may be a Deadlock happens on my Driver, need ur help

Hello everybody, I am new to this thread and to driver development…
Can any body help me understand my current problem, and give your idea or solution to this one…here’s the situation…

I have ported a wdm filter driver to wdf filter driver…then on my application i have two events issuing deviceIOControl on driver side at the same time, ioctl1 and ioctl 2, respectively. first event does the checking of the power changes…and the second event does the checking and getting the data from the driver. these has no problem when using WDM version and the application is intact(no changes at all)…
but after i ported it to wdf filter driver…

on the first instance of my application, there was no problem at all… but when i launch another instance of my application, a hang up will occur because the driver is responding to the 2nd instance of my application with status device busy…

when i am trying to debug why is it that there is a problem on the second launching of my application, I found out that the first event on the second application will get a status device busy…on the second thread there was an infinite loop…and when I press the ctrl+alt+delete there was an error saying 0xC0000017…and then after seconds I got a blue screen…

question:

if there were memory leaks…why is it not happening on the first instance?
is there a problem with the synchronization?
does my driver has a problem in IRQL?
I have only few ideas on framework base device dev’t…

if you did not understand my problem…I am open for any questions…

PLEASE GUYZ, I NEED YOUR IDEAS…

GOD BLESS

xxxxx@gmail.com wrote:

I have ported a wdm filter driver to wdf filter driver…then on my application i have two events issuing deviceIOControl on driver side at the same time, ioctl1 and ioctl 2, respectively. first event does the checking of the power changes…and the second event does the checking and getting the data from the driver. these has no problem when using WDM version and the application is intact(no changes at all)…
but after i ported it to wdf filter driver…

on the first instance of my application, there was no problem at all… but when i launch another instance of my application, a hang up will occur because the driver is responding to the 2nd instance of my application with status device busy…

My guess, from this very sketchy description, is that you have some kind
of locking problem. How have you configured your queues? Sequential,
parallel, manual? Did you set a synchronization scope? Are you
queueing up these IRPs or are you always completing them immediately?
What kind of device are you filtering? Did you declare yourself to KMDF
as a filter?

Perhaps you should post some code. The section where you set up the
queues and your ioctl handler would probably be enough.


Tim Roberts, xxxxx@probo.com
Providenza & Boekelheide, Inc.

What does this " first event does the checking of the power changes" mean? KMDF will manage power state changes for you. If you use power managed queues properly, KMDF will make sure that your device has power for requests that need it.

d

-----Original Message-----
From: xxxxx@lists.osr.com [mailto:xxxxx@lists.osr.com] On Behalf Of Tim Roberts
Sent: Wednesday, December 12, 2007 9:45 AM
To: Windows System Software Devs Interest List
Subject: Re: [ntdev] may be a Deadlock happens on my Driver, need ur help

xxxxx@gmail.com wrote:

I have ported a wdm filter driver to wdf filter driver…then on my application i have two events issuing deviceIOControl on driver side at the same time, ioctl1 and ioctl 2, respectively. first event does the checking of the power changes…and the second event does the checking and getting the data from the driver. these has no problem when using WDM version and the application is intact(no changes at all)…
but after i ported it to wdf filter driver…

on the first instance of my application, there was no problem at all… but when i launch another instance of my application, a hang up will occur because the driver is responding to the 2nd instance of my application with status device busy…

My guess, from this very sketchy description, is that you have some kind
of locking problem. How have you configured your queues? Sequential,
parallel, manual? Did you set a synchronization scope? Are you
queueing up these IRPs or are you always completing them immediately?
What kind of device are you filtering? Did you declare yourself to KMDF
as a filter?

Perhaps you should post some code. The section where you set up the
queues and your ioctl handler would probably be enough.


Tim Roberts, xxxxx@probo.com
Providenza & Boekelheide, Inc.


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

>>My guess, from this very sketchy description, is that you have some kind of locking problem.

>How have you configured your queues? Sequential, parallel, manual?
Actually, I have two queues, fisrt queue is created in EvtAddDevice which is for InternalIoControl, and second queue is for the controldevice which is for EvtIODeviceControl…
codes for configuring InternalIOControl queue:---------------------------------------------------------------

WDF_IO_QUEUE_CONFIG_INIT_DEFAULT_QUEUE(&ioQueueConfig,
WdfIoQueueDispatchParallel);

ioQueueConfig.EvtIoInternalDeviceControl = My_EvtIoInternalDeviceControl;

