https://git.reactos.org/?p=reactos.git;a=commitdiff;h=91bc5b5e9488fd674639b…
commit 91bc5b5e9488fd674639b7102fb6b973a2b5f299
Author: Eric Kohl <eric.kohl(a)reactos.org>
AuthorDate: Fri Nov 1 14:43:37 2024 +0100
Commit: Eric Kohl <eric.kohl(a)reactos.org>
CommitDate: Fri Nov 1 14:43:37 2024 +0100
[UMPNPMGR] PNP_GetGlobalState returns CM_GLOBAL_STATE_SHUTTING_DOWN on service
shutdown
---
base/services/umpnpmgr/precomp.h | 1 +
base/services/umpnpmgr/rpcserver.c | 3 +++
base/services/umpnpmgr/umpnpmgr.c | 4 ++++
3 files changed, 8 insertions(+)
diff --git a/base/services/umpnpmgr/precomp.h b/base/services/umpnpmgr/precomp.h
index a9dabcc25c8..21c3622d929 100644
--- a/base/services/umpnpmgr/precomp.h
+++ b/base/services/umpnpmgr/precomp.h
@@ -88,6 +88,7 @@ RpcServerThread(
extern HKEY hEnumKey;
extern HKEY hClassKey;
extern BOOL g_IsUISuppressed;
+extern BOOL g_ShuttingDown;
BOOL
GetSuppressNewUIValue(VOID);
diff --git a/base/services/umpnpmgr/rpcserver.c b/base/services/umpnpmgr/rpcserver.c
index db6a474a0f6..ff7a15ac0fb 100644
--- a/base/services/umpnpmgr/rpcserver.c
+++ b/base/services/umpnpmgr/rpcserver.c
@@ -687,6 +687,9 @@ PNP_GetGlobalState(
*pulState = CM_GLOBAL_STATE_CAN_DO_UI | CM_GLOBAL_STATE_SERVICES_AVAILABLE;
+ if (g_ShuttingDown)
+ *pulState |= CM_GLOBAL_STATE_SHUTTING_DOWN;
+
return CR_SUCCESS;
}
diff --git a/base/services/umpnpmgr/umpnpmgr.c b/base/services/umpnpmgr/umpnpmgr.c
index 14b7c1a9e6f..60194bd458d 100644
--- a/base/services/umpnpmgr/umpnpmgr.c
+++ b/base/services/umpnpmgr/umpnpmgr.c
@@ -44,6 +44,7 @@ static SERVICE_STATUS ServiceStatus;
HKEY hEnumKey = NULL;
HKEY hClassKey = NULL;
BOOL g_IsUISuppressed = FALSE;
+BOOL g_ShuttingDown = FALSE;
/* FUNCTIONS *****************************************************************/
@@ -52,6 +53,9 @@ UpdateServiceStatus(
_In_ DWORD dwState,
_In_ DWORD dwCheckPoint)
{
+ if ((dwState == SERVICE_STOPPED) || (dwState == SERVICE_STOP_PENDING))
+ g_ShuttingDown = TRUE;
+
ServiceStatus.dwServiceType = SERVICE_WIN32_OWN_PROCESS;
ServiceStatus.dwCurrentState = dwState;
ServiceStatus.dwWin32ExitCode = 0;