https://git.reactos.org/?p=reactos.git;a=commitdiff;h=995f56d1d34a8a8a93dea…
commit 995f56d1d34a8a8a93deac5fb576f767a8552a85
Author: Katayama Hirofumi MZ <katayama.hirofumi.mz(a)gmail.com>
AuthorDate: Thu Oct 26 23:27:45 2023 +0900
Commit: GitHub <noreply(a)github.com>
CommitDate: Thu Oct 26 23:27:45 2023 +0900
[SHELL32][SDK] Implement IsSuspendAllowed (#5831)
- Add IsShutdownAllowed helper function.
- Add IsSuspendAllowed prototype to
<undocshell.h>.
- 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