- Fix typo accidentally added after testing the build (due to alt-f Q)
[reactos.git] / reactos / include / ndk / rtlfuncs.h
index 0a5ddd4..f8e197e 100644 (file)
-/*
- * PROJECT:         ReactOS Native Headers
- * FILE:            include/ndk/rtlfuncs.h
- * PURPOSE:         Prototypes for Runtime Library Functions not defined in DDK/IFS
- * PROGRAMMER:      Alex Ionescu (alex@relsoft.net)
- * UPDATE HISTORY:
- *                  Created 06/10/04
- */
+/*++ NDK Version: 0095
+
+Copyright (c) Alex Ionescu.  All rights reserved.
+
+Header Name:
+
+    rtlfuncs.h
+
+Abstract:
+
+    Function definitions for the Run-Time Library
+
+Author:
+
+    Alex Ionescu (alex.ionescu@reactos.com)   06-Oct-2004
+
+--*/
+
 #ifndef _RTLFUNCS_H
 #define _RTLFUNCS_H
 
-/* DEPENDENCIES **************************************************************/
+//
+// Dependencies
+//
 #include <ntnls.h>
 #include "extypes.h"
 #include "rtltypes.h"
 
-/* MACROS ********************************************************************/
+#ifdef NTOS_MODE_USER
 
-/* FIXME: Eventually move the ones in rtltypes.h here... */
+//
+// List Functions
+//
+FORCEINLINE
+VOID
+InitializeListHead(
+    IN PLIST_ENTRY ListHead
+)
+{
+    ListHead->Flink = ListHead->Blink = ListHead;
+}
 
-/*
- * Splay Tree Macros
- */
-#define RtlIsLeftChild(Links) \
-    (RtlLeftChild(RtlParent(Links)) == (PRTL_SPLAY_LINKS)(Links))
+FORCEINLINE
+VOID
+InsertHeadList(
+    IN PLIST_ENTRY ListHead,
+    IN PLIST_ENTRY Entry
+)
+{
+    PLIST_ENTRY OldFlink;
+    OldFlink = ListHead->Flink;
+    Entry->Flink = OldFlink;
+    Entry->Blink = ListHead;
+    OldFlink->Blink = Entry;
+    ListHead->Flink = Entry;
+}
 
-#define RtlRightChild(Links) \
-    (PRTL_SPLAY_LINKS)(Links)->RightChild
+FORCEINLINE
+VOID
+InsertTailList(
+    IN PLIST_ENTRY ListHead,
+    IN PLIST_ENTRY Entry
+)
+{
+    PLIST_ENTRY OldBlink;
+    OldBlink = ListHead->Blink;
+    Entry->Flink = ListHead;
+    Entry->Blink = OldBlink;
+    OldBlink->Flink = Entry;
+    ListHead->Blink = Entry;
+}
 
-#define RtlIsRoot(Links) \
-    (RtlParent(Links) == (PRTL_SPLAY_LINKS)(Links))
+BOOLEAN
+FORCEINLINE
+IsListEmpty(
+    IN const LIST_ENTRY * ListHead
+)
+{
+    return (BOOLEAN)(ListHead->Flink == ListHead);
+}
 
-#define RtlLeftChild(Links) \
-    (PRTL_SPLAY_LINKS)(Links)->LeftChild
+FORCEINLINE
+PSINGLE_LIST_ENTRY
+PopEntryList(
+    PSINGLE_LIST_ENTRY ListHead
+)
+{
+    PSINGLE_LIST_ENTRY FirstEntry;
+    FirstEntry = ListHead->Next;
+    if (FirstEntry != NULL) {
+        ListHead->Next = FirstEntry->Next;
+    }
 
-#define RtlParent(Links) \
-    (PRTL_SPLAY_LINKS)(Links)->Parent
+    return FirstEntry;
+}
 
