Create a branch for header work.
[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 <windows.h>
33 #include <userenv.h>
34 #include <winwlx.h>
35 #include <cmfuncs.h>
36 #include <rtlfuncs.h>
37 #include <exfuncs.h>
38 #include <setypes.h>
39 #include <ntsecapi.h>
40 #include <accctrl.h>
41 #include <aclapi.h>
42
43 #include <reactos/winlogon.h>
44
45 #include "setup.h"
46 #include "resource.h"
47
48 typedef BOOL (WINAPI * PFWLXNEGOTIATE) (DWORD, DWORD *);
49 typedef BOOL (WINAPI * PFWLXINITIALIZE) (LPWSTR, HANDLE, PVOID, PVOID, PVOID *);
50 typedef VOID (WINAPI * PFWLXDISPLAYSASNOTICE) (PVOID);
51 typedef int (WINAPI * PFWLXLOGGEDOUTSAS) (PVOID, DWORD, PLUID, PSID, PDWORD,
52 PHANDLE, PWLX_MPR_NOTIFY_INFO,
53 PVOID *);
54 typedef BOOL (WINAPI * PFWLXACTIVATEUSERSHELL) (PVOID, PWSTR, PWSTR, PVOID);
55 typedef int (WINAPI * PFWLXLOGGEDONSAS) (PVOID, DWORD, PVOID);
56 typedef VOID (WINAPI * PFWLXDISPLAYLOCKEDNOTICE) (PVOID);
57 typedef int (WINAPI * PFWLXWKSTALOCKEDSAS) (PVOID, DWORD);
58 typedef BOOL (WINAPI * PFWLXISLOCKOK) (PVOID);
59 typedef BOOL (WINAPI * PFWLXISLOGOFFOK) (PVOID);
60 typedef VOID (WINAPI * PFWLXLOGOFF) (PVOID);
61 typedef VOID (WINAPI * PFWLXSHUTDOWN) (PVOID, DWORD);
62
63 /* version 1.1 */
64
65 typedef BOOL (WINAPI * PFWLXSCREENSAVERNOTIFY) (PVOID, BOOL *);
66 typedef BOOL (WINAPI * PFWLXSTARTAPPLICATION) (PVOID, PWSTR, PVOID, PWSTR);
67
68 /* version 1.3 */
69
70 typedef BOOL (WINAPI * PFWLXNETWORKPROVIDERLOAD) (PVOID, PWLX_MPR_NOTIFY_INFO);
71 typedef BOOL (WINAPI * PFWLXDISPLAYSTATUSMESSAGE) (PVOID, HDESK, DWORD, PWSTR, PWSTR);
72 typedef BOOL (WINAPI * PFWLXGETSTATUSMESSAGE) (PVOID, DWORD *, PWSTR, DWORD);
73 typedef BOOL (WINAPI * PFWLXREMOVESTATUSMESSAGE) (PVOID);
74
75 typedef struct _GINAFUNCTIONS
76 {
77 /* Functions always available for a valid GINA */
78 PFWLXNEGOTIATE WlxNegotiate; /* optional */
79 PFWLXINITIALIZE WlxInitialize;
80
81 /* Functions available if WlxVersion >= WLX_VERSION_1_0 (MS Windows 3.5.0) */
82 PFWLXDISPLAYSASNOTICE WlxDisplaySASNotice;
83 PFWLXLOGGEDOUTSAS WlxLoggedOutSAS;
84 PFWLXACTIVATEUSERSHELL WlxActivateUserShell;
85 PFWLXLOGGEDONSAS WlxLoggedOnSAS;
86 PFWLXDISPLAYLOCKEDNOTICE WlxDisplayLockedNotice;
87 PFWLXWKSTALOCKEDSAS WlxWkstaLockedSAS;
88 PFWLXISLOCKOK WlxIsLockOk;
89 PFWLXISLOGOFFOK WlxIsLogoffOk;
90 PFWLXLOGOFF WlxLogoff;
91 PFWLXSHUTDOWN WlxShutdown;
92
93 /* Functions available if WlxVersion >= WLX_VERSION_1_1 (MS Windows 3.5.1) */
94 PFWLXSCREENSAVERNOTIFY WlxScreenSaverNotify; /* optional */
95 PFWLXSTARTAPPLICATION WlxStartApplication; /* optional */
96
97 /* Functions available if WlxVersion >= WLX_VERSION_1_2 (MS Windows NT 4.0) */
98
99 /* Functions available if WlxVersion >= WLX_VERSION_1_3 (MS Windows 2000) */
100 PFWLXNETWORKPROVIDERLOAD WlxNetworkProviderLoad; /* not called ATM */
101 PFWLXDISPLAYSTATUSMESSAGE WlxDisplayStatusMessage;
102 PFWLXGETSTATUSMESSAGE WlxGetStatusMessage; /* doesn't need to be called */
103 PFWLXREMOVESTATUSMESSAGE WlxRemoveStatusMessage;
104
105 /* Functions available if WlxVersion >= WLX_VERSION_1_4 (MS Windows XP) */
106 } GINAFUNCTIONS, *PGINAFUNCTIONS;
107
108 typedef struct _GINAINSTANCE
109 {
110 HMODULE hDllInstance;
111 GINAFUNCTIONS Functions;
112 PVOID Context;
113 DWORD Version;
114 BOOL UseCtrlAltDelete;
115 } GINAINSTANCE, *PGINAINSTANCE;
116
117 /* FIXME: put in an enum */
118 /* See http://msdn.microsoft.com/library/default.asp?url=/library/en-us/secauthn/security/winlogon_states.asp */
119 #define WKSTA_IS_LOGGED_OFF 0
120 #define WKSTA_IS_LOGGED_ON 1
121 #define WKSTA_IS_LOCKED 2
122
123 #define LockWorkstation(Session)
124 #define UnlockWorkstation(Session)
125
126 typedef struct _WLSESSION
127 {
128 GINAINSTANCE Gina;
129 DWORD SASAction;
130 BOOL SuppressStatus;
131 BOOL TaskManHotkey;
132 HWND SASWindow;
133 HWINSTA InteractiveWindowStation;
134 LPWSTR InteractiveWindowStationName;
135 HDESK ApplicationDesktop;
136 HDESK WinlogonDesktop;
137 HDESK ScreenSaverDesktop;
138 LUID LogonId;
139 HANDLE UserToken;
140 HANDLE hProfileInfo;
141 DWORD LogonStatus;
142 DWORD DialogTimeout; /* Timeout for dialog boxes, in seconds */
143
144 /* Screen-saver informations */
145 #ifndef USE_GETLASTINPUTINFO
146 HHOOK KeyboardHook;
147 HHOOK MouseHook;
148 #endif
149 HANDLE hEndOfScreenSaverThread;
150 HANDLE hScreenSaverParametersChanged;
151 HANDLE hUserActivity;
152 HANDLE hEndOfScreenSaver;
153 #ifndef USE_GETLASTINPUTINFO
154 DWORD LastActivity;
155 #endif
156
157 /* Logon informations */
158 DWORD Options;
159 WLX_MPR_NOTIFY_INFO MprNotifyInfo;
160 WLX_PROFILE_V2_0 *Profile;
161 } WLSESSION, *PWLSESSION;
162
163 extern HINSTANCE hAppInstance;
164 extern PWLSESSION WLSession;
165
166 #define WLX_SHUTTINGDOWN(Status) \
167 (((Status) == WLX_SAS_ACTION_SHUTDOWN) || \
168 ((Status) == WLX_SAS_ACTION_SHUTDOWN_POWER_OFF) || \
169 ((Status) == WLX_SAS_ACTION_SHUTDOWN_REBOOT) \
170 )
171
172 #define WLX_SUSPENDING(Status) \
173 (((Status) == WLX_SAS_ACTION_SHUTDOWN_SLEEP) || \
174 ((Status) == WLX_SAS_ACTION_SHUTDOWN_SLEEP2) || \
175 ((Status) == WLX_SAS_ACTION_SHUTDOWN_HIBERNATE) \
176 )
177
178 /* user32 */
179 BOOL WINAPI
180 UpdatePerUserSystemParameters(DWORD dwUnknown,
181 DWORD dwReserved);
182
183 /* sas.c */
184 BOOL
185 SetDefaultLanguage(
186 IN BOOL UserProfile);
187
188 BOOL
189 InitializeSAS(
190 IN OUT PWLSESSION Session);
191
192 /* screensaver.c */
193 BOOL
194 InitializeScreenSaver(
195 IN OUT PWLSESSION Session);
196
197 VOID
198 StartScreenSaver(
199 IN PWLSESSION Session);
200
201 /* winlogon.c */
202 BOOL
203 DisplayStatusMessage(
204 IN PWLSESSION Session,
205 IN HDESK hDesktop,
206 IN UINT ResourceId);
207
208 BOOL
209 RemoveStatusMessage(
210 IN PWLSESSION Session);
211
212 /* wlx.c */
213 BOOL
214 GinaInit(
215 IN OUT PWLSESSION Session);
216 BOOL
217 CreateWindowStationAndDesktops(
218 IN OUT PWLSESSION Session);
219
220 NTSTATUS
221 HandleShutdown(
222 IN OUT PWLSESSION Session,
223 IN DWORD wlxAction);
224
225 VOID WINAPI WlxUseCtrlAltDel(HANDLE hWlx);
226 VOID WINAPI WlxSetContextPointer(HANDLE hWlx, PVOID pWlxContext);
227 VOID WINAPI WlxSasNotify(HANDLE hWlx, DWORD dwSasType);
228 BOOL WINAPI WlxSetTimeout(HANDLE hWlx, DWORD Timeout);
229 int WINAPI WlxAssignShellProtection(HANDLE hWlx, HANDLE hToken, HANDLE hProcess, HANDLE hThread);
230 int WINAPI WlxMessageBox(HANDLE hWlx, HWND hwndOwner, LPWSTR lpszText, LPWSTR lpszTitle, UINT fuStyle);
231 int WINAPI WlxDialogBox(HANDLE hWlx, HANDLE hInst, LPWSTR lpszTemplate, HWND hwndOwner, DLGPROC dlgprc);
232 int WINAPI WlxDialogBoxParam(HANDLE hWlx, HANDLE hInst, LPWSTR lpszTemplate, HWND hwndOwner, DLGPROC dlgprc, LPARAM dwInitParam);
233 int WINAPI WlxDialogBoxIndirect(HANDLE hWlx, HANDLE hInst, LPCDLGTEMPLATE hDialogTemplate, HWND hwndOwner, DLGPROC dlgprc);
234 int WINAPI WlxDialogBoxIndirectParam(HANDLE hWlx, HANDLE hInst, LPCDLGTEMPLATE hDialogTemplate, HWND hwndOwner, DLGPROC dlgprc, LPARAM dwInitParam);
235 int WINAPI WlxSwitchDesktopToUser(HANDLE hWlx);
236 int WINAPI WlxSwitchDesktopToWinlogon(HANDLE hWlx);
237 int WINAPI WlxChangePasswordNotify(HANDLE hWlx, PWLX_MPR_NOTIFY_INFO pMprInfo, DWORD dwChangeInfo);
238 BOOL WINAPI WlxGetSourceDesktop(HANDLE hWlx, PWLX_DESKTOP* ppDesktop);
239 BOOL WINAPI WlxSetReturnDesktop(HANDLE hWlx, PWLX_DESKTOP pDesktop);
240 BOOL WINAPI WlxCreateUserDesktop(HANDLE hWlx, HANDLE hToken, DWORD Flags, PWSTR pszDesktopName, PWLX_DESKTOP* ppDesktop);
241 int WINAPI WlxChangePasswordNotifyEx(HANDLE hWlx, PWLX_MPR_NOTIFY_INFO pMprInfo, DWORD dwChangeInfo, PWSTR ProviderName, PVOID Reserved);
242 BOOL WINAPI WlxCloseUserDesktop(HANDLE hWlx, PWLX_DESKTOP pDesktop, HANDLE hToken);
243 BOOL WINAPI WlxSetOption(HANDLE hWlx, DWORD Option, ULONG_PTR Value, ULONG_PTR* OldValue);
244 BOOL WINAPI WlxGetOption(HANDLE hWlx, DWORD Option, ULONG_PTR* Value);
245 VOID WINAPI WlxWin31Migrate(HANDLE hWlx);
246 BOOL WINAPI WlxQueryClientCredentials(PWLX_CLIENT_CREDENTIALS_INFO_V1_0 pCred);
247 BOOL WINAPI WlxQueryInetConnectorCredentials(PWLX_CLIENT_CREDENTIALS_INFO_V1_0 pCred);
248 DWORD WINAPI WlxQueryConsoleSwitchCredentials(PWLX_CONSOLESWITCH_CREDENTIALS_INFO_V1_0 pCred);
249 BOOL WINAPI WlxQueryTsLogonCredentials(PWLX_CLIENT_CREDENTIALS_INFO_V2_0 pCred);
250 BOOL WINAPI WlxDisconnect(VOID);
251 DWORD WINAPI WlxQueryTerminalServicesData(HANDLE hWlx, PWLX_TERMINAL_SERVICES_DATA pTSData, WCHAR* UserName, WCHAR* Domain);
252
253 #endif /* __WINLOGON_MAIN_H__ */
254
255 /* EOF */