Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Re-validating Windows logon password

Status
Not open for further replies.

Eean

IS-IT--Management
Nov 27, 2001
5
US
I need to write a piece of code that asks the user to reinput their windows (NT or 2000)network password, so that I can use it to addsecurites to a system that we have installed. I dont want to create another password for them to forget and I dont need to know their passwords, which are changed every month. So, in brief how do I compare two input strings to:
a)Network User Name
b)Network Password
 
If you just need to know the users name then try using the API function

Public Declare Function GetUserName Lib "advapi32.dll" Alias "GetUserNameA" (ByVal lpBuffer As String, nSize As Long) As Long
Mark

The key to immortality is to make a big impression in this life!!
 
Private Declare Function WNetVerifyPassword Lib "mpr.dll" Alias _
"WNetVerifyPasswordA" (ByVal lpszPassword As String, _
ByRef pfMatch As Long) As Long

Private Function VerifyWindowsLoginUserPassword _
(ByVal Password As String) As Boolean
Dim rtn As Long, Match As Long
rtn = WNetVerifyPassword(Password, Match)
If rtn Then
VerifyWindowsLoginUserPassword = False
Else
VerifyWindowsLoginUserPassword = (Match <> 0)
End If
Debug.Print rtn, Match
End Function
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top