Changeset 44986 in vbox
- Timestamp:
- Mar 11, 2013 1:49:43 PM (12 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Additions/common/VBoxGuest/VBoxGuest-win-pnp.cpp
r44985 r44986 69 69 static NTSTATUS vbgdNtSendIrpSynchronously(PDEVICE_OBJECT pDevObj, PIRP pIrp, BOOLEAN fStrict) 70 70 { 71 KEVENT event;72 73 KeInitializeEvent(& event, SynchronizationEvent, FALSE);71 KEVENT Event; 72 73 KeInitializeEvent(&Event, SynchronizationEvent, FALSE); 74 74 75 75 IoCopyCurrentIrpStackLocationToNext(pIrp); 76 76 IoSetCompletionRoutine(pIrp, (PIO_COMPLETION_ROUTINE)vbgdNtPnpIrpComplete, 77 & event, TRUE, TRUE, TRUE);77 &Event, TRUE, TRUE, TRUE); 78 78 79 79 NTSTATUS rc = IoCallDriver(pDevObj, pIrp); … … 81 81 if (rc == STATUS_PENDING) 82 82 { 83 KeWaitForSingleObject(& event, Executive, KernelMode, FALSE, NULL);83 KeWaitForSingleObject(&Event, Executive, KernelMode, FALSE, NULL); 84 84 rc = pIrp->IoStatus.Status; 85 85 } … … 108 108 109 109 #ifdef LOG_ENABLED 110 static char * aszFnctName[] =110 static char *s_apszFnctName[] = 111 111 { 112 112 "IRP_MN_START_DEVICE", … … 124 124 "IRP_MN_QUERY_DEVICE_TEXT", 125 125 "IRP_MN_FILTER_RESOURCE_REQUIREMENTS", 126 " ",126 "IRP_MN_0xE", 127 127 "IRP_MN_READ_CONFIG", 128 128 "IRP_MN_WRITE_CONFIG", … … 136 136 }; 137 137 Log(("VBoxGuest::vbgdNtGuestPnp: MinorFunction: %s\n", 138 pStack->MinorFunction < (sizeof(aszFnctName) / sizeof(aszFnctName[0])) 139 ? aszFnctName[pStack->MinorFunction] 140 : "Unknown")); 138 pStack->MinorFunction < RT_ELEMENTS(s_apszFnctName)) ? s_apszFnctName[pStack->MinorFunction] : "Unknown")); 141 139 #endif 142 140 … … 225 223 Log(("VBoxGuest::vbgdNtGuestPnp: QUERY_REMOVE_DEVICE: Device cannot be removed without a reboot.\n")); 226 224 rc = STATUS_UNSUCCESSFUL; 227 #endif /* VBOX_REBOOT_ON_UNINSTALL */225 #endif 228 226 229 227 if (NT_SUCCESS(rc)) … … 320 318 Log(("VBoxGuest::vbgdNtGuestPnp: QUERY_STOP_DEVICE: Device cannot be stopped without a reboot!\n")); 321 319 pIrp->IoStatus.Status = STATUS_UNSUCCESSFUL; 322 #endif /* VBOX_REBOOT_ON_UNINSTALL */320 #endif 323 321 324 322 if (NT_SUCCESS(rc)) … … 436 434 NTSTATUS vbgdNtPower(PDEVICE_OBJECT pDevObj, PIRP pIrp) 437 435 { 438 PIO_STACK_LOCATION pStack = IoGetCurrentIrpStackLocation(pIrp);439 PVBOXGUESTDEVEXT pDevExt = (PVBOXGUESTDEVEXT)pDevObj->DeviceExtension;440 POWER_STATE_TYPE powerType;441 POWER_STATE powerState;442 POWER_ACTION powerAction;436 PIO_STACK_LOCATION pStack = IoGetCurrentIrpStackLocation(pIrp); 437 PVBOXGUESTDEVEXT pDevExt = (PVBOXGUESTDEVEXT)pDevObj->DeviceExtension; 438 POWER_STATE_TYPE enmPowerType = pStack->Parameters.Power.Type; 439 POWER_STATE PowerState = pStack->Parameters.Power.State; 440 POWER_ACTION enmPowerAction = pStack->Parameters.Power.ShutdownType; 443 441 444 442 Log(("VBoxGuest::vbgdNtGuestPower\n")); 445 446 powerType = pStack->Parameters.Power.Type;447 powerAction = pStack->Parameters.Power.ShutdownType;448 powerState = pStack->Parameters.Power.State;449 443 450 444 switch (pStack->MinorFunction) … … 452 446 case IRP_MN_SET_POWER: 453 447 { 454 Log(("VBoxGuest::vbgdNtGuestPower: IRP_MN_SET_POWER, type= %d\n", powerType));455 switch ( powerType)448 Log(("VBoxGuest::vbgdNtGuestPower: IRP_MN_SET_POWER, type= %d\n", enmPowerType)); 449 switch (enmPowerType) 456 450 { 457 451 case SystemPowerState: 458 452 { 459 Log(("VBoxGuest::vbgdNtGuestPower: SystemPowerState, action = %d, state = %d\n", powerAction, powerState)); 460 461 switch (powerAction) 453 Log(("VBoxGuest::vbgdNtGuestPower: SystemPowerState, action = %d, state = %d/%d\n", 454 enmPowerAction, PowerState.SystemState, PowerState.DeviceState)); 455 456 switch (enmPowerAction) 462 457 { 463 458 case PowerActionSleep: 464 459 465 460 /* System now is in a working state. */ 466 if ( powerState.SystemState == PowerSystemWorking)461 if (PowerState.SystemState == PowerSystemWorking) 467 462 { 468 463 if ( pDevExt … … 484 479 /* Tell the VMM that we no longer support mouse pointer integration. */ 485 480 VMMDevReqMouseStatus *pReq = NULL; 486 int vrc = VbglGRAlloc((VMMDevRequestHeader **)&pReq, sizeof (VMMDevReqMouseStatus), VMMDevReq_SetMouseStatus); 481 int vrc = VbglGRAlloc((VMMDevRequestHeader **)&pReq, sizeof (VMMDevReqMouseStatus), 482 VMMDevReq_SetMouseStatus); 487 483 if (RT_SUCCESS(vrc)) 488 484 { … … 510 506 { 511 507 Log(("VBoxGuest::vbgdNtGuestPower: Power action shutdown!\n")); 512 if ( powerState.SystemState >= PowerSystemShutdown)508 if (PowerState.SystemState >= PowerSystemShutdown) 513 509 { 514 510 Log(("VBoxGuest::vbgdNtGuestPower: Telling the VMMDev to close the VM ...\n")); … … 524 520 } 525 521 if (RT_FAILURE(vrc)) 526 { 527 Log(("VBoxGuest::PowerStateRequest: Error communicating new power status to VMMDev. " 528 "vrc = %Rrc\n", vrc)); 529 } 522 Log(("VBoxGuest::PowerStateRequest: Error communicating new power status to VMMDev. vrc = %Rrc\n", vrc)); 530 523 531 524 /* No need to do cleanup here; at this point we should've been … … 546 539 */ 547 540 if (pDevExt) 548 pDevExt->win.s.LastSystemPowerAction = powerAction;541 pDevExt->win.s.LastSystemPowerAction = enmPowerAction; 549 542 550 543 break; … … 560 553 561 554 /* 562 * 563 * 555 * Whether we are completing or relaying this power IRP, 556 * we must call PoStartNextPowerIrp. 564 557 */ 565 558 PoStartNextPowerIrp(pIrp); 566 559 567 560 /* 568 * Send the IRP down the driver stack,569 * using PoCallDriver(not IoCallDriver, as for non-power irps).561 * Send the IRP down the driver stack, using PoCallDriver 562 * (not IoCallDriver, as for non-power irps). 570 563 */ 571 564 IoCopyCurrentIrpStackLocationToNext(pIrp); … … 578 571 return PoCallDriver(pDevExt->win.s.pNextLowerDriver, pIrp); 579 572 } 573
Note:
See TracChangeset
for help on using the changeset viewer.