[RTL]
authorThomas Faber <thomas.faber@reactos.org>
Thu, 15 Jun 2017 06:47:42 +0000 (06:47 +0000)
committerThomas Faber <thomas.faber@reactos.org>
Thu, 15 Jun 2017 06:47:42 +0000 (06:47 +0000)
- Implement RtlIsCriticalSectionLocked and RtlIsCriticalSectionLockedByThread
CORE-13436 #resolve

svn path=/trunk/; revision=75043

reactos/dll/ntdll/def/ntdll.spec
reactos/sdk/include/ndk/rtlfuncs.h
reactos/sdk/lib/rtl/critical.c

index 5c54b4c..04103df 100644 (file)
 732 stdcall RtlIpv6StringToAddressExW(wstr ptr ptr ptr)
 733 stdcall RtlIpv6StringToAddressW(wstr ptr ptr)
 734 stdcall RtlIsActivationContextActive(ptr)
-# stdcall RtlIsCriticalSectionLocked
-# stdcall RtlIsCriticalSectionLockedByThread
+735 stdcall RtlIsCriticalSectionLocked(ptr)
+736 stdcall RtlIsCriticalSectionLockedByThread(ptr)
 737 stdcall RtlIsDosDeviceName_U(wstr)
 738 stdcall RtlIsGenericTableEmpty(ptr)
 739 stdcall RtlIsGenericTableEmptyAvl(ptr)
index 30b61ed..68d474f 100644 (file)
@@ -3025,6 +3025,20 @@ RtlInitializeCriticalSectionAndSpinCount(
     _In_ ULONG SpinCount
 );
 
+NTSYSAPI
+ULONG
+NTAPI
+RtlIsCriticalSectionLocked(
+    _In_ PRTL_CRITICAL_SECTION CriticalSection
+);
+
+NTSYSAPI
+ULONG
+NTAPI
+RtlIsCriticalSectionLockedByThread(
+    _In_ PRTL_CRITICAL_SECTION CriticalSection
+);
+
 NTSYSAPI
 NTSTATUS
 NTAPI
index 3f5a9dc..ff0d1a9 100644 (file)
@@ -786,4 +786,19 @@ RtlCheckForOrphanedCriticalSections(HANDLE ThreadHandle)
     UNIMPLEMENTED;
 }
 
+ULONG
+NTAPI
+RtlIsCriticalSectionLocked(PRTL_CRITICAL_SECTION CriticalSection)
+{
+    return CriticalSection->RecursionCount != 0;
+}
+
+ULONG
+NTAPI
+RtlIsCriticalSectionLockedByThread(PRTL_CRITICAL_SECTION CriticalSection)
+{
+    return CriticalSection->OwningThread == NtCurrentTeb()->ClientId.UniqueThread &&
+           CriticalSection->RecursionCount != 0;
+}
+
 /* EOF */