Changeset 38732 in vbox for trunk/src/VBox/HostDrivers/VBoxNetFlt
- Timestamp:
- Sep 13, 2011 1:09:39 PM (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/HostDrivers/VBoxNetFlt/win/cfg/VBoxNetCfg.cpp
r37301 r38732 37 37 38 38 39 #ifndef Assert 39 #ifndef Assert /** @todo r=bird: where would this be defined? */ 40 40 //# ifdef DEBUG 41 41 //# define Assert(_expr) assert(_expr) … … 49 49 50 50 static VOID DoLogging(LPCSTR szString, ...); 51 #define Log DoLogging52 #define LogFlow(x) DoLogging x53 54 #define DbgLog 55 56 #define VBOX_NETCFG_LOCK_TIME_OUT 5000 51 #define NonStandardLog DoLogging 52 #define NonStandardLogFlow(x) DoLogging x 53 54 #define DbgLog /** @todo r=bird: What does this do? */ 55 56 #define VBOX_NETCFG_LOCK_TIME_OUT 5000 /** @todo r=bird: What does this do? */ 57 57 58 58 … … 66 66 if (FAILED(hr)) 67 67 { 68 LogFlow(("QueryInterface failed, hr (0x%x)\n", hr));68 NonStandardLogFlow(("QueryInterface failed, hr (0x%x)\n", hr)); 69 69 return hr; 70 70 } … … 73 73 if (hr == S_FALSE) 74 74 { 75 LogFlow(("Write lock busy\n"));75 NonStandardLogFlow(("Write lock busy\n")); 76 76 } 77 77 else if (FAILED(hr)) 78 78 { 79 LogFlow(("AcquireWriteLock failed, hr (0x%x)\n", hr));79 NonStandardLogFlow(("AcquireWriteLock failed, hr (0x%x)\n", hr)); 80 80 } 81 81 … … 90 90 if (FAILED(hr)) 91 91 { 92 LogFlow(("QueryInterface failed, hr (0x%x)\n", hr));92 NonStandardLogFlow(("QueryInterface failed, hr (0x%x)\n", hr)); 93 93 return hr; 94 94 } … … 96 96 hr = pLock->ReleaseWriteLock(); 97 97 if (FAILED(hr)) 98 LogFlow(("ReleaseWriteLock failed, hr (0x%x)\n", hr));98 NonStandardLogFlow(("ReleaseWriteLock failed, hr (0x%x)\n", hr)); 99 99 100 100 pLock->Release(); … … 112 112 if (FAILED(hr)) 113 113 { 114 LogFlow(("CoCreateInstance failed, hr (0x%x)\n", hr));114 NonStandardLogFlow(("CoCreateInstance failed, hr (0x%x)\n", hr)); 115 115 return hr; 116 116 } … … 121 121 if (hr == S_FALSE) 122 122 { 123 LogFlow(("Write lock is busy\n", hr));123 NonStandardLogFlow(("Write lock is busy\n", hr)); 124 124 hr = NETCFG_E_NO_WRITE_LOCK; 125 125 } … … 135 135 } 136 136 else 137 LogFlow(("Initialize failed, hr (0x%x)\n", hr));137 NonStandardLogFlow(("Initialize failed, hr (0x%x)\n", hr)); 138 138 } 139 139 … … 147 147 if (FAILED(hr)) 148 148 { 149 LogFlow(("Uninitialize failed, hr (0x%x)\n", hr));149 NonStandardLogFlow(("Uninitialize failed, hr (0x%x)\n", hr)); 150 150 return hr; 151 151 } … … 155 155 hr = vboxNetCfgWinINetCfgUnlock(pNetCfg); 156 156 if (FAILED(hr)) 157 LogFlow(("vboxNetCfgWinINetCfgUnlock failed, hr (0x%x)\n", hr));157 NonStandardLogFlow(("vboxNetCfgWinINetCfgUnlock failed, hr (0x%x)\n", hr)); 158 158 } 159 159 … … 169 169 if (FAILED(hr)) 170 170 { 171 LogFlow(("Reset failed, hr (0x%x)\n", hr));171 NonStandardLogFlow(("Reset failed, hr (0x%x)\n", hr)); 172 172 return hr; 173 173 } … … 195 195 } 196 196 else 197 LogFlow(("GetInstanceGuid failed, hr (0x%x)\n", hr));197 NonStandardLogFlow(("GetInstanceGuid failed, hr (0x%x)\n", hr)); 198 198 } 199 199 } … … 217 217 if (hr == S_FALSE) 218 218 { 219 LogFlow(("Component not found\n"));219 NonStandardLogFlow(("Component not found\n")); 220 220 } 221 221 else if (FAILED(hr)) 222 222 { 223 LogFlow(("vboxNetCfgWinGetComponentByGuidEnum failed, hr (0x%x)\n", hr));223 NonStandardLogFlow(("vboxNetCfgWinGetComponentByGuidEnum failed, hr (0x%x)\n", hr)); 224 224 } 225 225 pEnumNcc->Release(); 226 226 } 227 227 else 228 LogFlow(("EnumComponents failed, hr (0x%x)\n", hr));228 NonStandardLogFlow(("EnumComponents failed, hr (0x%x)\n", hr)); 229 229 return hr; 230 230 } … … 234 234 HRESULT hr = pNetCfg->QueryNetCfgClass(pguidClass, IID_INetCfgClassSetup, (void**)ppSetup); 235 235 if (FAILED(hr)) 236 LogFlow(("QueryNetCfgClass failed, hr (0x%x)\n", hr));236 NonStandardLogFlow(("QueryNetCfgClass failed, hr (0x%x)\n", hr)); 237 237 return hr; 238 238 } … … 245 245 if (FAILED(hr)) 246 246 { 247 LogFlow(("vboxNetCfgWinQueryInstaller failed, hr (0x%x)\n", hr));247 NonStandardLogFlow(("vboxNetCfgWinQueryInstaller failed, hr (0x%x)\n", hr)); 248 248 return hr; 249 249 } … … 265 265 Assert(tmpHr == S_OK); 266 266 if (tmpHr != S_OK) 267 LogFlow(("Apply failed, hr (0x%x)\n", tmpHr));267 NonStandardLogFlow(("Apply failed, hr (0x%x)\n", tmpHr)); 268 268 } 269 269 else 270 LogFlow(("Install failed, hr (0x%x)\n", hr));270 NonStandardLogFlow(("Install failed, hr (0x%x)\n", hr)); 271 271 272 272 pSetup->Release(); … … 281 281 UINT i = 0; 282 282 283 LogFlow(("Installing %u INF files ...\n", cInfPaths));283 NonStandardLogFlow(("Installing %u INF files ...\n", cInfPaths)); 284 284 285 285 for (; i < cInfPaths; i++) 286 286 { 287 LogFlow(("Installing INF file \"%ws\" ...\n", apInfPaths[i]));287 NonStandardLogFlow(("Installing INF file \"%ws\" ...\n", apInfPaths[i])); 288 288 hr = VBoxDrvCfgInfInstall(apInfPaths[i]); 289 289 if (FAILED(hr)) 290 290 { 291 LogFlow(("VBoxNetCfgWinInfInstall failed, hr (0x%x)\n", hr));291 NonStandardLogFlow(("VBoxNetCfgWinInfInstall failed, hr (0x%x)\n", hr)); 292 292 break; 293 293 } … … 298 298 hr = VBoxNetCfgWinInstallComponent(pNetCfg, pszwComponentId, pguidClass, ppComponent); 299 299 if (FAILED(hr)) 300 LogFlow(("VBoxNetCfgWinInstallComponent failed, hr (0x%x)\n", hr));300 NonStandardLogFlow(("VBoxNetCfgWinInstallComponent failed, hr (0x%x)\n", hr)); 301 301 } 302 302 … … 316 316 if (FAILED(hr)) 317 317 { 318 LogFlow(("GetClassGuid failed, hr (0x%x)\n", hr));318 NonStandardLogFlow(("GetClassGuid failed, hr (0x%x)\n", hr)); 319 319 return hr; 320 320 } … … 324 324 if (FAILED(hr)) 325 325 { 326 LogFlow(("vboxNetCfgWinQueryInstaller failed, hr (0x%x)\n", hr));326 NonStandardLogFlow(("vboxNetCfgWinQueryInstaller failed, hr (0x%x)\n", hr)); 327 327 return hr; 328 328 } … … 337 337 hr = pNetCfg->Apply(); 338 338 if (FAILED(hr)) 339 LogFlow(("Apply failed, hr (0x%x)\n", hr));339 NonStandardLogFlow(("Apply failed, hr (0x%x)\n", hr)); 340 340 } 341 341 else 342 LogFlow(("DeInstall failed, hr (0x%x)\n", hr));342 NonStandardLogFlow(("DeInstall failed, hr (0x%x)\n", hr)); 343 343 344 344 if (pSetup) … … 386 386 } 387 387 else 388 LogFlow(("Next failed, hr (0x%x)\n", hr));388 NonStandardLogFlow(("Next failed, hr (0x%x)\n", hr)); 389 389 break; 390 390 } … … 418 418 { 419 419 hr = S_FALSE; 420 Log(("!!!REBOOT REQUIRED!!!\n"));420 NonStandardLog(("!!!REBOOT REQUIRED!!!\n")); 421 421 } 422 422 } … … 425 425 { 426 426 DWORD dwErr = GetLastError(); 427 LogFlow(("SetupDiCallClassInstaller failed with %ld\n", dwErr));427 NonStandardLogFlow(("SetupDiCallClassInstaller failed with %ld\n", dwErr)); 428 428 hr = HRESULT_FROM_WIN32(dwErr); 429 429 } … … 432 432 { 433 433 DWORD dwErr = GetLastError(); 434 LogFlow(("SetupDiSetSelectedDevice failed with %ld\n", dwErr));434 NonStandardLogFlow(("SetupDiSetSelectedDevice failed with %ld\n", dwErr)); 435 435 hr = HRESULT_FROM_WIN32(dwErr); 436 436 } … … 439 439 { 440 440 DWORD dwErr = GetLastError(); 441 LogFlow(("SetupDiSetClassInstallParams failed with %ld\n", dwErr));441 NonStandardLogFlow(("SetupDiSetClassInstallParams failed with %ld\n", dwErr)); 442 442 hr = HRESULT_FROM_WIN32(dwErr); 443 443 } … … 486 486 if (winEr != ERROR_INSUFFICIENT_BUFFER) 487 487 { 488 LogFlow(("SetupDiGetDeviceRegistryPropertyW (1) failed winErr(%d)\n", winEr));488 NonStandardLogFlow(("SetupDiGetDeviceRegistryPropertyW (1) failed winErr(%d)\n", winEr)); 489 489 hr = HRESULT_FROM_WIN32(winEr); 490 490 break; … … 506 506 { 507 507 winEr = GetLastError(); 508 LogFlow(("SetupDiGetDeviceRegistryPropertyW (2) failed winErr(%d)\n", winEr));508 NonStandardLogFlow(("SetupDiGetDeviceRegistryPropertyW (2) failed winErr(%d)\n", winEr)); 509 509 hr = HRESULT_FROM_WIN32(winEr); 510 510 break; … … 541 541 { 542 542 DWORD winEr = GetLastError(); 543 LogFlow(("SetupDiGetClassDevsExW failed winErr(%d)\n", winEr));543 NonStandardLogFlow(("SetupDiGetClassDevsExW failed winErr(%d)\n", winEr)); 544 544 hr = HRESULT_FROM_WIN32(winEr); 545 545 } … … 824 824 } 825 825 else 826 LogFlow(("ExecQuery failed (0x%x)\n", hr));826 NonStandardLogFlow(("ExecQuery failed (0x%x)\n", hr)); 827 827 } 828 828 else 829 829 { 830 830 DWORD winEr = GetLastError(); 831 LogFlow(("StringFromGUID2 failed winEr (%d)\n", winEr));831 NonStandardLogFlow(("StringFromGUID2 failed winEr (%d)\n", winEr)); 832 832 hr = HRESULT_FROM_WIN32( winEr ); 833 833 } … … 1028 1028 } 1029 1029 else 1030 LogFlow(("CoSetProxyBlanket failed, hr (0x%x)\n", hr));1030 NonStandardLogFlow(("CoSetProxyBlanket failed, hr (0x%x)\n", hr)); 1031 1031 1032 1032 pSvc->Release(); 1033 1033 } 1034 1034 else 1035 LogFlow(("ConnectServer failed, hr (0x%x)\n", hr));1035 NonStandardLogFlow(("ConnectServer failed, hr (0x%x)\n", hr)); 1036 1036 pLoc->Release(); 1037 1037 } 1038 1038 else 1039 LogFlow(("CoCreateInstance failed, hr (0x%x)\n", hr));1039 NonStandardLogFlow(("CoCreateInstance failed, hr (0x%x)\n", hr)); 1040 1040 return hr; 1041 1041 } … … 1052 1052 } 1053 1053 else 1054 LogFlow(("Get failed, hr (0x%x)\n", hr));1054 NonStandardLogFlow(("Get failed, hr (0x%x)\n", hr)); 1055 1055 return hr; 1056 1056 } … … 1804 1804 } 1805 1805 else 1806 LogFlow(("GetAdaptersAddresses err (%d)\n", dwRc));1806 NonStandardLogFlow(("GetAdaptersAddresses err (%d)\n", dwRc)); 1807 1807 1808 1808 if (pAddresses) … … 1829 1829 if (hr == S_OK) 1830 1830 { 1831 Log("NetFlt is installed currently, uninstalling ...\n");1831 NonStandardLog("NetFlt is installed currently, uninstalling ...\n"); 1832 1832 1833 1833 hr = VBoxNetCfgWinUninstallComponent(pNc, pNcc); … … 1837 1837 else if (hr == S_FALSE) 1838 1838 { 1839 Log("NetFlt is not installed currently\n");1839 NonStandardLog("NetFlt is not installed currently\n"); 1840 1840 hr = S_OK; 1841 1841 } 1842 1842 else 1843 1843 { 1844 LogFlow(("FindComponent failed, hr (0x%x)\n", hr));1844 NonStandardLogFlow(("FindComponent failed, hr (0x%x)\n", hr)); 1845 1845 hr = S_OK; 1846 1846 } … … 1863 1863 if (SUCCEEDED(hr)) 1864 1864 { 1865 Log("NetFlt will be installed ...\n");1865 NonStandardLog("NetFlt will be installed ...\n"); 1866 1866 hr = VBoxNetCfgWinInstallInfAndComponent(pNc, VBOXNETCFGWIN_NETFLT_ID, 1867 1867 &GUID_DEVCLASS_NETSERVICE, … … 1950 1950 hr = pNetCfgBindings->MoveAfter(pNetCfgBindPath, NULL); 1951 1951 if (FAILED(hr)) 1952 LogFlow(("Unable to move interface, hr (0x%x)\n", hr));1952 NonStandardLogFlow(("Unable to move interface, hr (0x%x)\n", hr)); 1953 1953 bFoundIface = true; 1954 1954 } … … 1957 1957 } 1958 1958 else 1959 LogFlow(("GetLowerComponent failed, hr (0x%x)\n", hr));1959 NonStandardLogFlow(("GetLowerComponent failed, hr (0x%x)\n", hr)); 1960 1960 pNetCfgBindIfce->Release(); 1961 1961 } … … 1965 1965 hr = S_OK; 1966 1966 else 1967 LogFlow(("Next binding interface failed, hr (0x%x)\n", hr));1967 NonStandardLogFlow(("Next binding interface failed, hr (0x%x)\n", hr)); 1968 1968 break; 1969 1969 } … … 1972 1972 } 1973 1973 else 1974 LogFlow(("EnumBindingInterfaces failed, hr (0x%x)\n", hr));1974 NonStandardLogFlow(("EnumBindingInterfaces failed, hr (0x%x)\n", hr)); 1975 1975 pNetCfgBindPath->Release(); 1976 1976 } … … 1980 1980 hr = S_OK; 1981 1981 else 1982 LogFlow(("Next bind path failed, hr (0x%x)\n", hr));1982 NonStandardLogFlow(("Next bind path failed, hr (0x%x)\n", hr)); 1983 1983 break; 1984 1984 } … … 1987 1987 } 1988 1988 else 1989 LogFlow(("EnumBindingPaths failed, hr (0x%x)\n", hr));1989 NonStandardLogFlow(("EnumBindingPaths failed, hr (0x%x)\n", hr)); 1990 1990 pNetCfgBindings->Release(); 1991 1991 } 1992 1992 else 1993 LogFlow(("QueryInterface for IID_INetCfgComponentBindings failed, hr (0x%x)\n", hr));1993 NonStandardLogFlow(("QueryInterface for IID_INetCfgComponentBindings failed, hr (0x%x)\n", hr)); 1994 1994 return TRUE; 1995 1995 } … … 2130 2130 if (1) { \ 2131 2131 hrc = E_FAIL; \ 2132 Log strAndArgs; \2132 NonStandardLog strAndArgs; \ 2133 2133 break; \ 2134 2134 } else do {} while (0) … … 2429 2429 { 2430 2430 DWORD winEr = GetLastError(); 2431 LogFlow(("SetupDiSetDeviceInstallParams failed, winEr (%d)\n", winEr));2431 NonStandardLogFlow(("SetupDiSetDeviceInstallParams failed, winEr (%d)\n", winEr)); 2432 2432 break; 2433 2433 } … … 2435 2435 else 2436 2436 { 2437 LogFlow(("SetupDiSetDeviceInstallParams faileed: INF path is too long\n"));2437 NonStandardLogFlow(("SetupDiSetDeviceInstallParams faileed: INF path is too long\n")); 2438 2438 break; 2439 2439 } … … 2442 2442 { 2443 2443 DWORD winEr = GetLastError(); 2444 LogFlow(("SetupDiGetDeviceInstallParams failed, winEr (%d)\n", winEr));2444 NonStandardLogFlow(("SetupDiGetDeviceInstallParams failed, winEr (%d)\n", winEr)); 2445 2445 } 2446 2446 } … … 2563 2563 { 2564 2564 DWORD winEr = GetLastError(); 2565 LogFlow(("SetupDiSetDeviceInstallParams failed, winEr (%d)\n", winEr));2565 NonStandardLogFlow(("SetupDiSetDeviceInstallParams failed, winEr (%d)\n", winEr)); 2566 2566 } 2567 2567 Assert(fResult); … … 2570 2570 { 2571 2571 DWORD winEr = GetLastError(); 2572 LogFlow(("SetupInitDefaultQueueCallback failed, winEr (%d)\n", winEr));2572 NonStandardLogFlow(("SetupInitDefaultQueueCallback failed, winEr (%d)\n", winEr)); 2573 2573 } 2574 2574 } … … 2576 2576 { 2577 2577 DWORD winEr = GetLastError(); 2578 LogFlow(("SetupDiGetDeviceInstallParams failed, winEr (%d)\n", winEr));2578 NonStandardLogFlow(("SetupDiGetDeviceInstallParams failed, winEr (%d)\n", winEr)); 2579 2579 } 2580 2580 … … 2712 2712 if (!*lppszName) 2713 2713 { 2714 LogFlow(("SysAllocString failed\n"));2714 NonStandardLogFlow(("SysAllocString failed\n")); 2715 2715 hrc = HRESULT_FROM_WIN32(ERROR_NOT_ENOUGH_MEMORY); 2716 2716 } … … 2721 2721 hrc = CLSIDFromString(pWCfgGuidString, (LPCLSID)pGuid); 2722 2722 if (FAILED(hrc)) 2723 LogFlow(("CLSIDFromString failed, hrc (0x%x)\n", hrc));2723 NonStandardLogFlow(("CLSIDFromString failed, hrc (0x%x)\n", hrc)); 2724 2724 } 2725 2725 … … 2754 2754 } 2755 2755 else 2756 LogFlow(("Enumeration failed, hr 0x%x\n", hr));2756 NonStandardLogFlow(("Enumeration failed, hr 0x%x\n", hr)); 2757 2757 VBoxNetCfgWinReleaseINetCfg(pNetCfg, TRUE); 2758 2758 } 2759 2759 else if (hr == NETCFG_E_NO_WRITE_LOCK && lpszApp) 2760 2760 { 2761 LogFlow(("Application %ws is holding the lock, failed\n", lpszApp));2761 NonStandardLogFlow(("Application %ws is holding the lock, failed\n", lpszApp)); 2762 2762 CoTaskMemFree(lpszApp); 2763 2763 } 2764 2764 else 2765 LogFlow(("VBoxNetCfgWinQueryINetCfg failed, hr 0x%x\n", hr));2765 NonStandardLogFlow(("VBoxNetCfgWinQueryINetCfg failed, hr 0x%x\n", hr)); 2766 2766 } 2767 2767 return hrc;
Note:
See TracChangeset
for help on using the changeset viewer.