[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 319
  • Last Modified:

Getting user information

Whats the easiest way of getting user + password information
from VC5.0 under Windows NT. Can it be done under Windows 95 ??
0
dd021197
Asked:
dd021197
  • 4
  • 3
1 Solution
 
Blondie050798Commented:
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
 
Blondie050798Commented:
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
 
dd021197Author Commented:
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
Industry Leaders: 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!

 
Blondie050798Commented:
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
 
dd021197Author Commented:
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
 
Blondie050798Commented:
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
 
dd021197Author Commented:
cheers
0

Featured Post

Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

  • 4
  • 3
Tackle projects and never again get stuck behind a technical roadblock.
Join Now