From 29d57097b8a1915d1fdbd8822117c096bb9e8dae Mon Sep 17 00:00:00 2001 From: Zebediah Figura Date: Tue, 29 Jan 2019 21:50:37 -0600 Subject: [PATCH] ntoskrnl.exe: Implement ExIsResourceAcquiredExclusiveLite(). Signed-off-by: Zebediah Figura --- dlls/ntoskrnl.exe/ntoskrnl.exe.spec | 2 +- dlls/ntoskrnl.exe/sync.c | 19 +++++++++++++++++++ include/ddk/wdm.h | 1 + 3 files changed, 21 insertions(+), 1 deletion(-) diff --git a/dlls/ntoskrnl.exe/ntoskrnl.exe.spec b/dlls/ntoskrnl.exe/ntoskrnl.exe.spec index 51ba575..8892b7c 100644 --- a/dlls/ntoskrnl.exe/ntoskrnl.exe.spec +++ b/dlls/ntoskrnl.exe/ntoskrnl.exe.spec @@ -165,7 +165,7 @@ @ stub ExInterlockedPushEntryList @ stdcall ExInterlockedRemoveHeadList(ptr ptr) @ stub ExIsProcessorFeaturePresent -@ stub ExIsResourceAcquiredExclusiveLite +@ stdcall ExIsResourceAcquiredExclusiveLite(ptr) @ stub ExIsResourceAcquiredSharedLite @ stdcall ExLocalTimeToSystemTime(ptr ptr) RtlLocalTimeToSystemTime @ stub ExNotifyCallback diff --git a/dlls/ntoskrnl.exe/sync.c b/dlls/ntoskrnl.exe/sync.c index c63d739..0f71902 100644 --- a/dlls/ntoskrnl.exe/sync.c +++ b/dlls/ntoskrnl.exe/sync.c @@ -1045,3 +1045,22 @@ ULONG WINAPI ExGetSharedWaiterCount( ERESOURCE *resource ) return count; } + +/*********************************************************************** + * ExIsResourceAcquiredExclusiveLite (NTOSKRNL.EXE.@) + */ +BOOLEAN WINAPI ExIsResourceAcquiredExclusiveLite( ERESOURCE *resource ) +{ + BOOLEAN ret; + KIRQL irql; + + TRACE("resource %p.\n", resource); + + KeAcquireSpinLock( &resource->SpinLock, &irql ); + + ret = (resource->OwnerEntry.OwnerThread == (ERESOURCE_THREAD)KeGetCurrentThread()); + + KeReleaseSpinLock( &resource->SpinLock, irql ); + + return ret; +} diff --git a/include/ddk/wdm.h b/include/ddk/wdm.h index 1c58ab9..80a82b0 100644 --- a/include/ddk/wdm.h +++ b/include/ddk/wdm.h @@ -1531,6 +1531,7 @@ NTSTATUS WINAPI ExInitializeResourceLite(ERESOURCE*); PSLIST_ENTRY WINAPI ExInterlockedPopEntrySList(PSLIST_HEADER,PKSPIN_LOCK); PSLIST_ENTRY WINAPI ExInterlockedPushEntrySList(PSLIST_HEADER,PSLIST_ENTRY,PKSPIN_LOCK); LIST_ENTRY * WINAPI ExInterlockedRemoveHeadList(LIST_ENTRY*,KSPIN_LOCK*); +BOOLEAN WINAPI ExIsResourceAcquiredExclusiveLite(ERESOURCE*); void WINAPI ExReleaseFastMutexUnsafe(PFAST_MUTEX); void WINAPI ExReleaseResourceForThreadLite(ERESOURCE*,ERESOURCE_THREAD); ULONG WINAPI ExSetTimerResolution(ULONG,BOOLEAN); -- 1.9.1