Крашит с моим плагином при выходе из игры через /q
При выходе через меню игры, не крашит. В чем может быть прикол?
DllMain:
case DLL_PROCESS_DETACH:
SetWindowLongPtr(m_pGameWindow, GWLP_WNDPROC, LONG_PTR(m_pWindowProc));
ImGui_ImplDX9_Shutdown();
ImGui_ImplWin32_Shutdown();
ImGui::DestroyContext();
D3DHook->unHook();
break;
unhook:
void unHook()
{
DetourTransactionBegin();
DetourUpdateThread(GetCurrentThread());
DetourDetach(&(PVOID&)Orginal_Present, Hooked_Present);
DetourDetach(&(PVOID&)Orginal_Reset, Hooked_Reset);
DetourAttach(&(PVOID&)Orginal_Present, unHooked_Present);
DetourAttach(&(PVOID&)Orginal_Reset, unHooked_Reset);
DetourTransactionCommit();
}
unHookedD3DFuncs:
HRESULT __stdcall unHooked_Present(IDirect3DDevice9* pDevice, CONST RECT* pSrcRect, CONST RECT* pDestRect, HWND hDestWindow, CONST RGNDATA* pDirtyRegion)
{
static auto func = pD3DHook->Orginal_Present;
return func(pDevice, pSrcRect, pDestRect, hDestWindow, pDirtyRegion);
}
HRESULT __stdcall unHooked_Reset(LPDIRECT3DDEVICE9 pDevice, D3DPRESENT_PARAMETERS* pPresentParams)
{
static auto func = pD3DHook->Orginal_Reset;
return func(pDevice, pPresentParams);
}
crash:
SA-MP 0.3.7-R3
Exception At Address: 0x03DE7696
Base: 0x03DB0000
Registers:
EAX: 0x00000000 EBX: 0x00000000 ECX: 0x01CBC6EA EDX: 0x03E975C8
ESI: 0x10EEE7A0 EDI: 0x00000000 EBP: 0x75204E90 ESP: 0x0177FD34
EFLAGS: 0x00010202
Stack:
+0000: 0x00000001 0x03DB953C 0x01CBD4C8 0x01CBD4C8
+0010: 0x01CBD4C8 0x00000000 0x10EEE7A0 0x00000000
+0020: 0x03E7590B 0x00000000 0x00000001 0x75204E90
+0030: 0x0177FD78 0x00000000 0x00000000 0x00000000
+0040: 0x00C716B0 0x0000001A 0x00000001 0x00000000
+0050: 0x0053EB17 0x442AC000 0x43C00000 0x0053ECC2
+0060: 0x00000001 0x00619B71 0x0000001A 0x00000001
+0070: 0x00000001 0x0000000A 0x00748DA0 0x0000001A
+0080: 0x00000001 0x771F09C0 0x00000000 0x0177FF70
+0090: 0x002E0000 0x010E0000 0x4F229822 0x000E0ED8
+00A0: 0x00000008 0x00000100 0x00000008 0x00000102
+00B0: 0x442AC000 0x43C00000 0x00000000 0x00000000
+00C0: 0x00000556 0x00000300 0x00000000 0x00000001
+00D0: 0x0065010C 0x00000113 0x00000001 0x00000000
+00E0: 0x7FCE367C 0x000002AB 0x00000180 0x0000002C
+00F0: 0x0177FE14 0x00825EA4 0x0177FF60 0x00825EA4
+0100: 0x00000000 0x002E0000 0x00821D17 0x00835342
+0110: 0x00000065 0x0177FF70 0x008246F1 0x00400000
+0120: 0x00000000 0x01AD3932 0x0000000A 0x00000094
+0130: 0x00000006 0x00000002 0x000023F0 0x00000002
+0140: 0x00000000 0x00000000 0x00000000 0x00000000
+0150: 0x00000000 0x00000000 0x00000000 0x00000000
+0160: 0x00000000 0x00000000 0x00000000 0x00000000
+0170: 0x00000000 0x00000000 0x00000000 0x00000000
+0180: 0x00000000 0x00000000 0x00000000 0x00000000
+0190: 0x00000000 0x00000000 0x00000000 0x00000000
+01A0: 0x00000000 0x00000000 0x00000000 0x00000000
+01B0: 0x00000000 0x00000000 0x00000000 0x00824588
+01C0: 0x00824570 0x00824570 0x002E0000 0xC0000005
+01D0: 0x00000000 0x01AD3932 0x00000044 0x01AE3E38
+01E0: 0x01ADED10 0x01ADF1A0 0x00000000 0x00000000
+01F0: 0x00000000 0x00000000 0x00000000 0x00000000
+0200: 0x00000000 0x00000000 0x00000000 0x00000000
+0210: 0xFFFFFFFF 0xFFFFFFFF 0xFFFFFFFF 0x00000000
+0220: 0x00000000 0x0177FE60 0x0177F6F4 0x0177FFCC
+0230: 0x00825EA4 0x00888078 0x00000000 0x0177FF80
+0240: 0x771EF989 0x002E0000 0x771EF970 0x0177FFDC
+0250: 0x77337084 0x002E0000 0xE37B43C6 0x00000000
+0260: 0x00000000 0x002E0000 0x00000000 0x00000000
+0270: 0x00000000 0x00000000 0x00000000 0x00000000
SCM Op: 0x248, lDbg: 0 LastRendObj: 0
Game Version: US 1.0
State Information: Ped Context: 0