Does Vista/Win7 unload ALL drivers when OS shutdown?

Hello everyone!

Does Vista/Win7 unload *ALL* device drivers when shuttig down?

We want to do some clean up work in the driver unload function, but it seems that the driver unload routine was NEVER called when OS shutting down on Vista/Win7. (It is OK on XP).

Does anyone know how to guareente that the all the drivers will be unloaded on Vista/Win7.

Thanks a lot.

Regards,
HW

xxxxx@viatech.com.cn wrote:

Hello everyone!

Does Vista/Win7 unload *ALL* device drivers when shuttig down?

We want to do some clean up work in the driver unload function, but it seems that the driver unload routine was NEVER called when OS shutting down on Vista/Win7. (It is OK on XP).

Does anyone know how to guareente that the all the drivers will be unloaded on Vista/Win7.

Thanks a lot.

Regards,
HW

No, OS shutdown differs from driver unload.
As you’ve seen, driver unload function may be not called. Register a
shutdown callback if you need so.

– pa

Dear Pavel:
Thanks for your kind reply.
I know how to register shutdown callback in user mode.
But how to do it in kernel mode?
Could you please give me some pointers on this?
Thanks a lot.

BR.
HW

-----Original Message-----
From: xxxxx@lists.osr.com [mailto:xxxxx@lists.osr.com] On Behalf Of Pavel A.
Sent: Wednesday, July 08, 2009 5:27 PM
To: Windows System Software Devs Interest List
Subject: Re:[ntdev] Does Vista/Win7 unload ALL drivers when OS shutdown?

xxxxx@viatech.com.cn wrote:

Hello everyone!

Does Vista/Win7 unload *ALL* device drivers when shuttig down?

We want to do some clean up work in the driver unload function, but it seems that the driver unload routine was NEVER called when OS shutting down on Vista/Win7. (It is OK on XP).

Does anyone know how to guareente that the all the drivers will be unloaded on Vista/Win7.

Thanks a lot.

Regards,
HW

No, OS shutdown differs from driver unload.
As you’ve seen, driver unload function may be not called. Register a shutdown callback if you need so.

– pa


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

Hi, Xing
Why you not do that in the power request such as IRP_MN_SET_POWER, and
you can judge the from and to state?

2009/7/8 :
> Dear Pavel:
> Thanks for your kind reply.
> I know how to register shutdown callback in user mode.
> But how to do it in kernel mode?
> Could you please give me some pointers on this?
> Thanks a lot.
>
> BR.
> HW
>
> -----Original Message-----
> From: xxxxx@lists.osr.com [mailto:xxxxx@lists.osr.com] On Behalf Of Pavel A.
> Sent: Wednesday, July 08, 2009 5:27 PM
> To: Windows System Software Devs Interest List
> Subject: Re:[ntdev] Does Vista/Win7 unload ALL drivers when OS shutdown?
>
> xxxxx@viatech.com.cn wrote:
>> Hello everyone!
>>
>> Does Vista/Win7 unload ALL device drivers when shuttig down?
>>
>> We want to do some clean up work in the driver unload function, but it seems that the driver unload routine was NEVER called when OS shutting down on Vista/Win7. (It is OK on XP).
>>
>> Does anyone know how to guareente that the all the drivers will be unloaded on Vista/Win7.
>>
>> Thanks a lot.
>>
>> Regards,
>> HW
>
> No, OS shutdown differs from driver unload.
> As you’ve seen, driver unload function may be not called. Register a shutdown callback if you need so.
>
> – pa
>
> —
> 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
>
>
> —
> 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
>

IoRegisterShutdownNotification.

Bill Wandel

-----Original Message-----
From: xxxxx@lists.osr.com [mailto:xxxxx@lists.osr.com]
On Behalf Of ??
Sent: Wednesday, July 08, 2009 5:36 AM
To: Windows System Software Devs Interest List
Subject: Re: [ntdev] Does Vista/Win7 unload ALL drivers when OS shutdown?

Hi, Xing
Why you not do that in the power request such as IRP_MN_SET_POWER, and you
can judge the from and to state?

2009/7/8 :
> Dear Pavel:
> Thanks for your kind reply.
> I know how to register shutdown callback in user mode.
> But how to do it in kernel mode?
> Could you please give me some pointers on this?
> Thanks a lot.
>
> BR.
> HW
>
> -----Original Message-----
> From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com] On Behalf Of Pavel A.
> Sent: Wednesday, July 08, 2009 5:27 PM
> To: Windows System Software Devs Interest List
> Subject: Re:[ntdev] Does Vista/Win7 unload ALL drivers when OS shutdown?
>
> xxxxx@viatech.com.cn wrote:
>> Hello everyone!
>>
>> Does Vista/Win7 unload ALL device drivers when shuttig down?
>>
>> We want to do some clean up work in the driver unload function, but it
seems that the driver unload routine was NEVER called when OS shutting down
on Vista/Win7. (It is OK on XP).
>>
>> Does anyone know how to guareente that the all the drivers will be
unloaded on Vista/Win7.
>>
>> Thanks a lot.
>>
>> Regards,
>> HW
>
> No, OS shutdown differs from driver unload.
> As you’ve seen, driver unload function may be not called. Register a
shutdown callback if you need so.
>
> – pa
>
> —
> 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
>
>
> —
> 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
>


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

Dear Bill:
Got it.
Thanks for your kindly help.

Best regards
HW

-----Original Message-----
From: xxxxx@lists.osr.com [mailto:xxxxx@lists.osr.com] On Behalf Of Bill Wandel
Sent: Wednesday, July 08, 2009 5:45 PM
To: Windows System Software Devs Interest List
Subject: RE: [ntdev] Does Vista/Win7 unload ALL drivers when OS shutdown?

IoRegisterShutdownNotification.

Bill Wandel

-----Original Message-----
From: xxxxx@lists.osr.com [mailto:xxxxx@lists.osr.com]
On Behalf Of ??
Sent: Wednesday, July 08, 2009 5:36 AM
To: Windows System Software Devs Interest List
Subject: Re: [ntdev] Does Vista/Win7 unload ALL drivers when OS shutdown?

Hi, Xing
Why you not do that in the power request such as IRP_MN_SET_POWER, and you can judge the from and to state?

2009/7/8 :
> Dear Pavel:
> Thanks for your kind reply.
> I know how to register shutdown callback in user mode.
> But how to do it in kernel mode?
> Could you please give me some pointers on this?
> Thanks a lot.
>
> BR.
> HW
>
> -----Original Message-----
> From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com] On Behalf Of Pavel A.
> Sent: Wednesday, July 08, 2009 5:27 PM
> To: Windows System Software Devs Interest List
> Subject: Re:[ntdev] Does Vista/Win7 unload ALL drivers when OS shutdown?
>
> xxxxx@viatech.com.cn wrote:
>> Hello everyone!
>>
>> Does Vista/Win7 unload ALL device drivers when shuttig down?
>>
>> We want to do some clean up work in the driver unload function, but
>> it
seems that the driver unload routine was NEVER called when OS shutting down on Vista/Win7. (It is OK on XP).
>>
>> Does anyone know how to guareente that the all the drivers will be
unloaded on Vista/Win7.
>>
>> Thanks a lot.
>>
>> Regards,
>> HW
>
> No, OS shutdown differs from driver unload.
> As you’ve seen, driver unload function may be not called. Register a
shutdown callback if you need so.
>
> – pa
>
> —
> 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
>
>
> —
> 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
>


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


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

Is your driver a pnp driver ? If so, the S5/shutdown irp is what you need to use to be notified of shutdown, otherwise the Io routine is fine for a non pnp driver

d

Sent from my phone with no t9, all spilling mistakes are not intentional.

-----Original Message-----
From: xxxxx@viatech.com.cn
Sent: Wednesday, July 08, 2009 2:31 AM
To: Windows System Software Devs Interest List
Subject: RE: [ntdev] Does Vista/Win7 unload ALL drivers when OS shutdown?

Dear Pavel:
Thanks for your kind reply.
I know how to register shutdown callback in user mode.
But how to do it in kernel mode?
Could you please give me some pointers on this?
Thanks a lot.

BR.
HW

-----Original Message-----
From: xxxxx@lists.osr.com [mailto:xxxxx@lists.osr.com] On Behalf Of Pavel A.
Sent: Wednesday, July 08, 2009 5:27 PM
To: Windows System Software Devs Interest List
Subject: Re:[ntdev] Does Vista/Win7 unload ALL drivers when OS shutdown?

xxxxx@viatech.com.cn wrote:
> Hello everyone!
>
> Does Vista/Win7 unload ALL device drivers when shuttig down?
>
> We want to do some clean up work in the driver unload function, but it seems that the driver unload routine was NEVER called when OS shutting down on Vista/Win7. (It is OK on XP).
>
> Does anyone know how to guareente that the all the drivers will be unloaded on Vista/Win7.
>
> Thanks a lot.
>
> Regards,
> HW

No, OS shutdown differs from driver unload.
As you’ve seen, driver unload function may be not called. Register a shutdown callback if you need so.

– pa


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


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

“??” wrote in message news:xxxxx@ntdev…
> Hi, Xing
> Why you not do that in the power request such as IRP_MN_SET_POWER, and
> you can judge the from and to state?

a. Because not every driver, even PnP, sees these IRPs.
For example, NDIS miniports don’t see IRPs and use
NdisMRegisterAdapterShutdownHandler
to register for shutdown notifications

b. Sometimes one wants to use IoRegisterLastChanceShutdownNotification

Regards,
--pa

> 2009/7/8 :
>> Dear Pavel:
>> Thanks for your kind reply.
>> I know how to register shutdown callback in user mode.
>> But how to do it in kernel mode?
>> Could you please give me some pointers on this?
>> Thanks a lot.
>>
>> BR.
>> HW
>>
>> -----Original Message-----
>> From: xxxxx@lists.osr.com
>> [mailto:xxxxx@lists.osr.com] On Behalf Of Pavel A.
>> Sent: Wednesday, July 08, 2009 5:27 PM
>> To: Windows System Software Devs Interest List
>> Subject: Re:[ntdev] Does Vista/Win7 unload ALL drivers when OS shutdown?
>>
>> xxxxx@viatech.com.cn wrote:
>>> Hello everyone!
>>>
>>> Does Vista/Win7 unload ALL device drivers when shuttig down?
>>>
>>> We want to do some clean up work in the driver unload function, but it
>>> seems that the driver unload routine was NEVER called when OS shutting
>>> down on Vista/Win7. (It is OK on XP).
>>>
>>> Does anyone know how to guareente that the all the drivers will be
>>> unloaded on Vista/Win7.
>>>
>>> Thanks a lot.
>>>
>>> Regards,
>>> HW
>>
>> No, OS shutdown differs from driver unload.
>> As you’ve seen, driver unload function may be not called. Register a
>> shutdown callback if you need so.
>>
>> – pa
>>
>> —
>> 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
>>
>>
>> —
>> 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
>>
>

Thanks Doron.
What do you mean by “the S5/shutdown irp”, IRP_MJ_SHUTDOWN irp or IRP_MJ_POWER irp?

Regards,
HW
-----Original Message-----
From: xxxxx@lists.osr.com [mailto:xxxxx@lists.osr.com] On Behalf Of Doron Holan
Sent: Wednesday, July 08, 2009 10:43 PM
To: Windows System Software Devs Interest List
Subject: RE: [ntdev] Does Vista/Win7 unload ALL drivers when OS shutdown?

Is your driver a pnp driver ? If so, the S5/shutdown irp is what you need to use to be notified of shutdown, otherwise the Io routine is fine for a non pnp driver

d

Sent from my phone with no t9, all spilling mistakes are not intentional.

-----Original Message-----
From: xxxxx@viatech.com.cn
Sent: Wednesday, July 08, 2009 2:31 AM
To: Windows System Software Devs Interest List
Subject: RE: [ntdev] Does Vista/Win7 unload ALL drivers when OS shutdown?

Dear Pavel:
Thanks for your kind reply.
I know how to register shutdown callback in user mode.
But how to do it in kernel mode?
Could you please give me some pointers on this?
Thanks a lot.

BR.
HW

-----Original Message-----
From: xxxxx@lists.osr.com [mailto:xxxxx@lists.osr.com] On Behalf Of Pavel A.
Sent: Wednesday, July 08, 2009 5:27 PM
To: Windows System Software Devs Interest List
Subject: Re:[ntdev] Does Vista/Win7 unload ALL drivers when OS shutdown?

xxxxx@viatech.com.cn wrote:
> Hello everyone!
>
> Does Vista/Win7 unload ALL device drivers when shuttig down?
>
> We want to do some clean up work in the driver unload function, but it seems that the driver unload routine was NEVER called when OS shutting down on Vista/Win7. (It is OK on XP).
>
> Does anyone know how to guareente that the all the drivers will be unloaded on Vista/Win7.
>
> Thanks a lot.
>
> Regards,
> HW

No, OS shutdown differs from driver unload.
As you’ve seen, driver unload function may be not called. Register a shutdown callback if you need so.

– pa


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


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


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

Yes. We are miniport driver and don’t handle IRP directly.

-----Original Message-----
From: xxxxx@lists.osr.com [mailto:xxxxx@lists.osr.com] On Behalf Of Pavel A.
Sent: Thursday, July 09, 2009 7:31 AM
To: Windows System Software Devs Interest List
Subject: Re:[ntdev] Does Vista/Win7 unload ALL drivers when OS shutdown?

“??” wrote in message news:xxxxx@ntdev…
> Hi, Xing
> Why you not do that in the power request such as IRP_MN_SET_POWER, and
> you can judge the from and to state?

a. Because not every driver, even PnP, sees these IRPs.
For example, NDIS miniports don’t see IRPs and use NdisMRegisterAdapterShutdownHandler
to register for shutdown notifications

b. Sometimes one wants to use IoRegisterLastChanceShutdownNotification

Regards,
--pa

> 2009/7/8 :
>> Dear Pavel:
>> Thanks for your kind reply.
>> I know how to register shutdown callback in user mode.
>> But how to do it in kernel mode?
>> Could you please give me some pointers on this?
>> Thanks a lot.
>>
>> BR.
>> HW
>>
>> -----Original Message-----
>> From: xxxxx@lists.osr.com
>> [mailto:xxxxx@lists.osr.com] On Behalf Of Pavel A.
>> Sent: Wednesday, July 08, 2009 5:27 PM
>> To: Windows System Software Devs Interest List
>> Subject: Re:[ntdev] Does Vista/Win7 unload ALL drivers when OS shutdown?
>>
>> xxxxx@viatech.com.cn wrote:
>>> Hello everyone!
>>>
>>> Does Vista/Win7 unload ALL device drivers when shuttig down?
>>>
>>> We want to do some clean up work in the driver unload function, but
>>> it seems that the driver unload routine was NEVER called when OS
>>> shutting down on Vista/Win7. (It is OK on XP).
>>>
>>> Does anyone know how to guareente that the all the drivers will be
>>> unloaded on Vista/Win7.
>>>
>>> Thanks a lot.
>>>
>>> Regards,
>>> HW
>>
>> No, OS shutdown differs from driver unload.
>> As you’ve seen, driver unload function may be not called. Register a
>> shutdown callback if you need so.
>>
>> – pa
>>
>> —
>> 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
>>
>>
>> —
>> 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
>>
>


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

What kind of miniport? Typically as a mp you do not get any irps, MJ_SHUTDOWN or MJ_POWER and registering for either is not possible.

d

Sent from my phone with no t9, all spilling mistakes are not intentional.

-----Original Message-----
From: xxxxx@viatech.com.cn
Sent: Wednesday, July 08, 2009 7:21 PM
To: Windows System Software Devs Interest List
Subject: RE: [ntdev] Does Vista/Win7 unload ALL drivers when OS shutdown?

Yes. We are miniport driver and don’t handle IRP directly.

-----Original Message-----
From: xxxxx@lists.osr.com [mailto:xxxxx@lists.osr.com] On Behalf Of Pavel A.
Sent: Thursday, July 09, 2009 7:31 AM
To: Windows System Software Devs Interest List
Subject: Re:[ntdev] Does Vista/Win7 unload ALL drivers when OS shutdown?

“??” wrote in message news:xxxxx@ntdev…
> Hi, Xing
> Why you not do that in the power request such as IRP_MN_SET_POWER, and
> you can judge the from and to state?

a. Because not every driver, even PnP, sees these IRPs.
For example, NDIS miniports don’t see IRPs and use NdisMRegisterAdapterShutdownHandler
to register for shutdown notifications

b. Sometimes one wants to use IoRegisterLastChanceShutdownNotification

Regards,
--pa

> 2009/7/8 :
>> Dear Pavel:
>> Thanks for your kind reply.
>> I know how to register shutdown callback in user mode.
>> But how to do it in kernel mode?
>> Could you please give me some pointers on this?
>> Thanks a lot.
>>
>> BR.
>> HW
>>
>> -----Original Message-----
>> From: xxxxx@lists.osr.com
>> [mailto:xxxxx@lists.osr.com] On Behalf Of Pavel A.
>> Sent: Wednesday, July 08, 2009 5:27 PM
>> To: Windows System Software Devs Interest List
>> Subject: Re:[ntdev] Does Vista/Win7 unload ALL drivers when OS shutdown?
>>
>> xxxxx@viatech.com.cn wrote:
>>> Hello everyone!
>>>
>>> Does Vista/Win7 unload ALL device drivers when shuttig down?
>>>
>>> We want to do some clean up work in the driver unload function, but
>>> it seems that the driver unload routine was NEVER called when OS
>>> shutting down on Vista/Win7. (It is OK on XP).
>>>
>>> Does anyone know how to guareente that the all the drivers will be
>>> unloaded on Vista/Win7.
>>>
>>> Thanks a lot.
>>>
>>> Regards,
>>> HW
>>
>> No, OS shutdown differs from driver unload.
>> As you’ve seen, driver unload function may be not called. Register a
>> shutdown callback if you need so.
>>
>> – pa
>>
>> —
>> 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
>>
>>
>> —
>> 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
>>
>


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


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 meant MJ_POWER/MN_SET_POWER(SystemPowerState/Shutdown) which is the S5 state

d

Sent from my phone with no t9, all spilling mistakes are not intentional.

-----Original Message-----
From: xxxxx@viatech.com.cn
Sent: Wednesday, July 08, 2009 7:19 PM
To: Windows System Software Devs Interest List
Subject: RE: [ntdev] Does Vista/Win7 unload ALL drivers when OS shutdown?

Thanks Doron.
What do you mean by “the S5/shutdown irp”, IRP_MJ_SHUTDOWN irp or IRP_MJ_POWER irp?

Regards,
HW
-----Original Message-----
From: xxxxx@lists.osr.com [mailto:xxxxx@lists.osr.com] On Behalf Of Doron Holan
Sent: Wednesday, July 08, 2009 10:43 PM
To: Windows System Software Devs Interest List
Subject: RE: [ntdev] Does Vista/Win7 unload ALL drivers when OS shutdown?

Is your driver a pnp driver ? If so, the S5/shutdown irp is what you need to use to be notified of shutdown, otherwise the Io routine is fine for a non pnp driver

d

Sent from my phone with no t9, all spilling mistakes are not intentional.

-----Original Message-----
From: xxxxx@viatech.com.cn
Sent: Wednesday, July 08, 2009 2:31 AM
To: Windows System Software Devs Interest List
Subject: RE: [ntdev] Does Vista/Win7 unload ALL drivers when OS shutdown?

Dear Pavel:
Thanks for your kind reply.
I know how to register shutdown callback in user mode.
But how to do it in kernel mode?
Could you please give me some pointers on this?
Thanks a lot.

BR.
HW

-----Original Message-----
From: xxxxx@lists.osr.com [mailto:xxxxx@lists.osr.com] On Behalf Of Pavel A.
Sent: Wednesday, July 08, 2009 5:27 PM
To: Windows System Software Devs Interest List
Subject: Re:[ntdev] Does Vista/Win7 unload ALL drivers when OS shutdown?

xxxxx@viatech.com.cn wrote:
> Hello everyone!
>
> Does Vista/Win7 unload ALL device drivers when shuttig down?
>
> We want to do some clean up work in the driver unload function, but it seems that the driver unload routine was NEVER called when OS shutting down on Vista/Win7. (It is OK on XP).
>
> Does anyone know how to guareente that the all the drivers will be unloaded on Vista/Win7.
>
> Thanks a lot.
>
> Regards,
> HW

No, OS shutdown differs from driver unload.
As you’ve seen, driver unload function may be not called. Register a shutdown callback if you need so.

– pa


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


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


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


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

WDM audio miniport drivers.

We implement the IAdapterPowerManagement interface as required.
But seems this interface doesn’t called when shutdown.

Regards,
HW

-----Original Message-----
From: xxxxx@lists.osr.com [mailto:xxxxx@lists.osr.com] On Behalf Of Doron Holan
Sent: Thursday, July 09, 2009 10:37 AM
To: Windows System Software Devs Interest List
Subject: RE: [ntdev] Does Vista/Win7 unload ALL drivers when OS shutdown?

What kind of miniport? Typically as a mp you do not get any irps, MJ_SHUTDOWN or MJ_POWER and registering for either is not possible.

d

Sent from my phone with no t9, all spilling mistakes are not intentional.

-----Original Message-----
From: xxxxx@viatech.com.cn
Sent: Wednesday, July 08, 2009 7:21 PM
To: Windows System Software Devs Interest List
Subject: RE: [ntdev] Does Vista/Win7 unload ALL drivers when OS shutdown?

Yes. We are miniport driver and don’t handle IRP directly.

-----Original Message-----
From: xxxxx@lists.osr.com [mailto:xxxxx@lists.osr.com] On Behalf Of Pavel A.
Sent: Thursday, July 09, 2009 7:31 AM
To: Windows System Software Devs Interest List
Subject: Re:[ntdev] Does Vista/Win7 unload ALL drivers when OS shutdown?

“??” wrote in message news:xxxxx@ntdev…
> Hi, Xing
> Why you not do that in the power request such as IRP_MN_SET_POWER, and
> you can judge the from and to state?

