We help IT Professionals succeed at work.

Getting user information

dd021197 asked
Last Modified: 2013-11-20
Whats the easiest way of getting user + password information
from VC5.0 under Windows NT. Can it be done under Windows 95 ??
Watch Question

GetUserName()will obviously get you the user name...
Password information is a little bit trickier than that...you cannot just get the users password in a simple text form the same way that you do with the username...
Depending on why you want this information you can impersonate the user and once you are impersonating, you can get the token from the current thread (this is where impersonation tokens are found). Once you have the security token of the client, you have two options (according to msdn):

Search the token for a particular SID in the groups listed, or

Get a Security Descriptor for an object that you want to check the user's access to and call AccessCheck().

Security is obviously a lot more complex than a simple win32 api call... but this should help get you started....
Whoopps...forgot to mention about windows 95...getusername still works the same...security on 95 is nothing like as sophisticated as nt; this might not be a problem depending on what you are trying to do with this information....


I am writing a service on NT, in which I want users from a
Windows 95 client to be authenticated, so basically I want to
check the password against that stored on NT - is there no easy way of doing this ??
Huh? You have an NT service.  You have various users on Windows 95 clients.  Are you getting them to type in additional username and password information, or are you just using their login username and password?  If you are just using their login username and password, and the machine is a member of the NT machines domain, then effectively when you login to the 95 machine you are logging into the NT domain...so you have all the power of the NT security API calls from your service...so as previously stated, you can impersonate the user and get their security token and look it up.

I get the impression that you are looking for a very simple one function call, and that is not going to happen...you have to do a bit more work...

If I have still misunderstood your question, then please provide even more information so that I can help you.


The Windows 95 clients will be connecting to the NT server
over TCP/IP so they do not have to log into any domain.
Under UNIX you call getpwname and compare the crypted password
with the user entered password and check the security that
way - I was basically looking for an equivilant under NT -
Hope this explains it a bit better - looking for some pointers
to what help to lookat / API calls

This one is on us!
(Get your first solution completely free - no credit card required)


Unlock the solution to this question.
Join our community and discover your potential

Experts Exchange is the only place where you can interact directly with leading experts in the technology field. Become a member today and access the collective knowledge of thousands of technology experts.

*This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.


Please enter a first name

Please enter a last name

8+ characters (letters, numbers, and a symbol)

By clicking, you agree to the Terms of Use and Privacy Policy.