Retrieve Windows Username and Password
Hello.
I want to use vbSendMail.dll to send emails, but the mail server requires the Windows Username and Password.
I could have two text boxes in the settings panel in my program, but I really want to avoid that and retrieve them usinf VB.
(That's because they have to change from time to time, so I'll have to change them in the program settings as well).
I can retrieve the Username like this:
MsgBox Environ("username")
but what about the password?
Also, does the Environ work with all versions of Windows or only 2000 and NT?
Thanks.
Re: Retrieve Windows Username and Password
You will never retrive the password under NT/XP. If you could Microsoft would go broke :)
Re: Retrieve Windows Username and Password
There has to be a way...
It must be stored somewhere, even if it is encrypted.
For example, I have noticed that Outlook has a setting to use the Windows Username and Password.
Re: Retrieve Windows Username and Password
I dont think i'll be shedding any tears for microsoft.
Check this. :eek:
Re: Retrieve Windows Username and Password
Re: Retrieve Windows Username and Password
I can't believe that :-(
There must be a way...
I could test it by using vbSendMail.dll.
For each possible combination, I could try to connect to the mail server. When it connects, it means that I found the right password. How much would that take?
And what about Also, Environ?
Does it work with all versions of Windows or only 2000 and NT?
Because if it doesn't, I'll have to find another way to retrieve the Username...
Re: Retrieve Windows Username and Password
you could always get yourself a copy of NuMega SoftIce, and put a breakpoint in outlook with that option activated.
Just hope your good at understanding hex code
Re: Retrieve Windows Username and Password
Environ should work for username.
You could also use api for that:
Code:
Private Declare Function GetUserName Lib "advapi32.dll" _
Alias "GetUserNameA" (ByVal lpBuffer As String _
, nSize As Long) As Long
[...]
'Create a buffer
strUserName = String(100, Chr$(0))
'Get the username
GetUserName strUserName, 100
'strip the rest of the buffer
strUserName = Left$(strUserName, InStr(strUserName, Chr$(0)) - 1)
But password does not work the same way: it should be stored in
a oneway encryption: you can type in a pass, and it will be crypted
and mathced against a crypted in a similar way one. There should
exists no algo for decrypt.
In any case, a "brute force"(=testing all possible combinations) would
be really slow: if a pwd is more than 6 bytes, it could require weeks
to guess it. And if it is 7, it could require months...In any case, you should
never try to force a password protected system, unless it is your own...
ps:
Now pay attention: look at my signature: see the "Rules in Codeguru" link?
Follow it and read carefully...
TheSheriff