Author: fireball
Date: Tue Apr 6 20:47:52 2010
New Revision: 46753
URL:
http://svn.reactos.org/svn/reactos?rev=46753&view=rev
Log:
- Create and use idle_event as expected by Wine. It creates idle_event for every gui
process (TODO: investigate if CUI process in ReactOS should have it).
- Rewrite get_process_idle_event handler in a NT way.
Modified:
branches/arwinss/reactos/subsystems/win32/win32k/include/object.h
branches/arwinss/reactos/subsystems/win32/win32k/include/win32.h
branches/arwinss/reactos/subsystems/win32/win32k/main/init.c
branches/arwinss/reactos/subsystems/win32/win32k/win32k.rbuild
branches/arwinss/reactos/subsystems/win32/win32k/wine/process.c
branches/arwinss/reactos/subsystems/win32/win32k/wine/stubs.c
branches/arwinss/reactos/subsystems/win32/win32k/wine/winesup.c
Modified: branches/arwinss/reactos/subsystems/win32/win32k/include/object.h
URL:
http://svn.reactos.org/svn/reactos/branches/arwinss/reactos/subsystems/win3…
==============================================================================
--- branches/arwinss/reactos/subsystems/win32/win32k/include/object.h [iso-8859-1]
(original)
+++ branches/arwinss/reactos/subsystems/win32/win32k/include/object.h [iso-8859-1] Tue Apr
6 20:47:52 2010
@@ -157,7 +157,7 @@
const struct security_descriptor *sd );
extern struct event *get_event_obj( PPROCESSINFO process, obj_handle_t handle, unsigned
int access );
extern void pulse_event( struct event *event );
-extern void set_event( struct event *event );
+extern void set_event( PKEVENT event );
extern void reset_event( struct event *event );
/* mutex functions */
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] Tue Apr
6 20:47:52 2010
@@ -18,7 +18,7 @@
W32HEAP_USER_MAPPING HeapMappings;
struct list Classes; /* window classes owned by the process */
struct handle_table *handles; /* handle entries */
- struct event *idle_event; /* event for input idle */
+ PKEVENT idle_event; /* event for input idle */
struct msg_queue *queue; /* main message queue */
obj_handle_t winstation; /* main handle to process window station */
obj_handle_t desktop; /* handle to desktop to use for new threads */
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] Tue Apr 6
20:47:52 2010
@@ -38,6 +38,8 @@
BOOLEAN Create)
{
PPROCESSINFO Win32Process;
+ NTSTATUS Status;
+ HANDLE IdleHandle;
struct handle_table *handles;
DPRINT("Enter Win32kProcessCallback\n");
@@ -62,6 +64,19 @@
Win32Process->peProcess = Process;
/* FIXME - unlock the process */
+ /* Create an idle event */
+ Status = ZwCreateEvent(&IdleHandle, 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,
+ EVENT_ALL_ACCESS,
+ NULL,
+ KernelMode,
+ (PVOID*)&Win32Process->idle_event,
+ NULL);
+ if (!NT_SUCCESS(Status)) ZwClose(IdleHandle);
+
list_init(&Win32Process->Classes);
Win32Process->handles = alloc_handle_table(Win32Process, 0);
connect_process_winstation(Win32Process);
@@ -79,6 +94,8 @@
/* Destroy its classes */
destroy_process_classes(Win32Process);
+
+ if (Win32Process->idle_event) ZwClose(Win32Process->idle_event);
UserLeave();
Modified: branches/arwinss/reactos/subsystems/win32/win32k/win32k.rbuild
URL:
http://svn.reactos.org/svn/reactos/branches/arwinss/reactos/subsystems/win3…
==============================================================================
--- branches/arwinss/reactos/subsystems/win32/win32k/win32k.rbuild [iso-8859-1]
(original)
+++ branches/arwinss/reactos/subsystems/win32/win32k/win32k.rbuild [iso-8859-1] Tue Apr 6
20:47:52 2010
@@ -144,6 +144,7 @@
<file>hook.c</file>
<file>main.c</file>
<file>object.c</file>
+ <file>process.c</file>
<file>queue.c</file>
<file>region.c</file>
<file>stubs.c</file>
Modified: branches/arwinss/reactos/subsystems/win32/win32k/wine/process.c
URL:
http://svn.reactos.org/svn/reactos/branches/arwinss/reactos/subsystems/win3…
==============================================================================
--- branches/arwinss/reactos/subsystems/win32/win32k/wine/process.c [iso-8859-1]
(original)
+++ branches/arwinss/reactos/subsystems/win32/win32k/wine/process.c [iso-8859-1] Tue Apr
6 20:47:52 2010
@@ -1,7 +1,7 @@
/*
* Server-side process management
*
- * Copyright (C) 1998 Alexandre Julliard
+ * Copyright (C) 2010 Aleksey Bragin
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
@@ -32,30 +32,35 @@
/* retrieve the process idle event */
DECL_HANDLER(get_process_idle_event)
{
- PEPROCESS process_obj;
- PPROCESSINFO process;
- NTSTATUS status;
+ PEPROCESS ProcessObject;
+ PPROCESSINFO Process;
+ NTSTATUS Status;
reply->event = 0;
/* Reference the process */
- status = ObReferenceObjectByHandle((HANDLE)req->handle,
+ Status = ObReferenceObjectByHandle((HANDLE)req->handle,
PROCESS_QUERY_INFORMATION,
PsProcessType,
KernelMode,
- (PVOID*)&process_obj,
+ (PVOID*)&ProcessObject,
NULL);
-DPRINT1("status 0x%08X\n", status);
- if (NT_SUCCESS(status))
+
+ if (NT_SUCCESS(Status))
{
- process = PsGetProcessWin32Process(process_obj);
+ Process = PsGetProcessWin32Process(ProcessObject);
- if (process->idle_event && process_obj != PsGetCurrentProcess())
+ if (Process->idle_event && ProcessObject != PsGetCurrentProcess())
{
- UNIMPLEMENTED;
- //reply->event = alloc_handle( PsGetCurrentProcess(),
process->idle_event,
- // EVENT_ALL_ACCESS, 0 );
+ /* Get a handle to the idle event (in another process) */
+ Status = ObOpenObjectByPointer(Process->idle_event,
+ 0,
+ NULL,
+ EVENT_ALL_ACCESS,
+ 0,
+ KernelMode,
+ (PHANDLE)&reply->event);
}
- ObDereferenceObject( process_obj );
+ ObDereferenceObject( ProcessObject );
}
}
Modified: branches/arwinss/reactos/subsystems/win32/win32k/wine/stubs.c
URL:
http://svn.reactos.org/svn/reactos/branches/arwinss/reactos/subsystems/win3…
==============================================================================
--- branches/arwinss/reactos/subsystems/win32/win32k/wine/stubs.c [iso-8859-1] (original)
+++ branches/arwinss/reactos/subsystems/win32/win32k/wine/stubs.c [iso-8859-1] Tue Apr 6
20:47:52 2010
@@ -558,11 +558,6 @@
UNIMPLEMENTED;
}
-DECL_HANDLER(get_process_idle_event)
-{
- UNIMPLEMENTED;
-}
-
DECL_HANDLER(get_serial_info)
{
UNIMPLEMENTED;
Modified: branches/arwinss/reactos/subsystems/win32/win32k/wine/winesup.c
URL:
http://svn.reactos.org/svn/reactos/branches/arwinss/reactos/subsystems/win3…
==============================================================================
--- branches/arwinss/reactos/subsystems/win32/win32k/wine/winesup.c [iso-8859-1]
(original)
+++ branches/arwinss/reactos/subsystems/win32/win32k/wine/winesup.c [iso-8859-1] Tue Apr
6 20:47:52 2010
@@ -125,9 +125,9 @@
#endif
}
-void set_event( struct event *event )
+void set_event( PKEVENT event )
{
- UNIMPLEMENTED;
+ KeSetEvent(event, EVENT_INCREMENT, FALSE);
}
void reset_event( struct event *event )