- Part one of major RTL cleanup. Merge duplicated code and stick everything in lib\rtl that used to be in ntdll. Also cleanup the file headers, copyright information and includes.
Modified: trunk/reactos/lib/ntdll/ntdll.xml
Deleted: trunk/reactos/lib/ntdll/rtl/apc.c
Deleted: trunk/reactos/lib/ntdll/rtl/callback.c
Deleted: trunk/reactos/lib/ntdll/rtl/crc32.c
Deleted: trunk/reactos/lib/ntdll/rtl/dbgbuffer.c
Deleted: trunk/reactos/lib/ntdll/rtl/handle.c
Modified: trunk/reactos/lib/ntdll/rtl/libsupp.c
Deleted: trunk/reactos/lib/ntdll/rtl/math.c
Deleted: trunk/reactos/lib/ntdll/rtl/message.c
Deleted: trunk/reactos/lib/ntdll/rtl/misc.c
Deleted: trunk/reactos/lib/ntdll/rtl/process.c
Deleted: trunk/reactos/lib/ntdll/rtl/propvar.c
Deleted: trunk/reactos/lib/ntdll/rtl/rangelist.c
Deleted: trunk/reactos/lib/ntdll/rtl/resource.c
Deleted: trunk/reactos/lib/ntdll/rtl/secobj.c
Deleted: trunk/reactos/lib/ntdll/rtl/teb.c
Deleted: trunk/reactos/lib/ntdll/rtl/timerqueue.c
Deleted: trunk/reactos/lib/ntdll/rtl/trace.c
Added: trunk/reactos/lib/ntdll/rtl/version.c
Modified: trunk/reactos/lib/rtl/access.c
Modified: trunk/reactos/lib/rtl/acl.c
Added: trunk/reactos/lib/rtl/apc.c
Modified: trunk/reactos/lib/rtl/atom.c
Modified: trunk/reactos/lib/rtl/bit.c
Modified: trunk/reactos/lib/rtl/bitmap.c
Modified: trunk/reactos/lib/rtl/bootdata.c
Added: trunk/reactos/lib/rtl/callback.c
Modified: trunk/reactos/lib/rtl/compress.c
Added: trunk/reactos/lib/rtl/crc32.c
Added: trunk/reactos/lib/rtl/dbgbuffer.c
Modified: trunk/reactos/lib/rtl/dos8dot3.c
Modified: trunk/reactos/lib/rtl/encode.c
Modified: trunk/reactos/lib/rtl/env.c
Modified: trunk/reactos/lib/rtl/error.c
Modified: trunk/reactos/lib/rtl/exception.c
Modified: trunk/reactos/lib/rtl/generictable.c
Added: trunk/reactos/lib/rtl/handle.c
Modified: trunk/reactos/lib/rtl/heap.c
Modified: trunk/reactos/lib/rtl/image.c
Modified: trunk/reactos/lib/rtl/largeint.c
Modified: trunk/reactos/lib/rtl/luid.c
Added: trunk/reactos/lib/rtl/math.c
Modified: trunk/reactos/lib/rtl/mem.c
Added: trunk/reactos/lib/rtl/message.c
Modified: trunk/reactos/lib/rtl/network.c
Modified: trunk/reactos/lib/rtl/nls.c
Modified: trunk/reactos/lib/rtl/ppb.c
Modified: trunk/reactos/lib/rtl/process.c
Added: trunk/reactos/lib/rtl/propvar.c
Modified: trunk/reactos/lib/rtl/qsort.c
Modified: trunk/reactos/lib/rtl/random.c
Added: trunk/reactos/lib/rtl/rangelist.c
Modified: trunk/reactos/lib/rtl/registry.c
Added: trunk/reactos/lib/rtl/resource.c
Modified: trunk/reactos/lib/rtl/rtl.h
Modified: trunk/reactos/lib/rtl/rtl.xml
Modified: trunk/reactos/lib/rtl/sd.c
Modified: trunk/reactos/lib/rtl/security.c
Modified: trunk/reactos/lib/rtl/sid.c
Modified: trunk/reactos/lib/rtl/splaytree.c
Modified: trunk/reactos/lib/rtl/thread.c
Modified: trunk/reactos/lib/rtl/time.c
Added: trunk/reactos/lib/rtl/timerqueue.c
Modified: trunk/reactos/lib/rtl/timezone.c
Modified: trunk/reactos/lib/rtl/unicode.c
Modified: trunk/reactos/lib/rtl/unicodeprefix.c
Modified: trunk/reactos/lib/rtl/version.c
Modified: trunk/reactos/ntoskrnl/ntoskrnl.xml
Modified: trunk/reactos/ntoskrnl/rtl/libsupp.c
Deleted: trunk/reactos/ntoskrnl/rtl/message.c
Deleted: trunk/reactos/ntoskrnl/rtl/rangelist.c

Modified: trunk/reactos/lib/ntdll/ntdll.xml
--- trunk/reactos/lib/ntdll/ntdll.xml	2005-09-07 21:25:42 UTC (rev 17730)
+++ trunk/reactos/lib/ntdll/ntdll.xml	2005-09-08 00:09:32 UTC (rev 17731)
@@ -32,25 +32,11 @@
 		<file>dllmain.c</file>
 	</directory>
 	<directory name="rtl">
-		<file>apc.c</file>
-		<file>callback.c</file>
-		<file>crc32.c</file>
 		<file>critical.c</file>
-		<file>dbgbuffer.c</file>
 		<file>exception.c</file>
-		<file>handle.c</file>
 		<file>libsupp.c</file>
-		<file>math.c</file>
-		<file>message.c</file>
-		<file>misc.c</file>
 		<file>path.c</file>
