diff options
author | Mathias Michel <matm@gmx.fr> | 2013-01-20 02:46:13 +0100 |
---|---|---|
committer | Andras Timar <atimar@suse.com> | 2013-01-23 11:26:08 +0000 |
commit | 95ee7d9cd3a0b0f397def8e607759c81feb8c592 (patch) | |
tree | 05a77a104c510ebb2faebf94e230a9a1be1ce16e /setup_native/source/win32/customactions/shellextensions/copyextensiondata.cxx | |
parent | e1669188e2832cf0cc1caf111f70aff7ba17757a (diff) |
fix for fdo#39632 : Consolidate GetMsiProperty()
And did it also for GetMsiProp() and *MsiProperty()
Reworked some conditions related to that.
Change-Id: I1cd082361126db3d9aced3a878b19e7052514864
Reviewed-on: https://gerrit.libreoffice.org/1816
Reviewed-by: Andras Timar <atimar@suse.com>
Tested-by: Andras Timar <atimar@suse.com>
Diffstat (limited to 'setup_native/source/win32/customactions/shellextensions/copyextensiondata.cxx')
-rw-r--r-- | setup_native/source/win32/customactions/shellextensions/copyextensiondata.cxx | 24 |
1 files changed, 3 insertions, 21 deletions
diff --git a/setup_native/source/win32/customactions/shellextensions/copyextensiondata.cxx b/setup_native/source/win32/customactions/shellextensions/copyextensiondata.cxx index 1a52dad88d04..758d9d9cca24 100644 --- a/setup_native/source/win32/customactions/shellextensions/copyextensiondata.cxx +++ b/setup_native/source/win32/customactions/shellextensions/copyextensiondata.cxx @@ -28,7 +28,7 @@ #define WIN32_LEAN_AND_MEAN #endif #include <windows.h> -#include <msiquery.h> +#include <../tools/msiprop.hxx> #include <shellapi.h> #ifdef _MSC_VER #pragma warning(pop) @@ -48,27 +48,9 @@ #include <string> -static std::_tstring GetMsiProperty( MSIHANDLE handle, const std::_tstring& sProperty ) -{ - std::_tstring result; - TCHAR szDummy[1] = TEXT(""); - DWORD nChars = 0; - - if ( MsiGetProperty( handle, sProperty.c_str(), szDummy, &nChars ) == ERROR_MORE_DATA ) - { - DWORD nBytes = ++nChars * sizeof(TCHAR); - LPTSTR buffer = reinterpret_cast<LPTSTR>(_alloca(nBytes)); - ZeroMemory( buffer, nBytes ); - MsiGetProperty(handle, sProperty.c_str(), buffer, &nChars); - result = buffer; - } - - return result; -} - extern "C" UINT __stdcall copyExtensionData(MSIHANDLE handle) { - std::_tstring sSourceDir = GetMsiProperty( handle, TEXT("SourceDir") ); + std::_tstring sSourceDir = GetMsiPropValue( handle, TEXT("SourceDir") ); std::_tstring sExtensionDir = sSourceDir + TEXT("extension\\"); std::_tstring sPattern = sExtensionDir + TEXT("*.oxt"); @@ -83,7 +65,7 @@ extern "C" UINT __stdcall copyExtensionData(MSIHANDLE handle) { bool fNextFile = false; bool bFailIfExist = true; - std::_tstring sDestDir = GetMsiProperty( handle, TEXT("INSTALLLOCATION") ); + std::_tstring sDestDir = GetMsiPropValue( handle, TEXT("INSTALLLOCATION") ); std::_tstring sShareInstallDir = sDestDir + TEXT("share\\extension\\install\\"); // creating directories |