From a704e14031c450d7da7defda44848c9425f1171f Mon Sep 17 00:00:00 2001 From: James Tabor Date: Fri, 11 Jul 2008 10:57:49 +0000 Subject: [PATCH] Update Eng Events and fix InputIdleEvent. svn path=/trunk/; revision=34423 --- reactos/subsystems/win32/win32k/eng/event.c | 20 +++++++++++++++---- .../subsystems/win32/win32k/include/tags.h | 1 + .../subsystems/win32/win32k/include/win32.h | 2 +- 3 files changed, 18 insertions(+), 5 deletions(-) diff --git a/reactos/subsystems/win32/win32k/eng/event.c b/reactos/subsystems/win32/win32k/eng/event.c index b1ed83062cd..09e1450c3f3 100644 --- a/reactos/subsystems/win32/win32k/eng/event.c +++ b/reactos/subsystems/win32/win32k/eng/event.c @@ -17,7 +17,7 @@ BOOL STDCALL EngCreateEvent ( OUT PEVENT *Event ) { - (*Event) = ExAllocatePool(NonPagedPool, sizeof(KEVENT)); + (*Event) = ExAllocatePoolWithTag(NonPagedPool, sizeof(KEVENT), TAG_DFSM); if ((*Event) == NULL) { return FALSE; @@ -45,6 +45,9 @@ EngMapEvent(IN HDEV Dev, NTSTATUS Status; PKEVENT Event; + Event = ExAllocatePoolWithTag(NonPagedPool, sizeof(KEVENT), TAG_DFSM); + if (!Event) return NULL; + Status = ObReferenceObjectByHandle(UserObject, EVENT_MODIFY_STATE, ExEventObjectType, @@ -52,9 +55,15 @@ EngMapEvent(IN HDEV Dev, (PVOID*)&Event, NULL); if (!NT_SUCCESS(Status)) - { - return NULL; - } + { + ExFreePool(Event); + return NULL; + } + else + KePulseEvent(Event, EVENT_INCREMENT, FALSE); + + if (Reserved1) Reserved1 = Event; + return (PEVENT)Event; } @@ -70,6 +79,7 @@ STDCALL EngUnmapEvent ( IN PEVENT Event ) { ObDereferenceObject((PVOID)Event); + ExFreePool(Event); return TRUE; } @@ -80,6 +90,8 @@ EngWaitForSingleObject (IN PEVENT Event, { NTSTATUS Status; + if (!Event) return FALSE; + Status = KeWaitForSingleObject(Event, Executive, KernelMode, diff --git a/reactos/subsystems/win32/win32k/include/tags.h b/reactos/subsystems/win32/win32k/include/tags.h index e705b6b923d..9c3c3e66f53 100644 --- a/reactos/subsystems/win32/win32k/include/tags.h +++ b/reactos/subsystems/win32/win32k/include/tags.h @@ -75,6 +75,7 @@ /* Eng objects */ #define TAG_CLIPOBJ TAG('C', 'L', 'P', 'O') /* clip object */ #define TAG_DRIVEROBJ TAG('D', 'R', 'V', 'O') /* driver object */ +#define TAG_DFSM TAG('D', 'f', 's', 'm') /* Eng event allocation */ #define TAG_FONT TAG('F', 'N', 'T', 'E') /* font entry */ #define TAG_FONTOBJ TAG('G', 'f', 'n', 't') /* font object */ #define TAG_WNDOBJ TAG('W', 'N', 'D', 'O') /* window object */ diff --git a/reactos/subsystems/win32/win32k/include/win32.h b/reactos/subsystems/win32/win32k/include/win32.h index aa8bc0fc309..10316479777 100644 --- a/reactos/subsystems/win32/win32k/include/win32.h +++ b/reactos/subsystems/win32/win32k/include/win32.h @@ -43,7 +43,7 @@ typedef struct _W32PROCESS ULONG Flags; LONG GDIObjects; LONG UserObjects; - KEVENT InputIdleEvent; + PKEVENT InputIdleEvent; W32HEAP_USER_MAPPING HeapMappings; PW32PROCESSINFO ProcessInfo;