开发者

Registry access problem

I have a windows forms app that is modifying some registry keys under the software section. Vista non admins are complaining that they are getting a permission error. I did what it said in this post:

Requested registry access is not allowed

Created an app.manifest file and pasted what was said in there. Do I need to align these values to my app:

<assemblyIdentity version="1.0.0.0" name="MyApplication.app" />

Also, when I com开发者_如何学运维pile in release mode, I am only seeing a *.vshost.manifest, but not a *.manifest file. I tried renaming the vshost one but it still won't work if I'm not an admin.

I guess what I'm asking here is how do I deploy this manifest file? I searched google for it but can't find any good info.


The important part in the other post you are referring to is this:

 <trustInfo xmlns="urn:schemas-microsoft-com:asm.v2">
  <security>
     <requestedPrivileges xmlns="urn:schemas-microsoft-com:asm.v3">
        <requestedExecutionLevel level="requireAdministrator" uiAccess="false" />
     </requestedPrivileges>
  </security>

By setting the requestedExecutionLevel to "requireAdministrator", your application will request administration rights on start. This will also cause the application icon to display the UAC shield icon overlay (telling the user that this executable requires administrator rights). The reason why you see no manifest file in your output directory, is probably because the default setting is to embed the manifest in the executable. You can change this setting to create and use an external manifest.

For manifest options in Visual Studio, check the project properties, then select Configuration Properties -> Manifest Tool -> Input and Output. There you can specify additional manifest files that will be included in your manifest, and also specify if you want to embed the manifest or not.

Hope this helps.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