473,385 Members | 1,542 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

How to find Logged In user type in C/C++?

Hello All,
Please can anybody help me how to find the system user type in c/c++ code...? I just want to do some operation if the user is system admin... If there is some other way to find system admin, please tell me and help me in solving this...
Nov 30 '10 #1
6 4074
Banfa
9,065 Expert Mod 8TB
There is no way to do it in standard C/C++ you would need to call some platform dependant OS provided API if there is one.
Nov 30 '10 #2
Thank You Banfa... But can you help me a little more in doing this...??? Please...
Nov 30 '10 #3
hype261
207 100+
What OS are you using snatusapi? That will help us give you a clue...
Nov 30 '10 #4
I'm using windows XP.. but i might use that call in most of the versions of windows...
Nov 30 '10 #5
newb16
687 512MB
It may not matter who is logged in, but what under user your process is running.
Find the user the process is running under and then find if it belongs to administrators group? Then search for functions to do this on microsoft site, starting e.g. from here http://msdn.microsoft.com/en-us/libr...(v=VS.85).aspx
Googled a bit more ... -
OpenProcess (PID) -> process handle
OpenProcessToken (process handle) -> access token
GetTokenInformation (access token) -> token info
LookupAccountSid (token info.SID) -> "domain\user"
Nov 30 '10 #6
Thank you newb16... I will try this once... Thanks a lot for the idea...
Dec 1 '10 #7

Sign in to post your reply or Sign up for a free account.

Similar topics

8
by: Gandu | last post by:
Could some C++ guru please help me? Suppose I have a linked list, in which the data stored is of type T (using templates) or void* (as in C). Is there any way to find out the type of the object...
6
by: zoltix | last post by:
Hi, I would like to access to execute specific commands but the privileges are not enough from an aspx Page. Because this service run as IU_IISSERVER, therefore aspx hasn’t access to these...
1
by: caldera | last post by:
Hi, I want to find the web user control in the datalist. I iterate the datalist using foreach statement in the DataListItem and in thi DataListItem I iterate all Controls objects but I can't find...
5
by: chellappa | last post by:
Hi All, How to find the data type of the variable ? is there any libaray function avaiable? Because i want create generic data type of some operation . Thanks All By Chellappa
5
by: mvr | last post by:
Hi all How to get the Windows current logged user name using Classic ASP. If no direct way are there any work arounds. Thanks mvr
6
by: roland.bali | last post by:
Hi, Here is the basic setup, my base class is Shoe which has a child class called Sandal. I would like to create objects by calling Sandal.Load. But without overloading Load in Sandal and...
7
by: Dave | last post by:
Is it possible in .NET2.0 to find the user that the current process is running under without going through the whole WMI palaver? I tried looking at ProcessStartInfo.UserName but that was empty - I...
0
by: dsartain | last post by:
Hi, I'm trying to use C++.NET to find which user is currently logged in. This is part of a bigger project for which I'll also need to retrieve visited URL's from the web browser as well...but one...
2
by: Ole | last post by:
Hi, Is it possible to create a type that I can import in any solution and user control etc so that it can be used the same way as system types (like Int32, String etc.)? Thanks, Ole
2
by: Jim in Arizona | last post by:
I'm trying to do a check to see if a specific active directory user account exists in active directory AND a specific group. I can't seem to get the filter down right. I can do this to find a...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.