Why Remove Event is not getting signaled while uninstalling the driver

Hi all,
I am making a driver for a pci device.The driver gets installed properly but when i uninstall the driver system gets hanged.
While debugging with winDbg i found that remove event is not getting signaled because of which system become hangs.

any one can point out what could be possible the reason because of which remove event wont get signaled.

Regards


Get the new Windows Live Messenger!
http://get.live.com/messenger/overview

Typically this is caused by having an open handle to the device in question.
It a can also be caused by improper handling of pnp IRP requests. Are you
using KMDF for this driver?

From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com] On Behalf Of nayan kumar
Sent: Sunday, October 21, 2007 4:18 PM
To: Windows System Software Devs Interest List
Subject: [ntdev] Why Remove Event is not getting signaled while uninstalling
the driver

Hi all,
I am making a driver for a pci device.The driver gets installed
properly but when i uninstall the driver system gets hanged.
While debugging with winDbg i found that remove event is not getting
signaled because of which system become hangs.

any one can point out what could be possible the reason because of which
remove event wont get signaled.

Regards


Get the new Windows Live Messenger! Try it!
http:

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</http:>

Hi Mark,
Thanks for your reply.
i am using ddk3790.1830.And as far as opening the handle is concern IRP_MJ_CREATE never gets called because i am just checking my driver by installing and uninstalling it only for checking that weather its working properly up to this point or not and i am also using pnptest tool that comes along with the ddk.i am taking help from toaster fun featured2 for making my driver.

Is there any other thing that i need to take care of basedon the sample that i am using for my help.

Regards

From: xxxxx@hollistech.comTo: xxxxx@lists.osr.comSubject: RE: [ntdev] Why Remove Event is not getting signaled while uninstalling the driverDate: Sun, 21 Oct 2007 18:17:46 -0400

Typically this is caused by having an open handle to the device in question. It a can also be caused by improper handling of pnp IRP requests. Are you using KMDF for this driver?

From: xxxxx@lists.osr.com [mailto:xxxxx@lists.osr.com] On Behalf Of nayan kumarSent: Sunday, October 21, 2007 4:18 PMTo: Windows System Software Devs Interest ListSubject: [ntdev] Why Remove Event is not getting signaled while uninstalling the driver

Hi all, I am making a driver for a pci device.The driver gets installed properly but when i uninstall the driver system gets hanged.While debugging with winDbg i found that remove event is not getting signaled because of which system become hangs. any one can point out what could be possible the reason because of which remove event wont get signaled. Regards

Get the new Windows Live Messenger! Try it!— 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


Windows Live Spaces is here! It?s easy to create your own personal Web site.
http://spaces.live.com/?mkt=en-in

  1. Consider using KMDF instead as it will provide all of the power/pnp
    management code for you.

  2. Turn on driver verifier for your device and retest. That may get DV
    to indicate what the problem is.

  3. After you think your device should have been removed, use windbg to
    break into the system and execute a !devnode command on the devnode for your
    PCI device. That will indicate the current state and the recent history of
    state changes and may provide some clues as to what is wrong.

From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com] On Behalf Of nayan kumar
Sent: Monday, October 22, 2007 5:35 AM
To: Windows System Software Devs Interest List
Subject: RE: [ntdev] Why Remove Event is not getting signaled while
uninstalling the driver

Hi Mark,
Thanks for your reply.
i am using ddk3790.1830.And as far as opening the handle is concern
IRP_MJ_CREATE never gets called because i am just checking my driver by
installing and uninstalling it only for checking that weather its working
properly up to this point or not and i am also using pnptest tool that comes
along with the ddk.i am taking help from toaster fun featured2 for making my
driver.

Is there any other thing that i need to take care of basedon the sample that
i am using for my help.

Regards


From: xxxxx@hollistech.com
To: xxxxx@lists.osr.com
Subject: RE: [ntdev] Why Remove Event is not getting signaled while
uninstalling the driver
Date: Sun, 21 Oct 2007 18:17:46 -0400

Typically this is caused by having an open handle to the device in question.
It a can also be caused by improper handling of pnp IRP requests. Are you
using KMDF for this driver?

From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com] On Behalf Of nayan kumar
Sent: Sunday, October 21, 2007 4:18 PM
To: Windows System Software Devs Interest List
Subject: [ntdev] Why Remove Event is not getting signaled while uninstalling
the driver

Hi all,
I am making a driver for a pci device.The driver gets installed
properly but when i uninstall the driver system gets hanged.
While debugging with winDbg i found that remove event is not getting
signaled because of which system become hangs.

any one can point out what could be possible the reason because of which
remove event wont get signaled.

Regards


Get the new Windows Live Messenger! Try it!
http:

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

_____

Windows Live Spaces is here! It’s easy to create your own personal Web site.
Check it out! http:

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</http:></http:>

Hi Mark,
Thanks for your help.
As u instructed i issued the !devnode command immediately before KeWaitForSingleObject and the resut i got it as follows
kd> !devnodeDumping IopRootDeviceNode (= 0x8136d808)DevNode 0x8136d808 for PDO 0x8136d940 Parent 0000000000 Sibling 0000000000 Child 0x8136d3f8 InstancePath is “HTREE\ROOT\0” State = DeviceNodeStarted (0x308) Previous State = DeviceNodeEnumerateCompletion (0x30d) StateHistory[04] = DeviceNodeEnumerateCompletion (0x30d) StateHistory[03] = DeviceNodeStarted (0x308) StateHistory[02] = DeviceNodeEnumerateCompletion (0x30d) StateHistory[01] = DeviceNodeStarted (0x308) StateHistory[00] = DeviceNodeUninitialized (0x301) StateHistory[19] = Unknown State (0x0) StateHistory[18] = Unknown State (0x0) StateHistory[17] = Unknown State (0x0) StateHistory[16] = Unknown State (0x0) StateHistory[15] = Unknown State (0x0) StateHistory[14] = Unknown State (0x0) StateHistory[13] = Unknown State (0x0) StateHistory[12] = Unknown State (0x0) StateHistory[11] = Unknown State (0x0) StateHistory[10] = Unknown State (0x0) StateHistory[09] = Unknown State (0x0) StateHistory[08] = Unknown State (0x0) StateHistory[07] = Unknown State (0x0) StateHistory[06] = Unknown State (0x0) StateHistory[05] = Unknown State (0x0) Flags (0x00000131) DNF_MADEUP, DNF_ENUMERATED, DNF_IDS_QUERIED, DNF_NO_RESOURCE_REQUIRED DisableableDepends = 10 (from children)kd> pJinSdDesigner!SdHostDispatchPnp+0xe4:f821f77c 53 push ebxkd> p

Please helping me in finding the problem based on this data.

Regards


Get the new Windows Live Messenger!
http://get.live.com/messenger/overview

You have to perform !devnode on your device object’s devnodes. Read the
windbg docs. Use !devnode 0 1 to enumerate all devnodes in the system.
Then find yours. Then perform another !devnode on your devnode’s
address.


From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com] On Behalf Of nayan kumar
Sent: Monday, October 22, 2007 12:19 PM
To: Windows System Software Devs Interest List
Subject: RE: [ntdev] Why Remove Event is not getting signaled while
uninstalling the driver

Hi Mark,
Thanks for your help.
As u instructed i issued the !devnode command immediately before
KeWaitForSingleObject and the resut i got it as follows

kd> !devnode
Dumping IopRootDeviceNode (= 0x8136d808)
DevNode 0x8136d808 for PDO 0x8136d940
Parent 0000000000 Sibling 0000000000 Child 0x8136d3f8
InstancePath is “HTREE\ROOT\0”
State = DeviceNodeStarted (0x308)
Previous State = DeviceNodeEnumerateCompletion (0x30d)
StateHistory[04] = DeviceNodeEnumerateCompletion (0x30d)
StateHistory[03] = DeviceNodeStarted (0x308)
StateHistory[02] = DeviceNodeEnumerateCompletion (0x30d)
StateHistory[01] = DeviceNodeStarted (0x308)
StateHistory[00] = DeviceNodeUninitialized (0x301)
StateHistory[19] = Unknown State (0x0)
StateHistory[18] = Unknown State (0x0)
StateHistory[17] = Unknown State (0x0)
StateHistory[16] = Unknown State (0x0)
StateHistory[15] = Unknown State (0x0)
StateHistory[14] = Unknown State (0x0)
StateHistory[13] = Unknown State (0x0)
StateHistory[12] = Unknown State (0x0)
StateHistory[11] = Unknown State (0x0)
StateHistory[10] = Unknown State (0x0)
StateHistory[09] = Unknown State (0x0)
StateHistory[08] = Unknown State (0x0)
StateHistory[07] = Unknown State (0x0)
StateHistory[06] = Unknown State (0x0)
StateHistory[05] = Unknown State (0x0)
Flags (0x00000131) DNF_MADEUP, DNF_ENUMERATED,
DNF_IDS_QUERIED, DNF_NO_RESOURCE_REQUIRED
DisableableDepends = 10 (from children)
kd> p
JinSdDesigner!SdHostDispatchPnp+0xe4:
f821f77c 53 push ebx
kd> p

Please helping me in finding the problem based on this data.

Regards


Get the new Windows Live Messenger! Try it!
http:

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</http:>

You can shortcircuit the dumping of the entire tree by running “!devnode 0 1 ” without quotes. This will dump devnode for your device

d

From: xxxxx@lists.osr.com [mailto:xxxxx@lists.osr.com] On Behalf Of Roddy, Mark
Sent: Monday, October 22, 2007 10:18 AM
To: Windows System Software Devs Interest List
Subject: RE: [ntdev] Why Remove Event is not getting signaled while uninstalling the driver

You have to perform !devnode on your device object’s devnodes. Read the windbg docs. Use !devnode 0 1 to enumerate all devnodes in the system. Then find yours. Then perform another !devnode on your devnode’s address.


From: xxxxx@lists.osr.com [mailto:xxxxx@lists.osr.com] On Behalf Of nayan kumar
Sent: Monday, October 22, 2007 12:19 PM
To: Windows System Software Devs Interest List
Subject: RE: [ntdev] Why Remove Event is not getting signaled while uninstalling the driver

Hi Mark,
Thanks for your help.
As u instructed i issued the !devnode command immediately before KeWaitForSingleObject and the resut i got it as follows

kd> !devnode
Dumping IopRootDeviceNode (= 0x8136d808)
DevNode 0x8136d808 for PDO 0x8136d940
Parent 0000000000 Sibling 0000000000 Child 0x8136d3f8
InstancePath is “HTREE\ROOT\0”
State = DeviceNodeStarted (0x308)
Previous State = DeviceNodeEnumerateCompletion (0x30d)
StateHistory[04] = DeviceNodeEnumerateCompletion (0x30d)
StateHistory[03] = DeviceNodeStarted (0x308)
StateHistory[02] = DeviceNodeEnumerateCompletion (0x30d)
StateHistory[01] = DeviceNodeStarted (0x308)
StateHistory[00] = DeviceNodeUninitialized (0x301)
StateHistory[19] = Unknown State (0x0)
StateHistory[18] = Unknown State (0x0)
StateHistory[17] = Unknown State (0x0)
StateHistory[16] = Unknown State (0x0)
StateHistory[15] = Unknown State (0x0)
StateHistory[14] = Unknown State (0x0)
StateHistory[13] = Unknown State (0x0)
StateHistory[12] = Unknown State (0x0)
StateHistory[11] = Unknown State (0x0)
StateHistory[10] = Unknown State (0x0)
StateHistory[09] = Unknown State (0x0)
StateHistory[08] = Unknown State (0x0)
StateHistory[07] = Unknown State (0x0)
StateHistory[06] = Unknown State (0x0)
StateHistory[05] = Unknown State (0x0)
Flags (0x00000131) DNF_MADEUP, DNF_ENUMERATED,
DNF_IDS_QUERIED, DNF_NO_RESOURCE_REQUIRED
DisableableDepends = 10 (from children)
kd> p
JinSdDesigner!SdHostDispatchPnp+0xe4:
f821f77c 53 push ebx
kd> p

Please helping me in finding the problem based on this data.

Regards

Get the new Windows Live Messenger! Try it!http:

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</http:>

Hi All,
Thank you all for your help.

As you people suggested i issued those command

Followin is the result when i issued the command immediately after installing the driver

kd> !devnode 0 1 JinSdDesignerDumping IopRootDeviceNode (= 0x8136d808)DevNode 0x812ff350 for PDO 0x812ff928 InstancePath is “PCI\VEN_1947&DEV_4743&SUBSYS_44332211&REV_09\4&2af9ed5&0&00F0” ServiceName is “JinSdDesigner” State = DeviceNodeStarted (0x308) Previous State = DeviceNodeEnumerateCompletion (0x30d)
Following is the result when i tried to uninstall the driver

kd> !devnode 0 1 JinSdDesignerDumping IopRootDeviceNode (= 0x8136d808)DevNode 0x812ff350 for PDO 0x812ff928 InstancePath is “PCI\VEN_1947&DEV_4743&SUBSYS_44332211&REV_09\4&2af9ed5&0&00F0” ServiceName is “JinSdDesigner” State = DeviceNodeQueryRemoved (0x310) Previous State = DeviceNodeStarted (0x308)kd> g
i am puzzled with this result how i will determine where the problem lies,and how i can find those problem based on this result i am not able to determine why the remove event is not getting signaled.

Your input will be very helpfull.

Regards

Subject: RE: [ntdev] Why Remove Event is not getting signaled while uninstalling the driverDate: Mon, 22 Oct 2007 13:17:55 -0400From: xxxxx@stratus.comTo: xxxxx@lists.osr.com

You have to perform !devnode on your device object?s devnodes. Read the windbg docs. Use !devnode 0 1 to enumerate all devnodes in the system. Then find yours. Then perform another !devnode on your devnode?s address.

From: xxxxx@lists.osr.com [mailto:xxxxx@lists.osr.com] On Behalf Of nayan kumarSent: Monday, October 22, 2007 12:19 PMTo: Windows System Software Devs Interest ListSubject: RE: [ntdev] Why Remove Event is not getting signaled while uninstalling the driver

Hi Mark, Thanks for your help.As u instructed i issued the !devnode command immediately before KeWaitForSingleObject and the resut i got it as followskd> !devnodeDumping IopRootDeviceNode (= 0x8136d808)DevNode 0x8136d808 for PDO 0x8136d940 Parent 0000000000 Sibling 0000000000 Child 0x8136d3f8 InstancePath is “HTREE\ROOT\0” State = DeviceNodeStarted (0x308) Previous State = DeviceNodeEnumerateCompletion (0x30d) StateHistory[04] = DeviceNodeEnumerateCompletion (0x30d) StateHistory[03] = DeviceNodeStarted (0x308) StateHistory[02] = DeviceNodeEnumerateCompletion (0x30d) StateHistory[01] = DeviceNodeStarted (0x308) StateHistory[00] = DeviceNodeUninitialized (0x301) StateHistory[19] = Unknown State (0x0) StateHistory[18] = Unknown State (0x0) StateHistory[17] = Unknown State (0x0) StateHistory[16] = Unknown State (0x0) StateHistory[15] = Unknown State (0x0) StateHistory[14] = Unknown State (0x0) StateHistory[13] = Unknown State (0x0) StateHistory[12] = Unknown State (0x0) StateHistory[11] = Unknown State (0x0) StateHistory[10] = Unknown State (0x0) StateHistory[09] = Unknown State (0x0) StateHistory[08] = Unknown State (0x0) StateHistory[07] = Unknown State (0x0) StateHistory[06] = Unknown State (0x0) StateHistory[05] = Unknown State (0x0) Flags (0x00000131) DNF_MADEUP, DNF_ENUMERATED, DNF_IDS_QUERIED, DNF_NO_RESOURCE_REQUIRED DisableableDepends = 10 (from children)kd> pJinSdDesigner!SdHostDispatchPnp+0xe4:f821f77c 53 push ebxkd> p Please helping me in finding the problem based on this data. Regards

Get the new Windows Live Messenger! Try it!— 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


Search from any Web page with powerful protection. Get the FREE Windows Live Toolbar Today!
http://toolbar.live.com/?mkt=en-in

Did you complete the query remove irp? Are there any filters in your device stack (!devstack )? Does the output of !locks tell you who owns the pnp lock currently?

d

From: xxxxx@lists.osr.com [mailto:xxxxx@lists.osr.com] On Behalf Of nayan kumar
Sent: Monday, October 22, 2007 12:00 PM
To: Windows System Software Devs Interest List
Subject: RE: [ntdev] Why Remove Event is not getting signaled while uninstalling the driver

Hi All,
Thank you all for your help.

As you people suggested i issued those command

Followin is the result when i issued the command immediately after installing the driver

kd> !devnode 0 1 JinSdDesigner
Dumping IopRootDeviceNode (= 0x8136d808)
DevNode 0x812ff350 for PDO 0x812ff928
InstancePath is “PCI\VEN_1947&DEV_4743&SUBSYS_44332211&REV_09\4&2af9ed5&0&00F0”
ServiceName is “JinSdDesigner”
State = DeviceNodeStarted (0x308)
Previous State = DeviceNodeEnumerateCompletion (0x30d)

Following is the result when i tried to uninstall the driver

kd> !devnode 0 1 JinSdDesigner
Dumping IopRootDeviceNode (= 0x8136d808)
DevNode 0x812ff350 for PDO 0x812ff928
InstancePath is “PCI\VEN_1947&DEV_4743&SUBSYS_44332211&REV_09\4&2af9ed5&0&00F0”
ServiceName is “JinSdDesigner”
State = DeviceNodeQueryRemoved (0x310)
Previous State = DeviceNodeStarted (0x308)
kd> g
i am puzzled with this result how i will determine where the problem lies,and how i can find those problem based on this result i am not able to determine why the remove event is not getting signaled.

Your input will be very helpfull.

Regards


Subject: RE: [ntdev] Why Remove Event is not getting signaled while uninstalling the driver
Date: Mon, 22 Oct 2007 13:17:55 -0400
From: xxxxx@stratus.com
To: xxxxx@lists.osr.com
You have to perform !devnode on your device object’s devnodes. Read the windbg docs. Use !devnode 0 1 to enumerate all devnodes in the system. Then find yours. Then perform another !devnode on your devnode’s address.


From: xxxxx@lists.osr.com [mailto:xxxxx@lists.osr.com] On Behalf Of nayan kumar
Sent: Monday, October 22, 2007 12:19 PM
To: Windows System Software Devs Interest List
Subject: RE: [ntdev] Why Remove Event is not getting signaled while uninstalling the driver

Hi Mark,
Thanks for your help.
As u instructed i issued the !devnode command immediately before KeWaitForSingleObject and the resut i got it as follows

kd> !devnode
Dumping IopRootDeviceNode (= 0x8136d808)
DevNode 0x8136d808 for PDO 0x8136d940
Parent 0000000000 Sibling 0000000000 Child 0x8136d3f8
InstancePath is “HTREE\ROOT\0”
State = DeviceNodeStarted (0x308)
Previous State = DeviceNodeEnumerateCompletion (0x30d)
StateHistory[04] = DeviceNodeEnumerateCompletion (0x30d)
StateHistory[03] = DeviceNodeStarted (0x308)
StateHistory[02] = DeviceNodeEnumerateCompletion (0x30d)
StateHistory[01] = DeviceNodeStarted (0x308)
StateHistory[00] = DeviceNodeUninitialized (0x301)
StateHistory[19] = Unknown State (0x0)
StateHistory[18] = Unknown State (0x0)
StateHistory[17] = Unknown State (0x0)
StateHistory[16] = Unknown State (0x0)
StateHistory[15] = Unknown State (0x0)
StateHistory[14] = Unknown State (0x0)
StateHistory[13] = Unknown State (0x0)
StateHistory[12] = Unknown State (0x0)
StateHistory[11] = Unknown State (0x0)
StateHistory[10] = Unknown State (0x0)
StateHistory[09] = Unknown State (0x0)
StateHistory[08] = Unknown State (0x0)
StateHistory[07] = Unknown State (0x0)
StateHistory[06] = Unknown State (0x0)
StateHistory[05] = Unknown State (0x0)
Flags (0x00000131) DNF_MADEUP, DNF_ENUMERATED,
DNF_IDS_QUERIED, DNF_NO_RESOURCE_REQUIRED
DisableableDepends = 10 (from children)
kd> p
JinSdDesigner!SdHostDispatchPnp+0xe4:
f821f77c 53 push ebx
kd> p

Please helping me in finding the problem based on this data.

Regards

Get the new Windows Live Messenger! Try it!http:

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


Search from any Web page with powerful protection. Get the FREE Windows Live Toolbar Today! Try it now!http:

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</http:></http:>

This is a great case study for why new drivers should be implemented
using KMDF rather than WDM. Most likely the OP has mishandled query
remove processing, and with KMDF he would have to go out of his way to
get that to happen.

One small note, !devnode on an explicit devnode address provides more
information than the global enumeration with filter does.


From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com] On Behalf Of Doron Holan
Sent: Monday, October 22, 2007 3:54 PM
To: Windows System Software Devs Interest List
Subject: RE: [ntdev] Why Remove Event is not getting signaled while
uninstalling the driver

Did you complete the query remove irp? Are there any filters in your
device stack (!devstack )? Does the output of
!locks tell you who owns the pnp lock currently?

d

From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com] On Behalf Of nayan kumar
Sent: Monday, October 22, 2007 12:00 PM
To: Windows System Software Devs Interest List
Subject: RE: [ntdev] Why Remove Event is not getting signaled while
uninstalling the driver

Hi All,
Thank you all for your help.

As you people suggested i issued those command

Followin is the result when i issued the command immediately after
installing the driver

kd> !devnode 0 1 JinSdDesigner
Dumping IopRootDeviceNode (= 0x8136d808)
DevNode 0x812ff350 for PDO 0x812ff928
InstancePath is
“PCI\VEN_1947&DEV_4743&SUBSYS_44332211&REV_09\4&2af9ed5&0&00F0”
ServiceName is “JinSdDesigner”
State = DeviceNodeStarted (0x308)
Previous State = DeviceNodeEnumerateCompletion (0x30d)

Following is the result when i tried to uninstall the driver

kd> !devnode 0 1 JinSdDesigner
Dumping IopRootDeviceNode (= 0x8136d808)
DevNode 0x812ff350 for PDO 0x812ff928
InstancePath is
“PCI\VEN_1947&DEV_4743&SUBSYS_44332211&REV_09\4&2af9ed5&0&00F0”
ServiceName is “JinSdDesigner”
State = DeviceNodeQueryRemoved (0x310)
Previous State = DeviceNodeStarted (0x308)
kd> g
i am puzzled with this result how i will determine where the problem
lies,and how i can find those problem based on this result i am not able
to determine why the remove event is not getting signaled.

Your input will be very helpfull.

Regards



Subject: RE: [ntdev] Why Remove Event is not getting signaled while
uninstalling the driver
Date: Mon, 22 Oct 2007 13:17:55 -0400
From: xxxxx@stratus.com
To: xxxxx@lists.osr.com

