Added bitmaps
authorEric Kohl <eric.kohl@reactos.org>
Fri, 3 Mar 2000 00:48:50 +0000 (00:48 +0000)
committerEric Kohl <eric.kohl@reactos.org>
Fri, 3 Mar 2000 00:48:50 +0000 (00:48 +0000)
Added some Rtl string functions
Various changes

svn path=/trunk/; revision=1026

19 files changed:
reactos/include/ddk/dbgfuncs.h
reactos/include/ddk/exfuncs.h
reactos/include/ddk/kefuncs.h
reactos/include/ddk/rtl.h
reactos/lib/ntdll/dbg/brkpoint.c
reactos/lib/ntdll/def/ntdll.def
reactos/lib/ntdll/def/ntdll.edf
reactos/ntoskrnl/dbg/brkpoint.c
reactos/ntoskrnl/hal/x86/misc.c [new file with mode: 0644]
reactos/ntoskrnl/hal/x86/sources
reactos/ntoskrnl/kd/kdebug.c
reactos/ntoskrnl/ke/catch.c
reactos/ntoskrnl/ke/spinlock.c [new file with mode: 0644]
reactos/ntoskrnl/makefile_rex
reactos/ntoskrnl/ntoskrnl.def
reactos/ntoskrnl/ntoskrnl.edf
reactos/ntoskrnl/rtl/bitmap.c [new file with mode: 0644]
reactos/ntoskrnl/rtl/nls.c
reactos/ntoskrnl/rtl/unicode.c

index 4830c33..0a7f15c 100644 (file)
@@ -1,6 +1,7 @@
 
-VOID DbgBreakPoint(VOID);
-ULONG DbgPrint(PCH Format,...);   
+VOID STDCALL DbgBreakPoint(VOID);
+VOID STDCALL DbgBreakPointWithStatus (ULONG Status);
+ULONG DbgPrint(PCH Format,...);
 
 #define DBG_GET_SHOW_FACILITY 0x0001
 #define DBG_GET_SHOW_SEVERITY 0x0002
index af12a35..fa395a4 100644 (file)
@@ -247,6 +247,17 @@ ExQueueWorkItem (
        WORK_QUEUE_TYPE         QueueType
        );
 VOID
+STDCALL
+ExRaiseAccessViolation (
+       VOID
+       );
+VOID
+STDCALL
+ExRaiseDatatypeMisalignment (
+       VOID
+       );
+VOID
+STDCALL
 ExRaiseStatus (
        NTSTATUS        Status
        );
