Skip to content

Variant Interop Bug #227

Description

@weltkante

While reviewing the WinForms implementation of VARIANT interop I was comparing with various implementations found on the web and I noticed you are treating VT_INT/VT_UINT as IntPtr/UIntPtr.

The resolution in the WinForms PR was that VT_INT/VT_UINT need to be 4 byte, even though the C/C++ headers are a bit ambigous the spec is clear and its also what native code is doing.

Just leaving you this as a note in case you want to fix your implementation.

dotnet/winforms#3197 (comment)

In the headers (wtypes.h) it is written up as such:

/*
...
 *  VT_INT              [V][T][P][S]  signed machine int
 *  VT_UINT             [V][T]   [S]  unsigned machine int
*/

But... things like VariantCopyInd() always treat them as a 4 byte value. This aligns with the MS-OAUT specification which states:

VT_INT:
Context Description
V, S, T Either the specified type, or the type of the element or contained field MUST be a 4-byte signed integer.

VT_UINT:
Context Description
V, S, T Either the specified type, or the type of the element or contained field MUST be a 4-byte unsigned integer.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions