From: Gé van Geldorp Date: Wed, 30 Nov 2005 23:24:19 +0000 (+0000) Subject: Make GetProcessWindowStation work for CSRSS X-Git-Tag: backups/ros-branch-0_2_9@19949~143 X-Git-Url: https://git.reactos.org/?p=reactos.git;a=commitdiff_plain;h=dbebd881b29f4c760a7b32c0c81e0baf6f9413fc Make GetProcessWindowStation work for CSRSS svn path=/trunk/; revision=19790 --- diff --git a/reactos/subsys/win32k/ntuser/winsta.c b/reactos/subsys/win32k/ntuser/winsta.c index be08986c147..c8453acafd6 100644 --- a/reactos/subsys/win32k/ntuser/winsta.c +++ b/reactos/subsys/win32k/ntuser/winsta.c @@ -915,17 +915,31 @@ NtUserSetObjectInformation( HWINSTA FASTCALL UserGetProcessWindowStation(VOID) { + NTSTATUS Status; + HWINSTA WinSta; + if(PsGetCurrentProcess() != CsrProcess) { return PsGetCurrentProcess()->Win32WindowStation; } else { - /* FIXME - get the pointer to the window station by querying the parent of - the desktop of the calling thread (which is a window station), - then use ObFindHandleForObject() to find a suitable handle */ - DPRINT1("CSRSS called NtUserGetProcessWindowStation()!!! returned NULL!\n"); - return NULL; + DPRINT1("Should use ObFindHandleForObject\n"); + Status = ObOpenObjectByPointer(PsGetWin32Thread()->Desktop->WindowStation, + 0, + NULL, + WINSTA_ALL_ACCESS, + ExWindowStationObjectType, + UserMode, + (PHANDLE) &WinSta); + if (! NT_SUCCESS(Status)) + { + SetLastNtError(Status); + DPRINT1("Unable to open handle for CSRSSs winsta, status 0x%08x\n", + Status); + return NULL; + } + return WinSta; } } diff --git a/reactos/w32api/include/winuser.h b/reactos/w32api/include/winuser.h index 6d2e6f35b8c..6abeac15d30 100644 --- a/reactos/w32api/include/winuser.h +++ b/reactos/w32api/include/winuser.h @@ -380,6 +380,7 @@ extern "C" { #define WINSTA_READATTRIBUTES 2 #define WINSTA_READSCREEN 512 #define WINSTA_WRITEATTRIBUTES 16 +#define WINSTA_ALL_ACCESS 895 #define DDL_READWRITE 0 #define DDL_READONLY 1 #define DDL_HIDDEN 2