Remove /nt directory
authorAlex Ionescu <aionescu@gmail.com>
Fri, 7 Jan 2005 06:54:27 +0000 (06:54 +0000)
committerAlex Ionescu <aionescu@gmail.com>
Fri, 7 Jan 2005 06:54:27 +0000 (06:54 +0000)
svn path=/trunk/; revision=12861

27 files changed:
reactos/iface/native/makefile
reactos/iface/native/sysfuncs.lst
reactos/include/ddk/ketypes.h
reactos/lib/ntdll/def/ntdll.def
reactos/ntoskrnl/Makefile
reactos/ntoskrnl/Makefile.i386
reactos/ntoskrnl/ex/event.c [new file with mode: 0644]
reactos/ntoskrnl/ex/evtpair.c [new file with mode: 0644]
reactos/ntoskrnl/ex/init.c
reactos/ntoskrnl/ex/mutant.c [new file with mode: 0644]
reactos/ntoskrnl/ex/profile.c [new file with mode: 0644]
reactos/ntoskrnl/ex/sem.c [new file with mode: 0644]
reactos/ntoskrnl/ex/timer.c [new file with mode: 0644]
reactos/ntoskrnl/inbv/inbv.c
reactos/ntoskrnl/include/internal/ke.h
reactos/ntoskrnl/include/internal/ntoskrnl.h
reactos/ntoskrnl/include/internal/port.h
reactos/ntoskrnl/include/ntoskrnl.h
reactos/ntoskrnl/io/efi.c [new file with mode: 0644]
reactos/ntoskrnl/io/plugplay.c [new file with mode: 0644]
reactos/ntoskrnl/ke/i386/vdm.c [new file with mode: 0644]
reactos/ntoskrnl/ke/main.c
reactos/ntoskrnl/ke/profile.c
reactos/ntoskrnl/ke/zw.c [new file with mode: 0644]
reactos/ntoskrnl/lpc/connect.c
reactos/ntoskrnl/lpc/create.c
reactos/ntoskrnl/lpc/port.c

index b64374d..32de051 100644 (file)
@@ -14,7 +14,7 @@ TARGET = genntdll
 SYSTEM_CALLS_DB = sysfuncs.lst
 NTDLL_STUBS = ../../lib/ntdll/napi.c
 KERNEL_SERVICE_TABLE = ../../include/ntdll/napi.h
-KERNEL_ZW_CALLS = ../../ntoskrnl/nt/zw.c
+KERNEL_ZW_CALLS = ../../ntoskrnl/ke/zw.c
 NAPI_FILES = $(NTDLL_STUBS) $(KERNEL_SERVICE_TABLE) $(KERNEL_ZW_CALLS)
 
 BASE_CFLAGS = -I../../include
index 2d512ef..83e776a 100644 (file)
@@ -232,10 +232,4 @@ NtWriteFileGather ZwWriteFileGather 9
 NtWriteRequestData ZwWriteRequestData 6
 NtWriteVirtualMemory ZwWriteVirtualMemory 5
 NtW32Call ZwW32Call 5
-NtCreateChannel ZwCreateChannel 2
-NtListenChannel ZwListenChannel 2
-NtOpenChannel ZwOpenChannel 2
-NtReplyWaitSendChannel ZwReplyWaitSendChannel 3
-NtSendWaitReplyChannel ZwSendWaitReplyChannel 4
-NtSetContextChannel ZwSetContextChannel 1
 NtYieldExecution ZwYieldExecution 0
index 549be03..ce77b02 100644 (file)
@@ -99,6 +99,10 @@ typedef struct _KDEVICE_QUEUE
   BOOLEAN Busy;
 } KDEVICE_QUEUE, *PKDEVICE_QUEUE;
 
+/*
+ * Size of the profile hash table.
+ */
+#define PROFILE_HASH_TABLE_SIZE      (32)
 
 #include <pshpack2.h>
 
index 21743fd..e03542d 100644 (file)
@@ -77,7 +77,6 @@ NtCloseObjectAuditAlarm@12
 NtCompleteConnectPort@4
 NtConnectPort@32
 NtContinue@8
-NtCreateChannel@8
 NtCreateDirectoryObject@12
 NtCreateEvent@20
 NtCreateEventPair@12
@@ -128,7 +127,6 @@ NtImpersonateClientOfPort@8
 NtImpersonateThread@12
 NtInitializeRegistry@4
 NtIsProcessInJob@8
-NtListenChannel@8
 NtListenPort@8
 NtLoadDriver@4
 NtLoadKey@8
@@ -139,7 +137,6 @@ NtMakeTemporaryObject@4
 NtMapViewOfSection@40
 NtNotifyChangeDirectoryFile@36
 NtNotifyChangeKey@40
-NtOpenChannel@8
 NtOpenDirectoryObject@12
 NtOpenEvent@12
 NtOpenEventPair@12
@@ -212,17 +209,14 @@ NtReleaseSemaphore@12
 NtRemoveIoCompletion@20
 NtReplaceKey@12
 NtReplyPort@8
-NtReplyWaitReceivePort@16
 NtReplyWaitReplyPort@8
-NtReplyWaitSendChannel@12
+NtReplyWaitReceivePort@16
 NtRequestPort@8
 NtRequestWaitReplyPort@12
 NtResetEvent@8
 NtRestoreKey@12
 NtResumeThread@8
 NtSaveKey@8
-NtSendWaitReplyChannel@16
-NtSetContextChannel@4
 NtSetContextThread@8
 NtSetDefaultHardErrorPort@4
 NtSetDefaultLocale@8
@@ -704,7 +698,6 @@ ZwCloseObjectAuditAlarm@12
 ZwCompleteConnectPort@4
 ZwConnectPort@32
 ZwContinue@8
-ZwCreateChannel@8
 ZwCreateDirectoryObject@12
 ZwCreateEvent@20
 ZwCreateEventPair@12
@@ -751,7 +744,6 @@ ZwGetTickCount@0
 ZwImpersonateClientOfPort@8
 ZwImpersonateThread@12
 ZwInitializeRegistry@4
-ZwListenChannel@8
 ZwListenPort@8
 ZwLoadDriver@4
 ZwLoadKey@8
@@ -762,7 +754,6 @@ ZwMakeTemporaryObject@4
 ZwMapViewOfSection@40
 ZwNotifyChangeDirectoryFile@36
 ZwNotifyChangeKey@40
-ZwOpenChannel@8
 ZwOpenDirectoryObject@12
 ZwOpenEvent@12
 ZwOpenEventPair@12
@@ -835,15 +826,12 @@ ZwReplaceKey@12
 ZwReplyPort@8
 ZwReplyWaitReceivePort@16
 ZwReplyWaitReplyPort@8
-ZwReplyWaitSendChannel@12
 ZwRequestPort@8
 ZwRequestWaitReplyPort@12
 ZwResetEvent@8
 ZwRestoreKey@12
 ZwResumeThread@8
 ZwSaveKey@8
-ZwSendWaitReplyChannel@16
-ZwSetContextChannel@4
 ZwSetContextThread@8
 ZwSetDefaultHardErrorPort@4
 ZwSetDefaultLocale@8
index 23977a1..0098a95 100644 (file)
@@ -77,22 +77,6 @@ OBJECTS_PATH = objects
 #
 include Makefile.$(ARCH)
 
-# System API (Nt/Zw)
-OBJECTS_NT = \
-       nt/channel.o \
-       nt/efi.o \
-       nt/evtpair.o \
-       nt/mutant.o \
-       nt/misc.o \
-       nt/nt.o \
-       nt/ntevent.o \
-       nt/ntsem.o \
-       nt/nttimer.o \
-       nt/plugplay.o \
-       nt/profile.o \
-       nt/vdm.o \
-       nt/zw.o
-
 # Run-Time Library (Rtl)
 OBJECTS_RTL = \
        rtl/atom.o \
@@ -136,7 +120,8 @@ OBJECTS_KE = \
        ke/sem.o \
        ke/spinlock.o \
        ke/timer.o \
-       ke/wait.o
+       ke/wait.o \
+       ke/zw.o
 
 # Memory Manager (Mm)
 OBJECTS_MM = \
@@ -188,6 +173,7 @@ OBJECTS_IO = \
        io/deviface.o \
        io/dir.o \
        io/driver.o \
+       io/efi.o \
        io/errlog.o \
        io/error.o \
        io/event.o \
@@ -206,6 +192,7 @@ OBJECTS_IO = \
        io/npipe.o \
        io/page.o \
        io/parttab.o \
+       io/plugplay.o \
        io/process.o \
        io/pnpnotify.o \
        io/pnpdma.o \
@@ -259,20 +246,26 @@ OBJECTS_PS = \
 OBJECTS_EX = \
        ex/btree.o \
        ex/callback.o \
+       ex/event.o \
+       ex/evtpair.o \
        ex/fmutex.o \
        ex/hashtab.o \
        ex/init.o \
        ex/interlck.o \
        ex/list.o \
        ex/lookas.o \
+       ex/mutant.o \
        ex/napi.o \
        ex/power.o \
+       ex/profile.o \
        ex/resource.o \
        ex/rundown.o \
        ex/stree.o \
+       ex/sem.o \
        ex/synch.o \
        ex/sysinfo.o \
        ex/time.o \
+       ex/timer.o \
        ex/util.o \
        ex/uuid.o \
        ex/win32k.o \
@@ -371,7 +364,7 @@ OBJECTS_KD = \
 OBJECTS_INBV = \
        inbv/inbv.o
 
-DEP_OBJECTS := $(OBJECTS_NT) $(OBJECTS_MM) $(OBJECTS_ARCH) \
+DEP_OBJECTS := $(OBJECTS_MM) $(OBJECTS_ARCH) \
        $(OBJECTS_IO) $(OBJECTS_KE) $(OBJECTS_OB) \
        $(OBJECTS_PS) $(OBJECTS_EX) $(OBJECTS_CC) $(OBJECTS_FS) $(OBJECTS_SE) \
        $(OBJECTS_DBG) $(OBJECTS_CM) $(OBJECTS_LDR) $(OBJECTS_LPC) \
@@ -475,12 +468,6 @@ $(OBJECTS_PATH)/lpc.o: $(OBJECTS_LPC)
                -o $(OBJECTS_PATH)/lpc.o \
                $(OBJECTS_LPC)
 
-$(OBJECTS_PATH)/nt.o: $(OBJECTS_NT)
-       $(LD) \
-               -r \
-               -o $(OBJECTS_PATH)/nt.o \
-               $(OBJECTS_NT)
-
 $(OBJECTS_PATH)/po.o: $(OBJECTS_PO)
        $(LD) \
                -r \
@@ -519,7 +506,6 @@ OBJECTS := \
        $(OBJECTS_PATH)/kd.o \
        $(OBJECTS_PATH)/ldr.o \
        $(OBJECTS_PATH)/mm.o \
-       $(OBJECTS_PATH)/nt.o \
        $(OBJECTS_PATH)/ob.o \
        $(OBJECTS_PATH)/po.o \
        $(OBJECTS_PATH)/ps.o \
index 61454fd..3226e79 100644 (file)
@@ -22,6 +22,7 @@ OBJECTS_KE_I386 := \
        ke/i386/tskswitch.o \
        ke/i386/v86m.o \
        ke/i386/v86m_sup.o \
+       ke/i386/vdm.o \
        ke/i386/bios.o \
        ke/i386/i386-mcount.o \
        ke/i386/gdt.o \
