I developed an out-of-proc server and trying to marshal input params, but it fails. My .idl file is:
[
uuid(6a4791c0-f69f-4d78-a591-f549c90c0620),
object,
oleautomation
]
interface IBrowserInterraction : IUnknown
{
HRESULT Unlock([in] BSTR str, [in] int value);
};
[
uuid(4d36f1c6-9ee6-4d9a-b0aa-6b7195cc5666),
version(1.0)
]
library BrowserInterractionInterfaceLibrary
{
[
uuid(cdebf15b-f12c-4559-a6ac-81620c5056c4)
]
coclass BrowserInterractionInterface
{
interface IBrowserInterraction;
};
};
My server code:
m_bpFactory = boost::make_shared<BrowserPluginInterractionClassFactory>(m_synchronizer);
IUnknown* pUnk;
m_bpFactory->QueryInterface(__uuidof(IUnknown), (void**)&pUnk);
CoRegisterClassObject(__uuidof(BrowserInterractionInterface), pUnk, CLSCTX_LOCAL_SERVER, REGCLS_MULTIPLEUSE, &magic);
My client code:
std::string data("some value")
std::wstring wstr = std::wstring(password.begin(), password.end());
BSTR bs = SysAllocStringLen(wstr.data(), wstr.size());
IBrowserInterraction* interraction = NULL;
CoCreateInstance(__uuidof(BrowserInterractionInterface), NULL, CLSCTX_ALL, __uuidof(IBrowserInterraction), (void**)&interraction);
interraction->Unlock(bs, 123);
I debugged this client call it sends the right value. But server receives this:
I created a proxy\stub library, registered it with regsvr, and included _i.c and _h.h files in client and server code, and everythong was fine.
And client after call of Unlock functions shows me this error:
Run-Time Check Failure #0 - The value of ESP was not properly saved across a function call. This is usually a result of calling a function declared with one calling convention with a function pointer declared with a different calling convention.