1
votes

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)

I have built and registered the corresponding proxy stub DLL.

I have a client app that does

  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

These steps were copied from (comip.h::CreateInstance)

The problem appears to be that the proxystub dll is not being invoked (it doesn't appear in the Modules list in the IDE, nor in loaded modules list in debug window)

The OleCom Object viewer for my class and interface can be seen here https://skydrive.live.com/redir?resid=AE43106917EBD9E1!191&authkey=!AIOWeS5P3o2mlpw

8891..ca4d is the class interface id for my object

A298...420c is the interface ID for my server object (IDispatch based)

TIA for any assistance

1
Have you registered the proxystub? You could use Process Monitor to see if COM tries to load the proxystub and what happen next. - sharptooth
What does the lifetime of the out of proc COM server look like? Does it launch then immediately exit? Also, can you describe the reasoning behind your usage of OleRun? I suspect that oleauto32.dll is being loaded and performing the marshalling for you. Your question doesn't mention any custom interfaces, in which case any marshalling that needs to take place can be done by oleaut32 and won't require your custom proxy/stub to be loaded. - Tra5is
One more question, does the component that Run is called on register itself in the Running Object Table? - Tra5is
Yes, proxy stub is registered - user1411477
Out of proc server does not exit immediately, it hangs around until client exits, Usage of OleRun was copied from comip.h::CreateInstance, i.e. expansion of _com_ptr_t::CreateInstance(clsid). What does proxying if it isn't done in PS DLL ? - user1411477

1 Answers

0
votes

It's possible that your issue is that the component that is implementing the IRunnableObject interface isn't registering itself in the Running Object Table. This will mean that the CoCreateInstance itself will succeed, however, when the object it called on, the RPC code will be unable to find it.

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.

I'm a little worried about why you're also using the IMarshall interface. Normally it's not necessary to write custom marshaling code, thus you won't need to use this interface.

As long as you don't reference a custom interface the default marshaller in ole32.dll or oleauto32.dll will be used. That's most likely why you don't see your proxy being loaded.

    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/desktop/ms692621(v=vs.85).aspx