- Fix KeAttackProcess, KeStackAttachProcess, KeUnstackDetachProcess and KeDetachProce...
[reactos.git] / reactos / include / ndk / rtlfuncs.h
index bd58ab5..7d122be 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 <umtypes.h>
 #include <ntnls.h>
-#include "extypes.h"
-#include "rtltypes.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 RtlIsRightChild(Links) \
-    (RtlRightChild(RtlParent(Links)) == (PRTL_SPLAY_LINKS)(Links))
+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 RtlRightChild(Links) \
-    ((PRTL_SPLAY_LINKS)(Links))->RightChild
+BOOLEAN
+FORCEINLINE
+IsListEmpty(
+    IN const LIST_ENTRY * ListHead
+)
+{
+    return (BOOLEAN)(ListHead->Flink == ListHead);
+}
 
-#define RtlIsRoot(Links) \
-    (RtlParent(Links) == (PRTL_SPLAY_LINKS)(Links))
+FORCEINLINE
+PSINGLE_LIST_ENTRY
+PopEntryList(
+    PSINGLE_LIST_ENTRY ListHead
+)
+{
+    PSINGLE_LIST_ENTRY FirstEntry;
+    FirstEntry = ListHead->Next;
+    if (FirstEntry != NULL) {
+        ListHead->Next = FirstEntry->Next;
+    }
 
-#define RtlLeftChild(Links) \
-    ((PRTL_SPLAY_LINKS)(Links))->LeftChild
+    return FirstEntry;
+}
 
-#define RtlParent(Links) \
-    ((PRTL_SPLAY_LINKS)(Links))->Parent
+FORCEINLINE
+VOID
+PushEntryList(
+    PSINGLE_LIST_ENTRY ListHead,
+    PSINGLE_LIST_ENTRY Entry
+)
+{
+    Entry->Next = ListHead->Next;
+    ListHead->Next = Entry;
+}
 
-#define RtlInitializeSplayLinks(Links)                  \
-    {                                                   \
-        PRTL_SPLAY_LINKS _SplayLinks;                   \
-        _SplayLinks = (PRTL_SPLAY_LINKS)(Links);        \
-        _SplayLinks->Parent = _SplayLinks;              \
-        _SplayLinks->LeftChild = NULL;                  \
-        _SplayLinks->RightChild = NULL;                 \
-    }
+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 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
+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;
+}
 
-#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
+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;
+}
+
+//
+// LUID Macros
+//
+#define RtlEqualLuid(L1, L2) (((L1)->HighPart == (L2)->HighPart) && \
+                              ((L1)->LowPart  == (L2)->LowPart))
 
-/* PROTOTYPES ****************************************************************/
+#endif
 
-/*
- * Splay Tree Functions
- */
+//
+// RTL Splay Tree Functions
+//
 NTSYSAPI
 PRTL_SPLAY_LINKS
 NTAPI
@@ -111,9 +200,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
@@ -185,10 +321,9 @@ RtlUnwind(
     IN PVOID ReturnValue
 );
 
-/*
- * Heap Functions
- */
-
+//
+// Heap Functions
+//
 NTSYSAPI
 PVOID
 NTAPI
@@ -273,10 +408,9 @@ RtlValidateHeap(
 
 #define RtlGetProcessHeap() (NtCurrentPeb()->ProcessHeap)
 
-
-/*
- * Security Functions
- */
+//
+// Security Functions
+//
 NTSYSAPI
 NTSTATUS
 NTAPI
@@ -787,9 +921,9 @@ RtlSetSecurityObject(
     IN HANDLE Token
 );
 
-/*
- * Single-Character Functions
- */
+//
+// Single-Character Functions
+//
 NTSYSAPI
 NTSTATUS
 NTAPI
@@ -853,7 +987,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);
@@ -863,6 +1003,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
@@ -879,20 +1020,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
@@ -904,9 +1047,9 @@ RtlUnicodeStringToAnsiString(
     BOOLEAN AllocateDestinationString
 );
 
-/*
- * Unicode->OEM String Functions
- */
+//
+// Unicode->OEM String Functions
+//
 NTSYSAPI
 NTSTATUS
 NTAPI
