https://git.reactos.org/?p=reactos.git;a=commitdiff;h=89c936fdd691a3fcd5c45e58d9ed02d43ad761a7

commit 89c936fdd691a3fcd5c45e58d9ed02d43ad761a7
Author:     Eric Kohl <eric.k...@reactos.org>
AuthorDate: Sat Jun 22 20:59:16 2019 +0200
Commit:     Eric Kohl <eric.k...@reactos.org>
CommitDate: Sat Jun 22 21:01:26 2019 +0200

    [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:

Reply via email to