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: subsys/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>
46 #include <wine/debug.h>
47 WINE_DEFAULT_DEBUG_CHANNEL(winlogon
);
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
,
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
);
69 typedef BOOL (WINAPI
* PFWLXSCREENSAVERNOTIFY
) (PVOID
, BOOL
*);
70 typedef BOOL (WINAPI
* PFWLXSTARTAPPLICATION
) (PVOID
, PWSTR
, PVOID
, PWSTR
);
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
);
79 typedef struct _GINAFUNCTIONS
81 /* Functions always available for a valid GINA */
82 PFWLXNEGOTIATE WlxNegotiate
; /* optional */
83 PFWLXINITIALIZE WlxInitialize
;
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
;
97 /* Functions available if WlxVersion >= WLX_VERSION_1_1 (MS Windows 3.5.1) */
98 PFWLXSCREENSAVERNOTIFY WlxScreenSaverNotify
; /* optional */
99 PFWLXSTARTAPPLICATION WlxStartApplication
; /* optional */
101 /* Functions available if WlxVersion >= WLX_VERSION_1_2 (MS Windows NT 4.0) */
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
;
109 /* Functions available if WlxVersion >= WLX_VERSION_1_4 (MS Windows XP) */
110 } GINAFUNCTIONS
, *PGINAFUNCTIONS
;
112 typedef struct _GINAINSTANCE
114 HMODULE hDllInstance
;
115 GINAFUNCTIONS Functions
;
118 BOOL UseCtrlAltDelete
;
119 } GINAINSTANCE
, *PGINAINSTANCE
;
123 * The picture Microsoft is trying to paint here
124 * (http://msdn.microsoft.com/en-us/library/windows/desktop/aa380547%28v=vs.85%29.aspx)
125 * about the Winlogon states is a little too simple.
127 * The real picture should look more like this:
130 * Initial state. Required for session initialization. After intialization,
131 * the state will automatically change to STATE_LOGGED_OFF.
134 * User is logged off. Winlogon shows the "Press Ctrl-Alt-Del for logon"
135 * dialog. The state changes to STATE_LOGGED_OFF_SAS when the user presses
136 * "Ctrl-Alt-Del". If DisableCAD is true, the state will automatically
137 * change to STATE_LOGGED_OFF_SAS without showing the dialog.
139 * STATE_LOGGED_OFF_SAS
140 * State shows the logon dialog. Entering the right credentials and pressing
141 * "OK" changes the state to STATE_LOGGED_ON. Pressing "Cancel" or a timeout
142 * changes the state back to STATE_LOGGED_OFF.
145 * User is logged on. Winlogon does not show any dialog. Pressing
146 * "Ctrl-Alt-Del" changes the state to STATE_LOGGED_ON_SAS and user
147 * inactivity changes the state to STATE_SCREENSAVER.
149 * STATE_LOGGED_ON_SAS
150 * Winlogon shows the security dialog. Pressing "Cancel" or "Task Manager"
151 * or a timeout change the state back to STATE_LOGGED_ON. Pressing "Change
152 * Password" does not change the state, because the security dialog is still
153 * visible behind the change password dialog. Pressing "Log off" changes the
154 * state to STATE_LOGGING_OFF. Pressing "Lock Computer" changes the state to
155 * STATE_LOCKED. Pressing "Shutdown" changes the state to
156 * STATE_SHUTTING_DOWN.
159 * Winlogon shows the locked message dialog. When the user presses "Ctrl-
160 * Alt-Del" the state changes to STATE_LOCKED_SAS. If DisableCAD is true,
161 * the state will automatically change to STATE_LOCKED_SAS without showing
165 * Winlogon shows the unlock dialog. Presing "Cancel" or a timeout will
166 * change the state back to STATE_LOCKED. Entering the right credentials and
167 * pressing "OK" unlocks the computer and changes the state to
171 * Winlogon shows the logoff dialog. Pressing "Cancel" or a timeout changes
172 * the state back to STATE_LOGGED_ON_SAS. Pressing "OK" logs off the user
173 * and changes the state to STATE_LOGGED_OFF.
175 * STATE_SHUTTING_DOWN
176 * Winlogon shows the shutdown dialog. Presing "Cancel" or a timeout will
177 * change the state back to STATE_LOGGED_ON_SAS. Pressing "OK" will change
178 * the state to STATE_SHUT_DOWN.
181 * Terminates Winlogon and initiates shut-down.
184 * Winlogon runs the screen saver. Upon user activity, the screensaver
185 * terminates and the state changes back to STATE_LOGGED_ON if the secure
186 * screen saver option is off. Otherwise, the state changes to STATE_LOCKED.
188 typedef enum _LOGON_STATE
192 STATE_LOGGED_OFF_SAS
,
197 STATE_LOGGING_OFF
, // not used yet
198 STATE_SHUTTING_DOWN
, // not used yet
199 STATE_SHUT_DOWN
, // not used yet
200 STATE_SCREENSAVER
// not used yet
201 } LOGON_STATE
, *PLOGON_STATE
;
203 #define LockWorkstation(Session)
204 #define UnlockWorkstation(Session)
206 typedef struct _WLSESSION
213 HWINSTA InteractiveWindowStation
;
214 LPWSTR InteractiveWindowStationName
;
215 HDESK ApplicationDesktop
;
216 HDESK WinlogonDesktop
;
217 HDESK ScreenSaverDesktop
;
221 LOGON_STATE LogonState
;
222 DWORD DialogTimeout
; /* Timeout for dialog boxes, in seconds */
224 /* Screen-saver informations */
225 #ifndef USE_GETLASTINPUTINFO
229 HANDLE hEndOfScreenSaverThread
;
230 HANDLE hScreenSaverParametersChanged
;
231 HANDLE hUserActivity
;
232 HANDLE hEndOfScreenSaver
;
233 #ifndef USE_GETLASTINPUTINFO
237 /* Logon informations */
239 WLX_MPR_NOTIFY_INFO MprNotifyInfo
;
240 WLX_PROFILE_V2_0
*Profile
;
241 } WLSESSION
, *PWLSESSION
;
243 extern HINSTANCE hAppInstance
;
244 extern PWLSESSION WLSession
;
246 #define WLX_SHUTTINGDOWN(Status) \
247 (((Status) == WLX_SAS_ACTION_SHUTDOWN) || \
248 ((Status) == WLX_SAS_ACTION_SHUTDOWN_POWER_OFF) || \
249 ((Status) == WLX_SAS_ACTION_SHUTDOWN_REBOOT) \
252 #define WLX_SUSPENDING(Status) \
253 (((Status) == WLX_SAS_ACTION_SHUTDOWN_SLEEP) || \
254 ((Status) == WLX_SAS_ACTION_SHUTDOWN_SLEEP2) || \
255 ((Status) == WLX_SAS_ACTION_SHUTDOWN_HIBERNATE) \
260 CreateUserEnvironment(IN PWLSESSION Session
);
264 SetDefaultLanguage(IN BOOL UserProfile
);
267 InitializeSAS(IN OUT PWLSESSION Session
);
271 InitializeScreenSaver(IN OUT PWLSESSION Session
);
274 StartScreenSaver(IN PWLSESSION Session
);
279 PlaySoundRoutine(IN LPCWSTR FileName
,
284 DisplayStatusMessage(IN PWLSESSION Session
,
289 RemoveStatusMessage(IN PWLSESSION Session
);
293 InitDialogListHead(VOID
);
296 GetTopDialogWindow(VOID
);
299 GinaInit(IN OUT PWLSESSION Session
);
302 CreateWindowStationAndDesktops(IN OUT PWLSESSION Session
);
305 HandleShutdown(IN OUT PWLSESSION Session
,
308 VOID WINAPI
WlxUseCtrlAltDel(HANDLE hWlx
);
309 VOID WINAPI
WlxSetContextPointer(HANDLE hWlx
, PVOID pWlxContext
);
310 VOID WINAPI
WlxSasNotify(HANDLE hWlx
, DWORD dwSasType
);
311 BOOL WINAPI
WlxSetTimeout(HANDLE hWlx
, DWORD Timeout
);
312 int WINAPI
WlxAssignShellProtection(HANDLE hWlx
, HANDLE hToken
, HANDLE hProcess
, HANDLE hThread
);
313 int WINAPI
WlxMessageBox(HANDLE hWlx
, HWND hwndOwner
, LPWSTR lpszText
, LPWSTR lpszTitle
, UINT fuStyle
);
314 int WINAPI
WlxDialogBox(HANDLE hWlx
, HANDLE hInst
, LPWSTR lpszTemplate
, HWND hwndOwner
, DLGPROC dlgprc
);
315 int WINAPI
WlxDialogBoxParam(HANDLE hWlx
, HANDLE hInst
, LPWSTR lpszTemplate
, HWND hwndOwner
, DLGPROC dlgprc
, LPARAM dwInitParam
);
316 int WINAPI
WlxDialogBoxIndirect(HANDLE hWlx
, HANDLE hInst
, LPCDLGTEMPLATE hDialogTemplate
, HWND hwndOwner
, DLGPROC dlgprc
);
317 int WINAPI
WlxDialogBoxIndirectParam(HANDLE hWlx
, HANDLE hInst
, LPCDLGTEMPLATE hDialogTemplate
, HWND hwndOwner
, DLGPROC dlgprc
, LPARAM dwInitParam
);
318 int WINAPI
WlxSwitchDesktopToUser(HANDLE hWlx
);
319 int WINAPI
WlxSwitchDesktopToWinlogon(HANDLE hWlx
);
320 int WINAPI
WlxChangePasswordNotify(HANDLE hWlx
, PWLX_MPR_NOTIFY_INFO pMprInfo
, DWORD dwChangeInfo
);
321 BOOL WINAPI
WlxGetSourceDesktop(HANDLE hWlx
, PWLX_DESKTOP
* ppDesktop
);
322 BOOL WINAPI
WlxSetReturnDesktop(HANDLE hWlx
, PWLX_DESKTOP pDesktop
);
323 BOOL WINAPI
WlxCreateUserDesktop(HANDLE hWlx
, HANDLE hToken
, DWORD Flags
, PWSTR pszDesktopName
, PWLX_DESKTOP
* ppDesktop
);
324 int WINAPI
WlxChangePasswordNotifyEx(HANDLE hWlx
, PWLX_MPR_NOTIFY_INFO pMprInfo
, DWORD dwChangeInfo
, PWSTR ProviderName
, PVOID Reserved
);
325 BOOL WINAPI
WlxCloseUserDesktop(HANDLE hWlx
, PWLX_DESKTOP pDesktop
, HANDLE hToken
);
326 BOOL WINAPI
WlxSetOption(HANDLE hWlx
, DWORD Option
, ULONG_PTR Value
, ULONG_PTR
* OldValue
);
327 BOOL WINAPI
WlxGetOption(HANDLE hWlx
, DWORD Option
, ULONG_PTR
* Value
);
328 VOID WINAPI
WlxWin31Migrate(HANDLE hWlx
);
329 BOOL WINAPI
WlxQueryClientCredentials(PWLX_CLIENT_CREDENTIALS_INFO_V1_0 pCred
);
330 BOOL WINAPI
WlxQueryInetConnectorCredentials(PWLX_CLIENT_CREDENTIALS_INFO_V1_0 pCred
);
331 DWORD WINAPI
WlxQueryConsoleSwitchCredentials(PWLX_CONSOLESWITCH_CREDENTIALS_INFO_V1_0 pCred
);
332 BOOL WINAPI
WlxQueryTsLogonCredentials(PWLX_CLIENT_CREDENTIALS_INFO_V2_0 pCred
);
333 BOOL WINAPI
WlxDisconnect(VOID
);
334 DWORD WINAPI
WlxQueryTerminalServicesData(HANDLE hWlx
, PWLX_TERMINAL_SERVICES_DATA pTSData
, WCHAR
* UserName
, WCHAR
* Domain
);
336 #endif /* __WINLOGON_MAIN_H__ */