VirtualBox

Changeset 20883 in vbox


Ignore:
Timestamp:
Jun 24, 2009 9:08:48 AM (16 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
49029
Message:

Call KeWaitForSingleObject with UserMode for event semaphores

Location:
trunk/src/VBox/Runtime/r0drv/nt
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Runtime/r0drv/nt/semevent-r0drv-nt.cpp

    r8245 r20883  
    138138    /*
    139139     * Wait for it.
     140     *
     141     * We default to UserMode here as the waits might be aborted due to process termination.
     142     * @todo As far as I can tell this is currently safe as all calls are made on behalf of user threads.
    140143     */
    141144    NTSTATUS rcNt;
    142145    if (cMillies == RT_INDEFINITE_WAIT)
    143         rcNt = KeWaitForSingleObject(&pEventInt->Event, Executive, KernelMode, fInterruptible, NULL);
     146        rcNt = KeWaitForSingleObject(&pEventInt->Event, Executive, UserMode, fInterruptible, NULL);
    144147    else
    145148    {
    146         LARGE_INTEGER Timeout;
    147         Timeout.QuadPart = -(int64_t)cMillies * 10000;
    148         rcNt = KeWaitForSingleObject(&pEventInt->Event, Executive, KernelMode, fInterruptible, &Timeout);
     149        /* Can't use the stack here as the wait is UserMode. */
     150        PLARGE_INTEGER pTimeout = (PLARGE_INTEGER)RTMemAlloc(sizeof(*pTimeout));
     151        if (!pTimeout)
     152            return VERR_NO_MEMORY;
     153
     154        pTimeout->QuadPart = -(int64_t)cMillies * 10000;
     155        rcNt = KeWaitForSingleObject(&pEventInt->Event, Executive, UserMode, fInterruptible, pTimeout);
     156        RTMemFree(pTimeout);
    149157    }
    150158    switch (rcNt)
  • trunk/src/VBox/Runtime/r0drv/nt/semeventmulti-r0drv-nt.cpp

    r8245 r20883  
    148148    NTSTATUS rcNt;
    149149    if (cMillies == RT_INDEFINITE_WAIT)
    150         rcNt = KeWaitForSingleObject(&pThis->Event, Executive, KernelMode, fInterruptible, NULL);
     150        rcNt = KeWaitForSingleObject(&pThis->Event, Executive, UserMode, fInterruptible, NULL);
    151151    else
    152152    {
    153         LARGE_INTEGER Timeout;
    154         Timeout.QuadPart = -(int64_t)cMillies * 10000;
    155         rcNt = KeWaitForSingleObject(&pThis->Event, Executive, KernelMode, fInterruptible, &Timeout);
     153        /* Can't use the stack here as the wait is UserMode. */
     154        PLARGE_INTEGER pTimeout = (PLARGE_INTEGER)RTMemAlloc(sizeof(*pTimeout));
     155        if (!pTimeout)
     156            return VERR_NO_MEMORY;
     157
     158        pTimeout->QuadPart = -(int64_t)cMillies * 10000;
     159        rcNt = KeWaitForSingleObject(&pThis->Event, Executive, UserMode, fInterruptible, pTimeout);
     160        RTMemFree(pTimeout);
    156161    }
    157162    switch (rcNt)
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