dinput8: DirectInput8Create rewrite.

This commit is contained in:
Roderick Colenbrander 2006-07-20 12:42:23 +02:00 committed by Alexandre Julliard
parent 31e3ad7150
commit 951f4657b7
3 changed files with 39 additions and 5 deletions

View File

@ -4,7 +4,7 @@ SRCDIR = @srcdir@
VPATH = @srcdir@ VPATH = @srcdir@
MODULE = dinput8.dll MODULE = dinput8.dll
IMPORTLIB = libdinput8.$(IMPLIBEXT) IMPORTLIB = libdinput8.$(IMPLIBEXT)
IMPORTS = dinput kernel32 IMPORTS = dinput ole32 advapi32 kernel32
EXTRALIBS = -luuid -ldxguid EXTRALIBS = -luuid -ldxguid
C_SRCS = \ C_SRCS = \

View File

@ -51,8 +51,39 @@ static void UnlockModule(void)
* DirectInput8Create (DINPUT8.@) * DirectInput8Create (DINPUT8.@)
*/ */
HRESULT WINAPI DirectInput8Create(HINSTANCE hinst, DWORD dwVersion, REFIID riid, LPVOID *ppDI, LPUNKNOWN punkOuter) { HRESULT WINAPI DirectInput8Create(HINSTANCE hinst, DWORD dwVersion, REFIID riid, LPVOID *ppDI, LPUNKNOWN punkOuter) {
/* TODO: Create the interface using CoCreateInstance as that's what windows does too and check if the version number >= 0x800 */ HRESULT hr;
return DirectInputCreateEx(hinst, dwVersion, riid, ppDI, punkOuter);
TRACE("hInst (%p), dwVersion: %ld, riid (%s), punkOuter (%p))\n", hinst, dwVersion, debugstr_guid(riid), punkOuter);
/* The specified version needs to be dinput8 (0x800) or higher */
if(dwVersion < 0x800)
return DIERR_OLDDIRECTINPUTVERSION;
if( !(IsEqualGUID(&IID_IDirectInput8A, riid) || IsEqualGUID(&IID_IDirectInput8W, riid) || IsEqualGUID(&IID_IUnknown, riid)) )
return DIERR_INVALIDPARAM;
CoInitialize(NULL);
hr = CoCreateInstance( &CLSID_DirectInput8, punkOuter, CLSCTX_INPROC_SERVER, riid, ppDI);
if(FAILED(hr)) {
ERR("CoCreateInstance failed with hr = %ld\n", hr);
return DIERR_INVALIDPARAM;
}
CoUninitialize();
/* When aggregation is used (punkOuter!=NULL) the application needs to manually call Initialize. */
if(punkOuter == NULL && IsEqualGUID(&IID_IDirectInput8A, riid)) {
LPDIRECTINPUTA DI = (LPDIRECTINPUTA)*ppDI;
IDirectInput8_Initialize(DI, hinst, dwVersion);
}
if(punkOuter == NULL && IsEqualGUID(&IID_IDirectInput8W, riid)) {
LPDIRECTINPUTW DI = (LPDIRECTINPUTW)*ppDI;
IDirectInput8_Initialize(DI, hinst, dwVersion);
}
return S_OK;
} }
/******************************************************************************* /*******************************************************************************
@ -84,8 +115,8 @@ static HRESULT WINAPI DI8CF_CreateInstance(LPCLASSFACTORY iface,LPUNKNOWN pOuter
IClassFactoryImpl *This = (IClassFactoryImpl *)iface; IClassFactoryImpl *This = (IClassFactoryImpl *)iface;
TRACE("(%p)->(%p,%s,%p)\n",This,pOuter,debugstr_guid(riid),ppobj); TRACE("(%p)->(%p,%s,%p)\n",This,pOuter,debugstr_guid(riid),ppobj);
if( IsEqualGUID( &IID_IDirectInput8A, riid ) || IsEqualGUID( &IID_IDirectInput8W, riid ) ) { if( IsEqualGUID( &IID_IDirectInput8A, riid ) || IsEqualGUID( &IID_IDirectInput8W, riid ) || IsEqualGUID( &IID_IUnknown, riid )) {
return DirectInput8Create(0, DIRECTINPUT_VERSION, riid, ppobj, pOuter); return DirectInputCreateEx(0, DIRECTINPUT_VERSION, riid, ppobj, pOuter);
} }
ERR("(%p,%p,%s,%p) Interface not found!\n",This,pOuter,debugstr_guid(riid),ppobj); ERR("(%p,%p,%s,%p) Interface not found!\n",This,pOuter,debugstr_guid(riid),ppobj);

View File

@ -126,6 +126,9 @@ HKCR,AVIFile\Extensions\AVI,,,"{00020000-0000-0000-C000-000000000046}"
HKCR,AVIFile\Extensions\WAV,,,"{00020003-0000-0000-C000-000000000046}" HKCR,AVIFile\Extensions\WAV,,,"{00020003-0000-0000-C000-000000000046}"
HKCR,AVIFile\RIFFHandlers\AVI,,,"{00020000-0000-0000-C000-000000000046}" HKCR,AVIFile\RIFFHandlers\AVI,,,"{00020000-0000-0000-C000-000000000046}"
HKCR,AVIFile\RIFFHandlers\WAVE,,,"{00020003-0000-0000-C000-000000000046}" HKCR,AVIFile\RIFFHandlers\WAVE,,,"{00020003-0000-0000-C000-000000000046}"
HKCR,CLSID\{25E609E4-B259-11CF-BFC7-444553540000},,,"DirectInput8 Object"
HKCR,CLSID\{25E609E4-B259-11CF-BFC7-444553540000}\InProcServer32,,,"dinput8.dll"
HKCR,CLSID\{25E609E4-B259-11CF-BFC7-444553540000}\InProcServer32,ThreadingModel,,"Both"
HKCR,TypeLib\{00020430-0000-0000-C000-000000000046}\1.0,,,"OLE Automation" HKCR,TypeLib\{00020430-0000-0000-C000-000000000046}\1.0,,,"OLE Automation"
HKCR,TypeLib\{00020430-0000-0000-C000-000000000046}\1.0\0\win16,,,"stdole.tlb" HKCR,TypeLib\{00020430-0000-0000-C000-000000000046}\1.0\0\win16,,,"stdole.tlb"
HKCR,TypeLib\{00020430-0000-0000-C000-000000000046}\1.0\0\win32,,,"stdole32.tlb" HKCR,TypeLib\{00020430-0000-0000-C000-000000000046}\1.0\0\win32,,,"stdole32.tlb"