VirtualBox

Ignore:
Timestamp:
Sep 7, 2015 11:45:55 AM (10 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
102525
Message:

Main/Network: report errors from VBoxNetCfg back to VBoxManage (#7973)

File:
1 edited

Legend:

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

    r57370 r57639  
    5656#define VBOX_NETCFG_LOCK_TIME_OUT     5000  /** @todo r=bird: What does this do? */
    5757
     58
     59/*
     60 * For some weird reason we do not want to use IPRT here, hence the following
     61 * function provides a replacement for BstrFmt.
     62 */
     63static bstr_t bstr_printf(const char *cszFmt, ...)
     64{
     65    char szBuffer[4096];
     66    szBuffer[sizeof(szBuffer) - 1] = 0; /* Make sure the string will be null-terminated */
     67    va_list va;
     68    va_start(va, cszFmt);
     69    _vsnprintf(szBuffer, sizeof(szBuffer) - 1, cszFmt, va);
     70    va_end(va);
     71    return bstr_t(szBuffer);
     72}
    5873
    5974static HRESULT vboxNetCfgWinINetCfgLock(IN INetCfg *pNetCfg,
     
    24632478        hrc = E_FAIL; \
    24642479        NonStandardLog strAndArgs; \
     2480        bstrError = bstr_printf strAndArgs; \
    24652481        break; \
    24662482    } else do {} while (0)
     
    24692485{
    24702486    HRESULT hrc = S_OK;
     2487    bstr_t bstrError;
    24712488
    24722489    do
     
    26682685    while (0);
    26692686
     2687    if (pErrMsg && bstrError.length())
     2688        *pErrMsg = bstrError.Detach();
     2689
    26702690    return hrc;
    26712691}
     
    26912711    WCHAR DevName[256];
    26922712    HKEY hkey = (HKEY)INVALID_HANDLE_VALUE;
     2713    bstr_t bstrError;
    26932714
    26942715    do
     
    31203141            NonStandardLogFlow(("VBoxNetCfgWinQueryINetCfg failed, hr 0x%x\n", hr));
    31213142    }
     3143
     3144    if (pErrMsg && bstrError.length())
     3145        *pErrMsg = bstrError.Detach();
     3146
    31223147    return hrc;
    31233148}
Note: See TracChangeset for help on using the changeset viewer.

© 2025 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette