ExAcquireResourceExclusiveLite - NtDoc

Native API online documentation, based on the System Informer (formerly Process Hacker) phnt headers
// wdm.h

BOOLEAN ExAcquireResourceExclusiveLite(
  [in, out] PERESOURCE Resource,
  [in]      BOOLEAN    Wait
);

View the official Windows Driver Kit DDI reference

NtDoc

No description available.

Windows Driver Kit DDI reference (nf-wdm-exacquireresourceexclusivelite)

Description

The ExAcquireResourceExclusiveLite routine acquires the given resource for exclusive access by the calling thread.

Parameters

Resource [in, out]

A pointer to the resource to acquire.

Wait [in]

Specifies the routine's behavior whenever the resource cannot be acquired immediately. If TRUE, the caller is put into a wait state until the resource can be acquired. If FALSE, the routine immediately returns, regardless of whether the resource can be acquired.

Return value

ExAcquireResourceExclusiveLite returns TRUE if the resource is acquired. This routine returns FALSE if the input Wait is FALSE and exclusive access cannot be granted immediately.

Remarks

The following list describes whether and when a caller is given exclusive access to a given resource:

If two threads each hold a shared lock on the same resource and both attempt to acquire the lock exclusively without releasing their shared lock, they will deadlock. This means that each thread will wait for the other to release its shared hold on the lock, and neither will release its shared hold until the other does.

The caller can release the resource by calling either ExReleaseResourceLite or ExReleaseResourceForThreadLite.

Normal kernel APC delivery must be disabled before calling this routine. Disable normal kernel APC delivery by calling KeEnterCriticalRegion. Delivery must remain disabled until the resource is released, at which point it can be reenabled by calling KeLeaveCriticalRegion. For more information, see Disabling APCs.

See also

ExAcquireResourceSharedLite

ExGetExclusiveWaiterCount

ExGetSharedWaiterCount

ExInitializeResourceLite

ExIsResourceAcquiredExclusiveLite

ExReinitializeResourceLite

ExReleaseResourceForThreadLite

ExReleaseResourceLite

KeEnterCriticalRegion

KeLeaveCriticalRegion