The sample code swapBuffers.c seems missing a call of
FltCompletePendedPostOperation in its
SwapPostDirCtrlBuffersWhenSafe routine. In SwapPostDirCtrlBuffers, there is
a piece of code like this:
In SwapPostDirCtrlBuffersWhenSafe, it returns
FLT_POSTOP_FINISHED_PROCESSING.
The DDK document says that retValue can be
FLT_POSTOP_MORE_PROCESSING_REQUIRED if FltDoCompletionProcessingWhenSafe
posts the I/O operation to a worker thread and calls the SafePostCallback
routine from the worker thread. In this case, the Post-Op returns
FLT_POSTOP_MORE_PROCESSING_REQUIRED, but the Callback data will never be
completed.
Should the routine of SwapPostDirCtrlBuffersWhenSafe call
FltCompletePendedPostOperation to complete the IRP?
I am not sure that the sample is incorrect or the document is incorrect.
I believe that many developers are referring DDK samples for their
production filters. Please clarify this by any MS engineer or some experts.
I think, you should call FltCompletePendedPostOperation function only if you return FLT_POSTOP_MORE_PROCESSING_REQUIRED (i.e. you’re pending post-operation callback) and when you’ve finished your processing you need to restart the I/O by calling FltCompletePendedPostOperation. In SwapBuffer example, it has nothing much to do with that return code, because FltDoCompletionProcessingWhenSafe says: call my completion routine again at < DPC_LEVEL (but it’s not your driver who’s pending post-operation).
doc is little misleading
-pk
“Shangwu” wrote in message news:xxxxx@ntfsd… > The sample code swapBuffers.c seems missing a call of > FltCompletePendedPostOperation in its > SwapPostDirCtrlBuffersWhenSafe routine. In SwapPostDirCtrlBuffers, there is > a piece of code like this: > > FltDoCompletionProcessingWhenSafe( Data, FltObjects, CompletionContext, > Flags, > SwapPostDirCtrlBuffersWhenSafe, &retValue ); > … > return retValue; > > In SwapPostDirCtrlBuffersWhenSafe, it returns > FLT_POSTOP_FINISHED_PROCESSING. > > The DDK document says that retValue can be > FLT_POSTOP_MORE_PROCESSING_REQUIRED if FltDoCompletionProcessingWhenSafe > posts the I/O operation to a worker thread and calls the SafePostCallback > routine from the worker thread. In this case, the Post-Op returns > FLT_POSTOP_MORE_PROCESSING_REQUIRED, but the Callback data will never be > completed. > > Should the routine of SwapPostDirCtrlBuffersWhenSafe call > FltCompletePendedPostOperation to complete the IRP? > I am not sure that the sample is incorrect or the document is incorrect. > I believe that many developers are referring DDK samples for their > production filters. Please clarify this by any MS engineer or some experts. > > Thanks, > > Shangwu > > > > >
I am not talking about how my driver works. Of course I know when I need to
call FltCompletePendedPostOperation in my driver code. I am asking if the
sample is correct or not when it calls FltDoCompletionProcessingWhenSafe.
Because in some conditions, it will set the return value as
FLT_POSTOP_MORE_PROCESSING_REQUIRED (based on the document) that will be
returned to I/O manager by the post-op-routine. But the sample code does not
call FltCompletePendedPostOperation at all.
“Petr Kurtin” wrote in message news:xxxxx@ntfsd… I think, you should call FltCompletePendedPostOperation function only if you return FLT_POSTOP_MORE_PROCESSING_REQUIRED (i.e. you’re pending post-operation callback) and when you’ve finished your processing you need to restart the I/O by calling FltCompletePendedPostOperation. In SwapBuffer example, it has nothing much to do with that return code, because FltDoCompletionProcessingWhenSafe says: call my completion routine again at < DPC_LEVEL (but it’s not your driver who’s pending post-operation).
doc is little misleading
-pk
“Shangwu” wrote in message news:xxxxx@ntfsd… > The sample code swapBuffers.c seems missing a call of > FltCompletePendedPostOperation in its > SwapPostDirCtrlBuffersWhenSafe routine. In SwapPostDirCtrlBuffers, there > is > a piece of code like this: > > FltDoCompletionProcessingWhenSafe( Data, FltObjects, CompletionContext, > Flags, > SwapPostDirCtrlBuffersWhenSafe, &retValue ); > … > return retValue; > > In SwapPostDirCtrlBuffersWhenSafe, it returns > FLT_POSTOP_FINISHED_PROCESSING. > > The DDK document says that retValue can be > FLT_POSTOP_MORE_PROCESSING_REQUIRED if FltDoCompletionProcessingWhenSafe > posts the I/O operation to a worker thread and calls the SafePostCallback > routine from the worker thread. In this case, the Post-Op returns > FLT_POSTOP_MORE_PROCESSING_REQUIRED, but the Callback data will never be > completed. > > Should the routine of SwapPostDirCtrlBuffersWhenSafe call > FltCompletePendedPostOperation to complete the IRP? > I am not sure that the sample is incorrect or the document is incorrect. > I believe that many developers are referring DDK samples for their > production filters. Please clarify this by any MS engineer or some > experts. > > Thanks, > > Shangwu > > > > >