' ########################################################################################
' Microsoft Windows
' File: WinWlx.inc
' WLX == WinLogon eXtension
' Contents: Definitions, data types, and routine prototypes necessary to produce a
' replacement Graphical Identification aNd Authentication (GINA) DLL for Winlogon.
' Copyright (c) 2011 Jos? Roca
' Portions Copyright (c) Microsoft Corporation.
' All Rights Reserved.
' THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER
' EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED WARRANTIES OF
' MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE.
' ########################################################################################
#IF NOT %DEF(PBX_WinWlx_PBI)
#DEFINE PBX_WinWlx_PBI
%EQUATE `WINWLX_INC = 1
#INCLUDE ONCE "Core/Windows.inc"
'////////////////////////////////////////////////////////////////////////
'// //
'// #defines //
'// //
'////////////////////////////////////////////////////////////////////////
'/////////////////////////////////////////////////////////////////////////
'/////////////////////////////////////////////////////////////////////////
'//
'// Revisions of Winlogon API available for use by GINAs
'// Version is two parts: Major revision and minor revision.
'// Major revision is the upper 16-bits, minor is the lower
'// 16-bits.
'//
%EQUATE `WLX_VERSION_1_0 = &H00010000
%EQUATE `WLX_VERSION_1_1 = &H00010001
%EQUATE `WLX_VERSION_1_2 = &H00010002
%EQUATE `WLX_VERSION_1_3 = &H00010003
%EQUATE `WLX_VERSION_1_4 = &H00010004
%EQUATE `WLX_CURRENT_VERSION = %WLX_VERSION_1_4
'/////////////////////////////////////////////////////////////////////////
'/////////////////////////////////////////////////////////////////////////
'//
'// Secure attention sequence types
'// These values are passed to routines that have a dwSasType
'// parameter.
'//
'// ALL VALUES FROM 0 TO 127 ARE RESERVED FOR MICROSOFT DEFINITION.
'// VALUES ABOVE 127 ARE RESERVED FOR CUSTOMER DEFINITION.
'//
'// CTRL_ALT_DEL - used to indicate that the standard ctrl-alt-del
'// secure attention sequence has been entered.
'//
'// SCRNSVR_TIMEOUT - used to indicate that keyboard/mouse inactivity
'// has lead to a screensaver activation. It is up to the GINA
'// DLL whether this constitutes a workstation locking event.
'//
'// SCRNSVR_ACTIVITY - used to indicate that keyboard or mouse
'// activity occured while a secure screensaver was active.
'//
'// SC_INSERT - used to indicate that a smart card has been inserted
'// to a compatible device
'//
'// SC_REMOVE - used to indicate that a smart card has been removed
'// from a compatible device
'//
%EQUATE `WLX_SAS_TYPE_TIMEOUT = 0
%EQUATE `WLX_SAS_TYPE_CTRL_ALT_DEL = 1
%EQUATE `WLX_SAS_TYPE_SCRNSVR_TIMEOUT = 2
%EQUATE `WLX_SAS_TYPE_SCRNSVR_ACTIVITY = 3
%EQUATE `WLX_SAS_TYPE_USER_LOGOFF = 4
%EQUATE `WLX_SAS_TYPE_SC_INSERT = 5
%EQUATE `WLX_SAS_TYPE_SC_REMOVE = 6
%EQUATE `WLX_SAS_TYPE_AUTHENTICATED = 7
%EQUATE `WLX_SAS_TYPE_SC_FIRST_READER_ARRIVED = 8
%EQUATE `WLX_SAS_TYPE_SC_LAST_READER_REMOVED = 9
%EQUATE `WLX_SAS_TYPE_SWITCHUSER = 10
%EQUATE `WLX_SAS_TYPE_MAX_MSFT_VALUE = 127
'//
'// This structure is available through WlxGetOption, and is
'// passed as the lParam for any S/C SAS notices sent to windows
'//
' // Size = 16 bytes
TYPE WLX_SC_NOTIFICATION_INFO DWORD
 pszCard AS WSTRINGZ PTR
 pszReader AS WSTRINGZ PTR
 pszContainer AS WSTRINGZ PTR
 pszCryptoProvider AS WSTRINGZ PTR
END TYPE
'/////////////////////////////////////////////////////////////////////////
'/////////////////////////////////////////////////////////////////////////
'//
'// Upon successful logon, the GINA DLL may specify any of the following
'// options to Winlogon (via the dwOptions parameter of the WlxLoggedOutSas()
'// api). When set, these options specify:
'//
'// NO_PROFILE - Winlogon must NOT load a profile for the logged
'// on user. Either the GINA DLL will take care of
'// this activity, or the user does not need a profile.
'//
%EQUATE `WLX_LOGON_OPT_NO_PROFILE = &H00000001
'/////////////////////////////////////////////////////////////////////////
'/////////////////////////////////////////////////////////////////////////
'//
'// GINA DLLs are expected to return account information to Winlogon
'// following a successful logon. This information allows Winlogon
'// to support profile loading and supplemental network providers.
'//
'// To allow different sets of profile information to be returned
'// by GINAs over time, the first DWORD of each profile structure
'// is expected to contain a type-identifier. The following constants
'// are the defined profile type identifiers.
'//
'//
'// Standard profile is V2_0
'//
%EQUATE `WLX_PROFILE_TYPE_V1_0 = 1
%EQUATE `WLX_PROFILE_TYPE_V2_0 = 2
'/////////////////////////////////////////////////////////////////////////
'/////////////////////////////////////////////////////////////////////////
'//
'// WlxLoggedOnSas() and WlxWkstaLockedSas() return an action
'// value to Winlogon directing Winlogon to either remain unchanged
'// or to perform some action (such as force-log the user off).
'// These are the values that may be returned. Note, however, that
'// not all of the values may be returned by both of these api. See
'// the description of each api to see which values are expected from
'// each.
'//
'// LOGON - User has logged on
'// NONE - Don't change the state of the window station.
'// LOCK_WKSTA - Lock the workstation, wait for next SAS.
'// LOGOFF - Log the user off of the workstation.
'// SHUTDOWN - Log the user off and shutdown the machine.
'// PWD_CHANGED - Indicates that the user changed their password. Notify network providers.
'// TASKLIST - Invoke the task list.
'// UNLOCK_WKSTA - Unlock the workstation.
'// FORCE_LOGOFF - Forcibly log the user off.
'// SHUTDOWN_POWER_OFF - Turn off machine after shutting down.
'// SHUTDOWN_REBOOT - Reboot machine after shutting down.
'// SHUTDOWN_SLEEP - Put the machine to sleep
'// SHUTDOWN_SLEEP2 - Put the machine to sleep and disable wakeup events
'// SHUTDOWN_HIBERNATE - Hibernate the machine
'// RECONNECTED - Session was reconnected to an earlier session
'//
%EQUATE `WLX_SAS_ACTION_LOGON = 1
%EQUATE `WLX_SAS_ACTION_NONE = 2
%EQUATE `WLX_SAS_ACTION_LOCK_WKSTA = 3
%EQUATE `WLX_SAS_ACTION_LOGOFF = 4
%EQUATE `WLX_SAS_ACTION_SHUTDOWN = 5
%EQUATE `WLX_SAS_ACTION_PWD_CHANGED = 6
%EQUATE `WLX_SAS_ACTION_TASKLIST = 7
%EQUATE `WLX_SAS_ACTION_UNLOCK_WKSTA = 8
%EQUATE `WLX_SAS_ACTION_FORCE_LOGOFF = 9
%EQUATE `WLX_SAS_ACTION_SHUTDOWN_POWER_OFF = 10
%EQUATE `WLX_SAS_ACTION_SHUTDOWN_REBOOT = 11
%EQUATE `WLX_SAS_ACTION_SHUTDOWN_SLEEP = 12
%EQUATE `WLX_SAS_ACTION_SHUTDOWN_SLEEP2 = 13
%EQUATE `WLX_SAS_ACTION_SHUTDOWN_HIBERNATE = 14
%EQUATE `WLX_SAS_ACTION_RECONNECTED = 15
%EQUATE `WLX_SAS_ACTION_DELAYED_FORCE_LOGOFF = 16
%EQUATE `WLX_SAS_ACTION_SWITCH_CONSOLE = 17
'////////////////////////////////////////////////////////////////////////
'// //
'// Window Messages //
'// //
'////////////////////////////////////////////////////////////////////////
'//
'// The WM_SAS is defined as follows
'//
'// The wParam parameter has the SAS Type (above)
%EQUATE `WLX_WM_SAS = %WM_USER + 601
'//
'// Dialog return values
'//
'// These may be returned by dialogs started by a GINA dll.
'//
%EQUATE `WLX_DLG_SAS = 101
%EQUATE `WLX_DLG_INPUT_TIMEOUT = 102 ' Input (keys, etc) timed out
%EQUATE `WLX_DLG_SCREEN_SAVER_TIMEOUT = 103 ' Screen Saver activated
%EQUATE `WLX_DLG_USER_LOGOFF = 104 ' User logged off
'////////////////////////////////////////////////////////////////////////
'// //
'// #data types //
'// //
'////////////////////////////////////////////////////////////////////////
'/////////////////////////////////////////////////////////////////////////
'/////////////////////////////////////////////////////////////////////////
'//
'// The WLX_PROFILE_* structure is returned from a GINA DLL
'// following authentication. This information is used by Winlogon
'// to support supplemental Network Providers and to load the
'// newly logged-on user's profile.
'//
'// Winlogon is responsible for freeing both the profile structure
'// and the fields within the structure that are marked as separately
'// deallocatable.
'//
' // Size = 8 bytes
TYPE WLX_PROFILE_V1_0 DWORD
 dwType AS DWORD
 pszProfile AS WSTRINGZ PTR
