Solved

How to get the user/password of client machine ?

Posted on 2002-05-30
5
145 Views
Last Modified: 2010-05-02
How can I get the User name/password of the local machine used to log on BY THE LOCAL user.

0
Comment
Question by:chirawa
5 Comments
 
LVL 6

Accepted Solution

by:
xSinbad earned 50 total points
ID: 7046257
I dont know about getting the password but have a look at these two examples

Username in NT msgbox environ("UserName")

or

API

Declare Function GetUserName Lib "advapi32" Alias "GetUserNameA" (ByVal strName As String, ByRef dwLength As Long) As Long

intLen = 50
strUserID = Space(intLen + 1)
GetUserName strUserID, intLen
strUserID = Left(strUserID, intLen - 1)
msgbox strUserID

(TimCottee  - Q_20219899)

http://www.vbcode.com/asp/showsn.asp?theID=1075
http://www.vbcode.com/asp/showsn.asp?theID=3795
0
 
LVL 33

Expert Comment

by:hongjun
ID: 7046269
Retrieve user name

Option Explicit

Private Const UNKNOWN = _
"(Value Unknown Because System Call Failed)"

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

Public Function GetCurrentUserName() As String

Dim l As Long
Dim sUser As String

sUser = Space$(255)
l = GetUserName(sUser, 255)

'strip null terminator

If l <> 0 Then
   GetCurrentUserName = Left(sUser, InStr(sUser, Chr(0)) - 1)
Else
   Err.Raise Err.LastDllError, , _
     "A system call returned an error code of " _
      & Err.LastDllError
End If

End Function


Private Sub Form_Load()
    MsgBox GetCurrentUserName()
End Sub



Retrieve Password? Researching.

hongjun
0
 
LVL 2

Expert Comment

by:ventond
ID: 7048022
Hopefully the password is not stored, therefore unreturnable.
0
 
LVL 49

Expert Comment

by:DanRollins
ID: 7851310
Hi chirawa,
It appears that you have forgotten this question. I will ask Community Support to close it unless you finalize it within 7 days. I will ask a Community Support Moderator to:

    Accept xSinbad's comment(s) as an answer.

chirawa, if you think your question was not answered at all or if you need help, just post a new comment here; Community Support will help you.  DO NOT accept this comment as an answer.

EXPERTS: If you disagree with that recommendation, please post an explanatory comment.
==========
DanRollins -- EE database cleanup volunteer
0
 

Expert Comment

by:SpideyMod
ID: 7912899
per recommendation

SpideyMod
Community Support Moderator @Experts Exchange
0

Featured Post

Do You Know the 4 Main Threat Actor Types?

Do you know the main threat actor types? Most attackers fall into one of four categories, each with their own favored tactics, techniques, and procedures.

Join & Write a Comment

Article by: Martin
Here are a few simple, working, games that you can use as-is or as the basis for your own games. Tic-Tac-Toe This is one of the simplest of all games.   The game allows for a choice of who goes first and keeps track of the number of wins for…
Enums (shorthand for ‘enumerations’) are not often used by programmers but they can be quite valuable when they are.  What are they? An Enum is just a type of variable like a string or an Integer, but in this case one that you create that contains…
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…

757 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

21 Experts available now in Live!

Get 1:1 Help Now