diff options
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 ); |