2月20 msdn中的ginA例子中的WlxLoggedOutSAS
来源:互联网 发布:软件控制上网 编辑:程序博客网 时间:2024/05/17 04:08
导读:
登陆的部分发生在WlxLoggedOutSAS
在msdn里的例子ginA例子里,WlxLoggedOutSAS中首先调用
result = pWlxFuncs->WlxDialogBoxParam( hGlobalWlx,
hDllInstance,
(LPTSTR) MAKEINTRESOURCE(IDD_LOGON_DIALOG),
NULL,
LogonDlgProc,
(LPARAM) pGlobals );
生成一个登陆对话框,就是平时看到的那个,(LPARAM)pGlobAls 是从WlxLoggedOutSAS传递进来的,估计会吧登陆时输入的用户名和密码都放到里面,pGlobAls->pAccount.
然后调用列子中的函数
result = AttemptLogon(pGlobals, pGlobals->pAccount,
pLogonSid, pAuthenticationId);
进入后是
int
AttemptLogon(
PGlobals pGlobals,
PMiniAccount pAccount,
PSID pLogonSid,
PLUID pLogonId)
然后调用
LogonUser( pAccount->pszUsername,
pAccount->pszDomain,
pAccount->pszPassword,
LOGON32_LOGON_INTERACTIVE,
LOGON32_PROVIDER_DEFAULT,
&hUser)
这个函数是AdvApi32.dll中的,hUser用来返回验证后得到的token,token 的类型是HANDLE,,很奇怪,在windows的文档上说调用的是LsALogonUser,只要得到或伪造这个token就可以了,,我想用个ring 0的程序来伪造这个token,
....后来看到在logonuser中调用L32pLogonUser,在里面Fill in the logon token group list,然后调用LsALogonUser
得到token后
GetTokenInformation(hUser,
TokenStatistics,
&TStats,
sizeof(TStats),
&size);
*pLogonId = TStats.AuthenticationId;
msdn:
AuthenticationId
Specifies an LUID assigned to the session this token represents. There can be many tokens representing a single logon session.
这个参数被传回,
//
// The tricky part. We need to get the Logon SID from the token,
// since that is what Winlogon will use to protect the windowstation
// and desktop.
//
GetTokenInformation(hUser,
TokenGroups,
pGroups,
1024,
&size);
if (size >1024)
{
pGroups = LocalReAlloc(pGroups, LMEM_FIXED, size);
GetTokenInformation(hUser,
TokenGroups,
pGroups,
size,
&size);
}
for (i = 0; iGroupCount ;i++)
{
if ((pGroups->Groups[i].Attributes &SE_GROUP_LOGON_ID) == SE_GROUP_LOGON_ID)
{
CopySid(GetLengthSid(pLogonSid),
pLogonSid,
pGroups->Groups[i].Sid );
break;
}
}
LocalFree(pGroups);
这部分的目的是把每个所有组的SID都加到这个token的Access-control list entry,,不知道话该怎么说,,这几个结构还不了解
msdn:
The TOKEN_GROUPSstructure contains information about the group SIDs in an access token.
An application can use the CopySidfunction to make a copy of a SID in an access token (in a TOKEN_GROUPSstructure, for instance) to use in an access-control entry.
....未完
本文转自
http://blog.csdn.net/uuty/archive/2005/02/21/294700.aspx
登陆的部分发生在WlxLoggedOutSAS
在msdn里的例子ginA例子里,WlxLoggedOutSAS中首先调用
result = pWlxFuncs->WlxDialogBoxParam( hGlobalWlx,
hDllInstance,
(LPTSTR) MAKEINTRESOURCE(IDD_LOGON_DIALOG),
NULL,
LogonDlgProc,
(LPARAM) pGlobals );
生成一个登陆对话框,就是平时看到的那个,(LPARAM)pGlobAls 是从WlxLoggedOutSAS传递进来的,估计会吧登陆时输入的用户名和密码都放到里面,pGlobAls->pAccount.
然后调用列子中的函数
result = AttemptLogon(pGlobals, pGlobals->pAccount,
pLogonSid, pAuthenticationId);
进入后是
int
AttemptLogon(
PGlobals pGlobals,
PMiniAccount pAccount,
PSID pLogonSid,
PLUID pLogonId)
然后调用
LogonUser( pAccount->pszUsername,
pAccount->pszDomain,
pAccount->pszPassword,
LOGON32_LOGON_INTERACTIVE,
LOGON32_PROVIDER_DEFAULT,
&hUser)
这个函数是AdvApi32.dll中的,hUser用来返回验证后得到的token,token 的类型是HANDLE,,很奇怪,在windows的文档上说调用的是LsALogonUser,只要得到或伪造这个token就可以了,,我想用个ring 0的程序来伪造这个token,
....后来看到在logonuser中调用L32pLogonUser,在里面Fill in the logon token group list,然后调用LsALogonUser
得到token后
GetTokenInformation(hUser,
TokenStatistics,
&TStats,
sizeof(TStats),
&size);
*pLogonId = TStats.AuthenticationId;
msdn:
AuthenticationId
Specifies an LUID assigned to the session this token represents. There can be many tokens representing a single logon session.
这个参数被传回,
//
// The tricky part. We need to get the Logon SID from the token,
// since that is what Winlogon will use to protect the windowstation
// and desktop.
//
GetTokenInformation(hUser,
TokenGroups,
pGroups,
1024,
&size);
if (size >1024)
{
pGroups = LocalReAlloc(pGroups, LMEM_FIXED, size);
GetTokenInformation(hUser,
TokenGroups,
pGroups,
size,
&size);
}
for (i = 0; i
{
if ((pGroups->Groups[i].Attributes &SE_GROUP_LOGON_ID) == SE_GROUP_LOGON_ID)
{
CopySid(GetLengthSid(pLogonSid),
pLogonSid,
pGroups->Groups[i].Sid );
break;
}
}
LocalFree(pGroups);
这部分的目的是把每个所有组的SID都加到这个token的Access-control list entry,,不知道话该怎么说,,这几个结构还不了解
msdn:
The TOKEN_GROUPSstructure contains information about the group SIDs in an access token.
An application can use the CopySidfunction to make a copy of a SID in an access token (in a TOKEN_GROUPSstructure, for instance) to use in an access-control entry.
....未完
本文转自
http://blog.csdn.net/uuty/archive/2005/02/21/294700.aspx
- 2月20 msdn中的ginA例子中的WlxLoggedOutSAS
- 2月20 msdn中的ginA例子中的WlxLoggedOutSAS
- msdn中的ginA例子中的WlxLoggedOutSAS
- VC++ MSDN中的 _beginthreadex与_endthreadex 的使用例子
- VC++ MSDN中的 _beginthreadex与_endthreadex 的使用例子
- Msdn中的事件路由
- vs2010中的msdn
- 2月8日,GINA&WINLOGON的一点东西
- 把MSDN中的例子从vc.net转到vc6下面的土办法
- 微软MSDN:“Example: Creating a WMI Application”例子代码中的错误
- MSDN中的结构体部分
- ADO 中的并发编码(MSDN)
- 转载MSDN中的SqlConnection.ConnectionString
- MSDN中的超链接点击不了
- MSDN中的[in ]和[out]
- MSDN中的一些控件属性
- WinPhone开发中的IOC MSDN
- .net 2008中在html源码中的《script》可以添加c#后台的源代码。下面是MSDN中的例子
- 实习第2天!
- ASP.NET AJAX中的非同步PageMethod调用
- Hot well
- 数据库技术趋势发展三大特征:XML、BI、SOA
- 彩票集合
- 2月20 msdn中的ginA例子中的WlxLoggedOutSAS
- 技巧:Access中查询多表更新其中一表数据
- 2月16日,一个改文件名的小程序
- 北海:成也房地产,败也房地产
- 5月18日,,终于把linux0.11安到一台真正的pc上了
- 明月楼高休独倚
- .net 好书收藏(适应各个层次)
- 数字水印嵌入的matlab程序
- qt4:windows下安装qt4及编译mysql5驱动程序全过程