FltAcquireResourceExclusive routine

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

Syntax


VOID FltAcquireResourceExclusive(
  _Inout_ PERESOURCE Resource
);

Parameters

Resource [in, out]

A pointer to an opaque ERESOURCE structure. This structure must be allocated by the caller from nonpaged pool and initialized by calling ExInitializeResourceLite or ExReinitializeResourceLite.

Return value

None

Remarks

This routine is available on Windows XP with Service Pack 2 (SP2), Windows Server 2003 with Service Pack 1 (SP1), and later versions of Windows.

FltAcquireResourceExclusive acquires the given resource for exclusive access by the calling thread.

The following circumstances determine whether or when the caller is given exclusive access to the given resource:

  • If the resource is currently not owned, exclusive access is granted immediately to the current thread.

  • If the caller already has acquired the resource for exclusive access, the current thread is granted the same type of access recursively.

  • Callers who have shared access to the resource must release the lock and then reacquire it exclusively.

  • If the resource is currently owned as exclusive by another thread, or if the caller only has shared access to the resource, the current thread is put into a wait state until the resource can be acquired.

Note   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.
 

FltAcquireResourceExclusive is a wrapper for ExAcquireResourceExclusiveLite that disables normal kernel APC delivery.

Because FltAcquireResourceExclusive disables normal kernel APC delivery, it is not necessary to call KeEnterCriticalRegion or FsRtlEnterFileSystem before calling FltAcquireResourceExclusive.

To release the resource after it is acquired, call FltReleaseResource. Every successful call to FltAcquireResourceExclusive must be matched by a subsequent call to FltReleaseResource.

To acquire a resource for shared access, call FltAcquireResourceShared.

To delete a resource from the system's resource list, call ExDeleteResourceLite.

To initialize a resource for reuse, call ExReinitializeResourceLite.

For more information about ERESOURCE structures, see Introduction to ERESOURCE Routines in the Kernel Architecture Design Guide.

Requirements

Target platform

Universal

Version

Available in Windows XP SP2, Windows Server 2003 SP1, and later versions of all Windows operating systems.

Header

Fltkernel.h (include Fltkernel.h)

Library

FltMgr.lib

IRQL

<= APC_LEVEL

See also

ExAcquireResourceExclusiveLite
ExDeleteResourceLite
ExInitializeResourceLite
ExReinitializeResourceLite
FltAcquireResourceShared
FltReleaseResource
FsRtlEnterFileSystem
KeEnterCriticalRegion

 

 

Send comments about this topic to Microsoft

Show: