?
Solved

Getting user information

Posted on 1998-05-18
7
Medium Priority
?
318 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
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 360 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

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

In this article, I'll describe -- and show pictures of -- some of the significant additions that have been made available to programmers in the MFC Feature Pack for Visual C++ 2008.  These same feature are in the MFC libraries that come with Visual …
Introduction: Dynamic window placements and drawing on a form, simple usage of windows registry as a storage place for information. Continuing from the first article about sudoku.  There we have designed the application and put a lot of user int…
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.
Video by: ITPro.TV
In this episode Don builds upon the troubleshooting techniques by demonstrating how to properly monitor a vSphere deployment to detect problems before they occur. He begins the show using tools found within the vSphere suite as ends the show demonst…

650 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