如何在Windows Server 2008上使用32位COM对象(在2008 R2上工作,但不是2008) [英] How to use a 32 bit COM object on Windows Server 2008 (works on 2008 R2 but non 2008)

查看:449
本文介绍了如何在Windows Server 2008上使用32位COM对象(在2008 R2上工作,但不是2008)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用默认的DllSurrogate启用64位的32位COM对象的自动化。这在Windows7 64位和Windows Server 2008 R2完美。然而;正常风格Windows Server 2008(pre R2)完全忽略注册表中的DllSurrogate条目。我研究了这几天,发现文档,经典的Windows Server 2008有注册表反射,忽略DllSurrogate值,如果其空白。 (我留下注册表字符串空值使用默认代理)。要解决这个未反映(不复制在32位和64位注册表之间),我运行regedit.exe * 32并设置键。然后我打开正常的regedit并设置键。还没有运气。我也尝试将DllSurrogate注册表值设置为c:\windows \syswow64\dllhost.exe,以便该值不为空,但是根本不工作(在任何操作系统上)。我收到的错误是不能创建activex对象。

I am using the default DllSurrogate to enable automation of a 32bit COM object in 64bit. This works perfectly in Windows7 64 bit and Windows Server 2008 R2. However; regular flavor Windows Server 2008 (pre R2) completely ignores the DllSurrogate entry in the registry. I've researched this for days and found documentation that classic Windows Server 2008 had registry reflection which ignores the DllSurrogate value if its blank. (I leave the value of the registry string blank to use the default Surrogate.) To work around this not-reflected (not copied between 32bit and 64bit registries), I run the regedit.exe*32 and set the keys. Then I open normal regedit and set the keys. Still no luck. I have also tried setting the DllSurrogate registry value to c:\windows\syswow64\dllhost.exe so that the value isn't blank but that doesn't work at all (on any OS). The error I receive is "cannot create activex object."

我已经在两个不同的Windows Server 2008(Pre R2)机器上重现了这个问题。我还验证了COM对象可以在这些机器上使用从32位应用程序启动时。我用LINQPad 32位和64位进行测试。 LINQPad作为32位运行可以创建COM对象。 64位LINQPad不能。

I have reproduced the problem on 2 different Windows Server 2008 (Pre R2) machines. I also verified that the COM object can be used on those machines when launched from a 32 bit app. I used LINQPad 32 bit and 64bit to test. LINQPad running as 32 bit can create the COM object. 64bit LINQPad cannot.

[link text] [1]< - 解决方案我使用(在R2上工作)
http://msdn.microsoft.com/en-us/library/aa384253(VS.85 ).aspx < - 文档说明DllSurrogate注册表项没有反映在Windows Server 2008上,但我不知道如何规避这个限制。我尝试使用regedit.exe * 32直接编辑32位注册表。

[link text][1] <-- Solution I am using (works on R2) http://msdn.microsoft.com/en-us/library/aa384253(VS.85).aspx <-- Documentation that DllSurrogate registry entry is not reflected on Windows Server 2008, but I don't know how to circumvent this limitation. I tried using regedit.exe*32 to edit the 32bit registry directly.

任何想法我缺少这里?有没有一些特殊的技巧使用默认的DllSurrogate(dllhost.exe)pre-R2?重写我们的COM到.NET是不是一个选择的时刻。我希望我只是失去一些东西,因为这在最新的Windows Server 2008 R2上的工作。

Any ideas what I am missing here? Is there some special trick to use the default DllSurrogate (dllhost.exe) on pre-R2? Rewriting our COM to .NET is not an option at the moment. I hope that I am just missing something as this does work on the latest Windows Server 2008 R2.

感谢您看看!
Danny

Thanks for taking a look! Danny

推荐答案

问题解决!感谢汉斯让我在正确的轨道上!我不小心配置系统使用64位DLLHost.exe文件,它没有工作,因为它不能启动一个32位COM对象。

Problem solved! Thanks Hans for setting me on the right track! I accidentally configured the system to use a 64-bit DLLHost.exe file, which didn't work since it couldn't launch a 32-bit COM object.

开始下面是我能够从64位应用程序中使用我的32位COM对象。

Start-to-finish, here is how I was able to use my 32-bit COM object from a 64-bit application.


  1. 使用regedit * 32注册COM对象(c:\windows \syswow64\regedit)

  1. Register COM object with regedit*32 (c:\windows\syswow64\regedit)

进行以下注册表更改。

Make the following registry changes. Be sure to put this all under Wow6432Node so the 32-bit DLLHost will be used.

通过搜索classname的注册表来确定COM对象的GUID。确保将这一切都放在Wow6432Node下,以便使用32位DLLHost。即。

Determine your COM object's GUID by searching for registry for classname. ie. Classname would be the value you pass to createobject, like CreateObject("classname").

找到现有的键 HKey_Classes_Root\Wow6432Node\\ \\ CLSID\ [GUID]
添加一个新的REG_SZ(字符串)以COM对象GUID作为值的称为AppID的值。

Locate existing key HKey_Classes_Root\Wow6432Node\CLSID\[GUID]. Add a new REG_SZ (string) Value called AppID with a the COM object GUID as the value.

添加一个新的键 HKey_Classes_Root\Wow6432Node\AppID\ [GUID]
在此新键下,添加一个新的REG_SZ(字符串)值称为DllSurrogate。

Add a new key HKey_Classes_Root\Wow6432Node\AppID\[GUID]. Under this new key, add a new REG_SZ (string) Value called DllSurrogate. Leave the value empty.

如果还没有,请在 HKey_Local_Machine \Software \Wow6432Node\ Classes \ AppID\ [GUID]
如果还没有,在此键下添加一个新的REG_SZ(字符串)值 DllSurrogate

If not already there, create new Key under HKey_Local_Machine\Software\Wow6432Node\Classes\AppID\[GUID]. If not already there, add a new REG_SZ (string) Value called DllSurrogate under this key. Leave the value empty.



现在,当您创建COM对象时,应该会看到DLLHost.exe * 32出现在任务管理器。打开任务管理器中的命令行列,您应该会看到 C:\windows\syswow64\dllhost.exe / processid:{YourCOMGUIDHere}

这篇关于如何在Windows Server 2008上使用32位COM对象(在2008 R2上工作,但不是2008)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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