Solved

Getting user information

Posted on 1998-05-18
7
306 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
What Should I Do With This Threat Intelligence?

Are you wondering if you actually need threat intelligence? The answer is yes. We explain the basics for creating useful threat intelligence.

 
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

IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

Introduction: Hints for the grid button.  Nested classes, templated collections.  Squash that darned bug! Continuing from the sixth article about sudoku.   Open the project in visual studio. First we will finish with the SUD_SETVALUE messa…
Exception Handling is in the core of any application that is able to dignify its name. In this article, I'll guide you through the process of writing a DRY (Don't Repeat Yourself) Exception Handling mechanism, using Aspect Oriented Programming.
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.
Excel styles will make formatting consistent and let you apply and change formatting faster. In this tutorial, you'll learn how to use Excel's built-in styles, how to modify styles, and how to create your own. You'll also learn how to use your custo…

760 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

23 Experts available now in Live!

Get 1:1 Help Now