Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to add manifest <requestedPrivileges> info into delphi project

What is the easiest way to add the <requestedPrivileges> manifest info to a Delphi XE project (.exe)?

Is it possible to add just the required node like:

<requestedPrivileges>   
  <requestedExecutionLevel level="requireAdministrator"/> 
</requestedPrivileges>

or do i have to add the whole manifest file, like?

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0">
  <assemblyIdentity version="1.0.0.0" processorArchitecture="X86" name="VistaLogonCustomizer.exe" type="*"/>
  <description>elevate execution level</description>
  <trustInfo xmlns="urn:schemas-microsoft-com:asm.v2">
   <security>
     <requestedPrivileges>
      <requestedExecutionLevel level="requireAdministrator"/>
     </requestedPrivileges>
   </security>
  </trustInfo>
  <dependency>
   <dependentAssembly>
     <assemblyIdentity type="win32" name="Microsoft.Windows.Common-Controls" version="6.0.0.0" publicKeyToken="6595b64144ccf1df" language="*" processorArchitecture="*"/>
   </dependentAssembly>
  </dependency>
</assembly> 

If I have to add the whole manifest file, do I have then a conflict with the build in manfest file (which is generated when the project-option "Activate Runtime-Theme" is set to true)?

like image 875
markus_ja Avatar asked Jun 03 '11 12:06

markus_ja


People also ask

What is an application manifest file?

Every app project must have an AndroidManifest. xml file (with precisely that name) at the root of the project source set. The manifest file describes essential information about your app to the Android build tools, the Android operating system, and Google Play.

What is a manifest file c#?

The manifest file describes how your application should run. From MSDN: Every assembly, whether static or dynamic, contains a collection of data that describes how the elements in the assembly relate to each other. The assembly manifest contains this assembly metadata.

How do you make an app manifest?

The simplest way to create a manifest is: Project Properties -> Security -> Click "enable ClickOnce security settings" (it will generate default manifest in your project Properties) -> then Click it again in order to uncheck that Checkbox -> open your app. maifest and edit it as you wish.


1 Answers

Here are some links

Delphi and Windows Vista User Account Control

Vista UAC Manifest

Here are the steps:

Create XML file with following content: 

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
 <assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0">
  <assemblyIdentity version="1.1.1.1"
   processorArchitecture="X86"
   name="YourApplicationExeName"
   type="win32"/>
  <description>elevate execution level</description>
  <trustInfo xmlns="urn:schemas-microsoft-com:asm.v2">
  <security>
   <requestedPrivileges>
    <requestedExecutionLevel level="requireAdministrator" uiAccess="false"/>
   </requestedPrivileges>
  </security>
  </trustInfo>
 </assembly>

Name this XML file as YourApplicationName.manifest

Create a text file with following content:

1 24 "YourApplicationName.manifest"

Name this text file as YourApplicationName.RC using the command line execute following command:

brcc32 YourApplicationName.RC -foYourApplicationName.REC

This will create a new resource file called YourApplicationName.REC Copy this YourApplicationName.REC file in to the resource path of your application. Include this resource file into the DPR of you application,

as like:

{$R YourApplicationName.REC} Finally build your application - it is now ready to get admin rights

like image 182
Orhan Cinar Avatar answered Sep 18 '22 16:09

Orhan Cinar