-#define RtlInitializeSplayLinks(Links)                  \
-    PRTL_SPLAY_LINKS _SplayLinks;                       \
-    _SplayLinks = (PRTL_SPLAY_LINKS)(Links);            \
-    _SplayLinks->Parent = _SplayLinks;                  \
-    _SplayLinks->LeftChild = NULL;                      \
-    _SplayLinks->RightChild = NULL;
+FORCEINLINE
+VOID
+PushEntryList(
+    PSINGLE_LIST_ENTRY ListHead,
+    PSINGLE_LIST_ENTRY Entry
+)
+{
+    Entry->Next = ListHead->Next;
+    ListHead->Next = Entry;
+}
 
-#define RtlInsertAsLeftChild(ParentLinks,ChildLinks)    \
-    PRTL_SPLAY_LINKS _SplayParent;                      \
-    PRTL_SPLAY_LINKS _SplayChild;                       \
-    _SplayParent = (PRTL_SPLAY_LINKS)(ParentLinks);     \
-    _SplayChild = (PRTL_SPLAY_LINKS)(ChildLinks);       \
-    _SplayParent->LeftChild = _SplayChild;              \
-    _SplayChild->Parent = _SplayParent;
+FORCEINLINE
+BOOLEAN
+RemoveEntryList(
+    IN PLIST_ENTRY  Entry)
+{
+    PLIST_ENTRY OldFlink;
+    PLIST_ENTRY OldBlink;
+
+    OldFlink = Entry->Flink;
+    OldBlink = Entry->Blink;
+    OldFlink->Blink = OldBlink;
+    OldBlink->Flink = OldFlink;
+    return (BOOLEAN)(OldFlink == OldBlink);
+}
 
-#define RtlInsertAsRightChild(ParentLinks,ChildLinks)   \
-    PRTL_SPLAY_LINKS _SplayParent;                      \
-    PRTL_SPLAY_LINKS _SplayChild;                       \
-    _SplayParent = (PRTL_SPLAY_LINKS)(ParentLinks);     \
-    _SplayChild = (PRTL_SPLAY_LINKS)(ChildLinks);       \
-    _SplayParent->RightChild = _SplayChild;             \
-    _SplayChild->Parent = _SplayParent;
+FORCEINLINE
+PLIST_ENTRY
+RemoveHeadList(
+    IN PLIST_ENTRY  ListHead)
+{
+    PLIST_ENTRY Flink;
+    PLIST_ENTRY Entry;
+
+    Entry = ListHead->Flink;
+    Flink = Entry->Flink;
+    ListHead->Flink = Flink;
+    Flink->Blink = ListHead;
+    return Entry;
+}
 
-/* PROTOTYPES ****************************************************************/
+FORCEINLINE
+PLIST_ENTRY
+RemoveTailList(
+    IN PLIST_ENTRY  ListHead)
+{
+    PLIST_ENTRY Blink;
+    PLIST_ENTRY Entry;
+
+    Entry = ListHead->Blink;
+    Blink = Entry->Blink;
+    ListHead->Blink = Blink;
+    Blink->Flink = ListHead;
+    return Entry;
+}
 
-/*
- * Splay Tree Functions
- */
+//
+// LUID Macros
+//
+#define RtlEqualLuid(L1, L2) (((L1)->HighPart == (L2)->HighPart) && \
+                              ((L1)->LowPart  == (L2)->LowPart))
+
+#endif
+
+//
+// RTL Splay Tree Functions
+//
 NTSYSAPI
 PRTL_SPLAY_LINKS
 NTAPI
@@ -102,9 +199,56 @@ PRTL_SPLAY_LINKS
 NTAPI
 RtlRealPredecessor(PRTL_SPLAY_LINKS Links);
 
