MajorFunction IRP_MJ_POWER does not get called

  • Thread starter Thread starter Thomas Johansen
  • Start date Start date
T

Thomas Johansen

Hi

I do have a MajorFunction[IRP_MJ_POWER] function in my driver. But it seems
not to get called when i restarting the system. (Start->shutdown->restart)
Schouldn't the function when the restart is issued. ?
I have tried to do a systemlog entry, when the functions gets called, but
the log entry never show up.

From my DriverEntry:

DriverObject->MajorFunction[IRP_MJ_CREATE] = DrvOpen;
DriverObject->MajorFunction[IRP_MJ_CLOSE] = DrvClose;
DriverObject->MajorFunction[IRP_MJ_DEVICE_CONTROL] = DrvDeviceControl;
DriverObject->MajorFunction[IRP_MJ_CLEANUP] = DrvCleanup;
DriverObject->MajorFunction[IRP_MJ_POWER] = DrvPower;

All the other major functions gets called..

From the DrvPower function:

NTSTATUS UPSPower(IN PDEVICE_OBJECT DeviceObject, IN PIRP Irp)
{
POWER_STATE_TYPE powerType;
POWER_STATE powerState;
PIO_STACK_LOCATION pIrpStack;
NTSTATUS status;

// Get the Itp
pIrpStack = IoGetCurrentIrpStackLocation(Irp);

// Get the power type and state
powerType = pIrpStack->Parameters.Power.Type;
powerState = pIrpStack->Parameters.Power.State;

// Write to log. Just for test
DrvErrorLog(ERRLOG_DEVICE_POWER, DeviceObject, L"DrvPower function
called"); // This never get in system log.

............
...........

}

The DrvErrorLog does work and verified
So is the system log closed, before the IRP_MJ_POWER function is called ?
Does it never gets called with windows restart ?
I just whant my driver to know if windows are shutting down og restarting..

Thomas
 
Back
Top