Windows Vista Tips

Windows Vista Tips > Newsgroups > Windows Vista Drivers > DeviceIoControl hangs after device removal

Reply
Thread Tools Display Modes

DeviceIoControl hangs after device removal

 
 
Bhentai
Guest
Posts: n/a

 
      12-16-2009
Hi,
I'm faced with something weird when calling DeviceIoControl in a user
application on my UMDF driver based on the osrusbfx2 driver. What happens is
that if I unplug my usb device and a user application calls DeviceIoControl
with a previously valid handle to my driver, the call hangs there. My driver
is totally unmounted so normally, the pnp manager would know that the handle
used by DeviceIoControl is not longer valid and the call would return a
failure but instead it hangs. Is it something that is not done right in my
driver that causes this? Should I manage in the user app and verify that the
handle is still valid?

Regards
 
Reply With Quote
 
 
 
 
Doron Holan [MSFT]
Guest
Posts: n/a

 
      12-16-2009
if you still have an open handle, the driver is still loaded b/c of that
outstanding handle. is the call to DeviceIoControl on an OVERLAPPED handle
?

--

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


"Bhentai" <> wrote in message
news:A248EF36-8B1E-4BE5-96B3-...
> Hi,
> I'm faced with something weird when calling DeviceIoControl in a user
> application on my UMDF driver based on the osrusbfx2 driver. What happens
> is
> that if I unplug my usb device and a user application calls
> DeviceIoControl
> with a previously valid handle to my driver, the call hangs there. My
> driver
> is totally unmounted so normally, the pnp manager would know that the
> handle
> used by DeviceIoControl is not longer valid and the call would return a
> failure but instead it hangs. Is it something that is not done right in my
> driver that causes this? Should I manage in the user app and verify that
> the
> handle is still valid?
>
> Regards


 
Reply With Quote
 
Bhentai
Guest
Posts: n/a

 
      12-17-2009
No, the DeviceIoControl is not Overlapped and the Createfile for the handle
doesn't have the FILE_FLAG_OVERLAPPED specified.

"Doron Holan [MSFT]" wrote:

> if you still have an open handle, the driver is still loaded b/c of that
> outstanding handle. is the call to DeviceIoControl on an OVERLAPPED handle
> ?
>
> --
>
> This posting is provided "AS IS" with no warranties, and confers no rights.
>
>
> "Bhentai" <> wrote in message
> news:A248EF36-8B1E-4BE5-96B3-...
> > Hi,
> > I'm faced with something weird when calling DeviceIoControl in a user
> > application on my UMDF driver based on the osrusbfx2 driver. What happens
> > is
> > that if I unplug my usb device and a user application calls
> > DeviceIoControl
> > with a previously valid handle to my driver, the call hangs there. My
> > driver
> > is totally unmounted so normally, the pnp manager would know that the
> > handle
> > used by DeviceIoControl is not longer valid and the call would return a
> > failure but instead it hangs. Is it something that is not done right in my
> > driver that causes this? Should I manage in the user app and verify that
> > the
> > handle is still valid?
> >
> > Regards

>
> .
>

 
Reply With Quote
 
Doron Holan [MSFT]
Guest
Posts: n/a

 
      12-17-2009
my guess is that you have not completed some IWdfIoRequest in your UMDF
driver. it is probably parked in a non power managed io queue

d

--

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


"Bhentai" <> wrote in message
news:8CD9CA27-0511-486A-8E78-...
> No, the DeviceIoControl is not Overlapped and the Createfile for the
> handle
> doesn't have the FILE_FLAG_OVERLAPPED specified.
>
> "Doron Holan [MSFT]" wrote:
>
>> if you still have an open handle, the driver is still loaded b/c of that
>> outstanding handle. is the call to DeviceIoControl on an OVERLAPPED
>> handle
>> ?
>>
>> --
>>
>> This posting is provided "AS IS" with no warranties, and confers no
>> rights.
>>
>>
>> "Bhentai" <> wrote in message
>> news:A248EF36-8B1E-4BE5-96B3-...
>> > Hi,
>> > I'm faced with something weird when calling DeviceIoControl in a user
>> > application on my UMDF driver based on the osrusbfx2 driver. What
>> > happens
>> > is
>> > that if I unplug my usb device and a user application calls
>> > DeviceIoControl
>> > with a previously valid handle to my driver, the call hangs there. My
>> > driver
>> > is totally unmounted so normally, the pnp manager would know that the
>> > handle
>> > used by DeviceIoControl is not longer valid and the call would return a
>> > failure but instead it hangs. Is it something that is not done right in
>> > my
>> > driver that causes this? Should I manage in the user app and verify
>> > that
>> > the
>> > handle is still valid?
>> >
>> > Regards