END TYPE
' // Size = 24 bytes
TYPE WLX_PROFILE_V2_0 DWORD
 dwType AS DWORD
 pszProfile AS WSTRINGZ PTR
 pszPolicy AS WSTRINGZ PTR
 pszNetworkDefaultUserProfile AS WSTRINGZ PTR
 pszServerName AS WSTRINGZ PTR
 pszEnvironment AS WSTRINGZ PTR
END TYPE
'/////////////////////////////////////////////////////////////////////////
'/////////////////////////////////////////////////////////////////////////
'//
'// The WLX_NPR_NOTIFICATION_INFO structure is returned
'// from a GINA DLL following successful authentication.
'// This information is used by Winlogon to provide
'// identification and authentication information already
'// collected to network providers. Winlogon is
'// responsible for freeing both the main structure and all
'// string and other buffers pointed to from within the
'// structure.
'//
' // Size = 16 bytes
TYPE WLX_MPR_NOTIFY_INFO DWORD
 pszUserName AS WSTRINGZ PTR
 pszDomain AS WSTRINGZ PTR
 pszPassword AS WSTRINGZ PTR
 pszOldPassword AS WSTRINGZ PTR
END TYPE
'/////////////////////////////////////////////////////////////////////////
'/////////////////////////////////////////////////////////////////////////
'//
'// WLX_TERMINAL_SERVICES_DATA is used by the GINA during a
'// WlxQueryTerminalServicesData() callback into WinLogon from the
'// WlxLoggedOutSAS() context, after the user name and domain are known.
'// This structure relates to TS user configuration information which is
'// retrieved from the Domain Controller and SAM database. Having WinLogon
'// pass this information means the GINA does not need to do the same
'// off-machines lookups again.
'//
%EQUATE `WLX_DIRECTORY_LENGTH = 256
' // Size = 1036 bytes
TYPE WLX_TERMINAL_SERVICES_DATA BYTE
 ProfilePath AS WSTRINGZ * %WLX_DIRECTORY_LENGTH + 1 ' WCHAR
 HomeDir AS WSTRINGZ * %WLX_DIRECTORY_LENGTH + 1 ' WCHAR
 HomeDirDrive AS WSTRINGZ * 4 ' WCHAR
END TYPE
'/////////////////////////////////////////////////////////////////////////
'/////////////////////////////////////////////////////////////////////////
'//
'// The WLX_CLIENT_CREDENTIALS_INFO structure is returned
'// from winlogon from the WlxQueryClientCredentials() call.
'//
'// This allows a network client WinStation to pass client
'// credentials for automatic logon.
'//
'// The MSGINA DLL is responsible for freeing the memory
'// and substrings with LocalFree().
'//
%EQUATE `WLX_CREDENTIAL_TYPE_V1_0 = 1
%EQUATE `WLX_CREDENTIAL_TYPE_V2_0 = 2
' // Size = 20 bytes
TYPE WLX_CLIENT_CREDENTIALS_INFO_V1_0 DWORD
 dwType AS DWORD
 pszUserName AS WSTRINGZ PTR
 pszDomain AS WSTRINGZ PTR
 pszPassword AS WSTRINGZ PTR
 fPromptForPassword AS LONG
END TYPE
MACRO WLX_CLIENT_CREDENTIALS_INFO = WLX_CLIENT_CREDENTIALS_INFO_V1_0
' // Size = 24 bytes
TYPE WLX_CLIENT_CREDENTIALS_INFO_V2_0 DWORD
 dwType AS DWORD
 pszUserName AS WSTRINGZ PTR
 pszDomain AS WSTRINGZ PTR
 pszPassword AS WSTRINGZ PTR
 fPromptForPassword AS LONG
 fDisconnectOnLogonFailure AS LONG
END TYPE
MACRO WLX_CLIENT_CREDENTIALS_INFO_2_0 = WLX_CLIENT_CREDENTIALS_INFO_V2_0
'/////////////////////////////////////////////////////////////////////////
'/////////////////////////////////////////////////////////////////////////
'//
'// The WLX_CONSOLESWITCH_CREDENTIALS_INFO structure is returned
'// from gina in response to WlxGetConsoleSwitchCredentials calls.
'// This structure is also returned from winlogon in response to
'// to WlxQueryConsoleSwitchCredentials call
'//
'// This is used to implement single session Terminal Server. A remote
'// session winlogon calls WlxGetConsoleSwitchCredentials to get the token
'// and other info of the logged on user from msgina. This info is then passed to
'// the console session winlogon to autologon the user on the console session.
'// The gina on console session calls WlxQueryConsoleSwitchCredentials to get
'// this info from winlogon and logs on the user.
'//
'// The caller is responsible for freeing the memory
'// and substrings with LocalFree().
'//
%EQUATE `WLX_CONSOLESWITCHCREDENTIAL_TYPE_V1_0 = 1
' // Size = 168 bytes
TYPE WLX_CONSOLESWITCH_CREDENTIALS_INFO_V1_0 ' Must be 8 byte aligned
 dwType AS DWORD
 UserToken AS DWORD
 LogonId AS QUAD ' LUID
 Quotas AS QUOTA_LIMITS ' QUOTA_LIMITS
 UserName AS WSTRINGZ PTR
 Domain AS WSTRINGZ PTR
 LogonTime AS QUAD ' LARGE_INTEGER
 SmartCardLogon AS LONG
 ProfileLength AS DWORD ' ULONG
 MessageType AS DWORD
 LogonCount AS WORD ' USHORT
 BadPasswordCount AS WORD ' USHORT
 ProfileLogonTime AS QUAD ' LARGE_INTEGER
 LogoffTime AS QUAD ' LARGE_INTEGER
 KickOffTime AS QUAD ' LARGE_INTEGER
 PasswordLastSet AS QUAD ' LARGE_INTEGER
 PasswordCanChange AS QUAD ' LARGE_INTEGER
 PasswordMustChange AS QUAD ' LARGE_INTEGER
 LogonScript AS WSTRINGZ PTR
 HomeDirectory AS WSTRINGZ PTR
 FullName AS WSTRINGZ PTR
 ProfilePath AS WSTRINGZ PTR
 HomeDirectoryDrive AS WSTRINGZ PTR
 LogonServer AS WSTRINGZ PTR
 UserFlags AS DWORD ' ULONG
 PrivateDataLen AS DWORD ' ULONG
 PrivateData AS BYTE PTR
 alignment__ AS DWORD ' // To keep 8 byte alignment
