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__
29 #define USE_GETLASTINPUTINFO
31 #define WIN32_NO_STATUS
32 #define WIN32_LEAN_AND_MEAN
45 #include <reactos/undocuser.h>
46 #include <reactos/winlogon.h>
48 #include <wine/debug.h>
53 typedef BOOL (WINAPI
* PFWLXNEGOTIATE
) (DWORD
, DWORD
*);
54 typedef BOOL (WINAPI
* PFWLXINITIALIZE
) (LPWSTR
, HANDLE
, PVOID
, PVOID
, PVOID
*);
55 typedef VOID (WINAPI
* PFWLXDISPLAYSASNOTICE
) (PVOID
);
56 typedef int (WINAPI
* PFWLXLOGGEDOUTSAS
) (PVOID
, DWORD
, PLUID
, PSID
, PDWORD
,
57 PHANDLE
, PWLX_MPR_NOTIFY_INFO
,
59 typedef BOOL (WINAPI
* PFWLXACTIVATEUSERSHELL
) (PVOID
, PWSTR
, PWSTR
, PVOID
);
60 typedef int (WINAPI
* PFWLXLOGGEDONSAS
) (PVOID
, DWORD
, PVOID
);
61 typedef VOID (WINAPI
* PFWLXDISPLAYLOCKEDNOTICE
) (PVOID
);
62 typedef int (WINAPI
* PFWLXWKSTALOCKEDSAS
) (PVOID
, DWORD
);
63 typedef BOOL (WINAPI
* PFWLXISLOCKOK
) (PVOID
);
64 typedef BOOL (WINAPI
* PFWLXISLOGOFFOK
) (PVOID
);
65 typedef VOID (WINAPI
* PFWLXLOGOFF
) (PVOID
);
66 typedef VOID (WINAPI
* PFWLXSHUTDOWN
) (PVOID
, DWORD
);
70 typedef BOOL (WINAPI
* PFWLXSCREENSAVERNOTIFY
) (PVOID
, BOOL
*);
71 typedef BOOL (WINAPI
* PFWLXSTARTAPPLICATION
) (PVOID
, PWSTR
, PVOID
, PWSTR
);
75 typedef BOOL (WINAPI
* PFWLXNETWORKPROVIDERLOAD
) (PVOID
, PWLX_MPR_NOTIFY_INFO
);
76 typedef BOOL (WINAPI
* PFWLXDISPLAYSTATUSMESSAGE
) (PVOID
, HDESK
, DWORD
, PWSTR
, PWSTR
);
77 typedef BOOL (WINAPI
* PFWLXGETSTATUSMESSAGE
) (PVOID
, DWORD
*, PWSTR
, DWORD
);
78 typedef BOOL (WINAPI
* PFWLXREMOVESTATUSMESSAGE
) (PVOID
);
80 typedef struct _GINAFUNCTIONS
82 /* Functions always available for a valid GINA */
83 PFWLXNEGOTIATE WlxNegotiate
; /* optional */
84 PFWLXINITIALIZE WlxInitialize
;
86 /* Functions available if WlxVersion >= WLX_VERSION_1_0 (MS Windows 3.5.0) */
87 PFWLXDISPLAYSASNOTICE WlxDisplaySASNotice
;
88 PFWLXLOGGEDOUTSAS WlxLoggedOutSAS
;
89 PFWLXACTIVATEUSERSHELL WlxActivateUserShell
;
90 PFWLXLOGGEDONSAS WlxLoggedOnSAS
;
91 PFWLXDISPLAYLOCKEDNOTICE WlxDisplayLockedNotice
;
92 PFWLXWKSTALOCKEDSAS WlxWkstaLockedSAS
;
93 PFWLXISLOCKOK WlxIsLockOk
;
94 PFWLXISLOGOFFOK WlxIsLogoffOk
;
95 PFWLXLOGOFF WlxLogoff
;
96 PFWLXSHUTDOWN WlxShutdown
;
98 /* Functions available if WlxVersion >= WLX_VERSION_1_1 (MS Windows 3.5.1) */
99 PFWLXSCREENSAVERNOTIFY WlxScreenSaverNotify
; /* optional */
100 PFWLXSTARTAPPLICATION WlxStartApplication
; /* optional */
102 /* Functions available if WlxVersion >= WLX_VERSION_1_2 (MS Windows NT 4.0) */
104 /* Functions available if WlxVersion >= WLX_VERSION_1_3 (MS Windows 2000) */
105 PFWLXNETWORKPROVIDERLOAD WlxNetworkProviderLoad
; /* not called ATM */
106 PFWLXDISPLAYSTATUSMESSAGE WlxDisplayStatusMessage
;
107 PFWLXGETSTATUSMESSAGE WlxGetStatusMessage
; /* doesn't need to be called */
108 PFWLXREMOVESTATUSMESSAGE WlxRemoveStatusMessage
;
110 /* Functions available if WlxVersion >= WLX_VERSION_1_4 (MS Windows XP) */
111 } GINAFUNCTIONS
, *PGINAFUNCTIONS
;
113 typedef struct _GINAINSTANCE
115 HMODULE hDllInstance
;
116 GINAFUNCTIONS Functions
;
119 BOOL UseCtrlAltDelete
;
120 } GINAINSTANCE
, *PGINAINSTANCE
;
124 * The picture Microsoft is trying to paint here
125 * (http://msdn.microsoft.com/en-us/library/windows/desktop/aa380547%28v=vs.85%29.aspx)
126 * about the Winlogon states is a little too simple.
128 * The real picture should look more like this:
131 * Initial state. Required for session initialization. After intialization,
132 * the state will automatically change to STATE_LOGGED_OFF.
135 * User is logged off. Winlogon shows the "Press Ctrl-Alt-Del for logon"
136 * dialog. The state changes to STATE_LOGGED_OFF_SAS when the user presses
137 * "Ctrl-Alt-Del". If DisableCAD is true, the state will automatically
138 * change to STATE_LOGGED_OFF_SAS without showing the dialog.
140 * STATE_LOGGED_OFF_SAS
141 * State shows the logon dialog. Entering the right credentials and pressing
142 * "OK" changes the state to STATE_LOGGED_ON. Pressing "Cancel" or a timeout
143 * changes the state back to STATE_LOGGED_OFF.
146 * User is logged on. Winlogon does not show any dialog. Pressing
147 * "Ctrl-Alt-Del" changes the state to STATE_LOGGED_ON_SAS and user
148 * inactivity changes the state to STATE_SCREENSAVER.
150 * STATE_LOGGED_ON_SAS
151 * Winlogon shows the security dialog. Pressing "Cancel" or "Task Manager"
152 * or a timeout change the state back to STATE_LOGGED_ON. Pressing "Change
153 * Password" does not change the state, because the security dialog is still
154 * visible behind the change password dialog. Pressing "Log off" changes the
155 * state to STATE_LOGGING_OFF. Pressing "Lock Computer" changes the state to
156 * STATE_LOCKED. Pressing "Shutdown" changes the state to
157 * STATE_SHUTTING_DOWN.
160 * Winlogon runs the screen saver. Upon user activity, the screensaver
161 * terminates and the state changes back to STATE_LOGGED_ON if the secure
162 * screen saver option is off. Otherwise, the state changes to STATE_LOCKED.
165 * Winlogon shows the logoff dialog. Pressing "Cancel" or a timeout changes
166 * the state back to STATE_LOGGED_ON_SAS. Pressing "OK" logs off the user
167 * and changes the state to STATE_LOGGED_OFF.
170 * Winlogon shows the locked message dialog. When the user presses "Ctrl-
171 * Alt-Del" the state changes to STATE_LOCKED_SAS. If DisableCAD is true,
172 * the state will automatically change to STATE_LOCKED_SAS without showing
176 * Winlogon shows the unlock dialog. Presing "Cancel" or a timeout will
177 * change the state back to STATE_LOCKED. Entering the right credentials and
178 * pressing "OK" unlocks the computer and changes the state to
181 * STATE_SHUTTING_DOWN
182 * Winlogon shows the shutdown dialog. Presing "Cancel" or a timeout will
183 * change the state back to STATE_LOGGED_ON_SAS. Pressing "OK" will change
184 * the state to STATE_SHUT_DOWN.
187 * Terminates Winlogon and initiates shut-down.
189 typedef enum _LOGON_STATE
191 STATE_INIT
, // not user yet
193 STATE_LOGGED_OFF_SAS
, // not user yet
195 STATE_LOGGED_ON_SAS
, // not user yet
196 STATE_SCREENSAVER
, // not user yet
198 STATE_LOCKED_SAS
, // not user yet
199 STATE_LOGGING_OFF
, // not user yet
200 STATE_SHUTTING_DOWN
, // not user yet
201 STATE_SHUT_DOWN
// not user yet
202 } LOGON_STATE
, *PLOGON_STATE
;
204 #define LockWorkstation(Session)
205 #define UnlockWorkstation(Session)
207 typedef struct _WLSESSION
214 HWINSTA InteractiveWindowStation
;
215 LPWSTR InteractiveWindowStationName
;
216 HDESK ApplicationDesktop
;
217 HDESK WinlogonDesktop
;
218 HDESK ScreenSaverDesktop
;
222 LOGON_STATE LogonState
;
223 DWORD DialogTimeout
; /* Timeout for dialog boxes, in seconds */
225 /* Screen-saver informations */
226 #ifndef USE_GETLASTINPUTINFO
230 HANDLE hEndOfScreenSaverThread
;
231 HANDLE hScreenSaverParametersChanged
;
232 HANDLE hUserActivity
;
233 HANDLE hEndOfScreenSaver
;
234 #ifndef USE_GETLASTINPUTINFO
238 /* Logon informations */
240 WLX_MPR_NOTIFY_INFO MprNotifyInfo
;
241 WLX_PROFILE_V2_0
*Profile
;
242 } WLSESSION
, *PWLSESSION
;
244 extern HINSTANCE hAppInstance
;
245 extern PWLSESSION WLSession
;
247 #define WLX_SHUTTINGDOWN(Status) \
248 (((Status) == WLX_SAS_ACTION_SHUTDOWN) || \
249 ((Status) == WLX_SAS_ACTION_SHUTDOWN_POWER_OFF) || \
250 ((Status) == WLX_SAS_ACTION_SHUTDOWN_REBOOT) \
253 #define WLX_SUSPENDING(Status) \
254 (((Status) == WLX_SAS_ACTION_SHUTDOWN_SLEEP) || \
255 ((Status) == WLX_SAS_ACTION_SHUTDOWN_SLEEP2) || \
256 ((Status) == WLX_SAS_ACTION_SHUTDOWN_HIBERNATE) \
261 CreateUserEnvironment(IN PWLSESSION Session
);
265 SetDefaultLanguage(IN BOOL UserProfile
);
268 InitializeSAS(IN OUT PWLSESSION Session
);
272 InitializeScreenSaver(IN OUT PWLSESSION Session
);
275 StartScreenSaver(IN PWLSESSION Session
);
280 PlaySoundRoutine(IN LPCWSTR FileName
,
285 DisplayStatusMessage(IN PWLSESSION Session
,
290 RemoveStatusMessage(IN PWLSESSION Session
);
294 GinaInit(IN OUT PWLSESSION Session
);
297 CreateWindowStationAndDesktops(IN OUT PWLSESSION Session
);
300 HandleShutdown(IN OUT PWLSESSION Session
,
303 VOID WINAPI
WlxUseCtrlAltDel(HANDLE hWlx
);
304 VOID WINAPI
WlxSetContextPointer(HANDLE hWlx
, PVOID pWlxContext
);
305 VOID WINAPI
WlxSasNotify(HANDLE hWlx
, DWORD dwSasType
);
306 BOOL WINAPI
WlxSetTimeout(HANDLE hWlx
, DWORD Timeout
);
307 int WINAPI
WlxAssignShellProtection(HANDLE hWlx
, HANDLE hToken
, HANDLE hProcess
, HANDLE hThread
);
308 int WINAPI
WlxMessageBox(HANDLE hWlx
, HWND hwndOwner
, LPWSTR lpszText
, LPWSTR lpszTitle
, UINT fuStyle
);
309 int WINAPI
WlxDialogBox(HANDLE hWlx
, HANDLE hInst
, LPWSTR lpszTemplate
, HWND hwndOwner
, DLGPROC dlgprc
);
310 int WINAPI
WlxDialogBoxParam(HANDLE hWlx
, HANDLE hInst
, LPWSTR lpszTemplate
, HWND hwndOwner
, DLGPROC dlgprc
, LPARAM dwInitParam
);
311 int WINAPI
WlxDialogBoxIndirect(HANDLE hWlx
, HANDLE hInst
, LPCDLGTEMPLATE hDialogTemplate
, HWND hwndOwner
, DLGPROC dlgprc
);
312 int WINAPI
WlxDialogBoxIndirectParam(HANDLE hWlx
, HANDLE hInst
, LPCDLGTEMPLATE hDialogTemplate
, HWND hwndOwner
, DLGPROC dlgprc
, LPARAM dwInitParam
);
313 int WINAPI
WlxSwitchDesktopToUser(HANDLE hWlx
);
314 int WINAPI
WlxSwitchDesktopToWinlogon(HANDLE hWlx
);
315 int WINAPI
WlxChangePasswordNotify(HANDLE hWlx
, PWLX_MPR_NOTIFY_INFO pMprInfo
, DWORD dwChangeInfo
);
316 BOOL WINAPI
WlxGetSourceDesktop(HANDLE hWlx
, PWLX_DESKTOP
* ppDesktop
);
317 BOOL WINAPI
WlxSetReturnDesktop(HANDLE hWlx
, PWLX_DESKTOP pDesktop
);
318 BOOL WINAPI
WlxCreateUserDesktop(HANDLE hWlx
, HANDLE hToken
, DWORD Flags
, PWSTR pszDesktopName
, PWLX_DESKTOP
* ppDesktop
);
319 int WINAPI
WlxChangePasswordNotifyEx(HANDLE hWlx
, PWLX_MPR_NOTIFY_INFO pMprInfo
, DWORD dwChangeInfo
, PWSTR ProviderName
, PVOID Reserved
);
320 BOOL WINAPI
WlxCloseUserDesktop(HANDLE hWlx
, PWLX_DESKTOP pDesktop
, HANDLE hToken
);
321 BOOL WINAPI
WlxSetOption(HANDLE hWlx
, DWORD Option
, ULONG_PTR Value
, ULONG_PTR
* OldValue
);
322 BOOL WINAPI
WlxGetOption(HANDLE hWlx
, DWORD Option
, ULONG_PTR
* Value
);
323 VOID WINAPI
WlxWin31Migrate(HANDLE hWlx
);
324 BOOL WINAPI
WlxQueryClientCredentials(PWLX_CLIENT_CREDENTIALS_INFO_V1_0 pCred
);
325 BOOL WINAPI
WlxQueryInetConnectorCredentials(PWLX_CLIENT_CREDENTIALS_INFO_V1_0 pCred
);
326 DWORD WINAPI
WlxQueryConsoleSwitchCredentials(PWLX_CONSOLESWITCH_CREDENTIALS_INFO_V1_0 pCred
);
327 BOOL WINAPI
WlxQueryTsLogonCredentials(PWLX_CLIENT_CREDENTIALS_INFO_V2_0 pCred
);
328 BOOL WINAPI
WlxDisconnect(VOID
);
329 DWORD WINAPI
WlxQueryTerminalServicesData(HANDLE hWlx
, PWLX_TERMINAL_SERVICES_DATA pTSData
, WCHAR
* UserName
, WCHAR
* Domain
);
331 #endif /* __WINLOGON_MAIN_H__ */