DeviceIoControl deadlock

Hey, guys.

I have a very annoying problem, so maybe you can help me…

My user-mode app gets data from a driver using DeviceIoControl().

There is a synchronization mechanism (using events and a cyclic queue) in my
IRP_MJ_DEVICE_CONTROL handler.

The handler waits for the queue to be available with ZwWait…() and it
seems to deadlock, since the APC is

being delivered to the user mode thread which is waiting on
DeviceIoControl() upstairs, in the user mode…

The scenario looks simple but I can’t find a proper way to synchronize these
two waits… The user mode

thread just deadlocks…

Any help would be much appreciated.

If you are using a handle in your driver convert it to an object so that you can use the KeWaitForSingleObject function.

–Mark Cariddi
OSR, Open Systems Resources, Inc.

-----Original Message-----
From: xxxxx@lists.osr.com [mailto:xxxxx@lists.osr.com] On Behalf Of Dmitry Geskin
Sent: Sunday, March 14, 2010 1:12 PM
To: Windows File Systems Devs Interest List
Subject: [ntfsd] DeviceIoControl deadlock

Hey, guys.

I have a very annoying problem, so maybe you can help me…

My user-mode app gets data from a driver using DeviceIoControl().

There is a synchronization mechanism (using events and a cyclic queue) in my
IRP_MJ_DEVICE_CONTROL handler.

The handler waits for the queue to be available with ZwWait…() and it
seems to deadlock, since the APC is

being delivered to the user mode thread which is waiting on
DeviceIoControl() upstairs, in the user mode…

The scenario looks simple but I can’t find a proper way to synchronize these
two waits… The user mode

thread just deadlocks…

Any help would be much appreciated.


NTFSD is sponsored by OSR

For our schedule of debugging and file system seminars
(including our new fs mini-filter seminar) 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

give it a timeout.