From 15fd135cd7bc46416235eee58ebac0d35d8e0d9e Mon Sep 17 00:00:00 2001 From: Zebediah Figura Date: Tue, 29 Jan 2019 21:48:49 -0600 Subject: [PATCH 09/13] ntoskrnl.exe: Implement ExGetExclusiveWaiterCount(). 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 79db7ee8..3d6ed649 100644 --- a/dlls/ntoskrnl.exe/ntoskrnl.exe.spec +++ b/dlls/ntoskrnl.exe/ntoskrnl.exe.spec @@ -146,7 +146,7 @@ @ stub ExFreeToPagedLookasideList @ stub ExGetCurrentProcessorCounts @ stub ExGetCurrentProcessorCpuUsage -@ stub ExGetExclusiveWaiterCount +@ stdcall ExGetExclusiveWaiterCount(ptr) @ stub ExGetPreviousMode @ stub ExGetSharedWaiterCount @ stdcall ExInitializeNPagedLookasideList(ptr ptr ptr long long long long) diff --git a/dlls/ntoskrnl.exe/sync.c b/dlls/ntoskrnl.exe/sync.c index 705ea2c7..d024ee9f 100644 --- a/dlls/ntoskrnl.exe/sync.c +++ b/dlls/ntoskrnl.exe/sync.c @@ -1031,3 +1031,22 @@ void WINAPI ExReleaseResourceLite( ERESOURCE *resource ) { ExReleaseResourceForThreadLite( resource, (ERESOURCE_THREAD)KeGetCurrentThread() ); } + +/*********************************************************************** + * ExGetExclusiveWaiterCount (NTOSKRNL.EXE.@) + */ +ULONG WINAPI ExGetExclusiveWaiterCount( ERESOURCE *resource ) +{ + ULONG count; + KIRQL irql; + + TRACE("resource %p.\n", resource); + + KeAcquireSpinLock( &resource->SpinLock, &irql ); + + count = resource->NumberOfExclusiveWaiters; + + KeReleaseSpinLock( &resource->SpinLock, irql ); + + return count; +} diff --git a/include/ddk/wdm.h b/include/ddk/wdm.h index 69efdb7a..f7ced72a 100644 --- a/include/ddk/wdm.h +++ b/include/ddk/wdm.h @@ -1524,6 +1524,7 @@ void WINAPI ExDeleteNPagedLookasideList(PNPAGED_LOOKASIDE_LIST); NTSTATUS WINAPI ExDeleteResourceLite(ERESOURCE*); void WINAPI ExFreePool(PVOID); void WINAPI ExFreePoolWithTag(PVOID,ULONG); +ULONG WINAPI ExGetExclusiveWaiterCount(ERESOURCE*); void WINAPI ExInitializeNPagedLookasideList(PNPAGED_LOOKASIDE_LIST,PALLOCATE_FUNCTION,PFREE_FUNCTION,ULONG,SIZE_T,ULONG,USHORT); NTSTATUS WINAPI ExInitializeResourceLite(ERESOURCE*); PSLIST_ENTRY WINAPI ExInterlockedPopEntrySList(PSLIST_HEADER,PKSPIN_LOCK); -- 2.20.1