Author: hbelusca
Date: Sun Sep 22 15:14:24 2013
New Revision: 60302
URL:
http://svn.reactos.org/svn/reactos?rev=60302&view=rev
Log:
[RTL]
- Implement and export RtlGetCriticalSectionRecursionCount (introduced in NT 5.2 SP1, see
http://www.geoffchappell.com/studies/windows/win32/ntdll/history/names52.htm) which
definition comes from
http://processhacker.sourceforge.net/doc/ntrtl_8h.html#a26bd65dfad63985a247….
- Fix the return type of RtlSetCriticalSectionSpinCount.
- Export the already-existing RtlQueryInformationActiveActivationContext API.
RtlQueryInformationActiveActivationContext and RtlGetCriticalSectionRecursionCount are
needed by Win2k3 user32.dll and winsrv.dll .
Modified:
trunk/reactos/dll/ntdll/def/ntdll.spec
trunk/reactos/lib/rtl/critical.c
Modified: trunk/reactos/dll/ntdll/def/ntdll.spec
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/ntdll/def/ntdll.spec?r…
==============================================================================
--- trunk/reactos/dll/ntdll/def/ntdll.spec [iso-8859-1] (original)
+++ trunk/reactos/dll/ntdll/def/ntdll.spec [iso-8859-1] Sun Sep 22 15:14:24 2013
@@ -614,7 +614,7 @@
@ stdcall RtlGetCallersAddress(ptr ptr)
@ stdcall RtlGetCompressionWorkSpaceSize(long ptr ptr)
@ stdcall RtlGetControlSecurityDescriptor(ptr ptr ptr)
-;@ stdcall RtlGetCriticalSectionRecursionCount
+@ stdcall RtlGetCriticalSectionRecursionCount(ptr)
@ stdcall RtlGetCurrentDirectory_U(long ptr)
@ stdcall RtlGetCurrentPeb()
@ stdcall RtlGetCurrentProcessorNumber() ; 5.2 SP1 and higher
@@ -780,7 +780,7 @@
@ stdcall RtlQueryHeapInformation(long long ptr long ptr)
@ stdcall RtlQueryInformationAcl(ptr ptr long long)
@ stdcall RtlQueryInformationActivationContext(long long ptr long ptr long ptr)
-;@ stdcall RtlQueryInformationActiveActivationContext
+@ stdcall RtlQueryInformationActiveActivationContext(long ptr long ptr)
;@ stdcall RtlQueryInterfaceMemoryStream
;@ stdcall RtlQueryProcessBackTraceInformation
@ stdcall RtlQueryProcessDebugInformation(long long ptr)
Modified: trunk/reactos/lib/rtl/critical.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/lib/rtl/critical.c?rev=603…
==============================================================================
--- trunk/reactos/lib/rtl/critical.c [iso-8859-1] (original)
+++ trunk/reactos/lib/rtl/critical.c [iso-8859-1] Sun Sep 22 15:14:24 2013
@@ -299,7 +299,7 @@
}
/* We are out of static buffer, allocate dynamic */
- return RtlAllocateHeap(NtCurrentPeb()->ProcessHeap,
+ return RtlAllocateHeap(RtlGetProcessHeap(),
0,
sizeof(RTL_CRITICAL_SECTION_DEBUG));
}
@@ -436,7 +436,7 @@
* SpinCount is ignored on single-processor systems.
*
*--*/
-DWORD
+ULONG
NTAPI
RtlSetCriticalSectionSpinCount(PRTL_CRITICAL_SECTION CriticalSection,
ULONG SpinCount)
@@ -619,6 +619,45 @@
}
/*++
+ * RtlGetCriticalSectionRecursionCount
+ * @implemented NT5.2 SP1
+ *
+ * Retrieves the recursion count of a given critical section.
+ *
+ * Params:
+ * CriticalSection - Critical section to retrieve its recursion count.
+ *
+ * Returns:
+ * The recursion count.
+ *
+ * Remarks:
+ * We return the recursion count of the critical section if it is owned
+ * by the current thread, and otherwise we return zero.
+ *
+ *--*/
+LONG
+NTAPI
+RtlGetCriticalSectionRecursionCount(PRTL_CRITICAL_SECTION CriticalSection)
+{
+ if (CriticalSection->OwningThread == NtCurrentTeb()->ClientId.UniqueThread)
+ {
+ /*
+ * The critical section is owned by the current thread,
+ * therefore retrieve its actual recursion count.
+ */
+ return CriticalSection->RecursionCount;
+ }
+ else
+ {
+ /*
+ * It is not owned by the current thread, so
+ * for this thread there is no recursion.
+ */
+ return 0;
+ }
+}
+
+/*++
* RtlLeaveCriticalSection
* @implemented NT4
*