[NETCFGX] Start a network adapter device after the custom install steps have been completed.

This could probably fix CORE-16103
This commit is contained in:
Eric Kohl 2019-06-22 20:59:16 +02:00
parent 8dc70d2454
commit 89c936fdd6

View file

@ -99,6 +99,7 @@ InstallNetDevice(
DWORD Characteristics,
LPCWSTR BusType)
{
SP_DEVINSTALL_PARAMS_W DeviceInstallParams;
LPWSTR InstanceId = NULL;
LPWSTR ComponentId = NULL;
LPWSTR DeviceName = NULL;
@ -112,6 +113,28 @@ InstallNetDevice(
WCHAR szBuffer[300];
PWSTR ptr;
DeviceInstallParams.cbSize = sizeof(DeviceInstallParams);
if (!SetupDiGetDeviceInstallParamsW(DeviceInfoSet,
DeviceInfoData,
&DeviceInstallParams))
{
rc = GetLastError();
ERR("SetupDiGetDeviceInstallParamsW() failed (Error %lu)\n", rc);
goto cleanup;
}
/* Do not start the adapter in the call to SetupDiInstallDevice */
DeviceInstallParams.Flags |= DI_DONOTCALLCONFIGMG;
if (!SetupDiSetDeviceInstallParamsW(DeviceInfoSet,
DeviceInfoData,
&DeviceInstallParams))
{
rc = GetLastError();
ERR("SetupDiSetDeviceInstallParamsW() failed (Error %lu)\n", rc);
goto cleanup;
}
/* Install the adapter */
if (!SetupDiInstallDevice(DeviceInfoSet, DeviceInfoData))
{
@ -389,6 +412,14 @@ InstallNetDevice(
goto cleanup;
}
/* Start the device */
if (!SetupDiRestartDevices(DeviceInfoSet, DeviceInfoData))
{
rc = GetLastError();
ERR("SetupDiRestartDevices() failed with error 0x%lx\n", rc);
goto cleanup;
}
rc = ERROR_SUCCESS;
cleanup: