English 中文(简体)
无法使用代理系统块创建 com 对象
原标题:Unable to create a com object using proxy stub dll

Using Visual c++ 6.0, I have created an ATL based .EXE server . (VC6 as I am dealing with legacy code, a .exe server as I need to test operation in an out of process context, currently the .exe server is essentialy a no op)

我已经建立并注册了相应的代理书根DLL

我有一个客户应用程序

  1. CoCreateInstance of IUnknown which invokes FinalConstruct in server object and succeeds (so server is correctly invoked)
  2. OleRun of returned IUnknown interface succeeds
  3. QueryInterface on IUnknown pointer for my server object fails with error code of 0x8000402 (No such interface supported) for the IMarshall interface

这些步骤是从(comi.h:CreateInstance)复制的。

问题似乎在于代理stub dll 没有被引用( 它没有出现在 IDE 中的模块列表中, 也没有出现在调试窗口中的装入模块列表中) 。

https://skydrive.live.com/redir?resid=AE43106917EBD9E1!191 & amp;authkey=!AIOWES5P3o2mlpw" rel="nofollow" > OleCom 对象查看器用于我的课和接口 https://skydrive.live.com/redir?resid=AE43106917EB9E9E1!191&authkey=!AIOWES5P3o2mlpw

8891.ca4d 是我的对象的类界面 ID

A298..420c 是我的服务器对象(基于 IDispatch) 的接口 ID

任何援助的军备透明分析署

问题回答

您的问题可能在于执行 IRunnableObject 界面的组件没有在运行对象表注册。 这意味着“ 共产主义” 本身会成功, 但是当它所呼吁的物件被成功时, RPC 代码将无法找到它 。

This MSDN page indicates: http://msdn.microsoft.com/en-us/library/windows/desktop/ms694517(v=vs.85).aspx

    Notes to Implementers
    The object should register in the running object table if it has a 
    moniker assigned. The object should not hold any strong locks on itself; 
    instead, it should remain in the unstable, unlocked state. The object 
    should be locked when the first external connection is made to the object.

我有点担心你为什么同时使用 IMarshall 界面。 通常不需要写入自定义编码, 因此您不需要使用这个界面 。

只要您不引用自定义界面, 就会使用 ole32.dll 或 oleato32.dll 中的默认运算符。 这很可能是您没有看到代理被装入的原因 。

    In the case of most COM interfaces, the proxies and stubs for standard 
    marshaling are in-process component objects which are loaded from a 
    systemwide DLL provided by COM in Ole32.dll.

http://msdn.microsoft.com/en-us/library/windows/desktops/ms692621(v=s.85)。aspx





相关问题
How can i add a button to all windows explorer instances?

I am trying to add a button to one of the existing tool bars in any windows explorer instance. After much research i figured out that BHO (browser helper objects) are the best way to hook to ...

Hunting memory leaks

I m finding leaked heap blocks by using the following command in WinDbg !heap –l With each leaked heap block I get, I m running to following to get the stack trace. !heap -p -a leakedheapblock The ...

Why use CComBSTR instead of just passing a WCHAR*?

I m new to COM. What exactly is the advantage of replacing: L"String" with CComBSTR(L"String") I can see a changelist in the COM part of my .NET application where all strings are replaced in this ...

IThumbnailProvider and IInitializeWithItem

I am trying to develop an IThumbnailProvider for use in Windows 7. Since this particular thumbnail would also be dependant on some other files in the same directory, I need to use something other than ...

Getting a byte array from out of process C++ COM to C#

What s the best way to get a chunk of memory (i.e. void*) from a COM server to C#? We have been using an IStream (using CreateStreamOnHGlobal) and passing that back, which worked. However when we ...

COM Basic links

folks can you provide me the tutorial link or .pdf for learning basic COM?. i do google it.. still i recommend answers of stackoverflow so please pass me.. Thanks

热门标签