status = WdfIoQueueCreate(hDevice,
&ioQueueConfig,
WDF_NO_OBJECT_ATTRIBUTES,
WDF_NO_HANDLE // pointer to default queue
);

codes for configuring IODeviceControl in control device------------------------------------------------------

WdfWaitLockAcquire(FilterDeviceCollectionLock, NULL);
if(WdfCollectionGetCount(FilterDeviceCollection) == 1) {
bCreate = TRUE;
}
WdfWaitLockRelease(FilterDeviceCollectionLock);

if(!bCreate) {
return STATUS_SUCCESS;
}
DbgPrint( “Creating Control Device\n”);
//
// In order to create a control device, we first need to allocate a
// WDFDEVICE_INIT structure and set all properties.
//
pInit = WdfControlDeviceInitAllocate(
WdfDeviceGetDriver(Device),
&SDDL_DEVOBJ_SYS_ALL_ADM_RWX_WORLD_RW_RES_R
);
if (pInit == NULL) {
status = STATUS_INSUFFICIENT_RESOURCES;
goto Error;
}
status = WdfDeviceInitAssignName(pInit, &ntDeviceName);
if (!NT_SUCCESS(status)) {
goto Error;
}
WDF_OBJECT_ATTRIBUTES_INIT_CONTEXT_TYPE(&controlAttributes,
CONTROLLER_DEVICE_EXTENSION);
status = WdfDeviceCreate(&pInit,
&controlAttributes,
&controlDevice);
if (!NT_SUCCESS(status)) {
goto Error;
}
status = WdfDeviceCreateSymbolicLink(controlDevice,
&symbolicLinkName);
if (!NT_SUCCESS(status)) {
goto Error;
}
//I tried already changing the WdfIoQueueDispatchParallel to WdfIoQueueDispatchSequential
// but the driver doesn’t work anymore
WDF_IO_QUEUE_CONFIG_INIT_DEFAULT_QUEUE(&ioQueueConfig,
WdfIoQueueDispatchParallel);
ioQueueConfig.EvtIoDeviceControl = My_EvtIoDeviceControl;
status = WdfIoQueueCreate(controlDevice,
&ioQueueConfig,
WDF_NO_OBJECT_ATTRIBUTES,
&queue // pointer to default queue
);
if (!NT_SUCCESS(status)) {
goto Error;
}

>Did you set a synchronization scope?

I did not set any synchronization scope.

>Are you queueing up these IRPs or are you always completing them immediately?

>What kind of device are you filtering?

I am filtering the mouse device data…

>Did you declare yourself to KMDF as a filter?

yes, I declare it… with this WdfFdoInitSetFilter(DeviceInit);

>Perhaps you should post some code. The section where you set up the queues and your ioctl handler would probably be enough.

for handling my EvtIoDeviceControl here’s the code:--------------------------------------------------------
//Not sure if i’m correct with this one…
WdfWaitLockAcquire(FilterDeviceCollectionLock, NULL);
noItems = WdfCollectionGetCount(FilterDeviceCollection);
for(i=0; i hDevice = WdfCollectionGetItem(FilterDeviceCollection, i);
devExt = FilterGetData(hDevice);
}
WdfWaitLockRelease(FilterDeviceCollectionLock);
CompleteRequest = FALSE;
Irp = WdfRequestWdmGetIrp(Request);
switch (IoControlCode) {
case FOR_FIRST_EVENT:

CompleteRequest = TRUE;
break;
case FOR_SECOND_EVENT:
//i HAVE A LONG CODES HERE GET THE DATA
//PROVIDED SOME LOCKS(WdfSpinLockAcquire which i created in EvtAddDevice)

CompleteRequest = TRUE;
break;
case FOR_OTHER_EVENTS:

CompleteRequest = TRUE;
break;
}
if (CompleteRequest) {
WdfRequestSetInformation(Request,infolen);
// status = STATUS_SUCCESS;
WdfRequestCompleteWithPriorityBoost (Request, status, IO_NO_INCREMENT);
}

codes for IOInternalDeviceControl ;------------------------------------------------------------------------
hDevice = WdfIoQueueGetDevice(Queue);
devExt = FilterGetData(hDevice);

