wine-staging/patches/ntoskrnl.exe-Resources/0011-ntoskrnl.exe-Implement-ExIsResourceAcquiredExclusive.patch

69 lines
2.5 KiB
Diff
Raw Normal View History

2019-02-19 16:59:41 -08:00
From 7a4285a1f926b9a1caba1f815b9b781857a0997e Mon Sep 17 00:00:00 2001
From: Zebediah Figura <z.figura12@gmail.com>
Date: Tue, 29 Jan 2019 21:50:37 -0600
Subject: [PATCH 11/13] ntoskrnl.exe: Implement
ExIsResourceAcquiredExclusiveLite().
Signed-off-by: Zebediah Figura <z.figura12@gmail.com>
---
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 45553e06..66f0b7d9 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 ad68e7ea..cee15605 100644
--- a/dlls/ntoskrnl.exe/sync.c
+++ b/dlls/ntoskrnl.exe/sync.c
@@ -1069,3 +1069,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 7a4be723..76eb6117 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);
--
2.20.1