Recently I was faced with the need to create an application that requires elevation of privileges to run in Windows 7. It turned out that creating such an application is a snap. Now on a practical example, we consider how this can be done.
Environment setupWe will solve the task with Microsoft Visual Sutdio 2008. At this moment, Team Edition is at my disposal. To implement this, you will need some components from Visual C ++. If you are writing, for example, only in C #, or you are a novice developer, you could skip the installation of these components:
Task implementationAfter the components are delivered, create a new project. For clarity, in our case, this will be a regular Windows Forms project:

')
We will not write anything in it, but go straight into the project properties and exclude the manifesto from it:

Compile the project and create a batch file (* .bat or * .cmd) with the following content:
@echo off
SetLocal EnableExtensions DisableDelayedExpansion
cd /d %~dp0
"%programfiles%\Microsoft SDKs\Windows\v6.0A\bin\mt.exe" -manifest "%~dp0uactest.exe.manifest" -outputresource:"%~dp0uactest.exe";#1
pause
Put it next to the
uactest.exe compiled binary
.Now start the notepad and paste the following text there:
<? 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 = "Uactest" type = "win32" />
<trustInfo xmlns = "urn: schemas-microsoft-com: asm.v3">
<security>
<requestedPrivileges>
<requestedExecutionLevel level = "requireAdministrator" />
</ requestedPrivileges>
</ security>
</ trustInfo>
</ assembly>
Save the file with the parameters specified in the figure to the same folder where you saved the command file.

Run the batch file. You should have something like this:
findingsThis article has reviewed the general approach to creating applications that require elevated administrator privileges to launch. The technique is based on the introduction of a specially prepared manifesto into the resources and does not claim to be unique or to a direct guide to action.