Skip to content

Commit d5b0085

Browse files
committed
[ARWINSS]
- Implement logon process registration in win32k and its shutdown notification. - Add a hack into server/queue.c which allows to send message to a thread without the desktop. Once the dektop issue is properly solved, this hack should go away. - Arwinss boots to the desktop now. - Remove redundant csr_shared.h, and use trunk's ntuser.h instead. svn path=/branches/arwinss/; revision=70345
1 parent 0b6cd57 commit d5b0085

File tree

8 files changed

+183
-171
lines changed

8 files changed

+183
-171
lines changed

arwinss/client/user32/csr.c

Lines changed: 31 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -28,13 +28,18 @@
2828

2929
/* CSRSS Headers */
3030
#include <subsys/csr/csr.h>
31-
#include <csr_shared.h>
31+
#include <ntuser.h>
3232
#include <subsys/win/winmsg.h>
3333

34+
#include "wine/rosuser.h"
35+
3436
#include "wine/debug.h"
3537

3638
WINE_DEFAULT_DEBUG_CHANNEL(usercsr);
3739

40+
/* GLOBALS ********************************************************************/
41+
42+
BOOLEAN gfLogonProcess = FALSE;
3843

3944
/* FUNCTIONS ******************************************************************/
4045

@@ -89,63 +94,51 @@ RegisterServicesProcess(DWORD ServicesProcessId)
8994
return TRUE;
9095
}
9196

97+
EXTINLINE BOOL NtUserxRegisterLogonProcess(DWORD dwProcessId, BOOL bRegister)
98+
{
99+
return (BOOL)NtUserCallTwoParam((DWORD_PTR)dwProcessId, (DWORD_PTR)bRegister, TWOPARAM_ROUTINE_REGISTERLOGONPROCESS);
100+
}
101+
92102
/***********************************************************************
93103
* RegisterLogonProcess (USER32.@)
94104
*/
95-
BOOL WINAPI RegisterLogonProcess(DWORD dwProcessId, BOOL bRegister)
105+
BOOL
106+
WINAPI
107+
RegisterLogonProcess(DWORD dwProcessId,
108+
BOOL bRegister)
96109
{
97-
NTSTATUS Status;
110+
gfLogonProcess = NtUserxRegisterLogonProcess(dwProcessId, bRegister);
111+
112+
if (gfLogonProcess)
113+
{
98114
USER_API_MESSAGE ApiMessage;
115+
PUSER_REGISTER_LOGON_PROCESS RegisterLogonProcessRequest = &ApiMessage.Data.RegisterLogonProcessRequest;
99116

100-
ApiMessage.Data.RegisterLogonProcessRequest.ProcessId = dwProcessId;
101-
ApiMessage.Data.RegisterLogonProcessRequest.Register = bRegister;
117+
RegisterLogonProcessRequest->ProcessId = dwProcessId;
118+
RegisterLogonProcessRequest->Register = bRegister;
102119

103-
Status = CsrClientCallServer((PCSR_API_MESSAGE)&ApiMessage,
104-
NULL,
105-
CSR_CREATE_API_NUMBER(USERSRV_SERVERDLL_INDEX, UserpRegisterLogonProcess),
106-
sizeof(USER_REGISTER_LOGON_PROCESS));
107-
if (!NT_SUCCESS(Status))
120+
CsrClientCallServer((PCSR_API_MESSAGE)&ApiMessage,
121+
NULL,
122+
CSR_CREATE_API_NUMBER(USERSRV_SERVERDLL_INDEX, UserpRegisterLogonProcess),
123+
sizeof(*RegisterLogonProcessRequest));
124+
if (!NT_SUCCESS(ApiMessage.Status))
108125
{
109126
ERR("Failed to register logon process with CSRSS\n");
110-
SetLastError(RtlNtStatusToDosError(Status));
111-
return FALSE;
127+
SetLastError(RtlNtStatusToDosError(ApiMessage.Status));
112128
}
129+
}
113130

114-
return TRUE;
131+
return gfLogonProcess;
115132
}
116133

117-
118134
/***********************************************************************
119135
* SetLogonNotifyWindow (USER32.@)
120136
*/
121137
BOOL
122138
WINAPI
123139
SetLogonNotifyWindow (HWND Wnd)
124140
{
125-
#if 0
126-
/* Maybe we should call NtUserSetLogonNotifyWindow and let that one inform CSRSS??? */
127-
CSR_API_MESSAGE Request;
128-
ULONG CsrRequest;
129-
NTSTATUS Status;
130-
131-
CsrRequest = MAKE_CSR_API(SET_LOGON_NOTIFY_WINDOW, CSR_GUI);
132-
Request.Data.SetLogonNotifyWindowRequest.LogonNotifyWindow = Wnd;
133-
134-
Status = CsrClientCallServer(&Request,
135-
NULL,
136-
CsrRequest,
137-
sizeof(CSR_API_MESSAGE));
138-
if (!NT_SUCCESS(Status) || !NT_SUCCESS(Status = Request.Status))
139-
{
140-
SetLastError(RtlNtStatusToDosError(Status));
141-
return FALSE;
142-
}
143-
144-
return TRUE;
145-
#else
146-
ERR("SetLogonNotifyWindow is not yet implemented in Arwinss\n");
147-
return TRUE;
148-
#endif
141+
return NtUserSetLogonNotifyWindow(Wnd);
149142
}
150143

151144
/* EOF */

arwinss/include/csr_shared.h

Lines changed: 0 additions & 72 deletions
This file was deleted.

arwinss/include/wine/rosuser.h

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,14 @@
1111
#ifndef __WIN32K_ROSUSER_H
1212
#define __WIN32K_ROSUSER_H
1313

14+
#if defined(__GNUC__)
15+
#define EXTINLINE extern inline __attribute__((always_inline))
16+
#elif defined(_MSC_VER)
17+
#define EXTINLINE extern __forceinline
18+
#else
19+
#error
20+
#endif
21+
1422
/* DEFINES *******************************************************************/
1523

1624
#define SWM_ROOT_WINDOW_ID 1
@@ -181,6 +189,12 @@ RosUserDeRegisterShellHookWindow(HWND hWnd);
181189
BOOL NTAPI
182190
RosUserBuildShellHookHwndList(HWND *list, UINT *cbSize);
183191

192+
DWORD_PTR NTAPI
193+
NtUserCallTwoParam(DWORD_PTR Param1, DWORD_PTR Param2, DWORD Routine);
194+
195+
BOOL NTAPI
196+
NtUserSetLogonNotifyWindow(HWND hWnd);
197+
184198
SWM_WINDOW_ID NTAPI
185199
SwmNewWindow(SWM_WINDOW_ID parent, RECT *WindowRect, HWND hWnd, DWORD ex_style);
186200

arwinss/server/main/misc.c

Lines changed: 81 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,14 +10,33 @@
1010

1111
#include <win32k.h>
1212

13-
//#define NDEBUG
13+
#define NDEBUG
1414
#include <debug.h>
1515

1616
#include <ntstatus.h>
1717
#include <shutdown.h>
1818
#include <csr.h>
1919

2020
extern PEPROCESS CsrProcess;
21+
extern HWND hwndSAS;
22+
23+
/* Registered logon process ID */
24+
HANDLE gpidLogon = 0;
25+
26+
BOOL
27+
APIENTRY
28+
NtUserSetLogonNotifyWindow(HWND hWnd)
29+
{
30+
if (gpidLogon != PsGetCurrentProcessId())
31+
return FALSE;
32+
33+
DPRINT("Logon hwnd %x\n", hWnd);
34+
35+
hwndSAS = hWnd;
36+
37+
return TRUE;
38+
}
39+
2140

2241
NTSTATUS
2342
APIENTRY
@@ -163,3 +182,64 @@ NtUserSetInformationThread(IN HANDLE ThreadHandle,
163182
UserLeave();
164183
return Status;
165184
}
185+
186+
BOOL
187+
UserRegisterLogonProcess(HANDLE ProcessId, BOOL Register)
188+
{
189+
NTSTATUS Status;
190+
PEPROCESS Process;
191+
192+
Status = PsLookupProcessByProcessId(ProcessId, &Process);
193+
if (!NT_SUCCESS(Status))
194+
{
195+
EngSetLastError(RtlNtStatusToDosError(Status));
196+
return FALSE;
197+
}
198+
199+
ProcessId = Process->UniqueProcessId;
200+
ObDereferenceObject(Process);
201+
202+
if (Register)
203+
{
204+
/* Register the logon process */
205+
if (gpidLogon != 0) return FALSE;
206+
gpidLogon = ProcessId;
207+
}
208+
else
209+
{
210+
/* Deregister the logon process */
211+
if (gpidLogon != ProcessId) return FALSE;
212+
gpidLogon = 0;
213+
}
214+
215+
return TRUE;
216+
}
217+
218+
DWORD_PTR
219+
APIENTRY
220+
NtUserCallTwoParam(
221+
DWORD_PTR Param1,
222+
DWORD_PTR Param2,
223+
DWORD Routine)
224+
{
225+
DWORD_PTR ReturnValue;
226+
227+
DPRINT("Enter NtUserCallTwoParam\n");
228+
UserEnterExclusive();
229+
230+
switch(Routine)
231+
{
232+
case TWOPARAM_ROUTINE_REGISTERLOGONPROCESS:
233+
ReturnValue = (DWORD_PTR)UserRegisterLogonProcess((HANDLE)Param1, (BOOL)Param2);
234+
break;
235+
236+
default:
237+
DPRINT1("Calling invalid routine number 0x%x in NtUserCallTwoParam(), Param1=0x%x Parm2=0x%x\n",
238+
Routine, Param1, Param2);
239+
EngSetLastError(ERROR_INVALID_PARAMETER);
240+
}
241+
242+
DPRINT("Leave NtUserCallTwoParam, ret=%p\n", ReturnValue);
243+
UserLeave();
244+
return ReturnValue;
245+
}

0 commit comments

Comments
 (0)