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>
49 IN HWINSTA hWindowStation
,
51 IN PSID psid OPTIONAL
,
54 #include <wine/debug.h>
55 WINE_DEFAULT_DEBUG_CHANNEL(winlogon
);
59 typedef BOOL (WINAPI
* PFWLXNEGOTIATE
) (DWORD
, DWORD
*);
60 typedef BOOL (WINAPI
* PFWLXINITIALIZE
) (LPWSTR
, HANDLE
, PVOID
, PVOID
, PVOID
*);
61 typedef VOID (WINAPI
* PFWLXDISPLAYSASNOTICE
) (PVOID
);
62 typedef int (WINAPI
* PFWLXLOGGEDOUTSAS
) (PVOID
, DWORD
, PLUID
, PSID
, PDWORD
,
63 PHANDLE
, PWLX_MPR_NOTIFY_INFO
,
65 typedef BOOL (WINAPI
* PFWLXACTIVATEUSERSHELL
) (PVOID
, PWSTR
, PWSTR
, PVOID
);
66 typedef int (WINAPI
* PFWLXLOGGEDONSAS
) (PVOID
, DWORD
, PVOID
);
67 typedef VOID (WINAPI
* PFWLXDISPLAYLOCKEDNOTICE
) (PVOID
);
68 typedef int (WINAPI
* PFWLXWKSTALOCKEDSAS
) (PVOID
, DWORD
);
69 typedef BOOL (WINAPI
* PFWLXISLOCKOK
) (PVOID
);
70 typedef BOOL (WINAPI
* PFWLXISLOGOFFOK
) (PVOID
);
71 typedef VOID (WINAPI
* PFWLXLOGOFF
) (PVOID
);
72 typedef VOID (WINAPI
* PFWLXSHUTDOWN
) (PVOID
, DWORD
);
76 typedef BOOL (WINAPI
* PFWLXSCREENSAVERNOTIFY
) (PVOID
, BOOL
*);
77 typedef BOOL (WINAPI
* PFWLXSTARTAPPLICATION
) (PVOID
, PWSTR
, PVOID
, PWSTR
);
81 typedef BOOL (WINAPI
* PFWLXNETWORKPROVIDERLOAD
) (PVOID
, PWLX_MPR_NOTIFY_INFO
);
82 typedef BOOL (WINAPI
* PFWLXDISPLAYSTATUSMESSAGE
) (PVOID
, HDESK
, DWORD
, PWSTR
, PWSTR
);
83 typedef BOOL (WINAPI
* PFWLXGETSTATUSMESSAGE
) (PVOID
, DWORD
*, PWSTR
, DWORD
);
84 typedef BOOL (WINAPI
* PFWLXREMOVESTATUSMESSAGE
) (PVOID
);
86 typedef struct _GINAFUNCTIONS
88 /* Functions always available for a valid GINA */
89 PFWLXNEGOTIATE WlxNegotiate
; /* optional */
90 PFWLXINITIALIZE WlxInitialize
;
92 /* Functions available if WlxVersion >= WLX_VERSION_1_0 (MS Windows 3.5.0) */
93 PFWLXDISPLAYSASNOTICE WlxDisplaySASNotice
;
94 PFWLXLOGGEDOUTSAS WlxLoggedOutSAS
;
95 PFWLXACTIVATEUSERSHELL WlxActivateUserShell
;
96 PFWLXLOGGEDONSAS WlxLoggedOnSAS
;
97 PFWLXDISPLAYLOCKEDNOTICE WlxDisplayLockedNotice
;
98 PFWLXWKSTALOCKEDSAS WlxWkstaLockedSAS
;
99 PFWLXISLOCKOK WlxIsLockOk
;
100 PFWLXISLOGOFFOK WlxIsLogoffOk
;
101 PFWLXLOGOFF WlxLogoff
;
102 PFWLXSHUTDOWN WlxShutdown
;
104 /* Functions available if WlxVersion >= WLX_VERSION_1_1 (MS Windows 3.5.1) */
105 PFWLXSCREENSAVERNOTIFY WlxScreenSaverNotify
; /* optional */
106 PFWLXSTARTAPPLICATION WlxStartApplication
; /* optional */
108 /* Functions available if WlxVersion >= WLX_VERSION_1_2 (MS Windows NT 4.0) */
110 /* Functions available if WlxVersion >= WLX_VERSION_1_3 (MS Windows 2000) */
111 PFWLXNETWORKPROVIDERLOAD WlxNetworkProviderLoad
; /* not called ATM */
112 PFWLXDISPLAYSTATUSMESSAGE WlxDisplayStatusMessage
;
113 PFWLXGETSTATUSMESSAGE WlxGetStatusMessage
; /* doesn't need to be called */
114 PFWLXREMOVESTATUSMESSAGE WlxRemoveStatusMessage
;
116 /* Functions available if WlxVersion >= WLX_VERSION_1_4 (MS Windows XP) */
117 } GINAFUNCTIONS
, *PGINAFUNCTIONS
;
119 typedef struct _GINAINSTANCE
121 HMODULE hDllInstance
;
122 GINAFUNCTIONS Functions
;
125 BOOL UseCtrlAltDelete
;
126 } GINAINSTANCE
, *PGINAINSTANCE
;
130 * The picture Microsoft is trying to paint here
131 * (http://msdn.microsoft.com/en-us/library/windows/desktop/aa380547%28v=vs.85%29.aspx)
132 * about the Winlogon states is a little too simple.
134 * The real picture should look more like this:
137 * Initial state. Required for session initialization. After initialization,
138 * the state will automatically change to STATE_LOGGED_OFF.
141 * User is logged off. Winlogon shows the "Press Ctrl-Alt-Del for logon"
142 * dialog. The state changes to STATE_LOGGED_OFF_SAS when the user presses
143 * "Ctrl-Alt-Del". If DisableCAD is true, the state will automatically
144 * change to STATE_LOGGED_OFF_SAS without showing the dialog.
146 * STATE_LOGGED_OFF_SAS
147 * State shows the logon dialog. Entering the right credentials and pressing
148 * "OK" changes the state to STATE_LOGGED_ON. Pressing "Cancel" or a timeout
149 * changes the state back to STATE_LOGGED_OFF.
152 * User is logged on. Winlogon does not show any dialog. Pressing
153 * "Ctrl-Alt-Del" changes the state to STATE_LOGGED_ON_SAS and user
154 * inactivity changes the state to STATE_SCREENSAVER.
156 * STATE_LOGGED_ON_SAS
157 * Winlogon shows the security dialog. Pressing "Cancel" or "Task Manager"
158 * or a timeout change the state back to STATE_LOGGED_ON. Pressing "Change
159 * Password" does not change the state, because the security dialog is still
160 * visible behind the change password dialog. Pressing "Log off" changes the
161 * state to STATE_LOGGING_OFF. Pressing "Lock Computer" changes the state to
162 * STATE_LOCKED. Pressing "Shutdown" changes the state to
163 * STATE_SHUTTING_DOWN.
166 * Winlogon shows the locked message dialog. When the user presses "Ctrl-
167 * Alt-Del" the state changes to STATE_LOCKED_SAS. If DisableCAD is true,
168 * the state will automatically change to STATE_LOCKED_SAS without showing
172 * Winlogon shows the unlock dialog. Pressing "Cancel" or a timeout will
173 * change the state back to STATE_LOCKED. Entering the right credentials and
174 * pressing "OK" unlocks the computer and changes the state to
178 * Winlogon shows the logoff dialog. Pressing "Cancel" or a timeout changes
179 * the state back to STATE_LOGGED_ON_SAS. Pressing "OK" logs off the user
180 * and changes the state to STATE_LOGGED_OFF.
182 * STATE_SHUTTING_DOWN
183 * Winlogon shows the shutdown dialog. Pressing "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.
191 * Winlogon runs the screen saver. Upon user activity, the screensaver
192 * terminates and the state changes back to STATE_LOGGED_ON if the secure
193 * screen saver option is off. Otherwise, the state changes to STATE_LOCKED.
195 typedef enum _LOGON_STATE
199 STATE_LOGGED_OFF_SAS
,
204 STATE_LOGGING_OFF
, // not used yet
205 STATE_SHUTTING_DOWN
, // not used yet
206 STATE_SHUT_DOWN
, // not used yet
207 STATE_SCREENSAVER
// not used yet
208 } LOGON_STATE
, *PLOGON_STATE
;
210 #define LockWorkstation(Session)
211 #define UnlockWorkstation(Session)
213 typedef struct _WLSESSION
220 HWINSTA InteractiveWindowStation
;
221 LPWSTR InteractiveWindowStationName
;
222 HDESK ApplicationDesktop
;
223 HDESK WinlogonDesktop
;
224 HDESK ScreenSaverDesktop
;
228 LOGON_STATE LogonState
;
229 DWORD DialogTimeout
; /* Timeout for dialog boxes, in seconds */
231 /* Screen-saver informations */
232 #ifndef USE_GETLASTINPUTINFO
236 HANDLE hEndOfScreenSaverThread
;
237 HANDLE hScreenSaverParametersChanged
;
238 HANDLE hUserActivity
;
239 HANDLE hEndOfScreenSaver
;
240 #ifndef USE_GETLASTINPUTINFO
244 /* Logon informations */
246 WLX_MPR_NOTIFY_INFO MprNotifyInfo
;
247 WLX_PROFILE_V2_0
*Profile
;
248 } WLSESSION
, *PWLSESSION
;
250 typedef enum _NOTIFICATION_TYPE
258 StartScreenSaverHandler
,
259 StopScreenSaverHandler
,
265 } NOTIFICATION_TYPE
, *PNOTIFICATION_TYPE
;
267 extern HINSTANCE hAppInstance
;
268 extern PWLSESSION WLSession
;
270 #define WLX_SHUTTINGDOWN(Status) \
271 (((Status) == WLX_SAS_ACTION_SHUTDOWN) || \
272 ((Status) == WLX_SAS_ACTION_SHUTDOWN_POWER_OFF) || \
273 ((Status) == WLX_SAS_ACTION_SHUTDOWN_REBOOT) \
276 #define WLX_SUSPENDING(Status) \
277 (((Status) == WLX_SAS_ACTION_SHUTDOWN_SLEEP) || \
278 ((Status) == WLX_SAS_ACTION_SHUTDOWN_SLEEP2) || \
279 ((Status) == WLX_SAS_ACTION_SHUTDOWN_HIBERNATE) \
284 CreateUserEnvironment(IN PWLSESSION Session
);
288 InitNotifications(VOID
);
291 CleanupNotifications(VOID
);
294 CallNotificationDlls(
296 NOTIFICATION_TYPE Type
);
300 StartRpcServer(VOID
);
303 extern LUID LuidNone
;
306 SetDefaultLanguage(IN PWLSESSION Session
);
309 HandleShutdown(IN OUT PWLSESSION Session
,
313 InitializeSAS(IN OUT PWLSESSION Session
);
317 InitializeScreenSaver(IN OUT PWLSESSION Session
);
320 StartScreenSaver(IN PWLSESSION Session
);
331 TerminateSystemShutdown(VOID
);
335 PUNICODE_STRING lpMessage
,
337 BOOLEAN bForceAppsClosed
,
338 BOOLEAN bRebootAfterShutdown
,
343 PlaySoundRoutine(IN LPCWSTR FileName
,
348 DisplayStatusMessage(IN PWLSESSION Session
,
353 RemoveStatusMessage(IN PWLSESSION Session
);
357 InitDialogListHead(VOID
);
360 CloseAllDialogWindows(VOID
);
363 GinaInit(IN OUT PWLSESSION Session
);
366 AddAceToWindowStation(
371 CreateWindowStationAndDesktops(IN OUT PWLSESSION Session
);
374 VOID WINAPI
WlxUseCtrlAltDel(HANDLE hWlx
);
375 VOID WINAPI
WlxSetContextPointer(HANDLE hWlx
, PVOID pWlxContext
);
376 VOID WINAPI
WlxSasNotify(HANDLE hWlx
, DWORD dwSasType
);
377 BOOL WINAPI
WlxSetTimeout(HANDLE hWlx
, DWORD Timeout
);
378 int WINAPI
WlxAssignShellProtection(HANDLE hWlx
, HANDLE hToken
, HANDLE hProcess
, HANDLE hThread
);
379 int WINAPI
WlxMessageBox(HANDLE hWlx
, HWND hwndOwner
, LPWSTR lpszText
, LPWSTR lpszTitle
, UINT fuStyle
);
380 int WINAPI
WlxDialogBox(HANDLE hWlx
, HANDLE hInst
, LPWSTR lpszTemplate
, HWND hwndOwner
, DLGPROC dlgprc
);
381 int WINAPI
WlxDialogBoxParam(HANDLE hWlx
, HANDLE hInst
, LPWSTR lpszTemplate
, HWND hwndOwner
, DLGPROC dlgprc
, LPARAM dwInitParam
);
382 int WINAPI
WlxDialogBoxIndirect(HANDLE hWlx
, HANDLE hInst
, LPCDLGTEMPLATE hDialogTemplate
, HWND hwndOwner
, DLGPROC dlgprc
);
383 int WINAPI
WlxDialogBoxIndirectParam(HANDLE hWlx
, HANDLE hInst
, LPCDLGTEMPLATE hDialogTemplate
, HWND hwndOwner
, DLGPROC dlgprc
, LPARAM dwInitParam
);
384 int WINAPI
WlxSwitchDesktopToUser(HANDLE hWlx
);
385 int WINAPI
WlxSwitchDesktopToWinlogon(HANDLE hWlx
);
386 int WINAPI
WlxChangePasswordNotify(HANDLE hWlx
, PWLX_MPR_NOTIFY_INFO pMprInfo
, DWORD dwChangeInfo
);
387 BOOL WINAPI
WlxGetSourceDesktop(HANDLE hWlx
, PWLX_DESKTOP
* ppDesktop
);
388 BOOL WINAPI
WlxSetReturnDesktop(HANDLE hWlx
, PWLX_DESKTOP pDesktop
);
389 BOOL WINAPI
WlxCreateUserDesktop(HANDLE hWlx
, HANDLE hToken
, DWORD Flags
, PWSTR pszDesktopName
, PWLX_DESKTOP
* ppDesktop
);
390 int WINAPI
WlxChangePasswordNotifyEx(HANDLE hWlx
, PWLX_MPR_NOTIFY_INFO pMprInfo
, DWORD dwChangeInfo
, PWSTR ProviderName
, PVOID Reserved
);
391 BOOL WINAPI
WlxCloseUserDesktop(HANDLE hWlx
, PWLX_DESKTOP pDesktop
, HANDLE hToken
);
392 BOOL WINAPI
WlxSetOption(HANDLE hWlx
, DWORD Option
, ULONG_PTR Value
, ULONG_PTR
* OldValue
);
393 BOOL WINAPI
WlxGetOption(HANDLE hWlx
, DWORD Option
, ULONG_PTR
* Value
);
394 VOID WINAPI
WlxWin31Migrate(HANDLE hWlx
);
395 BOOL WINAPI
WlxQueryClientCredentials(PWLX_CLIENT_CREDENTIALS_INFO_V1_0 pCred
);
396 BOOL WINAPI
WlxQueryInetConnectorCredentials(PWLX_CLIENT_CREDENTIALS_INFO_V1_0 pCred
);
397 DWORD WINAPI
WlxQueryConsoleSwitchCredentials(PWLX_CONSOLESWITCH_CREDENTIALS_INFO_V1_0 pCred
);
398 BOOL WINAPI
WlxQueryTsLogonCredentials(PWLX_CLIENT_CREDENTIALS_INFO_V2_0 pCred
);
399 BOOL WINAPI
WlxDisconnect(VOID
);
400 DWORD WINAPI
WlxQueryTerminalServicesData(HANDLE hWlx
, PWLX_TERMINAL_SERVICES_DATA pTSData
, WCHAR
* UserName
, WCHAR
* Domain
);
402 #endif /* __WINLOGON_MAIN_H__ */