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>
46 #include <wine/debug.h>
47 WINE_DEFAULT_DEBUG_CHANNEL(winlogon
);
51 typedef BOOL (WINAPI
* PFWLXNEGOTIATE
) (DWORD
, DWORD
*);
52 typedef BOOL (WINAPI
* PFWLXINITIALIZE
) (LPWSTR
, HANDLE
, PVOID
, PVOID
, PVOID
*);
53 typedef VOID (WINAPI
* PFWLXDISPLAYSASNOTICE
) (PVOID
);
54 typedef int (WINAPI
* PFWLXLOGGEDOUTSAS
) (PVOID
, DWORD
, PLUID
, PSID
, PDWORD
,
55 PHANDLE
, PWLX_MPR_NOTIFY_INFO
,
57 typedef BOOL (WINAPI
* PFWLXACTIVATEUSERSHELL
) (PVOID
, PWSTR
, PWSTR
, PVOID
);
58 typedef int (WINAPI
* PFWLXLOGGEDONSAS
) (PVOID
, DWORD
, PVOID
);
59 typedef VOID (WINAPI
* PFWLXDISPLAYLOCKEDNOTICE
) (PVOID
);
60 typedef int (WINAPI
* PFWLXWKSTALOCKEDSAS
) (PVOID
, DWORD
);
61 typedef BOOL (WINAPI
* PFWLXISLOCKOK
) (PVOID
);
62 typedef BOOL (WINAPI
* PFWLXISLOGOFFOK
) (PVOID
);
63 typedef VOID (WINAPI
* PFWLXLOGOFF
) (PVOID
);
64 typedef VOID (WINAPI
* PFWLXSHUTDOWN
) (PVOID
, DWORD
);
68 typedef BOOL (WINAPI
* PFWLXSCREENSAVERNOTIFY
) (PVOID
, BOOL
*);
69 typedef BOOL (WINAPI
* PFWLXSTARTAPPLICATION
) (PVOID
, PWSTR
, PVOID
, PWSTR
);
73 typedef BOOL (WINAPI
* PFWLXNETWORKPROVIDERLOAD
) (PVOID
, PWLX_MPR_NOTIFY_INFO
);
74 typedef BOOL (WINAPI
* PFWLXDISPLAYSTATUSMESSAGE
) (PVOID
, HDESK
, DWORD
, PWSTR
, PWSTR
);
75 typedef BOOL (WINAPI
* PFWLXGETSTATUSMESSAGE
) (PVOID
, DWORD
*, PWSTR
, DWORD
);
76 typedef BOOL (WINAPI
* PFWLXREMOVESTATUSMESSAGE
) (PVOID
);
78 typedef struct _GINAFUNCTIONS
80 /* Functions always available for a valid GINA */
81 PFWLXNEGOTIATE WlxNegotiate
; /* optional */
82 PFWLXINITIALIZE WlxInitialize
;
84 /* Functions available if WlxVersion >= WLX_VERSION_1_0 (MS Windows 3.5.0) */
85 PFWLXDISPLAYSASNOTICE WlxDisplaySASNotice
;
86 PFWLXLOGGEDOUTSAS WlxLoggedOutSAS
;
87 PFWLXACTIVATEUSERSHELL WlxActivateUserShell
;
88 PFWLXLOGGEDONSAS WlxLoggedOnSAS
;
89 PFWLXDISPLAYLOCKEDNOTICE WlxDisplayLockedNotice
;
90 PFWLXWKSTALOCKEDSAS WlxWkstaLockedSAS
;
91 PFWLXISLOCKOK WlxIsLockOk
;
92 PFWLXISLOGOFFOK WlxIsLogoffOk
;
93 PFWLXLOGOFF WlxLogoff
;
94 PFWLXSHUTDOWN WlxShutdown
;
96 /* Functions available if WlxVersion >= WLX_VERSION_1_1 (MS Windows 3.5.1) */
97 PFWLXSCREENSAVERNOTIFY WlxScreenSaverNotify
; /* optional */
98 PFWLXSTARTAPPLICATION WlxStartApplication
; /* optional */
100 /* Functions available if WlxVersion >= WLX_VERSION_1_2 (MS Windows NT 4.0) */
102 /* Functions available if WlxVersion >= WLX_VERSION_1_3 (MS Windows 2000) */
103 PFWLXNETWORKPROVIDERLOAD WlxNetworkProviderLoad
; /* not called ATM */
104 PFWLXDISPLAYSTATUSMESSAGE WlxDisplayStatusMessage
;
105 PFWLXGETSTATUSMESSAGE WlxGetStatusMessage
; /* doesn't need to be called */
106 PFWLXREMOVESTATUSMESSAGE WlxRemoveStatusMessage
;
108 /* Functions available if WlxVersion >= WLX_VERSION_1_4 (MS Windows XP) */
109 } GINAFUNCTIONS
, *PGINAFUNCTIONS
;
111 typedef struct _GINAINSTANCE
113 HMODULE hDllInstance
;
114 GINAFUNCTIONS Functions
;
117 BOOL UseCtrlAltDelete
;
118 } GINAINSTANCE
, *PGINAINSTANCE
;
122 * The picture Microsoft is trying to paint here
123 * (http://msdn.microsoft.com/en-us/library/windows/desktop/aa380547%28v=vs.85%29.aspx)
124 * about the Winlogon states is a little too simple.
126 * The real picture should look more like this:
129 * Initial state. Required for session initialization. After initialization,
130 * the state will automatically change to STATE_LOGGED_OFF.
133 * User is logged off. Winlogon shows the "Press Ctrl-Alt-Del for logon"
134 * dialog. The state changes to STATE_LOGGED_OFF_SAS when the user presses
135 * "Ctrl-Alt-Del". If DisableCAD is true, the state will automatically
136 * change to STATE_LOGGED_OFF_SAS without showing the dialog.
138 * STATE_LOGGED_OFF_SAS
139 * State shows the logon dialog. Entering the right credentials and pressing
140 * "OK" changes the state to STATE_LOGGED_ON. Pressing "Cancel" or a timeout
141 * changes the state back to STATE_LOGGED_OFF.
144 * User is logged on. Winlogon does not show any dialog. Pressing
145 * "Ctrl-Alt-Del" changes the state to STATE_LOGGED_ON_SAS and user
146 * inactivity changes the state to STATE_SCREENSAVER.
148 * STATE_LOGGED_ON_SAS
149 * Winlogon shows the security dialog. Pressing "Cancel" or "Task Manager"
150 * or a timeout change the state back to STATE_LOGGED_ON. Pressing "Change
151 * Password" does not change the state, because the security dialog is still
152 * visible behind the change password dialog. Pressing "Log off" changes the
153 * state to STATE_LOGGING_OFF. Pressing "Lock Computer" changes the state to
154 * STATE_LOCKED. Pressing "Shutdown" changes the state to
155 * STATE_SHUTTING_DOWN.
158 * Winlogon shows the locked message dialog. When the user presses "Ctrl-
159 * Alt-Del" the state changes to STATE_LOCKED_SAS. If DisableCAD is true,
160 * the state will automatically change to STATE_LOCKED_SAS without showing
164 * Winlogon shows the unlock dialog. Pressing "Cancel" or a timeout will
165 * change the state back to STATE_LOCKED. Entering the right credentials and
166 * pressing "OK" unlocks the computer and changes the state to
170 * Winlogon shows the logoff dialog. Pressing "Cancel" or a timeout changes
171 * the state back to STATE_LOGGED_ON_SAS. Pressing "OK" logs off the user
172 * and changes the state to STATE_LOGGED_OFF.
174 * STATE_SHUTTING_DOWN
175 * Winlogon shows the shutdown dialog. Pressing "Cancel" or a timeout will
176 * change the state back to STATE_LOGGED_ON_SAS. Pressing "OK" will change
177 * the state to STATE_SHUT_DOWN.
180 * Terminates Winlogon and initiates shut-down.
183 * Winlogon runs the screen saver. Upon user activity, the screensaver
184 * terminates and the state changes back to STATE_LOGGED_ON if the secure
185 * screen saver option is off. Otherwise, the state changes to STATE_LOCKED.
187 typedef enum _LOGON_STATE
191 STATE_LOGGED_OFF_SAS
,
196 STATE_LOGGING_OFF
, // not used yet
197 STATE_SHUTTING_DOWN
, // not used yet
198 STATE_SHUT_DOWN
, // not used yet
199 STATE_SCREENSAVER
// not used yet
200 } LOGON_STATE
, *PLOGON_STATE
;
202 #define LockWorkstation(Session)
203 #define UnlockWorkstation(Session)
205 typedef struct _WLSESSION
212 HWINSTA InteractiveWindowStation
;
213 LPWSTR InteractiveWindowStationName
;
214 HDESK ApplicationDesktop
;
215 HDESK WinlogonDesktop
;
216 HDESK ScreenSaverDesktop
;
220 LOGON_STATE LogonState
;
221 DWORD DialogTimeout
; /* Timeout for dialog boxes, in seconds */
223 /* Screen-saver informations */
224 #ifndef USE_GETLASTINPUTINFO
228 HANDLE hEndOfScreenSaverThread
;
229 HANDLE hScreenSaverParametersChanged
;
230 HANDLE hUserActivity
;
231 HANDLE hEndOfScreenSaver
;
232 #ifndef USE_GETLASTINPUTINFO
236 /* Logon informations */
238 WLX_MPR_NOTIFY_INFO MprNotifyInfo
;
239 WLX_PROFILE_V2_0
*Profile
;
240 } WLSESSION
, *PWLSESSION
;
242 typedef enum _NOTIFICATION_TYPE
250 StartScreenSaverHandler
,
251 StopScreenSaverHandler
,
257 } NOTIFICATION_TYPE
, *PNOTIFICATION_TYPE
;
259 extern HINSTANCE hAppInstance
;
260 extern PWLSESSION WLSession
;
262 #define WLX_SHUTTINGDOWN(Status) \
263 (((Status) == WLX_SAS_ACTION_SHUTDOWN) || \
264 ((Status) == WLX_SAS_ACTION_SHUTDOWN_POWER_OFF) || \
265 ((Status) == WLX_SAS_ACTION_SHUTDOWN_REBOOT) \
268 #define WLX_SUSPENDING(Status) \
269 (((Status) == WLX_SAS_ACTION_SHUTDOWN_SLEEP) || \
270 ((Status) == WLX_SAS_ACTION_SHUTDOWN_SLEEP2) || \
271 ((Status) == WLX_SAS_ACTION_SHUTDOWN_HIBERNATE) \
276 CreateUserEnvironment(IN PWLSESSION Session
);
280 InitNotifications(VOID
);
283 CleanupNotifications(VOID
);
286 CallNotificationDlls(
288 NOTIFICATION_TYPE Type
);
292 StartRpcServer(VOID
);
296 SetDefaultLanguage(IN PWLSESSION Session
);
299 InitializeSAS(IN OUT PWLSESSION Session
);
303 InitializeScreenSaver(IN OUT PWLSESSION Session
);
306 StartScreenSaver(IN PWLSESSION Session
);
317 PlaySoundRoutine(IN LPCWSTR FileName
,
322 DisplayStatusMessage(IN PWLSESSION Session
,
327 RemoveStatusMessage(IN PWLSESSION Session
);
331 InitDialogListHead(VOID
);
334 GetTopDialogWindow(VOID
);
337 GinaInit(IN OUT PWLSESSION Session
);
340 CreateWindowStationAndDesktops(IN OUT PWLSESSION Session
);
343 HandleShutdown(IN OUT PWLSESSION Session
,
346 VOID WINAPI
WlxUseCtrlAltDel(HANDLE hWlx
);
347 VOID WINAPI
WlxSetContextPointer(HANDLE hWlx
, PVOID pWlxContext
);
348 VOID WINAPI
WlxSasNotify(HANDLE hWlx
, DWORD dwSasType
);
349 BOOL WINAPI
WlxSetTimeout(HANDLE hWlx
, DWORD Timeout
);
350 int WINAPI
WlxAssignShellProtection(HANDLE hWlx
, HANDLE hToken
, HANDLE hProcess
, HANDLE hThread
);
351 int WINAPI
WlxMessageBox(HANDLE hWlx
, HWND hwndOwner
, LPWSTR lpszText
, LPWSTR lpszTitle
, UINT fuStyle
);
352 int WINAPI
WlxDialogBox(HANDLE hWlx
, HANDLE hInst
, LPWSTR lpszTemplate
, HWND hwndOwner
, DLGPROC dlgprc
);
353 int WINAPI
WlxDialogBoxParam(HANDLE hWlx
, HANDLE hInst
, LPWSTR lpszTemplate
, HWND hwndOwner
, DLGPROC dlgprc
, LPARAM dwInitParam
);
354 int WINAPI
WlxDialogBoxIndirect(HANDLE hWlx
, HANDLE hInst
, LPCDLGTEMPLATE hDialogTemplate
, HWND hwndOwner
, DLGPROC dlgprc
);
355 int WINAPI
WlxDialogBoxIndirectParam(HANDLE hWlx
, HANDLE hInst
, LPCDLGTEMPLATE hDialogTemplate
, HWND hwndOwner
, DLGPROC dlgprc
, LPARAM dwInitParam
);
356 int WINAPI
WlxSwitchDesktopToUser(HANDLE hWlx
);
357 int WINAPI
WlxSwitchDesktopToWinlogon(HANDLE hWlx
);
358 int WINAPI
WlxChangePasswordNotify(HANDLE hWlx
, PWLX_MPR_NOTIFY_INFO pMprInfo
, DWORD dwChangeInfo
);
359 BOOL WINAPI
WlxGetSourceDesktop(HANDLE hWlx
, PWLX_DESKTOP
* ppDesktop
);
360 BOOL WINAPI
WlxSetReturnDesktop(HANDLE hWlx
, PWLX_DESKTOP pDesktop
);
361 BOOL WINAPI
WlxCreateUserDesktop(HANDLE hWlx
, HANDLE hToken
, DWORD Flags
, PWSTR pszDesktopName
, PWLX_DESKTOP
* ppDesktop
);
362 int WINAPI
WlxChangePasswordNotifyEx(HANDLE hWlx
, PWLX_MPR_NOTIFY_INFO pMprInfo
, DWORD dwChangeInfo
, PWSTR ProviderName
, PVOID Reserved
);
363 BOOL WINAPI
WlxCloseUserDesktop(HANDLE hWlx
, PWLX_DESKTOP pDesktop
, HANDLE hToken
);
364 BOOL WINAPI
WlxSetOption(HANDLE hWlx
, DWORD Option
, ULONG_PTR Value
, ULONG_PTR
* OldValue
);
365 BOOL WINAPI
WlxGetOption(HANDLE hWlx
, DWORD Option
, ULONG_PTR
* Value
);
366 VOID WINAPI
WlxWin31Migrate(HANDLE hWlx
);
367 BOOL WINAPI
WlxQueryClientCredentials(PWLX_CLIENT_CREDENTIALS_INFO_V1_0 pCred
);
368 BOOL WINAPI
WlxQueryInetConnectorCredentials(PWLX_CLIENT_CREDENTIALS_INFO_V1_0 pCred
);
369 DWORD WINAPI
WlxQueryConsoleSwitchCredentials(PWLX_CONSOLESWITCH_CREDENTIALS_INFO_V1_0 pCred
);
370 BOOL WINAPI
WlxQueryTsLogonCredentials(PWLX_CLIENT_CREDENTIALS_INFO_V2_0 pCred
);
371 BOOL WINAPI
WlxDisconnect(VOID
);
372 DWORD WINAPI
WlxQueryTerminalServicesData(HANDLE hWlx
, PWLX_TERMINAL_SERVICES_DATA pTSData
, WCHAR
* UserName
, WCHAR
* Domain
);
374 #endif /* __WINLOGON_MAIN_H__ */