Changeset 13495 in vbox
- Timestamp:
- Oct 22, 2008 2:51:14 PM (16 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/HostDrivers/Support/win/SUPDrv-win.cpp
r12161 r13495 78 78 static int VBoxDrvNtDeviceControlSlow(PSUPDRVDEVEXT pDevExt, PSUPDRVSESSION pSession, PIRP pIrp, PIO_STACK_LOCATION pStack); 79 79 static NTSTATUS _stdcall VBoxDrvNtInternalDeviceControl(PDEVICE_OBJECT pDevObj, PIRP pIrp); 80 static VOID _stdcall VBoxPowerDispatchCallback(PVOID pCallbackContext, PVOID pArgument1, PVOID pArgument2); 80 81 static NTSTATUS _stdcall VBoxDrvNtNotSupportedStub(PDEVICE_OBJECT pDevObj, PIRP pIrp); 81 82 static NTSTATUS VBoxDrvNtErr2NtStatus(int rc); … … 142 143 pDrvObj->MajorFunction[IRP_MJ_READ] = VBoxDrvNtNotSupportedStub; 143 144 pDrvObj->MajorFunction[IRP_MJ_WRITE] = VBoxDrvNtNotSupportedStub; 145 144 146 /* more? */ 147 148 /* Register ourselves for power state changes. */ 149 UNICODE_STRING CallbackName; 150 OBJECT_ATTRIBUTES Attr; 151 152 RtlInitUnicodeString(&CallbackName, L"\\Callback\\PowerState"); 153 InitializeObjectAttributes(&Attr, &CallbackName, OBJ_CASE_INSENSITIVE, NULL, NULL); 154 155 rc = ExCreateCallback(&pDevExt->pObjPowerCallback, &Attr, TRUE, TRUE); 156 if (rc == STATUS_SUCCESS) 157 pDevExt->hPowerCallback = ExRegisterCallback(pDevExt->pObjPowerCallback, VBoxPowerDispatchCallback, pDevObj); 158 145 159 dprintf(("VBoxDrv::DriverEntry returning STATUS_SUCCESS\n")); 146 160 return STATUS_SUCCESS; … … 184 198 185 199 dprintf(("VBoxDrvNtUnload at irql %d\n", KeGetCurrentIrql())); 200 201 /* Clean up the power callback registration. */ 202 if (pDevExt->hPowerCallback) 203 ExUnregisterCallback(pDevExt->hPowerCallback); 204 if (pDevExt->pObjPowerCallback) 205 ObDereferenceObject(pDevExt->pObjPowerCallback); 186 206 187 207 /* … … 500 520 501 521 /** 522 * ExRegisterCallback handler for power events 523 * 524 * @param pCallbackContext User supplied parameter (pDevObj) 525 * @param pArgument1 First argument 526 * @param pArgument2 Second argument 527 */ 528 VOID _stdcall VBoxPowerDispatchCallback(PVOID pCallbackContext, PVOID pArgument1, PVOID pArgument2) 529 { 530 PDEVICE_OBJECT pDevObj = (PDEVICE_OBJECT)pCallbackContext; 531 532 dprintf(("VBoxPowerDispatchCallback: %x %x\n", pArgument1, pArgument2)); 533 534 /* Power change imminent? */ 535 if ((unsigned)pArgument1 == PO_CB_SYSTEM_STATE_LOCK) 536 { 537 if ((unsigned)pArgument2 == 0) 538 dprintf(("VBoxPowerDispatchCallback: about to go into suspend mode!\n")); 539 else 540 dprintf(("VBoxPowerDispatchCallback: resumed!\n")); 541 } 542 } 543 544 545 /** 502 546 * Initializes any OS specific object creator fields. 503 547 */
Note:
See TracChangeset
for help on using the changeset viewer.