VirtualBox

Changeset 37233 in vbox for trunk/src/VBox/Devices/USB


Ignore:
Timestamp:
May 27, 2011 1:31:57 PM (14 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
71955
Message:

IRPT: Adding RTErrVarsSave/Restore/++ to preserve errno, h_error/WSAGetLastError and GetLastError accross assertions.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Devices/USB/win/USBProxyDevice-win.cpp

    r37158 r37233  
    3939#include "../USBProxyDevice.h"
    4040#include <VBox/usblib.h>
    41 //#include "USBLibInternal.h"
    4241
    4342
     
    312311    }
    313312    else
    314     {
    315         /* do not use GetLastError() in AssertMsgFailed directly since the "real" err will be overwritten with the
    316          * RTAssertMsg1Weak((const char *)0, __LINE__, __FILE__, __PRETTY_FUNCTION__); call encapsulated by AssertMsgFailed */
    317         DWORD winEr = GetLastError();
    318         AssertMsgFailed(("lasterr=%d\n", winEr));
    319     }
     313        AssertMsgFailed(("lasterr=%u\n", GetLastError()));
    320314
    321315    return 0;
     
    374368    }
    375369    else
    376     {
    377         /* do not use GetLastError() in AssertMsgFailed directly since the "real" err will be overwritten with the
    378          * RTAssertMsg1Weak((const char *)0, __LINE__, __FILE__, __PRETTY_FUNCTION__); call encapsulated by AssertMsgFailed */
    379         DWORD winEr = GetLastError();
    380         AssertMsgFailed(("lasterr=%d\n", winEr));
    381     }
     370        AssertMsgFailed(("lasterr=%d\n", GetLastError()));
    382371    return 0;
    383372}
     
    408397    }
    409398    else
    410     {
    411         /* do not use GetLastError() in AssertMsgFailed directly since the "real" err will be overwritten with the
    412          * RTAssertMsg1Weak((const char *)0, __LINE__, __FILE__, __PRETTY_FUNCTION__); call encapsulated by AssertMsgFailed */
    413         DWORD winEr = GetLastError();
    414         AssertMsgFailed(("lasterr=%d\n", winEr));
    415     }
     399        AssertMsgFailed(("lasterr=%d\n", GetLastError()));
    416400    return 0;
    417401}
     
    444428    }
    445429    else
    446     {
    447         /* do not use GetLastError() in AssertMsgFailed directly since the "real" err will be overwritten with the
    448          * RTAssertMsg1Weak((const char *)0, __LINE__, __FILE__, __PRETTY_FUNCTION__); call encapsulated by AssertMsgFailed */
    449         DWORD winEr = GetLastError();
    450         AssertMsgFailed(("lasterr=%d\n", winEr));
    451     }
     430        AssertMsgFailed(("lasterr=%d\n", rc));
    452431    return RTErrConvertFromWin32(rc);
    453432}
     
    635614    /*
    636615     * Wait/poll.
     616     *
     617     * ASSUMPTIONS:
     618     *   1. The usbProxyWinUrbReap can not be run concurrently with each other
     619     *      so racing the cQueuedUrbs access/modification can not occur.
     620     *   2. The usbProxyWinUrbReap can not be run concurrently with
     621     *      usbProxyWinUrbQueue so they can not race the pPriv->paHandles
     622     *      access/realloc.
    637623     */
     624    unsigned cQueuedUrbs = ASMAtomicReadU32((volatile uint32_t *)&pPriv->cQueuedUrbs);
    638625    PVUSBURB pUrb = NULL;
    639     unsigned cQueuedUrbs = ASMAtomicReadU32((volatile uint32_t *)&pPriv->cQueuedUrbs);
    640 
    641     /* we assume here
    642      * 1. the usbProxyWinUrbReap can not be run concurrently with each other so racing the cQueuedUrbs access/modification can not occur
    643      * 2. the usbProxyWinUrbReap can not be run concurrently with usbProxyWinUrbQueue so they can not race the pPriv->paHandles access/realloc */
    644626    DWORD rc = WaitForMultipleObjects(cQueuedUrbs, pPriv->paHandles, FALSE, cMillies);
    645627    if (rc >= WAIT_OBJECT_0 && rc < WAIT_OBJECT_0 + cQueuedUrbs)
     
    697679    else if (   rc == WAIT_FAILED
    698680             || (rc >= WAIT_ABANDONED_0 && rc < WAIT_ABANDONED_0 + cQueuedUrbs))
    699     {
    700         /* do not use GetLastError() in AssertMsgFailed directly since the "real" err will be overwritten with the
    701          * RTAssertMsg1Weak((const char *)0, __LINE__, __FILE__, __PRETTY_FUNCTION__); call encapsulated by AssertMsgFailed */
    702         DWORD winEr = GetLastError();
    703         AssertMsgFailed(("USB: WaitForMultipleObjects %d objects failed with rc=%d and last error %d\n", cQueuedUrbs, rc, winEr));
    704     }
     681        AssertMsgFailed(("USB: WaitForMultipleObjects %d objects failed with rc=%d and last error %d\n", cQueuedUrbs, rc, GetLastError()));
    705682
    706683    return pUrb;
     
    823800    }
    824801    else
    825     {
    826         /* do not use GetLastError() in AssertMsgFailed directly since the "real" err will be overwritten with the
    827          * RTAssertMsg1Weak((const char *)0, __LINE__, __FILE__, __PRETTY_FUNCTION__); call encapsulated by AssertMsgFailed */
    828         DWORD winEr = GetLastError();
    829         AssertMsgFailed(("lasterr=%d\n", winEr));
    830     }
     802        AssertMsgFailed(("lasterr=%d\n", rc));
    831803}
    832804
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