Link to home
Start Free TrialLog in
Avatar of appleby
appleby

asked on

win32 equivalents of getuid, getgid, etc.

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.
Avatar of agopal
agopal


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

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!)...
Avatar of appleby

ASKER

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.
Avatar of appleby

ASKER

Adjusted points to 75
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?
Avatar of appleby

ASKER

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.
Avatar of appleby

ASKER

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.
ASKER CERTIFIED SOLUTION
Avatar of lekshmikr
lekshmikr

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of appleby

ASKER

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.