Some doubts about WORK_QUEUE_ITEM

I use the ExInitializeWorkItem(&workItem, func, &workItem) to Initialize the WORK_QUEUE_ITEM.

The WDK doucment Indicates that “The callback routine specified in the Routine parameter is responsible for freeing this work item when it is no longer needed by calling ExFreePool or ExFreePoolWithTag”, that means I must free the workItem in workItem callback function? I want free the workItem at driver unloading, is it OK?

Thanks

*I want free the workItem at driver unloading, is it OK?*

What will you do keeping work item unnecessary till that time.
Your callback has already been called and did the job.

Regards
Deepak

On Thu, Jul 8, 2010 at 8:33 AM, wrote:

> I use the ExInitializeWorkItem(&workItem, func, &workItem) to Initialize
> the WORK_QUEUE_ITEM.
>
> The WDK doucment Indicates that “The callback routine specified in the
> Routine parameter is responsible for freeing this work item when it is no
> longer needed by calling ExFreePool or ExFreePoolWithTag”, that means I must
> free the workItem in workItem callback function? I want free the workItem at
> driver unloading, is it OK?
>
> 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
>

What the docs are saying is that you must free it when you are done using it. You can certainly free it at driver unload.

d

-----Original Message-----
From: xxxxx@lists.osr.com [mailto:xxxxx@lists.osr.com] On Behalf Of xxxxx@yahoo.com.cn
Sent: Wednesday, July 07, 2010 8:04 PM
To: Windows System Software Devs Interest List
Subject: [ntdev] Some doubts about WORK_QUEUE_ITEM

I use the ExInitializeWorkItem(&workItem, func, &workItem) to Initialize the WORK_QUEUE_ITEM.

The WDK doucment Indicates that “The callback routine specified in the Routine parameter is responsible for freeing this work item when it is no longer needed by calling ExFreePool or ExFreePoolWithTag”, that means I must free the workItem in workItem callback function? I want free the workItem at driver unloading, is it OK?

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

>I want free the workItem at driver unloading, is it OK?

Yes.


Maxim S. Shatskih
Windows DDK MVP
xxxxx@storagecraft.com
http://www.storagecraft.com