mirror of
https://github.com/reactos/wine.git
synced 2024-11-28 22:20:26 +00:00
dinput8: DirectInput8Create rewrite.
This commit is contained in:
parent
31e3ad7150
commit
951f4657b7
@ -4,7 +4,7 @@ SRCDIR = @srcdir@
|
||||
VPATH = @srcdir@
|
||||
MODULE = dinput8.dll
|
||||
IMPORTLIB = libdinput8.$(IMPLIBEXT)
|
||||
IMPORTS = dinput kernel32
|
||||
IMPORTS = dinput ole32 advapi32 kernel32
|
||||
EXTRALIBS = -luuid -ldxguid
|
||||
|
||||
C_SRCS = \
|
||||
|
@ -51,8 +51,39 @@ static void UnlockModule(void)
|
||||
* DirectInput8Create (DINPUT8.@)
|
||||
*/
|
||||
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 */
|
||||
return DirectInputCreateEx(hinst, dwVersion, riid, ppDI, punkOuter);
|
||||
HRESULT hr;
|
||||
|
||||
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;
|
||||
|
||||
TRACE("(%p)->(%p,%s,%p)\n",This,pOuter,debugstr_guid(riid),ppobj);
|
||||
if( IsEqualGUID( &IID_IDirectInput8A, riid ) || IsEqualGUID( &IID_IDirectInput8W, riid ) ) {
|
||||
return DirectInput8Create(0, DIRECTINPUT_VERSION, riid, ppobj, pOuter);
|
||||
if( IsEqualGUID( &IID_IDirectInput8A, riid ) || IsEqualGUID( &IID_IDirectInput8W, riid ) || IsEqualGUID( &IID_IUnknown, riid )) {
|
||||
return DirectInputCreateEx(0, DIRECTINPUT_VERSION, riid, ppobj, pOuter);
|
||||
}
|
||||
|
||||
ERR("(%p,%p,%s,%p) Interface not found!\n",This,pOuter,debugstr_guid(riid),ppobj);
|
||||
|
@ -126,6 +126,9 @@ HKCR,AVIFile\Extensions\AVI,,,"{00020000-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\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\0\win16,,,"stdole.tlb"
|
||||
HKCR,TypeLib\{00020430-0000-0000-C000-000000000046}\1.0\0\win32,,,"stdole32.tlb"
|
||||
|
Loading…
Reference in New Issue
Block a user