diff --git a/reactos/ntoskrnl/ex/event.c b/reactos/ntoskrnl/ex/event.c
new file mode 100644 (file)
index 0000000..2daf124
--- /dev/null
@@ -0,0 +1,370 @@
+/*
+ *  ReactOS kernel
+ *  Copyright (C) 1998, 1999, 2000, 2001 ReactOS Team
+ *
+ *  This program is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 2 of the License, or
+ *  (at your option) any later version.
+ *
+ *  This program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with this program; if not, write to the Free Software
+ *  Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ */
+/*
+ * PROJECT:         ReactOS kernel
+ * FILE:            ntoskrnl/nt/event.c
+ * PURPOSE:         Named event support
+ * PROGRAMMER:      Philip Susi and David Welch
+ * UPDATE HISTORY:
+ *                  Created 22/05/98
+ */
+
+/* INCLUDES *****************************************************************/
+
+#include <ntoskrnl.h>
+#define NDEBUG
+#include <internal/debug.h>
+
+/* GLOBALS *******************************************************************/
+
+POBJECT_TYPE EXPORTED ExEventObjectType = NULL;
+
+static GENERIC_MAPPING ExpEventMapping = {
+       STANDARD_RIGHTS_READ | SYNCHRONIZE | EVENT_QUERY_STATE,
+       STANDARD_RIGHTS_WRITE | SYNCHRONIZE | EVENT_MODIFY_STATE,
+       STANDARD_RIGHTS_EXECUTE | SYNCHRONIZE | EVENT_QUERY_STATE,
+       EVENT_ALL_ACCESS};
+
+
+/* FUNCTIONS *****************************************************************/
+
+NTSTATUS STDCALL
+NtpCreateEvent(PVOID ObjectBody,
+              PVOID Parent,
+              PWSTR RemainingPath,
+              POBJECT_ATTRIBUTES ObjectAttributes)
+{
+  DPRINT("NtpCreateEvent(ObjectBody %x, Parent %x, RemainingPath %S)\n",
+        ObjectBody, Parent, RemainingPath);
+
+  if (RemainingPath != NULL && wcschr(RemainingPath+1, '\\') != NULL)
+    {
+      return(STATUS_UNSUCCESSFUL);
+    }
+
+  return(STATUS_SUCCESS);
+}
+
+
+VOID INIT_FUNCTION
+ExpInitializeEventImplementation(VOID)
+{
+   ExEventObjectType = ExAllocatePool(NonPagedPool,sizeof(OBJECT_TYPE));
+   
+   RtlCreateUnicodeString(&ExEventObjectType->TypeName, L"Event");
+   
+   ExEventObjectType->Tag = TAG('E', 'V', 'T', 'T');
+   ExEventObjectType->PeakObjects = 0;
+   ExEventObjectType->PeakHandles = 0;
+   ExEventObjectType->TotalObjects = 0;
+   ExEventObjectType->TotalHandles = 0;
+   ExEventObjectType->PagedPoolCharge = 0;
+   ExEventObjectType->NonpagedPoolCharge = sizeof(KEVENT);
+   ExEventObjectType->Mapping = &ExpEventMapping;
+   ExEventObjectType->Dump = NULL;
+   ExEventObjectType->Open = NULL;
+   ExEventObjectType->Close = NULL;
+   ExEventObjectType->Delete = NULL;
+   ExEventObjectType->Parse = NULL;
+   ExEventObjectType->Security = NULL;
+   ExEventObjectType->QueryName = NULL;
+   ExEventObjectType->OkayToClose = NULL;
+   ExEventObjectType->Create = NtpCreateEvent;
+   ExEventObjectType->DuplicationNotify = NULL;
+
+   ObpCreateTypeObject(ExEventObjectType);
+}
+
+
+NTSTATUS STDCALL
+NtClearEvent(IN HANDLE EventHandle)
+{
+   PKEVENT Event;
+   NTSTATUS Status;
+   
+   Status = ObReferenceObjectByHandle(EventHandle,
+                                     EVENT_MODIFY_STATE,
+                                     ExEventObjectType,
+                                     UserMode,
+                                     (PVOID*)&Event,
+                                     NULL);
+   if (!NT_SUCCESS(Status))
+     {
+       return(Status);
+     }
+   KeClearEvent(Event);
+   ObDereferenceObject(Event);
+   return(STATUS_SUCCESS);
+}
+
+
+/*
+ * @implemented
+ */
+NTSTATUS STDCALL
+NtCreateEvent(OUT PHANDLE EventHandle,
+             IN ACCESS_MASK DesiredAccess,
+             IN POBJECT_ATTRIBUTES ObjectAttributes  OPTIONAL,
+             IN EVENT_TYPE EventType,
+             IN BOOLEAN InitialState)
+{
+   PKEVENT Event;
+   HANDLE hEvent;
+   NTSTATUS Status;
+   OBJECT_ATTRIBUTES SafeObjectAttributes;
+   
+   if (ObjectAttributes != NULL)
+     {
+       Status = MmCopyFromCaller(&SafeObjectAttributes, ObjectAttributes,
+                                sizeof(OBJECT_ATTRIBUTES));
+       if (!NT_SUCCESS(Status))
+        {
+          return(Status);
+        }
+       ObjectAttributes = &SafeObjectAttributes;
+     }
+
+   Status = ObCreateObject(ExGetPreviousMode(),
+                          ExEventObjectType,
+                          ObjectAttributes,
+                          ExGetPreviousMode(),
+                          NULL,
+                          sizeof(KEVENT),
+                          0,
+                          0,
+                          (PVOID*)&Event);
+   if (!NT_SUCCESS(Status))
+     {
+       return(Status);
+     }
+   KeInitializeEvent(Event,
+                    EventType,
+                    InitialState);
+
+   Status = ObInsertObject ((PVOID)Event,
+                           NULL,
+                           DesiredAccess,
+                           0,
+                           NULL,
+                           &hEvent);
+   ObDereferenceObject(Event);
+   if (!NT_SUCCESS(Status))
+     {
+       return Status;
+     }
+
+   Status = MmCopyToCaller(EventHandle, &hEvent, sizeof(HANDLE));
+   if (!NT_SUCCESS(Status))
+     {
+       ZwClose(hEvent);
+       return(Status);
+     }
+   return(STATUS_SUCCESS);
+}
+
+
+NTSTATUS STDCALL
+NtOpenEvent(OUT PHANDLE EventHandle,
+           IN ACCESS_MASK DesiredAccess,
+           IN POBJECT_ATTRIBUTES ObjectAttributes)
+{
+   NTSTATUS Status;
+   HANDLE hEvent;
+
+   DPRINT("ObjectName '%wZ'\n", ObjectAttributes->ObjectName);
+
+   Status = ObOpenObjectByName(ObjectAttributes,
+                              ExEventObjectType,
+                              NULL,
+                              UserMode,
+                              DesiredAccess,
+                              NULL,
+                              &hEvent);
+             
+  if (!NT_SUCCESS(Status))
+  {
+    return(Status);
+  }
+
+   Status = MmCopyToCaller(EventHandle, &hEvent, sizeof(HANDLE));
+   if (!NT_SUCCESS(Status))
+     {
+       ZwClose(EventHandle);
+       return(Status);
+     }
+     
+   return(Status);
+}
+
+
+NTSTATUS STDCALL
+NtPulseEvent(IN HANDLE EventHandle,
+            OUT PLONG PreviousState  OPTIONAL)
+{
+   PKEVENT Event;
+   NTSTATUS Status;
+
+   DPRINT("NtPulseEvent(EventHandle %x PreviousState %x)\n",
+         EventHandle, PreviousState);
+
+   Status = ObReferenceObjectByHandle(EventHandle,
+                                     EVENT_MODIFY_STATE,
+                                     ExEventObjectType,
+                                     UserMode,
+                                     (PVOID*)&Event,
+                                     NULL);
+   if (!NT_SUCCESS(Status))
+     {
+       return(Status);
+     }
+
+   KePulseEvent(Event, EVENT_INCREMENT, FALSE);
+
+   ObDereferenceObject(Event);
+   return(STATUS_SUCCESS);
+}
+
+
+NTSTATUS STDCALL
+NtQueryEvent(IN HANDLE EventHandle,
+            IN EVENT_INFORMATION_CLASS EventInformationClass,
+            OUT PVOID EventInformation,
+            IN ULONG EventInformationLength,
+            OUT PULONG ReturnLength  OPTIONAL)
+{
+   EVENT_BASIC_INFORMATION Info;
+   PKEVENT Event;
+   NTSTATUS Status;
+   ULONG RetLen;
+
+   if (EventInformationClass > EventBasicInformation)
+     return STATUS_INVALID_INFO_CLASS;
+
+   if (EventInformationLength < sizeof(EVENT_BASIC_INFORMATION))
+     return STATUS_INFO_LENGTH_MISMATCH;
+
+   Status = ObReferenceObjectByHandle(EventHandle,
+                                     EVENT_QUERY_STATE,
+                                     ExEventObjectType,
+                                     UserMode,
+                                     (PVOID*)&Event,
+                                     NULL);
+   if (!NT_SUCCESS(Status))
+     return Status;
+
+   if (Event->Header.Type == InternalNotificationEvent)
+     Info.EventType = NotificationEvent;
+   else
+     Info.EventType = SynchronizationEvent;
+   Info.EventState = KeReadStateEvent(Event);
+
+   Status = MmCopyToCaller(EventInformation, &Event,
+                          sizeof(EVENT_BASIC_INFORMATION));
+   if (!NT_SUCCESS(Status))
+     {
+       ObDereferenceObject(Event);
+       return(Status);
+     }
+
+   if (ReturnLength != NULL)
+     {
+       RetLen = sizeof(EVENT_BASIC_INFORMATION);
+       Status = MmCopyToCaller(ReturnLength, &RetLen, sizeof(ULONG));
+       if (!NT_SUCCESS(Status))
+         {
+           ObDereferenceObject(Event);
+           return(Status);
+         }
+     }
+
+   ObDereferenceObject(Event);
+   return(STATUS_SUCCESS);
+}
+
+
+NTSTATUS STDCALL
+NtResetEvent(IN HANDLE EventHandle,
+            OUT PLONG PreviousState  OPTIONAL)
+{
+   PKEVENT Event;
+   NTSTATUS Status;
+   
+   DPRINT("NtResetEvent(EventHandle %x)\n", EventHandle);
+   
+   Status = ObReferenceObjectByHandle(EventHandle,
+                                     EVENT_MODIFY_STATE,
+                                     ExEventObjectType,
+                                     UserMode,
+                                     (PVOID*)&Event,
+                                     NULL);
+   if (!NT_SUCCESS(Status))
+     {
+       return(Status);
+     }
+   KeResetEvent(Event);
+   ObDereferenceObject(Event);
+   return(STATUS_SUCCESS);
+}
+
+
+/*
+ * @implemented
+ */
+NTSTATUS STDCALL
+NtSetEvent(IN HANDLE EventHandle,
+          OUT PLONG PreviousState  OPTIONAL)
+{
+   PKEVENT Event;
+   NTSTATUS Status;
+   
+   DPRINT("NtSetEvent(EventHandle %x)\n", EventHandle);
+   
+   Status = ObReferenceObjectByHandle(EventHandle,
+                                     EVENT_MODIFY_STATE,
+                                     ExEventObjectType,
+                                     UserMode,
+                                     (PVOID*)&Event,
+                                     NULL);
+   if (!NT_SUCCESS(Status))
+     {
+       return(Status);
+     }
+   KeSetEvent(Event,EVENT_INCREMENT,FALSE);
+   ObDereferenceObject(Event);
+   return(STATUS_SUCCESS);
+}
+
+/*
+ * @unimplemented
+ */
+NTSTATUS
+STDCALL
+NtTraceEvent(
+       IN ULONG TraceHandle,
+       IN ULONG Flags,
+       IN ULONG TraceHeaderLength,
+       IN struct _EVENT_TRACE_HEADER* TraceHeader
+       )
+{
+       UNIMPLEMENTED;
+       return STATUS_NOT_IMPLEMENTED;
+}
+
+
+/* EOF */
diff --git a/reactos/ntoskrnl/ex/evtpair.c b/reactos/ntoskrnl/ex/evtpair.c
new file mode 100644 (file)
index 0000000..626c092
--- /dev/null
@@ -0,0 +1,496 @@
+/* $Id: evtpair.c 12779 2005-01-04 04:45:00Z gdalsnes $
+ *
+ * COPYRIGHT:       See COPYING in the top level directory
+ * PROJECT:         ReactOS kernel
+ * FILE:            ntoskrnl/ex/evtpair.c
+ * PURPOSE:         Support for event pairs
+ * PROGRAMMER:      David Welch (welch@mcmail.com)
+ * UPDATE HISTORY:
+ *                  Created 22/05/98
+ *                  Updated 09/08/2003 by Skywing (skywing@valhallalegends.com)
+ *                   to correctly maintain ownership of the dispatcher lock
+ *                   between KeSetEvent and KeWaitForSingleObject calls.
+ *                   Additionally, implemented the thread-eventpair routines.
+ */
+
+/* INCLUDES *****************************************************************/
+
+#include <ntoskrnl.h>
+#define NDEBUG
+#include <internal/debug.h>
+
+#ifndef NTSYSAPI
+#define NTSYSAPI
+#endif
+
+#ifndef NTAPI
+#define NTAPI STDCALL
+#endif
+
+
+/* GLOBALS *******************************************************************/
+
+POBJECT_TYPE EXPORTED ExEventPairObjectType = NULL;
+
+static GENERIC_MAPPING ExEventPairMapping = {
+       STANDARD_RIGHTS_READ,
+       STANDARD_RIGHTS_WRITE,
+       STANDARD_RIGHTS_EXECUTE | SYNCHRONIZE,
+       EVENT_PAIR_ALL_ACCESS};
+
+static KSPIN_LOCK ExThreadEventPairSpinLock;
+
+/* FUNCTIONS *****************************************************************/
+
+NTSTATUS STDCALL
+ExpCreateEventPair(PVOID ObjectBody,
+                  PVOID Parent,
+                  PWSTR RemainingPath,
+                  POBJECT_ATTRIBUTES ObjectAttributes)
+{
+  DPRINT("ExpCreateEventPair(ObjectBody %x, Parent %x, RemainingPath %S)\n",
+        ObjectBody, Parent, RemainingPath);
+
+  if (RemainingPath != NULL && wcschr(RemainingPath+1, '\\') != NULL)
+    {
+      return(STATUS_UNSUCCESSFUL);
+    }
+  
+  return(STATUS_SUCCESS);
+}
+
+VOID INIT_FUNCTION
+ExpInitializeEventPairImplementation(VOID)
+{
+   ExEventPairObjectType = ExAllocatePool(NonPagedPool,sizeof(OBJECT_TYPE));
+   
+   RtlCreateUnicodeString(&ExEventPairObjectType->TypeName, L"EventPair");
+   ExEventPairObjectType->Tag = TAG('E', 'v', 'P', 'a');
+   ExEventPairObjectType->PeakObjects = 0;
+   ExEventPairObjectType->PeakHandles = 0;
+   ExEventPairObjectType->TotalObjects = 0;
+   ExEventPairObjectType->TotalHandles = 0;
+   ExEventPairObjectType->PagedPoolCharge = 0;
+   ExEventPairObjectType->NonpagedPoolCharge = sizeof(KEVENT_PAIR);
+   ExEventPairObjectType->Mapping = &ExEventPairMapping;
+   ExEventPairObjectType->Dump = NULL;
+   ExEventPairObjectType->Open = NULL;
+   ExEventPairObjectType->Close = NULL;
+   ExEventPairObjectType->Delete = NULL;
+   ExEventPairObjectType->Parse = NULL;
+   ExEventPairObjectType->Security = NULL;
+   ExEventPairObjectType->QueryName = NULL;
+   ExEventPairObjectType->OkayToClose = NULL;
+   ExEventPairObjectType->Create = ExpCreateEventPair;
+   ExEventPairObjectType->DuplicationNotify = NULL;
+
+   KeInitializeSpinLock(&ExThreadEventPairSpinLock);
+   ObpCreateTypeObject(ExEventPairObjectType);
+}
+
+
+NTSTATUS STDCALL
+NtCreateEventPair(OUT PHANDLE EventPairHandle,
+                 IN ACCESS_MASK DesiredAccess,
+                 IN POBJECT_ATTRIBUTES ObjectAttributes)
+{
+   PKEVENT_PAIR EventPair;
+   NTSTATUS Status;
+
+   DPRINT("NtCreateEventPair()\n");
+   Status = ObCreateObject(ExGetPreviousMode(),
+                          ExEventPairObjectType,
+                          ObjectAttributes,
+                          ExGetPreviousMode(),
+                          NULL,
+                          sizeof(KEVENT_PAIR),
+                          0,
+                          0,
+                          (PVOID*)&EventPair);
+   if (!NT_SUCCESS(Status))
+     {
+       return(Status);
+     }
+
+   KeInitializeEvent(&EventPair->LowEvent,
+                    SynchronizationEvent,
+                    FALSE);
+   KeInitializeEvent(&EventPair->HighEvent,
+                    SynchronizationEvent,
+                    FALSE);
+
+   Status = ObInsertObject ((PVOID)EventPair,
+                           NULL,
+                           DesiredAccess,
+                           0,
+                           NULL,
+                           EventPairHandle);
+
+   ObDereferenceObject(EventPair);
+
+   return Status;
+}
+
+
+NTSTATUS STDCALL
+NtOpenEventPair(OUT PHANDLE EventPairHandle,
+               IN ACCESS_MASK DesiredAccess,
+               IN POBJECT_ATTRIBUTES ObjectAttributes)
+{
+   NTSTATUS Status;
+
+   DPRINT("NtOpenEventPair()\n");
+
+   Status = ObOpenObjectByName(ObjectAttributes,
+                              ExEventPairObjectType,
+                              NULL,
+                              UserMode,
+                              DesiredAccess,
+                              NULL,
+                              EventPairHandle);
+
+   return Status;
+}
+
+
+NTSTATUS STDCALL
+NtSetHighEventPair(IN HANDLE EventPairHandle)
+{
+   PKEVENT_PAIR EventPair;
+   NTSTATUS Status;
+
+   DPRINT("NtSetHighEventPair(EventPairHandle %x)\n",
+         EventPairHandle);
+
+   Status = ObReferenceObjectByHandle(EventPairHandle,
+                                     EVENT_PAIR_ALL_ACCESS,
+                                     ExEventPairObjectType,
+                                     UserMode,
+                                     (PVOID*)&EventPair,
+                                     NULL);
+   if (!NT_SUCCESS(Status))
+     return(Status);
+
+   KeSetEvent(&EventPair->HighEvent,
+             EVENT_INCREMENT,
+             FALSE);
+
+   ObDereferenceObject(EventPair);
+   return(STATUS_SUCCESS);
+}
+
+
+NTSTATUS STDCALL
+NtSetHighWaitLowEventPair(IN HANDLE EventPairHandle)
+{
+   PKEVENT_PAIR EventPair;
+   NTSTATUS Status;
+
+   DPRINT("NtSetHighWaitLowEventPair(EventPairHandle %x)\n",
+         EventPairHandle);
+
+   Status = ObReferenceObjectByHandle(EventPairHandle,
+                                     EVENT_PAIR_ALL_ACCESS,
+                                     ExEventPairObjectType,
+                                     UserMode,
+                                     (PVOID*)&EventPair,
+                                     NULL);
+   if (!NT_SUCCESS(Status))
+     return(Status);
+
+   KeSetEvent(&EventPair->HighEvent,
+             EVENT_INCREMENT,
+             TRUE);
+
+   KeWaitForSingleObject(&EventPair->LowEvent,
+                        WrEventPair,
+                        UserMode,
+                        FALSE,
+                        NULL);
+
+   ObDereferenceObject(EventPair);
+   return(STATUS_SUCCESS);
+}
+
+
+NTSTATUS STDCALL
+NtSetLowEventPair(IN HANDLE EventPairHandle)
+{
+   PKEVENT_PAIR EventPair;
+   NTSTATUS Status;
+
+   DPRINT("NtSetLowEventPair(EventPairHandle %x)\n",
+         EventPairHandle);
+
+   Status = ObReferenceObjectByHandle(EventPairHandle,
+                                     EVENT_PAIR_ALL_ACCESS,
+                                     ExEventPairObjectType,
+                                     UserMode,
+                                     (PVOID*)&EventPair,
+                                     NULL);
+   if (!NT_SUCCESS(Status))
+     return(Status);
+
+   KeSetEvent(&EventPair->LowEvent,
+             EVENT_INCREMENT,
+             FALSE);
+
+   ObDereferenceObject(EventPair);
+   return(STATUS_SUCCESS);
+}
+
+
+NTSTATUS STDCALL
+NtSetLowWaitHighEventPair(IN HANDLE EventPairHandle)
+{
+   PKEVENT_PAIR EventPair;
+   NTSTATUS Status;
+
+   DPRINT("NtSetLowWaitHighEventPair(EventPairHandle %x)\n",
+         EventPairHandle);
+
+   Status = ObReferenceObjectByHandle(EventPairHandle,
+                                     EVENT_PAIR_ALL_ACCESS,
+                                     ExEventPairObjectType,
+                                     UserMode,
+                                     (PVOID*)&EventPair,
+                                     NULL);
+   if (!NT_SUCCESS(Status))
+     return(Status);
+
+   KeSetEvent(&EventPair->LowEvent,
+             EVENT_INCREMENT,
+             TRUE);
+
+   KeWaitForSingleObject(&EventPair->HighEvent,
+                        WrEventPair,
+                        UserMode,
+                        FALSE,
+                        NULL);
+
+   ObDereferenceObject(EventPair);
+   return(STATUS_SUCCESS);
+}
+
+
+NTSTATUS STDCALL
+NtWaitLowEventPair(IN HANDLE EventPairHandle)
+{
+   PKEVENT_PAIR EventPair;
+   NTSTATUS Status;
+
+   DPRINT("NtWaitLowEventPair(EventPairHandle %x)\n",
+         EventPairHandle);
+
+   Status = ObReferenceObjectByHandle(EventPairHandle,
+                                     EVENT_PAIR_ALL_ACCESS,
+                                     ExEventPairObjectType,
+                                     UserMode,
+                                     (PVOID*)&EventPair,
+                                     NULL);
+   if (!NT_SUCCESS(Status))
+     return(Status);
+
+   KeWaitForSingleObject(&EventPair->LowEvent,
+                        WrEventPair,
+                        UserMode,
+                        FALSE,
+                        NULL);
+
+   ObDereferenceObject(EventPair);
+   return(STATUS_SUCCESS);
+}
+
+
+NTSTATUS STDCALL
+NtWaitHighEventPair(IN HANDLE EventPairHandle)
+{
+   PKEVENT_PAIR EventPair;
+   NTSTATUS Status;
+
+   DPRINT("NtWaitHighEventPair(EventPairHandle %x)\n",
+         EventPairHandle);
+
+   Status = ObReferenceObjectByHandle(EventPairHandle,
+                                     EVENT_PAIR_ALL_ACCESS,
+                                     ExEventPairObjectType,
+                                     UserMode,
+                                     (PVOID*)&EventPair,
+                                     NULL);
+   if (!NT_SUCCESS(Status))
+     return(Status);
+
+   KeWaitForSingleObject(&EventPair->HighEvent,
+                        WrEventPair,
+                        UserMode,
+                        FALSE,
+                        NULL);
+
+   ObDereferenceObject(EventPair);
+   return(STATUS_SUCCESS);
+}
+
+#ifdef _ENABLE_THRDEVTPAIR
+
+/*
+ * Author: Skywing (skywing@valhallalegends.com), 09/08/2003
+ * Note that the eventpair spinlock must be acquired when setting the thread
+ * eventpair via NtSetInformationThread.
+ * @implemented
+ */
+NTSTATUS
+NTSYSAPI
+NTAPI
+NtSetLowWaitHighThread(
+       VOID
+       )
+{
+       PETHREAD Thread;
+       PKEVENT_PAIR EventPair;
+       NTSTATUS Status;
+       KIRQL Irql;
+
+       Thread = PsGetCurrentThread();
+
+       if(!Thread->EventPair)
+               return STATUS_NO_EVENT_PAIR;
+
+       KeAcquireSpinLock(&ExThreadEventPairSpinLock, &Irql);
+
+       EventPair = Thread->EventPair;
+
+       if(EventPair)
+               ObReferenceObjectByPointer(EventPair,
+                                          EVENT_PAIR_ALL_ACCESS,
+                                          ExEventPairObjectType,
+                                          UserMode);
+       
+       KeReleaseSpinLock(&ExThreadEventPairSpinLock, Irql);
+
+       if(EventPair == NULL)
+               return STATUS_NO_EVENT_PAIR;
+
+       KeSetEvent(&EventPair->LowEvent,
+               EVENT_INCREMENT,
+               TRUE);
+
+       Status = KeWaitForSingleObject(&EventPair->HighEvent,
+                                      WrEventPair,
+                                      UserMode,
+                                      FALSE,
+                                      NULL);
+
+       ObDereferenceObject(EventPair);
+
+       return Status;
+}
+
+
+/*
+ * Author: Skywing (skywing@valhallalegends.com), 09/08/2003
+ * Note that the eventpair spinlock must be acquired when setting the thread
+ * eventpair via NtSetInformationThread.
+ * @implemented
+ */
+NTSTATUS
+NTSYSAPI
+NTAPI
+NtSetHighWaitLowThread(
+       VOID
+       )
+{
+       PETHREAD Thread;
+       PKEVENT_PAIR EventPair;
+       NTSTATUS Status;
+       KIRQL Irql;
+
+       Thread = PsGetCurrentThread();
+
+       if(!Thread->EventPair)
+               return STATUS_NO_EVENT_PAIR;
+
+       KeAcquireSpinLock(&ExThreadEventPairSpinLock, &Irql);
+
+       EventPair = PsGetCurrentThread()->EventPair;
+
+       if(EventPair)
+               ObReferenceObjectByPointer(EventPair,
+                                          EVENT_PAIR_ALL_ACCESS,
+                                          ExEventPairObjectType,
+                                          UserMode);
+       
+       KeReleaseSpinLock(&ExThreadEventPairSpinLock, Irql);
+
+       if(EventPair == NULL)
+               return STATUS_NO_EVENT_PAIR;
+
+       KeSetEvent(&EventPair->HighEvent,
+               EVENT_INCREMENT,
+               TRUE);
+
+       Status = KeWaitForSingleObject(&EventPair->LowEvent,
+                                      WrEventPair,
+                                      UserMode,
+                                      FALSE,
+                                      NULL);
+
+       ObDereferenceObject(EventPair);
+
+       return Status;
+}
+
+/*
+ * Author: Skywing (skywing@valhallalegends.com), 09/08/2003
+ * Note that the eventpair spinlock must be acquired when waiting on the
+ * eventpair via NtSetLow/HighWaitHigh/LowThread.  Additionally, when
+ * deleting a thread object, NtpSwapThreadEventPair(Thread, NULL) should
+ * be called to release any preexisting eventpair object associated with
+ * the thread.  The Microsoft name for this function is not known.
+ */
+VOID
+ExpSwapThreadEventPair(
+       IN PETHREAD Thread,
+       IN PKEVENT_PAIR EventPair
+       )
+{
+       PKEVENT_PAIR OriginalEventPair;
+       KIRQL Irql;
+
+       KeAcquireSpinLock(&ExThreadEventPairSpinLock, &Irql);
+
+       OriginalEventPair = Thread->EventPair;
+       Thread->EventPair = EventPair;
+
+       if(OriginalEventPair)
+               ObDereferenceObject(OriginalEventPair);
+
+       KeReleaseSpinLock(&ExThreadEventPairSpinLock, Irql);
+}
+
+#else /* !_ENABLE_THRDEVTPAIR */
+
+NTSTATUS
+NTSYSAPI
+NTAPI
+NtSetLowWaitHighThread(
+       VOID
+       )
+{
+        DPRINT1("NtSetLowWaitHighThread() not supported anymore (NT4 only)!\n");
+        return STATUS_NOT_IMPLEMENTED;
+}
+
+NTSTATUS
+NTSYSAPI
+NTAPI
+NtSetHighWaitLowThread(
+       VOID
+       )
+{
+        DPRINT1("NtSetHighWaitLowThread() not supported anymore (NT4 only)!\n");
+        return STATUS_NOT_IMPLEMENTED;
+}
+
+#endif /* _ENABLE_THRDEVTPAIR */
+
+/* EOF */
index 96587e8..c81768b 100644 (file)
@@ -44,6 +44,13 @@ VOID INIT_FUNCTION
 ExInit3 (VOID)
 {
   ExInitializeWorkerThreads();
+  ExpInitializeEventImplementation();
+  ExpInitializeEventPairImplementation();
+  ExpInitializeMutantImplementation();
+  ExpInitializeSemaphoreImplementation();
+  ExpInitializeTimerImplementation();
+  LpcpInitSystem();
+  ExpInitializeProfileImplementation();
   ExpWin32kInit();
   ExpInitUuids();
 }
