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