You have to perform !devnode on your device object’s devnodes. Read the
windbg docs. Use !devnode 0 1 to enumerate all devnodes in the system.
Then find yours. Then perform another !devnode on your devnode’s
address.



From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com] On Behalf Of nayan kumar
Sent: Monday, October 22, 2007 12:19 PM
To: Windows System Software Devs Interest List
Subject: RE: [ntdev] Why Remove Event is not getting signaled while
uninstalling the driver

Hi Mark,
Thanks for your help.
As u instructed i issued the !devnode command immediately before
KeWaitForSingleObject and the resut i got it as follows

kd> !devnode
Dumping IopRootDeviceNode (= 0x8136d808)
DevNode 0x8136d808 for PDO 0x8136d940
Parent 0000000000 Sibling 0000000000 Child 0x8136d3f8
InstancePath is “HTREE\ROOT\0”
State = DeviceNodeStarted (0x308)
Previous State = DeviceNodeEnumerateCompletion (0x30d)
StateHistory[04] = DeviceNodeEnumerateCompletion (0x30d)
StateHistory[03] = DeviceNodeStarted (0x308)
StateHistory[02] = DeviceNodeEnumerateCompletion (0x30d)
StateHistory[01] = DeviceNodeStarted (0x308)
StateHistory[00] = DeviceNodeUninitialized (0x301)
StateHistory[19] = Unknown State (0x0)
StateHistory[18] = Unknown State (0x0)
StateHistory[17] = Unknown State (0x0)
StateHistory[16] = Unknown State (0x0)
StateHistory[15] = Unknown State (0x0)
StateHistory[14] = Unknown State (0x0)
StateHistory[13] = Unknown State (0x0)
StateHistory[12] = Unknown State (0x0)
StateHistory[11] = Unknown State (0x0)
StateHistory[10] = Unknown State (0x0)
StateHistory[09] = Unknown State (0x0)
StateHistory[08] = Unknown State (0x0)
StateHistory[07] = Unknown State (0x0)
StateHistory[06] = Unknown State (0x0)
StateHistory[05] = Unknown State (0x0)
Flags (0x00000131) DNF_MADEUP, DNF_ENUMERATED,
DNF_IDS_QUERIED, DNF_NO_RESOURCE_REQUIRED
DisableableDepends = 10 (from children)
kd> p
JinSdDesigner!SdHostDispatchPnp+0xe4:
f821f77c 53 push ebx
kd> p

Please helping me in finding the problem based on this data.

Regards



Get the new Windows Live Messenger! Try it!
http:

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



Search from any Web page with powerful protection. Get the FREE Windows
Live Toolbar Today! Try it now! http:

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</http:></http:>

Hi,
Thanks for your input.

I am modifiying the toaster func featured 2 code according to my requirment.

According to me yes i am completing the query remove irp but possibility of doing something wrong is always there .
following is the code please point out if i am doing anything wrong .
case IRP_MN_QUERY_REMOVE_DEVICE:
status = SdHostCanRemoveDevice(pDeviceObject, pIrp);
if (NT_SUCCESS(status))
{
SET_NEW_PNP_STATE(pSdHostFdoData, SdHostRemovePending);
pSdHostFdoData->SdHostQueueState = HoldRequests;
ToasterDisarmWake(pSdHostFdoData, TRUE);
KeWaitForSingleObject(
&pSdHostFdoData->StopEvent,
Executive,
KernelMode,
FALSE,
NULL);
pIrp->IoStatus.Status = STATUS_SUCCESS;
IoSkipCurrentIrpStackLocation (pIrp);
status = IoCallDriver (pSdHostFdoData->NextLowerDriver, pIrp);
return status;
}
break;

There is no any filter in my device stack;

Following is the detailed output of devnod and locks command that i issued when uninstallationpreocess halted in the midle.
Although i am able to see the warning in these detailed ouput of these command but i am unable to locate the problem in my code if you can help me in locating the problem i would be very thankfull to you.

