To All
In many cases our programs need to have elevated privileges to run on Win7 to do certain tasks.. I searched that topic and came across this manifest file.
I have not tested this in any application but if one of our friends would like to try here is the file and instructions from Microsoft. Like all manifests it would have to be added manually to a .rc and compiled into the application.
Let me know if anyone has success.
Rick Lipkin
In many cases our programs need to have elevated privileges to run on Win7 to do certain tasks.. I searched that topic and came across this manifest file.
This works for me but it prompts for the user password.
Code:
cStrg := "runas /noprofile /user:" + GetEnv( "COMPUTERNAME" ) + "\" + GetEnv( "USERNAME" ) + " TELNET"
winexec( cStrg )
@Rick: when you use winexec waitrun etc... it seems you loose elevated privileges. My login has administrator privileges for my computer. If i open a prompt with start button I can run telnet. If I open the prompt with waitrun or winexec telnet does not appear even with dir c:\windows\system32.
_________________
André Dutheil
FWH 12.04 HB 3.1 BCC 5.82 MinGW 4.5.2 MSVS 10
I have not tested this in any application but if one of our friends would like to try here is the file and instructions from Microsoft. Like all manifests it would have to be added manually to a .rc and compiled into the application.
Let me know if anyone has success.
Rick Lipkin
Manifest File
To mark your application with a requestedExecutionLevel, first create an application manifest file to use with the target application. This file can be created by using any text editor. The application manifest file should have the same name as the target executable file with a .manifest extension. For example: IsUserAdmin.exe.manifest.
Example
Executable: IsUserAdmin.exe
Manifest:IsUserAdmin.exe.manifest
Sample application manifest file:
<?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="IsUserAdmin"
type="win32"/>
<description>Description of your application</description>
<!-- Identify the application security requirements. -->
<trustInfo xmlns="urn:schemas-microsoft-com:asm.v2">
<security>
<requestedPrivileges>
<requestedExecutionLevel
level="requireAdministrator"
uiAccess="false"/>
</requestedPrivileges>
</security>
</trustInfo>
</assembly>
The parts of the manifest that need to be adjusted for your application are marked in bold. They include the following:
The assembly identity
The name
The type
The description
The attributes in the requestedExecutionLevel