techiew / DirectXHook

DirectX 11/12 hook including a simple overlay framework.
181 stars 23 forks source link

Game Crashes if I place the two files next to it's folder #6

Open eviluess opened 2 years ago

eviluess commented 2 years ago

Hi man. Thanks for your work!

I compiled successfully without any code modification by the VS 2022 Communication Edition. However, after I placed the generated dxgi.dll and blank.jpg to the game folder, the game quitted after 3~4 seconds.

I didn't actually run a game, I ran the "VESA Disaplay Test" and "D3D12HDR" because I want this hook to try to increase the brightness of the HDR rendering.

All the generated directx_hook_log.txt is 0 bytes.

I'll actually run a game after work.

techiew commented 2 years ago

I'm currently rewriting some parts to make the hook more compatible with third-party overlays, this might indirectly solve your issue. Not sure when I will be pushing the commits though, should be soon.

However the version in the repo should already work with 99% of games as long as there is no third-party overlay/hook (MSI AfterBurner, etc) messing around in the memory. The VESA display test might be a special case though.

Patrick-van-Halm commented 1 year ago

Any update on this? Since I am running this on a unity game on steam and it's unable to launch. When I remove the files the game runs fine.

Overlay code:

#include "Example.h"

using namespace OF;

void Example::Setup()
{
    InitFramework(m_device, m_spriteBatch, m_window);
    box = CreateBox(10, 10, 50, 50);
}

void Example::Render()
{
    DrawBox(box, 255, 0, 0);
}

Stacktrace:

0x00007FFE04C0062F (UnityPlayer) UnityMain
0x00007FFE04BFBF0B (UnityPlayer) UnityMain
0x00007FFE04CA6614 (UnityPlayer) UnityMain
SymInit: Symbol-SearchPath: '.;G:\Steam\steamapps\common\Phasmophobia;G:\Steam\steamapps\common\Phasmophobia;C:\WINDOWS;C:\WINDOWS\system32;', symOptions: 534, UserName: 'Patrick'
OS-Version: 10.0.0
G:\Steam\steamapps\common\Phasmophobia\Phasmophobia.exe:Phasmophobia.exe (00007FF643B40000), size: 675840 (result: 0), SymType: '-exported-', PDB: 'G:\Steam\steamapps\common\Phasmophobia\Phasmophobia.exe', fileVersion: 2021.3.16.5719
C:\WINDOWS\SYSTEM32\ntdll.dll:ntdll.dll (00007FFEC7D30000), size: 2064384 (result: 0), SymType: '-exported-', PDB: 'C:\WINDOWS\SYSTEM32\ntdll.dll', fileVersion: 10.0.19041.2130
C:\WINDOWS\System32\KERNEL32.DLL:KERNEL32.DLL (00007FFEC5E40000), size: 782336 (result: 0), SymType: '-exported-', PDB: 'C:\WINDOWS\System32\KERNEL32.DLL', fileVersion: 10.0.19041.2364
C:\WINDOWS\System32\KERNELBASE.dll:KERNELBASE.dll (00007FFEC5800000), size: 2957312 (result: 0), SymType: '-exported-', PDB: 'C:\WINDOWS\System32\KERNELBASE.dll', fileVersion: 10.0.19041.2364
C:\WINDOWS\SYSTEM32\apphelp.dll:apphelp.dll (00007FFEC28D0000), size: 593920 (result: 0), SymType: '-exported-', PDB: 'C:\WINDOWS\SYSTEM32\apphelp.dll', fileVersion: 10.0.19041.2075
G:\Steam\steamapps\common\Phasmophobia\UnityPlayer.dll:UnityPlayer.dll (00007FFE044B0000), size: 30216192 (result: 0), SymType: '-exported-', PDB: 'G:\Steam\steamapps\common\Phasmophobia\UnityPlayer.dll', fileVersion: 2021.3.16.5719
C:\WINDOWS\System32\USER32.dll:USER32.dll (00007FFEC5F60000), size: 1708032 (result: 0), SymType: '-exported-', PDB: 'C:\WINDOWS\System32\USER32.dll', fileVersion: 10.0.19041.2311
C:\WINDOWS\System32\win32u.dll:win32u.dll (00007FFEC5AE0000), size: 139264 (result: 0), SymType: '-exported-', PDB: 'C:\WINDOWS\System32\win32u.dll', fileVersion: 10.0.19041.2364
C:\WINDOWS\System32\GDI32.dll:GDI32.dll (00007FFEC5E10000), size: 176128 (result: 0), SymType: '-exported-', PDB: 'C:\WINDOWS\System32\GDI32.dll', fileVersion: 10.0.19041.2130
C:\WINDOWS\System32\gdi32full.dll:gdi32full.dll (00007FFEC5C60000), size: 1110016 (result: 0), SymType: '-exported-', PDB: 'C:\WINDOWS\System32\gdi32full.dll', fileVersion: 10.0.19041.2364
C:\WINDOWS\System32\msvcp_win.dll:msvcp_win.dll (00007FFEC56D0000), size: 643072 (result: 0), SymType: '-exported-', PDB: 'C:\WINDOWS\System32\msvcp_win.dll', fileVersion: 10.0.19041.789
C:\WINDOWS\System32\ucrtbase.dll:ucrtbase.dll (00007FFEC5470000), size: 1048576 (result: 0), SymType: '-exported-', PDB: 'C:\WINDOWS\System32\ucrtbase.dll', fileVersion: 10.0.19041.789
C:\WINDOWS\System32\ole32.dll:ole32.dll (00007FFEC6110000), size: 1220608 (result: 0), SymType: '-exported-', PDB: 'C:\WINDOWS\System32\ole32.dll', fileVersion: 10.0.19041.1202
C:\WINDOWS\System32\RPCRT4.dll:RPCRT4.dll (00007FFEC6240000), size: 1200128 (result: 0), SymType: '-exported-', PDB: 'C:\WINDOWS\System32\RPCRT4.dll', fileVersion: 10.0.19041.1806
C:\WINDOWS\System32\combase.dll:combase.dll (00007FFEC7640000), size: 3493888 (result: 0), SymType: '-exported-', PDB: 'C:\WINDOWS\System32\combase.dll', fileVersion: 10.0.19041.2311
C:\WINDOWS\SYSTEM32\VERSION.dll:VERSION.dll (00007FFEBCE90000), size: 40960 (result: 0), SymType: '-exported-', PDB: 'C:\WINDOWS\SYSTEM32\VERSION.dll', fileVersion: 10.0.19041.546
C:\WINDOWS\System32\msvcrt.dll:msvcrt.dll (00007FFEC7A60000), size: 647168 (result: 0), SymType: '-exported-', PDB: 'C:\WINDOWS\System32\msvcrt.dll', fileVersion: 7.0.19041.546
C:\WINDOWS\System32\SHLWAPI.dll:SHLWAPI.dll (00007FFEC70F0000), size: 348160 (result: 0), SymType: '-exported-', PDB: 'C:\WINDOWS\System32\SHLWAPI.dll', fileVersion: 10.0.19041.2075
C:\WINDOWS\System32\SETUPAPI.dll:SETUPAPI.dll (00007FFEC6370000), size: 4620288 (result: 0), SymType: '-exported-', PDB: 'C:\WINDOWS\System32\SETUPAPI.dll', fileVersion: 10.0.19041.2193
C:\WINDOWS\System32\cfgmgr32.dll:cfgmgr32.dll (00007FFEC5420000), size: 319488 (result: 0), SymType: '-exported-', PDB: 'C:\WINDOWS\System32\cfgmgr32.dll', fileVersion: 10.0.19041.1620
C:\WINDOWS\System32\bcrypt.dll:bcrypt.dll (00007FFEC5C30000), size: 159744 (result: 0), SymType: '-exported-', PDB: 'C:\WINDOWS\System32\bcrypt.dll', fileVersion: 10.0.19041.1023
C:\WINDOWS\System32\ADVAPI32.dll:ADVAPI32.dll (00007FFEC7590000), size: 712704 (result: 0), SymType: '-exported-', PDB: 'C:\WINDOWS\System32\ADVAPI32.dll', fileVersion: 10.0.19041.2130
C:\WINDOWS\System32\sechost.dll:sechost.dll (00007FFEC5D70000), size: 638976 (result: 0), SymType: '-exported-', PDB: 'C:\WINDOWS\System32\sechost.dll', fileVersion: 10.0.19041.1865
C:\WINDOWS\System32\SHELL32.dll:SHELL32.dll (00007FFEC67E0000), size: 7618560 (result: 0), SymType: '-exported-', PDB: 'C:\WINDOWS\System32\SHELL32.dll', fileVersion: 10.0.19041.2311
C:\WINDOWS\System32\OLEAUT32.dll:OLEAUT32.dll (00007FFEC7410000), size: 839680 (result: 0), SymType: '-exported-', PDB: 'C:\WINDOWS\System32\OLEAUT32.dll', fileVersion: 10.0.19041.985
C:\WINDOWS\System32\IMM32.dll:IMM32.dll (00007FFEC72F0000), size: 204800 (result: 0), SymType: '-exported-', PDB: 'C:\WINDOWS\System32\IMM32.dll', fileVersion: 10.0.19041.2193
C:\WINDOWS\SYSTEM32\WINMM.dll:WINMM.dll (00007FFEB5DF0000), size: 159744 (result: 0), SymType: '-exported-', PDB: 'C:\WINDOWS\SYSTEM32\WINMM.dll', fileVersion: 10.0.19041.546
C:\WINDOWS\SYSTEM32\OPENGL32.dll:OPENGL32.dll (00007FFE8D040000), size: 1200128 (result: 0), SymType: '-exported-', PDB: 'C:\WINDOWS\SYSTEM32\OPENGL32.dll', fileVersion: 10.0.19041.2193
C:\WINDOWS\System32\CRYPT32.dll:CRYPT32.dll (00007FFEC5570000), size: 1400832 (result: 0), SymType: '-exported-', PDB: 'C:\WINDOWS\System32\CRYPT32.dll', fileVersion: 10.0.19041.1889
C:\WINDOWS\System32\WS2_32.dll:WS2_32.dll (00007FFEC7160000), size: 438272 (result: 0), SymType: '-exported-', PDB: 'C:\WINDOWS\System32\WS2_32.dll', fileVersion: 10.0.19041.546
C:\WINDOWS\SYSTEM32\HID.DLL:HID.DLL (00007FFEC3C30000), size: 53248 (result: 0), SymType: '-exported-', PDB: 'C:\WINDOWS\SYSTEM32\HID.DLL', fileVersion: 10.0.19041.546
C:\WINDOWS\SYSTEM32\WINHTTP.dll:WINHTTP.dll (00007FFEBD840000), size: 1097728 (result: 0), SymType: '-exported-', PDB: 'C:\WINDOWS\SYSTEM32\WINHTTP.dll', fileVersion: 10.0.19041.2193
C:\WINDOWS\SYSTEM32\GLU32.dll:GLU32.dll (00007FFEBEDB0000), size: 180224 (result: 0), SymType: '-exported-', PDB: 'C:\WINDOWS\SYSTEM32\GLU32.dll', fileVersion: 10.0.19041.2193
C:\WINDOWS\SYSTEM32\dwmapi.dll:dwmapi.dll (00007FFEC2D90000), size: 192512 (result: 0), SymType: '-exported-', PDB: 'C:\WINDOWS\SYSTEM32\dwmapi.dll', fileVersion: 10.0.19041.746
C:\WINDOWS\SYSTEM32\kernel.appcore.dll:kernel.appcore.dll (00007FFEC3CA0000), size: 73728 (result: 0), SymType: '-exported-', PDB: 'C:\WINDOWS\SYSTEM32\kernel.appcore.dll', fileVersion: 10.0.19041.546
C:\WINDOWS\System32\bcryptPrimitives.dll:bcryptPrimitives.dll (00007FFEC5770000), size: 532480 (result: 0), SymType: '-exported-', PDB: 'C:\WINDOWS\System32\bcryptPrimitives.dll', fileVersion: 10.0.19041.1415
C:\WINDOWS\system32\uxtheme.dll:uxtheme.dll (00007FFEC29F0000), size: 647168 (result: 0), SymType: '-exported-', PDB: 'C:\WINDOWS\system32\uxtheme.dll', fileVersion: 10.0.19041.2193
C:\WINDOWS\System32\shcore.dll:shcore.dll (00007FFEC7C40000), size: 708608 (result: 0), SymType: '-exported-', PDB: 'C:\WINDOWS\System32\shcore.dll', fileVersion: 10.0.19041.1865
C:\WINDOWS\SYSTEM32\windows.storage.dll:windows.storage.dll (00007FFEC3330000), size: 7938048 (result: 0), SymType: '-exported-', PDB: 'C:\WINDOWS\SYSTEM32\windows.storage.dll', fileVersion: 10.0.19041.2311
C:\WINDOWS\SYSTEM32\Wldp.dll:Wldp.dll (00007FFEC4E80000), size: 196608 (result: 0), SymType: '-exported-', PDB: 'C:\WINDOWS\SYSTEM32\Wldp.dll', fileVersion: 10.0.19041.2311
C:\WINDOWS\SYSTEM32\profapi.dll:profapi.dll (00007FFEC5360000), size: 126976 (result: 0), SymType: '-nosymbols-', PDB: 'C:\WINDOWS\SYSTEM32\profapi.dll', fileVersion: 10.0.19041.844
G:\Steam\steamapps\common\Phasmophobia\GameAssembly.dll:GameAssembly.dll (00007FFDF6ED0000), size: 93696000 (result: 0), SymType: '-exported-', PDB: 'G:\Steam\steamapps\common\Phasmophobia\GameAssembly.dll'
C:\WINDOWS\SYSTEM32\dbghelp.dll:dbghelp.dll (00007FFEC3140000), size: 1982464 (result: 0), SymType: '-exported-', PDB: 'C:\WINDOWS\SYSTEM32\dbghelp.dll', fileVersion: 10.0.19041.867
G:\Steam\steamapps\common\Phasmophobia\baselib.dll:baselib.dll (00007FFEBFFB0000), size: 417792 (result: 0), SymType: '-exported-', PDB: 'G:\Steam\steamapps\common\Phasmophobia\baselib.dll'
C:\WINDOWS\SYSTEM32\IPHLPAPI.DLL:IPHLPAPI.DLL (00007FFEC4880000), size: 241664 (result: 0), SymType: '-exported-', PDB: 'C:\WINDOWS\SYSTEM32\IPHLPAPI.DLL', fileVersion: 10.0.19041.1865
G:\Steam\steamapps\common\Phasmophobia\Phasmophobia_Data\Plugins\x86_64\audioplugin_phonon.dll:audioplugin_phonon.dll (00007FFEBFF40000), size: 417792 (result: 0), SymType: '-exported-', PDB: 'G:\Steam\steamapps\common\Phasmophobia\Phasmophobia_Data\Plugins\x86_64\audioplugin_phonon.dll'
G:\Steam\steamapps\common\Phasmophobia\Phasmophobia_Data\Plugins\x86_64\phonon.dll:phonon.dll (00007FFE12BC0000), size: 10244096 (result: 0), SymType: '-exported-', PDB: 'G:\Steam\steamapps\common\Phasmophobia\Phasmophobia_Data\Plugins\x86_64\phonon.dll'
G:\Steam\steamapps\common\Phasmophobia\Phasmophobia_Data\Plugins\x86_64\AudioPluginDissonance.dll:AudioPluginDissonance.dll (00007FFE12AC0000), size: 1044480 (result: 0), SymType: '-exported-', PDB: 'G:\Steam\steamapps\common\Phasmophobia\Phasmophobia_Data\Plugins\x86_64\AudioPluginDissonance.dll'
C:\WINDOWS\System32\MSCTF.dll:MSCTF.dll (00007FFEC71D0000), size: 1134592 (result: 0), SymType: '-exported-', PDB: 'C:\WINDOWS\System32\MSCTF.dll', fileVersion: 10.0.19041.2193
G:\Steam\steamapps\common\Phasmophobia\Phasmophobia_Data\Plugins\x86_64\UnityOpenXR.dll:UnityOpenXR.dll (00007FFE945D0000), size: 704512 (result: 0), SymType: '-exported-', PDB: 'G:\Steam\steamapps\common\Phasmophobia\Phasmophobia_Data\Plugins\x86_64\UnityOpenXR.dll', fileVersion: 1.6.0.0
G:\Steam\steamapps\common\Phasmophobia\Phasmophobia_Data\Plugins\x86_64\openxr_loader.dll:openxr_loader.dll (00007FFE128D0000), size: 1998848 (result: 0), SymType: '-exported-', PDB: 'G:\Steam\steamapps\common\Phasmophobia\Phasmophobia_Data\Plugins\x86_64\openxr_loader.dll', fileVersion: 1.0.25.0
C:\WINDOWS\SYSTEM32\d3d11.dll:d3d11.dll (00007FFEC0CD0000), size: 2502656 (result: 0), SymType: '-exported-', PDB: 'C:\WINDOWS\SYSTEM32\d3d11.dll', fileVersion: 10.0.19041.2075
G:\Steam\steamapps\common\Phasmophobia\dxgi.dll:dxgi.dll (00007FFEBFF00000), size: 258048 (result: 0), SymType: 'PDB', PDB: '.\dxgi.pdb'
C:\WINDOWS\SYSTEM32\D3DCOMPILER_47.dll:D3DCOMPILER_47.dll (00007FFEC0F40000), size: 4575232 (result: 0), SymType: '-exported-', PDB: 'C:\WINDOWS\SYSTEM32\D3DCOMPILER_47.dll', fileVersion: 10.0.19041.868
C:\WINDOWS\SYSTEM32\d3d12.dll:d3d12.dll (00007FFEC0590000), size: 131072 (result: 0), SymType: '-exported-', PDB: 'C:\WINDOWS\SYSTEM32\d3d12.dll', fileVersion: 10.0.19041.1266
C:\WINDOWS\SYSTEM32\MSVCP140.dll:MSVCP140.dll (00007FFEB08E0000), size: 577536 (result: 0), SymType: '-exported-', PDB: 'C:\WINDOWS\SYSTEM32\MSVCP140.dll', fileVersion: 14.29.30038.0
C:\WINDOWS\SYSTEM32\VCRUNTIME140.dll:VCRUNTIME140.dll (00007FFEB0970000), size: 110592 (result: 0), SymType: '-exported-', PDB: 'C:\WINDOWS\SYSTEM32\VCRUNTIME140.dll', fileVersion: 14.29.30038.0
C:\WINDOWS\SYSTEM32\VCRUNTIME140_1.dll:VCRUNTIME140_1.dll (00007FFEB1280000), size: 49152 (result: 0), SymType: '-exported-', PDB: 'C:\WINDOWS\SYSTEM32\VCRUNTIME140_1.dll', fileVersion: 14.29.30038.0
C:\WINDOWS\SYSTEM32\CRYPTSP.dll:CRYPTSP.dll (00007FFEC4DE0000), size: 98304 (result: 0), SymType: '-exported-', PDB: 'C:\WINDOWS\SYSTEM32\CRYPTSP.dll', fileVersion: 10.0.19041.546
C:\WINDOWS\SYSTEM32\SspiCli.dll:SspiCli.dll (00007FFEC52E0000), size: 204800 (result: 0), SymType: '-exported-', PDB: 'C:\WINDOWS\SYSTEM32\SspiCli.dll', fileVersion: 10.0.19041.2130
  ERROR: SymGetSymFromAddr64, GetLastError: 'Attempt to access invalid address.' (Address: 00007FFE04AA3F65)
