JimDel
JimDel

Reputation: 4359

Is a manifest file needed for non-managed code?

Before I begin let me apologize for my nearly nonexistent knowledge of programing for UAC. That said…

I have a c# application that starts the setup.exe of a totally different program. Its main purpose is to help that second program run under UAC. So in a nutshell it runs that programs setup.exe file under an elevated command prompt. I have no control over that second program, so getting it to be UAC compatible is not an option. I wrote my program when Vista was first released and there was little UAC info to be found. Now keep in mind that running that setup.exe file this way in fact works, and allows the program to be run with UAC on. But part of my program also adds a “theirapp.exe.manifest” file with “requireAdministrator” as the Execution level. So my question is this, do I even need that file when the program I’m ultimately trying to run is a non-managed application (CBuilder C++). Somewhere along the way I believed a manifest file was needed. But now I’m told they only work for .NET apps.

Thanks

EDIT: To sum it up... Is manifest file needed to run a non-managed program under UAC?

<trustInfo xmlns="urn:schemas-microsoft-com:asm.v3">
  <security>
    <requestedPrivileges>
      <requestedExecutionLevel
        level="requireAdministrator"
        uiAccess="false"/>
    </requestedPrivileges>
  </security>
</trustInfo>

EDIT: My main method for running the OTHER programs setup.exe

private void RunElevated()
{
    ProcessStartInfo processInfo = new ProcessStartInfo("cmd.exe", @"/C " + AppDomain.CurrentDomain.BaseDirectory + @"setup.exe");
    processInfo.Verb = "runas";

    try
    {
        Process.Start(processInfo);
    }
    catch (Exception ex)
    {
        MessageBox.Show(ex.Message.ToString());
    }
}

Upvotes: 1

Views: 367

Answers (2)

JimDel
JimDel

Reputation: 4359

This link answers my question. I suppose the fact that it refers to a manifest file for an un-managed DLL threw off my search.

Upvotes: 0

Mario
Mario

Reputation: 36537

In Visual C++ you'll find the options under the Manifest options (part of the Linker settings):

UAC settings in Visual Studio 11 (beta)

Upvotes: 3

Related Questions