2 * COPYRIGHT: See COPYING in the top level directory
3 * PROJECT: ReactOS Configuration of network devices
4 * FILE: dll/win32/netcfgx/netcfgx.c
5 * PURPOSE: Network devices installer
7 * PROGRAMMERS: Hervé Poussineau (hpoussin@reactos.org)
17 HINSTANCE netcfgx_hInstance
;
19 static INTERFACE_TABLE InterfaceTable
[] =
33 DllMain(HINSTANCE hinstDLL
, DWORD fdwReason
, LPVOID fImpLoad
)
37 case DLL_PROCESS_ATTACH
:
38 netcfgx_hInstance
= hinstDLL
;
39 DisableThreadLibraryCalls(netcfgx_hInstance
);
56 DllRegisterServer(void)
59 // implement registering services
65 DllUnregisterServer(void)
68 // implement unregistering services
81 HRESULT hres
= E_OUTOFMEMORY
;
82 IClassFactory
* pcf
= NULL
;
89 for (i
= 0; InterfaceTable
[i
].riid
; i
++)
91 if (IsEqualIID(InterfaceTable
[i
].riid
, rclsid
))
93 pcf
= IClassFactory_fnConstructor(InterfaceTable
[i
].lpfnCI
, NULL
, NULL
);
100 return CLASS_E_CLASSNOTAVAILABLE
;
103 hres
= IClassFactory_QueryInterface(pcf
, riid
, ppv
);
104 IClassFactory_Release(pcf
);
110 /* Append a REG_SZ to an existing REG_MULTI_SZ string in the registry.
111 * If the value doesn't exist, create it.
112 * Returns ERROR_SUCCESS if success. Othewise, returns an error code
115 AppendStringToMultiSZ(
118 IN PCWSTR ValueToAppend
)
122 DWORD dwRequired
, dwLength
;
126 rc
= RegQueryValueExW(
133 if (rc
!= ERROR_FILE_NOT_FOUND
)
135 if (rc
!= ERROR_SUCCESS
)
137 if (dwRegType
!= REG_MULTI_SZ
)
139 rc
= ERROR_GEN_FAILURE
;
143 dwTmp
= dwLength
= dwRequired
+ wcslen(ValueToAppend
) * sizeof(WCHAR
) + sizeof(UNICODE_NULL
);
144 Buffer
= HeapAlloc(GetProcessHeap(), 0, dwLength
);
147 rc
= ERROR_NOT_ENOUGH_MEMORY
;
150 rc
= RegQueryValueExW(
157 if (rc
!= ERROR_SUCCESS
)
162 dwRequired
= sizeof(WCHAR
);
163 dwLength
= wcslen(ValueToAppend
) * sizeof(WCHAR
) + 2 * sizeof(UNICODE_NULL
);
164 Buffer
= HeapAlloc(GetProcessHeap(), 0, dwLength
);
167 rc
= ERROR_NOT_ENOUGH_MEMORY
;
172 /* Append the value */
173 wcscpy(&Buffer
[dwRequired
/ sizeof(WCHAR
) - 1], ValueToAppend
);
174 /* Terminate the REG_MULTI_SZ string */
175 Buffer
[dwLength
/ sizeof(WCHAR
) - 1] = UNICODE_NULL
;
186 HeapFree(GetProcessHeap(), 0, Buffer
);
190 /* Install a section of a .inf file
191 * Returns TRUE if success, FALSE if failure. Error code can
192 * be retrieved with GetLastError()
198 IN LPCWSTR InfSection OPTIONAL
,
199 IN LPCWSTR InfService OPTIONAL
)
201 WCHAR Buffer
[MAX_PATH
];
202 HINF hInf
= INVALID_HANDLE_VALUE
;
204 PVOID Context
= NULL
;
207 /* Get Windows directory */
208 BufferSize
= MAX_PATH
- 5 - wcslen(InfFile
);
209 if (GetWindowsDirectoryW(Buffer
, BufferSize
) > BufferSize
)
211 /* Function failed */
212 SetLastError(ERROR_GEN_FAILURE
);
215 /* We have enough space to add some information in the buffer */
216 if (Buffer
[wcslen(Buffer
) - 1] != '\\')
217 wcscat(Buffer
, L
"\\");
218 wcscat(Buffer
, L
"Inf\\");
219 wcscat(Buffer
, InfFile
);
221 /* Install specified section */
222 hInf
= SetupOpenInfFileW(Buffer
, NULL
, INF_STYLE_WIN4
, NULL
);
223 if (hInf
== INVALID_HANDLE_VALUE
)
226 Context
= SetupInitDefaultQueueCallback(hWnd
);
231 if (ret
&& InfSection
)
233 ret
= SetupInstallFromInfSectionW(
235 InfSection
, SPINST_ALL
,
236 NULL
, NULL
, SP_COPY_NEWER
,
237 SetupDefaultQueueCallbackW
, Context
,
240 if (ret
&& InfService
)
242 ret
= SetupInstallServicesFromInfSectionW(
243 hInf
, InfService
, 0);
248 SetupTermDefaultQueueCallback(Context
);
249 if (hInf
!= INVALID_HANDLE_VALUE
)
250 SetupCloseInfFile(hInf
);
254 /* Add default services for network cards */
256 InstallAdditionalServices(
261 /* Install TCP/IP protocol */
262 ret
= InstallInfSection(
265 L
"MS_TCPIP.PrimaryInstall",
266 L
"MS_TCPIP.PrimaryInstall.Services");
267 if (!ret
&& GetLastError() != ERROR_FILE_NOT_FOUND
)
269 DPRINT("InstallInfSection() failed with error 0x%lx\n", GetLastError());
270 return GetLastError();
273 /* You can add here more clients (SMB...) and services (DHCP server...) */
275 return ERROR_SUCCESS
;
280 IN HDEVINFO DeviceInfoSet
,
281 IN PSP_DEVINFO_DATA DeviceInfoData
,
283 DWORD Characteristics
,
286 LPWSTR InstanceId
= NULL
;
287 LPWSTR DeviceName
= NULL
;
288 LPWSTR ExportName
= NULL
;
291 HKEY hNetworkKey
= NULL
;
292 HKEY hLinkageKey
= NULL
;
293 HKEY hConnectionKey
= NULL
;
294 DWORD dwShowIcon
, dwLength
;
295 SP_DEVINSTALL_PARAMS_W installParams
;
297 /* Get Instance ID */
298 if (SetupDiGetDeviceInstanceIdW(DeviceInfoSet
, DeviceInfoData
, NULL
, 0, &dwLength
))
300 DPRINT("SetupDiGetDeviceInstanceIdW() returned TRUE. FALSE expected\n");
301 rc
= ERROR_GEN_FAILURE
;
304 InstanceId
= HeapAlloc(GetProcessHeap(), 0, dwLength
* sizeof(WCHAR
));
307 DPRINT("HeapAlloc() failed\n");
308 rc
= ERROR_NOT_ENOUGH_MEMORY
;
311 if (!SetupDiGetDeviceInstanceIdW(DeviceInfoSet
, DeviceInfoData
, InstanceId
, dwLength
, NULL
))
314 DPRINT("SetupDiGetDeviceInstanceIdW() failed with error 0x%lx\n", rc
);
318 /* Create device name */
319 DeviceName
= HeapAlloc(GetProcessHeap(), 0, (wcslen(L
"\\Device\\") + wcslen(UuidString
)) * sizeof(WCHAR
) + sizeof(UNICODE_NULL
));
322 DPRINT("HeapAlloc() failed\n");
323 rc
= ERROR_NOT_ENOUGH_MEMORY
;
326 wcscpy(DeviceName
, L
"\\Device\\");
327 wcscat(DeviceName
, UuidString
);
329 /* Create export name */
330 ExportName
= HeapAlloc(GetProcessHeap(), 0, (wcslen(L
"\\Device\\Tcpip_") + wcslen(UuidString
)) * sizeof(WCHAR
) + sizeof(UNICODE_NULL
));
333 DPRINT("HeapAlloc() failed\n");
334 rc
= ERROR_NOT_ENOUGH_MEMORY
;
337 wcscpy(ExportName
, L
"\\Device\\Tcpip_");
338 wcscat(ExportName
, UuidString
);
340 /* Write Tcpip parameters in new service Key */
341 rc
= RegCreateKeyExW(HKEY_LOCAL_MACHINE
, L
"SYSTEM\\CurrentControlSet\\Services", 0, NULL
, REG_OPTION_NON_VOLATILE
, 0, NULL
, &hKey
, NULL
);
342 if (rc
!= ERROR_SUCCESS
)
344 DPRINT("RegCreateKeyExW() failed with error 0x%lx\n", rc
);
347 rc
= RegCreateKeyExW(hKey
, UuidString
, 0, NULL
, REG_OPTION_NON_VOLATILE
, 0, NULL
, &hNetworkKey
, NULL
);
348 if (rc
!= ERROR_SUCCESS
)
350 DPRINT("RegCreateKeyExW() failed with error 0x%lx\n", rc
);
355 rc
= RegCreateKeyExW(hNetworkKey
, L
"Parameters\\Tcpip", 0, NULL
, REG_OPTION_NON_VOLATILE
, KEY_SET_VALUE
, NULL
, &hKey
, NULL
);
356 if (rc
!= ERROR_SUCCESS
)
358 DPRINT("RegCreateKeyExW() failed with error 0x%lx\n", rc
);
361 RegCloseKey(hNetworkKey
);
363 rc
= RegSetValueExW(hKey
, L
"DefaultGateway", 0, REG_SZ
, (const BYTE
*)L
"0.0.0.0", (wcslen(L
"0.0.0.0") + 1) * sizeof(WCHAR
));
364 if (rc
!= ERROR_SUCCESS
)
366 DPRINT("RegSetValueExW() failed with error 0x%lx\n", rc
);
369 rc
= RegSetValueExW(hKey
, L
"IPAddress", 0, REG_SZ
, (const BYTE
*)L
"0.0.0.0", (wcslen(L
"0.0.0.0") + 1) * sizeof(WCHAR
));
370 if (rc
!= ERROR_SUCCESS
)
372 DPRINT("RegSetValueExW() failed with error 0x%lx\n", rc
);
375 rc
= RegSetValueExW(hKey
, L
"SubnetMask", 0, REG_SZ
, (const BYTE
*)L
"0.0.0.0", (wcslen(L
"0.0.0.0") + 1) * sizeof(WCHAR
));
376 if (rc
!= ERROR_SUCCESS
)
378 DPRINT("RegSetValueExW() failed with error 0x%lx\n", rc
);
384 /* Write 'Linkage' key in hardware key */
385 #if _WIN32_WINNT >= 0x502
386 hKey
= SetupDiOpenDevRegKey(DeviceInfoSet
, DeviceInfoData
, DICS_FLAG_GLOBAL
, 0, DIREG_DRV
, KEY_READ
| KEY_WRITE
);
388 hKey
= SetupDiOpenDevRegKey(DeviceInfoSet
, DeviceInfoData
, DICS_FLAG_GLOBAL
, 0, DIREG_DRV
, KEY_ALL_ACCESS
);
390 if (hKey
== INVALID_HANDLE_VALUE
&& GetLastError() == ERROR_FILE_NOT_FOUND
)
391 hKey
= SetupDiCreateDevRegKeyW(DeviceInfoSet
, DeviceInfoData
, DICS_FLAG_GLOBAL
, 0, DIREG_DRV
, NULL
, NULL
);
392 if (hKey
== INVALID_HANDLE_VALUE
)
396 DPRINT("SetupDiCreateDevRegKeyW() failed with error 0x%lx\n", rc
);
399 rc
= RegSetValueExW(hKey
, L
"NetCfgInstanceId", 0, REG_SZ
, (const BYTE
*)UuidString
, (wcslen(UuidString
) + 1) * sizeof(WCHAR
));
400 if (rc
!= ERROR_SUCCESS
)
402 DPRINT("RegSetValueExW() failed with error 0x%lx\n", rc
);
405 rc
= RegSetValueExW(hKey
, L
"Characteristics", 0, REG_DWORD
, (const BYTE
*)&Characteristics
, sizeof(DWORD
));
406 if (rc
!= ERROR_SUCCESS
)
408 DPRINT("RegSetValueExW() failed with error 0x%lx\n", rc
);
412 rc
= RegSetValueExW(hKey
, L
"BusType", 0, REG_SZ
, (const BYTE
*)BusType
, (wcslen(BusType
) + 1) * sizeof(WCHAR
));
413 if (rc
!= ERROR_SUCCESS
)
415 DPRINT("RegSetValueExW() failed with error 0x%lx\n", rc
);
418 rc
= RegCreateKeyExW(hKey
, L
"Linkage", 0, NULL
, REG_OPTION_NON_VOLATILE
, KEY_SET_VALUE
, NULL
, &hLinkageKey
, NULL
);
419 if (rc
!= ERROR_SUCCESS
)
421 DPRINT("RegCreateKeyExW() failed with error 0x%lx\n", rc
);
424 rc
= RegSetValueExW(hLinkageKey
, L
"Export", 0, REG_SZ
, (const BYTE
*)DeviceName
, (wcslen(DeviceName
) + 1) * sizeof(WCHAR
));
425 if (rc
!= ERROR_SUCCESS
)
427 DPRINT("RegSetValueExW() failed with error 0x%lx\n", rc
);
430 rc
= RegSetValueExW(hLinkageKey
, L
"RootDevice", 0, REG_SZ
, (const BYTE
*)UuidString
, (wcslen(UuidString
) + 1) * sizeof(WCHAR
));
431 if (rc
!= ERROR_SUCCESS
)
433 DPRINT("RegSetValueExW() failed with error 0x%lx\n", rc
);
436 rc
= RegSetValueExW(hLinkageKey
, L
"UpperBind", 0, REG_SZ
, (const BYTE
*)L
"Tcpip", (wcslen(L
"Tcpip") + 1) * sizeof(WCHAR
));
437 if (rc
!= ERROR_SUCCESS
)
439 DPRINT("RegSetValueExW() failed with error 0x%lx\n", rc
);
445 /* Write connection information in network subkey */
446 rc
= RegCreateKeyExW(HKEY_LOCAL_MACHINE
, L
"SYSTEM\\CurrentControlSet\\Control\\Network\\{4D36E972-E325-11CE-BFC1-08002BE10318}", 0, NULL
, REG_OPTION_NON_VOLATILE
, 0, NULL
, &hNetworkKey
, NULL
);
447 if (rc
!= ERROR_SUCCESS
)
449 DPRINT("RegCreateKeyExW() failed with error 0x%lx\n", rc
);
452 rc
= RegCreateKeyExW(hNetworkKey
, UuidString
, 0, NULL
, REG_OPTION_NON_VOLATILE
, KEY_CREATE_SUB_KEY
, NULL
, &hKey
, NULL
);
453 if (rc
!= ERROR_SUCCESS
)
455 DPRINT("RegCreateKeyExW() failed with error 0x%lx\n", rc
);
458 rc
= RegCreateKeyExW(hKey
, L
"Connection", 0, NULL
, REG_OPTION_NON_VOLATILE
, KEY_SET_VALUE
, NULL
, &hConnectionKey
, NULL
);
461 if (rc
!= ERROR_SUCCESS
)
463 DPRINT("RegCreateKeyExW() failed with error 0x%lx\n", rc
);
466 rc
= RegSetValueExW(hConnectionKey
, L
"Name", 0, REG_SZ
, (const BYTE
*)L
"Network connection", (wcslen(L
"Network connection") + 1) * sizeof(WCHAR
));
467 if (rc
!= ERROR_SUCCESS
)
469 DPRINT("RegSetValueExW() failed with error 0x%lx\n", rc
);
472 rc
= RegSetValueExW(hConnectionKey
, L
"PnpInstanceId", 0, REG_SZ
, (const BYTE
*)InstanceId
, (wcslen(InstanceId
) + 1) * sizeof(WCHAR
));
473 if (rc
!= ERROR_SUCCESS
)
475 DPRINT("RegSetValueExW() failed with error 0x%lx\n", rc
);
479 rc
= RegSetValueExW(hConnectionKey
, L
"ShowIcon", 0, REG_DWORD
, (const BYTE
*)&dwShowIcon
, sizeof(dwShowIcon
));
480 if (rc
!= ERROR_SUCCESS
)
482 DPRINT("RegSetValueExW() failed with error 0x%lx\n", rc
);
486 /* Write linkage information in Tcpip service */
487 rc
= RegCreateKeyExW(HKEY_LOCAL_MACHINE
, L
"SYSTEM\\CurrentControlSet\\Services\\Tcpip\\Linkage", 0, NULL
, REG_OPTION_NON_VOLATILE
, KEY_QUERY_VALUE
| KEY_SET_VALUE
, NULL
, &hKey
, NULL
);
488 if (rc
!= ERROR_SUCCESS
)
490 DPRINT("RegCreateKeyExW() failed with error 0x%lx\n", rc
);
493 rc
= AppendStringToMultiSZ(hKey
, L
"Bind", DeviceName
);
494 if (rc
!= ERROR_SUCCESS
)
496 DPRINT("AppendStringToMultiSZ() failed with error 0x%lx\n", rc
);
499 rc
= AppendStringToMultiSZ(hKey
, L
"Export", ExportName
);
500 if (rc
!= ERROR_SUCCESS
)
502 DPRINT("AppendStringToMultiSZ() failed with error 0x%lx\n", rc
);
505 rc
= AppendStringToMultiSZ(hKey
, L
"Route", UuidString
);
506 if (rc
!= ERROR_SUCCESS
)
508 DPRINT("AppendStringToMultiSZ() failed with error 0x%lx\n", rc
);
512 /* Install additionnal services */
513 rc
= InstallAdditionalServices(NULL
);
514 if (rc
!= ERROR_SUCCESS
)
516 DPRINT("InstallAdditionalServices() failed with error 0x%lx\n", rc
);
520 /* HACK: hpoussin, Dec 2005. TCP/IP driver is not able to manage devices
521 * which are installed after its startup. So, we have to reboot to take
522 * this new netcard into account.
524 /* Should we reboot? */
525 installParams
.cbSize
= sizeof(SP_DEVINSTALL_PARAMS_W
);
526 if (!SetupDiGetDeviceInstallParamsW(
532 DPRINT("SetupDiGetDeviceInstallParams() failed with error 0x%lx\n", rc
);
535 installParams
.Flags
|= DI_NEEDRESTART
;
536 if (!SetupDiSetDeviceInstallParamsW(
542 DPRINT("SetupDiSetDeviceInstallParams() failed with error 0x%lx\n", rc
);
548 HeapFree(GetProcessHeap(), 0, InstanceId
);
549 HeapFree(GetProcessHeap(), 0, DeviceName
);
550 HeapFree(GetProcessHeap(), 0, ExportName
);
553 if (hNetworkKey
!= NULL
)
554 RegCloseKey(hNetworkKey
);
555 if (hLinkageKey
!= NULL
)
556 RegCloseKey(hLinkageKey
);
557 if (hConnectionKey
!= NULL
)
558 RegCloseKey(hConnectionKey
);
563 InstallNetClient(VOID
)
565 DPRINT1("Installation of network clients is not yet supported\n");
566 return ERROR_GEN_FAILURE
;
570 InstallNetService(VOID
)
572 DPRINT1("Installation of network services is not yet supported\n");
573 return ERROR_GEN_FAILURE
;
577 InstallNetTransport(VOID
)
579 DPRINT1("Installation of network protocols is not yet supported\n");
580 return ERROR_GEN_FAILURE
;
585 IN DI_FUNCTION InstallFunction
,
586 IN HDEVINFO DeviceInfoSet
,
587 IN PSP_DEVINFO_DATA DeviceInfoData OPTIONAL
)
589 SP_DRVINFO_DATA_W DriverInfoData
;
590 SP_DRVINFO_DETAIL_DATA_W DriverInfoDetail
;
591 WCHAR SectionName
[LINE_LEN
];
592 HINF hInf
= INVALID_HANDLE_VALUE
;
593 INFCONTEXT InfContext
;
595 INT CharacteristicsInt
;
596 DWORD Characteristics
;
597 LPWSTR BusType
= NULL
;
598 RPC_STATUS RpcStatus
;
600 LPWSTR UuidRpcString
= NULL
;
601 LPWSTR UuidString
= NULL
;
605 if (InstallFunction
!= DIF_INSTALLDEVICE
)
606 return ERROR_DI_DO_DEFAULT
;
608 DPRINT("%lu %p %p\n", InstallFunction
, DeviceInfoSet
, DeviceInfoData
);
610 /* Get driver info details */
611 DriverInfoData
.cbSize
= sizeof(SP_DRVINFO_DATA_W
);
612 if (!SetupDiGetSelectedDriverW(DeviceInfoSet
, DeviceInfoData
, &DriverInfoData
))
615 DPRINT("SetupDiGetSelectedDriverW() failed with error 0x%lx\n", rc
);
618 DriverInfoDetail
.cbSize
= sizeof(SP_DRVINFO_DETAIL_DATA_W
);
619 if (!SetupDiGetDriverInfoDetailW(DeviceInfoSet
, DeviceInfoData
, &DriverInfoData
, &DriverInfoDetail
, sizeof(DriverInfoDetail
), NULL
)
620 && GetLastError() != ERROR_INSUFFICIENT_BUFFER
)
623 DPRINT("SetupDiGetDriverInfoDetailW() failed with error 0x%lx\n", rc
);
626 hInf
= SetupOpenInfFileW(DriverInfoDetail
.InfFileName
, NULL
, INF_STYLE_WIN4
, &ErrorLine
);
627 if (hInf
== INVALID_HANDLE_VALUE
)
630 DPRINT("SetupOpenInfFileW() failed with error 0x%lx\n", rc
);
633 if (!SetupDiGetActualSectionToInstallW(hInf
, DriverInfoDetail
.SectionName
, SectionName
, LINE_LEN
, NULL
, NULL
))
636 DPRINT("SetupDiGetActualSectionToInstallW() failed with error 0x%lx\n", rc
);
640 /* Get Characteristics and BusType (optional) from .inf file */
641 if (!SetupFindFirstLineW(hInf
, SectionName
, L
"Characteristics", &InfContext
))
644 DPRINT("Unable to find key %S in section %S of file %S (error 0x%lx)\n",
645 L
"Characteristics", SectionName
, DriverInfoDetail
.InfFileName
, rc
);
648 if (!SetupGetIntField(&InfContext
, 1, &CharacteristicsInt
))
651 DPRINT("SetupGetIntField() failed with error 0x%lx\n", rc
);
654 Characteristics
= (DWORD
)CharacteristicsInt
;
655 if (IsEqualIID(&DeviceInfoData
->ClassGuid
, &GUID_DEVCLASS_NET
))
657 if (SetupFindFirstLineW(hInf
, SectionName
, L
"BusType", &InfContext
))
659 if (!SetupGetStringFieldW(&InfContext
, 1, NULL
, 0, &dwLength
))
662 DPRINT("SetupGetStringFieldW() failed with error 0x%lx\n", rc
);
665 BusType
= HeapAlloc(GetProcessHeap(), 0, dwLength
* sizeof(WCHAR
));
668 DPRINT("HeapAlloc() failed\n");
669 rc
= ERROR_NOT_ENOUGH_MEMORY
;
672 if (!SetupGetStringFieldW(&InfContext
, 1, BusType
, dwLength
, NULL
))
675 DPRINT("SetupGetStringFieldW() failed with error 0x%lx\n", rc
);
681 /* Create a new UUID */
682 RpcStatus
= UuidCreate(&Uuid
);
683 if (RpcStatus
!= RPC_S_OK
&& RpcStatus
!= RPC_S_UUID_LOCAL_ONLY
)
685 DPRINT("UuidCreate() failed with RPC status 0x%lx\n", RpcStatus
);
686 rc
= ERROR_GEN_FAILURE
;
689 RpcStatus
= UuidToStringW(&Uuid
, &UuidRpcString
);
690 if (RpcStatus
!= RPC_S_OK
)
692 DPRINT("UuidToStringW() failed with RPC status 0x%lx\n", RpcStatus
);
693 rc
= ERROR_GEN_FAILURE
;
697 /* Add curly braces around Uuid */
698 UuidString
= HeapAlloc(GetProcessHeap(), 0, (2 + wcslen(UuidRpcString
)) * sizeof(WCHAR
) + sizeof(UNICODE_NULL
));
701 DPRINT("HeapAlloc() failed\n");
702 rc
= ERROR_NOT_ENOUGH_MEMORY
;
705 wcscpy(UuidString
, L
"{");
706 wcscat(UuidString
, UuidRpcString
);
707 wcscat(UuidString
, L
"}");
709 if (IsEqualIID(&DeviceInfoData
->ClassGuid
, &GUID_DEVCLASS_NET
))
710 rc
= InstallNetDevice(DeviceInfoSet
, DeviceInfoData
, UuidString
, Characteristics
, BusType
);
711 else if (IsEqualIID(&DeviceInfoData
->ClassGuid
, &GUID_DEVCLASS_NETCLIENT
))
712 rc
= InstallNetClient();
713 else if (IsEqualIID(&DeviceInfoData
->ClassGuid
, &GUID_DEVCLASS_NETSERVICE
))
714 rc
= InstallNetService();
715 else if (IsEqualIID(&DeviceInfoData
->ClassGuid
, &GUID_DEVCLASS_NETTRANS
))
716 rc
= InstallNetTransport();
719 DPRINT("Invalid class guid\n");
720 rc
= ERROR_GEN_FAILURE
;
724 if (hInf
!= INVALID_HANDLE_VALUE
)
725 SetupCloseInfFile(hInf
);
726 if (UuidRpcString
!= NULL
)
727 RpcStringFreeW(&UuidRpcString
);
728 HeapFree(GetProcessHeap(), 0, BusType
);
729 HeapFree(GetProcessHeap(), 0, UuidString
);
731 if (rc
== ERROR_SUCCESS
)
732 rc
= ERROR_DI_DO_DEFAULT
;
733 DPRINT("Returning 0x%lx\n", rc
);