switch (IoControlCode) {
case IOCTL_INTERNAL_MOUSE_CONNECT:


devExt->UpperConnectData = *connectData;

connectData->ClassDeviceObject = WdfDeviceWdmGetDeviceObject(hDevice);
//for my service callback
connectData->ClassService = My_ServiceCallback;

break;
case …:
case …:
}
My_ForwardRequest(Request, WdfDeviceGetIoTarget(hDevice));

when I got a blue screen the bug check ID is 0x0000010d

xxxxx@gmail.com wrote:

>> My guess, from this very sketchy description, is that you have some kind of locking problem.
>> How have you configured your queues? Sequential, parallel, manual?
>>
Actually, I have two queues, fisrt queue is created in EvtAddDevice which is for InternalIoControl, and second queue is for the controldevice which is for EvtIODeviceControl…
codes for configuring InternalIOControl queue:---------------------------------------------------------------

WDF_IO_QUEUE_CONFIG_INIT_DEFAULT_QUEUE(&ioQueueConfig,
WdfIoQueueDispatchParallel);

ioQueueConfig.EvtIoInternalDeviceControl = My_EvtIoInternalDeviceControl;

status = WdfIoQueueCreate(hDevice,
&ioQueueConfig,
WDF_NO_OBJECT_ATTRIBUTES,
WDF_NO_HANDLE // pointer to default queue
);

codes for configuring IODeviceControl in control device------------------------------------------------------

WdfWaitLockAcquire(FilterDeviceCollectionLock, NULL);
if(WdfCollectionGetCount(FilterDeviceCollection) == 1) {
bCreate = TRUE;
}
WdfWaitLockRelease(FilterDeviceCollectionLock);

if(!bCreate) {
return STATUS_SUCCESS;
}
DbgPrint( “Creating Control Device\n”);
//
// In order to create a control device, we first need to allocate a
// WDFDEVICE_INIT structure and set all properties.
//
pInit = WdfControlDeviceInitAllocate(
WdfDeviceGetDriver(Device),
&SDDL_DEVOBJ_SYS_ALL_ADM_RWX_WORLD_RW_RES_R
);
if (pInit == NULL) {
status = STATUS_INSUFFICIENT_RESOURCES;
goto Error;
}
status = WdfDeviceInitAssignName(pInit, &ntDeviceName);
if (!NT_SUCCESS(status)) {
goto Error;
}
WDF_OBJECT_ATTRIBUTES_INIT_CONTEXT_TYPE(&controlAttributes,
CONTROLLER_DEVICE_EXTENSION);
status = WdfDeviceCreate(&pInit,
&controlAttributes,
&controlDevice);
if (!NT_SUCCESS(status)) {
goto Error;
}
status = WdfDeviceCreateSymbolicLink(controlDevice,
&symbolicLinkName);
if (!NT_SUCCESS(status)) {
goto Error;
}
//I tried already changing the WdfIoQueueDispatchParallel to WdfIoQueueDispatchSequential
// but the driver doesn’t work anymore
WDF_IO_QUEUE_CONFIG_INIT_DEFAULT_QUEUE(&ioQueueConfig,
WdfIoQueueDispatchParallel);
ioQueueConfig.EvtIoDeviceControl = My_EvtIoDeviceControl;
status = WdfIoQueueCreate(controlDevice,
&ioQueueConfig,
WDF_NO_OBJECT_ATTRIBUTES,
&queue // pointer to default queue
);
if (!NT_SUCCESS(status)) {
goto Error;
}

for handling my EvtIoDeviceControl here’s the code:--------------------------------------------------------
//Not sure if i’m correct with this one…
WdfWaitLockAcquire(FilterDeviceCollectionLock, NULL);
noItems = WdfCollectionGetCount(FilterDeviceCollection);
for(i=0; i> hDevice = WdfCollectionGetItem(FilterDeviceCollection, i);
> devExt = FilterGetData(hDevice);
> }
> WdfWaitLockRelease(FilterDeviceCollectionLock);
>

What do you think that loop is doing? The net effect is going to be to
set devExt to the device extension of the last device in the
collection. The loop is pointless.

Further, the loop is unnecessary. This EvtIoDeviceControl handler is
associated with a queue, and that queue is owned by exactly one of your
filter devices. You don’t have to go searching for it. You should
replace that entire piece of code with:
hDevice = WdfIoQueueGetDevice( Queue );
devExt = FilterGetData( hDevice );

> if (CompleteRequest) {
> WdfRequestSetInformation(Request,infolen);
> // status = STATUS_SUCCESS;
> WdfRequestCompleteWithPriorityBoost (Request, status, IO_NO_INCREMENT);
> }
>

