[prev in list] [next in list] [prev in thread] [next in thread] 

List:       ros-diffs
Subject:    [ros-diffs] [gvg] 19790: Make GetProcessWindowStation work for CSRSS
From:       <gvg () svn ! reactos ! com>
Date:       2005-11-30 23:24:23
Message-ID: 000001c5f605$32dfe310$6b01a8c0 () PENELOPE
[Download RAW message or body]

Make GetProcessWindowStation work for CSRSS
Modified: trunk/reactos/subsys/win32k/ntuser/winsta.c
Modified: trunk/reactos/w32api/include/winuser.h
  _____  

Modified: trunk/reactos/subsys/win32k/ntuser/winsta.c
--- trunk/reactos/subsys/win32k/ntuser/winsta.c	2005-11-30 22:44:41 UTC
(rev 19789)
+++ trunk/reactos/subsys/win32k/ntuser/winsta.c	2005-11-30 23:24:19 UTC
(rev 19790)
@@ -915,17 +915,31 @@

 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;
    }
 }
 
  _____  

Modified: trunk/reactos/w32api/include/winuser.h
--- trunk/reactos/w32api/include/winuser.h	2005-11-30 22:44:41 UTC
(rev 19789)
+++ trunk/reactos/w32api/include/winuser.h	2005-11-30 23:24:19 UTC
(rev 19790)
@@ -380,6 +380,7 @@

 #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

[Attachment #3 (text/html)]

<html>
<head>
<style>
<!--
body { background-color:#ffffff }
.file { border:1px solid #eeeeee; margin-top:1em; margin-bottom:1em }
.pathname { font-family:monospace; float:right }
.fileheader { margin-bottom:.5em }
.diff { margin:0 }
.tasklist { padding:4px; border:1px dashed #000000; margin-top:1em }
.tasklist ul { margin-top:0; margin-bottom:0 }
tr.alt { background-color:#eeeeee }
#added { background-color:#ddffdd }
#addedchars { background-color:#99ff99; font-weight:bolder }
tr.alt #added { background-color:#ccf7cc }
#removed { background-color:#ffdddd }
#removedchars { background-color:#ff9999; font-weight:bolder }
tr.alt #removed { background-color:#f7cccc }
#info { color:#888888 }
#context { background-color:#eeeeee }
td {padding-left:.3em; padding-right:.3em }
tr.head { border-bottom-width:1px; border-bottom-style:solid }
tr.head td { padding:0; padding-top:.2em }
.task { background-color:#ffff00 }
.comment { padding:4px; border:1px dashed #000000; background-color:#ffffdd }
.error { color:red }
hr { border-width:0px; height:2px; background:black }
-->
</style>
</head>
<body>
<pre class="comment">Make GetProcessWindowStation work for CSRSS</pre><pre \
                class="diff" id="context">Modified: \
                trunk/reactos/subsys/win32k/ntuser/winsta.c
Modified: trunk/reactos/w32api/include/winuser.h
</pre><hr /><div class="file">
<div class="fileheader"><big><b>Modified: \
trunk/reactos/subsys/win32k/ntuser/winsta.c</b></big></div> <pre class="diff"><small \
id="info">--- trunk/reactos/subsys/win32k/ntuser/winsta.c	2005-11-30 22:44:41 UTC \
                (rev 19789)
+++ trunk/reactos/subsys/win32k/ntuser/winsta.c	2005-11-30 23:24:19 UTC (rev 19790)
@@ -915,17 +915,31 @@
</small></pre><pre class="diff" id="context"> HWINSTA FASTCALL
 UserGetProcessWindowStation(VOID)
 {
</pre><pre class="diff" id="added">+ &nbsp; NTSTATUS Status;
+ &nbsp; HWINSTA WinSta;
+
</pre><pre class="diff" id="context"> &nbsp; &nbsp;if(PsGetCurrentProcess() != \
CsrProcess)  &nbsp; &nbsp;{
 &nbsp; &nbsp; &nbsp; return PsGetCurrentProcess()-&gt;Win32WindowStation;
 &nbsp; &nbsp;}
 &nbsp; &nbsp;else
 &nbsp; &nbsp;{
</pre><pre class="diff" id="removed">- &nbsp; &nbsp; &nbsp;/* FIXME - get the pointer \
                to the window station by querying the parent of
- &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; the desktop of the calling \
                thread (which is a window station),
- &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; then use \
                ObFindHandleForObject() to find a suitable handle */
- &nbsp; &nbsp; &nbsp;DPRINT1(&quot;CSRSS called NtUserGetProcessWindowStation()!!! \
                returned NULL!\n&quot;);
- &nbsp; &nbsp; &nbsp;<span id="removedchars">return NULL</span>;
</pre><pre class="diff" id="added">+ &nbsp; &nbsp; &nbsp;<span \
id="addedchars">DPRINT1(&quot;Should use ObFindHandleForObject\n&quot;)</span>; + \
&nbsp; &nbsp; &nbsp;Status = \
ObOpenObjectByPointer(PsGetWin32Thread()-&gt;Desktop-&gt;WindowStation, + &nbsp; \
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; \
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 0, + &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; \
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; \
NULL, + &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; \
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; WINSTA_ALL_ACCESS, + &nbsp; &nbsp; \
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; \
&nbsp; &nbsp; &nbsp; &nbsp; ExWindowStationObjectType, + &nbsp; &nbsp; &nbsp; &nbsp; \
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; \
&nbsp; &nbsp; UserMode, + &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; \
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; (PHANDLE) \
&amp;WinSta); + &nbsp; &nbsp; &nbsp;if (! NT_SUCCESS(Status))
+ &nbsp; &nbsp; &nbsp;{
+ &nbsp; &nbsp; &nbsp; &nbsp; SetLastNtError(Status);
+ &nbsp; &nbsp; &nbsp; &nbsp; DPRINT1(&quot;Unable to open handle for CSRSSs winsta, \
status 0x%08x\n&quot;, + &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; \
Status); + &nbsp; &nbsp; &nbsp; &nbsp; return NULL;
+ &nbsp; &nbsp; &nbsp;}
+ &nbsp; &nbsp; &nbsp;return WinSta;
</pre><pre class="diff" id="context"> &nbsp; &nbsp;}
 }
 
</pre></div>
<hr /><div class="file">
<div class="fileheader"><big><b>Modified: \
trunk/reactos/w32api/include/winuser.h</b></big></div> <pre class="diff"><small \
id="info">--- trunk/reactos/w32api/include/winuser.h	2005-11-30 22:44:41 UTC (rev \
                19789)
+++ trunk/reactos/w32api/include/winuser.h	2005-11-30 23:24:19 UTC (rev 19790)
@@ -380,6 +380,7 @@
</small></pre><pre class="diff" id="context"> #define WINSTA_READATTRIBUTES	2
 #define WINSTA_READSCREEN	512
 #define WINSTA_WRITEATTRIBUTES	16
</pre><pre class="diff" id="added">+#define WINSTA_ALL_ACCESS &nbsp; &nbsp; &nbsp; \
895 </pre><pre class="diff" id="context"> #define DDL_READWRITE	0
 #define DDL_READONLY	1
 #define DDL_HIDDEN	2
</pre>
</div>

</body>
</html>



[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic