×
INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!
  • Students Click Here

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

Jobs

Hard Core - expert needed (I think!)

Hard Core - expert needed (I think!)

Hard Core - expert needed (I think!)

(OP)
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,



Blessed is he who in the name of justice and goodwill, sheperds the weak through the valley of darkness...
http://www20.brinkster.com/ionelb

RE: Hard Core - expert needed (I think!)

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?

RE: Hard Core - expert needed (I think!)

(OP)
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,



Blessed is he who in the name of justice and goodwill, sheperds the weak through the valley of darkness...
http://www20.brinkster.com/ionelb

RE: Hard Core - expert needed (I think!)

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.

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members! Already a Member? Login

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close