Win32API.OpenFileMapping 从 IE 工具栏引发访问冲突异常
我们正在尝试内存映射文件技术跨进程共享一些信息
但是当我们在我们的组件之一(IE 工具栏)中使用它时,当 IE 在保护模式下运行时,它会抛出访问冲突异常。
有人可以在这方面帮助我吗?
如果有任何替代方案可以在多个进程中共享内存,使 IE 在保护模式下运行时不会出现任何问题,也请分享
详细场景已经解释此处 谢谢
We are trying to Memory Mapping File Technique to share some information across the processes
But when we use this in one of our component which is IE Toolbar it throws access violation exception when IE is running in protected mode.
Can someone help me in this regard??.
If there is any alternative to share memroy within multiple process through which IE do not have any problem while running in protected mode, please also share
Detailed scenario is already explained here
Thanks
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
还没有回复???
无论如何,我找到了解决方案,我们需要先了解问题。
当 IE 在保护模式下运行时,它实际上会将 IE 进程置于低完整性级别,以避免使用 IE 中的安全对象。因此,如果在高完整性进程(例如从控制台或窗口应用程序)中创建内核对象(内存映射文件),那么当其处于保护模式时,将无法从 IE 访问它。
因此,要完成这项工作,必须将内核对象从高完整性级别进程标记为低完整性级别,该对象也可以从低完整性级别进程访问,尽管这也会使该对象容易受到攻击。
经过长时间的研究,我发现(此处) 以下 VC++ 代码将内核对象设置为低完整性级别:
为了使其可以在 C# 中使用,我在 Windows 上进行了转换API 转换为 C# 如下;
No Reply Yet???
Anyway I found the Solution, We need to understand the problem first.
When IE is running in Protected Mode its actually take IE process to Low-Integrity level to avoid usage of secure objects from IE. So if a Kernal Object (Memory Map File) is created in Highty-Integrity Process (e.g. from a console or window application) then it would not be accessed from the IE when its in protected mode.
So make this work one has to mark the Kernal Object to Low-Integrity level from the high-Integrity process, this object will be accessible from low-integrity level processes as well though it will make the object vulnerable as well.
after a long research i found(here) the following VC++ code to set a kernal object to the low-integrity level:
to make it workable in C# I converted above windows Apis into C# as follow;