>>
>> .
>>

 
Reply With Quote
 
Bhentai
Guest
Posts: n/a

 
      12-18-2009
You were right, it was something that had to do with my non power managed
queue. So I changed my queue to power manage and now the DeviceIoControl call
isn't blocked and returns ERROR_OPERATION_ABORTED, which is alright.

Thank a lot.

"Doron Holan [MSFT]" wrote:

> my guess is that you have not completed some IWdfIoRequest in your UMDF
> driver. it is probably parked in a non power managed io queue
>
> d
>
> --
>
> This posting is provided "AS IS" with no warranties, and confers no rights.
>
>
> "Bhentai" <> wrote in message
> news:8CD9CA27-0511-486A-8E78-...
> > No, the DeviceIoControl is not Overlapped and the Createfile for the
> > handle
> > doesn't have the FILE_FLAG_OVERLAPPED specified.
> >
> > "Doron Holan [MSFT]" wrote:
> >
> >> if you still have an open handle, the driver is still loaded b/c of that
> >> outstanding handle. is the call to DeviceIoControl on an OVERLAPPED
> >> handle
> >> ?
> >>
> >> --
> >>
> >> This posting is provided "AS IS" with no warranties, and confers no
> >> rights.
> >>
> >>
> >> "Bhentai" <> wrote in message
> >> news:A248EF36-8B1E-4BE5-96B3-...
> >> > Hi,
> >> > I'm faced with something weird when calling DeviceIoControl in a user
> >> > application on my UMDF driver based on the osrusbfx2 driver. What
> >> > happens
> >> > is
> >> > that if I unplug my usb device and a user application calls
> >> > DeviceIoControl
> >> > with a previously valid handle to my driver, the call hangs there. My
> >> > driver
> >> > is totally unmounted so normally, the pnp manager would know that the
> >> > handle
> >> > used by DeviceIoControl is not longer valid and the call would return a
> >> > failure but instead it hangs. Is it something that is not done right in
> >> > my
> >> > driver that causes this? Should I manage in the user app and verify
> >> > that
> >> > the
> >> > handle is still valid?
> >> >
> >> > Regards
> >>
> >> .
> >>

> .
>

 
Reply With Quote
 
Doron Holan [MSFT]
Guest
Posts: n/a

 
      12-18-2009
blindly turning the queue into a power managed queue has other side effects.
for instance it can effect selective suspend (if you enabled it)

d

--

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


"Bhentai" <> wrote in message
news:62CBF13C-4CF0-41B3-AB18-...
> You were right, it was something that had to do with my non power managed
> queue. So I changed my queue to power manage and now the DeviceIoControl
> call
> isn't blocked and returns ERROR_OPERATION_ABORTED, which is alright.
>
> Thank a lot.
>
> "Doron Holan [MSFT]" wrote:
>
>> my guess is that you have not completed some IWdfIoRequest in your UMDF
>> driver. it is probably parked in a non power managed io queue
>>
>> d
>>
>> --
>>
>> This posting is provided "AS IS" with no warranties, and confers no
>> rights.
>>
>>
>> "Bhentai" <> wrote in message
>> news:8CD9CA27-0511-486A-8E78-...
>> > No, the DeviceIoControl is not Overlapped and the Createfile for the
>> > handle
>> > doesn't have the FILE_FLAG_OVERLAPPED specified.
>> >
>> > "Doron Holan [MSFT]" wrote:
>> >
>> >> if you still have an open handle, the driver is still loaded b/c of
>> >> that
>> >> outstanding handle. is the call to DeviceIoControl on an OVERLAPPED
>> >> handle
>> >> ?
>> >>
>> >> --
>> >>
>> >> This posting is provided "AS IS" with no warranties, and confers no
>> >> rights.
>> >>
>> >>
>> >> "Bhentai" <> wrote in message
>> >> news:A248EF36-8B1E-4BE5-96B3-...
>> >> > Hi,
>> >> > I'm faced with something weird when calling DeviceIoControl in a
>> >> > user
>> >> > application on my UMDF driver based on the osrusbfx2 driver. What
>> >> > happens
>> >> > is
>> >> > that if I unplug my usb device and a user application calls
>> >> > DeviceIoControl
>> >> > with a previously valid handle to my driver, the call hangs there.
>> >> > My
>> >> > driver
>> >> > is totally unmounted so normally, the pnp manager would know that
>> >> > the
>> >> > handle
>> >> > used by DeviceIoControl is not longer valid and the call would
>> >> > return a
>> >> > failure but instead it hangs. Is it something that is not done right
>> >> > in
>> >> > my
>> >> > driver that causes this? Should I manage in the user app and verify
>> >> > that
>> >> > the
>> >> > handle is still valid?
>> >> >
>> >> > Regards
>> >>
>> >> .
>> >>

