IonelBurtan
Programmer
Hi everybody,
This problem is becoming annoying. It took me two days and I did not even solve it. here it is.
The problem is that I am having a crash when I am passing VARIANT arguments to a function prototype (below is the IDL signature). The signature is the same in the callee too, I did not change it somehow/
MyFunc([in]LONG ldata, [in]VARIANT vData, [out, retval]LONG* lResponse)
So when I am passing VARIANT that are of simple types (e.g., long, short etc) as parameters on position 2 - the function is called from another component just fine. But if I put an array inside the variant (using safearrays) I get a immediate crush or an RPC error (RPC_X_BAD_STUB_DATA) - "The stub has received bad data".
Now there is no problem with the array from within the VARIANT (the same code works well in other situations).
The caller is a COM+ register application. The interface in problem is IUnknown based.
The callee is also COM+ register application. The interface in problem is IDispatch based.
There is a relation between them - the callee implements the caller interface.
The callee is instantiated safely like that - and the pointer is valid:
CComPtr<ICallerInterface>pObj;
pObj.CoCreateInstance(szProgIdCallee);
...
Now one more thing - this whole stuff happens in a branch on COM calls in a complex COM intesive application.
I am using #import directive in the second component to make the first interface available.
If I take the code out - in two separated components, not registered in COM+ the code works fine.
I am definitely missing something here. But what can it be.
I am 99% that is something not so well-known that has effect in bad marshalling code. The code never reaches the callee - I checked.
The MSDN is misserable on RPCs problems, I did not find anything suitable on the net
Any help appreciated
Thanks,
s-)
Blessed is he who in the name of justice and goodwill, sheperds the weak through the valley of darkness...
This problem is becoming annoying. It took me two days and I did not even solve it. here it is.
The problem is that I am having a crash when I am passing VARIANT arguments to a function prototype (below is the IDL signature). The signature is the same in the callee too, I did not change it somehow/
MyFunc([in]LONG ldata, [in]VARIANT vData, [out, retval]LONG* lResponse)
So when I am passing VARIANT that are of simple types (e.g., long, short etc) as parameters on position 2 - the function is called from another component just fine. But if I put an array inside the variant (using safearrays) I get a immediate crush or an RPC error (RPC_X_BAD_STUB_DATA) - "The stub has received bad data".
Now there is no problem with the array from within the VARIANT (the same code works well in other situations).
The caller is a COM+ register application. The interface in problem is IUnknown based.
The callee is also COM+ register application. The interface in problem is IDispatch based.
There is a relation between them - the callee implements the caller interface.
The callee is instantiated safely like that - and the pointer is valid:
CComPtr<ICallerInterface>pObj;
pObj.CoCreateInstance(szProgIdCallee);
...
Now one more thing - this whole stuff happens in a branch on COM calls in a complex COM intesive application.
I am using #import directive in the second component to make the first interface available.
If I take the code out - in two separated components, not registered in COM+ the code works fine.
I am definitely missing something here. But what can it be.
I am 99% that is something not so well-known that has effect in bad marshalling code. The code never reaches the callee - I checked.
The MSDN is misserable on RPCs problems, I did not find anything suitable on the net
Any help appreciated
Thanks,
s-)
Blessed is he who in the name of justice and goodwill, sheperds the weak through the valley of darkness...