0

i try to add a key in registry key \local machine But i got this error: Requested registry access is not allowed.

changed linker -> manifest file -> UAC Execution Level to requireAdministrator (/level='requireAdministrator'),

but again the same error.

Asdren
  • 1
  • Do you have this error, if you do "run as administrator"? – Rekshino Jul 27 '17 at 14:28
  • 2
    Possible duplicate of [Requested registry access is not allowed](https://stackoverflow.com/questions/562350/requested-registry-access-is-not-allowed) – Rekshino Jul 27 '17 at 14:29

1 Answers1

1

Are you sure you have the correct definition in your app.manifest? It should look like this:

<?xml version="1.0" encoding="utf-8"?>
<asmv1:assembly manifestVersion="1.0" xmlns="urn:schemas-microsoft-com:asm.v1" xmlns:asmv1="urn:schemas-microsoft-com:asm.v1" xmlns:asmv2="urn:schemas-microsoft-com:asm.v2" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
   <assemblyIdentity version="1.0.0.0" name="MyApplication" />
   <trustInfo xmlns="urn:schemas-microsoft-com:asm.v2">
      <security>
         <requestedPrivileges xmlns="urn:schemas-microsoft-com:asm.v3">
            <requestedExecutionLevel level="requireAdministrator" uiAccess="false" />
         </requestedPrivileges>
      </security>
   </trustInfo>
</asmv1:assembly>

And make sure that you get the UAC admin prompt beforehand.