From b9ebabd675f916a0151ec3893a59131f3a8b2a05 Mon Sep 17 00:00:00 2001 From: Vasily Melenchuk Date: Mon, 21 May 2018 19:47:00 +0300 Subject: tdf#97231: basic: do not use extra wrapping for string marshaling previous approach did wrap string reference once again, making practically "a pointer to pointer to string" so this code was not working correctly for RegQueryValueExA WinAPI call. String is already provided as a reference (see marshalString(), so no reason to wrap its reference. This approach was just copied from from dllmgr-x86.cxx plus some minor changes to make both versions similar. Change-Id: I85065112407de3f078265d2c76437814402eb1b3 Reviewed-on: https://gerrit.libreoffice.org/54645 Tested-by: Jenkins Reviewed-by: Thorsten Behrens --- basic/source/runtime/dllmgr-x64.cxx | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) (limited to 'basic') diff --git a/basic/source/runtime/dllmgr-x64.cxx b/basic/source/runtime/dllmgr-x64.cxx index 4450bbfa6029..2c311861122a 100644 --- a/basic/source/runtime/dllmgr-x64.cxx +++ b/basic/source/runtime/dllmgr-x64.cxx @@ -31,6 +31,7 @@ #include #include +#include "runtime.hxx" #include #include #include @@ -256,9 +257,15 @@ ErrCode marshal( std::vector< char > & blob, std::size_t offset, MarshalData & data) { OSL_ASSERT(variable != nullptr); - if (!(variable->GetFlags() & SbxFlagBits::Reference)) { - if ((variable->GetType() & SbxARRAY) == 0) { - switch (variable->GetType()) { + + SbxDataType eVarType = variable->GetType(); + bool bByVal = !(variable->GetFlags() & SbxFlagBits::Reference); + if( !bByVal && !SbiRuntime::isVBAEnabled() && eVarType == SbxSTRING ) + bByVal = true; + + if (bByVal) { + if ((eVarType & SbxARRAY) == 0) { + switch (eVarType) { case SbxINTEGER: add(blob, variable->GetInteger(), outer ? 8 : 2, offset); break; @@ -307,8 +314,8 @@ ErrCode marshal( } } } else { - if ((variable->GetType() & SbxARRAY) == 0) { - switch (variable->GetType()) { + if ((eVarType & SbxARRAY) == 0) { + switch (eVarType) { case SbxINTEGER: case SbxLONG: case SbxSINGLE: -- cgit