Solved

win32 equivalents of getuid, getgid, etc.

Posted on 1998-05-08
9
954 Views
Last Modified: 2013-12-03
I'm rewriting some code for win32 that was originally done in motif for unix.  I need a reference for equivalent (or close) functions if anyone knows of one.  In the mean time, what I need is something like getuid, getgid, etc.  All I find is SID and can't figure out if it's serving the same purpose.
0
Comment
Question by:appleby
9 Comments
 

Expert Comment

by:agopal
ID: 1400086

GetUserName() is the function you are looking for.
You could subsequently use it in
  Lookup ...APIs I guess

0
 
LVL 1

Expert Comment

by:Blondie050798
ID: 1400087
Well it depends on the operating system really...windows 95 is limited in terms of the security aspect...as agopal said, ::GetUserName() will obviously get you the username! ::GetComputerName() will tell you what their pc is called...

To get more detailed information, such as security info, you need to be running NT 3.1 or later (I think)...things start to get slightly more complicated here, and it is not a simply matter of matching a unix function for a win32 function...
If you lookup LookupAccountName() or LookupAccountSid(), you will find links to the various other access control function (of which there are many!)...
0
 

Author Comment

by:appleby
ID: 1400088
Sorry to leave out details.  I am running on NT 4.0.  The code I am rewriting may not be applicable for NT, it's hard to tell so far since I'm having trouble wading through the docs on security...I keep running in circles.  I guess what I really need is one example of the difference in using GetUserName() to work like getuid and geteuid.  These are the kinds of things I can't resolve after I find the main function for dealing with such topics.
0
 

Author Comment

by:appleby
ID: 1400089
Adjusted points to 75
0
Highfive Gives IT Their Time Back

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!

 
LVL 1

Expert Comment

by:Blondie050798
ID: 1400090
Well rather than quoting unix functions (cos my unix is rather rusty) can you tell me exactly what you want to find out about the user?
0
 

Author Comment

by:appleby
ID: 1400091
I'd like to be able to get the user, which GetUserName does.  If the user is aliasing another user, GetUserName returns the aliased user.  I'd like to be able to get the real user too.  I'd like to be able to do the same for groups.  Get the real user's group, and the aliased user's group.
0
 

Author Comment

by:appleby
ID: 1400092
Sorry, you can scratch that last comment.  After clarification
from our project lead, (which I should have gotten before making that last comment) that is not what this code is looking for, and in fact they have decided we don't need to translate this part.
(nice of them to tell me so soon).  I'm sorry for wasting your time.  It did help me understand GetUserName, which I still need in other areas.  I just don't need to translate geteuid or the group info.
0
 
LVL 1

Accepted Solution

by:
lekshmikr earned 70 total points
ID: 1400093
To get the name of the user associated the  application can call the WNetGetUser function. (LAN manager API for windows NT)

 NetGroupGetUsers function retrieves a list of the members of a particular global group

0
 

Author Comment

by:appleby
ID: 1400094
Although my last comment was that I no longer needed the question answered, this is new information that I haven't found so it is still something I'll save for later use if needed.

I'd like to know if it's possible to remove questions once you've asked them and before they are answered.
0

Featured Post

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

As more and more people are shifting to the latest .Net frameworks, the windows presentation framework is gaining importance by the day. Many people are now turning to WPF controls to provide a rich user experience. I have been using WPF controls fo…
After several hours of googling I could not gather any information on this topic. There are several ways of controlling the USB port connected to any storage device. The best example of that is by changing the registry value of "HKEY_LOCAL_MACHINE\S…
This is Part 3 in a 3-part series on Experts Exchange to discuss error handling in VBA code written for Excel. Part 1 of this series discussed basic error handling code using VBA. http://www.experts-exchange.com/videos/1478/Excel-Error-Handlin…
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…

746 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

10 Experts available now in Live!

Get 1:1 Help Now