Changeset 32474 in vbox
- Timestamp:
- Sep 14, 2010 11:35:57 AM (14 years ago)
- Location:
- trunk/src/VBox/Additions/common/VBoxGuest
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Additions/common/VBoxGuest/VBoxGuest-win-legacy.cpp
r32322 r32474 41 41 *******************************************************************************/ 42 42 RT_C_DECLS_BEGIN 43 NTSTATUS vboxguestwinnt4CreateDevice(PDRIVER_OBJECT pDrvObj, PDEVICE_OBJECT pDevObj, PUNICODE_STRING pRegPath); 43 44 static NTSTATUS vboxguestwinnt4FindPCIDevice(PULONG pBusNumber, PPCI_SLOT_NUMBER pSlotNumber); 44 static void vboxguestwinnt4FreeDeviceResources(PDRIVER_OBJECT pDrvObj, PDEVICE_OBJECT pDevObj);45 45 RT_C_DECLS_END 46 46 … … 48 48 #pragma alloc_text (INIT, vboxguestwinnt4CreateDevice) 49 49 #pragma alloc_text (INIT, vboxguestwinnt4FindPCIDevice) 50 #pragma alloc_text (INIT, vboxguestwinnt4FreeDeviceResources)51 50 #endif 52 51 53 52 54 53 /** 55 * Helper function to create the device object 56 * 57 * @returns NT status code 58 * @param 54 * Legacy helper function to create the device object. 55 * 56 * @returns NT status code. 57 * 58 * @param pDrvObj 59 * @param pDevObj 60 * @param pRegPath 59 61 */ 60 62 NTSTATUS vboxguestwinnt4CreateDevice(PDRIVER_OBJECT pDrvObj, PDEVICE_OBJECT pDevObj, PUNICODE_STRING pRegPath) … … 63 65 NTSTATUS rc = STATUS_SUCCESS; 64 66 65 Log(("VBoxGuest::vboxguestwinnt4CreateDevice: pDrvObj=% x, pDevObj=%x, pRegPath=%x\n",67 Log(("VBoxGuest::vboxguestwinnt4CreateDevice: pDrvObj=%p, pDevObj=%p, pRegPath=%p\n", 66 68 pDrvObj, pDevObj, pRegPath)); 67 69 … … 74 76 Log(("VBoxGuest::vboxguestwinnt4CreateDevice: Device not found!\n")); 75 77 78 bool fSymbolicLinkCreated = false; 79 UNICODE_STRING szDosName; 76 80 PDEVICE_OBJECT pDeviceObject = NULL; 77 81 if (NT_SUCCESS(rc)) … … 87 91 Log(("VBoxGuest::vboxguestwinnt4CreateDevice: Device created\n")); 88 92 89 UNICODE_STRING DosName; 90 RtlInitUnicodeString(&DosName, VBOXGUEST_DEVICE_NAME_DOS); 91 rc = IoCreateSymbolicLink(&DosName, &szDevName); 92 if (NT_ERROR(rc)) 93 RtlInitUnicodeString(&szDosName, VBOXGUEST_DEVICE_NAME_DOS); 94 rc = IoCreateSymbolicLink(&szDosName, &szDevName); 95 if (NT_SUCCESS(rc)) 93 96 { 97 Log(("VBoxGuest::vboxguestwinnt4CreateDevice: Symlink created\n")); 98 fSymbolicLinkCreated = true; 99 } 100 else 94 101 Log(("VBoxGuest::vboxguestwinnt4CreateDevice: IoCreateSymbolicLink failed with rc = %#x\n", rc)); 95 //IoDeleteDevice(pDeviceObject);96 }97 Log(("VBoxGuest::vboxguestwinnt4CreateDevice: Symlink created\n"));98 102 } 99 103 else … … 110 114 111 115 pDevExt = (PVBOXGUESTDEVEXT)pDeviceObject->DeviceExtension; 112 Assert(pDevExt);113 116 RtlZeroMemory(pDevExt, sizeof(VBOXGUESTDEVEXT)); 114 117 } 115 118 116 if ( NT_SUCCESS(rc) 117 && pDevExt) 118 { 119 if (NT_SUCCESS(rc) && pDevExt) 120 { 121 Log(("VBoxGuest::vboxguestwinnt4CreateDevice: Device extension created\n")); 122 119 123 /* Store a reference to ourself. */ 120 124 pDevExt->win.s.pDeviceObject = pDeviceObject; … … 129 133 } 130 134 135 /* Do the actual VBox init ... */ 131 136 if (NT_SUCCESS(rc)) 132 { 133 rc = vboxguestwinInit(pDrvObj, pDevObj, pRegPath); 137 rc = vboxguestwinInit(pDrvObj, pDeviceObject, pRegPath); 138 139 /* Clean up in case of errors. */ 140 if (NT_ERROR(rc)) 141 { 142 if (fSymbolicLinkCreated && szDosName.Length > 0) 143 IoDeleteSymbolicLink(&szDosName); 144 if (pDeviceObject) 145 IoDeleteDevice(pDeviceObject); 134 146 } 135 147 … … 140 152 141 153 /** 142 * Helper function to handle the PCI device lookup 143 * 144 * @returns NT error codes 154 * Helper function to handle the PCI device lookup. 155 * 156 * @returns NT status code. 157 * 158 * @param pBusNumber 159 * @param pSlotNumber 160 * 145 161 */ 146 162 static NTSTATUS vboxguestwinnt4FindPCIDevice(PULONG pBusNumber, PPCI_SLOT_NUMBER pSlotNumber) -
trunk/src/VBox/Additions/common/VBoxGuest/VBoxGuest-win.cpp
r32457 r32474 435 435 IoInitializeDpcRequest(pDevExt->win.s.pDeviceObject, vboxguestwinDpcHandler); 436 436 #ifdef TARGET_NT4 437 ULONG uInterruptVector; 438 KIRQL irqLevel; 437 439 /* Get an interrupt vector. */ 438 440 /* Only proceed if the device provides an interrupt. */ … … 440 442 || pDevExt->win.s.interruptVector) 441 443 { 442 pDevExt->win.s.interruptVector = HalGetInterruptVector(PCIBus, 443 pDevExt->win.s.busNumber, 444 pDevExt->win.s.interruptLevel, 445 pDevExt->win.s.interruptVector, 446 (PKIRQL)pDevExt->win.s.interruptLevel, 447 &pDevExt->win.s.interruptAffinity); 444 Log(("VBoxGuest::vboxguestwinInit: Getting interrupt vector (HAL): Bus: %u, IRQL: %u, Vector: %u\n", 445 pDevExt->win.s.busNumber, pDevExt->win.s.interruptLevel, pDevExt->win.s.interruptVector)); 446 447 uInterruptVector = HalGetInterruptVector(PCIBus, 448 pDevExt->win.s.busNumber, 449 pDevExt->win.s.interruptLevel, 450 pDevExt->win.s.interruptVector, 451 &irqLevel, 452 &pDevExt->win.s.interruptAffinity); 453 Log(("VBoxGuest::vboxguestwinInit: HalGetInterruptVector returns vector %u\n", uInterruptVector)); 454 if (uInterruptVector == 0) 455 Log(("VBoxGuest::vboxguestwinInit: No interrupt vector found!\n")); 448 456 } 449 457 else … … 452 460 if (pDevExt->win.s.interruptVector) 453 461 { 462 Log(("VBoxGuest::vboxguestwinInit: Connecting interrupt ...\n")); 463 454 464 rc = IoConnectInterrupt(&pDevExt->win.s.pInterruptObject, /* Out: interrupt object. */ 455 465 (PKSERVICE_ROUTINE)vboxguestwinIsrHandler, /* Our ISR handler. */ 456 466 pDevExt, /* Device context. */ 457 467 NULL, /* Optional spinlock. */ 468 #ifdef TARGET_NT4 469 uInterruptVector, /* Interrupt vector. */ 470 irqLevel, /* Interrupt level. */ 471 irqLevel, /* Interrupt level. */ 472 #else 458 473 pDevExt->win.s.interruptVector, /* Interrupt vector. */ 459 474 (KIRQL)pDevExt->win.s.interruptLevel, /* Interrupt level. */ 460 475 (KIRQL)pDevExt->win.s.interruptLevel, /* Interrupt level. */ 476 #endif 461 477 pDevExt->win.s.interruptMode, /* LevelSensitive or Latched. */ 462 478 TRUE, /* Shareable interrupt. */ … … 479 495 pDevExt->win.s.hgcm.s.WaitTimeout.QuadPart *= -10000; /* Relative in 100ns units. */ 480 496 497 Log(("VBoxGuest::vboxguestwinInit: Allocating kernel session data ...\n")); 481 498 int vrc = VBoxGuestCreateKernelSession(pDevExt, &pDevExt->win.s.pKernelSession); 482 499 if (RT_FAILURE(vrc)) … … 492 509 Log(("VBoxGuest::vboxguestwinInit: Device is ready!\n")); 493 510 pDevExt->win.s.devState = WORKING; 511 } 512 else 513 { 514 pDevExt->win.s.pInterruptObject = NULL; 494 515 } 495 516
Note:
See TracChangeset
for help on using the changeset viewer.