#ifndef _WINWLX_H
#define _WINWLX_H

/* Windows WinLogon eXtensions: */
/* Graphical Identification aNd Authentication (GINA) DLL definitions */

#if __POCC__ >= 290
#pragma warn(push)
#pragma warn(disable:2028)  /* Missing prototype */
#endif

#define WLX_VERSION_1_0  0X00010000
#define WLX_VERSION_1_1  0X00010001
#define WLX_VERSION_1_2  0X00010002
#define WLX_VERSION_1_3  0X00010003
#define WLX_CURRENT_VERSION  WLX_VERSION_1_3

#define WLX_SAS_TYPE_TIMEOUT  0
#define WLX_SAS_TYPE_CTRL_ALT_DEL  1
#define WLX_SAS_TYPE_SCRNSVR_TIMEOUT  2
#define WLX_SAS_TYPE_SCRNSVR_ACTIVITY  3
#define WLX_SAS_TYPE_USER_LOGOFF  4
#define WLX_SAS_TYPE_SC_INSERT  5
#define WLX_SAS_TYPE_SC_REMOVE  6
#define WLX_SAS_TYPE_MAX_MSFT_VALUE  127

#define WLX_LOGON_OPT_NO_PROFILE  0x00000001

#define WLX_PROFILE_TYPE_V1_0  1
#define WLX_PROFILE_TYPE_V2_0  2

#define WLX_SAS_ACTION_LOGON  1
#define WLX_SAS_ACTION_NONE  2
#define WLX_SAS_ACTION_LOCK_WKSTA  3
#define WLX_SAS_ACTION_LOGOFF  4
#define WLX_SAS_ACTION_SHUTDOWN  5
#define WLX_SAS_ACTION_PWD_CHANGED  6
#define WLX_SAS_ACTION_TASKLIST  7
#define WLX_SAS_ACTION_UNLOCK_WKSTA  8
#define WLX_SAS_ACTION_FORCE_LOGOFF  9
#define WLX_SAS_ACTION_SHUTDOWN_POWER_OFF  10
#define WLX_SAS_ACTION_SHUTDOWN_REBOOT  11
#define WLX_SAS_ACTION_SHUTDOWN_SLEEP  12
#define WLX_SAS_ACTION_SHUTDOWN_SLEEP2  13
#define WLX_SAS_ACTION_SHUTDOWN_HIBERNATE  14
#define WLX_SAS_ACTION_RECONNECTED  15
#define WLX_SAS_ACTION_DELAYED_FORCE_LOGOFF 16

#define WLX_WM_SAS  (WM_USER+601)

#define WLX_DLG_SAS  101
#define WLX_DLG_INPUT_TIMEOUT  102
#define WLX_DLG_SCREEN_SAVER_TIMEOUT  103
#define WLX_DLG_USER_LOGOFF  104

#define WLX_DIRECTORY_LENGTH  256

#define WLX_CREDENTIAL_TYPE_V1_0  1

#define STATUSMSG_OPTION_NOANIMATION  0x00000001
#define STATUSMSG_OPTION_SETFOREGROUND  0x00000002

#define WLX_DESKTOP_NAME  0x00000001
#define WLX_DESKTOP_HANDLE  0x00000002

#define WLX_CREATE_INSTANCE_ONLY  0x00000001
#define WLX_CREATE_USER  0x00000002

#define WLX_OPTION_USE_CTRL_ALT_DEL  0x00000001
#define WLX_OPTION_CONTEXT_POINTER  0x00000002
#define WLX_OPTION_USE_SMART_CARD  0x00000003
#define WLX_OPTION_FORCE_LOGOFF_TIME  0x00000004
#define WLX_OPTION_IGNORE_AUTO_LOGON  0x00000008

#define WLX_OPTION_SMART_CARD_PRESENT  0x00010001
#define WLX_OPTION_SMART_CARD_INFO  0x00010002
#define WLX_OPTION_DISPATCH_TABLE_SIZE  0x00010003

typedef struct _WLX_SC_NOTIFICATION_INFO {
    PWSTR pszCard;
    PWSTR pszReader;
    PWSTR pszContainer;
    PWSTR pszCryptoProvider;
} WLX_SC_NOTIFICATION_INFO, *PWLX_SC_NOTIFICATION_INFO;

typedef struct _WLX_PROFILE_V1_0 {
    DWORD dwType;
    PWSTR pszProfile;
} WLX_PROFILE_V1_0, *PWLX_PROFILE_V1_0;

typedef struct _WLX_PROFILE_V2_0 {
    DWORD dwType;
    PWSTR pszProfile;
    PWSTR pszPolicy;
    PWSTR pszNetworkDefaultUserProfile;
    PWSTR pszServerName;
    PWSTR pszEnvironment;
} WLX_PROFILE_V2_0, *PWLX_PROFILE_V2_0;

typedef struct _WLX_MPR_NOTIFY_INFO {
    PWSTR pszUserName;
    PWSTR pszDomain;
    PWSTR pszPassword;
    PWSTR pszOldPassword;
} WLX_MPR_NOTIFY_INFO, *PWLX_MPR_NOTIFY_INFO;

typedef struct _WLX_TERMINAL_SERVICES_DATA {
    WCHAR ProfilePath[WLX_DIRECTORY_LENGTH+1];
    WCHAR HomeDir[WLX_DIRECTORY_LENGTH+1];
    WCHAR HomeDirDrive[4];
} WLX_TERMINAL_SERVICES_DATA, *PWLX_TERMINAL_SERVICES_DATA;

typedef struct _WLX_CLIENT_CREDENTIALS_INFO {
    DWORD dwType;
    PWSTR pszUserName;
    PWSTR pszDomain;
    PWSTR pszPassword;
    BOOL fPromptForPassword;
} WLX_CLIENT_CREDENTIALS_INFO_V1_0, *PWLX_CLIENT_CREDENTIALS_INFO_V1_0;

typedef struct _WLX_DESKTOP {
    DWORD Size;
    DWORD Flags;
    HDESK hDesktop;
    PWSTR pszDesktopName;
} WLX_DESKTOP, *PWLX_DESKTOP;

typedef VOID (WINAPI *PWLX_USE_CTRL_ALT_DEL)(HANDLE);
typedef VOID (WINAPI *PWLX_SET_CONTEXT_POINTER)(HANDLE,PVOID);
typedef VOID (WINAPI *PWLX_SAS_NOTIFY)(HANDLE,DWORD);
typedef BOOL (WINAPI *PWLX_SET_TIMEOUT)(HANDLE,DWORD);
typedef int (WINAPI *PWLX_ASSIGN_SHELL_PROTECTION)(HANDLE,HANDLE,HANDLE,HANDLE);
typedef int (WINAPI *PWLX_MESSAGE_BOX)(HANDLE,HWND,LPWSTR,LPWSTR,UINT);
typedef int (WINAPI *PWLX_DIALOG_BOX)(HANDLE,HANDLE,LPWSTR,HWND,DLGPROC);
typedef int (WINAPI *PWLX_DIALOG_BOX_INDIRECT)(HANDLE,HANDLE,LPCDLGTEMPLATE,HWND,DLGPROC);
typedef int (WINAPI *PWLX_DIALOG_BOX_PARAM)(HANDLE,HANDLE,LPWSTR,HWND,DLGPROC,LPARAM);
typedef int (WINAPI *PWLX_DIALOG_BOX_INDIRECT_PARAM)(HANDLE,HANDLE,LPCDLGTEMPLATE,HWND,DLGPROC,LPARAM);
typedef int (WINAPI *PWLX_SWITCH_DESKTOP_TO_USER)(HANDLE);
typedef int (WINAPI *PWLX_SWITCH_DESKTOP_TO_WINLOGON)(HANDLE);
typedef int (WINAPI *PWLX_CHANGE_PASSWORD_NOTIFY)(HANDLE,PWLX_MPR_NOTIFY_INFO,DWORD);
typedef BOOL (WINAPI *PWLX_GET_SOURCE_DESKTOP)(HANDLE,PWLX_DESKTOP*);
typedef BOOL (WINAPI *PWLX_SET_RETURN_DESKTOP)(HANDLE,PWLX_DESKTOP);
typedef BOOL (WINAPI *PWLX_CREATE_USER_DESKTOP)(HANDLE,HANDLE,DWORD,PWSTR,PWLX_DESKTOP*);

typedef int (WINAPI *PWLX_CHANGE_PASSWORD_NOTIFY_EX)(HANDLE,PWLX_MPR_NOTIFY_INFO,DWORD,PWSTR,PVOID);
typedef BOOL (WINAPI *PWLX_CLOSE_USER_DESKTOP)(HANDLE,PWLX_DESKTOP,HANDLE);
typedef BOOL (WINAPI *PWLX_SET_OPTION)(HANDLE,DWORD,ULONG_PTR,ULONG_PTR*);
typedef BOOL (WINAPI *PWLX_GET_OPTION)(HANDLE,DWORD,ULONG_PTR*);
typedef VOID (WINAPI *PWLX_WIN31_MIGRATE)(HANDLE);
typedef BOOL (WINAPI *PWLX_QUERY_CLIENT_CREDENTIALS)(PWLX_CLIENT_CREDENTIALS_INFO_V1_0);
typedef BOOL (WINAPI *PWLX_QUERY_IC_CREDENTIALS)(PWLX_CLIENT_CREDENTIALS_INFO_V1_0);
typedef BOOL (WINAPI *PWLX_DISCONNECT)();
typedef DWORD (WINAPI *PWLX_QUERY_TERMINAL_SERVICES_DATA)(HANDLE,PWLX_TERMINAL_SERVICES_DATA,WCHAR*,WCHAR*);

