Error 0x800706F7 "Pieces received bad data" in Windows XP SP3

In my VB6 application, I make several calls to the COM server created by my team from the Ada project (using GNATCOM). There are basically 2 methods on the COM server. Their prototypes in VB:

Sub PutParam(Param As Parameter_Type, Value)
Function GetParam(Param As Parameter_Type)

where Parameter_Type is an enumerated type that distinguishes many parameters that I can put / receive from the COM server, and "Value" is a variable of type Variant . PutParam () gets the option, and GetParam () returns the option. (I really don't know why in VB6 Object Browser there is no reference to the Variant type on the COM server interface ...).

The product of this project has been used continuously for many years without any problems in this interface on computers running Windows XP Service Pack 2 (SP2). On computers with WinXP SP3, we get error 0x800706F7 "The piece received bad data" when trying to put parameters with the type "Long".

Does anyone know what could be causing this? The COM server is still being built on a system with Service Pack 2 (SP2). Should any differences build it in a system with SP3? (for example, when we create X64 on X64 systems).

One of the challenges that cause the problem is the following (changing some variable names):

Dim StructData As StructData_Type

StructData.FirstLong = 1234567
StructData.SecondLong = 8901234
StructData.Status = True

ComServer.PutParam(StructDataParamType, StructData)

Where is the definition of StructData_Type:

Type StructData_Type
    FirstLong As Long
    SecondLong As Long
    Status As Boolean
End Type

(after the question was first submitted, the following is added)

The definition of primitive calls on the COM server interface in the IDL is presented below:

// Service to receive data
HRESULT PutParam([in] Parameter_Type Param, [in] VARIANT *Value);

//Service to send requested data
HRESULT GetParam([in] Parameter_Type Param, [out, retval] VARIANT *Value);

, , :

struct StructData_Type
{
   int FirstLong;
   int SecondLong;
   VARIANT_BOOL Status;
} StructData_Type;

, "int" FirstLong SeconLong, - VB6, "Long". , IDL COM- ( ), Long.

Update:

COM-, Windows 7 ( GNAT, GNATCOM), ! , . WinXP SP3, , Win7. , Win7.

+5
4

, , , .

A "" COM . , Ada, , EXE COM- . Windows - . Windows RPC, Remote Procedure Call, , .

RPC, . COM , , , . , , . , , . . .

, , , , . , , , StructData_Type, " ".

, DLL Hell. . , .

, . , , . , , , . 10 , 4 + 4 + 2, . 12 . , , ints , . COM, COM , - . , IRecordInfo. , .

, IRecordInfo. /. - IDL, Interface Description Language MIDL. /, . DLL, , . , , .

- , VB6, -, Windows. FactoryBuffer, CLSID - {00000320-0000-0000-C000-000000000046}. . COM-, FactoryBuffer, , . , , IRecordInfo , . , , GNATCOM.

, , . VB6, . , , - . . , , . Kaboom, , guid.

, . , , SP3, COM- . , , - . ProcMon SysInternals - , , , . COM Spy, .

+5

XP, , , . , "" 64-, COM Ada (/, , C ints) 32 . , , COM, .

, " 64- ", . , 64- C.

0

, , , (, , ). 9 ( 4 ints/longs ). , (, , 8, )

0

, . , #pragma, , , .

I think it would be nice to try to fix your structure so that the resulting structure of the type library is a multiple of four (or eight). Your status member takes 2 bytes, so perhaps you should insert a dummy value of the same type as before or after the state - which should bring it to 12 bytes (when packing up to eight bytes, it should be three dummy variables).

0
source

All Articles