3 * Copyright (C) 2003 ReactOS Team
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.
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.
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.
19 /* COPYRIGHT: See COPYING in the top level directory
20 * PROJECT: ReactOS winlogon
21 * FILE: base/system/winlogon/winlogon.h
26 #ifndef __WINLOGON_MAIN_H__
27 #define __WINLOGON_MAIN_H__
31 #define USE_GETLASTINPUTINFO
33 #define WIN32_NO_STATUS
40 #include <ndk/rtlfuncs.h>
41 #include <ndk/exfuncs.h>
44 #include <reactos/undocuser.h>
45 #include <reactos/undocmpr.h>
50 IN HWINSTA hWindowStation
,
52 IN PSID psid OPTIONAL
,
55 #include <wine/debug.h>
56 WINE_DEFAULT_DEBUG_CHANNEL(winlogon
);
60 typedef BOOL (WINAPI
* PFWLXNEGOTIATE
) (DWORD
, DWORD
*);
61 typedef BOOL (WINAPI
* PFWLXINITIALIZE
) (LPWSTR
, HANDLE
, PVOID
, PVOID
, PVOID
*);
62 typedef VOID (WINAPI
* PFWLXDISPLAYSASNOTICE
) (PVOID
);
63 typedef int (WINAPI
* PFWLXLOGGEDOUTSAS
) (PVOID
, DWORD
, PLUID
, PSID
, PDWORD
,
64 PHANDLE
, PWLX_MPR_NOTIFY_INFO
,
66 typedef BOOL (WINAPI
* PFWLXACTIVATEUSERSHELL
) (PVOID
, PWSTR
, PWSTR
, PVOID
);
67 typedef int (WINAPI
* PFWLXLOGGEDONSAS
) (PVOID
, DWORD
, PVOID
);
68 typedef VOID (WINAPI
* PFWLXDISPLAYLOCKEDNOTICE
) (PVOID
);
69 typedef int (WINAPI
* PFWLXWKSTALOCKEDSAS
) (PVOID
, DWORD
);
70 typedef BOOL (WINAPI
* PFWLXISLOCKOK
) (PVOID
);
71 typedef BOOL (WINAPI
* PFWLXISLOGOFFOK
) (PVOID
);
72 typedef VOID (WINAPI
* PFWLXLOGOFF
) (PVOID
);
73 typedef VOID (WINAPI
* PFWLXSHUTDOWN
) (PVOID
, DWORD
);
77 typedef BOOL (WINAPI
* PFWLXSCREENSAVERNOTIFY
) (PVOID
, BOOL
*);
78 typedef BOOL (WINAPI
* PFWLXSTARTAPPLICATION
) (PVOID
, PWSTR
, PVOID
, PWSTR
);
82 typedef BOOL (WINAPI
* PFWLXNETWORKPROVIDERLOAD
) (PVOID
, PWLX_MPR_NOTIFY_INFO
);
83 typedef BOOL (WINAPI
* PFWLXDISPLAYSTATUSMESSAGE
) (PVOID
, HDESK
, DWORD
, PWSTR
, PWSTR
);
84 typedef BOOL (WINAPI
* PFWLXGETSTATUSMESSAGE
) (PVOID
, DWORD
*, PWSTR
, DWORD
);
85 typedef BOOL (WINAPI
* PFWLXREMOVESTATUSMESSAGE
) (PVOID
);
87 typedef struct _GINAFUNCTIONS
89 /* Functions always available for a valid GINA */
90 PFWLXNEGOTIATE WlxNegotiate
; /* optional */
91 PFWLXINITIALIZE WlxInitialize
;
93 /* Functions available if WlxVersion >= WLX_VERSION_1_0 (MS Windows 3.5.0) */
94 PFWLXDISPLAYSASNOTICE WlxDisplaySASNotice
;
95 PFWLXLOGGEDOUTSAS WlxLoggedOutSAS
;
96 PFWLXACTIVATEUSERSHELL WlxActivateUserShell
;
97 PFWLXLOGGEDONSAS WlxLoggedOnSAS
;
98 PFWLXDISPLAYLOCKEDNOTICE WlxDisplayLockedNotice
;
99 PFWLXWKSTALOCKEDSAS WlxWkstaLockedSAS
;
100 PFWLXISLOCKOK WlxIsLockOk
;
101 PFWLXISLOGOFFOK WlxIsLogoffOk
;
102 PFWLXLOGOFF WlxLogoff
;
103 PFWLXSHUTDOWN WlxShutdown
;
105 /* Functions available if WlxVersion >= WLX_VERSION_1_1 (MS Windows 3.5.1) */
106 PFWLXSCREENSAVERNOTIFY WlxScreenSaverNotify
; /* optional */
107 PFWLXSTARTAPPLICATION WlxStartApplication
; /* optional */
109 /* Functions available if WlxVersion >= WLX_VERSION_1_2 (MS Windows NT 4.0) */
111 /* Functions available if WlxVersion >= WLX_VERSION_1_3 (MS Windows 2000) */
112 PFWLXNETWORKPROVIDERLOAD WlxNetworkProviderLoad
; /* not called ATM */
113 PFWLXDISPLAYSTATUSMESSAGE WlxDisplayStatusMessage
;
114 PFWLXGETSTATUSMESSAGE WlxGetStatusMessage
; /* doesn't need to be called */
115 PFWLXREMOVESTATUSMESSAGE WlxRemoveStatusMessage
;
117 /* Functions available if WlxVersion >= WLX_VERSION_1_4 (MS Windows XP) */
118 } GINAFUNCTIONS
, *PGINAFUNCTIONS
;
120 typedef struct _GINAINSTANCE
122 HMODULE hDllInstance
;
123 GINAFUNCTIONS Functions
;
126 BOOL UseCtrlAltDelete
;
127 } GINAINSTANCE
, *PGINAINSTANCE
;
131 * The picture Microsoft is trying to paint here
132 * (http://msdn.microsoft.com/en-us/library/windows/desktop/aa380547%28v=vs.85%29.aspx)
133 * about the Winlogon states is a little too simple.
135 * The real picture should look more like this:
138 * Initial state. Required for session initialization. After initialization,
139 * the state will automatically change to STATE_LOGGED_OFF.
142 * User is logged off. Winlogon shows the "Press Ctrl-Alt-Del for logon"
143 * dialog. The state changes to STATE_LOGGED_OFF_SAS when the user presses
144 * "Ctrl-Alt-Del". If DisableCAD is true, the state will automatically
145 * change to STATE_LOGGED_OFF_SAS without showing the dialog.
147 * STATE_LOGGED_OFF_SAS
148 * State shows the logon dialog. Entering the right credentials and pressing
149 * "OK" changes the state to STATE_LOGGED_ON. Pressing "Cancel" or a timeout
150 * changes the state back to STATE_LOGGED_OFF.
153 * User is logged on. Winlogon does not show any dialog. Pressing
154 * "Ctrl-Alt-Del" changes the state to STATE_LOGGED_ON_SAS and user
155 * inactivity changes the state to STATE_SCREENSAVER.
157 * STATE_LOGGED_ON_SAS
158 * Winlogon shows the security dialog. Pressing "Cancel" or "Task Manager"
159 * or a timeout change the state back to STATE_LOGGED_ON. Pressing "Change
160 * Password" does not change the state, because the security dialog is still
161 * visible behind the change password dialog. Pressing "Log off" changes the
162 * state to STATE_LOGGING_OFF. Pressing "Lock Computer" changes the state to
163 * STATE_LOCKED. Pressing "Shutdown" changes the state to
164 * STATE_SHUTTING_DOWN.
167 * Winlogon shows the locked message dialog. When the user presses "Ctrl-
168 * Alt-Del" the state changes to STATE_LOCKED_SAS. If DisableCAD is true,
169 * the state will automatically change to STATE_LOCKED_SAS without showing
173 * Winlogon shows the unlock dialog. Pressing "Cancel" or a timeout will
174 * change the state back to STATE_LOCKED. Entering the right credentials and
175 * pressing "OK" unlocks the computer and changes the state to
179 * Winlogon shows the logoff dialog. Pressing "Cancel" or a timeout changes
180 * the state back to STATE_LOGGED_ON_SAS. Pressing "OK" logs off the user
181 * and changes the state to STATE_LOGGED_OFF.
183 * STATE_SHUTTING_DOWN
184 * Winlogon shows the shutdown dialog. Pressing "Cancel" or a timeout will
185 * change the state back to STATE_LOGGED_ON_SAS. Pressing "OK" will change
186 * the state to STATE_SHUT_DOWN.
189 * Terminates Winlogon and initiates shut-down.
192 * Winlogon runs the screen saver. Upon user activity, the screensaver
193 * terminates and the state changes back to STATE_LOGGED_ON if the secure
194 * screen saver option is off. Otherwise, the state changes to STATE_LOCKED.
196 typedef enum _LOGON_STATE
200 STATE_LOGGED_OFF_SAS
,
205 STATE_LOGGING_OFF
, // not used yet
206 STATE_SHUTTING_DOWN
, // not used yet
207 STATE_SHUT_DOWN
, // not used yet
208 STATE_SCREENSAVER
// not used yet
209 } LOGON_STATE
, *PLOGON_STATE
;
211 #define LockWorkstation(Session)
212 #define UnlockWorkstation(Session)
214 typedef struct _WLSESSION
221 HWINSTA InteractiveWindowStation
;
222 LPWSTR InteractiveWindowStationName
;
223 HDESK ApplicationDesktop
;
224 HDESK WinlogonDesktop
;
225 HDESK ScreenSaverDesktop
;
229 LOGON_STATE LogonState
;
230 DWORD DialogTimeout
; /* Timeout for dialog boxes, in seconds */
232 /* Screen-saver informations */
233 #ifndef USE_GETLASTINPUTINFO
237 HANDLE hEndOfScreenSaverThread
;
238 HANDLE hScreenSaverParametersChanged
;
239 HANDLE hUserActivity
;
240 HANDLE hEndOfScreenSaver
;
241 #ifndef USE_GETLASTINPUTINFO
245 /* Logon informations */
247 WLX_MPR_NOTIFY_INFO MprNotifyInfo
;
248 WLX_PROFILE_V2_0
*Profile
;
249 } WLSESSION
, *PWLSESSION
;
251 typedef enum _NOTIFICATION_TYPE
259 StartScreenSaverHandler
,
260 StopScreenSaverHandler
,
266 } NOTIFICATION_TYPE
, *PNOTIFICATION_TYPE
;
268 extern HINSTANCE hAppInstance
;
269 extern PWLSESSION WLSession
;
271 #define WLX_SHUTTINGDOWN(Status) \
272 (((Status) == WLX_SAS_ACTION_SHUTDOWN) || \
273 ((Status) == WLX_SAS_ACTION_SHUTDOWN_POWER_OFF) || \
274 ((Status) == WLX_SAS_ACTION_SHUTDOWN_REBOOT) \
277 #define WLX_SUSPENDING(Status) \
278 (((Status) == WLX_SAS_ACTION_SHUTDOWN_SLEEP) || \
279 ((Status) == WLX_SAS_ACTION_SHUTDOWN_SLEEP2) || \
280 ((Status) == WLX_SAS_ACTION_SHUTDOWN_HIBERNATE) \
285 CreateUserEnvironment(IN PWLSESSION Session
);
289 InitNotifications(VOID
);
292 CleanupNotifications(VOID
);
295 CallNotificationDlls(
297 NOTIFICATION_TYPE Type
);
301 StartRpcServer(VOID
);
304 extern LUID LuidNone
;
307 SetDefaultLanguage(IN PWLSESSION Session
);
310 HandleShutdown(IN OUT PWLSESSION Session
,
314 InitializeSAS(IN OUT PWLSESSION Session
);
318 InitializeScreenSaver(IN OUT PWLSESSION Session
);
321 StartScreenSaver(IN PWLSESSION Session
);
332 TerminateSystemShutdown(VOID
);
336 IN PUNICODE_STRING pMessage
,
338 IN BOOLEAN bForceAppsClosed
,
339 IN BOOLEAN bRebootAfterShutdown
,
344 PlaySoundRoutine(IN LPCWSTR FileName
,
349 DisplayStatusMessage(IN PWLSESSION Session
,
354 RemoveStatusMessage(IN PWLSESSION Session
);
358 InitDialogListHead(VOID
);
361 CloseAllDialogWindows(VOID
);
364 GinaInit(IN OUT PWLSESSION Session
);
367 AddAceToWindowStation(
372 CreateWindowStationAndDesktops(IN OUT PWLSESSION Session
);
375 VOID WINAPI
WlxUseCtrlAltDel(HANDLE hWlx
);
376 VOID WINAPI
WlxSetContextPointer(HANDLE hWlx
, PVOID pWlxContext
);
377 VOID WINAPI
WlxSasNotify(HANDLE hWlx
, DWORD dwSasType
);
378 BOOL WINAPI
WlxSetTimeout(HANDLE hWlx
, DWORD Timeout
);
379 int WINAPI
WlxAssignShellProtection(HANDLE hWlx
, HANDLE hToken
, HANDLE hProcess
, HANDLE hThread
);
380 int WINAPI
WlxMessageBox(HANDLE hWlx
, HWND hwndOwner
, LPWSTR lpszText
, LPWSTR lpszTitle
, UINT fuStyle
);
381 int WINAPI
WlxDialogBox(HANDLE hWlx
, HANDLE hInst
, LPWSTR lpszTemplate
, HWND hwndOwner
, DLGPROC dlgprc
);
382 int WINAPI
WlxDialogBoxParam(HANDLE hWlx
, HANDLE hInst
, LPWSTR lpszTemplate
, HWND hwndOwner
, DLGPROC dlgprc
, LPARAM dwInitParam
);
383 int WINAPI
WlxDialogBoxIndirect(HANDLE hWlx
, HANDLE hInst
, LPCDLGTEMPLATE hDialogTemplate
, HWND hwndOwner
, DLGPROC dlgprc
);
384 int WINAPI
WlxDialogBoxIndirectParam(HANDLE hWlx
, HANDLE hInst
, LPCDLGTEMPLATE hDialogTemplate
, HWND hwndOwner
, DLGPROC dlgprc
, LPARAM dwInitParam
);
385 int WINAPI
WlxSwitchDesktopToUser(HANDLE hWlx
);
386 int WINAPI
WlxSwitchDesktopToWinlogon(HANDLE hWlx
);
387 int WINAPI
WlxChangePasswordNotify(HANDLE hWlx
, PWLX_MPR_NOTIFY_INFO pMprInfo
, DWORD dwChangeInfo
);
388 BOOL WINAPI
WlxGetSourceDesktop(HANDLE hWlx
, PWLX_DESKTOP
* ppDesktop
);
389 BOOL WINAPI
WlxSetReturnDesktop(HANDLE hWlx
, PWLX_DESKTOP pDesktop
);
390 BOOL WINAPI
WlxCreateUserDesktop(HANDLE hWlx
, HANDLE hToken
, DWORD Flags
, PWSTR pszDesktopName
, PWLX_DESKTOP
* ppDesktop
);
391 int WINAPI
WlxChangePasswordNotifyEx(HANDLE hWlx
, PWLX_MPR_NOTIFY_INFO pMprInfo
, DWORD dwChangeInfo
, PWSTR ProviderName
, PVOID Reserved
);
392 BOOL WINAPI
WlxCloseUserDesktop(HANDLE hWlx
, PWLX_DESKTOP pDesktop
, HANDLE hToken
);
393 BOOL WINAPI
WlxSetOption(HANDLE hWlx
, DWORD Option
, ULONG_PTR Value
, ULONG_PTR
* OldValue
);
394 BOOL WINAPI
WlxGetOption(HANDLE hWlx
, DWORD Option
, ULONG_PTR
* Value
);
395 VOID WINAPI
WlxWin31Migrate(HANDLE hWlx
);
396 BOOL WINAPI
WlxQueryClientCredentials(PWLX_CLIENT_CREDENTIALS_INFO_V1_0 pCred
);
397 BOOL WINAPI
WlxQueryInetConnectorCredentials(PWLX_CLIENT_CREDENTIALS_INFO_V1_0 pCred
);
398 DWORD WINAPI
WlxQueryConsoleSwitchCredentials(PWLX_CONSOLESWITCH_CREDENTIALS_INFO_V1_0 pCred
);
399 BOOL WINAPI
WlxQueryTsLogonCredentials(PWLX_CLIENT_CREDENTIALS_INFO_V2_0 pCred
);
400 BOOL WINAPI
WlxDisconnect(VOID
);
401 DWORD WINAPI
WlxQueryTerminalServicesData(HANDLE hWlx
, PWLX_TERMINAL_SERVICES_DATA pTSData
, WCHAR
* UserName
, WCHAR
* Domain
);
403 #endif /* __WINLOGON_MAIN_H__ */