Solved

Getting user information

Posted on 1998-05-18
7
310 Views
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 ??
0
Comment
Question by:dd021197
  • 4
  • 3
7 Comments
 
LVL 1

Expert Comment

by:Blondie050798
ID: 1312009
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....
0
 
LVL 1

Expert Comment

by:Blondie050798
ID: 1312010
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....
0
 
LVL 1

Author Comment

by:dd021197
ID: 1312011
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 ??
0
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 
LVL 1

Expert Comment

by:Blondie050798
ID: 1312012
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.
0
 
LVL 1

Author Comment

by:dd021197
ID: 1312013
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

0
 
LVL 1

Accepted Solution

by:
Blondie050798 earned 90 total points
ID: 1312014
Well it is a bit different to UNIX, but take a look at these functions:

On windows 95 you have limited functions in this respect:
 
 
ExpandEnvironmentStrings  
GetComputerName  
GetCurrentHwProfile  
GetKeyboardType  
GetSysColor  
GetSystemDirectory  
GetSystemInfo  
GetSystemMetrics  
GetUserName  
GetVersionEx  
GetWindowsDirectory  
IsProcessorFeaturePresent  
SetComputerName  
SetSysColors  
SystemParametersInfo

However, on NT you have a lot more you can do:

Access Control Functions
The following functions are used with privileges.

 
 
AllocateLocallyUniqueId Windows NT 3.1 and later
LookupPrivilegeDisplayName Windows NT 3.1 and later
LookupPrivilegeName Windows NT 3.1 and later
LookupPrivilegeValue Windows NT 3.1 and later


The following functions are used with access tokens.

 
 
AdjustTokenGroups Windows NT 3.1 and later
AdjustTokenPrivileges Windows NT 3.1 and later
DuplicateToken Windows NT 3.1 and later
GetTokenInformation Windows NT 3.1 and later
OpenProcessToken Windows NT 3.1 and later
OpenThreadToken Windows NT 3.1 and later
SetTokenInformation Windows NT 3.1 and later
SetThreadToken Windows NT 3.51 and later
DuplicateTokenEx Windows NT 4.0 and later
CheckTokenMembership Windows NT 5.0 and later
CreateRestrictedToken  Windows NT 5.0 and later
IsTokenRestricted Windows NT 5.0 and later


The following functions are used with security identifiers (SIDs).

 
 
AllocateAndInitializeSid Windows NT 3.1 and later
CopySid Windows NT 3.1 and later
EqualPrefixSid Windows NT 3.1 and later
EqualSid Windows NT 3.1 and later
FreeSid Windows NT 3.1 and later
GetLengthSid Windows NT 3.1 and later
GetSidIdentifierAuthority Windows NT 3.1 and later
GetSidLengthRequired Windows NT 3.1 and later
GetSidSubAuthority Windows NT 3.1 and later
GetSidSubAuthorityCount Windows NT 3.1 and later
InitializeSid Windows NT 3.1 and later
IsValidSid Windows NT 3.1 and later
LookupAccountName Windows NT 3.1 and later
LookupAccountSid Windows NT 3.1 and later


The following functions are used to get and set the components of an object's security descriptor.

 
 
GetSecurityDescriptorControl Windows NT 3.51 and later
CancelOverlappedAccess Windows NT 5.0 and later
ConvertAccessToSecurityDescriptor Windows NT 5.0 and later
ConvertSecurityDescriptorToAccess Windows NT 5.0 and later
ConvertSecurityDescriptorToAccessNamed Windows NT 5.0 and later
GetNamedSecurityInfoEx Windows NT 5.0 and later
GetOverlappedAccessResults Windows NT 5.0 and later
GetSecurityInfoEx Windows NT 5.0 and later
SetNamedSecurityInfoEx Windows NT 5.0 and later
SetSecurityDescriptorControl Windows NT 5.0 and later
SetSecurityInfoEx Windows NT 5.0 and later


The following functions are used to manipulate access-control lists.

 
 
BuildTrusteeWithName Windows NT 4.0 and later
BuildTrusteeWithSid Windows NT 4.0 and later
GetTrusteeForm Windows NT 4.0 and later
GetTrusteeName Windows NT 4.0 and later
GetTrusteeType Windows NT 4.0 and later
SetEntriesInAccessList Windows NT 5.0 and later
SetEntriesInAuditList Windows NT 5.0 and later
TrusteeAccessToObject Windows NT 5.0 and later


0
 
LVL 1

Author Comment

by:dd021197
ID: 1312015
cheers
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Introduction: Load and Save to file, Document-View interaction inside the SDI. Continuing from the second article about sudoku.   Open the project in visual studio. From the class view select CSudokuDoc and double click to open the header …
Introduction: Dialogs (2) modeless dialog and a worker thread.  Handling data shared between threads.  Recursive functions. Continuing from the tenth article about sudoku.   Last article we worked with a modal dialog to help maintain informat…
This video will show you how to get GIT to work in Eclipse.   It will walk you through how to install the EGit plugin in eclipse and how to checkout an existing repository.
Here's a very brief overview of the methods PRTG Network Monitor (https://www.paessler.com/prtg) offers for monitoring bandwidth, to help you decide which methods you´d like to investigate in more detail.  The methods are covered in more detail in o…

943 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

6 Experts available now in Live!

Get 1:1 Help Now