Re: Handle To Driver Not Closing by Gereon
Gereon
Mon Aug 30 14:05:30 CDT 2004
I'm sorry I didn't get back to maintaining my post sooner. I have so many
disparate things going on, stuff falls through the cracks everywhere. I
really would like to find out why this happened with this driver, but ever
since I unintentionally "fixed" it, I haven't been able to reproduce the
problem.
So far, all the IOCTL calls I make are synchronous on this particular
driver; I don't pend anything. The majority end up just reading hardware
registers and passing back the results. However, a couple of them perform
writes, and I was able to track the "failure to close" problem as occurring
after I made an IOCTL call that specified METHOD_IN_DIRECT,
FILE_WRITE_ACCESS. I thought hmm, inadequate permission somehow? So using
SysInternal's WINOBJ tool, I turned on all the privileges for Administrators
on the driver and the problem stopped. I tried to get it to occur again by
putting the permissions back, but of course now it continues to work. I
system- restored to an earlier time and re- installed the hardware, but it
still continues to work.
If/ when this shows up again, I'll make sure and investigate with the
suggestions I have received. If this post gives any more insight into what
the problem might have been (including, but not limited to, the possibility
that I'm just a clueless hack), feel free to suggest them. Until then, all
I can do about it is hope that it pops up again and investigate it more
carefully.
"Doron Holan [MS]" <doronh@nospam.microsoft.com> wrote in message
news:ed%23W4ymhEHA.1644@tk2msftngp13.phx.gbl...
> also, are you completing all requests that you have pended? if you have
> left any queued in your driver, the handle will not truly close until they
> are completed.
>
> d
>
> --
> 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.
>
>
> "Peter Wieland [MSFT]" <peterwie@online.microsoft.com> wrote in message
> news:OL$9RzihEHA.3980@TK2MSFTNGP12.phx.gbl...
>> do you not see a cleanup either? Or just not a close?
>>
>> -p
>>
>> --
>> This posting is provided "AS IS" with no warranties, and confers no
> rights.
>> "Gereon" <gereon_msdn@alwaysfind.us> wrote in message
>> news:%23JrI45hhEHA.3016@tk2msftngp13.phx.gbl...
>> > One of the drivers I am writing is just a simple IO driver for some
> custom
>> > hardware. I make DeviceIoControl calls, it reads and writes the
> hardware
>> > and comes back with the results. Simple as pie.
>> >
>> > Normally everything works fine, but sometimes when I close the user-
> mode
>> > application that opened a handle to the driver, the application will
>> > perform
>> > the CloseHandle call (and it returns TRUE) but my driver's CloseHandle
>> > code
>> > will not get called. Afterwards, when I try to run the program again,
>> > several things happen.
>> >
>> > One: If I try to build the program again, the .EXE for the program is
>> > locked
>> > up and can't be rebuilt. Like it hasn't actually exited yet.
>> >
>> > Two: If I just run the program again, the CreateFile call refuses to
> open
>> > a
>> > handle to my driver. It doesn't even reach my driver's OpenHandle
>> > call.
>> >
>> > Any ideas about why it doesn't get to my driver's CloseHandle call?
>> >
>> >
>>
>>
>
>