开发者

IE BHO c++ data sharing among tabs

开发者 https://www.devze.com 2023-04-01 23:52 出处:网络
I would like the BHO instances of my IE extension to be able to share common data. I just need them to share a couple of variables, so I am trying to find an easy solution for the problem.

I would like the BHO instances of my IE extension to be able to share common data. I just need them to share a couple of variables, so I am trying to find an easy solution for the problem.

The alternatives I can think of, from easier to more complex are:

1) Writing/reading data to/from the file system or to the registry, see MSDN article and Codeproject article. Question: is this information accessible from BHO instances running in different threads?

2) Developing a Windows Service or a background application that communicates with all BHO instances, see MSDN article. Problem: I have NO IDEA how to make this, or where to start with. I am worried about the user having to install to many things.

3) Providing IPC mechanisms so that the different BHO instances can communicate directly to each other. Like using the IGlobalInterfaceTable, see ookii article. Problem: Yes, you can store pointers in this IGlobalInterfaceTable and get cookies to access them back, but how can you share one cookie obtained in BHO Instance 1 with BHO Instance 2, so that the second instance can access the data inserted in the IGlobalInterfaceTable by the first one? Aren't we havin开发者_开发问答g here the same data sharing problem again?

Well, as you see, after a whole week looking for a solution I simply don't know how to start dealing with this problem. Any help would be greatly appreciated.


Often, Memory Mapped Files are used for this purpose. It's a non-trivial amount of work, however, as you must ensure that they are ACL'd properly to allow cross-process access (each tab may be in a different process) and work across multiple integrity levels.


1 sort of, except the place a normal web site can write is isolated from a trusted web site can access.

2 Writing a service is probably the easiest way, given the abundant amount of documentation on how to write a windows service (you even get an ATL project wizard if you use Visual C++), and your broker code can survive a tab processes crash or even a user log off.

3 Indeed you have the same sharing problem again, COM messages are blocked by UIPI unless you can change the message filter, but the messages used by COM are not documented. I would use something like named pipe/memory file mapping.

You need to host the communication broker code somewhere and only create it once. You can write something like how computers in a workgroup elect the master browser (kind of chatty), or have a broker process to do the communication work (e.g in a windows service).

0

精彩评论

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

关注公众号