- Synchronize up to trunk's revision r57864.
[reactos.git] / base / system / winlogon / winlogon.h
1 /*
2 * ReactOS kernel
3 * Copyright (C) 2003 ReactOS Team
4 *
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation; either version 2 of the License, or
8 * (at your option) any later version.
9 *
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
14 *
15 * You should have received a copy of the GNU General Public License along
16 * with this program; if not, write to the Free Software Foundation, Inc.,
17 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
18 */
19 /* COPYRIGHT: See COPYING in the top level directory
20 * PROJECT: ReactOS winlogon
21 * FILE: subsys/system/winlogon/winlogon.h
22 * PURPOSE: Winlogon
23 * PROGRAMMER:
24 */
25
26 #ifndef __WINLOGON_MAIN_H__
27 #define __WINLOGON_MAIN_H__
28
29 #define USE_GETLASTINPUTINFO
30
31 #define WIN32_NO_STATUS
32 #include <stdio.h>
33 #include <windows.h>
34 #include <userenv.h>
35 #include <winwlx.h>
36 #include <cmfuncs.h>
37 #include <rtlfuncs.h>
38 #include <exfuncs.h>
39 #include <setypes.h>
40 #include <sefuncs.h>
41 #include <ntsecapi.h>
42 #include <accctrl.h>
43 #include <aclapi.h>
44 #include <strsafe.h>
45
46 #include <reactos/undocuser.h>
47 #include <reactos/winlogon.h>
48
49 #include "setup.h"
50 #include "resource.h"
51
52 typedef BOOL (WINAPI * PFWLXNEGOTIATE) (DWORD, DWORD *);
53 typedef BOOL (WINAPI * PFWLXINITIALIZE) (LPWSTR, HANDLE, PVOID, PVOID, PVOID *);
54 typedef VOID (WINAPI * PFWLXDISPLAYSASNOTICE) (PVOID);
55 typedef int (WINAPI * PFWLXLOGGEDOUTSAS) (PVOID, DWORD, PLUID, PSID, PDWORD,
56 PHANDLE, PWLX_MPR_NOTIFY_INFO,
57 PVOID *);
58 typedef BOOL (WINAPI * PFWLXACTIVATEUSERSHELL) (PVOID, PWSTR, PWSTR, PVOID);
59 typedef int (WINAPI * PFWLXLOGGEDONSAS) (PVOID, DWORD, PVOID);
60 typedef VOID (WINAPI * PFWLXDISPLAYLOCKEDNOTICE) (PVOID);
61 typedef int (WINAPI * PFWLXWKSTALOCKEDSAS) (PVOID, DWORD);
62 typedef BOOL (WINAPI * PFWLXISLOCKOK) (PVOID);
63 typedef BOOL (WINAPI * PFWLXISLOGOFFOK) (PVOID);
64 typedef VOID (WINAPI * PFWLXLOGOFF) (PVOID);
65 typedef VOID (WINAPI * PFWLXSHUTDOWN) (PVOID, DWORD);
66
67 /* version 1.1 */
68
69 typedef BOOL (WINAPI * PFWLXSCREENSAVERNOTIFY) (PVOID, BOOL *);
70 typedef BOOL (WINAPI * PFWLXSTARTAPPLICATION) (PVOID, PWSTR, PVOID, PWSTR);
71
72 /* version 1.3 */
73
74 typedef BOOL (WINAPI * PFWLXNETWORKPROVIDERLOAD) (PVOID, PWLX_MPR_NOTIFY_INFO);
75 typedef BOOL (WINAPI * PFWLXDISPLAYSTATUSMESSAGE) (PVOID, HDESK, DWORD, PWSTR, PWSTR);
76 typedef BOOL (WINAPI * PFWLXGETSTATUSMESSAGE) (PVOID, DWORD *, PWSTR, DWORD);
77 typedef BOOL (WINAPI * PFWLXREMOVESTATUSMESSAGE) (PVOID);
78
79 typedef struct _GINAFUNCTIONS
80 {
81 /* Functions always available for a valid GINA */
82 PFWLXNEGOTIATE WlxNegotiate; /* optional */
83 PFWLXINITIALIZE WlxInitialize;
84
85 /* Functions available if WlxVersion >= WLX_VERSION_1_0 (MS Windows 3.5.0) */
86 PFWLXDISPLAYSASNOTICE WlxDisplaySASNotice;
87 PFWLXLOGGEDOUTSAS WlxLoggedOutSAS;
88 PFWLXACTIVATEUSERSHELL WlxActivateUserShell;
89 PFWLXLOGGEDONSAS WlxLoggedOnSAS;
90 PFWLXDISPLAYLOCKEDNOTICE WlxDisplayLockedNotice;
91 PFWLXWKSTALOCKEDSAS WlxWkstaLockedSAS;
92 PFWLXISLOCKOK WlxIsLockOk;
93 PFWLXISLOGOFFOK WlxIsLogoffOk;
94 PFWLXLOGOFF WlxLogoff;
95 PFWLXSHUTDOWN WlxShutdown;
96
97 /* Functions available if WlxVersion >= WLX_VERSION_1_1 (MS Windows 3.5.1) */
98 PFWLXSCREENSAVERNOTIFY WlxScreenSaverNotify; /* optional */
99 PFWLXSTARTAPPLICATION WlxStartApplication; /* optional */
100
101 /* Functions available if WlxVersion >= WLX_VERSION_1_2 (MS Windows NT 4.0) */
102
103 /* Functions available if WlxVersion >= WLX_VERSION_1_3 (MS Windows 2000) */
104 PFWLXNETWORKPROVIDERLOAD WlxNetworkProviderLoad; /* not called ATM */
105 PFWLXDISPLAYSTATUSMESSAGE WlxDisplayStatusMessage;
106 PFWLXGETSTATUSMESSAGE WlxGetStatusMessage; /* doesn't need to be called */
107 PFWLXREMOVESTATUSMESSAGE WlxRemoveStatusMessage;
108
109 /* Functions available if WlxVersion >= WLX_VERSION_1_4 (MS Windows XP) */
110 } GINAFUNCTIONS, *PGINAFUNCTIONS;
111
112 typedef struct _GINAINSTANCE
113 {
114 HMODULE hDllInstance;
115 GINAFUNCTIONS Functions;
116 PVOID Context;
117 DWORD Version;
118 BOOL UseCtrlAltDelete;
119 } GINAINSTANCE, *PGINAINSTANCE;
120
121 /* FIXME: put in an enum */
122 /* See http://msdn.microsoft.com/library/default.asp?url=/library/en-us/secauthn/security/winlogon_states.asp */
123 #define WKSTA_IS_LOGGED_OFF 0
124 #define WKSTA_IS_LOGGED_ON 1
125 #define WKSTA_IS_LOCKED 2
126
127 #define LockWorkstation(Session)
128 #define UnlockWorkstation(Session)
129
130 typedef struct _WLSESSION
131 {
132 GINAINSTANCE Gina;
133 DWORD SASAction;
134 BOOL SuppressStatus;
135 BOOL TaskManHotkey;
136 HWND SASWindow;
137 HWINSTA InteractiveWindowStation;
138 LPWSTR InteractiveWindowStationName;
139 HDESK ApplicationDesktop;
140 HDESK WinlogonDesktop;
141 HDESK ScreenSaverDesktop;
142 LUID LogonId;
143 HANDLE UserToken;
144 HANDLE hProfileInfo;
145 DWORD LogonStatus;
146 DWORD DialogTimeout; /* Timeout for dialog boxes, in seconds */
147
148 /* Screen-saver informations */
149 #ifndef USE_GETLASTINPUTINFO
150 HHOOK KeyboardHook;
151 HHOOK MouseHook;
152 #endif
153 HANDLE hEndOfScreenSaverThread;
154 HANDLE hScreenSaverParametersChanged;
155 HANDLE hUserActivity;
156 HANDLE hEndOfScreenSaver;
157 #ifndef USE_GETLASTINPUTINFO
158 DWORD LastActivity;
159 #endif
160
161 /* Logon informations */
162 DWORD Options;
163 WLX_MPR_NOTIFY_INFO MprNotifyInfo;
164 WLX_PROFILE_V2_0 *Profile;
165 } WLSESSION, *PWLSESSION;
166
167 extern HINSTANCE hAppInstance;
168 extern PWLSESSION WLSession;
169
170 #define WLX_SHUTTINGDOWN(Status) \
171 (((Status) == WLX_SAS_ACTION_SHUTDOWN) || \
172 ((Status) == WLX_SAS_ACTION_SHUTDOWN_POWER_OFF) || \
173 ((Status) == WLX_SAS_ACTION_SHUTDOWN_REBOOT) \
174 )
175
176 #define WLX_SUSPENDING(Status) \
177 (((Status) == WLX_SAS_ACTION_SHUTDOWN_SLEEP) || \
178 ((Status) == WLX_SAS_ACTION_SHUTDOWN_SLEEP2) || \
179 ((Status) == WLX_SAS_ACTION_SHUTDOWN_HIBERNATE) \
180 )
181
182 /* environment.c */
183 BOOL
184 CreateUserEnvironment(IN PWLSESSION Session);
185
186 /* sas.c */
187 BOOL
188 SetDefaultLanguage(
189 IN BOOL UserProfile);
190
191 BOOL
192 InitializeSAS(
193 IN OUT PWLSESSION Session);
194
195 /* screensaver.c */
196 BOOL
197 InitializeScreenSaver(
198 IN OUT PWLSESSION Session);
199
200 VOID
201 StartScreenSaver(
202 IN PWLSESSION Session);
203
204 /* winlogon.c */
205
206 BOOL
207 PlaySoundRoutine(
208 IN LPCWSTR FileName,
209 IN UINT Logon,
210 IN UINT Flags);
211
212 BOOL
213 DisplayStatusMessage(
214 IN PWLSESSION Session,
215 IN HDESK hDesktop,
216 IN UINT ResourceId);
217
218 BOOL
219 RemoveStatusMessage(
220 IN PWLSESSION Session);
221
222 /* wlx.c */
223 BOOL
224 GinaInit(
225 IN OUT PWLSESSION Session);
226 BOOL
227 CreateWindowStationAndDesktops(
228 IN OUT PWLSESSION Session);
229
230 NTSTATUS
231 HandleShutdown(
232 IN OUT PWLSESSION Session,
233 IN DWORD wlxAction);
234
235 VOID WINAPI WlxUseCtrlAltDel(HANDLE hWlx);
236 VOID WINAPI WlxSetContextPointer(HANDLE hWlx, PVOID pWlxContext);
237 VOID WINAPI WlxSasNotify(HANDLE hWlx, DWORD dwSasType);
238 BOOL WINAPI WlxSetTimeout(HANDLE hWlx, DWORD Timeout);
239 int WINAPI WlxAssignShellProtection(HANDLE hWlx, HANDLE hToken, HANDLE hProcess, HANDLE hThread);
240 int WINAPI WlxMessageBox(HANDLE hWlx, HWND hwndOwner, LPWSTR lpszText, LPWSTR lpszTitle, UINT fuStyle);
241 int WINAPI WlxDialogBox(HANDLE hWlx, HANDLE hInst, LPWSTR lpszTemplate, HWND hwndOwner, DLGPROC dlgprc);
242 int WINAPI WlxDialogBoxParam(HANDLE hWlx, HANDLE hInst, LPWSTR lpszTemplate, HWND hwndOwner, DLGPROC dlgprc, LPARAM dwInitParam);
243 int WINAPI WlxDialogBoxIndirect(HANDLE hWlx, HANDLE hInst, LPCDLGTEMPLATE hDialogTemplate, HWND hwndOwner, DLGPROC dlgprc);
244 int WINAPI WlxDialogBoxIndirectParam(HANDLE hWlx, HANDLE hInst, LPCDLGTEMPLATE hDialogTemplate, HWND hwndOwner, DLGPROC dlgprc, LPARAM dwInitParam);
245 int WINAPI WlxSwitchDesktopToUser(HANDLE hWlx);
246 int WINAPI WlxSwitchDesktopToWinlogon(HANDLE hWlx);
247 int WINAPI WlxChangePasswordNotify(HANDLE hWlx, PWLX_MPR_NOTIFY_INFO pMprInfo, DWORD dwChangeInfo);
248 BOOL WINAPI WlxGetSourceDesktop(HANDLE hWlx, PWLX_DESKTOP* ppDesktop);
249 BOOL WINAPI WlxSetReturnDesktop(HANDLE hWlx, PWLX_DESKTOP pDesktop);
250 BOOL WINAPI WlxCreateUserDesktop(HANDLE hWlx, HANDLE hToken, DWORD Flags, PWSTR pszDesktopName, PWLX_DESKTOP* ppDesktop);
251 int WINAPI WlxChangePasswordNotifyEx(HANDLE hWlx, PWLX_MPR_NOTIFY_INFO pMprInfo, DWORD dwChangeInfo, PWSTR ProviderName, PVOID Reserved);
252 BOOL WINAPI WlxCloseUserDesktop(HANDLE hWlx, PWLX_DESKTOP pDesktop, HANDLE hToken);
253 BOOL WINAPI WlxSetOption(HANDLE hWlx, DWORD Option, ULONG_PTR Value, ULONG_PTR* OldValue);
254 BOOL WINAPI WlxGetOption(HANDLE hWlx, DWORD Option, ULONG_PTR* Value);
255 VOID WINAPI WlxWin31Migrate(HANDLE hWlx);
256 BOOL WINAPI WlxQueryClientCredentials(PWLX_CLIENT_CREDENTIALS_INFO_V1_0 pCred);
257 BOOL WINAPI WlxQueryInetConnectorCredentials(PWLX_CLIENT_CREDENTIALS_INFO_V1_0 pCred);
258 DWORD WINAPI WlxQueryConsoleSwitchCredentials(PWLX_CONSOLESWITCH_CREDENTIALS_INFO_V1_0 pCred);
259 BOOL WINAPI WlxQueryTsLogonCredentials(PWLX_CLIENT_CREDENTIALS_INFO_V2_0 pCred);
260 BOOL WINAPI WlxDisconnect(VOID);
261 DWORD WINAPI WlxQueryTerminalServicesData(HANDLE hWlx, PWLX_TERMINAL_SERVICES_DATA pTSData, WCHAR* UserName, WCHAR* Domain);
262
263 #endif /* __WINLOGON_MAIN_H__ */
264
265 /* EOF */