0

I am having an EXE of C++ program which takes one EXE as input searches for symbol in it and replace it with some value from user through command prompt.

I am using Eclipse IDE and MinGW compiler for development.I have also set linker flag to '-static'. but when I run EXE on some other machine I got with the problem of UAC popup window, which is asking for administrative privileges.

I also tried with the option of setting 'Run this program as an administrator',but it is also not working.

Please help me out..Thanks in advance.

2 Answers2

3

Unless you have taken steps to add the requireAdministrator option to your requestedExecutionLevel application manifest setting, you would not expect to receive a UAC prompt. However, there are backwards compatibility options in Windows that will result in the UAC prompt being shown for certain applications.

These backwards compatibility UAC prompts only happen for executable files that do not include the requestedExecutionLevel application manifest setting. In that scenario the system uses heuristics to determine whether or not to show the UAC prompt. For instance, non-manifested applications named setup.exe or patch.exe will get the UAC prompt.

The way to avoid being subject to this backwards compatibility behaviour is to link an application manifest to your executable.

This question covers the topic in rather more detail: How does Windows decide whether to display the UAC prompt?

Community
  • 1
  • 1
David Heffernan
  • 601,492
  • 42
  • 1,072
  • 1,490
  • thanks @david, but how to link exe with the manifest file,because currently i am not having any manifest file in my project. – user3628555 May 26 '14 at 03:33
  • Sorry I am late to see that comment. Please refer to these links that I found by websearch (I don't use Eclipse, or MinGW for GUI apps). http://stackoverflow.com/questions/7245962/add-application-manifest-to-a-win32-application-in-eclipse http://www.transmissionzero.co.uk/computing/win32-apps-with-mingw/ Is the question answered? – David Heffernan May 27 '14 at 08:37
0

Apart from what @David Heffernan has written, you can also trigger UAC window when you launch your application from folders like Program Files etc., which require administrative privileges. The same applies if you try to manipulate files located in such folders. Wikipedia has nice section regarding events triggering the window: http://en.wikipedia.org/wiki/User_Account_Control#Tasks_that_trigger_a_UAC_prompt

KjMag
  • 2,650
  • 16
  • 16