Skip to content

Commit 2751677

Browse files
committed
[WIN32K]
- Add NtUserSetInformationThread stub, thanks to Konstantin Shkil. The general direction is that it's fine to add syscalls to Arwinss' win32k which are called by other components like usersrv/consrv, as the list is quite small really, and NtUserInitialize is already there. svn path=/branches/arwinss/; revision=70341
1 parent 3ec8512 commit 2751677

File tree

4 files changed

+171
-1
lines changed

4 files changed

+171
-1
lines changed

arwinss/server/CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,7 @@ list(APPEND SOURCE
8787
main/monitor.c
8888
main/kbdlayout.c
8989
main/keyboard.c
90+
main/misc.c
9091
swm/winman.c
9192
wine/atom.c
9293
wine/class.c

arwinss/server/main/misc.c

Lines changed: 167 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,167 @@
1+
/*
2+
* PROJECT: ReactOS Win32K
3+
* LICENSE: GPL - See COPYING in the top level directory
4+
* FILE: server/main/misc.c
5+
* PURPOSE: Misc stuff
6+
* PROGRAMMERS: Aleksey Bragin ([email protected])
7+
*/
8+
9+
/* INCLUDES ******************************************************************/
10+
11+
#include <win32k.h>
12+
13+
//#define NDEBUG
14+
#include <debug.h>
15+
16+
#include <ntstatus.h>
17+
//#include <shutdown.h>
18+
#include <csr.h>
19+
20+
extern PEPROCESS CsrProcess;
21+
22+
NTSTATUS
23+
APIENTRY
24+
NtUserSetInformationThread(IN HANDLE ThreadHandle,
25+
IN USERTHREADINFOCLASS ThreadInformationClass,
26+
IN PVOID ThreadInformation,
27+
IN ULONG ThreadInformationLength)
28+
{
29+
NTSTATUS Status = STATUS_SUCCESS;
30+
PETHREAD Thread;
31+
32+
/* Allow only CSRSS to perform this operation */
33+
if (PsGetCurrentProcess() != CsrProcess)
34+
return STATUS_ACCESS_DENIED;
35+
36+
UserEnterExclusive();
37+
38+
/* Get the Thread */
39+
Status = ObReferenceObjectByHandle(ThreadHandle,
40+
THREAD_SET_INFORMATION,
41+
*PsThreadType,
42+
UserMode,
43+
(PVOID)&Thread,
44+
NULL);
45+
if (!NT_SUCCESS(Status)) goto Quit;
46+
47+
switch (ThreadInformationClass)
48+
{
49+
case UserThreadInitiateShutdown:
50+
{
51+
ULONG CapturedFlags = 0;
52+
53+
DPRINT("Shutdown initiated\n");
54+
55+
if (ThreadInformationLength != sizeof(ULONG))
56+
{
57+
Status = STATUS_INFO_LENGTH_MISMATCH;
58+
break;
59+
}
60+
61+
/* Capture the caller value */
62+
Status = STATUS_SUCCESS;
63+
_SEH2_TRY
64+
{
65+
ProbeForWrite(ThreadInformation, sizeof(CapturedFlags), sizeof(PVOID));
66+
CapturedFlags = *(PULONG)ThreadInformation;
67+
}
68+
_SEH2_EXCEPT(EXCEPTION_EXECUTE_HANDLER)
69+
{
70+
Status = _SEH2_GetExceptionCode();
71+
_SEH2_YIELD(break);
72+
}
73+
_SEH2_END;
74+
75+
Status = STATUS_NOT_IMPLEMENTED; //UserInitiateShutdown(Thread, &CapturedFlags);
76+
UNIMPLEMENTED;
77+
78+
/* Return the modified value to the caller */
79+
_SEH2_TRY
80+
{
81+
*(PULONG)ThreadInformation = CapturedFlags;
82+
}
83+
_SEH2_EXCEPT(EXCEPTION_EXECUTE_HANDLER)
84+
{
85+
Status = _SEH2_GetExceptionCode();
86+
}
87+
_SEH2_END;
88+
89+
break;
90+
}
91+
92+
case UserThreadEndShutdown:
93+
{
94+
NTSTATUS ShutdownStatus;
95+
96+
DPRINT("Shutdown ended\n");
97+
98+
if (ThreadInformationLength != sizeof(ShutdownStatus))
99+
{
100+
Status = STATUS_INFO_LENGTH_MISMATCH;
101+
break;
102+
}
103+
104+
/* Capture the caller value */
105+
Status = STATUS_SUCCESS;
106+
_SEH2_TRY
107+
{
108+
ProbeForRead(ThreadInformation, sizeof(ShutdownStatus), sizeof(PVOID));
109+
ShutdownStatus = *(NTSTATUS*)ThreadInformation;
110+
}
111+
_SEH2_EXCEPT(EXCEPTION_EXECUTE_HANDLER)
112+
{
113+
Status = _SEH2_GetExceptionCode();
114+
_SEH2_YIELD(break);
115+
}
116+
_SEH2_END;
117+
118+
Status = STATUS_NOT_IMPLEMENTED; //UserEndShutdown(Thread, ShutdownStatus);
119+
UNIMPLEMENTED;
120+
break;
121+
}
122+
123+
case UserThreadCsrApiPort:
124+
{
125+
HANDLE CsrPortHandle;
126+
127+
DPRINT("Set CSR API Port for Win32k\n");
128+
129+
if (ThreadInformationLength != sizeof(CsrPortHandle))
130+
{
131+
Status = STATUS_INFO_LENGTH_MISMATCH;
132+
break;
133+
}
134+
135+
/* Capture the caller value */
136+
Status = STATUS_SUCCESS;
137+
_SEH2_TRY
138+
{
139+
ProbeForRead(ThreadInformation, sizeof(CsrPortHandle), sizeof(PVOID));
140+
CsrPortHandle = *(PHANDLE)ThreadInformation;
141+
}
142+
_SEH2_EXCEPT(EXCEPTION_EXECUTE_HANDLER)
143+
{
144+
Status = _SEH2_GetExceptionCode();
145+
_SEH2_YIELD(break);
146+
}
147+
_SEH2_END;
148+
149+
Status = STATUS_NOT_IMPLEMENTED;//InitCsrApiPort(CsrPortHandle);
150+
UNIMPLEMENTED;
151+
break;
152+
}
153+
154+
default:
155+
{
156+
UNIMPLEMENTED;
157+
Status = STATUS_NOT_IMPLEMENTED;
158+
break;
159+
}
160+
}
161+
162+
ObDereferenceObject(Thread);
163+
164+
Quit:
165+
UserLeave();
166+
return Status;
167+
}

arwinss/server/w32ksvc.db

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -92,4 +92,5 @@ SwmSetForeground 1
9292
SwmPosChanged 5
9393
SwmGetWindowFromPoint 2
9494
SwmShowWindow 3
95-
NtUserInitialize 3
95+
NtUserInitialize 3
96+
NtUserSetInformationThread 4

arwinss/server/w32ksvc.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -96,3 +96,4 @@ SVC_(SwmPosChanged, 5)
9696
SVC_(SwmGetWindowFromPoint, 2)
9797
SVC_(SwmShowWindow, 3)
9898
SVC_(NtUserInitialize, 3)
99+
SVC_(NtUserSetInformationThread, 4)

0 commit comments

Comments
 (0)