Why would you do it that way, instead of one single call:
WdfRequestCompleteWithInformation ( Request, status, infolen );

There no point in calling …WithPriorityBoost if you are specifying no
priority boost.

> codes for IOInternalDeviceControl ;------------------------------------------------------------------------
> hDevice = WdfIoQueueGetDevice(Queue);
> devExt = FilterGetData(hDevice);
>
> switch (IoControlCode) {
> case IOCTL_INTERNAL_MOUSE_CONNECT:
> …
> …
> devExt->UpperConnectData = *connectData;
>
> connectData->ClassDeviceObject = WdfDeviceWdmGetDeviceObject(hDevice);
> //for my service callback
> connectData->ClassService = My_ServiceCallback;
>
>
> break;
> case …:
> case …:
> }
> My_ForwardRequest(Request, WdfDeviceGetIoTarget(hDevice));
>

What does My_ForwardRequest do?


Tim Roberts, xxxxx@probo.com
Providenza & Boekelheide, Inc.

My_ForwardRequest will forward the request to the lower driver…
here’s the code…
VOID TwoTrack_ForwardRequest(IN WDFREQUEST Request, IN WDFIOTARGET Target)
{
WDF_REQUEST_SEND_OPTIONS options;
BOOLEAN ret;
NTSTATUS status;
WDF_REQUEST_SEND_OPTIONS_INIT(&options,
WDF_REQUEST_SEND_OPTION_SEND_AND_FORGET);
ret = WdfRequestSend(Request, Target, &options);
if (ret == FALSE) {
status = WdfRequestGetStatus (Request);
DebugPrint( (CH_DISP, 1, “WdfRequestSend failed: 0x%x\n”, status));
WdfRequestComplete(Request, status);
}
return;
}

This would not be for twotrack.sys would it :slight_smile: ? You said that the filter device object only has a queue for internal ioctls. It would appear below that you are forwarding ioctls, not internal ioctls to the filter device. Can you post your EvtIoXxx routines for the filter device? Note that power managed queues on a filter device can be iffy b/c the filter is not the power policy owner of the stack and cannot force the stack into a D0 state.

d

-----Original Message-----
From: xxxxx@lists.osr.com [mailto:xxxxx@lists.osr.com] On Behalf Of xxxxx@gmail.com
Sent: Thursday, December 13, 2007 5:59 PM
To: Windows System Software Devs Interest List
Subject: RE:[ntdev] may be a Deadlock happens on my Driver, need ur help

My_ForwardRequest will forward the request to the lower driver…
here’s the code…
VOID TwoTrack_ForwardRequest(IN WDFREQUEST Request, IN WDFIOTARGET Target)
{
WDF_REQUEST_SEND_OPTIONS options;
BOOLEAN ret;
NTSTATUS status;
WDF_REQUEST_SEND_OPTIONS_INIT(&options,
WDF_REQUEST_SEND_OPTION_SEND_AND_FORGET);
ret = WdfRequestSend(Request, Target, &options);
if (ret == FALSE) {
status = WdfRequestGetStatus (Request);
DebugPrint( (CH_DISP, 1, “WdfRequestSend failed: 0x%x\n”, status));
WdfRequestComplete(Request, status);
}
return;
}


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

>>This would not be for twotrack.sys would it :slight_smile: ?

>You said that the filter device object only has a queue for internal ioctls. It would appear
>below that you are forwarding ioctls, not internal ioctls

>to the filter device. Can you post your EvtIoXxx routines for the filter device? Note that power
>managed queues on a filter device can be iffy b/c the filter is not the power policy owner of the
>stack and cannot force the stack into a D0 state.

What is twotrack.sys? maybe that is for the mouse too i think…I used that forwardRequest as what my co worker gave to me as reference…

If I have to

anyway… I have another questions…thanks for your information by the way…

What i want with my driver is be able to handle many application or events run over it.
DOes all locks sequence implemented in WDM is not working in WDF?
\I did not touch anything on the locks from wdm. what i did is just to convert KeSpinlockAcquire to WdfSpinLockAcquire or what ever is that…etc…

the details for my application is that, we filter the data from mousescrollwheel ,that if the scrollwheel was press the cursor will be displayed depending what image does the user loaded to the settings in the control panel…

On our driver we created a control device to process the user application request…
but seems like