@@ -951,14 +1094,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
@@ -972,9 +1118,9 @@ RtlUnicodeToOemN(
     ULONG UnicodeSize
 );
 
-/*
- * Unicode->MultiByte String Functions
- */
+//
+// Unicode->MultiByte String Functions
+//
 NTSYSAPI
 NTSTATUS
 NTAPI
@@ -1011,20 +1157,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
@@ -1045,9 +1180,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
@@ -1065,11 +1214,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
@@ -1080,9 +1231,9 @@ RtlCreateUnicodeStringFromAsciiz(
     IN PCSZ Source
 );
 
-/*
- * Unicode String Functions
- */
+//
+// Unicode String Functions
+//
 NTSYSAPI
 NTSTATUS
 NTAPI
@@ -1125,6 +1276,7 @@ RtlCreateUnicodeString(
 );
 
 #ifdef NTOS_MODE_USER
+
 NTSYSAPI
 NTSTATUS
 NTAPI
@@ -1133,6 +1285,7 @@ RtlDowncaseUnicodeString(
     IN PCUNICODE_STRING UniSource,
     IN BOOLEAN AllocateDestinationString
 );
+
 #endif
 
 NTSYSAPI
@@ -1220,9 +1373,9 @@ RtlUnicodeStringToInteger(
     PULONG Value
 );
 
-/*
- * Ansi String Functions
- */
+//
+// Ansi String Functions
+//
 NTSYSAPI
 VOID
 NTAPI
@@ -1236,17 +1389,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
@@ -1267,9 +1420,9 @@ RtlMultiByteToUnicodeSize(
     ULONG MbSize
 );
 
-/*
- * Atom Functions
- */
+//
+// Atom Functions
+//
 NTSYSAPI
 NTSTATUS
 NTAPI
@@ -1329,9 +1482,9 @@ RtlLookupAtomInAtomTable(
     OUT PRTL_ATOM Atom
 );
 
-/*
- * Memory Functions
- */
+//
+// Memory Functions
+//
 NTSYSAPI
 VOID
 NTAPI
@@ -1341,9 +1494,9 @@ RtlFillMemoryUlong(
     IN ULONG Fill
 );
 
-/*
- * Process Management Functions
- */
+//
+// Process Management Functions
+//
 NTSYSAPI
 VOID
 NTAPI
@@ -1442,9 +1595,11 @@ RtlSetProcessIsCritical(
     IN BOOLEAN IsWinlogon
 );
 
-/*
- * Environment/Path Functions
- */
+#define NtCurrentPeb() (NtCurrentTeb()->ProcessEnvironmentBlock)
+
+//
+// Environment/Path Functions
+//
 NTSYSAPI
 NTSTATUS
 NTAPI
@@ -1550,9 +1705,9 @@ RtlSetEnvironmentVariable(
     PUNICODE_STRING Value
 );
 
-/*
- * Critical Section/Resource Functions
- */
+//
+// Critical Section/Resource Functions
+//
 NTSYSAPI
 NTSTATUS
 NTAPI
@@ -1661,9 +1816,9 @@ RtlReleaseResource(
     IN PRTL_RESOURCE Resource
 );
 
-/*
- * Compression Functions
- */
+//
+// Compression Functions
+//
 NTSYSAPI
 NTSTATUS
 NTAPI
@@ -1699,9 +1854,9 @@ RtlGetCompressionWorkSpaceSize(
     OUT PULONG CompressFragmentWorkSpaceSize
 );
 
-/*
- * Debug Info Functions
- */
+//
+// Debug Info Functions
+//
 NTSYSAPI
 PRTL_DEBUG_BUFFER
 NTAPI
@@ -1724,9 +1879,9 @@ RtlQueryProcessDebugInformation(
     IN OUT PRTL_DEBUG_BUFFER DebugBuffer
 );
 
-/*
- * Bitmap Functions
- */
+//
+// Bitmap Functions
+//
 NTSYSAPI
 BOOLEAN
 NTAPI
@@ -1790,9 +1945,9 @@ RtlSetBits (
     IN ULONG NumberToSet
 );
 
-/*
- * Timer Functions
- */
+//
+// Timer Functions
+//
 NTSYSAPI
 NTSTATUS
 NTAPI
