[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [XENBUS PATCH v2 5/5] Check for active installation before autoreboot
If the _MSIExecute mutex is set, an MSI installation is under way. We don't want to autoreboot in these situations either. Signed-off-by: Tu Dinh <ngoc-tu.dinh@xxxxxxxxxx> --- src/monitor/monitor.c | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/src/monitor/monitor.c b/src/monitor/monitor.c index be41012..e1e8f1a 100644 --- a/src/monitor/monitor.c +++ b/src/monitor/monitor.c @@ -685,6 +685,7 @@ TryAutoReboot( ) { PMONITOR_CONTEXT Context = &MonitorContext; + HANDLE MsiMutex; DWORD Type; DWORD AutoReboot; DWORD RebootCount; @@ -710,6 +711,22 @@ TryAutoReboot( if (Context->Response == IDNO) goto done; + // Check if there's an installation under way. + MsiMutex = OpenMutex(SYNCHRONIZE, + FALSE, + TEXT("Global\\_MSIExecute")); + if (MsiMutex != NULL) { + Error = WaitForSingleObject(MsiMutex, 0); + if (Error == WAIT_OBJECT_0 || Error == WAIT_ABANDONED) + ReleaseMutex(MsiMutex); + + CloseHandle(MsiMutex); + + if (Error == WAIT_TIMEOUT) + // The only case where an installation is definitely running. + goto done; + } + Status = CallNtPowerInformation(SystemExecutionState, NULL, 0, -- 2.49.0.windows.1 Ngoc Tu Dinh | Vates XCP-ng Developer XCP-ng & Xen Orchestra - Vates solutions web: https://vates.tech
|
![]() |
Lists.xenproject.org is hosted with RackSpace, monitoring our |