Commit 7c46763e authored by Sebastian Lackner's avatar Sebastian Lackner Committed by Alexandre Julliard

ntdll: Implement RtlIsCriticalSectionLocked[ByThread].

parent b028f2c0
......@@ -610,6 +610,43 @@ BOOL WINAPI RtlTryEnterCriticalSection( RTL_CRITICAL_SECTION *crit )
/***********************************************************************
* RtlIsCriticalSectionLocked (NTDLL.@)
*
* Checks if the critical section is locked by any thread.
*
* PARAMS
* crit [I/O] Critical section to check.
*
* RETURNS
* Success: TRUE. The critical section is locked.
* Failure: FALSE. The critical section is not locked.
*/
BOOL WINAPI RtlIsCriticalSectionLocked( RTL_CRITICAL_SECTION *crit )
{
return crit->RecursionCount != 0;
}
/***********************************************************************
* RtlIsCriticalSectionLockedByThread (NTDLL.@)
*
* Checks if the critical section is locked by the current thread.
*
* PARAMS
* crit [I/O] Critical section to check.
*
* RETURNS
* Success: TRUE. The critical section is locked.
* Failure: FALSE. The critical section is not locked.
*/
BOOL WINAPI RtlIsCriticalSectionLockedByThread( RTL_CRITICAL_SECTION *crit )
{
return crit->OwningThread == ULongToHandle(GetCurrentThreadId()) &&
crit->RecursionCount;
}
/***********************************************************************
* RtlLeaveCriticalSection (NTDLL.@)
*
* Leaves a critical section.
......
......@@ -719,6 +719,8 @@
# @ stub RtlIpv6StringToAddressExW
# @ stub RtlIpv6StringToAddressW
@ stdcall RtlIsActivationContextActive(ptr)
@ stdcall RtlIsCriticalSectionLocked(ptr)
@ stdcall RtlIsCriticalSectionLockedByThread(ptr)
@ stdcall RtlIsDosDeviceName_U(wstr)
@ stub RtlIsGenericTableEmpty
# @ stub RtlIsGenericTableEmptyAvl
......
......@@ -2008,7 +2008,7 @@ static void test_RtlIsCriticalSectionLocked(void)
if (!pRtlIsCriticalSectionLocked || !pRtlIsCriticalSectionLockedByThread)
{
skip("skipping RtlIsCriticalSectionLocked tests, required functions not available\n");
win_skip("skipping RtlIsCriticalSectionLocked tests, required functions not available\n");
return;
}
......
......@@ -2483,6 +2483,8 @@ NTSYSAPI NTSTATUS WINAPI RtlInt64ToUnicodeString(ULONGLONG,ULONG,UNICODE_STRING
NTSYSAPI NTSTATUS WINAPI RtlIntegerToChar(ULONG,ULONG,ULONG,PCHAR);
NTSYSAPI NTSTATUS WINAPI RtlIntegerToUnicodeString(ULONG,ULONG,UNICODE_STRING *);
NTSYSAPI BOOLEAN WINAPI RtlIsActivationContextActive(HANDLE);
NTSYSAPI BOOL WINAPI RtlIsCriticalSectionLocked(RTL_CRITICAL_SECTION *);
NTSYSAPI BOOL WINAPI RtlIsCriticalSectionLockedByThread(RTL_CRITICAL_SECTION *);
NTSYSAPI ULONG WINAPI RtlIsDosDeviceName_U(PCWSTR);
NTSYSAPI BOOLEAN WINAPI RtlIsNameLegalDOS8Dot3(const UNICODE_STRING*,POEM_STRING,PBOOLEAN);
NTSYSAPI BOOLEAN WINAPI RtlIsTextUnicode(LPCVOID,INT,INT *);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment