mirror of
https://github.com/FunkyFr3sh/cnc-ddraw.git
synced 2025-03-25 01:57:47 +01:00
use SetThreadExecutionState with ES_DISPLAY_REQUIRED
This commit is contained in:
parent
48081e3f24
commit
eafcdaf95d
@ -23,7 +23,6 @@ PVOID FakePrimarySurface;
|
|||||||
|
|
||||||
|
|
||||||
HMODULE g_ddraw_module;
|
HMODULE g_ddraw_module;
|
||||||
static BOOL g_screensaver_disabled;
|
|
||||||
|
|
||||||
BOOL WINAPI DllMain(HANDLE hDll, DWORD dwReason, LPVOID lpReserved)
|
BOOL WINAPI DllMain(HANDLE hDll, DWORD dwReason, LPVOID lpReserved)
|
||||||
{
|
{
|
||||||
@ -132,15 +131,7 @@ BOOL WINAPI DllMain(HANDLE hDll, DWORD dwReason, LPVOID lpReserved)
|
|||||||
set_aware();
|
set_aware();
|
||||||
}
|
}
|
||||||
|
|
||||||
BOOL screensaver_enabled = FALSE;
|
SetThreadExecutionState(ES_CONTINUOUS | ES_DISPLAY_REQUIRED);
|
||||||
SystemParametersInfoA(SPI_GETSCREENSAVEACTIVE, 0, &screensaver_enabled, 0);
|
|
||||||
|
|
||||||
if (screensaver_enabled)
|
|
||||||
{
|
|
||||||
SystemParametersInfoA(SPI_SETSCREENSAVEACTIVE, FALSE, NULL, 0);
|
|
||||||
g_screensaver_disabled = TRUE;
|
|
||||||
}
|
|
||||||
|
|
||||||
indeo_enable();
|
indeo_enable();
|
||||||
timeBeginPeriod(1);
|
timeBeginPeriod(1);
|
||||||
hook_init();
|
hook_init();
|
||||||
@ -160,11 +151,7 @@ BOOL WINAPI DllMain(HANDLE hDll, DWORD dwReason, LPVOID lpReserved)
|
|||||||
keyboard_hook_exit();
|
keyboard_hook_exit();
|
||||||
dinput_hook_exit();
|
dinput_hook_exit();
|
||||||
hook_exit();
|
hook_exit();
|
||||||
|
SetThreadExecutionState(ES_CONTINUOUS);
|
||||||
if (g_screensaver_disabled)
|
|
||||||
{
|
|
||||||
SystemParametersInfoA(SPI_SETSCREENSAVEACTIVE, TRUE, NULL, 0);
|
|
||||||
}
|
|
||||||
|
|
||||||
ULONG(WINAPI* remove_handler)(PVOID) =
|
ULONG(WINAPI* remove_handler)(PVOID) =
|
||||||
(void*)real_GetProcAddress(GetModuleHandleA("Kernel32.dll"), "RemoveVectoredExceptionHandler");
|
(void*)real_GetProcAddress(GetModuleHandleA("Kernel32.dll"), "RemoveVectoredExceptionHandler");
|
||||||
|
Loading…
x
Reference in New Issue
Block a user