diff options
Diffstat (limited to 'overlay/lib.cpp')
-rw-r--r-- | overlay/lib.cpp | 18 |
1 files changed, 17 insertions, 1 deletions
diff --git a/overlay/lib.cpp b/overlay/lib.cpp index e9eeb4370..9358212c0 100644 --- a/overlay/lib.cpp +++ b/overlay/lib.cpp @@ -448,13 +448,29 @@ extern "C" __declspec(dllexport) void __cdecl PrepareD3D9(); // Via dxgi.cpp extern "C" __declspec(dllexport) void __cdecl PrepareDXGI(); -extern "C" __declspec(dllexport) int __cdecl OverlayHelperProcessMain(unsigned int magic) { +void __stdcall OverlayHelperProcessParentDeathThread(void *udata) { + HANDLE parent = reinterpret_cast<HANDLE>(udata); + DWORD status = WaitForSingleObject(parent, INFINITE); + if (status != WAIT_OBJECT_0) { + ExitProcess(OVERLAY_HELPER_ERROR_DLL_PDEATH_WAIT_FAIL); + } + + ExitProcess(0); +} + +extern "C" __declspec(dllexport) int __cdecl OverlayHelperProcessMain(unsigned int magic, HANDLE parent) { int retval = 0; if (GetOverlayMagicVersion() != magic) { return OVERLAY_HELPER_ERROR_DLL_MAGIC_MISMATCH; } + HANDLE pcheckHandle = CreateThread(NULL, 0, (LPTHREAD_START_ROUTINE) OverlayHelperProcessParentDeathThread, + reinterpret_cast<void *>(parent), 0, NULL); + if (pcheckHandle == 0) { + return OVERLAY_HELPER_ERROR_DLL_PDEATH_THREAD_ERROR; + } + PrepareD3D9(); PrepareDXGI(); |