From 995f56d1d34a8a8a93deac5fb576f767a8552a85 Mon Sep 17 00:00:00 2001 From: Katayama Hirofumi MZ Date: Thu, 26 Oct 2023 23:27:45 +0900 Subject: [PATCH] [SHELL32][SDK] Implement IsSuspendAllowed (#5831) - Add IsShutdownAllowed helper function. - Add IsSuspendAllowed prototype to . - Implement IsSuspendAllowed function. --- dll/win32/shell32/stubs.cpp | 11 ----------- dll/win32/shell32/utils.cpp | 14 ++++++++++++++ sdk/include/reactos/undocshell.h | 1 + 3 files changed, 15 insertions(+), 11 deletions(-) diff --git a/dll/win32/shell32/stubs.cpp b/dll/win32/shell32/stubs.cpp index f8518336906..9ca95825c7f 100644 --- a/dll/win32/shell32/stubs.cpp +++ b/dll/win32/shell32/stubs.cpp @@ -783,17 +783,6 @@ DAD_DragEnterEx2(HWND hwndTarget, return FALSE; } -/* - * Unimplemented - */ -EXTERN_C BOOL -WINAPI -IsSuspendAllowed(VOID) -{ - FIXME("IsSuspendAllowed() stub\n"); - return FALSE; -} - /* * Unimplemented */ diff --git a/dll/win32/shell32/utils.cpp b/dll/win32/shell32/utils.cpp index 57ade40713e..f10cb11e290 100644 --- a/dll/win32/shell32/utils.cpp +++ b/dll/win32/shell32/utils.cpp @@ -164,6 +164,20 @@ Quit: return ret; } +BOOL IsShutdownAllowed(VOID) +{ + return SHTestTokenPrivilegeW(NULL, SE_SHUTDOWN_NAME); +} + +/************************************************************************* + * IsSuspendAllowed (SHELL32.53) + */ +BOOL WINAPI IsSuspendAllowed(VOID) +{ + TRACE("()\n"); + return IsShutdownAllowed() && IsPwrSuspendAllowed(); +} + /************************************************************************* * SHGetShellStyleHInstance (SHELL32.749) */ diff --git a/sdk/include/reactos/undocshell.h b/sdk/include/reactos/undocshell.h index 1577466ab9f..5b6953e9204 100644 --- a/sdk/include/reactos/undocshell.h +++ b/sdk/include/reactos/undocshell.h @@ -697,6 +697,7 @@ SHInvokePrivilegedFunctionW( BOOL WINAPI SHTestTokenPrivilegeW(_In_opt_ HANDLE hToken, _In_z_ LPCWSTR lpName); +BOOL WINAPI IsSuspendAllowed(VOID); /***************************************************************************** * Shell32 resources