VirtualBox

Changeset 63295 in vbox


Ignore:
Timestamp:
Aug 10, 2016 4:04:41 PM (8 years ago)
Author:
vboxsync
Message:

VBoxBugReport: warnings

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Frontends/VBoxBugReport/VBoxBugReportWin.cpp

    r62686 r63295  
    11/* $Id$ */
    22/** @file
    3  * VBoxBugReportWin - VirtualBox command-line diagnostics tool,
    4  * Windows-specific part.
     3 * VBoxBugReportWin - VirtualBox command-line diagnostics tool, Windows-specific part.
    54 */
    65
     
    225224public:
    226225    ErrorHandler(const char *pszFunction, int iLine)
    227         : m_function(pszFunction), m_line(iLine) {};
     226        : m_function(pszFunction), m_line(iLine)
     227    { }
     228
    228229    void handleWinError(DWORD uError, const char *pszMsgFmt, ...)
     230    {
     231        if (uError != ERROR_SUCCESS)
    229232        {
    230             if (uError != ERROR_SUCCESS)
    231             {
    232                 va_list va;
    233                 va_start(va, pszMsgFmt);
    234                 RTCString msgArgs(pszMsgFmt, va);
    235                 va_end(va);
    236                 LPSTR pBuf = NULL;
    237                 DWORD cb = FormatMessageA(FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_SYSTEM | FORMAT_MESSAGE_IGNORE_INSERTS,
    238                                           NULL, uError, MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), (LPSTR)&pBuf, 0, NULL);
    239                 RTCStringFmt msg("%s at %s(%d): err=%u %s", msgArgs.c_str(), m_function, m_line, uError, pBuf);
    240                 LocalFree(pBuf);
    241                 throw RTCError(msg.c_str());
    242             }
    243         };
     233            va_list va;
     234            va_start(va, pszMsgFmt);
     235            RTCString msgArgs(pszMsgFmt, va);
     236            va_end(va);
     237
     238            LPSTR pBuf = NULL;
     239            FormatMessageA(FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_SYSTEM | FORMAT_MESSAGE_IGNORE_INSERTS,
     240                           NULL, uError, MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), (LPSTR)&pBuf, 0, NULL);
     241            RTCStringFmt msg("%s at %s(%d): err=%u %s", msgArgs.c_str(), m_function, m_line, uError, pBuf);
     242            LocalFree(pBuf);
     243            throw RTCError(msg.c_str());
     244        }
     245    }
     246
    244247private:
    245248    const char *m_function;
     
    254257    BugReportUsbTreeWin();
    255258    virtual ~BugReportUsbTreeWin();
    256     virtual PRTSTREAM getStream(void) { enumerate(); return BugReportStream::getStream(); };
     259    virtual PRTSTREAM getStream(void) { enumerate(); return BugReportStream::getStream(); }
    257260private:
    258261    class AutoHandle {
    259262    public:
    260         AutoHandle(HANDLE h) { m_h = h; };
    261         ~AutoHandle() { close(); };
    262         bool isValid() { return m_h != INVALID_HANDLE_VALUE; };
    263         operator HANDLE() { return m_h; };
    264         void close(void) { if (isValid()) { CloseHandle(m_h); m_h = INVALID_HANDLE_VALUE; } };
     263        AutoHandle(HANDLE h) { m_h = h; }
     264        ~AutoHandle() { close(); }
     265        bool isValid() { return m_h != INVALID_HANDLE_VALUE; }
     266        operator HANDLE() { return m_h; }
     267        void close(void)  {   if (isValid()) { CloseHandle(m_h); m_h = INVALID_HANDLE_VALUE; }    }
    265268    private:
    266269        HANDLE m_h;
     
    339342RTCString BugReportUsbTreeWin::getDeviceRegistryPropertyString(HDEVINFO hDev, PSP_DEVINFO_DATA pInfoData, DWORD uProperty)
    340343{
    341     DWORD cbString = 0;
    342344    PWSTR pUnicodeString = (PWSTR)getDeviceRegistryProperty(hDev, pInfoData, uProperty, REG_SZ, NULL);
    343345
     
    489491void BugReportUsbTreeWin::enumerateController(PSP_DEVINFO_DATA pInfoData, PSP_DEVICE_INTERFACE_DATA pInterfaceData)
    490492{
     493    RT_NOREF(pInterfaceData);
    491494    RTCString strCtrlDesc = getDeviceRegistryPropertyString(m_hDevInfo, pInfoData, SPDRP_DEVICEDESC);
    492495    printf("%s\n", strCtrlDesc.c_str());
     
    561564void createBugReportOsSpecific(BugReport* report, const char *pszHome)
    562565{
     566    RT_NOREF(pszHome);
    563567    WCHAR szWinDir[MAX_PATH];
    564568
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