a. Because not every driver, even PnP, sees these IRPs.
For example, NDIS miniports don’t see IRPs and use NdisMRegisterAdapterShutdownHandler
to register for shutdown notifications

b. Sometimes one wants to use IoRegisterLastChanceShutdownNotification

Regards,
--pa

> 2009/7/8 :
>> Dear Pavel:
>> Thanks for your kind reply.
>> I know how to register shutdown callback in user mode.
>> But how to do it in kernel mode?
>> Could you please give me some pointers on this?
>> Thanks a lot.
>>
>> BR.
>> HW
>>
>> -----Original Message-----
>> From: xxxxx@lists.osr.com
>> [mailto:xxxxx@lists.osr.com] On Behalf Of Pavel A.
>> Sent: Wednesday, July 08, 2009 5:27 PM
>> To: Windows System Software Devs Interest List
>> Subject: Re:[ntdev] Does Vista/Win7 unload ALL drivers when OS shutdown?
>>
>> xxxxx@viatech.com.cn wrote:
>>> Hello everyone!
>>>
>>> Does Vista/Win7 unload ALL device drivers when shuttig down?
>>>
>>> We want to do some clean up work in the driver unload function, but
>>> it seems that the driver unload routine was NEVER called when OS
>>> shutting down on Vista/Win7. (It is OK on XP).
>>>
>>> Does anyone know how to guareente that the all the drivers will be
>>> unloaded on Vista/Win7.
>>>
>>> Thanks a lot.
>>>
>>> Regards,
>>> HW
>>
>> No, OS shutdown differs from driver unload.
>> As you’ve seen, driver unload function may be not called. Register a
>> shutdown callback if you need so.
>>
>> – pa
>>
>> —
>> 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
>>
>>
>> —
>> 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
>>
>


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


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


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

Why do you need to distinguish between shutdown and other Sx state transitions? What are you doing differently between suspend and S5? Or hibernate?

-----Original Message-----
From: xxxxx@lists.osr.com [mailto:xxxxx@lists.osr.com] On Behalf Of xxxxx@viatech.com.cn
Sent: Wednesday, July 08, 2009 8:24 PM
To: Windows System Software Devs Interest List
Subject: RE: [ntdev] Does Vista/Win7 unload ALL drivers when OS shutdown?

WDM audio miniport drivers.

We implement the IAdapterPowerManagement interface as required.
But seems this interface doesn’t called when shutdown.

Regards,
HW

-----Original Message-----
From: xxxxx@lists.osr.com [mailto:xxxxx@lists.osr.com] On Behalf Of Doron Holan
Sent: Thursday, July 09, 2009 10:37 AM
To: Windows System Software Devs Interest List
Subject: RE: [ntdev] Does Vista/Win7 unload ALL drivers when OS shutdown?

What kind of miniport? Typically as a mp you do not get any irps, MJ_SHUTDOWN or MJ_POWER and registering for either is not possible.

d

Sent from my phone with no t9, all spilling mistakes are not intentional.

-----Original Message-----
From: xxxxx@viatech.com.cn
Sent: Wednesday, July 08, 2009 7:21 PM
To: Windows System Software Devs Interest List
Subject: RE: [ntdev] Does Vista/Win7 unload ALL drivers when OS shutdown?

Yes. We are miniport driver and don’t handle IRP directly.

-----Original Message-----
From: xxxxx@lists.osr.com [mailto:xxxxx@lists.osr.com] On Behalf Of Pavel A.
Sent: Thursday, July 09, 2009 7:31 AM
To: Windows System Software Devs Interest List
Subject: Re:[ntdev] Does Vista/Win7 unload ALL drivers when OS shutdown?

“??” wrote in message news:xxxxx@ntdev…
> Hi, Xing
> Why you not do that in the power request such as IRP_MN_SET_POWER, and
> you can judge the from and to state?

a. Because not every driver, even PnP, sees these IRPs.
For example, NDIS miniports don’t see IRPs and use NdisMRegisterAdapterShutdownHandler
to register for shutdown notifications

b. Sometimes one wants to use IoRegisterLastChanceShutdownNotification

Regards,
--pa

> 2009/7/8 :
>> Dear Pavel:
>> Thanks for your kind reply.
>> I know how to register shutdown callback in user mode.
>> But how to do it in kernel mode?
>> Could you please give me some pointers on this?
>> Thanks a lot.
>>
>> BR.
>> HW
>>
>> -----Original Message-----
>> From: xxxxx@lists.osr.com
>> [mailto:xxxxx@lists.osr.com] On Behalf Of Pavel A.
>> Sent: Wednesday, July 08, 2009 5:27 PM
>> To: Windows System Software Devs Interest List
>> Subject: Re:[ntdev] Does Vista/Win7 unload ALL drivers when OS shutdown?
>>
>> xxxxx@viatech.com.cn wrote:
>>> Hello everyone!
>>>
>>> Does Vista/Win7 unload ALL device drivers when shuttig down?
>>>
>>> We want to do some clean up work in the driver unload function, but
>>> it seems that the driver unload routine was NEVER called when OS
>>> shutting down on Vista/Win7. (It is OK on XP).
>>>
>>> Does anyone know how to guareente that the all the drivers will be
>>> unloaded on Vista/Win7.
>>>
>>> Thanks a lot.
>>>
>>> Regards,
>>> HW
>>
>> No, OS shutdown differs from driver unload.
>> As you’ve seen, driver unload function may be not called. Register a
>> shutdown callback if you need so.
>>
>> – pa
>>
>> —
>> 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
>>
>>
>> —
>> 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
>>
>


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


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


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


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

Actually, we want to differentiate S3 and S5.
But we can’t because the default SxD mappings set by bus driver are S0->D0, S3->D3,S5->D3.
From the miniport driver’s point of view, we can’t distguish S3/S5.
But we still want to do something we system is tansitioned to S5 state. So…

Best regards,
HW

-----Original Message-----
From: xxxxx@lists.osr.com [mailto:xxxxx@lists.osr.com] On Behalf Of Doron Holan
Sent: Thursday, July 09, 2009 2:44 PM
To: Windows System Software Devs Interest List
Subject: RE: [ntdev] Does Vista/Win7 unload ALL drivers when OS shutdown?

Why do you need to distinguish between shutdown and other Sx state transitions? What are you doing differently between suspend and S5? Or hibernate?

-----Original Message-----
From: xxxxx@lists.osr.com [mailto:xxxxx@lists.osr.com] On Behalf Of xxxxx@viatech.com.cn
Sent: Wednesday, July 08, 2009 8:24 PM
To: Windows System Software Devs Interest List
Subject: RE: [ntdev] Does Vista/Win7 unload ALL drivers when OS shutdown?

WDM audio miniport drivers.

We implement the IAdapterPowerManagement interface as required.
But seems this interface doesn’t called when shutdown.

Regards,
HW

-----Original Message-----
From: xxxxx@lists.osr.com [mailto:xxxxx@lists.osr.com] On Behalf Of Doron Holan
Sent: Thursday, July 09, 2009 10:37 AM
To: Windows System Software Devs Interest List
Subject: RE: [ntdev] Does Vista/Win7 unload ALL drivers when OS shutdown?

What kind of miniport? Typically as a mp you do not get any irps, MJ_SHUTDOWN or MJ_POWER and registering for either is not possible.

d

Sent from my phone with no t9, all spilling mistakes are not intentional.

-----Original Message-----
From: xxxxx@viatech.com.cn
Sent: Wednesday, July 08, 2009 7:21 PM
To: Windows System Software Devs Interest List
Subject: RE: [ntdev] Does Vista/Win7 unload ALL drivers when OS shutdown?

Yes. We are miniport driver and don’t handle IRP directly.

-----Original Message-----
From: xxxxx@lists.osr.com [mailto:xxxxx@lists.osr.com] On Behalf Of Pavel A.
Sent: Thursday, July 09, 2009 7:31 AM
To: Windows System Software Devs Interest List
Subject: Re:[ntdev] Does Vista/Win7 unload ALL drivers when OS shutdown?

“??” wrote in message news:xxxxx@ntdev…
> Hi, Xing
> Why you not do that in the power request such as IRP_MN_SET_POWER, and
> you can judge the from and to state?

a. Because not every driver, even PnP, sees these IRPs.
For example, NDIS miniports don’t see IRPs and use NdisMRegisterAdapterShutdownHandler
to register for shutdown notifications

b. Sometimes one wants to use IoRegisterLastChanceShutdownNotification

Regards,
--pa

