CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 2 of 2
  1. #1
    Join Date
    Mar 2005
    Posts
    22

    How to confirm if user password is correct

    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.

    Code:
    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?
    Last edited by lechoo; July 27th, 2005 at 02:07 PM.

  2. #2
    Join Date
    Mar 2004
    Location
    (Upper-) Austria
    Posts
    2,899

    Re: How to confirm if user password is correct

    This example might be confusing and complicated but it is very good and you should work through it.
    I am not offering technical guidiance via email or IM
    Come on share your photo with us! CG members photo album!
    Use the Code Tags!

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured