64 bit COM(ActiveX) server

萝らか妹 提交于 2019-12-12 12:22:13

问题


I have activex server exe that was building and registering fine on 32bit OS. I wanted to make 64 bit version of that exe by upgrading project to Visual Studio 2010 and changing platform to X64 which apparently doesn't work.

Application itself works but I don't see it registered after running

That.exe /RegServer

I would appreciate any usable advice on migrating activex from 32 to x64.

Code that is processing /RegServer param is below:

if(lstrcmpi(lpszToken, _T("RegServer")) == 0)
  {
   _Module.UpdateRegistryFromResource(IDR_OUTDISKSARG, TRUE);
   nRet = _Module.RegisterServer(TRUE);
   bRun = false;
   break;
  }

32 bit activex is unuable for me since I have to load it in x64 .NET process.


回答1:


  1. When you run That.exe /RegServer, did you do that from an Administrator command prompt? If not that's probably why it didn't work.

  2. If you did and it still didn't work, try debugging it to see what it's doing to the registry. e.g. Use Process Monitor, or even the Visual Studio debugger (remembering to ensure the debugger runs your app as admin).




回答2:


Assuming that the process has enough rights to write to the registry, you'll have to take care of that by running it from an elevated command prompt, this is likely to only add the COM registry keys to the registry view that 64-bit processes can see.

32-bit COM clients get a different view of the registry, HKLM\Software\Wow6432Node. It is not going to find the registry keys there. Review RegCreateKeyEx() in the SDK docs. Note the link at the bottom and the talk about the KEY_WOW64_32KEY option. The online article is here.

32-bit clients accessing a 64-bit out-of-process COM server is otherwise a pretty well supported scenario, with some caveats. Like building and registering both the 32-bit and 64-bit proxy/stub DLLs.



来源:https://stackoverflow.com/questions/4513566/64-bit-comactivex-server

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!