From 89c936fdd691a3fcd5c45e58d9ed02d43ad761a7 Mon Sep 17 00:00:00 2001 From: Eric Kohl Date: Sat, 22 Jun 2019 20:59:16 +0200 Subject: [PATCH] [NETCFGX] Start a network adapter device after the custom install steps have been completed. This could probably fix CORE-16103 --- dll/win32/netcfgx/installer.c | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) diff --git a/dll/win32/netcfgx/installer.c b/dll/win32/netcfgx/installer.c index ccde4019a98..a9eb0a710ba 100644 --- a/dll/win32/netcfgx/installer.c +++ b/dll/win32/netcfgx/installer.c @@ -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: