Embed an application manifest within your program with "requireAdministrator" attribute.
Edit "Secure Folder" with your ProjectName in following manifest file.
Save it as "YourAppName.exe.manifest" in your project directory.
To embed this manifest in VS 2008 go to:
Project Properties > "Application" tab > in "Manifest" comboBox select this manifest file.
(if this manifest file is not shown in this comboBox, open solution explorer and right-click on this manifest file and select "Include in project".
-
-
<?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="SecureFolder" type="win32" />
-
<description>SecureFolder</description>
-
<trustInfo xmlns="urn:schemas-microsoft-com:asm.v2">
-
<security>
-
<requestedPrivileges>
-
<requestedExecutionLevel level="requireAdministrator" uiAccess="false" />
-
</requestedPrivileges>
-
<applicationRequestMinimum>
-
<defaultAssemblyRequest permissionSetReference="Custom" />
-
<PermissionSet class="System.Security.PermissionSet" version="1.3" Unrestricted="true" ID="Custom" SameSite="site" />
-
</applicationRequestMinimum>
-
</security>
-
</trustInfo>
-
</assembly>
-
-
You need to have administrative rights to edit registry.