Changeset 38323 in vbox for trunk/src/VBox/HostDrivers/Support
- Timestamp:
- Aug 5, 2011 10:27:14 AM (14 years ago)
- svn:sync-xref-src-repo-rev:
- 73339
- Location:
- trunk/src/VBox/HostDrivers/Support
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/HostDrivers/Support/SUPDrv.c
r38321 r38323 1913 1913 REQ_CHECK_IDC_SIZE(SUPDRV_IDC_REQ_DISCONNECT, sizeof(*pReqHdr)); 1914 1914 1915 #ifdef RT_OS_WINDOWS1916 /* Windows will destroy the session when the file object is destroyed. */1917 #else1918 1915 supdrvCloseSession(pDevExt, pSession); 1919 #endif1920 1916 return pReqHdr->rc = VINF_SUCCESS; 1921 1917 } -
trunk/src/VBox/HostDrivers/Support/win/SUPDrv-win.cpp
r38321 r38323 232 232 NTSTATUS _stdcall VBoxDrvNtCreate(PDEVICE_OBJECT pDevObj, PIRP pIrp) 233 233 { 234 Log(("VBoxDrvNtCreate \n"));234 Log(("VBoxDrvNtCreate: RequestorMode=%d\n", pIrp->RequestorMode)); 235 235 PIO_STACK_LOCATION pStack = IoGetCurrentIrpStackLocation(pIrp); 236 236 PFILE_OBJECT pFileObj = pStack->FileObject; … … 250 250 251 251 /* 252 * Call common code for the rest. 252 * Don't create a session for kernel clients, they'll close the handle 253 * immediately and work with the file object via 254 * VBoxDrvNtInternalDeviceControl. The first request will there be one 255 * to create a session. 253 256 */ 254 pFileObj->FsContext = NULL; 255 PSUPDRVSESSION pSession; 256 //#if 0 /** @todo check if this works, consider OBJ_KERNEL_HANDLE too. */ 257 bool fUser = pIrp->RequestorMode != KernelMode; 258 //#else 259 // bool fUser = true; 260 //#endif 261 int rc = supdrvCreateSession(pDevExt, fUser, &pSession); 262 if (!rc) 263 pFileObj->FsContext = pSession; 264 265 NTSTATUS rcNt = pIrp->IoStatus.Status = VBoxDrvNtErr2NtStatus(rc); 257 NTSTATUS rcNt; 258 if (pIrp->RequestorMode == KernelMode) 259 rcNt = STATUS_SUCCESS; 260 else 261 { 262 /* 263 * Call common code for the rest. 264 */ 265 pFileObj->FsContext = NULL; 266 PSUPDRVSESSION pSession; 267 int rc = supdrvCreateSession(pDevExt, true /*fUser*/, &pSession); 268 if (!rc) 269 pFileObj->FsContext = pSession; 270 rcNt = pIrp->IoStatus.Status = VBoxDrvNtErr2NtStatus(rc); 271 } 272 266 273 pIrp->IoStatus.Information = 0; 267 274 IoCompleteRequest(pIrp, IO_NO_INCREMENT); … … 496 503 { 497 504 /* 498 * Do the job. 505 * Call the generic code. 506 * 507 * Note! Connect and disconnect requires some extra attention 508 * in order to get the session handling right. 499 509 */ 510 if (pStack->Parameters.DeviceIoControl.IoControlCode == SUPDRV_IDC_REQ_DISCONNECT) 511 pFileObj->FsContext = NULL; 512 500 513 rc = supdrvIDC(pStack->Parameters.DeviceIoControl.IoControlCode, pDevExt, pSession, pHdr); 501 514 if (!rc) … … 503 516 if (pStack->Parameters.DeviceIoControl.IoControlCode == SUPDRV_IDC_REQ_CONNECT) 504 517 pFileObj->FsContext = ((PSUPDRVIDCREQCONNECT)pHdr)->u.Out.pSession; 505 /** @todo Handle SUPDRV_IDC_REQ_DISCONNECT and drop the506 * windows hack in the generic code. */507 518 508 519 rcNt = STATUS_SUCCESS; … … 510 521 } 511 522 else 523 { 512 524 rcNt = STATUS_INVALID_PARAMETER; 525 if (pStack->Parameters.DeviceIoControl.IoControlCode == SUPDRV_IDC_REQ_DISCONNECT) 526 pFileObj->FsContext = pSession; 527 } 513 528 Log2(("VBoxDrvNtInternalDeviceControl: returns %#x/rc=%#x\n", rcNt, rc)); 514 529 }
Note:
See TracChangeset
for help on using the changeset viewer.