Ticket #14040: VBoxNetCfg-Win10.patch
| File VBoxNetCfg-Win10.patch, 1.7 KB (added by , 9 years ago) |
|---|
-
VBoxNetCfg.cpp
2961 2961 if (hkey == INVALID_HANDLE_VALUE) 2962 2962 SetErrBreak(("SetupDiOpenDevRegKey failed (0x%08X)", GetLastError())); 2963 2963 2964 cbSize = sizeof(pWCfgGuidString); 2964 /* 2965 * Since Windows 10 it apparently takes some time before the necessary 2966 * value "NetCfgInstanceId" appears in the registry. Retry silently for 2967 * a while and fail only if it really does not show up. 2968 */ 2965 2969 DWORD ret; 2966 ret = RegQueryValueExW (hkey, L"NetCfgInstanceId", NULL, 2967 &dwValueType, (LPBYTE) pWCfgGuidString, &cbSize); 2970 int retry = 0; 2971 for (;;) 2972 { 2973 cbSize = sizeof(pWCfgGuidString); 2974 ret = RegQueryValueExW (hkey, L"NetCfgInstanceId", NULL, 2975 &dwValueType, (LPBYTE) pWCfgGuidString, &cbSize); 2976 if (ret != ERROR_FILE_NOT_FOUND || ++retry > 3 * 4) 2977 break; 2978 Sleep(250); 2979 } 2980 if (ret != ERROR_SUCCESS) 2981 SetErrBreak(("RegQueryValueEx(NetCfgInstanceId) failed (0x%08X)", ret)); 2968 2982 2969 2983 RegCloseKey (hkey); 2970 2984 … … 3007 3021 if (hDeviceInfo != INVALID_HANDLE_VALUE) 3008 3022 { 3009 3023 /* an error has occurred, but the device is registered, we must remove it */ 3010 if ( ret != 0&& registered)3024 if (FAILED(hrc) && registered) 3011 3025 SetupDiCallClassInstaller(DIF_REMOVE, hDeviceInfo, &DeviceInfoData); 3012 3026 3013 3027 found = SetupDiDeleteDeviceInfo(hDeviceInfo, &DeviceInfoData);