kd> !devnode 0 1 JinSdDesignerDumping IopRootDeviceNode (= 0x8136d808)DevNode 0x812ff350 for PDO 0x812ff928 InstancePath is “PCI\VEN_1947&DEV_4743&SUBSYS_44332211&REV_09\4&2af9ed5&0&00F0” ServiceName is “JinSdDesigner” State = DeviceNodeQueryRemoved (0x310) Previous State = DeviceNodeStarted (0x308)
kd> !locks**** DUMP OF ALL RESOURCE OBJECTS ****KD: Scanning for held locks…
Resource @ nt!IopDeviceTreeLock (0x805586e0) Shared 1 owning threads Contention Count = 1 Threads: 81348da8-01<*> KD: Scanning for held locks.
Resource @ nt!PiEngineLock (0x80558660) Exclusively owned Contention Count = 3 Threads: 81348da8-01<*> KD: Scanning for held locks…
Resource @ 0xfeb10980 Shared 1 owning threads Threads: 8134a473-01<*> *** Actual Thread 8134a4702818 total locks, 3 locks currently held
kd> !locks -v 0x805586e0
Resource @ nt!IopDeviceTreeLock (0x805586e0) Shared 1 owning threads Contention Count = 1 Threads: 81348da8-01<*>
THREAD 81348da8 Cid 0004.0034 Teb: 00000000 Win32Thread: 00000000 WAIT: (Executive) KernelMode Non-Alertable 81251400 SynchronizationEvent IRP List: fe9a8e28: (0006,01d8) Flags: 00000000 Mdl: 00000000 Not impersonating DeviceMap e1000090 Owning Process 8134a020 Image: System Wait Start TickCount 185997 Ticks: 769 (0:00:00:12.015) Context Switch Count 4810 UserTime 00:00:00.0000 KernelTime 00:00:01.0687 Start Address nt!ExpWorkerThread (0x804e4196) Stack Init f9716000 Current f9715b28 Base f9716000 Limit f9713000 Call 0 Priority 12 BasePriority 12 PriorityDecrement 0 DecrementCount 16 ChildEBP RetAddr f9715b40 804dc0f7 nt!KiSwapContext+0x2e (FPO: [EBP 0xf9715b74] [0,0,4]) f9715b4c 804dc143 nt!KiSwapThread+0x46 (FPO: [0,0,0]) f9715b74 f23a278a nt!KeWaitForSingleObject+0x1c2 (FPO: [Non-Fpo])WARNING: Stack unwind information not available. Following frames may be wrong. f9715b9c 804e37f7 JinSdDesigner+0x578a f9715bac 805dc5ff nt!IopfCallDriver+0x31 (FPO: [0,0,0]) f9715bd8 8061a94e nt!IopSynchronousCall+0xb7 (FPO: [Non-Fpo]) f9715c2c 805314d1 nt!IopRemoveDevice+0x93 (FPO: [Non-Fpo]) f9715c54 8061bac3 nt!IopRemoveLockedDeviceNode+0x160 (FPO: [Non-Fpo]) f9715c6c 8061bb2f nt!IopDeleteLockedDeviceNode+0x34 (FPO: [Non-Fpo]) f9715ca0 8061d8f6 nt!IopDeleteLockedDeviceNodes+0x3f (FPO: [Non-Fpo]) f9715d34 805ec82d nt!PiProcessQueryRemoveAndEject+0x76b (FPO: [Non-Fpo]) f9715d50 8059fbb1 nt!PiProcessTargetDeviceEvent+0x2a (FPO: [Non-Fpo]) f9715d74 804e426b nt!PiWalkDeviceList+0x122 (FPO: [Non-Fpo]) f9715dac 8057d0f1 nt!ExpWorkerThread+0x100 (FPO: [Non-Fpo]) f9715ddc 804f827a nt!PspSystemThreadStartup+0x34 (FPO: [Non-Fpo]) 00000000 00000000 nt!KiThreadStartup+0x16
1 total locks, 1 locks currently held
kd> !locks -v 0x80558660
Resource @ nt!PiEngineLock (0x80558660) Exclusively owned Contention Count = 3 Threads: 81348da8-01<*>
THREAD 81348da8 Cid 0004.0034 Teb: 00000000 Win32Thread: 00000000 WAIT: (Executive) KernelMode Non-Alertable 81251400 SynchronizationEvent IRP List: fe9a8e28: (0006,01d8) Flags: 00000000 Mdl: 00000000 Not impersonating DeviceMap e1000090 Owning Process 8134a020 Image: System Wait Start TickCount 185997 Ticks: 769 (0:00:00:12.015) Context Switch Count 4810 UserTime 00:00:00.0000 KernelTime 00:00:01.0687 Start Address nt!ExpWorkerThread (0x804e4196) Stack Init f9716000 Current f9715b28 Base f9716000 Limit f9713000 Call 0 Priority 12 BasePriority 12 PriorityDecrement 0 DecrementCount 16 ChildEBP RetAddr f9715b40 804dc0f7 nt!KiSwapContext+0x2e (FPO: [EBP 0xf9715b74] [0,0,4]) f9715b4c 804dc143 nt!KiSwapThread+0x46 (FPO: [0,0,0]) f9715b74 f23a278a nt!KeWaitForSingleObject+0x1c2 (FPO: [Non-Fpo])WARNING: Stack unwind information not available. Following frames may be wrong. f9715b9c 804e37f7 JinSdDesigner+0x578a f9715bac 805dc5ff nt!IopfCallDriver+0x31 (FPO: [0,0,0]) f9715bd8 8061a94e nt!IopSynchronousCall+0xb7 (FPO: [Non-Fpo]) f9715c2c 805314d1 nt!IopRemoveDevice+0x93 (FPO: [Non-Fpo]) f9715c54 8061bac3 nt!IopRemoveLockedDeviceNode+0x160 (FPO: [Non-Fpo]) f9715c6c 8061bb2f nt!IopDeleteLockedDeviceNode+0x34 (FPO: [Non-Fpo]) f9715ca0 8061d8f6 nt!IopDeleteLockedDeviceNodes+0x3f (FPO: [Non-Fpo]) f9715d34 805ec82d nt!PiProcessQueryRemoveAndEject+0x76b (FPO: [Non-Fpo]) f9715d50 8059fbb1 nt!PiProcessTargetDeviceEvent+0x2a (FPO: [Non-Fpo]) f9715d74 804e426b nt!PiWalkDeviceList+0x122 (FPO: [Non-Fpo]) f9715dac 8057d0f1 nt!ExpWorkerThread+0x100 (FPO: [Non-Fpo]) f9715ddc 804f827a nt!PspSystemThreadStartup+0x34 (FPO: [Non-Fpo]) 00000000 00000000 nt!KiThreadStartup+0x16
1 total locks, 1 locks currently held
kd> !locks -v feb10980
Resource @ 0xfeb10980 Shared 1 owning threads Threads: 8134a473-01<*> *** Actual Thread 8134a470
THREAD 8134a470 Cid 0004.0014 Teb: 00000000 Win32Thread: 00000000 WAIT: (WrQueue) UserMode Non-Alertable 80561640 Unknown Not impersonating DeviceMap e1000090 Owning Process 8134a020 Image: System Wait Start TickCount 186763 Ticks: 3 (0:00:00:00.046) Context Switch Count 5332 UserTime 00:00:00.0000 KernelTime 00:00:01.0140 Start Address nt!ExpWorkerThread (0x804e4196) Stack Init f96f6000 Current f96f5d1c Base f96f6000 Limit f96f3000 Call 0 Priority 13 BasePriority 13 PriorityDecrement 0 DecrementCount 16 ChildEBP RetAddr f96f5d34 804dc0f7 nt!KiSwapContext+0x2e (FPO: [EBP 0xf96f5d6c] [0,0,4]) f96f5d40 804e407e nt!KiSwapThread+0x46 (FPO: [0,0,0]) f96f5d6c 804e423d nt!KeRemoveQueue+0x20e (FPO: [Non-Fpo]) f96f5dac 8057d0f1 nt!ExpWorkerThread+0xd6 (FPO: [Non-Fpo]) f96f5ddc 804f827a nt!PspSystemThreadStartup+0x34 (FPO: [Non-Fpo]) 00000000 00000000 nt!KiThreadStartup+0x16
1 total locks, 1 locks currently held

Regards


Call friends with PC-to-PC calling – FREE
http://get.live.com/messenger/overview

The answer is in the output you gave, look at your query remove code (you wait for an event) and then look at the output of !locks -v. do you see your code in the stack blocking, waiting for the event? You are never completing the q.r. irp. I strongly suggest you rewrite using KMDF, all of these issues will go away.

kd> !locks -v 0x805586e0
Resource @ nt!IopDeviceTreeLock (0x805586e0) Shared 1 owning threads
Contention Count = 1
Threads: 81348da8-01<*>
THREAD 81348da8 Cid 0004.0034 Teb: 00000000 Win32Thread: 00000000 WAIT: (Executive) KernelMode Non-Alertable
81251400 SynchronizationEvent
IRP List:
fe9a8e28: (0006,01d8) Flags: 00000000 Mdl: 00000000
Not impersonating
DeviceMap e1000090
Owning Process 8134a020 Image: System
Wait Start TickCount 185997 Ticks: 769 (0:00:00:12.015)
Context Switch Count 4810
UserTime 00:00:00.0000
KernelTime 00:00:01.0687
Start Address nt!ExpWorkerThread (0x804e4196)
Stack Init f9716000 Current f9715b28 Base f9716000 Limit f9713000 Call 0
Priority 12 BasePriority 12 PriorityDecrement 0 DecrementCount 16
ChildEBP RetAddr
f9715b40 804dc0f7 nt!KiSwapContext+0x2e (FPO: [EBP 0xf9715b74] [0,0,4])
f9715b4c 804dc143 nt!KiSwapThread+0x46 (FPO: [0,0,0])
f9715b74 f23a278a nt!KeWaitForSingleObject+0x1c2 (FPO: [Non-Fpo])
WARNING: Stack unwind information not available. Following frames may be wrong.
f9715b9c 804e37f7 JinSdDesigner+0x578a <== right here!!! <==
f9715bac 805dc5ff nt!IopfCallDriver+0x31 (FPO: [0,0,0])
f9715bd8 8061a94e nt!IopSynchronousCall+0xb7 (FPO: [Non-Fpo])
f9715c2c 805314d1 nt!IopRemoveDevice+0x93 (FPO: [Non-Fpo])
f9715c54 8061bac3 nt!IopRemoveLockedDeviceNode+0x160 (FPO: [Non-Fpo])
f9715c6c 8061bb2f nt!IopDeleteLockedDeviceNode+0x34 (FPO: [Non-Fpo])
f9715ca0 8061d8f6 nt!IopDeleteLockedDeviceNodes+0x3f (FPO: [Non-Fpo])
f9715d34 805ec82d nt!PiProcessQueryRemoveAndEject+0x76b (FPO: [Non-Fpo])
f9715d50 8059fbb1 nt!PiProcessTargetDeviceEvent+0x2a (FPO: [Non-Fpo])
f9715d74 804e426b nt!PiWalkDeviceList+0x122 (FPO: [Non-Fpo])
f9715dac 8057d0f1 nt!ExpWorkerThread+0x100 (FPO: [Non-Fpo])
f9715ddc 804f827a nt!PspSystemThreadStartup+0x34 (FPO: [Non-Fpo])
00000000 00000000 nt!KiThreadStartup+0x16