>> .
>>

 
Reply With Quote
 
Bhentai
Guest
Posts: n/a

 
      12-18-2009
Ok, but my device doesn't support selective suspend and I haven't implemented
anything about power policy for my device in my driver. The only thing I have
specified is the surprise removal when setting the pnp capabilities in my
OnDeviceAdd call. Is there anything that could be influenced by changing my
queues power setting? I have two of them, one for IOCTL and the other is a
manual one.

Regards

"Doron Holan [MSFT]" wrote:

> blindly turning the queue into a power managed queue has other side effects.
> for instance it can effect selective suspend (if you enabled it)
>
> d
>
> --
>
> This posting is provided "AS IS" with no warranties, and confers no rights.
>
>
> "Bhentai" <> wrote in message
> news:62CBF13C-4CF0-41B3-AB18-...
> > You were right, it was something that had to do with my non power managed
> > queue. So I changed my queue to power manage and now the DeviceIoControl
> > call
> > isn't blocked and returns ERROR_OPERATION_ABORTED, which is alright.
> >
> > Thank a lot.
> >
> > "Doron Holan [MSFT]" wrote:
> >
> >> my guess is that you have not completed some IWdfIoRequest in your UMDF
> >> driver. it is probably parked in a non power managed io queue
> >>
> >> d
> >>
> >> --
> >>
> >> This posting is provided "AS IS" with no warranties, and confers no
> >> rights.
> >>
> >>
> >> "Bhentai" <> wrote in message
> >> news:8CD9CA27-0511-486A-8E78-...
> >> > No, the DeviceIoControl is not Overlapped and the Createfile for the
> >> > handle
> >> > doesn't have the FILE_FLAG_OVERLAPPED specified.
> >> >
> >> > "Doron Holan [MSFT]" wrote:
> >> >
> >> >> if you still have an open handle, the driver is still loaded b/c of
> >> >> that
> >> >> outstanding handle. is the call to DeviceIoControl on an OVERLAPPED
> >> >> handle
> >> >> ?
> >> >>
> >> >> --
> >> >>
> >> >> This posting is provided "AS IS" with no warranties, and confers no
> >> >> rights.
> >> >>
> >> >>
> >> >> "Bhentai" <> wrote in message
> >> >> news:A248EF36-8B1E-4BE5-96B3-...
> >> >> > Hi,
> >> >> > I'm faced with something weird when calling DeviceIoControl in a
> >> >> > user
> >> >> > application on my UMDF driver based on the osrusbfx2 driver. What
> >> >> > happens
> >> >> > is
> >> >> > that if I unplug my usb device and a user application calls
> >> >> > DeviceIoControl
> >> >> > with a previously valid handle to my driver, the call hangs there.
> >> >> > My
> >> >> > driver
> >> >> > is totally unmounted so normally, the pnp manager would know that
> >> >> > the
> >> >> > handle
> >> >> > used by DeviceIoControl is not longer valid and the call would
> >> >> > return a
> >> >> > failure but instead it hangs. Is it something that is not done right
> >> >> > in
> >> >> > my
> >> >> > driver that causes this? Should I manage in the user app and verify
> >> >> > that
> >> >> > the
> >> >> > handle is still valid?
> >> >> >
> >> >> > Regards
> >> >>
> >> >> .
> >> >>
> >> .
> >>

> .
>

 
Reply With Quote
 
Doron Holan [MSFT]
Guest
Posts: n/a

 
      12-21-2009
power managed queues are used to control if you get presented IO only when
the device has power. this means in a non power managed queue you could get
a io request when you are off, and if in that state you try to touch the hw,
it will fail.

d

--

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


"Bhentai" <> wrote in message
news:25425413-9598-4497-AA47-...
> Ok, but my device doesn't support selective suspend and I haven't
> implemented
> anything about power policy for my device in my driver. The only thing I
> have
> specified is the surprise removal when setting the pnp capabilities in my
> OnDeviceAdd call. Is there anything that could be influenced by changing
> my
> queues power setting? I have two of them, one for IOCTL and the other is a
> manual one.
>
> Regards
>
> "Doron Holan [MSFT]" wrote:
>
>> blindly turning the queue into a power managed queue has other side
>> effects.
>> for instance it can effect selective suspend (if you enabled it)
>>
>> d
>>
>> --
>>
>> This posting is provided "AS IS" with no warranties, and confers no
>> rights.
>>
>>
>> "Bhentai" <> wrote in message
>> news:62CBF13C-4CF0-41B3-AB18-...
>> > You were right, it was something that had to do with my non power
>> > managed
>> > queue. So I changed my queue to power manage and now the
>> > DeviceIoControl
>> > call
>> > isn't blocked and returns ERROR_OPERATION_ABORTED, which is alright.
>> >
>> > Thank a lot.
>> >
>> > "Doron Holan [MSFT]" wrote:
>> >
>> >> my guess is that you have not completed some IWdfIoRequest in your
>> >> UMDF
>> >> driver. it is probably parked in a non power managed io queue
>> >>
>> >> d
>> >>
>> >> --
>> >>
>> >> This posting is provided "AS IS" with no warranties, and confers no
>> >> rights.
>> >>
>> >>
>> >> "Bhentai" <> wrote in message
>> >> news:8CD9CA27-0511-486A-8E78-...
>> >> > No, the DeviceIoControl is not Overlapped and the Createfile for the
>> >> > handle
>> >> > doesn't have the FILE_FLAG_OVERLAPPED specified.
>> >> >
>> >> > "Doron Holan [MSFT]" wrote:
>> >> >
>> >> >> if you still have an open handle, the driver is still loaded b/c of
>> >> >> that
>> >> >> outstanding handle. is the call to DeviceIoControl on an
>> >> >> OVERLAPPED
>> >> >> handle
>> >> >> ?
>> >> >>
>> >> >> --
>> >> >>
>> >> >> This posting is provided "AS IS" with no warranties, and confers no
>> >> >> rights.
>> >> >>
>> >> >>
>> >> >> "Bhentai" <> wrote in message
>> >> >> news:A248EF36-8B1E-4BE5-96B3-...
>> >> >> > Hi,
>> >> >> > I'm faced with something weird when calling DeviceIoControl in a
>> >> >> > user
>> >> >> > application on my UMDF driver based on the osrusbfx2 driver. What
>> >> >> > happens
>> >> >> > is
>> >> >> > that if I unplug my usb device and a user application calls
>> >> >> > DeviceIoControl
>> >> >> > with a previously valid handle to my driver, the call hangs
>> >> >> > there.
>> >> >> > My
>> >> >> > driver
>> >> >> > is totally unmounted so normally, the pnp manager would know that
>> >> >> > the
>> >> >> > handle
>> >> >> > used by DeviceIoControl is not longer valid and the call would
>> >> >> > return a
>> >> >> > failure but instead it hangs. Is it something that is not done
>> >> >> > right
>> >> >> > in
>> >> >> > my
>> >> >> > driver that causes this? Should I manage in the user app and
>> >> >> > verify
>> >> >> > that
>> >> >> > the
>> >> >> > handle is still valid?
>> >> >> >
>> >> >> > Regards
>> >> >>
>> >> >> .
>> >> >>
>> >> .
>> >>

>> .
>>

 
Reply With Quote
 
Bhentai
Guest
Posts: n/a

 
      12-22-2009
ok, so in my case, since I had problem on a surprise removal, I must have
some callback on D0exit to address the pending or remaining request that I
would have in my queue. But, since my device never goes off or support
selective suspend, it seems ok to have power managed queues and let the
framework do its thing.

"Doron Holan [MSFT]" wrote:

