ReactOS 0.4.15-dev-8116-gf69e256
register.c
Go to the documentation of this file.
1/*
2 * COPYRIGHT: See COPYING in the top level directory
3 * PROJECT: ReactOS User API Server DLL
4 * FILE: win32ss/user/winsrv/usersrv/register.c
5 * PURPOSE: Register logon window and services process
6 * PROGRAMMERS: Eric Kohl
7 * Hermes Belusca-Maito (hermes.belusca@sfr.fr)
8 */
9
10/* INCLUDES *******************************************************************/
11
12#include "usersrv.h"
13
14#define NDEBUG
15#include <debug.h>
16
17/* GLOBALS ********************************************************************/
18
22
23#if 1 //HACK! See use below
24extern HANDLE CsrApiPort;
25#endif
26
27/* PUBLIC SERVER APIS *********************************************************/
28
29/* API_NUMBER: UserpRegisterLogonProcess */
30CSR_API(SrvRegisterLogonProcess)
31{
32 PUSER_REGISTER_LOGON_PROCESS RegisterLogonProcessRequest = &((PUSER_API_MESSAGE)ApiMessage)->Data.RegisterLogonProcessRequest;
33
34 if (RegisterLogonProcessRequest->Register)
35 {
36 if (LogonProcessId != 0)
38
39 LogonProcessId = RegisterLogonProcessRequest->ProcessId;
40 }
41 else
42 {
43 if (ApiMessage->Header.ClientId.UniqueProcess != UlongToHandle(LogonProcessId))
44 {
45 DPRINT1("Current logon process 0x%x, can't deregister from process 0x%x\n",
46 LogonProcessId, ApiMessage->Header.ClientId.UniqueProcess);
48 }
49
51 }
52
53#if 1 //HAAAACK. This should be done in UserClientConnect which is never called!
54
55 /* Check if we don't have an API port yet */
56 if (CsrApiPort == NULL)
57 {
59
60 /* Query the API port and save it globally */
62
63 DPRINT("Giving win32k our api port\n");
64
65 /* Inform win32k about the API port */
69 sizeof(CsrApiPort));
70 if (!NT_SUCCESS(Status))
71 {
72 return Status;
73 }
74 }
75#endif
76
77 return STATUS_SUCCESS;
78}
79
80/* API_NUMBER: UserpRegisterServicesProcess */
81CSR_API(SrvRegisterServicesProcess)
82{
83 PUSER_REGISTER_SERVICES_PROCESS RegisterServicesProcessRequest = &((PUSER_API_MESSAGE)ApiMessage)->Data.RegisterServicesProcessRequest;
84
86 {
87 /* Only accept a single call */
89 }
90 else
91 {
92 ServicesProcessId = RegisterServicesProcessRequest->ProcessId;
94 return STATUS_SUCCESS;
95 }
96}
97
98/* EOF */
unsigned char BOOLEAN
LONG NTSTATUS
Definition: precomp.h:26
#define DPRINT1
Definition: precomp.h:8
#define UlongToHandle(ul)
Definition: basetsd.h:97
HANDLE NTAPI CsrQueryApiPort(VOID)
Definition: api.c:1097
#define CSR_API(n)
Definition: csrsrv.h:176
#define NULL
Definition: types.h:112
#define TRUE
Definition: types.h:120
#define FALSE
Definition: types.h:117
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:32
Status
Definition: gdiplustypes.h:25
NTSTATUS NTAPI NtUserSetInformationThread(IN HANDLE ThreadHandle, IN USERTHREADINFOCLASS ThreadInformationClass, IN PVOID ThreadInformation, IN ULONG ThreadInformationLength)
Definition: ntstubs.c:673
@ UserThreadCsrApiPort
Definition: ntuser.h:78
#define STATUS_NOT_LOGON_PROCESS
Definition: ntstatus.h:473
#define STATUS_LOGON_SESSION_EXISTS
Definition: ntstatus.h:474
#define STATUS_SUCCESS
Definition: shellext.h:65
#define DPRINT
Definition: sndvol32.h:73
uint32_t ULONG_PTR
Definition: typedefs.h:65
#define STATUS_INVALID_PARAMETER
Definition: udferr_usr.h:135
static BOOLEAN ServicesProcessIdValid
Definition: register.c:19
ULONG_PTR ServicesProcessId
Definition: register.c:20
ULONG_PTR LogonProcessId
Definition: register.c:21
HANDLE CsrApiPort
Definition: connect.c:27
struct _USER_API_MESSAGE * PUSER_API_MESSAGE
#define NtCurrentThread()