index 7a0bbf1..529e9fb 100644 (file)
@@ -228,9 +228,18 @@ NTSTATUS KeI386AllocateGdtSelectors(OUT PULONG SelArray,
 /*
  * FUNCTION: Raises a user mode exception
  * ARGUMENTS:
- *     ExceptionCode = Status code of the exception 
+ *     ExceptionCode = Status code of the exception
  */
 VOID KeRaiseUserException(NTSTATUS ExceptionCode);
 
 
+/*
+ * FUNCTION: Enters the kernel debugger
+ * ARGUMENTS:
+ *     None
+ */
+VOID
+STDCALL
+KeEnterKernelDebugger (VOID);
+
 #endif /* __INCLUDE_DDK_KEFUNCS_H */
index 02c2df3..667efad 100644 (file)
@@ -1,4 +1,4 @@
-/* $Id: rtl.h,v 1.27 2000/02/21 22:36:00 ekohl Exp $
+/* $Id: rtl.h,v 1.28 2000/03/03 00:38:15 ekohl Exp $
  * 
  */
 
@@ -277,6 +277,12 @@ RtlCheckRegistryKey (
        PWSTR   Path
        );
 
+VOID
+STDCALL
+RtlClearAllBits (
+       IN      PRTL_BITMAP     BitMapHeader
+       );
+
 UINT
 STDCALL
 RtlCompactHeap (
@@ -558,6 +564,14 @@ RtlInitUnicodeString (
        PCWSTR          SourceString
        );
 
+VOID
+STDCALL
+RtlInitializeBitMap (
+       IN OUT  PRTL_BITMAP     BitMapHeader,
+       IN      PULONG          BitMapBuffer,
+       IN      ULONG           SizeOfBitMap
+       );
+
 NTSTATUS
 STDCALL
 RtlInitializeContext (
@@ -894,6 +908,12 @@ RtlSecondsSince1980ToTime (
        PLARGE_INTEGER Time
        );
 
+VOID
+STDCALL
+RtlSetAllBits (
+       IN      PRTL_BITMAP     BitMapHeader
+       );
+
 NTSTATUS
 STDCALL
 RtlSetDaclSecurityDescriptor (
@@ -911,12 +931,14 @@ RtlSizeHeap (
        PVOID   pmem
        );
 
+#if 0
 PWSTR
 RtlStrtok (
        PUNICODE_STRING _string,
        PWSTR           _sep,
        PWSTR           * temp
        );
+#endif
 
 VOID
 RtlStoreLong (
index eb3507a..3b5a036 100644 (file)
@@ -1,4 +1,4 @@
-/* $Id: brkpoint.c,v 1.1 1999/12/29 17:12:28 ekohl Exp $
+/* $Id: brkpoint.c,v 1.2 2000/03/03 00:39:38 ekohl Exp $
  *
  * COPYRIGHT:       See COPYING in the top level directory
  * PROJECT:         ReactOS kernel
 
 /* FUNCTIONS *****************************************************************/
 
-VOID DbgBreakPoint(VOID)
+VOID STDCALL DbgBreakPoint(VOID)
 {
    __asm__("int $3\n\t");
 }
 
-VOID DbgUserBreakPoint(VOID)
+VOID STDCALL DbgUserBreakPoint(VOID)
 {
    __asm__("int $3\n\t");
 }
index 4501385..c35c84f 100644 (file)
@@ -1,4 +1,4 @@
-; $Id: ntdll.def,v 1.42 2000/02/27 02:05:40 ekohl Exp $
+; $Id: ntdll.def,v 1.43 2000/03/03 00:40:29 ekohl Exp $
 ;
 ; ReactOS Operating System
 ;
@@ -7,12 +7,12 @@ LIBRARY ntdll.dll
 EXPORTS
 CsrClientCallServer@16
 CsrClientConnectToServer@24
-DbgBreakPoint
+DbgBreakPoint@0
 DbgPrint
-DbgUserBreakPoint
-NlsAnsiCodePage
-NlsMbCodePageTag
-NlsMbOemCodePageTag
+DbgUserBreakPoint@0
+NlsAnsiCodePage DATA
+NlsMbCodePageTag DATA
+NlsMbOemCodePageTag DATA
 NtAcceptConnectPort@24
 NtAccessCheck@32
 NtAccessCheckAndAuditAlarm@44
index 46ecf01..90172c3 100644 (file)
@@ -1,4 +1,4 @@
-; $Id: ntdll.edf,v 1.31 2000/02/27 02:05:40 ekohl Exp $
+; $Id: ntdll.edf,v 1.32 2000/03/03 00:40:29 ekohl Exp $
 ;
 ; ReactOS Operating System
 ;
@@ -7,12 +7,12 @@ LIBRARY ntdll.dll
 EXPORTS
 CsrClientCallServer=CsrClientCallServer@16
 CsrClientConnectToServer=CsrClientConnectToServer@24
-DbgBreakPoint
+DbgBreakPoint=DbgBreakPoint@0
 DbgPrint
-DbgUserBreakPoint
-NlsAnsiCodePage
-NlsMbCodePageTag
-NlsMbOemCodePageTag
+DbgUserBreakPoint=DbgUserBreakPoint@0
+NlsAnsiCodePage DATA
+NlsMbCodePageTag DATA
+NlsMbOemCodePageTag DATA
 NtAcceptConnectPort=NtAcceptConnectPort@24
 NtAccessCheck=NtAccessCheck@32
 NtAccessCheckAndAuditAlarm=NtAccessCheckAndAuditAlarm@44
index 0c577b1..17e5cc4 100644 (file)
@@ -21,8 +21,14 @@ NTSTATUS STDCALL NtSystemDebugControl(VOID)
    UNIMPLEMENTED;
 }
 
-VOID DbgBreakPoint(VOID)
+VOID STDCALL DbgBreakPoint(VOID)
 {
    __asm__("int $3\n\t");
 }
 
+VOID STDCALL DbgBreakPointWithStatus(ULONG Status)
+{
+   __asm__("mov %0, %%eax\n\t"
+           "int $3\n\t"
+           ::"m"(Status));
+}
diff --git a/reactos/ntoskrnl/hal/x86/misc.c b/reactos/ntoskrnl/hal/x86/misc.c
new file mode 100644 (file)
index 0000000..7cdf717
--- /dev/null
@@ -0,0 +1,46 @@
+/* $Id: misc.c,v 1.1 2000/03/03 00:45:53 ekohl Exp $
+ *
+ * COPYRIGHT:             See COPYING in the top level directory
+ * PROJECT:               ReactOS kernel
+ * FILE:                  ntoskrnl/hal/x86/misc.c
+ * PURPOSE:               Miscellaneous hardware functions
+ * PROGRAMMER:            Eric Kohl (ekohl@rz-online.de)
+ */
+
+/* INCLUDES *****************************************************************/
+
+#include <ddk/ntddk.h>
+
+
+/* FUNCTIONS ****************************************************************/
+
+VOID
+STDCALL
+HalHandleNMI (ULONG Unused)
+{
+       UCHAR ucStatus;
+       
+       ucStatus = READ_PORT_UCHAR((PUCHAR) 0x61);
+       
+       HalDisplayString ("\n*** Hardware Malfunction\n\n");
+       HalDisplayString ("Call your hardware vendor for support\n\n");
+       
+       if (ucStatus & 0x80)
+               HalDisplayString ("NMI: Parity Check / Memory Parity Error\n");
+               
+       if (ucStatus & 0x40)
+               HalDisplayString ("NMI: Channel Check / IOCHK\n");
+
+       HalDisplayString ("\n*** The system has halted ***\n");
+       KeEnterKernelDebugger ();
+}
+
+VOID
+STDCALL
+HalProcessorIdle (VOID)
+{
+       __asm__("sti\n\t" \
+               "hlt\n\t");
+}
+
+/* EOF */
\ No newline at end of file
index 035c976..6d43da7 100644 (file)
@@ -1,7 +1,7 @@
 HAL_OBJECTS = hal/x86/head.o hal/x86/irq.o hal/x86/isa.o \
   hal/x86/pci.o hal/x86/irqhand.o hal/x86/halinit.o \
-  hal/x86/irql.o hal/x86/bios32.o hal/x86/spinlock.o \
+  hal/x86/irql.o hal/x86/bios32.o \
   hal/x86/mp.o hal/x86/dma.o hal/x86/bus.o hal/x86/mbr.o \
   hal/x86/sysinfo.o hal/x86/time.o hal/x86/beep.o \
-  hal/x86/display.o hal/x86/reboot.o hal/x86/kdbg.o hal/x86/portio.o
-
+  hal/x86/display.o hal/x86/reboot.o hal/x86/kdbg.o \
+  hal/x86/portio.o hal/x86/misc.o
index d50cd1c..97878dd 100644 (file)
@@ -1,4 +1,4 @@
-/* $Id: kdebug.c,v 1.6 2000/02/27 02:09:40 ekohl Exp $
+/* $Id: kdebug.c,v 1.7 2000/03/03 00:46:37 ekohl Exp $
  *
  * COPYRIGHT:       See COPYING in the top level directory
  * PROJECT:         ReactOS kernel
@@ -129,5 +129,16 @@ KdPollBreakIn (
        return KdPortPollByte();
 }
 
+VOID
+STDCALL
+KeEnterKernelDebugger (
+       VOID
+       )
+{
+       HalDisplayString ("\n\n *** Entered kernel debugger ***\n");
+
+       for (;;)
+               __asm__("hlt\n\t");
+}
 
 /* EOF */
index 77d2729..9b79cb4 100644 (file)
@@ -1,4 +1,5 @@
-/*
+/* $Id: catch.c,v 1.7 2000/03/03 00:47:06 ekohl Exp $
+ *
  * COPYRIGHT:            See COPYING in the top level directory
  * PROJECT:              ReactOS kernel
  * FILE:                 ntoskrnl/ke/catch.c
 
 /* FUNCTIONS ****************************************************************/
 
-VOID ExRaiseStatus(NTSTATUS Status)
+VOID
+STDCALL
+ExRaiseAccessViolation (
+       VOID
+       )
 {
-   DbgPrint("ExRaiseStatus(%x)\n",Status);
-   for(;;);
+       ExRaiseStatus (STATUS_ACCESS_VIOLATION);
 }
 
+VOID
+STDCALL
+ExRaiseDatatypeMisalignment (
+       VOID
+       )
+{
+       ExRaiseStatus (STATUS_DATATYPE_MISALIGNMENT);
+}
 
-NTSTATUS STDCALL NtRaiseException(IN PEXCEPTION_RECORD ExceptionRecord,
-                                 IN PCONTEXT Context,
-                                 IN BOOL       IsDebugger OPTIONAL)
+VOID
+STDCALL
+ExRaiseStatus (
+       IN      NTSTATUS        Status
+       )
 {
-   UNIMPLEMENTED;
+       DbgPrint("ExRaiseStatus(%x)\n",Status);
+       for(;;);
 }
+
+
+NTSTATUS
+STDCALL
+NtRaiseException (
+       IN      PEXCEPTION_RECORD       ExceptionRecord,
+       IN      PCONTEXT                Context,
+       IN      BOOL                    IsDebugger      OPTIONAL
+       )
+{
+       UNIMPLEMENTED;
+}
+
+/* EOF */
diff --git a/reactos/ntoskrnl/ke/spinlock.c b/reactos/ntoskrnl/ke/spinlock.c
new file mode 100644 (file)
index 0000000..05d1c09
--- /dev/null
@@ -0,0 +1,118 @@
+/*
+ * COPYRIGHT:       See COPYING in the top level directory
+ * PROJECT:         ReactOS kernel
+ * FILE:            ntoskrnl/hal/x86/spinlock.c
+ * PURPOSE:         Implements spinlocks
+ * PROGRAMMER:      David Welch (welch@cwcom.net)
+ * UPDATE HISTORY:
+ *                  3/6/98: Created
+ */
+
+/*
+ * NOTE: On a uniprocessor machine spinlocks are implemented by raising
+ * the irq level
+ */
+
+/* INCLUDES ****************************************************************/
+
+#include <ddk/ntddk.h>
+
+#include <internal/debug.h>
+
+/* FUNCTIONS ***************************************************************/
+
+BOOLEAN KeSynchronizeExecution(PKINTERRUPT Interrupt,
+                              PKSYNCHRONIZE_ROUTINE SynchronizeRoutine,
+                              PVOID SynchronizeContext)
+/*
+ * FUNCTION: Synchronizes the execution of a given routine with the ISR
+ * of a given interrupt object
+ * ARGUMENTS:
+ *       Interrupt = Interrupt object to synchronize with
+ *       SynchronizeRoutine = Routine to call whose execution is 
+ *                            synchronized with the ISR
+ *       SynchronizeContext = Parameter to pass to the synchronized routine
+ * RETURNS: TRUE if the operation succeeded
+ */
+{
+   KIRQL oldlvl;
+   BOOLEAN ret;
+   
+   KeRaiseIrql(Interrupt->SynchLevel,&oldlvl);
+   KeAcquireSpinLockAtDpcLevel(Interrupt->IrqLock);
+   
+   ret = SynchronizeRoutine(SynchronizeContext);
+   
+   KeReleaseSpinLockFromDpcLevel(Interrupt->IrqLock);
+   KeLowerIrql(oldlvl);
+   
+   return(ret);
+}
+
+VOID KeInitializeSpinLock(PKSPIN_LOCK SpinLock)
+/*
+ * FUNCTION: Initalizes a spinlock
+ * ARGUMENTS:
+ *           SpinLock = Caller supplied storage for the spinlock
+ */
+{
+   SpinLock->Lock = 0;
+}
+
+VOID KeAcquireSpinLockAtDpcLevel(PKSPIN_LOCK SpinLock)
+/*
+ * FUNCTION: Acquires a spinlock when the caller is already running at 
+ * dispatch level
+ * ARGUMENTS:
+ *        SpinLock = Spinlock to acquire
+ */
+{
+   ULONG i;
+   
+   while ((i = InterlockedExchange(&SpinLock->Lock, 1)) == 1)
+     {
+       DbgPrint("Spinning on spinlock %x current value %x\n", SpinLock, i);
+       KeBugCheck(0);
+     }
+}
+
+VOID KeReleaseSpinLockFromDpcLevel(PKSPIN_LOCK SpinLock)
+/*
+ * FUNCTION: Releases a spinlock when the caller was running at dispatch
+ * level before acquiring it
+ * ARGUMENTS: 
+ *         SpinLock = Spinlock to release
+ */
+{
+   if (SpinLock->Lock != 1)
+     {
+       DbgPrint("Releasing unacquired spinlock %x\n", SpinLock);
+       KeBugCheck(0);
+     }
+   (void)InterlockedExchange(&SpinLock->Lock, 0);
+}
+
+VOID KeAcquireSpinLock(PKSPIN_LOCK SpinLock, PKIRQL OldIrql)
+/*
+ * FUNCTION: Acquires a spinlock
+ * ARGUMENTS:
+ *         SpinLock = Spinlock to acquire
+ *         OldIrql (OUT) = Caller supplied storage for the previous irql
+ */
+{
+   KeRaiseIrql(DISPATCH_LEVEL,OldIrql);
+   KeAcquireSpinLockAtDpcLevel(SpinLock);
+}
+
+VOID KeReleaseSpinLock(PKSPIN_LOCK SpinLock, KIRQL NewIrql)
+/*
+ * FUNCTION: Releases a spinlock
+ * ARGUMENTS:
+ *        SpinLock = Spinlock to release
+ *        NewIrql = Irql level before acquiring the spinlock
+ */
+{
+   KeReleaseSpinLockFromDpcLevel(SpinLock);
+   KeLowerIrql(NewIrql);
+}
+
index 9882838..6e36a83 100644 (file)
@@ -1,4 +1,4 @@
-# $Id: makefile_rex,v 1.55 2000/03/01 22:52:27 ea Exp $
+# $Id: makefile_rex,v 1.56 2000/03/03 00:43:28 ekohl Exp $
 #
 # ReactOS Operating System
 #
@@ -6,6 +6,7 @@ TARGET=ntoskrnl
 
 BASE_CFLAGS = -I../include -D__NTOSKRNL__
 
+
 all: objects $(TARGET).exe
 
 #
@@ -22,12 +23,12 @@ RTL_OBJECTS = rtl/ctype.o rtl/interlck.o rtl/largeint.o  rtl/list.o \
               rtl/memmove.o rtl/memset.o  rtl/nls.o rtl/regio.o \
               rtl/return.o rtl/slist.o rtl/sprintf.o rtl/swprintf.o \
               rtl/stdlib.o rtl/string.o rtl/time.o rtl/unalign.o \
-              rtl/unicode.o rtl/wstring.o
+              rtl/unicode.o rtl/wstring.o rtl/bitmap.o
 
 KE_OBJECTS = ke/main.o ke/timer.o ke/error.o ke/catch.o \
              ke/dpc.o ke/wait.o ke/kqueue.o ke/dispatch.o \
             ke/sem.o ke/critical.o ke/event.o ke/apc.o ke/bug.o \
-            ke/mutex.o ke/kernel.o ke/ldt.o \
+            ke/mutex.o ke/kernel.o ke/ldt.o ke/spinlock.o\
             ke/process.o ke/gdt.o ke/idt.o ke/udelay.o
 
 KE_I386_OBJECTS = ke/i386/thread.o ke/i386/usercall.o ke/i386/exp.o
@@ -143,23 +144,24 @@ OBJECTS = objects/hal.o objects/ke.o objects/rtl.o objects/mm.o \
           objects/io.o objects/ob.o objects/ps.o objects/ex.o \
           objects/se.o objects/cm.o objects/dbg.o objects/nt.o \
           objects/cc.o objects/kd.o objects/ldr.o objects/fs.o \
-         objects/po.o objects/nls.o \
+          objects/po.o objects/nls.o \
           $(TARGET).coff
 
 ifeq ($(DOSCLI),yes)
 CLEAN_FILES = objects\*.o cc\*.o cm\*.o dbg\*.o ex\*.o hal\x86\*.o io\*.o \
               ke\*.o ldr\*.o mm\*.o nt\*.o ob\*.o ps\*.o rtl\*.o se\*.o \
-             ke\i386\*.o mm\i386\*.o fs\*.o po\*.o nls\*.o \
+              ke\i386\*.o mm\i386\*.o fs\*.o po\*.o nls\*.o \
               kd\*.o utils\export\export.exe $(TARGET).o $(TARGET).a junk.tmp \
               base.tmp temp.exp $(TARGET).exe $(TARGET).sym $(TARGET).coff
 else
 CLEAN_FILES = objects/*.o cc/*.o cm/*.o dbg/*.o ex/*.o hal/x86/*.o io/*.o \
               ke/*.o ldr/*.o mm/*.o nt/*.o ob/*.o ps/*.o rtl/*.o se/*.o \
-             ke/i386/*.o mm/i386/*.o fs/*.o po/*.o nls/*.o \
+              ke/i386/*.o mm/i386/*.o fs/*.o po/*.o nls/*.o \
               kd/*.o utils/export/export $(TARGET).o $(TARGET).a junk.tmp \
               base.tmp temp.exp $(TARGET).exe $(TARGET).sym $(TARGET).coff
 endif
 
+
 $(TARGET).exe: $(OBJECTS) $(TARGET).def
        $(LD) \
                -r $(OBJECTS) \
index c6ec1bd..4d94312 100644 (file)
@@ -1,4 +1,4 @@
-; $Id: ntoskrnl.def,v 1.48 2000/03/01 22:52:27 ea Exp $
+; $Id: ntoskrnl.def,v 1.49 2000/03/03 00:43:28 ekohl Exp $
 ;
 ; reactos/ntoskrnl/ntoskrnl.def
 ;
@@ -10,6 +10,8 @@ CcInitializeFileCache@8
 CcRequestCachePage@20
 CcReleaseCachePage@12
 CcReleaseFileCache@8
+DbgBreakPoint@0
+DbgBreakPointWithStatus@4
 DbgPrint
 ExAcquireResourceExclusive
 ExAcquireResourceExclusiveLite
@@ -66,7 +68,9 @@ ExIsResourceAcquiredSharedLite
 ExLocalTimeToSystemTime
 ExQueryDepthSListHead
 ExQueueWorkItem
-ExRaiseStatus
+ExRaiseAccessViolation@0
+ExRaiseDatatypeMisalignment@0
+ExRaiseStatus@4
 ExReinitializeResourceLite
 ExReleaseFastMutexUnsafe
 ExReleaseResource
@@ -167,6 +171,7 @@ KeBugCheck
 KeBugCheckEx
 KeClearEvent
 KeDelayExecutionThread@12
+KeEnterKernelDebugger@0
 KeFlushIoBuffers
 KeGetPreviousMode
 KeInitializeDpc
@@ -183,8 +188,11 @@ KeSynchronizeExecution
 KeWaitForSingleObject
 MmGetSystemAddressForMdl
 MmMapIoSpace
-NlsMbCodePageTag
-NlsMbOemCodePageTag
+NlsAnsiCodePage DATA
+NlsLeadByteInfo DATA
+NlsMbCodePageTag DATA
+NlsMbOemCodePageTag DATA
+NlsOemLeadByteInfo DATA
 NtAddAtom@8
 NtAdjustPrivilegesToken@24
 NtAllocateLocallyUniqueId@4
@@ -243,7 +251,7 @@ READ_REGISTER_USHORT
 READ_REGISTER_BUFFER_UCHAR
 READ_REGISTER_BUFFER_ULONG
 READ_REGISTER_BUFFER_USHORT
-;RtlAbsoluteToSelfRelativeSD
+RtlAbsoluteToSelfRelativeSD@12
 ;RtlAddAccessAllowedAce
 ;RtlAddAce
 ;RtlAddAtomToAtomTable
@@ -264,8 +272,8 @@ RtlAppendUnicodeToString@8
 ;RtlCaptureStackBackTrace
 RtlCharToInteger@12
 ;RtlCheckRegistryKey
-;RtlClearAllBits
-;RtlClearBits
+RtlClearAllBits@4
+RtlClearBits@12
 RtlCompareMemory@12
 RtlCompareMemoryUlong@12
 RtlCompareString@12
@@ -283,7 +291,7 @@ RtlCopyUnicodeString@8
 ;RtlCreateAtomTable
 ;RtlCreateHeap
 ;RtlCreateRegistryKey
-;RtlCreateSecurityDescriptor
+RtlCreateSecurityDescriptor@8
 RtlCreateUnicodeString@8
 ;RtlCustomCPToUnicodeN
 ;RtlDecompressBuffer
@@ -331,17 +339,17 @@ RtlFreeUnicodeString@4
 ;RtlGenerate8dot3Name
 ;RtlGetCallersAddress
 ;RtlGetCompressionWorkSpaceSize
-;RtlGetDaclSecurityDescriptor
+RtlGetDaclSecurityDescriptor@16
 RtlGetDefaultCodePage@8
 ;RtlGetElementGenericTable
-;RtlGetGroupSecurityDescriptor
-;RtlGetOwnerSecurityDescriptor
-;RtlImageNtHeader@4
+RtlGetGroupSecurityDescriptor@12
+RtlGetOwnerSecurityDescriptor@12
+;RtlImageNtHeader
 RtlInitAnsiString@8
 ;RtlInitCodePageTable
 RtlInitString@8
 RtlInitUnicodeString@8
-;RtlInitializeBitmap
+RtlInitializeBitMap@12
 ;RtlInitializeGenericTable
 RtlInitializeSid@12
 ;RtlInitializeUnicodePrefix
@@ -358,7 +366,7 @@ RtlLargeIntegerShiftLeft@12
 RtlLargeIntegerShiftRight@12
 RtlLargeIntegerSubtract@16
 RtlLengthRequiredSid@4
-;RtlLengthRequiredSecurityDescriptor
+RtlLengthSecurityDescriptor@4
 RtlLengthSid@4
 ;RtlLookupAtomInAtomTable
 ;RtlLookupElementGenericTable
@@ -372,14 +380,14 @@ RtlMultiByteToUnicodeSize@12
 ;RtlNumberGenericTableElements
 ;RtlNumberOfClearBits
 ;RtlNumberOfSetBits
-;RtlOemStringToCountedUnicodeString
+RtlOemStringToCountedUnicodeString@12
 RtlOemStringToUnicodeSize@4
 RtlOemStringToUnicodeString@12
 RtlOemToUnicodeN@20
 ;RtlPinAtomInAtomTable
 ;RtlPrefixString
 ;RtlPrefixUnicodeString
-;RtlQueryAtominAtomTable
+;RtlQueryAtomInAtomTable
 ;RtlQueryRegistryValues
 ;RtlQueryTimeZoneInformation
 ;RtlRaiseException
@@ -388,11 +396,11 @@ RtlOemToUnicodeN@20
 ;RtlReserveChunk
 RtlSecondsSince1970ToTime@8
 RtlSecondsSince1980ToTime@8
-;RtlSetAllBits
-;RtlSetBits
-;RtlSetDaclSecurityDescriptor
-;RtlSetGroupSecurityDescriptor
-;RtlSetOwnerSecurityDescriptor
+RtlSetAllBits@4
+RtlSetBits@12
+RtlSetDaclSecurityDescriptor@16
+RtlSetGroupSecurityDescriptor@12
+RtlSetOwnerSecurityDescriptor@12
 ;RtlSetSaclSecurityDescriptor
 ;RtlSetTimeZoneInformation
 ;RtlSplay
@@ -404,7 +412,7 @@ RtlTimeToSecondsSince1980@8
 RtlTimeToTimeFields@8
 RtlUnicodeStringToAnsiSize@4
 RtlUnicodeStringToAnsiString@12
-;RtlUnicodeStringToCountedOemString
+RtlUnicodeStringToCountedOemString@12
 RtlUnicodeStringToInteger@12
 RtlUnicodeStringToOemSize@4
 RtlUnicodeStringToOemString@12
@@ -416,14 +424,14 @@ RtlUnicodeToOemN@20
 RtlUpcaseUnicodeChar@4
 RtlUpcaseUnicodeString@12
 RtlUpcaseUnicodeStringToAnsiString@12
-;RtlUpcaseUnicodeStringToCountedOemString
+RtlUpcaseUnicodeStringToCountedOemString@12
 RtlUpcaseUnicodeStringToOemString@12
 ;RtlUpcaseUnicodeToCustomCPN
 RtlUpcaseUnicodeToMultiByteN@20
 RtlUpcaseUnicodeToOemN@20
 RtlUpperChar@4
 RtlUpperString@8
-;RtlValidSecurityDescriptor
+RtlValidSecurityDescriptor@4
 RtlValidSid@4
 ;RtlWriteRegistryValue
 ;RtlZeroHeap
@@ -600,7 +608,7 @@ wctomb
 ; exports from hal.dll
 ;
 ;
-;ExAcquireFastMutex
+ExAcquireFastMutex
 ExReleaseFastMutex
 ExTryToAcquireFastMutex
 HalAcquireDisplayOwnership
@@ -624,11 +632,11 @@ HalDisplayString
 HalGetBusDataByOffset
 ;HalGetEnvironmentVariable
 HalGetInterruptVector
-;HalHandleNMI
+HalHandleNMI@4
 HalInitSystem
 ;HalInitializeProcessor
 HalMakeBeep
-;HalProcessorIdle
+HalProcessorIdle@0
 HalQueryDisplayParameters
 HalQueryRealTimeClock
 ;HalReadDmaCounter
index f1764b4..6b9cc3b 100644 (file)
@@ -1,4 +1,4 @@
-; $Id: ntoskrnl.edf,v 1.35 2000/03/01 22:52:27 ea Exp $
+; $Id: ntoskrnl.edf,v 1.36 2000/03/03 00:43:29 ekohl Exp $
 ;
 ; reactos/ntoskrnl/ntoskrnl.def
 ;
@@ -10,6 +10,8 @@ CcInitializeFileCache=CcInitializeFileCache@8
 CcRequestCachePage=CcRequestCachePage@20
 CcReleaseCachePage=CcReleaseCachePage@12
 CcReleaseFileCache=CcReleaseFileCache@8
+DbgBreakPoint=DbgBreakPoint@0
+DbgBreakPointWithStatus=DbgBreakPointWithStatus@4
 DbgPrint
 ExAcquireResourceExclusive
 ExAcquireResourceExclusiveLite
@@ -66,7 +68,9 @@ ExIsResourceAcquiredSharedLite
 ExLocalTimeToSystemTime
 ExQueryDepthSListHead
 ExQueueWorkItem
-ExRaiseStatus
+ExRaiseAccessViolation=ExRaiseAccessViolation@0
+ExRaiseDatatypeMisalignment=ExRaiseDatatypeMisalignment@0
+ExRaiseStatus=ExRaiseStatus@4
 ExReinitializeResourceLite
 ExReleaseFastMutexUnsafe
 ExReleaseResource
@@ -167,6 +171,7 @@ KeBugCheck
 KeBugCheckEx
 KeClearEvent
 KeDelayExecutionThread=KeDelayExecutionThread@12
+KeEnterKernelDebugger=KeEnterKernelDebugger@0
 KeFlushIoBuffers
 KeGetPreviousMode
 KeInitializeDpc
@@ -183,8 +188,11 @@ KeSynchronizeExecution
 KeWaitForSingleObject
 MmGetSystemAddressForMdl
 MmMapIoSpace
-NlsMbCodePageTag
-NlsMbOemCodePageTag
+NlsAnsiCodePage DATA
+NlsLeadByteInfo DATA
+NlsMbCodePageTag DATA
+NlsMbOemCodePageTag DATA
+NlsOemLeadByteInfo DATA
 NtAddAtom=NtAddAtom@8
 NtAdjustPrivilegesToken=NtAdjustPrivilegesToken@24
 NtAllocateLocallyUniqueId=NtAllocateLocallyUniqueId@4
@@ -243,6 +251,7 @@ READ_REGISTER_USHORT
 READ_REGISTER_BUFFER_UCHAR
 READ_REGISTER_BUFFER_ULONG
 READ_REGISTER_BUFFER_USHORT
+RtlAbsoluteToSelfRelativeSD=RtlAbsoluteToSelfRelativeSD@12
 RtlAnsiCharToUnicodeChar=RtlAnsiCharToUnicodeChar@4
 RtlAnsiStringToUnicodeSize=RtlAnsiStringToUnicodeSize@4
 RtlAnsiStringToUnicodeString=RtlAnsiStringToUnicodeString@12
@@ -251,6 +260,8 @@ RtlAppendStringToString=RtlAppendStringToString@8
 RtlAppendUnicodeStringToString=RtlAppendUnicodeStringToString@8
 RtlAppendUnicodeToString=RtlAppendUnicodeToString@8
 RtlCharToInteger=RtlCharToInteger@12
+RtlClearAllBits=RtlClearAllBits@4
+RtlClearBits=RtlClearBits@12
 RtlCompareMemory=RtlCompareMemory@12
 RtlCompareMemoryUlong=RtlCompareMemoryUlong@12
 RtlCompareString=RtlCompareString@12
@@ -261,6 +272,7 @@ RtlCopyLuid=RtlCopyLuid@8
 RtlCopySid=RtlCopySid@12
 RtlCopyString=RtlCopyString@8
 RtlCopyUnicodeString=RtlCopyUnicodeString@8
+RtlCreateSecurityDescriptor=RtlCreateSecurityDescriptor@8
 RtlCreateUnicodeString=RtlCreateUnicodeString@8
 RtlDowncaseUnicodeString=RtlDowncaseUnicodeString@12
 RtlEnlargedIntegerMultiply=RtlEnlargedIntegerMultiply@8
@@ -278,11 +290,14 @@ RtlFillMemoryUlong=RtlFillMemoryUlong@12
 RtlFreeAnsiString=RtlFreeAnsiString@4
 RtlFreeOemString=RtlFreeOemString@4
 RtlFreeUnicodeString=RtlFreeUnicodeString@4
+RtlGetDaclSecurityDescriptor=RtlGetDaclSecurityDescriptor@16
 RtlGetDefaultCodePage=RtlGetDefaultCodePage@8
-;RtlImageNtHeader=RtlImageNtHeader@4
+RtlGetGroupSecurityDescriptor=RtlGetGroupSecurityDescriptor@12
+RtlGetOwnerSecurityDescriptor=RtlGetOwnerSecurityDescriptor@12
 RtlInitAnsiString=RtlInitAnsiString@8
 RtlInitString=RtlInitString@8
 RtlInitUnicodeString=RtlInitUnicodeString@8
+RtlInitializeBitMap=RtlInitializeBitMap@12
 RtlInitializeSid=RtlInitializeSid@12
 RtlIntegerToChar=RtlIntegerToChar@16
 RtlIntegerToUnicodeString=RtlIntegerToUnicodeString@12
@@ -294,14 +309,21 @@ RtlLargeIntegerShiftLeft=RtlLargeIntegerShiftLeft@12
 RtlLargeIntegerShiftRight=RtlLargeIntegerShiftRight@12
 RtlLargeIntegerSubtract=RtlLargeIntegerSubtract@16
 RtlLengthRequiredSid=RtlLengthRequiredSid@4
+RtlLengthSecurityDescriptor=RtlLengthSecurityDescriptor@4
 RtlLengthSid=RtlLengthSid@4
 RtlMoveMemory=RtlMoveMemory@12
 RtlMultiByteToUnicodeN=RtlMultiByteToUnicodeN@20
 RtlMultiByteToUnicodeSize=RtlMultiByteToUnicodeSize@12
+RtlOemStringToCountedUnicodeString=RtlOemStringToCountedUnicodeString@12
 RtlOemStringToUnicodeSize=RtlOemStringToUnicodeSize@4
 RtlOemStringToUnicodeString=RtlOemStringToUnicodeString@12
 RtlSecondsSince1970ToTime=RtlSecondsSince1970ToTime@8
 RtlSecondsSince1980ToTime=RtlSecondsSince1980ToTime@8
+RtlSetAllBits=RtlSetAllBits@4
+RtlSetBits=RtlSetBits@12
+RtlSetDaclSecurityDescriptor=RtlSetDaclSecurityDescriptor@16
+RtlSetGroupSecurityDescriptor=RtlSetGroupSecurityDescriptor@12
+RtlSetOwnerSecurityDescriptor=RtlSetOwnerSecurityDescriptor@12
 RtlSubAuthorityCountSid=RtlSubAuthorityCountSid@4
 RtlSubAuthoritySid=RtlSubAuthoritySid@8
 RtlTimeFieldsToTime=RtlTimeFieldsToTime@8
@@ -310,6 +332,7 @@ RtlTimeToSecondsSince1980=RtlTimeToSecondsSince1980@8
 RtlTimeToTimeFields=RtlTimeToTimeFields@8
 RtlUnicodeStringToAnsiSize=RtlUnicodeStringToAnsiSize@4
 RtlUnicodeStringToAnsiString=RtlUnicodeStringToAnsiString@12
+RtlUnicodeStringToCountedOemString=RtlUnicodeStringToCountedOemString@12
 RtlUnicodeStringToInteger=RtlUnicodeStringToInteger@12
 RtlUnicodeStringToOemSize=RtlUnicodeStringToOemSize@4
 RtlUnicodeStringToOemString=RtlUnicodeStringToOemString@12
@@ -318,11 +341,13 @@ RtlUnicodeToMultiByteSize=RtlUnicodeToMultiByteSize@12
 RtlUpcaseUnicodeChar=RtlUpcaseUnicodeChar@4
 RtlUpcaseUnicodeString=RtlUpcaseUnicodeString@12
 RtlUpcaseUnicodeStringToAnsiString=RtlUpcaseUnicodeStringToAnsiString@12
+RtlUpcaseUnicodeStringToCountedOemString=RtlUpcaseUnicodeStringToCountedOemString@12
 RtlUpcaseUnicodeStringToOemString=RtlUpcaseUnicodeStringToOemString@12
 RtlUpcaseUnicodeToMultiByteN=RtlUpcaseUnicodeToMultiByteN@20
 RtlUpcaseUnicodeToOemN=RtlUpcaseUnicodeToOemN@20
 RtlUpperChar=RtlUpperChar@4
 RtlUpperString=RtlUpperString@8
+RtlValidSecurityDescriptor=RtlValidSecurityDescriptor@4
 RtlValidSid=RtlValidSid@4
 RtlZeroMemory=RtlZeroMemory@8
 RtlxAnsiStringToUnicodeSize=RtlxAnsiStringToUnicodeSize@4
@@ -497,7 +522,7 @@ wctomb
 ; exports from hal.dll
 ;
 ;
-;ExAcquireFastMutex
+ExAcquireFastMutex
 ExReleaseFastMutex
 ExTryToAcquireFastMutex
 HalAcquireDisplayOwnership
@@ -521,11 +546,11 @@ HalDisplayString
 HalGetBusDataByOffset
 ;HalGetEnvironmentVariable
 HalGetInterruptVector
-;HalHandleNMI
+HalHandleNMI=HalHandleNMI@4
 HalInitSystem
 ;HalInitializeProcessor
 HalMakeBeep
-;HalProcessorIdle
+HalProcessorIdle=HalProcessorIdle@0
 HalQueryDisplayParameters
 HalQueryRealTimeClock
 ;HalReadDmaCounter
diff --git a/reactos/ntoskrnl/rtl/bitmap.c b/reactos/ntoskrnl/rtl/bitmap.c
new file mode 100644 (file)
index 0000000..f832aa4
--- /dev/null
@@ -0,0 +1,125 @@
+/* $Id: bitmap.c,v 1.1 2000/03/03 00:48:50 ekohl Exp $
+ *
+ * COPYRIGHT:       See COPYING in the top level directory
+ * PROJECT:         ReactOS kernel
+ * FILE:            ntoskrnl/rtl/bitmap.c
+ * PURPOSE:         Bitmap functions
+ * UPDATE HISTORY:
+ *                  20/08/99 Created by Eric Kohl
+ */
+
+#include <ddk/ntddk.h>
+
+
+#define ALIGN(x,align) (((x)+(align)-1) / (align))
+
+
+VOID
+STDCALL
+RtlInitializeBitMap (
+       PRTL_BITMAP     BitMapHeader,
+       PULONG          BitMapBuffer,
+       ULONG           SizeOfBitMap
+       )
+{
+       BitMapHeader->SizeOfBitMap = SizeOfBitMap;
+       BitMapHeader->Buffer = BitMapBuffer;
+}
+
+
+VOID
+STDCALL
+RtlClearAllBits (
+       IN OUT  PRTL_BITMAP     BitMapHeader
+       )
+{
+       memset (BitMapHeader->Buffer,
+               0x00,
+               ALIGN(BitMapHeader->SizeOfBitMap, 8));
+}
+
+
+VOID
+STDCALL
+RtlClearBits (
+       PRTL_BITMAP     BitMapHeader,
+       ULONG           StartingIndex,
+       ULONG           NumberToClear
+       )
+{
+       ULONG Size = BitMapHeader->SizeOfBitMap;
+       ULONG n;
+       ULONG shift;
+       PCHAR p;
+
+       if (StartingIndex >= Size || NumberToClear == 0)
+               return;
+
+       if (StartingIndex + NumberToClear > Size)
+               NumberToClear = Size - StartingIndex;
+
+       p = (PCHAR)(BitMapHeader->Buffer + (StartingIndex / 8));
+       while (NumberToClear)
+       {
+               /* bit shift in current byte */
+               shift = StartingIndex & 7;
+
+               /* number of bits to change in current byte */
+               n = (NumberToClear > 8 - shift ) ? 8 - shift : NumberToClear;
+
+               /* adjust byte */
+               *p++ &= ~(~(0xFF << n) << shift);
+               NumberToClear -= n;
+               StartingIndex += n;
+       }
+}
+
+
+VOID
+STDCALL
+RtlSetAllBits (
+       IN OUT  PRTL_BITMAP     BitMapHeader
+       )
+{
+       memset (BitMapHeader->Buffer,
+               0xFF,
+               ALIGN(BitMapHeader->SizeOfBitMap, 8));
+}
+
+VOID
+STDCALL
+RtlSetBits (
+       PRTL_BITMAP     BitMapHeader,
+       ULONG           StartingIndex,
+       ULONG           NumberToSet
+       )
+{
+       ULONG Size = BitMapHeader->SizeOfBitMap;
+       ULONG n;
+       ULONG shift;
+       PCHAR p;
+
+       if (StartingIndex >= Size || NumberToSet == 0)
+               return;
+
+       if (StartingIndex + NumberToSet > Size)
+               NumberToSet = Size - StartingIndex;
+
+       p = (PCHAR)BitMapHeader->Buffer + (StartingIndex / 8);
+       while (NumberToSet)
+       {
+               /* bit shift in current byte */
+               shift = StartingIndex & 7;
+
+               /* number of bits to change in current byte */
+               n = (NumberToSet > 8 - shift) ? 8 - shift : NumberToSet;
+
+               /* adjust byte */
+               *p++ |= ~( 0xFF << n ) << shift;
+               NumberToSet -= n;
+               StartingIndex += n;
+       }
+}
+
+
+/* EOF */
index 64d96b2..778ca26 100644 (file)
@@ -1,4 +1,4 @@
-/* $Id: nls.c,v 1.2 1999/11/20 21:45:20 ekohl Exp $
+/* $Id: nls.c,v 1.3 2000/03/03 00:48:50 ekohl Exp $
  *
  * COPYRIGHT:       See COPYING in the top level directory
  * PROJECT:         ReactOS kernel
@@ -54,6 +54,11 @@ CHAR UnicodeToOemTable [65536];
 
 /* FUNCTIONS *****************************************************************/
 
+/*
+ * RtlCustomCPToUnicodeN
+ */
+
+
 VOID
 STDCALL
 RtlGetDefaultCodePage (
@@ -138,11 +143,12 @@ RtlMultiByteToUnicodeSize (
 
 NTSTATUS
 STDCALL
-RtlOemToUnicodeN(PWCHAR UnicodeString,
-                 ULONG  UnicodeSize,
-                 PULONG ResultSize,
-                 PCHAR  OemString,
-                 ULONG  OemSize)
+RtlOemToUnicodeN (
+       PWCHAR  UnicodeString,
+       ULONG   UnicodeSize,
+       PULONG  ResultSize,
+       PCHAR   OemString,
+       ULONG   OemSize)
 {
        ULONG Size = 0;
        ULONG i;
@@ -180,13 +186,19 @@ RtlOemToUnicodeN(PWCHAR UnicodeString,
 }
 
 
+/*
+ * RtlUnicodeToCustomCPN
+ */
+
+
 NTSTATUS
 STDCALL
-RtlUnicodeToMultiByteN(PCHAR  MbString,
-                       ULONG  MbSize,
-                       PULONG ResultSize,
-                       PWCHAR UnicodeString,
-                       ULONG  UnicodeSize)
+RtlUnicodeToMultiByteN (
+       PCHAR   MbString,
+       ULONG   MbSize,
+       PULONG  ResultSize,
+       PWCHAR  UnicodeString,
+       ULONG   UnicodeSize)
 {
        ULONG Size = 0;
        ULONG i;
@@ -226,9 +238,10 @@ RtlUnicodeToMultiByteN(PCHAR  MbString,
 
 NTSTATUS
 STDCALL
-RtlUnicodeToMultiByteSize(PULONG MbSize,
-                          PWCHAR UnicodeString,
-                          ULONG UnicodeSize)
+RtlUnicodeToMultiByteSize (
+       PULONG  MbSize,
+       PWCHAR  UnicodeString,
+       ULONG   UnicodeSize)
 {
        if (NlsMbCodePageTag == FALSE)
        {
@@ -248,11 +261,12 @@ RtlUnicodeToMultiByteSize(PULONG MbSize,
 
 NTSTATUS
 STDCALL
-RtlUnicodeToOemN(PCHAR  OemString,
-                 ULONG  OemSize,
-                 PULONG ResultSize,
-                 PWCHAR UnicodeString,
-                 ULONG  UnicodeSize)
+RtlUnicodeToOemN (
+       PCHAR   OemString,
+       ULONG   OemSize,
+       PULONG  ResultSize,
+       PWCHAR  UnicodeString,
+       ULONG   UnicodeSize)
 {
        ULONG Size = 0;
        ULONG i;
@@ -290,6 +304,11 @@ RtlUnicodeToOemN(PCHAR  OemString,
 }
 
 
+/*
+ * RtlUpcaseUnicodeToCustomCPN
+ */
+
+
 NTSTATUS
 STDCALL
 RtlUpcaseUnicodeToMultiByteN (
@@ -383,5 +402,4 @@ RtlUpcaseUnicodeToOemN (
        return STATUS_SUCCESS;
 }
 
-
 /* EOF */
index a4d13a9..47d2ab3 100644 (file)
@@ -1,4 +1,4 @@
-/* $Id: unicode.c,v 1.13 2000/02/19 19:31:18 ekohl Exp $
+/* $Id: unicode.c,v 1.14 2000/03/03 00:48:50 ekohl Exp $
  *
  * COPYRIGHT:       See COPYING in the top level directory
  * PROJECT:         ReactOS kernel
@@ -480,11 +480,6 @@ RtlCreateUnicodeStringFromAsciiz (
 }
 
 
-/*
-RtlCustomCPToUnicodeN
-*/
-
-
 NTSTATUS
 STDCALL
 RtlDowncaseUnicodeString (
@@ -627,11 +622,6 @@ RtlEqualUnicodeString (
 }
 
 
-/*
-RtlEraseUnicodeString
-*/
-
-
 VOID
 STDCALL
 RtlFreeAnsiString (
@@ -838,9 +828,61 @@ RtlIntegerToUnicodeString (
 }
 
 
-/*
-RtlOemStringToCountedUnicodeString
-*/
+NTSTATUS
+STDCALL
+RtlOemStringToCountedUnicodeString (
+       IN OUT  PUNICODE_STRING DestinationString,
+       IN      POEM_STRING     SourceString,
+       IN      BOOLEAN         AllocateDestinationString
+       )
+{
+       NTSTATUS Status;
+       ULONG Length;
+
+       if (NlsMbCodePageTag == TRUE)
+               Length = RtlAnsiStringToUnicodeSize (SourceString);
+       else
+               Length = SourceString->Length * sizeof(WCHAR);
+
+       if (Length > 65535)
+               return STATUS_INVALID_PARAMETER_2;
+
+       if (AllocateDestinationString == TRUE)
+       {
+               DestinationString->MaximumLength = Length + sizeof(WCHAR);
+               DestinationString->Buffer =
+                       ExAllocatePool (NonPagedPool,
+                                       DestinationString->MaximumLength);
+               if (DestinationString->Buffer == NULL)
+                       return STATUS_NO_MEMORY;
+       }
+       else
+       {
+               if (Length > DestinationString->MaximumLength)
+                       return STATUS_BUFFER_TOO_SMALL;
+       }
+       DestinationString->Length = Length;
+
+       RtlZeroMemory (DestinationString->Buffer,
+                      DestinationString->Length);
+
+       Status = RtlOemToUnicodeN (DestinationString->Buffer,
+                                  DestinationString->Length,
+                                  NULL,
+                                  SourceString->Buffer,
+                                  SourceString->Length);
+       if (!NT_SUCCESS(Status))
+       {
+               if (AllocateDestinationString)
+                       ExFreePool (DestinationString->Buffer);
+
+               return Status;
+       }
+
+       DestinationString->Buffer[Length / sizeof(WCHAR)] = 0;
+
+       return STATUS_SUCCESS;
+}
 
 
 ULONG
@@ -982,9 +1024,68 @@ RtlUnicodeStringToAnsiString (
 }
 
 
-/*
-RtlUnicodeStringToCountedOemString
-*/
+NTSTATUS
+STDCALL
+RtlUnicodeStringToCountedOemString (
+       IN OUT  POEM_STRING     DestinationString,
+       IN      PUNICODE_STRING SourceString,
+       IN      BOOLEAN         AllocateDestinationString
+       )
+{
+       NTSTATUS Status;
+       ULONG Length;
+       ULONG Size;
+
+       if (NlsMbOemCodePageTag == TRUE)
+               Length = RtlUnicodeStringToAnsiSize (SourceString) + 1;
+       else
+               Length = SourceString->Length / sizeof(WCHAR) + 1;
+
+       if (Length > 0x0000FFFF)
+               return STATUS_INVALID_PARAMETER_2;
+
+       DestinationString->Length = (WORD)(Length - 1);
+
+       if (AllocateDestinationString)
+       {
+               DestinationString->Buffer = ExAllocatePool (NonPagedPool,
+                                                           Length);
+
+               if (DestinationString->Buffer == NULL)
+                       return STATUS_NO_MEMORY;
+
+               RtlZeroMemory (DestinationString->Buffer,
+                              Length);
+               DestinationString->MaximumLength = (WORD)Length;
+       }
+       else
+       {
+               if (Length > DestinationString->MaximumLength)
+               {
+                       if (DestinationString->MaximumLength == 0)
+                               return STATUS_BUFFER_OVERFLOW;
+                       DestinationString->Length =
+                               DestinationString->MaximumLength - 1;
+               }
+       }
+
+       Status = RtlUnicodeToOemN (DestinationString->Buffer,
+                                  DestinationString->Length,
+                                  &Size,
+                                  SourceString->Buffer,
+                                  SourceString->Length);
+       if (!NT_SUCCESS(Status))
+       {
+               if (AllocateDestinationString)
+                       ExFreePool (DestinationString->Buffer);
+
+               return Status;
+       }
+
+       DestinationString->Buffer[Size] = 0;
+
+       return STATUS_SUCCESS;
+}
 
 
 NTSTATUS
@@ -1258,9 +1359,68 @@ RtlUpcaseUnicodeStringToAnsiString (
 }
 
 
-/*
-RtlUpcaseUnicodeStringToCountedOemString
-*/
+NTSTATUS
+STDCALL
+RtlUpcaseUnicodeStringToCountedOemString (
+       IN OUT  POEM_STRING     DestinationString,
+       IN      PUNICODE_STRING SourceString,
+       IN      BOOLEAN         AllocateDestinationString
+       )
+{
+       NTSTATUS Status;
+       ULONG Length;
+       ULONG Size;
+
+       if (NlsMbCodePageTag == TRUE)
+               Length = RtlUnicodeStringToAnsiSize (SourceString) + 1;
+       else
+               Length = SourceString->Length / sizeof(WCHAR) + 1;
+
+       if (Length > 0x0000FFFF)
+               return STATUS_INVALID_PARAMETER_2;
+
+       DestinationString->Length = (WORD)(Length - 1);
+
+       if (AllocateDestinationString == TRUE)
+       {
+               DestinationString->Buffer = ExAllocatePool (NonPagedPool,
+                                                           Length);
+
+               if (DestinationString->Buffer == NULL)
+                       return STATUS_NO_MEMORY;
+
+               RtlZeroMemory (DestinationString->Buffer,
+                              Length);
+               DestinationString->MaximumLength = (WORD)Length;
+       }
+       else
+       {
+               if (Length > DestinationString->MaximumLength)
+               {
+                       if (DestinationString->MaximumLength == 0)
+                               return STATUS_BUFFER_OVERFLOW;
+                       DestinationString->Length =
+                               DestinationString->MaximumLength - 1;
+               }
+       }
+
+       Status = RtlUpcaseUnicodeToOemN (DestinationString->Buffer,
+                                        DestinationString->Length,
+                                        &Size,
+                                        SourceString->Buffer,
+                                        SourceString->Length);
+       if (!NT_SUCCESS(Status))
+       {
+               if (AllocateDestinationString)
+                       ExFreePool (DestinationString->Buffer);
+
+               return Status;
+       }
+
+       DestinationString->Buffer[Size] = 0;
+
+       return STATUS_SUCCESS;
+}
 
 
 NTSTATUS
@@ -1315,11 +1475,6 @@ RtlUpcaseUnicodeStringToOemString (
 }
 
 
-/*
-RtlUpcaseUnicodeToCustomCP
-*/
-
-
 CHAR
 STDCALL
 RtlUpperChar (