Re: How to Validate User Credentials on Windows 2000 OS?
- From: "Asif Bhimla" <AsifBhimla@xxxxxxxxxxxxxxxxxxxxxxxxx>
- Date: Wed, 15 Feb 2006 00:28:28 -0800
I have tried this link out, but it is not working. Actually the code seems to
be not working. Here is the code which i had use:
UINT flags = TOKEN_ADJUST_PRIVILEGES | TOKEN_QUERY;
HANDLE hToken;
BOOL ret = OpenProcessToken(GetCurrentProcess(), flags, &hToken);
if(ret == TRUE)
{
LUID id;
BOOL ret1 = LookupPrivilegeValue(NULL, SE_TCB_NAME, &id);
if(ret1 == TRUE)
{
TOKEN_PRIVILEGES newPrivileges;
newPrivileges.PrivilegeCount = 1;
newPrivileges.Privileges[0].Luid = id;
newPrivileges.Privileges[0].Attributes = SE_PRIVILEGE_ENABLED;
BOOL ret2 = AdjustTokenPrivileges(hToken, FALSE, &newPrivileges, 0, NULL, 0);
if(ret2 == FALSE)
{
printf("AdjustTokenPrivileges failed. GetLastError() return = %d",
GetLastError());
}
else
{
HANDLE hUserToken;
if(LogonUser("asif", "OSA", "asif", LOGON32_LOGON_NETWORK,
LOGON32_PROVIDER_DEFAULT, &hUserToken))
{
CloseHandle(hUserToken);
return TRUE;
}
else
{
printf("LogonUser failed. GetLastError() return = %d",
GetLastError());
}
}
else
{
printf("LookupPrivilegeValue failed. GetLastError() return = %d",
GetLastError());
}
}
else
{
printf("OpenProcessToken failed. GetLastError() return = %d",
GetLastError());
}
Can you please check this code out?
Thanks
-Asif
"Alex Fedotov" wrote:
Asif Bhimla wrote:.
I want to validate a user credentials using LogonUser(...) API, in an
administrator session on Windows 2000 platform. I have tried to Add
SE_TCB_NAME privilege to the process who is callin LogonUser(...) API, but
still I am unable to verify user Credentials on Windows 2000.
Can some one provide me code snippets which uses LogonUser(...) API on
Windows 2000 succesfully?
http://support.microsoft.com/default.aspx?scid=kb;en-us;180548
-- Alex Fedotov
- Follow-Ups:
- Re: How to Validate User Credentials on Windows 2000 OS?
- From: Alex Fedotov
- Re: How to Validate User Credentials on Windows 2000 OS?
- References:
- Re: How to Validate User Credentials on Windows 2000 OS?
- From: Alex Fedotov
- Re: How to Validate User Credentials on Windows 2000 OS?
- Prev by Date: Re: Biometric CSP wrapper
- Next by Date: RE: 2003 Certificate Authority - Custom Policy module
- Previous by thread: Re: How to Validate User Credentials on Windows 2000 OS?
- Next by thread: Re: How to Validate User Credentials on Windows 2000 OS?
- Index(es):
Relevant Pages
|