Completes the part of the process that prevents the process from interfering with the system's power operation.
This commit is contained in:
parent
d0b5ed01e3
commit
c07d778847
|
@ -509,6 +509,7 @@ _FX BOOLEAN Gui_Init(HMODULE module)
|
|||
GUI_IMPORT_AW(PostMessage);
|
||||
GUI_IMPORT_AW(PostThreadMessage);
|
||||
GUI_IMPORT_AW(DispatchMessage);
|
||||
GUI_IMPORT___(ShutdownBlockReasonCreate)
|
||||
|
||||
GUI_IMPORT_AW(SetWindowsHookEx);
|
||||
GUI_IMPORT___(UnhookWindowsHookEx);
|
||||
|
@ -1658,7 +1659,12 @@ _FX LRESULT Gui_WindowProcA(
|
|||
|
||||
if (uMsg == WM_CREATE)
|
||||
Gui_ProtectScreen(hWnd);
|
||||
|
||||
if (uMsg == WM_QUERYENDSESSION)
|
||||
{
|
||||
if (SbieApi_QueryConfBool(NULL, "BlockInterferePower", FALSE)) {
|
||||
return TRUE;
|
||||
}
|
||||
}
|
||||
wndproc = __sys_GetPropW(hWnd, (LPCWSTR)Gui_WindowProcOldA_Atom);
|
||||
lResult = __sys_CallWindowProcA(wndproc, hWnd, uMsg, wParam, new_lParam);
|
||||
|
||||
|
|
|
@ -420,6 +420,10 @@ typedef HDC(*P_GetDCEx)(HWND hWnd,HRGN hrgnClip,DWORD flags);
|
|||
|
||||
typedef BOOL (*P_PrintWindow)(HWND hwnd,HDC hdcBlt,UINT nFlags);
|
||||
|
||||
typedef BOOL (*P_ShutdownBlockReasonCreate)(HWND hWnd,LPCWSTR pwszReason);
|
||||
|
||||
typedef EXECUTION_STATE (*P_SetThreadExecutionState)(EXECUTION_STATE esFlags);
|
||||
|
||||
typedef BOOL (*P_SetThreadDesktop)(HDESK hDesktop);
|
||||
|
||||
typedef BOOL (*P_SwitchDesktop)(HDESK hDesktop);
|
||||
|
@ -571,6 +575,8 @@ GUI_SYS_VAR(IsZoomed)
|
|||
GUI_SYS_VAR_2(SendMessage)
|
||||
GUI_SYS_VAR_2(SendMessageTimeout)
|
||||
//GUI_SYS_VAR_2(SendMessageCallback)
|
||||
GUI_SYS_VAR(ShutdownBlockReasonCreate)
|
||||
GUI_SYS_VAR(SetThreadExecutionState)
|
||||
GUI_SYS_VAR_2(SendNotifyMessage)
|
||||
GUI_SYS_VAR_2(PostMessage)
|
||||
GUI_SYS_VAR_2(PostThreadMessage)
|
||||
|
|
|
@ -103,6 +103,13 @@ static HDC Gui_GetDC(HWND hWnd);
|
|||
static HDC Gui_GetWindowDC(HWND hWnd);
|
||||
static HDC Gui_GetDCEx(HWND hWnd, HRGN hrgnClip, DWORD flags);
|
||||
static BOOL Gui_PrintWindow(HWND hwnd,HDC hdcBlt,UINT nFlags);
|
||||
static BOOL Gui_ShutdownBlockReasonCreate(
|
||||
HWND hWnd,
|
||||
LPCWSTR pwszReason
|
||||
);
|
||||
static EXECUTION_STATE Gui_SetThreadExecutionState(
|
||||
EXECUTION_STATE esFlags
|
||||
);
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
|
||||
|
@ -184,6 +191,8 @@ _FX BOOLEAN Gui_InitMisc(HMODULE module)
|
|||
SBIEDLL_HOOK_GUI(GetDC);
|
||||
SBIEDLL_HOOK_GUI(GetDCEx);
|
||||
SBIEDLL_HOOK_GUI(PrintWindow);
|
||||
SBIEDLL_HOOK_GUI(ShutdownBlockReasonCreate);
|
||||
SBIEDLL_HOOK_GUI(SetThreadExecutionState);
|
||||
if (Dll_OsBuild >= 6000) {
|
||||
|
||||
//
|
||||
|
@ -1538,3 +1547,27 @@ _FX BOOL Gui_PrintWindow(
|
|||
}
|
||||
return __sys_PrintWindow(hwnd, hdcBlt, nFlags);
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
// Gui_ShutdownBlockReasonCreate
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
_FX BOOL Gui_ShutdownBlockReasonCreate(
|
||||
[in] HWND hWnd,
|
||||
[in] LPCWSTR pwszReason
|
||||
) {
|
||||
if (SbieApi_QueryConfBool(NULL, "BlockInterferePower", FALSE)) {
|
||||
SetLastError(ERROR_ACCESS_DENIED);
|
||||
return 0;
|
||||
}
|
||||
return __sys_ShutdownBlockReasonCreate(hWnd, pwszReason);
|
||||
}
|
||||
_FX EXECUTION_STATE Gui_SetThreadExecutionState(
|
||||
EXECUTION_STATE esFlags
|
||||
) {
|
||||
if (SbieApi_QueryConfBool(NULL, "BlockInterferePower", FALSE)) {
|
||||
SetLastError(ERROR_ACCESS_DENIED);
|
||||
return 0;
|
||||
}
|
||||
return __sys_SetThreadExecutionState(esFlags);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue