Re: Shut down be prevented in Windows 2000?

  1. I don’t believe that ‘PoRegisterSystemState’ should have any affect on an explicit shut down request, on any version of the os
    (that supports PM, at least).

  2. Is your power button on the W2K machine mapped to something other than ‘shutdown?’ I don’t have any idea of how to check this,
    or whether it even makes sense, but my guess would be that your W2K machine has the power button mapped to something like ‘standby.’
    Perhaps there is something in ‘control panel’ that lets you specify this?

If that doesn’t help:

  1. Are the XP machine and the 2000 machine the same?

  2. Are you sure that the 2000 machine is actually using ACPI, and in particular an ACPI hal?

If that doesn’t help:

  1. Wait for Jake

Good luck,

mm

xxxxx@yahoo.com.cn wrote:

Hi,All

I have a PCI video capture card.And I found a issue when it works in Windows 2000.
When the card works,I press the power button to shut down the machine,but the system pop-up a warning “device driver is preventing the machine to go to the sleep mode…”,just like I clicked “sleep” from the “start” menu,and the system still works.

But when the card works in Windows XP,I press the power button to shut down the machine,it can realized.
A strange thing is:in Windows 2000,when I cliked “shut down” from the “start” menu,it also can realized.

[Summarize]
It can not realize shut down the maching by press the power button when our card works in Windows 2000 even if I delete the function PoRegisterSystemState() in IRP_MJ_CREATE Routine.

Is the issue relevant to the ACPI in Windows 2000?
How can I realize shut down the maching by press the power button when our card works in Windows 2000?

Any help is appreciated.Thanks.

Best Regards
Zhou ChengJun

Is this a KS miniport driver or a full WDM driver? If it is a WDM driver, did you implement the IRP_MJ_POWER dispatch routine? You can easily get the message “device Xxx prevented the machine from going into a low power state” by failing any and all the query power irps sent to your device (which what happens when you do not implement this IRP major code)

d

-----Original Message-----
From: xxxxx@lists.osr.com [mailto:xxxxx@lists.osr.com] On Behalf Of Martin O’Brien
Sent: Tuesday, August 12, 2008 11:33 AM
To: Windows System Software Devs Interest List
Subject: Re:[ntdev] Shut down be prevented in Windows 2000?

  1. I don’t believe that ‘PoRegisterSystemState’ should have any affect on an explicit shut down request, on any version of the os
    (that supports PM, at least).

  2. Is your power button on the W2K machine mapped to something other than ‘shutdown?’ I don’t have any idea of how to check this,
    or whether it even makes sense, but my guess would be that your W2K machine has the power button mapped to something like ‘standby.’
    Perhaps there is something in ‘control panel’ that lets you specify this?

If that doesn’t help:

  1. Are the XP machine and the 2000 machine the same?

  2. Are you sure that the 2000 machine is actually using ACPI, and in particular an ACPI hal?

If that doesn’t help:

  1. Wait for Jake

Good luck,

mm

xxxxx@yahoo.com.cn wrote:

Hi,All

I have a PCI video capture card.And I found a issue when it works in Windows 2000.
When the card works,I press the power button to shut down the machine,but the system pop-up a warning “device driver is preventing the machine to go to the sleep mode…”,just like I clicked “sleep” from the “start” menu,and the system still works.

But when the card works in Windows XP,I press the power button to shut down the machine,it can realized.
A strange thing is:in Windows 2000,when I cliked “shut down” from the “start” menu,it also can realized.

[Summarize]
It can not realize shut down the maching by press the power button when our card works in Windows 2000 even if I delete the function PoRegisterSystemState() in IRP_MJ_CREATE Routine.

Is the issue relevant to the ACPI in Windows 2000?
How can I realize shut down the maching by press the power button when our card works in Windows 2000?

Any help is appreciated.Thanks.

Best Regards
Zhou ChengJun


NTDEV is sponsored by OSR

For our schedule of WDF, WDM, debugging and other seminars visit:
http://www.osr.com/seminars

To unsubscribe, visit the List Server section of OSR Online at http://www.osronline.com/page.cfm?name=ListServer

Thank you all for your enthusiastic replies.

1 The result is the same even if I didn’t use ‘PoRegisterSystemState’.
2 I checked in ‘control panel’ that the power button on the W2K mapped to ‘shut down’.
3 Yes, the two OS are in same machine.
And I test other machine that have both win2000 and xp OS,the same result.
4 I check ACPI in BIOS,ACPI fuction is Enabled.
And I see “ACPI Multiprocessor PC” in ‘control panel->device manager->computer’.

Best Regards
Zhou ChengJun


MM
xxxxx@evitechnology.com Join Date: 28 May 2005
Posts To This List: 1216

