https://git.reactos.org/?p=reactos.git;a=commitdiff;h=a6005299c685bb7669ad7e...
commit a6005299c685bb7669ad7ecb1d9c765bcc494c08 Author: Hervé Poussineau hpoussin@reactos.org AuthorDate: Mon Jul 12 23:50:42 2021 +0200 Commit: Hervé Poussineau hpoussin@reactos.org CommitDate: Mon Jul 12 23:51:39 2021 +0200
[DESK] Only try to restart graphic device after installation
If it fails, require a reboot.
CORE-17675 --- dll/cpl/desk/classinst.c | 32 +++++++++++++++++++++++++------- 1 file changed, 25 insertions(+), 7 deletions(-)
diff --git a/dll/cpl/desk/classinst.c b/dll/cpl/desk/classinst.c index c178d162d5b..2c73aced777 100644 --- a/dll/cpl/desk/classinst.c +++ b/dll/cpl/desk/classinst.c @@ -247,16 +247,34 @@ DisplayClassInstaller( /* FIXME: install OpenGLSoftwareSettings section */
/* Start the device */ - if (!SetupDiRestartDevices(DeviceInfoSet, DeviceInfoData)) + if (SetupDiRestartDevices(DeviceInfoSet, DeviceInfoData)) { - rc = GetLastError(); - DPRINT1("SetupDiRestartDevices() failed with error 0x%lx\n", rc); - goto cleanup; + /* Reenumerate display devices ; this will rescan for potential new devices */ + DisplayDevice.cb = sizeof(DISPLAY_DEVICE); + EnumDisplayDevices(NULL, 0, &DisplayDevice, 0); } + else + { + rc = GetLastError(); + DPRINT("SetupDiRestartDevices() failed with error 0x%lx. Will reboot later.\n", rc);
- /* Reenumerate display devices ; this will rescan for potential new devices */ - DisplayDevice.cb = sizeof(DISPLAY_DEVICE); - EnumDisplayDevices(NULL, 0, &DisplayDevice, 0); + /* Mark device as needing a restart */ + InstallParams.cbSize = sizeof(InstallParams); + if (!SetupDiGetDeviceInstallParams(DeviceInfoSet, DeviceInfoData, &InstallParams)) + { + rc = GetLastError(); + DPRINT("SetupDiGetDeviceInstallParams() failed with error 0x%lx\n", rc); + goto cleanup; + } + InstallParams.Flags |= DI_NEEDRESTART; + result = SetupDiSetDeviceInstallParams(DeviceInfoSet, DeviceInfoData, &InstallParams); + if (!result) + { + rc = GetLastError(); + DPRINT("SetupDiSetDeviceInstallParams() failed with error 0x%lx\n", rc); + goto cleanup; + } + }
rc = ERROR_SUCCESS;