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>
49 WINE_DEFAULT_DEBUG_CHANNEL(winlogon
);
54 typedef BOOL (WINAPI
* PFWLXNEGOTIATE
) (DWORD
, DWORD
*);
55 typedef BOOL (WINAPI
* PFWLXINITIALIZE
) (LPWSTR
, HANDLE
, PVOID
, PVOID
, PVOID
*);
56 typedef VOID (WINAPI
* PFWLXDISPLAYSASNOTICE
) (PVOID
);
57 typedef int (WINAPI
* PFWLXLOGGEDOUTSAS
) (PVOID
, DWORD
, PLUID
, PSID
, PDWORD
,
58 PHANDLE
, PWLX_MPR_NOTIFY_INFO
,
60 typedef BOOL (WINAPI
* PFWLXACTIVATEUSERSHELL
) (PVOID
, PWSTR
, PWSTR
, PVOID
);
61 typedef int (WINAPI
* PFWLXLOGGEDONSAS
) (PVOID
, DWORD
, PVOID
);
62 typedef VOID (WINAPI
* PFWLXDISPLAYLOCKEDNOTICE
) (PVOID
);
63 typedef int (WINAPI
* PFWLXWKSTALOCKEDSAS
) (PVOID
, DWORD
);
64 typedef BOOL (WINAPI
* PFWLXISLOCKOK
) (PVOID
);
65 typedef BOOL (WINAPI
* PFWLXISLOGOFFOK
) (PVOID
);
66 typedef VOID (WINAPI
* PFWLXLOGOFF
) (PVOID
);
67 typedef VOID (WINAPI
* PFWLXSHUTDOWN
) (PVOID
, DWORD
);
71 typedef BOOL (WINAPI
* PFWLXSCREENSAVERNOTIFY
) (PVOID
, BOOL
*);
72 typedef BOOL (WINAPI
* PFWLXSTARTAPPLICATION
) (PVOID
, PWSTR
, PVOID
, PWSTR
);
76 typedef BOOL (WINAPI
* PFWLXNETWORKPROVIDERLOAD
) (PVOID
, PWLX_MPR_NOTIFY_INFO
);
77 typedef BOOL (WINAPI
* PFWLXDISPLAYSTATUSMESSAGE
) (PVOID
, HDESK
, DWORD
, PWSTR
, PWSTR
);
78 typedef BOOL (WINAPI
* PFWLXGETSTATUSMESSAGE
) (PVOID
, DWORD
*, PWSTR
, DWORD
);
79 typedef BOOL (WINAPI
* PFWLXREMOVESTATUSMESSAGE
) (PVOID
);
81 typedef struct _GINAFUNCTIONS
83 /* Functions always available for a valid GINA */
84 PFWLXNEGOTIATE WlxNegotiate
; /* optional */
85 PFWLXINITIALIZE WlxInitialize
;
87 /* Functions available if WlxVersion >= WLX_VERSION_1_0 (MS Windows 3.5.0) */
88 PFWLXDISPLAYSASNOTICE WlxDisplaySASNotice
;
89 PFWLXLOGGEDOUTSAS WlxLoggedOutSAS
;
90 PFWLXACTIVATEUSERSHELL WlxActivateUserShell
;
91 PFWLXLOGGEDONSAS WlxLoggedOnSAS
;
92 PFWLXDISPLAYLOCKEDNOTICE WlxDisplayLockedNotice
;
93 PFWLXWKSTALOCKEDSAS WlxWkstaLockedSAS
;
94 PFWLXISLOCKOK WlxIsLockOk
;
95 PFWLXISLOGOFFOK WlxIsLogoffOk
;
96 PFWLXLOGOFF WlxLogoff
;
97 PFWLXSHUTDOWN WlxShutdown
;
99 /* Functions available if WlxVersion >= WLX_VERSION_1_1 (MS Windows 3.5.1) */
100 PFWLXSCREENSAVERNOTIFY WlxScreenSaverNotify
; /* optional */
101 PFWLXSTARTAPPLICATION WlxStartApplication
; /* optional */
103 /* Functions available if WlxVersion >= WLX_VERSION_1_2 (MS Windows NT 4.0) */
105 /* Functions available if WlxVersion >= WLX_VERSION_1_3 (MS Windows 2000) */
106 PFWLXNETWORKPROVIDERLOAD WlxNetworkProviderLoad
; /* not called ATM */
107 PFWLXDISPLAYSTATUSMESSAGE WlxDisplayStatusMessage
;
108 PFWLXGETSTATUSMESSAGE WlxGetStatusMessage
; /* doesn't need to be called */
109 PFWLXREMOVESTATUSMESSAGE WlxRemoveStatusMessage
;
111 /* Functions available if WlxVersion >= WLX_VERSION_1_4 (MS Windows XP) */
112 } GINAFUNCTIONS
, *PGINAFUNCTIONS
;
114 typedef struct _GINAINSTANCE
116 HMODULE hDllInstance
;
117 GINAFUNCTIONS Functions
;
120 BOOL UseCtrlAltDelete
;
121 } GINAINSTANCE
, *PGINAINSTANCE
;
125 * The picture Microsoft is trying to paint here
126 * (http://msdn.microsoft.com/en-us/library/windows/desktop/aa380547%28v=vs.85%29.aspx)
127 * about the Winlogon states is a little too simple.
129 * The real picture should look more like this:
132 * Initial state. Required for session initialization. After intialization,
133 * the state will automatically change to STATE_LOGGED_OFF.
136 * User is logged off. Winlogon shows the "Press Ctrl-Alt-Del for logon"
137 * dialog. The state changes to STATE_LOGGED_OFF_SAS when the user presses
138 * "Ctrl-Alt-Del". If DisableCAD is true, the state will automatically
139 * change to STATE_LOGGED_OFF_SAS without showing the dialog.
141 * STATE_LOGGED_OFF_SAS
142 * State shows the logon dialog. Entering the right credentials and pressing
143 * "OK" changes the state to STATE_LOGGED_ON. Pressing "Cancel" or a timeout
144 * changes the state back to STATE_LOGGED_OFF.
147 * User is logged on. Winlogon does not show any dialog. Pressing
148 * "Ctrl-Alt-Del" changes the state to STATE_LOGGED_ON_SAS and user
149 * inactivity changes the state to STATE_SCREENSAVER.
151 * STATE_LOGGED_ON_SAS
152 * Winlogon shows the security dialog. Pressing "Cancel" or "Task Manager"
153 * or a timeout change the state back to STATE_LOGGED_ON. Pressing "Change
154 * Password" does not change the state, because the security dialog is still
155 * visible behind the change password dialog. Pressing "Log off" changes the
156 * state to STATE_LOGGING_OFF. Pressing "Lock Computer" changes the state to
157 * STATE_LOCKED. Pressing "Shutdown" changes the state to
158 * STATE_SHUTTING_DOWN.
161 * Winlogon runs the screen saver. Upon user activity, the screensaver
162 * terminates and the state changes back to STATE_LOGGED_ON if the secure
163 * screen saver option is off. Otherwise, the state changes to STATE_LOCKED.
166 * Winlogon shows the logoff dialog. Pressing "Cancel" or a timeout changes
167 * the state back to STATE_LOGGED_ON_SAS. Pressing "OK" logs off the user
168 * and changes the state to STATE_LOGGED_OFF.
171 * Winlogon shows the locked message dialog. When the user presses "Ctrl-
172 * Alt-Del" the state changes to STATE_LOCKED_SAS. If DisableCAD is true,
173 * the state will automatically change to STATE_LOCKED_SAS without showing
177 * Winlogon shows the unlock dialog. Presing "Cancel" or a timeout will
178 * change the state back to STATE_LOCKED. Entering the right credentials and
179 * pressing "OK" unlocks the computer and changes the state to
182 * STATE_SHUTTING_DOWN
183 * Winlogon shows the shutdown dialog. Presing "Cancel" or a timeout will
184 * change the state back to STATE_LOGGED_ON_SAS. Pressing "OK" will change
185 * the state to STATE_SHUT_DOWN.
188 * Terminates Winlogon and initiates shut-down.
190 typedef enum _LOGON_STATE
192 STATE_INIT
, // not used yet
194 STATE_LOGGED_OFF_SAS
, // not used yet
196 STATE_LOGGED_ON_SAS
, // not used yet
197 STATE_SCREENSAVER
, // not used yet
199 STATE_LOCKED_SAS
, // not used yet
200 STATE_LOGGING_OFF
, // not used yet
201 STATE_SHUTTING_DOWN
, // not used yet
202 STATE_SHUT_DOWN
// not used yet
203 } LOGON_STATE
, *PLOGON_STATE
;
205 #define LockWorkstation(Session)
206 #define UnlockWorkstation(Session)
208 typedef struct _WLSESSION
215 HWINSTA InteractiveWindowStation
;
216 LPWSTR InteractiveWindowStationName
;
217 HDESK ApplicationDesktop
;
218 HDESK WinlogonDesktop
;
219 HDESK ScreenSaverDesktop
;
223 LOGON_STATE LogonState
;
224 DWORD DialogTimeout
; /* Timeout for dialog boxes, in seconds */
226 /* Screen-saver informations */
227 #ifndef USE_GETLASTINPUTINFO
231 HANDLE hEndOfScreenSaverThread
;
232 HANDLE hScreenSaverParametersChanged
;
233 HANDLE hUserActivity
;
234 HANDLE hEndOfScreenSaver
;
235 #ifndef USE_GETLASTINPUTINFO
239 /* Logon informations */
241 WLX_MPR_NOTIFY_INFO MprNotifyInfo
;
242 WLX_PROFILE_V2_0
*Profile
;
243 } WLSESSION
, *PWLSESSION
;
245 extern HINSTANCE hAppInstance
;
246 extern PWLSESSION WLSession
;
248 #define WLX_SHUTTINGDOWN(Status) \
249 (((Status) == WLX_SAS_ACTION_SHUTDOWN) || \
250 ((Status) == WLX_SAS_ACTION_SHUTDOWN_POWER_OFF) || \
251 ((Status) == WLX_SAS_ACTION_SHUTDOWN_REBOOT) \
254 #define WLX_SUSPENDING(Status) \
255 (((Status) == WLX_SAS_ACTION_SHUTDOWN_SLEEP) || \
256 ((Status) == WLX_SAS_ACTION_SHUTDOWN_SLEEP2) || \
257 ((Status) == WLX_SAS_ACTION_SHUTDOWN_HIBERNATE) \
262 CreateUserEnvironment(IN PWLSESSION Session
);
266 SetDefaultLanguage(IN BOOL UserProfile
);
269 InitializeSAS(IN OUT PWLSESSION Session
);
273 InitializeScreenSaver(IN OUT PWLSESSION Session
);
276 StartScreenSaver(IN PWLSESSION Session
);
281 PlaySoundRoutine(IN LPCWSTR FileName
,
286 DisplayStatusMessage(IN PWLSESSION Session
,
291 RemoveStatusMessage(IN PWLSESSION Session
);
295 InitDialogListHead(VOID
);
298 GetTopDialogWindow(VOID
);
301 GinaInit(IN OUT PWLSESSION Session
);
304 CreateWindowStationAndDesktops(IN OUT PWLSESSION Session
);
307 HandleShutdown(IN OUT PWLSESSION Session
,
310 VOID WINAPI
WlxUseCtrlAltDel(HANDLE hWlx
);
311 VOID WINAPI
WlxSetContextPointer(HANDLE hWlx
, PVOID pWlxContext
);
312 VOID WINAPI
WlxSasNotify(HANDLE hWlx
, DWORD dwSasType
);
313 BOOL WINAPI
WlxSetTimeout(HANDLE hWlx
, DWORD Timeout
);
314 int WINAPI
WlxAssignShellProtection(HANDLE hWlx
, HANDLE hToken
, HANDLE hProcess
, HANDLE hThread
);
315 int WINAPI
WlxMessageBox(HANDLE hWlx
, HWND hwndOwner
, LPWSTR lpszText
, LPWSTR lpszTitle
, UINT fuStyle
);
316 int WINAPI
WlxDialogBox(HANDLE hWlx
, HANDLE hInst
, LPWSTR lpszTemplate
, HWND hwndOwner
, DLGPROC dlgprc
);
317 int WINAPI
WlxDialogBoxParam(HANDLE hWlx
, HANDLE hInst
, LPWSTR lpszTemplate
, HWND hwndOwner
, DLGPROC dlgprc
, LPARAM dwInitParam
);
318 int WINAPI
WlxDialogBoxIndirect(HANDLE hWlx
, HANDLE hInst
, LPCDLGTEMPLATE hDialogTemplate
, HWND hwndOwner
, DLGPROC dlgprc
);
319 int WINAPI
WlxDialogBoxIndirectParam(HANDLE hWlx
, HANDLE hInst
, LPCDLGTEMPLATE hDialogTemplate
, HWND hwndOwner
, DLGPROC dlgprc
, LPARAM dwInitParam
);
320 int WINAPI
WlxSwitchDesktopToUser(HANDLE hWlx
);
321 int WINAPI
WlxSwitchDesktopToWinlogon(HANDLE hWlx
);
322 int WINAPI
WlxChangePasswordNotify(HANDLE hWlx
, PWLX_MPR_NOTIFY_INFO pMprInfo
, DWORD dwChangeInfo
);
323 BOOL WINAPI
WlxGetSourceDesktop(HANDLE hWlx
, PWLX_DESKTOP
* ppDesktop
);
324 BOOL WINAPI
WlxSetReturnDesktop(HANDLE hWlx
, PWLX_DESKTOP pDesktop
);
325 BOOL WINAPI
WlxCreateUserDesktop(HANDLE hWlx
, HANDLE hToken
, DWORD Flags
, PWSTR pszDesktopName
, PWLX_DESKTOP
* ppDesktop
);
326 int WINAPI
WlxChangePasswordNotifyEx(HANDLE hWlx
, PWLX_MPR_NOTIFY_INFO pMprInfo
, DWORD dwChangeInfo
, PWSTR ProviderName
, PVOID Reserved
);
327 BOOL WINAPI
WlxCloseUserDesktop(HANDLE hWlx
, PWLX_DESKTOP pDesktop
, HANDLE hToken
);
328 BOOL WINAPI
WlxSetOption(HANDLE hWlx
, DWORD Option
, ULONG_PTR Value
, ULONG_PTR
* OldValue
);
329 BOOL WINAPI
WlxGetOption(HANDLE hWlx
, DWORD Option
, ULONG_PTR
* Value
);
330 VOID WINAPI
WlxWin31Migrate(HANDLE hWlx
);
331 BOOL WINAPI
WlxQueryClientCredentials(PWLX_CLIENT_CREDENTIALS_INFO_V1_0 pCred
);
332 BOOL WINAPI
WlxQueryInetConnectorCredentials(PWLX_CLIENT_CREDENTIALS_INFO_V1_0 pCred
);
333 DWORD WINAPI
WlxQueryConsoleSwitchCredentials(PWLX_CONSOLESWITCH_CREDENTIALS_INFO_V1_0 pCred
);
334 BOOL WINAPI
WlxQueryTsLogonCredentials(PWLX_CLIENT_CREDENTIALS_INFO_V2_0 pCred
);
335 BOOL WINAPI
WlxDisconnect(VOID
);
336 DWORD WINAPI
WlxQueryTerminalServicesData(HANDLE hWlx
, PWLX_TERMINAL_SERVICES_DATA pTSData
, WCHAR
* UserName
, WCHAR
* Domain
);
338 #endif /* __WINLOGON_MAIN_H__ */