From 52092e6d933dd9be59dceb596319f93d0ea71e2b Mon Sep 17 00:00:00 2001 From: Jan Engelhardt Date: Thu, 25 Nov 2021 22:16:46 +0100 Subject: [PATCH] emsmdb: use attachment_object::set_properties when props are set via fastupctx When an attachment is copied from and to the same message using MFCMAPI, it issues MAPI calls like so: // CAttachmentsDlg::HandlePaste() srcmsg->OpenAttach(..., &srcatt); dstmsg->CreateAttach(..., &dstatt); srcatt->CopyTo(..., dstatt, ...); dstatt->SaveChanges(...); dstmsg->SaveChanges(...); and EMSMDB.DLL's IAttach::CopyTo issues this set of ROPs: ropOpenAttachment ropCreateAttachment ropFastTransferDestinationConfigure ropFastTransferSourceCopyTo ropFastTransferSourceGetBuffer ropFastTransferDestinationPutBuffer ropSaveChangesAttachment ropSaveChangesMessage rop_fasttransferdestputbuffer fails to mark the attachment as modified (b_touched), and the attachment is not saved. Fixes: gromox-0~666 --- exch/emsmdb/fastupctx_object.cpp | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/exch/emsmdb/fastupctx_object.cpp b/exch/emsmdb/fastupctx_object.cpp index 9724e0856..2aa40b551 100644 --- a/exch/emsmdb/fastupctx_object.cpp +++ b/exch/emsmdb/fastupctx_object.cpp @@ -873,11 +873,14 @@ static gxerr_t fastupctx_object_record_propval(fastupctx_object *pctx, static_cast(pctx->pobject)->get_instance_id(), ppropval, &b_result) == TRUE ? GXERR_SUCCESS : GXERR_CALL_FAILED; - case ROOT_ELEMENT_ATTACHMENTCONTENT: - return exmdb_client_set_instance_property(pctx->pstream->plogon->get_dir(), - static_cast(pctx->pobject)->get_instance_id(), - ppropval, &b_result) == TRUE ? - GXERR_SUCCESS : GXERR_CALL_FAILED; + case ROOT_ELEMENT_ATTACHMENTCONTENT: { + auto atx = static_cast(pctx->pobject); + TPROPVAL_ARRAY av; + av.count = 1; + av.ppropval = deconst(ppropval); + PROBLEM_ARRAY pa; + return atx->set_properties(&av, &pa) == TRUE ? GXERR_SUCCESS : GXERR_CALL_FAILED; + } case ROOT_ELEMENT_MESSAGELIST: case ROOT_ELEMENT_TOPFOLDER: return GXERR_CALL_FAILED;