0x00007FFE04AA3F65 (UnityPlayer) (function-name not available)
  ERROR: SymGetSymFromAddr64, GetLastError: 'Attempt to access invalid address.' (Address: 00007FFE04AA4C73)
0x00007FFE04AA4C73 (UnityPlayer) (function-name not available)
  ERROR: SymGetSymFromAddr64, GetLastError: 'Attempt to access invalid address.' (Address: 00007FFE049515DC)
0x00007FFE049515DC (UnityPlayer) (function-name not available)
  ERROR: SymGetSymFromAddr64, GetLastError: 'Attempt to access invalid address.' (Address: 00007FFE0496302E)
0x00007FFE0496302E (UnityPlayer) (function-name not available)
  ERROR: SymGetSymFromAddr64, GetLastError: 'Attempt to access invalid address.' (Address: 00007FFE04B4DBD0)
0x00007FFE04B4DBD0 (UnityPlayer) (function-name not available)
0x00007FFE04B4FF5B (UnityPlayer) UnityMain
  ERROR: SymGetSymFromAddr64, GetLastError: 'Attempt to access invalid address.' (Address: 00007FF643B411F2)
0x00007FF643B411F2 (Phasmophobia) (function-name not available)
0x00007FFEC5E57614 (KERNEL32) BaseThreadInitThunk
0x00007FFEC7D826A1 (ntdll) RtlUserThreadStart
Patrick-van-Halm commented 1 year ago

Same code also crashes on unreal engine games, stacktrace:

LoginId:cc28ae384e62e09e5878c79809a5659c
EpicAccountId:

Unhandled Exception: EXCEPTION_ACCESS_VIOLATION 0x0000000000000000

BusSimulator21_Win64_Shipping
BusSimulator21_Win64_Shipping
BusSimulator21_Win64_Shipping
BusSimulator21_Win64_Shipping
BusSimulator21_Win64_Shipping
BusSimulator21_Win64_Shipping
BusSimulator21_Win64_Shipping
BusSimulator21_Win64_Shipping
BusSimulator21_Win64_Shipping
BusSimulator21_Win64_Shipping
kernel32
ntdll