-		<file>process.c</file>
-		<file>propvar.c</file>
-		<file>rangelist.c</file>
-		<file>resource.c</file>
-		<file>secobj.c</file>
-		<file>teb.c</file>
-		<file>timerqueue.c</file>
+		<file>version.c</file>
 	</directory>
 	<directory name="stdio">
 		<file>sprintf.c</file>

Deleted: trunk/reactos/lib/ntdll/rtl/apc.c
--- trunk/reactos/lib/ntdll/rtl/apc.c	2005-09-07 21:25:42 UTC (rev 17730)
+++ trunk/reactos/lib/ntdll/rtl/apc.c	2005-09-08 00:09:32 UTC (rev 17731)
@@ -1,55 +0,0 @@
-/*
- *  ReactOS kernel
- *  Copyright (C) 2000 David Welch <welch@cwcom.net>
- *
- *  This program is free software; you can redistribute it and/or modify
- *  it under the terms of the GNU General Public License as published by
- *  the Free Software Foundation; either version 2 of the License, or
- *  (at your option) any later version.
- *
- *  This program is distributed in the hope that it will be useful,
- *  but WITHOUT ANY WARRANTY; without even the implied warranty of
- *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- *  GNU General Public License for more details.
- *
- *  You should have received a copy of the GNU General Public License
- *  along with this program; if not, write to the Free Software
- *  Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
- */
-/* $Id$
- *
- * PROJECT:           ReactOS kernel
- * PURPOSE:           User-mode APC support
- * FILE:              lib/ntdll/rtl/apc.c
- * PROGRAMER:         David Welch <welch@cwcom.net>
- */
-
-/* INCLUDES *****************************************************************/
-
-#include <ntdll.h>
-#define NDEBUG
-#include <debug.h>
-
-/* FUNCTIONS ***************************************************************/
-
-VOID STDCALL
-KiUserApcDispatcher(PIO_APC_ROUTINE ApcRoutine,
-		    PVOID ApcContext,
-		    PIO_STATUS_BLOCK Iosb,
-		    ULONG Reserved,
-		    PCONTEXT Context)
-{
-   /*
-    * Call the APC
-    */
-   //DPRINT1("ITS ME\n");
-   ApcRoutine(ApcContext,
-	      Iosb,
-	      Reserved);
-   /*
-    * Switch back to the interrupted context
-    */
-    //DPRINT1("switch back\n");
-   NtContinue(Context, 1);
-}
-

Deleted: trunk/reactos/lib/ntdll/rtl/callback.c
--- trunk/reactos/lib/ntdll/rtl/callback.c	2005-09-07 21:25:42 UTC (rev 17730)
+++ trunk/reactos/lib/ntdll/rtl/callback.c	2005-09-08 00:09:32 UTC (rev 17731)
@@ -1,35 +0,0 @@
-/* $Id$
- *
- * COPYRIGHT:         See COPYING in the top level directory
- * PROJECT:           ReactOS kernel
- * PURPOSE:           User-mode callback support
- * FILE:              lib/ntdll/rtl/callback.c
- * PROGRAMER:         David Welch <welch@cwcom.net>
- */
-
-/* INCLUDES *****************************************************************/
-
-#include <ntdll.h>
-#define NDEBUG
-#include <debug.h>
-/* TYPES *********************************************************************/
-
-typedef NTSTATUS (STDCALL *KERNEL_CALLBACK_FUNCTION)(PVOID Argument,
-                                                    ULONG ArgumentLength);
-
-/* FUNCTIONS *****************************************************************/
-
-VOID STDCALL
-KiUserCallbackDispatcher(ULONG RoutineIndex,
-			 PVOID Argument,
-			 ULONG ArgumentLength)
-{
-   PPEB Peb;
-   NTSTATUS Status;
-   KERNEL_CALLBACK_FUNCTION Callback;
-
-   Peb = NtCurrentPeb();
-   Callback = (KERNEL_CALLBACK_FUNCTION)Peb->KernelCallbackTable[RoutineIndex];
-   Status = Callback(Argument, ArgumentLength);
-   ZwCallbackReturn(NULL, 0, Status);
-}

