Index: trunk/src/NTDLL/file.c
===================================================================
--- trunk/src/NTDLL/file.c	(revision 33)
+++ trunk/src/NTDLL/file.c	(revision 33)
@@ -0,0 +1,298 @@
+/*
+ * Project Odin Software License can be found in LICENSE.TXT
+ * Win32 NT Runtime / NTDLL for OS/2
+ *
+ * Copyright 1998       original WINE Author
+ * Copyright 1998, 1999 Patrick Haller (phaller@gmx.net)
+ */
+
+#include <stdlib.h>
+#include <string.h>
+
+#include "ntdll.h"
+
+
+//******************************************************************************
+//NtClose has to call CloseHandle since the Handlemanager has to be
+//called.
+//******************************************************************************
+NTSTATUS WIN32API NtClose(HANDLE hHandle)
+{
+  dprintf(("NTDLL: NtClose(%08x) not properly implemented.\n",
+           hHandle));
+
+  /* @@@PH 98/05/05 function from NTDLL */
+  return (CloseHandle(hHandle));
+}
+
+
+
+/**************************************************************************
+ *                 NtOpenFile                     [NTDLL.127]
+ * FUNCTION: Opens a file
+ * ARGUMENTS:
+ *  FileHandle    Variable that receives the file handle on return
+ *  DesiredAccess Access desired by the caller to the file
+ *  ObjectAttributes                     Structue describing the file to be opened
+ *  IoStatusBlock Receives details about the result of the operation
+ *  ShareAccess                          Type of shared access the caller requires
+ *  OpenOptions                          Options for the file open
+ */
+NTSTATUS WIN32API NtOpenFile(PHANDLE            FileHandle,
+                             ACCESS_MASK        DesiredAccess,
+                             POBJECT_ATTRIBUTES ObjectAttributes,
+                             PIO_STATUS_BLOCK   IoStatusBlock,
+                             ULONG              ShareAccess,
+                             ULONG              OpenOptions)
+{
+  dprintf(("NTDLL: NtOpenFile(%08xh,%08xh,%08xh,%08xh,%08xh,%08xh) not implemented.\n",
+           FileHandle,
+           DesiredAccess,
+           ObjectAttributes,
+           IoStatusBlock,
+           ShareAccess,
+           OpenOptions));
+
+  return 0;
+}
+
+
+/**************************************************************************
+ *    NtCreateFile                                [NTDLL.73]
+ * FUNCTION: Either causes a new file or directory to be created, or it opens
+ *  an existing file, device, directory or volume, giving the caller a handle
+ *  for the file object. This handle can be used by subsequent calls to
+ *  manipulate data within the file or the file object's state of attributes.
+ * ARGUMENTS:
+ * FileHandle     Points to a variable which receives the file handle on return
+ * DesiredAccess                         Desired access to the file
+ * ObjectAttributes                      Structure describing the file
+ * IoStatusBlock                         Receives information about the operation on return
+ * AllocationSize                        Initial size of the file in bytes
+ * FileAttributes                        Attributes to create the file with
+ * ShareAccess    Type of shared access the caller would like to the file
+ * CreateDisposition                     Specifies what to do, depending on whether the file already exists
+ * CreateOptions                         Options for creating a new file
+ * EaBuffer    Undocumented
+ * EaLength    Undocumented
+ */
+NTSTATUS WIN32API NtCreateFile(PHANDLE            FileHandle,
+                               ACCESS_MASK        DesiredAccess,
+                               POBJECT_ATTRIBUTES ObjectAttributes,
+                               PIO_STATUS_BLOCK   IoStatusBlock,
+                               PLARGE_INTEGER     AllocateSize,
+                               ULONG              FileAttributes,
+                               ULONG              ShareAccess,
+                               ULONG              CreateDisposition,
+                               ULONG              CreateOptions,
+                               PVOID              EaBuffer,
+                               ULONG              EaLength)
+{
+  dprintf(("NTDLL: NtCreateFile(%08xh,%08xh,%08xh,%08xh,%08xh,%08xh,%08xh,%08xh,%08xh,%08xh,%08xh) not implemented.\n",
+           FileHandle,
+           DesiredAccess,
+           ObjectAttributes,
+           IoStatusBlock,
+           AllocateSize,
+           FileAttributes,
+           ShareAccess,
+           CreateDisposition,
+           CreateOptions,
+           EaBuffer,
+           EaLength));
+
+  return 0;
+}
+
+
+/******************************************************************************
+ *  NtReadFile                                 [NTDLL]
+ *  ZwReadFile
+ *
+ * Parameters
+ *   HANDLE32     FileHandle
+ *   HANDLE32     Event                     OPTIONAL
+ *   PIO_APC_ROUTINE                     ApcRoutine  OPTIONAL
+ *   PVOID     ApcContext                OPTIONAL
+ *   PIO_STATUS_BLOCK                    IoStatusBlock
+ *   PVOID     Buffer
+ *   ULONG     Length
+ *   PLARGE_INTEGER                      ByteOffset  OPTIONAL
+ *   PULONG       Key                       OPTIONAL
+ */
+NTSTATUS WIN32API NtReadFile (HANDLE           FileHandle,
+                              HANDLE           EventHandle,
+                              PIO_APC_ROUTINE  ApcRoutine,
+                              PVOID            ApcContext,
+                              PIO_STATUS_BLOCK IoStatusBlock,
+                              PVOID            Buffer,
+                              ULONG            Length,
+                              PLARGE_INTEGER   ByteOffset,
+                              PULONG           Key)
+{
+  dprintf(("NTDLL: NtReadFile(%08xh,%08xh,%08xh,%08xh,%08xh,%08xh,%08xh,%08xh,%08xh) not implemented.\n",
+           FileHandle,
+           EventHandle,
+           ApcRoutine,
+           ApcContext,
+           IoStatusBlock,
+           Buffer,
+           Length,
+           ByteOffset,
+           Key));
+
+  return 0;
+}
+
+
+/**************************************************************************
+ *    NtDeviceIoControlFile                    [NTDLL.94]
+ */
+NTSTATUS WIN32API NtDeviceIoControlFile(HANDLE           DeviceHandle,
+                                        HANDLE           Event,
+                                        PIO_APC_ROUTINE  UserApcRoutine,
+                                        PVOID            UserApcContext,
+                                        PIO_STATUS_BLOCK IoStatusBlock,
+                                        ULONG            IoControlCode,
+                                        PVOID            InputBuffer,
+                                        ULONG            InputBufferSize,
+                                        PVOID            OutputBuffer,
+                                        ULONG            OutputBufferSize)
+{
+  dprintf(("NTDLL: NtDeviceIoControlFile(%08xh,%08xh,%08xh,%08xh,%08xh,%08xh,%08xh,%08xh,%08xh,%08xh) not implemented.\n",
+           DeviceHandle,
+           Event,
+           UserApcRoutine,
+           UserApcContext,
+           IoStatusBlock,
+           IoControlCode,
+           InputBuffer,
+           InputBufferSize,
+           OutputBuffer,
+           OutputBufferSize));
+
+  return 0;
+}
+
+
+/******************************************************************************
+ * NtFsControlFile [NTDLL.108]
+ */
+NTSTATUS WIN32API NtFsControlFile(HANDLE           DeviceHandle,
+                                  HANDLE           Event,
+                                  PIO_APC_ROUTINE  UserApcRoutine,
+                                  PVOID            UserApcContext,
+                                  PIO_STATUS_BLOCK IoStatusBlock,
+                                  ULONG            IoControlCode,
+                                  PVOID            InputBuffer,
+                                  ULONG            InputBufferSize,
+                                  PVOID            OutputBuffer,
+                                  ULONG            OutputBufferSize)
+{
+  dprintf(("NTDLL: NtFsControlFile(%08xh,%08xh,%08xh,%08xh,%08xh,%08xh,%08xh,%08xh,%08xh,%08xh) not implemented.\n",
+           DeviceHandle,
+           Event,
+           UserApcRoutine,
+           UserApcContext,
+           IoStatusBlock,
+           IoControlCode,
+           InputBuffer,
+           InputBufferSize,
+           OutputBuffer,
+           OutputBufferSize));
+
+  return 0;
+}
+
+
+/******************************************************************************
+ *  NtSetVolumeInformationFile              [NTDLL]
+ */
+NTSTATUS WIN32API NtSetVolumeInformationFile(HANDLE FileHandle,
+                                             PVOID  VolumeInformationClass,
+                                             PVOID  VolumeInformation,
+                                             ULONG  Length)
+{
+  dprintf(("NTDLL: NtSetVolumeInformationFile(%08xh,%08xh,%08xh,%08xh) not implemented.\n",
+           FileHandle,
+           VolumeInformationClass,
+           VolumeInformation,
+           Length));
+
+  return 0;
+}
+
+
+/******************************************************************************
+ *  NtQueryInformationFile                  [NTDLL]
+ */
+NTSTATUS WIN32API NtQueryInformationFile(HANDLE                 FileHandle,
+                                         PIO_STATUS_BLOCK       IoStatusBlock,
+                                         PVOID                  FileInformation,
+                                         ULONG                  Length,
+                                         FILE_INFORMATION_CLASS FileInformationClass)
+{
+  dprintf(("NTDLL: NtQueryInformationFile(%08xh,%08xh,%08xh,%08xh,%08xh) not implemented.\n",
+           FileHandle,
+           IoStatusBlock,
+           FileInformation,
+           Length,
+           FileInformationClass));
+
+  return 0;
+}
+
+
+/******************************************************************************
+ *  NtSetInformationFile                    [NTDLL]
+ */
+NTSTATUS WIN32API NtSetInformationFile(HANDLE                 FileHandle,
+                                       PIO_STATUS_BLOCK       IoStatusBlock,
+                                       PVOID                  FileInformation,
+                                       ULONG                  Length,
+                                       FILE_INFORMATION_CLASS FileInformationClass)
+{
+  dprintf(("NTDLL: NtSetInformationFile(%08xh,%08xh,%08xh,%08xh,%08xh) not implemented.\n",
+           FileHandle,
+           IoStatusBlock,
+           FileInformation,
+           Length,
+           FileInformationClass));
+
+  return 0;
+}
+
+
+/******************************************************************************
+ *  NtQueryDirectoryFile                 [NTDLL]
+ *  ZwQueryDirectoryFile
+ */
+NTSTATUS WIN32API NtQueryDirectoryFile(HANDLE                 FileHandle,
+                                       HANDLE                 Event,
+                                       PIO_APC_ROUTINE        ApcRoutine,
+                                       PVOID                  ApcContext,
+                                       PIO_STATUS_BLOCK       IoStatusBlock,
+                                       PVOID                  FileInformation,
+                                       ULONG                  Length,
+                                       FILE_INFORMATION_CLASS FileInformationClass,
+                                       BOOLEAN                ReturnSingleEntry,
+                                       PUNICODE_STRING        FileName,
+                                       BOOLEAN                RestartScan)
+{
+  dprintf(("NTDLL: NtQueryDirectoryFile(%08xh,%08xh,%08xh,%08xh,%08xh,%08xh,%08xh,%08xh,%08xh,%08xh,%08xh) not implemented.\n",
+           FileHandle,
+           Event,
+           ApcRoutine,
+           ApcContext,
+           IoStatusBlock,
+           FileInformation,
+           Length,
+           FileInformationClass,
+           ReturnSingleEntry,
+           FileName,
+           RestartScan));
+
+  return 0;
+}
+
+
Index: trunk/src/NTDLL/nt.c
===================================================================
--- trunk/src/NTDLL/nt.c	(revision 33)
+++ trunk/src/NTDLL/nt.c	(revision 33)
@@ -0,0 +1,729 @@
+
+/*
+ * NT basis DLL
+ *
+ * This file contains the Nt* API functions of NTDLL.DLL.
+ * In the original ntdll.dll they all seem to just call int 0x2e (down to the HAL)
+ *
+ * Copyright 1996-1998 Marcus Meissner
+ * Copyright 1999      Patrick Haller
+ */
+
+#include <stdlib.h>
+#include <string.h>
+#include <time.h>
+
+#include "ntdll.h"
+
+
+/* move to winbase.h */
+
+// @@@PH can't compile this WINE code
+//typedef VOID (CALLBACK *PTIMERAPCROUTINE)(LPVOID lpArgToCompletionRoutine,DWORD dwTimerLowValue,DWORD dwTimerHighValue);
+typedef PVOID PTIMERAPCROUTINE;
+
+
+/*
+ * Timer object
+ */
+
+/**************************************************************************
+ *    NtCreateTimer                               [NTDLL.87]
+ */
+NTSTATUS WINAPI NtCreateTimer(PHANDLE            TimerHandle,
+                              ACCESS_MASK        DesiredAccess,
+                              POBJECT_ATTRIBUTES ObjectAttributes,
+                              TIMER_TYPE         TimerType)
+{
+  dprintf(("NTDLL: NtCreateTimer(%08xh,%08xh,%08xh,%08xh) not implemented.\n",
+           TimerHandle,
+           DesiredAccess,
+           ObjectAttributes,
+           TimerType));
+
+  return 0;
+}
+
+
+/**************************************************************************
+ *    NtSetTimer                               [NTDLL.221]
+ */
+NTSTATUS WINAPI NtSetTimer(HANDLE           TimerHandle,
+                           PLARGE_INTEGER   DueTime,
+                           PTIMERAPCROUTINE TimerApcRoutine,
+                           PVOID            TimerContext,
+                           BOOLEAN          WakeTimer,
+                           ULONG            Period,
+                           PBOOLEAN         PreviousState)
+{
+  dprintf(("NTDLL: NtSetTimer(%08xh,%08xh,%08xh,%08xh,%08xh,%08xh,%08xh) not implemented.\n",
+           TimerHandle,
+           DueTime,
+           TimerApcRoutine,
+           TimerContext,
+           WakeTimer,
+           Period,
+           PreviousState));
+
+  return 0;
+}
+
+
+/******************************************************************************
+ * NtQueryTimerResolution [NTDLL.129]
+ */
+NTSTATUS WINAPI NtQueryTimerResolution(DWORD x1,
+                                       DWORD x2,
+                                       DWORD x3)
+{
+  dprintf(("NTDLL: NtQueryTimerResolution(%08xh,%08xh,%08xh) not implemented.\n",
+           x1,
+           x2,
+           x3));
+
+  return 1;
+}
+
+
+/*
+ * Process object
+ */
+
+/******************************************************************************
+ *  NtTerminateProcess                         [NTDLL.]
+ *
+ *  Native applications must kill themselves when done
+ * FIXME: return value 0-success
+ */
+NTSTATUS WINAPI NtTerminateProcess(HANDLE ProcessHandle,
+                                   LONG   ExitStatus)
+{
+  dprintf(("NTDLL: NtTerminateProcess(%08xh,%08xh)",
+           ProcessHandle,
+           ExitStatus));
+
+  /* win32 (0x7fffffff) to nt (-1) */
+  if ( NtCurrentProcess() == ProcessHandle )
+    ProcessHandle = GetCurrentProcess();
+
+  /* @@@PH return code looks suspicious ! */
+  return (! TerminateProcess( ProcessHandle, ExitStatus ));
+}
+
+
+/******************************************************************************
+*  NtQueryInformationProcess                [NTDLL.]
+*
+*/
+NTSTATUS WINAPI NtQueryInformationProcess(HANDLE           ProcessHandle,
+                                          PROCESSINFOCLASS ProcessInformationClass,
+                                          PVOID            ProcessInformation,
+                                          ULONG            ProcessInformationLength,
+                                          PULONG           ReturnLength)
+{
+  dprintf(("NTDLL: NtQueryInformationProcess(%08xh,%08xh,%08xh,%08xh,%08xh) not implemented.\n",
+           ProcessHandle,
+           ProcessInformationClass,
+           ProcessInformation,
+           ProcessInformationLength,
+           Returnlength));
+
+  return 0;
+}
+
+/******************************************************************************
+ * NtSetInformationProcess [NTDLL.207]
+ */
+NTSTATUS WINAPI NtSetInformationProcess(HANDLE           ProcessHandle,
+                                        PROCESSINFOCLASS ProcessInformationClass,
+                                        PVOID            ProcessInformation,
+                                        ULONG            ProcessInformationLength)
+{
+  dprintf(("NTDLL: NtSetInformationProcess(%08xh,%08xh,%08xh,%08xh) not implemented.\n",
+           ProcessHandle,
+           ProcessInformationClass,
+           ProcessInformation,
+           ProcessInformationLength));
+
+  return 0;
+}
+
+
+/*
+ * Thread
+ */
+
+/******************************************************************************
+ *  NtResumeThread                       [NTDLL]
+ */
+NTSTATUS WINAPI NtResumeThread(HANDLE ThreadHandle,
+                               PULONG SuspendCount)
+{
+  dprintf(("NTDLL: NtResumeThread(%08xh,%08x) not implemented.\n",
+           ThreadHandle,
+           SuspendCount));
+
+  return 0;
+}
+
+
+/******************************************************************************
+ *  NtTerminateThread                    [NTDLL]
+ */
+NTSTATUS WINAPI NtTerminateThread(HANDLE ThreadHandle,
+                                  NTSTATUS ExitStatus)
+{
+  dprintf(("NTDLL: NtTerminateThread(%08xh,%08xh) not correctly implemented.\n",
+           ThreadHandle,
+           ExitStatus));
+
+  if ( TerminateThread(ThreadHandle,ExitStatus) )
+    return 0;
+
+  return 0xc0000000; /* FIXME: lasterror->ntstatus */
+}
+
+
+/******************************************************************************
+*  NtQueryInformationThread                 [NTDLL.]
+*
+*/
+NTSTATUS WINAPI NtQueryInformationThread(HANDLE          ThreadHandle,
+                                         THREADINFOCLASS ThreadInformationClass,
+                                         PVOID           ThreadInformation,
+                                         ULONG           ThreadInformationLength,
+                                         PULONG          ReturnLength)
+{
+  dprintf(("NTDLL: NtQueryInformationThread(%08xh,%08xh,%08xh,%08xh,%08xh) not implemented.\n",
+           ThreadHandle,
+           ThreadInformationClass,
+           ThreadInformation,
+           ThreadInformationLength,
+           ReturnLength));
+
+  return 0;
+}
+
+
+/******************************************************************************
+ *  NtSetInformationThread                  [NTDLL]
+ */
+NTSTATUS WINAPI NtSetInformationThread(HANDLE          ThreadHandle,
+                                       THREADINFOCLASS ThreadInformationClass,
+                                       PVOID           ThreadInformation,
+                                       ULONG           ThreadInformationLength)
+{
+  dprintf(("NTDLL: NtSetInformationThread(%08xh,%08xh,%08xh,%08xh) not implemented.\n",
+           ThreadHandle,
+           ThreadInformationClass,
+           ThreadInformation,
+           ThreadInformationLength));
+
+  return 0;
+}
+
+
+/*
+ * Token
+ */
+
+/******************************************************************************
+ *  NtDuplicateToken                        [NTDLL]
+ */
+NTSTATUS WINAPI NtDuplicateToken(HANDLE                       ExistingToken,
+                                 ACCESS_MASK                  DesiredAccess,
+                                 POBJECT_ATTRIBUTES           ObjectAttributes,
+                                 SECURITY_IMPERSONATION_LEVEL ImpersonationLevel,
+                                 TOKEN_TYPE                   TokenType,
+                                 PHANDLE                      NewToken)
+{
+  dprintf(("NTDLL: NtDuplicateToken(%08xh,%08xh,%08xh,%08xh,%08xh,%08xh) not implemented.\n",
+           ExistingToken,
+           DesiredAccess,
+           ObjectAttributes,
+           ImpersonationLevel,
+           TokenType,
+           NewToken));
+
+  return 0;
+}
+
+/******************************************************************************
+ *  NtOpenProcessToken                      [NTDLL]
+ */
+NTSTATUS WINAPI NtOpenProcessToken(HANDLE  ProcessHandle,
+                                   DWORD   DesiredAccess,
+                                   PHANDLE TokenHandle)
+{
+  dprintf(("NTDLL: NtOpenProcessToken(%08xh,%08xh,%08xh) not implemented.\n",
+           ProcessHandle,
+           DesiredAccess,
+           TokenHandle));
+
+  *TokenHandle = 0xcafe;
+  return 0;
+}
+
+
+/******************************************************************************
+ *  NtOpenThreadToken                       [NTDLL]
+ */
+NTSTATUS WINAPI NtOpenThreadToken(HANDLE  ThreadHandle,
+                                  DWORD   DesiredAccess,
+                                  BOOLEAN OpenAsSelf,
+                                  PHANDLE TokenHandle)
+{
+  dprintf(("NTDLL: NtOpenThreadToken(%08xh,%08xh,%08xh,%08xh) not implemented.\n",
+           ThreadHandle,
+           DesiredAccess,
+           OpenAsSelf,
+           TokenHandle));
+
+  *TokenHandle = 0xcafe;
+  return 0;
+}
+
+
+/******************************************************************************
+ *  NtAdjustPrivilegesToken                 [NTDLL]
+ *
+ * FIXME: parameters unsafe
+ */
+NTSTATUS WINAPI NtAdjustPrivilegesToken(HANDLE            TokenHandle,
+                                        BOOLEAN           DisableAllPrivileges,
+                                        PTOKEN_PRIVILEGES NewState,
+                                        DWORD             BufferLength,
+                                        PTOKEN_PRIVILEGES PreviousState,
+                                        PDWORD            ReturnLength)
+{
+  dprintf(("NTDLL: NtAdjustPrivilegesToken(%08xh,%08xh,%08xh,%08xh,%08xh,%08xh) not implemented.\n",
+           TokenHandle,
+           DisableAllPrivileges,
+           NewState,
+           BufferLength,
+           PreviousState,
+           ReturnLength));
+
+  return 0;
+}
+
+
+/******************************************************************************
+*  NtQueryInformationToken                  [NTDLL.156]
+*
+*/
+NTSTATUS WINAPI NtQueryInformationToken(HANDLE  Token,
+                                        DWORD   TokenInformationClass,
+                                        LPVOID  TokenInformation,
+                                        DWORD   TokenInformationLength,
+                                        LPDWORD ReturnLength)
+{
+  dprintf(("NTDLL: NtQueryInformationToken(%08xh,%08xh,%08xh,%08xh,%08xh) not implemented.\n",
+           TokenHandle,
+           TokenInformationClass,
+           TokenInformation,
+           TokenInformationLength,
+           ReturnLength));
+
+  switch (TokenInformationClass)
+  {
+    case TokenGroups:                    /* 2 */
+      *ReturnLength = sizeof (TOKEN_GROUPS);
+#if 0
+    case TokenUser:                     /* 1 */
+    case TokenPrivileges:
+    case TokenOwner:
+    case TokenPrimaryGroup:
+    case TokenDefaultDacl:
+    case TokenSource:
+    case TokenType:
+    case TokenImpersonationLevel:
+    case TokenStatistics:
+#endif /* 0 */
+  }
+
+  return 0;
+}
+
+
+/*
+ * Section
+ */
+
+/******************************************************************************
+ *  NtCreateSection                      [NTDLL]
+ */
+NTSTATUS WINAPI NtCreateSection(PHANDLE SectionHandle,
+                                ACCESS_MASK DesiredAccess,
+                                POBJECT_ATTRIBUTES ObjectAttributes,
+                                PLARGE_INTEGER MaximumSize,
+                                ULONG SectionPageProtection,
+                                ULONG AllocationAttributes,
+                                HANDLE FileHandle)
+{
+  dprintf(("NTDLL: NtCreateSection(%08xh,%08xh,%08xh,%08xh,%08xh,%08xh,%08xh) not implemented.\n",
+           SectionHandle,
+           DesiredAccess,
+           ObjectAttributes,
+           MaximumSize,
+           SectionPageProtection,
+           AllocationAttributes,
+           FileHandle));
+
+  return 0;
+}
+
+
+/******************************************************************************
+ *  NtOpenSection [NTDLL]
+ */
+NTSTATUS WINAPI NtOpenSection(PHANDLE SectionHandle,
+                              ACCESS_MASK DesiredAccess,
+                              POBJECT_ATTRIBUTES ObjectAttributes)
+{
+  dprintf(("NTDLL: NtOpenSection(%08xh,%08xh,%08xh) not implemented.\n",
+           SectionHandle,
+           DesiredAccess,
+           ObjectAttributes));
+
+  return 0;
+}
+
+
+/******************************************************************************
+ *  NtQuerySection                       [NTDLL]
+ */
+NTSTATUS WINAPI NtQuerySection(HANDLE SectionHandle,
+                               PVOID SectionInformationClass,
+                               PVOID SectionInformation,
+                               ULONG Length,
+                               PULONG ResultLength)
+{
+  dprintf(("NTDLL: NtQuerySection(%08xh,%08xh,%08xh,%08xh,%08xh) not implemented.\n",
+           SectionHandle,
+           SectionInformationClass,
+           SectionInformation,
+           Length,
+           ResultLength));
+
+  return 0;
+}
+
+
+/******************************************************************************
+ * NtMapViewOfSection                    [NTDLL]
+ * FUNCTION: Maps a view of a section into the virtual address space of a process
+ *
+ * ARGUMENTS:
+ *  SectionHandle Handle of the section
+ *  ProcessHandle Handle of the process
+ *  BaseAddress                          Desired base address (or NULL) on entry
+ *       Actual base address of the view on exit
+ *  ZeroBits      Number of high order address bits that must be zero
+ *  CommitSize    Size bytes of the initially committed section of the view
+ *  SectionOffset Offset bytes from the beginning of the section to the beginning of the view
+ *  ViewSize      Desired length of map (or zero to map all) on entry
+         Actual length mapped on exit
+ *  InheritDisposition                   Specified how the view is to be shared with
+ *       child processes
+ *  AllocateType  Type of allocation for the pages
+ *  Protect    Protection for the committed region of the view
+ */
+NTSTATUS WINAPI NtMapViewOfSection(HANDLE          SectionHandle,
+                                   HANDLE          ProcessHandle,
+                                   PVOID*          BaseAddress,
+                                   ULONG           ZeroBits,
+                                   ULONG           CommitSize,
+                                   PLARGE_INTEGER  SectionOffset,
+                                   PULONG          ViewSize,
+                                   SECTION_INHERIT InheritDisposition,
+                                   ULONG           AllocationType,
+                                   ULONG           Protect)
+{
+  dprintf(("NTDLL: NtMapViewOfSection(%08xh,%08xh,%08xh,%08xh,%08xh,%08xh,%08xh,%08xh,%08xh,%08xh) not implemented.\n",
+           SectionHandle,
+           ProcessHandle,
+           BaseAddress,
+           ZeroBits,
+           CommitSize,
+           SectionOffset,
+           ViewSize,
+           InheritDisposition,
+           AllocationType,
+           Protect));
+
+  return 0;
+}
+
+
+/*
+ * ports
+ */
+
+/******************************************************************************
+ *  NtCreatePort                         [NTDLL]
+ */
+NTSTATUS WINAPI NtCreatePort(DWORD x1,
+                             DWORD x2,
+                             DWORD x3,
+                             DWORD x4,
+                             DWORD x5)
+{
+  dprintf(("NTDLL: NtCreatePort(%08xh,%08xh,%08xh,%08xh,%08xh) not implemented.\n",
+           x1,
+           x2,
+           x3,
+           x4,
+           x5));
+
+  return 0;
+}
+
+
+/******************************************************************************
+ *  NtConnectPort                        [NTDLL]
+ */
+NTSTATUS WINAPI NtConnectPort(DWORD           x1,
+                              PUNICODE_STRING uni,
+                              DWORD           x3,
+                              DWORD           x4,
+                              DWORD           x5,
+                              DWORD           x6,
+                              DWORD           x7,
+                              DWORD           x8)
+{
+  dprintf(("NTDLL: NtConnectPort(%08xh,%08xh,%08xh,%08xh,%08xh,%08xh,%08xh,%08xh) not implemented.\n",
+           x1,
+           uni,
+           x3,
+           x4,
+           x5,
+           x6,
+           x7,
+           x8));
+
+  return 0;
+}
+
+
+/******************************************************************************
+ *  NtListenPort                         [NTDLL]
+ */
+NTSTATUS WINAPI NtListenPort(DWORD x1,
+                             DWORD x2)
+{
+  dprintf(("NTDLL: NtListenPort(%08xh,%08xh) not implemented.\n",
+           x1,
+           x2));
+
+  return 0;
+}
+
+
+/******************************************************************************
+ *  NtAcceptConnectPort                  [NTDLL]
+ */
+NTSTATUS WINAPI NtAcceptConnectPort(DWORD x1,
+                                    DWORD x2,
+                                    DWORD x3,
+                                    DWORD x4,
+                                    DWORD x5,
+                                    DWORD x6)
+{
+  dprintf(("NTDLL: NtAcceptConnectPort(%08xh,%08xh,%08xh,%08xh,%08xh,%08xh) not implemented.\n",
+           x1,
+           x2,
+           x3,
+           x4,
+           x5,
+           x6));
+
+  return 0;
+}
+
+
+/******************************************************************************
+ *  NtCompleteConnectPort                [NTDLL]
+ */
+NTSTATUS WINAPI NtCompleteConnectPort(DWORD x1)
+{
+  dprintf(("NTDLL: NtCompleteConnectPort(%08xh) not implemented.\n",
+           x1));
+
+  return 0;
+}
+
+
+/******************************************************************************
+ *  NtRegisterThreadTerminatePort        [NTDLL]
+ */
+NTSTATUS WINAPI NtRegisterThreadTerminatePort(DWORD x1)
+{
+  dprintf(("NTDLL: NtRegisterThreadTerminatePort(%08xh) not implemented.\n",
+           x1));
+
+  return 0;
+}
+
+
+/******************************************************************************
+ *  NtRequestWaitReplyPort                  [NTDLL]
+ */
+NTSTATUS WINAPI NtRequestWaitReplyPort(DWORD x1,
+                                       DWORD x2,
+                                       DWORD x3)
+{
+  dprintf(("NTDLL: NtRequestWaitReplyPort(%08xh,%08xh,%08xh) not implemented.\n",
+           x1,
+           x2,
+           x3));
+
+  return 0;
+}
+
+
+/******************************************************************************
+ *  NtReplyWaitReceivePort               [NTDLL]
+ */
+NTSTATUS WINAPI NtReplyWaitReceivePort(DWORD x1,
+                                       DWORD x2,
+                                       DWORD x3,
+                                       DWORD x4)
+{
+  dprintf(("NTDLL: NtReplyWaitReceivePort(%08xh,%08xh,%08xh,%08xh) not implemented.\n",
+           x1,
+           x2,
+           x3,
+           x4));
+
+  return 0;
+}
+
+
+/*
+ * Misc
+ */
+
+ /******************************************************************************
+ *  NtSetIntervalProfile                 [NTDLL]
+ */
+NTSTATUS WINAPI NtSetIntervalProfile(DWORD x1,
+                                     DWORD x2)
+{
+  dprintf(("NTDLL: NtSetIntervalProfile(%08xh,%08xh) not implemented.\n",
+           x1,
+           x2));
+
+  return 0;
+}
+
+
+/******************************************************************************
+ *  NtQueryPerformanceCounter            [NTDLL]
+ */
+NTSTATUS WINAPI NtQueryPerformanceCounter(PLARGE_INTEGER Counter,
+                                          PLARGE_INTEGER Frequency)
+{
+  dprintf(("NTDLL: NtQueryPerformanceCounter(%08xh,%08xh) not implemented.\n",
+           Counter,
+           Frequency));
+
+  return 0;
+}
+
+
+/******************************************************************************
+ *  NtCreateMailSlotFile                 [NTDLL]
+ */
+NTSTATUS WINAPI NtCreateMailslotFile(DWORD x1,
+                                     DWORD x2,
+                                     DWORD x3,
+                                     DWORD x4,
+                                     DWORD x5,
+                                     DWORD x6,
+                                     DWORD x7,
+                                     DWORD x8)
+{
+  dprintf(("NTDLL: NtCreateMailslotFile(%08xh,%08xh,%08xh,%08xh,%08xh,%08xh,%08xh,%08xh) not implemented.\n",
+           x1,
+           x2,
+           x3,
+           x4,
+           x5,
+           x6,
+           x7,
+           x8));
+
+  return 0;
+}
+
+
+/******************************************************************************
+ * NtQuerySystemInformation [NTDLL.168]
+ *
+ * ARGUMENTS:
+ *  SystemInformationClass               Index to a certain information structure
+ * SystemTimeAdjustmentInformation       SYSTEM_TIME_ADJUSTMENT
+ * SystemCacheInformation                   SYSTEM_CACHE_INFORMATION
+ * SystemConfigurationInformation        CONFIGURATION_INFORMATION
+ * observed (class/len):
+ *    0x0/0x2c
+ *    0x12/0x18
+ *    0x2/0x138
+ *    0x8/0x600
+ *  SystemInformation                    caller supplies storage for the information structure
+ *  Length     size of the structure
+ *  ResultLength  Data written
+ */
+NTSTATUS WINAPI NtQuerySystemInformation(SYSTEM_INFORMATION_CLASS SystemInformationClass,
+                                         PVOID                    SystemInformation,
+                                         ULONG                    Length,
+                                         PULONG                   ResultLength)
+{
+  dprintf(("NTDLL: NtQuerySystemInformation(%08xh,%08xh,%08xh,%08xh) not implemented.\n",
+           SystemInformationClass,
+           SystemInformation,
+           Length,
+           ResultLength));
+
+  ZeroMemory (SystemInformation, Length);
+  return 0;
+}
+
+
+/******************************************************************************
+ *  NtCreatePagingFile                      [NTDLL]
+ */
+NTSTATUS WINAPI NtCreatePagingFile(PUNICODE_STRING PageFileName,
+                                   ULONG MiniumSize,
+                                   ULONG MaxiumSize,
+                                   PULONG ActualSize)
+{
+  dprintf(("NTDLL: NtCreatePagingFile(%08xh, %08xh, %08xh, %08xh) not implemented.\n",
+           PageFileName,
+           MinimumSize,
+           MaximumSize,
+           ActualSize));
+
+  return 0;
+}
+
+
+/******************************************************************************
+ *  NtDisplayString                               [NTDLL.95]
+ *
+ * writes a string to the nt-textmode screen eg. during startup
+ */
+NTSTATUS WINAPI NtDisplayString (PUNICODE_STRING string)
+{
+  dprintf(("NTDLL: NtDisplayString(%08xh\n",
+           string));
+
+  WriteConsoleW(GetStdHandle(STD_OUTPUT_HANDLE),
+                string->Buffer,
+                string->Length,
+                0,
+                0);
+
+  return 0;
+}
Index: trunk/src/NTDLL/om.c
===================================================================
--- trunk/src/NTDLL/om.c	(revision 33)
+++ trunk/src/NTDLL/om.c	(revision 33)
@@ -0,0 +1,246 @@
+/*
+ * Project Odin Software License can be found in LICENSE.TXT
+ * Win32 NT Runtime / NTDLL for OS/2
+ *
+ * Copyright 1998       original WINE Author
+ * Copyright 1998, 1999 Patrick Haller (phaller@gmx.net)
+ *
+ * Object management functions
+ */
+
+#include <stdlib.h>
+#include <string.h>
+
+#include "ntdll.h"
+
+/* move to somewhere */
+typedef void * POBJDIR_INFORMATION;
+
+/*
+ * Generic object functions
+ */
+
+/******************************************************************************
+ * NtQueryObject [NTDLL.161]
+ */
+NTSTATUS WINAPI NtQueryObject(HANDLE                   ObjectHandle,
+                              OBJECT_INFORMATION_CLASS ObjectInformationClass,
+                              PVOID                    ObjectInformation,
+                              ULONG                    Length,
+                              PULONG                   ResultLength)
+{
+  dprintf(("NTDLL: NtQueryObject(%08xh,%08xh,%08xh,%08xh,%08xh) not implemented.\n",
+           ObjectHandle,
+           ObjectInformationClass,
+           ObjectInformation,
+           Length,
+           ResultLength));
+
+  return 0;
+}
+
+
+/******************************************************************************
+ *  NtQuerySecurityObject                [NTDLL]
+ */
+NTSTATUS WINAPI NtQuerySecurityObject(DWORD x1,
+                                      DWORD x2,
+                                      DWORD x3,
+                                      DWORD x4,
+                                      DWORD x5)
+{
+  dprintf(("NTDLL: NtQuerySecurityObject(%08xh,%08xh,%08xh,%08xh,%08xh) not implemented.\n",
+           x1,
+           x2,
+           x3,
+           x4,
+           x5));
+
+  return 0;
+}
+
+
+/******************************************************************************
+ *  NtDuplicateObject                       [NTDLL]
+ */
+NTSTATUS WINAPI NtDuplicateObject(HANDLE      SourceProcessHandle,
+                                  PHANDLE     SourceHandle,
+                                  HANDLE      TargetProcessHandle,
+                                  PHANDLE     TargetHandle,
+                                  ACCESS_MASK DesiredAccess,
+                                  BOOLEAN     InheritHandle,
+                                  ULONG       Options)
+{
+  dprintf (("NTDLL: NtDuplicateObject(%08xh,%08xh,%08xh,%08xh,%08xh,%08xh,%08xh) not implemented.\n",
+            SourceProcessHandle,
+            SourceHandle,
+            TargetProcessHandle,
+            TargetHandle,
+            DesiredAccess,
+            InheritHandle,
+            Options));
+
+  *TargetHandle = 0;
+  return 0;
+}
+
+
+/**************************************************************************
+ *                 NtClose                        [NTDLL.65]
+ * FUNCTION: Closes a handle reference to an object
+ * ARGUMENTS:
+ * Handle   handle to close
+ */
+//NTSTATUS WINAPI NtClose(
+//   HANDLE Handle)
+//{
+//   FIXME(ntdll,"(0x%08x),stub!\n",Handle);
+//   return 1;
+//}
+
+
+/******************************************************************************
+ *  NtWaitForSingleObject                   [NTDLL]
+ */
+NTSTATUS WINAPI NtWaitForSingleObject(PHANDLE        Object,
+                                      BOOLEAN        Alertable,
+                                      PLARGE_INTEGER Time)
+{
+  dprintf(("NTDLL: NtWaitForSingleObject(%08xh,%08xh,%08xh) not implemented.\n",
+           Object,
+           Alertable,
+           Time));
+
+  return 0;
+}
+
+
+/*
+ * Directory functions
+ */
+
+/**************************************************************************
+ * NtOpenDirectoryObject [NTDLL.124]
+ * FUNCTION: Opens a namespace directory object
+ * ARGUMENTS:
+ *  DirectoryHandle                      Variable which receives the directory handle
+ *  DesiredAccess Desired access to the directory
+ *  ObjectAttributes                     Structure describing the directory
+ * RETURNS: Status
+ */
+NTSTATUS WINAPI NtOpenDirectoryObject(PHANDLE            DirectoryHandle,
+                                      ACCESS_MASK        DesiredAccess,
+                                      POBJECT_ATTRIBUTES ObjectAttributes)
+{
+  dprintf(("NTDLL: NtOpenDirectoryObject(%08xh,%08xh,%08xh) not implemented.\n",
+           DirectoryHandle,
+           DesiredAccess,
+           ObjectAttributes));
+
+  return 0;
+}
+
+
+/******************************************************************************
+ *  NtCreateDirectoryObject              [NTDLL]
+ */
+NTSTATUS WINAPI NtCreateDirectoryObject(PHANDLE            DirectoryHandle,
+                                        ACCESS_MASK        DesiredAccess,
+                                        POBJECT_ATTRIBUTES ObjectAttributes)
+{
+  dprintf(("NTDLL: NtCreateDirectoryObject(%08xh,%08xh,%08xh) not implemented.\n",
+           DirectoryHandle,
+           DesiredAccess,
+           ObjectAttributes));
+
+  return 0;
+}
+
+
+/******************************************************************************
+ * NtQueryDirectoryObject [NTDLL.149]
+ * FUNCTION: Reads information from a namespace directory
+ * ARGUMENTS:
+ *  DirObjInformation                    Buffer to hold the data read
+ *  BufferLength  Size of the buffer in bytes
+ *  GetNextIndex  If TRUE then set ObjectIndex to the index of the next object
+ *       If FALSE then set ObjectIndex to the number of objects in the directory
+ *  IgnoreInputIndex                     If TRUE start reading at index 0
+ *       If FALSE start reading at the index specified by object index
+ *  ObjectIndex                          Zero based index into the directory, interpretation depends on IgnoreInputIndex and GetNextIndex
+ *  DataWritten                          Caller supplied storage for the number of bytes written (or NULL)
+ */
+NTSTATUS WINAPI NtQueryDirectoryObject(HANDLE              DirObjHandle,
+                                       POBJDIR_INFORMATION DirObjInformation,
+                                       ULONG               BufferLength,
+                                       BOOLEAN             GetNextIndex,
+                                       BOOLEAN             IgnoreInputIndex,
+                                       PULONG              ObjectIndex,
+                                       PULONG              DataWritten)
+{
+  dprintf(("NTDLL: NtQueryDirectoryObject(%08xh,%08xh,%08xh,%08xh,%08xh,%08xh,%08xh) not implemented.\n",
+           DirObjHandle,
+           DirObjInformation,
+           BufferLength,
+           GetNextIndex,
+           IgnoreInputIndex,
+           ObjectIndex,
+           DataWritten));
+
+  return 0xc0000000; /* We don't have any. Whatever. (Yet.) */
+}
+
+
+/*
+ * Link objects
+ */
+
+/******************************************************************************
+ *  NtOpenSymbolicLinkObject             [NTDLL]
+ */
+NTSTATUS WINAPI NtOpenSymbolicLinkObject(PHANDLE            LinkHandle,
+                                         ACCESS_MASK        DesiredAccess,
+                                         POBJECT_ATTRIBUTES ObjectAttributes)
+{
+  dprintf(("NTDLL: NtOpenSymbolicLinkObject(%08xh,%08xh,%08xh) not implemented.\n",
+           LinkHandle,
+           DesiredAccess,
+           ObjectAttributes));
+
+  return 0;
+}
+
+
+/******************************************************************************
+ *  NtCreateSymbolicLinkObject           [NTDLL]
+ */
+NTSTATUS WINAPI NtCreateSymbolicLinkObject(PHANDLE            SymbolicLinkHandle,
+                                           ACCESS_MASK        DesiredAccess,
+                                           POBJECT_ATTRIBUTES ObjectAttributes,
+                                           PUNICODE_STRING    Name)
+{
+  dprintf(("NTDLL: NtCreateSymbolicLinkObject(%08xh,%08xh,%08xh,%08x) not implemented.\n",
+           SymbolicLinkHandle,
+           DesiredAccess,
+           ObjectAttributes,
+           Name));
+
+  return 0;
+}
+
+
+/******************************************************************************
+ *  NtQuerySymbolicLinkObject            [NTDLL]
+ */
+NTSTATUS WINAPI NtQuerySymbolicLinkObject(HANDLE          LinkHandle,
+                                          PUNICODE_STRING LinkTarget,
+                                          PULONG          ReturnedLength)
+{
+  dprintf(("NTDLL: NtQuerySymbolicLinkObject(%08xh,%08xh,%08xh) not implemented.\n",
+           LinkHandle,
+           LinkTarget,
+           ReturnedLength));
+
+  return 0;
+}
+
Index: trunk/src/NTDLL/reg.c
===================================================================
--- trunk/src/NTDLL/reg.c	(revision 33)
+++ trunk/src/NTDLL/reg.c	(revision 33)
@@ -0,0 +1,362 @@
+/*
+ * Project Odin Software License can be found in LICENSE.TXT
+ * Win32 NT Runtime / NTDLL for OS/2
+ *
+ * Copyright 1998       original WINE Author
+ * Copyright 1998, 1999 Patrick Haller (phaller@gmx.net)
+ *
+ * registry functions
+ */
+
+#include "winreg.h"
+
+#include "ntdll.h"
+
+
+/******************************************************************************
+ * NtCreateKey [NTDLL]
+ * ZwCreateKey
+ */
+NTSTATUS WINAPI NtCreateKey(PHANDLE            KeyHandle,
+                            ACCESS_MASK        DesiredAccess,
+                            POBJECT_ATTRIBUTES ObjectAttributes,
+                            ULONG              TitleIndex,
+                            PUNICODE_STRING    Class,
+                            ULONG              CreateOptions,
+                            PULONG             Disposition)
+{
+  dprintf (("NTDLL: NtCreateKey(%08xh,  %08xh,%08xh,%08xh,%08xh,%08xh,%08xh) not implemented.\n",
+            KeyHandle,
+            DesiredAccess,
+            ObjectAttributes,
+            TitleIndex,
+            Class,
+            CreateOptions,
+            Disposition));
+
+  return (0);
+}
+
+
+/******************************************************************************
+ * NtDeleteKey [NTDLL]
+ * ZwDeleteKey
+ */
+NTSTATUS WINAPI NtDeleteKey(HANDLE KeyHandle)
+{
+  dprintf(("NTDLL: NtDeleteKey(%08xh) not implemented\n",
+           KeyHandle));
+
+  return (0);
+}
+
+
+/******************************************************************************
+ * NtDeleteValueKey [NTDLL]
+ * ZwDeleteValueKey
+ */
+NTSTATUS WINAPI NtDeleteValueKey(HANDLE          KeyHandle,
+                                 PUNICODE_STRING ValueName)
+{
+  dprintf(("NTDLL: NtDeleteValueKey(%08xh, %08xh) not implemented\n",
+           KeyHandle,
+           ValueName));
+
+  return(0);
+}
+
+
+/******************************************************************************
+ * NtEnumerateKey [NTDLL]
+ * ZwEnumerateKey
+ */
+NTSTATUS WINAPI NtEnumerateKey(HANDLE                KeyHandle,
+                               ULONG                 Index,
+                               KEY_INFORMATION_CLASS KeyInformationClass,
+                               PVOID                 KeyInformation,
+                               ULONG                 Length,
+                               PULONG                ResultLength)
+{
+  dprintf(("NTDLL: NtEnumerateKey(%08xh,%08xh,%08xh,%08xh,%08xh,%08xh) not implemented.\n",
+           KeyHandle,
+           Index,
+           KeyInformationClass,
+           KeyInformation,
+           Length,
+           ResultLength));
+
+  return 0;
+}
+
+
+/******************************************************************************
+ *  NtEnumerateValueKey                  [NTDLL]
+ *  ZwEnumerateValueKey
+ */
+NTSTATUS WINAPI NtEnumerateValueKey(HANDLE                      KeyHandle,
+                                    ULONG                       Index,
+                                    KEY_VALUE_INFORMATION_CLASS KeyInformationClass,
+                                    PVOID                       KeyInformation,
+                                    ULONG                       Length,
+                                    PULONG                      ResultLength)
+{
+  dprintf(("NTDLL: NtEnumerateValueKey(%08xh,%08xh,%08xh,%08xh,%08xh,%08xh) not implemented.\n",
+           KeyHandle,
+           Index,
+           KeyInformationClass,
+           KeyInformation,
+           Length,
+           ResultLength));
+
+  return 0;
+}
+
+
+/******************************************************************************
+ *  NtFlushKey [NTDLL]
+ *  ZwFlushKey
+ */
+NTSTATUS WINAPI NtFlushKey(HANDLE KeyHandle)
+{
+  dprintf(("NTDLL: NtFlushKey(%08xh)\n",
+           KeyHandle));
+
+  return ERROR_SUCCESS;
+}
+
+
+/******************************************************************************
+ *  NtLoadKey  [NTDLL]
+ *  ZwLoadKey
+ */
+NTSTATUS WINAPI NtLoadKey(PHANDLE            KeyHandle,
+                          POBJECT_ATTRIBUTES ObjectAttributes)
+{
+  dprintf(("NTDLL: NtLoadKey(%08xh,%08xh) not implemented.\n",
+           KeyHandle,
+           ObjectAttributes));
+
+  return 0;
+}
+
+
+/******************************************************************************
+ *  NtNotifyChangeKey                    [NTDLL]
+ *  ZwNotifyChangeKey
+ */
+NTSTATUS WINAPI NtNotifyChangeKey(HANDLE           KeyHandle,
+                                  HANDLE           Event,
+                                  PIO_APC_ROUTINE  ApcRoutine,
+                                  PVOID            ApcContext,
+                                  PIO_STATUS_BLOCK IoStatusBlock,
+                                  ULONG            CompletionFilter,
+                                  BOOLEAN          Asynchroneous,
+                                  PVOID            ChangeBuffer,
+                                  ULONG            Length,
+                                  BOOLEAN          WatchSubtree)
+{
+  dprintf(("NTDLL: NtNotifyChangeKey(%08xh,%08xh,%08xh,%08xh,%08xh,%08xh,%08xh,%08xh,%08xh,%08xh) not implemented.\n",
+           KeyHandle,
+           Event,
+           ApcRoutine,
+           ApcContext,
+           IoStatusBlock,
+           CompletionFilter,
+           Asynchronous,
+           ChangeBuffer,
+           Length,
+           WatchSubTree));
+
+  return 0;
+}
+
+
+/******************************************************************************
+ * NtOpenKey [NTDLL.129]
+ * ZwOpenKey
+ *   OUT PHANDLE                            KeyHandle,
+ *   IN     ACCESS_MASK                     DesiredAccess,
+ *   IN     POBJECT_ATTRIBUTES           ObjectAttributes
+ */
+NTSTATUS WINAPI NtOpenKey(PHANDLE            KeyHandle,
+                          ACCESS_MASK        DesiredAccess,
+                          POBJECT_ATTRIBUTES ObjectAttributes)
+{
+  dprintf(("NTDLL: NtOpenKey(%08xh,%08xh,%08xh) not implemented.\n",
+           KeyHandle,
+           DesiredAccess,
+           ObjectAttributes));
+  return 0;
+}
+
+
+/******************************************************************************
+ * NtQueryKey [NTDLL]
+ * ZwQueryKey
+ */
+NTSTATUS WINAPI NtQueryKey(HANDLE                KeyHandle,
+                           KEY_INFORMATION_CLASS KeyInformationClass,
+                           PVOID                 KeyInformation,
+                           ULONG                 Length,
+                           PULONG                ResultLength)
+{
+  dprintf(("NTDLL: NtQueryKey(%08xh,%08xh,%08xh,%08xh,%08xh) not implemented.\n",
+           KeyHandle,
+           KeyInformationClass,
+           KeyInformation,
+           Length,
+           ResultLength));
+
+  return 0;
+}
+
+
+/******************************************************************************
+ * NtQueryMultipleValueKey [NTDLL]
+ * ZwQueryMultipleValueKey
+ */
+
+NTSTATUS WINAPI NtQueryMultipleValueKey(HANDLE KeyHandle,
+                                        PVALENTW ListOfValuesToQuery,
+                                        ULONG NumberOfItems,
+                                        PVOID MultipleValueInformation,
+                                        ULONG Length,
+                                        PULONG  ReturnLength)
+{
+  dprintf(("NTDLL: NtQueryMultipleValueKey(%08xh,%08xh,%08xh,%08xh,%08xh,%08xh) not implemented.\n",
+           KeyHandle,
+           ListOfValuesToQuery,
+           NumberOfItems,
+           MultipleValueInformation,
+           Length,
+           ReturnLength));
+
+  return 0;
+}
+
+
+/******************************************************************************
+ * NtQueryValueKey [NTDLL]
+ * ZwQueryValueKey
+ */
+NTSTATUS WINAPI NtQueryValueKey(HANDLE                      KeyHandle,
+                                PUNICODE_STRING             ValueName,
+                                KEY_VALUE_INFORMATION_CLASS KeyValueInformationClass,
+                                PVOID                       KeyValueInformation,
+                                ULONG                       Length,
+                                PULONG                      ResultLength)
+{
+  dprintf(("NTDLL: NtQueryValueKey(%08xh,%08xh,%08xh,%08xh,%08xh,%08xh) not implemented.\n",
+           KeyHandle,
+           ValueName,
+           KeyValueInformationClass,
+           KeyValueInformation,
+           Length,
+           ResultLength));
+
+  return 0;
+}
+
+
+/******************************************************************************
+ * NtReplaceKey [NTDLL]
+ * ZwReplaceKey
+ */
+NTSTATUS WINAPI NtReplaceKey(POBJECT_ATTRIBUTES ObjectAttributes,
+                             HANDLE             Key,
+                             POBJECT_ATTRIBUTES ReplacedObjectAttributes)
+{
+  dprintf(("NTDLL: NtReplaceKey(%08xh,%08xh,%08xh) not implemented.\n",
+           ObjectAttributes,
+           Key,
+           ReplacedObjectAttributes));
+
+  return 0;
+}
+
+
+/******************************************************************************
+ * NtRestoreKey [NTDLL]
+ * ZwRestoreKey
+ */
+NTSTATUS WINAPI NtRestoreKey(HANDLE KeyHandle,
+                             HANDLE FileHandle,
+                             ULONG RestoreFlags)
+{
+  dprintf(("NTDLL: NtRestoreKey(%08xh,%08xh,%08xh) not implemented.\n",
+           KeyHandle,
+           FileHandle,
+           RestoreFlags));
+
+  return 0;
+}
+
+
+/******************************************************************************
+ * NtSaveKey [NTDLL]
+ * ZwSaveKey
+ */
+NTSTATUS WINAPI NtSaveKey(HANDLE KeyHandle,
+                          HANDLE FileHandle)
+{
+  dprintf(("NTDLL NtSaveKey(%08xh,%08xh) not implemented.\n",
+           KeyHandle,
+           FileHandle));
+
+  return 0;
+}
+
+
+/******************************************************************************
+ * NtSetInformationKey [NTDLL]
+ * ZwSetInformationKey
+ */
+NTSTATUS WINAPI NtSetInformationKey(HANDLE    KeyHandle,
+                                    const int KeyInformationClass,
+                                    PVOID     KeyInformation,
+                                    ULONG     KeyInformationLength)
+{
+  dprintf(("NTDLL: NtSetInformationKey(%08xh,%08xh,%08xh,%08xh) not implemented.\n",
+           KeyHandle,
+           KeyInformationClass,
+           KeyInformation,
+           KeyInformationLength));
+
+  return 0;
+}
+
+
+/******************************************************************************
+ * NtSetValueKey [NTDLL]
+ * ZwSetValueKey
+ */
+NTSTATUS WINAPI NtSetValueKey(HANDLE          KeyHandle,
+                              PUNICODE_STRING ValueName,
+                              ULONG           TitleIndex,
+                              ULONG           Type,
+                              PVOID           Data,
+                              ULONG           DataSize)
+{
+  dprintf(("NTDLL: NtSetValueKey(%08xh,%08xh,%08xh,%08xh,%08xh,%08xh) not implemented.\n",
+           KeyHandle,
+           ValueName,
+           TitleIndex,
+           Type,
+           Data,
+           DataSize));
+
+  return (0);
+}
+
+
+/******************************************************************************
+ * NtUnloadKey [NTDLL]
+ * ZwUnloadKey
+ */
+NTSTATUS WINAPI NtUnloadKey(HANDLE KeyHandle)
+{
+  dprintf(("NTDLL: NtUnloadKey(%08xh) not implemented.\n",
+           KeyHandle));
+
+  return 0;
+}
Index: trunk/src/NTDLL/rtl.c
===================================================================
--- trunk/src/NTDLL/rtl.c	(revision 33)
+++ trunk/src/NTDLL/rtl.c	(revision 33)
@@ -0,0 +1,667 @@
+/*
+ * Project Odin Software License can be found in LICENSE.TXT
+ * Win32 NT Runtime / NTDLL for OS/2
+ *
+ * Copyright 1998       original WINE Author
+ * Copyright 1998, 1999 Patrick Haller (phaller@gmx.net)
+ *
+ * NT basis DLL
+ *
+ * This file contains the Rtl* API functions. These should be implementable.
+ *
+ * Copyright 1996-1998 Marcus Meissner
+ *      1999 Alex Korobka
+ */
+
+#include <stdlib.h>
+#include <string.h>
+
+#include "ntdll.h"
+
+#include "winuser.h"
+#include "winerror.h"
+#include "winreg.h"
+
+
+
+/*
+ * resource functions
+ */
+
+/***********************************************************************
+ *           RtlInitializeResource       (NTDLL.409)
+ *
+ * xxxResource() functions implement multiple-reader-single-writer lock.
+ * The code is based on information published in WDJ January 1999 issue.
+ */
+void WINAPI RtlInitializeResource(LPRTL_RWLOCK rwl)
+{
+  dprintf(("NTDLL: RtlInitializeResource(%08xh)\n",
+           rwl));
+
+  if( rwl )
+  {
+    rwl->iNumberActive     = 0;
+    rwl->uExclusiveWaiters = 0;
+    rwl->uSharedWaiters    = 0;
+    rwl->hOwningThreadId   = 0;
+    rwl->dwTimeoutBoost    = 0; /* no info on this one, default value is 0 */
+    InitializeCriticalSection( &rwl->rtlCS );
+    rwl->hExclusiveReleaseSemaphore = CreateSemaphoreA( NULL, 0, 65535, NULL );
+    rwl->hSharedReleaseSemaphore    = CreateSemaphoreA( NULL, 0, 65535, NULL );
+  }
+}
+
+
+/***********************************************************************
+ *           RtlDeleteResource              (NTDLL.330)
+ */
+void WINAPI RtlDeleteResource(LPRTL_RWLOCK rwl)
+{
+  dprintf(("NTDLL: RtlDeleteResource(%08xh)\n",
+           rwl));
+
+  if( rwl )
+  {
+    EnterCriticalSection( &rwl->rtlCS );
+    if( rwl->iNumberActive || rwl->uExclusiveWaiters || rwl->uSharedWaiters )
+       dprintf(("NTDLL: RtlDeleteResource active MRSW lock (%p), expect failure\n",
+                rwl));
+
+    rwl->hOwningThreadId   = 0;
+    rwl->uExclusiveWaiters = rwl->uSharedWaiters = 0;
+    rwl->iNumberActive     = 0;
+    CloseHandle( rwl->hExclusiveReleaseSemaphore );
+    CloseHandle( rwl->hSharedReleaseSemaphore );
+    LeaveCriticalSection( &rwl->rtlCS );
+    DeleteCriticalSection( &rwl->rtlCS );
+  }
+}
+
+
+/***********************************************************************
+ *          RtlAcquireResourceExclusive  (NTDLL.256)
+ */
+BYTE WINAPI RtlAcquireResourceExclusive(LPRTL_RWLOCK rwl,
+                                        BYTE         fWait)
+{
+  BYTE retVal = 0;
+
+  if( !rwl )
+    return 0;
+
+  dprintf(("NTDLL: RtlAcquireResourceExclusive(%08xh,%08xh)\n",
+           rwl,
+           fWait));
+
+start:
+    EnterCriticalSection( &rwl->rtlCS );
+    if( rwl->iNumberActive == 0 ) /* lock is free */
+    {
+   rwl->iNumberActive = -1;
+   retVal = 1;
+    }
+    else if( rwl->iNumberActive < 0 ) /* exclusive lock in progress */
+    {
+    if( rwl->hOwningThreadId == GetCurrentThreadId() )
+    {
+        retVal = 1;
+        rwl->iNumberActive--;
+        goto done;
+    }
+wait:
+    if( fWait )
+    {
+        rwl->uExclusiveWaiters++;
+
+        LeaveCriticalSection( &rwl->rtlCS );
+        if( WaitForSingleObject( rwl->hExclusiveReleaseSemaphore, INFINITE ) == WAIT_FAILED )
+       goto done;
+        goto start; /* restart the acquisition to avoid deadlocks */
+    }
+    }
+    else  /* one or more shared locks are in progress */
+    if( fWait )
+        goto wait;
+
+    if( retVal == 1 )
+   rwl->hOwningThreadId = GetCurrentThreadId();
+done:
+    LeaveCriticalSection( &rwl->rtlCS );
+    return retVal;
+}
+
+/***********************************************************************
+ *          RtlAcquireResourceShared     (NTDLL.257)
+ */
+BYTE WINAPI RtlAcquireResourceShared(LPRTL_RWLOCK rwl,
+                                     BYTE         fWait)
+{
+  DWORD dwWait = WAIT_FAILED;
+  BYTE retVal = 0;
+
+  if( !rwl )
+    return 0;
+
+  dprintf(("NTDLL: RtlAcquireResourceShared(%08xh,%08xh)\n",
+           rwl,
+           fWait));
+
+start:
+    EnterCriticalSection( &rwl->rtlCS );
+    if( rwl->iNumberActive < 0 )
+    {
+   if( rwl->hOwningThreadId == GetCurrentThreadId() )
+   {
+       rwl->iNumberActive--;
+       retVal = 1;
+       goto done;
+   }
+
+   if( fWait )
+   {
+       rwl->uSharedWaiters++;
+       LeaveCriticalSection( &rwl->rtlCS );
+       if( (dwWait = WaitForSingleObject( rwl->hSharedReleaseSemaphore, INFINITE )) == WAIT_FAILED )
+      goto done;
+       goto start;
+   }
+    }
+    else
+    {
+   if( dwWait != WAIT_OBJECT_0 ) /* otherwise RtlReleaseResource() has already done it */
+       rwl->iNumberActive++;
+   retVal = 1;
+    }
+done:
+    LeaveCriticalSection( &rwl->rtlCS );
+    return retVal;
+}
+
+
+/***********************************************************************
+ *           RtlReleaseResource             (NTDLL.471)
+ */
+void WINAPI RtlReleaseResource(LPRTL_RWLOCK rwl)
+{
+  dprintf(("NTDLL: RtlReleaseResource(%08xh)\n",
+           rwl));
+
+    EnterCriticalSection( &rwl->rtlCS );
+
+    if( rwl->iNumberActive > 0 ) /* have one or more readers */
+    {
+   if( --rwl->iNumberActive == 0 )
+   {
+       if( rwl->uExclusiveWaiters )
+       {
+wake_exclusive:
+      rwl->uExclusiveWaiters--;
+      ReleaseSemaphore( rwl->hExclusiveReleaseSemaphore, 1, NULL );
+       }
+   }
+    }
+    else
+    if( rwl->iNumberActive < 0 ) /* have a writer, possibly recursive */
+    {
+   if( ++rwl->iNumberActive == 0 )
+   {
+       rwl->hOwningThreadId = 0;
+       if( rwl->uExclusiveWaiters )
+      goto wake_exclusive;
+       else
+      if( rwl->uSharedWaiters )
+      {
+          UINT n = rwl->uSharedWaiters;
+          rwl->iNumberActive = rwl->uSharedWaiters; /* prevent new writers from joining until
+                                                * all queued readers have done their thing */
+          rwl->uSharedWaiters = 0;
+          ReleaseSemaphore( rwl->hSharedReleaseSemaphore, n, NULL );
+      }
+   }
+    }
+    LeaveCriticalSection( &rwl->rtlCS );
+}
+
+
+/***********************************************************************
+ *           RtlDumpResource                (NTDLL.340)
+ */
+void WINAPI RtlDumpResource(LPRTL_RWLOCK rwl)
+{
+  dprintf(("NTDLL: RtlDumpResource(%08x)\n",
+           rwl));
+
+  if( rwl )
+  {
+    dprintf(("NTDLL: RtlDumpResource(%p):\n\tactive count = %i\n\twaiting readers = %i\n\twaiting writers = %i\n",
+             rwl,
+             rwl->iNumberActive,
+             rwl->uSharedWaiters,
+             rwl->uExclusiveWaiters));
+
+    if( rwl->iNumberActive )
+       dprintf(("NTDLL: \towner thread = %08x\n",
+                rwl->hOwningThreadId ));
+  }
+}
+
+
+/*
+ * heap functions
+ */
+
+/******************************************************************************
+ *  RtlCreateHeap                        [NTDLL]
+ */
+HANDLE WINAPI RtlCreateHeap(ULONG                Flags,
+                            PVOID                BaseAddress,
+                            ULONG                SizeToReserve,
+                            ULONG                SizeToCommit,
+                            PVOID                Unknown,
+                            PRTL_HEAP_DEFINITION Definition)
+{
+  dprintf(("NTDLL: RtlCreateHeap(%08xh,%08xh,%08xh,%08xh,%08xh,%08xh).\n",
+           Flags,
+           BaseAddress,
+           SizeToReserve,
+           SizeToCommit,
+           Unknown,
+           Definition));
+
+  return HeapCreate(Flags,
+                    SizeToCommit,
+                    SizeToReserve);
+}
+
+
+/******************************************************************************
+ *  RtlAllocateHeap                         [NTDLL]
+ */
+PVOID WINAPI RtlAllocateHeap(HANDLE Heap,
+                             ULONG  Flags,
+                             ULONG  Size)
+{
+  dprintf(("NTDLL: RtlAllocateHeap(%08xh,%08xh,%08xh).\n",
+           Heap,
+           Flags,
+           Size));
+
+  return HeapAlloc(Heap,
+                   Flags,
+                   Size);
+}
+
+
+/******************************************************************************
+ *  RtlFreeHeap                          [NTDLL]
+ */
+BOOLEAN WINAPI RtlFreeHeap(HANDLE Heap,
+                           ULONG Flags,
+                           PVOID Address)
+{
+  dprintf(("NTDLL: RtlFreeHeap(%08xh,%08xh,%08xh)\n",
+           Heap,
+           Flags,
+           Address));
+
+  return HeapFree(Heap, Flags, Address);
+}
+
+
+/******************************************************************************
+ *  RtlDestroyHeap                          [NTDLL]
+ *
+ * FIXME: prototype guessed
+ */
+BOOLEAN WINAPI RtlDestroyHeap(HANDLE Heap)
+{
+  dprintf(("NTDLL: RtlDestroyHeap(%08xh)\n",
+           Heap));
+
+  return HeapDestroy(Heap);
+}
+
+
+/*
+ * misc functions
+ */
+
+/******************************************************************************
+ * DbgPrint [NTDLL]
+ */
+/* @@@PH how to port ? */
+#if 0
+void __cdecl DbgPrint(LPCSTR fmt,LPVOID args)
+{
+  dprintf(("NTDLL: DbgPrint(%s,08xh) not supported.\n",
+           fmt,
+           args));
+
+   /* hmm, raise exception? */
+}
+
+DWORD WINAPI NtRaiseException (DWORD           dwExceptionCode,
+                               DWORD           dwExceptionFlags,
+                               DWORD           nNumberOfArguments,
+                               CONST ULONG_PTR *lpArguments)
+{
+  dprintf(("NTDLL: NtRaiseException(%08xh,%08xh,%08xh,%08xh) not implemented.\n",
+           dwExceptionCode,
+           dwExceptionFlags,
+           nNumberOfArguments,
+           lpArguments));
+
+  return 0;
+}
+
+
+DWORD WINAPI RtlRaiseException (DWORD x)
+{
+  dprintf(("NTDLL: RtlRaiseException(%08xh) not implemented.\n",
+           x));
+
+  return 0;
+}
+#endif
+
+
+/******************************************************************************
+ *  RtlAcquirePebLock                       [NTDLL]
+ */
+VOID WINAPI RtlAcquirePebLock(void)
+{
+  dprintf(("NTDLL: RtlAcquirePebLock() not implemented.\n"));
+
+  /* enter critical section ? */
+}
+
+
+/******************************************************************************
+ *  RtlReleasePebLock                       [NTDLL]
+ */
+VOID WINAPI RtlReleasePebLock(void)
+{
+  dprintf(("NTDLL: RtlReleasePebLock() not implemented.\n"));
+
+  /* leave critical section ? */
+}
+
+
+/******************************************************************************
+ *  RtlIntegerToChar                     [NTDLL]
+ */
+DWORD WINAPI RtlIntegerToChar(DWORD x1,
+                              DWORD x2,
+                              DWORD x3,
+                              DWORD x4)
+{
+  dprintf(("NTDLL: RtlIntegerToChar(%08xh,%08xh,%08xh,%08xh) not implemented.\n";
+           x1,
+           x2,
+           x3,
+           x4));
+
+  return 0;
+}
+
+
+/******************************************************************************
+ *  RtlSetEnvironmentVariable               [NTDLL]
+ */
+DWORD WINAPI RtlSetEnvironmentVariable(DWORD           x1,
+                                       PUNICODE_STRING key,
+                                       PUNICODE_STRING val)
+{
+  dprintf(("NTDLL: RtlSetEnvironmentVariable(%08xh,%08xh,%08xh) not implemented.\n",
+           x1,
+           key,
+           val));
+
+  return 0;
+}
+
+
+/******************************************************************************
+ *  RtlNewSecurityObject                    [NTDLL]
+ */
+DWORD WINAPI RtlNewSecurityObject(DWORD x1,
+                                  DWORD x2,
+                                  DWORD x3,
+                                  DWORD x4,
+                                  DWORD x5,
+                                  DWORD x6)
+{
+  dprintf(("NTDLL: RtlNewSecurityObject(%08xh,%08xh,%08xh,%08xh,%08xh,%08xh) not implemented.\n";
+           x1,
+           x2,
+           x3,
+           x4,
+           x5,
+           x6));
+
+  return 0;
+}
+
+
+/******************************************************************************
+ *  RtlDeleteSecurityObject                 [NTDLL]
+ */
+DWORD WINAPI RtlDeleteSecurityObject(DWORD x1)
+{
+  dprintf(("NTDLL: RtlDeleteSecurityObject(%08xh) not implemented.\n",
+           x1));
+
+  return 0;
+}
+
+
+/**************************************************************************
+ *                 RtlNormalizeProcessParams      [NTDLL.441]
+ */
+LPVOID WINAPI RtlNormalizeProcessParams(LPVOID x)
+{
+  dprintf(("NTDLL: RtlNormalizeProcessParams(%08xh) not implemented.\n",
+           x));
+
+  return x;
+}
+
+
+/**************************************************************************
+ *                 RtlNtStatusToDosError       [NTDLL.442]
+ */
+DWORD WINAPI RtlNtStatusToDosError(DWORD error)
+{
+  dprintf(("NTDLL: RtlNtStatusToDosError(%08xh) partially implemented.\n",
+           error));
+
+  switch (error)
+  {
+    case STATUS_SUCCESS:                return ERROR_SUCCESS;
+    case STATUS_INVALID_PARAMETER:      return ERROR_BAD_ARGUMENTS;
+    case STATUS_BUFFER_TOO_SMALL:       return ERROR_INSUFFICIENT_BUFFER;
+/*   case STATUS_INVALID_SECURITY_DESCR: return ERROR_INVALID_SECURITY_DESCR;*/
+    case STATUS_NO_MEMORY:              return ERROR_NOT_ENOUGH_MEMORY;
+/*   case STATUS_UNKNOWN_REVISION:
+     case STATUS_BUFFER_OVERFLOW:*/
+  }
+
+  dprintf(("NTDLL: RtlNtStatusToDosError(%08xh is unknown !)\n",
+           error));
+
+  return ERROR_SUCCESS;
+}
+
+
+/**************************************************************************
+ *                 RtlGetNtProductType         [NTDLL.390]
+ */
+BOOLEAN WINAPI RtlGetNtProductType(LPDWORD type)
+{
+  dprintf(("NTDLL: RtlGetNtProductType(%08xh) not correctly implemented.\n",
+           type));
+
+  *type=3; /* dunno. 1 for client, 3 for server? */
+  return 1;
+}
+
+
+/**************************************************************************
+ *                 NTDLL_chkstk                   [NTDLL.862]
+ *                 NTDLL_alloca_probe             [NTDLL.861]
+ * Glorified "enter xxxx".
+ */
+/* @@@PH how to port this to VAC ?
+REGS_ENTRYPOINT(NTDLL_chkstk)
+{
+    ESP_reg(context) -= EAX_reg(context);
+}
+
+REGS_ENTRYPOINT(NTDLL_alloca_probe)
+{
+    ESP_reg(context) -= EAX_reg(context);
+}
+*/
+
+/******************************************************************************
+ * RtlExtendedLargeIntegerDivide [NTDLL.359]
+ */
+INT WINAPI RtlExtendedLargeIntegerDivide(LARGE_INTEGER dividend,
+                                         DWORD         divisor,
+                                         LPDWORD       rest)
+{
+#if SIZEOF_LONG_LONG==8
+   long long x1 = *(long long*)&dividend;
+
+   if (*rest)
+      *rest = x1 % divisor;
+   return x1/divisor;
+#else
+  dprintf(("NTDLL: RtlExtendedLargeIntegerDevice(%08xh,%08xh,%08xh) not implemented.\n",
+           dividend,
+           divisor,
+           rest));
+
+  return 0;
+#endif
+}
+
+/******************************************************************************
+ * RtlExtendedLargeIntegerMultiply [NTDLL.359]
+ * Note: This even works, since gcc returns 64bit values in eax/edx just like
+ * the caller expects. However... The relay code won't grok this I think.
+ */
+#if 0
+/* longlong in VAC++ ? */
+long long WINAPI RtlExtendedIntegerMultiply(LARGE_INTEGER factor1,
+                                            INT factor2)
+{
+#if SIZEOF_LONG_LONG==8
+   return (*(long long*)&factor1) * factor2;
+#else
+  dprintf(("NTDLL: RtlExtendedLargeIntegerMultiply(%08xh,%08xh) not implemented.\n",
+           factor1,
+           factor2));
+
+  return 0;
+#endif
+}
+#endif
+/******************************************************************************
+ *  RtlFormatCurrentUserKeyPath             [NTDLL.371]
+ */
+DWORD WINAPI RtlFormatCurrentUserKeyPath(DWORD x)
+{
+  dprintf(("NTDLL: RtlFormatCurrentUserKeyPath(%08xh) not implemented.\n",
+           x));
+
+  return 1;
+}
+
+
+/******************************************************************************
+ *  RtlOpenCurrentUser                      [NTDLL]
+ */
+DWORD WINAPI RtlOpenCurrentUser(DWORD x1,
+                                DWORD *x2)
+{
+  /* Note: this is not the correct solution,
+   * But this works pretty good on wine and NT4.0 binaries
+   */
+  if (x1 == 0x2000000 )
+  {
+    *x2 = HKEY_CURRENT_USER;
+    return TRUE;
+  }
+
+  return FALSE;
+}
+
+
+/**************************************************************************
+ *                 RtlDosPathNameToNtPathName_U      [NTDLL.338]
+ *
+ * FIXME: convert to UNC or whatever is expected here
+ */
+BOOLEAN  WINAPI RtlDosPathNameToNtPathName_U(LPWSTR          from,
+                                             PUNICODE_STRING us,
+                                             DWORD           x2,
+                                             DWORD           x3)
+{
+  LPSTR fromA = HEAP_strdupWtoA(GetProcessHeap(),0,from);
+
+  dprintf(("NTDLL: RtlDosPathNameToNtPathName_U(%08xh,%08h,%08xh,%08xh) not implemented.\n",
+           from,
+           us,
+           x2,
+           x3));
+
+  if (us)
+    RtlInitUnicodeString(us,HEAP_strdupW(GetProcessHeap(),0,from));
+
+  return TRUE;
+}
+
+
+/******************************************************************************
+ *  RtlCreateEnvironment                    [NTDLL]
+ */
+DWORD WINAPI RtlCreateEnvironment(DWORD x1,
+                                  DWORD x2)
+{
+  dprintf(("NTDLL: RtlCreateEnvironment(%08xh, %08xh) not implemented.\n",
+           x1,
+           x2));
+
+  return 0;
+}
+
+
+/******************************************************************************
+ *  RtlDestroyEnvironment                   [NTDLL]
+ */
+DWORD WINAPI RtlDestroyEnvironment(DWORD x)
+{
+  dprintf(("NTDLL: RtlDestroyEnvironment(%08xh) not implemented.\n",
+           x));
+
+  return 0;
+}
+
+
+/******************************************************************************
+ *  RtlQueryEnvironmentVariable_U           [NTDLL]
+ */
+DWORD WINAPI RtlQueryEnvironmentVariable_U(DWORD           x1,
+                                           PUNICODE_STRING key,
+                                           PUNICODE_STRING val)
+{
+  dprintf(("NTDLL: RtlQueryEnvironmentVariable_U(%08xh,%08xh,%08xh) not implemented.\n",
+           x1,
+           key,
+           val));
+
+  return 0;
+}
+
Index: trunk/src/NTDLL/rtlstr.c
===================================================================
--- trunk/src/NTDLL/rtlstr.c	(revision 33)
+++ trunk/src/NTDLL/rtlstr.c	(revision 33)
@@ -0,0 +1,541 @@
+/*
+ * Project Odin Software License can be found in LICENSE.TXT
+ * Win32 NT Runtime / NTDLL for OS/2
+ *
+ * Copyright 1998       original WINE Author
+ * Copyright 1998, 1999 Patrick Haller (phaller@gmx.net)
+ *
+ * Rtl string functions
+ *
+ * Copyright 1996-1998 Marcus Meissner
+ */
+
+#include "config.h"
+
+#include <stdlib.h>
+#include <string.h>
+#include <ctype.h>
+
+#include "ntdll.h"
+#include "windef.h"
+
+#ifdef HAVE_WCTYPE_H
+# include <wctype.h>
+#endif
+#include "wine/winestring.h"
+#include "winnls.h"
+
+
+
+/*
+ * STRING FUNCTIONS
+ */
+
+/**************************************************************************
+ *                 RtlAnsiStringToUnicodeString      [NTDLL.269]
+ */
+DWORD WINAPI RtlAnsiStringToUnicodeString(PUNICODE_STRING uni,
+                                             PANSI_STRING    ansi,
+                                             BOOLEAN         doalloc)
+{
+  DWORD unilen = (ansi->Length+1)*sizeof(WCHAR);
+
+  dprintf(("NTDLL: RtlAnsiStringToUnicodeString(%08xh,%08xh,%08xh)\n",
+           uni,
+           ansi,
+           doalloc));
+
+  if (unilen>0xFFFF)
+    return STATUS_INVALID_PARAMETER_2;
+
+  uni->Length = unilen;
+  if (doalloc)
+  {
+    uni->MaximumLength = unilen;
+    uni->Buffer = HeapAlloc(GetProcessHeap(),HEAP_ZERO_MEMORY,unilen);
+    if (!uni->Buffer)
+      return STATUS_NO_MEMORY;
+  }
+
+  if (unilen>uni->MaximumLength)
+    return STATUS_BUFFER_OVERFLOW;
+
+  lstrcpynAtoW(uni->Buffer,ansi->Buffer,unilen/2);
+
+  return STATUS_SUCCESS;
+}
+
+
+/**************************************************************************
+ *                 RtlOemStringToUnicodeString    [NTDLL.447]
+ */
+DWORD WINAPI RtlOemStringToUnicodeString(PUNICODE_STRING uni,
+                                            PSTRING         ansi,
+                                            BOOLEAN         doalloc)
+{
+  DWORD unilen = (ansi->Length+1)*sizeof(WCHAR);
+
+  dprintf(("NTDLL: RtlOemStringToUnicodeString(%08xh,%08xh,%08xh)\n",
+           uni,
+           ansi,
+           doalloc));
+
+  if (unilen>0xFFFF)
+    return STATUS_INVALID_PARAMETER_2;
+
+  uni->Length = unilen;
+  if (doalloc)
+  {
+    uni->MaximumLength = unilen;
+    uni->Buffer = HeapAlloc(GetProcessHeap(),
+                            HEAP_ZERO_MEMORY,
+                            unilen);
+
+    if (!uni->Buffer)
+      return STATUS_NO_MEMORY;
+  }
+
+  if (unilen>uni->MaximumLength)
+    return STATUS_BUFFER_OVERFLOW;
+
+  lstrcpynAtoW(uni->Buffer,
+               ansi->Buffer,
+               unilen/2);
+  return STATUS_SUCCESS;
+}
+
+
+/**************************************************************************
+ *                 RtlMultiByteToUnicodeN      [NTDLL.436]
+ * FIXME: multibyte support
+ */
+DWORD WINAPI RtlMultiByteToUnicodeN(LPWSTR  unistr,
+                                       DWORD   unilen,
+                                       LPDWORD reslen,
+                                       LPSTR   oemstr,
+                                       DWORD   oemlen)
+{
+  DWORD len;
+  LPWSTR x;
+
+  dprintf(("NTDLL: RtlMultiByteToUnicodeN(%08xh,%08xh,%08xh,%08xh,%08xh)\n",
+           unistr,
+           unilen,
+           reslen,
+           oemstr,
+           oemlen));
+
+  len = oemlen;
+
+  if (unilen/2 < len)
+     len = unilen/2;
+
+  x=(LPWSTR)HeapAlloc(GetProcessHeap(),
+                      HEAP_ZERO_MEMORY,
+                      (len+1)*sizeof(WCHAR));
+
+  lstrcpynAtoW(x,
+               oemstr,
+               len+1);
+
+  memcpy(unistr,
+         x,
+         len*2);
+
+  if (reslen)
+    *reslen = len*2;
+
+  return 0;
+}
+
+
+/**************************************************************************
+ *                 RtlOemToUnicodeN            [NTDLL.448]
+ */
+DWORD WINAPI RtlOemToUnicodeN(LPWSTR  unistr,
+                                 DWORD   unilen,
+                                 LPDWORD reslen,
+                                 LPSTR   oemstr,
+                                 DWORD   oemlen)
+{
+  DWORD len;
+  LPWSTR x;
+
+  dprintf(("NTDLL: RtlOemToUnicodeN(%08xh,%08xh,%08xh,%08xh,%08xh)\n",
+           unistr,
+           unilen,
+           reslen,
+           oemstr,
+           oemlen));
+
+  len = oemlen;
+
+  if (unilen/2 < len)
+    len = unilen/2;
+
+  x=(LPWSTR)HeapAlloc(GetProcessHeap(),
+                      HEAP_ZERO_MEMORY,
+                      (len+1)*sizeof(WCHAR));
+
+  lstrcpynAtoW(x,
+               oemstr,
+               len+1);
+
+  memcpy(unistr,
+         x,
+         len*2);
+
+  if (reslen)
+    *reslen = len*2;
+
+  return 0;
+}
+
+
+/**************************************************************************
+ *                 RtlInitAnsiString           [NTDLL.399]
+ */
+VOID WINAPI RtlInitAnsiString(PANSI_STRING target,
+                              LPCSTR       source)
+{
+  dprintf(("NTDLL: RtlInitAnsiString(%08xh, %08xh)\n",
+           target,
+           source));
+
+  target->Length        = target->MaximumLength = 0;
+  target->Buffer        = (LPSTR)source;
+  if (!source)
+     return;
+
+  target->MaximumLength = lstrlenA(target->Buffer);
+  target->Length        = target->MaximumLength+1;
+}
+
+
+/**************************************************************************
+ *                 RtlInitString               [NTDLL.402]
+ */
+VOID WINAPI RtlInitString(PSTRING target,
+                          LPCSTR  source)
+{
+  dprintf (("NTDLL: RtlInitString(%08xh, %08xh)\n",
+            target,
+            source));
+
+  target->Length        = target->MaximumLength = 0;
+  target->Buffer        = (LPSTR)source;
+  if (!source)
+     return;
+
+  target->MaximumLength = lstrlenA(target->Buffer);
+  target->Length        = target->MaximumLength+1;
+}
+
+
+/**************************************************************************
+ *                 RtlInitUnicodeString        [NTDLL.403]
+ */
+VOID WINAPI RtlInitUnicodeString(PUNICODE_STRING target,
+                                 LPCWSTR         source)
+{
+  dprintf(("NTDLL: RtlInitUnicodeString(%08xh,%08xh)\n",
+           target,
+           source));
+
+   target->Length = target->MaximumLength = 0;
+   target->Buffer = (LPWSTR)source;
+   if (!source)
+      return;
+
+   target->MaximumLength = lstrlenW(target->Buffer)*2;
+   target->Length        = target->MaximumLength+2;
+}
+
+
+/**************************************************************************
+ *                 RtlFreeUnicodeString        [NTDLL.377]
+ */
+VOID WINAPI RtlFreeUnicodeString(PUNICODE_STRING str)
+{
+  dprintf(("NTDLL: RtlFreeUnicodeString(%08xh)\n",
+           str));
+
+  if (str->Buffer)
+    HeapFree(GetProcessHeap(),
+             0,
+             str->Buffer);
+}
+
+
+/**************************************************************************
+ * RtlFreeAnsiString [NTDLL.373]
+ */
+VOID WINAPI RtlFreeAnsiString(PANSI_STRING AnsiString)
+{
+  dprintf(("NTDLL: RtlFreeAnsiString(%08xh)\n",
+           AnsiString));
+
+  if( AnsiString->Buffer )
+      HeapFree(GetProcessHeap(),
+               0,
+               AnsiString->Buffer);
+}
+
+
+/**************************************************************************
+ *                 RtlUnicodeToOemN            [NTDLL.515]
+ */
+DWORD WINAPI RtlUnicodeToOemN(LPSTR   oemstr,
+                                 DWORD   oemlen,
+                                 LPDWORD reslen,
+                                 LPWSTR  unistr,
+                                 DWORD   unilen)
+{
+  DWORD len;
+  LPSTR x;
+
+  dprintf(("NTDLL: RtlUnicodeToOemN(%08xh,%08xh,%08xh,%08xh,%08xh)\n",
+           oemstr,
+           oemlen,
+           reslen,
+           unistr,
+           unilen));
+
+  len = oemlen;
+
+  if (unilen/2 < len)
+    len = unilen/2;
+
+  x=(LPSTR)HeapAlloc(GetProcessHeap(),
+                     HEAP_ZERO_MEMORY,
+                     len+1);
+
+  lstrcpynWtoA(x,
+               unistr,
+               len+1);
+
+  memcpy(oemstr,
+         x,
+         len);
+
+  if (reslen)
+    *reslen = len;
+
+  return 0;
+}
+
+
+/**************************************************************************
+ *                 RtlUnicodeStringToOemString    [NTDLL.511]
+ */
+DWORD WINAPI RtlUnicodeStringToOemString(PANSI_STRING    oem,
+                                            PUNICODE_STRING uni,
+                                            BOOLEAN         alloc)
+{
+  dprintf(("NTDLL: RtlUnicodeStringToOemString(%08xh,%08xh,%08xh)\n",
+           oem,
+           uni,
+           alloc));
+
+  if (alloc)
+  {
+    oem->Buffer = (LPSTR)HeapAlloc(GetProcessHeap(),
+                                   HEAP_ZERO_MEMORY,
+                                   uni->Length/2)+1;
+    oem->MaximumLength = uni->Length/2+1;
+  }
+
+  oem->Length = uni->Length/2;
+  lstrcpynWtoA(oem->Buffer,
+               uni->Buffer,
+               uni->Length/2+1);
+  return 0;
+}
+
+/**************************************************************************
+ *                 RtlUnicodeStringToAnsiString      [NTDLL.507]
+ */
+DWORD WINAPI RtlUnicodeStringToAnsiString(PANSI_STRING    oem,
+                                             PUNICODE_STRING uni,
+                                             BOOLEAN         alloc)
+{
+  dprintf(("NTDLL: RtlUnicodeStringToAnsiString(%08xh,%08xh,%08xh)\n",
+           oem,
+           uni,
+           alloc));
+
+  if (alloc)
+  {
+     oem->Buffer = (LPSTR)HeapAlloc(GetProcessHeap(),
+                                    HEAP_ZERO_MEMORY,
+                                    uni->Length/2)+1;
+     oem->MaximumLength = uni->Length/2+1;
+  }
+
+  oem->Length = uni->Length/2;
+  lstrcpynWtoA(oem->Buffer,
+               uni->Buffer,
+               uni->Length/2+1);
+
+  return 0;
+}
+
+/**************************************************************************
+ *                 RtlEqualUnicodeString    [NTDLL]
+ */
+DWORD WINAPI RtlEqualUnicodeString(PUNICODE_STRING s1,
+                                   PUNICODE_STRING s2,
+                                   DWORD           x)
+{
+  dprintf(("NTDLL: RtlEqualUnicodeString(%08xh,%08xh,%08xh)\n",
+           s1,
+           s2,
+           x));
+
+  if (s1->Length != s2->Length)
+    return 1;
+
+  return !lstrncmpW(s1->Buffer,
+                    s2->Buffer,
+                    s1->Length/2);
+}
+
+
+/**************************************************************************
+ *                 RtlUpcaseUnicodeString      [NTDLL.520]
+ */
+DWORD WINAPI RtlUpcaseUnicodeString(PUNICODE_STRING dest,
+                                    PUNICODE_STRING src,
+                                    BOOLEAN         doalloc)
+{
+  LPWSTR s,t;
+  DWORD  i,len;
+
+  dprintf(("NTDLL: RtlUpcaseUnicodeString(%08xh,%08xh,%08xh)\n",
+           dest,
+           src,
+           doalloc));
+
+  len = src->Length;
+  if (doalloc)
+  {
+    dest->MaximumLength = len;
+    dest->Buffer = (LPWSTR)HeapAlloc(GetProcessHeap(),
+                                     HEAP_ZERO_MEMORY,
+                                     len);
+    if (!dest->Buffer)
+      return STATUS_NO_MEMORY;
+   }
+
+  if (dest->MaximumLength < len)
+    return STATUS_BUFFER_OVERFLOW;
+
+  s=dest->Buffer;
+  t=src->Buffer;
+
+  /* len is in bytes */
+  for (i = 0;
+       i < len/2;
+       i++)
+    s[i] = towupper(t[i]);
+
+  return STATUS_SUCCESS;
+}
+
+
+/**************************************************************************
+ *                 RtlxOemStringToUnicodeSize     [NTDLL.549]
+ */
+UINT WINAPI RtlxOemStringToUnicodeSize(PSTRING str)
+{
+  dprintf(("NTDLL: RtlxOemStringToUnicodeSize(%08xh)\n",
+           str));
+
+  return str->Length*2+2;
+}
+
+
+/**************************************************************************
+ *                 RtlxAnsiStringToUnicodeSize    [NTDLL.548]
+ */
+UINT WINAPI RtlxAnsiStringToUnicodeSize(PANSI_STRING str)
+{
+  dprintf(("NTDLL: RtlxAnsiStringToUnicodeSize(%08xh)\n",
+           str));
+
+  return str->Length*2+2;
+}
+
+
+/**************************************************************************
+ *                 RtlIsTextUnicode            [NTDLL.417]
+ *
+ * Apply various feeble heuristics to guess whether
+ * the text buffer contains Unicode.
+ * FIXME: should implement more tests.
+ */
+DWORD WINAPI RtlIsTextUnicode(LPVOID buf,
+                              DWORD  len,
+                              DWORD  *pf)
+{
+  LPWSTR s = buf;
+  DWORD  flags = -1,
+         out_flags = 0;
+
+  dprintf(("NTDLL: RtlIsTextUnicode(%08xh,%08xh,%08xh)\n",
+           buf,
+           len,
+           pf));
+
+  if (!len)
+    goto out;
+
+  if (pf)
+    flags = *pf;
+
+  /*
+   * Apply various tests to the text string. According to the
+   * docs, each test "passed" sets the corresponding flag in
+   * the output flags. But some of the tests are mutually
+   * exclusive, so I don't see how you could pass all tests ...
+   */
+
+  /* Check for an odd length ... pass if even. */
+  if (!(len & 1))
+    out_flags |= IS_TEXT_UNICODE_ODD_LENGTH;
+
+  /* Check for the special unicode marker byte. */
+  if (*s == 0xFEFF)
+    out_flags |= IS_TEXT_UNICODE_SIGNATURE;
+
+  /*
+   * Check whether the string passed all of the tests.
+   */
+  flags &= ITU_IMPLEMENTED_TESTS;
+  if ((out_flags & flags) != flags)
+    len = 0;
+
+out:
+  if (pf)
+    *pf = out_flags;
+
+  return len;
+}
+
+
+/******************************************************************************
+ * RtlCompareUnicodeString               [NTDLL]
+ */
+DWORD WINAPI RtlCompareUnicodeString(PUNICODE_STRING String1,
+                                        PUNICODE_STRING String2,
+                                        BOOLEAN         CaseInSensitive)
+{
+  dprintf(("NTDLL: RtlCompareUnicodeString(%08xh,%08xh,%08xh) not implemented.\n",
+           String1,
+           String2,
+           CaseInSensitive));
+
+  return 0;
+}
+
+
Index: trunk/src/NTDLL/sec.c
===================================================================
--- trunk/src/NTDLL/sec.c	(revision 33)
+++ trunk/src/NTDLL/sec.c	(revision 33)
@@ -0,0 +1,712 @@
+/*
+ * Project Odin Software License can be found in LICENSE.TXT
+ * Win32 NT Runtime / NTDLL for OS/2
+ *
+ * Copyright 1998       original WINE Author
+ * Copyright 1998, 1999 Patrick Haller (phaller@gmx.net)
+ *
+ * Security functions
+ *
+ * Copyright 1996-1998 Marcus Meissner
+ */
+
+#include <stdlib.h>
+#include <string.h>
+#include <time.h>
+#include <ctype.h>
+#include <math.h>
+
+#include <os2win.h>
+#include "ntdll.h"
+
+/*
+#include "windef.h"
+#include "winbase.h"
+#include "winuser.h"
+#include "wine/winestring.h"
+#include "heap.h"
+#include "winnls.h"
+#include "winuser.h"
+#include "winerror.h"
+#include "stackframe.h"
+
+#include "winreg.h"
+*/
+
+/*
+ * SID FUNCTIONS
+ */
+
+/******************************************************************************
+ *  RtlAllocateAndInitializeSid             [NTDLL.265]
+ *
+ */
+BOOLEAN WINAPI RtlAllocateAndInitializeSid (PSID_IDENTIFIER_AUTHORITY pIdentifierAuthority,
+                                            DWORD                     nSubAuthorityCount,
+                                            DWORD                     x3,
+                                            DWORD                     x4,
+                                            DWORD                     x5,
+                                            DWORD                     x6,
+                                            DWORD                     x7,
+                                            DWORD                     x8,
+                                            DWORD                     x9,
+                                            DWORD                     x10,
+                                            PSID                      pSid)
+{
+  dprintf(("NTDLL: RtlAllocateAndInitializeSid(%08xh,%08xh,%08xh,"
+           "%08xh,%08xh,%08xh,%08xh,%08xh,%08xh,%08xh,%08xh) not implemented.\n",
+           pIdentifierAuthority,
+           nSubAuthorityCount,
+           x3,
+           x4,
+           x5,
+           x6,
+           x7,
+           x8,
+           x9,
+           x10,
+           pSid));
+
+  return 0;
+}
+
+
+/******************************************************************************
+ *  RtlEqualSid                          [NTDLL.352]
+ *
+ */
+DWORD WINAPI RtlEqualSid(DWORD x1,
+                         DWORD x2)
+{
+  dprintf(("NTDLL: RtlEqualSid(%08x, %08x) not implemented.\n",
+           x1,
+           x2));
+
+  return TRUE;
+}
+
+
+/******************************************************************************
+ *  RtlFreeSid    [NTDLL.376]
+ */
+DWORD WINAPI RtlFreeSid(DWORD x1)
+{
+  dprintf(("NTDLL: RtlFreeSid(%08xh) not implemented.\n",
+           x1));
+
+  return TRUE;
+}
+
+
+/**************************************************************************
+ *                 RtlLengthRequiredSid        [NTDLL.427]
+ */
+DWORD WINAPI RtlLengthRequiredSid(DWORD nrofsubauths)
+{
+  dprintf (("NTDLL: RtlLengthRequiredSid(%08xh)\n",
+            nrofsubauths));
+
+  return sizeof(DWORD)*nrofsubauths+sizeof(SID);
+}
+
+
+/**************************************************************************
+ *                 RtlLengthSid                   [NTDLL.429]
+ */
+DWORD WINAPI RtlLengthSid(PSID sid)
+{
+  dprintf(("NTDLL: RtlLengthSid(%08xh)\n",
+           sid));
+
+  if (!sid)
+    return FALSE;
+
+  return sizeof(DWORD)*sid->SubAuthorityCount+sizeof(SID);
+}
+
+
+/**************************************************************************
+ *                 RtlInitializeSid            [NTDLL.410]
+ */
+DWORD WINAPI RtlInitializeSid(PSID                      psid,
+                              PSID_IDENTIFIER_AUTHORITY psidauth,
+                              DWORD                     c)
+{
+  BYTE  a = c & 0xff;
+
+  dprintf(("NTDLL: RtlInitializeSid(%08xh,%08xh,%08xh)\n",
+           psid,
+           psidauth,
+           c));
+
+  if (a>=SID_MAX_SUB_AUTHORITIES)
+    return a;
+
+  psid->SubAuthorityCount = a;
+  psid->Revision          = SID_REVISION;
+  memcpy(&(psid->IdentifierAuthority),
+         psidauth,
+         sizeof(SID_IDENTIFIER_AUTHORITY));
+
+  return STATUS_SUCCESS;
+}
+
+
+/**************************************************************************
+ *                 RtlSubAuthoritySid          [NTDLL.497]
+ */
+LPDWORD WINAPI RtlSubAuthoritySid(PSID  psid,
+                                  DWORD nr)
+{
+  dprintf(("NTDLL: RtlSubAuthoritySid(%08xh,%08xh)\n",
+           psid,
+           nr));
+
+  return &(psid->SubAuthority[nr]);
+}
+
+
+/**************************************************************************
+ *                 RtlSubAuthorityCountSid     [NTDLL.496]
+ */
+
+LPBYTE WINAPI RtlSubAuthorityCountSid(PSID psid)
+{
+  dprintf(("NTDLL: RtlSubAUthorityCountSid(%08xh)\n",
+           psid));
+
+  return ((LPBYTE)psid)+1;
+}
+
+
+/**************************************************************************
+ *                 RtlCopySid                     [NTDLL.302]
+ */
+DWORD WINAPI RtlCopySid(DWORD len,
+                        PSID  to,
+                        PSID  from)
+{
+  dprintf(("NTDLL: RtlCopySid(%08xh,%08xh,%08xh)\n",
+           len,
+           to,
+           from));
+
+  if (!from)
+    return 0;
+
+  if (len<(from->SubAuthorityCount*4+8))
+     return STATUS_BUFFER_TOO_SMALL;
+
+  memmove(to,
+          from,
+          from->SubAuthorityCount*4+8);
+
+  return STATUS_SUCCESS;
+}
+
+
+/*
+ * security descriptor functions
+ */
+
+/**************************************************************************
+ * RtlCreateSecurityDescriptor                 [NTDLL.313]
+ *
+ * RETURNS:
+ *  0 success,
+ *  STATUS_INVALID_OWNER, STATUS_PRIVILEGE_NOT_HELD, STATUS_NO_INHERITANCE,
+ *  STATUS_NO_MEMORY
+ */
+NTSTATUS WINAPI RtlCreateSecurityDescriptor(PSECURITY_DESCRIPTOR lpsd,
+                                            DWORD                rev)
+{
+  dprintf(("NTDLL: RtlCreateSecurityDescriptor(%08xh,%08xh)\n",
+           lpsd,
+           rev));
+
+  if (rev!=SECURITY_DESCRIPTOR_REVISION)
+    return STATUS_UNKNOWN_REVISION;
+
+  memset(lpsd,
+         '\0',
+         sizeof(*lpsd));
+
+  lpsd->Revision = SECURITY_DESCRIPTOR_REVISION;
+
+  return STATUS_SUCCESS;
+}
+
+
+/**************************************************************************
+ * RtlValidSecurityDescriptor                  [NTDLL.313]
+ *
+ */
+NTSTATUS WINAPI RtlValidSecurityDescriptor(PSECURITY_DESCRIPTOR SecurityDescriptor)
+{
+  dprintf(("NTDLL: RtlValidSecurityDescriptor(%08xh)\n",
+           SecurityDescriptor));
+
+  if ( ! SecurityDescriptor )
+    return STATUS_INVALID_SECURITY_DESCR;
+
+  if ( SecurityDescriptor->Revision != SECURITY_DESCRIPTOR_REVISION )
+    return STATUS_UNKNOWN_REVISION;
+
+  return STATUS_SUCCESS;
+}
+
+
+/**************************************************************************
+ *  RtlLengthSecurityDescriptor                [NTDLL]
+ */
+ULONG WINAPI RtlLengthSecurityDescriptor(PSECURITY_DESCRIPTOR SecurityDescriptor)
+{
+  ULONG Size;
+
+  dprintf(("NTDLL: RtlLengthSecurityDescriptor(%08xh)\n",
+           SecurityDescriptor));
+
+  Size = SECURITY_DESCRIPTOR_MIN_LENGTH;
+  if ( SecurityDescriptor == NULL )
+    return 0;
+
+  if ( SecurityDescriptor->Owner != NULL )
+    Size += SecurityDescriptor->Owner->SubAuthorityCount;
+  if ( SecurityDescriptor->Group != NULL )
+    Size += SecurityDescriptor->Group->SubAuthorityCount;
+
+
+  if ( SecurityDescriptor->Sacl != NULL )
+    Size += SecurityDescriptor->Sacl->AclSize;
+  if ( SecurityDescriptor->Dacl != NULL )
+    Size += SecurityDescriptor->Dacl->AclSize;
+
+  return Size;
+}
+
+/******************************************************************************
+ *  RtlGetDaclSecurityDescriptor            [NTDLL]
+ *
+ */
+NTSTATUS WINAPI RtlGetDaclSecurityDescriptor(PSECURITY_DESCRIPTOR pSecurityDescriptor,
+                                             PBOOLEAN             lpbDaclPresent,
+                                             PACL                 *pDacl,
+                                             PBOOLEAN             lpbDaclDefaulted)
+{
+  dprintf(("NTDLL: RtlGetDaclSecurityDescriptor(%08xh,%08xh,%08xh,%08xh)\n",
+           pSecurityDescriptor,
+           lpbDaclPresent,
+           pDacl,
+           lpbDaclDefaulted));
+
+  if (pSecurityDescriptor->Revision != SECURITY_DESCRIPTOR_REVISION)
+    return STATUS_UNKNOWN_REVISION ;
+
+  if ( (*lpbDaclPresent = (SE_DACL_PRESENT & pSecurityDescriptor->Control) ? 1 : 0) )
+  {
+    if ( SE_SELF_RELATIVE & pSecurityDescriptor->Control)
+    {
+      *pDacl = (PACL) ((LPBYTE)pSecurityDescriptor + (DWORD)pSecurityDescriptor->Dacl);
+    }
+    else
+    {
+      *pDacl = pSecurityDescriptor->Dacl;
+    }
+  }
+
+  *lpbDaclDefaulted = (( SE_DACL_DEFAULTED & pSecurityDescriptor->Control ) ? 1 : 0);
+
+  return STATUS_SUCCESS;
+}
+
+
+/**************************************************************************
+ *  RtlSetDaclSecurityDescriptor            [NTDLL.483]
+ */
+NTSTATUS WINAPI RtlSetDaclSecurityDescriptor (PSECURITY_DESCRIPTOR lpsd,
+                                              BOOLEAN              daclpresent,
+                                              PACL                 dacl,
+                                              BOOLEAN              dacldefaulted)
+{
+  dprintf(("NTDLL: RtlSetDaclSecurityDescriptor(%08xh,%08xh,%08xh,%08xh)\n",
+           lpsd,
+           daclpresent,
+           dacl,
+           dacldefaulted));
+
+  if (lpsd->Revision!=SECURITY_DESCRIPTOR_REVISION)
+    return STATUS_UNKNOWN_REVISION;
+  if (lpsd->Control & SE_SELF_RELATIVE)
+    return STATUS_INVALID_SECURITY_DESCR;
+
+  if (!daclpresent)
+  {
+    lpsd->Control &= ~SE_DACL_PRESENT;
+    return TRUE;
+  }
+
+  lpsd->Control |= SE_DACL_PRESENT;
+  lpsd->Dacl = dacl;
+
+  if (dacldefaulted)
+    lpsd->Control |= SE_DACL_DEFAULTED;
+  else
+    lpsd->Control &= ~SE_DACL_DEFAULTED;
+
+  return STATUS_SUCCESS;
+}
+
+
+/******************************************************************************
+ *  RtlGetSaclSecurityDescriptor            [NTDLL]
+ *
+ */
+NTSTATUS WINAPI RtlGetSaclSecurityDescriptor(PSECURITY_DESCRIPTOR pSecurityDescriptor,
+                                             PBOOLEAN             lpbSaclPresent,
+                                             PACL                 *pSacl,
+                                             PBOOLEAN             lpbSaclDefaulted)
+{
+  dprintf(("NTDLL: RtlGetSaclSecurityDescriptor(%08xh,%08xh,%08xh,%08xh)\n",
+           pSecurityDescriptor,
+           lpbSaclPresent,
+           pSacl,
+           lpbSaclDefaulted));
+
+  if (pSecurityDescriptor->Revision != SECURITY_DESCRIPTOR_REVISION)
+    return STATUS_UNKNOWN_REVISION ;
+
+  if ( (*lpbSaclPresent = (SE_SACL_PRESENT & pSecurityDescriptor->Control) ? 1 : 0) )
+  {
+    if ( SE_SELF_RELATIVE & pSecurityDescriptor->Control)
+    {
+      *pSacl = (PACL) ((LPBYTE)pSecurityDescriptor + (DWORD)pSecurityDescriptor->Sacl);
+    }
+    else
+    {
+      *pSacl = pSecurityDescriptor->Sacl;
+    }
+  }
+
+  *lpbSaclDefaulted = (( SE_SACL_DEFAULTED & pSecurityDescriptor->Control ) ? 1 : 0);
+
+  return STATUS_SUCCESS;
+}
+
+
+/**************************************************************************
+ * RtlSetSaclSecurityDescriptor                [NTDLL.488]
+ */
+NTSTATUS WINAPI RtlSetSaclSecurityDescriptor (PSECURITY_DESCRIPTOR lpsd,
+                                              BOOLEAN              saclpresent,
+                                              PACL                 sacl,
+                                              BOOLEAN              sacldefaulted)
+{
+  dprintf(("NTDLL: RtlSetSaclSecurityDescriptor(%08xh,%08xh,%08xh,%08xh)\n",
+           lpsd,
+           saclpresent,
+           sacl,
+           sacldefaulted));
+
+  if (lpsd->Revision!=SECURITY_DESCRIPTOR_REVISION)
+    return STATUS_UNKNOWN_REVISION;
+
+  if (lpsd->Control & SE_SELF_RELATIVE)
+    return STATUS_INVALID_SECURITY_DESCR;
+
+  if (!saclpresent)
+  {
+    lpsd->Control &= ~SE_SACL_PRESENT;
+    return 0;
+  }
+
+  lpsd->Control |= SE_SACL_PRESENT;
+  lpsd->Sacl = sacl;
+
+  if (sacldefaulted)
+    lpsd->Control |= SE_SACL_DEFAULTED;
+  else
+    lpsd->Control &= ~SE_SACL_DEFAULTED;
+
+  return STATUS_SUCCESS;
+}
+
+
+/**************************************************************************
+ * RtlGetOwnerSecurityDescriptor            [NTDLL.488]
+ */
+NTSTATUS WINAPI RtlGetOwnerSecurityDescriptor(PSECURITY_DESCRIPTOR SecurityDescriptor,
+                                              PSID                 *Owner,
+                                              PBOOLEAN             OwnerDefaulted)
+{
+  dprintf(("NTDLL: RtlGetOwnerSecurityDescriptor(%08xh,%08xh,%08xh)\n",
+           SecurityDescriptor,
+           Owner,
+           OwnerDefaulted));
+
+  if ( !SecurityDescriptor  || !Owner || !OwnerDefaulted )
+    return STATUS_INVALID_PARAMETER;
+
+  *Owner = SecurityDescriptor->Owner;
+  if ( *Owner != NULL )
+  {
+    if ( SecurityDescriptor->Control & SE_OWNER_DEFAULTED )
+       *OwnerDefaulted = TRUE;
+    else
+       *OwnerDefaulted = FALSE;
+  }
+
+  return STATUS_SUCCESS;
+}
+
+
+/**************************************************************************
+ *                 RtlSetOwnerSecurityDescriptor     [NTDLL.487]
+ */
+NTSTATUS WINAPI RtlSetOwnerSecurityDescriptor(PSECURITY_DESCRIPTOR lpsd,
+                                              PSID                 owner,
+                                              BOOLEAN              ownerdefaulted)
+{
+  dprintf(("NTDLL: RtlSetOwnerSecurityDescriptor(%08x,%08xh,%08xh)\n",
+           lpsd,
+           owner,
+           ownerdefaulted));
+
+  if (lpsd->Revision!=SECURITY_DESCRIPTOR_REVISION)
+    return STATUS_UNKNOWN_REVISION;
+  if (lpsd->Control & SE_SELF_RELATIVE)
+    return STATUS_INVALID_SECURITY_DESCR;
+
+  lpsd->Owner = owner;
+  if (ownerdefaulted)
+    lpsd->Control |= SE_OWNER_DEFAULTED;
+  else
+    lpsd->Control &= ~SE_OWNER_DEFAULTED;
+
+  return STATUS_SUCCESS;
+}
+
+
+/**************************************************************************
+ *                 RtlSetGroupSecurityDescriptor     [NTDLL.485]
+ */
+NTSTATUS WINAPI RtlSetGroupSecurityDescriptor (PSECURITY_DESCRIPTOR lpsd,
+                                               PSID                 group,
+                                               BOOLEAN              groupdefaulted)
+{
+  dprintf(("NTDLL: RtlSetGroupSecurityDescriptor(%08xh,%08xh,%08xh)\n",
+           lpsd,
+           group,
+           groupdefaulted));
+
+  if (lpsd->Revision!=SECURITY_DESCRIPTOR_REVISION)
+    return STATUS_UNKNOWN_REVISION;
+  if (lpsd->Control & SE_SELF_RELATIVE)
+    return STATUS_INVALID_SECURITY_DESCR;
+
+  lpsd->Group = group;
+  if (groupdefaulted)
+    lpsd->Control |= SE_GROUP_DEFAULTED;
+  else
+    lpsd->Control &= ~SE_GROUP_DEFAULTED;
+
+  return STATUS_SUCCESS;
+}
+
+
+/**************************************************************************
+ *                 RtlGetGroupSecurityDescriptor     [NTDLL]
+ */
+NTSTATUS WINAPI RtlGetGroupSecurityDescriptor(PSECURITY_DESCRIPTOR SecurityDescriptor,
+                                              PSID                 *Group,
+                                              PBOOLEAN             GroupDefaulted)
+{
+  dprintf(("NTDLL: RtlGetGroupSecurityDescriptor(%08xh,%08xh,%08xh)\n",
+           SecurityDescriptor,
+           Group,
+           GrouDefaulted));
+
+  if ( !SecurityDescriptor || !Group || !GroupDefaulted )
+    return STATUS_INVALID_PARAMETER;
+
+  *Group = SecurityDescriptor->Group;
+  if ( *Group != NULL )
+  {
+    if ( SecurityDescriptor->Control & SE_GROUP_DEFAULTED )
+      *GroupDefaulted = TRUE;
+    else
+      *GroupDefaulted = FALSE;
+  }
+
+  return STATUS_SUCCESS;
+}
+
+
+/*
+ * access control list's
+ */
+
+/**************************************************************************
+ *                 RtlCreateAcl                   [NTDLL.306]
+ *
+ * NOTES
+ *    This should return NTSTATUS
+ */
+DWORD WINAPI RtlCreateAcl(PACL  acl,
+                          DWORD size,
+                          DWORD rev)
+{
+  dprintf(("NTDLL: RtlCreateAcl(%08xh,%08xh,%08xh)\n",
+           acl,
+           size,
+           rev));
+
+  if (rev!=ACL_REVISION)
+    return STATUS_INVALID_PARAMETER;
+  if (size<sizeof(ACL))
+    return STATUS_BUFFER_TOO_SMALL;
+  if (size>0xFFFF)
+    return STATUS_INVALID_PARAMETER;
+
+  memset(acl,'\0',sizeof(ACL));
+  acl->AclRevision                      = rev;
+  acl->AclSize                          = size;
+  acl->AceCount                         = 0;
+
+  return 0;
+}
+
+
+/**************************************************************************
+ *                 RtlFirstFreeAce             [NTDLL.370]
+ * looks for the AceCount+1 ACE, and if it is still within the alloced
+ * ACL, return a pointer to it
+ */
+BOOLEAN WINAPI RtlFirstFreeAce(PACL        acl,
+                               PACE_HEADER *x)
+{
+  PACE_HEADER ace;
+  int      i;
+
+  dprintf(("NTDLL: RtlFirstFreeAct(%08xh,%08xh)\n",
+           acl,
+           x));
+
+  *x = 0;
+  ace = (PACE_HEADER)(acl+1);
+  for (i=0;
+       i<acl->AceCount;
+       i++)
+  {
+    if ((DWORD)ace>=(((DWORD)acl)+acl->AclSize))
+       return 0;
+
+    ace = (PACE_HEADER)(((BYTE*)ace)+ace->AceSize);
+  }
+
+  if ((DWORD)ace>=(((DWORD)acl)+acl->AclSize))
+     return 0;
+
+  *x = ace;
+  return 1;
+}
+
+
+/**************************************************************************
+ *                 RtlAddAce                      [NTDLL.260]
+ */
+NTSTATUS WINAPI RtlAddAce(PACL acl,
+                          DWORD rev,
+                          DWORD xnrofaces,
+                          PACE_HEADER acestart,
+                          DWORD acelen)
+{
+  PACE_HEADER ace,targetace;
+  int      nrofaces;
+
+  dprintf(("NTDLL: RtlAddAce(%08xh,%08xh,%08xh,%08xh,%08xh)\n",
+           acl,
+           rev,
+           xnrofaces,
+           acestart,
+           acelen));
+
+  if (acl->AclRevision != ACL_REVISION)
+    return STATUS_INVALID_PARAMETER;
+
+  if (!RtlFirstFreeAce(acl,&targetace))
+    return STATUS_INVALID_PARAMETER;
+
+  nrofaces=0;
+  ace=acestart;
+
+  while (((DWORD)ace-(DWORD)acestart)<acelen)
+  {
+    nrofaces++;
+    ace = (PACE_HEADER)(((BYTE*)ace)+ace->AceSize);
+  }
+
+  if ((DWORD)targetace+acelen>(DWORD)acl+acl->AclSize) /* too much aces */
+    return STATUS_INVALID_PARAMETER;
+
+  memcpy((LPBYTE)targetace,acestart,acelen);
+  acl->AceCount+=nrofaces;
+
+  return STATUS_SUCCESS;
+}
+
+
+/******************************************************************************
+ *  RtlAddAccessAllowedAce                  [NTDLL]
+ */
+DWORD WINAPI RtlAddAccessAllowedAce(DWORD x1,
+                                    DWORD x2,
+                                    DWORD x3,
+                                    DWORD x4)
+{
+  dprintf(("NTDLL: RtlAddAccessAllowedAce(%08xh,%08xh,%08xh,%08xh) not implemented.\n",
+           x1,
+           x2,
+           x3,
+           x4));
+
+  return 0;
+}
+
+
+/******************************************************************************
+ *  RtlGetAce     [NTDLL]
+ */
+DWORD WINAPI RtlGetAce(PACL  pAcl,
+                       DWORD dwAceIndex,
+                       LPVOID *pAce )
+{
+  dprintf(("NTDLL: RtlGetAce(%08x,%08x,%08x) not implemented.\n",
+           pAcl,
+           dwAceIndex,
+           pAce));
+
+  return 0;
+}
+
+
+/*
+ * misc
+ */
+
+/******************************************************************************
+ *  RtlAdjustPrivilege                      [NTDLL]
+ */
+DWORD WINAPI RtlAdjustPrivilege(DWORD x1,
+                                DWORD x2,
+                                DWORD x3,
+                                DWORD x4)
+{
+  dprintf(("NTDLL: RtlAdjustPrivilege(%08xh,%08xh,%08xh,%08xh) not implemented.\n",
+           x1,
+           x2,
+           x3,
+           x4));
+
+  return 0;
+}
+
Index: trunk/src/NTDLL/sync.c
===================================================================
--- trunk/src/NTDLL/sync.c	(revision 33)
+++ trunk/src/NTDLL/sync.c	(revision 33)
@@ -0,0 +1,146 @@
+/*
+ * Project Odin Software License can be found in LICENSE.TXT
+ * Win32 NT Runtime / NTDLL for OS/2
+ *
+ * Copyright 1998       original WINE Author
+ * Copyright 1998, 1999 Patrick Haller (phaller@gmx.net)
+ *
+ * Process synchronisation
+ */
+
+#include "ntdll.h"
+#include <stdlib.h>
+#include <string.h>
+#include <time.h>
+
+
+
+/*
+ * Semaphore
+ */
+
+/******************************************************************************
+ *  NtCreateSemaphore                    [NTDLL]
+ */
+NTSTATUS WINAPI NtCreateSemaphore(PHANDLE            SemaphoreHandle,
+                                  ACCESS_MASK        DesiredAccess,
+                                  POBJECT_ATTRIBUTES ObjectAttributes,
+                                  ULONG              InitialCount,
+                                  ULONG              MaximumCount)
+{
+  dprintf(("NTDLL: NtCreateSemaphore(%08xh,%08xh,%08xh,%08xh,%08xh) not implemented.\n",
+           SemaphoreHandle,
+           DesiredAccess,
+           ObjectAttributes,
+           InitialCount,
+           MaximumCount));
+
+  return 0;
+}
+
+
+/******************************************************************************
+ *  NtOpenSemaphore                      [NTDLL]
+ */
+NTSTATUS WINAPI NtOpenSemaphore(HANDLE             SemaphoreHandle,
+                                ACCESS_MASK        DesiredAccess,
+                                POBJECT_ATTRIBUTES ObjectAttributes)
+{
+  dprintf(("NTDLL: NtOpenSemaphore(%08xh,%08xh,%08xh) not implemented.\n",
+           SemaphoreHandle,
+           DesiredAccess,
+           ObjectAttributes));
+
+  return 0;
+}
+
+
+/******************************************************************************
+ *  NtQuerySemaphore                     [NTDLL]
+ */
+NTSTATUS WINAPI NtQuerySemaphore(HANDLE SemaphoreHandle,
+                                 PVOID  SemaphoreInformationClass,
+                                 PVOID SemaphoreInformation,
+                                 ULONG Length,
+                                 PULONG ReturnLength)
+{
+  dprintf(("NTDLL: NtQuerySemaphore(%08xh,%08xh,%08xh,%08xh,%08xh) not implemented.\n",
+           SemaphoreHandle,
+           SemaphoreInformationClass,
+           SemaphoreInformation,
+           Length,
+           ReturnLength));
+
+  return 0;
+}
+
+
+/******************************************************************************
+ *  NtReleaseSemaphore                   [NTDLL]
+ */
+NTSTATUS WINAPI NtReleaseSemaphore(HANDLE SemaphoreHandle,
+                                   ULONG  ReleaseCount,
+                                   PULONG PreviousCount)
+{
+  dprintf(("NTDLL: NtReleaseSemaphore(%08xh,%08xh,%08xh) not implemented.\n",
+           SemaphoreHandle,
+           ReleaseCount,
+           PreviousCount));
+
+  return 0;
+}
+
+
+/*
+ * Event
+ */
+
+/**************************************************************************
+ *    NtCreateEvent                               [NTDLL.71]
+ */
+NTSTATUS WINAPI NtCreateEvent(PHANDLE            EventHandle,
+                              ACCESS_MASK        DesiredAccess,
+                              POBJECT_ATTRIBUTES ObjectAttributes,
+                              BOOLEAN            ManualReset,
+                              BOOLEAN            InitialState)
+{
+  dprintf(("NTDLL: NtCreateEvent(%08xh,%08xh,%08xh,%08xh,%08xh) not implemented.\n",
+           EventHandle,
+           DesiredAccess,
+           ObjectAttributes,
+           ManuelReset,
+           InitialState));
+
+  return 0;
+}
+
+
+/******************************************************************************
+ *  NtOpenEvent                          [NTDLL]
+ */
+NTSTATUS WINAPI NtOpenEvent(PHANDLE            EventHandle,
+                            ACCESS_MASK        DesiredAccess,
+                            POBJECT_ATTRIBUTES ObjectAttributes)
+{
+  dprintf(("NTDLL: NtOpenEvent(%08xh,%08xh,%08xh) not implemented.\n",
+           EventHandle,
+           DesiredAccess,
+           ObjectAttributes));
+
+  return 0;
+}
+
+
+/******************************************************************************
+ *  NtSetEvent    [NTDLL]
+ */
+NTSTATUS WINAPI NtSetEvent(HANDLE EventHandle,
+                           PULONG NumberOfThreadsReleased)
+{
+  dprintf(("NTDLL: NtSetEvent(%08xh,%08xh) not implemented.\n",
+           EventHandle,
+           NumberOfThreadReleased));
+
+  return 0;
+}
+
Index: trunk/src/NTDLL/time.c
===================================================================
--- trunk/src/NTDLL/time.c	(revision 33)
+++ trunk/src/NTDLL/time.c	(revision 33)
@@ -0,0 +1,237 @@
+/*
+ * Project Odin Software License can be found in LICENSE.TXT
+ * Win32 NT Runtime / NTDLL for OS/2
+ *
+ * Copyright 1998       original WINE Author
+ * Copyright 1998, 1999 Patrick Haller (phaller@gmx.net)
+ *
+ * Conversion between Time and TimeFields
+ *
+ * RtlTimeToTimeFields, RtlTimeFieldsToTime and defines are taken from ReactOS and
+ * adapted to wine with special permissions of the author
+ * Rex Jolliff (rex@lvcablemodem.com)
+ *
+ *
+ */
+
+#include "ntdll.h"
+#include <string.h>
+
+
+#define TICKSPERSEC        10000000
+#define TICKSPERMSEC       10000
+#define SECSPERDAY         86400
+#define SECSPERHOUR        3600
+#define SECSPERMIN         60
+#define MINSPERHOUR        60
+#define HOURSPERDAY        24
+#define EPOCHWEEKDAY       0
+#define DAYSPERWEEK        7
+#define EPOCHYEAR          1601
+#define DAYSPERNORMALYEAR  365
+#define DAYSPERLEAPYEAR    366
+#define MONSPERYEAR        12
+
+static const int YearLengths[2] = {DAYSPERNORMALYEAR, DAYSPERLEAPYEAR};
+static const int MonthLengths[2][MONSPERYEAR] =
+{
+   { 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 },
+   { 31, 29, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 }
+};
+
+static int IsLeapYear(int Year)
+{
+   return Year % 4 == 0 && (Year % 100 != 0 || Year % 400 == 0) ? 1 : 0;
+}
+
+static void NormalizeTimeFields(CSHORT *FieldToNormalize,
+                                CSHORT *CarryField,
+                                int    Modulus)
+{
+   *FieldToNormalize = (CSHORT) (*FieldToNormalize - Modulus);
+   *CarryField = (CSHORT) (*CarryField + 1);
+}
+
+/******************************************************************************
+ *  RtlTimeToTimeFields                     [NTDLL.265]
+ *
+ */
+
+/* @@@PH we need 64-bit arithmetics here */
+#if 0
+VOID WINAPI RtlTimeToTimeFields(
+   PLARGE_INTEGER liTime,
+   PTIME_FIELDS TimeFields)
+{
+   const int *Months;
+   int LeapSecondCorrections, SecondsInDay, CurYear;
+   int LeapYear, CurMonth, GMTOffset;
+   long int Days;
+   long long int Time = *(long long int *)&liTime;
+
+   /* Extract millisecond from time and convert time into seconds */
+   TimeFields->Milliseconds = (CSHORT) ((Time % TICKSPERSEC) / TICKSPERMSEC);
+   Time = Time / TICKSPERSEC;
+
+   /* FIXME: Compute the number of leap second corrections here */
+   LeapSecondCorrections = 0;
+
+   /* FIXME: get the GMT offset here */
+   GMTOffset = 0;
+
+   /* Split the time into days and seconds within the day */
+   Days = Time / SECSPERDAY;
+   SecondsInDay = Time % SECSPERDAY;
+
+   /* Adjust the values for GMT and leap seconds */
+   SecondsInDay += (GMTOffset - LeapSecondCorrections);
+   while (SecondsInDay < 0)
+   { SecondsInDay += SECSPERDAY;
+     Days--;
+   }
+   while (SecondsInDay >= SECSPERDAY)
+   { SecondsInDay -= SECSPERDAY;
+     Days++;
+   }
+
+   /* compute time of day */
+   TimeFields->Hour = (CSHORT) (SecondsInDay / SECSPERHOUR);
+   SecondsInDay = SecondsInDay % SECSPERHOUR;
+   TimeFields->Minute = (CSHORT) (SecondsInDay / SECSPERMIN);
+   TimeFields->Second = (CSHORT) (SecondsInDay % SECSPERMIN);
+
+   /* FIXME: handle the possibility that we are on a leap second (i.e. Second = 60) */
+
+   /* compute day of week */
+   TimeFields->Weekday = (CSHORT) ((EPOCHWEEKDAY + Days) % DAYSPERWEEK);
+
+   /* compute year */
+   CurYear = EPOCHYEAR;
+   /* FIXME: handle calendar modifications */
+   while (1)
+   { LeapYear = IsLeapYear(CurYear);
+     if (Days < (long) YearLengths[LeapYear])
+     { break;
+     }
+     CurYear++;
+     Days = Days - (long) YearLengths[LeapYear];
+   }
+   TimeFields->Year = (CSHORT) CurYear;
+
+   /* Compute month of year */
+   Months = MonthLengths[LeapYear];
+   for (CurMonth = 0; Days >= (long) Months[CurMonth]; CurMonth++)
+     Days = Days - (long) Months[CurMonth];
+   TimeFields->Month = (CSHORT) (CurMonth + 1);
+   TimeFields->Day = (CSHORT) (Days + 1);
+}
+
+
+/******************************************************************************
+ *  RtlTimeFieldsToTime                     [NTDLL.265]
+ *
+ */
+BOOLEAN WINAPI RtlTimeFieldsToTime(
+   PTIME_FIELDS tfTimeFields,
+   PLARGE_INTEGER Time)
+{
+   int CurYear, CurMonth;
+   long long int rcTime;
+   TIME_FIELDS TimeFields = *tfTimeFields;
+
+   rcTime = 0;
+
+   /* FIXME: normalize the TIME_FIELDS structure here */
+   while (TimeFields.Second >= SECSPERMIN)
+   { NormalizeTimeFields(&TimeFields.Second, &TimeFields.Minute, SECSPERMIN);
+   }
+   while (TimeFields.Minute >= MINSPERHOUR)
+   { NormalizeTimeFields(&TimeFields.Minute, &TimeFields.Hour, MINSPERHOUR);
+   }
+   while (TimeFields.Hour >= HOURSPERDAY)
+   { NormalizeTimeFields(&TimeFields.Hour, &TimeFields.Day, HOURSPERDAY);
+   }
+   while (TimeFields.Day > MonthLengths[IsLeapYear(TimeFields.Year)][TimeFields.Month - 1])
+   { NormalizeTimeFields(&TimeFields.Day, &TimeFields.Month, SECSPERMIN);
+   }
+   while (TimeFields.Month > MONSPERYEAR)
+   { NormalizeTimeFields(&TimeFields.Month, &TimeFields.Year, MONSPERYEAR);
+   }
+
+   /* FIXME: handle calendar corrections here */
+   for (CurYear = EPOCHYEAR; CurYear < TimeFields.Year; CurYear++)
+   { rcTime += YearLengths[IsLeapYear(CurYear)];
+   }
+   for (CurMonth = 1; CurMonth < TimeFields.Month; CurMonth++)
+   { rcTime += MonthLengths[IsLeapYear(CurYear)][CurMonth - 1];
+   }
+   rcTime += TimeFields.Day - 1;
+   rcTime *= SECSPERDAY;
+   rcTime += TimeFields.Hour * SECSPERHOUR + TimeFields.Minute * SECSPERMIN + TimeFields.Second;
+   rcTime *= TICKSPERSEC;
+   rcTime += TimeFields.Milliseconds * TICKSPERMSEC;
+   *Time = *(LARGE_INTEGER *)&rcTime;
+
+   return TRUE;
+}
+#endif
+
+/************* end of code by Rex Jolliff (rex@lvcablemodem.com) *******************/
+
+/******************************************************************************
+ *  RtlSystemTimeToLocalTime             [NTDLL]
+ */
+VOID WINAPI RtlSystemTimeToLocalTime(PLARGE_INTEGER SystemTime,
+                                     PLARGE_INTEGER LocalTime)
+{
+  dprintf(("NTDLL: RtlSystemTimeToLocalTime(%08xh,%08xh) not implemented.\n",
+           SystemTime,
+           LocalTime));
+
+  memcpy (LocalTime,
+          SystemTime,
+          sizeof (PLARGE_INTEGER));
+}
+
+
+/******************************************************************************
+ *  RtlToTimeInSecondsSince1980             [NTDLL]
+ */
+BOOLEAN WINAPI RtlTimeToSecondsSince1980(LPFILETIME ft,
+                                         LPDWORD    timeret)
+{
+  dprintf(("NTDLL: RtlTimeToSecondsSince1980(%08xh,%08xh) not implemented.\n",
+           ft,
+           timeret));
+
+  /* 1980 = 1970+10*365 days +  29. februar 1972 + 29.februar 1976 */
+  //*timeret = DOSFS_FileTimeToUnixTime(ft,NULL) - (10*365+2)*24*3600;
+  return 1;
+}
+
+/******************************************************************************
+ *  RtlToTimeInSecondsSince1970             [NTDLL]
+ */
+BOOLEAN WINAPI RtlTimeToSecondsSince1970(LPFILETIME ft,
+                                         LPDWORD timeret)
+{
+  dprintf(("NTDLL: RtlTimeToSecondsSince1970(%08xh,%08xh) not implemented.\n",
+           ft,
+           timeret));
+
+  //*timeret = DOSFS_FileTimeToUnixTime(ft,NULL);
+  return 1;
+}
+
+
+/******************************************************************************
+ * RtlTimeToElapsedTimeFields [NTDLL.502]
+ * FIXME: prototype guessed
+ */
+VOID WINAPI RtlTimeToElapsedTimeFields(PLARGE_INTEGER liTime,
+                                       PTIME_FIELDS   TimeFields)
+{
+  dprintf(("NTDLL: RtlTimeToElapsedTimeFields(%08xh,%08xh) not implemented.\n",
+           liTime,
+           TimeFields));
+}
