Changeset 40993 in vbox for trunk/src/VBox/HostDrivers/VBoxNetFlt/win/cfg
- Timestamp:
- Apr 19, 2012 2:25:38 PM (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/HostDrivers/VBoxNetFlt/win/cfg/VBoxNetCfg.cpp
r38797 r40993 448 448 } 449 449 450 typedef struct VBOXNECTFGWINPROPCHANGE 451 { 452 VBOXNECTFGWINPROPCHANGE_TYPE enmPcType; 453 HRESULT hr; 454 } VBOXNECTFGWINPROPCHANGE ,*PVBOXNECTFGWINPROPCHANGE; 455 456 static BOOL vboxNetCfgWinPropChangeAllNetDevicesOfIdCallback(HDEVINFO hDevInfo, PSP_DEVINFO_DATA pDev, PVOID pContext) 457 { 458 PVBOXNECTFGWINPROPCHANGE pPc = (PVBOXNECTFGWINPROPCHANGE)pContext; 459 HRESULT hr = S_OK; 460 SP_PROPCHANGE_PARAMS PcParams; 461 memset (&PcParams, 0, sizeof (PcParams)); 462 463 PcParams.ClassInstallHeader.cbSize = sizeof (SP_CLASSINSTALL_HEADER); 464 PcParams.ClassInstallHeader.InstallFunction = DIF_PROPERTYCHANGE; 465 PcParams.Scope = DICS_FLAG_GLOBAL; 466 PcParams.HwProfile = 0; 467 switch(pPc->enmPcType) 468 { 469 case VBOXNECTFGWINPROPCHANGE_TYPE_DISABLE: 470 PcParams.StateChange = DICS_DISABLE; 471 break; 472 case VBOXNECTFGWINPROPCHANGE_TYPE_ENABLE: 473 PcParams.StateChange = DICS_ENABLE; 474 break; 475 default: 476 NonStandardLogFlow(("unexpected prop change type: %d\n", pPc->enmPcType)); 477 pPc->hr = E_INVALIDARG; 478 return FALSE; 479 } 480 481 482 if (SetupDiSetClassInstallParams(hDevInfo, pDev, &PcParams.ClassInstallHeader, sizeof (PcParams))) 483 { 484 if (SetupDiSetSelectedDevice(hDevInfo, pDev)) 485 { 486 if (SetupDiCallClassInstaller(DIF_PROPERTYCHANGE, hDevInfo, pDev)) 487 { 488 SP_DEVINSTALL_PARAMS devParams; 489 devParams.cbSize = sizeof(devParams); 490 if (SetupDiGetDeviceInstallParams(hDevInfo,pDev,&devParams)) 491 { 492 if (devParams.Flags & (DI_NEEDRESTART|DI_NEEDREBOOT)) 493 { 494 hr = S_FALSE; 495 NonStandardLogFlow(("PropChange: !!!REBOOT REQUIRED!!!\n")); 496 } 497 } 498 } 499 else 500 { 501 DWORD dwErr = GetLastError(); 502 NonStandardLogFlow(("SetupDiCallClassInstaller failed with %ld\n", dwErr)); 503 hr = HRESULT_FROM_WIN32(dwErr); 504 } 505 } 506 else 507 { 508 DWORD dwErr = GetLastError(); 509 NonStandardLogFlow(("SetupDiSetSelectedDevice failed with %ld\n", dwErr)); 510 hr = HRESULT_FROM_WIN32(dwErr); 511 } 512 } 513 else 514 { 515 DWORD dwErr = GetLastError(); 516 NonStandardLogFlow(("SetupDiSetClassInstallParams failed with %ld\n", dwErr)); 517 hr = HRESULT_FROM_WIN32(dwErr); 518 } 519 520 return TRUE; 521 } 522 450 523 typedef BOOL (*VBOXNETCFGWIN_NETENUM_CALLBACK) (HDEVINFO hDevInfo, PSP_DEVINFO_DATA pDev, PVOID pContext); 451 524 VBOXNETCFGWIN_DECL(HRESULT) VBoxNetCfgWinEnumNetDevices(LPCWSTR pPnPId, VBOXNETCFGWIN_NETENUM_CALLBACK callback, PVOID pContext) … … 553 626 { 554 627 return VBoxNetCfgWinEnumNetDevices(lpszPnPId, vboxNetCfgWinRemoveAllNetDevicesOfIdCallback, NULL); 628 } 629 630 VBOXNETCFGWIN_DECL(HRESULT) VBoxNetCfgWinPropChangeAllNetDevicesOfId(IN LPCWSTR lpszPnPId, VBOXNECTFGWINPROPCHANGE_TYPE enmPcType) 631 { 632 VBOXNECTFGWINPROPCHANGE Pc; 633 Pc.enmPcType = enmPcType; 634 Pc.hr = S_OK; 635 return VBoxNetCfgWinEnumNetDevices(lpszPnPId, vboxNetCfgWinPropChangeAllNetDevicesOfIdCallback, &Pc); 555 636 } 556 637 … … 2349 2430 } 2350 2431 2432 VBOXNETCFGWIN_DECL(HRESULT) VBoxNetCfgWinUpdateHostOnlyNetworkInterface(LPCWSTR pcsxwInf, BOOL *pbRebootRequired) 2433 { 2434 return VBoxDrvCfgDrvUpdate(DRIVERHWID, pcsxwInf, pbRebootRequired); 2435 } 2436 2351 2437 VBOXNETCFGWIN_DECL(HRESULT) VBoxNetCfgWinCreateHostOnlyNetworkInterface(IN LPCWSTR pInfPath, IN bool bIsInfPathFile, 2352 2438 OUT GUID *pGuid, OUT BSTR *lppszName, OUT BSTR *pErrMsg)
Note:
See TracChangeset
for help on using the changeset viewer.