diff --git a/Release/.gitattributes b/Release/.gitattributes deleted file mode 100644 index b110a24..0000000 --- a/Release/.gitattributes +++ /dev/null @@ -1 +0,0 @@ -*.{dll,exe} filter=lfs diff=lfs merge=lfs -text \ No newline at end of file diff --git a/Release/dxwnd.dll b/Release/dxwnd.dll deleted file mode 100644 index 0bf9953..0000000 --- a/Release/dxwnd.dll +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:a515ee8d52505d5b62117e1931676f56d30edb24aa7c177da523ea480ca3ea56 -size 638464 diff --git a/Release/dxwnd.exe b/Release/dxwnd.exe deleted file mode 100644 index 6f72c4a..0000000 --- a/Release/dxwnd.exe +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:580769bb1fc0c1d0639a1b1dc00f874184b7c61269efcdd2644765d7de1e7442 -size 556032 diff --git a/build/dxwnd.0.ini b/build/dxwnd.0.ini index be2c649..dfdaf5d 100644 --- a/build/dxwnd.0.ini +++ b/build/dxwnd.0.ini @@ -27,5 +27,8 @@ fpstoggle= printscreen=0x7B corner=0x7A freezetime=0x79 +fullscreen=0x0D +workarea= +desktop= diff --git a/build/dxwnd.dll b/build/dxwnd.dll index 0bf9953..f2b647a 100644 --- a/build/dxwnd.dll +++ b/build/dxwnd.dll @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:a515ee8d52505d5b62117e1931676f56d30edb24aa7c177da523ea480ca3ea56 -size 638464 +oid sha256:c352a420894e9be21d4b1a04c665e7e463d533be4c54b70201c90db2702ef994 +size 643584 diff --git a/build/dxwnd.exe b/build/dxwnd.exe index 6f72c4a..66e542e 100644 --- a/build/dxwnd.exe +++ b/build/dxwnd.exe @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:580769bb1fc0c1d0639a1b1dc00f874184b7c61269efcdd2644765d7de1e7442 +oid sha256:b9bf619ccedb715b22ab6deee04a4182be6f76f31f702ac1e2ff1bb172447e49 size 556032 diff --git a/build/dxwnd.reg b/build/dxwnd.reg deleted file mode 100644 index ead38c6..0000000 --- a/build/dxwnd.reg +++ /dev/null @@ -1,14 +0,0 @@ -[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft] -[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Microsoft Games] -[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Microsoft Games\Golf '98] -[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Microsoft Games\Golf '98\Version 1.0 Demo] -"AppPath"="D:\\Games\\MSGolf98\\MSGOLF98" -"InstallType"="1" -"InstallPath"="D:\\Games\\MSGolf98\\MSGOLF98\\" -"CDPath"="D:\\Games\\MSGolf98\\MSGOLF98" -"Launched"="1" -"PID"="" -"Path"="D:\\Games\\MSGolf98\\MSGOLF98" -"VersionType"="TrialVersion" -"InstalledGroup"="1" -"LangID"=dword:00000009 diff --git a/build/exports/Gooka The Mystery of Janatris.dxw b/build/exports/Gooka The Mystery of Janatris.dxw new file mode 100644 index 0000000..46b87f8 --- /dev/null +++ b/build/exports/Gooka The Mystery of Janatris.dxw @@ -0,0 +1,29 @@ +[target] +title0=Gooka The Mystery of Janatris +path0=D:\Games\Gooka The Mystery of Janatris\Gooka\Gooka2.exe +launchpath0= +module0= +opengllib0= +notes0=Starforce protected: is working only with proper crack.\nThe game has a native windowed mode.\nTo use DxWnd configure it in fullscreen mode.\nSetting audio in 3D mode (in advanced game settings" may cause a game error \nafter the main menu at game starting! +registry0= +ver0=0 +coord0=0 +flag0=136315402 +flagg0=1207959552 +flagh0=20 +flagi0=4194308 +flagj0=4224 +flagk0=268500992 +flagl0=8 +flagm0=0 +tflag0=0 +posx0=50 +posy0=50 +sizx0=800 +sizy0=600 +maxfps0=0 +initts0=0 +winver0=0 +maxres0=-1 +swapeffect0=0 +maxddinterface0=7 diff --git a/build/proxy/d3d8.dll b/build/proxy/d3d8.dll index e61c304..ec3c3db 100644 --- a/build/proxy/d3d8.dll +++ b/build/proxy/d3d8.dll @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:5fbf64fa49a8d0a6b663bead76c6505fc15601989ad224c4c7c2a7362f7c7191 +oid sha256:6f84be0f5c6643d8c83967d60f343b4d1a61f278287206ee56fbcb2991001d34 size 54784 diff --git a/build/proxy/d3d9.dll b/build/proxy/d3d9.dll index 8448260..e83a734 100644 --- a/build/proxy/d3d9.dll +++ b/build/proxy/d3d9.dll @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:82e18e275a93264221b7c2d205192332d457d2d0cf44fa88400b3d288db3601c +oid sha256:b1e79093e9a141f7936c8c8cd27ac2dc36196683294a81f21e5f84a5f5fcc5e0 size 55808 diff --git a/build/proxy/ddraw.dll b/build/proxy/ddraw.dll index b43f5b7..22148b1 100644 --- a/build/proxy/ddraw.dll +++ b/build/proxy/ddraw.dll @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:8d0edf937b0e8cac90fa36c4281f78fb554a236c1da32a5d8b103211636839c6 -size 56832 +oid sha256:73324ad26838bc56f13cdcb1e23c1e122f9a6bb96cb3fdc3f13ad47f249ecb8e +size 56320 diff --git a/build/readme-relnotes.txt b/build/readme-relnotes.txt index 3b7678c..2cd24df 100644 --- a/build/readme-relnotes.txt +++ b/build/readme-relnotes.txt @@ -1076,4 +1076,10 @@ fix: preliminary d3d7 function pointers separation for different interfaces add: block process priority class add: autohide DxWnd feature fix: GUI kill process now kills the whole process tree to avoid leaving live processes around. Happens for instance in Win7 with rundll32.exe for compatibility in 64 bit environment, and that one uses a full core CPU! -fix: added CDS_UPDATEREGISTRY to the ChangeDisplaySettings modes to be neutralized. Needed in "Severance: Blade of Darkness". \ No newline at end of file +fix: added CDS_UPDATEREGISTRY to the ChangeDisplaySettings modes to be neutralized. Needed in "Severance: Blade of Darkness". + +v2.03.62 +fix: flag "Intercept Alt-F4 key" now working also alone with no need to set "Enable hot keys" +fix: file open dialogs initialization on WinXP platform +fix: hooked ANSI & WIDECHAR version of DirectInput8Create: makes "Gooka the Mystery of Janatris" working. +fix: rebuild up-to-date dxwnd proxies diff --git a/dll/dinput.cpp b/dll/dinput.cpp index c057841..2f2d3c6 100644 --- a/dll/dinput.cpp +++ b/dll/dinput.cpp @@ -20,47 +20,89 @@ extern BOOL WINAPI extGetCursorPos(LPPOINT); +/* +DEFINE_GUID(IID_IDirectInputA, 0x89521360,0xAA8A,0x11CF,0xBF,0xC7,0x44,0x45,0x53,0x54,0x00,0x00); +DEFINE_GUID(IID_IDirectInputW, 0x89521361,0xAA8A,0x11CF,0xBF,0xC7,0x44,0x45,0x53,0x54,0x00,0x00); +DEFINE_GUID(IID_IDirectInput2A, 0x5944E662,0xAA8A,0x11CF,0xBF,0xC7,0x44,0x45,0x53,0x54,0x00,0x00); +DEFINE_GUID(IID_IDirectInput2W, 0x5944E663,0xAA8A,0x11CF,0xBF,0xC7,0x44,0x45,0x53,0x54,0x00,0x00); +DEFINE_GUID(IID_IDirectInput7A, 0x9A4CB684,0x236D,0x11D3,0x8E,0x9D,0x00,0xC0,0x4F,0x68,0x44,0xAE); +DEFINE_GUID(IID_IDirectInput7W, 0x9A4CB685,0x236D,0x11D3,0x8E,0x9D,0x00,0xC0,0x4F,0x68,0x44,0xAE); +DEFINE_GUID(IID_IDirectInput8A, 0xBF798030,0x483A,0x4DA2,0xAA,0x99,0x5D,0x64,0xED,0x36,0x97,0x00); +DEFINE_GUID(IID_IDirectInput8W, 0xBF798031,0x483A,0x4DA2,0xAA,0x99,0x5D,0x64,0xED,0x36,0x97,0x00); +DEFINE_GUID(IID_IDirectInputDeviceA, 0x5944E680,0xC92E,0x11CF,0xBF,0xC7,0x44,0x45,0x53,0x54,0x00,0x00); +DEFINE_GUID(IID_IDirectInputDeviceW, 0x5944E681,0xC92E,0x11CF,0xBF,0xC7,0x44,0x45,0x53,0x54,0x00,0x00); +DEFINE_GUID(IID_IDirectInputDevice2A,0x5944E682,0xC92E,0x11CF,0xBF,0xC7,0x44,0x45,0x53,0x54,0x00,0x00); +DEFINE_GUID(IID_IDirectInputDevice2W,0x5944E683,0xC92E,0x11CF,0xBF,0xC7,0x44,0x45,0x53,0x54,0x00,0x00); +DEFINE_GUID(IID_IDirectInputDevice7A,0x57D7C6BC,0x2356,0x11D3,0x8E,0x9D,0x00,0xC0,0x4F,0x68,0x44,0xAE); +DEFINE_GUID(IID_IDirectInputDevice7W,0x57D7C6BD,0x2356,0x11D3,0x8E,0x9D,0x00,0xC0,0x4F,0x68,0x44,0xAE); +DEFINE_GUID(IID_IDirectInputDevice8A,0x54D41080,0xDC15,0x4833,0xA4,0x1B,0x74,0x8F,0x73,0xA3,0x81,0x79); +DEFINE_GUID(IID_IDirectInputDevice8W,0x54D41081,0xDC15,0x4833,0xA4,0x1B,0x74,0x8F,0x73,0xA3,0x81,0x79); +DEFINE_GUID(IID_IDirectInputEffect, 0xE7E1F7C0,0x88D2,0x11D0,0x9A,0xD0,0x00,0xA0,0xC9,0xA0,0x6E,0x35); +*/ + typedef HRESULT (WINAPI *QueryInterface_Type)(void *, REFIID, LPVOID *); -typedef HRESULT (WINAPI *DirectInputCreate_Type)(HINSTANCE, DWORD, LPDIRECTINPUT *, LPUNKNOWN); +typedef HRESULT (WINAPI *DirectInputCreateA_Type)(HINSTANCE, DWORD, LPDIRECTINPUTA *, LPUNKNOWN); +typedef HRESULT (WINAPI *DirectInputCreateW_Type)(HINSTANCE, DWORD, LPDIRECTINPUTW *, LPUNKNOWN); typedef HRESULT (WINAPI *DirectInputCreateEx_Type)(HINSTANCE, DWORD, REFIID, LPVOID *, LPUNKNOWN); -typedef HRESULT (WINAPI *DICreateDevice_Type)(LPDIRECTINPUT, REFGUID, LPDIRECTINPUTDEVICE *, LPUNKNOWN); +typedef HRESULT (WINAPI *DICreateDeviceA_Type)(LPDIRECTINPUTA, REFGUID, LPDIRECTINPUTDEVICEA *, LPUNKNOWN); +typedef HRESULT (WINAPI *DICreateDeviceW_Type)(LPDIRECTINPUTW, REFGUID, LPDIRECTINPUTDEVICEW *, LPUNKNOWN); typedef HRESULT (WINAPI *DICreateDeviceEx_Type)(LPDIRECTINPUT, REFGUID, REFIID, LPVOID *, LPUNKNOWN); typedef HRESULT (WINAPI *GetDeviceData_Type)(LPDIRECTINPUTDEVICE, DWORD, LPVOID, LPDWORD, DWORD); typedef HRESULT (WINAPI *GetDeviceState_Type)(LPDIRECTINPUTDEVICE, DWORD, LPDIMOUSESTATE); typedef HRESULT (WINAPI *DISetCooperativeLevel_Type)(LPDIRECTINPUTDEVICE, HWND, DWORD); typedef HRESULT (WINAPI *SetDataFormat_Type)(LPDIRECTINPUTDEVICE, LPCDIDATAFORMAT); -typedef HRESULT (WINAPI *DIEnumDevices_Type)(void *, DWORD, LPDIENUMDEVICESCALLBACK, LPVOID, DWORD); +typedef HRESULT (WINAPI *DIEnumDevicesA_Type)(void *, DWORD, LPDIENUMDEVICESCALLBACKA, LPVOID, DWORD); +typedef HRESULT (WINAPI *DIEnumDevicesW_Type)(void *, DWORD, LPDIENUMDEVICESCALLBACKW, LPVOID, DWORD); typedef HRESULT (WINAPI *Acquire_Type)(LPDIRECTINPUTDEVICE); typedef HRESULT (WINAPI *Unacquire_Type)(LPDIRECTINPUTDEVICE); typedef HRESULT (WINAPI *DirectInput8Create_Type)(HINSTANCE, DWORD, REFIID, LPVOID *, LPUNKNOWN); - -HRESULT WINAPI extDirectInputCreateA(HINSTANCE, DWORD, LPDIRECTINPUT *, LPUNKNOWN); -HRESULT WINAPI extDirectInputCreateW(HINSTANCE, DWORD, LPDIRECTINPUT *, LPUNKNOWN); -HRESULT WINAPI extDirectInputCreateEx(HINSTANCE, DWORD, REFIID, LPVOID *, LPUNKNOWN); + +HRESULT WINAPI extDirectInputCreateA(HINSTANCE, DWORD, LPDIRECTINPUTA *, LPUNKNOWN); +HRESULT WINAPI extDirectInputCreateW(HINSTANCE, DWORD, LPDIRECTINPUTW *, LPUNKNOWN); +HRESULT WINAPI extDirectInputCreateExA(HINSTANCE, DWORD, REFIID, LPVOID *, LPUNKNOWN); +HRESULT WINAPI extDirectInputCreateExW(HINSTANCE, DWORD, REFIID, LPVOID *, LPUNKNOWN); HRESULT WINAPI extDirectInput8Create(HINSTANCE, DWORD, REFIID, LPVOID *, LPUNKNOWN); -HRESULT WINAPI extDICreateDevice(LPDIRECTINPUT, REFGUID, LPDIRECTINPUTDEVICE *, LPUNKNOWN); -HRESULT WINAPI extDICreateDeviceEx(LPDIRECTINPUT, REFGUID, REFIID, LPVOID *, LPUNKNOWN); +HRESULT WINAPI extDICreateDeviceA1(LPDIRECTINPUTA, REFGUID, LPDIRECTINPUTDEVICEA *, LPUNKNOWN); +HRESULT WINAPI extDICreateDeviceA2(LPDIRECTINPUTA, REFGUID, LPDIRECTINPUTDEVICEA *, LPUNKNOWN); +HRESULT WINAPI extDICreateDeviceA7(LPDIRECTINPUTA, REFGUID, LPDIRECTINPUTDEVICEA *, LPUNKNOWN); +HRESULT WINAPI extDICreateDeviceA8(LPDIRECTINPUTA, REFGUID, LPDIRECTINPUTDEVICEA *, LPUNKNOWN); +HRESULT WINAPI extDICreateDeviceW1(LPDIRECTINPUTW, REFGUID, LPDIRECTINPUTDEVICEW *, LPUNKNOWN); +HRESULT WINAPI extDICreateDeviceW2(LPDIRECTINPUTW, REFGUID, LPDIRECTINPUTDEVICEW *, LPUNKNOWN); +HRESULT WINAPI extDICreateDeviceW7(LPDIRECTINPUTW, REFGUID, LPDIRECTINPUTDEVICEW *, LPUNKNOWN); +HRESULT WINAPI extDICreateDeviceW8(LPDIRECTINPUTW, REFGUID, LPDIRECTINPUTDEVICEW *, LPUNKNOWN); +HRESULT WINAPI extDICreateDeviceExA(LPDIRECTINPUTA, REFGUID, REFIID, LPVOID *, LPUNKNOWN); +HRESULT WINAPI extDICreateDeviceExW(LPDIRECTINPUTW, REFGUID, REFIID, LPVOID *, LPUNKNOWN); HRESULT WINAPI extGetDeviceData(LPDIRECTINPUTDEVICE, DWORD, LPVOID, LPDWORD, DWORD); HRESULT WINAPI extGetDeviceState(LPDIRECTINPUTDEVICE, DWORD, LPDIMOUSESTATE); HRESULT WINAPI extDISetCooperativeLevel(LPDIRECTINPUTDEVICE, HWND, DWORD); HRESULT WINAPI extSetDataFormat(LPDIRECTINPUTDEVICE, LPCDIDATAFORMAT); HRESULT WINAPI extDIQueryInterface(void *, REFIID, LPVOID *); -HRESULT WINAPI extDIEnumDevices(void *, DWORD, LPDIENUMDEVICESCALLBACK, LPVOID, DWORD); +HRESULT WINAPI extDIEnumDevicesA1(void *, DWORD, LPDIENUMDEVICESCALLBACKA, LPVOID, DWORD); +HRESULT WINAPI extDIEnumDevicesA2(void *, DWORD, LPDIENUMDEVICESCALLBACKA, LPVOID, DWORD); +HRESULT WINAPI extDIEnumDevicesA7(void *, DWORD, LPDIENUMDEVICESCALLBACKA, LPVOID, DWORD); +HRESULT WINAPI extDIEnumDevicesA8(void *, DWORD, LPDIENUMDEVICESCALLBACKA, LPVOID, DWORD); +HRESULT WINAPI extDIEnumDevicesW1(void *, DWORD, LPDIENUMDEVICESCALLBACKW, LPVOID, DWORD); +HRESULT WINAPI extDIEnumDevicesW2(void *, DWORD, LPDIENUMDEVICESCALLBACKW, LPVOID, DWORD); +HRESULT WINAPI extDIEnumDevicesW7(void *, DWORD, LPDIENUMDEVICESCALLBACKW, LPVOID, DWORD); +HRESULT WINAPI extDIEnumDevicesW8(void *, DWORD, LPDIENUMDEVICESCALLBACKW, LPVOID, DWORD); HRESULT WINAPI extAcquire(LPDIRECTINPUTDEVICE); HRESULT WINAPI extUnacquire(LPDIRECTINPUTDEVICE); HRESULT WINAPI extDirectInput8Create(HINSTANCE, DWORD, REFIID, LPVOID *, LPUNKNOWN); -DirectInputCreate_Type pDirectInputCreateA = NULL; -DirectInputCreate_Type pDirectInputCreateW = NULL; -DirectInputCreateEx_Type pDirectInputCreateEx = NULL; -DICreateDevice_Type pDICreateDevice = NULL; -DICreateDeviceEx_Type pDICreateDeviceEx = NULL; +DirectInputCreateA_Type pDirectInputCreateA = NULL; +DirectInputCreateW_Type pDirectInputCreateW = NULL; +DirectInputCreateEx_Type pDirectInputCreateExA, pDirectInputCreateExW; +DICreateDeviceA_Type pDICreateDeviceA1, pDICreateDeviceA2, pDICreateDeviceA7, pDICreateDeviceA8; +DICreateDeviceW_Type pDICreateDeviceW1, pDICreateDeviceW2, pDICreateDeviceW7, pDICreateDeviceW8; +DICreateDeviceEx_Type pDICreateDeviceExA, pDICreateDeviceExW; +//DICreateDeviceEx_Type pDICreateDeviceEx; GetDeviceData_Type pGetDeviceData = NULL; GetDeviceState_Type pGetDeviceState = NULL; DISetCooperativeLevel_Type pDISetCooperativeLevel = NULL; SetDataFormat_Type pSetDataFormat = NULL; QueryInterface_Type pDIQueryInterface = NULL; -DIEnumDevices_Type pDIEnumDevices = NULL; +DIEnumDevicesA_Type pDIEnumDevicesA1, pDIEnumDevicesA2, pDIEnumDevicesA7, pDIEnumDevicesA8; +DIEnumDevicesW_Type pDIEnumDevicesW1, pDIEnumDevicesW2, pDIEnumDevicesW7, pDIEnumDevicesW8; Acquire_Type pAcquire = NULL; Unacquire_Type pUnacquire = NULL; DirectInput8Create_Type pDirectInput8Create = NULL; @@ -68,7 +110,7 @@ DirectInput8Create_Type pDirectInput8Create = NULL; static HookEntryEx_Type diHooks[]={ {HOOK_HOT_CANDIDATE, 0, "DirectInputCreateA", (FARPROC)NULL, (FARPROC *)&pDirectInputCreateA, (FARPROC)extDirectInputCreateA}, {HOOK_HOT_CANDIDATE, 0, "DirectInputCreateW", (FARPROC)NULL, (FARPROC *)&pDirectInputCreateW, (FARPROC)extDirectInputCreateW}, - {HOOK_HOT_CANDIDATE, 0, "DirectInputCreateEx", (FARPROC)NULL, (FARPROC *)&pDirectInputCreateEx, (FARPROC)extDirectInputCreateEx}, + {HOOK_HOT_CANDIDATE, 0, "DirectInputCreateExA", (FARPROC)NULL, (FARPROC *)&pDirectInputCreateExA, (FARPROC)extDirectInputCreateExA}, {HOOK_IAT_CANDIDATE, 0, 0, NULL, 0, 0} // terminator }; @@ -115,15 +157,15 @@ void HookDirectInput(HMODULE module) LPDIRECTINPUT lpdi; HookLibraryEx(module, diHooks, "dinput.dll"); - if(!pDirectInputCreateA && !pDirectInputCreateW && !pDirectInputCreateEx){ + if(!pDirectInputCreateA && !pDirectInputCreateW && !pDirectInputCreateExA){ hinst = LoadLibrary("dinput.dll"); - pDirectInputCreateA = (DirectInputCreate_Type)GetProcAddress(hinst, "DirectInputCreateA"); + pDirectInputCreateA = (DirectInputCreateA_Type)GetProcAddress(hinst, "DirectInputCreateA"); if(pDirectInputCreateA) if(!extDirectInputCreateA(GetModuleHandle(0), DIRECTINPUT_VERSION, &lpdi, 0)) lpdi->Release(); - pDirectInputCreateEx = (DirectInputCreateEx_Type)GetProcAddress(hinst, "DirectInputCreateEx"); - if(pDirectInputCreateEx) - if(!extDirectInputCreateEx(GetModuleHandle(0), DIRECTINPUT_VERSION, + pDirectInputCreateExA = (DirectInputCreateEx_Type)GetProcAddress(hinst, "DirectInputCreateEx"); + if(pDirectInputCreateExA) + if(!extDirectInputCreateExA(GetModuleHandle(0), DIRECTINPUT_VERSION, di7, (void **)&lpdi, 0)) lpdi->Release(); } } @@ -158,50 +200,75 @@ FARPROC Remap_DInput8_ProcAddress(LPCSTR proc, HMODULE hModule) return NULL; } -HRESULT WINAPI extDirectInputCreate(HINSTANCE hinst, - DWORD dwversion, LPDIRECTINPUT *lplpdi, LPUNKNOWN pu, DirectInputCreate_Type pDirectInputCreate, char *apiname) +HRESULT WINAPI extDirectInputCreateA(HINSTANCE hinst, DWORD dwversion, LPDIRECTINPUT *lplpdi, LPUNKNOWN pu) { HRESULT res; - OutTraceDW("%s: dwVersion=%x\n", apiname, dwversion); + OutTraceDW("DirectInputCreateA: version=%x\n", dwversion); - res = (*pDirectInputCreate)(hinst, dwversion, lplpdi, pu); + res = (*pDirectInputCreateA)(hinst, dwversion, lplpdi, pu); if(res) { - OutTraceE("%s: ERROR err=%x(%s)\n", apiname, res, ExplainDDError(res)); + OutTraceE("DirectInputCreateA: ERROR err=%x(%s)\n", res, ExplainDDError(res)); return res; } SetHook((void *)(**(DWORD **)lplpdi), extDIQueryInterface, (void **)&pDIQueryInterface, "QueryInterface(I)"); - SetHook((void *)(**(DWORD **)lplpdi + 12), extDICreateDevice, (void **)&pDICreateDevice, "CreateDevice(I)"); - SetHook((void *)(**(DWORD **)lplpdi + 16), extDIEnumDevices, (void **)&pDIEnumDevices, "EnumDevices(I)"); + SetHook((void *)(**(DWORD **)lplpdi + 12), extDICreateDeviceA1, (void **)&pDICreateDeviceA1, "CreateDevice(I)"); + SetHook((void *)(**(DWORD **)lplpdi + 16), extDIEnumDevicesA1, (void **)&pDIEnumDevicesA1, "EnumDevices(I)"); return 0; } -HRESULT WINAPI extDirectInputCreateA(HINSTANCE hinst, DWORD dwversion, LPDIRECTINPUT *lplpdi, LPUNKNOWN pu) -{ - return extDirectInputCreate(hinst, dwversion, lplpdi, pu, pDirectInputCreateA, "DirectInputCreateA"); -} - -HRESULT WINAPI extDirectInputCreateW(HINSTANCE hinst, DWORD dwversion, LPDIRECTINPUT *lplpdi, LPUNKNOWN pu) -{ - return extDirectInputCreate(hinst, dwversion, lplpdi, pu, pDirectInputCreateW, "DirectInputCreateW"); -} - -HRESULT WINAPI extDirectInputCreateEx(HINSTANCE hinst, DWORD dwversion, REFIID riidltf, LPVOID *ppvout, LPUNKNOWN pu) +HRESULT WINAPI extDirectInputCreateW(HINSTANCE hinst, DWORD dwversion, LPDIRECTINPUTW *lplpdi, LPUNKNOWN pu) { HRESULT res; - OutTraceDW("DirectInputCreateEx: dwVersion=%x REFIID=%x\n", - dwversion, riidltf.Data1); + OutTraceDW("DirectInputCreateW: version=%x\n", dwversion); - res = (*pDirectInputCreateEx)(hinst, dwversion, riidltf, ppvout, pu); + res = (*pDirectInputCreateW)(hinst, dwversion, lplpdi, pu); if(res) { - OutTraceE("DirectInputCreateEx: ERROR err=%x(%s)\n", res, ExplainDDError(res)); + OutTraceE("DirectInputCreateW: ERROR err=%x(%s)\n", res, ExplainDDError(res)); return res; } - SetHook((void *)(**(DWORD **)ppvout + 12), extDICreateDevice, (void **)&pDICreateDevice, "CreateDevice(I7)"); - SetHook((void *)(**(DWORD **)ppvout + 16), extDIEnumDevices, (void **)&pDIEnumDevices, "EnumDevices(I7)"); + SetHook((void *)(**(DWORD **)lplpdi), extDIQueryInterface, (void **)&pDIQueryInterface, "QueryInterface(I)"); + SetHook((void *)(**(DWORD **)lplpdi + 12), extDICreateDeviceW1, (void **)&pDICreateDeviceW1, "CreateDevice(IW1)"); + SetHook((void *)(**(DWORD **)lplpdi + 16), extDIEnumDevicesW1, (void **)&pDIEnumDevicesW1, "EnumDevices(IW1)"); + return 0; +} + +HRESULT WINAPI extDirectInputCreateExA(HINSTANCE hinst, DWORD dwversion, REFIID riidltf, LPVOID *ppvout, LPUNKNOWN pu) +{ + HRESULT res; + + OutTraceDW("DirectInputCreateExA: dwVersion=%x REFIID=%x\n", + dwversion, riidltf.Data1); + + res = (*pDirectInputCreateExA)(hinst, dwversion, riidltf, ppvout, pu); + if(res) { + OutTraceE("DirectInputCreateExA: ERROR err=%x(%s)\n", res, ExplainDDError(res)); + return res; + } + SetHook((void *)(**(DWORD **)ppvout + 12), extDICreateDeviceA7, (void **)&pDICreateDeviceA7, "CreateDevice(IA7)"); + SetHook((void *)(**(DWORD **)ppvout + 16), extDIEnumDevicesA7, (void **)&pDIEnumDevicesA7, "EnumDevices(IA7)"); if(dwversion >= 700) - SetHook((void *)(**(DWORD **)ppvout + 36), extDICreateDeviceEx, (void **)&pDICreateDeviceEx, "CreateDeviceEx(I7)"); + SetHook((void *)(**(DWORD **)ppvout + 36), extDICreateDeviceExA, (void **)&pDICreateDeviceExA, "CreateDeviceEx(IA7)"); + return 0; +} + +HRESULT WINAPI extDirectInputCreateExW(HINSTANCE hinst, DWORD dwversion, REFIID riidltf, LPVOID *ppvout, LPUNKNOWN pu) +{ + HRESULT res; + + OutTraceDW("DirectInputCreateExW: dwVersion=%x REFIID=%x\n", + dwversion, riidltf.Data1); + + res = (*pDirectInputCreateExW)(hinst, dwversion, riidltf, ppvout, pu); + if(res) { + OutTraceE("DirectInputCreateExW: ERROR err=%x(%s)\n", res, ExplainDDError(res)); + return res; + } + SetHook((void *)(**(DWORD **)ppvout + 12), extDICreateDeviceW7, (void **)&pDICreateDeviceA7, "CreateDevice(IA7)"); + SetHook((void *)(**(DWORD **)ppvout + 16), extDIEnumDevicesW7, (void **)&pDIEnumDevicesA7, "EnumDevices(IA7)"); + if(dwversion >= 700) + SetHook((void *)(**(DWORD **)ppvout + 36), extDICreateDeviceExW, (void **)&pDICreateDeviceExA, "CreateDeviceEx(IA7)"); return 0; } @@ -217,20 +284,29 @@ HRESULT WINAPI extDIQueryInterface(void * lpdi, REFIID riid, LPVOID *obp) switch(riid.Data1){ case 0x89521360: //DirectInputA + SetHook((void *)(**(DWORD **)obp + 12), extDICreateDeviceA1, (void **)&pDICreateDeviceA1, "CreateDevice(IA1)"); + SetHook((void *)(**(DWORD **)obp + 16), extDIEnumDevicesA1, (void **)&pDIEnumDevicesA1, "EnumDevices(IA1)"); + break; case 0x89521361: //DirectInputW - SetHook((void *)(**(DWORD **)obp + 12), extDICreateDevice, (void **)&pDICreateDevice, "CreateDevice(I)"); - SetHook((void *)(**(DWORD **)obp + 16), extDIEnumDevices, (void **)&pDIEnumDevices, "EnumDevices(I)"); + SetHook((void *)(**(DWORD **)obp + 12), extDICreateDeviceW1, (void **)&pDICreateDeviceW1, "CreateDevice(IW1)"); + SetHook((void *)(**(DWORD **)obp + 16), extDIEnumDevicesW1, (void **)&pDIEnumDevicesW1, "EnumDevices(IW1)"); break; case 0x5944E662: //DirectInput2A + SetHook((void *)(**(DWORD **)obp + 12), extDICreateDeviceA2, (void **)&pDICreateDeviceA2, "CreateDevice(IA2)"); + SetHook((void *)(**(DWORD **)obp + 16), extDIEnumDevicesA2, (void **)&pDIEnumDevicesA2, "EnumDevices(IA2)"); + break; case 0x5944E663: //DirectInput2W - SetHook((void *)(**(DWORD **)obp + 12), extDICreateDevice, (void **)&pDICreateDevice, "CreateDevice(I2)"); - SetHook((void *)(**(DWORD **)obp + 16), extDIEnumDevices, (void **)&pDIEnumDevices, "EnumDevices(I2)"); + SetHook((void *)(**(DWORD **)obp + 12), extDICreateDeviceW2, (void **)&pDICreateDeviceW2, "CreateDevice(IW2)"); + SetHook((void *)(**(DWORD **)obp + 16), extDIEnumDevicesW2, (void **)&pDIEnumDevicesW2, "EnumDevices(IW2)"); break; case 0x9A4CB684: //IDirectInput7A + SetHook((void *)(**(DWORD **)obp + 12), extDICreateDeviceA7, (void **)&pDICreateDeviceA7, "CreateDevice(IA7)"); + SetHook((void *)(**(DWORD **)obp + 16), extDIEnumDevicesA7, (void **)&pDIEnumDevicesA7, "EnumDevices(IA7)"); + SetHook((void *)(**(DWORD **)obp + 36), extDICreateDeviceExA, (void **)&pDICreateDeviceExA, "CreateDeviceEx(IA7)"); case 0x9A4CB685: //IDirectInput7W - SetHook((void *)(**(DWORD **)obp + 12), extDICreateDevice, (void **)&pDICreateDevice, "CreateDevice(I7)"); - SetHook((void *)(**(DWORD **)obp + 16), extDIEnumDevices, (void **)&pDIEnumDevices, "EnumDevices(I7)"); - SetHook((void *)(**(DWORD **)obp + 36), extDICreateDeviceEx, (void **)&pDICreateDeviceEx, "CreateDeviceEx(I7)"); + SetHook((void *)(**(DWORD **)obp + 12), extDICreateDeviceW7, (void **)&pDICreateDeviceW7, "CreateDevice(IW7)"); + SetHook((void *)(**(DWORD **)obp + 16), extDIEnumDevicesW7, (void **)&pDIEnumDevicesW7, "EnumDevices(IW7)"); + SetHook((void *)(**(DWORD **)obp + 36), extDICreateDeviceExW, (void **)&pDICreateDeviceExW, "CreateDeviceEx(IW7)"); break; } return 0; @@ -243,15 +319,22 @@ HRESULT WINAPI extDirectInput8Create(HINSTANCE hinst, DWORD dwversion, REFIID ri OutTraceDW("DirectInput8Create: dwVersion=%x REFIID=%x\n", dwversion, riidltf.Data1); - //res = (*pDirectInputCreateEx)(hinst, dwversion, riidltf, ppvout, pu); res = (*pDirectInput8Create)(hinst, dwversion, riidltf, ppvout, pu); if(res) { OutTraceE("DirectInput8Create: ERROR res=%x\n", res); return res; } OutTraceDW("DirectInput8Create: di=%x\n", *ppvout); - SetHook((void *)(**(DWORD **)ppvout + 12), extDICreateDevice, (void **)&pDICreateDevice, "CreateDevice(I8)"); - SetHook((void *)(**(DWORD **)ppvout + 16), extDIEnumDevices, (void **)&pDIEnumDevices, "EnumDevices(I8)"); + switch(riidltf.Data1){ + case 0xBF798030: + SetHook((void *)(**(DWORD **)ppvout + 12), extDICreateDeviceA8, (void **)&pDICreateDeviceA8, "CreateDevice(IA8)"); + SetHook((void *)(**(DWORD **)ppvout + 16), extDIEnumDevicesA8, (void **)&pDIEnumDevicesA8, "EnumDevices(IA8)"); + break; + case 0xBF798031: + SetHook((void *)(**(DWORD **)ppvout + 12), extDICreateDeviceW8, (void **)&pDICreateDeviceW8, "CreateDevice(IW8)"); + SetHook((void *)(**(DWORD **)ppvout + 16), extDIEnumDevicesW8, (void **)&pDIEnumDevicesW8, "EnumDevices(IW8)"); + break; + } return 0; } @@ -283,15 +366,15 @@ static int iDeviceType(REFGUID rguid) return devtype; } -HRESULT WINAPI extDICreateDevice(LPDIRECTINPUT lpdi, REFGUID rguid, LPDIRECTINPUTDEVICE *lplpdid, LPUNKNOWN pu) +HRESULT WINAPI extDICreateDeviceA(DICreateDeviceA_Type pDICreateDevice, LPDIRECTINPUT lpdi, REFGUID rguid, LPDIRECTINPUTDEVICEA *lplpdid, LPUNKNOWN pu) { HRESULT res; - OutTraceDW("CreateDevice(I): REFGUID=%x(%s)\n", rguid.Data1, sDeviceType(rguid)); + OutTraceDW("CreateDeviceA(I): REFGUID=%x(%s)\n", rguid.Data1, sDeviceType(rguid)); res = (*pDICreateDevice)(lpdi, rguid, lplpdid, pu); if(res) { - OutTraceE("CreateDevice(I): ERROR res=%x\n", res); + OutTraceE("CreateDeviceA(I): ERROR res=%x\n", res); return res; } @@ -312,6 +395,53 @@ HRESULT WINAPI extDICreateDevice(LPDIRECTINPUT lpdi, REFGUID rguid, LPDIRECTINPU return DI_OK; } +HRESULT WINAPI extDICreateDeviceA1(LPDIRECTINPUT lpdi, REFGUID rguid, LPDIRECTINPUTDEVICEA *lplpdid, LPUNKNOWN pu) +{ return extDICreateDeviceA(pDICreateDeviceA1, lpdi, rguid, lplpdid, pu); } +HRESULT WINAPI extDICreateDeviceA2(LPDIRECTINPUT lpdi, REFGUID rguid, LPDIRECTINPUTDEVICEA *lplpdid, LPUNKNOWN pu) +{ return extDICreateDeviceA(pDICreateDeviceA2, lpdi, rguid, lplpdid, pu); } +HRESULT WINAPI extDICreateDeviceA7(LPDIRECTINPUT lpdi, REFGUID rguid, LPDIRECTINPUTDEVICEA *lplpdid, LPUNKNOWN pu) +{ return extDICreateDeviceA(pDICreateDeviceA7, lpdi, rguid, lplpdid, pu); } +HRESULT WINAPI extDICreateDeviceA8(LPDIRECTINPUT lpdi, REFGUID rguid, LPDIRECTINPUTDEVICEA *lplpdid, LPUNKNOWN pu) +{ return extDICreateDeviceA(pDICreateDeviceA8, lpdi, rguid, lplpdid, pu); } + +HRESULT WINAPI extDICreateDeviceW(DICreateDeviceW_Type pDICreateDevice, LPDIRECTINPUTW lpdi, REFGUID rguid, LPDIRECTINPUTDEVICEW *lplpdid, LPUNKNOWN pu) +{ + HRESULT res; + + OutTraceDW("CreateDeviceW(I): REFGUID=%x(%s)\n", rguid.Data1, sDeviceType(rguid)); + + res = (*pDICreateDevice)(lpdi, rguid, lplpdid, pu); + if(res) { + OutTraceE("CreateDeviceW(I): ERROR res=%x\n", res); + return res; + } + + OutTraceDW("CreateDevice(I): did=%x\n", *lplpdid); + SetHook((void *)(**(DWORD **)lplpdid + 28), extAcquire, (void **)&pAcquire, "Acquire(I)"); + SetHook((void *)(**(DWORD **)lplpdid + 32), extUnacquire, (void **)&pUnacquire, "Unacquire(I)"); + SetHook((void *)(**(DWORD **)lplpdid + 36), extGetDeviceState, (void **)&pGetDeviceState, "GetDeviceState(I)"); + SetHook((void *)(**(DWORD **)lplpdid + 40), extGetDeviceData, (void **)&pGetDeviceData, "GetDeviceData(I)"); + SetHook((void *)(**(DWORD **)lplpdid + 44), extSetDataFormat, (void **)&pSetDataFormat, "SetDataFormat(I)"); + SetHook((void *)(**(DWORD **)lplpdid + 52), extDISetCooperativeLevel, (void **)&pDISetCooperativeLevel, "SetCooperativeLevel(I)"); + + switch(iDeviceType(rguid)){ + case DIDEVTYPE_DEVICE: lpDIDDevice = (LPDIRECTINPUTDEVICE)*lplpdid; break; + case DIDEVTYPE_MOUSE: lpDIDSysMouse = (LPDIRECTINPUTDEVICE)*lplpdid; break; + case DIDEVTYPE_KEYBOARD: lpDIDKeyboard = (LPDIRECTINPUTDEVICE)*lplpdid; break; + case DIDEVTYPE_JOYSTICK: lpDIDJoystick = (LPDIRECTINPUTDEVICE)*lplpdid; break; + } + return DI_OK; +} + +HRESULT WINAPI extDICreateDeviceW1(LPDIRECTINPUTW lpdi, REFGUID rguid, LPDIRECTINPUTDEVICEW *lplpdid, LPUNKNOWN pu) +{ return extDICreateDeviceW(pDICreateDeviceW1, lpdi, rguid, lplpdid, pu); } +HRESULT WINAPI extDICreateDeviceW2(LPDIRECTINPUTW lpdi, REFGUID rguid, LPDIRECTINPUTDEVICEW *lplpdid, LPUNKNOWN pu) +{ return extDICreateDeviceW(pDICreateDeviceW2, lpdi, rguid, lplpdid, pu); } +HRESULT WINAPI extDICreateDeviceW7(LPDIRECTINPUTW lpdi, REFGUID rguid, LPDIRECTINPUTDEVICEW *lplpdid, LPUNKNOWN pu) +{ return extDICreateDeviceW(pDICreateDeviceW7, lpdi, rguid, lplpdid, pu); } +HRESULT WINAPI extDICreateDeviceW8(LPDIRECTINPUTW lpdi, REFGUID rguid, LPDIRECTINPUTDEVICEW *lplpdid, LPUNKNOWN pu) +{ return extDICreateDeviceW(pDICreateDeviceW8, lpdi, rguid, lplpdid, pu); } + HRESULT WINAPI extDICreateDeviceEx(LPDIRECTINPUT lpdi, REFGUID rguid, REFIID riid, LPVOID *pvout, LPUNKNOWN pu) { @@ -319,7 +449,7 @@ HRESULT WINAPI extDICreateDeviceEx(LPDIRECTINPUT lpdi, REFGUID rguid, OutTraceDW("CreateDeviceEx(I): GUID=%x(%s) REFIID=%x\n", rguid.Data1, sDeviceType(rguid), riid.Data1); - res = (*pDICreateDeviceEx)(lpdi, rguid, riid, pvout, pu); + res = (*pDICreateDeviceExA)(lpdi, rguid, riid, pvout, pu); if(res) { OutTraceE("CreateDeviceEx(I): ERROR res=%x\n", res); return res; @@ -341,6 +471,13 @@ HRESULT WINAPI extDICreateDeviceEx(LPDIRECTINPUT lpdi, REFGUID rguid, return DI_OK; } +// to do +HRESULT WINAPI extDICreateDeviceExA(LPDIRECTINPUTA lpdi, REFGUID rguid, REFIID riid, LPVOID *pvout, LPUNKNOWN pu) +{ return extDICreateDeviceEx(lpdi, rguid, riid, pvout, pu); } +HRESULT WINAPI extDICreateDeviceExW(LPDIRECTINPUTW lpdi, REFGUID rguid, REFIID riid, LPVOID *pvout, LPUNKNOWN pu) +{ return extDICreateDeviceEx((LPDIRECTINPUT)lpdi, rguid, riid, pvout, pu); } + + /* from MSDN: cbObjectData Size of the DIDEVICEOBJECTDATA structure, in bytes. @@ -631,19 +768,50 @@ HRESULT WINAPI extDeviceProxy(LPCDIDEVICEINSTANCE dev, LPVOID arg) return res; } -HRESULT WINAPI extDIEnumDevices(void *lpdi, DWORD dwDevType, LPDIENUMDEVICESCALLBACK lpCallback, LPVOID pvRef, DWORD dwFlags) +HRESULT WINAPI extDIEnumDevicesA(DIEnumDevicesA_Type pDIEnumDevices, void *lpdi, DWORD dwDevType, LPDIENUMDEVICESCALLBACKA lpCallback, LPVOID pvRef, DWORD dwFlags) { HRESULT res; CallbackArg Arg; - OutTraceDW("EnumDevices(I): di=%x DevType=%x CallBack=%x Ref=%x Flags=%x\n", lpdi, dwDevType, lpCallback, pvRef, dwFlags); + OutTraceDW("EnumDevicesA(I): di=%x DevType=%x CallBack=%x Ref=%x Flags=%x\n", lpdi, dwDevType, lpCallback, pvRef, dwFlags); Arg.cb= lpCallback; Arg.arg=pvRef; - res=(*pDIEnumDevices)( lpdi, dwDevType, (LPDIENUMDEVICESCALLBACK)extDeviceProxy, &Arg, dwFlags); // V2.02.80 fix + res=(*pDIEnumDevices)( lpdi, dwDevType, (LPDIENUMDEVICESCALLBACKA)extDeviceProxy, &Arg, dwFlags); // V2.02.80 fix //res=(*pDIEnumDevices)( lpdi, dwDevType, lpCallback, pvRef, dwFlags); - OutTraceDW("EnumDevices(I): res=%x\n", res); + OutTraceDW("EnumDevicesA(I): res=%x\n", res); return res; } +HRESULT WINAPI extDIEnumDevicesA1(void *lpdi, DWORD dwDevType, LPDIENUMDEVICESCALLBACK lpCallback, LPVOID pvRef, DWORD dwFlags) +{ return extDIEnumDevicesA(pDIEnumDevicesA1, lpdi, dwDevType, lpCallback, pvRef, dwFlags); } +HRESULT WINAPI extDIEnumDevicesA2(void *lpdi, DWORD dwDevType, LPDIENUMDEVICESCALLBACK lpCallback, LPVOID pvRef, DWORD dwFlags) +{ return extDIEnumDevicesA(pDIEnumDevicesA2, lpdi, dwDevType, lpCallback, pvRef, dwFlags); } +HRESULT WINAPI extDIEnumDevicesA7(void *lpdi, DWORD dwDevType, LPDIENUMDEVICESCALLBACK lpCallback, LPVOID pvRef, DWORD dwFlags) +{ return extDIEnumDevicesA(pDIEnumDevicesA7, lpdi, dwDevType, lpCallback, pvRef, dwFlags); } +HRESULT WINAPI extDIEnumDevicesA8(void *lpdi, DWORD dwDevType, LPDIENUMDEVICESCALLBACK lpCallback, LPVOID pvRef, DWORD dwFlags) +{ return extDIEnumDevicesA(pDIEnumDevicesA8, lpdi, dwDevType, lpCallback, pvRef, dwFlags); } + +HRESULT WINAPI extDIEnumDevicesW(DIEnumDevicesW_Type pDIEnumDevices, void *lpdi, DWORD dwDevType, LPDIENUMDEVICESCALLBACKW lpCallback, LPVOID pvRef, DWORD dwFlags) +{ + HRESULT res; + CallbackArg Arg; + OutTraceDW("EnumDevicesW(I): di=%x DevType=%x CallBack=%x Ref=%x Flags=%x\n", lpdi, dwDevType, lpCallback, pvRef, dwFlags); + Arg.cb= (LPDIENUMDEVICESCALLBACKA)lpCallback; + Arg.arg=pvRef; + res=(*pDIEnumDevices)( lpdi, dwDevType, (LPDIENUMDEVICESCALLBACKW)extDeviceProxy, &Arg, dwFlags); // V2.02.80 fix + //res=(*pDIEnumDevices)( lpdi, dwDevType, lpCallback, pvRef, dwFlags); + OutTraceDW("EnumDevicesW(I): res=%x\n", res); + return res; +} + +HRESULT WINAPI extDIEnumDevicesW1(void *lpdi, DWORD dwDevType, LPDIENUMDEVICESCALLBACKW lpCallback, LPVOID pvRef, DWORD dwFlags) +{ return extDIEnumDevicesW(pDIEnumDevicesW1, lpdi, dwDevType, lpCallback, pvRef, dwFlags); } +HRESULT WINAPI extDIEnumDevicesW2(void *lpdi, DWORD dwDevType, LPDIENUMDEVICESCALLBACKW lpCallback, LPVOID pvRef, DWORD dwFlags) +{ return extDIEnumDevicesW(pDIEnumDevicesW2, lpdi, dwDevType, lpCallback, pvRef, dwFlags); } +HRESULT WINAPI extDIEnumDevicesW7(void *lpdi, DWORD dwDevType, LPDIENUMDEVICESCALLBACKW lpCallback, LPVOID pvRef, DWORD dwFlags) +{ return extDIEnumDevicesW(pDIEnumDevicesW7, lpdi, dwDevType, lpCallback, pvRef, dwFlags); } +HRESULT WINAPI extDIEnumDevicesW8(void *lpdi, DWORD dwDevType, LPDIENUMDEVICESCALLBACKW lpCallback, LPVOID pvRef, DWORD dwFlags) +{ return extDIEnumDevicesW(pDIEnumDevicesW8, lpdi, dwDevType, lpCallback, pvRef, dwFlags); } + HRESULT WINAPI extAcquire(LPDIRECTINPUTDEVICE lpdid) { HRESULT res; diff --git a/dll/dsound.cpp b/dll/dsound.cpp index 2921a7f..b3a3820 100644 --- a/dll/dsound.cpp +++ b/dll/dsound.cpp @@ -15,18 +15,29 @@ typedef HRESULT (WINAPI *DirectSoundCreate_Type)(LPGUID, LPDIRECTSOUND *, LPUNKNOWN); typedef HRESULT (WINAPI *DirectSoundCreate8_Type)(LPCGUID, LPDIRECTSOUND8 *, LPUNKNOWN); typedef HRESULT (WINAPI *SetCooperativeLevel_Type) (void *, HWND, DWORD); +typedef HRESULT (WINAPI *CreateSoundBuffer_Type) (void *, LPCDSBUFFERDESC, LPDIRECTSOUNDBUFFER *, LPUNKNOWN); +typedef HRESULT (WINAPI *DirectSoundEnumerateA_Type)(LPDSENUMCALLBACKA, LPVOID); +typedef HRESULT (WINAPI *DirectSoundEnumerateW_Type)(LPDSENUMCALLBACKW, LPVOID); DirectSoundCreate_Type pDirectSoundCreate = NULL; DirectSoundCreate8_Type pDirectSoundCreate8 = NULL; SetCooperativeLevel_Type pDSSetCooperativeLevel = NULL; +CreateSoundBuffer_Type pCreateSoundBuffer = NULL; +DirectSoundEnumerateA_Type pDirectSoundEnumerateA = NULL; +DirectSoundEnumerateW_Type pDirectSoundEnumerateW = NULL; HRESULT WINAPI extDirectSoundCreate(LPGUID, LPDIRECTSOUND *, LPUNKNOWN); HRESULT WINAPI extDirectSoundCreate8(LPCGUID, LPDIRECTSOUND8 *, LPUNKNOWN); HRESULT WINAPI extDSSetCooperativeLevel(void *, HWND, DWORD); +HRESULT WINAPI extCreateSoundBuffer(void *, LPCDSBUFFERDESC, LPDIRECTSOUNDBUFFER *, LPUNKNOWN); +HRESULT WINAPI extDirectSoundEnumerateA(LPDSENUMCALLBACKA, LPVOID); +HRESULT WINAPI extDirectSoundEnumerateW(LPDSENUMCALLBACKW, LPVOID); static HookEntryEx_Type Hooks[]={ {HOOK_HOT_CANDIDATE, 0x0001, "DirectSoundCreate", (FARPROC)NULL, (FARPROC *)&pDirectSoundCreate, (FARPROC)extDirectSoundCreate}, {HOOK_HOT_CANDIDATE, 0x000B, "DirectSoundCreate8", (FARPROC)NULL, (FARPROC *)&pDirectSoundCreate8, (FARPROC)extDirectSoundCreate8}, + {HOOK_HOT_CANDIDATE, 0x000B, "DirectSoundEnumerateA", (FARPROC)NULL, (FARPROC *)&pDirectSoundEnumerateA, (FARPROC)extDirectSoundEnumerateA}, + {HOOK_HOT_CANDIDATE, 0x000B, "DirectSoundEnumerateW", (FARPROC)NULL, (FARPROC *)&pDirectSoundEnumerateW, (FARPROC)extDirectSoundEnumerateW}, {HOOK_IAT_CANDIDATE, 0, 0, NULL, 0, 0} // terminator }; @@ -41,7 +52,7 @@ static char *libname = "dsound.dll"; void HookDirectSound(HMODULE hModule) { - HookLibraryEx(hModule, Hooks, libname); + HookLibraryEx(hModule, Hooks, "dsound.dll"); } void HookDirectSoundInit() @@ -52,6 +63,7 @@ void HookDirectSoundInit() void HookDirectSoundObj(LPDIRECTSOUND *lpds) { // IDIrectSound::SetCooperativeLevel + SetHook((void *)(**(DWORD **)lpds + 12), extCreateSoundBuffer, (void **)&pCreateSoundBuffer, "CreateSoundBuffer"); SetHook((void *)(**(DWORD **)lpds + 24), extDSSetCooperativeLevel, (void **)&pDSSetCooperativeLevel, "SetCooperativeLevel(DSound)"); } @@ -125,3 +137,54 @@ HRESULT WINAPI extDSSetCooperativeLevel(void *lpds, HWND hwnd, DWORD dwLevel) } return res; } + +char *ExplainCSBFlags(DWORD c) +{ + static char eb[512]; + unsigned int l; + strcpy(eb,""); + if (c & DSBCAPS_PRIMARYBUFFER) strcat(eb, "PRIMARYBUFFER+"); + if (c & DSBCAPS_STATIC) strcat(eb, "STATIC+"); + if (c & DSBCAPS_LOCHARDWARE) strcat(eb, "LOCHARDWARE+"); + if (c & DSBCAPS_LOCSOFTWARE) strcat(eb, "LOCSOFTWARE+"); + if (c & DSBCAPS_CTRL3D) strcat(eb, "CTRL3D+"); + if (c & DSBCAPS_CTRLFREQUENCY) strcat(eb, "CTRLFREQUENCY+"); + if (c & DSBCAPS_CTRLPAN) strcat(eb, "CTRLPAN+"); + if (c & DSBCAPS_CTRLVOLUME) strcat(eb, "CTRLVOLUME+"); + if (c & DSBCAPS_CTRLPOSITIONNOTIFY) strcat(eb, "CTRLPOSITIONNOTIFY+"); + if (c & DSBCAPS_CTRLFX) strcat(eb, "CTRLFX+"); + if (c & DSBCAPS_STICKYFOCUS) strcat(eb, "STICKYFOCUS+"); + if (c & DSBCAPS_GLOBALFOCUS) strcat(eb, "GLOBALFOCUS+"); + if (c & DSBCAPS_GETCURRENTPOSITION2) strcat(eb, "GETCURRENTPOSITION2+"); + if (c & DSBCAPS_MUTE3DATMAXDISTANCE) strcat(eb, "MUTE3DATMAXDISTANCE+"); + if (c & DSBCAPS_LOCDEFER) strcat(eb, "LOCDEFER+"); + l=strlen(eb); + if (l>strlen("DSBCAPS_")) eb[l-1]=0; // delete last '+' if any + else eb[0]=0; + return(eb); +} + +HRESULT WINAPI extCreateSoundBuffer (void *lpds, LPCDSBUFFERDESC pcDSBufferDesc, LPDIRECTSOUNDBUFFER *ppDSBuffer, LPUNKNOWN pUnkOuter) +{ + HRESULT res; + OutTraceDW("CreateSoundBuffer: flags=%x(%s) BufferBytes=%d\n", pcDSBufferDesc->dwFlags, ExplainCSBFlags(pcDSBufferDesc->dwFlags), pcDSBufferDesc->dwBufferBytes); + res = (*pCreateSoundBuffer)(lpds, pcDSBufferDesc, ppDSBuffer, pUnkOuter); + if(res) OutTraceE("CreateSoundBuffer ERROR: res=%x(s)\n", res, ExplainDDError(res)); + return res; +} + +HRESULT WINAPI extDirectSoundEnumerateA(LPDSENUMCALLBACKA pDSEnumCallback, LPVOID pContext) +{ + HRESULT res; + OutTraceDW("DirectSoundEnumerateA\n"); + res = (*pDirectSoundEnumerateA)(pDSEnumCallback, pContext); + return res; +} + +HRESULT WINAPI extDirectSoundEnumerateW(LPDSENUMCALLBACKW pDSEnumCallback, LPVOID pContext) +{ + HRESULT res; + OutTraceDW("DirectSoundEnumerateW\n"); + res = (*pDirectSoundEnumerateW)(pDSEnumCallback, pContext); + return res; +} diff --git a/dll/dxhook.cpp b/dll/dxhook.cpp index a2734bc..a5c22e1 100644 --- a/dll/dxhook.cpp +++ b/dll/dxhook.cpp @@ -80,8 +80,8 @@ static char *Flag3Names[32]={ "FORCEHOOKOPENGL", "MARKBLIT", "HOOKDLLS", "SUPPRESSD3DEXT", "HOOKENABLED", "FIXD3DFRAME", "FORCE16BPP", "BLACKWHITE", "MARKLOCK", "SINGLEPROCAFFINITY", "EMULATEREGISTRY", "CDROMDRIVETYPE", - "NOWINDOWMOVE", "**", "LOCKSYSCOLORS", "GDIEMULATEDC", - "FULLSCREENONLY", "FONTBYPASS", "**", "DEFAULTMESSAGES", + "NOWINDOWMOVE", "FORCECLIPPER", "LOCKSYSCOLORS", "GDIEMULATEDC", + "FULLSCREENONLY", "FONTBYPASS", "MINIMALCAPS", "DEFAULTMESSAGES", "BUFFEREDIOFIX", "FILTERMESSAGES", "PEEKALLMESSAGES", "SURFACEWARN", "ANALYTICMODE", "FORCESHEL", "CAPMASK", "COLORFIX", "NODDRAWBLT", "NODDRAWFLIP", "NOGDIBLT", "NOPIXELFORMAT", @@ -121,8 +121,8 @@ static char *Flag6Names[32]={ }; static char *Flag7Names[32]={ - "LIMITDDRAW", "DISABLEDISABLEALTTAB", "FIXCLIPPERAREA", "", - "", "", "", "", + "LIMITDDRAW", "DISABLEDISABLEALTTAB", "FIXCLIPPERAREA", "HOOKDIRECTSOUND", + "HOOKSMACKW32", "BLOCKPRIORITYCLASS", "", "", "", "", "", "", "", "", "", "", "", "", "", "", diff --git a/dll/dxwnd.cpp b/dll/dxwnd.cpp index c2aeac9..bce8911 100644 --- a/dll/dxwnd.cpp +++ b/dll/dxwnd.cpp @@ -27,7 +27,7 @@ along with this program. If not, see . #include "TlHelp32.h" -#define VERSION "2.03.61" +#define VERSION "2.03.62.fix2" #define DDTHREADLOCK 1 //#define LOCKTHREADS diff --git a/dll/dxwnd.vs2008.suo b/dll/dxwnd.vs2008.suo index 3d602ae..d61afda 100644 Binary files a/dll/dxwnd.vs2008.suo and b/dll/dxwnd.vs2008.suo differ diff --git a/dll/winproc.cpp b/dll/winproc.cpp index da6d89b..dd8dbec 100644 --- a/dll/winproc.cpp +++ b/dll/winproc.cpp @@ -617,6 +617,11 @@ LRESULT CALLBACK extWindowProc(HWND hwnd, UINT message, WPARAM wparam, LPARAM lp if(dxw.dwFlags6 & TERMINATEONCLOSE) TerminateProcess(GetCurrentProcess(),0); break; case WM_SYSKEYDOWN: + if ((dxw.dwFlags1 & HANDLEALTF4) && (wparam == VK_F4)) { + OutTraceDW("WindowProc: WM_SYSKEYDOWN(ALT-F4) - terminating process\n"); + TerminateProcess(GetCurrentProcess(),0); + } + // fall through case WM_KEYDOWN: if(!(dxw.dwFlags4 & ENABLEHOTKEYS)) break; OutTraceW("event %s wparam=%x lparam=%x\n", (message==WM_SYSKEYDOWN)?"WM_SYSKEYDOWN":"WM_KEYDOWN", wparam, lparam); @@ -669,7 +674,7 @@ LRESULT CALLBACK extWindowProc(HWND hwnd, UINT message, WPARAM wparam, LPARAM lp break; case DXVK_ALTF4: if (dxw.dwFlags1 & HANDLEALTF4) { - OutTraceDW("WindowProc: WM_SYSKEYDOWN(ALT-F4) - terminating process\n"); + OutTraceDW("WindowProc: WM_SYSKEYDOWN(virtual Alt-F4) - terminating process\n"); TerminateProcess(GetCurrentProcess(),0); } break; diff --git a/host/TabProgram.cpp b/host/TabProgram.cpp index 686ae4f..ca800b1 100644 --- a/host/TabProgram.cpp +++ b/host/TabProgram.cpp @@ -69,6 +69,15 @@ END_MESSAGE_MAP() extern void GetFolderFromPath(char *); +static BOOL IsWinXP() +{ + OSVERSIONINFO osvi; + ZeroMemory(&osvi, sizeof(OSVERSIONINFO)); + osvi.dwOSVersionInfoSize = sizeof(OSVERSIONINFO); + GetVersionEx(&osvi); + return osvi.dwMajorVersion == 5; +} + void CTabProgram::OnOpen() { // TODO: Please add your control notification handler code here @@ -77,6 +86,8 @@ void CTabProgram::OnOpen() cTarget->m_File.GetWindowText(path, MAX_PATH); GetPrivateProfileString("window", "exepath", NULL, path, MAX_PATH, gInitPath); if(!dirExists(path)) strcpy(path, ""); + // XP fix: path must end with '\.' + if(IsWinXP()) strcat(path, "."); CFileDialog dlg( TRUE, "*.*", path, OFN_HIDEREADONLY | OFN_OVERWRITEPROMPT, "Program (*.exe)|*.exe|All Files (*.*)|*.*||", this); if( dlg.DoModal() == IDOK) { @@ -97,6 +108,8 @@ void CTabProgram::OnOpenLaunch() cTarget->m_File.GetWindowText(path, MAX_PATH); GetPrivateProfileString("window", "exepath", NULL, path, MAX_PATH, gInitPath); if(!dirExists(path)) strcpy(path, ""); + // XP fix: path must end with '\.' + if(IsWinXP()) strcat(path, "."); CFileDialog dlg( TRUE, "*.*", path, OFN_HIDEREADONLY | OFN_OVERWRITEPROMPT, "Program (*.exe)|*.exe|All Files (*.*)|*.*||", this); if( dlg.DoModal() == IDOK) { diff --git a/host/dxwndhost.aps b/host/dxwndhost.aps index a63fa0e..582521c 100644 Binary files a/host/dxwndhost.aps and b/host/dxwndhost.aps differ diff --git a/host/dxwndhost.rc b/host/dxwndhost.rc index 1920261..3636ab8 100644 Binary files a/host/dxwndhost.rc and b/host/dxwndhost.rc differ diff --git a/host/dxwndhost.vs2008.suo b/host/dxwndhost.vs2008.suo index a848b05..cbc9a0e 100644 Binary files a/host/dxwndhost.vs2008.suo and b/host/dxwndhost.vs2008.suo differ diff --git a/proxy/d3d8.suo b/proxy/d3d8.suo index e2f8487..a77b40d 100644 Binary files a/proxy/d3d8.suo and b/proxy/d3d8.suo differ diff --git a/proxy/d3d9.suo b/proxy/d3d9.suo index c67a246..be9ce2e 100644 Binary files a/proxy/d3d9.suo and b/proxy/d3d9.suo differ diff --git a/proxy/ddraw.suo b/proxy/ddraw.suo index 1aeaba4..e65c76f 100644 Binary files a/proxy/ddraw.suo and b/proxy/ddraw.suo differ diff --git a/proxy/init.cpp b/proxy/init.cpp index 0c45acb..0873229 100644 --- a/proxy/init.cpp +++ b/proxy/init.cpp @@ -44,16 +44,10 @@ void InitDxWnd(void) target.flags5 = GetIntEntry("flagj0", AEROBOOST|CENTERTOWIN); target.flags6 = GetIntEntry("flagk0", 0); target.tflags = GetIntEntry("tflag0", 0); - target.initx = GetIntEntry("initx0", 0); - target.inity = GetIntEntry("inity0", 0); target.posx = GetIntEntry("posx0", 0); target.posy = GetIntEntry("posy0", 0); target.sizx = GetIntEntry("sizx0", 0); target.sizy = GetIntEntry("sizy0", 0); - target.maxx = GetIntEntry("maxx0", 0); - target.maxy = GetIntEntry("maxy0", 0); - target.minx = GetIntEntry("minx0", 0); - target.miny = GetIntEntry("miny0", 0); target.coordinates = GetIntEntry("coord0", 1); // centered to desktop target.MaxFPS = GetIntEntry("maxfps0", 0); target.dxversion = GetIntEntry("ver0", 0);