KD System Rewrite:
[reactos.git] / reactos / ntoskrnl / rtl / libsupp.c
1 /* $Id$
2 *
3 * COPYRIGHT: See COPYING in the top level directory
4 * PROJECT: ReactOS kernel
5 * FILE: ntoskrnl/rtl/libsupp.c
6 * PURPOSE: Rtl library support routines
7 *
8 * PROGRAMMERS: No programmer listed.
9 */
10
11 /* INCLUDES ******************************************************************/
12
13 #include <ntoskrnl.h>
14 #include <internal/ps.h>
15 #define NDEBUG
16 #include <internal/debug.h>
17
18 //FIXME: sort this out somehow. IAI: Sorted in new header branch
19 #define PRTL_CRITICAL_SECTION PVOID
20
21 /* FUNCTIONS *****************************************************************/
22
23
24 KPROCESSOR_MODE
25 RtlpGetMode()
26 {
27 return KernelMode;
28 }
29
30 /*
31 * @implemented
32 */
33 VOID STDCALL
34 RtlAcquirePebLock(VOID)
35 {
36
37 }
38
39 /*
40 * @implemented
41 */
42 VOID STDCALL
43 RtlReleasePebLock(VOID)
44 {
45
46 }
47
48
49 PPEB
50 STDCALL
51 RtlpCurrentPeb(VOID)
52 {
53 return ((PEPROCESS)(KeGetCurrentThread()->ApcState.Process))->Peb;
54 }
55
56 NTSTATUS
57 STDCALL
58 RtlDeleteCriticalSection(
59 PRTL_CRITICAL_SECTION CriticalSection)
60 {
61 return STATUS_SUCCESS;
62 }
63
64 DWORD
65 STDCALL
66 RtlSetCriticalSectionSpinCount(
67 PRTL_CRITICAL_SECTION CriticalSection,
68 DWORD SpinCount
69 )
70 {
71 return 0;
72 }
73
74 NTSTATUS
75 STDCALL
76 RtlEnterCriticalSection(
77 PRTL_CRITICAL_SECTION CriticalSection)
78 {
79 ExAcquireFastMutex((PFAST_MUTEX) CriticalSection);
80 return STATUS_SUCCESS;
81 }
82
83 NTSTATUS
84 STDCALL
85 RtlInitializeCriticalSection(
86 PRTL_CRITICAL_SECTION CriticalSection)
87 {
88 ExInitializeFastMutex((PFAST_MUTEX)CriticalSection );
89 return STATUS_SUCCESS;
90 }
91
92 NTSTATUS
93 STDCALL
94 RtlLeaveCriticalSection(
95 PRTL_CRITICAL_SECTION CriticalSection)
96 {
97 ExReleaseFastMutex((PFAST_MUTEX) CriticalSection );
98 return STATUS_SUCCESS;
99 }
100
101 BOOLEAN
102 STDCALL
103 RtlTryEnterCriticalSection(
104 PRTL_CRITICAL_SECTION CriticalSection)
105 {
106 return ExTryToAcquireFastMutex((PFAST_MUTEX) CriticalSection );
107 }
108
109
110 NTSTATUS
111 STDCALL
112 RtlInitializeCriticalSectionAndSpinCount(
113 PRTL_CRITICAL_SECTION CriticalSection,
114 ULONG SpinCount)
115 {
116 ExInitializeFastMutex((PFAST_MUTEX)CriticalSection );
117 return STATUS_SUCCESS;
118 }
119
120
121 #ifdef DBG
122 VOID FASTCALL
123 CHECK_PAGED_CODE_RTL(char *file, int line)
124 {
125 if(KeGetCurrentIrql() > APC_LEVEL)
126 {
127 DbgPrint("%s:%i: Pagable code called at IRQL > APC_LEVEL (%d)\n", file, line, KeGetCurrentIrql());
128 KEBUGCHECK(0);
129 }
130 }
131 #endif
132
133 /* EOF */