Click here to Skip to main content
15,887,746 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
In C++ what code makes a program run only under administrative privileges. Is there a way to turn it off so that anyone can run it.
?
Posted

1 solution

It is not C++ language or compiler stuff. You need to change the linker settings.
First check the Linker->Manifest settings (in VS2008+).

Check the shortcut to EXE (if any), if it says 'Run As Administrator'

Ensure the EXE itself is not marked as 'Run As Admin' from Windows Explorer. An application which wasnt built with UAC=AdminitratorRequired, CAN be changed from Property of EXE from Explorer.

Check if parent of process is NOT running in Admin mode (like Visual Studio).

And most importantly, if your application is requiring or non-requiring any action that demands Admin mode ,(like LOCAL_MACHINE registry access, SystemRoot folder access/modification)
 
Share this answer
 
Comments
Member 7766180 1-May-11 23:54pm    
Thank you, First are my settings correct in Linker>Manifest ?
Second I checked the property in window explore and gave the USER Full Access, it only had Read/Write...The console window opens and closes right away. It's not asking to be run as Admin.
Member 7766180 1-May-11 23:59pm    
If I run Visual Studio 2010 as Administrator then the Consule stays open.
Ajay Vijayvargiya 2-May-11 0:13am    
Start command prompt (cmd.exe), and run from there. See any error you might see on console.

And I am confused: You need access or you dont need full-access (i.e. you require Admin, or Non-Admin) ?
Member 7766180 2-May-11 7:02am    
Maybe this is a better way. Go to this link,
http://www.codeproject.com/KB/winsdk/Sniffer.aspx
I'm running a slightly modified version of this code.
If I open Visual Studio 2010 "Run As Administrator" and debug, the console program runs as it should. The console stays open and sniffs. If I open Visual Studio 2010 without "Run As Administrator" when I debug the console merely flashes open and then closes.
Member 7766180 2-May-11 7:56am    
If I run from the command prompt I get SCOKET ERROR 10013

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900