Jump to content

power options (standby and hibernation) without restart possible?


Recommended Posts

Hello developers,
in Windows 2000 we have the situation, that if there is a non-plug-and-play-capable driver active, then the shutdown options "standby" and "hibernation" are not available. For example the driver vga.sys of Windows 2000 prevents the system from going into standby mode.

When vga.sys is replaced with a plug-and-play-capable driver by installing one and then restarting, then the power options are available.

My graphics driver is capable of performing mode switching and turning off the display after a certain time of inactivity directly after the installation. But the additional power options are only available after the user has restarted the computer.

videoprt.sys and my driver do not receive any IRP_MJ_POWER queries until the system has been restarted.

When I try to enter the standby mode manually by calling ntdll.dll/NtSetSystemPowerState before the reboot I get a STATUS_CANCELLED and a STATUS_SUCCESS after the reboot.

I am out of ideas about what the operating system is waiting for and why it needs the restart.

Does anyone have an idea what the problem could be?

Many thanks.

Edited by Start Me Up
Link to comment
Share on other sites


I do not have an external graphics card to test your theory. The integrated graphics circuits I have can't be removed from the system, because they are a subcircuit of the chipset or the processor.

If the vga.sys driver is still blocking the system from going into sleep because it's still running in the background, is it still possible somehow to remove the blockade?

Edit: I think what I need to do, is basicly to find a save and clean way to unload vga.sys and make sure it gets loaded again if my driver gets unloaded.

Well, thank you @jumper. I think you gave me the crucial information I was missing.

Edited by Start Me Up
Link to comment
Share on other sites

Slipstream the driver into the OS install.

Sleep requests can be blocked by any driver, program, or process. It might be possible to kill vga.sys programmatically once the new driver takes control.

 

Link to comment
Share on other sites

I tried to make my own driver unloadable first, because this should be easier than unloading vga.sys.

When the user tries to remove the graphics circuit from the device manager, then my driver receives the following IRPs:

DispatchPnP gets called with:
	IRP_MJ_PNP
	IRP_MN_QUERY_DEVICE_RELATIONS
	RemovalRelations
DispatchPnP does:
	create a list with 1 entry (the DeviceObject it received)
	call IofCompleteRequest
DispatchPnP returns:
	STATUS_SUCCESS

DispatchPnP gets called with:
	IRP_MJ_PNP
	IRP_MN_QUERY_REMOVE_DEVICE
DispatchPnP does:
	IRP.IoStatus.Status = STATUS_SUCCESS
	call IofCompleteRequest
DispatchPnP returns:
	STATUS_SUCCESS

DispatchPnP gets called with:
	IRP_MJ_PNP
	IRP_MN_REMOVE_DEVICE
DispatchPnP does:
	call DispatchPnP of videoprt.sys
DispatchPnP returns:
	STATUS_SUCCESS

DispatchPnP gets called with:
	IRP_MJ_PNP
	IRP_MN_QUERY_DEVICE_RELATIONS
	RemovalRelations
DispatchPnP does:
	create a list with 1 entry (the DeviceObject it received)
	call IofCompleteRequest
DispatchPnP returns:
	STATUS_SUCCESS

DispatchPnP gets called with:
	IRP_MJ_PNP
	IRP_MN_QUERY_REMOVE_DEVICE
DispatchPnP does:
	IRP.IoStatus.Status = STATUS_SUCCESS
	call IofCompleteRequest
DispatchPnP returns:
	STATUS_SUCCESS

DispatchPnP gets called with:
	IRP_MJ_PNP
	IRP_MN_CANCEL_REMOVE_DEVICE
DispatchPnP does:
	call DispatchPnP of videoprt.sys
DispatchPnP returns:
	STATUS_INVALID_DEVICE_STATE

Afterwards the display is removed from the device manager but the graphics circuit is still there. Also, the device manager asks for a restart to complete the removal.

So I think for the display the process is:

QUERY_DEVICE_RELATIONS -> QUERY_REMOVE_DEVICE -> REMOVE_DEVICE

And for the graphics circuit the process is:

QUERY_DEVICE_RELATIONS -> QUERY_REMOVE_DEVICE -> CANCEL_REMOVE_DEVICE

For some unknown reason Windows decides not to continue with the graphics circuit removal process.

Edited by Start Me Up
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...