Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Hard Core - expert needed (I think!) 1

Status
Not open for further replies.

IonelBurtan

Programmer
May 25, 2001
601
RO
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 failure occurs because parts of the marshaling code are not synchronized. Besides that, Microsoft has confirmed that this is a problem in some of the Microsoft products (it applies to Microsoft COM+ 1.0 when used with Microsoft Windows NT 4.0 and 2000).
Some questions, though: what's your OS and how many processors does your machine has?
 
Hi,

I have one processor and Windows 2000 SP3
I came to same conclusion: there is nothing wrong with the code itself.

That is the code works fine on a computer with folowing configuration:
Visual Studio 6 Version = service pack 5
MdacVersion = 2.71.9040.2
AdoVersion = 2.7
Operating System = Windows 2000 Service Pack 4.0
MTS Version = 3.0
WSH Version = 5.6

My computer configuration is:
Visual Studio 6 Version = service pack 5
MdacVersion = 2.53.6200.1
AdoVersion = 2.5
Operating System = Windows 2000 Service Pack 3.0
MTS Version = 3.0
WSH Version = 5.6


All above elements are used in code. I do not know exaclty what solved the problem. This would be important, in order to know how to make the Software Requirements for the clients.
If any of you knows about that, please tell

Thanks,


s-)

Blessed is he who in the name of justice and goodwill, sheperds the weak through the valley of darkness...
 
Hi again. I don't know exactly on what operating systems this problem occurs (and as you've said, not only the MSDN but the entire Microsoft support site is miserable on RPC problems) but I can tell you that if you ever need to run this code under Windows NT 4, you need ServicePack 6 installed.


P.S.: I asked you how many processors do you have because searching on several discussion threads on some (more or less) obscure forums, I've read that similiar marshalling problems are happening mostly on multi-processor architectures.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top