-/*
- * Error and Exception Functions
- */
+#define RtlIsLeftChild(Links) \
+    (RtlLeftChild(RtlParent(Links)) == (PRTL_SPLAY_LINKS)(Links))
+
+#define RtlIsRightChild(Links) \
+    (RtlRightChild(RtlParent(Links)) == (PRTL_SPLAY_LINKS)(Links))
+
+#define RtlRightChild(Links) \
+    ((PRTL_SPLAY_LINKS)(Links))->RightChild
+
+#define RtlIsRoot(Links) \
+    (RtlParent(Links) == (PRTL_SPLAY_LINKS)(Links))
+
+#define RtlLeftChild(Links) \
+    ((PRTL_SPLAY_LINKS)(Links))->LeftChild
+
+#define RtlParent(Links) \
+    ((PRTL_SPLAY_LINKS)(Links))->Parent
+
+#define RtlInitializeSplayLinks(Links)                  \
+    {                                                   \
+        PRTL_SPLAY_LINKS _SplayLinks;                   \
+        _SplayLinks = (PRTL_SPLAY_LINKS)(Links);        \
+        _SplayLinks->Parent = _SplayLinks;              \
+        _SplayLinks->LeftChild = NULL;                  \
+        _SplayLinks->RightChild = NULL;                 \
+    }
+
+#define RtlInsertAsLeftChild(ParentLinks,ChildLinks)    \
+    {                                                   \
+        PRTL_SPLAY_LINKS _SplayParent;                  \
+        PRTL_SPLAY_LINKS _SplayChild;                   \
+        _SplayParent = (PRTL_SPLAY_LINKS)(ParentLinks); \
+        _SplayChild = (PRTL_SPLAY_LINKS)(ChildLinks);   \
+        _SplayParent->LeftChild = _SplayChild;          \
+        _SplayChild->Parent = _SplayParent;             \
+    }
+
+#define RtlInsertAsRightChild(ParentLinks,ChildLinks)   \
+    {                                                   \
+        PRTL_SPLAY_LINKS _SplayParent;                  \
+        PRTL_SPLAY_LINKS _SplayChild;                   \
+        _SplayParent = (PRTL_SPLAY_LINKS)(ParentLinks); \
+        _SplayChild = (PRTL_SPLAY_LINKS)(ChildLinks);   \
+        _SplayParent->RightChild = _SplayChild;         \
+        _SplayChild->Parent = _SplayParent;             \
+    }
+
+//
+// Error and Exception Functions
+//
 NTSYSAPI
 PVOID
 NTAPI
@@ -176,10 +320,9 @@ RtlUnwind(
     IN PVOID ReturnValue
 );
 
-/*
- * Heap Functions
- */
-
+//
+// Heap Functions
+//
 NTSYSAPI
 PVOID
 NTAPI
@@ -264,10 +407,9 @@ RtlValidateHeap(
 
 #define RtlGetProcessHeap() (NtCurrentPeb()->ProcessHeap)
 
-
-/*
- * Security Functions
- */
+//
+// Security Functions
+//
 NTSYSAPI
 NTSTATUS
 NTAPI
@@ -778,9 +920,9 @@ RtlSetSecurityObject(
     IN HANDLE Token
 );
 
-/*
- * Single-Character Functions
- */
+//
+// Single-Character Functions
+//
 NTSYSAPI
 NTSTATUS
 NTAPI
@@ -844,7 +986,13 @@ RtlCharToInteger(
     PULONG Value
 );
 
-#if (defined(_M_IX86) && (_MSC_FULL_VER > 13009037)) || ((defined(_M_AMD64) || defined(_M_IA64)) && (_MSC_FULL_VER > 13009175))
+//
+// Byte Swap Functions
+//
+#if (defined(_M_IX86) && (_MSC_FULL_VER > 13009037)) || \
+    ((defined(_M_AMD64) || \
+     defined(_M_IA64)) && (_MSC_FULL_VER > 13009175))
+
 unsigned short __cdecl _byteswap_ushort(unsigned short);
 unsigned long  __cdecl _byteswap_ulong (unsigned long);
 unsigned __int64 __cdecl _byteswap_uint64(unsigned __int64);
@@ -854,6 +1002,7 @@ unsigned __int64 __cdecl _byteswap_uint64(unsigned __int64);
 #define RtlUshortByteSwap(_x) _byteswap_ushort((USHORT)(_x))
 #define RtlUlongByteSwap(_x) _byteswap_ulong((_x))
 #define RtlUlonglongByteSwap(_x) _byteswap_uint64((_x))
+
 #else
 
 USHORT
@@ -870,20 +1019,22 @@ RtlUlonglongByteSwap(IN ULONGLONG Source);
 
 #endif
 
-/*
- * Unicode->Ansi String Functions
- */
+//
+// Unicode->Ansi String Functions
+//
 NTSYSAPI
 ULONG
 NTAPI
 RtlxUnicodeStringToAnsiSize(IN PCUNICODE_STRING UnicodeString);
 
 #ifdef NTOS_MODE_USER
+
 #define RtlUnicodeStringToAnsiSize(STRING) (                  \
     NLS_MB_CODE_PAGE_TAG ?                                    \
     RtlxUnicodeStringToAnsiSize(STRING) :                     \
     ((STRING)->Length + sizeof(UNICODE_NULL)) / sizeof(WCHAR) \
 )
