UINT __stdcall StopHostOnlyInterfaces(MSIHANDLE hModule) { #ifdef VBOX_WITH_NETFLT netCfgLoggerEnable(hModule); logStringW(hModule, L"StopHostOnlyInterfaces: Stopping all host-only interfaces"); BOOL bSetupModeInteractive = SetupSetNonInteractiveMode(FALSE); HRESULT hr = VBoxNetCfgWinPropChangeAllNetDevicesOfId(NETADP_ID, VBOXNECTFGWINPROPCHANGE_TYPE_DISABLE); if (SUCCEEDED(hr)) logStringW(hModule, L"StopHostOnlyInterfaces: Disabling host interfaces was successful, hr = 0x%x", hr); else logStringW(hModule, L"StopHostOnlyInterfaces: Disabling host interfaces failed, hr = 0x%x", hr); /* Restore original setup mode. */ if (bSetupModeInteractive) SetupSetNonInteractiveMode(bSetupModeInteractive); netCfgLoggerDisable(); #endif /* VBOX_WITH_NETFLT */ /* Never fail the install even if we did not succeed. */ return ERROR_SUCCESS; }
static int VBoxNetAdpEnable(void) { VBoxNetCfgWinSetLogging(winNetCfgLogger); printf("enabling all host-only interfaces..\n"); HRESULT hr = CoInitialize(NULL); if (SUCCEEDED(hr)) { hr = VBoxNetCfgWinPropChangeAllNetDevicesOfId(VBOX_NETADP_HWID, VBOXNECTFGWINPROPCHANGE_TYPE_ENABLE); if (SUCCEEDED(hr)) { printf("enabling successful\n"); } else printf("enabling failed, hr = 0x%x\n", hr); CoUninitialize(); } else printf("Error initializing COM (0x%x)\n", hr); VBoxNetCfgWinSetLogging(NULL); return SUCCEEDED(hr) ? 0 : 1; }