Deleted: trunk/reactos/lib/ntdll/rtl/crc32.c
--- trunk/reactos/lib/ntdll/rtl/crc32.c	2005-09-07 21:25:42 UTC (rev 17730)
+++ trunk/reactos/lib/ntdll/rtl/crc32.c	2005-09-08 00:09:32 UTC (rev 17731)
@@ -1,109 +0,0 @@
-/*
- * COPYRIGHT:         See COPYING in the top level directory
- * PROJECT:           ReactOS kernel
- * PURPOSE:           crc32 functions
- * FILE:              lib/ntdll/rtl/crc32.c
- * PROGRAMER:         Steven Edwards
- * REVISION HISTORY:
- *                    11/15/2000: Created
- */
-
-/* This work is based off of rtl.c in Wine.
- * Please give credit where credit is due:
- *
- * Copyright 2003      Thomas Mertes
- * Crc32 code Copyright 1986 Gary S. Brown (Public domain)
- */
-
-/* INCLUDES *****************************************************************/
-
-#include <ntdll.h>
-#define NDEBUG
-#include <debug.h>
-/* FUNCTIONS ****************************************************************/
-
-/* CRC polynomial 0xedb88320 */
-static const ULONG CrcTable[256] =
-{
-    0x00000000, 0x77073096, 0xee0e612c, 0x990951ba, 0x076dc419, 0x706af48f,
-    0xe963a535, 0x9e6495a3, 0x0edb8832, 0x79dcb8a4, 0xe0d5e91e, 0x97d2d988,
-    0x09b64c2b, 0x7eb17cbd, 0xe7b82d07, 0x90bf1d91, 0x1db71064, 0x6ab020f2,
-    0xf3b97148, 0x84be41de, 0x1adad47d, 0x6ddde4eb, 0xf4d4b551, 0x83d385c7,
-    0x136c9856, 0x646ba8c0, 0xfd62f97a, 0x8a65c9ec, 0x14015c4f, 0x63066cd9,
-    0xfa0f3d63, 0x8d080df5, 0x3b6e20c8, 0x4c69105e, 0xd56041e4, 0xa2677172,
-    0x3c03e4d1, 0x4b04d447, 0xd20d85fd, 0xa50ab56b, 0x35b5a8fa, 0x42b2986c,
-    0xdbbbc9d6, 0xacbcf940, 0x32d86ce3, 0x45df5c75, 0xdcd60dcf, 0xabd13d59,
-    0x26d930ac, 0x51de003a, 0xc8d75180, 0xbfd06116, 0x21b4f4b5, 0x56b3c423,
-    0xcfba9599, 0xb8bda50f, 0x2802b89e, 0x5f058808, 0xc60cd9b2, 0xb10be924,
-    0x2f6f7c87, 0x58684c11, 0xc1611dab, 0xb6662d3d, 0x76dc4190, 0x01db7106,
-    0x98d220bc, 0xefd5102a, 0x71b18589, 0x06b6b51f, 0x9fbfe4a5, 0xe8b8d433,
-    0x7807c9a2, 0x0f00f934, 0x9609a88e, 0xe10e9818, 0x7f6a0dbb, 0x086d3d2d,
-    0x91646c97, 0xe6635c01, 0x6b6b51f4, 0x1c6c6162, 0x856530d8, 0xf262004e,
-    0x6c0695ed, 0x1b01a57b, 0x8208f4c1, 0xf50fc457, 0x65b0d9c6, 0x12b7e950,
-    0x8bbeb8ea, 0xfcb9887c, 0x62dd1ddf, 0x15da2d49, 0x8cd37cf3, 0xfbd44c65,
-    0x4db26158, 0x3ab551ce, 0xa3bc0074, 0xd4bb30e2, 0x4adfa541, 0x3dd895d7,
-    0xa4d1c46d, 0xd3d6f4fb, 0x4369e96a, 0x346ed9fc, 0xad678846, 0xda60b8d0,
-    0x44042d73, 0x33031de5, 0xaa0a4c5f, 0xdd0d7cc9, 0x5005713c, 0x270241aa,
-    0xbe0b1010, 0xc90c2086, 0x5768b525, 0x206f85b3, 0xb966d409, 0xce61e49f,
-    0x5edef90e, 0x29d9c998, 0xb0d09822, 0xc7d7a8b4, 0x59b33d17, 0x2eb40d81,
-    0xb7bd5c3b, 0xc0ba6cad, 0xedb88320, 0x9abfb3b6, 0x03b6e20c, 0x74b1d29a,
-    0xead54739, 0x9dd277af, 0x04db2615, 0x73dc1683, 0xe3630b12, 0x94643b84,
-    0x0d6d6a3e, 0x7a6a5aa8, 0xe40ecf0b, 0x9309ff9d, 0x0a00ae27, 0x7d079eb1,
-    0xf00f9344, 0x8708a3d2, 0x1e01f268, 0x6906c2fe, 0xf762575d, 0x806567cb,
-    0x196c3671, 0x6e6b06e7, 0xfed41b76, 0x89d32be0, 0x10da7a5a, 0x67dd4acc,
-    0xf9b9df6f, 0x8ebeeff9, 0x17b7be43, 0x60b08ed5, 0xd6d6a3e8, 0xa1d1937e,
-    0x38d8c2c4, 0x4fdff252, 0xd1bb67f1, 0xa6bc5767, 0x3fb506dd, 0x48b2364b,
-    0xd80d2bda, 0xaf0a1b4c, 0x36034af6, 0x41047a60, 0xdf60efc3, 0xa867df55,
-    0x316e8eef, 0x4669be79, 0xcb61b38c, 0xbc66831a, 0x256fd2a0, 0x5268e236,
-    0xcc0c7795, 0xbb0b4703, 0x220216b9, 0x5505262f, 0xc5ba3bbe, 0xb2bd0b28,
-    0x2bb45a92, 0x5cb36a04, 0xc2d7ffa7, 0xb5d0cf31, 0x2cd99e8b, 0x5bdeae1d,
-    0x9b64c2b0, 0xec63f226, 0x756aa39c, 0x026d930a, 0x9c0906a9, 0xeb0e363f,
-    0x72076785, 0x05005713, 0x95bf4a82, 0xe2b87a14, 0x7bb12bae, 0x0cb61b38,
-    0x92d28e9b, 0xe5d5be0d, 0x7cdcefb7, 0x0bdbdf21, 0x86d3d2d4, 0xf1d4e242,
-    0x68ddb3f8, 0x1fda836e, 0x81be16cd, 0xf6b9265b, 0x6fb077e1, 0x18b74777,
-    0x88085ae6, 0xff0f6a70, 0x66063bca, 0x11010b5c, 0x8f659eff, 0xf862ae69,
-    0x616bffd3, 0x166ccf45, 0xa00ae278, 0xd70dd2ee, 0x4e048354, 0x3903b3c2,
-    0xa7672661, 0xd06016f7, 0x4969474d, 0x3e6e77db, 0xaed16a4a, 0xd9d65adc,
-    0x40df0b66, 0x37d83bf0, 0xa9bcae53, 0xdebb9ec5, 0x47b2cf7f, 0x30b5ffe9,
-    0xbdbdf21c, 0xcabac28a, 0x53b39330, 0x24b4a3a6, 0xbad03605, 0xcdd70693,
-    0x54de5729, 0x23d967bf, 0xb3667a2e, 0xc4614ab8, 0x5d681b02, 0x2a6f2b94,
-    0xb40bbe37, 0xc30c8ea1, 0x5a05df1b, 0x2d02ef8d
-};
-
-/*********************************************************************
- *                  RtlComputeCrc32   [NTDLL.@]
- *
- * Calculate the CRC32 checksum of a block of bytes
- *
- * PARAMS
- *  Initial [I] Initial CRC value
- *  Data    [I] Data block
- *  Length  [I] Length of the byte block
- *
- * RETURNS
- *  The cumulative CRC32 of Initial and Length bytes of the Data block.
- *
- * @implemented
- */
-ULONG STDCALL
-RtlComputeCrc32 (IN ULONG Initial,
-		 IN PUCHAR Data,
-		 IN ULONG Length)
-{
-  ULONG CrcValue;
-
-#ifdef DBG
-  DbgPrint("(%lu,%p,%lu)\n", Initial, Data, Length);
-#endif
-
-  CrcValue = ~Initial;
-  while (Length > 0)
-  {
-    CrcValue = CrcTable[(CrcValue ^ *Data) & 0xff] ^ (CrcValue >> 8);
-    Data++;
-    Length--;
-  }
-  return ~CrcValue;
-}
-
-/* EOF */

