xref: /reactos/win32ss/user/user32/misc/logon.c (revision 84344399)
1 /*
2  * COPYRIGHT:       See COPYING in the top level directory
3  * PROJECT:         ReactOS user32.dll
4  * FILE:            win32ss/user/user32/misc/logon.c
5  * PURPOSE:         Logon functions
6  * PROGRAMMER:      Thomas Weidenmueller (w3seek@users.sourceforge.net)
7  */
8 
9 #include <user32.h>
10 
11 WINE_DEFAULT_DEBUG_CHANNEL(user32);
12 
13 /*
14  * @implemented
15  */
16 BOOL
17 WINAPI
18 RegisterServicesProcess(DWORD ServicesProcessId)
19 {
20     USER_API_MESSAGE ApiMessage;
21     PUSER_REGISTER_SERVICES_PROCESS RegisterServicesProcessRequest = &ApiMessage.Data.RegisterServicesProcessRequest;
22 
23     RegisterServicesProcessRequest->ProcessId = ServicesProcessId;
24 
25     CsrClientCallServer((PCSR_API_MESSAGE)&ApiMessage,
26                         NULL,
27                         CSR_CREATE_API_NUMBER(USERSRV_SERVERDLL_INDEX, UserpRegisterServicesProcess),
28                         sizeof(*RegisterServicesProcessRequest));
29     if (!NT_SUCCESS(ApiMessage.Status))
30     {
31         UserSetLastNTError(ApiMessage.Status);
32         return FALSE;
33     }
34 
35     return TRUE;
36 }
37 
38 /*
39  * @implemented
40  */
41 BOOL
42 WINAPI
43 RegisterLogonProcess(DWORD dwProcessId,
44                      BOOL bRegister)
45 {
46     gfLogonProcess = NtUserxRegisterLogonProcess(dwProcessId, bRegister);
47 
48     if (gfLogonProcess)
49     {
50         USER_API_MESSAGE ApiMessage;
51         PUSER_REGISTER_LOGON_PROCESS RegisterLogonProcessRequest = &ApiMessage.Data.RegisterLogonProcessRequest;
52 
53         RegisterLogonProcessRequest->ProcessId = dwProcessId;
54         RegisterLogonProcessRequest->Register  = bRegister;
55 
56         CsrClientCallServer((PCSR_API_MESSAGE)&ApiMessage,
57                             NULL,
58                             CSR_CREATE_API_NUMBER(USERSRV_SERVERDLL_INDEX, UserpRegisterLogonProcess),
59                             sizeof(*RegisterLogonProcessRequest));
60         if (!NT_SUCCESS(ApiMessage.Status))
61         {
62             ERR("Failed to register logon process with CSRSS\n");
63             UserSetLastNTError(ApiMessage.Status);
64         }
65     }
66 
67     return gfLogonProcess;
68 }
69 
70 /*
71  * Helper function used by SetWindowStationUser (see winsta.c)
72  */
73 VOID FASTCALL
74 Logon(BOOL IsLogon)
75 {
76     USER_API_MESSAGE ApiMessage;
77     PUSER_LOGON LogonRequest = &ApiMessage.Data.LogonRequest;
78 
79     LogonRequest->IsLogon = IsLogon;
80     CsrClientCallServer((PCSR_API_MESSAGE)&ApiMessage,
81                          NULL,
82                          CSR_CREATE_API_NUMBER(USERSRV_SERVERDLL_INDEX, UserpLogon),
83                          sizeof(*LogonRequest));
84 }
85 
86 /*
87  * @implemented
88  */
89 BOOL
90 WINAPI
91 SetLogonNotifyWindow(HWND Wnd)
92 {
93     return NtUserSetLogonNotifyWindow(Wnd);
94 }
95 
96 /*
97  * @implemented
98  */
99 BOOL
100 WINAPI
101 UpdatePerUserSystemParameters(DWORD dwReserved,
102                               BOOL bEnable)
103 {
104     // Update Imm support and load Imm32.dll.
105     UpdatePerUserImmEnabling();
106 
107     /* Initialize the IME hotkeys */
108     CliImmInitializeHotKeys(SETIMEHOTKEY_INITIALIZE, NULL);
109 
110     /* Load Preload keyboard layouts */
111     IntLoadPreloadKeyboardLayouts();
112 
113     return NtUserUpdatePerUserSystemParameters(dwReserved, bEnable);
114 }
115