> 2009/7/8 :
>> Dear Pavel:
>> Thanks for your kind reply.
>> I know how to register shutdown callback in user mode.
>> But how to do it in kernel mode?
>> Could you please give me some pointers on this?
>> Thanks a lot.
>>
>> BR.
>> HW
>>
>> -----Original Message-----
>> From: xxxxx@lists.osr.com
>> [mailto:xxxxx@lists.osr.com] On Behalf Of Pavel A.
>> Sent: Wednesday, July 08, 2009 5:27 PM
>> To: Windows System Software Devs Interest List
>> Subject: Re:[ntdev] Does Vista/Win7 unload ALL drivers when OS shutdown?
>>
>> xxxxx@viatech.com.cn wrote:
>>> Hello everyone!
>>>
>>> Does Vista/Win7 unload ALL device drivers when shuttig down?
>>>
>>> We want to do some clean up work in the driver unload function, but
>>> it seems that the driver unload routine was NEVER called when OS
>>> shutting down on Vista/Win7. (It is OK on XP).
>>>
>>> Does anyone know how to guareente that the all the drivers will be
>>> unloaded on Vista/Win7.
>>>
>>> Thanks a lot.
>>>
>>> Regards,
>>> HW
>>
>> No, OS shutdown differs from driver unload.
>> As you’ve seen, driver unload function may be not called. Register a
>> shutdown callback if you need so.
>>
>> – pa
>>
>> —
>> 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
>>
>>
>> —
>> 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
>>
>


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


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


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


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


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

>

Actually, we want to differentiate S3 and S5.
But we can’t because the default SxD mappings set by bus driver are
S0->D0,
S3->D3,S5->D3.
From the miniport driver’s point of view, we can’t distguish S3/S5.
But we still want to do something we system is tansitioned to S5
state. So…

You’ve been asked why you want to do this at least once and haven’t
answered. If you offer the reason why detecting the S5 state transition
is so important to you then you will be more likely to get some useful
information.

James

Dear James,
Thanks.
The reason is we want to set different hardware registers according to system state (S0/S3/S5).

Our driver are miniport drivers and don’t directly handle power IRPs.
When system power state changes, the port driver will notify us and direct our driver to appropiate device state.
However, the default SxD mappings set by bus dirver are as follows:
S0->D0
S3->D3
S5->D3

So when port driver direct us to D0 we know the system power state is S0.
But we can’t distinguish S3/S5.
Since S5 correspond to shutdown, so we want to set S5 state registers in shutdown callback.

Best regards,
HW
-----Original Message-----
From: xxxxx@lists.osr.com [mailto:xxxxx@lists.osr.com] On Behalf Of James Harper
Sent: Thursday, July 09, 2009 5:33 PM
To: Windows System Software Devs Interest List
Subject: RE: [ntdev] Does Vista/Win7 unload ALL drivers when OS shutdown?

Actually, we want to differentiate S3 and S5.
But we can’t because the default SxD mappings set by bus driver are
S0->D0,
S3->D3,S5->D3.
From the miniport driver’s point of view, we can’t distguish S3/S5.
But we still want to do something we system is tansitioned to S5
state. So…

You’ve been asked why you want to do this at least once and haven’t answered. If you offer the reason why detecting the S5 state transition is so important to you then you will be more likely to get some useful information.

James


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

>The reason is we want to set different hardware registers according to

system state (S0/S3/S5).

I think everyone is looking to find out why your device cares if the system
is going to S3 or S5 since you’re going to D3 in either case. Are you trying
to work around some bug in the chipset?

-scott


Scott Noone
Consulting Associate
OSR Open Systems Resources, Inc.
http://www.osronline.com

wrote in message news:xxxxx@ntdev…
Dear James,
Thanks.
The reason is we want to set different hardware registers according to
system state (S0/S3/S5).

Our driver are miniport drivers and don’t directly handle power IRPs.
When system power state changes, the port driver will notify us and direct
our driver to appropiate device state.
However, the default SxD mappings set by bus dirver are as follows:
S0->D0
S3->D3
S5->D3

So when port driver direct us to D0 we know the system power state is S0.
But we can’t distinguish S3/S5.
Since S5 correspond to shutdown, so we want to set S5 state registers in
shutdown callback.

Best regards,
HW
-----Original Message-----
From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com] On Behalf Of James Harper
Sent: Thursday, July 09, 2009 5:33 PM
To: Windows System Software Devs Interest List
Subject: RE: [ntdev] Does Vista/Win7 unload ALL drivers when OS shutdown?

>
> Actually, we want to differentiate S3 and S5.
> But we can’t because the default SxD mappings set by bus driver are
S0->D0,
> S3->D3,S5->D3.
> From the miniport driver’s point of view, we can’t distguish S3/S5.
> But we still want to do something we system is tansitioned to S5
state. So…
>

You’ve been asked why you want to do this at least once and haven’t
answered. If you offer the reason why detecting the S5 state transition is
so important to you then you will be more likely to get some useful
information.

James


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