- Timestamp:
- Aug 31, 2017 12:09:51 PM (8 years ago)
- svn:sync-xref-src-repo-rev:
- 117770
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Additions/common/VBoxGuestLib/VBoxGuestR0LibIdc-win.cpp
r68550 r68553 29 29 * Header Files * 30 30 *********************************************************************************************************************************/ 31 #include <iprt/nt/nt.h> 31 32 #include "VBoxGuestR0LibInternal.h" 32 33 #include <VBox/VBoxGuest.h> 33 34 #include <VBox/err.h> 34 35 #include <VBox/log.h> 35 36 37 /**38 * Implementation of a IO_COMPLETION_ROUTINE.39 *40 * @returns STATUS_MORE_PROCESSING_REQUIRED41 * @param pDeviceObject The device object.42 * @param pIrp The request.43 * @param pvUser The event object.44 */45 static NTSTATUS vbglR0NtDriverIoCtlCompletion(IN PDEVICE_OBJECT pDeviceObject, IN PIRP pIrp, IN PVOID pvUser)46 {47 PKEVENT pEvent = (PKEVENT )pvUser;48 Log(("vbglR0NtDriverIoCtlCompletion: pIrp=%p pEvent=%p\n", pIrp, pEvent));49 RT_NOREF2(pDeviceObject, pIrp);50 51 KeSetEvent(pEvent, IO_NO_INCREMENT, FALSE /*fWait*/);52 return STATUS_MORE_PROCESSING_REQUIRED;53 }54 36 55 37 … … 65 47 static int vbglR0IdcNtCallInternal(PDEVICE_OBJECT pDeviceObject, PFILE_OBJECT pFileObject, uint32_t uReq, PVBGLREQHDR pReq) 66 48 { 67 int rc; 68 IO_STATUS_BLOCK IoStatusBlock; 69 KEVENT Event; 70 PIRP pIrp; 71 NTSTATUS rcNt; 49 int rc; 50 NTSTATUS rcNt; 72 51 73 52 /* 74 53 * Build the request. 54 * 55 * We want to avoid double buffering of the request, therefore we don't 56 * specify any request pointers or sizes when asking the kernel to build 57 * the IRP for us, but instead do that part our selves. 75 58 */ 59 KEVENT Event; 76 60 KeInitializeEvent(&Event, NotificationEvent, FALSE); 77 pIrp = IoBuildDeviceIoControlRequest(uReq, /* IoControlCode */ 78 pDeviceObject, 79 pReq, /* InputBuffer */ 80 pReq->cbIn, /* InputBufferLength */ 81 pReq, /* OutputBuffer */ 82 pReq->cbOut, /* OutputBufferLength */ 83 TRUE, /* InternalDeviceIoControl (=> IRP_MJ_INTERNAL_DEVICE_CONTROL) */ 84 &Event, /* Event */ 85 &IoStatusBlock); /* IoStatusBlock */ 61 62 IO_STATUS_BLOCK IoStatusBlock = RTNT_IO_STATUS_BLOCK_INITIALIZER; 63 #if 0 64 PIRP pIrp = IoBuildDeviceIoControlRequest(uReq, /* IoControlCode */ 65 pDeviceObject, 66 pReq, /* InputBuffer */ 67 pReq->cbIn, /* InputBufferLength */ 68 pReq, /* OutputBuffer */ 69 pReq->cbOut, /* OutputBufferLength */ 70 TRUE, /* InternalDeviceIoControl (=> IRP_MJ_INTERNAL_DEVICE_CONTROL) */ 71 &Event, /* Event */ 72 &IoStatusBlock); /* IoStatusBlock */ 73 #else 74 PIRP pIrp = IoBuildDeviceIoControlRequest(uReq, /* IoControlCode */ 75 pDeviceObject, 76 NULL, /* InputBuffer */ 77 0, /* InputBufferLength */ 78 NULL, /* OutputBuffer */ 79 0, /* OutputBufferLength */ 80 TRUE, /* InternalDeviceIoControl (=> IRP_MJ_INTERNAL_DEVICE_CONTROL) */ 81 &Event, /* Event */ 82 &IoStatusBlock); /* IoStatusBlock */ 83 #endif 86 84 if (pIrp) 87 85 { 86 #if 0 88 87 IoGetNextIrpStackLocation(pIrp)->FileObject = pFileObject; 89 90 /* A completion routine is required to signal the Event. */ 91 IoSetCompletionRoutine(pIrp, vbglR0NtDriverIoCtlCompletion, &Event, 92 TRUE /* InvokeOnSuccess */, TRUE /* InvokeOnError */, TRUE /* InvokeOnCancel */); 88 #else 89 pIrp->Flags |= IRP_SYNCHRONOUS_API; 90 pIrp->UserBuffer = pReq; 91 pIrp->AssociatedIrp.SystemBuffer = pReq; 92 PIO_STACK_LOCATION pStack = IoGetNextIrpStackLocation(pIrp); 93 pStack->FileObject = pFileObject; 94 pStack->Parameters.DeviceIoControl.OutputBufferLength = pReq->cbOut; 95 pStack->Parameters.DeviceIoControl.InputBufferLength = pReq->cbIn; 96 #endif 93 97 94 98 /* … … 97 101 rcNt = IoCallDriver(pDeviceObject, pIrp); 98 102 if (rcNt == STATUS_PENDING) 99 {100 103 rcNt = KeWaitForSingleObject(&Event, /* Object */ 101 104 Executive, /* WaitReason */ … … 103 106 FALSE, /* Alertable */ 104 107 NULL); /* TimeOut */ 108 if (NT_SUCCESS(rcNt)) 105 109 rcNt = IoStatusBlock.Status; 106 }107 110 if (NT_SUCCESS(rcNt)) 108 111 rc = pReq->rc;
Note:
See TracChangeset
for help on using the changeset viewer.