Windows Server 2008: COM error: 0x800706F7 - The s

2019-04-10 09:57发布

问题:

I'm evaluating Server 2008. My C++ executable is getting this error. I've seen this error on MSDN that seems to have required a hot-fix for several previous OSes. Anyone else seen this? I get the same results for the 32 & 64 bit OS.

Code snippet:

HRESULT GroupStart([in] short iClientId, [in] VARIANT GroupDataArray,
    [out] short* pGroupInstance, [out] long* pCommandId);

Where the GroupDataArray VARIANT argument wraps a single-dimension SAFEARRAY of VARIANTs wrapping a DCAPICOM_GroupData struct entries:

// DCAPICOM_GroupData
[
      uuid(F1FE2605-2744-4A2A-AB85-1E1845C280EB),
      helpstring("removed")
]

typedef struct DCAPICOM_GroupData {
      [helpstring("removed")]
      long              m_lImageID;

      [helpstring("removed")]
      unsigned char     m_ucHeadID;

      [helpstring("removed")]
      unsigned char     m_ucPlateID;
} DCAPICOM_GroupData;

回答1:

After opening a support case with Microsoft, I can now answer my own question. This is (now) a recognized bug. The issue has to do with marshalling on the server side, but before the server code is called. Our structure is 6 bytes long, but this COM implementation is interpreting it as 8, so the marshalling fails, and this is the error you get back. The workaround, until a Service Pack is released to deal with this, is to add two extra bytes to the structure to pad it up to 8 bytes. We haven't run across any more instances that fail yet, but we still have a lot of testing to do still.



回答2:

We ran into the same error recently with a client/server app communicating via DCOM. It turned out that the size of a marshalled interface pointer going across the wire (i.e., not local) had changed (gotten bigger). You might like to check whether your code is doing any special marshalling via CoMarshalInterface or the like.