Gina编程---发布头文件(wlx.h) ( 积分: 0 )

  • 主题发起人 主题发起人 linuxping
  • 开始时间 开始时间
L

linuxping

Unregistered / Unconfirmed
GUEST, unregistred user!
unit Wlx;

interface
uses Windows, Messages, SysUtils,Classes,Dialogs,
CommonFunction;

{$INCLUDE NTVersion.inc}


const
MSGINADLL='msgina.dll';

{$IFNDEF _WINWLX_}
{$define _WINWLX_}
{$ENDIF }

{******************************************************}
{有2个版本的Gina: Major revision 和 minor revision. }
{ Major revision使用在高于16位的系统. }
{ minor revision使用在低于16位的系统. }
{******************************************************}
WLX_VERSION_1_0 =$00010000;
WLX_VERSION_1_1 =$00010001;
WLX_VERSION_1_2 =$00010002;
WLX_VERSION_1_3 =$00010003;
//WLX_VERSION_1_4 =$00010004; //不被支持
WLX_CURRENT_VERSION =WLX_VERSION_1_3;

{*******************************************************}
{ 安全口令系列类型定义 }
{这些值被具有dwSasType参数的函数使用. }
{从0..127的值已被系统使用,用户自定义的类型必须大于127. }
{*******************************************************}
WLX_SAS_TYPE_TIMEOUT =0;
WLX_SAS_TYPE_CTRL_ALT_DEL =1; // CTRL+ALT+DEL三键被按下
WLX_SAS_TYPE_SCRNSVR_TIMEOUT =2; //键盘和鼠标没有使用导致屏保出现{It is up to the GINA DLL whether this constitutes a workstation locking event.}
WLX_SAS_TYPE_SCRNSVR_ACTIVITY =3; //处于屏保状态时键盘或鼠标被使用.(退出屏保)
WLX_SAS_TYPE_USER_LOGOFF =4;
WLX_SAS_TYPE_SC_INSERT =5;
WLX_SAS_TYPE_SC_REMOVE =6;
WLX_SAS_TYPE_AUTHENTICATED =7;
WLX_SAS_TYPE_SC_FIRST_READER_ARRIVED=8;
WLX_SAS_TYPE_SC_LAST_READER_REMOVED =9;
WLX_SAS_TYPE_SWITCHUSER =10;
WLX_SAS_TYPE_MAX_MSFT_VALUE =127;

{*******************************************************}
{成功登录之后,Gina.dll会提供一些选项给WinLogon. }
{这些选项通过WlxLoggedOutSas函数的dwOptions参数被传递 }
{*******************************************************}
WLX_LOGON_OPT_NO_PROFILE =$00000001; //
WLX_LOGON_OPT_USE_GROUPPOLICY =$00000002; //提交组策略给用户

{*******************************************************}
{成功登录之后,Gina.dll期望返回一个信息给WinLogon. }
{这个信息允许WinLogon做2件事情: }
{ 1> 支持Profile载入. }
{ 2> 追加网络提供者. }
{为了不同的信息可以传递给Winlogon,每一个profile结构体的 }
{第一个DWord成员必须是一个类型标志.下面的常量定义了可以 }
{使用的类型标志. }
{标准的profile 类型标志是 V2_0 }
{*******************************************************}
WLX_PROFILE_TYPE_V1_0 =1;
WLX_PROFILE_TYPE_V2_0 =2;

{*******************************************************}
{WlxLoggedOnSas() 和 WlxWkstaLockedSas()函数返回一个值, }
{这个值指示WinLogon执行一些动作(或者什么也不执行). }
{下面定义了这2个函数的一些(并非全部)返回值. }
{*******************************************************}
WLX_SAS_ACTION_LOGON =1; //用户已登录
WLX_SAS_ACTION_NONE =2; //不改变Windows工作站的状态
WLX_SAS_ACTION_LOCK_WKSTA =3; //锁定工作站,等待下一个SAS事件.
WLX_SAS_ACTION_LOGOFF =4; //用户退出工作站
WLX_SAS_ACTION_SHUTDOWN =5; //用户退出工作站,并关闭系统
WLX_SAS_ACTION_PWD_CHANGED =6; //用户改变密码.通知网络提供者.
WLX_SAS_ACTION_TASKLIST =7; //调用Task List.
WLX_SAS_ACTION_UNLOCK_WKSTA =8; //解锁工作站.
WLX_SAS_ACTION_FORCE_LOGOFF =9; //强制用户退出
WLX_SAS_ACTION_SHUTDOWN_POWER_OFF =10; //关闭计算机
WLX_SAS_ACTION_SHUTDOWN_REBOOT =11; //Reboot machine after shutting down.
WLX_SAS_ACTION_SHUTDOWN_SLEEP =12; //Put the machine to sleep
WLX_SAS_ACTION_SHUTDOWN_SLEEP2 =13; //Put the machine to sleep and disable wakeup events
WLX_SAS_ACTION_SHUTDOWN_HIBERNATE =14; //Hibernate the machine
WLX_SAS_ACTION_RECONNECTED =15;
WLX_SAS_ACTION_DELAYED_FORCE_LOGOFF =16;
WLX_SAS_ACTION_SWITCH_CONSOLE =17;


{********************************************}
{ 消息. }
{ wParam传递SAS事件类型. }
{********************************************}
WLX_WM_SAS =WM_USER + 601;

