Solved

win32 equivalents of getuid, getgid, etc.

Posted on 1998-05-08
9
986 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
[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
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
MS Dynamics Made Instantly Simpler

Make Your Microsoft Dynamics Investment Count  & Drastically Decrease Training Time by Providing Intuitive Step-By-Step WalkThru Tutorials.

 

Author Comment

by:appleby
ID: 1400089
Adjusted points to 75
0
 
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

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

This tutorial is about how to put some of your C++ program's functionality into a standard DLL, and how to make working with the EXE and the DLL simple and seamless.   We'll be using Microsoft Visual Studio 2008 and we will cut out the noise; that i…
A theme is a collection of property settings that allow you to define the look of pages and controls, and then apply the look consistently across pages in an application. Themes can be made up of a set of elements: skins, style sheets, images, and o…
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…
Finds all prime numbers in a range requested and places them in a public primes() array. I've demostrated a template size of 30 (2 * 3 * 5) but larger templates can be built such 210  (2 * 3 * 5 * 7) or 2310  (2 * 3 * 5 * 7 * 11). The larger templa…

734 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