+
 #endif
 
 NTSYSAPI
@@ -895,9 +1046,9 @@ RtlUnicodeStringToAnsiString(
     BOOLEAN AllocateDestinationString
 );
 
-/*
- * Unicode->OEM String Functions
- */
+//
+// Unicode->OEM String Functions
+//
 NTSYSAPI
 NTSTATUS
 NTAPI
@@ -942,14 +1093,17 @@ NTAPI
 RtlxUnicodeStringToOemSize(IN PCUNICODE_STRING UnicodeString);
 
 #ifdef NTOS_MODE_USER
-#define RtlUnicodeStringToOemSize(STRING) (                   \
-    NLS_MB_OEM_CODE_PAGE_TAG ?                                \
-    RtlxUnicodeStringToOemSize(STRING) :                      \
-    ((STRING)->Length + sizeof(UNICODE_NULL)) / sizeof(WCHAR) \
+
+#define RtlUnicodeStringToOemSize(STRING) (                             \
+    NLS_MB_OEM_CODE_PAGE_TAG ?                                          \
+    RtlxUnicodeStringToOemSize(STRING) :                                \
+    ((STRING)->Length + sizeof(UNICODE_NULL)) / sizeof(WCHAR)           \
 )
-#define RtlUnicodeStringToCountedOemSize(STRING) (                    \
-    (ULONG)(RtlUnicodeStringToOemSize(STRING) - sizeof(ANSI_NULL)) \
+
+#define RtlUnicodeStringToCountedOemSize(STRING) (                      \
+    (ULONG)(RtlUnicodeStringToOemSize(STRING) - sizeof(ANSI_NULL))      \
 )
+
 #endif
 
 NTSYSAPI
@@ -963,9 +1117,9 @@ RtlUnicodeToOemN(
     ULONG UnicodeSize
 );
 
-/*
- * Unicode->MultiByte String Functions
- */
+//
+// Unicode->MultiByte String Functions
+//
 NTSYSAPI
 NTSTATUS
 NTAPI
@@ -1002,20 +1156,9 @@ ULONG
 NTAPI
 RtlxOemStringToUnicodeSize(IN PCOEM_STRING OemString);
 
-/*
- * OEM to Unicode Functions
- */
-#ifdef NTOS_MODE_USER
-#define RtlOemStringToUnicodeSize(STRING) (                  \
-    NLS_MB_OEM_CODE_PAGE_TAG ?                               \
-    RtlxOemStringToUnicodeSize(STRING) :                     \
-    ((STRING)->Length + sizeof(ANSI_NULL)) * sizeof(WCHAR)   \
-)
-#define RtlOemStringToCountedUnicodeSize(STRING) (                    \
-    (ULONG)(RtlOemStringToUnicodeSize(STRING) - sizeof(UNICODE_NULL)) \
-)
-#endif
-
+//
+// OEM to Unicode Functions
+//
 NTSYSAPI
 NTSTATUS
 NTAPI
@@ -1036,9 +1179,23 @@ RtlOemToUnicodeN(
     ULONG BytesInOemString
 );
 
