I have this message pop up in Windows 7 sometimes. When it pops up is not relevant because I'm not seeking a solution. I am 90% sure I know what is causing this message to pop up. However, I am not going to bother fixing it for reasons not relevant to the question.

What I really want to know is what is meant by the message, as in, what is this "stub" and what is meant by "bad data"?

  • A little research shows this MS KB and mentions You pass a variant from a COM client to a COM Server (or from a COM Server to a COM client). The variant contains a single user-defined data type (UDT) or a SafeArray of UDTs. and it mentions the variant is not passed successfully so this means that the data in this operation is not being transformed correctly for whatever reason basically... en.wikipedia.org/wiki/Marshalling_(computer_science)... I'm sure a programmer can answer more specifically but that's my quick thought. – Pimp Juice IT Aug 27 '16 at 18:40
  • Additionally, I'm not saying you need any hotfix either, just using that MS KB for reference only as well as the wiki "Marshalling" for some additional reading to use for clarification on the topic for the best understanding perhaps... – Pimp Juice IT Aug 27 '16 at 18:41

After some research, I think I can now answer my own question. Actually, the answer to the question can be found in an answer on Stack Overflow.

A "stub" is used in COM when you make calls across an execution boundary. It wasn't stated explicitly in the question but your Ada program is probably an EXE and implements an out-of-process COM server. Crossing the boundary between processes in Windows is difficult due to their strong isolation. This is done in Windows by RPC, Remote Procedure Call, a protocol for making calls across such boundaries, a network being the typical case.

To make an RPC call, the arguments of a function must be serialized into a network packet. COM doesn't know how to do this because it doesn't know enough about the actual arguments to a function, it needs the help of a proxy. A piece of code that does know what the argument types are. On the receiving end is a very similar piece of code that does the exact opposite of what the proxy does. It deserializes the arguments and makes the internal call. This is the stub.

One way this can fail is when the stub receives a network packet and it contains more or less data than required for the function argument values. Clearly it won't know what to do with that packet, there is no sensible way to turn that into a StructData_Type value, and it will fail with "The stub received bad data" error."

SturctData_Type in the 3rd paragraph simply refers to a user defined data type which is something that a programmer defines to store a collection of data in an organised fashion.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.