How to make your MFC application bypass UAC in windows7 and Vista

mfcuacvisual c++windows-vista

I have an MFC application developed in VS Studio 2008 which reads and writes to a JSON file in its installation folder. It works perfectly in vista(administrator) BUT ONLY when UAC is turned off. When UAC is ON, the application isn't able to write to its JSON file. I figured I had to create a manifest file but I haven't really tried creating one.

Questions:

  1. reference: http://msdn.microsoft.com/en-us/library/bb384691.aspx.
    It says here that you can simply set the linker options in the Visual Studio development environment.
    What values do I need to select for:
    a) Enable User Account Control (UAC)? [I tried NO].

    b) UAC Execution Level? [I tried highestAvailable].

    c) and UAC Bypass UI Protection? [I tried Yes].

  2. Do I need to add the manifest file in the software package (exe, Dll's, etc.)?

Thanks…

Best Answer

The whole concept of UAC is that you can not bypass it. If you could, it would be useless.

The only solution (which is what you should do anyway, not just because of UAC) is to never ever write files in the install folder but in %APPDATA% where it belongs.

Related Topic