Author: ekohl Date: Mon Apr 17 11:34:08 2017 New Revision: 74348
URL: http://svn.reactos.org/svn/reactos?rev=74348&view=rev Log: Avoid attempts to reinstall a driver on reboot when a previous attempt has already failed.
[NEWDEV] Set the CONFIGFLAG_FAILEDINSTALL flag in the new hardware wizards welcome page and remove it only when the driver was successfully installed.
[UMPNPMGR] Do not invoke the device installer if the devices CONFIGFLAG_FAILEDINSTALL flag is set.
Modified: trunk/reactos/base/services/umpnpmgr/umpnpmgr.c trunk/reactos/dll/win32/newdev/wizard.c
Modified: trunk/reactos/base/services/umpnpmgr/umpnpmgr.c URL: http://svn.reactos.org/svn/reactos/trunk/reactos/base/services/umpnpmgr/umpn... ============================================================================== --- trunk/reactos/base/services/umpnpmgr/umpnpmgr.c [iso-8859-1] (original) +++ trunk/reactos/base/services/umpnpmgr/umpnpmgr.c [iso-8859-1] Mon Apr 17 11:34:08 2017 @@ -21,7 +21,7 @@ * PROJECT: ReactOS kernel * FILE: base/services/umpnpmgr/umpnpmgr.c * PURPOSE: User-mode Plug and Play manager - * PROGRAMMER: Eric Kohl + * PROGRAMMER: Eric Kohl (eric.kohl@reactos.org) * Hervé Poussineau (hpoussin@reactos.org) * Colin Finck (colin@reactos.org) */ @@ -3230,6 +3230,22 @@ return TRUE; }
+ BytesWritten = sizeof(DWORD); + if (RegQueryValueExW(DeviceKey, + L"ConfigFlags", + NULL, + NULL, + (PBYTE)&Value, + &BytesWritten) == ERROR_SUCCESS) + { + if (Value & CONFIGFLAG_FAILEDINSTALL) + { + DPRINT("No need to install: %S\n", DeviceInstance); + RegCloseKey(DeviceKey); + return TRUE; + } + } + RegCloseKey(DeviceKey); }
Modified: trunk/reactos/dll/win32/newdev/wizard.c URL: http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/newdev/wizard.c?r... ============================================================================== --- trunk/reactos/dll/win32/newdev/wizard.c [iso-8859-1] (original) +++ trunk/reactos/dll/win32/newdev/wizard.c [iso-8859-1] Mon Apr 17 11:34:08 2017 @@ -52,6 +52,44 @@ }
static BOOL +SetFailedInstall( + IN HDEVINFO DeviceInfoSet, + IN PSP_DEVINFO_DATA DevInfoData OPTIONAL, + IN BOOLEAN Set) +{ + DWORD dwType, dwSize, dwFlags = 0; + + dwSize = sizeof(dwFlags); + if (!SetupDiGetDeviceRegistryProperty(DeviceInfoSet, + DevInfoData, + SPDRP_CONFIGFLAGS, + &dwType, + (PBYTE)&dwFlags, + dwSize, + &dwSize)) + { + return FALSE; + } + + if (Set) + dwFlags |= CONFIGFLAG_FAILEDINSTALL; + else + dwFlags &= ~CONFIGFLAG_FAILEDINSTALL; + + if (!SetupDiSetDeviceRegistryProperty(DeviceInfoSet, + DevInfoData, + SPDRP_CONFIGFLAGS, + (PBYTE)&dwFlags, + dwSize)) + { + + return FALSE; + } + + return TRUE; +} + +static BOOL CanDisableDevice( IN DEVINST DevInst, IN HMACHINE hMachine, @@ -462,6 +500,10 @@ BM_SETCHECK, (WPARAM)TRUE, (LPARAM)0); + + SetFailedInstall(DevInstData->hDevInfo, + &DevInstData->devInfoData, + TRUE); break; }
@@ -807,8 +849,13 @@ hThread = 0; if (wParam == 0) { + SP_DEVINSTALL_PARAMS installParams; + + SetFailedInstall(DevInstData->hDevInfo, + &DevInstData->devInfoData, + FALSE); + /* Should we reboot? */ - SP_DEVINSTALL_PARAMS installParams; installParams.cbSize = sizeof(SP_DEVINSTALL_PARAMS); if (SetupDiGetDeviceInstallParams( DevInstData->hDevInfo,