How to Access AppData in IE Protected Mode (from a Managed BHO)

倾然丶 夕夏残阳落幕 提交于 2019-11-27 01:57:06

问题


I am writing an IE Extension (BHO) in C#. When run in protected mode (IE's new UAC-compliant mode which forces all extensions to run at low-integrity), it fails because it cannot access user.config in the appdata folder.

Is there some way to mark files are readable by lower-integrity processes?

Failing that, is there some way to force the BHO to run at medium-level integrity?

Failing that, is there some way to create a low-integrity symlink in the low-integrity folders which points to a medium-integrity file in AppData?

Failing that, is there some way to force the application to use a user.config file in the LocalLow folder? How do I get the path for this folder in .net (it's not listed under Environment.SpecialFolder)? Will I be able to fall back with users running XP or who turn protected mode off, without losing all their user.config data?


回答1:


There's one approach that is not especially elegant but you can start another (broker)process with medium level integrity which can do the 'dirty work' and use IPC to communicate with it. To make your life easier I would suggest you to use sockets for communication because they don't require security check which can be tricky when you have communication between processes with different integrity levels.

In order to skip UAC warning when you spawn new process you can modify BHO registration script and add few registry values that will inform IE to silently elevate new process to medium level.

You can find more information here: http://msdn.microsoft.com/en-us/library/bb250462(VS.85).aspx#wpm_elebp




回答2:


I would start with the Protected Mode Internet Explorer Reference.




回答3:


I suggest you to write your own SettingsProvider that saves files in System.IO.IsolatedStorage.




回答4:


You get a one-shot privileged access during RegisterBHO. After that you are in protected mode.

If you need to change long term storage during the runtime of the BHO, I have found that the registry is the best place. Your changes will be only visible to you, but they will persist.



来源:https://stackoverflow.com/questions/1992765/how-to-access-appdata-in-ie-protected-mode-from-a-managed-bho

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!