?
Solved

win32 equivalents of getuid, getgid, etc.

Posted on 1998-05-08
9
Medium Priority
?
1,007 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
Get your Disaster Recovery as a Service basics

Disaster Recovery as a Service is one go-to solution that revolutionizes DR planning. Implementing DRaaS could be an efficient process, easily accessible to non-DR experts. Learn about monitoring, testing, executing failovers and failbacks to ensure a "healthy" DR environment.

 

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

Windows Server 2016: All you need to know

Learn about Hyper-V features that increase functionality and usability of Microsoft Windows Server 2016. Also, throughout this eBook, you’ll find some basic PowerShell examples that will help you leverage the scripts in your environments!

Question has a verified solution.

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

What my article will show is if you ever had to do processing to a listbox without being able to just select all the items in it. My software Visual Studio 2008 crystal report v11 My issue was I wanted to add crystal report to a form and show…
Entering time in Microsoft Access can be difficult. An input mask often bothers users more than helping them and won't catch all typing errors. This article shows how to create a textbox for 24-hour time input with full validation politely catching …
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…
Visualize your data even better in Access queries. Given a date and a value, this lesson shows how to compare that value with the previous value, calculate the difference, and display a circle if the value is the same, an up triangle if it increased…

762 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