diff --git a/inc/config.h b/inc/config.h index d1600d5ed..a353aa850 100644 --- a/inc/config.h +++ b/inc/config.h @@ -80,6 +80,7 @@ typedef struct CNCDDRAWCONFIG BOOL limit_gdi_handles; BOOL remove_menu; int refresh_rate; + int terminate_process; /* Hotkeys */ diff --git a/src/config.c b/src/config.c index 39bcfdaca..f9cf3e2fd 100644 --- a/src/config.c +++ b/src/config.c @@ -93,6 +93,7 @@ void cfg_load() GET_BOOL(g_config.limit_gdi_handles, "limit_gdi_handles", FALSE); GET_BOOL(g_config.remove_menu, "remove_menu", FALSE); GET_INT(g_config.refresh_rate, "refresh_rate", 0); + GET_BOOL(g_config.terminate_process, "terminate_process", FALSE); /* Hotkeys */ @@ -336,6 +337,7 @@ static void cfg_create_ini() "limit_gdi_handles=false\n" "remove_menu=false\n" "refresh_rate=0\n" + "terminate_process=false\n" "\n" "\n" "\n" diff --git a/src/dllmain.c b/src/dllmain.c index f4ede204a..5e7185925 100644 --- a/src/dllmain.c +++ b/src/dllmain.c @@ -179,6 +179,9 @@ BOOL WINAPI DllMain(HANDLE hDll, DWORD dwReason, LPVOID lpReserved) if (g_dbg_exception_handle && remove_handler) remove_handler(g_dbg_exception_handle); + if (g_config.terminate_process == 2) + TerminateProcess(GetCurrentProcess(), 0); + break; } case DLL_THREAD_ATTACH: diff --git a/src/wndproc.c b/src/wndproc.c index cbc0c0707..35550582a 100644 --- a/src/wndproc.c +++ b/src/wndproc.c @@ -620,6 +620,9 @@ LRESULT CALLBACK fake_WndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam if (wParam == SC_CLOSE && !GameHandlesClose) { + if (g_config.terminate_process) + g_config.terminate_process = 2; + ExitProcess(0); //_exit(0); }