-/*
- * Ansi->Unicode String Functions
- */
+#ifdef NTOS_MODE_USER
+
+#define RtlOemStringToUnicodeSize(STRING) (                             \
+    NLS_MB_OEM_CODE_PAGE_TAG ?                                          \
+    RtlxOemStringToUnicodeSize(STRING) :                                \
+    ((STRING)->Length + sizeof(ANSI_NULL)) * sizeof(WCHAR)              \
+)
+
+#define RtlOemStringToCountedUnicodeSize(STRING) (                      \
+    (ULONG)(RtlOemStringToUnicodeSize(STRING) - sizeof(UNICODE_NULL))   \
+)
+
+#endif
+
+//
+// Ansi->Unicode String Functions
+//
 NTSYSAPI
 ULONG
 NTAPI
@@ -1056,11 +1213,13 @@ RtlAnsiStringToUnicodeString(
 );
 
 #ifdef NTOS_MODE_USER
-#define RtlAnsiStringToUnicodeSize(STRING) (                 \
-    NLS_MB_CODE_PAGE_TAG ?                                   \
-    RtlxAnsiStringToUnicodeSize(STRING) :                    \
-    ((STRING)->Length + sizeof(ANSI_NULL)) * sizeof(WCHAR)   \
+
+#define RtlAnsiStringToUnicodeSize(STRING) (                        \
+    NLS_MB_CODE_PAGE_TAG ?                                          \
+    RtlxAnsiStringToUnicodeSize(STRING) :                           \
+    ((STRING)->Length + sizeof(ANSI_NULL)) * sizeof(WCHAR)          \
 )
+
 #endif
 
 NTSYSAPI
@@ -1071,9 +1230,9 @@ RtlCreateUnicodeStringFromAsciiz(
     IN PCSZ Source
 );
 
-/*
- * Unicode String Functions
- */
+//
+// Unicode String Functions
+//
 NTSYSAPI
 NTSTATUS
 NTAPI
@@ -1116,6 +1275,7 @@ RtlCreateUnicodeString(
 );
 
 #ifdef NTOS_MODE_USER
+
 NTSYSAPI
 NTSTATUS
 NTAPI
@@ -1124,6 +1284,7 @@ RtlDowncaseUnicodeString(
     IN PCUNICODE_STRING UniSource,
     IN BOOLEAN AllocateDestinationString
 );
+
 #endif
 
 NTSYSAPI
@@ -1175,6 +1336,15 @@ RtlIsTextUnicode(
     ULONG *Flags
 );
 
+NTSYSAPI
+BOOLEAN
+NTAPI
+RtlPrefixString(
+    PCANSI_STRING String1,
+    PCANSI_STRING String2,
+    BOOLEAN CaseInsensitive
+);
+
 NTSYSAPI
 BOOLEAN
 NTAPI
@@ -1202,9 +1372,9 @@ RtlUnicodeStringToInteger(
     PULONG Value
 );
 
-/*
- * Ansi String Functions
- */
+//
+// Ansi String Functions
+//
 NTSYSAPI
 VOID
 NTAPI
@@ -1218,17 +1388,17 @@ RtlInitAnsiString(
     PCSZ SourceString
 );
 
-/*
- * OEM String Functions
- */
+//
+// OEM String Functions
+//
 NTSYSAPI
 VOID
 NTAPI
 RtlFreeOemString(IN POEM_STRING OemString);
 
-/*
- * MultiByte->Unicode String Functions
- */
+//
+// MultiByte->Unicode String Functions
+//
 NTSYSAPI
 NTSTATUS
 NTAPI
@@ -1249,9 +1419,9 @@ RtlMultiByteToUnicodeSize(
     ULONG MbSize
 );
 
-/*
- * Atom Functions
- */
+//
+// Atom Functions
+//
 NTSYSAPI
 NTSTATUS
 NTAPI
@@ -1294,6 +1464,14 @@ RtlQueryAtomInAtomTable(
     IN OUT PULONG NameLength OPTIONAL
 );
 
+NTSYSAPI
+NTSTATUS
+NTAPI
+RtlPinAtomInAtomTable(
+    IN PRTL_ATOM_TABLE AtomTable,
+    IN RTL_ATOM Atom
+);     
+
 NTSYSAPI
 NTSTATUS
 NTAPI
@@ -1303,9 +1481,9 @@ RtlLookupAtomInAtomTable(
     OUT PRTL_ATOM Atom
 );
 
