Author: fireball
Date: Wed Apr 7 11:57:49 2010
New Revision: 46759
URL:
http://svn.reactos.org/svn/reactos?rev=46759&view=rev
Log:
- Store a handle to the idle event, not just a pointer to the event object in a per
process structure.
- Dereference and properly close idle event object when terminating a process.
Modified:
branches/arwinss/reactos/subsystems/win32/win32k/include/win32.h
branches/arwinss/reactos/subsystems/win32/win32k/main/init.c
Modified: branches/arwinss/reactos/subsystems/win32/win32k/include/win32.h
URL:
http://svn.reactos.org/svn/reactos/branches/arwinss/reactos/subsystems/win3…
==============================================================================
--- branches/arwinss/reactos/subsystems/win32/win32k/include/win32.h [iso-8859-1]
(original)
+++ branches/arwinss/reactos/subsystems/win32/win32k/include/win32.h [iso-8859-1] Wed Apr
7 11:57:49 2010
@@ -23,6 +23,7 @@
obj_handle_t winstation; /* main handle to process window station */
obj_handle_t desktop; /* handle to desktop to use for new threads */
LONG GDIHandleCount; /* kernelmode GDI handles count */
+ HANDLE idle_event_handle; /* handle for idle_event */
} PROCESSINFO;
#include <pshpack1.h>
Modified: branches/arwinss/reactos/subsystems/win32/win32k/main/init.c
URL:
http://svn.reactos.org/svn/reactos/branches/arwinss/reactos/subsystems/win3…
==============================================================================
--- branches/arwinss/reactos/subsystems/win32/win32k/main/init.c [iso-8859-1] (original)
+++ branches/arwinss/reactos/subsystems/win32/win32k/main/init.c [iso-8859-1] Wed Apr 7
11:57:49 2010
@@ -39,7 +39,6 @@
{
PPROCESSINFO Win32Process;
NTSTATUS Status;
- HANDLE IdleHandle;
struct handle_table *handles;
DPRINT("Enter Win32kProcessCallback\n");
@@ -65,17 +64,17 @@
/* FIXME - unlock the process */
/* Create an idle event */
- Status = ZwCreateEvent(&IdleHandle, EVENT_ALL_ACCESS, NULL,
SynchronizationEvent, TRUE);
+ Status = ZwCreateEvent(&Win32Process->idle_event_handle, EVENT_ALL_ACCESS,
NULL, SynchronizationEvent, TRUE);
if (!NT_SUCCESS(Status)) DPRINT1("Creating idle event failed with status
0x%08X\n", Status);
/* Get a pointer to the object itself */
- Status = ObReferenceObjectByHandle(IdleHandle,
+ Status = ObReferenceObjectByHandle(Win32Process->idle_event_handle,
EVENT_ALL_ACCESS,
NULL,
KernelMode,
(PVOID*)&Win32Process->idle_event,
NULL);
- if (!NT_SUCCESS(Status)) ZwClose(IdleHandle);
+ if (!NT_SUCCESS(Status)) ZwClose(Win32Process->idle_event_handle);
list_init(&Win32Process->Classes);
Win32Process->handles = alloc_handle_table(Win32Process, 0);
@@ -95,7 +94,11 @@
/* Destroy its classes */
destroy_process_classes(Win32Process);
- if (Win32Process->idle_event) ZwClose(Win32Process->idle_event);
+ if (Win32Process->idle_event)
+ {
+ ObDereferenceObject(Win32Process->idle_event);
+ ZwClose(Win32Process->idle_event_handle);
+ }
UserLeave();