Reverting to 13775. Sorry for the mess. This is dedicated to Jane!
19934415.
Modified: trunk/reactos/config
Modified: trunk/reactos/drivers/storage/floppy/floppy.c
Modified: trunk/reactos/include/ddk/extypes.h
Modified: trunk/reactos/include/ddk/iotypes.h
Modified: trunk/reactos/include/ddk/ketypes.h
Modified: trunk/reactos/include/ntos/zwtypes.h
Modified: trunk/reactos/lib/ntdll/def/ntdll.def
Modified: trunk/reactos/ntoskrnl/Makefile
Modified: trunk/reactos/ntoskrnl/cm/registry.c
Deleted: trunk/reactos/ntoskrnl/ex/error.c
Modified: trunk/reactos/ntoskrnl/ex/event.c
Modified: trunk/reactos/ntoskrnl/ex/evtpair.c
Modified: trunk/reactos/ntoskrnl/ex/init.c
Modified: trunk/reactos/ntoskrnl/ex/mutant.c
Modified: trunk/reactos/ntoskrnl/ex/rundown.c
Modified: trunk/reactos/ntoskrnl/ex/sem.c
Modified: trunk/reactos/ntoskrnl/ex/sysinfo.c
Modified: trunk/reactos/ntoskrnl/ex/timer.c
Modified: trunk/reactos/ntoskrnl/ex/work.c
Modified: trunk/reactos/ntoskrnl/include/internal/ex.h
Modified: trunk/reactos/ntoskrnl/include/internal/id.h
Modified: trunk/reactos/ntoskrnl/include/internal/io.h
Modified: trunk/reactos/ntoskrnl/include/internal/ke.h
Modified: trunk/reactos/ntoskrnl/include/internal/nls.h
Modified: trunk/reactos/ntoskrnl/include/internal/ntoskrnl.h
Modified: trunk/reactos/ntoskrnl/include/internal/ps.h
Modified: trunk/reactos/ntoskrnl/io/bootlog.c
Modified: trunk/reactos/ntoskrnl/io/create.c
Modified: trunk/reactos/ntoskrnl/io/driver.c
Modified: trunk/reactos/ntoskrnl/io/iocomp.c
Modified: trunk/reactos/ntoskrnl/io/iomgr.c
Modified: trunk/reactos/ntoskrnl/io/wmi.c
Added: trunk/reactos/ntoskrnl/ke/alert.c
Modified: trunk/reactos/ntoskrnl/ke/apc.c
Modified: trunk/reactos/ntoskrnl/ke/bug.c
Modified: trunk/reactos/ntoskrnl/ke/catch.c
Added: trunk/reactos/ntoskrnl/ke/critical.c
Modified: trunk/reactos/ntoskrnl/ke/dpc.c
Added: trunk/reactos/ntoskrnl/ke/error.c
Modified: trunk/reactos/ntoskrnl/ke/event.c
Modified: trunk/reactos/ntoskrnl/ke/i386/tskswitch.S
Modified: trunk/reactos/ntoskrnl/ke/kthread.c
Modified: trunk/reactos/ntoskrnl/ke/main.c
Modified: trunk/reactos/ntoskrnl/ke/mutex.c
Modified: trunk/reactos/ntoskrnl/ke/queue.c
Modified: trunk/reactos/ntoskrnl/ke/sem.c
Modified: trunk/reactos/ntoskrnl/ke/timer.c
Modified: trunk/reactos/ntoskrnl/ke/wait.c
Modified: trunk/reactos/ntoskrnl/ntoskrnl.def
Modified: trunk/reactos/ntoskrnl/ntoskrnl.mc
Deleted: trunk/reactos/ntoskrnl/ob/wait.c
Modified: trunk/reactos/ntoskrnl/ps/kill.c
Modified: trunk/reactos/ntoskrnl/ps/process.c
Modified: trunk/reactos/ntoskrnl/ps/thread.c
Modified: trunk/reactos/ntoskrnl/rtl/nls.c
Modified: trunk/reactos/tools/nci/sysfuncs.lst
_____
Modified: trunk/reactos/config
--- trunk/reactos/config 2005-02-28 16:44:38 UTC (rev 13776)
+++ trunk/reactos/config 2005-02-28 17:40:15 UTC (rev 13777)
@@ -15,7 +15,7 @@
# be optimze for.
#
-OARCH := pentium2
+OARCH := i486
#
# Whether to compile in the kernel debugger
@@ -30,7 +30,7 @@
#
# Whether to compile with optimizations
#
-OPTIMIZED := 1
+OPTIMIZED := 0
#
# Whether to compile a multiprocessor or single processor version
_____
Modified: trunk/reactos/drivers/storage/floppy/floppy.c
--- trunk/reactos/drivers/storage/floppy/floppy.c 2005-02-28
16:44:38 UTC (rev 13776)
+++ trunk/reactos/drivers/storage/floppy/floppy.c 2005-02-28
17:40:15 UTC (rev 13777)
@@ -58,7 +58,7 @@
/* Queue thread management */
static KEVENT QueueThreadTerminate;
-static PVOID QueueThreadObject;
+static PVOID ThreadObject;
static VOID NTAPI MotorStopDpcFunc(PKDPC UnusedDpc,
@@ -378,8 +378,8 @@
KdPrint(("floppy: unloading\n"));
KeSetEvent(&QueueThreadTerminate, 0, FALSE);
- KeWaitForSingleObject(QueueThreadObject, Executive, KernelMode,
FALSE, 0);
- ObDereferenceObject(QueueThreadObject);
+ KeWaitForSingleObject(ThreadObject, Executive, KernelMode, FALSE, 0);
+ ObDereferenceObject(ThreadObject);
for(i = 0; i < gNumberOfControllers; i++)
{
@@ -1152,7 +1152,7 @@
return STATUS_INSUFFICIENT_RESOURCES;
}
- if(ObReferenceObjectByHandle(ThreadHandle, STANDARD_RIGHTS_ALL, NULL,
KernelMode, &QueueThreadObject, NULL) != STATUS_SUCCESS)
+ if(ObReferenceObjectByHandle(ThreadHandle, STANDARD_RIGHTS_ALL, NULL,
KernelMode, &ThreadObject, NULL) != STATUS_SUCCESS)
{
KdPrint(("floppy: Unable to reference returned thread handle;
failing init\n"));
return STATUS_UNSUCCESSFUL;
_____
Modified: trunk/reactos/include/ddk/extypes.h
--- trunk/reactos/include/ddk/extypes.h 2005-02-28 16:44:38 UTC (rev
13776)
+++ trunk/reactos/include/ddk/extypes.h 2005-02-28 17:40:15 UTC (rev
13777)
@@ -30,23 +30,6 @@
MaximumWorkQueue
} WORK_QUEUE_TYPE;
-typedef struct _EX_QUEUE_WORKER_INFO {
- UCHAR QueueDisabled:1;
- UCHAR MakeThreadsAsNecessary:1;
- UCHAR WaitMode:1;
- ULONG WorkerCount:29;
-} EX_QUEUE_WORKER_INFO, *PEX_QUEUE_WORKER_INFO;
-
-typedef struct _EX_WORK_QUEUE {
- KQUEUE WorkerQueue;
- ULONG DynamicThreadCount;
- ULONG WorkItemsProcessed;
- ULONG WorkItemsProcessedLastPass;
- ULONG QueueDepthLastPass;
- EX_QUEUE_WORKER_INFO Info;
-} EX_WORK_QUEUE, *PEX_WORK_QUEUE;
-
-
typedef ULONG_PTR ERESOURCE_THREAD, *PERESOURCE_THREAD;
typedef struct _OWNER_ENTRY
@@ -257,10 +240,6 @@
PVOID Argument1,
PVOID Argument2);
-extern struct _OBJECT_TYPE EXPORTED *ExMutantObjectType;
-extern struct _OBJECT_TYPE EXPORTED *ExSemaphoreObjectType;
-extern struct _OBJECT_TYPE EXPORTED *ExTimerType;
-
#endif /* __INCLUDE_DDK_EXTYPES_H */
/* EOF */
_____
Modified: trunk/reactos/include/ddk/iotypes.h
--- trunk/reactos/include/ddk/iotypes.h 2005-02-28 16:44:38 UTC (rev
13776)
+++ trunk/reactos/include/ddk/iotypes.h 2005-02-28 17:40:15 UTC (rev
13777)
@@ -886,8 +886,6 @@
#endif
#define IO_TYPE_DRIVER 4L
-#define IO_TYPE_FILE 0x0F5L
-
#define DRVO_UNLOAD_INVOKED 0x1L
#define DRVO_LEGACY_DRIVER 0x2L
#define DRVO_BUILTIN_DRIVER 0x4L
_____
Modified: trunk/reactos/include/ddk/ketypes.h
--- trunk/reactos/include/ddk/ketypes.h 2005-02-28 16:44:38 UTC (rev
13776)
+++ trunk/reactos/include/ddk/ketypes.h 2005-02-28 17:40:15 UTC (rev
13777)
@@ -36,34 +36,23 @@
struct _DISPATCHER_HEADER;
-typedef enum _KOBJECTS {
- EventNotificationObject = 0,
- EventSynchronizationObject = 1,
- MutantObject = 2,
- ProcessObject = 3,
- QueueObject = 4,
- SemaphoreObject = 5,
- ThreadObject = 6,
- GateObject = 7,
- TimerNotificationObject = 8,
- TimerSynchronizationObject = 9,
- Spare2Object = 10,
- Spare3Object = 11,
- Spare4Object = 12,
- Spare5Object = 13,
- Spare6Object = 14,
- Spare7Object = 15,
- Spare8Object = 16,
- Spare9Object = 17,
- ApcObject = 18,
- DpcObject = 19,
- DeviceQueueObject = 20,
- EventPairObject = 21,
- InterruptObject = 22,
- ProfileObject = 23,
- ThreadedDpcObject = 24,
- MaximumKernelObject = 25
-} KOBJECTS;
+typedef enum _KERNEL_OBJECTS {
+ KNotificationEvent = 0,
+ KSynchronizationEvent = 1,
+ KMutant = 2,
+ KProcess = 3,
+ KQueue = 4,
+ KSemaphore = 5,
+ KThread = 6,
+ KNotificationTimer = 8,
+ KSynchronizationTimer = 9,
+ KApc = 18,
+ KDpc = 19,
+ KDeviceQueue = 20,
+ KEventPair = 21,
+ KInterrupt = 22,
+ KProfile = 23
+} KERNEL_OBJECTS;
#include <pshpack1.h>
_____
Modified: trunk/reactos/include/ntos/zwtypes.h
--- trunk/reactos/include/ntos/zwtypes.h 2005-02-28 16:44:38 UTC
(rev 13776)
+++ trunk/reactos/include/ntos/zwtypes.h 2005-02-28 17:40:15 UTC
(rev 13777)
@@ -1262,9 +1262,9 @@
typedef struct _MUTANT_BASIC_INFORMATION
{
- LONG CurrentCount;
- BOOLEAN OwnedByCaller;
- BOOLEAN AbandonedState;
+ LONG Count;
+ BOOLEAN Owned;
+ BOOLEAN Abandoned;
} MUTANT_BASIC_INFORMATION, *PMUTANT_BASIC_INFORMATION;
_____
Modified: trunk/reactos/lib/ntdll/def/ntdll.def
--- trunk/reactos/lib/ntdll/def/ntdll.def 2005-02-28 16:44:38 UTC
(rev 13776)
+++ trunk/reactos/lib/ntdll/def/ntdll.def 2005-02-28 17:40:15 UTC
(rev 13777)
@@ -225,6 +225,7 @@
NtSetEvent@8
NtSetHighEventPair@4
NtSetHighWaitLowEventPair@4
+NtSetHighWaitLowThread@0
NtSetInformationFile@20
NtSetInformationJobObject@16
NtSetInformationKey@16
@@ -237,6 +238,7 @@
NtSetLdtEntries@24
NtSetLowEventPair@4
NtSetLowWaitHighEventPair@4
+NtSetLowWaitHighThread@0
NtSetSecurityObject@12
NtSetSystemEnvironmentValue@8
NtSetSystemInformation@12
@@ -847,6 +849,7 @@
ZwSetEvent@8
ZwSetHighEventPair@4
ZwSetHighWaitLowEventPair@4
+ZwSetHighWaitLowThread@0
ZwSetInformationFile@20
ZwSetInformationKey@16
ZwSetInformationObject@16
@@ -858,6 +861,7 @@
ZwSetLdtEntries@24
ZwSetLowEventPair@4
ZwSetLowWaitHighEventPair@4
+ZwSetLowWaitHighThread@0
ZwSetSecurityObject@12
ZwSetSystemEnvironmentValue@8
ZwSetSystemInformation@12
_____
Modified: trunk/reactos/ntoskrnl/Makefile
--- trunk/reactos/ntoskrnl/Makefile 2005-02-28 16:44:38 UTC (rev
13776)
+++ trunk/reactos/ntoskrnl/Makefile 2005-02-28 17:40:15 UTC (rev
13777)
@@ -101,8 +101,10 @@
ke/bug.o \
ke/catch.o \
ke/clock.o \
+ ke/critical.o \
ke/dpc.o \
ke/device.o \
+ ke/error.o \
ke/event.o \
ke/kqueue.o \
ke/kthread.o \
@@ -116,6 +118,7 @@
ke/spinlock.o \
ke/timer.o \
ke/wait.o \
+ ke/alert.o
# Memory Manager (Mm)
OBJECTS_MM = \
@@ -216,8 +219,7 @@
ob/object.o \
ob/sdcache.o \
ob/security.o \
- ob/symlink.o \
- ob/wait.o
+ ob/symlink.o
# Process Manager (Ps)
OBJECTS_PS = \
@@ -240,7 +242,6 @@
OBJECTS_EX = \
ex/btree.o \
ex/callback.o \
- ex/error.o \
ex/event.o \
ex/evtpair.o \
ex/fmutex.o \
_____
Modified: trunk/reactos/ntoskrnl/cm/registry.c
--- trunk/reactos/ntoskrnl/cm/registry.c 2005-02-28 16:44:38 UTC
(rev 13776)
+++ trunk/reactos/ntoskrnl/cm/registry.c 2005-02-28 17:40:15 UTC
(rev 13777)
@@ -241,30 +241,7 @@
CmiCheckByName(Verbose, L"User");
}
-VOID
-INIT_FUNCTION
-STDCALL
-CmInitHives(BOOLEAN SetupBoot)
-{
- PCHAR BaseAddress;
-
- /* Load Registry Hives */
- BaseAddress = (PCHAR)CachedModules[SystemRegistry]->ModStart;
- CmImportSystemHive(BaseAddress,
- CachedModules[SystemRegistry]->ModEnd -
(ULONG_PTR)BaseAddress);
-
- BaseAddress = (PCHAR)CachedModules[HardwareRegistry]->ModStart;
- CmImportHardwareHive(BaseAddress,
- CachedModules[HardwareRegistry]->ModEnd -
(ULONG_PTR)BaseAddress);
-
- /* Create dummy keys if no hardware hive was found */
- CmImportHardwareHive (NULL, 0);
-
- /* Initialize volatile registry settings */
- if (SetupBoot == FALSE) CmInit2((PCHAR)KeLoaderBlock.CommandLine);
-}
-
VOID INIT_FUNCTION
CmInitializeRegistry(VOID)
{
_____
Deleted: trunk/reactos/ntoskrnl/ex/error.c
--- trunk/reactos/ntoskrnl/ex/error.c 2005-02-28 16:44:38 UTC (rev
13776)
+++ trunk/reactos/ntoskrnl/ex/error.c 2005-02-28 17:40:15 UTC (rev
13777)
@@ -1,163 +0,0 @@
-/*
- * COPYRIGHT: See COPYING in the top level directory
- * PROJECT: ReactOS kernel
- * FILE: ntoskrnl/ex/error.c
- * PURPOSE: Error Functions and Status/Exception
Dispatching/Raising
- *
- * PROGRAMMERS: Alex Ionescu (alex(a)relsoft.net) - Created File
- */
-
-/* INCLUDES
*****************************************************************/
-
-#include <ntoskrnl.h>
-#define NDEBUG
-#include <internal/debug.h>
-
-/* GLOBALS
****************************************************************/
-
-BOOLEAN ExReadyForErrors = FALSE;
-PEPORT ExpDefaultErrorPort = NULL;
-PEPROCESS ExpDefaultErrorPortProcess = NULL;
-
-/* FUNCTIONS
****************************************************************/
-
-/*
- * @implemented
- */
-VOID
-STDCALL
-ExRaiseAccessViolation(VOID)
-{
- /* Raise the Right Status */
- ExRaiseStatus (STATUS_ACCESS_VIOLATION);
-}
-
-/*
- * @implemented
- */
-VOID
-STDCALL
-ExRaiseDatatypeMisalignment (VOID)
-{
- /* Raise the Right Status */
- ExRaiseStatus (STATUS_DATATYPE_MISALIGNMENT);
-}
-
-/*
- * @implemented
- */
-VOID
-STDCALL
-ExRaiseStatus(IN NTSTATUS Status)
-{
- EXCEPTION_RECORD ExceptionRecord;
-
- DPRINT("ExRaiseStatus(%x)\n", Status);
-
- /* Set up an Exception Record */
- ExceptionRecord.ExceptionRecord = NULL;
- ExceptionRecord.NumberParameters = 0;
- ExceptionRecord.ExceptionCode = Status;
- ExceptionRecord.ExceptionFlags = 0;
-
- /* Call the Rtl Function */
- RtlRaiseException(&ExceptionRecord);
-}
-
-/*
- * @implemented
- */
-VOID
-STDCALL
-ExRaiseException (PEXCEPTION_RECORD ExceptionRecord)
-{
- /* Call the Rtl function */
- RtlRaiseException(ExceptionRecord);
-}
-
-/*
- * @implemented
- */
-BOOLEAN
-STDCALL
-ExSystemExceptionFilter(VOID)
-{
- return KeGetPreviousMode() != KernelMode ?
EXCEPTION_EXECUTE_HANDLER : EXCEPTION_CONTINUE_SEARCH;
-}
-
-/*
- * @unimplemented
- */
-VOID
-STDCALL
-ExRaiseHardError(IN NTSTATUS ErrorStatus,
- IN ULONG NumberOfParameters,
- IN PUNICODE_STRING UnicodeStringParameterMask
OPTIONAL,
- IN PVOID *Parameters,
- IN HARDERROR_RESPONSE_OPTION ResponseOption,
- OUT PHARDERROR_RESPONSE Response)
-{
- UNIMPLEMENTED;
-}
-
-NTSTATUS
-STDCALL
-NtRaiseHardError(IN NTSTATUS ErrorStatus,
- IN ULONG NumberOfParameters,
- IN PUNICODE_STRING UnicodeStringParameterMask
OPTIONAL,
- IN PVOID *Parameters,
- IN HARDERROR_RESPONSE_OPTION ResponseOption,
- OUT PHARDERROR_RESPONSE Response)
-{
- DPRINT1("Hard error %x\n", ErrorStatus);
-
- /* Call the Executive Function (WE SHOULD PUT SEH HERE/CAPTURE!) */
- ExRaiseHardError(ErrorStatus,
- NumberOfParameters,
- UnicodeStringParameterMask,
- Parameters,
- ResponseOption,
- Response);
-
- /* Return Success */
- return STATUS_SUCCESS;
-}
-
-NTSTATUS
-STDCALL
-NtSetDefaultHardErrorPort(IN HANDLE PortHandle)
-{
-
- KPROCESSOR_MODE PreviousMode = ExGetPreviousMode();
- NTSTATUS Status = STATUS_UNSUCCESSFUL;
-
- /* Check if we have the Privilege */
- if(!SeSinglePrivilegeCheck(SeTcbPrivilege, PreviousMode)) {
-
- DPRINT1("NtSetDefaultHardErrorPort: Caller requires the
SeTcbPrivilege privilege!\n");
- return STATUS_PRIVILEGE_NOT_HELD;
- }
-
- /* Only called once during bootup, make sure we weren't called yet
*/
- if(!ExReadyForErrors) {
-
- Status = ObReferenceObjectByHandle(PortHandle,
- 0,
- LpcPortObjectType,
- PreviousMode,
-
(PVOID*)&ExpDefaultErrorPort,
- NULL);
-
- /* Check for Success */
- if(NT_SUCCESS(Status)) {
-
- /* Save the data */
- ExpDefaultErrorPortProcess = PsGetCurrentProcess();
- ExReadyForErrors = TRUE;
- }
- }
-
- return Status;
-}
-
-/* EOF */
_____
Modified: trunk/reactos/ntoskrnl/ex/event.c
--- trunk/reactos/ntoskrnl/ex/event.c 2005-02-28 16:44:38 UTC (rev
13776)
+++ trunk/reactos/ntoskrnl/ex/event.c 2005-02-28 17:40:15 UTC (rev
13777)
@@ -19,286 +19,300 @@
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};
+ STANDARD_RIGHTS_READ | SYNCHRONIZE | EVENT_QUERY_STATE,
+ STANDARD_RIGHTS_WRITE | SYNCHRONIZE | EVENT_MODIFY_STATE,
+ STANDARD_RIGHTS_EXECUTE | SYNCHRONIZE | EVENT_QUERY_STATE,
+ EVENT_ALL_ACCESS};
-static const INFORMATION_CLASS_INFO ExEventInfoClass[] = {
-
- /* EventBasicInformation */
- ICI_SQ_SAME( sizeof(EVENT_BASIC_INFORMATION), sizeof(ULONG),
ICIF_QUERY),
+static const INFORMATION_CLASS_INFO ExEventInfoClass[] =
+{
+ ICI_SQ_SAME( sizeof(EVENT_BASIC_INFORMATION), sizeof(ULONG),
ICIF_QUERY ), /* EventBasicInformation */
};
/* FUNCTIONS
*****************************************************************/
-VOID
-INIT_FUNCTION
+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)
{
- /* Create the Event Object Type */
- ExEventObjectType =
ExAllocatePool(NonPagedPool,sizeof(OBJECT_TYPE));
- RtlpCreateUnicodeString(&ExEventObjectType->TypeName, L"Event",
NonPagedPool);
- 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 = NULL;
- ExEventObjectType->DuplicationNotify = NULL;
- ObpCreateTypeObject(ExEventObjectType);
+ ExEventObjectType =
ExAllocatePool(NonPagedPool,sizeof(OBJECT_TYPE));
+
+ RtlpCreateUnicodeString(&ExEventObjectType->TypeName, L"Event",
NonPagedPool);
+
+ 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);
}
+
/*
* @implemented
*/
-NTSTATUS
-STDCALL
+NTSTATUS STDCALL
NtClearEvent(IN HANDLE EventHandle)
{
- PKEVENT Event;
- NTSTATUS Status;
-
- PAGED_CODE();
+ PKEVENT Event;
+ NTSTATUS Status;
- /* Reference the Object */
+ PAGED_CODE();
+
Status = ObReferenceObjectByHandle(EventHandle,
- EVENT_MODIFY_STATE,
- ExEventObjectType,
- ExGetPreviousMode(),
- (PVOID*)&Event,
- NULL);
+ EVENT_MODIFY_STATE,
+ ExEventObjectType,
+ ExGetPreviousMode(),
+ (PVOID*)&Event,
+ NULL);
+ if(NT_SUCCESS(Status))
+ {
+ KeClearEvent(Event);
+ ObDereferenceObject(Event);
+ }
- /* Check for Success */
- if(NT_SUCCESS(Status)) {
-
- /* Clear the Event and Dereference */
- KeClearEvent(Event);
- ObDereferenceObject(Event);
- }
-
- /* Return Status */
- return Status;
+ return Status;
}
/*
* @implemented
*/
-NTSTATUS
-STDCALL
+NTSTATUS STDCALL
NtCreateEvent(OUT PHANDLE EventHandle,
- IN ACCESS_MASK DesiredAccess,
- IN POBJECT_ATTRIBUTES ObjectAttributes OPTIONAL,
- IN EVENT_TYPE EventType,
- IN BOOLEAN InitialState)
+ IN ACCESS_MASK DesiredAccess,
+ IN POBJECT_ATTRIBUTES ObjectAttributes OPTIONAL,
+ IN EVENT_TYPE EventType,
+ IN BOOLEAN InitialState)
{
- KPROCESSOR_MODE PreviousMode = ExGetPreviousMode();
- PKEVENT Event;
- HANDLE hEvent;
- NTSTATUS Status = STATUS_SUCCESS;
+ KPROCESSOR_MODE PreviousMode;
+ PKEVENT Event;
+ HANDLE hEvent;
+ NTSTATUS Status = STATUS_SUCCESS;
- PAGED_CODE();
+ PAGED_CODE();
- /* Check Output Safety */
- if(PreviousMode == UserMode) {
-
- _SEH_TRY {
-
- ProbeForWrite(EventHandle,
- sizeof(HANDLE),
- sizeof(ULONG));
- } _SEH_HANDLE {
-
- Status = _SEH_GetExceptionCode();
-
- } _SEH_END;
+ PreviousMode = ExGetPreviousMode();
+
+ if(PreviousMode == UserMode)
+ {
+ _SEH_TRY
+ {
+ ProbeForWrite(EventHandle,
+ sizeof(HANDLE),
+ sizeof(ULONG));
+ }
+ _SEH_HANDLE
+ {
+ Status = _SEH_GetExceptionCode();
+ }
+ _SEH_END;
- if(!NT_SUCCESS(Status)) return Status;
- }
-
- /* Create the Object */
- Status = ObCreateObject(PreviousMode,
- ExEventObjectType,
- ObjectAttributes,
- PreviousMode,
- NULL,
- sizeof(KEVENT),
- 0,
- 0,
- (PVOID*)&Event);
-
- /* Check for Success */
- if(NT_SUCCESS(Status)) {
-
- /* Initalize the Event */
- KeInitializeEvent(Event,
- EventType,
- InitialState);
-
- /* Insert it */
- Status = ObInsertObject((PVOID)Event,
- NULL,
- DesiredAccess,
- 0,
- NULL,
- &hEvent);
- ObDereferenceObject(Event);
+ if(!NT_SUCCESS(Status))
+ {
+ return Status;
+ }
+ }
- /* Check for success and return handle */
- if(NT_SUCCESS(Status)) {
-
- _SEH_TRY {
-
- *EventHandle = hEvent;
-
- } _SEH_HANDLE {
-
- Status = _SEH_GetExceptionCode();
-
- } _SEH_END;
- }
- }
-
- /* Return Status */
- return Status;
+ Status = ObCreateObject(PreviousMode,
+ ExEventObjectType,
+ ObjectAttributes,
+ PreviousMode,
+ NULL,
+ sizeof(KEVENT),
+ 0,
+ 0,
+ (PVOID*)&Event);
+ if(NT_SUCCESS(Status))
+ {
+ KeInitializeEvent(Event,
+ EventType,
+ InitialState);
+
+
+ Status = ObInsertObject((PVOID)Event,
+ NULL,
+ DesiredAccess,
+ 0,
+ NULL,
+ &hEvent);
+ ObDereferenceObject(Event);
+
+ if(NT_SUCCESS(Status))
+ {
+ _SEH_TRY
+ {
+ *EventHandle = hEvent;
+ }
+ _SEH_HANDLE
+ {
+ Status = _SEH_GetExceptionCode();
+ }
+ _SEH_END;
+ }
+ }
+
+ return Status;
}
+
/*
* @implemented
*/
-NTSTATUS
-STDCALL
+NTSTATUS STDCALL
NtOpenEvent(OUT PHANDLE EventHandle,
- IN ACCESS_MASK DesiredAccess,
- IN POBJECT_ATTRIBUTES ObjectAttributes)
+ IN ACCESS_MASK DesiredAccess,
+ IN POBJECT_ATTRIBUTES ObjectAttributes)
{
- HANDLE hEvent;
- KPROCESSOR_MODE PreviousMode = ExGetPreviousMode();
- NTSTATUS Status = STATUS_SUCCESS;
+ HANDLE hEvent;
+ KPROCESSOR_MODE PreviousMode;
+ NTSTATUS Status = STATUS_SUCCESS;
- PAGED_CODE();
- DPRINT("NtOpenEvent(0x%x, 0x%x, 0x%x)\n", EventHandle,
DesiredAccess, ObjectAttributes);
+ PAGED_CODE();
+
+ DPRINT("NtOpenEvent(0x%x, 0x%x, 0x%x)\n", EventHandle,
DesiredAccess, ObjectAttributes);
- /* Check Output Safety */
- if(PreviousMode == UserMode) {
-
- _SEH_TRY {
-
- ProbeForWrite(EventHandle,
- sizeof(HANDLE),
- sizeof(ULONG));
- } _SEH_HANDLE {
-
- Status = _SEH_GetExceptionCode();
-
- } _SEH_END;
+ PreviousMode = ExGetPreviousMode();
+
+ if(PreviousMode == UserMode)
+ {
+ _SEH_TRY
+ {
+ ProbeForWrite(EventHandle,
+ sizeof(HANDLE),
+ sizeof(ULONG));
+ }
+ _SEH_HANDLE
+ {
+ Status = _SEH_GetExceptionCode();
+ }
+ _SEH_END;
- if(!NT_SUCCESS(Status)) return Status;
- }
-
- /* Open the Object */
- Status = ObOpenObjectByName(ObjectAttributes,
- ExEventObjectType,
- NULL,
- PreviousMode,
- DesiredAccess,
- NULL,
- &hEvent);
+ if(!NT_SUCCESS(Status))
+ {
+ return Status;
+ }
+ }
+
+ Status = ObOpenObjectByName(ObjectAttributes,
+ ExEventObjectType,
+ NULL,
+ PreviousMode,
+ DesiredAccess,
+ NULL,
+ &hEvent);
- /* Check for success and return handle */
- if(NT_SUCCESS(Status)) {
-
- _SEH_TRY {
-
- *EventHandle = hEvent;
-
- } _SEH_HANDLE {
-
- Status = _SEH_GetExceptionCode();
-
- } _SEH_END;
- }
+ if(NT_SUCCESS(Status))
+ {
+ _SEH_TRY
+ {
+ *EventHandle = hEvent;
+ }
+ _SEH_HANDLE
+ {
+ Status = _SEH_GetExceptionCode();
+ }
+ _SEH_END;
+ }
- /* Return status */
- return Status;
+ return Status;
}
+
/*
* @implemented
*/
-NTSTATUS
-STDCALL
+NTSTATUS STDCALL
NtPulseEvent(IN HANDLE EventHandle,
- OUT PLONG PreviousState OPTIONAL)
+ OUT PLONG PreviousState OPTIONAL)
{
- PKEVENT Event;
- KPROCESSOR_MODE PreviousMode = ExGetPreviousMode();
- NTSTATUS Status = STATUS_SUCCESS;
+ PKEVENT Event;
+ KPROCESSOR_MODE PreviousMode;
+ NTSTATUS Status = STATUS_SUCCESS;
- PAGED_CODE();
- DPRINT("NtPulseEvent(EventHandle 0%x PreviousState 0%x)\n",
- EventHandle, PreviousState);
+ PAGED_CODE();
- /* Check buffer validity */
- if(PreviousState && PreviousMode == UserMode) {
-
- _SEH_TRY {
-
- ProbeForWrite(PreviousState,
- sizeof(LONG),
- sizeof(ULONG));
- } _SEH_HANDLE {
-
- Status = _SEH_GetExceptionCode();
-
- } _SEH_END;
+ DPRINT("NtPulseEvent(EventHandle 0%x PreviousState 0%x)\n",
+ EventHandle, PreviousState);
- if(!NT_SUCCESS(Status)) return Status;
- }
-
- /* Open the Object */
- Status = ObReferenceObjectByHandle(EventHandle,
- EVENT_MODIFY_STATE,
- ExEventObjectType,
- PreviousMode,
- (PVOID*)&Event,
- NULL);
-
- /* Check for success */
- if(NT_SUCCESS(Status)) {
-
- /* Pulse the Event */
- LONG Prev = KePulseEvent(Event, EVENT_INCREMENT, FALSE);
- ObDereferenceObject(Event);
+ PreviousMode = ExGetPreviousMode();
+
+ if(PreviousState != NULL && PreviousMode == UserMode)
+ {
+ _SEH_TRY
+ {
+ ProbeForWrite(PreviousState,
+ sizeof(LONG),
+ sizeof(ULONG));
+ }
+ _SEH_HANDLE
+ {
+ Status = _SEH_GetExceptionCode();
+ }
+ _SEH_END;
- /* Return it */
- if(PreviousState) {
-
- _SEH_TRY {
-
- *PreviousState = Prev;
-
- } _SEH_HANDLE {
-
- Status = _SEH_GetExceptionCode();
-
- } _SEH_END;
- }
+ if(!NT_SUCCESS(Status))
+ {
+ return Status;
+ }
}
- /* Return Status */
+ Status = ObReferenceObjectByHandle(EventHandle,
+ EVENT_MODIFY_STATE,
+ ExEventObjectType,
+ PreviousMode,
+ (PVOID*)&Event,
+ NULL);
+ if(NT_SUCCESS(Status))
+ {
+ LONG Prev = KePulseEvent(Event, EVENT_INCREMENT, FALSE);
+ ObDereferenceObject(Event);
+
+ if(PreviousState != NULL)
+ {
+ _SEH_TRY
+ {
+ *PreviousState = Prev;
+ }
+ _SEH_HANDLE
+ {
+ Status = _SEH_GetExceptionCode();
+ }
+ _SEH_END;
+ }
+ }
+
return Status;
}
@@ -306,202 +320,230 @@
/*
* @implemented
*/
-NTSTATUS
-STDCALL
+NTSTATUS STDCALL
NtQueryEvent(IN HANDLE EventHandle,
- IN EVENT_INFORMATION_CLASS EventInformationClass,
[truncated at 1000 lines; 13561 more skipped]