Hi
I am having trouble with my encryption driver on Floppies (it works fine
with hard drives so I guess it is a speed issue as it is the same code being
executed). Some of the files end up corrupt and I think it is lazy writing
and the completion routine that is causing the problem. So I would like a
few questions answered if possible.
(1) Is there anything wrong with the following code if I do not need to
process a completion
/* Get a pointer to the current stack location in the IRP */
PIO_STACK_LOCATION irpSp = IoGetCurrentIrpStackLocation( Irp );
/* Setup Next Driver */
IoCopyCurrentIrpStackLocationToNext(Irp);
/* Setup Default completion Routine */
IoSetCompletionRoutine(Irp, SFilterDefaultCompletion, NULL, FALSE, FALSE,
FALSE);
/* Call Next driver */
return (IoCallDriver …
(2) Does a completion routine ever get called before the write has finished
? If so how do I wait for the IRP to finish in my completion routine ?
Thanks for all the help so far. I nearly have a working product
TTFN
Paul Delivett
Paul Delivett wrote
> (1) Is there anything wrong with the following code if I do not
need to
> process a completion
>
> /* Get a pointer to the current stack location in the IRP /
> PIO_STACK_LOCATION irpSp = IoGetCurrentIrpStackLocation( Irp );
> / Setup Next Driver /
> IoCopyCurrentIrpStackLocationToNext(Irp);
> / Setup Default completion Routine /
> IoSetCompletionRoutine(Irp, SFilterDefaultCompletion, NULL,
FALSE, FALSE,
> FALSE);
> / Call Next driver */
> return (IoCallDriver …
This should be OK but the call to IoSetCompletionRoutine is
unncessary. Your last three FALSE values ensure that the
completion handler never gets called, which is the default set up
by the IoCopyCurrentIrpStackLocationToNext macro. Look for the
definition of those functions in the Win2K DDK tree.
> (2) Does a completion routine ever get called before the write
has
> finished?
No, it doesn’t.
> (2) Does a completion routine ever get called before the write has
finished
? If so how do I wait for the IRP to finish in my completion routine ?
No, it will be called only when the write finishes. No need to wait.
Max