Changeset 32474 in vbox for trunk/src/VBox/Additions/common/VBoxGuest/VBoxGuest-win-legacy.cpp
- Timestamp:
- Sep 14, 2010 11:35:57 AM (15 years ago)
- svn:sync-xref-src-repo-rev:
- 65848
- File:
-
- 1 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)
Note:
See TracChangeset
for help on using the changeset viewer.