handling IRP_MJ_SHUTDOWN in FilterDriver

Hi all,
we have an issue related to the IRP_MJ_SHUTDOWN.
when we shutdown the system whil the driver is still alive, the system is getting restarted instead of shutting down( poweroff).

could anyone suggest something on how to handle the IRP_MJ_SHUTDOWN in filterdriver.

regards,
venu

Here in our code there are two global variables we have initialized with ExAllocatePoolWithTag.
we have experimented by changing the shutdown routine and observed that, in the shutdown routine, if we donot free the pool that we allocated with the tag, the system is shutting down(poweroff) properly. if we free the memory allocated with tag, then the system is getting restarted.

those global variables are allocated in the driverentry. we read from the documentation that we need to free the variables allocated with ExAllocatePoolWithTag.

can anyone throw some light on this.