Modified: trunk/reactos/baseaddress.cfg
Modified: trunk/reactos/drivers/lib/oskittcp/oskittcp/uipc_domain.c
Modified: trunk/reactos/drivers/lib/oskittcp/oskittcp/uipc_mbuf.c
Modified: trunk/reactos/lib/kernel32/file/file.c
Modified: trunk/reactos/ntoskrnl/ex/event.c
Modified: trunk/reactos/ntoskrnl/ex/evtpair.c
Modified: trunk/reactos/ntoskrnl/ex/mutant.c
Modified: trunk/reactos/ntoskrnl/io/file.c
Modified: trunk/reactos/ntoskrnl/ob/object.c
Modified: trunk/reactos/services/eventlog/eventlog.c
--- trunk/reactos/baseaddress.cfg 2005-01-22 02:38:07 UTC (rev 13205)
+++ trunk/reactos/baseaddress.cfg 2005-01-22 03:54:23 UTC (rev 13206)
@@ -88,9 +88,9 @@
TARGET_BASE_LIB_ADVAPI32 =0x77dc0000
TARGET_BASE_LIB_USER32 =0x77e60000
TARGET_BASE_LIB_GDI32 =0x77ed0000
-TARGET_BASE_LIB_DNSAPI =0x78000000
+TARGET_BASE_LIB_DNSAPI =0x77f00000
TARGET_BASE_LIB_MSVCRT =0x78000000
-TARGET_BASE_LIB_MSVCRT20 =0x78000000
+TARGET_BASE_LIB_MSVCRT20 =0x78500000
TARGET_BASE_LIB_EXPAT =0x79000000
TARGET_BASE_LIB_KERNEL32 =0x7C800000
TARGET_BASE_LIB_NTDLL =0x7C900000
--- trunk/reactos/drivers/lib/oskittcp/oskittcp/uipc_domain.c 2005-01-22 02:38:07 UTC (rev 13205)
+++ trunk/reactos/drivers/lib/oskittcp/oskittcp/uipc_domain.c 2005-01-22 03:54:23 UTC (rev 13206)
@@ -64,7 +64,7 @@
register struct domain *dp, **dpp;
register struct protosw *pr;
- printf("domaininit starting\n");
+ //printf("domaininit starting\n");
/*
* NB - local domain is always present.
@@ -73,7 +73,7 @@
ADDDOMAIN(inet);
for (dpp = (struct domain **)domain_set.ls_items; *dpp; dpp++) {
- printf("(1) Domain %s counting\n", (**dpp).dom_name);
+ //printf("(1) Domain %s counting\n", (**dpp).dom_name);
(**dpp).dom_next = domains;
domains = *dpp;
}
@@ -84,11 +84,11 @@
#endif
*/
for (dp = domains; dp; dp = dp->dom_next) {
- printf("(1) Domain %s initializing\n", dp->dom_name);
+ //printf("(1) Domain %s initializing\n", dp->dom_name);
if (dp->dom_init)
(*dp->dom_init)();
for (pr = dp->dom_protosw; pr < dp->dom_protoswNPROTOSW; pr++) {
- printf("Registering protocols for %s\n", dp->dom_name);
+ //printf("Registering protocols for %s\n", dp->dom_name);
if (pr->pr_init)
(*pr->pr_init)();
}
@@ -103,7 +103,7 @@
timeout(pffasttimo, (void *)0, 1);
timeout(pfslowtimo, (void *)0, 1);
- printf("Domaininit done\n");
+ //printf("Domaininit done\n");
}
struct protosw *
--- trunk/reactos/drivers/lib/oskittcp/oskittcp/uipc_mbuf.c 2005-01-22 02:38:07 UTC (rev 13205)
+++ trunk/reactos/drivers/lib/oskittcp/oskittcp/uipc_mbuf.c 2005-01-22 03:54:23 UTC (rev 13206)
@@ -79,11 +79,11 @@
#else
#define NCL_INIT 1
#endif
- printf("Here1\n");
+ //printf("Here1\n");
s = splimp();
if (m_clalloc(NCL_INIT, M_DONTWAIT) == 0)
goto bad;
- printf("Here2\n");
+ //printf("Here2\n");
splx(s);
return;
bad:
@@ -116,12 +116,12 @@
npg = ncl * CLSIZE;
- printf("kmem_malloc(%d)\n", npg);
+ //printf("kmem_malloc(%d)\n", npg);
p = (caddr_t)kmem_malloc(mb_map, ctob(npg),
nowait ? M_NOWAIT : M_WAITOK);
- printf("kmem_malloc done\n");
+ //printf("kmem_malloc done\n");
/*
* Either the map is now full, or this is nowait and there
@@ -133,13 +133,13 @@
ncl = ncl * CLBYTES / MCLBYTES;
for (i = 0; i < ncl; i++) {
((union mcluster *)p)->mcl_next = mclfree;
- printf( "Freeing %x onto the free list\n", p);
+ //printf( "Freeing %x onto the free list\n", p);
mclfree = (union mcluster *)p;
p += MCLBYTES;
mbstat.m_clfree++;
}
mbstat.m_clusters += ncl;
- printf( "done with m_clalloc\n");
+ //printf( "done with m_clalloc\n");
return (1);
}
#endif /* !OSKIT */
--- trunk/reactos/lib/kernel32/file/file.c 2005-01-22 02:38:07 UTC (rev 13205)
+++ trunk/reactos/lib/kernel32/file/file.c 2005-01-22 03:54:23 UTC (rev 13206)
@@ -694,7 +694,7 @@
NTSTATUS Status;
WIN32_FILE_ATTRIBUTE_DATA* FileAttributeData;
- DPRINT ("GetFileAttributesExW(%S) called\n", lpFileName);
+ DPRINT("GetFileAttributesExW(%S) called\n", lpFileName);
if (fInfoLevelId != GetFileExInfoStandard || lpFileInformation == NULL)
@@ -709,7 +709,7 @@
NULL,
NULL))
{
- DPRINT ("Invalid path\n");
+ DPRINT1 ("Invalid path\n");
SetLastError (ERROR_BAD_PATHNAME);
return FALSE;
}
@@ -731,7 +731,7 @@
RtlFreeUnicodeString (&FileName);
if (!NT_SUCCESS (Status))
{
- DPRINT ("NtOpenFile() failed (Status %lx)\n", Status);
+ DPRINT1 ("NtOpenFile() failed %x (Status %lx)\n", &ObjectAttributes, Status);
SetLastErrorByStatus (Status);
return FALSE;
}
@@ -746,7 +746,7 @@
if (!NT_SUCCESS (Status))
{
- DPRINT ("NtQueryInformationFile() failed (Status %lx)\n", Status);
+ DPRINT1 ("NtQueryInformationFile() failed (Status %lx)\n", Status);
SetLastErrorByStatus (Status);
return FALSE;
}
--- trunk/reactos/ntoskrnl/ex/event.c 2005-01-22 02:38:07 UTC (rev 13205)
+++ trunk/reactos/ntoskrnl/ex/event.c 2005-01-22 03:54:23 UTC (rev 13206)
@@ -41,6 +41,10 @@
STANDARD_RIGHTS_EXECUTE | SYNCHRONIZE | EVENT_QUERY_STATE,
EVENT_ALL_ACCESS};
+static const INFORMATION_CLASS_INFO ExEventInfoClass[] =
+{
+ ICI_SQ_SAME( sizeof(EVENT_BASIC_INFORMATION), sizeof(ULONG), ICIF_QUERY ), /* EventBasicInformation */
+};
/* FUNCTIONS *****************************************************************/
@@ -92,6 +96,9 @@
}
+/*
+ * @implemented
+ */
NTSTATUS STDCALL
NtClearEvent(IN HANDLE EventHandle)
{
@@ -101,16 +108,16 @@
Status = ObReferenceObjectByHandle(EventHandle,
EVENT_MODIFY_STATE,
ExEventObjectType,
- UserMode,
+ ExGetPreviousMode(),
(PVOID*)&Event,
NULL);
- if (!NT_SUCCESS(Status))
- {
- return(Status);
- }
- KeClearEvent(Event);
- ObDereferenceObject(Event);
- return(STATUS_SUCCESS);
+ if(NT_SUCCESS(Status))
+ {
+ KeClearEvent(Event);
+ ObDereferenceObject(Event);
+ }
+
+ return Status;
}
@@ -188,68 +195,119 @@
}
+/*
+ * @implemented
+ */
NTSTATUS STDCALL
NtOpenEvent(OUT PHANDLE EventHandle,
IN ACCESS_MASK DesiredAccess,
IN POBJECT_ATTRIBUTES ObjectAttributes)
{
- NTSTATUS Status;
HANDLE hEvent;
+ KPROCESSOR_MODE PreviousMode;
+ NTSTATUS Status = STATUS_SUCCESS;
+
+ DPRINT("NtOpenEvent(0x%x, 0x%x, 0x%x)\n", EventHandle, DesiredAccess, ObjectAttributes);
- DPRINT("ObjectName '%wZ'\n", ObjectAttributes->ObjectName);
+ 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;
+ }
+ }
Status = ObOpenObjectByName(ObjectAttributes,
ExEventObjectType,
NULL,
- UserMode,
+ PreviousMode,
DesiredAccess,
NULL,
&hEvent);
- if (!NT_SUCCESS(Status))
- {
- return(Status);
- }
-
- Status = MmCopyToCaller(EventHandle, &hEvent, sizeof(HANDLE));
- if (!NT_SUCCESS(Status))
+ if(NT_SUCCESS(Status))
+ {
+ _SEH_TRY
{
- ZwClose(EventHandle);
- return(Status);
+ *EventHandle = hEvent;
}
-
- return(Status);
+ _SEH_HANDLE
+ {
+ Status = _SEH_GetExceptionCode();
+ }
+ _SEH_END;
+ }
+
+ return Status;
}
+/*
+ * @implemented
+ */
NTSTATUS STDCALL
NtPulseEvent(IN HANDLE EventHandle,
OUT PLONG PreviousState OPTIONAL)
{
PKEVENT Event;
- NTSTATUS Status;
+ KPROCESSOR_MODE PreviousMode;
+ NTSTATUS Status = STATUS_SUCCESS;
- DPRINT("NtPulseEvent(EventHandle %x PreviousState %x)\n",
+ DPRINT("NtPulseEvent(EventHandle 0%x PreviousState 0%x)\n",
EventHandle, PreviousState);
+ PreviousMode = ExGetPreviousMode();
+
+ if(PreviousState != NULL && PreviousMode == UserMode)
+ {
+ _SEH_TRY
+ {
+ ProbeForWrite(PreviousState,
+ sizeof(LONG),
+ sizeof(ULONG));
+ }
+ _SEH_HANDLE
+ {
+ Status = _SEH_GetExceptionCode();
+ }
+ _SEH_END;
+ }
+
Status = ObReferenceObjectByHandle(EventHandle,
EVENT_MODIFY_STATE,
ExEventObjectType,
- UserMode,
+ PreviousMode,
(PVOID*)&Event,
NULL);
- if (!NT_SUCCESS(Status))
- {
- return(Status);
- }
+ if(NT_SUCCESS(Status))
+ {
+ KePulseEvent(Event, EVENT_INCREMENT, FALSE);
+ ObDereferenceObject(Event);
+
+ /* FIXME - Return the previous state! */
+ }
- KePulseEvent(Event, EVENT_INCREMENT, FALSE);
-
- ObDereferenceObject(Event);
- return(STATUS_SUCCESS);
+ return Status;
}
+/*
+ * @implemented
+ */
NTSTATUS STDCALL
NtQueryEvent(IN HANDLE EventHandle,
IN EVENT_INFORMATION_CLASS EventInformationClass,
@@ -257,78 +315,129 @@
IN ULONG EventInformationLength,
OUT PULONG ReturnLength OPTIONAL)
{
- EVENT_BASIC_INFORMATION Info;
PKEVENT Event;
- NTSTATUS Status;
- ULONG RetLen;
+ KPROCESSOR_MODE PreviousMode;
+ NTSTATUS Status = STATUS_SUCCESS;
- if (EventInformationClass > EventBasicInformation)
- return STATUS_INVALID_INFO_CLASS;
+ PreviousMode = ExGetPreviousMode();
+
+ DefaultQueryInfoBufferCheck(EventInformationClass,
+ ExEventInfoClass,
+ EventInformation,
+ EventInformationLength,
+ ReturnLength,
+ PreviousMode,
+ &Status);
+ if(!NT_SUCCESS(Status))
+ {
+ DPRINT1("NtQueryEvent() failed, Status: 0x%x\n", Status);
+ return Status;
+ }
- if (EventInformationLength < sizeof(EVENT_BASIC_INFORMATION))
- return STATUS_INFO_LENGTH_MISMATCH;
-
Status = ObReferenceObjectByHandle(EventHandle,
EVENT_QUERY_STATE,
ExEventObjectType,
- UserMode,
+ PreviousMode,
(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))
+ if(NT_SUCCESS(Status))
+ {
+ switch(EventInformationClass)
{
- ObDereferenceObject(Event);
- return(Status);
- }
+ case EventBasicInformation:
+ {
+ PEVENT_BASIC_INFORMATION BasicInfo = (PEVENT_BASIC_INFORMATION)EventInformation;
+
+ _SEH_TRY
+ {
+ if (Event->Header.Type == InternalNotificationEvent)
+ BasicInfo->EventType = NotificationEvent;
+ else
+ BasicInfo->EventType = SynchronizationEvent;
+ BasicInfo->EventState = KeReadStateEvent(Event);
- if (ReturnLength != NULL)
- {
- RetLen = sizeof(EVENT_BASIC_INFORMATION);
- Status = MmCopyToCaller(ReturnLength, &RetLen, sizeof(ULONG));
- if (!NT_SUCCESS(Status))
+ if(ReturnLength != NULL)
+ {
+ *ReturnLength = sizeof(EVENT_BASIC_INFORMATION);
+ }
+ }
+ _SEH_HANDLE
{
- ObDereferenceObject(Event);
- return(Status);
+ Status = _SEH_GetExceptionCode();
}
+ _SEH_END;
+ break;
+ }
+
+ default:
+ Status = STATUS_NOT_IMPLEMENTED;
+ break;
}
- ObDereferenceObject(Event);
- return(STATUS_SUCCESS);
+ ObDereferenceObject(Event);
+ }
+
+ return Status;
}
+/*
+ * @implemented
+ */
NTSTATUS STDCALL
NtResetEvent(IN HANDLE EventHandle,
OUT PLONG PreviousState OPTIONAL)
{
PKEVENT Event;
- NTSTATUS Status;
-
- DPRINT("NtResetEvent(EventHandle %x)\n", EventHandle);
-
+ KPROCESSOR_MODE PreviousMode;
+ NTSTATUS Status = STATUS_SUCCESS;
+
+ DPRINT("NtResetEvent(EventHandle 0%x PreviousState 0%x)\n",
+ EventHandle, PreviousState);
+
+ PreviousMode = ExGetPreviousMode();
+
+ if(PreviousState != NULL && PreviousMode == UserMode)
+ {
+ _SEH_TRY
+ {
+ ProbeForWrite(PreviousState,
+ sizeof(LONG),
+ sizeof(ULONG));
+ }
+ _SEH_HANDLE
+ {
+ Status = _SEH_GetExceptionCode();
+ }
+ _SEH_END;
+ }
+
Status = ObReferenceObjectByHandle(EventHandle,
EVENT_MODIFY_STATE,
ExEventObjectType,
- UserMode,
+ PreviousMode,
(PVOID*)&Event,
NULL);
- if (!NT_SUCCESS(Status))
+ if(NT_SUCCESS(Status))
+ {
+ LONG Prev = KeResetEvent(Event);
+ ObDereferenceObject(Event);
+
+ if(PreviousState != NULL)
{
- return(Status);
+ _SEH_TRY
+ {
+ *PreviousState = Prev;
+ }
+ _SEH_HANDLE
+ {
+ Status = _SEH_GetExceptionCode();
+ }
+ _SEH_END;
}
- KeResetEvent(Event);
- ObDereferenceObject(Event);
- return(STATUS_SUCCESS);
+ }
+
+ return Status;
}
@@ -340,25 +449,58 @@
OUT PLONG PreviousState OPTIONAL)
{
PKEVENT Event;
- NTSTATUS Status;
-
- DPRINT("NtSetEvent(EventHandle %x)\n", EventHandle);
-
+ KPROCESSOR_MODE PreviousMode;
+ NTSTATUS Status = STATUS_SUCCESS;
+
+ DPRINT("NtSetEvent(EventHandle 0%x PreviousState 0%x)\n",
+ EventHandle, PreviousState);
+
+ PreviousMode = ExGetPreviousMode();
+
+ if(PreviousState != NULL && PreviousMode == UserMode)
+ {
+ _SEH_TRY
+ {
+ ProbeForWrite(PreviousState,
+ sizeof(LONG),
+ sizeof(ULONG));
+ }
+ _SEH_HANDLE
+ {
+ Status = _SEH_GetExceptionCode();
+ }
+ _SEH_END;
+ }
+
Status = ObReferenceObjectByHandle(EventHandle,
EVENT_MODIFY_STATE,
ExEventObjectType,
- UserMode,
+ PreviousMode,
(PVOID*)&Event,
NULL);
- if (!NT_SUCCESS(Status))
+ if(NT_SUCCESS(Status))
+ {
+ LONG Prev = KeSetEvent(Event, EVENT_INCREMENT, FALSE);
+ ObDereferenceObject(Event);
+
+ if(PreviousState != NULL)
{
- return(Status);
+ _SEH_TRY
+ {
+ *PreviousState = Prev;
+ }
+ _SEH_HANDLE
+ {
+ Status = _SEH_GetExceptionCode();
+ }
+ _SEH_END;
}
- KeSetEvent(Event,EVENT_INCREMENT,FALSE);
- ObDereferenceObject(Event);
- return(STATUS_SUCCESS);
+ }
+
+ return Status;
}
+
/*
* @unimplemented
*/
--- trunk/reactos/ntoskrnl/ex/evtpair.c 2005-01-22 02:38:07 UTC (rev 13205)
+++ trunk/reactos/ntoskrnl/ex/evtpair.c 2005-01-22 03:54:23 UTC (rev 13206)
@@ -95,39 +95,66 @@
IN POBJECT_ATTRIBUTES ObjectAttributes)
{
PKEVENT_PAIR EventPair;
- NTSTATUS Status;
+ HANDLE hEventPair;
+ KPROCESSOR_MODE PreviousMode;
+ NTSTATUS Status = STATUS_SUCCESS;
+
+ PreviousMode = ExGetPreviousMode();
- DPRINT("NtCreateEventPair()\n");
+ if(PreviousMode == UserMode)
+ {
+ _SEH_TRY
+ {
+ ProbeForWrite(EventPairHandle,
+ sizeof(HANDLE),
+ sizeof(ULONG));
+ }
+ _SEH_HANDLE
+ {
+ Status = _SEH_GetExceptionCode();
+ }
+ _SEH_END;
+ }
+
Status = ObCreateObject(ExGetPreviousMode(),
ExEventPairObjectType,
ObjectAttributes,
- ExGetPreviousMode(),
+ PreviousMode,
NULL,
sizeof(KEVENT_PAIR),
0,
0,
(PVOID*)&EventPair);
- if (!NT_SUCCESS(Status))
+ if(NT_SUCCESS(Status))
+ {
+ KeInitializeEvent(&EventPair->LowEvent,
+ SynchronizationEvent,
+ FALSE);
+ KeInitializeEvent(&EventPair->HighEvent,
+ SynchronizationEvent,
+ FALSE);
+
+ Status = ObInsertObject ((PVOID)EventPair,
+ NULL,
+ DesiredAccess,
+ 0,
+ NULL,
+ &hEventPair);
+ ObDereferenceObject(EventPair);
+
+ if(NT_SUCCESS(Status))
{
- return(Status);
+ _SEH_TRY
+ {
+ *EventPairHandle = hEventPair;
+ }
+ _SEH_HANDLE
+ {
+ Status = _SEH_GetExceptionCode();
+ }
+ _SEH_END;
}
-
- KeInitializeEvent(&EventPair->LowEvent,
- SynchronizationEvent,
- FALSE);
- KeInitializeEvent(&EventPair->HighEvent,
- SynchronizationEvent,
- FALSE);
-
- Status = ObInsertObject ((PVOID)EventPair,
- NULL,
- DesiredAccess,
- 0,
- NULL,
- EventPairHandle);
-
- ObDereferenceObject(EventPair);
-
+ }
return Status;
}
@@ -137,18 +164,47 @@
IN ACCESS_MASK DesiredAccess,
IN POBJECT_ATTRIBUTES ObjectAttributes)
{
- NTSTATUS Status;
+ HANDLE hEventPair;
+ KPROCESSOR_MODE PreviousMode;
+ NTSTATUS Status = STATUS_SUCCESS;
- DPRINT("NtOpenEventPair()\n");
+ PreviousMode = ExGetPreviousMode();
+ if(PreviousMode == UserMode)
+ {
+ _SEH_TRY
+ {
+ ProbeForWrite(EventPairHandle,
+ sizeof(HANDLE),
+ sizeof(ULONG));
+ }
+ _SEH_HANDLE
+ {
+ Status = _SEH_GetExceptionCode();
+ }
+ _SEH_END;
+ }
+
Status = ObOpenObjectByName(ObjectAttributes,
ExEventPairObjectType,
NULL,
- UserMode,
+ PreviousMode,
DesiredAccess,
NULL,
- EventPairHandle);
-
+ &hEventPair);
+ if(NT_SUCCESS(Status))
+ {
+ _SEH_TRY
+ {
+ *EventPairHandle = hEventPair;
+ }
+ _SEH_HANDLE
+ {
+ Status = _SEH_GetExceptionCode();
+ }
+ _SEH_END;
+ }
+
return Status;
}
@@ -157,26 +213,30 @@
NtSetHighEventPair(IN HANDLE EventPairHandle)
{
PKEVENT_PAIR EventPair;
+ KPROCESSOR_MODE PreviousMode;
NTSTATUS Status;
DPRINT("NtSetHighEventPair(EventPairHandle %x)\n",
EventPairHandle);
+ PreviousMode = ExGetPreviousMode();
+
Status = ObReferenceObjectByHandle(EventPairHandle,
- EVENT_PAIR_ALL_ACCESS,
+ SYNCHRONIZE,
ExEventPairObjectType,
- UserMode,
+ PreviousMode,
(PVOID*)&EventPair,
NULL);
- if (!NT_SUCCESS(Status))
- return(Status);
+ if(NT_SUCCESS(Status))
+ {
+ KeSetEvent(&EventPair->HighEvent,
+ EVENT_INCREMENT,
+ FALSE);
- KeSetEvent(&EventPair->HighEvent,
- EVENT_INCREMENT,
- FALSE);
-
- ObDereferenceObject(EventPair);
- return(STATUS_SUCCESS);
+ ObDereferenceObject(EventPair);
+ }
+
+ return Status;
}
@@ -184,32 +244,36 @@
NtSetHighWaitLowEventPair(IN HANDLE EventPairHandle)
{
PKEVENT_PAIR EventPair;
+ KPROCESSOR_MODE PreviousMode;
NTSTATUS Status;
DPRINT("NtSetHighWaitLowEventPair(EventPairHandle %x)\n",
EventPairHandle);
+ PreviousMode = ExGetPreviousMode();
+
Status = ObReferenceObjectByHandle(EventPairHandle,
- EVENT_PAIR_ALL_ACCESS,
+ SYNCHRONIZE,
ExEventPairObjectType,
- UserMode,
+ PreviousMode,
(PVOID*)&EventPair,
NULL);
- if (!NT_SUCCESS(Status))
- return(Status);
+ if(NT_SUCCESS(Status))
+ {
+ KeSetEvent(&EventPair->HighEvent,
+ EVENT_INCREMENT,
+ TRUE);
- KeSetEvent(&EventPair->HighEvent,
- EVENT_INCREMENT,
- TRUE);
+ KeWaitForSingleObject(&EventPair->LowEvent,
+ WrEventPair,
+ PreviousMode,
+ FALSE,
+ NULL);
- KeWaitForSingleObject(&EventPair->LowEvent,
- WrEventPair,
- UserMode,
- FALSE,
- NULL);
-
- ObDereferenceObject(EventPair);
- return(STATUS_SUCCESS);
+ ObDereferenceObject(EventPair);
+ }
+
+ return Status;
}
@@ -217,26 +281,30 @@
NtSetLowEventPair(IN HANDLE EventPairHandle)
{
PKEVENT_PAIR EventPair;
+ KPROCESSOR_MODE PreviousMode;
NTSTATUS Status;
DPRINT("NtSetLowEventPair(EventPairHandle %x)\n",
EventPairHandle);
+ PreviousMode = ExGetPreviousMode();
+
Status = ObReferenceObjectByHandle(EventPairHandle,
- EVENT_PAIR_ALL_ACCESS,
+ SYNCHRONIZE,
ExEventPairObjectType,
- UserMode,
+ PreviousMode,
(PVOID*)&EventPair,
NULL);
- if (!NT_SUCCESS(Status))
- return(Status);
+ if(NT_SUCCESS(Status))
+ {
+ KeSetEvent(&EventPair->LowEvent,
+ EVENT_INCREMENT,
+ FALSE);
- KeSetEvent(&EventPair->LowEvent,
- EVENT_INCREMENT,
- FALSE);
-
- ObDereferenceObject(EventPair);
- return(STATUS_SUCCESS);
+ ObDereferenceObject(EventPair);
+ }
+
+ return Status;
}
@@ -244,32 +312,36 @@
NtSetLowWaitHighEventPair(IN HANDLE EventPairHandle)
{
PKEVENT_PAIR EventPair;
+ KPROCESSOR_MODE PreviousMode;
NTSTATUS Status;
DPRINT("NtSetLowWaitHighEventPair(EventPairHandle %x)\n",
EventPairHandle);
+ PreviousMode = ExGetPreviousMode();
+
Status = ObReferenceObjectByHandle(EventPairHandle,
- EVENT_PAIR_ALL_ACCESS,
+ SYNCHRONIZE,
ExEventPairObjectType,
- UserMode,
+ PreviousMode,
(PVOID*)&EventPair,
NULL);
- if (!NT_SUCCESS(Status))
- return(Status);
+ if(NT_SUCCESS(Status))
+ {
+ KeSetEvent(&EventPair->LowEvent,
+ EVENT_INCREMENT,
+ TRUE);
- KeSetEvent(&EventPair->LowEvent,
- EVENT_INCREMENT,
- TRUE);
+ KeWaitForSingleObject(&EventPair->HighEvent,
+ WrEventPair,
+ PreviousMode,
+ FALSE,
+ NULL);
- KeWaitForSingleObject(&EventPair->HighEvent,
- WrEventPair,
- UserMode,
- FALSE,
- NULL);
-
- ObDereferenceObject(EventPair);
- return(STATUS_SUCCESS);
+ ObDereferenceObject(EventPair);
+ }
+
+ return Status;
}
@@ -277,28 +349,32 @@
NtWaitLowEventPair(IN HANDLE EventPairHandle)
{
PKEVENT_PAIR EventPair;
+ KPROCESSOR_MODE PreviousMode;
NTSTATUS Status;
DPRINT("NtWaitLowEventPair(EventPairHandle %x)\n",
EventPairHandle);
+ PreviousMode = ExGetPreviousMode();
+
Status = ObReferenceObjectByHandle(EventPairHandle,
- EVENT_PAIR_ALL_ACCESS,
+ SYNCHRONIZE,
ExEventPairObjectType,
- UserMode,
+ PreviousMode,
(PVOID*)&EventPair,
NULL);
- if (!NT_SUCCESS(Status))
- return(Status);
+ if(NT_SUCCESS(Status))
+ {
+ KeWaitForSingleObject(&EventPair->LowEvent,
+ WrEventPair,
+ PreviousMode,
+ FALSE,
+ NULL);
- KeWaitForSingleObject(&EventPair->LowEvent,
- WrEventPair,
- UserMode,
- FALSE,
- NULL);
-
- ObDereferenceObject(EventPair);
- return(STATUS_SUCCESS);
+ ObDereferenceObject(EventPair);
+ }
+
+ return Status;
}
@@ -306,28 +382,32 @@
NtWaitHighEventPair(IN HANDLE EventPairHandle)
{
PKEVENT_PAIR EventPair;
+ KPROCESSOR_MODE PreviousMode;
NTSTATUS Status;
DPRINT("NtWaitHighEventPair(EventPairHandle %x)\n",
EventPairHandle);
+ PreviousMode = ExGetPreviousMode();
+
Status = ObReferenceObjectByHandle(EventPairHandle,
- EVENT_PAIR_ALL_ACCESS,
+ SYNCHRONIZE,
ExEventPairObjectType,
- UserMode,
+ PreviousMode,
(PVOID*)&EventPair,
NULL);
- if (!NT_SUCCESS(Status))
- return(Status);
+ if(NT_SUCCESS(Status))
+ {
+ KeWaitForSingleObject(&EventPair->HighEvent,
+ WrEventPair,
+ PreviousMode,
+ FALSE,
+ NULL);
- KeWaitForSingleObject(&EventPair->HighEvent,
- WrEventPair,
- UserMode,
- FALSE,
- NULL);
+ ObDereferenceObject(EventPair);
[truncated at 1000 lines; 494 more skipped]