VirtualBox

Changeset 20659 in vbox for trunk/src/VBox/Additions/WINNT


Ignore:
Timestamp:
Jun 17, 2009 10:34:40 AM (15 years ago)
Author:
vboxsync
Message:

Windows guest additions: use KernelMode wait for HCGM calls from shared folders driver.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Additions/WINNT/VBoxGuest/VBoxGuest.cpp

    r20374 r20659  
    415415
    416416#ifdef VBOX_WITH_HGCM
    417 void VBoxHGCMCallbackWorker (VMMDevHGCMRequestHeader *pHeader, PVBOXGUESTDEVEXT pDevExt,
    418                              uint32_t u32Timeout, bool fInterruptible)
     417static void VBoxHGCMCallbackWorker (VMMDevHGCMRequestHeader *pHeader, PVBOXGUESTDEVEXT pDevExt,
     418                                    uint32_t u32Timeout, bool fInterruptible, KPROCESSOR_MODE ProcessorMode)
    419419{
    420420    /* Possible problem with request completion right between the fu32Flags check and KeWaitForSingleObject
     
    434434        /* Specifying UserMode so killing the user process will abort the wait. */
    435435        NTSTATUS rc = KeWaitForSingleObject (&pDevExt->keventNotification, Executive,
    436                                              UserMode,
     436                                             ProcessorMode,
    437437                                             fInterruptible ? TRUE : FALSE, /* Alertable */
    438438                                             &timeout
     
    459459
    460460    dprintf(("VBoxHGCMCallback\n"));
    461     VBoxHGCMCallbackWorker (pHeader, pDevExt, u32Data, false);
     461    VBoxHGCMCallbackWorker (pHeader, pDevExt, u32Data, false, UserMode);
     462}
     463
     464DECLVBGL(void) VBoxHGCMCallbackKernelMode (VMMDevHGCMRequestHeader *pHeader, void *pvData, uint32_t u32Data)
     465{
     466    PVBOXGUESTDEVEXT pDevExt = (PVBOXGUESTDEVEXT)pvData;
     467
     468    dprintf(("VBoxHGCMCallback\n"));
     469    VBoxHGCMCallbackWorker (pHeader, pDevExt, u32Data, false, KernelMode);
    462470}
    463471
     
    468476
    469477    dprintf(("VBoxHGCMCallbackInterruptible\n"));
    470     VBoxHGCMCallbackWorker (pHeader, pDevExt, u32Data, true);
     478    VBoxHGCMCallbackWorker (pHeader, pDevExt, u32Data, true, UserMode);
    471479}
    472480
     
    10101018            dprintf(("a) ptr->u32ClientID = %d\n", ptr->u32ClientID));
    10111019
    1012             int rc = VbglHGCMConnect (ptr, VBoxHGCMCallback, pDevExt, RT_INDEFINITE_WAIT);
     1020            int rc = VbglHGCMConnect (ptr, pIrp->RequestorMode == KernelMode? VBoxHGCMCallbackKernelMode :VBoxHGCMCallback, pDevExt, RT_INDEFINITE_WAIT);
    10131021
    10141022            dprintf(("b) ptr->u32ClientID = %d\n", ptr->u32ClientID));
     
    10541062                        Info.result = 0;
    10551063                        Info.u32ClientID = ptr->u32ClientID;
    1056                         VbglHGCMDisconnect(&Info, VBoxHGCMCallback, pDevExt, RT_INDEFINITE_WAIT);
     1064                        VbglHGCMDisconnect(&Info, pIrp->RequestorMode == KernelMode? VBoxHGCMCallbackKernelMode :VBoxHGCMCallback, pDevExt, RT_INDEFINITE_WAIT);
    10571065                        Status = STATUS_UNSUCCESSFUL;
    10581066                        break;
     
    11331141             */
    11341142
    1135             int rc = VbglHGCMDisconnect (ptr, VBoxHGCMCallback, pDevExt, RT_INDEFINITE_WAIT);
     1143            int rc = VbglHGCMDisconnect (ptr, pIrp->RequestorMode == KernelMode? VBoxHGCMCallbackKernelMode :VBoxHGCMCallback, pDevExt, RT_INDEFINITE_WAIT);
    11361144
    11371145            if (RT_FAILURE(rc))
     
    11821190            VBoxGuestHGCMCallInfo *ptr = (VBoxGuestHGCMCallInfo *)pBuf;
    11831191
    1184             rc = VbglHGCMCall32(ptr, VBoxHGCMCallback, pDevExt, RT_INDEFINITE_WAIT);
     1192            rc = VbglHGCMCall32(ptr, pIrp->RequestorMode == KernelMode? VBoxHGCMCallbackKernelMode :VBoxHGCMCallback, pDevExt, RT_INDEFINITE_WAIT);
    11851193
    11861194            if (RT_FAILURE(rc))
     
    12141222            VBoxGuestHGCMCallInfo *ptr = (VBoxGuestHGCMCallInfo *)pBuf;
    12151223
    1216             rc = VbglHGCMCall (ptr, VBoxHGCMCallback, pDevExt, RT_INDEFINITE_WAIT);
     1224            rc = VbglHGCMCall (ptr, pIrp->RequestorMode == KernelMode? VBoxHGCMCallbackKernelMode :VBoxHGCMCallback, pDevExt, RT_INDEFINITE_WAIT);
    12171225
    12181226            if (RT_FAILURE(rc))
     
    12301238        case VBOXGUEST_IOCTL_HGCM_CALL_TIMED(0): /* (The size isn't relevant on NT.) */
    12311239        {
     1240            /* This IOCTL is not used by shared folders, so VBoxHGCMCallbackKernelMode is not used. */
    12321241            dprintf(("VBoxGuest::VBoxGuestDeviceControl: VBOXGUEST_IOCTL_HGCM_CALL_TIMED\n"));
    12331242
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