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/vistaspecial.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/vistaspecial.cxx')
-rw-r--r-- | setup_native/source/win32/customactions/shellextensions/vistaspecial.cxx | 26 |
1 files changed, 4 insertions, 22 deletions
diff --git a/setup_native/source/win32/customactions/shellextensions/vistaspecial.cxx b/setup_native/source/win32/customactions/shellextensions/vistaspecial.cxx index 7011fcdf7dd7..862c7a3d65f1 100644 --- a/setup_native/source/win32/customactions/shellextensions/vistaspecial.cxx +++ b/setup_native/source/win32/customactions/shellextensions/vistaspecial.cxx @@ -24,7 +24,7 @@ #endif #define WIN32_LEAN_AND_MEAN #include <windows.h> -#include <msiquery.h> +#include <../tools/msiprop.hxx> #ifdef _MSC_VER #pragma warning(pop) #endif @@ -65,25 +65,7 @@ static inline void OutputDebugStringFormat( LPCSTR, ... ) #endif -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; -} - -static BOOL RemoveCompleteDirectory( std::_tstring sPath ) +static bool RemoveCompleteDirectory( std::_tstring sPath ) { bool bDirectoryRemoved = true; @@ -143,7 +125,7 @@ static BOOL RemoveCompleteDirectory( std::_tstring sPath ) extern "C" UINT __stdcall RenamePrgFolder( MSIHANDLE handle ) { - std::_tstring sOfficeInstallPath = GetMsiProperty(handle, TEXT("INSTALLLOCATION")); + std::_tstring sOfficeInstallPath = GetMsiPropValue(handle, TEXT("INSTALLLOCATION")); std::_tstring sRenameSrc = sOfficeInstallPath + TEXT("program"); std::_tstring sRenameDst = sOfficeInstallPath + TEXT("program_old"); @@ -167,7 +149,7 @@ extern "C" UINT __stdcall RenamePrgFolder( MSIHANDLE handle ) extern "C" UINT __stdcall RemovePrgFolder( MSIHANDLE handle ) { - std::_tstring sOfficeInstallPath = GetMsiProperty(handle, TEXT("INSTALLLOCATION")); + std::_tstring sOfficeInstallPath = GetMsiPropValue(handle, TEXT("INSTALLLOCATION")); std::_tstring sRemoveDir = sOfficeInstallPath + TEXT("program_old"); RemoveCompleteDirectory( sRemoveDir ); |