END TYPE
MACRO WLX_CONSOLESWITCH_CREDENTIALS_INFO = WLX_CONSOLESWITCH_CREDENTIALS_INFO_V1_0
'////////////////////////////////////////////////////////////////////////
'// //
'// Services that replacement GINAs ** MUST ** provide //
'// //
'////////////////////////////////////////////////////////////////////////
DECLARE FUNCTION WlxNegotiate ALIAS "WlxNegotiate" ( BYVAL dwWinlogonVersion AS QUAD , BYREF pdwDllVersion AS QUAD ) AS LONG
DECLARE FUNCTION WlxInitialize ALIAS "WlxInitialize" ( BYREF lpWinsta AS WSTRINGZ
 , BYVAL hWlx AS DWORD
 , BYVAL pvReserved AS DWORD
 , BYVAL pWinlogonFunctions AS DWORD
 , BYREF pWlxContext AS ANY
 ) AS LONG
DECLARE SUB WlxDisplaySASNotice ALIAS "WlxDisplaySASNotice" ( BYVAL pWlxContext AS DWORD
 ) ' void
DECLARE FUNCTION WlxLoggedOutSAS ALIAS "WlxLoggedOutSAS" ( BYVAL pWlxContext AS QUAD , BYVAL dwSasType AS QUAD , BYREF pAuthenticationId AS ANY , BYREF pLogonSid AS ANY , BYREF pdwOptions AS QUAD , BYREF phToken AS QUAD , BYREF pNprNotifyInfo AS WLX_MPR_NOTIFY_INFO , BYREF pProfile AS ANY ) AS LONG ' int
DECLARE FUNCTION WlxActivateUserShell ALIAS "WlxActivateUserShell" ( BYVAL pWlxContext AS QUAD , BYREF pszDesktopName AS WSTRINGZ , BYREF pszMprLogonScript AS WSTRINGZ , BYVAL pEnvironment AS QUAD ) AS LONG
DECLARE FUNCTION WlxLoggedOnSAS ALIAS "WlxLoggedOnSAS" ( BYVAL pWlxContext AS QUAD
 , BYVAL dwSasType AS DWORD
 , BYVAL pReserved AS DWORD
 ) AS LONG ' int
DECLARE SUB WlxDisplayLockedNotice ALIAS "WlxDisplayLockedNotice" ( BYVAL pWlxContext AS QUAD ) ' void
DECLARE FUNCTION WlxWkstaLockedSAS ALIAS "WlxWkstaLockedSAS" ( BYVAL pWlxContext AS QUAD , BYVAL dwSasType AS QUAD ) AS LONG ' int
DECLARE FUNCTION WlxIsLockOk ALIAS "WlxIsLockOk" ( BYVAL pWlxContext AS QUAD ) AS LONG
DECLARE FUNCTION WlxIsLogoffOk ALIAS "WlxIsLogoffOk" ( BYVAL pWlxContext AS QUAD
 ) AS LONG