diff --git a/reactos/ntoskrnl/ex/mutant.c b/reactos/ntoskrnl/ex/mutant.c
new file mode 100644 (file)
index 0000000..624373a
--- /dev/null
@@ -0,0 +1,249 @@
+/*
+ *  ReactOS kernel
+ *  Copyright (C) 1998, 1999, 2000, 2001 ReactOS Team
+ *
+ *  This program is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 2 of the License, or
+ *  (at your option) any later version.
+ *
+ *  This program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with this program; if not, write to the Free Software
+ *  Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ */
+/*
+ * COPYRIGHT:       See COPYING in the top level directory
+ * PROJECT:         ReactOS kernel
+ * FILE:            ntoskrnl/ex/mutant.c
+ * PURPOSE:         Synchronization primitives
+ * PROGRAMMER:      David Welch (welch@cwcom.net)
+ * UPDATE HISTORY:
+ *                  Created 22/05/98
+ */
+
+/* INCLUDES *****************************************************************/
+
+#include <ntoskrnl.h>
+#define NDEBUG
+#include <internal/debug.h>
+
+POBJECT_TYPE ExMutantObjectType = NULL;
+
+static GENERIC_MAPPING ExpMutantMapping = {
+       STANDARD_RIGHTS_READ | SYNCHRONIZE | MUTANT_QUERY_STATE,
+       STANDARD_RIGHTS_WRITE | SYNCHRONIZE,
+       STANDARD_RIGHTS_EXECUTE | SYNCHRONIZE | MUTANT_QUERY_STATE,
+       MUTANT_ALL_ACCESS};
+
+/* FUNCTIONS *****************************************************************/
+
+
+NTSTATUS STDCALL
+ExpCreateMutant(PVOID ObjectBody,
+               PVOID Parent,
+               PWSTR RemainingPath,
+               POBJECT_ATTRIBUTES ObjectAttributes)
+{
+  DPRINT("NtpCreateMutant(ObjectBody %x, Parent %x, RemainingPath %S)\n",
+        ObjectBody, Parent, RemainingPath);
+
+  if (RemainingPath != NULL && wcschr(RemainingPath+1, '\\') != NULL)
+    {
+      return(STATUS_UNSUCCESSFUL);
+    }
+
+  return(STATUS_SUCCESS);
+}
+
+
+VOID STDCALL
+ExpDeleteMutant(PVOID ObjectBody)
+{
+  DPRINT("NtpDeleteMutant(ObjectBody %x)\n", ObjectBody);
+
+  KeReleaseMutant((PKMUTANT)ObjectBody,
+                 MUTANT_INCREMENT,
+                 TRUE,
+                 FALSE);
+}
+
+
+VOID INIT_FUNCTION
+ExpInitializeMutantImplementation(VOID)
+{
+  ExMutantObjectType = ExAllocatePool(NonPagedPool,sizeof(OBJECT_TYPE));
+
+  RtlCreateUnicodeString(&ExMutantObjectType->TypeName, L"Mutant");
+
+  ExMutantObjectType->Tag = TAG('M', 'T', 'N', 'T');
+  ExMutantObjectType->PeakObjects = 0;
+  ExMutantObjectType->PeakHandles = 0;
+  ExMutantObjectType->TotalObjects = 0;
+  ExMutantObjectType->TotalHandles = 0;
+  ExMutantObjectType->PagedPoolCharge = 0;
+  ExMutantObjectType->NonpagedPoolCharge = sizeof(KMUTANT);
+  ExMutantObjectType->Mapping = &ExpMutantMapping;
+  ExMutantObjectType->Dump = NULL;
+  ExMutantObjectType->Open = NULL;
+  ExMutantObjectType->Close = NULL;
+  ExMutantObjectType->Delete = ExpDeleteMutant;
+  ExMutantObjectType->Parse = NULL;
+  ExMutantObjectType->Security = NULL;
+  ExMutantObjectType->QueryName = NULL;
+  ExMutantObjectType->OkayToClose = NULL;
+  ExMutantObjectType->Create = ExpCreateMutant;
+  ExMutantObjectType->DuplicationNotify = NULL;
+
+  ObpCreateTypeObject(ExMutantObjectType);
+}
+
+
+NTSTATUS STDCALL
+NtCreateMutant(OUT PHANDLE MutantHandle,
+              IN ACCESS_MASK DesiredAccess,
+              IN POBJECT_ATTRIBUTES ObjectAttributes  OPTIONAL,
+              IN BOOLEAN InitialOwner)
+{
+  PKMUTEX Mutant;
+  NTSTATUS Status;
+
+  Status = ObCreateObject(ExGetPreviousMode(),
+                         ExMutantObjectType,
+                         ObjectAttributes,
+                         ExGetPreviousMode(),
+                         NULL,
+                         sizeof(KMUTANT),
+                         0,
+                         0,
+                         (PVOID*)&Mutant);
+  if (!NT_SUCCESS(Status))
+    {
+      return(Status);
+    }
+
+  KeInitializeMutant(Mutant,
+                    InitialOwner);
+
+  Status = ObInsertObject ((PVOID)Mutant,
+                          NULL,
+                          DesiredAccess,
+                          0,
+                          NULL,
+                          MutantHandle);
+
+  ObDereferenceObject(Mutant);
+
+  return Status;
+}
+
+
+NTSTATUS STDCALL
+NtOpenMutant(OUT PHANDLE MutantHandle,
+            IN ACCESS_MASK DesiredAccess,
+            IN POBJECT_ATTRIBUTES ObjectAttributes)
+{
+  return(ObOpenObjectByName(ObjectAttributes,
+                           ExMutantObjectType,
+                           NULL,
+                           ExGetPreviousMode(),
+                           DesiredAccess,
+                           NULL,
+                           MutantHandle));
+}
+
+
+NTSTATUS STDCALL
+NtQueryMutant(IN HANDLE MutantHandle,
+             IN MUTANT_INFORMATION_CLASS MutantInformationClass,
+             OUT PVOID MutantInformation,
+             IN ULONG MutantInformationLength,
+             OUT PULONG ResultLength  OPTIONAL)
+{
+  MUTANT_BASIC_INFORMATION SafeMutantInformation;
+  PKMUTANT Mutant;
+  NTSTATUS Status;
+
+  if (MutantInformationClass > MutantBasicInformation)
+    return(STATUS_INVALID_INFO_CLASS);
+
+  if (MutantInformationLength < sizeof(MUTANT_BASIC_INFORMATION))
+    return(STATUS_INFO_LENGTH_MISMATCH);
+
+  Status = ObReferenceObjectByHandle(MutantHandle,
+                                    MUTANT_QUERY_STATE,
+                                    ExMutantObjectType,
+                                    ExGetPreviousMode(),
+                                    (PVOID*)&Mutant,
+                                    NULL);
+  if (!NT_SUCCESS(Status))
+    {
+      return(Status);
+    }
+
+  SafeMutantInformation.Count = KeReadStateMutant(Mutant);
+  SafeMutantInformation.Owned = (Mutant->OwnerThread != NULL);
+  SafeMutantInformation.Abandoned = Mutant->Abandoned;
+
+  ObDereferenceObject(Mutant);
+  
+  Status = MmCopyToCaller(MutantInformation, &SafeMutantInformation, sizeof(MUTANT_BASIC_INFORMATION));
+  if(NT_SUCCESS(Status))
+  {
+    if(ResultLength != NULL)
+    {
+      ULONG RetLen = sizeof(MUTANT_BASIC_INFORMATION);
+      Status = MmCopyToCaller(ResultLength, &RetLen, sizeof(ULONG));
+    }
+    else
+    {
+      Status = STATUS_SUCCESS;
+    }
+  }
+
+  return Status;
+}
+
+
+NTSTATUS STDCALL
+NtReleaseMutant(IN HANDLE MutantHandle,
+               IN PLONG PreviousCount  OPTIONAL)
+{
+  PKMUTANT Mutant;
+  NTSTATUS Status;
+  LONG Count;
+
+  Status = ObReferenceObjectByHandle(MutantHandle,
+                                    MUTANT_ALL_ACCESS,
+                                    ExMutantObjectType,
+                                    ExGetPreviousMode(),
+                                    (PVOID*)&Mutant,
+                                    NULL);
+  if (!NT_SUCCESS(Status))
+    {
+      return(Status);
+    }
+
+  Count = KeReleaseMutant(Mutant,
+                         MUTANT_INCREMENT,
+                         0,
+                         FALSE);
+  ObDereferenceObject(Mutant);
+
+  if (PreviousCount != NULL)
+    {
+      Status = MmCopyToCaller(PreviousCount, &Count, sizeof(LONG));
+    }
+  else
+    {
+      Status = STATUS_SUCCESS;
+    }
+
+  return Status;
+}
+
+/* EOF */
diff --git a/reactos/ntoskrnl/ex/profile.c b/reactos/ntoskrnl/ex/profile.c
new file mode 100644 (file)
index 0000000..d6dcf39
--- /dev/null
@@ -0,0 +1,309 @@
+/*
+ *  ReactOS kernel
+ *  Copyright (C) 1998, 1999, 2000, 2001 ReactOS Team
+ *
+ *  This program is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 2 of the License, or
+ *  (at your option) any later version.
+ *
+ *  This program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with this program; if not, write to the Free Software
+ *  Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ */
+/*
+ * PROJECT:         ReactOS kernel
+ * FILE:            ntoskrnl/nt/profile.c
+ * PURPOSE:         Support for profiling
+ * PROGRAMMER:      Nobody
+ * UPDATE HISTORY:
+ *                  
+ */
+
+/* INCLUDES *****************************************************************/
+
+#include <ntoskrnl.h>
+#include <internal/debug.h>
+
+/* TYPES ********************************************************************/
+
+/* GLOBALS *******************************************************************/
+
+POBJECT_TYPE EXPORTED ExProfileObjectType = NULL;
+
+static GENERIC_MAPPING ExpProfileMapping = {
+       STANDARD_RIGHTS_READ,
+       STANDARD_RIGHTS_WRITE,
+       STANDARD_RIGHTS_EXECUTE,
+       STANDARD_RIGHTS_ALL};
+
+/*
+ * Size of the profile hash table.
+ */
+#define PROFILE_HASH_TABLE_SIZE      (32)
+
+/*
+ * Table of lists of per-process profiling data structures hashed by PID.
+ */
+LIST_ENTRY ProcessProfileListHashTable[PROFILE_HASH_TABLE_SIZE];
+
+/*
+ * Head of the list of profile data structures for the kernel.
+ */
+LIST_ENTRY SystemProfileList;
+
+/*
+ * Lock that protects the profiling data structures.
+ */
+KSPIN_LOCK ProfileListLock;
+
+/*
+ * Timer interrupts happen before we have initialized the profiling
+ * data structures so just ignore them before that.
+ */
+BOOLEAN ProfileInitDone = FALSE;
+
+VOID INIT_FUNCTION
+ExpInitializeProfileImplementation(VOID)
+{
+  ULONG i;
+
+  InitializeListHead(&SystemProfileList);
+  
+  for (i = 0; i < PROFILE_HASH_TABLE_SIZE; i++)
+    {
+      InitializeListHead(&ProcessProfileListHashTable[i]);
+    }
+
+  KeInitializeSpinLock(&ProfileListLock);
+  ProfileInitDone = TRUE;
+
+  ExProfileObjectType = ExAllocatePool(NonPagedPool,sizeof(OBJECT_TYPE));
+  
+  RtlCreateUnicodeString(&ExProfileObjectType->TypeName, L"Profile");
+  
+  ExProfileObjectType->Tag = TAG('P', 'R', 'O', 'F');
+  ExProfileObjectType->PeakObjects = 0;
+  ExProfileObjectType->PeakHandles = 0;
+  ExProfileObjectType->TotalObjects = 0;
+  ExProfileObjectType->TotalHandles = 0;
+  ExProfileObjectType->PagedPoolCharge = 0;
+  ExProfileObjectType->NonpagedPoolCharge = sizeof(KPROFILE);
+  ExProfileObjectType->Mapping = &ExpProfileMapping;
+  ExProfileObjectType->Dump = NULL;
+  ExProfileObjectType->Open = NULL;
+  ExProfileObjectType->Close = NULL;
+  ExProfileObjectType->Delete = KiDeleteProfile;
+  ExProfileObjectType->Parse = NULL;
+  ExProfileObjectType->Security = NULL;
+  ExProfileObjectType->QueryName = NULL;
+  ExProfileObjectType->OkayToClose = NULL;
+  ExProfileObjectType->Create = NULL;
+
+  ObpCreateTypeObject(ExProfileObjectType);
+}
+
+NTSTATUS STDCALL 
+NtCreateProfile(OUT PHANDLE ProfileHandle,
+               IN HANDLE Process  OPTIONAL,
+               IN PVOID ImageBase, 
+               IN ULONG ImageSize, 
+               IN ULONG BucketSize,
+               IN PVOID Buffer,
+               IN ULONG BufferSize,
+               IN KPROFILE_SOURCE ProfileSource,
+               IN KAFFINITY Affinity)
+{
+  HANDLE SafeProfileHandle;
+  NTSTATUS Status;
+  PKPROFILE Profile;
+  PEPROCESS pProcess;
+
+  /*
+   * Reference the associated process
+   */
+  if (Process != NULL)
+    {
+      Status = ObReferenceObjectByHandle(Process,
+                                        PROCESS_QUERY_INFORMATION,
+                                        PsProcessType,
+                                        UserMode,
+                                        (PVOID*)&pProcess,
+                                        NULL);
+      if (!NT_SUCCESS(Status))
+       {
+         return(Status);
+       }
+    }
+  else
+    {
+      pProcess = NULL;
+      /* FIXME: Check privilege. */
+    }
+
+  /*
+   * Check the parameters
+   */
+  if ((pProcess == NULL && ImageBase < (PVOID)KERNEL_BASE) ||
+      (pProcess != NULL && ImageBase >= (PVOID)KERNEL_BASE))
+    {
+      return(STATUS_INVALID_PARAMETER_3);
+    }
+  if (((ImageSize >> BucketSize) * 4) >= BufferSize)
+    {
+      return(STATUS_BUFFER_TOO_SMALL);
+    }
+  if (ProfileSource != ProfileTime)
+    {
+      return(STATUS_INVALID_PARAMETER_9);
+    }
+  if (Affinity != 0)
+    {
+      return(STATUS_INVALID_PARAMETER_10);
+    }
+
+  /*
+   * Create the object
+   */
+  Status = ObCreateObject(ExGetPreviousMode(),
+                         ExProfileObjectType,
+                         NULL,
+                         ExGetPreviousMode(),
+                         NULL,
+                         sizeof(KPROFILE),
+                         0,
+                         0,
+                         (PVOID*)&Profile);
+  if (!NT_SUCCESS(Status))
+     {
+       return(Status);
+     }
+
+  /*
+   * Initialize it
+   */
+  Profile->Base = ImageBase;
+  Profile->Size = ImageSize;
+  Profile->BucketShift = BucketSize;
+  Profile->BufferMdl = MmCreateMdl(NULL, Buffer, BufferSize);
+  if(Profile->BufferMdl == NULL) {
+       DPRINT("MmCreateMdl: Out of memory!");
+       return(STATUS_NO_MEMORY);
+  }  
+  MmProbeAndLockPages(Profile->BufferMdl, UserMode, IoWriteAccess);
+  Profile->Buffer = MmGetSystemAddressForMdl(Profile->BufferMdl);
+  Profile->BufferSize = BufferSize;
+  Profile->ProcessorMask = Affinity;
+  Profile->Started = FALSE;
+  Profile->Process = pProcess;
+
+  /*
+   * Insert the profile into the profile list data structures
+   */
+  KiInsertProfile(Profile);
+
+  Status = ObInsertObject ((PVOID)Profile,
+                          NULL,
+                          STANDARD_RIGHTS_ALL,
+                          0,
+                          NULL,
+                          &SafeProfileHandle);
+  if (!NT_SUCCESS(Status))
+    {
+      ObDereferenceObject (Profile);
+      return Status;
+    }
+
+  /*
+   * Copy the created handle back to the caller
+   */
+  Status = MmCopyToCaller(ProfileHandle, &SafeProfileHandle, sizeof(HANDLE));
+  if (!NT_SUCCESS(Status))
+     {
+       ObDereferenceObject(Profile);
+       ZwClose(ProfileHandle);
+       return(Status);
+     }
+
+  ObDereferenceObject(Profile);
+
+  return(STATUS_SUCCESS);
+}
+
+NTSTATUS STDCALL 
+NtQueryIntervalProfile(IN  KPROFILE_SOURCE ProfileSource,
+                      OUT PULONG Interval)
+{
+  NTSTATUS Status;
+
+  if (ProfileSource == ProfileTime)
+    {
+      ULONG SafeInterval;
+
+      /* FIXME: What units does this use, for now nanoseconds */
+      SafeInterval = 100;
+      Status = MmCopyToCaller(Interval, &SafeInterval, sizeof(ULONG));
+      if (!NT_SUCCESS(Status))
+       {
+         return(Status);
+       }
+      return(STATUS_SUCCESS);
+    }
+  return(STATUS_INVALID_PARAMETER_2);
+}
+
+NTSTATUS STDCALL 
+NtSetIntervalProfile(IN ULONG Interval,
+                    IN KPROFILE_SOURCE Source)
+{
+  return(STATUS_NOT_IMPLEMENTED);
+}
+
+NTSTATUS STDCALL 
+NtStartProfile(IN HANDLE ProfileHandle)
+{
+  NTSTATUS Status;
+  PKPROFILE Profile;
+
+  Status = ObReferenceObjectByHandle(ProfileHandle,
+                                    STANDARD_RIGHTS_ALL,
+                                    ExProfileObjectType,
+                                    UserMode,
+                                    (PVOID*)&Profile,
+                                    NULL);
+  if (!NT_SUCCESS(Status))
+    {
+      return(Status);
+    }
+  Profile->Started = TRUE;
+  ObDereferenceObject(Profile);
+  return(STATUS_SUCCESS);
+}
+
+NTSTATUS STDCALL 
+NtStopProfile(IN HANDLE ProfileHandle)
+{
+  NTSTATUS Status;
+  PKPROFILE Profile;
+
+  Status = ObReferenceObjectByHandle(ProfileHandle,
+                                    STANDARD_RIGHTS_ALL,
+                                    ExProfileObjectType,
+                                    UserMode,
+                                    (PVOID*)&Profile,
+                                    NULL);
+  if (!NT_SUCCESS(Status))
+    {
+      return(Status);
+    }
+  Profile->Started = FALSE;
+  ObDereferenceObject(Profile);
+  return(STATUS_SUCCESS);
+}
+
+
diff --git a/reactos/ntoskrnl/ex/sem.c b/reactos/ntoskrnl/ex/sem.c
new file mode 100644 (file)
index 0000000..46ae719
--- /dev/null
@@ -0,0 +1,201 @@
+/* $Id: ntsem.c 12779 2005-01-04 04:45:00Z gdalsnes $
+ *
+ * COPYRIGHT:       See COPYING in the top level directory
+ * PROJECT:         ReactOS kernel
+ * FILE:            ntoskrnl/ex/sem.c
+ * PURPOSE:         Synchronization primitives
+ * PROGRAMMER:      David Welch (welch@mcmail.com)
+ * UPDATE HISTORY:
+ *                  Created 22/05/98
+ */
+
+/* INCLUDES *****************************************************************/
+
+#include <ntoskrnl.h>
+#define NDEBUG
+#include <internal/debug.h>
+
+/* GLOBALS ******************************************************************/
+
+POBJECT_TYPE ExSemaphoreObjectType;
+
+static GENERIC_MAPPING ExSemaphoreMapping = {
+       STANDARD_RIGHTS_READ | SEMAPHORE_QUERY_STATE,
+       STANDARD_RIGHTS_WRITE | SEMAPHORE_MODIFY_STATE,
+       STANDARD_RIGHTS_EXECUTE | SYNCHRONIZE | SEMAPHORE_QUERY_STATE,
+       SEMAPHORE_ALL_ACCESS};
+
+/* FUNCTIONS *****************************************************************/
+
+NTSTATUS STDCALL
+ExpCreateSemaphore(PVOID ObjectBody,
+                  PVOID Parent,
+                  PWSTR RemainingPath,
+                  POBJECT_ATTRIBUTES ObjectAttributes)
+{
+  DPRINT("NtpCreateSemaphore(ObjectBody %x, Parent %x, RemainingPath %S)\n",
+        ObjectBody, Parent, RemainingPath);
+
+  if (RemainingPath != NULL && wcschr(RemainingPath+1, '\\') != NULL)
+    {
+      return(STATUS_UNSUCCESSFUL);
+    }
+
+  return(STATUS_SUCCESS);
+}
+
+VOID INIT_FUNCTION
+ExpInitializeSemaphoreImplementation(VOID)
+{
+   ExSemaphoreObjectType = ExAllocatePool(NonPagedPool, sizeof(OBJECT_TYPE));
+   
+   RtlCreateUnicodeString(&ExSemaphoreObjectType->TypeName, L"Semaphore");
+   
+   ExSemaphoreObjectType->Tag = TAG('S', 'E', 'M', 'T');
+   ExSemaphoreObjectType->PeakObjects = 0;
+   ExSemaphoreObjectType->PeakHandles = 0;
+   ExSemaphoreObjectType->TotalObjects = 0;
+   ExSemaphoreObjectType->TotalHandles = 0;
+   ExSemaphoreObjectType->PagedPoolCharge = 0;
+   ExSemaphoreObjectType->NonpagedPoolCharge = sizeof(KSEMAPHORE);
+   ExSemaphoreObjectType->Mapping = &ExSemaphoreMapping;
+   ExSemaphoreObjectType->Dump = NULL;
+   ExSemaphoreObjectType->Open = NULL;
+   ExSemaphoreObjectType->Close = NULL;
+   ExSemaphoreObjectType->Delete = NULL;
+   ExSemaphoreObjectType->Parse = NULL;
+   ExSemaphoreObjectType->Security = NULL;
+   ExSemaphoreObjectType->QueryName = NULL;
+   ExSemaphoreObjectType->OkayToClose = NULL;
+   ExSemaphoreObjectType->Create = ExpCreateSemaphore;
+   ExSemaphoreObjectType->DuplicationNotify = NULL;
+
+   ObpCreateTypeObject(ExSemaphoreObjectType);
+}
+
+NTSTATUS STDCALL
+NtCreateSemaphore(OUT PHANDLE SemaphoreHandle,
+                 IN ACCESS_MASK DesiredAccess,
+                 IN POBJECT_ATTRIBUTES ObjectAttributes  OPTIONAL,
+                 IN LONG InitialCount,
+                 IN LONG MaximumCount)
+{
+   PKSEMAPHORE Semaphore;
+   NTSTATUS Status;
+
+   Status = ObCreateObject(ExGetPreviousMode(),
+                          ExSemaphoreObjectType,
+                          ObjectAttributes,
+                          ExGetPreviousMode(),
+                          NULL,
+                          sizeof(KSEMAPHORE),
+                          0,
+                          0,
+                          (PVOID*)&Semaphore);
+   if (!NT_SUCCESS(Status))
+     {
+       return(Status);
+     }
+
+   KeInitializeSemaphore(Semaphore,
+                        InitialCount,
+                        MaximumCount);
+
+   Status = ObInsertObject ((PVOID)Semaphore,
+                           NULL,
+                           DesiredAccess,
+                           0,
+                           NULL,
+                           SemaphoreHandle);
+
+   ObDereferenceObject(Semaphore);
+
+   return Status;
+}
+
+
+NTSTATUS STDCALL
+NtOpenSemaphore(IN HANDLE SemaphoreHandle,
+               IN ACCESS_MASK  DesiredAccess,
+               IN POBJECT_ATTRIBUTES ObjectAttributes)
+{
+   NTSTATUS Status;
+   
+   Status = ObOpenObjectByName(ObjectAttributes,
+                              ExSemaphoreObjectType,
+                              NULL,
+                              UserMode,
+                              DesiredAccess,
+                              NULL,
+                              SemaphoreHandle);
+   
+   return Status;
+}
+
+
+NTSTATUS STDCALL
+NtQuerySemaphore(IN HANDLE SemaphoreHandle,
+                IN SEMAPHORE_INFORMATION_CLASS SemaphoreInformationClass,
+                OUT PVOID SemaphoreInformation,
+                IN ULONG SemaphoreInformationLength,
+                OUT PULONG ReturnLength  OPTIONAL)
+{
+   PSEMAPHORE_BASIC_INFORMATION Info;
+   PKSEMAPHORE Semaphore;
+   NTSTATUS Status;
+
+   Info = (PSEMAPHORE_BASIC_INFORMATION)SemaphoreInformation;
+
+   if (SemaphoreInformationClass > SemaphoreBasicInformation)
+     return STATUS_INVALID_INFO_CLASS;
+
+   if (SemaphoreInformationLength < sizeof(SEMAPHORE_BASIC_INFORMATION))
+     return STATUS_INFO_LENGTH_MISMATCH;
+
+   Status = ObReferenceObjectByHandle(SemaphoreHandle,
+                                     SEMAPHORE_QUERY_STATE,
+                                     ExSemaphoreObjectType,
+                                     UserMode,
+                                     (PVOID*)&Semaphore,
+                                     NULL);
+   if (!NT_SUCCESS(Status))
+     return Status;
+
+   Info->CurrentCount = KeReadStateSemaphore(Semaphore);
+   Info->MaximumCount = Semaphore->Limit;
+
+   if (ReturnLength != NULL)
+     *ReturnLength = sizeof(SEMAPHORE_BASIC_INFORMATION);
+
+   ObDereferenceObject(Semaphore);
+
+   return STATUS_SUCCESS;
+}
+
+NTSTATUS STDCALL
+NtReleaseSemaphore(IN HANDLE SemaphoreHandle,
+                  IN LONG ReleaseCount,
+                  OUT PLONG PreviousCount  OPTIONAL)
+{
+   PKSEMAPHORE Semaphore;
+   NTSTATUS Status;
+   
+   Status = ObReferenceObjectByHandle(SemaphoreHandle,
+                                     SEMAPHORE_MODIFY_STATE,
+                                     ExSemaphoreObjectType,
+                                     UserMode,
+                                     (PVOID*)&Semaphore,
+                                     NULL);
+   if (!NT_SUCCESS(Status))
+     {
+       return(Status);
+     }
+   KeReleaseSemaphore(Semaphore,
+                     IO_NO_INCREMENT,
+                     ReleaseCount,
+                     FALSE);
+   ObDereferenceObject(Semaphore);
+   return(STATUS_SUCCESS);
+}
+
+/* EOF */
diff --git a/reactos/ntoskrnl/ex/timer.c b/reactos/ntoskrnl/ex/timer.c
new file mode 100644 (file)
index 0000000..459fb47
--- /dev/null
@@ -0,0 +1,381 @@
+/* $Id: nttimer.c 12779 2005-01-04 04:45:00Z gdalsnes $
+ *
+ * COPYRIGHT:       See COPYING in the top level directory
+ * PROJECT:         ReactOS kernel
+ * FILE:            ntoskrnl/ex/timer.c
+ * PURPOSE:         User-mode timers
+ * PROGRAMMER:      David Welch (welch@mcmail.com)
+ * UPDATE HISTORY:
+ *                  Created 22/05/98
+ */
+
+/* INCLUDES *****************************************************************/
+
+#include <ntoskrnl.h>
+#include <internal/debug.h>
+
+
+/* TYPES ********************************************************************/
+
+typedef struct _NTTIMER
+{
+   KTIMER Timer;
+   KDPC Dpc;
+   KAPC Apc;
+   BOOLEAN Running;
+} NTTIMER, *PNTTIMER;
+
+
+/* GLOBALS ******************************************************************/
+
+POBJECT_TYPE ExTimerType = NULL;
+
+static GENERIC_MAPPING ExpTimerMapping = {
+       STANDARD_RIGHTS_READ | TIMER_QUERY_STATE,
+       STANDARD_RIGHTS_WRITE | TIMER_MODIFY_STATE,
+       STANDARD_RIGHTS_EXECUTE | SYNCHRONIZE,
+       TIMER_ALL_ACCESS};
+
+
+/* FUNCTIONS *****************************************************************/
+
+NTSTATUS STDCALL
+ExpCreateTimer(PVOID ObjectBody,
+              PVOID Parent,
+              PWSTR RemainingPath,
+              POBJECT_ATTRIBUTES ObjectAttributes)
+{
+  DPRINT("ExpCreateTimer(ObjectBody %x, Parent %x, RemainingPath %S)\n",
+        ObjectBody, Parent, RemainingPath);
+
+  if (RemainingPath != NULL && wcschr(RemainingPath+1, '\\') != NULL)
+    {
+      return(STATUS_UNSUCCESSFUL);
+    }
+
+  return(STATUS_SUCCESS);
+}
+
+
+VOID STDCALL
+ExpDeleteTimer(PVOID ObjectBody)
+{
+   KIRQL OldIrql;
+   PNTTIMER Timer = ObjectBody;
+
+   DPRINT("ExpDeleteTimer()\n");
+
+   OldIrql = KeRaiseIrqlToDpcLevel();
+
+   KeCancelTimer(&Timer->Timer);
+   KeRemoveQueueDpc(&Timer->Dpc);
+   KeRemoveQueueApc(&Timer->Apc);
+   Timer->Running = FALSE;
+
+   KeLowerIrql(OldIrql);
+}
+
+
+VOID STDCALL
+ExpTimerDpcRoutine(PKDPC Dpc,
+                  PVOID DeferredContext,
+                  PVOID SystemArgument1,
+                  PVOID SystemArgument2)
+{
+   PNTTIMER Timer;
+
+   DPRINT("ExpTimerDpcRoutine()\n");
+
+   Timer = (PNTTIMER)DeferredContext;
+
+   if ( Timer->Running )
+     {
+       KeInsertQueueApc(&Timer->Apc,
+                       SystemArgument1,
+                       SystemArgument2,
+                       IO_NO_INCREMENT);
+     }
+}
+
+
+VOID STDCALL
+ExpTimerApcKernelRoutine(PKAPC Apc,
+                        PKNORMAL_ROUTINE* NormalRoutine,
+                        PVOID* NormalContext,
+                        PVOID* SystemArgument1,
+                        PVOID* SystemArguemnt2)
+{
+   DPRINT("ExpTimerApcKernelRoutine()\n");
+
+}
+
+
+VOID INIT_FUNCTION
+ExpInitializeTimerImplementation(VOID)
+{
+   ASSERT(!ExTimerType)
+   ExTimerType = ExAllocatePool(NonPagedPool, sizeof(OBJECT_TYPE));
+
+   RtlCreateUnicodeString(&ExTimerType->TypeName, L"Timer");
+
+   ExTimerType->Tag = TAG('T', 'I', 'M', 'T');
+   ExTimerType->PeakObjects = 0;
+   ExTimerType->PeakHandles = 0;
+   ExTimerType->TotalObjects = 0;
+   ExTimerType->TotalHandles = 0;
+   ExTimerType->PagedPoolCharge = 0;
+   ExTimerType->NonpagedPoolCharge = sizeof(NTTIMER);
+   ExTimerType->Mapping = &ExpTimerMapping;
+   ExTimerType->Dump = NULL;
+   ExTimerType->Open = NULL;
+   ExTimerType->Close = NULL;
+   ExTimerType->Delete = ExpDeleteTimer;
+   ExTimerType->Parse = NULL;
+   ExTimerType->Security = NULL;
+   ExTimerType->QueryName = NULL;
+   ExTimerType->OkayToClose = NULL;
+   ExTimerType->Create = ExpCreateTimer;
+   ExTimerType->DuplicationNotify = NULL;
+
+   ObpCreateTypeObject(ExTimerType);
+}
+
+
+NTSTATUS STDCALL
+NtCancelTimer(IN HANDLE TimerHandle,
+             OUT PBOOLEAN CurrentState OPTIONAL)
+{
+   PNTTIMER Timer;
+   NTSTATUS Status;
+   BOOLEAN State;
+   KIRQL OldIrql;
+
+   DPRINT("NtCancelTimer()\n");
+   Status = ObReferenceObjectByHandle(TimerHandle,
+                                     TIMER_ALL_ACCESS,
+                                     ExTimerType,
+                                     UserMode,
+                                     (PVOID*)&Timer,
+                                     NULL);
+   if (!NT_SUCCESS(Status))
+     return Status;
+
+   OldIrql = KeRaiseIrqlToDpcLevel();
+
+   State = KeCancelTimer(&Timer->Timer);
+   KeRemoveQueueDpc(&Timer->Dpc);
+   KeRemoveQueueApc(&Timer->Apc);
+   Timer->Running = FALSE;
+
+   KeLowerIrql(OldIrql);
+   ObDereferenceObject(Timer);
+
+   if (CurrentState != NULL)
+     {
+       *CurrentState = State;
+     }
+
+   return STATUS_SUCCESS;
+}
+
+
+NTSTATUS STDCALL
+NtCreateTimer(OUT PHANDLE TimerHandle,
+             IN ACCESS_MASK DesiredAccess,
+             IN POBJECT_ATTRIBUTES ObjectAttributes OPTIONAL,
+             IN TIMER_TYPE TimerType)
+{
+   PNTTIMER Timer;
+   NTSTATUS Status;
+
+   DPRINT("NtCreateTimer()\n");
+   Status = ObCreateObject(ExGetPreviousMode(),
+                          ExTimerType,
+                          ObjectAttributes,
+                          ExGetPreviousMode(),
+                          NULL,
+                          sizeof(NTTIMER),
+                          0,
+                          0,
+                          (PVOID*)&Timer);
+   if (!NT_SUCCESS(Status))
+     return Status;
+
+   KeInitializeTimerEx(&Timer->Timer,
+                      TimerType);
+
+   KeInitializeDpc(&Timer->Dpc,
+                  &ExpTimerDpcRoutine,
+                  Timer);
+
+   Timer->Running = FALSE;
+
+   Status = ObInsertObject ((PVOID)Timer,
+                           NULL,
+                           DesiredAccess,
+                           0,
+                           NULL,
+                           TimerHandle);
+
+   ObDereferenceObject(Timer);
+
+   return Status;
+}
+
+
+NTSTATUS STDCALL
+NtOpenTimer(OUT PHANDLE TimerHandle,
+           IN ACCESS_MASK DesiredAccess,
+           IN POBJECT_ATTRIBUTES ObjectAttributes)
+{
+   NTSTATUS Status;
+
+   Status = ObOpenObjectByName(ObjectAttributes,
+                              ExTimerType,
+                              NULL,
+                              UserMode,
+                              DesiredAccess,
+                              NULL,
+                              TimerHandle);
+   return Status;
+}
+
+
+NTSTATUS STDCALL
+NtQueryTimer(IN HANDLE TimerHandle,
+            IN TIMER_INFORMATION_CLASS TimerInformationClass,
+            OUT PVOID TimerInformation,
+            IN ULONG TimerInformationLength,
+            OUT PULONG ReturnLength  OPTIONAL)
+{
+  PNTTIMER Timer;
+  TIMER_BASIC_INFORMATION SafeTimerInformation;
+  ULONG ResultLength;
+  NTSTATUS Status;
+
+  Status = ObReferenceObjectByHandle(TimerHandle,
+                                    TIMER_QUERY_STATE,
+                                    ExTimerType,
+                                    (KPROCESSOR_MODE)KeGetPreviousMode(),
+                                    (PVOID*)&Timer,
+                                    NULL);
+  if (!NT_SUCCESS(Status))
+    {
+      return(Status);
+    }
+
+  if (TimerInformationClass != TimerBasicInformation)
+    {
+      ObDereferenceObject(Timer);
+      return(STATUS_INVALID_INFO_CLASS);
+    }
+  if (TimerInformationLength < sizeof(TIMER_BASIC_INFORMATION))
+    {
+      ObDereferenceObject(Timer);
+      return(STATUS_INFO_LENGTH_MISMATCH);
+    }
+
+  memcpy(&SafeTimerInformation.TimeRemaining, &Timer->Timer.DueTime,
+        sizeof(LARGE_INTEGER));
+  SafeTimerInformation.SignalState = (BOOLEAN)Timer->Timer.Header.SignalState;
+  ResultLength = sizeof(TIMER_BASIC_INFORMATION);
+
+  Status = MmCopyToCaller(TimerInformation, &SafeTimerInformation,
+                         sizeof(TIMER_BASIC_INFORMATION));
+  if (!NT_SUCCESS(Status))
+    {
+      ObDereferenceObject(Timer);
+      return(Status);
+    }
+
+  if (ReturnLength != NULL)
+    {
+      Status = MmCopyToCaller(ReturnLength, &ResultLength,
+                             sizeof(ULONG));
+      if (!NT_SUCCESS(Status))
+       {
+         ObDereferenceObject(Timer);
+         return(Status);
+       }
+    }
+  ObDereferenceObject(Timer);
+  return(STATUS_SUCCESS);
+}
+
+
+NTSTATUS STDCALL
+NtSetTimer(IN HANDLE TimerHandle,
+          IN PLARGE_INTEGER DueTime,
+          IN PTIMER_APC_ROUTINE TimerApcRoutine  OPTIONAL,
+          IN PVOID TimerContext  OPTIONAL,
+          IN BOOLEAN ResumeTimer,
+          IN LONG Period  OPTIONAL,
+          OUT PBOOLEAN PreviousState  OPTIONAL)
+{
+   PNTTIMER Timer;
+   NTSTATUS Status;
+   BOOLEAN Result;
+   BOOLEAN State;
+
+   DPRINT("NtSetTimer()\n");
+
+   Status = ObReferenceObjectByHandle(TimerHandle,
+                                     TIMER_ALL_ACCESS,
+                                     ExTimerType,
+                                     (KPROCESSOR_MODE)KeGetPreviousMode(),
+                                     (PVOID*)&Timer,
+                                     NULL);
+   if (!NT_SUCCESS(Status))
+     {
+       return Status;
+     }
+
+   State = KeReadStateTimer(&Timer->Timer);
+
+   if (Timer->Running == TRUE)
+     {
+       /* cancel running timer */
+       const KIRQL OldIrql = KeRaiseIrqlToDpcLevel();
+       KeCancelTimer(&Timer->Timer);
+       KeRemoveQueueDpc(&Timer->Dpc);
+       KeRemoveQueueApc(&Timer->Apc);
+       Timer->Running = FALSE;
+       KeLowerIrql(OldIrql);
+     }
+
+   if (TimerApcRoutine)
+     {
+       KeInitializeApc(&Timer->Apc,
+                      KeGetCurrentThread(),
+                      OriginalApcEnvironment,
+                      &ExpTimerApcKernelRoutine,
+                      (PKRUNDOWN_ROUTINE)NULL,
+                      (PKNORMAL_ROUTINE)TimerApcRoutine,
+                      (KPROCESSOR_MODE)KeGetPreviousMode(),
+                      TimerContext);
+     }
+
+   Result = KeSetTimerEx(&Timer->Timer,
+                        *DueTime,
+                        Period,
+                        TimerApcRoutine ? &Timer->Dpc : 0 );
+   if (Result == TRUE)
+     {
+       ObDereferenceObject(Timer);
+       DPRINT1( "KeSetTimer says the timer was already running, this shouldn't be\n" );
+       return STATUS_UNSUCCESSFUL;
+     }
+
+   Timer->Running = TRUE;
+
+   ObDereferenceObject(Timer);
+
+   if (PreviousState != NULL)
+     {
+       *PreviousState = State;
+     }
+
+   return STATUS_SUCCESS;
+}
+
+/* EOF */
index 6d9f1ce..dbf9209 100755 (executable)
@@ -217,3 +217,18 @@ InbvSolidColorFill(IN ULONG Left,
   IN ULONG Color)
 {
 }
