https://git.reactos.org/?p=reactos.git;a=commitdiff;h=3ec7b163c9bdf6dbe4379…
commit 3ec7b163c9bdf6dbe4379273135f0261e6b88638
Author: Giannis Adamopoulos <gadamopoulos(a)reactos.org>
AuthorDate: Sun Dec 16 13:14:56 2018 +0200
Commit: Giannis Adamopoulos <gadamopoulos(a)reactos.org>
CommitDate: Wed Dec 19 16:13:18 2018 +0200
[WINSRV] Add a hack to fix giving the api port to win32k
- Register our api port with win32k in SrvRegisterLogonProcess because
UserClientConnect is never really called.
[NTUSER] Silence a noisy trace
---
win32ss/user/ntuser/ntstubs.c | 2 +-
win32ss/user/winsrv/usersrv/register.c | 28 ++++++++++++++++++++++++++++
2 files changed, 29 insertions(+), 1 deletion(-)
diff --git a/win32ss/user/ntuser/ntstubs.c b/win32ss/user/ntuser/ntstubs.c
index fdb9a7b558..44cbb5af3b 100644
--- a/win32ss/user/ntuser/ntstubs.c
+++ b/win32ss/user/ntuser/ntstubs.c
@@ -797,8 +797,8 @@ NtUserSetInformationThread(IN HANDLE ThreadHandle,
{
HANDLE CsrPortHandle;
- ERR("Set CSR API Port for Win32k\n");
+ TRACE("Set CSR API Port for Win32k\n");
if (ThreadInformationLength != sizeof(CsrPortHandle))
{
Status = STATUS_INFO_LENGTH_MISMATCH;
diff --git a/win32ss/user/winsrv/usersrv/register.c
b/win32ss/user/winsrv/usersrv/register.c
index 0070a3407d..0a521bcdd4 100644
--- a/win32ss/user/winsrv/usersrv/register.c
+++ b/win32ss/user/winsrv/usersrv/register.c
@@ -20,6 +20,10 @@ static BOOLEAN ServicesProcessIdValid = FALSE;
ULONG_PTR ServicesProcessId = 0;
ULONG_PTR LogonProcessId = 0;
+#if 1 //HACK! See use below
+extern HANDLE CsrApiPort;
+#endif
+
/* PUBLIC SERVER APIS *********************************************************/
CSR_API(SrvRegisterLogonProcess)
@@ -45,6 +49,30 @@ CSR_API(SrvRegisterLogonProcess)
LogonProcessId = 0;
}
+#if 1 //HAAAACK. This should be done in UserClientConnect which is never called!
+
+ /* Check if we don't have an API port yet */
+ if (CsrApiPort == NULL)
+ {
+ NTSTATUS Status;
+
+ /* Query the API port and save it globally */
+ CsrApiPort = CsrQueryApiPort();
+
+ DPRINT("Giving win32k our api port\n");
+
+ /* Inform win32k about the API port */
+ Status = NtUserSetInformationThread(NtCurrentThread(),
+ UserThreadCsrApiPort,
+ &CsrApiPort,
+ sizeof(CsrApiPort));
+ if (!NT_SUCCESS(Status))
+ {
+ return Status;
+ }
+ }
+#endif
+
return STATUS_SUCCESS;
}