From: xxxxx@lists.osr.com [mailto:xxxxx@lists.osr.com] On Behalf Of nayan kumar
Sent: Monday, October 22, 2007 4:05 PM
To: Windows System Software Devs Interest List
Subject: RE: [ntdev] Why Remove Event is not getting signaled while uninstalling the driver

Hi,
Thanks for your input.

I am modifiying the toaster func featured 2 code according to my requirment.

According to me yes i am completing the query remove irp but possibility of doing something wrong is always there .
following is the code please point out if i am doing anything wrong .

case IRP_MN_QUERY_REMOVE_DEVICE:
status = SdHostCanRemoveDevice(pDeviceObject, pIrp);
if (NT_SUCCESS(status))
{
SET_NEW_PNP_STATE(pSdHostFdoData, SdHostRemovePending);
pSdHostFdoData->SdHostQueueState = HoldRequests;
ToasterDisarmWake(pSdHostFdoData, TRUE);
KeWaitForSingleObject(
&pSdHostFdoData->StopEvent,
Executive,
KernelMode,
FALSE,
NULL);
pIrp->IoStatus.Status = STATUS_SUCCESS;
IoSkipCurrentIrpStackLocation (pIrp);
status = IoCallDriver (pSdHostFdoData->NextLowerDriver, pIrp);
return status;
}
break;

There is no any filter in my device stack;

Following is the detailed output of devnod and locks command that i issued when uninstallationpreocess halted in the midle.
Although i am able to see the warning in these detailed ouput of these command but i am unable to locate the problem in my code if you can help me in locating the problem i would be very thankfull to you.

kd> !devnode 0 1 JinSdDesigner
Dumping IopRootDeviceNode (= 0x8136d808)
DevNode 0x812ff350 for PDO 0x812ff928
InstancePath is “PCI\VEN_1947&DEV_4743&SUBSYS_44332211&REV_09\4&2af9ed5&0&00F0”
ServiceName is “JinSdDesigner”
State = DeviceNodeQueryRemoved (0x310)
Previous State = DeviceNodeStarted (0x308)
kd> !locks
**** DUMP OF ALL RESOURCE OBJECTS ****
KD: Scanning for held locks…
Resource @ nt!IopDeviceTreeLock (0x805586e0) Shared 1 owning threads
Contention Count = 1
Threads: 81348da8-01<*>
KD: Scanning for held locks.
Resource @ nt!PiEngineLock (0x80558660) Exclusively owned
Contention Count = 3
Threads: 81348da8-01<*>
KD: Scanning for held locks…
Resource @ 0xfeb10980 Shared 1 owning threads
Threads: 8134a473-01<*> *** Actual Thread 8134a470
2818 total locks, 3 locks currently held

kd> !locks -v 0x805586e0
Resource @ nt!IopDeviceTreeLock (0x805586e0) Shared 1 owning threads
Contention Count = 1
Threads: 81348da8-01<*>
THREAD 81348da8 Cid 0004.0034 Teb: 00000000 Win32Thread: 00000000 WAIT: (Executive) KernelMode Non-Alertable
81251400 SynchronizationEvent
IRP List:
fe9a8e28: (0006,01d8) Flags: 00000000 Mdl: 00000000
Not impersonating
DeviceMap e1000090
Owning Process 8134a020 Image: System
Wait Start TickCount 185997 Ticks: 769 (0:00:00:12.015)
Context Switch Count 4810
UserTime 00:00:00.0000
KernelTime 00:00:01.0687
Start Address nt!ExpWorkerThread (0x804e4196)
Stack Init f9716000 Current f9715b28 Base f9716000 Limit f9713000 Call 0
Priority 12 BasePriority 12 PriorityDecrement 0 DecrementCount 16
ChildEBP RetAddr
f9715b40 804dc0f7 nt!KiSwapContext+0x2e (FPO: [EBP 0xf9715b74] [0,0,4])
f9715b4c 804dc143 nt!KiSwapThread+0x46 (FPO: [0,0,0])
f9715b74 f23a278a nt!KeWaitForSingleObject+0x1c2 (FPO: [Non-Fpo])
WARNING: Stack unwind information not available. Following frames may be wrong.
f9715b9c 804e37f7 JinSdDesigner+0x578a
f9715bac 805dc5ff nt!IopfCallDriver+0x31 (FPO: [0,0,0])
f9715bd8 8061a94e nt!IopSynchronousCall+0xb7 (FPO: [Non-Fpo])
f9715c2c 805314d1 nt!IopRemoveDevice+0x93 (FPO: [Non-Fpo])
f9715c54 8061bac3 nt!IopRemoveLockedDeviceNode+0x160 (FPO: [Non-Fpo])
f9715c6c 8061bb2f nt!IopDeleteLockedDeviceNode+0x34 (FPO: [Non-Fpo])
f9715ca0 8061d8f6 nt!IopDeleteLockedDeviceNodes+0x3f (FPO: [Non-Fpo])
f9715d34 805ec82d nt!PiProcessQueryRemoveAndEject+0x76b (FPO: [Non-Fpo])
f9715d50 8059fbb1 nt!PiProcessTargetDeviceEvent+0x2a (FPO: [Non-Fpo])
f9715d74 804e426b nt!PiWalkDeviceList+0x122 (FPO: [Non-Fpo])
f9715dac 8057d0f1 nt!ExpWorkerThread+0x100 (FPO: [Non-Fpo])
f9715ddc 804f827a nt!PspSystemThreadStartup+0x34 (FPO: [Non-Fpo])
00000000 00000000 nt!KiThreadStartup+0x16

1 total locks, 1 locks currently held

kd> !locks -v 0x80558660
Resource @ nt!PiEngineLock (0x80558660) Exclusively owned
Contention Count = 3
Threads: 81348da8-01<*>
THREAD 81348da8 Cid 0004.0034 Teb: 00000000 Win32Thread: 00000000 WAIT: (Executive) KernelMode Non-Alertable
81251400 SynchronizationEvent
IRP List:
fe9a8e28: (0006,01d8) Flags: 00000000 Mdl: 00000000
Not impersonating
DeviceMap e1000090
Owning Process 8134a020 Image: System
Wait Start TickCount 185997 Ticks: 769 (0:00:00:12.015)
Context Switch Count 4810
UserTime 00:00:00.0000
KernelTime 00:00:01.0687
Start Address nt!ExpWorkerThread (0x804e4196)
Stack Init f9716000 Current f9715b28 Base f9716000 Limit f9713000 Call 0
Priority 12 BasePriority 12 PriorityDecrement 0 DecrementCount 16
ChildEBP RetAddr
f9715b40 804dc0f7 nt!KiSwapContext+0x2e (FPO: [EBP 0xf9715b74] [0,0,4])
f9715b4c 804dc143 nt!KiSwapThread+0x46 (FPO: [0,0,0])
f9715b74 f23a278a nt!KeWaitForSingleObject+0x1c2 (FPO: [Non-Fpo])
WARNING: Stack unwind information not available. Following frames may be wrong.
f9715b9c 804e37f7 JinSdDesigner+0x578a
f9715bac 805dc5ff nt!IopfCallDriver+0x31 (FPO: [0,0,0])
f9715bd8 8061a94e nt!IopSynchronousCall+0xb7 (FPO: [Non-Fpo])
f9715c2c 805314d1 nt!IopRemoveDevice+0x93 (FPO: [Non-Fpo])
f9715c54 8061bac3 nt!IopRemoveLockedDeviceNode+0x160 (FPO: [Non-Fpo])
f9715c6c 8061bb2f nt!IopDeleteLockedDeviceNode+0x34 (FPO: [Non-Fpo])
f9715ca0 8061d8f6 nt!IopDeleteLockedDeviceNodes+0x3f (FPO: [Non-Fpo])
f9715d34 805ec82d nt!PiProcessQueryRemoveAndEject+0x76b (FPO: [Non-Fpo])
f9715d50 8059fbb1 nt!PiProcessTargetDeviceEvent+0x2a (FPO: [Non-Fpo])
f9715d74 804e426b nt!PiWalkDeviceList+0x122 (FPO: [Non-Fpo])
f9715dac 8057d0f1 nt!ExpWorkerThread+0x100 (FPO: [Non-Fpo])
f9715ddc 804f827a nt!PspSystemThreadStartup+0x34 (FPO: [Non-Fpo])
00000000 00000000 nt!KiThreadStartup+0x16

1 total locks, 1 locks currently held

kd> !locks -v feb10980
Resource @ 0xfeb10980 Shared 1 owning threads
Threads: 8134a473-01<*> *** Actual Thread 8134a470
THREAD 8134a470 Cid 0004.0014 Teb: 00000000 Win32Thread: 00000000 WAIT: (WrQueue) UserMode Non-Alertable
80561640 Unknown
Not impersonating
DeviceMap e1000090
Owning Process 8134a020 Image: System
Wait Start TickCount 186763 Ticks: 3 (0:00:00:00.046)
Context Switch Count 5332
UserTime 00:00:00.0000
KernelTime 00:00:01.0140
Start Address nt!ExpWorkerThread (0x804e4196)
Stack Init f96f6000 Current f96f5d1c Base f96f6000 Limit f96f3000 Call 0
Priority 13 BasePriority 13 PriorityDecrement 0 DecrementCount 16
ChildEBP RetAddr
f96f5d34 804dc0f7 nt!KiSwapContext+0x2e (FPO: [EBP 0xf96f5d6c] [0,0,4])
f96f5d40 804e407e nt!KiSwapThread+0x46 (FPO: [0,0,0])
f96f5d6c 804e423d nt!KeRemoveQueue+0x20e (FPO: [Non-Fpo])
f96f5dac 8057d0f1 nt!ExpWorkerThread+0xd6 (FPO: [Non-Fpo])
f96f5ddc 804f827a nt!PspSystemThreadStartup+0x34 (FPO: [Non-Fpo])
00000000 00000000 nt!KiThreadStartup+0x16

1 total locks, 1 locks currently held

Regards


Call friends with PC-to-PC calling – FREE Try it now!http:

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</http:>

Hi Doron,
Thank you ver much for your help i will proceed further as you suggested.

Regards

From: xxxxx@microsoft.comTo: xxxxx@lists.osr.comDate: Mon, 22 Oct 2007 16:18:45 -0700Subject: RE: [ntdev] Why Remove Event is not getting signaled while uninstalling the driver

The answer is in the output you gave, look at your query remove code (you wait for an event) and then look at the output of !locks ?v. do you see your code in the stack blocking, waiting for the event? You are never completing the q.r. irp. I strongly suggest you rewrite using KMDF, all of these issues will go away.

kd> !locks -v 0x805586e0Resource @ nt!IopDeviceTreeLock (0x805586e0) Shared 1 owning threads Contention Count = 1 Threads: 81348da8-01<*> THREAD 81348da8 Cid 0004.0034 Teb: 00000000 Win32Thread: 00000000 WAIT: (Executive) KernelMode Non-Alertable 81251400 SynchronizationEvent IRP List: fe9a8e28: (0006,01d8) Flags: 00000000 Mdl: 00000000 Not impersonating DeviceMap e1000090 Owning Process 8134a020 Image: System Wait Start TickCount 185997 Ticks: 769 (0:00:00:12.015) Context Switch Count 4810 UserTime 00:00:00.0000 KernelTime 00:00:01.0687 Start Address nt!ExpWorkerThread (0x804e4196) Stack Init f9716000 Current f9715b28 Base f9716000 Limit f9713000 Call 0 Priority 12 BasePriority 12 PriorityDecrement 0 DecrementCount 16 ChildEBP RetAddr f9715b40 804dc0f7 nt!KiSwapContext+0x2e (FPO: [EBP 0xf9715b74] [0,0,4]) f9715b4c 804dc143 nt!KiSwapThread+0x46 (FPO: [0,0,0]) f9715b74 f23a278a nt!KeWaitForSingleObject+0x1c2 (FPO: [Non-Fpo])WARNING: Stack unwind information not available. Following frames may be wrong. f9715b9c 804e37f7 JinSdDesigner+0x578a ? right here!!! ? f9715bac 805dc5ff nt!IopfCallDriver+0x31 (FPO: [0,0,0]) f9715bd8 8061a94e nt!IopSynchronousCall+0xb7 (FPO: [Non-Fpo]) f9715c2c 805314d1 nt!IopRemoveDevice+0x93 (FPO: [Non-Fpo]) f9715c54 8061bac3 nt!IopRemoveLockedDeviceNode+0x160 (FPO: [Non-Fpo]) f9715c6c 8061bb2f nt!IopDeleteLockedDeviceNode+0x34 (FPO: [Non-Fpo]) f9715ca0 8061d8f6 nt!IopDeleteLockedDeviceNodes+0x3f (FPO: [Non-Fpo]) f9715d34 805ec82d nt!PiProcessQueryRemoveAndEject+0x76b (FPO: [Non-Fpo]) f9715d50 8059fbb1 nt!PiProcessTargetDeviceEvent+0x2a (FPO: [Non-Fpo]) f9715d74 804e426b nt!PiWalkDeviceList+0x122 (FPO: [Non-Fpo]) f9715dac 8057d0f1 nt!ExpWorkerThread+0x100 (FPO: [Non-Fpo]) f9715ddc 804f827a nt!PspSystemThreadStartup+0x34 (FPO: [Non-Fpo]) 00000000 00000000 nt!KiThreadStartup+0x16

From: xxxxx@lists.osr.com [mailto:xxxxx@lists.osr.com] On Behalf Of nayan kumarSent: Monday, October 22, 2007 4:05 PMTo: Windows System Software Devs Interest ListSubject: RE: [ntdev] Why Remove Event is not getting signaled while uninstalling the driver

