简体   繁体   English

如何以IE保护模式(从托管BHO)访问AppData

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

I am writing an IE Extension (BHO) in C#. 我正在用C#编写IE扩展(BHO)。 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. 当以保护模式运行(IE的新UAC兼容模式,该模式强制所有扩展以低完整性运行)时,它将失败,因为它无法访问appdata文件夹中的user.config。

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? 如果失败,是否有某种方法可以迫使BHO以中等级别的完整性运行?

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? 如果失败,是否有某种方法可以在低完整性文件夹中创建低完整性符号链接,该链接指向AppData中的中完整性文件?

Failing that, is there some way to force the application to use a user.config file in the LocalLow folder? 失败了,是否有某种方法可以强制应用程序使用LocalLow文件夹中的user.config文件? How do I get the path for this folder in .net (it's not listed under Environment.SpecialFolder)? 如何在.net中获取此文件夹的路径(未在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? 我能否在不丢失所有user.config数据的情况下回退到运行XP的用户或关闭保护模式的用户?

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. 有一种方法不是特别优雅,但是您可以启动具有中等级别完整性的另一个(代理)过程,该过程可以完成“肮脏的工作”并使用IPC与之通信。 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. 为了在生成新进程时跳过UAC警告,可以修改BHO注册脚本并添加一些注册表值,这些值将通知IE将新进程静默提升到中等级别。

You can find more information here: http://msdn.microsoft.com/en-us/library/bb250462(VS.85).aspx#wpm_elebp 您可以在这里找到更多信息: http : //msdn.microsoft.com/zh-cn/library/bb250462(VS.85).aspx#wpm_elebp

You get a one-shot privileged access during RegisterBHO. 在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. 如果您需要在BHO的运行期间更改长期存储,我发现注册表是最好的地方。 Your changes will be only visible to you, but they will persist. 您所做的更改仅对您可见,但它们将保持不变。

我建议您编写自己的SettingsProvider,将其保存在System.IO.IsolatedStorage中。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 如何在 Edge IE 兼容模式下启用 BHO? 微软表示它在 MS Edge 的 IE 兼容模式下支持 BHO,但它似乎无法正常工作 - How to enable BHO in Edge IE compatibility mode? Microsoft says it supports BHO in MS Edge's IE compatibility Mode but it seems to be not working 当IE处于非管理员模式时,无法通过stdin / stdout与从BHO启动的可执行文件进行通信 - Unable to communicate with an executable started from BHO via stdin / stdout when IE is in non admin mode 如何访问 AppData 文件夹 - How to Access AppData Folder IE 11和增强保护模式以及自定义BHO:是否有一些调试信息? - IE 11 and Enhanced Protection Mode and custom BHO : is there some debug info? 在EPM模式下以非管理员身份打开IE时,无法运行BHO - Not able to run BHO when IE is opened as non admin in EPM mode 如何以编程方式关闭IE的保护模式? - How to programmatically turn off IE's Protected Mode? 如何使用c#检测IE保护模式 - How to detect IE Protected Mode using c# 未使用保护模式实例化托管BHO - Managed BHOs not instantiated using Protected Mode 从IE BHO打开对话框时,如何确保对话框是模态对话框? - How can I ensure a dialog will be modal when opened from an IE BHO? 通过 BHO 运行应用程序时禁用 Internet Explorer 提示“程序将在保护模式之外打开” - Disable Internet Explorer prompt 'the program will open outside of protected mode' when running application through BHO
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM