Changeset 44983 in vbox
- Timestamp:
- Mar 11, 2013 1:34:31 PM (12 years ago)
- svn:sync-xref-src-repo-rev:
- 84204
- Location:
- trunk/src/VBox/Additions/common/VBoxGuest
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Additions/common/VBoxGuest/VBoxGuest-win-legacy.cpp
r44980 r44983 115 115 if (NT_SUCCESS(rc)) 116 116 { 117 rc = vb oxguestwinInit(pDrvObj, pDeviceObject, pRegPath);117 rc = vbgdNtInit(pDrvObj, pDeviceObject, pRegPath); 118 118 if (NT_SUCCESS(rc)) 119 119 { -
trunk/src/VBox/Additions/common/VBoxGuest/VBoxGuest-win-pnp.cpp
r44529 r44983 28 28 * Defined Constants And Macros * 29 29 *******************************************************************************/ 30 extern winVersion_t g_winVersion;31 32 30 RT_C_DECLS_BEGIN 33 static NTSTATUS vb oxguestwinSendIrpSynchronously(PDEVICE_OBJECT pDevObj, PIRP pIrp, BOOLEAN fStrict);34 static NTSTATUS vb oxguestwinPnPIrpComplete(PDEVICE_OBJECT pDevObj, PIRP pIrp, PKEVENT pEvent);35 static VOID vb oxguestwinShowDeviceResources(PCM_PARTIAL_RESOURCE_LIST pResourceList);31 static NTSTATUS vbgdNtSendIrpSynchronously(PDEVICE_OBJECT pDevObj, PIRP pIrp, BOOLEAN fStrict); 32 static NTSTATUS vbgdNtPnPIrpComplete(PDEVICE_OBJECT pDevObj, PIRP pIrp, PKEVENT pEvent); 33 static VOID vbgdNtShowDeviceResources(PCM_PARTIAL_RESOURCE_LIST pResourceList); 36 34 RT_C_DECLS_END 37 35 38 36 #ifdef ALLOC_PRAGMA 39 #pragma alloc_text (PAGE, vb oxguestwinPnP)40 #pragma alloc_text (PAGE, vb oxguestwinPower)41 #pragma alloc_text (PAGE, vb oxguestwinSendIrpSynchronously)42 #pragma alloc_text (PAGE, vb oxguestwinShowDeviceResources)37 #pragma alloc_text (PAGE, vbgdNtPnP) 38 #pragma alloc_text (PAGE, vbgdNtPower) 39 #pragma alloc_text (PAGE, vbgdNtSendIrpSynchronously) 40 #pragma alloc_text (PAGE, vbgdNtShowDeviceResources) 43 41 #endif 44 42 … … 46 44 #define LOG_ENABLED 47 45 48 49 /*******************************************************************************50 * Internal Functions *51 *******************************************************************************/52 46 53 47 /** … … 59 53 * @return NT status code 60 54 */ 61 static NTSTATUS vb oxguestwinPnpIrpComplete(PDEVICE_OBJECT pDevObj, PIRP pIrp, PKEVENT pEvent)55 static NTSTATUS vbgdNtPnpIrpComplete(PDEVICE_OBJECT pDevObj, PIRP pIrp, PKEVENT pEvent) 62 56 { 63 57 KeSetEvent(pEvent, 0, FALSE); … … 74 68 * @return NT status code 75 69 */ 76 static NTSTATUS vb oxguestwinSendIrpSynchronously(PDEVICE_OBJECT pDevObj, PIRP pIrp, BOOLEAN fStrict)70 static NTSTATUS vbgdNtSendIrpSynchronously(PDEVICE_OBJECT pDevObj, PIRP pIrp, BOOLEAN fStrict) 77 71 { 78 72 KEVENT event; … … 81 75 82 76 IoCopyCurrentIrpStackLocationToNext(pIrp); 83 IoSetCompletionRoutine(pIrp, (PIO_COMPLETION_ROUTINE)vb oxguestwinPnpIrpComplete,77 IoSetCompletionRoutine(pIrp, (PIO_COMPLETION_ROUTINE)vbgdNtPnpIrpComplete, 84 78 &event, TRUE, TRUE, TRUE); 85 79 … … 98 92 } 99 93 100 Log(("VBoxGuest::vb oxguestwinSendIrpSynchronously: Returning 0x%x\n", rc));94 Log(("VBoxGuest::vbgdNtSendIrpSynchronously: Returning 0x%x\n", rc)); 101 95 return rc; 102 96 } … … 109 103 * @param pIrp Request packet. 110 104 */ 111 NTSTATUS vb oxguestwinPnP(PDEVICE_OBJECT pDevObj, PIRP pIrp)105 NTSTATUS vbgdNtPnP(PDEVICE_OBJECT pDevObj, PIRP pIrp) 112 106 { 113 107 PVBOXGUESTDEVEXT pDevExt = (PVBOXGUESTDEVEXT)pDevObj->DeviceExtension; … … 142 136 "IRP_MN_SURPRISE_REMOVAL", 143 137 }; 144 Log(("VBoxGuest::vb oxguestwinGuestPnp: MinorFunction: %s\n",138 Log(("VBoxGuest::vbgdNtGuestPnp: MinorFunction: %s\n", 145 139 pStack->MinorFunction < (sizeof(aszFnctName) / sizeof(aszFnctName[0])) 146 140 ? aszFnctName[pStack->MinorFunction] … … 153 147 case IRP_MN_START_DEVICE: 154 148 { 155 Log(("VBoxGuest::vb oxguestwinVBoxGuestPnP: START_DEVICE\n"));149 Log(("VBoxGuest::vbgdNtVBoxGuestPnP: START_DEVICE\n")); 156 150 157 151 /* This must be handled first by the lower driver. */ 158 rc = vb oxguestwinSendIrpSynchronously(pDevExt->win.s.pNextLowerDriver, pIrp, TRUE);152 rc = vbgdNtSendIrpSynchronously(pDevExt->win.s.pNextLowerDriver, pIrp, TRUE); 159 153 160 154 if ( NT_SUCCESS(rc) 161 155 && NT_SUCCESS(pIrp->IoStatus.Status)) 162 156 { 163 Log(("VBoxGuest::vb oxguestwinVBoxGuestPnP: START_DEVICE: pStack->Parameters.StartDevice.AllocatedResources = %p\n",157 Log(("VBoxGuest::vbgdNtVBoxGuestPnP: START_DEVICE: pStack->Parameters.StartDevice.AllocatedResources = %p\n", 164 158 pStack->Parameters.StartDevice.AllocatedResources)); 165 159 166 160 if (!pStack->Parameters.StartDevice.AllocatedResources) 167 161 { 168 Log(("VBoxGuest::vb oxguestwinVBoxGuestPnP: START_DEVICE: No resources, pDevExt = %p, nextLowerDriver = %p!\n",162 Log(("VBoxGuest::vbgdNtVBoxGuestPnP: START_DEVICE: No resources, pDevExt = %p, nextLowerDriver = %p!\n", 169 163 pDevExt, pDevExt ? pDevExt->win.s.pNextLowerDriver : NULL)); 170 164 rc = STATUS_UNSUCCESSFUL; … … 172 166 else 173 167 { 174 rc = vb oxguestwinInit(pDevObj, pIrp);168 rc = vbgdNtInit(pDevObj, pIrp); 175 169 } 176 170 } … … 178 172 if (NT_ERROR(rc)) 179 173 { 180 Log(("VBoxGuest::vb oxguestwinGuestPnp: START_DEVICE: Error: rc = 0x%x\n", rc));174 Log(("VBoxGuest::vbgdNtGuestPnp: START_DEVICE: Error: rc = 0x%x\n", rc)); 181 175 182 176 /* Need to unmap memory in case of errors ... */ 183 vb oxguestwinUnmapVMMDevMemory(pDevExt);177 vbgdNtUnmapVMMDevMemory(pDevExt); 184 178 } 185 179 break; … … 188 182 case IRP_MN_CANCEL_REMOVE_DEVICE: 189 183 { 190 Log(("VBoxGuest::vb oxguestwinVBoxGuestPnP: CANCEL_REMOVE_DEVICE\n"));184 Log(("VBoxGuest::vbgdNtVBoxGuestPnP: CANCEL_REMOVE_DEVICE\n")); 191 185 192 186 /* This must be handled first by the lower driver. */ 193 rc = vb oxguestwinSendIrpSynchronously(pDevExt->win.s.pNextLowerDriver, pIrp, TRUE);187 rc = vbgdNtSendIrpSynchronously(pDevExt->win.s.pNextLowerDriver, pIrp, TRUE); 194 188 195 189 if (NT_SUCCESS(rc) && pDevExt->win.s.devState == PENDINGREMOVE) … … 205 199 case IRP_MN_SURPRISE_REMOVAL: 206 200 { 207 Log(("VBoxGuest::vb oxguestwinVBoxGuestPnP: IRP_MN_SURPRISE_REMOVAL\n"));201 Log(("VBoxGuest::vbgdNtVBoxGuestPnP: IRP_MN_SURPRISE_REMOVAL\n")); 208 202 209 203 VBOXGUEST_UPDATE_DEVSTATE(pDevExt, SURPRISEREMOVED); … … 227 221 case IRP_MN_QUERY_REMOVE_DEVICE: 228 222 { 229 Log(("VBoxGuest::vb oxguestwinVBoxGuestPnP: QUERY_REMOVE_DEVICE\n"));223 Log(("VBoxGuest::vbgdNtVBoxGuestPnP: QUERY_REMOVE_DEVICE\n")); 230 224 231 225 #ifdef VBOX_REBOOT_ON_UNINSTALL 232 Log(("VBoxGuest::vb oxguestwinGuestPnp: QUERY_REMOVE_DEVICE: Device cannot be removed without a reboot.\n"));226 Log(("VBoxGuest::vbgdNtGuestPnp: QUERY_REMOVE_DEVICE: Device cannot be removed without a reboot.\n")); 233 227 rc = STATUS_UNSUCCESSFUL; 234 228 #endif /* VBOX_REBOOT_ON_UNINSTALL */ … … 244 238 245 239 rc = IoCallDriver(pDevExt->win.s.pNextLowerDriver, pIrp); 246 Log(("VBoxGuest::vb oxguestwinGuestPnp: QUERY_REMOVE_DEVICE: Next lower driver replied rc = 0x%x\n", rc));240 Log(("VBoxGuest::vbgdNtGuestPnp: QUERY_REMOVE_DEVICE: Next lower driver replied rc = 0x%x\n", rc)); 247 241 248 242 /* we must not do anything the IRP after doing IoSkip & CallDriver … … 258 252 case IRP_MN_REMOVE_DEVICE: 259 253 { 260 Log(("VBoxGuest::vb oxguestwinVBoxGuestPnP: REMOVE_DEVICE\n"));254 Log(("VBoxGuest::vbgdNtVBoxGuestPnP: REMOVE_DEVICE\n")); 261 255 262 256 VBOXGUEST_UPDATE_DEVSTATE(pDevExt, REMOVED); … … 264 258 /* Free hardware resources. */ 265 259 /* @todo this should actually free I/O ports, interrupts, etc. */ 266 rc = vb oxguestwinCleanup(pDevObj);267 Log(("VBoxGuest::vb oxguestwinGuestPnp: REMOVE_DEVICE: vboxguestwinCleanup rc = 0x%08X\n", rc));260 rc = vbgdNtCleanup(pDevObj); 261 Log(("VBoxGuest::vbgdNtGuestPnp: REMOVE_DEVICE: vbgdNtCleanup rc = 0x%08X\n", rc)); 268 262 269 263 /* … … 277 271 278 272 rc = IoCallDriver(pDevExt->win.s.pNextLowerDriver, pIrp); 279 Log(("VBoxGuest::vb oxguestwinGuestPnp: REMOVE_DEVICE: Next lower driver replied rc = 0x%x\n", rc));273 Log(("VBoxGuest::vbgdNtGuestPnp: REMOVE_DEVICE: Next lower driver replied rc = 0x%x\n", rc)); 280 274 281 275 IoDetachDevice(pDevExt->win.s.pNextLowerDriver); 282 276 283 Log(("VBoxGuest::vb oxguestwinGuestPnp: REMOVE_DEVICE: Removing device ...\n"));277 Log(("VBoxGuest::vbgdNtGuestPnp: REMOVE_DEVICE: Removing device ...\n")); 284 278 285 279 /* Destroy device extension and clean up everything else. */ … … 291 285 IoDeleteSymbolicLink(&win32Name); 292 286 293 Log(("VBoxGuest::vb oxguestwinGuestPnp: REMOVE_DEVICE: Deleting device ...\n"));287 Log(("VBoxGuest::vbgdNtGuestPnp: REMOVE_DEVICE: Deleting device ...\n")); 294 288 295 289 /* Last action: Delete our device! pDevObj is *not* failed … … 297 291 IoDeleteDevice(pDevObj); 298 292 299 Log(("VBoxGuest::vb oxguestwinGuestPnp: REMOVE_DEVICE: Device removed!\n"));293 Log(("VBoxGuest::vbgdNtGuestPnp: REMOVE_DEVICE: Device removed!\n")); 300 294 301 295 /* Propagating rc from IoCallDriver. */ … … 305 299 case IRP_MN_CANCEL_STOP_DEVICE: 306 300 { 307 Log(("VBoxGuest::vb oxguestwinVBoxGuestPnP: CANCEL_STOP_DEVICE\n"));301 Log(("VBoxGuest::vbgdNtVBoxGuestPnP: CANCEL_STOP_DEVICE\n")); 308 302 309 303 /* This must be handled first by the lower driver. */ 310 rc = vb oxguestwinSendIrpSynchronously(pDevExt->win.s.pNextLowerDriver, pIrp, TRUE);304 rc = vbgdNtSendIrpSynchronously(pDevExt->win.s.pNextLowerDriver, pIrp, TRUE); 311 305 312 306 if (NT_SUCCESS(rc) && pDevExt->win.s.devState == PENDINGSTOP) … … 322 316 case IRP_MN_QUERY_STOP_DEVICE: 323 317 { 324 Log(("VBoxGuest::vb oxguestwinVBoxGuestPnP: QUERY_STOP_DEVICE\n"));318 Log(("VBoxGuest::vbgdNtVBoxGuestPnP: QUERY_STOP_DEVICE\n")); 325 319 326 320 #ifdef VBOX_REBOOT_ON_UNINSTALL 327 Log(("VBoxGuest::vb oxguestwinGuestPnp: QUERY_STOP_DEVICE: Device cannot be stopped without a reboot!\n"));321 Log(("VBoxGuest::vbgdNtGuestPnp: QUERY_STOP_DEVICE: Device cannot be stopped without a reboot!\n")); 328 322 pIrp->IoStatus.Status = STATUS_UNSUCCESSFUL; 329 323 #endif /* VBOX_REBOOT_ON_UNINSTALL */ … … 339 333 340 334 rc = IoCallDriver(pDevExt->win.s.pNextLowerDriver, pIrp); 341 Log(("VBoxGuest::vb oxguestwinGuestPnp: QUERY_STOP_DEVICE: Next lower driver replied rc = 0x%x\n", rc));335 Log(("VBoxGuest::vbgdNtGuestPnp: QUERY_STOP_DEVICE: Next lower driver replied rc = 0x%x\n", rc)); 342 336 343 337 /* we must not do anything with the IRP after doing IoSkip & CallDriver … … 353 347 case IRP_MN_STOP_DEVICE: 354 348 { 355 Log(("VBoxGuest::vb oxguestwinVBoxGuestPnP: STOP_DEVICE\n"));349 Log(("VBoxGuest::vbgdNtVBoxGuestPnP: STOP_DEVICE\n")); 356 350 357 351 VBOXGUEST_UPDATE_DEVSTATE(pDevExt, STOPPED); … … 359 353 /* Free hardware resources. */ 360 354 /* @todo this should actually free I/O ports, interrupts, etc. */ 361 rc = vb oxguestwinCleanup(pDevObj);362 Log(("VBoxGuest::vb oxguestwinGuestPnp: STOP_DEVICE: cleaning up, rc = 0x%x\n", rc));355 rc = vbgdNtCleanup(pDevObj); 356 Log(("VBoxGuest::vbgdNtGuestPnp: STOP_DEVICE: cleaning up, rc = 0x%x\n", rc)); 363 357 364 358 /* Pass to the lower driver. */ … … 368 362 369 363 rc = IoCallDriver(pDevExt->win.s.pNextLowerDriver, pIrp); 370 Log(("VBoxGuest::vb oxguestwinGuestPnp: STOP_DEVICE: Next lower driver replied rc = 0x%x\n", rc));364 Log(("VBoxGuest::vbgdNtGuestPnp: STOP_DEVICE: Next lower driver replied rc = 0x%x\n", rc)); 371 365 372 366 return rc; … … 384 378 IoCompleteRequest(pIrp, IO_NO_INCREMENT); 385 379 386 Log(("VBoxGuest::vb oxguestwinGuestPnp: Returning with rc = 0x%x\n", rc));380 Log(("VBoxGuest::vbgdNtGuestPnp: Returning with rc = 0x%x\n", rc)); 387 381 return rc; 388 382 } … … 397 391 * @param pContext Context value passed to IoSetCompletionRoutine in VBoxGuestPower. 398 392 */ 399 NTSTATUS vboxguestwinPowerComplete(IN PDEVICE_OBJECT pDevObj, 400 IN PIRP pIrp, IN PVOID pContext) 393 static NTSTATUS vbgdNtPowerComplete(IN PDEVICE_OBJECT pDevObj, IN PIRP pIrp, IN PVOID pContext) 401 394 { 402 395 PIO_STACK_LOCATION pIrpSp; … … 442 435 * @param pIrp IRP 443 436 */ 444 NTSTATUS vb oxguestwinPower(PDEVICE_OBJECT pDevObj, PIRP pIrp)437 NTSTATUS vbgdNtPower(PDEVICE_OBJECT pDevObj, PIRP pIrp) 445 438 { 446 439 PIO_STACK_LOCATION pStack = IoGetCurrentIrpStackLocation(pIrp); … … 450 443 POWER_ACTION powerAction; 451 444 452 Log(("VBoxGuest::vb oxguestwinGuestPower\n"));445 Log(("VBoxGuest::vbgdNtGuestPower\n")); 453 446 454 447 powerType = pStack->Parameters.Power.Type; … … 460 453 case IRP_MN_SET_POWER: 461 454 { 462 Log(("VBoxGuest::vb oxguestwinGuestPower: IRP_MN_SET_POWER, type= %d\n", powerType));455 Log(("VBoxGuest::vbgdNtGuestPower: IRP_MN_SET_POWER, type= %d\n", powerType)); 463 456 switch (powerType) 464 457 { 465 458 case SystemPowerState: 466 459 { 467 Log(("VBoxGuest::vb oxguestwinGuestPower: SystemPowerState, action = %d, state = %d\n", powerAction, powerState));460 Log(("VBoxGuest::vbgdNtGuestPower: SystemPowerState, action = %d, state = %d\n", powerAction, powerState)); 468 461 469 462 switch (powerAction) … … 477 470 && pDevExt->win.s.LastSystemPowerAction == PowerActionHibernate) 478 471 { 479 Log(("VBoxGuest::vboxguestwinGuestPower: Returning from hibernation!\n")); 480 int rc = VBoxGuestReinitDevExtAfterHibernation(pDevExt, vboxguestwinVersionToOSType(g_winVersion)); 472 Log(("VBoxGuest::vbgdNtGuestPower: Returning from hibernation!\n")); 473 int rc = VBoxGuestReinitDevExtAfterHibernation(pDevExt, 474 vbgdNtVersionToOSType(g_enmVbgdNtVer)); 481 475 if (RT_FAILURE(rc)) 482 Log(("VBoxGuest::vb oxguestwinGuestPower: Cannot re-init VMMDev chain, rc = %d!\n", rc));476 Log(("VBoxGuest::vbgdNtGuestPower: Cannot re-init VMMDev chain, rc = %d!\n", rc)); 483 477 } 484 478 } … … 487 481 case PowerActionShutdownReset: 488 482 { 489 Log(("VBoxGuest::vb oxguestwinGuestPower: Power action reset!\n"));483 Log(("VBoxGuest::vbgdNtGuestPower: Power action reset!\n")); 490 484 491 485 /* Tell the VMM that we no longer support mouse pointer integration. */ … … 516 510 case PowerActionShutdownOff: 517 511 { 518 Log(("VBoxGuest::vb oxguestwinGuestPower: Power action shutdown!\n"));512 Log(("VBoxGuest::vbgdNtGuestPower: Power action shutdown!\n")); 519 513 if (powerState.SystemState >= PowerSystemShutdown) 520 514 { 521 Log(("VBoxGuest::vb oxguestwinGuestPower: Telling the VMMDev to close the VM ...\n"));515 Log(("VBoxGuest::vbgdNtGuestPower: Telling the VMMDev to close the VM ...\n")); 522 516 523 517 VMMDevPowerStateRequest *pReq = pDevExt->win.s.pPowerStateRequest; … … 544 538 case PowerActionHibernate: 545 539 546 Log(("VBoxGuest::vb oxguestwinGuestPower: Power action hibernate!\n"));540 Log(("VBoxGuest::vbgdNtGuestPower: Power action hibernate!\n")); 547 541 break; 548 542 } … … 578 572 IoCopyCurrentIrpStackLocationToNext(pIrp); 579 573 IoSetCompletionRoutine(pIrp, 580 vb oxguestwinPowerComplete,574 vbgdNtPowerComplete, 581 575 (PVOID)pDevExt, 582 576 TRUE, -
trunk/src/VBox/Additions/common/VBoxGuest/VBoxGuest-win.cpp
r44979 r44983 1 /* $Id$ */ 1 2 /** @file 2 *3 3 * VBoxGuest - Windows specifics. 4 * 5 * Copyright (C) 2010-2012 Oracle Corporation 4 */ 5 6 /* 7 * Copyright (C) 2010-2013 Oracle Corporation 6 8 * 7 9 * This file is part of VirtualBox Open Source Edition (OSE), as … … 36 38 #endif 37 39 40 38 41 /******************************************************************************* 39 42 * Internal Functions * 40 43 *******************************************************************************/ 41 44 RT_C_DECLS_BEGIN 42 static NTSTATUS vb oxguestwinAddDevice(PDRIVER_OBJECT pDrvObj, PDEVICE_OBJECT pDevObj);43 static void vb oxguestwinUnload(PDRIVER_OBJECT pDrvObj);44 static NTSTATUS vb oxguestwinCreate(PDEVICE_OBJECT pDevObj, PIRP pIrp);45 static NTSTATUS vb oxguestwinClose(PDEVICE_OBJECT pDevObj, PIRP pIrp);46 static NTSTATUS vb oxguestwinIOCtl(PDEVICE_OBJECT pDevObj, PIRP pIrp);47 static NTSTATUS vb oxguestwinInternalIOCtl(PDEVICE_OBJECT pDevObj, PIRP pIrp);48 static NTSTATUS vb oxguestwinRegistryReadDWORD(ULONG ulRoot, PCWSTR pwszPath, PWSTR pwszName, PULONG puValue);49 static NTSTATUS vb oxguestwinSystemControl(PDEVICE_OBJECT pDevObj, PIRP pIrp);50 static NTSTATUS vb oxguestwinShutdown(PDEVICE_OBJECT pDevObj, PIRP pIrp);51 static NTSTATUS vb oxguestwinNotSupportedStub(PDEVICE_OBJECT pDevObj, PIRP pIrp);45 static NTSTATUS vbgdNtAddDevice(PDRIVER_OBJECT pDrvObj, PDEVICE_OBJECT pDevObj); 46 static void vbgdNtUnload(PDRIVER_OBJECT pDrvObj); 47 static NTSTATUS vbgdNtCreate(PDEVICE_OBJECT pDevObj, PIRP pIrp); 48 static NTSTATUS vbgdNtClose(PDEVICE_OBJECT pDevObj, PIRP pIrp); 49 static NTSTATUS vbgdNtIOCtl(PDEVICE_OBJECT pDevObj, PIRP pIrp); 50 static NTSTATUS vbgdNtInternalIOCtl(PDEVICE_OBJECT pDevObj, PIRP pIrp); 51 static NTSTATUS vbgdNtRegistryReadDWORD(ULONG ulRoot, PCWSTR pwszPath, PWSTR pwszName, PULONG puValue); 52 static NTSTATUS vbgdNtSystemControl(PDEVICE_OBJECT pDevObj, PIRP pIrp); 53 static NTSTATUS vbgdNtShutdown(PDEVICE_OBJECT pDevObj, PIRP pIrp); 54 static NTSTATUS vbgdNtNotSupportedStub(PDEVICE_OBJECT pDevObj, PIRP pIrp); 52 55 #ifdef DEBUG 53 static void vb oxguestwinDoTests(void);56 static void vbgdNtDoTests(void); 54 57 #endif 55 58 RT_C_DECLS_END … … 64 67 65 68 #ifdef ALLOC_PRAGMA 66 #pragma alloc_text (INIT, DriverEntry) 67 #pragma alloc_text (PAGE, vboxguestwinAddDevice) 68 #pragma alloc_text (PAGE, vboxguestwinUnload) 69 #pragma alloc_text (PAGE, vboxguestwinCreate) 70 #pragma alloc_text (PAGE, vboxguestwinClose) 71 #pragma alloc_text (PAGE, vboxguestwinIOCtl) 72 #pragma alloc_text (PAGE, vboxguestwinShutdown) 73 #pragma alloc_text (PAGE, vboxguestwinNotSupportedStub) 74 #pragma alloc_text (PAGE, vboxguestwinScanPCIResourceList) 75 #endif 76 77 /** The detected Windows version. */ 78 winVersion_t g_winVersion; 69 # pragma alloc_text(INIT, DriverEntry) 70 # pragma alloc_text(PAGE, vbgdNtAddDevice) 71 # pragma alloc_text(PAGE, vbgdNtUnload) 72 # pragma alloc_text(PAGE, vbgdNtCreate) 73 # pragma alloc_text(PAGE, vbgdNtClose) 74 # pragma alloc_text(PAGE, vbgdNtIOCtl) 75 # pragma alloc_text(PAGE, vbgdNtShutdown) 76 # pragma alloc_text(PAGE, vbgdNtNotSupportedStub) 77 # pragma alloc_text(PAGE, vbgdNtScanPCIResourceList) 78 #endif 79 80 81 /******************************************************************************* 82 * Global Variables * 83 *******************************************************************************/ 84 /** The detected NT (windows) version. */ 85 VBGDNTVER g_enmVbgdNtVer = VBGDNTVER_INVALID; 86 87 79 88 80 89 /** … … 91 100 Log(("VBoxGuest::DriverEntry. Driver built: %s %s\n", __DATE__, __TIME__)); 92 101 93 ULONG majorVersion; 94 ULONG minorVersion; 95 ULONG buildNumber; 96 BOOLEAN bCheckedBuild = PsGetVersion(&majorVersion, &minorVersion, &buildNumber, NULL); 97 Log(("VBoxGuest::DriverEntry: Running on Windows NT version %d.%d, build %d\n", majorVersion, minorVersion, buildNumber)); 98 if (bCheckedBuild) 102 /* 103 * Check if the the NT version is supported and initializing 104 * g_enmVbgdNtVer in the process. 105 */ 106 ULONG ulMajorVer; 107 ULONG ulMinorVer; 108 ULONG ulBuildNo; 109 BOOLEAN fCheckedBuild = PsGetVersion(&ulMajorVer, &ulMinorVer, &ulBuildNo, NULL); 110 Log(("VBoxGuest::DriverEntry: Running on Windows NT version %u.%u, build %u\n", ulMajorVer, ulMinorVer, ulBuildNo)); 111 if (fCheckedBuild) 99 112 Log(("VBoxGuest::DriverEntry: Running on a Windows checked build (debug)!\n")); 100 113 #ifdef DEBUG 101 vb oxguestwinDoTests();102 #endif 103 switch ( majorVersion)114 vbgdNtDoTests(); 115 #endif 116 switch (ulMajorVer) 104 117 { 105 118 case 6: /* Windows Vista or Windows 7 (based on minor ver) */ 106 switch ( minorVersion)119 switch (ulMinorVer) 107 120 { 108 121 case 0: /* Note: Also could be Windows 2008 Server! */ 109 g_ winVersion =WINVISTA;122 g_enmVbgdNtVer = VBGDNTVER_WINVISTA; 110 123 break; 111 124 case 1: /* Note: Also could be Windows 2008 Server R2! */ 112 g_ winVersion =WIN7;125 g_enmVbgdNtVer = VBGDNTVER_WIN7; 113 126 break; 114 127 case 2: 115 g_ winVersion =WIN8;128 g_enmVbgdNtVer = VBGDNTVER_WIN8; 116 129 break; 117 130 default: 118 Log(("VBoxGuest::DriverEntry: Unknown version of Windows (%u.%u), refusing!\n", 119 majorVersion, minorVersion)); 131 Log(("VBoxGuest::DriverEntry: Unknown version of Windows (%u.%u), refusing!\n", ulMajorVer, ulMinorVer)); 120 132 rc = STATUS_DRIVER_UNABLE_TO_LOAD; 121 133 break; … … 123 135 break; 124 136 case 5: 125 switch ( minorVersion)137 switch (ulMinorVer) 126 138 { 127 139 case 2: 128 g_ winVersion =WIN2K3;140 g_enmVbgdNtVer = VBGDNTVER_WIN2K3; 129 141 break; 130 142 case 1: 131 g_ winVersion =WINXP;143 g_enmVbgdNtVer = VBGDNTVER_WINXP; 132 144 break; 133 145 case 0: 134 g_ winVersion =WIN2K;146 g_enmVbgdNtVer = VBGDNTVER_WIN2K; 135 147 break; 136 148 default: 137 Log(("VBoxGuest::DriverEntry: Unknown version of Windows (%u.%u), refusing!\n", 138 majorVersion, minorVersion)); 149 Log(("VBoxGuest::DriverEntry: Unknown version of Windows (%u.%u), refusing!\n", ulMajorVer, ulMinorVer)); 139 150 rc = STATUS_DRIVER_UNABLE_TO_LOAD; 140 151 } 141 152 break; 142 153 case 4: 143 g_ winVersion =WINNT4;154 g_enmVbgdNtVer = VBGDNTVER_WINNT4; 144 155 break; 145 156 default: 146 Log(("VBoxGuest::DriverEntry: At least Windows NT4 required!\n")); 157 if (ulMajorVer < 4) 158 Log(("VBoxGuest::DriverEntry: At least Windows NT4 required! (%u.%u)\n", ulMajorVer, ulMinorVer)); 159 else 160 Log(("VBoxGuest::DriverEntry: Too new version %u.%u!\n", ulMajorVer, ulMinorVer)); 147 161 rc = STATUS_DRIVER_UNABLE_TO_LOAD; 162 break; 148 163 } 149 164 … … 153 168 * Setup the driver entry points in pDrvObj. 154 169 */ 155 pDrvObj->DriverUnload = vb oxguestwinUnload;156 pDrvObj->MajorFunction[IRP_MJ_CREATE] = vb oxguestwinCreate;157 pDrvObj->MajorFunction[IRP_MJ_CLOSE] = vb oxguestwinClose;158 pDrvObj->MajorFunction[IRP_MJ_DEVICE_CONTROL] = vb oxguestwinIOCtl;159 pDrvObj->MajorFunction[IRP_MJ_INTERNAL_DEVICE_CONTROL] = vb oxguestwinInternalIOCtl;160 pDrvObj->MajorFunction[IRP_MJ_SHUTDOWN] = vb oxguestwinShutdown;161 pDrvObj->MajorFunction[IRP_MJ_READ] = vb oxguestwinNotSupportedStub;162 pDrvObj->MajorFunction[IRP_MJ_WRITE] = vb oxguestwinNotSupportedStub;170 pDrvObj->DriverUnload = vbgdNtUnload; 171 pDrvObj->MajorFunction[IRP_MJ_CREATE] = vbgdNtCreate; 172 pDrvObj->MajorFunction[IRP_MJ_CLOSE] = vbgdNtClose; 173 pDrvObj->MajorFunction[IRP_MJ_DEVICE_CONTROL] = vbgdNtIOCtl; 174 pDrvObj->MajorFunction[IRP_MJ_INTERNAL_DEVICE_CONTROL] = vbgdNtInternalIOCtl; 175 pDrvObj->MajorFunction[IRP_MJ_SHUTDOWN] = vbgdNtShutdown; 176 pDrvObj->MajorFunction[IRP_MJ_READ] = vbgdNtNotSupportedStub; 177 pDrvObj->MajorFunction[IRP_MJ_WRITE] = vbgdNtNotSupportedStub; 163 178 #ifdef TARGET_NT4 164 179 rc = vbgdNt4CreateDevice(pDrvObj, NULL /* pDevObj */, pRegPath); 165 180 #else 166 pDrvObj->MajorFunction[IRP_MJ_PNP] = vb oxguestwinPnP;167 pDrvObj->MajorFunction[IRP_MJ_POWER] = vb oxguestwinPower;168 pDrvObj->MajorFunction[IRP_MJ_SYSTEM_CONTROL] = vb oxguestwinSystemControl;169 pDrvObj->DriverExtension->AddDevice = (PDRIVER_ADD_DEVICE)vb oxguestwinAddDevice;181 pDrvObj->MajorFunction[IRP_MJ_PNP] = vbgdNtPnP; 182 pDrvObj->MajorFunction[IRP_MJ_POWER] = vbgdNtPower; 183 pDrvObj->MajorFunction[IRP_MJ_SYSTEM_CONTROL] = vbgdNtSystemControl; 184 pDrvObj->DriverExtension->AddDevice = (PDRIVER_ADD_DEVICE)vbgdNtAddDevice; 170 185 #endif 171 186 } … … 184 199 * @param pDevObj Device object 185 200 */ 186 static NTSTATUS vb oxguestwinAddDevice(PDRIVER_OBJECT pDrvObj, PDEVICE_OBJECT pDevObj)201 static NTSTATUS vbgdNtAddDevice(PDRIVER_OBJECT pDrvObj, PDEVICE_OBJECT pDevObj) 187 202 { 188 203 NTSTATUS rc; 189 Log(("VBoxGuest::vb oxguestwinGuestAddDevice\n"));204 Log(("VBoxGuest::vbgdNtGuestAddDevice\n")); 190 205 191 206 /* … … 222 237 if (pDevExt->win.s.pNextLowerDriver == NULL) 223 238 { 224 Log(("VBoxGuest::vb oxguestwinGuestAddDevice: IoAttachDeviceToDeviceStack did not give a nextLowerDriver!\n"));239 Log(("VBoxGuest::vbgdNtGuestAddDevice: IoAttachDeviceToDeviceStack did not give a nextLowerDriver!\n")); 225 240 rc = STATUS_DEVICE_NOT_CONNECTED; 226 241 } 227 242 } 228 243 else 229 Log(("VBoxGuest::vb oxguestwinGuestAddDevice: IoCreateSymbolicLink failed with rc=%#x!\n", rc));244 Log(("VBoxGuest::vbgdNtGuestAddDevice: IoCreateSymbolicLink failed with rc=%#x!\n", rc)); 230 245 } 231 246 else 232 Log(("VBoxGuest::vb oxguestwinGuestAddDevice: IoCreateDevice failed with rc=%#x!\n", rc));247 Log(("VBoxGuest::vbgdNtGuestAddDevice: IoCreateDevice failed with rc=%#x!\n", rc)); 233 248 234 249 if (NT_SUCCESS(rc)) … … 239 254 */ 240 255 #ifdef VBOX_WITH_GUEST_BUGCHECK_DETECTION 241 vb oxguestwinBugCheckCallback(pDevExt); /* Ignore failure! */256 vbgdNtBugCheckCallback(pDevExt); /* Ignore failure! */ 242 257 #endif 243 258 /* VBoxGuestPower is pageable; ensure we are not called at elevated IRQL */ … … 261 276 } 262 277 263 Log(("VBoxGuest::vb oxguestwinGuestAddDevice: returning with rc = 0x%x\n", rc));278 Log(("VBoxGuest::vbgdNtGuestAddDevice: returning with rc = 0x%x\n", rc)); 264 279 return rc; 265 280 } … … 272 287 * @param pResourceList list of device resources. 273 288 */ 274 static void vb oxguestwinShowDeviceResources(PCM_PARTIAL_RESOURCE_LIST pResourceList)289 static void vbgdNtShowDeviceResources(PCM_PARTIAL_RESOURCE_LIST pResourceList) 275 290 { 276 291 #ifdef LOG_ENABLED … … 296 311 }; 297 312 298 Log(("VBoxGuest::vb oxguestwinShowDeviceResources: Type %s",313 Log(("VBoxGuest::vbgdNtShowDeviceResources: Type %s", 299 314 uType < (sizeof(aszName) / sizeof(aszName[0])) 300 315 ? aszName[uType] : "Unknown")); … … 304 319 case CmResourceTypePort: 305 320 case CmResourceTypeMemory: 306 Log(("VBoxGuest::vb oxguestwinShowDeviceResources: Start %8X%8.8lX length %X\n",321 Log(("VBoxGuest::vbgdNtShowDeviceResources: Start %8X%8.8lX length %X\n", 307 322 resource->u.Port.Start.HighPart, resource->u.Port.Start.LowPart, 308 323 resource->u.Port.Length)); … … 310 325 311 326 case CmResourceTypeInterrupt: 312 Log(("VBoxGuest::vb oxguestwinShowDeviceResources: Level %X, Vector %X, Affinity %X\n",327 Log(("VBoxGuest::vbgdNtShowDeviceResources: Level %X, Vector %X, Affinity %X\n", 313 328 resource->u.Interrupt.Level, resource->u.Interrupt.Vector, 314 329 resource->u.Interrupt.Affinity)); … … 316 331 317 332 case CmResourceTypeDma: 318 Log(("VBoxGuest::vb oxguestwinShowDeviceResources: Channel %d, Port %X\n",333 Log(("VBoxGuest::vbgdNtShowDeviceResources: Channel %d, Port %X\n", 319 334 resource->u.Dma.Channel, resource->u.Dma.Port)); 320 335 break; … … 336 351 */ 337 352 #ifndef TARGET_NT4 338 NTSTATUS vb oxguestwinInit(PDEVICE_OBJECT pDevObj, PIRP pIrp)353 NTSTATUS vbgdNtInit(PDEVICE_OBJECT pDevObj, PIRP pIrp) 339 354 #else 340 NTSTATUS vb oxguestwinInit(PDRIVER_OBJECT pDrvObj, PDEVICE_OBJECT pDevObj, PUNICODE_STRING pRegPath)355 NTSTATUS vbgdNtInit(PDRIVER_OBJECT pDrvObj, PDEVICE_OBJECT pDevObj, PUNICODE_STRING pRegPath) 341 356 #endif 342 357 { … … 346 361 #endif 347 362 348 Log(("VBoxGuest::vb oxguestwinInit\n"));363 Log(("VBoxGuest::vbgdNtInit\n")); 349 364 350 365 int rc = STATUS_SUCCESS; … … 353 368 * Let's have a look at what our PCI adapter offers. 354 369 */ 355 Log(("VBoxGuest::vb oxguestwinInit: Starting to scan PCI resources of VBoxGuest ...\n"));370 Log(("VBoxGuest::vbgdNtInit: Starting to scan PCI resources of VBoxGuest ...\n")); 356 371 357 372 /* Assign the PCI resources. */ … … 364 379 &pResourceList); 365 380 if (pResourceList && pResourceList->Count > 0) 366 vb oxguestwinShowDeviceResources(&pResourceList->List[0].PartialResourceList);381 vbgdNtShowDeviceResources(&pResourceList->List[0].PartialResourceList); 367 382 if (NT_SUCCESS(rc)) 368 rc = vb oxguestwinScanPCIResourceList(pResourceList, pDevExt);383 rc = vbgdNtScanPCIResourceList(pResourceList, pDevExt); 369 384 #else 370 385 if (pStack->Parameters.StartDevice.AllocatedResources->Count > 0) 371 vb oxguestwinShowDeviceResources(&pStack->Parameters.StartDevice.AllocatedResources->List[0].PartialResourceList);386 vbgdNtShowDeviceResources(&pStack->Parameters.StartDevice.AllocatedResources->List[0].PartialResourceList); 372 387 if (NT_SUCCESS(rc)) 373 rc = vb oxguestwinScanPCIResourceList(pStack->Parameters.StartDevice.AllocatedResourcesTranslated,388 rc = vbgdNtScanPCIResourceList(pStack->Parameters.StartDevice.AllocatedResourcesTranslated, 374 389 pDevExt); 375 390 #endif … … 382 397 void *pvMMIOBase = NULL; 383 398 uint32_t cbMMIO = 0; 384 rc = vb oxguestwinMapVMMDevMemory(pDevExt,385 386 387 388 399 rc = vbgdNtMapVMMDevMemory(pDevExt, 400 pDevExt->win.s.vmmDevPhysMemoryAddress, 401 pDevExt->win.s.vmmDevPhysMemoryLength, 402 &pvMMIOBase, 403 &cbMMIO); 389 404 if (NT_SUCCESS(rc)) 390 405 { 391 406 pDevExt->pVMMDevMemory = (VMMDevMemory *)pvMMIOBase; 392 407 393 Log(("VBoxGuest::vb oxguestwinInit: pvMMIOBase = 0x%p, pDevExt = 0x%p, pDevExt->pVMMDevMemory = 0x%p\n",408 Log(("VBoxGuest::vbgdNtInit: pvMMIOBase = 0x%p, pDevExt = 0x%p, pDevExt->pVMMDevMemory = 0x%p\n", 394 409 pvMMIOBase, pDevExt, pDevExt ? pDevExt->pVMMDevMemory : NULL)); 395 410 … … 397 412 pDevExt->IOPortBase, 398 413 pvMMIOBase, cbMMIO, 399 vb oxguestwinVersionToOSType(g_winVersion),414 vbgdNtVersionToOSType(g_enmVbgdNtVer), 400 415 VMMDEV_EVENT_MOUSE_POSITION_CHANGED); 401 416 if (RT_FAILURE(vrc)) 402 417 { 403 Log(("VBoxGuest::vb oxguestwinInit: Could not init device extension, rc = %Rrc!\n", vrc));418 Log(("VBoxGuest::vbgdNtInit: Could not init device extension, rc = %Rrc!\n", vrc)); 404 419 rc = STATUS_DEVICE_CONFIGURATION_ERROR; 405 420 } 406 421 } 407 422 else 408 Log(("VBoxGuest::vb oxguestwinInit: Could not map physical address of VMMDev, rc = 0x%x!\n", rc));423 Log(("VBoxGuest::vbgdNtInit: Could not map physical address of VMMDev, rc = 0x%x!\n", rc)); 409 424 } 410 425 … … 415 430 if (RT_FAILURE(vrc)) 416 431 { 417 Log(("VBoxGuest::vb oxguestwinInit: Alloc for pPowerStateRequest failed, rc = %Rrc\n", vrc));432 Log(("VBoxGuest::vbgdNtInit: Alloc for pPowerStateRequest failed, rc = %Rrc\n", vrc)); 418 433 rc = STATUS_UNSUCCESSFUL; 419 434 } … … 425 440 * Register DPC and ISR. 426 441 */ 427 Log(("VBoxGuest::vb oxguestwinInit: Initializing DPC/ISR ...\n"));428 429 IoInitializeDpcRequest(pDevExt->win.s.pDeviceObject, vb oxguestwinDpcHandler);442 Log(("VBoxGuest::vbgdNtInit: Initializing DPC/ISR ...\n")); 443 444 IoInitializeDpcRequest(pDevExt->win.s.pDeviceObject, vbgdNtDpcHandler); 430 445 #ifdef TARGET_NT4 431 446 ULONG uInterruptVector; … … 436 451 || pDevExt->win.s.interruptVector) 437 452 { 438 Log(("VBoxGuest::vb oxguestwinInit: Getting interrupt vector (HAL): Bus: %u, IRQL: %u, Vector: %u\n",453 Log(("VBoxGuest::vbgdNtInit: Getting interrupt vector (HAL): Bus: %u, IRQL: %u, Vector: %u\n", 439 454 pDevExt->win.s.busNumber, pDevExt->win.s.interruptLevel, pDevExt->win.s.interruptVector)); 440 455 … … 445 460 &irqLevel, 446 461 &pDevExt->win.s.interruptAffinity); 447 Log(("VBoxGuest::vb oxguestwinInit: HalGetInterruptVector returns vector %u\n", uInterruptVector));462 Log(("VBoxGuest::vbgdNtInit: HalGetInterruptVector returns vector %u\n", uInterruptVector)); 448 463 if (uInterruptVector == 0) 449 Log(("VBoxGuest::vb oxguestwinInit: No interrupt vector found!\n"));464 Log(("VBoxGuest::vbgdNtInit: No interrupt vector found!\n")); 450 465 } 451 466 else 452 Log(("VBoxGuest::vb oxguestwinInit: Device does not provide an interrupt!\n"));467 Log(("VBoxGuest::vbgdNtInit: Device does not provide an interrupt!\n")); 453 468 #endif 454 469 if (pDevExt->win.s.interruptVector) 455 470 { 456 Log(("VBoxGuest::vb oxguestwinInit: Connecting interrupt ...\n"));457 458 rc = IoConnectInterrupt(&pDevExt->win.s.pInterruptObject, 459 (PKSERVICE_ROUTINE)vb oxguestwinIsrHandler,/* Our ISR handler. */460 pDevExt, 461 NULL, 471 Log(("VBoxGuest::vbgdNtInit: Connecting interrupt ...\n")); 472 473 rc = IoConnectInterrupt(&pDevExt->win.s.pInterruptObject, /* Out: interrupt object. */ 474 (PKSERVICE_ROUTINE)vbgdNtIsrHandler, /* Our ISR handler. */ 475 pDevExt, /* Device context. */ 476 NULL, /* Optional spinlock. */ 462 477 #ifdef TARGET_NT4 463 uInterruptVector, 464 irqLevel, 465 irqLevel, 478 uInterruptVector, /* Interrupt vector. */ 479 irqLevel, /* Interrupt level. */ 480 irqLevel, /* Interrupt level. */ 466 481 #else 467 pDevExt->win.s.interruptVector, 468 (KIRQL)pDevExt->win.s.interruptLevel, 469 (KIRQL)pDevExt->win.s.interruptLevel, 470 #endif 471 pDevExt->win.s.interruptMode, 472 TRUE, 473 pDevExt->win.s.interruptAffinity, 474 FALSE); 482 pDevExt->win.s.interruptVector, /* Interrupt vector. */ 483 (KIRQL)pDevExt->win.s.interruptLevel, /* Interrupt level. */ 484 (KIRQL)pDevExt->win.s.interruptLevel, /* Interrupt level. */ 485 #endif 486 pDevExt->win.s.interruptMode, /* LevelSensitive or Latched. */ 487 TRUE, /* Shareable interrupt. */ 488 pDevExt->win.s.interruptAffinity, /* CPU affinity. */ 489 FALSE); /* Don't save FPU stack. */ 475 490 if (NT_ERROR(rc)) 476 Log(("VBoxGuest::vb oxguestwinInit: Could not connect interrupt, rc = 0x%x\n", rc));491 Log(("VBoxGuest::vbgdNtInit: Could not connect interrupt, rc = 0x%x\n", rc)); 477 492 } 478 493 else 479 Log(("VBoxGuest::vb oxguestwinInit: No interrupt vector found!\n"));494 Log(("VBoxGuest::vbgdNtInit: No interrupt vector found!\n")); 480 495 } 481 496 482 497 483 498 #ifdef VBOX_WITH_HGCM 484 Log(("VBoxGuest::vb oxguestwinInit: Allocating kernel session data ...\n"));499 Log(("VBoxGuest::vbgdNtInit: Allocating kernel session data ...\n")); 485 500 int vrc = VBoxGuestCreateKernelSession(pDevExt, &pDevExt->win.s.pKernelSession); 486 501 if (RT_FAILURE(vrc)) 487 502 { 488 Log(("VBoxGuest::vb oxguestwinInit: Failed to allocated kernel session data! rc = %Rrc\n", rc));503 Log(("VBoxGuest::vbgdNtInit: Failed to allocated kernel session data! rc = %Rrc\n", rc)); 489 504 rc = STATUS_UNSUCCESSFUL; 490 505 } … … 494 509 { 495 510 ULONG ulValue = 0; 496 NTSTATUS s = vboxguestwinRegistryReadDWORD(RTL_REGISTRY_SERVICES, L"VBoxGuest", L"LoggingEnabled", 497 &ulValue); 498 if (NT_SUCCESS(s)) 511 NTSTATUS rcNt = vbgdNtRegistryReadDWORD(RTL_REGISTRY_SERVICES, L"VBoxGuest", L"LoggingEnabled", &ulValue); 512 if (NT_SUCCESS(rcNt)) 499 513 { 500 514 pDevExt->fLoggingEnabled = ulValue >= 0xFF; … … 504 518 505 519 /* Ready to rumble! */ 506 Log(("VBoxGuest::vb oxguestwinInit: Device is ready!\n"));520 Log(("VBoxGuest::vbgdNtInit: Device is ready!\n")); 507 521 VBOXGUEST_UPDATE_DEVSTATE(pDevExt, WORKING); 508 522 } … … 512 526 } 513 527 514 Log(("VBoxGuest::vb oxguestwinInit: Returned with rc = 0x%x\n", rc));528 Log(("VBoxGuest::vbgdNtInit: Returned with rc = 0x%x\n", rc)); 515 529 return rc; 516 530 } … … 523 537 * @param pDrvObj Driver object. 524 538 */ 525 NTSTATUS vb oxguestwinCleanup(PDEVICE_OBJECT pDevObj)526 { 527 Log(("VBoxGuest::vb oxguestwinCleanup\n"));539 NTSTATUS vbgdNtCleanup(PDEVICE_OBJECT pDevObj) 540 { 541 Log(("VBoxGuest::vbgdNtCleanup\n")); 528 542 529 543 PVBOXGUESTDEVEXT pDevExt = (PVBOXGUESTDEVEXT)pDevObj->DeviceExtension; … … 554 568 #endif 555 569 /* According to MSDN we have to unmap previously mapped memory. */ 556 vb oxguestwinUnmapVMMDevMemory(pDevExt);570 vbgdNtUnmapVMMDevMemory(pDevExt); 557 571 } 558 572 return STATUS_SUCCESS; … … 565 579 * @param pDrvObj Driver object. 566 580 */ 567 static void vb oxguestwinUnload(PDRIVER_OBJECT pDrvObj)568 { 569 Log(("VBoxGuest::vb oxguestwinGuestUnload\n"));581 static void vbgdNtUnload(PDRIVER_OBJECT pDrvObj) 582 { 583 Log(("VBoxGuest::vbgdNtGuestUnload\n")); 570 584 #ifdef TARGET_NT4 571 vb oxguestwinCleanup(pDrvObj->DeviceObject);585 vbgdNtCleanup(pDrvObj->DeviceObject); 572 586 573 587 /* Destroy device extension and clean up everything else. */ … … 590 604 #endif 591 605 592 Log(("VBoxGuest::vb oxguestwinGuestUnload: returning\n"));606 Log(("VBoxGuest::vbgdNtGuestUnload: returning\n")); 593 607 } 594 608 … … 600 614 * @param pIrp Request packet. 601 615 */ 602 static NTSTATUS vb oxguestwinCreate(PDEVICE_OBJECT pDevObj, PIRP pIrp)616 static NTSTATUS vbgdNtCreate(PDEVICE_OBJECT pDevObj, PIRP pIrp) 603 617 { 604 618 /** @todo AssertPtrReturn(pIrp); */ … … 611 625 if (pDevExt->win.s.devState != WORKING) 612 626 { 613 Log(("VBoxGuest::vb oxguestwinGuestCreate: device is not working currently: %d!\n",627 Log(("VBoxGuest::vbgdNtGuestCreate: device is not working currently: %d!\n", 614 628 pDevExt->win.s.devState)); 615 629 rc = STATUS_UNSUCCESSFUL; … … 621 635 * (But this is possible.) 622 636 */ 623 Log(("VBoxGuest::vb oxguestwinGuestCreate: Uhm, we're not a directory!\n"));637 Log(("VBoxGuest::vbgdNtGuestCreate: Uhm, we're not a directory!\n")); 624 638 rc = STATUS_NOT_A_DIRECTORY; 625 639 } … … 629 643 if (pFileObj) 630 644 { 631 Log(("VBoxGuest::vb oxguestwinGuestCreate: File object type = %d\n",645 Log(("VBoxGuest::vbgdNtGuestCreate: File object type = %d\n", 632 646 pFileObj->Type)); 633 647 … … 658 672 IoCompleteRequest(pIrp, IO_NO_INCREMENT); 659 673 660 Log(("VBoxGuest::vb oxguestwinGuestCreate: Returning 0x%x\n", rc));674 Log(("VBoxGuest::vbgdNtGuestCreate: Returning 0x%x\n", rc)); 661 675 return rc; 662 676 } … … 669 683 * @param pIrp Request packet. 670 684 */ 671 static NTSTATUS vb oxguestwinClose(PDEVICE_OBJECT pDevObj, PIRP pIrp)685 static NTSTATUS vbgdNtClose(PDEVICE_OBJECT pDevObj, PIRP pIrp) 672 686 { 673 687 PVBOXGUESTDEVEXT pDevExt = (PVBOXGUESTDEVEXT)pDevObj->DeviceExtension; … … 675 689 PFILE_OBJECT pFileObj = pStack->FileObject; 676 690 677 Log(("VBoxGuest::vb oxguestwinGuestClose: pDevExt=0x%p pFileObj=0x%p FsContext=0x%p\n",691 Log(("VBoxGuest::vbgdNtGuestClose: pDevExt=0x%p pFileObj=0x%p FsContext=0x%p\n", 678 692 pDevExt, pFileObj, pFileObj->FsContext)); 679 693 … … 700 714 * @param pIrp Request packet. 701 715 */ 702 static NTSTATUS vb oxguestwinIOCtl(PDEVICE_OBJECT pDevObj, PIRP pIrp)716 static NTSTATUS vbgdNtIOCtl(PDEVICE_OBJECT pDevObj, PIRP pIrp) 703 717 { 704 718 NTSTATUS Status = STATUS_SUCCESS; … … 717 731 pSession = (PVBOXGUESTSESSION)pFileObj->FsContext; 718 732 719 Log(("VBoxGuest::vb oxguestwinIOCtl: uCmd=%u, pDevExt=0x%p, pSession=0x%p\n",733 Log(("VBoxGuest::vbgdNtIOCtl: uCmd=%u, pDevExt=0x%p, pSession=0x%p\n", 720 734 uCmd, pDevExt, pSession)); 721 735 … … 726 740 if (pSession == NULL) 727 741 { 728 Log(("VBoxGuest::vb oxguestwinIOCtl: Using kernel session data ...\n"));742 Log(("VBoxGuest::vbgdNtIOCtl: Using kernel session data ...\n")); 729 743 pSession = pDevExt->win.s.pKernelSession; 730 744 } … … 740 754 case VBOXGUEST_IOCTL_ENABLE_VRDP_SESSION: 741 755 { 742 LogRel(("VBoxGuest::vb oxguestwinIOCtl: ENABLE_VRDP_SESSION: Currently: %sabled\n",756 LogRel(("VBoxGuest::vbgdNtIOCtl: ENABLE_VRDP_SESSION: Currently: %sabled\n", 743 757 pDevExt->fVRDPEnabled? "en": "dis")); 744 758 if (!pDevExt->fVRDPEnabled) … … 747 761 748 762 pDevExt->fVRDPEnabled = true; 749 LogRel(("VBoxGuest::vb oxguestwinIOCtl: ENABLE_VRDP_SESSION: Current active console ID: 0x%08X\n",763 LogRel(("VBoxGuest::vbgdNtIOCtl: ENABLE_VRDP_SESSION: Current active console ID: 0x%08X\n", 750 764 pSharedUserData->ActiveConsoleId)); 751 765 pDevExt->ulOldActiveConsoleId = pSharedUserData->ActiveConsoleId; … … 757 771 case VBOXGUEST_IOCTL_DISABLE_VRDP_SESSION: 758 772 { 759 LogRel(("VBoxGuest::vb oxguestwinIOCtl: DISABLE_VRDP_SESSION: Currently: %sabled\n",773 LogRel(("VBoxGuest::vbgdNtIOCtl: DISABLE_VRDP_SESSION: Currently: %sabled\n", 760 774 pDevExt->fVRDPEnabled? "en": "dis")); 761 775 if (pDevExt->fVRDPEnabled) … … 764 778 765 779 pDevExt->fVRDPEnabled = false; 766 Log(("VBoxGuest::vb oxguestwinIOCtl: DISABLE_VRDP_SESSION: Current active console ID: 0x%08X\n",780 Log(("VBoxGuest::vbgdNtIOCtl: DISABLE_VRDP_SESSION: Current active console ID: 0x%08X\n", 767 781 pSharedUserData->ActiveConsoleId)); 768 782 pSharedUserData->ActiveConsoleId = pDevExt->ulOldActiveConsoleId; … … 783 797 int vrc = VBoxGuestCommonIOCtl(uCmd, pDevExt, pSession, pBuf, cbData, &cbDataReturned); 784 798 785 Log(("VBoxGuest::vb oxguestwinGuestDeviceControl: rc=%Rrc, pBuf=0x%p, cbData=%u, cbDataReturned=%u\n",799 Log(("VBoxGuest::vbgdNtGuestDeviceControl: rc=%Rrc, pBuf=0x%p, cbData=%u, cbDataReturned=%u\n", 786 800 vrc, pBuf, cbData, cbDataReturned)); 787 801 … … 790 804 if (RT_UNLIKELY(cbDataReturned > cbData)) 791 805 { 792 Log(("VBoxGuest::vb oxguestwinGuestDeviceControl: Too much output data %u - expected %u!\n", cbDataReturned, cbData));806 Log(("VBoxGuest::vbgdNtGuestDeviceControl: Too much output data %u - expected %u!\n", cbDataReturned, cbData)); 793 807 cbDataReturned = cbData; 794 808 Status = STATUS_BUFFER_TOO_SMALL; … … 818 832 IoCompleteRequest(pIrp, IO_NO_INCREMENT); 819 833 820 //Log(("VBoxGuest::vb oxguestwinGuestDeviceControl: returned cbOut=%d rc=%#x\n", cbOut, Status));834 //Log(("VBoxGuest::vbgdNtGuestDeviceControl: returned cbOut=%d rc=%#x\n", cbOut, Status)); 821 835 return Status; 822 836 } … … 835 849 * has a way to do this already, see VBOXGUEST_IOCTL_GETVMMDEVPORT. 836 850 */ 837 static NTSTATUS vb oxguestwinInternalIOCtl(PDEVICE_OBJECT pDevObj, PIRP pIrp)851 static NTSTATUS vbgdNtInternalIOCtl(PDEVICE_OBJECT pDevObj, PIRP pIrp) 838 852 { 839 853 NTSTATUS Status = STATUS_SUCCESS; … … 884 898 } 885 899 886 return vb oxguestwinIOCtl(pDevObj, pIrp);900 return vbgdNtIOCtl(pDevObj, pIrp); 887 901 } 888 902 … … 895 909 * @param pIrp IRP. 896 910 */ 897 NTSTATUS vb oxguestwinSystemControl(PDEVICE_OBJECT pDevObj, PIRP pIrp)911 NTSTATUS vbgdNtSystemControl(PDEVICE_OBJECT pDevObj, PIRP pIrp) 898 912 { 899 913 PVBOXGUESTDEVEXT pDevExt = (PVBOXGUESTDEVEXT)pDevObj->DeviceExtension; 900 914 901 Log(("VBoxGuest::vb oxguestwinGuestSystemControl\n"));915 Log(("VBoxGuest::vbgdNtGuestSystemControl\n")); 902 916 903 917 /* Always pass it on to the next driver. */ … … 915 929 * @param pIrp IRP. 916 930 */ 917 NTSTATUS vb oxguestwinShutdown(PDEVICE_OBJECT pDevObj, PIRP pIrp)931 NTSTATUS vbgdNtShutdown(PDEVICE_OBJECT pDevObj, PIRP pIrp) 918 932 { 919 933 PVBOXGUESTDEVEXT pDevExt = (PVBOXGUESTDEVEXT)pDevObj->DeviceExtension; 920 934 921 Log(("VBoxGuest::vb oxguestwinGuestShutdown\n"));935 Log(("VBoxGuest::vbgdNtGuestShutdown\n")); 922 936 923 937 VMMDevPowerStateRequest *pReq = pDevExt->win.s.pPowerStateRequest; … … 930 944 if (RT_FAILURE(rc)) 931 945 { 932 Log(("VBoxGuest::vb oxguestwinGuestShutdown: Error performing request to VMMDev! "946 Log(("VBoxGuest::vbgdNtGuestShutdown: Error performing request to VMMDev! " 933 947 "rc = %Rrc\n", rc)); 934 948 } … … 945 959 * @param pIrp IRP. 946 960 */ 947 NTSTATUS vb oxguestwinNotSupportedStub(PDEVICE_OBJECT pDevObj, PIRP pIrp)948 { 949 Log(("VBoxGuest::vb oxguestwinGuestNotSupportedStub\n"));961 NTSTATUS vbgdNtNotSupportedStub(PDEVICE_OBJECT pDevObj, PIRP pIrp) 962 { 963 Log(("VBoxGuest::vbgdNtGuestNotSupportedStub\n")); 950 964 951 965 pIrp->IoStatus.Information = 0; … … 965 979 * @param pContext Context specific pointer. 966 980 */ 967 void vb oxguestwinDpcHandler(PKDPC pDPC, PDEVICE_OBJECT pDevObj, PIRP pIrp, PVOID pContext)981 void vbgdNtDpcHandler(PKDPC pDPC, PDEVICE_OBJECT pDevObj, PIRP pIrp, PVOID pContext) 968 982 { 969 983 PVBOXGUESTDEVEXT pDevExt = (PVBOXGUESTDEVEXT)pDevObj->DeviceExtension; 970 Log(("VBoxGuest::vb oxguestwinGuestDpcHandler: pDevExt=0x%p\n", pDevExt));984 Log(("VBoxGuest::vbgdNtGuestDpcHandler: pDevExt=0x%p\n", pDevExt)); 971 985 972 986 /* test & reset the counter */ … … 985 999 986 1000 /* Process the wake-up list we were asked by the scheduling a DPC 987 * in vb oxguestwinIsrHandler(). */1001 * in vbgdNtIsrHandler(). */ 988 1002 VBoxGuestWaitDoWakeUps(pDevExt); 989 1003 } … … 997 1011 * @param pServiceContext Context specific pointer. 998 1012 */ 999 BOOLEAN vb oxguestwinIsrHandler(PKINTERRUPT pInterrupt, PVOID pServiceContext)1013 BOOLEAN vbgdNtIsrHandler(PKINTERRUPT pInterrupt, PVOID pServiceContext) 1000 1014 { 1001 1015 PVBOXGUESTDEVEXT pDevExt = (PVBOXGUESTDEVEXT)pServiceContext; … … 1003 1017 return FALSE; 1004 1018 1005 /*Log(("VBoxGuest::vb oxguestwinGuestIsrHandler: pDevExt = 0x%p, pVMMDevMemory = 0x%p\n",1019 /*Log(("VBoxGuest::vbgdNtGuestIsrHandler: pDevExt = 0x%p, pVMMDevMemory = 0x%p\n", 1006 1020 pDevExt, pDevExt ? pDevExt->pVMMDevMemory : NULL));*/ 1007 1021 … … 1013 1027 if (fIRQTaken) 1014 1028 { 1015 Log(("VBoxGuest::vb oxguestwinGuestIsrHandler: IRQ was taken! pInterrupt = 0x%p, pDevExt = 0x%p\n",1029 Log(("VBoxGuest::vbgdNtGuestIsrHandler: IRQ was taken! pInterrupt = 0x%p, pDevExt = 0x%p\n", 1016 1030 pInterrupt, pDevExt)); 1017 1031 if (ASMAtomicUoReadU32(&pDevExt->u32MousePosChangedSeq) || !RTListIsEmpty(&pDevExt->WakeUpList)) 1018 1032 { 1019 Log(("VBoxGuest::vb oxguestwinGuestIsrHandler: Requesting DPC ...\n"));1033 Log(("VBoxGuest::vbgdNtGuestIsrHandler: Requesting DPC ...\n")); 1020 1034 IoRequestDpc(pDevExt->win.s.pDeviceObject, pDevExt->win.s.pCurrentIrp, NULL); 1021 1035 } … … 1050 1064 * registry value if found. 1051 1065 */ 1052 NTSTATUS vboxguestwinRegistryReadDWORD(ULONG ulRoot, PCWSTR pwszPath, PWSTR pwszName, 1053 PULONG puValue) 1066 NTSTATUS vbgdNtRegistryReadDWORD(ULONG ulRoot, PCWSTR pwszPath, PWSTR pwszName, PULONG puValue) 1054 1067 { 1055 1068 if (!pwszPath || !pwszName || !puValue) … … 1082 1095 * @param pDevExt Device extension 1083 1096 */ 1084 NTSTATUS vb oxguestwinScanPCIResourceList(PCM_RESOURCE_LIST pResList, PVBOXGUESTDEVEXT pDevExt)1097 NTSTATUS vbgdNtScanPCIResourceList(PCM_RESOURCE_LIST pResList, PVBOXGUESTDEVEXT pDevExt) 1085 1098 { 1086 1099 /* Enumerate the resource list. */ 1087 Log(("VBoxGuest::vb oxguestwinScanPCIResourceList: Found %d resources\n",1100 Log(("VBoxGuest::vbgdNtScanPCIResourceList: Found %d resources\n", 1088 1101 pResList->List->PartialResourceList.Count)); 1089 1102 … … 1103 1116 if (rangeCount < PCI_TYPE0_ADDRESSES) 1104 1117 { 1105 Log(("VBoxGuest::vb oxguestwinScanPCIResourceList: I/O range: Base = %08x:%08x, Length = %08x\n",1118 Log(("VBoxGuest::vbgdNtScanPCIResourceList: I/O range: Base = %08x:%08x, Length = %08x\n", 1106 1119 pPartialData->u.Port.Start.HighPart, 1107 1120 pPartialData->u.Port.Start.LowPart, … … 1118 1131 pBaseAddress->ResourceMapped = FALSE; 1119 1132 1120 Log(("VBoxGuest::vb oxguestwinScanPCIResourceList: I/O range for VMMDev found! Base = %08x:%08x, Length = %08x\n",1133 Log(("VBoxGuest::vbgdNtScanPCIResourceList: I/O range for VMMDev found! Base = %08x:%08x, Length = %08x\n", 1121 1134 pPartialData->u.Port.Start.HighPart, 1122 1135 pPartialData->u.Port.Start.LowPart, … … 1131 1144 case CmResourceTypeInterrupt: 1132 1145 { 1133 Log(("VBoxGuest::vb oxguestwinScanPCIResourceList: Interrupt: Level = %x, Vector = %x, Mode = %x\n",1146 Log(("VBoxGuest::vbgdNtScanPCIResourceList: Interrupt: Level = %x, Vector = %x, Mode = %x\n", 1134 1147 pPartialData->u.Interrupt.Level, 1135 1148 pPartialData->u.Interrupt.Vector, … … 1158 1171 if (rangeCount < PCI_TYPE0_ADDRESSES) 1159 1172 { 1160 Log(("VBoxGuest::vb oxguestwinScanPCIResourceList: Memory range: Base = %08x:%08x, Length = %08x\n",1173 Log(("VBoxGuest::vbgdNtScanPCIResourceList: Memory range: Base = %08x:%08x, Length = %08x\n", 1161 1174 pPartialData->u.Memory.Start.HighPart, 1162 1175 pPartialData->u.Memory.Start.LowPart, … … 1178 1191 pBaseAddress->ResourceMapped = FALSE; 1179 1192 1180 Log(("VBoxGuest::vb oxguestwinScanPCIResourceList: Memory range for VMMDev found! Base = %08x:%08x, Length = %08x\n",1193 Log(("VBoxGuest::vbgdNtScanPCIResourceList: Memory range for VMMDev found! Base = %08x:%08x, Length = %08x\n", 1181 1194 pPartialData->u.Memory.Start.HighPart, 1182 1195 pPartialData->u.Memory.Start.LowPart, … … 1188 1201 else 1189 1202 { 1190 Log(("VBoxGuest::vb oxguestwinScanPCIResourceList: Ignoring memory: Flags = %08x\n",1203 Log(("VBoxGuest::vbgdNtScanPCIResourceList: Ignoring memory: Flags = %08x\n", 1191 1204 pPartialData->Flags)); 1192 1205 } … … 1197 1210 default: 1198 1211 { 1199 Log(("VBoxGuest::vb oxguestwinScanPCIResourceList: Unhandled resource found, type = %d\n", pPartialData->Type));1212 Log(("VBoxGuest::vbgdNtScanPCIResourceList: Unhandled resource found, type = %d\n", pPartialData->Type)); 1200 1213 break; 1201 1214 } … … 1220 1233 * @param pcbMMIO Length of mapped I/O base. 1221 1234 */ 1222 NTSTATUS vb oxguestwinMapVMMDevMemory(PVBOXGUESTDEVEXT pDevExt, PHYSICAL_ADDRESS physicalAdr, ULONG ulLength,1223 1235 NTSTATUS vbgdNtMapVMMDevMemory(PVBOXGUESTDEVEXT pDevExt, PHYSICAL_ADDRESS physicalAdr, ULONG ulLength, 1236 void **ppvMMIOBase, uint32_t *pcbMMIO) 1224 1237 { 1225 1238 AssertPtrReturn(pDevExt, VERR_INVALID_POINTER); … … 1231 1244 { 1232 1245 VMMDevMemory *pVMMDevMemory = (VMMDevMemory *)MmMapIoSpace(physicalAdr, ulLength, MmNonCached); 1233 Log(("VBoxGuest::vb oxguestwinMapVMMDevMemory: pVMMDevMemory = 0x%x\n", pVMMDevMemory));1246 Log(("VBoxGuest::vbgdNtMapVMMDevMemory: pVMMDevMemory = 0x%x\n", pVMMDevMemory)); 1234 1247 if (pVMMDevMemory) 1235 1248 { 1236 Log(("VBoxGuest::vb oxguestwinMapVMMDevMemory: VMMDevMemory: Version = 0x%x, Size = %d\n",1249 Log(("VBoxGuest::vbgdNtMapVMMDevMemory: VMMDevMemory: Version = 0x%x, Size = %d\n", 1237 1250 pVMMDevMemory->u32Version, pVMMDevMemory->u32Size)); 1238 1251 … … 1240 1253 if (pVMMDevMemory->u32Version != VMMDEV_MEMORY_VERSION) 1241 1254 { 1242 Log(("VBoxGuest::vb oxguestwinMapVMMDevMemory: Wrong version (%u), refusing operation!\n",1255 Log(("VBoxGuest::vbgdNtMapVMMDevMemory: Wrong version (%u), refusing operation!\n", 1243 1256 pVMMDevMemory->u32Version)); 1244 1257 1245 1258 /* Not our version, refuse operation and unmap the memory. */ 1246 vb oxguestwinUnmapVMMDevMemory(pDevExt);1259 vbgdNtUnmapVMMDevMemory(pDevExt); 1247 1260 rc = STATUS_UNSUCCESSFUL; 1248 1261 } … … 1254 1267 *pcbMMIO = pVMMDevMemory->u32Size; 1255 1268 1256 Log(("VBoxGuest::vb oxguestwinMapVMMDevMemory: VMMDevMemory found and mapped! pvMMIOBase = 0x%p\n",1269 Log(("VBoxGuest::vbgdNtMapVMMDevMemory: VMMDevMemory found and mapped! pvMMIOBase = 0x%p\n", 1257 1270 *ppvMMIOBase)); 1258 1271 } … … 1270 1283 * @param pDevExt The device extension. 1271 1284 */ 1272 void vb oxguestwinUnmapVMMDevMemory(PVBOXGUESTDEVEXT pDevExt)1273 { 1274 Log(("VBoxGuest::vb oxguestwinUnmapVMMDevMemory: pVMMDevMemory = 0x%x\n", pDevExt->pVMMDevMemory));1285 void vbgdNtUnmapVMMDevMemory(PVBOXGUESTDEVEXT pDevExt) 1286 { 1287 Log(("VBoxGuest::vbgdNtUnmapVMMDevMemory: pVMMDevMemory = 0x%x\n", pDevExt->pVMMDevMemory)); 1275 1288 if (pDevExt->pVMMDevMemory) 1276 1289 { … … 1284 1297 1285 1298 1286 VBOXOSTYPE vb oxguestwinVersionToOSType(winVersion_t winVer)1299 VBOXOSTYPE vbgdNtVersionToOSType(VBGDNTVER enmNtVer) 1287 1300 { 1288 1301 VBOXOSTYPE enmOsType; 1289 switch ( winVer)1290 { 1291 case WINNT4:1302 switch (enmNtVer) 1303 { 1304 case VBGDNTVER_WINNT4: 1292 1305 enmOsType = VBOXOSTYPE_WinNT4; 1293 1306 break; 1294 1307 1295 case WIN2K:1308 case VBGDNTVER_WIN2K: 1296 1309 enmOsType = VBOXOSTYPE_Win2k; 1297 1310 break; 1298 1311 1299 case WINXP:1312 case VBGDNTVER_WINXP: 1300 1313 #if ARCH_BITS == 64 1301 1314 enmOsType = VBOXOSTYPE_WinXP_x64; … … 1305 1318 break; 1306 1319 1307 case WIN2K3:1320 case VBGDNTVER_WIN2K3: 1308 1321 #if ARCH_BITS == 64 1309 1322 enmOsType = VBOXOSTYPE_Win2k3_x64; … … 1313 1326 break; 1314 1327 1315 case WINVISTA:1328 case VBGDNTVER_WINVISTA: 1316 1329 #if ARCH_BITS == 64 1317 1330 enmOsType = VBOXOSTYPE_WinVista_x64; … … 1321 1334 break; 1322 1335 1323 case WIN7:1336 case VBGDNTVER_WIN7: 1324 1337 #if ARCH_BITS == 64 1325 1338 enmOsType = VBOXOSTYPE_Win7_x64; … … 1329 1342 break; 1330 1343 1331 case WIN8:1344 case VBGDNTVER_WIN8: 1332 1345 #if ARCH_BITS == 64 1333 1346 enmOsType = VBOXOSTYPE_Win8_x64; … … 1372 1385 1373 1386 1374 static void vboxguestwinTestAtomicTestAndClearBitsU32(uint32_t u32Mask, uint32_t u32Bits, 1375 uint32_t u32Exp) 1387 static void vbgdNtTestAtomicTestAndClearBitsU32(uint32_t u32Mask, uint32_t u32Bits, uint32_t u32Exp) 1376 1388 { 1377 1389 ULONG u32Bits2 = u32Bits; … … 1388 1400 1389 1401 1390 static void vb oxguestwinDoTests()1391 { 1392 vb oxguestwinTestAtomicTestAndClearBitsU32(0x00, 0x23, 0);1393 vb oxguestwinTestAtomicTestAndClearBitsU32(0x11, 0, 0);1394 vb oxguestwinTestAtomicTestAndClearBitsU32(0x11, 0x22, 0);1395 vb oxguestwinTestAtomicTestAndClearBitsU32(0x11, 0x23, 0x1);1396 vb oxguestwinTestAtomicTestAndClearBitsU32(0x11, 0x32, 0x10);1397 vb oxguestwinTestAtomicTestAndClearBitsU32(0x22, 0x23, 0x22);1402 static void vbgdNtDoTests(void) 1403 { 1404 vbgdNtTestAtomicTestAndClearBitsU32(0x00, 0x23, 0); 1405 vbgdNtTestAtomicTestAndClearBitsU32(0x11, 0, 0); 1406 vbgdNtTestAtomicTestAndClearBitsU32(0x11, 0x22, 0); 1407 vbgdNtTestAtomicTestAndClearBitsU32(0x11, 0x23, 0x1); 1408 vbgdNtTestAtomicTestAndClearBitsU32(0x11, 0x32, 0x10); 1409 vbgdNtTestAtomicTestAndClearBitsU32(0x22, 0x23, 0x22); 1398 1410 } 1399 1411 -
trunk/src/VBox/Additions/common/VBoxGuest/VBoxGuest-win.h
r44979 r44983 1 /* $Id$ */ 1 2 /** @file 2 *3 3 * VBoxGuest - Windows specifics. 4 * 5 * Copyright (C) 2010-2012 Oracle Corporation 4 */ 5 6 /* 7 * Copyright (C) 2010-2013 Oracle Corporation 6 8 * 7 9 * This file is part of VirtualBox Open Source Edition (OSE), as … … 17 19 #define ___VBoxGuest_win_h 18 20 19 /*******************************************************************************20 * Header Files *21 *******************************************************************************/22 21 23 22 #include <iprt/cdefs.h> … … 40 39 41 40 42 /*******************************************************************************43 * Structures and Typedefs *44 *******************************************************************************/45 46 /** Pointer to the VBoxGuest per session data. */47 typedef struct VBOXGUESTSESSION *PVBOXGUESTSESSION;48 41 49 42 /** Possible device states for our state machine. */ … … 120 113 121 114 /** Pre-allocated kernel session data. This is needed 122 123 PVBOXGUESTSESSIONpKernelSession;115 * for handling kernel IOCtls. */ 116 struct VBOXGUESTSESSION *pKernelSession; 124 117 125 118 /** Spinlock protecting MouseNotifyCallback. Required since the consumer is … … 128 121 } VBOXGUESTDEVEXTWIN, *PVBOXGUESTDEVEXTWIN; 129 122 130 #define VBOXGUEST_UPDATE_DEVSTATE(_pDevExt, _newDevState) do { \ 131 (_pDevExt)->win.s.prevDevState = (_pDevExt)->win.s.devState; \ 132 (_pDevExt)->win.s.devState = (_newDevState); \ 133 } while (0) 123 124 /** NT (windows) version identifier. */ 125 typedef enum VBGDNTVER 126 { 127 VBGDNTVER_INVALID = 0, 128 VBGDNTVER_WINNT4, 129 VBGDNTVER_WIN2K, 130 VBGDNTVER_WINXP, 131 VBGDNTVER_WIN2K3, 132 VBGDNTVER_WINVISTA, 133 VBGDNTVER_WIN7, 134 VBGDNTVER_WIN8 135 } VBGDNTVER; 136 extern VBGDNTVER g_enmVbgdNtVer; 134 137 135 138 136 /******************************************************************************* 137 * Defined Constants And Macros * 138 *******************************************************************************/ 139 #define VBOXGUEST_UPDATE_DEVSTATE(a_pDevExt, a_newDevState) \ 140 do { \ 141 (a_pDevExt)->win.s.prevDevState = (a_pDevExt)->win.s.devState; \ 142 (a_pDevExt)->win.s.devState = (a_newDevState); \ 143 } while (0) 139 144 140 145 /** CM_RESOURCE_MEMORY_* flags which were used on XP or earlier. */ 141 146 #define VBOX_CM_PRE_VISTA_MASK (0x3f) 142 147 143 /** Windows version identifier. */ 144 typedef enum 145 { 146 WINNT4 = 1, 147 WIN2K = 2, 148 WINXP = 3, 149 WIN2K3 = 4, 150 WINVISTA = 5, 151 WIN7 = 6, 152 WIN8 = 7 153 } winVersion_t; 154 extern winVersion_t winVersion; 148 149 /* Include the internal header now as we've declared the internal 150 structure and stuff. */ 151 #include "VBoxGuestInternal.h" 155 152 156 153 157 /******************************************************************************* 158 * Declared prototypes for helper routines used in both (PnP and legacy) * 159 * driver versions. * 160 *******************************************************************************/ 161 #include "VBoxGuestInternal.h" 154 RT_C_DECLS_BEGIN 162 155 163 RT_C_DECLS_BEGIN164 156 #ifdef TARGET_NT4 165 157 NTSTATUS vbgdNt4CreateDevice(PDRIVER_OBJECT pDrvObj, PDEVICE_OBJECT pDevObj, PUNICODE_STRING pRegPath); 166 NTSTATUS vboxguestwinInit(PDRIVER_OBJECT pDrvObj, PDEVICE_OBJECT pDevObj, PUNICODE_STRING pRegPath);167 158 #else 168 NTSTATUS vboxguestwinInit(PDEVICE_OBJECT pDevObj, PIRP pIrp); 159 NTSTATUS vbgdNtInit(PDEVICE_OBJECT pDevObj, PIRP pIrp); 160 NTSTATUS vbgdNtPnP(PDEVICE_OBJECT pDevObj, PIRP pIrp); 161 NTSTATUS vbgdNtPower(PDEVICE_OBJECT pDevObj, PIRP pIrp); 169 162 #endif 170 NTSTATUS vboxguestwinCleanup(PDEVICE_OBJECT pDevObj); 171 NTSTATUS vboxguestwinPnP(PDEVICE_OBJECT pDevObj, PIRP pIrp); 172 VOID vboxguestwinDpcHandler(PKDPC pDPC, PDEVICE_OBJECT pDevObj, PIRP pIrp, PVOID pContext); 173 BOOLEAN vboxguestwinIsrHandler(PKINTERRUPT interrupt, PVOID serviceContext); 174 NTSTATUS vboxguestwinScanPCIResourceList(PCM_RESOURCE_LIST pResList, PVBOXGUESTDEVEXT pDevExt); 175 NTSTATUS vboxguestwinMapVMMDevMemory(PVBOXGUESTDEVEXT pDevExt, PHYSICAL_ADDRESS physicalAdr, ULONG ulLength, 176 void **ppvMMIOBase, uint32_t *pcbMMIO); 177 void vboxguestwinUnmapVMMDevMemory(PVBOXGUESTDEVEXT pDevExt); 178 VBOXOSTYPE vboxguestwinVersionToOSType(winVersion_t winVer); 179 NTSTATUS vboxguestwinPower(PDEVICE_OBJECT pDevObj, PIRP pIrp); 163 164 /** @name Common routines used in both (PnP and legacy) driver versions. 165 * @{ 166 */ 167 #ifdef TARGET_NT4 168 NTSTATUS vbgdNtInit(PDRIVER_OBJECT pDrvObj, PDEVICE_OBJECT pDevObj, PUNICODE_STRING pRegPath); 169 #else 170 NTSTATUS vbgdNtInit(PDEVICE_OBJECT pDevObj, PIRP pIrp); 171 #endif 172 NTSTATUS vbgdNtCleanup(PDEVICE_OBJECT pDevObj); 173 VOID vbgdNtDpcHandler(PKDPC pDPC, PDEVICE_OBJECT pDevObj, PIRP pIrp, PVOID pContext); 174 BOOLEAN vbgdNtIsrHandler(PKINTERRUPT interrupt, PVOID serviceContext); 175 NTSTATUS vbgdNtScanPCIResourceList(PCM_RESOURCE_LIST pResList, PVBOXGUESTDEVEXT pDevExt); 176 NTSTATUS vbgdNtMapVMMDevMemory(PVBOXGUESTDEVEXT pDevExt, PHYSICAL_ADDRESS physicalAdr, ULONG ulLength, 177 void **ppvMMIOBase, uint32_t *pcbMMIO); 178 void vbgdNtUnmapVMMDevMemory(PVBOXGUESTDEVEXT pDevExt); 179 VBOXOSTYPE vbgdNtVersionToOSType(VBGDNTVER enmNtVer); 180 /** @} */ 181 180 182 RT_C_DECLS_END 181 183 … … 185 187 * on NT4, so... The same for ExAllocatePool. 186 188 */ 187 # undef ExAllocatePool188 # undef ExFreePool189 # undef ExAllocatePool 190 # undef ExFreePool 189 191 #endif 190 192 191 #endif /* ___VBoxGuest_win_h */193 #endif /* !___VBoxGuest_win_h */ 192 194 195 -
trunk/src/VBox/Additions/common/VBoxGuest/VBoxGuestInternal.h
r41722 r44983 182 182 VBoxGuestMouseSetNotifyCallback MouseNotifyCallback; 183 183 184 /** Windows part. */ 184 /** Windows part. 185 * @todo r=bird: Entirely wrong approach. You should create 186 * VBOXGUESTDEVEXTWIN as a super structure to VBOXGUESTDEVEXT. If they 187 * were classes, class VBOXGUESTDEVEXTWIN : public VBOXGUESTDEVEXT ... */ 185 188 union 186 189 {
Note:
See TracChangeset
for help on using the changeset viewer.