Re: Shut down be prevented in Windows 2000?


  1. I don’t believe that ‘PoRegisterSystemState’ should have any affect on an
    explicit shut down request, on any version of the os
    (that supports PM, at least).

  2. Is your power button on the W2K machine mapped to something other than
    ‘shutdown?’ I don’t have any idea of how to check this,
    or whether it even makes sense, but my guess would be that your W2K machine has
    the power button mapped to something like ‘standby.’
    Perhaps there is something in ‘control panel’ that lets you specify this?

If that doesn’t help:

  1. Are the XP machine and the 2000 machine the same?

  2. Are you sure that the 2000 machine is actually using ACPI, and in particular
    an ACPI hal?

If that doesn’t help:

  1. Wait for Jake

It is a WDM PCI driver.I used DriverStudio to develop the driver,used the routine
that the framework generated:
//Default handler for IRP_MJ_POWER.
NTSTATUS KPnpDevice::DefaultPower(KIrp I)
{
I.IndicatePowerIrpProcessed();
I.CopyParametersDown();
NTSTATUS status = m_Lower.PnpPowerCall(this, I);
return status;
}

Best Regards
Zhou ChengJun


12 Aug 08 15:38
Doron Holan
xxxxx@microsoft.com Join Date: 08 Sep 2005
Posts To This List: 2795

RE: Re:Shut down be prevented in Windows 2000?

Is this a KS miniport driver or a full WDM driver? If it is a WDM driver, did
you implement the IRP_MJ_POWER dispatch routine? You can easily get the message
“device Xxx prevented the machine from going into a low power state” by failing
any and all the query power irps sent to your device (which what happens when
you do not implement this IRP major code)

d

> It is a WDM PCI driver.I used DriverStudio

This framework is full of bugs and so I don’t think anyone is surprised that
the driver developed using it is buggy.

Switch to KMDF.


Maxim Shatskih, Windows DDK MVP
StorageCraft Corporation
xxxxx@storagecraft.com
http://www.storagecraft.com

DriverWorks? You’re on your own here, because that product was a mess when it existed, and is now not even supported.

If you can, you might want to switch to KMDF.

Good luck,

mm

xxxxx@yahoo.com.cn wrote:

It is a WDM PCI driver.I used DriverStudio to develop the driver,used the routine
that the framework generated:
//Default handler for IRP_MJ_POWER.
NTSTATUS KPnpDevice::DefaultPower(KIrp I)
{
I.IndicatePowerIrpProcessed();
I.CopyParametersDown();
NTSTATUS status = m_Lower.PnpPowerCall(this, I);
return status;
}

Best Regards
Zhou ChengJun


12 Aug 08 15:38
Doron Holan
xxxxx@microsoft.com Join Date: 08 Sep 2005
Posts To This List: 2795

RE: Re:Shut down be prevented in Windows 2000?

Is this a KS miniport driver or a full WDM driver? If it is a WDM driver, did
you implement the IRP_MJ_POWER dispatch routine? You can easily get the message
“device Xxx prevented the machine from going into a low power state” by failing
any and all the query power irps sent to your device (which what happens when
you do not implement this IRP major code)

d

Which looks like it keeps the current NTSTATUS in the power irp. The irp is initialized to STATUS_NOT_SUPPORTED, so I think you need to special case IRP_MN_QUERY_POWER and set the status to STATUS_SUCCESS before sending it down the stack

d

-----Original Message-----
From: xxxxx@lists.osr.com [mailto:xxxxx@lists.osr.com] On Behalf Of xxxxx@yahoo.com.cn
Sent: Thursday, August 14, 2008 1:46 AM
To: Windows System Software Devs Interest List
Subject: RE:[ntdev] Re: Shut down be prevented in Windows 2000?

It is a WDM PCI driver.I used DriverStudio to develop the driver,used the routine
that the framework generated:
//Default handler for IRP_MJ_POWER.
NTSTATUS KPnpDevice::DefaultPower(KIrp I)
{
I.IndicatePowerIrpProcessed();
I.CopyParametersDown();
NTSTATUS status = m_Lower.PnpPowerCall(this, I);
return status;
}

Best Regards
Zhou ChengJun


12 Aug 08 15:38
Doron Holan
xxxxx@microsoft.com Join Date: 08 Sep 2005
Posts To This List: 2795

RE: Re:Shut down be prevented in Windows 2000?

Is this a KS miniport driver or a full WDM driver? If it is a WDM driver, did
you implement the IRP_MJ_POWER dispatch routine? You can easily get the message
“device Xxx prevented the machine from going into a low power state” by failing
any and all the query power irps sent to your device (which what happens when
you do not implement this IRP major code)

d


NTDEV is sponsored by OSR

