Bewerken

Delen via


ExclusiveResourceAccess rule (wdm)

The ExclusiveResourceAccess rule specifies that the driver calls ExAcquireResourceExclusiveLite before calling ExReleaseResourceLite or ExReleaseResourceForThreadLite and specifies that the driver calls ExReleaseResourceLite or ExReleaseResourceForThreadLite before any subsequent calls to ExAcquireResourceExclusiveLite.

Nested calls are permitted if they are acquiring and releasing different resources. Nested calls to acquire or release the same resources violate this rule.

This rule also states that when the routine ends, the driver must not have exclusive access to the resource. Static Driver Verifier monitors the end of the DriverEntry, AddDevice, StartIo, StartDevice, DpcForIsr, Cancel, Dispatch, RemoveDevice, and Unload routines.

Driver model: WDM

Bug check(s) found with this rule

How to test

At compile time

Run Static Driver Verifier and specify the ExclusiveResourceAccess rule.

Use the following steps to run an analysis of your code:
  1. Prepare your code (use role type declarations).
  2. Run Static Driver Verifier.
  3. View and analyze the results.

For more information, see Using Static Driver Verifier to Find Defects in Drivers.

Applies to

ExAcquireResourceExclusiveLite ExReleaseResourceForThreadLite ExReleaseResourceLite

See also

Preventing Errors and Deadlocks While Using Spin Locks