- Question about device handle
- Posted by on November 30th, 2005
I have a device driver which I load from a visual basic program.
While stepping through my vb program, I reach
handle=CreateFile(.....)
which opens a handle to the device.
Then I stop my debugging (hence not closing the handle)
Then I start to debug once more, this time handle= CreateFile(....)
fails with an error code 5=ERROR_ACCESS_DENIED
I assume this is due to the fact I did not previously close the handle.
What can I do to make it work again (i.e. I know reboot will solve
the problem, but is there a simpler way?)
Also, is there a reason why I get error 5, why can't I get a 2nd
handle?
Thanks.
- Posted by Maxim S. Shatskih on November 30th, 2005
Quit VB and enter it once more
--
Maxim Shatskih, Windows DDK MVP
StorageCraft Corporation
maxim@storagecraft.com
http://www.storagecraft.com
<aaaaaaaa> wrote in message news:%236Le12c9FHA.2036@TK2MSFTNGP14.phx.gbl...
- Posted by r_konjeti@mailcity.com on November 30th, 2005
Documentation says when the process exits without closing a
handle(handle for event or other kernel objects) OS will close all the
handles. Still we see problems like this. Is it because process
termination(abrupt) causes OS to miss process exit incident.
Maxim S. Shatskih wrote:
- Posted by Carl Woodward on November 30th, 2005
Really? I've never experienced that. I have experienced an EPROCESS
structure not getting deleted, but I've never seen the object table being
left unprocessed. Surely this kind of problem would be the exception and not
the norm like the original postee was suggesting. I agree with Maxim, try it
outside of VB.
As far as I can remember, all the drivers I have ever written have been
happy with multiple handles opened to devices, and I've terminated test
harnesses from debugging sessions literally thousands of times before
executing a CloseHandle or ZwClose call, and I've never experienced this.
Has it happened to you a lot?
Carly
<r_konjeti@mailcity.com> wrote in message
news:1133379153.189230.61200@g44g2000cwa.googlegro ups.com...
- Posted by Chris Doré on November 30th, 2005
Did you try Maxim's suggestion and quit VB? Simply stopping the app in VB
will not delete the handle because a debugged VB app is actually running as
part of the VB process and not its own process. Therefore, the handle is
actually associated with the VB process and not just your app.
Chris
<r_konjeti@mailcity.com> wrote in message
news:1133379153.189230.61200@g44g2000cwa.googlegro ups.com...
- Posted by Maxim S. Shatskih on November 30th, 2005
VB's debugger does not create a separate process, it runs the program
inside the VB's IDE process.
So, close the VB IDE.
--
Maxim Shatskih, Windows DDK MVP
StorageCraft Corporation
maxim@storagecraft.com
http://www.storagecraft.com
<r_konjeti@mailcity.com> wrote in message
news:1133379153.189230.61200@g44g2000cwa.googlegro ups.com...