Deleted: trunk/reactos/lib/ntdll/rtl/dbgbuffer.c
--- trunk/reactos/lib/ntdll/rtl/dbgbuffer.c	2005-09-07 21:25:42 UTC (rev 17730)
+++ trunk/reactos/lib/ntdll/rtl/dbgbuffer.c	2005-09-08 00:09:32 UTC (rev 17731)
@@ -1,424 +0,0 @@
-/*
- *  ReactOS kernel
- *  Copyright (C) 2004 ReactOS Team
- *
- *  This program is free software; you can redistribute it and/or modify
- *  it under the terms of the GNU General Public License as published by
- *  the Free Software Foundation; either version 2 of the License, or
- *  (at your option) any later version.
- *
- *  This program is distributed in the hope that it will be useful,
- *  but WITHOUT ANY WARRANTY; without even the implied warranty of
- *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- *  GNU General Public License for more details.
- *
- *  You should have received a copy of the GNU General Public License
- *  along with this program; if not, write to the Free Software
- *  Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
- */
-/*
- *
- * PROJECT:           ReactOS kernel
- * PURPOSE:           User-mode Debug Buffer support
- * FILE:              lib/ntdll/rtl/dbgbuffer.c
- * PROGRAMER:         James Tabor
- * Fixme:             Add Process and Thread event pair support.
- *                    Start Locks and Heap support.
- *                    Test: Create remote thread to help query remote
- *                    processes and use view mapping to read them.
- *
- */
-
-/* INCLUDES *****************************************************************/
-
-#include <ntdll.h>
-#define NDEBUG
-#include <debug.h>
-
-/* FUNCTIONS ***************************************************************/
-
-/*
- * @unimplemented
- */
-PDEBUG_BUFFER STDCALL
-RtlCreateQueryDebugBuffer(IN ULONG Size,
-                          IN BOOLEAN EventPair)
-{
-   NTSTATUS Status;
-   PDEBUG_BUFFER Buf = NULL;
-   ULONG SectionSize  = 100 * PAGE_SIZE;
-
-   Status = NtAllocateVirtualMemory( NtCurrentProcess(),
-                                    (PVOID)&Buf,
-                                     0,
-                                    &SectionSize,
-                                     MEM_COMMIT,
-                                     PAGE_READWRITE);
-   if (!NT_SUCCESS(Status))
-     {
-        return NULL;
-     }
-
-   Buf->SectionBase = Buf;
-   Buf->SectionSize = SectionSize;
-
-   DPRINT("RtlCQDB: BA: %x BS: %d\n", Buf->SectionBase, Buf->SectionSize);
-
-   return Buf;
-}
-
-/*
- * @unimplemented
- */
-NTSTATUS STDCALL
-RtlDestroyQueryDebugBuffer(IN PDEBUG_BUFFER Buf)
-{
-   NTSTATUS Status = STATUS_SUCCESS;
-
-   if (NULL != Buf)
-     {
-     Status = NtFreeVirtualMemory( NtCurrentProcess(),
-                                  (PVOID)&Buf,
-                                  &Buf->SectionSize,
-                                   MEM_RELEASE);
-     }
-   if (!NT_SUCCESS(Status))
-     {
-        DPRINT1("RtlDQDB: Failed to free VM!\n");
-     }
-   return Status;
-}
-
-/*
- *	Based on lib/epsapi/enum/modules.c by KJK::Hyperion.
- *
- */
-NTSTATUS STDCALL
-RtlpQueryRemoteProcessModules(HANDLE ProcessHandle,
-                              IN PMODULE_INFORMATION ModuleInformation OPTIONAL,
-                              IN ULONG Size OPTIONAL,
-                              OUT PULONG ReturnedSize)
-{
-  PROCESS_BASIC_INFORMATION pbiInfo;
-  PPEB_LDR_DATA ppldLdrData;
-  LDR_DATA_TABLE_ENTRY lmModule;
-  PLIST_ENTRY pleListHead;
-  PLIST_ENTRY pleCurEntry;
-
-  PDEBUG_MODULE_INFORMATION ModulePtr = NULL;
-  NTSTATUS Status = STATUS_SUCCESS;
-  ULONG UsedSize = sizeof(ULONG);
-  ANSI_STRING AnsiString;
-  PCHAR p;
-
-  DPRINT("RtlpQueryRemoteProcessModules Start\n");
-
-  /* query the process basic information (includes the PEB address) */
-  Status = NtQueryInformationProcess ( ProcessHandle,
-                                       ProcessBasicInformation,
-                                       &pbiInfo,
-                                       sizeof(PROCESS_BASIC_INFORMATION),
-                                       NULL);
-
-  if (!NT_SUCCESS(Status))
-    {
-       /* failure */
-       DPRINT("NtQueryInformationProcess 1 &x \n", Status);
-       return Status;
-    }
-
-  if (ModuleInformation == NULL || Size == 0)
-    {
-      Status = STATUS_INFO_LENGTH_MISMATCH;
-    }
-  else
-    {
-      ModuleInformation->ModuleCount = 0;
-      ModulePtr = &ModuleInformation->ModuleEntry[0];
-      Status = STATUS_SUCCESS;
-    }
-
-  /* get the address of the PE Loader data */
-  Status = NtReadVirtualMemory ( ProcessHandle,
-                                &(pbiInfo.PebBaseAddress->Ldr),
-                                &ppldLdrData,
-                                sizeof(ppldLdrData),
-                                NULL );
-
-  if (!NT_SUCCESS(Status))
-    {
-       /* failure */
-       DPRINT("NtReadVirtualMemory 1 %x \n", Status);
-       return Status;
-    }
-
-
-  /* head of the module list: the last element in the list will point to this */
-  pleListHead = &ppldLdrData->InLoadOrderModuleList;
-
-  /* get the address of the first element in the list */
-  Status = NtReadVirtualMemory ( ProcessHandle,
-               &(ppldLdrData->InLoadOrderModuleList.Flink),
-                                &pleCurEntry,
-                                 sizeof(pleCurEntry),
-                                 NULL );
-
-   if (!NT_SUCCESS(Status))
-     {
-        /* failure */
-        DPRINT("NtReadVirtualMemory 2 %x \n", Status);
-        return Status;
-     }
-
-  while(pleCurEntry != pleListHead)
-  {
-
-   UNICODE_STRING Unicode;
-   WCHAR  Buffer[256 * sizeof(WCHAR)];
-
-   /* read the current module */
-   Status = NtReadVirtualMemory ( ProcessHandle,
-            CONTAINING_RECORD(pleCurEntry, LDR_DATA_TABLE_ENTRY, InLoadOrderModuleList),
-                                 &lmModule,
-                                 sizeof(LDR_DATA_TABLE_ENTRY),
-                                 NULL );
-
-   /* Import module name from remote Process user space. */
-   Unicode.Length = lmModule.FullDllName.Length;
-   Unicode.MaximumLength = lmModule.FullDllName.MaximumLength;
-   Unicode.Buffer = Buffer;
-
-   Status = NtReadVirtualMemory ( ProcessHandle,
-                                  lmModule.FullDllName.Buffer,
-                                  Unicode.Buffer,
-                                  Unicode.Length,
-                                  NULL );
-
-   if (!NT_SUCCESS(Status))
-     {
-        /* failure */
-        DPRINT( "NtReadVirtualMemory 3 %x \n", Status);
-        return Status;
-     }
-
-      DPRINT("  Module %wZ\n", &Unicode);
-
-      if (UsedSize > Size)
-        {
-          Status = STATUS_INFO_LENGTH_MISMATCH;
-        }
-      else if (ModuleInformation != NULL)
-        {
-          ModulePtr->Reserved[0] = ModulePtr->Reserved[1] = 0;      // FIXME: ??
-          ModulePtr->Base        = lmModule.DllBase;
-          ModulePtr->Size        = lmModule.SizeOfImage;
-          ModulePtr->Flags       = lmModule.Flags;
-          ModulePtr->Index       = 0;      // FIXME:  ??
-          ModulePtr->Unknown     = 0;      // FIXME: ??
-          ModulePtr->LoadCount   = lmModule.LoadCount;
-
-          AnsiString.Length        = 0;
-          AnsiString.MaximumLength = 256;
-          AnsiString.Buffer        = ModulePtr->ImageName;
-          RtlUnicodeStringToAnsiString(&AnsiString,
-                                       &Unicode,
-                                       FALSE);
-
-          p = strrchr(ModulePtr->ImageName, '\\');
-          if (p != NULL)
-            ModulePtr->ModuleNameOffset = p - ModulePtr->ImageName + 1;
-          else
-            ModulePtr->ModuleNameOffset = 0;
-
-          ModulePtr++;
-          ModuleInformation->ModuleCount++;
-        }
-      UsedSize += sizeof(DEBUG_MODULE_INFORMATION);
-
-      /* address of the next module in the list */
-      pleCurEntry = lmModule.InLoadOrderModuleList.Flink;
-  }
-
-  if (ReturnedSize != 0)
-       *ReturnedSize = UsedSize;
-
-  DPRINT("RtlpQueryRemoteProcessModules End\n");
-
-    /* success */
-  return (STATUS_SUCCESS);
-}
-
-/*
- * @unimplemented
- */
-NTSTATUS STDCALL
-RtlQueryProcessDebugInformation(IN ULONG ProcessId,
-                                IN ULONG DebugInfoMask,
-                                IN OUT PDEBUG_BUFFER Buf)
-{
-   NTSTATUS Status = STATUS_SUCCESS;
-   ULONG Pid = (ULONG) NtCurrentTeb()->Cid.UniqueProcess;
-
-   Buf->InfoClassMask = DebugInfoMask;
-   Buf->SizeOfInfo = sizeof(DEBUG_BUFFER);
-
-   DPRINT("QueryProcessDebugInformation Start\n");
-
-/*
-      Currently ROS can not read-only from kenrel space, and doesn't
-      check for boundaries inside kernel space that are page protected
-      from every one but the kernel. aka page 0 - 2
- */
-if (ProcessId <= 1)
-  {
-	Status = STATUS_ACCESS_VIOLATION;
-  }
-else
-if (Pid == ProcessId)
-  {
-   if (DebugInfoMask & PDI_MODULES)
-     {
-    PMODULE_INFORMATION Mp;
-    ULONG ReturnSize = 0;
-    ULONG MSize;
-
-    Mp = (PMODULE_INFORMATION)(Buf + Buf->SizeOfInfo);
-
-    /* I like this better than the do & while loop. */
-    Status = LdrQueryProcessModuleInformation( NULL,
-                                               0 ,
-                                              &ReturnSize);
-    Status = LdrQueryProcessModuleInformation( Mp,
-                                               ReturnSize ,
-                                              &ReturnSize);
-   if (!NT_SUCCESS(Status))
-     {
-         return Status;
-     }
-
-    MSize = Mp->ModuleCount * (sizeof(MODULE_INFORMATION) + 8);
-    Buf->ModuleInformation = Mp;
-    Buf->SizeOfInfo = Buf->SizeOfInfo + MSize;
-     }
-
-   if (DebugInfoMask & PDI_HEAPS)
-     {
-   PHEAP_INFORMATION Hp;
-   ULONG HSize;
-
-   Hp = (PHEAP_INFORMATION)(Buf + Buf->SizeOfInfo);
-   HSize = sizeof(HEAP_INFORMATION);
-        if (DebugInfoMask & PDI_HEAP_TAGS)
-          {
-          }
-        if (DebugInfoMask & PDI_HEAP_BLOCKS)
-          {
-          }
-   Buf->HeapInformation = Hp;
-   Buf->SizeOfInfo = Buf->SizeOfInfo + HSize;
-
-     }
-
-   if (DebugInfoMask & PDI_LOCKS)
-     {
-   PLOCK_INFORMATION Lp;
-   ULONG LSize;
-
-   Lp = (PLOCK_INFORMATION)(Buf + Buf->SizeOfInfo);
-   LSize = sizeof(LOCK_INFORMATION);
-   Buf->LockInformation = Lp;
-   Buf->SizeOfInfo = Buf->SizeOfInfo + LSize;
-    }
-
-   DPRINT("QueryProcessDebugInformation end \n");
-   DPRINT("QueryDebugInfo : %d\n", Buf->SizeOfInfo);
-}
-else
-{
-  HANDLE hProcess;
-  CLIENT_ID ClientId;
-  OBJECT_ATTRIBUTES ObjectAttributes;
-
-       Buf->Unknown[0] = (ULONG)NtCurrentProcess();
-
-       ClientId.UniqueThread = 0;
-       ClientId.UniqueProcess = (HANDLE)ProcessId;
-       InitializeObjectAttributes(&ObjectAttributes,
-                                  NULL,
-                                  0,
-                                  NULL,
-                                  NULL);
-
-       Status = NtOpenProcess( &hProcess,
-                                (PROCESS_ALL_ACCESS),
-                               &ObjectAttributes,
-                               &ClientId );
-       if (!NT_SUCCESS(Status))
-         {
-           return Status;
-         }
-
-   if (DebugInfoMask & PDI_MODULES)
-     {
-    PMODULE_INFORMATION Mp;
-    ULONG ReturnSize = 0;
-    ULONG MSize;
-
-    Mp = (PMODULE_INFORMATION)(Buf + Buf->SizeOfInfo);
-
-    Status = RtlpQueryRemoteProcessModules( hProcess,
-                                            NULL,
-                                            0,
-                                           &ReturnSize);
-
-    Status = RtlpQueryRemoteProcessModules( hProcess,
-                                            Mp,
-                                            ReturnSize ,
-                                           &ReturnSize);
-   if (!NT_SUCCESS(Status))
-     {
-         return Status;
-     }
-
-    MSize = Mp->ModuleCount * (sizeof(MODULE_INFORMATION) + 8);
-    Buf->ModuleInformation = Mp;
-    Buf->SizeOfInfo = Buf->SizeOfInfo + MSize;
-     }
-
-   if (DebugInfoMask & PDI_HEAPS)
-     {
-   PHEAP_INFORMATION Hp;
-   ULONG HSize;
-
-   Hp = (PHEAP_INFORMATION)(Buf + Buf->SizeOfInfo);
-   HSize = sizeof(HEAP_INFORMATION);
-        if (DebugInfoMask & PDI_HEAP_TAGS)
-          {
-          }
-        if (DebugInfoMask & PDI_HEAP_BLOCKS)
-          {
-          }
-   Buf->HeapInformation = Hp;
-   Buf->SizeOfInfo = Buf->SizeOfInfo + HSize;
-
-     }
-
-   if (DebugInfoMask & PDI_LOCKS)
-     {
-   PLOCK_INFORMATION Lp;
-   ULONG LSize;
-
-   Lp = (PLOCK_INFORMATION)(Buf + Buf->SizeOfInfo);
-   LSize = sizeof(LOCK_INFORMATION);
-   Buf->LockInformation = Lp;
-   Buf->SizeOfInfo = Buf->SizeOfInfo + LSize;
-    }
-
-   DPRINT("QueryProcessDebugInformation end \n");
-   DPRINT("QueryDebugInfo : %d\n", Buf->SizeOfInfo);
-}
-   return Status;
-
-}
-
-/* EOL */

Deleted: trunk/reactos/lib/ntdll/rtl/handle.c
--- trunk/reactos/lib/ntdll/rtl/handle.c	2005-09-07 21:25:42 UTC (rev 17730)
+++ trunk/reactos/lib/ntdll/rtl/handle.c	2005-09-08 00:09:32 UTC (rev 17731)
@@ -1,193 +0,0 @@
-/* $Id$
- *
- * COPYRIGHT:         See COPYING in the top level directory
- * PROJECT:           ReactOS kernel
- * PURPOSE:           Handle table
- * FILE:              lib/ntdll/rtl/handle.c
- * PROGRAMER:         Eric Kohl <ekohl@rz-online.de>
- */
-
-/* INCLUDES ******************************************************************/
-
-#include <ntdll.h>
-#define NDEBUG
-#include <debug.h>
-
-/* FUNCTIONS *****************************************************************/
-
-VOID STDCALL
-RtlInitializeHandleTable(ULONG TableSize,
-			 ULONG HandleSize,
-			 PRTL_HANDLE_TABLE HandleTable)
-{
-   /* initialize handle table */
-   memset(HandleTable,
-	  0,
-	  sizeof(RTL_HANDLE_TABLE));
-   HandleTable->MaximumNumberOfHandles = TableSize;
-   HandleTable->SizeOfHandleTableEntry = HandleSize;
-}
-
-
-/*
- * @implemented
- */
-VOID STDCALL
-RtlDestroyHandleTable(PRTL_HANDLE_TABLE HandleTable)
-{
-   PVOID ArrayPointer;
-   ULONG ArraySize;
-
-   /* free handle array */
-   if (HandleTable->CommittedHandles)
-     {
-        ArrayPointer = (PVOID)HandleTable->CommittedHandles;
-        ArraySize = HandleTable->SizeOfHandleTableEntry * HandleTable->MaximumNumberOfHandles;
-        NtFreeVirtualMemory(NtCurrentProcess(),
-		            &ArrayPointer,
-		            &ArraySize,
-		            MEM_RELEASE);
-     }
-}
-
-
-/*
- * @implemented
- */
-PRTL_HANDLE_TABLE_ENTRY STDCALL
-RtlAllocateHandle(PRTL_HANDLE_TABLE HandleTable,
-		  PULONG Index)
-{
-   PRTL_HANDLE_TABLE_ENTRY *pp_new, *pph, ph;
-   NTSTATUS Status;
-   PRTL_HANDLE_TABLE_ENTRY retval;
-   PVOID ArrayPointer;
-   ULONG ArraySize;
-
-   pp_new = &HandleTable->FreeHandles;
-
-   if (HandleTable->FreeHandles == NULL)
-     {
-	/* no free handle available */
-	if (HandleTable->UnCommittedHandles == NULL)
-	  {
-	     /* allocate handle array */
-	     ArraySize = HandleTable->SizeOfHandleTableEntry * HandleTable->MaximumNumberOfHandles;
-	     ArrayPointer = NULL;
-	     
-	     /* FIXME - only reserve handles here! */
-	     Status = NtAllocateVirtualMemory(NtCurrentProcess(),
-					      (PVOID*)&ArrayPointer,
-					      0,
-					      &ArraySize,
-					      MEM_RESERVE | MEM_COMMIT,
-					      PAGE_READWRITE);
-	     if (!NT_SUCCESS(Status))
-	       return NULL;
-
-	     /* update handle array pointers */
-	     HandleTable->FreeHandles = (PRTL_HANDLE_TABLE_ENTRY)ArrayPointer;
-	     HandleTable->MaxReservedHandles = (PRTL_HANDLE_TABLE_ENTRY)((ULONG_PTR)ArrayPointer + ArraySize);
-	     HandleTable->CommittedHandles = (PRTL_HANDLE_TABLE_ENTRY)ArrayPointer;
-	     HandleTable->UnCommittedHandles = (PRTL_HANDLE_TABLE_ENTRY)ArrayPointer;
-	  }
-
-        /* FIXME - should check if handles need to be committed */
-
-	/* build free list in handle array */
-	ph = HandleTable->FreeHandles;
-	pph = pp_new;
-	while (ph < HandleTable->MaxReservedHandles)
-	  {
-	     *pph = ph;
-	     pph = &ph->NextFree;
-	     ph = (PRTL_HANDLE_TABLE_ENTRY)((ULONG_PTR)ph + HandleTable->SizeOfHandleTableEntry);
-	  }
-	*pph = 0;
-     }
-
-   /* remove handle from free list */
-   retval = *pp_new;
-   *pp_new = retval->NextFree;
-   retval->NextFree = NULL;
-
-   if (Index)
-     *Index = ((ULONG)((ULONG_PTR)retval - (ULONG_PTR)HandleTable->CommittedHandles) /
-               HandleTable->SizeOfHandleTableEntry);
-
-   return retval;
-}
-
-
-/*
- * @implemented
- */
-BOOLEAN STDCALL
-RtlFreeHandle(PRTL_HANDLE_TABLE HandleTable,
-	      PRTL_HANDLE_TABLE_ENTRY Handle)
-{
-#if DBG
-   /* check if handle is valid */
-   if (RtlIsValidHandle(HandleTable, Handle))
-     return FALSE;
-#endif
-
-   /* clear handle */
-   memset(Handle, 0, HandleTable->SizeOfHandleTableEntry);
-
-   /* add handle to free list */
-   Handle->NextFree = HandleTable->FreeHandles;
-   HandleTable->FreeHandles = Handle;
-
-   return TRUE;
-}
-
-
-/*
- * @implemented
- */
-BOOLEAN STDCALL
-RtlIsValidHandle(PRTL_HANDLE_TABLE HandleTable,
-		 PRTL_HANDLE_TABLE_ENTRY Handle)
-{
-   if ((HandleTable != NULL)
-       && (Handle >= HandleTable->CommittedHandles)
-       && (Handle < HandleTable->MaxReservedHandles)
-       && (Handle->Flags & RTL_HANDLE_VALID))
-     return TRUE;
-   return FALSE;
-}
-
-
-/*
- * @implemented
- */
-BOOLEAN STDCALL
-RtlIsValidIndexHandle(IN PRTL_HANDLE_TABLE HandleTable,
-		      IN ULONG Index,
-		      OUT PRTL_HANDLE_TABLE_ENTRY *Handle)
-{
-   PRTL_HANDLE_TABLE_ENTRY InternalHandle;
-
-   DPRINT("RtlIsValidIndexHandle(HandleTable %p Index %x Handle %p)\n", HandleTable, Index, Handle);
-
-   if (HandleTable == NULL)
-     return FALSE;
-
-   DPRINT("Handles %p HandleSize %x\n",
-	  HandleTable->CommittedHandles, HandleTable->SizeOfHandleTableEntry);
-
-   InternalHandle = (PRTL_HANDLE_TABLE_ENTRY)((ULONG_PTR)HandleTable->CommittedHandles +
-                                              (HandleTable->SizeOfHandleTableEntry * Index));
-   if (!RtlIsValidHandle(HandleTable, InternalHandle))
-     return FALSE;
-
-   DPRINT("InternalHandle %p\n", InternalHandle);
-
-   if (Handle != NULL)
-     *Handle = InternalHandle;
-
-  return TRUE;
-}
-
-/* EOF */

