<pl**********@gmail.com> wrote in message
news:11**********************@f14g2000cwb.googlegr oups.com...
Hi,
i need to use logonuser api in c# for windows 2000.
Logonuser api is working fine in windowsXp,Windows2003 server.in
windows 2000 for running logonuser api we need SE_TCB_NAME
Privilege(act as part of operating system).i need to set the
SE_TCB_NAME Privilege programatically with out restarting the
system for the privilege to take effect.
My program need is to check the username,password provided by the
user matches with windows username,password.Is there any other way
to check windows username,password other than using logonuser
Please help me out to solve the problem
If all you need is credential checking, you can use the
NetUserChangePassword API without changing the actual password.
Note that this may return an error code because of local or domain password
policy constraints!!!.
For instance if the local password policy "Minimum password age" is > 0, the
call will return with an error code 1327, but that means that the
credentials are valid but you can't change the password because of policy
constraints, so be carefull with error checking.
[DllImport("netapi32", CharSet=CharSet.Unicode, SetLastError=true)]
static extern int NetUserChangePassword(
[MarshalAs(UnmanagedType.LPWStr)] string domain,
[MarshalAs(UnmanagedType.LPWStr)] string user,
[MarshalAs(UnmanagedType.LPWStr)] string oldpassword,
[MarshalAs(UnmanagedType.LPWStr)] string newpassword);
// where domain is the domain name or a machine name (eg. local machine name
for local accounts)
int ret = NetUserChangePassword(.....);
if (ret != 0) // if failed
{
}
// success
....
Willy.