VirtualBox

Changeset 40993 in vbox for trunk/src/VBox/HostDrivers/win


Ignore:
Timestamp:
Apr 19, 2012 2:25:38 PM (13 years ago)
Author:
vboxsync
Message:

NetCfg/win: disable/enable/update HostOnly

File:
1 edited

Legend:

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

    r38731 r40993  
    2424#include <malloc.h>
    2525#include <stdio.h>
     26
     27#include <Newdev.h>
    2628
    2729static PFNVBOXDRVCFG_LOG g_pfnVBoxDrvCfgLog;
     
    811813    return hr;
    812814}
     815
     816
     817HRESULT VBoxDrvCfgDrvUpdate(LPCWSTR pcszwHwId, LPCWSTR pcsxwInf, BOOL *pbRebootRequired)
     818{
     819    if (pbRebootRequired)
     820        *pbRebootRequired = FALSE;
     821    BOOL bRebootRequired = FALSE;
     822    WCHAR InfFullPath[MAX_PATH];
     823    DWORD dwChars = GetFullPathNameW(pcsxwInf,
     824            sizeof (InfFullPath) / sizeof (InfFullPath[0]),
     825            InfFullPath,
     826            NULL /* LPTSTR *lpFilePart */
     827            );
     828    if (!dwChars || dwChars >= MAX_PATH)
     829    {
     830        NonStandardLogCrap(("GetFullPathNameW failed, WinEr(%d), dwChars(%d)\n", GetLastError(), dwChars));
     831        return E_INVALIDARG;
     832    }
     833
     834
     835    if (!UpdateDriverForPlugAndPlayDevicesW(NULL, /* HWND hwndParent */
     836            pcszwHwId,
     837            InfFullPath,
     838            INSTALLFLAG_FORCE,
     839            &bRebootRequired))
     840    {
     841        NonStandardLogCrap(("UpdateDriverForPlugAndPlayDevicesW failed, WinEr(%d)\n", GetLastError(), dwChars));
     842        return E_FAIL;
     843    }
     844
     845
     846    if (bRebootRequired)
     847        NonStandardLogCrap(("!!Driver Update: REBOOT REQUIRED!!\n", GetLastError(), dwChars));
     848
     849    if (pbRebootRequired)
     850        *pbRebootRequired = bRebootRequired;
     851
     852    return S_OK;
     853}
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