Hi, Thanks for your input. I am modifiying the toaster func featured 2 code according to my requirment. According to me yes i am completing the query remove irp but possibility of doing something wrong is always there .following is the code please point out if i am doing anything wrong .case IRP_MN_QUERY_REMOVE_DEVICE:status = SdHostCanRemoveDevice(pDeviceObject, pIrp);if (NT_SUCCESS(status)){SET_NEW_PNP_STATE(pSdHostFdoData, SdHostRemovePending);pSdHostFdoData->SdHostQueueState = HoldRequests;ToasterDisarmWake(pSdHostFdoData, TRUE);KeWaitForSingleObject(&pSdHostFdoData->StopEvent,Executive,KernelMode,FALSE,NULL);pIrp->IoStatus.Status = STATUS_SUCCESS;IoSkipCurrentIrpStackLocation (pIrp);status = IoCallDriver (pSdHostFdoData->NextLowerDriver, pIrp);return status;}break; There is no any filter in my device stack; Following is the detailed output of devnod and locks command that i issued when uninstallationpreocess halted in the midle.Although i am able to see the warning in these detailed ouput of these command but i am unable to locate the problem in my code if you can help me in locating the problem i would be very thankfull to you. kd> !devnode 0 1 JinSdDesignerDumping IopRootDeviceNode (= 0x8136d808)DevNode 0x812ff350 for PDO 0x812ff928 InstancePath is “PCI\VEN_1947&DEV_4743&SUBSYS_44332211&REV_09\4&2af9ed5&0&00F0” ServiceName is “JinSdDesigner” State = DeviceNodeQueryRemoved (0x310) Previous State = DeviceNodeStarted (0x308)kd> !locks**** DUMP OF ALL RESOURCE OBJECTS ****KD: Scanning for held locks…Resource @ nt!IopDeviceTreeLock (0x805586e0) Shared 1 owning threads Contention Count = 1 Threads: 81348da8-01<*> KD: Scanning for held locks.Resource @ nt!PiEngineLock (0x80558660) Exclusively owned Contention Count = 3 Threads: 81348da8-01<*> KD: Scanning for held locks…Resource @ 0xfeb10980 Shared 1 owning threads Threads: 8134a473-01<*> *** Actual Thread 8134a4702818 total locks, 3 locks currently heldkd> !locks -v 0x805586e0Resource @ nt!IopDeviceTreeLock (0x805586e0) Shared 1 owning threads Contention Count = 1 Threads: 81348da8-01<*> THREAD 81348da8 Cid 0004.0034 Teb: 00000000 Win32Thread: 00000000 WAIT: (Executive) KernelMode Non-Alertable 81251400 SynchronizationEvent IRP List: fe9a8e28: (0006,01d8) Flags: 00000000 Mdl: 00000000 Not impersonating DeviceMap e1000090 Owning Process 8134a020 Image: System Wait Start TickCount 185997 Ticks: 769 (0:00:00:12.015) Context Switch Count 4810 UserTime 00:00:00.0000 KernelTime 00:00:01.0687 Start Address nt!ExpWorkerThread (0x804e4196) Stack Init f9716000 Current f9715b28 Base f9716000 Limit f9713000 Call 0 Priority 12 BasePriority 12 PriorityDecrement 0 DecrementCount 16 ChildEBP RetAddr f9715b40 804dc0f7 nt!KiSwapContext+0x2e (FPO: [EBP 0xf9715b74] [0,0,4]) f9715b4c 804dc143 nt!KiSwapThread+0x46 (FPO: [0,0,0]) f9715b74 f23a278a nt!KeWaitForSingleObject+0x1c2 (FPO: [Non-Fpo])WARNING: Stack unwind information not available. Following frames may be wrong. f9715b9c 804e37f7 JinSdDesigner+0x578a f9715bac 805dc5ff nt!IopfCallDriver+0x31 (FPO: [0,0,0]) f9715bd8 8061a94e nt!IopSynchronousCall+0xb7 (FPO: [Non-Fpo]) f9715c2c 805314d1 nt!IopRemoveDevice+0x93 (FPO: [Non-Fpo]) f9715c54 8061bac3 nt!IopRemoveLockedDeviceNode+0x160 (FPO: [Non-Fpo]) f9715c6c 8061bb2f nt!IopDeleteLockedDeviceNode+0x34 (FPO: [Non-Fpo]) f9715ca0 8061d8f6 nt!IopDeleteLockedDeviceNodes+0x3f (FPO: [Non-Fpo]) f9715d34 805ec82d nt!PiProcessQueryRemoveAndEject+0x76b (FPO: [Non-Fpo]) f9715d50 8059fbb1 nt!PiProcessTargetDeviceEvent+0x2a (FPO: [Non-Fpo]) f9715d74 804e426b nt!PiWalkDeviceList+0x122 (FPO: [Non-Fpo]) f9715dac 8057d0f1 nt!ExpWorkerThread+0x100 (FPO: [Non-Fpo]) f9715ddc 804f827a nt!PspSystemThreadStartup+0x34 (FPO: [Non-Fpo]) 00000000 00000000 nt!KiThreadStartup+0x161 total locks, 1 locks currently heldkd> !locks -v 0x80558660Resource @ nt!PiEngineLock (0x80558660) Exclusively owned Contention Count = 3 Threads: 81348da8-01<*> THREAD 81348da8 Cid 0004.0034 Teb: 00000000 Win32Thread: 00000000 WAIT: (Executive) KernelMode Non-Alertable 81251400 SynchronizationEvent IRP List: fe9a8e28: (0006,01d8) Flags: 00000000 Mdl: 00000000 Not impersonating DeviceMap e1000090 Owning Process 8134a020 Image: System Wait Start TickCount 185997 Ticks: 769 (0:00:00:12.015) Context Switch Count 4810 UserTime 00:00:00.0000 KernelTime 00:00:01.0687 Start Address nt!ExpWorkerThread (0x804e4196) Stack Init f9716000 Current f9715b28 Base f9716000 Limit f9713000 Call 0 Priority 12 BasePriority 12 PriorityDecrement 0 DecrementCount 16 ChildEBP RetAddr f9715b40 804dc0f7 nt!KiSwapContext+0x2e (FPO: [EBP 0xf9715b74] [0,0,4]) f9715b4c 804dc143 nt!KiSwapThread+0x46 (FPO: [0,0,0]) f9715b74 f23a278a nt!KeWaitForSingleObject+0x1c2 (FPO: [Non-Fpo])WARNING: Stack unwind information not available. Following frames may be wrong. f9715b9c 804e37f7 JinSdDesigner+0x578a f9715bac 805dc5ff nt!IopfCallDriver+0x31 (FPO: [0,0,0]) f9715bd8 8061a94e nt!IopSynchronousCall+0xb7 (FPO: [Non-Fpo]) f9715c2c 805314d1 nt!IopRemoveDevice+0x93 (FPO: [Non-Fpo]) f9715c54 8061bac3 nt!IopRemoveLockedDeviceNode+0x160 (FPO: [Non-Fpo]) f9715c6c 8061bb2f nt!IopDeleteLockedDeviceNode+0x34 (FPO: [Non-Fpo]) f9715ca0 8061d8f6 nt!IopDeleteLockedDeviceNodes+0x3f (FPO: [Non-Fpo]) f9715d34 805ec82d nt!PiProcessQueryRemoveAndEject+0x76b (FPO: [Non-Fpo]) f9715d50 8059fbb1 nt!PiProcessTargetDeviceEvent+0x2a (FPO: [Non-Fpo]) f9715d74 804e426b nt!PiWalkDeviceList+0x122 (FPO: [Non-Fpo]) f9715dac 8057d0f1 nt!ExpWorkerThread+0x100 (FPO: [Non-Fpo]) f9715ddc 804f827a nt!PspSystemThreadStartup+0x34 (FPO: [Non-Fpo]) 00000000 00000000 nt!KiThreadStartup+0x161 total locks, 1 locks currently heldkd> !locks -v feb10980Resource @ 0xfeb10980 Shared 1 owning threads Threads: 8134a473-01<*> *** Actual Thread 8134a470 THREAD 8134a470 Cid 0004.0014 Teb: 00000000 Win32Thread: 00000000 WAIT: (WrQueue) UserMode Non-Alertable 80561640 Unknown Not impersonating DeviceMap e1000090 Owning Process 8134a020 Image: System Wait Start TickCount 186763 Ticks: 3 (0:00:00:00.046) Context Switch Count 5332 UserTime 00:00:00.0000 KernelTime 00:00:01.0140 Start Address nt!ExpWorkerThread (0x804e4196) Stack Init f96f6000 Current f96f5d1c Base f96f6000 Limit f96f3000 Call 0 Priority 13 BasePriority 13 PriorityDecrement 0 DecrementCount 16 ChildEBP RetAddr f96f5d34 804dc0f7 nt!KiSwapContext+0x2e (FPO: [EBP 0xf96f5d6c] [0,0,4]) f96f5d40 804e407e nt!KiSwapThread+0x46 (FPO: [0,0,0]) f96f5d6c 804e423d nt!KeRemoveQueue+0x20e (FPO: [Non-Fpo]) f96f5dac 8057d0f1 nt!ExpWorkerThread+0xd6 (FPO: [Non-Fpo]) f96f5ddc 804f827a nt!PspSystemThreadStartup+0x34 (FPO: [Non-Fpo]) 00000000 00000000 nt!KiThreadStartup+0x161 total locks, 1 locks currently held Regards

Call friends with PC-to-PC calling – FREE Try it now!— 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


Get the new Windows Live Messenger!
http://get.live.com/messenger/overview