From: Zebediah Figura Subject: [PATCH] include: Define the _STGMEDIUM_UNION type for C++. Message-Id: <20191218175304.198289-1-z.figura12@gmail.com> Date: Wed, 18 Dec 2019 11:53:04 -0600 This fixes a regression introduced by 732f67ed38a45911d726df8da5a68710d175ba1d. Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=47710 Signed-off-by: Zebediah Figura --- include/objidl.idl | 22 +++++++++++++++++++++- 1 file changed, 21 insertions(+), 1 deletion(-) diff --git a/include/objidl.idl b/include/objidl.idl index a0ad1f6e01..a5466c3698 100644 --- a/include/objidl.idl +++ b/include/objidl.idl @@ -1426,8 +1426,11 @@ interface IAdviseSink : IUnknown default: wireHGLOBAL hGeneric; } GDI_OBJECT; +/* Defining the _STGMEDIUM_UNION type yields a violation of the C spec when + * NONAMELESSUNION is not defined, so only define it for C++. */ +cpp_quote("#ifdef __cplusplus") typedef struct _userSTGMEDIUM { - union switch(DWORD tymed) u { + union _STGMEDIUM_UNION switch(DWORD tymed) u { case TYMED_NULL: ; case TYMED_MFPICT: wireHMETAFILEPICT hMetaFilePict; case TYMED_ENHMF: wireHENHMETAFILE hHEnhMetaFile; @@ -1439,6 +1442,23 @@ interface IAdviseSink : IUnknown } DUMMYUNIONNAME; IUnknown *pUnkForRelease; } userSTGMEDIUM; +cpp_quote("#else") +cpp_quote("typedef struct _userSTGMEDIUM {") +cpp_quote(" struct {") +cpp_quote(" DWORD tymed;") +cpp_quote(" union {") +cpp_quote(" wireHMETAFILEPICT hMetaFilePict;") +cpp_quote(" wireHENHMETAFILE hHEnhMetaFile;") +cpp_quote(" GDI_OBJECT *hGdiHandle;") +cpp_quote(" wireHGLOBAL hGlobal;") +cpp_quote(" LPOLESTR lpszFileName;") +cpp_quote(" BYTE_BLOB *pstm;") +cpp_quote(" BYTE_BLOB *pstg;") +cpp_quote(" } u;") +cpp_quote(" } DUMMYUNIONNAME;") +cpp_quote(" IUnknown *pUnkForRelease;") +cpp_quote("} userSTGMEDIUM;") +cpp_quote("#endif") typedef [unique] userSTGMEDIUM *wireSTGMEDIUM; typedef [wire_marshal(wireSTGMEDIUM)] uSTGMEDIUM STGMEDIUM; -- 2.24.1