64位Windows上的32位和64位互操作性 [英] 32 and 64 bit interoperability on 64-bit Windows

查看:303
本文介绍了64位Windows上的32位和64位互操作性的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有没有一个很好的彻底的权威参考,讨论32位和64位进程之间的互操作性?基于googling,我推断:


  1. 32位DLL只能驻留在32位进程中,而64位DLL仅在64位进程中。

  2. 32位和64位进程只能使用松散耦合的消息系统进行通信,例如网络通信,这意味着它们可以使用COM / DCOM进行通信。

  3. 32和64位COM组件具有不同的注册表项。

  4. 一个32位进程只能创建一个注册为64位COM组件的东西,它只能在两个世界之一中注册。如果它使用CoCreateInstance与64位调用标志,或(和我猜在这一个,是可能吗?)如果64位组件以某种方式注册在32位注册表中,但在引擎下仍然创建为过程64位进程,或者如果有一个32位shell COM组件创建64位组件,然后将调用重定向到它?

这表明:
1.一个32位应用程序不能使用GetObject来获取运行的64位版本的Excel?还是可以吗?运行对象表(ROT)如何受32位64位问题的影响?如果只安装了64位版本的Office,那么32位进程是否可以创建Excel的实例?我认为答案将是否,除非32位进程在其CoCreateInstance调用中使用64位标志,或者如果Excel在32位世界中也注册了自己?



Microsoft自动执行任何操作,例如在32位进程中使用CoCreateInstance检查64位注册表,如果32位注册表中没有注册,则尝试创建一个进程外64位组件?我看到了一些来自64位Office的发行说明,Microsoft警告从32位应用程序访问64位Excel不工作,但我知道一个实例似乎只是工作。



这是否有一个很好的技术事实参考?

解决方案

a href =http://msdn.microsoft.com/en-us/library/ms693716%28VS.85%29.aspx>用于CLSCTX的MSDN库文档。许多规则,默认行为是:


如果客户端和服务器
都没有指定首选项, p>


  • 如果托管服务器的计算机运行的是Windows XP或
    没有Service的Windows Server 2003
    Pack 1 (SP1)或更高版本,则
    COM将优先选择64位版本的
    服务器(如果可用)


  • 如果托管服务器的计算机正在运行Windows Server,则
    将激活32位版本的
    服务器。 2003
    安装SP1或更高版本,然后COM
    将尝试将服务器
    体系结构匹配到客户端
    体系结构。换句话说,对于
    32位客户端,COM将激活
    32位服务器(如果可用)否则
    它将激活64位版本的
    服务器。对于64位客户端,如果
    可用,COM
    将激活64位服务器;否则将激活
    a 32位服务器。



MSDN文章,如果您想覆盖此行为。


Is there a good thorough authoritative reference that discusses interoperability between 32-bit and 64-bit processes? Based on googling I have deduced that:

  1. A 32-bit DLL can only reside in a 32-bit process, and a 64-bit DLL only in a 64-bit process.
  2. 32 and 64-bit processes can only communicate using loosely coupled message systems, such as network communications, which means they can communicate using COM/DCOM.
  3. 32 and 64-bit COM components have different registry entries. A component is typically only registered in one of the two and typically only seen in one of the two worlds.
  4. A 32-bit process can only create something registered as a 64-bit COM component if it uses CoCreateInstance with the 64-bit invocation flag, or (and I am guessing on this one, is it possible?) if the 64-bit component is somehow registered in the 32-bit registry but under the hood is still created as an out of process 64-bit process, or if there is a 32-bit shell COM component which creates the 64-bit component and then redirects calls to it?

This suggests that: 1. A 32-bit application can not use GetObject to get hold of a 64-bit version of Excel that is running? Or can it? How is the running object table (ROT) impacted by 32 versus 64-bit issue? Can a 32-bit process create an instance of Excel if only a 64-bit version of Office is installed? I would think the answer would be "no" unless the 32-bit process uses the 64-bit flag in its CoCreateInstance call, or if Excel somehow registered itself in the 32-bit world as well?

Does Microsoft automatically do anything like having CoCreateInstance from a 32-bit process check the 64-bit registry and try to create an out of process 64-bit component if there is none registered in the 32-bit registry? I have seen some release notes from 64-bit Office where Microsoft warns about access from 32-bit applications to 64-bit Excel not working, yet I know of one instance where it seemed to just work.

Is there a good technical factual reference for this?

解决方案

It is explained quite well in the MSDN Library docs for CLSCTX. Lots of rules, the default behavior is:

If neither the client nor the server specifies a preference, then:

  • If the computer that hosts the server is running Windows XP or Windows Server 2003 without Service Pack 1 (SP1) or later installed, then COM will prefer a 64-bit version of the server if available; otherwise it will activate a 32-bit version of the server.

  • If the computer that hosts the server is running Windows Server 2003 with SP1 or later installed, then COM will try to match the server architecture to the client architecture. In other words, for a 32-bit client, COM will activate a 32-bit server if available; otherwise it will activate a 64-bit version of the server. For a 64-bit client, COM will activate a 64-bit server if available; otherwise it will activate a 32-bit server.

Check the MSDN article if you want to override this behavior.

这篇关于64位Windows上的32位和64位互操作性的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