Skip to content

Commit

Permalink
[UMPNPMGR] PNP_GetGlobalState returns CM_GLOBAL_STATE_SHUTTING_DOWN o…
Browse files Browse the repository at this point in the history
…n service shutdown
  • Loading branch information
EricKohl committed Nov 1, 2024
1 parent 978503c commit 91bc5b5
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 0 deletions.
1 change: 1 addition & 0 deletions base/services/umpnpmgr/precomp.h
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,7 @@ RpcServerThread(
extern HKEY hEnumKey;
extern HKEY hClassKey;
extern BOOL g_IsUISuppressed;
extern BOOL g_ShuttingDown;

BOOL
GetSuppressNewUIValue(VOID);
Expand Down
3 changes: 3 additions & 0 deletions base/services/umpnpmgr/rpcserver.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

Expand Down
4 changes: 4 additions & 0 deletions base/services/umpnpmgr/umpnpmgr.c
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ static SERVICE_STATUS ServiceStatus;
HKEY hEnumKey = NULL;
HKEY hClassKey = NULL;
BOOL g_IsUISuppressed = FALSE;
BOOL g_ShuttingDown = FALSE;

/* FUNCTIONS *****************************************************************/

Expand All @@ -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;
Expand Down

0 comments on commit 91bc5b5

Please sign in to comment.