Click to See Complete Forum and Search --> : How to confirm if user password is correct


lechoo
July 26th, 2005, 11:48 AM
Hi,
I have following problem: I have domain and few users.
Now in my software I want to create log screen where user enters his/hers domain name and password. How can i confirm if entered password is user's domain password?
I've tried LogonUser but it will not work since not all users have required privileges. I'm looking for something very simple, for example function that will try to access something or log somewhere with user name and password and simply return true or false.

I've tried WNetAddConnection2 but NO_ERROR is returned only if "user" is currently logged user, what's weird works with any password. Doesn't work for any other user.

NETRESOURCE resource;
ZeroMemory(&resource,sizeof(NETRESOURCE));
resource.dwType = RESOURCETYPE_ANY;
resource.lpRemoteName = "\\\\Omega\\netShare";
resource.lpLocalName = "";

DWORD result = WNetAddConnection2(&resource, "pass", "user", CONNECT_UPDATE_PROFILE);

I've found this link: http://www.codeguru.com/forum/showthread.php?t=245025& with userverify.zip example but this is pretty complicated and I will use it if there's nothing else that works. Any ideas what else can I try?

NoHero
July 27th, 2005, 12:55 PM
This example might be confusing and complicated but it is very good and you should work through it.