it cannot process multiple request… I will post some of my IOCTL codes here when come back in the ofis…

Actually the filter driver for the ibm (neh Lenovo) two track mouse is tp4.sys or tp4point.ys or something similarly named, at least when I owned the ps2 stack during windows 2000.

DOes all locks sequence implemented in WDM is not working in WDF?
KMDF does nothing with your own locks. If you opt into kmdf synchronization or execution levels on your device or queues, kmdf may acquire locks on your behalf

\I did not touch anything on the locks from wdm. what i did is just to convert KeSpinlockAcquire to WdfSpinLockAcquire or what ever is that…etc…
I don’t think that is your issue unless you are forwarding a request to a parent device with a lock held and then trying to acquire that lock in the parent’s queue

D

-----Original Message-----
From: xxxxx@lists.osr.com [mailto:xxxxx@lists.osr.com] On Behalf Of xxxxx@gmail.com
Sent: Saturday, December 15, 2007 4:49 AM
To: Windows System Software Devs Interest List
Subject: RE:[ntdev] may be a Deadlock happens on my Driver, need ur help

>This would not be for twotrack.sys would it :slight_smile: ?
>You said that the filter device object only has a queue for internal ioctls. It would appear
>below that you are forwarding ioctls, not internal ioctls

>to the filter device. Can you post your EvtIoXxx routines for the filter device? Note that power
>managed queues on a filter device can be iffy b/c the filter is not the power policy owner of the
>stack and cannot force the stack into a D0 state.

What is twotrack.sys? maybe that is for the mouse too i think…I used that forwardRequest as what my co worker gave to me as reference…

If I have to

anyway… I have another questions…thanks for your information by the way…

What i want with my driver is be able to handle many application or events run over it.
DOes all locks sequence implemented in WDM is not working in WDF?
\I did not touch anything on the locks from wdm. what i did is just to convert KeSpinlockAcquire to WdfSpinLockAcquire or what ever is that…etc…

the details for my application is that, we filter the data from mousescrollwheel ,that if the scrollwheel was press the cursor will be displayed depending what image does the user loaded to the settings in the control panel…

On our driver we created a control device to process the user application request…
but seems like


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

I will ask one by one on what was done on my driver…

  1. is this OK to declare this three variable globally?
    //
    // Collection object is used to store all the FilterDevice objects so
    // that any event callback routine can easily walk thru the list and pick a
    // specific instance of the device for filtering.
    //
    WDFCOLLECTION FilterDeviceCollection;
    WDFWAITLOCK FilterDeviceCollectionLock;
    WDFDEVICE ControlDevice;

  2. On my driver entry, is it correct to make a collection of filter device? i just follow the filter.c in TOASTER. here’s the codes…

//
// Since there is only one control-device for all the instances
// of the physical device, we need an ability to get to particular instance
// of the device in our FilterEvtIoDeviceControlForControl. For that we
// will create a collection object and store filter device objects.
//
WDF_OBJECT_ATTRIBUTES_INIT(&colAttributes);
colAttributes.ParentObject = hDriver;

status = WdfCollectionCreate(&colAttributes,
&FilterDeviceCollection);
///locks
WDF_OBJECT_ATTRIBUTES_INIT(&colAttributes);
colAttributes.ParentObject = hDriver;

status = WdfWaitLockCreate(&colAttributes,
&FilterDeviceCollectionLock);

  1. Codes internally FOR my FOR_SECOND_EVENT IOCTL…is this ok, refer below? i just converted it from wdm to wdf…here’s the code…

//for wdm:
KeInitializeEvent(&eventSendDone, NotificationEvent, FALSE);
InternalIrp = IoBuildDeviceIoControlRequest
( IOCTL_INTERNAL_I8042_MOUSE_WRITE_BUFFER,
devExt->TopOfStack,
&devExt->Byteholder,
sizeof(devExt->Byteholder),
NULL,
0,
TRUE,
&eventSendDone,
&AppIrp->IoStatus
);

if (!InternalIrp) {
KeAcquireSpinLock(pSpinLock, &currentIrql);
devExt->StartedWrite = FALSE;
KeReleaseSpinLock(pSpinLock, currentIrql);
AppIrp->IoStatus.Status = STATUS_UNSUCCESSFUL;
AppIrp->IoStatus.Information = 0;
IoCompleteRequest(AppIrp, IO_NO_INCREMENT);
return STATUS_UNSUCCESSFUL;
}
status = IoCallDriver(devExt->TopOfStack, InternalIrp);