DECLARE SUB WlxLogoff ALIAS "WlxLogoff" ( BYVAL pWlxContext AS DWORD
 ) ' void
DECLARE SUB WlxShutdown ALIAS "WlxShutdown" ( BYVAL pWlxContext AS QUAD , BYVAL ShutdownType AS QUAD ) ' void
'//
'// NEW for version 1.1
'//
DECLARE FUNCTION WlxScreenSaverNotify ALIAS "WlxScreenSaverNotify" ( BYVAL pWlxContext AS QUAD , BYREF pSecure AS LONG ) AS LONG
DECLARE FUNCTION WlxStartApplication ALIAS "WlxStartApplication" ( BYVAL pWlxContext AS QUAD
 , BYREF pszDesktopName AS WSTRINGZ
 , BYVAL pEnvironment AS DWORD
 , BYREF pszCmdLine AS WSTRINGZ
 ) AS LONG
'//
'// New for 1.3
'//
DECLARE FUNCTION WlxNetworkProviderLoad ALIAS "WlxNetworkProviderLoad" ( BYVAL pWlxContext AS QUAD , BYREF pNprNotifyInfo AS WLX_MPR_NOTIFY_INFO ) AS LONG
%EQUATE `STATUSMSG_OPTION_NOANIMATION = &H00000001
%EQUATE `STATUSMSG_OPTION_SETFOREGROUND = &H00000002
DECLARE FUNCTION WlxDisplayStatusMessage ALIAS "WlxDisplayStatusMessage" ( BYVAL pWlxContext AS QUAD , BYVAL hDesktop AS QUAD , BYVAL dwOptions AS QUAD , BYREF pTitle AS WSTRINGZ , BYREF pMessage AS WSTRINGZ ) AS LONG
DECLARE FUNCTION WlxGetStatusMessage ALIAS "WlxGetStatusMessage" ( BYVAL pWlxContext AS QUAD
 , BYREF pdwOptions AS DWORD
 , BYREF pMessage AS WSTRINGZ
 , BYVAL dwBufferSize AS DWORD
 ) AS LONG
DECLARE FUNCTION WlxRemoveStatusMessage ALIAS "WlxRemoveStatusMessage" (_
 BYVAL pWlxContext AS DWORD
 ) AS LONG
'//
'// New for 1.4
'//
DECLARE FUNCTION WlxGetConsoleSwitchCredentials ALIAS "WlxGetConsoleSwitchCredentials" ( BYVAL pWlxContext AS QUAD , BYVAL pCredInfo AS QUAD ) AS LONG
DECLARE SUB WlxReconnectNotify ALIAS "WlxReconnectNotify" ( BYVAL pWlxContext AS QUAD
 ) ' void
DECLARE SUB WlxDisconnectNotify ALIAS "WlxDisconnectNotify" ( BYVAL pWlxContext AS QUAD ) ' void
'////////////////////////////////////////////////////////////////////////
'// //
'// Services that Winlogon provides //
'// //
'////////////////////////////////////////////////////////////////////////
' // Size = 16 bytes
TYPE WLX_DESKTOP DWORD
 Size AS DWORD
 Flags AS DWORD
 hDesktop AS DWORD ' HDESK
 pszDesktopName AS WSTRINGZ PTR