Modified: trunk/reactos/lib/ntdll/rtl/libsupp.c
--- trunk/reactos/lib/ntdll/rtl/libsupp.c	2005-09-07 21:25:42 UTC (rev 17730)
+++ trunk/reactos/lib/ntdll/rtl/libsupp.c	2005-09-08 00:09:32 UTC (rev 17731)
@@ -1,14 +1,13 @@
-/* $Id$
- *
+/*
  * COPYRIGHT:       See COPYING in the top level directory
  * PROJECT:         ReactOS kernel
  * FILE:            lib/ntdll/rtl/libsup.c
  * PURPOSE:         Rtl library support routines
  * PROGRAMMER:      Gunnar Dalsnes
- * UPDATE HISTORY:
- *
  */
 
+/* INCLUDES *****************************************************************/
+
 #include <ntdll.h>
 #define NDEBUG
 #include <debug.h>
@@ -16,13 +15,54 @@
 /* FUNCTIONS ***************************************************************/
 
 KPROCESSOR_MODE
+STDCALL
 RtlpGetMode()
 {
    return UserMode;
 }
 
+PPEB
+STDCALL
+RtlpCurrentPeb(VOID)
+{
+    return NtCurrentPeb();
+}
 
+
+/*
+ * @implemented
+ */
+VOID STDCALL
+RtlAcquirePebLock(VOID)
+{
+   PPEB Peb = NtCurrentPeb ();
+   Peb->FastPebLockRoutine (Peb->FastPebLock);
+}
+
+
+/*
+ * @implemented
+ */
+VOID STDCALL
+RtlReleasePebLock(VOID)
+{
+   PPEB Peb = NtCurrentPeb ();
+   Peb->FastPebUnlockRoutine (Peb->FastPebLock);
+}
+
+/*
+* @implemented
+*/
+ULONG
+STDCALL
+RtlGetNtGlobalFlags(VOID)
+{
+	PPEB pPeb = NtCurrentPeb();
+	return pPeb->NtGlobalFlag;
+}
+
 PVOID