typedef struct _WLX_DISPATCH_VERSION_1_0 {
    PWLX_USE_CTRL_ALT_DEL WlxUseCtrlAltDel;
    PWLX_SET_CONTEXT_POINTER WlxSetContextPointer;
    PWLX_SAS_NOTIFY WlxSasNotify;
    PWLX_SET_TIMEOUT WlxSetTimeout;
    PWLX_ASSIGN_SHELL_PROTECTION WlxAssignShellProtection;
    PWLX_MESSAGE_BOX WlxMessageBox;
    PWLX_DIALOG_BOX WlxDialogBox;
    PWLX_DIALOG_BOX_PARAM WlxDialogBoxParam;
    PWLX_DIALOG_BOX_INDIRECT WlxDialogBoxIndirect;
    PWLX_DIALOG_BOX_INDIRECT_PARAM WlxDialogBoxIndirectParam;
    PWLX_SWITCH_DESKTOP_TO_USER WlxSwitchDesktopToUser;
    PWLX_SWITCH_DESKTOP_TO_WINLOGON WlxSwitchDesktopToWinlogon;
    PWLX_CHANGE_PASSWORD_NOTIFY WlxChangePasswordNotify;
} WLX_DISPATCH_VERSION_1_0, *PWLX_DISPATCH_VERSION_1_0;

typedef struct _WLX_DISPATCH_VERSION_1_1 {
    PWLX_USE_CTRL_ALT_DEL WlxUseCtrlAltDel;
    PWLX_SET_CONTEXT_POINTER WlxSetContextPointer;
    PWLX_SAS_NOTIFY WlxSasNotify;
    PWLX_SET_TIMEOUT WlxSetTimeout;
    PWLX_ASSIGN_SHELL_PROTECTION WlxAssignShellProtection;
    PWLX_MESSAGE_BOX WlxMessageBox;
    PWLX_DIALOG_BOX WlxDialogBox;
    PWLX_DIALOG_BOX_PARAM WlxDialogBoxParam;
    PWLX_DIALOG_BOX_INDIRECT WlxDialogBoxIndirect;
    PWLX_DIALOG_BOX_INDIRECT_PARAM WlxDialogBoxIndirectParam;
    PWLX_SWITCH_DESKTOP_TO_USER WlxSwitchDesktopToUser;
    PWLX_SWITCH_DESKTOP_TO_WINLOGON WlxSwitchDesktopToWinlogon;
    PWLX_CHANGE_PASSWORD_NOTIFY WlxChangePasswordNotify;
    PWLX_GET_SOURCE_DESKTOP WlxGetSourceDesktop;
    PWLX_SET_RETURN_DESKTOP WlxSetReturnDesktop;
    PWLX_CREATE_USER_DESKTOP WlxCreateUserDesktop;
    PWLX_CHANGE_PASSWORD_NOTIFY_EX WlxChangePasswordNotifyEx;
} WLX_DISPATCH_VERSION_1_1, *PWLX_DISPATCH_VERSION_1_1;

typedef struct _WLX_DISPATCH_VERSION_1_2 {
    PWLX_USE_CTRL_ALT_DEL WlxUseCtrlAltDel;
    PWLX_SET_CONTEXT_POINTER WlxSetContextPointer;
    PWLX_SAS_NOTIFY WlxSasNotify;
    PWLX_SET_TIMEOUT WlxSetTimeout;
    PWLX_ASSIGN_SHELL_PROTECTION WlxAssignShellProtection;
    PWLX_MESSAGE_BOX WlxMessageBox;
    PWLX_DIALOG_BOX WlxDialogBox;
    PWLX_DIALOG_BOX_PARAM WlxDialogBoxParam;
    PWLX_DIALOG_BOX_INDIRECT WlxDialogBoxIndirect;
    PWLX_DIALOG_BOX_INDIRECT_PARAM WlxDialogBoxIndirectParam;
    PWLX_SWITCH_DESKTOP_TO_USER WlxSwitchDesktopToUser;
    PWLX_SWITCH_DESKTOP_TO_WINLOGON WlxSwitchDesktopToWinlogon;
    PWLX_CHANGE_PASSWORD_NOTIFY WlxChangePasswordNotify;
    PWLX_GET_SOURCE_DESKTOP WlxGetSourceDesktop;
    PWLX_SET_RETURN_DESKTOP WlxSetReturnDesktop;
    PWLX_CREATE_USER_DESKTOP WlxCreateUserDesktop;
    PWLX_CHANGE_PASSWORD_NOTIFY_EX WlxChangePasswordNotifyEx;
    PWLX_CLOSE_USER_DESKTOP WlxCloseUserDesktop;
} WLX_DISPATCH_VERSION_1_2, *PWLX_DISPATCH_VERSION_1_2;

