VirtualBox

Ignore:
Timestamp:
Jul 31, 2014 6:27:37 AM (10 years ago)
Author:
vboxsync
Message:

VBoxDrvCfgInfUninstallAllF: Just call GetSystemWindowsDirectory directly instead of the round about way via SHGetFolderPathW and drag in SHELL32.DLL.

File:
1 edited

Legend:

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

    r44529 r52241  
    680680VBOXDRVCFG_DECL(HRESULT) VBoxDrvCfgInfUninstallAllF(LPCWSTR lpszClassName, LPCWSTR lpszPnPId, DWORD Flags)
    681681{
    682     WCHAR InfDirPath[MAX_PATH];
    683     HRESULT hr = SHGetFolderPathW(NULL, /*          HWND hwndOwner*/
    684             CSIDL_WINDOWS, /* int nFolder*/
    685             NULL, /*HANDLE hToken*/
    686             SHGFP_TYPE_CURRENT, /*DWORD dwFlags*/
    687             InfDirPath);
    688     NonStandardAssert(hr == S_OK);
    689     if (hr == S_OK)
    690     {
    691         wcscat(InfDirPath, L"\\inf\\oem*.inf");
     682    static WCHAR const s_wszFilter[] = L"\\inf\\oem*.inf";
     683    HRESULT hr;
     684    WCHAR wszInfDirPath[MAX_PATH];
     685    UINT cwcInput = RT_ELEMENTS(wszInfDirPath) - RT_ELEMENTS(s_wszFilter);
     686    UINT cwcWindows = GetSystemWindowsDirectory(wszInfDirPath, cwcInput);
     687    if (cwcWindows > 0 && cwcWindows < cwcInput)
     688    {
     689        wcscpy(&wszInfDirPath[cwcWindows], s_wszFilter);
    692690
    693691        INFENUM_CONTEXT Context;
     
    696694        Context.Flags = Flags;
    697695        Context.hr = S_OK;
    698         hr = vboxDrvCfgEnumFiles(InfDirPath, vboxDrvCfgInfEnumerationCallback, &Context);
     696        hr = vboxDrvCfgEnumFiles(wszInfDirPath, vboxDrvCfgInfEnumerationCallback, &Context);
    699697        NonStandardAssert(hr == S_OK);
    700698        if (hr == S_OK)
     
    709707    else
    710708    {
    711         NonStandardLogRelCrap((__FUNCTION__": SHGetFolderPathW failed, hr=0x%x\n", hr));
     709        NonStandardLogRelCrap((__FUNCTION__": GetSystemWindowsDirectory failed, cwcWindows=%u lasterr=%u\n", cwcWindows, GetLastError()));
     710        NonStandardAssertFailed();
     711        hr = E_FAIL;
    712712    }
    713713
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