+STDCALL
 RtlpAllocateMemory(UINT Bytes,
                    ULONG Tag)
 {
@@ -35,6 +75,7 @@
 
 
 VOID
+STDCALL
 RtlpFreeMemory(PVOID Mem,
                ULONG Tag)
 {

Deleted: trunk/reactos/lib/ntdll/rtl/math.c
--- trunk/reactos/lib/ntdll/rtl/math.c	2005-09-07 21:25:42 UTC (rev 17730)
+++ trunk/reactos/lib/ntdll/rtl/math.c	2005-09-08 00:09:32 UTC (rev 17731)
@@ -1,221 +0,0 @@
-/* Math functions for i387.
-   Copyright (C) 1995, 1996, 1997 Free Software Foundation, Inc.
-   This file is part of the GNU C Library.
-   Contributed by John C. Bowman <bowman@ipp-garching.mpg.de>, 1995.
-
-   The GNU C Library is free software; you can redistribute it and/or
-   modify it under the terms of the GNU Library General Public License as
-   published by the Free Software Foundation; either version 2 of the
-   License, or (at your option) any later version.
-
-   The GNU C Library is distributed in the hope that it will be useful,
-   but WITHOUT ANY WARRANTY; without even the implied warranty of
-   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-   Library General Public License for more details.
-
-   You should have received a copy of the GNU Library General Public
-   License along with the GNU C Library; see the file COPYING.LIB.  If not,
-   write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
-   Boston, MA 02111-1307, USA.  */
-#include <ntdll.h>
-#define NDEBUG
-#include <debug.h>
-
-double atan (double __x);
-double ceil (double __x);
-double cos (double __x);
-double fabs (double __x);
-double floor (double __x);
-double log (double __x);
-double __log2 (double __x);
-double pow (double __x, double __y);
-double sin (double __x);
-double sqrt (double __x);
-double tan (double __x);
-
-int _fltused = 0x9875;
-
-double atan (double __x)
[truncated at 1000 lines; 7082 more skipped]