+
+NTSTATUS
+STDCALL
+NtDisplayString(IN PUNICODE_STRING DisplayString)
+{
+   ANSI_STRING AnsiString;
+
+   RtlUnicodeStringToAnsiString (&AnsiString, DisplayString, TRUE);
+
+   HalDisplayString (AnsiString.Buffer);
+
+   RtlFreeAnsiString (&AnsiString);
+
+   return(STATUS_SUCCESS);
+}
index 940db4e..447d7ad 100644 (file)
@@ -63,7 +63,57 @@ KeIpiGenericCall(VOID STDCALL (*WorkerRoutine)(PVOID),
 
 /* next file ***************************************************************/
 
+typedef struct _KPROCESS_PROFILE
+/*
+ * List of the profile data structures associated with a process.
+ */
+{
+  LIST_ENTRY ProfileListHead;
+  LIST_ENTRY ListEntry;
+  HANDLE Pid;
+} KPROCESS_PROFILE, *PKPROCESS_PROFILE;
+
+typedef struct _KPROFILE
+/*
+ * Describes a contiguous region of process memory that is being profiled.
+ */
+{
+  CSHORT Type;
+  CSHORT Name;
+
+  /* Entry in the list of profile data structures for this process. */
+  LIST_ENTRY ListEntry; 
+
+  /* Base of the region being profiled. */
+  PVOID Base;
+
+  /* Size of the region being profiled. */
+  ULONG Size;
 
+  /* Shift of offsets from the region to buckets in the profiling buffer. */
+  ULONG BucketShift;
+
+  /* MDL which described the buffer that receives profiling data. */
+  struct _MDL *BufferMdl;
+
+  /* System alias for the profiling buffer. */
+  PULONG Buffer;
+
+  /* Size of the buffer for profiling data. */
+  ULONG BufferSize;
+
+  /* 
+   * Mask of processors for which profiling data should be collected. 
+   * Currently unused.
+   */
+  ULONG ProcessorMask;
+
+  /* TRUE if profiling has been started for this region. */
+  BOOLEAN Started;
+
+  /* Pointer (and reference) to the process which is being profiled. */
+  struct _EPROCESS *Process;
+} KPROFILE, *PKPROFILE;
 
 VOID STDCALL 
 DbgBreakPointNoBugCheck(VOID);
@@ -81,6 +131,14 @@ KeProfileInterruptWithSource(
        IN KPROFILE_SOURCE              Source
 );
 
+VOID KiAddProfileEventToProcess(PLIST_ENTRY ListHead, PVOID Eip);
+VOID KiAddProfileEvent(KPROFILE_SOURCE Source, ULONG Eip);
+VOID KiInsertProfileIntoProcess(PLIST_ENTRY ListHead, PKPROFILE Profile);
+VOID KiInsertProfile(PKPROFILE Profile);
+VOID KiRemoveProfile(PKPROFILE Profile);
+VOID STDCALL KiDeleteProfile(PVOID ObjectBody);
+
+
 VOID STDCALL KeUpdateSystemTime(PKTRAP_FRAME TrapFrame, KIRQL Irql);
 VOID STDCALL KeUpdateRunTime(PKTRAP_FRAME TrapFrame, KIRQL Irql);
 
index 1bceac4..a98537f 100644 (file)
@@ -37,9 +37,13 @@ extern IDT_DESCRIPTOR KiIdt[256];
 //extern GDT_DESCRIPTOR KiGdt[256];
 
 
-VOID NtInitializeEventImplementation(VOID);
-VOID NtInit(VOID);
-
+VOID ExpInitializeEventImplementation(VOID);
+VOID ExpInitializeEventImplementation(VOID);
+VOID ExpInitializeEventPairImplementation(VOID);
+VOID ExpInitializeSemaphoreImplementation(VOID);
+VOID ExpInitializeMutantImplementation(VOID);
+VOID ExpInitializeTimerImplementation(VOID);
+VOID ExpInitializeProfileImplementation(VOID);
 /*
  * Initalization functions (called once by main())
  */
index 2bbb317..c987f67 100644 (file)
@@ -134,11 +134,11 @@ NiCreatePort (PVOID                       ObjectBody,
 /* Code in ntoskrnl/lpc/port.c */
 
 NTSTATUS STDCALL
-NiInitializePort (IN OUT  PEPORT       Port,
+LpcpInitializePort (IN OUT  PEPORT     Port,
                  IN      USHORT        Type,
                  IN      PEPORT        Parent OPTIONAL);
 NTSTATUS
-NiInitPort (VOID);
+LpcpInitSystem (VOID);
 
 extern POBJECT_TYPE    LpcPortObjectType;
 extern ULONG           LpcpNextMessageId;
index e49245a..5ee4af3 100755 (executable)
@@ -48,7 +48,6 @@
 #include <internal/kd.h>
 #include <internal/ex.h>
 #include <internal/ob.h>
-#include <internal/nt.h>
 #include "internal/xhal.h"
 #include <internal/v86m.h>
 #include <internal/ifs.h>
diff --git a/reactos/ntoskrnl/io/efi.c b/reactos/ntoskrnl/io/efi.c
new file mode 100644 (file)
index 0000000..dfdbc1b
--- /dev/null
@@ -0,0 +1,128 @@
+/*
+ * COPYRIGHT:       See COPYING in the top level directory
+ * PROJECT:         ReactOS kernel
+ * FILE:            ntoskrnl/io/efi.c
+ * PURPOSE:         EFI Unimplemented Function Calls
+ * PROGRAMMER:      Alex Ionescu (alex@relsoft.net)
+ * UPDATE HISTORY:
+ *                  Created 16/07/04
+ */
+
+/* INCLUDES *****************************************************************/
+
+#include <ntoskrnl.h>
+#include <internal/debug.h>
+
+/* FUNCTIONS *****************************************************************/
+
+/*
+ * @unimplemented
+ */
+NTSTATUS
+STDCALL
+NtAddBootEntry(
+       IN PUNICODE_STRING EntryName,
+       IN PUNICODE_STRING EntryValue
+       )
+{
+       UNIMPLEMENTED;
+       return STATUS_NOT_IMPLEMENTED;
+}
+/*
+ * @unimplemented
+ */
+NTSTATUS
+STDCALL
+NtDeleteBootEntry(
+       IN PUNICODE_STRING EntryName,
+       IN PUNICODE_STRING EntryValue
+       )
+{
+       UNIMPLEMENTED;
+       return STATUS_NOT_IMPLEMENTED;
+}
+/*
+ * @unimplemented
+ */
+NTSTATUS
+STDCALL
+NtEnumerateBootEntries(
+       IN ULONG Unknown1,
+       IN ULONG Unknown2
+       )
+{
+       UNIMPLEMENTED;
+       return STATUS_NOT_IMPLEMENTED;
+}
+/*
+ * @unimplemented
+ */
+NTSTATUS
+STDCALL
+NtQueryBootEntryOrder(
+       IN ULONG Unknown1,
+       IN ULONG Unknown2
+       )
+{
+       UNIMPLEMENTED;
+       return STATUS_NOT_IMPLEMENTED;
+}
+/*
+ * @unimplemented
+ */
+NTSTATUS
+STDCALL
+NtQueryBootOptions(
+       IN ULONG Unknown1,
+       IN ULONG Unknown2
+       )
+{
+       UNIMPLEMENTED;
+       return STATUS_NOT_IMPLEMENTED;
+}
+/*
+ * @unimplemented
+ */
+NTSTATUS
+STDCALL
+NtSetBootEntryOrder(
+       IN ULONG Unknown1,
+       IN ULONG Unknown2
+       )
+{
+       UNIMPLEMENTED;
+       return STATUS_NOT_IMPLEMENTED;
+}
+
+/*
+ * @unimplemented
+ */
+NTSTATUS 
+STDCALL 
+NtSetBootOptions(
+       ULONG Unknown1, 
+       ULONG Unknown2
+       )
+{
+       UNIMPLEMENTED;
+       return STATUS_NOT_IMPLEMENTED;
+}
+
+
+/*
+ * @unimplemented
+ */
+NTSTATUS 
+STDCALL 
+NtTranslateFilePath(
+       ULONG Unknown1, 
+       ULONG Unknown2,
+       ULONG Unknown3
+       )
+{
+       UNIMPLEMENTED;
+       return STATUS_NOT_IMPLEMENTED;
+}
+
+
+/* EOF */
diff --git a/reactos/ntoskrnl/io/plugplay.c b/reactos/ntoskrnl/io/plugplay.c
new file mode 100644 (file)
index 0000000..e37c3b6
--- /dev/null
@@ -0,0 +1,37 @@
+/*
+ * COPYRIGHT:       See COPYING in the top level directory
+ * PROJECT:         ReactOS kernel
+ * FILE:            ntoskrnl/io/plugplay.c
+ * PURPOSE:         Mysterious nt4 support for plug-and-play
+ * PROGRAMMER:      David Welch (welch@mcmail.com)
+ * UPDATE HISTORY:
+ *                  Created 22/05/98
+ */
+
+/* INCLUDES *****************************************************************/
+
+#include <ntoskrnl.h>
+#include <internal/debug.h>
+
+/* FUNCTIONS *****************************************************************/
+
+NTSTATUS
+STDCALL
+NtPlugPlayControl (DWORD Unknown1,
+                   DWORD Unknown2,
+                   DWORD Unknown3)
+{
+   UNIMPLEMENTED;
+   return(STATUS_NOT_IMPLEMENTED);
+}
+
+NTSTATUS
+STDCALL
+NtGetPlugPlayEvent (ULONG Reserved1,
+                    ULONG Reserved2,
+                    PVOID Buffer,
+                    ULONG BufferLength)
+{
+   UNIMPLEMENTED;
+   return(STATUS_NOT_IMPLEMENTED);
+}
diff --git a/reactos/ntoskrnl/ke/i386/vdm.c b/reactos/ntoskrnl/ke/i386/vdm.c
new file mode 100644 (file)
index 0000000..09f21b7
--- /dev/null
@@ -0,0 +1,82 @@
+/*
+ * COPYRIGHT:       See COPYING in the top level directory
+ * PROJECT:         ReactOS kernel
+ * FILE:            ntoskrnl/nt/vdm.c
+ * PURPOSE:         Virtual DOS machine support
+ * PROGRAMMER:      David Welch (welch@mcmail.com)
+ * UPDATE HISTORY:
+ *                  Created 22/05/98
+ */
+
+/* INCLUDES *****************************************************************/
+
+#include <ntoskrnl.h>
+#include <internal/debug.h>
+
+/* GLOBALS *******************************************************************/
+
+static UCHAR OrigIVT[1024];
+static UCHAR OrigBDA[256];
+/* static UCHAR OrigEBDA[]; */
+
+extern VOID Ki386RetToV86Mode(PKV86M_REGISTERS InRegs,
+                             PKV86M_REGISTERS OutRegs);
+
+/* FUNCTIONS *****************************************************************/
+
+VOID INIT_FUNCTION
+NtEarlyInitVdm(VOID)
+{
+  /* GCC 3.4 warns if NULL is passed in parameter 2 to the standard function memcpy */
+  PVOID start = (PVOID)0x0;
+
+  /*
+   * Save various BIOS data tables. At this point the lower 4MB memory
+   * map is still active so we can just copy the data from low memory.
+   */
+  memcpy(OrigIVT, start, 1024);
+  memcpy(OrigBDA, (PVOID)0x400, 256);
+}
+
+/*
+ * @implemented
+ */
+NTSTATUS STDCALL NtVdmControl(ULONG ControlCode,
+                             PVOID ControlData)
+{
+  switch (ControlCode)
+  {
+    case 0:
+      memcpy(ControlData, OrigIVT, 1024);
+      break;
+
+    case 1:
+      memcpy(ControlData, OrigBDA, 256);
+      break;
+
+    case 2:
+    {
+      KV86M_REGISTERS V86Registers;
+      ULONG ret;
+
+      ret = MmCopyFromCaller(&V86Registers,
+                             ControlData,
+                             sizeof(KV86M_REGISTERS));
+      if(!NT_SUCCESS(ret)) return ret;
+
+      KeGetCurrentProcess()->NtVdmFlag = 1;
+      Ki386RetToV86Mode(&V86Registers, &V86Registers);
+      KeGetCurrentProcess()->NtVdmFlag = 0;
+
+      ret = MmCopyToCaller(ControlData,
+                           &V86Registers,
+                           sizeof(KV86M_REGISTERS));
+      if(!NT_SUCCESS(ret)) return ret;
+
+      break;
+    }
+  }
+  return(STATUS_SUCCESS);
+}
+
+/* EOF */
index 424c965..cc76266 100644 (file)
@@ -534,7 +534,6 @@ ExpInitializeExecutive(VOID)
   IoInit();
   PoInit();
   CmInitializeRegistry();
-  NtInit();
   MmInit3();
   CcInit();
   KdInit2();
index 068963b..921d931 100644 (file)
 #define NDEBUG
 #include <internal/debug.h>
 
+extern LIST_ENTRY ProcessProfileListHashTable[PROFILE_HASH_TABLE_SIZE];
+extern LIST_ENTRY SystemProfileList;
+extern KSPIN_LOCK ProfileListLock;
+extern BOOLEAN ProfileInitDone;
+
+/* FUNCTIONS *****************************************************************/
+
+VOID
+KiAddProfileEventToProcess(PLIST_ENTRY ListHead, PVOID Eip)
+     /*
+      * Add a profile event to the profile objects for a particular process
+      * or the system
+      */
+{
+  PKPROFILE current;
+  PLIST_ENTRY current_entry;
+
+  current_entry = ListHead->Flink;
+  while (current_entry != ListHead)
+    {
+      current = CONTAINING_RECORD(current_entry, KPROFILE, ListEntry);
+
+      if (current->Base > Eip)
+       {
+         return;
+       }
+
+      if (current->Base <= Eip && ((char*)current->Base + current->Size) > (char*)Eip &&
+         current->Started)
+       {
+         ULONG Bucket;
+
+         Bucket = ((ULONG)((char*)Eip - (char*)current->Base)) >> current->BucketShift;
+
+         if ((Bucket*4) < current->BufferSize)
+           {
+             current->Buffer[Bucket]++;
+           }
+       }
+
+      current_entry = current_entry->Flink;
+    }
+}
+
+VOID
+KiAddProfileEvent(KPROFILE_SOURCE Source, ULONG Eip)
+     /*
+      * Add a profile event 
+      */
+{
+  HANDLE Pid;
+  PKPROCESS_PROFILE current;
+  PLIST_ENTRY current_entry;
+  PLIST_ENTRY ListHead;
+
+  if (!ProfileInitDone)
+    {
+      return;
+    }
+
+  Pid = PsGetCurrentProcessId();
+  ListHead = 
+    ProcessProfileListHashTable[(ULONG)Pid % PROFILE_HASH_TABLE_SIZE].Flink;
+
+  KeAcquireSpinLockAtDpcLevel(&ProfileListLock);
+
+  current_entry = ListHead;
+  while (current_entry != ListHead)
+    {
+      current = CONTAINING_RECORD(current_entry, KPROCESS_PROFILE, ListEntry);
+
+      if (current->Pid == Pid)
+       {
+         KiAddProfileEventToProcess(&current->ProfileListHead, (PVOID)Eip);
+         break;
+       }
+
+      current_entry = current_entry->Flink;
+    }
+
+  KiAddProfileEventToProcess(&SystemProfileList, (PVOID)Eip);
+
+  KeReleaseSpinLockFromDpcLevel(&ProfileListLock);
+}
+
+VOID
+KiInsertProfileIntoProcess(PLIST_ENTRY ListHead, PKPROFILE Profile)
+     /*
+      * Insert a profile object into the list for a process or the system
+      */
+{
+  PKPROFILE current;
+  PLIST_ENTRY current_entry;
+
+  current_entry = ListHead;
+  while (current_entry != ListHead)
+    {
+      current = CONTAINING_RECORD(current_entry, KPROFILE, ListEntry);
+
+      if (current->Base > Profile->Base)
+       {
+         Profile->ListEntry.Flink = current_entry;
+         Profile->ListEntry.Blink = current_entry->Blink;
+         current_entry->Blink->Flink = &Profile->ListEntry;
+         current_entry->Blink = &Profile->ListEntry;
+         return;
+       }
+
+      current_entry = current_entry->Flink;
+    }
+  InsertTailList(ListHead, &Profile->ListEntry);
+}
+
+VOID
+KiInsertProfile(PKPROFILE Profile)
+     /*
+      * Insert a profile into the relevant data structures
+      */
+{
+  KIRQL oldIrql;
+
+  KeAcquireSpinLock(&ProfileListLock, &oldIrql);
+
+  if (Profile->Process == NULL)
+    {
+      KiInsertProfileIntoProcess(&SystemProfileList, Profile);
+    }
+  else
+    {
+      ULONG Pid;
+      PKPROCESS_PROFILE current;
+      PLIST_ENTRY current_entry;
+      PLIST_ENTRY ListHead;
+
+      Pid = Profile->Process->UniqueProcessId;
+      ListHead = &ProcessProfileListHashTable[Pid % PROFILE_HASH_TABLE_SIZE];
+
+      current_entry = ListHead;
+      while(current_entry != ListHead)
+       {
+         current = CONTAINING_RECORD(current_entry, KPROCESS_PROFILE, 
+                                     ListEntry);
+
+         if (current->Pid == (HANDLE)Pid)
+           {
+             KiInsertProfileIntoProcess(&current->ProfileListHead, Profile);
+             KeReleaseSpinLock(&ProfileListLock, oldIrql);
+             return;
+           }
+
+         current_entry = current_entry->Flink;
+       }
+
+      current = ExAllocatePool(NonPagedPool, sizeof(KPROCESS_PROFILE));
+
+      current->Pid = (HANDLE)Pid;
+      InitializeListHead(&current->ProfileListHead);
+      InsertTailList(ListHead, &current->ListEntry);
+
+      KiInsertProfileIntoProcess(&current->ProfileListHead, Profile);
+    }
+
+  KeReleaseSpinLock(&ProfileListLock, oldIrql);
+}
+
+VOID KiRemoveProfile(PKPROFILE Profile)
+{
+  KIRQL oldIrql;
+
+  KeAcquireSpinLock(&ProfileListLock, &oldIrql);
+
+  if (Profile->Process == NULL)
+    {
+      RemoveEntryList(&Profile->ListEntry);
+    }
+  else
+    {
+      ULONG Pid;
+      PLIST_ENTRY ListHead;
+      PKPROCESS_PROFILE current;
+      PLIST_ENTRY current_entry;
+      
+      RemoveEntryList(&Profile->ListEntry);
+
+      Pid = Profile->Process->UniqueProcessId;
+      ListHead = &ProcessProfileListHashTable[Pid % PROFILE_HASH_TABLE_SIZE];
+
+      current_entry = ListHead;
+      while(current_entry != ListHead)
+       {
+         current = CONTAINING_RECORD(current_entry, KPROCESS_PROFILE, 
+                                     ListEntry);
+
+         if (current->Pid == (HANDLE)Pid)
+           {
+             if (IsListEmpty(&current->ProfileListHead))
+               {
+                 RemoveEntryList(&current->ListEntry);
+                 ExFreePool(current);
+               }
+             KeReleaseSpinLock(&ProfileListLock, oldIrql);
+             return;
+           }
+
+         current_entry = current_entry->Flink;
+       }
+      KEBUGCHECK(0);
+    }
+
+  KeReleaseSpinLock(&ProfileListLock, oldIrql);
+}
+
+VOID STDCALL
+KiDeleteProfile(PVOID ObjectBody)
+{
+  PKPROFILE Profile;
+
+  Profile = (PKPROFILE)ObjectBody;
+
+  KiRemoveProfile(Profile);
+  if (Profile->Process != NULL)
+    {
+      ObDereferenceObject(Profile->Process);
+      Profile->Process = NULL;
+    }
+
+  if (Profile->BufferMdl->MappedSystemVa != NULL)
+    {       
+      MmUnmapLockedPages(Profile->BufferMdl->MappedSystemVa, 
+                        Profile->BufferMdl);
+    }
+  MmUnlockPages(Profile->BufferMdl);
+  ExFreePool(Profile->BufferMdl);
+  Profile->BufferMdl = NULL;
+}
+
 /*
  * @unimplemented
  */
diff --git a/reactos/ntoskrnl/ke/zw.c b/reactos/ntoskrnl/ke/zw.c
new file mode 100644 (file)
index 0000000..81034f9
--- /dev/null
@@ -0,0 +1,244 @@
+/* Machine generated, don't edit */
+
+#ifdef __cplusplus
+#define EXTERN_C extern "C"
+#else
+#define EXTERN_C
+#endif
+
+EXTERN_C static __inline__ __attribute__((regparm(2)))void*ZwRosSystemServiceThunk(long n,void*a){void*ret;__asm__("int $0x2E":"=a"(ret):"a"(n),"d"(a));return ret;}
+EXTERN_C void*__stdcall ZwAcceptConnectPort(void*a0,void*a1,void*a2,void*a3,void*a4,void*a5){(void)a1;(void)a2;(void)a3;(void)a4;(void)a5;return ZwRosSystemServiceThunk(0,&a0);}
+EXTERN_C void*__stdcall ZwAccessCheck(void*a0,void*a1,void*a2,void*a3,void*a4,void*a5,void*a6,void*a7){(void)a1;(void)a2;(void)a3;(void)a4;(void)a5;(void)a6;(void)a7;return ZwRosSystemServiceThunk(1,&a0);}
+EXTERN_C void*__stdcall ZwAccessCheckAndAuditAlarm(void*a0,void*a1,void*a2,void*a3,void*a4,void*a5,void*a6,void*a7,void*a8,void*a9,void*a10){(void)a1;(void)a2;(void)a3;(void)a4;(void)a5;(void)a6;(void)a7;(void)a8;(void)a9;(void)a10;return ZwRosSystemServiceThunk(2,&a0);}
+EXTERN_C void*__stdcall ZwAddAtom(void*a0,void*a1,void*a2){(void)a1;(void)a2;return ZwRosSystemServiceThunk(3,&a0);}
+EXTERN_C void*__stdcall ZwAddBootEntry(void*a0,void*a1){(void)a1;return ZwRosSystemServiceThunk(4,&a0);}
+EXTERN_C void*__stdcall ZwAdjustGroupsToken(void*a0,void*a1,void*a2,void*a3,void*a4,void*a5){(void)a1;(void)a2;(void)a3;(void)a4;(void)a5;return ZwRosSystemServiceThunk(5,&a0);}
+EXTERN_C void*__stdcall ZwAdjustPrivilegesToken(void*a0,void*a1,void*a2,void*a3,void*a4,void*a5){(void)a1;(void)a2;(void)a3;(void)a4;(void)a5;return ZwRosSystemServiceThunk(6,&a0);}
+EXTERN_C void*__stdcall ZwAlertResumeThread(void*a0,void*a1){(void)a1;return ZwRosSystemServiceThunk(7,&a0);}
+EXTERN_C void*__stdcall ZwAlertThread(void*a0){return ZwRosSystemServiceThunk(8,&a0);}
+EXTERN_C void*__stdcall ZwAllocateLocallyUniqueId(void*a0){return ZwRosSystemServiceThunk(9,&a0);}
+EXTERN_C void*__stdcall ZwAllocateUuids(void*a0,void*a1,void*a2,void*a3){(void)a1;(void)a2;(void)a3;return ZwRosSystemServiceThunk(10,&a0);}
+EXTERN_C void*__stdcall ZwAllocateVirtualMemory(void*a0,void*a1,void*a2,void*a3,void*a4,void*a5){(void)a1;(void)a2;(void)a3;(void)a4;(void)a5;return ZwRosSystemServiceThunk(11,&a0);}
+EXTERN_C void*__stdcall ZwAssignProcessToJobObject(void*a0,void*a1){(void)a1;return ZwRosSystemServiceThunk(12,&a0);}
+EXTERN_C void*__stdcall ZwCallbackReturn(void*a0,void*a1,void*a2){(void)a1;(void)a2;return ZwRosSystemServiceThunk(13,&a0);}
+EXTERN_C void*__stdcall ZwCancelIoFile(void*a0,void*a1){(void)a1;return ZwRosSystemServiceThunk(14,&a0);}
+EXTERN_C void*__stdcall ZwCancelTimer(void*a0,void*a1){(void)a1;return ZwRosSystemServiceThunk(15,&a0);}
+EXTERN_C void*__stdcall ZwClearEvent(void*a0){return ZwRosSystemServiceThunk(16,&a0);}
+EXTERN_C void*__stdcall ZwClose(void*a0){return ZwRosSystemServiceThunk(17,&a0);}
+EXTERN_C void*__stdcall ZwCloseObjectAuditAlarm(void*a0,void*a1,void*a2){(void)a1;(void)a2;return ZwRosSystemServiceThunk(18,&a0);}
+EXTERN_C void*__stdcall ZwCompleteConnectPort(void*a0){return ZwRosSystemServiceThunk(19,&a0);}
+EXTERN_C void*__stdcall ZwConnectPort(void*a0,void*a1,void*a2,void*a3,void*a4,void*a5,void*a6,void*a7){(void)a1;(void)a2;(void)a3;(void)a4;(void)a5;(void)a6;(void)a7;return ZwRosSystemServiceThunk(20,&a0);}
+EXTERN_C void*__stdcall ZwContinue(void*a0,void*a1){(void)a1;return ZwRosSystemServiceThunk(21,&a0);}
+EXTERN_C void*__stdcall ZwCreateDirectoryObject(void*a0,void*a1,void*a2){(void)a1;(void)a2;return ZwRosSystemServiceThunk(22,&a0);}
+EXTERN_C void*__stdcall ZwCreateEvent(void*a0,void*a1,void*a2,void*a3,void*a4){(void)a1;(void)a2;(void)a3;(void)a4;return ZwRosSystemServiceThunk(23,&a0);}
+EXTERN_C void*__stdcall ZwCreateEventPair(void*a0,void*a1,void*a2){(void)a1;(void)a2;return ZwRosSystemServiceThunk(24,&a0);}
+EXTERN_C void*__stdcall ZwCreateFile(void*a0,void*a1,void*a2,void*a3,void*a4,void*a5,void*a6,void*a7,void*a8,void*a9,void*a10){(void)a1;(void)a2;(void)a3;(void)a4;(void)a5;(void)a6;(void)a7;(void)a8;(void)a9;(void)a10;return ZwRosSystemServiceThunk(25,&a0);}
+EXTERN_C void*__stdcall ZwCreateIoCompletion(void*a0,void*a1,void*a2,void*a3){(void)a1;(void)a2;(void)a3;return ZwRosSystemServiceThunk(26,&a0);}
+EXTERN_C void*__stdcall ZwCreateJobObject(void*a0,void*a1,void*a2){(void)a1;(void)a2;return ZwRosSystemServiceThunk(27,&a0);}
+EXTERN_C void*__stdcall ZwCreateKey(void*a0,void*a1,void*a2,void*a3,void*a4,void*a5,void*a6){(void)a1;(void)a2;(void)a3;(void)a4;(void)a5;(void)a6;return ZwRosSystemServiceThunk(28,&a0);}
+EXTERN_C void*__stdcall ZwCreateMailslotFile(void*a0,void*a1,void*a2,void*a3,void*a4,void*a5,void*a6,void*a7){(void)a1;(void)a2;(void)a3;(void)a4;(void)a5;(void)a6;(void)a7;return ZwRosSystemServiceThunk(29,&a0);}
+EXTERN_C void*__stdcall ZwCreateMutant(void*a0,void*a1,void*a2,void*a3){(void)a1;(void)a2;(void)a3;return ZwRosSystemServiceThunk(30,&a0);}
+EXTERN_C void*__stdcall ZwCreateNamedPipeFile(void*a0,void*a1,void*a2,void*a3,void*a4,void*a5,void*a6,void*a7,void*a8,void*a9,void*a10,void*a11,void*a12,void*a13){(void)a1;(void)a2;(void)a3;(void)a4;(void)a5;(void)a6;(void)a7;(void)a8;(void)a9;(void)a10;(void)a11;(void)a12;(void)a13;return ZwRosSystemServiceThunk(31,&a0);}
+EXTERN_C void*__stdcall ZwCreatePagingFile(void*a0,void*a1,void*a2,void*a3){(void)a1;(void)a2;(void)a3;return ZwRosSystemServiceThunk(32,&a0);}
+EXTERN_C void*__stdcall ZwCreatePort(void*a0,void*a1,void*a2,void*a3,void*a4){(void)a1;(void)a2;(void)a3;(void)a4;return ZwRosSystemServiceThunk(33,&a0);}
+EXTERN_C void*__stdcall ZwCreateProcess(void*a0,void*a1,void*a2,void*a3,void*a4,void*a5,void*a6,void*a7){(void)a1;(void)a2;(void)a3;(void)a4;(void)a5;(void)a6;(void)a7;return ZwRosSystemServiceThunk(34,&a0);}
+EXTERN_C void*__stdcall ZwCreateProfile(void*a0,void*a1,void*a2,void*a3,void*a4,void*a5,void*a6,void*a7,void*a8){(void)a1;(void)a2;(void)a3;(void)a4;(void)a5;(void)a6;(void)a7;(void)a8;return ZwRosSystemServiceThunk(35,&a0);}
+EXTERN_C void*__stdcall ZwCreateSection(void*a0,void*a1,void*a2,void*a3,void*a4,void*a5,void*a6){(void)a1;(void)a2;(void)a3;(void)a4;(void)a5;(void)a6;return ZwRosSystemServiceThunk(36,&a0);}
+EXTERN_C void*__stdcall ZwCreateSemaphore(void*a0,void*a1,void*a2,void*a3,void*a4){(void)a1;(void)a2;(void)a3;(void)a4;return ZwRosSystemServiceThunk(37,&a0);}
+EXTERN_C void*__stdcall ZwCreateSymbolicLinkObject(void*a0,void*a1,void*a2,void*a3){(void)a1;(void)a2;(void)a3;return ZwRosSystemServiceThunk(38,&a0);}
+EXTERN_C void*__stdcall ZwCreateThread(void*a0,void*a1,void*a2,void*a3,void*a4,void*a5,void*a6,void*a7){(void)a1;(void)a2;(void)a3;(void)a4;(void)a5;(void)a6;(void)a7;return ZwRosSystemServiceThunk(39,&a0);}
+EXTERN_C void*__stdcall ZwCreateTimer(void*a0,void*a1,void*a2,void*a3){(void)a1;(void)a2;(void)a3;return ZwRosSystemServiceThunk(40,&a0);}
+EXTERN_C void*__stdcall ZwCreateToken(void*a0,void*a1,void*a2,void*a3,void*a4,void*a5,void*a6,void*a7,void*a8,void*a9,void*a10,void*a11,void*a12){(void)a1;(void)a2;(void)a3;(void)a4;(void)a5;(void)a6;(void)a7;(void)a8;(void)a9;(void)a10;(void)a11;(void)a12;return ZwRosSystemServiceThunk(41,&a0);}
+EXTERN_C void*__stdcall ZwCreateWaitablePort(void*a0,void*a1,void*a2,void*a3,void*a4){(void)a1;(void)a2;(void)a3;(void)a4;return ZwRosSystemServiceThunk(42,&a0);}
+EXTERN_C void*__stdcall ZwDelayExecution(void*a0,void*a1){(void)a1;return ZwRosSystemServiceThunk(43,&a0);}
+EXTERN_C void*__stdcall ZwDeleteAtom(void*a0){return ZwRosSystemServiceThunk(44,&a0);}
+EXTERN_C void*__stdcall ZwDeleteBootEntry(void*a0,void*a1){(void)a1;return ZwRosSystemServiceThunk(45,&a0);}
+EXTERN_C void*__stdcall ZwDeleteFile(void*a0){return ZwRosSystemServiceThunk(46,&a0);}
+EXTERN_C void*__stdcall ZwDeleteKey(void*a0){return ZwRosSystemServiceThunk(47,&a0);}
+EXTERN_C void*__stdcall ZwDeleteObjectAuditAlarm(void*a0,void*a1,void*a2){(void)a1;(void)a2;return ZwRosSystemServiceThunk(48,&a0);}
+EXTERN_C void*__stdcall ZwDeleteValueKey(void*a0,void*a1){(void)a1;return ZwRosSystemServiceThunk(49,&a0);}
+EXTERN_C void*__stdcall ZwDeviceIoControlFile(void*a0,void*a1,void*a2,void*a3,void*a4,void*a5,void*a6,void*a7,void*a8,void*a9){(void)a1;(void)a2;(void)a3;(void)a4;(void)a5;(void)a6;(void)a7;(void)a8;(void)a9;return ZwRosSystemServiceThunk(50,&a0);}
+EXTERN_C void*__stdcall ZwDisplayString(void*a0){return ZwRosSystemServiceThunk(51,&a0);}
+EXTERN_C void*__stdcall ZwDuplicateObject(void*a0,void*a1,void*a2,void*a3,void*a4,void*a5,void*a6){(void)a1;(void)a2;(void)a3;(void)a4;(void)a5;(void)a6;return ZwRosSystemServiceThunk(52,&a0);}
+EXTERN_C void*__stdcall ZwDuplicateToken(void*a0,void*a1,void*a2,void*a3,void*a4,void*a5){(void)a1;(void)a2;(void)a3;(void)a4;(void)a5;return ZwRosSystemServiceThunk(53,&a0);}
+EXTERN_C void*__stdcall ZwEnumerateBootEntries(void*a0,void*a1){(void)a1;return ZwRosSystemServiceThunk(54,&a0);}
+EXTERN_C void*__stdcall ZwEnumerateKey(void*a0,void*a1,void*a2,void*a3,void*a4,void*a5){(void)a1;(void)a2;(void)a3;(void)a4;(void)a5;return ZwRosSystemServiceThunk(55,&a0);}
+EXTERN_C void*__stdcall ZwEnumerateValueKey(void*a0,void*a1,void*a2,void*a3,void*a4,void*a5){(void)a1;(void)a2;(void)a3;(void)a4;(void)a5;return ZwRosSystemServiceThunk(56,&a0);}
+EXTERN_C void*__stdcall ZwExtendSection(void*a0,void*a1){(void)a1;return ZwRosSystemServiceThunk(57,&a0);}
+EXTERN_C void*__stdcall ZwFindAtom(void*a0,void*a1,void*a2){(void)a1;(void)a2;return ZwRosSystemServiceThunk(58,&a0);}
+EXTERN_C void*__stdcall ZwFlushBuffersFile(void*a0,void*a1){(void)a1;return ZwRosSystemServiceThunk(59,&a0);}
+EXTERN_C void*__stdcall ZwFlushInstructionCache(void*a0,void*a1,void*a2){(void)a1;(void)a2;return ZwRosSystemServiceThunk(60,&a0);}
+EXTERN_C void*__stdcall ZwFlushKey(void*a0){return ZwRosSystemServiceThunk(61,&a0);}
+EXTERN_C void*__stdcall ZwFlushVirtualMemory(void*a0,void*a1,void*a2,void*a3){(void)a1;(void)a2;(void)a3;return ZwRosSystemServiceThunk(62,&a0);}
+EXTERN_C void*__stdcall ZwFlushWriteBuffer(void){return ZwRosSystemServiceThunk(63,0);}
+EXTERN_C void*__stdcall ZwFreeVirtualMemory(void*a0,void*a1,void*a2,void*a3){(void)a1;(void)a2;(void)a3;return ZwRosSystemServiceThunk(64,&a0);}
+EXTERN_C void*__stdcall ZwFsControlFile(void*a0,void*a1,void*a2,void*a3,void*a4,void*a5,void*a6,void*a7,void*a8,void*a9){(void)a1;(void)a2;(void)a3;(void)a4;(void)a5;(void)a6;(void)a7;(void)a8;(void)a9;return ZwRosSystemServiceThunk(65,&a0);}
+EXTERN_C void*__stdcall ZwGetContextThread(void*a0,void*a1){(void)a1;return ZwRosSystemServiceThunk(66,&a0);}
+EXTERN_C void*__stdcall ZwGetPlugPlayEvent(void*a0,void*a1,void*a2,void*a3){(void)a1;(void)a2;(void)a3;return ZwRosSystemServiceThunk(67,&a0);}
+EXTERN_C void*__stdcall ZwGetTickCount(void){return ZwRosSystemServiceThunk(68,0);}
+EXTERN_C void*__stdcall ZwImpersonateClientOfPort(void*a0,void*a1){(void)a1;return ZwRosSystemServiceThunk(69,&a0);}
+EXTERN_C void*__stdcall ZwImpersonateThread(void*a0,void*a1,void*a2){(void)a1;(void)a2;return ZwRosSystemServiceThunk(70,&a0);}
+EXTERN_C void*__stdcall ZwInitializeRegistry(void*a0){return ZwRosSystemServiceThunk(71,&a0);}
+EXTERN_C void*__stdcall ZwInitiatePowerAction(void*a0,void*a1,void*a2,void*a3){(void)a1;(void)a2;(void)a3;return ZwRosSystemServiceThunk(72,&a0);}
+EXTERN_C void*__stdcall ZwIsProcessInJob(void*a0,void*a1){(void)a1;return ZwRosSystemServiceThunk(73,&a0);}
+EXTERN_C void*__stdcall ZwListenPort(void*a0,void*a1){(void)a1;return ZwRosSystemServiceThunk(74,&a0);}
+EXTERN_C void*__stdcall ZwLoadDriver(void*a0){return ZwRosSystemServiceThunk(75,&a0);}
+EXTERN_C void*__stdcall ZwLoadKey(void*a0,void*a1){(void)a1;return ZwRosSystemServiceThunk(76,&a0);}
+EXTERN_C void*__stdcall ZwLoadKey2(void*a0,void*a1,void*a2){(void)a1;(void)a2;return ZwRosSystemServiceThunk(77,&a0);}
+EXTERN_C void*__stdcall ZwLockFile(void*a0,void*a1,void*a2,void*a3,void*a4,void*a5,void*a6,void*a7,void*a8,void*a9){(void)a1;(void)a2;(void)a3;(void)a4;(void)a5;(void)a6;(void)a7;(void)a8;(void)a9;return ZwRosSystemServiceThunk(78,&a0);}
+EXTERN_C void*__stdcall ZwLockVirtualMemory(void*a0,void*a1,void*a2,void*a3){(void)a1;(void)a2;(void)a3;return ZwRosSystemServiceThunk(79,&a0);}
+EXTERN_C void*__stdcall ZwMakePermanentObject(void*a0){return ZwRosSystemServiceThunk(80,&a0);}
+EXTERN_C void*__stdcall ZwMakeTemporaryObject(void*a0){return ZwRosSystemServiceThunk(81,&a0);}
+EXTERN_C void*__stdcall ZwMapViewOfSection(void*a0,void*a1,void*a2,void*a3,void*a4,void*a5,void*a6,void*a7,void*a8,void*a9){(void)a1;(void)a2;(void)a3;(void)a4;(void)a5;(void)a6;(void)a7;(void)a8;(void)a9;return ZwRosSystemServiceThunk(82,&a0);}
+EXTERN_C void*__stdcall ZwNotifyChangeDirectoryFile(void*a0,void*a1,void*a2,void*a3,void*a4,void*a5,void*a6,void*a7,void*a8){(void)a1;(void)a2;(void)a3;(void)a4;(void)a5;(void)a6;(void)a7;(void)a8;return ZwRosSystemServiceThunk(83,&a0);}
+EXTERN_C void*__stdcall ZwNotifyChangeKey(void*a0,void*a1,void*a2,void*a3,void*a4,void*a5,void*a6,void*a7,void*a8,void*a9){(void)a1;(void)a2;(void)a3;(void)a4;(void)a5;(void)a6;(void)a7;(void)a8;(void)a9;return ZwRosSystemServiceThunk(84,&a0);}
+EXTERN_C void*__stdcall ZwOpenDirectoryObject(void*a0,void*a1,void*a2){(void)a1;(void)a2;return ZwRosSystemServiceThunk(85,&a0);}
+EXTERN_C void*__stdcall ZwOpenEvent(void*a0,void*a1,void*a2){(void)a1;(void)a2;return ZwRosSystemServiceThunk(86,&a0);}
+EXTERN_C void*__stdcall ZwOpenEventPair(void*a0,void*a1,void*a2){(void)a1;(void)a2;return ZwRosSystemServiceThunk(87,&a0);}
+EXTERN_C void*__stdcall ZwOpenFile(void*a0,void*a1,void*a2,void*a3,void*a4,void*a5){(void)a1;(void)a2;(void)a3;(void)a4;(void)a5;return ZwRosSystemServiceThunk(88,&a0);}
+EXTERN_C void*__stdcall ZwOpenIoCompletion(void*a0,void*a1,void*a2){(void)a1;(void)a2;return ZwRosSystemServiceThunk(89,&a0);}
+EXTERN_C void*__stdcall ZwOpenJobObject(void*a0,void*a1,void*a2){(void)a1;(void)a2;return ZwRosSystemServiceThunk(90,&a0);}
+EXTERN_C void*__stdcall ZwOpenKey(void*a0,void*a1,void*a2){(void)a1;(void)a2;return ZwRosSystemServiceThunk(91,&a0);}
+EXTERN_C void*__stdcall ZwOpenMutant(void*a0,void*a1,void*a2){(void)a1;(void)a2;return ZwRosSystemServiceThunk(92,&a0);}
+EXTERN_C void*__stdcall ZwOpenObjectAuditAlarm(void*a0,void*a1,void*a2,void*a3,void*a4,void*a5,void*a6,void*a7,void*a8,void*a9,void*a10,void*a11){(void)a1;(void)a2;(void)a3;(void)a4;(void)a5;(void)a6;(void)a7;(void)a8;(void)a9;(void)a10;(void)a11;return ZwRosSystemServiceThunk(93,&a0);}
+EXTERN_C void*__stdcall ZwOpenProcess(void*a0,void*a1,void*a2,void*a3){(void)a1;(void)a2;(void)a3;return ZwRosSystemServiceThunk(94,&a0);}
+EXTERN_C void*__stdcall ZwOpenProcessToken(void*a0,void*a1,void*a2){(void)a1;(void)a2;return ZwRosSystemServiceThunk(95,&a0);}
+EXTERN_C void*__stdcall ZwOpenProcessTokenEx(void*a0,void*a1,void*a2,void*a3){(void)a1;(void)a2;(void)a3;return ZwRosSystemServiceThunk(96,&a0);}
+EXTERN_C void*__stdcall ZwOpenSection(void*a0,void*a1,void*a2){(void)a1;(void)a2;return ZwRosSystemServiceThunk(97,&a0);}
+EXTERN_C void*__stdcall ZwOpenSemaphore(void*a0,void*a1,void*a2){(void)a1;(void)a2;return ZwRosSystemServiceThunk(98,&a0);}
+EXTERN_C void*__stdcall ZwOpenSymbolicLinkObject(void*a0,void*a1,void*a2){(void)a1;(void)a2;return ZwRosSystemServiceThunk(99,&a0);}
+EXTERN_C void*__stdcall ZwOpenThread(void*a0,void*a1,void*a2,void*a3){(void)a1;(void)a2;(void)a3;return ZwRosSystemServiceThunk(100,&a0);}
+EXTERN_C void*__stdcall ZwOpenThreadToken(void*a0,void*a1,void*a2,void*a3){(void)a1;(void)a2;(void)a3;return ZwRosSystemServiceThunk(101,&a0);}
+EXTERN_C void*__stdcall ZwOpenThreadTokenEx(void*a0,void*a1,void*a2,void*a3,void*a4){(void)a1;(void)a2;(void)a3;(void)a4;return ZwRosSystemServiceThunk(102,&a0);}
+EXTERN_C void*__stdcall ZwOpenTimer(void*a0,void*a1,void*a2){(void)a1;(void)a2;return ZwRosSystemServiceThunk(103,&a0);}
+EXTERN_C void*__stdcall ZwPlugPlayControl(void*a0,void*a1,void*a2,void*a3){(void)a1;(void)a2;(void)a3;return ZwRosSystemServiceThunk(104,&a0);}
+EXTERN_C void*__stdcall ZwPowerInformation(void*a0,void*a1,void*a2,void*a3,void*a4){(void)a1;(void)a2;(void)a3;(void)a4;return ZwRosSystemServiceThunk(105,&a0);}
+EXTERN_C void*__stdcall ZwPrivilegeCheck(void*a0,void*a1,void*a2){(void)a1;(void)a2;return ZwRosSystemServiceThunk(106,&a0);}
+EXTERN_C void*__stdcall ZwPrivilegedServiceAuditAlarm(void*a0,void*a1,void*a2,void*a3,void*a4){(void)a1;(void)a2;(void)a3;(void)a4;return ZwRosSystemServiceThunk(107,&a0);}
+EXTERN_C void*__stdcall ZwPrivilegeObjectAuditAlarm(void*a0,void*a1,void*a2,void*a3,void*a4,void*a5){(void)a1;(void)a2;(void)a3;(void)a4;(void)a5;return ZwRosSystemServiceThunk(108,&a0);}
+EXTERN_C void*__stdcall ZwProtectVirtualMemory(void*a0,void*a1,void*a2,void*a3,void*a4){(void)a1;(void)a2;(void)a3;(void)a4;return ZwRosSystemServiceThunk(109,&a0);}
+EXTERN_C void*__stdcall ZwPulseEvent(void*a0,void*a1){(void)a1;return ZwRosSystemServiceThunk(110,&a0);}
+EXTERN_C void*__stdcall ZwQueryInformationAtom(void*a0,void*a1,void*a2,void*a3,void*a4){(void)a1;(void)a2;(void)a3;(void)a4;return ZwRosSystemServiceThunk(111,&a0);}
+EXTERN_C void*__stdcall ZwQueryAttributesFile(void*a0,void*a1){(void)a1;return ZwRosSystemServiceThunk(112,&a0);}
+EXTERN_C void*__stdcall ZwQueryBootEntryOrder(void*a0,void*a1){(void)a1;return ZwRosSystemServiceThunk(113,&a0);}
+EXTERN_C void*__stdcall ZwQueryBootOptions(void*a0,void*a1){(void)a1;return ZwRosSystemServiceThunk(114,&a0);}
+EXTERN_C void*__stdcall ZwQueryDefaultLocale(void*a0,void*a1){(void)a1;return ZwRosSystemServiceThunk(115,&a0);}
+EXTERN_C void*__stdcall ZwQueryDefaultUILanguage(void*a0){return ZwRosSystemServiceThunk(116,&a0);}
+EXTERN_C void*__stdcall ZwQueryDirectoryFile(void*a0,void*a1,void*a2,void*a3,void*a4,void*a5,void*a6,void*a7,void*a8,void*a9,void*a10){(void)a1;(void)a2;(void)a3;(void)a4;(void)a5;(void)a6;(void)a7;(void)a8;(void)a9;(void)a10;return ZwRosSystemServiceThunk(117,&a0);}
+EXTERN_C void*__stdcall ZwQueryDirectoryObject(void*a0,void*a1,void*a2,void*a3,void*a4,void*a5,void*a6){(void)a1;(void)a2;(void)a3;(void)a4;(void)a5;(void)a6;return ZwRosSystemServiceThunk(118,&a0);}
+EXTERN_C void*__stdcall ZwQueryEaFile(void*a0,void*a1,void*a2,void*a3,void*a4,void*a5,void*a6,void*a7,void*a8){(void)a1;(void)a2;(void)a3;(void)a4;(void)a5;(void)a6;(void)a7;(void)a8;return ZwRosSystemServiceThunk(119,&a0);}
+EXTERN_C void*__stdcall ZwQueryEvent(void*a0,void*a1,void*a2,void*a3,void*a4){(void)a1;(void)a2;(void)a3;(void)a4;return ZwRosSystemServiceThunk(120,&a0);}
+EXTERN_C void*__stdcall ZwQueryFullAttributesFile(void*a0,void*a1){(void)a1;return ZwRosSystemServiceThunk(121,&a0);}
+EXTERN_C void*__stdcall ZwQueryInformationFile(void*a0,void*a1,void*a2,void*a3,void*a4){(void)a1;(void)a2;(void)a3;(void)a4;return ZwRosSystemServiceThunk(122,&a0);}
+EXTERN_C void*__stdcall ZwQueryInformationJobObject(void*a0,void*a1,void*a2,void*a3,void*a4){(void)a1;(void)a2;(void)a3;(void)a4;return ZwRosSystemServiceThunk(123,&a0);}
+EXTERN_C void*__stdcall ZwQueryInformationPort(void*a0,void*a1,void*a2,void*a3,void*a4){(void)a1;(void)a2;(void)a3;(void)a4;return ZwRosSystemServiceThunk(124,&a0);}
+EXTERN_C void*__stdcall ZwQueryInformationProcess(void*a0,void*a1,void*a2,void*a3,void*a4){(void)a1;(void)a2;(void)a3;(void)a4;return ZwRosSystemServiceThunk(125,&a0);}
+EXTERN_C void*__stdcall ZwQueryInformationThread(void*a0,void*a1,void*a2,void*a3,void*a4){(void)a1;(void)a2;(void)a3;(void)a4;return ZwRosSystemServiceThunk(126,&a0);}
+EXTERN_C void*__stdcall ZwQueryInformationToken(void*a0,void*a1,void*a2,void*a3,void*a4){(void)a1;(void)a2;(void)a3;(void)a4;return ZwRosSystemServiceThunk(127,&a0);}
+EXTERN_C void*__stdcall ZwQueryInstallUILanguage(void*a0){return ZwRosSystemServiceThunk(128,&a0);}
+EXTERN_C void*__stdcall ZwQueryIntervalProfile(void*a0,void*a1){(void)a1;return ZwRosSystemServiceThunk(129,&a0);}
+EXTERN_C void*__stdcall ZwQueryIoCompletion(void*a0,void*a1,void*a2,void*a3,void*a4){(void)a1;(void)a2;(void)a3;(void)a4;return ZwRosSystemServiceThunk(130,&a0);}
+EXTERN_C void*__stdcall ZwQueryKey(void*a0,void*a1,void*a2,void*a3,void*a4){(void)a1;(void)a2;(void)a3;(void)a4;return ZwRosSystemServiceThunk(131,&a0);}
+EXTERN_C void*__stdcall ZwQueryMultipleValueKey(void*a0,void*a1,void*a2,void*a3,void*a4,void*a5){(void)a1;(void)a2;(void)a3;(void)a4;(void)a5;return ZwRosSystemServiceThunk(132,&a0);}
+EXTERN_C void*__stdcall ZwQueryMutant(void*a0,void*a1,void*a2,void*a3,void*a4){(void)a1;(void)a2;(void)a3;(void)a4;return ZwRosSystemServiceThunk(133,&a0);}
+EXTERN_C void*__stdcall ZwQueryObject(void*a0,void*a1,void*a2,void*a3,void*a4){(void)a1;(void)a2;(void)a3;(void)a4;return ZwRosSystemServiceThunk(134,&a0);}
+EXTERN_C void*__stdcall ZwQueryOleDirectoryFile(void*a0,void*a1,void*a2,void*a3,void*a4,void*a5,void*a6,void*a7,void*a8,void*a9,void*a10){(void)a1;(void)a2;(void)a3;(void)a4;(void)a5;(void)a6;(void)a7;(void)a8;(void)a9;(void)a10;return ZwRosSystemServiceThunk(135,&a0);}
+EXTERN_C void*__stdcall ZwQueryPerformanceCounter(void*a0,void*a1){(void)a1;return ZwRosSystemServiceThunk(136,&a0);}
+EXTERN_C void*__stdcall ZwQueryQuotaInformationFile(void*a0,void*a1,void*a2,void*a3,void*a4,void*a5,void*a6,void*a7,void*a8){(void)a1;(void)a2;(void)a3;(void)a4;(void)a5;(void)a6;(void)a7;(void)a8;return ZwRosSystemServiceThunk(137,&a0);}
+EXTERN_C void*__stdcall ZwQuerySection(void*a0,void*a1,void*a2,void*a3,void*a4){(void)a1;(void)a2;(void)a3;(void)a4;return ZwRosSystemServiceThunk(138,&a0);}
+EXTERN_C void*__stdcall ZwQuerySecurityObject(void*a0,void*a1,void*a2,void*a3,void*a4){(void)a1;(void)a2;(void)a3;(void)a4;return ZwRosSystemServiceThunk(139,&a0);}
+EXTERN_C void*__stdcall ZwQuerySemaphore(void*a0,void*a1,void*a2,void*a3,void*a4){(void)a1;(void)a2;(void)a3;(void)a4;return ZwRosSystemServiceThunk(140,&a0);}
+EXTERN_C void*__stdcall ZwQuerySymbolicLinkObject(void*a0,void*a1,void*a2){(void)a1;(void)a2;return ZwRosSystemServiceThunk(141,&a0);}
+EXTERN_C void*__stdcall ZwQuerySystemEnvironmentValue(void*a0,void*a1,void*a2,void*a3){(void)a1;(void)a2;(void)a3;return ZwRosSystemServiceThunk(142,&a0);}
+EXTERN_C void*__stdcall ZwQuerySystemInformation(void*a0,void*a1,void*a2,void*a3){(void)a1;(void)a2;(void)a3;return ZwRosSystemServiceThunk(143,&a0);}
+EXTERN_C void*__stdcall ZwQuerySystemTime(void*a0){return ZwRosSystemServiceThunk(144,&a0);}
+EXTERN_C void*__stdcall ZwQueryTimer(void*a0,void*a1,void*a2,void*a3,void*a4){(void)a1;(void)a2;(void)a3;(void)a4;return ZwRosSystemServiceThunk(145,&a0);}
+EXTERN_C void*__stdcall ZwQueryTimerResolution(void*a0,void*a1,void*a2){(void)a1;(void)a2;return ZwRosSystemServiceThunk(146,&a0);}
+EXTERN_C void*__stdcall ZwQueryValueKey(void*a0,void*a1,void*a2,void*a3,void*a4,void*a5){(void)a1;(void)a2;(void)a3;(void)a4;(void)a5;return ZwRosSystemServiceThunk(147,&a0);}
+EXTERN_C void*__stdcall ZwQueryVirtualMemory(void*a0,void*a1,void*a2,void*a3,void*a4,void*a5){(void)a1;(void)a2;(void)a3;(void)a4;(void)a5;return ZwRosSystemServiceThunk(148,&a0);}
+EXTERN_C void*__stdcall ZwQueryVolumeInformationFile(void*a0,void*a1,void*a2,void*a3,void*a4){(void)a1;(void)a2;(void)a3;(void)a4;return ZwRosSystemServiceThunk(149,&a0);}
+EXTERN_C void*__stdcall ZwQueueApcThread(void*a0,void*a1,void*a2,void*a3,void*a4){(void)a1;(void)a2;(void)a3;(void)a4;return ZwRosSystemServiceThunk(150,&a0);}
+EXTERN_C void*__stdcall ZwRaiseException(void*a0,void*a1,void*a2){(void)a1;(void)a2;return ZwRosSystemServiceThunk(151,&a0);}
+EXTERN_C void*__stdcall ZwRaiseHardError(void*a0,void*a1,void*a2,void*a3,void*a4,void*a5){(void)a1;(void)a2;(void)a3;(void)a4;(void)a5;return ZwRosSystemServiceThunk(152,&a0);}
+EXTERN_C void*__stdcall ZwReadFile(void*a0,void*a1,void*a2,void*a3,void*a4,void*a5,void*a6,void*a7,void*a8){(void)a1;(void)a2;(void)a3;(void)a4;(void)a5;(void)a6;(void)a7;(void)a8;return ZwRosSystemServiceThunk(153,&a0);}
+EXTERN_C void*__stdcall ZwReadFileScatter(void*a0,void*a1,void*a2,void*a3,void*a4,void*a5,void*a6,void*a7,void*a8){(void)a1;(void)a2;(void)a3;(void)a4;(void)a5;(void)a6;(void)a7;(void)a8;return ZwRosSystemServiceThunk(154,&a0);}
+EXTERN_C void*__stdcall ZwReadRequestData(void*a0,void*a1,void*a2,void*a3,void*a4,void*a5){(void)a1;(void)a2;(void)a3;(void)a4;(void)a5;return ZwRosSystemServiceThunk(155,&a0);}
+EXTERN_C void*__stdcall ZwReadVirtualMemory(void*a0,void*a1,void*a2,void*a3,void*a4){(void)a1;(void)a2;(void)a3;(void)a4;return ZwRosSystemServiceThunk(156,&a0);}
+EXTERN_C void*__stdcall ZwRegisterThreadTerminatePort(void*a0){return ZwRosSystemServiceThunk(157,&a0);}
+EXTERN_C void*__stdcall ZwReleaseMutant(void*a0,void*a1){(void)a1;return ZwRosSystemServiceThunk(158,&a0);}
+EXTERN_C void*__stdcall ZwReleaseSemaphore(void*a0,void*a1,void*a2){(void)a1;(void)a2;return ZwRosSystemServiceThunk(159,&a0);}
+EXTERN_C void*__stdcall ZwRemoveIoCompletion(void*a0,void*a1,void*a2,void*a3,void*a4){(void)a1;(void)a2;(void)a3;(void)a4;return ZwRosSystemServiceThunk(160,&a0);}
+EXTERN_C void*__stdcall ZwReplaceKey(void*a0,void*a1,void*a2){(void)a1;(void)a2;return ZwRosSystemServiceThunk(161,&a0);}
+EXTERN_C void*__stdcall ZwReplyPort(void*a0,void*a1){(void)a1;return ZwRosSystemServiceThunk(162,&a0);}
+EXTERN_C void*__stdcall ZwReplyWaitReceivePort(void*a0,void*a1,void*a2,void*a3){(void)a1;(void)a2;(void)a3;return ZwRosSystemServiceThunk(163,&a0);}
+EXTERN_C void*__stdcall ZwReplyWaitReplyPort(void*a0,void*a1){(void)a1;return ZwRosSystemServiceThunk(164,&a0);}
+EXTERN_C void*__stdcall ZwRequestPort(void*a0,void*a1){(void)a1;return ZwRosSystemServiceThunk(165,&a0);}
+EXTERN_C void*__stdcall ZwRequestWaitReplyPort(void*a0,void*a1,void*a2){(void)a1;(void)a2;return ZwRosSystemServiceThunk(166,&a0);}
+EXTERN_C void*__stdcall ZwResetEvent(void*a0,void*a1){(void)a1;return ZwRosSystemServiceThunk(167,&a0);}
+EXTERN_C void*__stdcall ZwRestoreKey(void*a0,void*a1,void*a2){(void)a1;(void)a2;return ZwRosSystemServiceThunk(168,&a0);}
+EXTERN_C void*__stdcall ZwResumeThread(void*a0,void*a1){(void)a1;return ZwRosSystemServiceThunk(169,&a0);}
+EXTERN_C void*__stdcall ZwSaveKey(void*a0,void*a1){(void)a1;return ZwRosSystemServiceThunk(170,&a0);}
+EXTERN_C void*__stdcall ZwSaveKeyEx(void*a0,void*a1,void*a2){(void)a1;(void)a2;return ZwRosSystemServiceThunk(171,&a0);}
+EXTERN_C void*__stdcall ZwSetBootEntryOrder(void*a0,void*a1){(void)a1;return ZwRosSystemServiceThunk(172,&a0);}
+EXTERN_C void*__stdcall ZwSetBootOptions(void*a0,void*a1){(void)a1;return ZwRosSystemServiceThunk(173,&a0);}
+EXTERN_C void*__stdcall ZwSetIoCompletion(void*a0,void*a1,void*a2,void*a3,void*a4){(void)a1;(void)a2;(void)a3;(void)a4;return ZwRosSystemServiceThunk(174,&a0);}
+EXTERN_C void*__stdcall ZwSetContextThread(void*a0,void*a1){(void)a1;return ZwRosSystemServiceThunk(175,&a0);}
+EXTERN_C void*__stdcall ZwSetDefaultHardErrorPort(void*a0){return ZwRosSystemServiceThunk(176,&a0);}
+EXTERN_C void*__stdcall ZwSetDefaultLocale(void*a0,void*a1){(void)a1;return ZwRosSystemServiceThunk(177,&a0);}
+EXTERN_C void*__stdcall ZwSetDefaultUILanguage(void*a0){return ZwRosSystemServiceThunk(178,&a0);}
+EXTERN_C void*__stdcall ZwSetEaFile(void*a0,void*a1,void*a2,void*a3){(void)a1;(void)a2;(void)a3;return ZwRosSystemServiceThunk(179,&a0);}
+EXTERN_C void*__stdcall ZwSetEvent(void*a0,void*a1){(void)a1;return ZwRosSystemServiceThunk(180,&a0);}
+EXTERN_C void*__stdcall ZwSetHighEventPair(void*a0){return ZwRosSystemServiceThunk(181,&a0);}
+EXTERN_C void*__stdcall ZwSetHighWaitLowEventPair(void*a0){return ZwRosSystemServiceThunk(182,&a0);}
+EXTERN_C void*__stdcall ZwSetHighWaitLowThread(void){return ZwRosSystemServiceThunk(183,0);}
+EXTERN_C void*__stdcall ZwSetInformationFile(void*a0,void*a1,void*a2,void*a3,void*a4){(void)a1;(void)a2;(void)a3;(void)a4;return ZwRosSystemServiceThunk(184,&a0);}
+EXTERN_C void*__stdcall ZwSetInformationKey(void*a0,void*a1,void*a2,void*a3){(void)a1;(void)a2;(void)a3;return ZwRosSystemServiceThunk(185,&a0);}
+EXTERN_C void*__stdcall ZwSetInformationJobObject(void*a0,void*a1,void*a2,void*a3){(void)a1;(void)a2;(void)a3;return ZwRosSystemServiceThunk(186,&a0);}
+EXTERN_C void*__stdcall ZwSetInformationObject(void*a0,void*a1,void*a2,void*a3){(void)a1;(void)a2;(void)a3;return ZwRosSystemServiceThunk(187,&a0);}
+EXTERN_C void*__stdcall ZwSetInformationProcess(void*a0,void*a1,void*a2,void*a3){(void)a1;(void)a2;(void)a3;return ZwRosSystemServiceThunk(188,&a0);}
+EXTERN_C void*__stdcall ZwSetInformationThread(void*a0,void*a1,void*a2,void*a3){(void)a1;(void)a2;(void)a3;return ZwRosSystemServiceThunk(189,&a0);}
+EXTERN_C void*__stdcall ZwSetInformationToken(void*a0,void*a1,void*a2,void*a3){(void)a1;(void)a2;(void)a3;return ZwRosSystemServiceThunk(190,&a0);}
+EXTERN_C void*__stdcall ZwSetIntervalProfile(void*a0,void*a1){(void)a1;return ZwRosSystemServiceThunk(191,&a0);}
+EXTERN_C void*__stdcall ZwSetLdtEntries(void*a0,void*a1,void*a2,void*a3,void*a4,void*a5){(void)a1;(void)a2;(void)a3;(void)a4;(void)a5;return ZwRosSystemServiceThunk(192,&a0);}
+EXTERN_C void*__stdcall ZwSetLowEventPair(void*a0){return ZwRosSystemServiceThunk(193,&a0);}
+EXTERN_C void*__stdcall ZwSetLowWaitHighEventPair(void*a0){return ZwRosSystemServiceThunk(194,&a0);}
+EXTERN_C void*__stdcall ZwSetLowWaitHighThread(void){return ZwRosSystemServiceThunk(195,0);}
+EXTERN_C void*__stdcall ZwSetQuotaInformationFile(void*a0,void*a1,void*a2,void*a3){(void)a1;(void)a2;(void)a3;return ZwRosSystemServiceThunk(196,&a0);}
+EXTERN_C void*__stdcall ZwSetSecurityObject(void*a0,void*a1,void*a2){(void)a1;(void)a2;return ZwRosSystemServiceThunk(197,&a0);}
+EXTERN_C void*__stdcall ZwSetSystemEnvironmentValue(void*a0,void*a1){(void)a1;return ZwRosSystemServiceThunk(198,&a0);}
+EXTERN_C void*__stdcall ZwSetSystemInformation(void*a0,void*a1,void*a2){(void)a1;(void)a2;return ZwRosSystemServiceThunk(199,&a0);}
+EXTERN_C void*__stdcall ZwSetSystemPowerState(void*a0,void*a1,void*a2){(void)a1;(void)a2;return ZwRosSystemServiceThunk(200,&a0);}
+EXTERN_C void*__stdcall ZwSetSystemTime(void*a0,void*a1){(void)a1;return ZwRosSystemServiceThunk(201,&a0);}
+EXTERN_C void*__stdcall ZwSetTimer(void*a0,void*a1,void*a2,void*a3,void*a4,void*a5,void*a6){(void)a1;(void)a2;(void)a3;(void)a4;(void)a5;(void)a6;return ZwRosSystemServiceThunk(202,&a0);}
+EXTERN_C void*__stdcall ZwSetTimerResolution(void*a0,void*a1,void*a2){(void)a1;(void)a2;return ZwRosSystemServiceThunk(203,&a0);}
+EXTERN_C void*__stdcall ZwSetUuidSeed(void*a0){return ZwRosSystemServiceThunk(204,&a0);}
+EXTERN_C void*__stdcall ZwSetValueKey(void*a0,void*a1,void*a2,void*a3,void*a4,void*a5){(void)a1;(void)a2;(void)a3;(void)a4;(void)a5;return ZwRosSystemServiceThunk(205,&a0);}
+EXTERN_C void*__stdcall ZwSetVolumeInformationFile(void*a0,void*a1,void*a2,void*a3,void*a4){(void)a1;(void)a2;(void)a3;(void)a4;return ZwRosSystemServiceThunk(206,&a0);}
+EXTERN_C void*__stdcall ZwShutdownSystem(void*a0){return ZwRosSystemServiceThunk(207,&a0);}
+EXTERN_C void*__stdcall ZwSignalAndWaitForSingleObject(void*a0,void*a1,void*a2,void*a3){(void)a1;(void)a2;(void)a3;return ZwRosSystemServiceThunk(208,&a0);}
+EXTERN_C void*__stdcall ZwStartProfile(void*a0){return ZwRosSystemServiceThunk(209,&a0);}
+EXTERN_C void*__stdcall ZwStopProfile(void*a0){return ZwRosSystemServiceThunk(210,&a0);}
+EXTERN_C void*__stdcall ZwSuspendThread(void*a0,void*a1){(void)a1;return ZwRosSystemServiceThunk(211,&a0);}
+EXTERN_C void*__stdcall ZwSystemDebugControl(void*a0,void*a1,void*a2,void*a3,void*a4,void*a5){(void)a1;(void)a2;(void)a3;(void)a4;(void)a5;return ZwRosSystemServiceThunk(212,&a0);}
+EXTERN_C void*__stdcall ZwTerminateJobObject(void*a0,void*a1){(void)a1;return ZwRosSystemServiceThunk(213,&a0);}
+EXTERN_C void*__stdcall ZwTerminateProcess(void*a0,void*a1){(void)a1;return ZwRosSystemServiceThunk(214,&a0);}
+EXTERN_C void*__stdcall ZwTerminateThread(void*a0,void*a1){(void)a1;return ZwRosSystemServiceThunk(215,&a0);}
+EXTERN_C void*__stdcall ZwTestAlert(void){return ZwRosSystemServiceThunk(216,0);}
+EXTERN_C void*__stdcall ZwTraceEvent(void*a0,void*a1,void*a2,void*a3){(void)a1;(void)a2;(void)a3;return ZwRosSystemServiceThunk(217,&a0);}
+EXTERN_C void*__stdcall ZwTranslateFilePath(void*a0,void*a1,void*a2){(void)a1;(void)a2;return ZwRosSystemServiceThunk(218,&a0);}
+EXTERN_C void*__stdcall ZwUnloadDriver(void*a0){return ZwRosSystemServiceThunk(219,&a0);}
+EXTERN_C void*__stdcall ZwUnloadKey(void*a0){return ZwRosSystemServiceThunk(220,&a0);}
+EXTERN_C void*__stdcall ZwUnlockFile(void*a0,void*a1,void*a2,void*a3,void*a4){(void)a1;(void)a2;(void)a3;(void)a4;return ZwRosSystemServiceThunk(221,&a0);}
+EXTERN_C void*__stdcall ZwUnlockVirtualMemory(void*a0,void*a1,void*a2,void*a3){(void)a1;(void)a2;(void)a3;return ZwRosSystemServiceThunk(222,&a0);}
+EXTERN_C void*__stdcall ZwUnmapViewOfSection(void*a0,void*a1){(void)a1;return ZwRosSystemServiceThunk(223,&a0);}
+EXTERN_C void*__stdcall ZwVdmControl(void*a0,void*a1){(void)a1;return ZwRosSystemServiceThunk(224,&a0);}
+EXTERN_C void*__stdcall ZwWaitForMultipleObjects(void*a0,void*a1,void*a2,void*a3,void*a4){(void)a1;(void)a2;(void)a3;(void)a4;return ZwRosSystemServiceThunk(225,&a0);}
+EXTERN_C void*__stdcall ZwWaitForSingleObject(void*a0,void*a1,void*a2){(void)a1;(void)a2;return ZwRosSystemServiceThunk(226,&a0);}
+EXTERN_C void*__stdcall ZwWaitHighEventPair(void*a0){return ZwRosSystemServiceThunk(227,&a0);}
+EXTERN_C void*__stdcall ZwWaitLowEventPair(void*a0){return ZwRosSystemServiceThunk(228,&a0);}
+EXTERN_C void*__stdcall ZwWriteFile(void*a0,void*a1,void*a2,void*a3,void*a4,void*a5,void*a6,void*a7,void*a8){(void)a1;(void)a2;(void)a3;(void)a4;(void)a5;(void)a6;(void)a7;(void)a8;return ZwRosSystemServiceThunk(229,&a0);}
+EXTERN_C void*__stdcall ZwWriteFileGather(void*a0,void*a1,void*a2,void*a3,void*a4,void*a5,void*a6,void*a7,void*a8){(void)a1;(void)a2;(void)a3;(void)a4;(void)a5;(void)a6;(void)a7;(void)a8;return ZwRosSystemServiceThunk(230,&a0);}
+EXTERN_C void*__stdcall ZwWriteRequestData(void*a0,void*a1,void*a2,void*a3,void*a4,void*a5){(void)a1;(void)a2;(void)a3;(void)a4;(void)a5;return ZwRosSystemServiceThunk(231,&a0);}
+EXTERN_C void*__stdcall ZwWriteVirtualMemory(void*a0,void*a1,void*a2,void*a3,void*a4){(void)a1;(void)a2;(void)a3;(void)a4;return ZwRosSystemServiceThunk(232,&a0);}
+EXTERN_C void*__stdcall ZwW32Call(void*a0,void*a1,void*a2,void*a3,void*a4){(void)a1;(void)a2;(void)a3;(void)a4;return ZwRosSystemServiceThunk(233,&a0);}
+EXTERN_C void*__stdcall ZwYieldExecution(void){return ZwRosSystemServiceThunk(234,0);}
index 982ecbe..d227ed6 100644 (file)
@@ -78,7 +78,7 @@ EiConnectPort(IN PEPORT* ConnectedPort,
     {
       return (Status);
     }
-  NiInitializePort(OurPort, EPORT_TYPE_CLIENT_COMM_PORT, NamedPort);
+  LpcpInitializePort(OurPort, EPORT_TYPE_CLIENT_COMM_PORT, NamedPort);
 
   /*
    * Allocate a request message.
@@ -592,7 +592,7 @@ NtAcceptConnectPort (PHANDLE                        ServerPortHandle,
          return(Status);
        }
 
-      NiInitializePort(OurPort, EPORT_TYPE_SERVER_COMM_PORT, NamedPort);
+      LpcpInitializePort(OurPort, EPORT_TYPE_SERVER_COMM_PORT, NamedPort);
     }
 
   /*
index 2b9260e..adf561f 100644 (file)
@@ -159,7 +159,7 @@ NtCreatePort (PHANDLE                     PortHandle,
       return (Status);
     }
 
-  Status = NiInitializePort (Port, EPORT_TYPE_SERVER_RQST_PORT, NULL);
+  Status = LpcpInitializePort (Port, EPORT_TYPE_SERVER_RQST_PORT, NULL);
   Port->MaxConnectInfoLength = PORT_MAX_DATA_LENGTH;
   Port->MaxDataLength = PORT_MAX_MESSAGE_LENGTH;
   Port->MaxPoolUsage = MaxPoolUsage;
index 5649e8d..2450ae5 100644 (file)
@@ -35,7 +35,7 @@ static GENERIC_MAPPING ExpPortMapping = {
 
 
 NTSTATUS INIT_FUNCTION
-NiInitPort (VOID)
+LpcpInitSystem (VOID)
 {
     /* Allocate Memory for the LPC Object */
     LpcPortObjectType = ExAllocatePool(NonPagedPool, sizeof(OBJECT_TYPE));
@@ -91,7 +91,7 @@ NiInitPort (VOID)
  *     otherwise.
  */
 NTSTATUS STDCALL
-NiInitializePort (IN OUT  PEPORT Port,
+LpcpInitializePort (IN OUT  PEPORT Port,
                  IN      USHORT Type,
                  IN      PEPORT Parent OPTIONAL)
 {