for WDF CODES:…
WDF_OBJECT_ATTRIBUTES_INIT_CONTEXT_TYPE(
&attributes,SET_EVENT_REQUEST_COMPLETION_CONTEXT);
status = WdfRequestCreate(&attributes,
WdfDeviceGetIoTarget(devExt->WdfDevice),
&InternalRequest);
setEventContext = GetSetEventContext(InternalRequest);
WdfRequestSetCompletionRoutine(InternalRequest,
SetEventRequestCompletionRoutine,
setEventContext);
KeInitializeEvent(&setEventContext->eventSendDone, NotificationEvent, FALSE);

status = WdfMemoryCreatePreallocated(WDF_NO_OBJECT_ATTRIBUTES,
&devExt->SendContext.FirstByte,
sizeof(devExt->SendContext.FirstByte),
&memory);
status = WdfIoTargetFormatRequestForInternalIoctl(
WdfDeviceGetIoTarget(devExt->WdfDevice),
InternalRequest,
IOCTL_INTERNAL_I8042_MOUSE_WRITE_BUFFER,
memory, NULL, WDF_NO_HANDLE,NULL);
if (!NT_SUCCESS(status)) {
WdfSpinLockAcquire(devExt->WdfISRSpinLock);
devExt->StartedWrite = FALSE;
WdfSpinLockRelease(devExt->WdfISRSpinLock);
AppIrp->IoStatus.Status = STATUS_UNSUCCESSFUL;
AppIrp->IoStatus.Information = 0;
IoCompleteRequest(AppIrp, IO_NO_INCREMENT);
return STATUS_UNSUCCESSFUL;
}
status = WdfRequestSend(InternalRequest,
WdfDeviceGetIoTarget(devExt->WdfDevice),
NULL);

