> Services at Vista can’t have windows so other way how to receive notification has to be used
Not true on 2 accounts. First, a service can have a window. It just can’t create a window in another session. Second, your ControlHandlerEx can receive device change notifications by registering with your service’s handle.
D
-----Original Message-----
From: xxxxx@lists.osr.com [mailto:xxxxx@lists.osr.com] On Behalf Of Michal Vodicka
Sent: Tuesday, March 25, 2008 1:33 PM
To: Windows System Software Devs Interest List
Subject: RE: [ntdev] CreateFile() handle problem
I don’t want to open next “antonish” thread but I can imagine different
implementation. Driver could call an API “invalidate all handles” and OS
would close all opened handles to invalidated device. It’d allow driver
to cleanup and possibly unload immediatelly. Apps would make a cleanup
when receive invalid handle error.
Current way has problems. App has to register for device change
notifications. It needs a window. Services at Vista can’t have windows
so other way how to receive notification has to be used. Similarly with
command line apps. Hideous when one has to create a library to be used
in all apps and services.
Yes, above is maily problem with the way how notifications are
implemented. But what OP presumes makes sense and I’d prefer it in some
cases. Once we had a problem with USB re-enumeration after ESD and
following surprise removal and after long discussion with MS support
they found re-enumeration was blocked by the driver which didn’t unload
fast enough because app has an opened handle. We were requested to close
handle ASAP to solve problem. There is something bad when app can
influence OS behaviour this way.
Best regards,
Michal Vodicka
UPEK, Inc.
[xxxxx@upek.com, http://www.upek.com]
-----Original Message-----
From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com] On Behalf Of Don Burn
Sent: Tuesday, March 25, 2008 8:54 PM
To: Windows System Software Devs Interest List
Subject: Re:[ntdev] CreateFile() handle problem
This is expected behavior, and the only way things can be.
Opening a device
can cause the driver to allocate data, once you start I/O
requests can be
queued etc. If on removal of the device the was removed
there would be no
mechanism for cleaning up all the actions that the open and I/O imply.
–
Don Burn (MVP, Windows DDK)
Windows 2k/XP/2k3 Filesystem and Driver Consulting
Website: http://www.windrvr.com
Blog: http://msmvps.com/blogs/WinDrvr
Remove StopSpam to reply
wrote in message news:xxxxx@ntdev…
> > Hi,
> >
> > I am developing a simple KMDF bulk USB driver.
> > I have noticed that if an app has a handle to my driver,
> the driver won’t
> > close even when the device is removed from the machine.
> > only once CloseHandle() is called the driver is properly closed.
> >
> > Is this the expected behavior?
> > I would think that the driver should close once there is no
> device under
> > it, no matter anyone having handles to it.
> >
> > Many thanks
> >
>
>
>
> —
> 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