VirtualBox

Ignore:
Timestamp:
Jul 31, 2015 4:36:57 PM (9 years ago)
Author:
vboxsync
Message:

Main: Attempted fix for Win10 host-only interface creation.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/HostDrivers/VBoxNetFlt/win/cfg/VBoxNetCfg.cpp

    r57143 r57147  
    29622962            SetErrBreak(("SetupDiOpenDevRegKey failed (0x%08X)", GetLastError()));
    29632963
    2964         cbSize = sizeof(pWCfgGuidString);
    2965         DWORD ret;
    2966         ret = RegQueryValueExW (hkey, L"NetCfgInstanceId", NULL,
    2967                                &dwValueType, (LPBYTE) pWCfgGuidString, &cbSize);
    2968 
    2969         RegCloseKey (hkey);
    2970 
    29712964        if (!SetupDiGetDeviceRegistryPropertyW(hDeviceInfo, &DeviceInfoData,
    29722965                                               SPDRP_FRIENDLYNAME , /* IN DWORD Property,*/
     
    29962989            }
    29972990        }
     2991
     2992        /* Query the instance ID; on Windows 10, the registry key may take a short
     2993         * while to appear. Microsoft recommends waiting for up to 5 seconds.
     2994         */
     2995        for (int retries = 0; retries < 5 * 5; ++retries)
     2996        {
     2997            cbSize = sizeof(pWCfgGuidString);
     2998            ret = RegQueryValueExW (hkey, L"NetCfgInstanceId", NULL,
     2999                                   &dwValueType, (LPBYTE) pWCfgGuidString, &cbSize);
     3000            /* As long as the return code is FILE_NOT_FOUND, sleep and retry. */
     3001            if (ret == ERROR_FILE_NOT_FOUND)
     3002                Sleep(200); /* 1/5 of a second. */
     3003            else
     3004                break;
     3005        }
     3006        RegCloseKey (hkey);
     3007
     3008        if (ret != ERROR_SUCCESS)
     3009            SetErrBreak(("Querying NetCfgInstanceId failed (0x%08X)", GetLastError()));
    29983010    }
    29993011    while (0);
Note: See TracChangeset for help on using the changeset viewer.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette