Changeset 38075 in vbox for trunk/src/VBox/HostDrivers/Support
- Timestamp:
- Jul 19, 2011 4:19:42 PM (14 years ago)
- Location:
- trunk/src/VBox/HostDrivers/Support
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/HostDrivers/Support/SUPDrv.c
r37955 r38075 974 974 * We check the two prereqs after doing this only to allow the compiler to optimize things better. 975 975 */ 976 if (RT_LIKELY(pSession->pVM && pDevExt->pfnVMMR0EntryFast)) 976 if (RT_LIKELY( RT_VALID_PTR(pSession) 977 && pSession->pVM 978 && pDevExt->pfnVMMR0EntryFast)) 977 979 { 978 980 switch (uIOCtl) … … 1046 1048 OSDBGPRINT(("vboxdrv: Bad ioctl request header; cbIn=%#lx cbOut=%#lx fFlags=%#lx\n", 1047 1049 (long)pReqHdr->cbIn, (long)pReqHdr->cbOut, (long)pReqHdr->fFlags)); 1050 VBOXDRV_SUPDRV_IOCTL_RETURN(pSession, uIOCtl, pReqHdr, VERR_INVALID_PARAMETER, VINF_SUCCESS); 1051 return VERR_INVALID_PARAMETER; 1052 } 1053 if (RT_UNLIKELY(!RT_VALID_PTR(pSession))) 1054 { 1055 OSDBGPRINT(("vboxdrv: Invalid pSession valud %p (ioctl=%p)\n", pSession, (void *)uIOCtl)); 1048 1056 VBOXDRV_SUPDRV_IOCTL_RETURN(pSession, uIOCtl, pReqHdr, VERR_INVALID_PARAMETER, VINF_SUCCESS); 1049 1057 return VERR_INVALID_PARAMETER; -
trunk/src/VBox/HostDrivers/Support/win/SUPDrv-win.cpp
r37249 r38075 75 75 static void _stdcall VBoxDrvNtUnload(PDRIVER_OBJECT pDrvObj); 76 76 static NTSTATUS _stdcall VBoxDrvNtCreate(PDEVICE_OBJECT pDevObj, PIRP pIrp); 77 static NTSTATUS _stdcall VBoxDrvNtCleanup(PDEVICE_OBJECT pDevObj, PIRP pIrp); 77 78 static NTSTATUS _stdcall VBoxDrvNtClose(PDEVICE_OBJECT pDevObj, PIRP pIrp); 78 79 static NTSTATUS _stdcall VBoxDrvNtDeviceControl(PDEVICE_OBJECT pDevObj, PIRP pIrp); … … 138 139 pDrvObj->DriverUnload = VBoxDrvNtUnload; 139 140 pDrvObj->MajorFunction[IRP_MJ_CREATE] = VBoxDrvNtCreate; 141 pDrvObj->MajorFunction[IRP_MJ_CLEANUP] = VBoxDrvNtCleanup; 140 142 pDrvObj->MajorFunction[IRP_MJ_CLOSE] = VBoxDrvNtClose; 141 143 pDrvObj->MajorFunction[IRP_MJ_DEVICE_CONTROL] = VBoxDrvNtDeviceControl; 142 //#if 0 /** @todo test IDC on windows. */143 144 pDrvObj->MajorFunction[IRP_MJ_INTERNAL_DEVICE_CONTROL] = VBoxDrvNtInternalDeviceControl; 144 //#endif145 145 pDrvObj->MajorFunction[IRP_MJ_READ] = VBoxDrvNtNotSupportedStub; 146 146 pDrvObj->MajorFunction[IRP_MJ_WRITE] = VBoxDrvNtNotSupportedStub; … … 272 272 273 273 /** 274 * Cl ose file entry point.274 * Clean up file handle entry point. 275 275 * 276 276 * @param pDevObj Device object. 277 277 * @param pIrp Request packet. 278 278 */ 279 NTSTATUS _stdcall VBoxDrvNtCleanup(PDEVICE_OBJECT pDevObj, PIRP pIrp) 280 { 281 PSUPDRVDEVEXT pDevExt = (PSUPDRVDEVEXT)pDevObj->DeviceExtension; 282 PIO_STACK_LOCATION pStack = IoGetCurrentIrpStackLocation(pIrp); 283 PFILE_OBJECT pFileObj = pStack->FileObject; 284 PSUPDRVSESSION pSession = (PSUPDRVSESSION)pFileObj->FsContext; 285 286 Log(("VBoxDrvNtCleanup: pDevExt=%p pFileObj=%p pSession=%p\n", pDevExt, pFileObj, pSession)); 287 if (pSession) 288 { 289 supdrvCloseSession(pDevExt, (PSUPDRVSESSION)pFileObj->FsContext); 290 pFileObj->FsContext = NULL; 291 } 292 293 pIrp->IoStatus.Information = 0; 294 pIrp->IoStatus.Status = STATUS_SUCCESS; 295 IoCompleteRequest(pIrp, IO_NO_INCREMENT); 296 297 return STATUS_SUCCESS; 298 } 299 300 301 /** 302 * Close file entry point. 303 * 304 * @param pDevObj Device object. 305 * @param pIrp Request packet. 306 */ 279 307 NTSTATUS _stdcall VBoxDrvNtClose(PDEVICE_OBJECT pDevObj, PIRP pIrp) 280 308 { 281 PSUPDRVDEVEXT pDevExt = (PSUPDRVDEVEXT)pDevObj->DeviceExtension;282 PIO_STACK_LOCATION pStack = IoGetCurrentIrpStackLocation(pIrp);309 PSUPDRVDEVEXT pDevExt = (PSUPDRVDEVEXT)pDevObj->DeviceExtension; 310 PIO_STACK_LOCATION pStack = IoGetCurrentIrpStackLocation(pIrp); 283 311 PFILE_OBJECT pFileObj = pStack->FileObject; 284 Log(("VBoxDrvNtClose: pDevExt=%p pFileObj=%p pSession=%p\n", 285 pDevExt, pFileObj, pFileObj->FsContext)); 286 supdrvCloseSession(pDevExt, (PSUPDRVSESSION)pFileObj->FsContext); 287 pFileObj->FsContext = NULL; 312 PSUPDRVSESSION pSession = (PSUPDRVSESSION)pFileObj->FsContext; 313 314 Log(("VBoxDrvNtClose: pDevExt=%p pFileObj=%p pSession=%p\n", pDevExt, pFileObj, pSession)); 315 if (pSession) 316 { 317 supdrvCloseSession(pDevExt, (PSUPDRVSESSION)pFileObj->FsContext); 318 pFileObj->FsContext = NULL; 319 } 320 288 321 pIrp->IoStatus.Information = 0; 289 322 pIrp->IoStatus.Status = STATUS_SUCCESS; … … 446 479 pIrp->AssociatedIrp.SystemBuffer, pStack->Parameters.DeviceIoControl.InputBufferLength, 447 480 pStack->Parameters.DeviceIoControl.OutputBufferLength, pSession)); 448 449 /** @todo IDC on NT: figure when to create the session and that stuff... */450 481 451 482 /* Verify that it's a buffered CTL. */
Note:
See TracChangeset
for help on using the changeset viewer.