-/*
- * Memory Functions
- */
+//
+// Memory Functions
+//
 NTSYSAPI
 VOID
 NTAPI
@@ -1315,9 +1493,9 @@ RtlFillMemoryUlong(
     IN ULONG Fill
 );
 
-/*
- * Process Management Functions
- */
+//
+// Process Management Functions
+//
 NTSYSAPI
 VOID
 NTAPI
@@ -1416,9 +1594,36 @@ RtlSetProcessIsCritical(
     IN BOOLEAN IsWinlogon
 );
 
-/*
- * Environment/Path Functions
- */
+static __inline
+struct _PEB*
+NtCurrentPeb(VOID)
+{
+    struct _PEB *pPeb;
+
+#if defined(__GNUC__)
+
+    __asm__ __volatile__
+    (
+      "movl %%fs:0x30, %0\n" /* fs:30h == Teb->Peb */
+      : "=r" (pPeb) /* can't have two memory operands */
+      : /* no inputs */
+    );
+
+#elif defined(_MSC_VER)
+
+    __asm mov eax, fs:0x30;
+    __asm mov pPeb, eax
+
+#else
+#error Unknown compiler for inline assembler
+#endif
+
+    return pPeb;
+}
+
+//
+// Environment/Path Functions
+//
 NTSYSAPI
 NTSTATUS
 NTAPI
@@ -1524,9 +1729,9 @@ RtlSetEnvironmentVariable(
     PUNICODE_STRING Value
 );
 
-/*
- * Critical Section/Resource Functions
- */
+//
+// Critical Section/Resource Functions
+//
 NTSYSAPI
 NTSTATUS
 NTAPI
@@ -1635,9 +1840,9 @@ RtlReleaseResource(
     IN PRTL_RESOURCE Resource
 );
 
-/*
- * Compression Functions
- */
+//
+// Compression Functions
+//
 NTSYSAPI
 NTSTATUS
 NTAPI
@@ -1673,11 +1878,11 @@ RtlGetCompressionWorkSpaceSize(
     OUT PULONG CompressFragmentWorkSpaceSize
 );
 
-/*
- * Debug Info Functions
- */
+//
+// Debug Info Functions
+//
 NTSYSAPI