> power managed queues are used to control if you get presented IO only when
> the device has power. this means in a non power managed queue you could get
> a io request when you are off, and if in that state you try to touch the hw,
> it will fail.
>
> d
>
> --
>
> This posting is provided "AS IS" with no warranties, and confers no rights.
>
>
> "Bhentai" <> wrote in message
> news:25425413-9598-4497-AA47-...
> > Ok, but my device doesn't support selective suspend and I haven't
> > implemented
> > anything about power policy for my device in my driver. The only thing I
> > have
> > specified is the surprise removal when setting the pnp capabilities in my
> > OnDeviceAdd call. Is there anything that could be influenced by changing
> > my
> > queues power setting? I have two of them, one for IOCTL and the other is a
> > manual one.
> >
> > Regards
> >
> > "Doron Holan [MSFT]" wrote:
> >
> >> blindly turning the queue into a power managed queue has other side
> >> effects.
> >> for instance it can effect selective suspend (if you enabled it)
> >>
> >> d
> >>
> >> --
> >>
> >> This posting is provided "AS IS" with no warranties, and confers no
> >> rights.
> >>
> >>
> >> "Bhentai" <> wrote in message
> >> news:62CBF13C-4CF0-41B3-AB18-...
> >> > You were right, it was something that had to do with my non power
> >> > managed
> >> > queue. So I changed my queue to power manage and now the
> >> > DeviceIoControl
> >> > call
> >> > isn't blocked and returns ERROR_OPERATION_ABORTED, which is alright.
> >> >
> >> > Thank a lot.
> >> >
> >> > "Doron Holan [MSFT]" wrote:
> >> >
> >> >> my guess is that you have not completed some IWdfIoRequest in your
> >> >> UMDF
> >> >> driver. it is probably parked in a non power managed io queue
> >> >>
> >> >> d
> >> >>
> >> >> --
> >> >>
> >> >> This posting is provided "AS IS" with no warranties, and confers no
> >> >> rights.
> >> >>
> >> >>
> >> >> "Bhentai" <> wrote in message
> >> >> news:8CD9CA27-0511-486A-8E78-...
> >> >> > No, the DeviceIoControl is not Overlapped and the Createfile for the
> >> >> > handle
> >> >> > doesn't have the FILE_FLAG_OVERLAPPED specified.
> >> >> >
> >> >> > "Doron Holan [MSFT]" wrote:
> >> >> >
> >> >> >> if you still have an open handle, the driver is still loaded b/c of
> >> >> >> that
> >> >> >> outstanding handle. is the call to DeviceIoControl on an
> >> >> >> OVERLAPPED
> >> >> >> handle
> >> >> >> ?
> >> >> >>
> >> >> >> --
> >> >> >>
> >> >> >> This posting is provided "AS IS" with no warranties, and confers no
> >> >> >> rights.
> >> >> >>
> >> >> >>
> >> >> >> "Bhentai" <> wrote in message
> >> >> >> news:A248EF36-8B1E-4BE5-96B3-...
> >> >> >> > Hi,
> >> >> >> > I'm faced with something weird when calling DeviceIoControl in a
> >> >> >> > user
> >> >> >> > application on my UMDF driver based on the osrusbfx2 driver. What
> >> >> >> > happens
> >> >> >> > is
> >> >> >> > that if I unplug my usb device and a user application calls
> >> >> >> > DeviceIoControl
> >> >> >> > with a previously valid handle to my driver, the call hangs
> >> >> >> > there.
> >> >> >> > My
> >> >> >> > driver
> >> >> >> > is totally unmounted so normally, the pnp manager would know that
> >> >> >> > the
> >> >> >> > handle
> >> >> >> > used by DeviceIoControl is not longer valid and the call would
> >> >> >> > return a
> >> >> >> > failure but instead it hangs. Is it something that is not done
> >> >> >> > right
> >> >> >> > in
> >> >> >> > my
> >> >> >> > driver that causes this? Should I manage in the user app and
> >> >> >> > verify
> >> >> >> > that
> >> >> >> > the
> >> >> >> > handle is still valid?
> >> >> >> >
> >> >> >> > Regards
> >> >> >>
> >> >> >> .
> >> >> >>
> >> >> .
> >> >>
> >> .
> >>

> .
>

 
Reply With Quote
 
 
 
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Game Compatibility BCurrey Windows Vista Games 6 11-29-2007 09:11 PM
Going Golfing but not with Vista markbyrn Windows Vista Games 15 03-08-2007 11:59 AM
Cannot reuse old Device name in WMDC (Final) mlai ActiveSync 3 03-06-2007 09:15 AM
americas army stuttering under vista premium ernie Windows Vista Games 0 02-27-2007 11:20 PM
problem in dxdiag Peewee64 Windows Vista Games 0 02-14-2007 10:49 PM



1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59