Tech Support > Microsoft Windows > Drivers > ZwClose in ndis minport driver crashing
ZwClose in ndis minport driver crashing
Posted by Michael on February 12th, 2008


In my ndis miniport halt handler I'm calling ZwClose() to close a handle to
an event. This works fine if I'm disabling the driver, or shutting down.
But if I put the machine in suspend, the driver crashes about half of the
time on ZwClose(), complaining that the handle is invalid. The handle isn't
NULL, and it isn't being closed multiple times. What else would cause this
behavior?

Thanks,
Michael

Posted by Gianluca Varenni on February 12th, 2008


Where did you create the handle? Was the handle created in user mode, in
kernel mode in the context of a process or in the system context?

Have a nice day
GV

--
Gianluca Varenni, Windows DDK MVP

CACE Technologies
http://www.cacetech.com



"Michael" <Michael@discussions.microsoft.com> wrote in message
news:466C056A-0CCF-48BC-AF08-E7F0D8C49202@microsoft.com...


Posted by Michael on February 12th, 2008


It was created in kernel mode in a worker thread.

"Gianluca Varenni" wrote:

Posted by Doron Holan [MSFT] on February 12th, 2008


did you open it as a kernel handle? or a normal handle?

--
Please do not send e-mail directly to this alias. this alias is for
newsgroup purposes only.
This posting is provided "AS IS" with no warranties, and confers no rights.


"Michael" <Michael@discussions.microsoft.com> wrote in message
news:0442CC08-365A-47FC-ADD4-82A354711EE3@microsoft.com...

Posted by Michael on February 12th, 2008


As a kernel handle.

"Doron Holan [MSFT]" wrote:

Posted by Doron Holan [MSFT] on February 13th, 2008


at what irql are you closing the handle? when you close the handle, do you
zero out the field that stored it to make sure you are not reusing it
accidentally later?

--
Please do not send e-mail directly to this alias. this alias is for
newsgroup purposes only.
This posting is provided "AS IS" with no warranties, and confers no rights.


"Michael" <Michael@discussions.microsoft.com> wrote in message
news:B6AD864C-22DA-4ED5-8C82-92D700049A8E@microsoft.com...

Posted by Alexander Grigoriev on February 13th, 2008


Beware that power management OIDs are coming on DISPATCH_LEVEL.

"Michael" <Michael@discussions.microsoft.com> wrote in message
news:466C056A-0CCF-48BC-AF08-E7F0D8C49202@microsoft.com...


Posted by news.microsoft.com on February 18th, 2008


On Windows Vista, enabling the Driver Verifier Miscellaneous Checks will
enable Handle Tracing for the System process. That will save stack traces
for recent handle Open and Close operations (see the !htrace documentation
for more information). Then, when the second Close is crashing, !htrace from
the debugger might be able to find the stack trace of the first Close. The
stack trace history gets lost if the first Close happened a while back
though - only the very recent traces are available.

Dan
--
This posting is provided "AS IS" with no warranties, and confers no rights.


"Michael" <Michael@discussions.microsoft.com> wrote in message
news:B6AD864C-22DA-4ED5-8C82-92D700049A8E@microsoft.com...