Windows System Software -- Consulting, Training, Development -- Unique Expertise, Guaranteed Results

Before Posting...
Please check out the Community Guidelines in the Announcements and Administration Category.

Problem in implement cancel queue on IRP Create

santosh_menonsantosh_menon Member Posts: 7

i am trying to implement cancel queue on IRP Create
i got a sample from here
https://github.com/microsoft/Windows-driver-samples/tree/master/filesys/miniFilter/cancelSafe
i want to convert following code for IRP Create, What changes should i made

//This routine empties the cancel safe queue and complete all the
// pended pre-read operations.
VOID PreReadEmptyQueueAndComplete(
    _In_ PINSTANCE_CONTEXT InstanceContext
    )

{
    NTSTATUS Status;
    FLT_PREOP_CALLBACK_STATUS callbackStatus;
    PFLT_CALLBACK_DATA Data;
    PQUEUE_CONTEXT QueueCtx;

    do {

        callbackStatus = FLT_PREOP_SUCCESS_NO_CALLBACK;

        Data = FltCbdqRemoveNextIo( &InstanceContext->Cbdq, NULL );

        if (Data) {

            QueueCtx = (PQUEUE_CONTEXT) Data->QueueContext[0];

        //changes here  
            if (!FlagOn(Data->Flags, FLTFL_CALLBACK_DATA_SYSTEM_BUFFER) && 
                Data->Iopb->Parameters.Read.MdlAddress == NULL &&
                Data->Iopb->Parameters.Read.Length > 0) {

                Status = FltLockUserBuffer( Data );

                if (!NT_SUCCESS( Status ))
         {                   

                    callbackStatus = FLT_PREOP_COMPLETE;
                    Data->IoStatus.Status = Status;
                }
            }

            FltCompletePendedPreOperation( Data,callbackStatus, NULL );

            ExFreeToNPagedLookasideList( &Globals.QueueContextLookaside,
                                         QueueCtx );
        }

    } while (Data);
}

plz help

Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Upcoming OSR Seminars
OSR has suspended in-person seminars due to the Covid-19 outbreak. But, don't miss your training! Attend via the internet instead!
Kernel Debugging 30 Mar 2020 OSR Seminar Space
Developing Minifilters 20 Apr 2020 LIVE ONLINE
Writing WDF Drivers 11 May 2020 LIVE ONLINE
Internals & Software Drivers 28 Sept 2020 Dulles, VA