Szerkesztés

Megosztás a következőn keresztül:


KsInvalidStreamPointer rule (ks)

The KsInvalidStreamPointer rule verifies if a KS miniport driver provides a valid KS Stream Pointer as a function argument. Typical violations are caused by incorrect pointer handling or a pointer corruption caused by incorrect use of memory.

A valid stream pointer is a leading or trailing edge stream pointer or a stream pointer that has been cloned via KsStreamPointerClone. For more information see Leading and Trailing Edge Stream Pointers.

This rule also verifies that KsStreamPointerDelete has not been used to attempt to delete a non-cloned stream pointer.

Driver model: KS

Bug check(s) found with this rule: Bug Check 0xC4: DRIVER_VERIFIER_DETECTED_VIOLATION (0x0008100C)

Example

The following code violates this rule.

PKKSSTREAM_POINTER StreamPointer = KsPinGetLeadingEdgeStreamPointer (Pin, KSSTREAM_POINTER_STATE_UNLOCKED);

//
// ERROR: KsStreamPointerDelete can only be called on clone stream pointers.
//

KsStreamPointerDelete (StreamPointer);

This code also violates the rule.

KsStreamPointerDelete (NULL);

How to test

At run time

To verify this rule, open a Command Prompt window. Enter a Driver Verifier command and specify /domain ks.

For example:

For more information, see Driver Verifier.

verifier /domain ks [options] /driver <yourdriver>

At run time

Run Driver Verifier and select the DDI compliance checking option.

Applies to

KsStreamPointerDelete

KsStreamPointerAdvance

KsStreamPointerAdvanceOffsetsAndUnlock

KsStreamPointerCancelTimeout

KsStreamPointerGetIrp

KsStreamPointerGetMdl

KsStreamPointerGetNextClone

KsStreamPointerLock

KsStreamPointerScheduleTimeout

KsStreamPointerSetStatusCode

KsStreamPointerUnlock