Author: fireball
Date: Tue Aug 4 14:13:26 2009
New Revision: 42379
URL:
http://svn.reactos.org/svn/reactos?rev=42379&view=rev
Log:
- Connect a new Win32 process to the window station, as it's supposed to be done.
However, desktop inheritance still needs to be checked. There is some testing code in
connect_process_winstation left #if0ed out.
Modified:
branches/arwinss/reactos/subsystems/win32/win32k/include/user.h
branches/arwinss/reactos/subsystems/win32/win32k/main/init.c
branches/arwinss/reactos/subsystems/win32/win32k/wine/winstation.c
Modified: branches/arwinss/reactos/subsystems/win32/win32k/include/user.h
URL:
http://svn.reactos.org/svn/reactos/branches/arwinss/reactos/subsystems/win3…
==============================================================================
--- branches/arwinss/reactos/subsystems/win32/win32k/include/user.h [iso-8859-1]
(original)
+++ branches/arwinss/reactos/subsystems/win32/win32k/include/user.h [iso-8859-1] Tue Aug
4 14:13:26 2009
@@ -156,7 +156,7 @@
extern struct desktop *get_desktop_obj( PPROCESSINFO process, obj_handle_t handle,
unsigned int access );
extern struct winstation *get_process_winstation( PPROCESSINFO process, unsigned int
access );
extern struct desktop *get_thread_desktop( PTHREADINFO thread, unsigned int access );
-extern void connect_process_winstation( PPROCESSINFO process, PTHREADINFO parent );
+extern void connect_process_winstation( PPROCESSINFO process );
extern void set_process_default_desktop( PPROCESSINFO process, struct desktop *desktop,
obj_handle_t handle );
extern void close_process_desktop( PPROCESSINFO process );
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 Aug 4
14:13:26 2009
@@ -13,7 +13,9 @@
/* System service call table */
#include <include/napi.h>
+#include "object.h"
#include <handle.h>
+#include <user.h>
#define NDEBUG
#include <debug.h>
@@ -90,6 +92,7 @@
InitializeListHead(&Win32Process->Classes);
Win32Process->handles = alloc_handle_table(Win32Process, 0);
+ connect_process_winstation(Win32Process);
}
else
{
Modified: branches/arwinss/reactos/subsystems/win32/win32k/wine/winstation.c
URL:
http://svn.reactos.org/svn/reactos/branches/arwinss/reactos/subsystems/win3…
==============================================================================
--- branches/arwinss/reactos/subsystems/win32/win32k/wine/winstation.c [iso-8859-1]
(original)
+++ branches/arwinss/reactos/subsystems/win32/win32k/wine/winstation.c [iso-8859-1] Tue
Aug 4 14:13:26 2009
@@ -376,20 +376,52 @@
}
/* connect a process to its window station */
-void connect_process_winstation( PPROCESSINFO process, PTHREADINFO parent )
+void connect_process_winstation( PPROCESSINFO process )
{
struct winstation *winstation = NULL;
struct desktop *desktop = NULL;
obj_handle_t handle;
+ PPROCESSINFO parent = NULL;
+ PEPROCESS eparent;
+ HANDLE parent_handle;
+ NTSTATUS status;
+
+#if 0
+ PRTL_USER_PROCESS_PARAMETERS ProcessParams = (process->peProcess->Peb ?
process->peProcess->Peb->ProcessParameters : NULL);
+ PUNICODE_STRING DesktopPath;
+
+ DesktopPath = (ProcessParams ? ((ProcessParams->DesktopInfo.Length > 0) ?
&ProcessParams->DesktopInfo : NULL) : NULL);
+ if (DesktopPath)
+ {
+ DPRINT1("DesktopPath %wZ\n", DesktopPath);
+ }
+ /*Status = IntParseDesktopPath(Process,
+ DesktopPath,
+ &hWinSta,
+ &hDesk);*/
+#endif
+
+ /* get parent process */
+ parent_handle = PsGetProcessInheritedFromUniqueProcessId(process->peProcess);
+ if (parent_handle)
+ {
+ /* Lookup the process */
+ status = PsLookupProcessByProcessId(parent_handle, &eparent);
+ if (NT_SUCCESS(status))
+ {
+ /* get win32 process out of it */
+ parent = PsGetProcessWin32Process(eparent);
+ }
+ }
/* check for an inherited winstation handle (don't ask...) */
if ((handle = find_inherited_handle( process, &winstation_ops )))
{
winstation = (struct winstation *)get_handle_obj( process, handle, 0,
&winstation_ops );
}
- else if (parent && parent->process->winstation)
- {
- handle = duplicate_handle( parent->process,
parent->process->winstation,
+ else if (parent && parent->winstation)
+ {
+ handle = duplicate_handle( parent, parent->winstation,
process, 0, 0, DUP_HANDLE_SAME_ACCESS );
winstation = (struct winstation *)get_handle_obj( process, handle, 0,
&winstation_ops );
}
@@ -403,17 +435,39 @@
}
else if (parent && parent->desktop)
{
- desktop = get_desktop_obj( parent->process, parent->desktop, 0 );
+ desktop = get_desktop_obj( parent, parent->desktop, 0 );
if (!desktop || desktop->winstation != winstation) goto done;
- handle = duplicate_handle( parent->process, parent->desktop,
+ handle = duplicate_handle( parent, parent->desktop,
process, 0, 0, DUP_HANDLE_SAME_ACCESS );
}
if (handle) set_process_default_desktop( process, desktop, handle );
+
+#if 0
+ {
+ // set default desktop differently. Just always assign a "default"
desktop
+ WCHAR deskbuf[8];
+ struct unicode_str full_str, desktop_name;
+ WCHAR *full_name;
+
+ desktop_name.str = deskbuf;
+ desktop_name.len = sizeof(deskbuf);
+ wcscpy(deskbuf, L"Default");
+
+ if ((full_name = build_desktop_name( &desktop_name, winstation, &full_str
)))
+ {
+ handle = open_object( winstation_namespace, &full_str, &desktop_ops,
GENERIC_ALL,
+ OBJ_CASE_INSENSITIVE );
+ ExFreePool( full_name );
+ DPRINT1("handle %x\n", handle);
+ }
+ }
+#endif
done:
if (desktop) release_object( desktop );
if (winstation) release_object( winstation );
+ if (eparent) ObDereferenceObject(eparent);
clear_error();
}