PagingPathCountEvent-diskperf DDK sample.

Hi,

In the sample, the event is initialized as a
NotificationEvent(NON-autoreset) to signaled state, but there’s no
KeClearEvent/ResetEvent found in the code to reset it to non-signaled state.
Seems to me it’s always in signaled state. Then what’s the point of waiting
on it? Shouldn’t that be a SyncEvent?

Thanks,
Calvin


Calvin Guan Software Engineer
ATI Technologies Inc. www.ati.com

PagingPathCountEvent-diskperf DDK sample.I looked at it too. It sure looks like it’s wrong to me. I also noticed the diskperf sample didn’t do anything with remove locks? I’m assuming the toaster filter sample is more correct?

  • Jan
    “Calvin Guan” wrote in message news:xxxxx@ntdev…
    Hi,

    In the sample, the event is initialized as a NotificationEvent(NON-autoreset) to signaled state, but there’s no KeClearEvent/ResetEvent found in the code to reset it to non-signaled state. Seems to me it’s always in signaled state. Then what’s the point of waiting on it? Shouldn’t that be a SyncEvent?

    Thanks,
    Calvin


    Calvin Guan Software Engineer
    ATI Technologies Inc. www.ati.com

Is there any MS people here listening?

Calvin Guan Software Engineer
ATI Technologies Inc. www.ati.com
-----Original Message-----
From: Jan Bottorff [mailto:xxxxx@pmatrix.com]
Sent: November 4, 2004 6:32 PM
To: Windows System Software Devs Interest List
Subject: Re:[ntdev] PagingPathCountEvent-diskperf DDK sample.

I looked at it too. It sure looks like it’s wrong to me. I also noticed the
diskperf sample didn’t do anything with remove locks? I’m assuming the
toaster filter sample is more correct?

  • Jan
    “Calvin Guan” > wrote in message
    news:xxxxx@ntdev news:xxxxx
    Hi,
    In the sample, the event is initialized as a
    NotificationEvent(NON-autoreset) to signaled state, but there’s no
    KeClearEvent/ResetEvent found in the code to reset it to non-signaled state.
    Seems to me it’s always in signaled state. Then what’s the point of waiting
    on it? Shouldn’t that be a SyncEvent?

    Thanks,
    Calvin

    Calvin Guan Software Engineer
    ATI Technologies Inc. www.ati.com


    Questions? First check the Kernel Driver FAQ at
    http://www.osronline.com/article.cfm?id=256

    You are currently subscribed to ntdev as: unknown lmsubst tag argument: ‘’
    To unsubscribe send a blank email to xxxxx@lists.osr.com</news:xxxxx>

PagingPathCountEvent-diskperf DDK sample. As Walter Oney explained in his book, remove locks are of minor importance. Most IRPs require a file object, and the devnode stack will not be disassembled if there are existing file objects referencing it.

With the disk stack, it cannot be disassembled with an FS mounted on it, so, again the remove lock is of minor importance.

Maxim Shatskih, Windows DDK MVP
StorageCraft Corporation
xxxxx@storagecraft.com
http://www.storagecraft.com

----- Original Message -----
From: Jan Bottorff
Newsgroups: ntdev
To: Windows System Software Devs Interest List
Sent: Friday, November 05, 2004 2:32 AM
Subject: Re:[ntdev] PagingPathCountEvent-diskperf DDK sample.

I looked at it too. It sure looks like it’s wrong to me. I also noticed the diskperf sample didn’t do anything with remove locks? I’m assuming the toaster filter sample is more correct?

  • Jan
    “Calvin Guan” wrote in message news:xxxxx@ntdev…
    Hi,

    In the sample, the event is initialized as a NotificationEvent(NON-autoreset) to signaled state, but there’s no KeClearEvent/ResetEvent found in the code to reset it to non-signaled state. Seems to me it’s always in signaled state. Then what’s the point of waiting on it? Shouldn’t that be a SyncEvent?

    Thanks,
    Calvin


    Calvin Guan Software Engineer
    ATI Technologies Inc. www.ati.com


    Questions? First check the Kernel Driver FAQ at http://www.osronline.com/article.cfm?id=256

    You are currently subscribed to ntdev as: unknown lmsubst tag argument: ‘’
    To unsubscribe send a blank email to xxxxx@lists.osr.com

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.

  • Jan

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.

  • Jan

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