[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [XENBUS PATCH v3 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> Reviewed-by: Paul Durrant <paul@xxxxxxx> --- src/monitor/monitor.c | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/src/monitor/monitor.c b/src/monitor/monitor.c index 8a56c11..dd5fc13 100644 --- a/src/monitor/monitor.c +++ b/src/monitor/monitor.c @@ -686,6 +686,7 @@ TryAutoReboot( { PMONITOR_CONTEXT Context = &MonitorContext; HRESULT Result; + HANDLE MsiMutex; DWORD Type; DWORD AutoReboot; DWORD RebootCount; @@ -711,6 +712,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 |