END TYPE
%EQUATE `WLX_DESKTOP_NAME = &H00000001 ' // Name present
%EQUATE `WLX_DESKTOP_HANDLE = &H00000002 ' // Handle present
'typedef VOID
'(WINAPI * PWLX_USE_CTRL_ALT_DEL)(
' HANDLE hWlx
' );
'SUB WLX_USE_CTRL_ALT_DEL ( ' BYVAL hWlx AS DWORD ' HANDLE hWlx
' ) ' void
'typedef VOID
'(WINAPI * PWLX_SET_CONTEXT_POINTER)(
' HANDLE hWlx,
' PVOID pWlxContext
' );
'SUB WLX_SET_CONTEXT_POINTER ( ' BYVAL hWlx AS DWORD ' HANDLE hWlx
' , BYVAL pWlxContext AS DWORD ' PVOID pWlxContext
' ) ' void
'typedef VOID
'(WINAPI * PWLX_SAS_NOTIFY)(
' HANDLE hWlx,
' DWORD dwSasType
' );
'SUB WLX_SAS_NOTIFY ( ' BYVAL hWlx AS DWORD ' HANDLE hWlx
' , BYVAL dwSasType AS DWORD ' DWORD dwSasType
' ) ' void
'typedef BOOL
'(WINAPI * PWLX_SET_TIMEOUT)(
' HANDLE hWlx,
' DWORD Timeout);
'FUNCTION WLX_SET_TIMEOUT ( ' BYVAL hWlx AS DWORD ' HANDLE hWlx
' , BYVAL dwTimeout AS DWORD ' DWORD Timeout
' ) AS LONG
'typedef int
'(WINAPI * PWLX_ASSIGN_SHELL_PROTECTION)(
' HANDLE hWlx,
' HANDLE hToken,
' HANDLE hProcess,
' HANDLE hThread
' );
'FUNCTION WLX_ASSIGN_SHELL_PROTECTION ( ' BYVAL hWlx AS DWORD ' HANDLE hWlx
' , BYVAL hToken AS DWORD ' HANDLE hToken
' , BYVAL hProcess AS DWORD ' HANDLE hProcess
' , BYVAL hThread AS DWORD ' HANDLE hThread
' ) AS LONG ' int
'typedef int
'(WINAPI * PWLX_MESSAGE_BOX)(
' HANDLE hWlx,
' HWND hwndOwner,
' LPWSTR lpszText,
' LPWSTR lpszTitle,
' UINT fuStyle
' );
'FUNCTION WLX_MESSAGE_BOX ( ' BYVAL hWlx AS DWORD ' HANDLE hWlx
' , BYVAL hwndOwner AS DWORD ' HWND hwndOwner
' , BYVAL lpszText AS WSTRINGZ ' LPWSTR lpszText
' , BYVAL lpszTitle AS WSTRINGZ ' LPWSTR lpszTitle
' , BYVAL fuStyle AS DWORD ' UINT fuStyle
' ) AS LONG ' int
'typedef int
'(WINAPI * PWLX_DIALOG_BOX)(
' HANDLE hWlx,
' HANDLE hInst,
' LPWSTR lpszTemplate,
' HWND hwndOwner,
' DLGPROC dlgprc
' );
'FUNCTION WLX_DIALOG_BOX ( ' BYVAL hWlx AS DWORD ' HANDLE hWlx
' , BYVAL hInst AS DWORD ' HANDLE hInst
' , BYREF lpszTemplate AS WSTRINGZ ' LPWSTR lpszTemplate
' , BYVAL hwndOwner AS DWORD ' HWND hwndOwner
' , BYVAL dlgprc AS DWORD ' DLGPROC dlgprc
' ) AS LONG ' int
'typedef int
'(WINAPI * PWLX_DIALOG_BOX_INDIRECT)(
' HANDLE hWlx,
' HANDLE hInst,
' LPCDLGTEMPLATE hDialogTemplate,
' HWND hwndOwner,
' DLGPROC dlgprc
' );
'FUNCTION WLX_DIALOG_BOX_INDIRECT ( ' BYVAL hWlx AS DWORD ' HANDLE hWlx
' , BYVAL hInst AS DWORD ' HANDLE hInst
' , BYREF hDialogTemplate AS DLGTEMPLATE ' LPCDLGTEMPLATE hDialogTemplate
' , BYVAL hwndOwner AS DWORD ' HWND hwndOwner
' , BYVAL dlgprc AS DWORD ' DLGPROC DLGPROC
' ) AS LONG ' int
'typedef int
'(WINAPI * PWLX_DIALOG_BOX_PARAM)(
' HANDLE hWlx,
' HANDLE hInst,
' LPWSTR lpszTemplate,
' HWND hwndOwner,
' DLGPROC dlgprc,
' LPARAM dwInitParam
' );
'FUNCTION WLX_DIALOG_BOX_PARAM ( ' BYVAL hWlx AS DWORD ' HANDLE hWlx
' , BYVAL hInst AS DWORD ' HANDLE hInst
' , BYREF lpszTemplate AS WSTRINGZ ' LPWSTR lpszTemplate
' , BYVAL hwndOwner AS DWORD ' HWND hwndOwner
' , BYVAL dlgprc AS DWORD ' DLGPROC dlgprc
' , BYVAL dwInitParam AS LONG ' LPARAM dwInitParam
' ) AS LONG ' int
'typedef int
'(WINAPI * PWLX_DIALOG_BOX_INDIRECT_PARAM)(
' HANDLE hWlx,
' HANDLE hInst,
' LPCDLGTEMPLATE hDialogTemplate,
' HWND hwndOwner,
' DLGPROC dlgprc,
' LPARAM dwInitParam
' );
'FUNCTION WLX_DIALOG_BOX_INDIRECT_PARAM ( ' BYVAL hWlx AS DWORD ' HANDLE hWlx
' , BYVAL hInst AS DWORD ' HANDLE hInst
' , BYREF hDialogTemplate AS DLGTEMPLATE ' LPCDLGTEMPLATE hDialogTemplate
' , BYVAL hwndOwner AS DWORD ' HWND hwndOwner
' , BYVAL dlgprc AS DWORD ' DLGPROC dlgprc
' , BYVAL dwInitParam AS LONG ' LPARAM dwInitParam
' ) AS LONG ' int
'typedef int
'(WINAPI * PWLX_SWITCH_DESKTOP_TO_USER)(
' HANDLE hWlx);
'FUNCTION WLX_SWITCH_DESKTOP_TO_USER ( ' BYVAL hWlx AS DWORD ' HANDLE hWlx
' ) AS LONG ' int
'typedef int
'(WINAPI * PWLX_SWITCH_DESKTOP_TO_WINLOGON)(
' HANDLE hWlx);
'FUNCTION WLX_SWITCH_DESKTOP_TO_WINLOGON ( ' BYVAL hWlx AS DWORD ' HANDLE hWlx
' ) AS LONG ' int
'typedef int
'(WINAPI * PWLX_CHANGE_PASSWORD_NOTIFY)(
' HANDLE hWlx,
' PWLX_MPR_NOTIFY_INFO pMprInfo,
' DWORD dwChangeInfo
' );
'FUNCTION WLX_CHANGE_PASSWORD_NOTIFY ( ' BYVAL hWlx AS DWORD ' HANDLE hWlx
' , BYVAL pMprInfo AS DWORD ' PWLX_MPR_NOTIFY_INFO pMprInfo
' , BYVAL dwChangeInfo AS DWORD ' DWORD dwChangeInfo
' ) AS LONG ' int
'typedef BOOL
'(WINAPI * PWLX_GET_SOURCE_DESKTOP)(
' HANDLE hWlx,
' PWLX_DESKTOP * ppDesktop);
'FUNCTION WLX_CHANGE_PASSWORD_NOTIFY ( ' BYVAL hWlx AS DWORD ' HANDLE hWlx
' , BYREF ppDesktop AS WLX_DESKTOP ' WLX_DESKTOP * ppDesktop
' ) AS LONG
'typedef BOOL
'(WINAPI * PWLX_SET_RETURN_DESKTOP)(
' HANDLE hWlx,
' PWLX_DESKTOP pDesktop);
'FUNCTION WLX_SET_RETURN_DESKTOP ( ' BYVAL hWlx AS DWORD ' HANDLE hWlx
' , BYREF pDesktop AS WLX_DESKTOP ' WLX_DESKTOP pDesktop
' ) AS LONG
'typedef BOOL
'(WINAPI * PWLX_CREATE_USER_DESKTOP)(
' HANDLE hWlx,
' HANDLE hToken,
' DWORD Flags,
' PWSTR pszDesktopName,
' PWLX_DESKTOP * ppDesktop);
'FUNCTION WLX_CREATE_USER_DESKTOP ( ' BYVAL hWlx AS DWORD ' HANDLE hWlx
' , BYVAL hToken AS DWORD ' HANDLE hToken
' , BYVAL Flags AS DWORD ' DWORD Flags
' , BYREF pszDesktopName AS WSTRINGZ ' PWSTR pszDesktopName
' , BYREF ppDesktop AS WLX_DESKTOP ' WLX_DESKTOP * ppDesktop
' ) AS LONG
%EQUATE `WLX_CREATE_INSTANCE_ONLY = &H00000001
%EQUATE `WLX_CREATE_USER = &H00000002
'typedef int
'(WINAPI * PWLX_CHANGE_PASSWORD_NOTIFY_EX)(
' HANDLE hWlx,
' PWLX_MPR_NOTIFY_INFO pMprInfo,
' DWORD dwChangeInfo,
' PWSTR ProviderName,
' PVOID Reserved);
'FUNCTION WLX_CHANGE_PASSWORD_NOTIFY_EX ( ' BYVAL hWlx AS DWORD ' HANDLE hWlx
' , BYVAL pMprInfo AS DWORD ' PWLX_MPR_NOTIFY_INFO pMprInfo
' , BYVAL dwChangeInfo AS DWORD ' DWORD dwChangeInfo
' , BYREF ProviderName AS WSTRINGZ ' PWSTR ProviderName
' , BYVAL Reserved AS DWORD ' PVOID Reserved
' ) AS LONG ' int
'typedef BOOL
'(WINAPI * PWLX_CLOSE_USER_DESKTOP)(
' HANDLE hWlx,
' PWLX_DESKTOP pDesktop,
' HANDLE hToken );
'FUNCTION WLX_CLOSE_USER_DESKTOP ( ' BYVAL hWlx AS DWORD ' HANDLE hWlx
' , BYREF pDesktop AS WLX_DESKTOP ' PWLX_DESKTOP pDesktop
' , BYVAL hToken AS DWORD ' HANDLE hToken
' ) AS LONG
'typedef BOOL
'(WINAPI * PWLX_SET_OPTION)(
' HANDLE hWlx,
' DWORD Option,
' ULONG_PTR Value,
' ULONG_PTR * OldValue
' );
'FUNCTION WLX_SET_OPTION ( ' BYVAL hWlx AS DWORD ' HANDLE hWlx
' , BYVAL Option AS DWORD ' DWORD Option
' , BYVAL Value AS DWORD ' ULONG_PTR Value
' , BYVAL OldValue AS DWORD ' ULONG_PTR * OldValue
' ) LONG
'typedef BOOL
'(WINAPI * PWLX_GET_OPTION)(
' HANDLE hWlx,
' DWORD Option,
' ULONG_PTR * Value
' );
'FUNCTION WLX_GET_OPTION ( ' BYVAL hWlx AS DWORD ' HANDLE hWlx
' , BYVAL Option AS DWORD ' DWORD Option
' , BYVAL Value AS DWORD ' ULONG_PTR Value
' ) AS LONG
'typedef VOID
'(WINAPI * PWLX_WIN31_MIGRATE)(
' HANDLE hWlx
' );
'SUB WLX_WIN31_MIGRATE ( ' BYVAL hWlx AS DWORD ' HANDLE hWlx
' ) ' void
'typedef BOOL
'(WINAPI * PWLX_QUERY_CLIENT_CREDENTIALS)(
' PWLX_CLIENT_CREDENTIALS_INFO_V1_0 pCred
' );
'FUNCTION WLX_QUERY_CLIENT_CREDENTIALS ( ' BYREF pCred AS WLX_CLIENT_CREDENTIALS_INFO_V1_0 ' PWLX_CLIENT_CREDENTIALS_INFO_V1_0 pCred
' ) AS LONG
'typedef BOOL
'(WINAPI * PWLX_QUERY_IC_CREDENTIALS)(
' PWLX_CLIENT_CREDENTIALS_INFO_V1_0 pCred
' );
'FUNCTION WLX_QUERY_IC_CREDENTIALS ( ' BYREF pCred AS WLX_CLIENT_CREDENTIALS_INFO_V1_0 ' PWLX_CLIENT_CREDENTIALS_INFO_V1_0 pCred
' ) AS LONG
'typedef BOOL
'(WINAPI * PWLX_QUERY_TS_LOGON_CREDENTIALS)(
' PWLX_CLIENT_CREDENTIALS_INFO_V2_0 pCred
' );
'FUNCTION WLX_QUERY_TS_LOGON_CREDENTIALS ( ' BYREF pCred AS WLX_CLIENT_CREDENTIALS_INFO_V2_0 ' PWLX_CLIENT_CREDENTIALS_INFO_V2_0 pCred
' ) AS LONG
'typedef BOOL
'(WINAPI * PWLX_DISCONNECT)(
' );
'FUNCTION WLX_DISCONNECT ( ' ) AS LONG
'typedef DWORD
'(WINAPI * PWLX_QUERY_TERMINAL_SERVICES_DATA)(
' HANDLE hWlx,
' PWLX_TERMINAL_SERVICES_DATA pTSData,
' WCHAR * UserName,
' WCHAR * Domain
' );
'FUNCTION WLX_QUERY_TERMINAL_SERVICES_DATA ( ' BYVAL hWlx AS DWORD ' HANDLE hWlx
' , BYREF WLX_TERMINAL_SERVICES_DATA ' PWLX_TERMINAL_SERVICES_DATA pTSData
' , BYREF UserName AS WSTRINGZ ' WCHAR * UserName
' , BYREF Domain AS WSTRINGZ ' WCHAR * Domain
' ) AS DWORD
'typedef DWORD
'(WINAPI * PWLX_QUERY_CONSOLESWITCH_CREDENTIALS)(
' PWLX_CONSOLESWITCH_CREDENTIALS_INFO_V1_0 pCred
' );
'FUNCTION WLX_QUERY_CONSOLESWITCH_CREDENTIALS ( ' BYREF pCred AS WLX_CONSOLESWITCH_CREDENTIALS_INFO_V1_0 ' PWLX_CONSOLESWITCH_CREDENTIALS_INFO_V1_0 pCred
' ) AS DWORD
'FUNCTION WLX_QUERY_CONSOLESWITCH_CREDENTIALS ( ' BYREF pCred AS WLX_CONSOLESWITCH_CREDENTIALS_INFO_V1_0 ' PWLX_CONSOLESWITCH_CREDENTIALS_INFO_V1_0 pCred
' ) AS DWORD
''//
''// Options that can be get or set:
''//
%EQUATE `WLX_OPTION_USE_CTRL_ALT_DEL = &H00000001
%EQUATE `WLX_OPTION_CONTEXT_POINTER = &H00000002
%EQUATE `WLX_OPTION_USE_SMART_CARD = &H00000003
%EQUATE `WLX_OPTION_FORCE_LOGOFF_TIME = &H00000004
%EQUATE `WLX_OPTION_IGNORE_AUTO_LOGON = &H00000008
%EQUATE `WLX_OPTION_NO_SWITCH_ON_SAS = &H00000009
'//
'// Options that can be queried only:
'//
%EQUATE `WLX_OPTION_SMART_CARD_PRESENT = &H00010001
%EQUATE `WLX_OPTION_SMART_CARD_INFO = &H00010002
%EQUATE `WLX_OPTION_DISPATCH_TABLE_SIZE = &H00010003
'////////////////////////////////////////////////////////////////////////
'// //
'// Function dispatch tables. //
'// One of the following tables will be passed to the GINA DLL //
'// in the WlxInitialize() call during initialization. //
'// //
'////////////////////////////////////////////////////////////////////////
' // Size = 52 bytes
TYPE WLX_DISPATCH_VERSION_1_0 DWORD
 WlxUseCtrlAltDel AS DWORD ' PWLX_USE_CTRL_ALT_DEL
 WlxSetContextPointer AS DWORD ' PWLX_SET_CONTEXT_POINTER
 WlxSasNotify AS DWORD ' PWLX_SAS_NOTIFY
 WlxSetTimeout AS DWORD ' PWLX_SET_TIMEOUT
 WlxAssignShellProtection AS DWORD ' PWLX_ASSIGN_SHELL_PROTECTION
 WlxMessageBox AS DWORD ' PWLX_MESSAGE_BOX
 WlxDialogBox AS DWORD ' PWLX_DIALOG_BOX
 WlxDialogBoxParam AS DWORD ' PWLX_DIALOG_BOX_PARAM
 WlxDialogBoxIndirect AS DWORD ' PWLX_DIALOG_BOX_INDIRECT
 WlxDialogBoxIndirectParam AS DWORD ' PWLX_DIALOG_BOX_INDIRECT_PARAM
 WlxSwitchDesktopToUser AS DWORD ' PWLX_SWITCH_DESKTOP_TO_USER
 WlxSwitchDesktopToWinlogon AS DWORD ' PWLX_SWITCH_DESKTOP_TO_WINLOGON
 WlxChangePasswordNotify AS DWORD ' PWLX_CHANGE_PASSWORD_NOTIFY
END TYPE
' // Size = 68 bytes
TYPE WLX_DISPATCH_VERSION_1_1 DWORD
 WlxUseCtrlAltDel AS DWORD ' PWLX_USE_CTRL_ALT_DEL
 WlxSetContextPointer AS DWORD ' PWLX_SET_CONTEXT_POINTER
 WlxSasNotify AS DWORD ' PWLX_SAS_NOTIFY
 WlxSetTimeout AS DWORD ' PWLX_SET_TIMEOUT
 WlxAssignShellProtection AS DWORD ' PWLX_ASSIGN_SHELL_PROTECTION
 WlxMessageBox AS DWORD ' PWLX_MESSAGE_BOX
 WlxDialogBox AS DWORD ' PWLX_DIALOG_BOX
 WlxDialogBoxParam AS DWORD ' PWLX_DIALOG_BOX_PARAM
 WlxDialogBoxIndirect AS DWORD ' PWLX_DIALOG_BOX_INDIRECT
 WlxDialogBoxIndirectParam AS DWORD ' PWLX_DIALOG_BOX_INDIRECT_PARAM
 WlxSwitchDesktopToUser AS DWORD ' PWLX_SWITCH_DESKTOP_TO_USER
 WlxSwitchDesktopToWinlogon AS DWORD ' PWLX_SWITCH_DESKTOP_TO_WINLOGON
 WlxChangePasswordNotify AS DWORD ' PWLX_CHANGE_PASSWORD_NOTIFY
 WlxGetSourceDesktop AS DWORD ' PWLX_GET_SOURCE_DESKTOP
 WlxSetReturnDesktop AS DWORD ' PWLX_SET_RETURN_DESKTOP
 WlxCreateUserDesktop AS DWORD ' PWLX_CREATE_USER_DESKTOP
 WlxChangePasswordNotifyEx AS DWORD ' PWLX_CHANGE_PASSWORD_NOTIFY_EX
END TYPE
' // Size = 72 bytes
TYPE WLX_DISPATCH_VERSION_1_2 DWORD
 WlxUseCtrlAltDel AS DWORD ' PWLX_USE_CTRL_ALT_DEL
 WlxSetContextPointer AS DWORD ' PWLX_SET_CONTEXT_POINTER
 WlxSasNotify AS DWORD ' PWLX_SAS_NOTIFY
 WlxSetTimeout AS DWORD ' PWLX_SET_TIMEOUT
 WlxAssignShellProtection AS DWORD ' PWLX_ASSIGN_SHELL_PROTECTION
 WlxMessageBox AS DWORD ' PWLX_MESSAGE_BOX
 WlxDialogBox AS DWORD ' PWLX_DIALOG_BOX
 WlxDialogBoxParam AS DWORD ' PWLX_DIALOG_BOX_PARAM
 WlxDialogBoxIndirect AS DWORD ' PWLX_DIALOG_BOX_INDIRECT
 WlxDialogBoxIndirectParam AS DWORD ' PWLX_DIALOG_BOX_INDIRECT_PARAM
 WlxSwitchDesktopToUser AS DWORD ' PWLX_SWITCH_DESKTOP_TO_USER
 WlxSwitchDesktopToWinlogon AS DWORD ' PWLX_SWITCH_DESKTOP_TO_WINLOGON
 WlxChangePasswordNotify AS DWORD ' PWLX_CHANGE_PASSWORD_NOTIFY
 WlxGetSourceDesktop AS DWORD ' PWLX_GET_SOURCE_DESKTOP
 WlxSetReturnDesktop AS DWORD ' PWLX_SET_RETURN_DESKTOP
 WlxCreateUserDesktop AS DWORD ' PWLX_CREATE_USER_DESKTOP
 WlxChangePasswordNotifyEx AS DWORD ' PWLX_CHANGE_PASSWORD_NOTIFY_EX
 WlxCloseUserDesktop AS DWORD ' PWLX_CLOSE_USER_DESKTOP
END TYPE
' // Size = 100 bytes
TYPE WLX_DISPATCH_VERSION_1_3 DWORD
 WlxUseCtrlAltDel AS DWORD ' PWLX_USE_CTRL_ALT_DEL
 WlxSetContextPointer AS DWORD ' PWLX_SET_CONTEXT_POINTER
 WlxSasNotify AS DWORD ' PWLX_SAS_NOTIFY
 WlxSetTimeout AS DWORD ' PWLX_SET_TIMEOUT
 WlxAssignShellProtection AS DWORD ' PWLX_ASSIGN_SHELL_PROTECTION
 WlxMessageBox AS DWORD ' PWLX_MESSAGE_BOX
 WlxDialogBox AS DWORD ' PWLX_DIALOG_BOX
 WlxDialogBoxParam AS DWORD ' PWLX_DIALOG_BOX_PARAM
 WlxDialogBoxIndirect AS DWORD ' PWLX_DIALOG_BOX_INDIRECT
 WlxDialogBoxIndirectParam AS DWORD ' PWLX_DIALOG_BOX_INDIRECT_PARAM
 WlxSwitchDesktopToUser AS DWORD ' PWLX_SWITCH_DESKTOP_TO_USER
 WlxSwitchDesktopToWinlogon AS DWORD ' PWLX_SWITCH_DESKTOP_TO_WINLOGON
 WlxChangePasswordNotify AS DWORD ' PWLX_CHANGE_PASSWORD_NOTIFY
 WlxGetSourceDesktop AS DWORD ' PWLX_GET_SOURCE_DESKTOP
 WlxSetReturnDesktop AS DWORD ' PWLX_SET_RETURN_DESKTOP
 WlxCreateUserDesktop AS DWORD ' PWLX_CREATE_USER_DESKTOP
 WlxChangePasswordNotifyEx AS DWORD ' PWLX_CHANGE_PASSWORD_NOTIFY_EX
 WlxCloseUserDesktop AS DWORD ' PWLX_CLOSE_USER_DESKTOP
 WlxSetOption AS DWORD ' PWLX_SET_OPTION
 WlxGetOption AS DWORD ' PWLX_GET_OPTION
 WlxWin31Migrate AS DWORD ' PWLX_WIN31_MIGRATE
 WlxQueryClientCredentials AS DWORD ' PWLX_QUERY_CLIENT_CREDENTIALS
 WlxQueryInetConnectorCredentials AS DWORD ' PWLX_QUERY_IC_CREDENTIALS
 WlxDisconnect AS DWORD ' PWLX_DISCONNECT
 WlxQueryTerminalServicesData AS DWORD ' PWLX_QUERY_TERMINAL_SERVICES_DATA
END TYPE
' // Size = 108 bytes
TYPE WLX_DISPATCH_VERSION_1_4 DWORD
 WlxUseCtrlAltDel AS DWORD ' PWLX_USE_CTRL_ALT_DEL
 WlxSetContextPointer AS DWORD ' PWLX_SET_CONTEXT_POINTER
 WlxSasNotify AS DWORD ' PWLX_SAS_NOTIFY
 WlxSetTimeout AS DWORD ' PWLX_SET_TIMEOUT
 WlxAssignShellProtection AS DWORD ' PWLX_ASSIGN_SHELL_PROTECTION
 WlxMessageBox AS DWORD ' PWLX_MESSAGE_BOX
 WlxDialogBox AS DWORD ' PWLX_DIALOG_BOX
 WlxDialogBoxParam AS DWORD ' PWLX_DIALOG_BOX_PARAM
 WlxDialogBoxIndirect AS DWORD ' PWLX_DIALOG_BOX_INDIRECT
 WlxDialogBoxIndirectParam AS DWORD ' PWLX_DIALOG_BOX_INDIRECT_PARAM
 WlxSwitchDesktopToUser AS DWORD ' PWLX_SWITCH_DESKTOP_TO_USER
 WlxSwitchDesktopToWinlogon AS DWORD ' PWLX_SWITCH_DESKTOP_TO_WINLOGON
 WlxChangePasswordNotify AS DWORD ' PWLX_CHANGE_PASSWORD_NOTIFY
 WlxGetSourceDesktop AS DWORD ' PWLX_GET_SOURCE_DESKTOP
 WlxSetReturnDesktop AS DWORD ' PWLX_SET_RETURN_DESKTOP
 WlxCreateUserDesktop AS DWORD ' PWLX_CREATE_USER_DESKTOP
 WlxChangePasswordNotifyEx AS DWORD ' PWLX_CHANGE_PASSWORD_NOTIFY_EX
 WlxCloseUserDesktop AS DWORD ' PWLX_CLOSE_USER_DESKTOP
 WlxSetOption AS DWORD ' PWLX_SET_OPTION
 WlxGetOption AS DWORD ' PWLX_GET_OPTION
 WlxWin31Migrate AS DWORD ' PWLX_WIN31_MIGRATE
 WlxQueryClientCredentials AS DWORD ' PWLX_QUERY_CLIENT_CREDENTIALS
 WlxQueryInetConnectorCredentials AS DWORD ' PWLX_QUERY_IC_CREDENTIALS
 WlxDisconnect AS DWORD ' PWLX_DISCONNECT
 WlxQueryTerminalServicesData AS DWORD ' PWLX_QUERY_TERMINAL_SERVICES_DATA
 WlxQueryConsoleSwitchCredentials AS DWORD ' PWLX_QUERY_CONSOLESWITCH_CREDENTIALS
 WlxQueryTsLogonCredentials AS DWORD ' PWLX_QUERY_TS_LOGON_CREDENTIALS
END TYPE
'//
'// Non-GINA notification DLLs
'//
'typedef DWORD (*PFNMSGECALLBACK)(BOOL bVerbose, LPWSTR lpMessage);
'FUNCTION FNMSGECALLBACK (BYVAL bVerbose AS LONG, BYREF lpMessage AS WSTRINGZ) AS DWORD
' // Size = 32 bytes
TYPE WLX_NOTIFICATION_INFO DWORD
 Size AS DWORD ' ULONG
 Flags AS DWORD ' ULONG
 UserName AS WSTRINGZ PTR
 Domain AS WSTRINGZ PTR
 WindowStation AS WSTRINGZ PTR
 hToken AS DWORD
 hDesktop AS DWORD ' HDESK
 pStatusCallback AS DWORD
END TYPE
#ENDIF