typedef struct _WLX_DISPATCH_VERSION_1_3 {
    PWLX_USE_CTRL_ALT_DEL WlxUseCtrlAltDel;
    PWLX_SET_CONTEXT_POINTER WlxSetContextPointer;
    PWLX_SAS_NOTIFY WlxSasNotify;
    PWLX_SET_TIMEOUT WlxSetTimeout;
    PWLX_ASSIGN_SHELL_PROTECTION WlxAssignShellProtection;
    PWLX_MESSAGE_BOX WlxMessageBox;
    PWLX_DIALOG_BOX WlxDialogBox;
    PWLX_DIALOG_BOX_PARAM WlxDialogBoxParam;
    PWLX_DIALOG_BOX_INDIRECT WlxDialogBoxIndirect;
    PWLX_DIALOG_BOX_INDIRECT_PARAM WlxDialogBoxIndirectParam;
    PWLX_SWITCH_DESKTOP_TO_USER WlxSwitchDesktopToUser;
    PWLX_SWITCH_DESKTOP_TO_WINLOGON WlxSwitchDesktopToWinlogon;
    PWLX_CHANGE_PASSWORD_NOTIFY WlxChangePasswordNotify;
    PWLX_GET_SOURCE_DESKTOP WlxGetSourceDesktop;
    PWLX_SET_RETURN_DESKTOP WlxSetReturnDesktop;
    PWLX_CREATE_USER_DESKTOP WlxCreateUserDesktop;
    PWLX_CHANGE_PASSWORD_NOTIFY_EX WlxChangePasswordNotifyEx;
    PWLX_CLOSE_USER_DESKTOP WlxCloseUserDesktop;
    PWLX_SET_OPTION WlxSetOption;
    PWLX_GET_OPTION WlxGetOption;
    PWLX_WIN31_MIGRATE WlxWin31Migrate;
    PWLX_QUERY_CLIENT_CREDENTIALS WlxQueryClientCredentials;
    PWLX_QUERY_IC_CREDENTIALS WlxQueryInetConnectorCredentials;
    PWLX_DISCONNECT WlxDisconnect;
    PWLX_QUERY_TERMINAL_SERVICES_DATA WlxQueryTerminalServicesData;
} WLX_DISPATCH_VERSION_1_3, *PWLX_DISPATCH_VERSION_1_3;

typedef DWORD (*PFNMSGECALLBACK)(BOOL,LPWSTR);

typedef struct _WLX_NOTIFICATION_INFO {
    ULONG Size;
    ULONG Flags;
    PWSTR UserName;
    PWSTR Domain;
    PWSTR WindowStation;
    HANDLE hToken;
    HDESK hDesktop;
    PFNMSGECALLBACK pStatusCallback;
} WLX_NOTIFICATION_INFO, *PWLX_NOTIFICATION_INFO;

BOOL WINAPI WlxNegotiate(DWORD,PDWORD);
BOOL WINAPI WlxInitialize(LPWSTR,HANDLE,PVOID,PVOID,PVOID*);
VOID WINAPI WlxDisplaySASNotice(PVOID);
int WINAPI WlxLoggedOutSAS(PVOID,DWORD,PLUID,PSID,PDWORD,PHANDLE,PWLX_MPR_NOTIFY_INFO,PVOID*);
BOOL WINAPI WlxActivateUserShell(PVOID,PWSTR,PWSTR,PVOID);
int WINAPI WlxLoggedOnSAS(PVOID,DWORD,PVOID);
VOID WINAPI WlxDisplayLockedNotice(PVOID);
int WINAPI WlxWkstaLockedSAS(PVOID,DWORD);
BOOL WINAPI WlxIsLockOk(PVOID);
BOOL WINAPI WlxIsLogoffOk(PVOID);
VOID WINAPI WlxLogoff(PVOID);
VOID WINAPI WlxShutdown(PVOID,DWORD);
BOOL WINAPI WlxScreenSaverNotify(PVOID,BOOL*);
BOOL WINAPI WlxStartApplication(PVOID,PWSTR,PVOID,PWSTR);
BOOL WINAPI WlxNetworkProviderLoad(PVOID,PWLX_MPR_NOTIFY_INFO);
BOOL WINAPI WlxDisplayStatusMessage(PVOID,HDESK,DWORD,PWSTR,PWSTR);
BOOL WINAPI WlxGetStatusMessage(PVOID,DWORD*,PWSTR,DWORD);
BOOL WINAPI WlxRemoveStatusMessage(PVOID);

#if __POCC__ >= 290
#pragma warn(pop)
#endif

#endif /* _WINWLX_H */