{********************************************}
{ 对话框的返回值 }
{********************************************}
WLX_DLG_SAS =101;
WLX_DLG_INPUT_TIMEOUT =102; // Insert (keys, etc) timed out
WLX_DLG_SCREEN_SAVER_TIMEOUT =103; // Screen Saver activated
WLX_DLG_USER_LOGOFF =104; // User logged off

WLX_CONSOLESWITCHCREDENTIAL_TYPE_V1_0=1;

STATUSMSG_OPTION_NOANIMATION =1;
STATUSMSG_OPTION_SETFOREGROUND =2;

type
{*********************************************************}
{ 登录之后,WLX_PROFILE_*结构体将由Gina.dll返回. }
{这些结构体将被WinLogon用来支持追加网络提供者 和 载入 }
{新用户的Profile. (原文:This information is used by }
{ Winlogon to support supplemental Network Providers and }
{ to load the newly logged-on user's profile.) }
{ }
{ Winlogon有责任释放这2个结构提及其成员. }
{*********************************************************}
PVOID=Pointer;
PPVOID=^PVOID;
_LUID=packed record
LowPart :DWORD;
HighPart :int64;
end;
LUID=_LUID;
PLUID=^_LUID;

_WLX_PROFILE_V1_0=packed record
{************************************************}
{这个成员字段识别由Gina.dll返回的Profile的类型. }
{它允许Winlogon进行类型转换. }
{ Profile类型被定义成 WLX_PROFILE_TYPE_xxx 前缀. }
{************************************************}
dwType :DWORD;

{************************************************}
{将被载入的Profile的路径. }
{这个字段指向的缓冲区必须被分配.不再使用时,须由 }
{Winlogon释放. }
{************************************************}
pszProfile :PWideChar;
end;
WLX_PROFILE_V1_0 =_WLX_PROFILE_V1_0;
PWLX_PROFILE_V1_0 =^_WLX_PROFILE_V1_0;

_WLX_PROFILE_V2_0 =packed record
dwType :DWORD; //同 _WLX_PROFILE_V1_0.dwType
pszProfile :PWideChar; //同 _WLX_PROFILE_V1_0.pszProfile,但可以为NULL(表示本地的Profile).

{************************************************}
{ 策略的路径名. }
{可以设为Null,以阻止网络认证. }
{这个字段指向的缓冲区必须被分配.不再使用时,须由 }
{Winlogon释放. }
{************************************************}
pszPolicy :PWideChar;

{******************************************************************}
{ pathname of network default user profile }
{它可以为Null. 这将使得默认的用户Profile在本机. }
{ }
{这个字段指向的缓冲区必须被分配.不再使用时,须由Winlogon释放. }
{******************************************************************}
pszNetworkDefaultUserProfile :PWideChar;


{*******************************************************************}
{ 使用户帐号生效的服务的名字. }
{它用来枚举用户所在的 全局的组.它可以为Null. }
{(原文: This is used to enumerate globals groups the user belongs }
{ to for policy support. This parameter can be NULL.) }
{ }
{这个字段指向的缓冲区必须被分配.不再使用时,须由Winlogon释放. }
{*******************************************************************}
pszServerName :PWideChar;

{*******************************************************************}
{指向一系列由NULL结尾的环境变量 }
{格式: 环境变量名 = 值 或者 环境变量名 = %OtherVar%/more text }
{每一个环境变量都以NULL结尾,最后一个环境变量必须以2个Null结尾. }
{环境变量可以包含其它环境变量.这就要用到"%"标记. }
{该参数可以为Null. }
{该参数指向的缓冲区必须被分配.不再使用时,须由Winlogon释放. }
{*******************************************************************}
pszEnvironment :PWideChar;
end;
WLX_PROFILE_V2_0 =_WLX_PROFILE_V2_0;
PWLX_PROFILE_V2_0 =^_WLX_PROFILE_V2_0;


{*************************************************************************}
{认证之后,WLX_MPR_NOTIFICATION_INFO结构体将由Gina.dll返回. }
{这些结构体将被WinLogon用来提供 收集来的认证和鉴别信息 给网络提供者. }
{(原文: This information is used by Winlogon to provide identification }
{ and authentication information already collected to network providers.)}
{ }
{ Winlogon有责任释放这2个结构提及其成员. }
{*************************************************************************}
_WLX_MPR_NOTIFY_INFO =packed record
{*************************************************************************}
{ 登录帐号 }
{ 它指向的缓冲区必须被分配.不再使用时,须由Winlogon释放. }
{*************************************************************************}
pszUserName :PWideChar;
pszDomain :PWideChar;
pszPassword :PWideChar; //密码.它指向的缓冲区必须被分配.不再使用时,须由Winlogon释放.

{*************************************************************************}
{ 旧密码 }
{ 当用户更改了密码,pszOldPassword指向以前的密码.新密码由pszPassword保存. }
{ }
{ 它指向的缓冲区必须被分配.不再使用时,须由Winlogon释放. }
{*************************************************************************}
pszOldPassword :PWideChar;
END;
WLX_MPR_NOTIFY_INFO=_WLX_MPR_NOTIFY_INFO;
PWLX_MPR_NOTIFY_INFO=^_WLX_MPR_NOTIFY_INFO;



////////////////////////////////////////////////////////////////////////
// //
// Winlogon 提供的服务 //
// //
////////////////////////////////////////////////////////////////////////
const
WLX_DESKTOP_NAME =$00000001; // Name present
WLX_DESKTOP_HANDLE =$00000002; // Handle present
type
_WLX_DESKTOP=packed record
Size :DWORD;
Flags :DWORD;
hDesktop :HDESK;
pszDesktopName :PWideChar;
end;

{回调函数,处理对话框的消息循环.}
DLGPROC=function(hHwnd:HWND;Msg:Longword;wP:wParam;lP:lParam):Bool;stdcall;

DLGTEMPLATE=packed record
_Style :DWORD;
_dwExtendedStyle :DWORD;
_cdit :WORD;
_x :Short;
_y :Short;
_cx :Short;
_cy :Short;
end;
LPCDLGTEMPLATE=^DLGTEMPLATE;

WLX_DESKTOP=_WLX_DESKTOP;
PWLX_DESKTOP=^_WLX_DESKTOP;
PPWLX_DESKTOP=^PWLX_DESKTOP;

PWLX_USE_CTRL_ALT_DEL= procedure(hWlx:THandle);stdcall;
PWLX_SET_CONTEXT_POINTER= procedure(hWlx:THandle;pWlxContext:Pointer);stdcall;
PWLX_SAS_NOTIFY= procedure(hWlx:THandle;dwSasType:DWORD);stdcall;
PWLX_SET_TIMEOUT= function(hWlx:THandle;Timeout:DWORD):Bool;stdcall;
PWLX_ASSIGN_SHELL_PROTECTION= function(hWlx,hToken,hProcess,hThread:THandle):Integer;stdcall;
PWLX_MESSAGE_BOX= function(hWlx:THandle;hwndOwner:HWND;
lpszText,lpszTitle:PWideChar;fuStyle:LongWord):Integer;Stdcall;
PWLX_DIALOG_BOX= function(hWlx,hInst:THandle;lpszTemplate:PWideChar;
hwndOwner:THandle;dlgprc:DLGPROC):Integer;stdcall;
PWLX_DIALOG_BOX_INDIRECT= function(hWlx,hInst:THandle;hDialogTemplate:LPCDLGTEMPLATE;
hwndOwner:HWND;dlgprc:DLGPROC):Integer;stdcall;
PWLX_DIALOG_BOX_PARAM= function(hWlx,hInst:THandle;lpszTemplate:PWideChar;
hwndOwner:HWND;dlgprc:DLGPROC;dwInitParam:LPARAM):Integer;stdcall;
PWLX_DIALOG_BOX_INDIRECT_PARAM= function(hWlx,hInst:THandle;
hDialogTemplate:LPCDLGTEMPLATE;hwndOwner:HWND;dlgprc:DLGPROC;
dwInitParam:LPARAM):Integer;stdcall;
PWLX_SWITCH_DESKTOP_TO_USER= function(hWlx:THandle):Integer;stdcall;
PWLX_SWITCH_DESKTOP_TO_WINLOGON= function(hWlx:THandle):Integer;stdcall;

PWLX_CHANGE_PASSWORD_NOTIFY= function(hWlx:THandle;pMprInfo:PWLX_MPR_NOTIFY_INFO;
dwChangeInfo:DWORD):Integer;stdcall;

PWLX_GET_SOURCE_DESKTOP= function(hWlx:THandle;ppDesktop:PPWLX_DESKTOP):bool;stdcall;

PWLX_SET_RETURN_DESKTOP= function(hWlx:THandle;pDesktop:PWLX_DESKTOP):Bool;stdcall;
PWLX_CREATE_USER_DESKTOP= function(hWlx,hToken:THandle;Flags:DWORD;
pszDesktopName:PWideChar;ppDesktop:PPWLX_DESKTOP):bool;stdcall;
PWLX_CLOSE_USER_DESKTOP= function(hwxl:THandle;PWLX_DESKTOP:PWLX_DESKTOP;hToken:THandle):LongBool;stdcall;
PWLX_SET_OPTION= function(hwxl:THandle;Option:DWORD;Value:PWORD;var OldValue:PWORD):BOOL;stdcall; ///????
PWLX_GET_OPTION =function(hwxl:THandle;Option:DWORD;var OldValue:PWORD):BOOL;stdcall;
PWLX_WIN31_MIGRATE =procedure(hwxl:THandle);stdcall;

_WLX_CLIENT_CREDENTIALS_INFO=packed record
dwType: DWORD;
pszUserName,
pszDomain,
pszPassword :PWideChar;
fPromptForPassword:BOOL;
end;
WLX_CLIENT_CREDENTIALS_INFO_V1_0 = _WLX_CLIENT_CREDENTIALS_INFO;
PWLX_CLIENT_CREDENTIALS_INFO_V1_0 =^_WLX_CLIENT_CREDENTIALS_INFO;

_WLX_CLIENT_CREDENTIALS_INFO_2_0=packed record
dwType:DWORD;
pszUserName,
pszDomain,
pszPassword :PWideChar;
fPromptForPassword,
fDisconnectOnLogonFailure:BOOL;

end;
WLX_CLIENT_CREDENTIALS_INFO_V2_0 = _WLX_CLIENT_CREDENTIALS_INFO_2_0;
P_WLX_CLIENT_CREDENTIALS_INFO_2_0 = ^_WLX_CLIENT_CREDENTIALS_INFO_2_0;

{_WLX_CONSOLESWITCH_CREDENTIALS_INFO= packed record
dwType: DWORD;
UserToken: THandle;
LogonId: LUID;
Quotas: QUOTA_LIMITS;
UserName,
Domain: PWideChar;
LogonTime: LARGE_INTEGER;
SmartCardLogon:BOOL;
ProfileLength: ULONG;
MessageType: DWORD;
LogonCount, //UShort???????
BadPasswordCount: Word;
ProfileLogonTime,
LogoffTime,
KickOffTime,
PasswordLastSet,
PasswordCanChange,
PasswordMustChange:LARGE_INTEGER
LogonScript,
HomeDirectory,
FullName,
ProfilePath,
HomeDirectoryDrive,
LogonServer:PWideChar;
UserFlags,
PrivateDataLen:ULONG;
PrivateData :PByte;
end;
WLX_CONSOLESWITCH_CREDENTIALS_INFO_V1_0= _WLX_CONSOLESWITCH_CREDENTIALS_INFO;
PWLX_CONSOLESWITCH_CREDENTIALS_INFO_V1_0=^_WLX_CONSOLESWITCH_CREDENTIALS_INFO; }

{ _WLX_MPR_NOTIFY_INFO=packed record
pszUserName,pszDomain,pszPassword,pszOldPassword:PWideChar;
end;
WLX_MPR_NOTIFY_INFO=_WLX_MPR_NOTIFY_INFO;
PWLX_MPR_NOTIFY_INFO=^_WLX_MPR_NOTIFY_INFO; }

PWLX_QUERY_CLIENT_CREDENTIALS=function(pCred:PWLX_CLIENT_CREDENTIALS_INFO_V1_0):BOOL;stdcall;
PWLX_QUERY_IC_CREDENTIALS =function(pCred:PWLX_CLIENT_CREDENTIALS_INFO_V1_0):BOOL;stdcall;
PWLX_DISCONNECT =function:BOOL;


const
WLX_CREATE_INSTANCE_ONLY =$00000001;
WLX_CREATE_USER =$00000002;
type
PWLX_CHANGE_PASSWORD_NOTIFY_EX=function(
hWlx:THandle;
pMprInfo:PWLX_MPR_NOTIFY_INFO;
dwChangeInfo:DWORD;
ProviderName:PWideChar;
Reserved:PVOID
):Integer;stdcall;

////////////////////////////////////////////////////////////////////////
// //
// Function dispatch tables. //
// 初始化期间,当WlxInitialize()被调用时,下面3个函数分发表之一将被传递//
// 给GINA.DLL. //
// //
// NOTE: FOR THIS REVISION THERE IS ONLY ONE TABLE. DEVELOPERS //
// SHOULD EXPECT MORE IN FUTURE RELEASE. //
// //
////////////////////////////////////////////////////////////////////////


{*********************************************************************}
{ 版本WLX_VERSION_1_0的函数分发表 }
{ NT3.51支持的函数集 }
{*********************************************************************}
_WLX_DISPATCH_VERSION_1_0=packed record
WlxUseCtrlAltDel :PWLX_USE_CTRL_ALT_DEL;
WlxSetContextPointer :PWLX_SET_CONTEXT_POINTER;
WlxSasNotify :PWLX_SAS_NOTIFY;
WlxSetTimeout :PWLX_SET_TIMEOUT;
WlxAssignShellProtection :PWLX_ASSIGN_SHELL_PROTECTION;
WlxMessageBox :PWLX_MESSAGE_BOX;
WlxDialogBox :PWLX_DIALOG_BOX;
WlxDialogBoxParam :PWLX_DIALOG_BOX_PARAM;
WlxDialogBoxIndirect :PWLX_DIALOG_BOX_INDIRECT;
WlxDialogBoxIndirectParam :PWLX_DIALOG_BOX_INDIRECT_PARAM;
WlxSwitchDesktopToUser :PWLX_SWITCH_DESKTOP_TO_USER;
WlxSwitchDesktopToWinlogon :PWLX_SWITCH_DESKTOP_TO_WINLOGON;
WlxChangePasswordNotify :PWLX_CHANGE_PASSWORD_NOTIFY;
end;
WLX_DISPATCH_VERSION_1_0=_WLX_DISPATCH_VERSION_1_0;
PWLX_DISPATCH_VERSION_1_0=^_WLX_DISPATCH_VERSION_1_0;

{*********************************************************************}
{ 版本WLX_VERSION_1_1的分发表 }
{ WinNT4.0使用该分发表 }
{*********************************************************************}
_WLX_DISPATCH_VERSION_1_1=packed record
WlxUseCtrlAltDel :PWLX_USE_CTRL_ALT_DEL;
WlxSetContextPointer :PWLX_SET_CONTEXT_POINTER;
WlxSasNotify :PWLX_SAS_NOTIFY;
WlxSetTimeout :PWLX_SET_TIMEOUT;
WlxAssignShellProtection :PWLX_ASSIGN_SHELL_PROTECTION;
WlxMessageBox :PWLX_MESSAGE_BOX;
WlxDialogBox :PWLX_DIALOG_BOX;
WlxDialogBoxParam :PWLX_DIALOG_BOX_PARAM;
WlxDialogBoxIndirect :PWLX_DIALOG_BOX_INDIRECT;
WlxDialogBoxIndirectParam :PWLX_DIALOG_BOX_INDIRECT_PARAM;
WlxSwitchDesktopToUser :PWLX_SWITCH_DESKTOP_TO_USER;
WlxSwitchDesktopToWinlogon :PWLX_SWITCH_DESKTOP_TO_WINLOGON;
WlxChangePasswordNotify :PWLX_CHANGE_PASSWORD_NOTIFY;
WlxGetSourceDesktop :PWLX_GET_SOURCE_DESKTOP;
WlxSetReturnDesktop :PWLX_SET_RETURN_DESKTOP;
WlxCreateUserDesktop :PWLX_CREATE_USER_DESKTOP;
WlxChangePasswordNotifyEx :PWLX_CHANGE_PASSWORD_NOTIFY_EX;
end;
WLX_DISPATCH_VERSION_1_1=_WLX_DISPATCH_VERSION_1_1;
PWLX_DISPATCH_VERSION_1_1=^_WLX_DISPATCH_VERSION_1_1;

{*********************************************************************}
{ 版本WLX_VERSION_1_2的分发表 }
{ WLX_DISPATCH_VERSION_1_2使用在NT SP4机器及其后续版本. ?? NT200}
{*********************************************************************}
_WLX_DISPATCH_VERSION_1_2=packed record
WlxUseCtrlAltDel :PWLX_USE_CTRL_ALT_DEL;
WlxSetContextPointer :PWLX_SET_CONTEXT_POINTER;
WlxSasNotify :PWLX_SAS_NOTIFY;
WlxSetTimeout :PWLX_SET_TIMEOUT;
WlxAssignShellProtection :PWLX_ASSIGN_SHELL_PROTECTION;
WlxMessageBox :PWLX_MESSAGE_BOX;
WlxDialogBox :PWLX_DIALOG_BOX;
WlxDialogBoxParam :PWLX_DIALOG_BOX_PARAM;
WlxDialogBoxIndirect :PWLX_DIALOG_BOX_INDIRECT;
WlxDialogBoxIndirectParam :PWLX_DIALOG_BOX_INDIRECT_PARAM;
WlxSwitchDesktopToUser :PWLX_SWITCH_DESKTOP_TO_USER;
WlxSwitchDesktopToWinlogon :PWLX_SWITCH_DESKTOP_TO_WINLOGON;
WlxChangePasswordNotify :PWLX_CHANGE_PASSWORD_NOTIFY;
WlxGetSourceDesktop :PWLX_GET_SOURCE_DESKTOP;
WlxSetReturnDesktop :PWLX_SET_RETURN_DESKTOP;
WlxCreateUserDesktop :PWLX_CREATE_USER_DESKTOP;
WlxChangePasswordNotifyEx :PWLX_CHANGE_PASSWORD_NOTIFY_EX;
WlxCloseUserDesktop :PWLX_CLOSE_USER_DESKTOP;
end;
WLX_DISPATCH_VERSION_1_2=_WLX_DISPATCH_VERSION_1_2;
PWLX_DISPATCH_VERSION_1_2=^_WLX_DISPATCH_VERSION_1_2;

{*********************************************************************}
{ 版本WLX_VERSION_1_3的分发表 }
{ WLX_DISPATCH_VERSION_1_3使用在XP ??? }
{*********************************************************************}
_WLX_DISPATCH_VERSION_1_3=packed record
WlxUseCtrlAltDel :PWLX_USE_CTRL_ALT_DEL;
WlxSetContextPointer :PWLX_SET_CONTEXT_POINTER;
WlxSasNotify :PWLX_SAS_NOTIFY;
WlxSetTimeout :PWLX_SET_TIMEOUT;
WlxAssignShellProtection :PWLX_ASSIGN_SHELL_PROTECTION;
WlxMessageBox :PWLX_MESSAGE_BOX;
WlxDialogBox :PWLX_DIALOG_BOX;
WlxDialogBoxParam :PWLX_DIALOG_BOX_PARAM;
WlxDialogBoxIndirect :PWLX_DIALOG_BOX_INDIRECT;
WlxDialogBoxIndirectParam :PWLX_DIALOG_BOX_INDIRECT_PARAM;
WlxSwitchDesktopToUser :PWLX_SWITCH_DESKTOP_TO_USER;
WlxSwitchDesktopToWinlogon :PWLX_SWITCH_DESKTOP_TO_WINLOGON;
WlxChangePasswordNotify :PWLX_CHANGE_PASSWORD_NOTIFY;
WlxGetSourceDesktop :PWLX_GET_SOURCE_DESKTOP;
WlxSetReturnDesktop :PWLX_SET_RETURN_DESKTOP;
WlxCreateUserDesktop :PWLX_CREATE_USER_DESKTOP;
WlxChangePasswordNotifyEx :PWLX_CHANGE_PASSWORD_NOTIFY_EX;
WlxCloseUserDesktop :PWLX_CLOSE_USER_DESKTOP;
WlxSetOption :PWLX_SET_OPTION;
WlxGetOption :PWLX_GET_OPTION;
WlxWin31Migrate :PWLX_WIN31_MIGRATE;
WlxQueryClientCredentials :PWLX_QUERY_CLIENT_CREDENTIALS;
WlxQueryInetConnectorCredentials :PWLX_QUERY_IC_CREDENTIALS;
WlxDisconnect :PWLX_DISCONNECT;
end;
WLX_DISPATCH_VERSION_1_3=_WLX_DISPATCH_VERSION_1_3;
PWLX_DISPATCH_VERSION_1_3=^_WLX_DISPATCH_VERSION_1_3;

/////////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////////

{******************************************************************}
{GINA通常会分配一些自己需要的内存.在MS自己的样板例程里,GINA需要分配}
{一段内存,记录的是一些全局变量.这些变量的定义如下: }
{******************************************************************}
_MiniAccount=record
pszUsername,
pszDomain,
pszPassword,
pszComment :PWideChar;
IconId,
Flags :DWORD;
end;
MiniAccount=_MiniAccount;
PMiniAccount=^_MiniAccount;

_Globals=record
fAllowNewUser,
fAutoLogonAtBoot,
fAutoLogonAlways :BOOL;
hUserToken :THandle;
pAccount :PMiniAccount;
end;
Globals=_Globals;
PGlobals=^_Globals;

const
{******************************************************}
{ShellShutdownDialog将返回一个值,告诉Logon执行什么操作.}
{返回值在下面被定义: }
{******************************************************}
SHUT_DOWN_NONE = 0; //无操作
SHUT_DOWN_LOGOUT = 1; //注销
SHUT_DOWN_POWEROFF = 2; //关机
SHUT_DOWN_REBOOT = 4; //重启
SHUT_DOWN_WAIT = 16; //待机
SHUT_DOWN_DORMANCY = 64; //休眠

type
{下面定义了3个结构体,关于这3个结构体的说明,请参见本目录下的"Client/MyGina/Doc/xxxx.txt"}

{ Gina Context }
_GINA_CONTEXT = record
bAllowNewUser : boolean;
bAutoLogonAtBoot : boolean;
bAutoLogonAlways : boolean; //自动登录
LoginName : PWideChar;
Password : PWideChar;
Domain : PWideChar;
LoginOnTime : PWideChar;
hWlx : THANDLE;
station : PWideChar;
{$IF VERSION>=1.3}
pWlxFuncs : PWLX_DISPATCH_VERSION_1_3;
{$ELSEIF VERSION>=1.2}
pWlxFuncs : PWLX_DISPATCH_VERSION_1_2;
{$ELSEIF VERSION>=1.1}
pWlxFuncs : PWLX_DISPATCH_VERSION_1_1;
{$ELSEIF VERSION>=1.0}
pWlxFuncs : PWLX_DISPATCH_VERSION_1_0;
{$IFEND}
hDllInstance : THANDLE;
UserToken : THANDLE;
end;
GINA_CONTEXT = _GINA_CONTEXT;
PGINA_CONTEXT = ^_GINA_CONTEXT;

{ http://msdn.microsoft.com/library/default.asp?url=/library/en-us/ security/Security/token_type.asp}
tagTOKEN_TYPE = (TokenPrimary = 1, //显示主令牌
TokenImpersonation //扮演者的令牌
);
TOKEN_TYPE = tagTOKEN_TYPE;

{ http://msdn.microsoft.com/library/default.asp?url=/library/en-us/security/security/security_impersonation_level.asp}
_SECURITY_IMPERSONATION_LEVEL = (SecurityAnonymous = 0, //不能获得客户端信任信息
SecurityIdentification, //可以获得客户端信任信息
SecurityImpersonation, // 可以获得安全上下文,但不能获得本地或远程系统.
SecurityDelegation //NT不支持该选项
);
SECURITY_IMPERSONATION_LEVEL = _SECURITY_IMPERSONATION_LEVEL;

{ http://msdn.microsoft.com/library/default.asp?url=/library/en-us/security/Security/token_statistics.asp}
_TOKEN_STATISTICS = record
TokenId: LUID;
AuthenticationId: LUID;
ExpirationTime: LARGE_INTEGER;
TokenType: TOKEN_TYPE;
ImpersonationLevel: SECURITY_IMPERSONATION_LEVEL;
DynamicCharged: DWORD;
DynamicAvailable: DWORD;
GroupCount: DWORD;
PrivilegeCount: DWORD;
ModifiedId: LUID;
end;
TOKEN_STATISTICS = _TOKEN_STATISTICS;
PTOKEN_STATISTICS = ^_TOKEN_STATISTICS;

const
LOGON32_LOGON_UNLOCK = 7;


//--------------------------------------------------------
type
//显示windows退出系统对话框
TShellShutdownDialog= function (hParent:HWND;UserName:PChar;bHideLogoff:LongBool):dword;stdcall;
// 用户登陆成功后,Winlogon.exe调用该函数启动用户外壳程序
TWlxActivateUserShell= function (pWlxContext: pointer; pszDesktopName: PWideChar; pszMprLogonScript: PWideChar; pEnvironment: pointer): BOOL; stdcall;
// 当系统处于锁定状态时,Winlogon.exe调用该函数
// 显示一些信息,如锁定者、锁定时间等
TWlxDisplayLockedNotice= procedure (pWlxContext: pointer); stdcall;
// 当没有任何用户登陆时,Winlogon.exe调用该函数显示一些提示信息
// 可以根据用户的动作模拟SAS事件的发送
TWlxDisplaySASNotice= procedure (pWlxContext: pointer); stdcall;
// 当gina dll要显示一些信息时,Winlogon.exe调用该函数
// 直接返回TRUE表示信息已经显示
TWlxDisplayStatusMessage= function (pWlxContext: pointer; hDesktop: HDESK; dwOptions: DWORD; pTitle: PWideChar; pMessage: PWideChar): BOOL; stdcall;
// Winlogon.exe调用该函数得到gina dll显示的状态信息
// 直接返回TRUE表示信息已经接收
TWlxGetStatusMessage= function (pWlxContext: pointer; var pdwOptions: DWORD; pMessage: PWideChar; dwBufferSize: DWORD): BOOL; stdcall;
{初始化.提供函数分发表.}
TWlxInitialize= function (lpWinsta: LPWSTR; hWlx: THANDLE; pvReserved: pointer; pWinlogonFunctions: pointer; var WlxContext: PVOID): BOOL; stdcall;
// 在试图锁定工作站之前Winlogon.exe调用该函数,判断是否可以锁定
// 直接返回FALSE表示不能锁定
TWlxIsLockOk= function (pWlxContext: pointer): BOOL; stdcall;
// 在试图注销时Winlogon.exe调用该函数,判断能否注销
// 直接返回FALSE表示不能注销
TWlxIsLogoffOk= function (pWlxContext: pointer): BOOL; stdcall;
{用户已登陆并且工作站没有被加锁,如果此时接收到SAS事件,则Winlogon 调用此函数}
TWlxLoggedOnSAS= function (pWlxContext: pointer; dwSasType: DWORD; pReserved: pointer): integer; stdcall;
{没有用户登陆,如果此时收到SAS事件,则Winlogon 调用此函数}
TWlxLoggedOutSAS= function (pWlxContext: pointer; dwSasType: DWORD; pAuthenticationId: PLUID; pLogonSid: PSID; var pdwOptions: DWORD; var phToken: THANDLE; var pNprNotifyInfo: WlX_MPR_NOTIFY_INFO; out pProfile: pointer): integer; stdcall;
{ Winlogon.exe调用该函数,通知gina dll用户注销操作
允许gina dll做出相应的处理 }
TWlxLogoff= procedure (pWlxContext: pointer); stdcall;
{版本协商.}
TWlxNegotiate= function (dwWinlogonVersion: DWORD; out dwDllVersion: DWORD): BOOL; stdcall;
TWlxNetworkProviderLoad= function (pWlxContext: pointer; var pNprNotifyInfo: WLX_MPR_NOTIFY_INFO): BOOL; stdcall;
{ Winlogon.exe调用该函数,告诉gina dll停止显示状态信息
直接返回TRUE表示信息已经删除}
TWlxRemoveStatusMessage= function (pWlxContext: pointer): BOOL; stdcall;
{在关闭之前Winlogon 调用此函数,允许GINA实现任何关闭任务,例如从读卡器中退出智能卡}
TWlxShutdown= procedure (pWlxContext: pointer; ShutdownType: DWORD); stdcall;
{当工作站被锁定,如果接收到一个SAS,则Winlogon 调用此函数 }
TWlxWkstaLockedSAS= function (pWlxContext: pointer; dwSasType: DWORD): integer; stdcall;

{$IF VERSION>=1.3}
TWlxGetConsoleSwitchCredentials= function (pWlxContext: pointer; pCredInfo: pointer): BOOL; stdcall;
TWlxReconnectNotify= procedure (pWlxContext: pointer); stdcall;
TWlxDisconnectNotify= procedure (pWlxContext: pointer); stdcall;
{$IFEND}

{$IF VERSION>=1.2}
//NO NEW Functions.
{$IFEND}

{$IF VERSION>=1.1}
{当系统要求在用户上下文中启动程序,Winlogon.exe调用该函数
这种情况发生在:浏览器非正常关闭需要重启或需要启动扩展的任务管理器
该接口gina dll可以选择性实现}
TWlxStartApplication= function (pWlxContext: pointer; pszDesktopName: PWideChar; pEnvironment: pointer; pszCmdLine: PWideChar): BOOL; stdcall;
{在屏保程序启动前一瞬Winlogon.exe调用该函数,允许gina dll同屏保程序交互
返回FALSE表示屏保程序不能启动}
TWlxScreenSaverNotify= function (pWlxContext: pointer; var pSecure: BOOL): BOOL; stdcall;
{$IFEND}
//------------------------------------------------------------------

{ PrcShellShutdownDialog: TShellShutdownDialog;
PrcWlxActivateUserShell: TWlxActivateUserShell;
PrcWlxDisplayLockedNotice: TWlxDisplayLockedNotice;
PrcWlxDisplaySASNotice: TWlxDisplaySASNotice;
PrcWlxDisplayStatusMessage: TWlxDisplayStatusMessag
PrcWlxGetStatusMessage: TWlxGetStatusMessage;
PrcWlxInitialize: TWlxInitialize;
PrcWlxIsLockOk: TWlxIsLockOk
PrcWlxIsLogoffOk: TWlxIsLogoffOk;
PrcWlxLoggedOnSAS: TWlxLoggedOnSAS;
PrcWlxLoggedOutSAS: TWlxLoggedOutSAS;
PrcWlxLogoff: TWlxLogoff;
PrcWlxNegotiate: TWlxNegotiate;
PrcWlxNetworkProviderLoad: TWlxNetworkProviderLoad;
PrcWlxRemoveStatusMessage: TWlxRemoveStatusMessage;
PrcWlxScreenSaverNotify: TWlxScreenSaverNotify;
PrcWlxShutdown: TWlxShutdown;
PrcWlxStartApplication: TWlxStartApplication;
PrcWlxWkstaLockedSAS: TWlxWkstaLockedSAS;

//{$IF WinVersion=wvWinNT}
{PrcWlxGetConsoleSwitchCredentials: TWlxGetConsoleSwitchCredentials;
PrcWlxReconnectNotify: TWlxReconnectNotify;
PrcWlxDisconnectNotify: TWlxDisconnectNotify; }
//{$ENDIF}

//-----------------------------------------------------------
function MyShellShutdownDialog(hParent:HWND;UserName:PChar;bHideLogoff:LongBool):dword;stdcall;
function MyWlxActivateUserShell(pWlxContext: pointer; pszDesktopName: PWideChar; pszMprLogonScript: PWideChar; pEnvironment: pointer): BOOL; stdcall;
procedure MyWlxDisplayLockedNotice (pWlxContext: pointer); stdcall;
procedure MyWlxDisplaySASNotice(pWlxContext: pointer); stdcall;
function MyWlxDisplayStatusMessage(pWlxContext: pointer; hDesktop: HDESK; dwOptions: DWORD; pTitle: PWideChar; pMessage: PWideChar): BOOL; stdcall;
function MyWlxGetStatusMessage(pWlxContext: pointer; var pdwOptions: DWORD; pMessage: PWideChar; dwBufferSize: DWORD): BOOL; stdcall;
function MyWlxInitialize(lpWinsta: LPWSTR; hWlx: THANDLE; pvReserved: pointer; pWinlogonFunctions: pointer; var WlxContext: PVOID): BOOL; stdcall;
function MyWlxIsLockOk(pWlxContext: pointer): BOOL; stdcall;
function MyWlxIsLogoffOk(pWlxContext: pointer): BOOL; stdcall;
function MyWlxLoggedOnSAS(pWlxContext: pointer; dwSasType: DWORD; pReserved: pointer): integer; stdcall;
function MyWlxLoggedOutSAS(pWlxContext: pointer; dwSasType: DWORD; pAuthenticationId: PLUID; pLogonSid: PSID; var pdwOptions: DWORD; var phToken: THANDLE; var pNprNotifyInfo: WlX_MPR_NOTIFY_INFO; out pProfile: pointer): integer; stdcall;
procedure MyWlxLogoff(pWlxContext: pointer); stdcall;
function MyWlxNegotiate(dwWinlogonVersion: DWORD; out dwDllVersion: DWORD): BOOL; stdcall;
function MyWlxNetworkProviderLoad(pWlxContext: pointer; var pNprNotifyInfo: WLX_MPR_NOTIFY_INFO): BOOL; stdcall;
function MyWlxRemoveStatusMessage(pWlxContext: pointer): BOOL; stdcall;
procedure MyWlxShutdown(pWlxContext: pointer; ShutdownType: DWORD); stdcall;

{$IF VERSION>=1.1}
function MyWlxScreenSaverNotify(pWlxContext: pointer; var pSecure: BOOL): BOOL; stdcall;
function MyWlxStartApplication(pWlxContext: pointer; pszDesktopName: PWideChar; pEnvironment: pointer; pszCmdLine: PWideChar): BOOL; stdcall;
{$IFEND}

function MyWlxWkstaLockedSAS(pWlxContext: pointer; dwSasType: DWORD): integer; stdcall;

{$IF VERSION>=1.3}
function MyWlxGetConsoleSwitchCredentials(pWlxContext: pointer; pCredInfo: pointer): BOOL; stdcall;
procedure MyWlxReconnectNotify(pWlxContext: pointer); stdcall;
procedure MyWlxDisconnectNotify(pWlxContext: pointer); stdcall;
{$IFEND}

implementation

function MyShellShutdownDialog; external MSGINADLL name 'ShellShutdownDialog';
function MyWlxActivateUserShell; external MSGINADLL name 'WlxActivateUserShell';
procedure MyWlxDisplayLockedNotice; external MSGINADLL name 'WlxDisplayLockedNotice';
procedure MyWlxDisplaySASNotice; external MSGINADLL name 'WlxDisplaySASNotice';
function MyWlxDisplayStatusMessage; external MSGINADLL name 'WlxDisplayStatusMessage';
function MyWlxGetStatusMessage; external MSGINADLL name 'WlxGetStatusMessage';
function MyWlxInitialize; external MSGINADLL name 'WlxInitialize';
function MyWlxIsLockOk; external MSGINADLL name 'WlxIsLockOk';
function MyWlxIsLogoffOk; external MSGINADLL name 'WlxIsLogoffOk';
function MyWlxLoggedOnSAS; external MSGINADLL name 'WlxLoggedOnSAS';
function MyWlxLoggedOutSAS; external MSGINADLL name 'WlxLoggedOutSAS';
procedure MyWlxLogoff; external MSGINADLL name 'WlxLogoff';
function MyWlxNegotiate; external MSGINADLL name 'WlxNegotiate';
function MyWlxNetworkProviderLoad; external MSGINADLL name 'WlxNetworkProviderLoad';
function MyWlxRemoveStatusMessage; external MSGINADLL name 'WlxRemoveStatusMessage';
procedure MyWlxShutdown; external MSGINADLL name 'WlxShutdown';
{$IF VERSION>=1.1}
function MyWlxScreenSaverNotify; external MSGINADLL name 'WlxScreenSaverNotify';
function MyWlxStartApplication; external MSGINADLL name 'WlxStartApplication';
{$IFEND}
function MyWlxWkstaLockedSAS; external MSGINADLL name 'WlxWkstaLockedSAS';

{$IF VERSION>=1.3}
function MyWlxGetConsoleSwitchCredentials;external MSGINADLL name 'WlxGetConsoleSwitchCredentials';
procedure MyWlxReconnectNotify; external MSGINADLL name 'WlxReconnectNotify';
procedure MyWlxDisconnectNotify; external MSGINADLL name 'WlxDisconnectNotify';
{$IFEND}

end.
 
http://lu0.126.com
Windows LOGON描述.---这个网站写的很好

陆麟(lu0)一定是个很帅的家伙.

/////////////////////////////
 
{NTVersion.inc}
{-----不同的Windows版本请修改这里------}
// {$define WinNT9X} //Win95,Win98
// {$define WinNT2K} //Win2000
{$define WinNTSP4} //XP


{----------不要修改下面的定义---------}
{$IFDEF Win9X}
const VERSION=1.0;
{$ENDIF}

{$IFDEF WinNT2K}
const VERSION=1.2;
{$ENDIF}

{$IFDEF WinNTSP4}
const VERSION=1.3;
{$ENDIF}

{******MSDN里声称1.2版函数表在WIN2000里启用是不对的.靠!差点害了我!********}
 
后退
顶部