@@ -1843,9 +1998,9 @@ NTSTATUS
 NTAPI
 RtlDeleteTimerQueue(HANDLE TimerQueue);
 
-/*
- * Debug Functions
- */
+//
+// Debug Functions
+//
 ULONG
 __cdecl
 DbgPrint(
@@ -1857,9 +2012,9 @@ VOID
 NTAPI
 DbgBreakPoint(VOID);
 
-/*
- * Handle Table Functions
- */
+//
+// Handle Table Functions
+//
 NTSYSAPI
 PRTL_HANDLE_TABLE_ENTRY
 NTAPI
@@ -1907,9 +2062,9 @@ RtlIsValidIndexHandle(
     OUT PRTL_HANDLE_TABLE_ENTRY *Handle
 );
 
-/*
- * PE Functions
- */
+//
+// PE Functions
+//
 NTSYSAPI
 NTSTATUS
 NTAPI
@@ -1960,9 +2115,9 @@ RtlImageRvaToSection(
     ULONG Rva
 );
 
-/*
- * Registry Functions
- */
+//
+// Registry Functions
+//
 NTSYSAPI
 NTSTATUS
 NTAPI
@@ -2017,9 +2172,9 @@ RtlWriteRegistryValue(
     ULONG ValueLength
 );
 
-/*
- * NLS Functions
- */
+//
+// NLS Functions
+//
 NTSYSAPI
 VOID
 NTAPI
@@ -2043,14 +2198,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;
 
@@ -2063,7 +2221,8 @@ LARGE_INTEGER
 NTAPI_INLINE
 RtlEnlargedIntegerMultiply(
     LONG Multiplicand,
-    LONG Multiplier)
+    LONG Multiplier
+)
 {
     LARGE_INTEGER Product;
 
@@ -2077,7 +2236,8 @@ NTAPI_INLINE
 RtlEnlargedUnsignedDivide(
     IN ULARGE_INTEGER Dividend,
     IN ULONG Divisor,
-    IN PULONG Remainder OPTIONAL)
+    IN PULONG Remainder OPTIONAL
+)
 {
     ULONG Quotient;
 
@@ -2094,7 +2254,8 @@ LARGE_INTEGER
 NTAPI_INLINE
 RtlEnlargedUnsignedMultiply(
     ULONG Multiplicand,
-    ULONG Multiplier)
+    ULONG Multiplier
+)
 {
     LARGE_INTEGER Product;
 
@@ -2108,9 +2269,9 @@ ULONG
 NTAPI
 RtlUniform(PULONG Seed);
 
-/*
- * Network Functions
- */
+//
+// Network Functions
+//
 NTSYSAPI
 NTSTATUS
 NTAPI
@@ -2121,9 +2282,48 @@ RtlIpv4StringToAddressW(
     OUT PULONG IpAddr
 );
 
-/*
- * Time Functions
- */
+NTSYSAPI
+NTSTATUS
+NTAPI
+RtlIpv6StringToAddressA(
+    IN LPSTR Name,
+    OUT PULONG Unknown,
+    OUT PVOID IpAddr
+);
+
+NTSYSAPI
+NTSTATUS
+NTAPI
+RtlIpv6StringToAddressW(
+    IN LPWSTR Name,
+    OUT PULONG Unknown,
+    OUT PVOID IpAddr
+);
+
+NTSYSAPI
+NTSTATUS
+NTAPI
+RtlIpv6StringToAddressExA(
+    IN LPSTR AddressName,
+    IN PVOID Address,
+    IN PULONG ScopeId,
+    IN PWORD Port
+);
+
+NTSYSAPI
+NTSTATUS
+NTAPI
+RtlIpv6StringToAddressExW(
+    IN LPWSTR AddressName,
+    IN PVOID Address,
+    IN PULONG ScopeId,
+    IN PWORD Port
+);
+
+
+//
+// Time Functions
+//
 NTSYSAPI
 NTSTATUS
 NTAPI
@@ -2158,9 +2358,9 @@ RtlTimeToTimeFields(
     PTIME_FIELDS TimeFields
 );
 
-/*
- * Version Functions
- */
+//
+// Version Functions
+//
 NTSYSAPI
 NTSTATUS
 NTAPI
@@ -2180,28 +2380,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