The other problem is that the completion routine from the previous stack
location is copied. It is not always a problem, but it could be; causing a
completion routine to be called when there may not be one for you stack
location.
Just plain bad code; I am surprised Microsoft has not cleaned this up.
In one of the filter drivers I worked on this DID cause a problem and we had
to check for filters like diskperf screwing up and patch our code
accordingly.
Jamey
-----Original Message-----
From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com] On Behalf Of Jan Bottorff
Sent: Wednesday, November 24, 2004 3:23 PM
To: Windows System Software Devs Interest List
Subject: Re:[ntdev] PagingPathCountEvent-diskperf DDK sample.
PagingPathCountEvent-diskperf DDK sample.On the subject of bugs in the
DiskPerf sample.
Isn’t there a problem in the code in function DiskPerfReadWrite that says:
//
// Copy current stack to next stack.
//
*nextIrpStack = *currentIrpStack;
The DDK macro for IoCopyCurrentIrpStackLocationToNext says:
#define IoCopyCurrentIrpStackLocationToNext( Irp ) { \
PIO_STACK_LOCATION __irpSp; \
PIO_STACK_LOCATION __nextIrpSp; \
__irpSp = IoGetCurrentIrpStackLocation( (Irp) ); \
__nextIrpSp = IoGetNextIrpStackLocation( (Irp) ); \
RtlCopyMemory( __nextIrpSp, __irpSp, FIELD_OFFSET(IO_STACK_LOCATION,
CompletionRoutine)); \
__nextIrpSp->Control = 0; }
Notice the macro clears nextIrpSp->Control, and the DiskPerf code doesn’t.
Questions? First check the Kernel Driver FAQ at
http://www.osronline.com/article.cfm?id=256
You are currently subscribed to ntdev as: xxxxx@tfb.com
To unsubscribe send a blank email to xxxxx@lists.osr.com