Try to open driver registry key before creating it.
Fixes bug 977
Modified: trunk/reactos/lib/netcfgx/netcfgx.c
_____
Modified: trunk/reactos/lib/netcfgx/netcfgx.c
--- trunk/reactos/lib/netcfgx/netcfgx.c 2005-11-12 20:28:32 UTC (rev
19185)
+++ trunk/reactos/lib/netcfgx/netcfgx.c 2005-11-12 21:11:09 UTC (rev
19186)
@@ -210,7 +210,13 @@
hKey = INVALID_HANDLE_VALUE;
/* Write 'Linkage' key in hardware key */
- hKey = SetupDiCreateDevRegKeyW(DeviceInfoSet, DeviceInfoData,
DICS_FLAG_GLOBAL, 0, DIREG_DRV, NULL, NULL);
+#if _WIN32_WINNT >= 0x502
+ hKey = SetupDiOpenDevRegKey(DeviceInfoSet, DeviceInfoData,
DICS_FLAG_GLOBAL, 0, DIREG_DRV, KEY_READ | KEY_WRITE);
+#else
+ hKey = SetupDiOpenDevRegKey(DeviceInfoSet, DeviceInfoData,
DICS_FLAG_GLOBAL, 0, DIREG_DRV, KEY_ALL_ACCESS);
+#endif
+ if (hKey == INVALID_HANDLE_VALUE && GetLastError() ==
ERROR_FILE_NOT_FOUND)
+ hKey = SetupDiCreateDevRegKeyW(DeviceInfoSet,
DeviceInfoData, DICS_FLAG_GLOBAL, 0, DIREG_DRV, NULL, NULL);
if (hKey == INVALID_HANDLE_VALUE)
{
rc = GetLastError();
Show replies by date