ReactOS  0.4.15-dev-1206-g731eddf
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
24 extern HANDLE CsrApiPort;
25 #endif
26 
27 /* PUBLIC SERVER APIS *********************************************************/
28 
29 /* API_NUMBER: UserpRegisterLogonProcess */
30 CSR_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 
50  LogonProcessId = 0;
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 */
68  &CsrApiPort,
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 */
81 CSR_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 */
ULONG_PTR ServicesProcessId
Definition: register.c:20
#define TRUE
Definition: types.h:120
#define STATUS_INVALID_PARAMETER
Definition: udferr_usr.h:135
LONG NTSTATUS
Definition: precomp.h:26
#define NtCurrentThread()
CSR_API(SrvRegisterLogonProcess)
Definition: register.c:30
#define STATUS_NOT_LOGON_PROCESS
Definition: ntstatus.h:473
static BOOLEAN ServicesProcessIdValid
Definition: register.c:19
uint32_t ULONG_PTR
Definition: typedefs.h:65
NTSTATUS NTAPI NtUserSetInformationThread(IN HANDLE ThreadHandle, IN USERTHREADINFOCLASS ThreadInformationClass, IN PVOID ThreadInformation, IN ULONG ThreadInformationLength)
Definition: ntstubs.c:699
#define FALSE
Definition: types.h:117
unsigned char BOOLEAN
smooth NULL
Definition: ftsmooth.c:416
#define STATUS_LOGON_SESSION_EXISTS
Definition: ntstatus.h:474
ULONG_PTR LogonProcessId
Definition: register.c:21
void DPRINT(...)
Definition: polytest.cpp:61
HANDLE CsrApiPort
Definition: connect.c:21
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:32
#define UlongToHandle(ul)
Definition: basetsd.h:97
struct _USER_API_MESSAGE * PUSER_API_MESSAGE
Status
Definition: gdiplustypes.h:24
#define DPRINT1
Definition: precomp.h:8
return STATUS_SUCCESS
Definition: btrfs.c:3014
HANDLE NTAPI CsrQueryApiPort(VOID)
Definition: api.c:1093