-PDEBUG_BUFFER
+PRTL_DEBUG_BUFFER
 NTAPI
 RtlCreateQueryDebugBuffer(
     IN ULONG Size,
@@ -1687,7 +1892,7 @@ RtlCreateQueryDebugBuffer(
 NTSYSAPI
 NTSTATUS
 NTAPI
-RtlDestroyQueryDebugBuffer(IN PDEBUG_BUFFER DebugBuffer);
+RtlDestroyQueryDebugBuffer(IN PRTL_DEBUG_BUFFER DebugBuffer);
 
 NTSYSAPI
 NTSTATUS
@@ -1695,12 +1900,12 @@ NTAPI
 RtlQueryProcessDebugInformation(
     IN ULONG ProcessId,
     IN ULONG DebugInfoClassMask,
-    IN OUT PDEBUG_BUFFER DebugBuffer
+    IN OUT PRTL_DEBUG_BUFFER DebugBuffer
 );
 
-/*
- * Bitmap Functions
- */
+//
+// Bitmap Functions
+//
 NTSYSAPI
 BOOLEAN
 NTAPI
@@ -1764,9 +1969,9 @@ RtlSetBits (
     IN ULONG NumberToSet
 );
 
-/*
- * Timer Functions
- */
+//
+// Timer Functions
+//
 NTSYSAPI
 NTSTATUS
 NTAPI
@@ -1817,9 +2022,9 @@ NTSTATUS
 NTAPI
 RtlDeleteTimerQueue(HANDLE TimerQueue);
 
-/*
- * Debug Functions
- */
+//
+// Debug Functions
+//
 ULONG
 __cdecl
 DbgPrint(
@@ -1831,9 +2036,9 @@ VOID
 NTAPI
 DbgBreakPoint(VOID);
 
-/*
- * Handle Table Functions
- */
+//
+// Handle Table Functions
+//
 NTSYSAPI
 PRTL_HANDLE_TABLE_ENTRY
 NTAPI
@@ -1881,9 +2086,9 @@ RtlIsValidIndexHandle(
     OUT PRTL_HANDLE_TABLE_ENTRY *Handle
 );
 
-/*
- * PE Functions
- */
+//
+// PE Functions
+//
 NTSYSAPI
 NTSTATUS
 NTAPI
@@ -1934,9 +2139,9 @@ RtlImageRvaToSection(
     ULONG Rva
 );
 
-/*
- * Registry Functions
- */
+//
+// Registry Functions
+//
 NTSYSAPI
 NTSTATUS
 NTAPI
@@ -1991,9 +2196,9 @@ RtlWriteRegistryValue(
     ULONG ValueLength
 );
 
-/*
- * NLS Functions
- */
+//
+// NLS Functions
+//
 NTSYSAPI
 VOID
 NTAPI
@@ -2017,14 +2222,17 @@ VOID
 NTAPI
 RtlResetRtlTranslations(IN PNLSTABLEINFO NlsTable);
 
-/*
- * Misc conversion functions
- */
 #if defined(NTOS_MODE_USER) && !defined(NO_RTL_INLINES)
+
+//
+// Misc conversion functions
+//
 static __inline
 LARGE_INTEGER
 NTAPI_INLINE
-RtlConvertLongToLargeInteger(LONG SignedInteger)
+RtlConvertLongToLargeInteger(
+    LONG SignedInteger
+)
 {
     LARGE_INTEGER Result;
 
@@ -2037,7 +2245,8 @@ LARGE_INTEGER
 NTAPI_INLINE
 RtlEnlargedIntegerMultiply(
     LONG Multiplicand,
-    LONG Multiplier)
+    LONG Multiplier
+)
 {
     LARGE_INTEGER Product;
 
@@ -2051,7 +2260,8 @@ NTAPI_INLINE
 RtlEnlargedUnsignedDivide(
     IN ULARGE_INTEGER Dividend,
     IN ULONG Divisor,
-    IN PULONG Remainder OPTIONAL)
+    IN PULONG Remainder OPTIONAL
+)
 {
     ULONG Quotient;
 
@@ -2068,7 +2278,8 @@ LARGE_INTEGER
 NTAPI_INLINE
 RtlEnlargedUnsignedMultiply(
     ULONG Multiplicand,
-    ULONG Multiplier)
+    ULONG Multiplier
+)
 {
     LARGE_INTEGER Product;
 
@@ -2082,9 +2293,9 @@ ULONG
 NTAPI
 RtlUniform(PULONG Seed);
 
-/*
- * Network Functions
- */
+//
+// Network Functions
+//
 NTSYSAPI
 NTSTATUS
 NTAPI
@@ -2095,9 +2306,9 @@ RtlIpv4StringToAddressW(
     OUT PULONG IpAddr
 );
 
-/*
- * Time Functions
- */
+//
+// Time Functions
+//
 NTSYSAPI
 NTSTATUS
 NTAPI
@@ -2132,9 +2343,9 @@ RtlTimeToTimeFields(
     PTIME_FIELDS TimeFields
 );
 
-/*
- * Version Functions
- */
+//
+// Version Functions
+//
 NTSYSAPI
 NTSTATUS
 NTAPI
@@ -2154,28 +2365,4 @@ BOOLEAN
 NTAPI
 RtlGetNtProductType(OUT PNT_PRODUCT_TYPE ProductType);
 
-static __inline struct _PEB* NtCurrentPeb (void) 
-{
-    struct _PEB * pPeb;
-
-#if defined(__GNUC__)
-
-    __asm__ __volatile__
-    (
-      "movl %%fs:0x30, %0\n" /* fs:30h == Teb->Peb */
-      : "=r" (pPeb) /* can't have two memory operands */
-      : /* no inputs */
-    );
-
-#elif defined(_MSC_VER)
-
-    __asm mov eax, fs:0x30;
-    __asm mov pPeb, eax
-
-#else
-#error Unknown compiler for inline assembler
-#endif
-
-    return pPeb;
-}
 #endif