Based on a patch by Zebediah Figura.
Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=46270 Signed-off-by: Huw Davies huw@codeweavers.com --- dlls/ole32/usrmarshal.c | 24 +++++++++++++++++++++--- 1 file changed, 21 insertions(+), 3 deletions(-)
diff --git a/dlls/ole32/usrmarshal.c b/dlls/ole32/usrmarshal.c index 772bff5f5e..9f19b66d63 100644 --- a/dlls/ole32/usrmarshal.c +++ b/dlls/ole32/usrmarshal.c @@ -2036,11 +2036,29 @@ unsigned char * __RPC_USER STGMEDIUM_UserUnmarshal(ULONG *pFlags, unsigned char * which the first parameter is a ULONG. * This function is only intended to be called by the RPC runtime. */ -void __RPC_USER STGMEDIUM_UserFree(ULONG *pFlags, STGMEDIUM *pStgMedium) +void __RPC_USER STGMEDIUM_UserFree(ULONG *flags, STGMEDIUM *med) { - TRACE("(%s, %p\n", debugstr_user_flags(pFlags), pStgMedium); + TRACE("(%s, %p)\n", debugstr_user_flags(flags), med);
- ReleaseStgMedium(pStgMedium); + switch (med->tymed) + { + case TYMED_NULL: + case TYMED_FILE: + case TYMED_ISTREAM: + case TYMED_ISTORAGE: + ReleaseStgMedium(med); + break; + case TYMED_HGLOBAL: + case TYMED_GDI: + case TYMED_MFPICT: + case TYMED_ENHMF: + if (LOWORD(*flags) == MSHCTX_INPROC) + med->tymed = TYMED_NULL; + ReleaseStgMedium(med); + break; + default: + RaiseException(DV_E_TYMED, 0, 0, NULL); + } }
ULONG __RPC_USER ASYNC_STGMEDIUM_UserSize(ULONG *pFlags, ULONG StartingSize, ASYNC_STGMEDIUM *pStgMedium)
Would it make sense to swap case order and merge/fallthrough?
On 13/12/2018 10:39, Huw Davies wrote:
- ReleaseStgMedium(pStgMedium);
- switch (med->tymed)
- {
- case TYMED_NULL:
- case TYMED_FILE:
- case TYMED_ISTREAM:
- case TYMED_ISTORAGE:
ReleaseStgMedium(med);
break;
- case TYMED_HGLOBAL:
- case TYMED_GDI:
- case TYMED_MFPICT:
- case TYMED_ENHMF:
if (LOWORD(*flags) == MSHCTX_INPROC)
med->tymed = TYMED_NULL;
ReleaseStgMedium(med);
break;
- default:
RaiseException(DV_E_TYMED, 0, 0, NULL);
- }
On Thu, Dec 13, 2018 at 01:23:47PM +0100, Serge Gautherie wrote:
Would it make sense to swap case order and merge/fallthrough?
I did try it like that, but decided I preferred it this way instead. Had the common code been more than just a single line I might have done it that way instead.
Huw.