Bewerken

Delen via


FltAcquireResourceShared function (fltkernel.h)

The FltAcquireResourceShared routine acquires the given resource for shared access by the calling thread.

Syntax

VOID FLTAPI FltAcquireResourceShared(
  [in/out] PERESOURCE Resource
);

Parameters

[in/out] Resource

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

FltAcquireResourceShared routine acquires the given resource for shared access by the calling thread.

Whether or when the caller is given shared access to the given resource depends on the following:

  • If the resource is currently unowned, shared access is granted immediately to the current thread.

  • If the caller already has acquired the resource (for shared or exclusive access), the current thread is granted the same type of access recursively. Note that making this call does not convert a caller's exclusive ownership of a given resource to shared.

  • If the resource is currently owned as shared by another thread and no thread is waiting for exclusive access to the resource, shared access is granted to the caller immediately. The caller is put into a wait state if there is an exclusive waiter.

  • If the resource is currently owned as exclusive by another thread or if there is another thread waiting for exclusive access and the caller does not already have shared access to the resource, the current thread is put into a wait state until the resource can be acquired.

FltAcquireResourceShared is a wrapper for ExAcquireResourceSharedLite that disables normal kernel APC delivery.

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

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

To acquire a resource for exclusive access, call FltAcquireResourceExclusive.

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.

Requirements

Requirement Value
Minimum supported client Windows XP SP2
Minimum supported server Windows Server 2003 SP1
Header fltkernel.h
Library FltMgr.lib
IRQL IRQL <= APC_LEVEL