does my conversion correct?
I am still using some of the WDM function in wdf, like for example the IoCompleteRequest(… is it ok?

sorry if I have lots of question… I know I must read some of the msdn reference but I don’t have time…komattana…

xxxxx@gmail.com wrote:

I will ask one by one on what was done on my driver…

  1. is this OK to declare this three variable globally?
    //
    // Collection object is used to store all the FilterDevice objects so
    // that any event callback routine can easily walk thru the list and pick a
    // specific instance of the device for filtering.
    //
    WDFCOLLECTION FilterDeviceCollection;
    WDFWAITLOCK FilterDeviceCollectionLock;
    WDFDEVICE ControlDevice;

This comes straight from the KMDF filter sample, right? That should
answer your question.

  1. On my driver entry, is it correct to make a collection of filter device? i just follow the filter.c in TOASTER. here’s the codes…

Yes, this is copied straight from the sample.

  1. Codes internally FOR my FOR_SECOND_EVENT IOCTL…is this ok, refer below? i just converted it from wdm to wdf…here’s the code…

    does my conversion correct?

Who are you sending your request to? Where did it devExt->WdfDevice
come from?

I am still using some of the WDM function in wdf, like for example the IoCompleteRequest(… is it ok?

Where did “AppIrp” come from? If you pulled it out of a WDFREQUEST,
which believes it owns the IRP, then it should be patently obvious that
you can’t go around the framework and complete it yourself.

sorry if I have lots of question… I know I must read some of the msdn reference but I don’t have time…

I know I should answer your question, but I don’t have time.

Do you really not understand how incredibly rude that statement was?
You are asking all of US to use OUR time to offer free help to you,
because YOU don’t have the time to look up the information yourself.

There is at least one good book on KMDF, and the online documentation
for KMDF is very good. Use it.

Good luck.


Tim Roberts, xxxxx@probo.com
Providenza & Boekelheide, Inc.

>>I know I should answer your question, but I don’t have time. Do you really not understand how incredibly rude that statement was? You are asking all of US to use OUR time to offer free help to you, because YOU don’t have the time to look up the information yourself. There is at least one good book on KMDF, and the online documentation for KMDF is very good. Use it.

I am very sorry for that rude statement, It doesn’t mean that I don’t read it, Of course I read it but reading without background at all that makes me a question mark after reading it, since i am only months on handling dev driver dev’t, but what I mean is, I am not pretty sure of my implementation that is why I am confirming it here. Hope u understand…

xxxxx@gmail.com wrote:

I am very sorry for that rude statement, It doesn’t mean that I don’t read it, Of course I read it but reading without background at all that makes me a question mark after reading it, since i am only months on handling dev driver dev’t, but what I mean is, I am not pretty sure of my implementation that is why I am confirming it here. Hope u understand…

Sure, and I think you will find most of us are more than willing to
answer specific questions, or to offer suggestions when you post
sections of code that aren’t working as you expect. However, when
people say something like “I need you to help me write an XXX driver –
I need to start from scratch,” then it’s much more difficult to get
motivated into writing a response.


Tim Roberts, xxxxx@probo.com
Providenza & Boekelheide, Inc.

Requests can be delivered immediately or queued for later delivery or retrieval, depending on queue configuration

in wdf,

can anybody give a sample code of delivering request immediately?
queue requests for later delivery or retrieval?

How to configure queue for delivering request immediately or queueing the request for later delivery?

This is simple and yet a little complicated at the same time.

  1. A non power managed queue will deliver requests immediately if it is in a started (which is the default) state.
  2. A power managed queue will deliver requests immediately if it is in a started (again, the default) state and the device is in D0
  3. A power managed queue will defer requests if it is in the started state but the device is in Dx. For a mouse stack, there is no idling out during S0 so you will not see this case in S0 for your mouse filter driver
  4. A queue, power managed or non power managed, in the stopped state (WdfIoQueueStop) will defer requests until it is in the started state

so, based on this, you control how the queues immediately deliver requests by first determining if you need a power managed queue or not. I think you do based on the IOCTLs you are sending to the port driver to touch hw. After that, if you are not making any calls to WdfIoQueueStart/Stop than you are done.

Once you get into the deadlock situation you can also use !wdfkd.wdfdevicequeues and !wdfkd.wdfqueue to give you the current state of the queues which will tell you if they are delivering requests (I think it is called “dispatching” in the output) or not.

d

-----Original Message-----
From: xxxxx@lists.osr.com [mailto:xxxxx@lists.osr.com] On Behalf Of xxxxx@gmail.com
Sent: Wednesday, December 19, 2007 10:30 PM
To: Windows System Software Devs Interest List
Subject: RE:[ntdev] may be a Deadlock happens on my Driver, need ur help

Requests can be delivered immediately or queued for later delivery or retrieval, depending on queue configuration

in wdf,

can anybody give a sample code of delivering request immediately?
queue requests for later delivery or retrieval?

How to configure queue for delivering request immediately or queueing the request for later delivery?


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

xxxxx@gmail.com wrote:

Requests can be delivered immediately or queued for later delivery or retrieval, depending on queue configuration

in wdf,

can anybody give a sample code of delivering request immediately?
queue requests for later delivery or retrieval?

How to configure queue for delivering request immediately or queueing the request for later delivery?

Doron gave a good description of how stop/start and power management can
affect this, but I somehow suspect you are asking a more fundamental
question. I believe this quote is actually referring to the type of
queue. A parallel queue delivers requests immediately. A serial queue
delivers one requests at a time; if a request is already in progress, it
will hold any new requests. As soon as the outstanding request is
completed, it will automatically deliver the next one. A manual queue
always holds requests until you go retrieve them.


Tim Roberts, xxxxx@probo.com
Providenza & Boekelheide, Inc.

>>This is simple and yet a little complicated at the same time. 1) A non power managed queue will deliver requests immediately if it is in a started (which is the default) state. 2) A power managed queue will deliver requests immediately if it is in a started (again, the default) state and the device is in D0 3) A power managed queue will defer requests if it is in the started state but the device is in Dx. For a mouse stack, there is no idling out during S0 so you will not see this case in S0 for your mouse filter driver 4) A queue, power managed or non power managed, in the stopped state (WdfIoQueueStop) will defer requests until it is in the started state so, based on this, you control how the queues immediately deliver requests by first determining if you need a power managed queue or not. I think you do based on the IOCTLs you are sending to the port driver to touch hw. After that, if you are not making any calls to WdfIoQueueStart/Stop than you are done. Once you get into the deadlock situation you can also use !wdfkd.wdfdevicequeues and !wdfkd.wdfqueue to give you the current state of the queues which will tell you if they are delivering requests (I think it is called “dispatching” in the output) or not.
>>>

DORON-saMA, Tim-sama…Thank you very much… your ideas help me a lot with my current situation…

You both great…GOD BLESS ya ALL

THANK YOU VERY MUCH…