For our schedule of WDF, WDM, debugging and other seminars visit:
http://www.osr.com/seminars

To unsubscribe, visit the List Server section of OSR Online at http://www.osronline.com/page.cfm?name=ListServer

I have used the KMDF driver,the result is the same.
The key point is that it have different performance between Win2000 and xp.
It can not realize shut down the maching by press the power button when our
card works in Windows 2000,but in XP it can realize.
Is the issue relevant to the ACPI in Windows 2000?

Relevant IRP_MJ_POWER dispatch routine:


UCHAR minorFunction = {IRP_MN_QUERY_POWER};

status = WdfDeviceInitAssignWdmIrpPreprocessCallback(
DeviceInit,
QueryPowerCallback,
IRP_MJ_POWER,
minorFunction,
sizeof(minorFunction)/sizeof(minorFunction[0])
);


NTSTATUS QueryPowerCallback (IN WDFDEVICE Device,IN PIRP Irp)
{
NTSTATUS status = STATUS_SUCCESS;
Irp->IoStatus.Status = STATUS_SUCCESS;
PoStartNextPowerIrp (Irp);
IoCompleteRequest (Irp, IO_NO_INCREMENT);
return status;
}

If this is a KMDF driver, there is absolutely *no need* to register a preprocess routine like you did to succeed the query power irp, KMDF will always succeed the query power irp.

Does the machine shut down normally if
a) your card is not present
or
b) your card is present, but your driver is not loaded

?

d

-----Original Message-----
From: xxxxx@lists.osr.com [mailto:xxxxx@lists.osr.com] On Behalf Of xxxxx@yahoo.com.cn
Sent: Thursday, August 14, 2008 10:49 PM
To: Windows System Software Devs Interest List
Subject: RE:[ntdev] Re: Shut down be prevented in Windows 2000?

I have used the KMDF driver,the result is the same.
The key point is that it have different performance between Win2000 and xp.
It can not realize shut down the maching by press the power button when our
card works in Windows 2000,but in XP it can realize.
Is the issue relevant to the ACPI in Windows 2000?

Relevant IRP_MJ_POWER dispatch routine:


UCHAR minorFunction = {IRP_MN_QUERY_POWER};

status = WdfDeviceInitAssignWdmIrpPreprocessCallback(
DeviceInit,
QueryPowerCallback,
IRP_MJ_POWER,
minorFunction,
sizeof(minorFunction)/sizeof(minorFunction[0])
);


NTSTATUS QueryPowerCallback (IN WDFDEVICE Device,IN PIRP Irp)
{
NTSTATUS status = STATUS_SUCCESS;
Irp->IoStatus.Status = STATUS_SUCCESS;
PoStartNextPowerIrp (Irp);
IoCompleteRequest (Irp, IO_NO_INCREMENT);
return status;
}


NTDEV is sponsored by OSR

For our schedule of WDF, WDM, debugging and other seminars visit:
http://www.osr.com/seminars

To unsubscribe, visit the List Server section of OSR Online at http://www.osronline.com/page.cfm?name=ListServer

I test KMDF driver on Win2000 again and found that it can realize:
shut down the maching by press the power button when our card works.
[may be I previous test have wrong].
Still,I have doubt that why WDM driver have different performance between Win2000 and xp.
[may be the bugs of Driverworks ,may be the faultiness of the ACPI in Windows 2000,just my guess]

Anyway,thank you all.

The situation that WDM driver is b).
When I installed driver and run app,then can not shut down the maching by press the power button when our card works.If I don’t run app,it can realized.
Anyway, the KMDF driver can realize this.

Does the machine shut down normally if
a) your card is not present
or
b) your card is present, but your driver is not loaded
?

I strongly doubt it is an acpi problem, rather I think it is a problem in your driver that perhaps XP has a workaround for.

d

-----Original Message-----
From: xxxxx@lists.osr.com [mailto:xxxxx@lists.osr.com] On Behalf Of xxxxx@yahoo.com.cn
Sent: Friday, August 15, 2008 4:04 AM
To: Windows System Software Devs Interest List
Subject: RE:[ntdev] Re: Shut down be prevented in Windows 2000?

I test KMDF driver on Win2000 again and found that it can realize:
shut down the maching by press the power button when our card works.
[may be I previous test have wrong].
Still,I have doubt that why WDM driver have different performance between Win2000 and xp.
[may be the bugs of Driverworks ,may be the faultiness of the ACPI in Windows 2000,just my guess]

Anyway,thank you all.


NTDEV is sponsored by OSR

For our schedule of WDF, WDM, debugging and other seminars visit:
http://www.osr.com/seminars

To unsubscribe, visit the List Server section of OSR Online at http://www.osronline.com/page.cfm?name=ListServer