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.

svn path=/trunk/; revision=74348
This commit is contained in:
Eric Kohl 2017-04-17 11:34:08 +00:00
parent 1313fd5c76
commit dd0e23b691
2 changed files with 65 additions and 2 deletions

View file

@ -21,7 +21,7 @@
* PROJECT: ReactOS kernel * PROJECT: ReactOS kernel
* FILE: base/services/umpnpmgr/umpnpmgr.c * FILE: base/services/umpnpmgr/umpnpmgr.c
* PURPOSE: User-mode Plug and Play manager * PURPOSE: User-mode Plug and Play manager
* PROGRAMMER: Eric Kohl * PROGRAMMER: Eric Kohl (eric.kohl@reactos.org)
* Hervé Poussineau (hpoussin@reactos.org) * Hervé Poussineau (hpoussin@reactos.org)
* Colin Finck (colin@reactos.org) * Colin Finck (colin@reactos.org)
*/ */
@ -3230,6 +3230,22 @@ InstallDevice(PCWSTR DeviceInstance, BOOL ShowWizard)
return TRUE; 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); RegCloseKey(DeviceKey);
} }

View file

@ -51,6 +51,44 @@ CenterWindow(
SWP_NOSIZE); SWP_NOSIZE);
} }
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 static BOOL
CanDisableDevice( CanDisableDevice(
IN DEVINST DevInst, IN DEVINST DevInst,
@ -462,6 +500,10 @@ WelcomeDlgProc(
BM_SETCHECK, BM_SETCHECK,
(WPARAM)TRUE, (WPARAM)TRUE,
(LPARAM)0); (LPARAM)0);
SetFailedInstall(DevInstData->hDevInfo,
&DevInstData->devInfoData,
TRUE);
break; break;
} }
@ -807,8 +849,13 @@ InstallDrvDlgProc(
hThread = 0; hThread = 0;
if (wParam == 0) if (wParam == 0)
{ {
/* Should we reboot? */
SP_DEVINSTALL_PARAMS installParams; SP_DEVINSTALL_PARAMS installParams;
SetFailedInstall(DevInstData->hDevInfo,
&DevInstData->devInfoData,
FALSE);
/* Should we reboot? */
installParams.cbSize = sizeof(SP_DEVINSTALL_PARAMS); installParams.cbSize = sizeof(SP_DEVINSTALL_PARAMS);
if (SetupDiGetDeviceInstallParams( if (SetupDiGetDeviceInstallParams(
DevInstData->hDevInfo, DevInstData->hDevInfo,