summaryrefslogtreecommitdiff
path: root/setup_native/source/win32/customactions
diff options
context:
space:
mode:
Diffstat (limited to 'setup_native/source/win32/customactions')
-rw-r--r--setup_native/source/win32/customactions/languagepacks/respintest.cxx57
-rw-r--r--setup_native/source/win32/customactions/reg4allmsdoc/reg4allmsi.cxx140
-rw-r--r--setup_native/source/win32/customactions/regactivex/regactivex.cxx27
-rw-r--r--setup_native/source/win32/customactions/regpatchactivex/regpatchactivex.cxx41
-rw-r--r--setup_native/source/win32/customactions/sellang/sellang.cxx21
-rw-r--r--setup_native/source/win32/customactions/shellextensions/checkdirectory.cxx37
-rw-r--r--setup_native/source/win32/customactions/shellextensions/checkpatches.cxx42
-rw-r--r--setup_native/source/win32/customactions/shellextensions/completeinstallpath.cxx33
-rw-r--r--setup_native/source/win32/customactions/shellextensions/copyextensiondata.cxx24
-rw-r--r--setup_native/source/win32/customactions/shellextensions/dotnetcheck.cxx42
-rw-r--r--setup_native/source/win32/customactions/shellextensions/layerlinks.cxx40
-rw-r--r--setup_native/source/win32/customactions/shellextensions/migrateinstallpath.cxx31
-rw-r--r--setup_native/source/win32/customactions/shellextensions/postuninstall.cxx23
-rw-r--r--setup_native/source/win32/customactions/shellextensions/setadmininstall.cxx4
-rw-r--r--setup_native/source/win32/customactions/shellextensions/startmenuicon.cxx37
-rw-r--r--setup_native/source/win32/customactions/shellextensions/upgrade.cxx44
-rw-r--r--setup_native/source/win32/customactions/shellextensions/vistaspecial.cxx26
-rw-r--r--setup_native/source/win32/customactions/thesaurus/thesaurus.cxx36
-rw-r--r--setup_native/source/win32/customactions/tools/checkversion.cxx35
-rwxr-xr-xsetup_native/source/win32/customactions/tools/msiprop.hxx62
20 files changed, 218 insertions, 584 deletions
diff --git a/setup_native/source/win32/customactions/languagepacks/respintest.cxx b/setup_native/source/win32/customactions/languagepacks/respintest.cxx
index f757a880f912..864f9bf64d42 100644
--- a/setup_native/source/win32/customactions/languagepacks/respintest.cxx
+++ b/setup_native/source/win32/customactions/languagepacks/respintest.cxx
@@ -27,7 +27,7 @@
#endif
#define WIN32_LEAN_AND_MEAN
#include <windows.h>
-#include <msiquery.h>
+#include <../tools/msiprop.hxx>
#ifdef _MSC_VER
#pragma warning(pop)
#endif
@@ -44,53 +44,18 @@
using namespace std;
-namespace
-{
- string GetMsiProperty(MSIHANDLE handle, const string& sProperty)
- {
- string 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;
- }
-
- inline bool IsSetMsiProperty(MSIHANDLE handle, const string& sProperty)
- {
- return (GetMsiProperty(handle, sProperty).length() > 0);
- }
-
- inline void UnsetMsiProperty(MSIHANDLE handle, const string& sProperty)
- {
- MsiSetProperty(handle, sProperty.c_str(), NULL);
- }
-
- inline void SetMsiProperty(MSIHANDLE handle, const string& sProperty, const string&)
- {
- MsiSetProperty(handle, sProperty.c_str(), TEXT("1"));
- }
-} // namespace
-
extern "C" UINT __stdcall GetUserInstallMode(MSIHANDLE handle)
{
- string sOfficeInstallPath = GetMsiProperty(handle, TEXT("INSTALLLOCATION"));
+ string sOfficeInstallPath = GetMsiPropValue(handle, TEXT("INSTALLLOCATION"));
// MessageBox(NULL, sOfficeInstallPath.c_str(), "DEBUG", MB_OK);
// unsetting all properties
- UnsetMsiProperty( handle, TEXT("INVALIDDIRECTORY") );
- UnsetMsiProperty( handle, TEXT("ISWRONGPRODUCT") );
- UnsetMsiProperty( handle, TEXT("PATCHISOLDER") );
- UnsetMsiProperty( handle, TEXT("ALLUSERS") );
+ MsiSetProperty( handle, TEXT("INVALIDDIRECTORY"), NULL );
+ MsiSetProperty( handle, TEXT("ISWRONGPRODUCT"), NULL );
+ MsiSetProperty( handle, TEXT("PATCHISOLDER"), NULL );
+ MsiSetProperty( handle, TEXT("ALLUSERS"), NULL );
// 1. Searching for "ProductCode" in setup.ini
@@ -110,7 +75,7 @@ extern "C" UINT __stdcall GetUserInstallMode(MSIHANDLE handle)
if ( !_tcsicmp( szValue, TEXT("INVALIDDIRECTORY") ) )
{
// No setup.ini or no "ProductCode" in setup.ini. This is an invalid directory.
- SetMsiProperty( handle, TEXT("INVALIDDIRECTORY"), TEXT("YES") );
+ MsiSetProperty( handle, TEXT("INVALIDDIRECTORY"), TEXT("YES") );
// MessageBox(NULL, "INVALIDDIRECTORY set, no setup.ini or ProductCode in setup.ini.", "DEBUG", MB_OK);
SetMsiErrorCode( MSI_ERROR_INVALIDDIRECTORY );
return ERROR_SUCCESS;
@@ -131,20 +96,20 @@ extern "C" UINT __stdcall GetUserInstallMode(MSIHANDLE handle)
if ( !_tcsicmp( szValue, TEXT("ISWRONGPRODUCT") ) )
{
- SetMsiProperty( handle, TEXT("ISWRONGPRODUCT"), TEXT("YES") );
+ MsiSetProperty( handle, TEXT("ISWRONGPRODUCT"), TEXT("YES") );
// MessageBox(NULL, "ISWRONGPRODUCT 1 set after searching buildid", "DEBUG", MB_OK);
SetMsiErrorCode( MSI_ERROR_ISWRONGPRODUCT );
return ERROR_SUCCESS;
}
- string ProductMajor = GetMsiProperty(handle, TEXT("PRODUCTMAJOR"));
+ string ProductMajor = GetMsiPropValue(handle, TEXT("PRODUCTMAJOR"));
// Comparing the first three characters, for example "680"
// If not equal, this version is not suited for patch or language pack
if (_tcsnicmp(ProductMajor.c_str(), szValue, 3))
{
- SetMsiProperty( handle, TEXT("ISWRONGPRODUCT"), TEXT("YES") );
+ MsiSetProperty( handle, TEXT("ISWRONGPRODUCT"), TEXT("YES") );
// MessageBox(NULL, "ISWRONGPRODUCT 2 set after searching PRODUCTMAJOR", "DEBUG", MB_OK);
SetMsiErrorCode( MSI_ERROR_ISWRONGPRODUCT );
return ERROR_SUCCESS;
@@ -165,7 +130,7 @@ extern "C" UINT __stdcall GetUserInstallMode(MSIHANDLE handle)
if ( szValue[0] )
{
- SetMsiProperty( handle, TEXT("ALLUSERS"), szValue );
+ MsiSetProperty( handle, TEXT("ALLUSERS"), szValue );
// MessageBox(NULL, "ALLUSERS set", "DEBUG", MB_OK);
}
diff --git a/setup_native/source/win32/customactions/reg4allmsdoc/reg4allmsi.cxx b/setup_native/source/win32/customactions/reg4allmsdoc/reg4allmsi.cxx
index a0f930ad7d35..4197053411ad 100644
--- a/setup_native/source/win32/customactions/reg4allmsdoc/reg4allmsi.cxx
+++ b/setup_native/source/win32/customactions/reg4allmsdoc/reg4allmsi.cxx
@@ -22,7 +22,7 @@
#endif
#define WIN32_LEAN_AND_MEAN
#include <windows.h>
-#include <msiquery.h>
+#include <../tools/msiprop.hxx>
#ifdef _MSC_VER
#pragma warning(pop)
#endif
@@ -66,6 +66,9 @@ static const int EXCEL_START = 7;
static const int POWERPOINT_START = 15;
static const int VISIO_START = 23;
static const int VISIO_END = 25;
+const string PROP_OFF = "0";
+const string PROP_ON = "1";
+
// ".xlam", // Office Excel 2007 XML macro-enabled add-in
// ".ppam", // Office PowerPoint 2007 macro-enabled XML add-in
@@ -176,30 +179,6 @@ static LONG DeleteSubKeyTree( HKEY RootKey, LPCSTR lpKey )
return rc;
}
-bool GetMsiProp( MSIHANDLE handle, LPCSTR name, /*out*/std::string& value )
-{
- DWORD sz = 0;
- LPSTR dummy = "";
- if (MsiGetPropertyA(handle, name, dummy, &sz) == ERROR_MORE_DATA)
- {
- sz++;
- DWORD nbytes = sz * sizeof(TCHAR);
- LPSTR buff = reinterpret_cast<LPSTR>(_alloca(nbytes));
- ZeroMemory(buff, nbytes);
- MsiGetPropertyA(handle, name, buff, &sz);
- value = buff;
- return true;
- }
- return false;
-}
-
-bool IsSetMsiProp( MSIHANDLE handle, LPCSTR name )
-{
- std::string val;
- GetMsiProp( handle, name, val );
- return (val == "1");
-}
-
static void registerForExtension( MSIHANDLE handle, const int nIndex, bool bRegister )
{
CHAR sPropName[256];
@@ -313,56 +292,16 @@ extern "C" UINT __stdcall LookForRegisteredExtensions( MSIHANDLE handle )
bool bCalcEnabled = false;
bool bImpressEnabled = false;
bool bDrawEnabled = false;
- bool bRegisterNone = IsSetMsiProp( handle, "REGISTER_NO_MSO_TYPES" );
-
- if ( ( ERROR_SUCCESS == MsiGetFeatureState( handle, L"gm_p_Wrt", &current_state, &future_state ) ) &&
- ( (future_state == INSTALLSTATE_LOCAL) || ((current_state == INSTALLSTATE_LOCAL) && (future_state == INSTALLSTATE_UNKNOWN) ) ) )
- bWriterEnabled = true;
-
- OutputDebugStringFormat( "LookForRegisteredExtensions: Install state Writer is [%d], will be [%d]", current_state, future_state );
- if ( bWriterEnabled )
- OutputDebugStringFormat( "LookForRegisteredExtensions: Writer is enabled" );
- else
- OutputDebugStringFormat( "LookForRegisteredExtensions: Writer is NOT enabled" );
-
- if ( ( ERROR_SUCCESS == MsiGetFeatureState( handle, L"gm_p_Calc", &current_state, &future_state ) ) &&
- ( (future_state == INSTALLSTATE_LOCAL) || ((current_state == INSTALLSTATE_LOCAL) && (future_state == INSTALLSTATE_UNKNOWN) ) ) )
- bCalcEnabled = true;
-
- OutputDebugStringFormat( "LookForRegisteredExtensions: Install state Calc is [%d], will be [%d]", current_state, future_state );
- if ( bCalcEnabled )
- OutputDebugStringFormat( "LookForRegisteredExtensions: Calc is enabled" );
- else
- OutputDebugStringFormat( "LookForRegisteredExtensions: Calc is NOT enabled" );
-
- if ( ( ERROR_SUCCESS == MsiGetFeatureState( handle, L"gm_p_Impress", &current_state, &future_state ) ) &&
- ( (future_state == INSTALLSTATE_LOCAL) || ((current_state == INSTALLSTATE_LOCAL) && (future_state == INSTALLSTATE_UNKNOWN) ) ) )
- bImpressEnabled = true;
-
- OutputDebugStringFormat( "LookForRegisteredExtensions: Install state Impress is [%d], will be [%d]", current_state, future_state );
- if ( bImpressEnabled )
- OutputDebugStringFormat( "LookForRegisteredExtensions: Impress is enabled" );
- else
- OutputDebugStringFormat( "LookForRegisteredExtensions: Impress is NOT enabled" );
-
- if ( ( ERROR_SUCCESS == MsiGetFeatureState( handle, L"gm_p_Draw", &current_state, &future_state ) ) &&
- ( (future_state == INSTALLSTATE_LOCAL) || ((current_state == INSTALLSTATE_LOCAL) && (future_state == INSTALLSTATE_UNKNOWN) ) ) )
- bDrawEnabled = true;
-
- OutputDebugStringFormat( "LookForRegisteredExtensions: Install state Draw is [%d], will be [%d]", current_state, future_state );
- if ( bImpressEnabled )
- OutputDebugStringFormat( "LookForRegisteredExtensions: Draw is enabled" );
- else
- OutputDebugStringFormat( "LookForRegisteredExtensions: Draw is NOT enabled" );
MsiSetPropertyA( handle, "SELECT_WORD", "" );
MsiSetPropertyA( handle, "SELECT_EXCEL", "" );
MsiSetPropertyA( handle, "SELECT_POWERPOINT", "" );
MsiSetPropertyA( handle, "SELECT_VISIO", "" );
- if ( ! bRegisterNone )
+ if ( GetMsiPropValue( handle, TEXT("REGISTER_NO_MSO_TYPES") ).compare( PROP_OFF ) == 0 )
{
- if ( IsSetMsiProp( handle, "REGISTER_ALL_MSO_TYPES" ) )
+
+ if ( GetMsiPropValue( handle, TEXT("REGISTER_ALL_MSO_TYPES") ).compare( PROP_ON ) == 0 )
{
if ( bWriterEnabled )
MsiSetPropertyA( handle, "SELECT_WORD", "1" );
@@ -375,6 +314,47 @@ extern "C" UINT __stdcall LookForRegisteredExtensions( MSIHANDLE handle )
}
else
{
+ if ( ( ERROR_SUCCESS == MsiGetFeatureState( handle, L"gm_p_Wrt", &current_state, &future_state ) ) &&
+ ( (future_state == INSTALLSTATE_LOCAL) || ((current_state == INSTALLSTATE_LOCAL) && (future_state == INSTALLSTATE_UNKNOWN) ) ) )
+ bWriterEnabled = true;
+
+ OutputDebugStringFormat( "LookForRegisteredExtensions: Install state Writer is [%d], will be [%d]", current_state, future_state );
+ if ( bWriterEnabled )
+ OutputDebugStringFormat( "LookForRegisteredExtensions: Writer is enabled" );
+ else
+ OutputDebugStringFormat( "LookForRegisteredExtensions: Writer is NOT enabled" );
+
+ if ( ( ERROR_SUCCESS == MsiGetFeatureState( handle, L"gm_p_Calc", &current_state, &future_state ) ) &&
+ ( (future_state == INSTALLSTATE_LOCAL) || ((current_state == INSTALLSTATE_LOCAL) && (future_state == INSTALLSTATE_UNKNOWN) ) ) )
+ bCalcEnabled = true;
+
+ OutputDebugStringFormat( "LookForRegisteredExtensions: Install state Calc is [%d], will be [%d]", current_state, future_state );
+ if ( bCalcEnabled )
+ OutputDebugStringFormat( "LookForRegisteredExtensions: Calc is enabled" );
+ else
+ OutputDebugStringFormat( "LookForRegisteredExtensions: Calc is NOT enabled" );
+
+ if ( ( ERROR_SUCCESS == MsiGetFeatureState( handle, L"gm_p_Impress", &current_state, &future_state ) ) &&
+ ( (future_state == INSTALLSTATE_LOCAL) || ((current_state == INSTALLSTATE_LOCAL) && (future_state == INSTALLSTATE_UNKNOWN) ) ) )
+ bImpressEnabled = true;
+
+ OutputDebugStringFormat( "LookForRegisteredExtensions: Install state Impress is [%d], will be [%d]", current_state, future_state );
+ if ( bImpressEnabled )
+ OutputDebugStringFormat( "LookForRegisteredExtensions: Impress is enabled" );
+ else
+ OutputDebugStringFormat( "LookForRegisteredExtensions: Impress is NOT enabled" );
+
+ if ( ( ERROR_SUCCESS == MsiGetFeatureState( handle, L"gm_p_Draw", &current_state, &future_state ) ) &&
+ ( (future_state == INSTALLSTATE_LOCAL) || ((current_state == INSTALLSTATE_LOCAL) && (future_state == INSTALLSTATE_UNKNOWN) ) ) )
+ bDrawEnabled = true;
+
+ OutputDebugStringFormat( "LookForRegisteredExtensions: Install state Draw is [%d], will be [%d]", current_state, future_state );
+ if ( bImpressEnabled )
+ OutputDebugStringFormat( "LookForRegisteredExtensions: Draw is enabled" );
+ else
+ OutputDebugStringFormat( "LookForRegisteredExtensions: Draw is NOT enabled" );
+
+
if ( bWriterEnabled && ! checkSomeExtensionInRegistry( WORD_START, EXCEL_START ) )
{
MsiSetPropertyA( handle, "SELECT_WORD", "1" );
@@ -390,7 +370,7 @@ extern "C" UINT __stdcall LookForRegisteredExtensions( MSIHANDLE handle )
MsiSetPropertyA( handle, "SELECT_POWERPOINT", "1" );
OutputDebugStringFormat( "LookForRegisteredExtensions: Register for Microsoft PowerPoint" );
}
- if ( bImpressEnabled && ! checkSomeExtensionInRegistry( VISIO_START, VISIO_END ) )
+ if ( bDrawEnabled && ! checkSomeExtensionInRegistry( VISIO_START, VISIO_END ) )
{
MsiSetPropertyA( handle, "SELECT_VISIO", "1" );
OutputDebugStringFormat( "LookForRegisteredExtensions: Register for Microsoft Visio" );
@@ -407,7 +387,7 @@ extern "C" UINT __stdcall RegisterSomeExtensions( MSIHANDLE handle )
{
OutputDebugStringFormat( "RegisterSomeExtensions: " );
- if ( IsSetMsiProp( handle, "SELECT_WORD" ) )
+ if ( GetMsiPropValue( handle, TEXT("SELECT_WORD") ).compare( PROP_ON ) == 0 )
{
registerSomeExtensions( handle, WORD_START, EXCEL_START, true );
MsiSetFeatureState( handle, L"gm_p_Wrt_MSO_Reg", INSTALLSTATE_LOCAL );
@@ -419,7 +399,7 @@ extern "C" UINT __stdcall RegisterSomeExtensions( MSIHANDLE handle )
MsiSetFeatureState( handle, L"gm_p_Wrt_MSO_Reg", INSTALLSTATE_ABSENT );
}
- if ( IsSetMsiProp( handle, "SELECT_EXCEL" ) )
+ if ( GetMsiPropValue( handle, TEXT("SELECT_EXCEL") ).compare( PROP_ON ) == 0 )
{
registerSomeExtensions( handle, EXCEL_START, POWERPOINT_START, true );
MsiSetFeatureState( handle, L"gm_p_Calc_MSO_Reg", INSTALLSTATE_LOCAL );
@@ -431,7 +411,7 @@ extern "C" UINT __stdcall RegisterSomeExtensions( MSIHANDLE handle )
MsiSetFeatureState( handle, L"gm_p_Calc_MSO_Reg", INSTALLSTATE_ABSENT );
}
- if ( IsSetMsiProp( handle, "SELECT_POWERPOINT" ) )
+ if ( GetMsiPropValue( handle, TEXT("SELECT_POWERPOINT") ).compare( PROP_ON ) == 0 )
{
registerSomeExtensions( handle, POWERPOINT_START, VISIO_START, true );
MsiSetFeatureState( handle, L"gm_p_Impress_MSO_Reg", INSTALLSTATE_LOCAL );
@@ -443,7 +423,7 @@ extern "C" UINT __stdcall RegisterSomeExtensions( MSIHANDLE handle )
MsiSetFeatureState( handle, L"gm_p_Impress_MSO_Reg", INSTALLSTATE_ABSENT );
}
- if ( IsSetMsiProp( handle, "SELECT_VISIO" ) )
+ if ( GetMsiPropValue( handle, TEXT("SELECT_VISIO") ).compare( PROP_ON ) == 0 )
{
registerSomeExtensions( handle, VISIO_START, VISIO_END, true );
MsiSetFeatureState( handle, L"gm_p_Draw_MSO_Reg", INSTALLSTATE_LOCAL );
@@ -459,7 +439,7 @@ extern "C" UINT __stdcall RegisterSomeExtensions( MSIHANDLE handle )
extern "C" UINT __stdcall FindRegisteredExtensions( MSIHANDLE handle )
{
- if ( IsSetMsiProp( handle, "FILETYPEDIALOGUSED" ) )
+ if ( GetMsiPropValue( handle, TEXT("FILETYPEDIALOGUSED") ).compare( PROP_ON ) == 0 )
{
OutputDebugStringFormat( "FindRegisteredExtensions: FILETYPEDIALOGUSED!" );
return ERROR_SUCCESS;
@@ -467,9 +447,9 @@ extern "C" UINT __stdcall FindRegisteredExtensions( MSIHANDLE handle )
OutputDebugStringFormat( "FindRegisteredExtensions:" );
- bool bRegisterAll = IsSetMsiProp( handle, "REGISTER_ALL_MSO_TYPES" );
+ bool bRegisterAll = GetMsiPropValue( handle, TEXT("REGISTER_ALL_MSO_TYPES") ).compare( PROP_ON ) == 0;
- if ( IsSetMsiProp( handle, "REGISTER_NO_MSO_TYPES" ) )
+ if ( GetMsiPropValue( handle, TEXT("REGISTER_NO_MSO_TYPES") ).compare( PROP_ON ) == 0 )
{
OutputDebugStringFormat( "FindRegisteredExtensions: Register none!" );
return ERROR_SUCCESS;
@@ -481,13 +461,13 @@ extern "C" UINT __stdcall FindRegisteredExtensions( MSIHANDLE handle )
// setting the msi properties SELECT_* will force registering for all corresponding
// file types
- if ( IsSetMsiProp( handle, "SELECT_WORD" ) )
+ if ( GetMsiPropValue( handle, TEXT("SELECT_WORD") ).compare( PROP_ON ) == 0 )
registerSomeExtensions( handle, WORD_START, EXCEL_START, true );
- if ( IsSetMsiProp( handle, "SELECT_EXCEL" ) )
+ if ( GetMsiPropValue( handle, TEXT("SELECT_EXCEL") ).compare( PROP_ON ) == 0 )
registerSomeExtensions( handle, EXCEL_START, POWERPOINT_START, true );
- if ( IsSetMsiProp( handle, "SELECT_POWERPOINT" ) )
+ if ( GetMsiPropValue( handle, TEXT("SELECT_POWERPOINT") ).compare( PROP_ON ) == 0)
registerSomeExtensions( handle, POWERPOINT_START, VISIO_START, true );
- if ( IsSetMsiProp( handle, "SELECT_VISIO" ) )
+ if ( GetMsiPropValue( handle, TEXT("SELECT_VISIO") ).compare( PROP_ON ) == 0)
registerSomeExtensions( handle, VISIO_START, VISIO_END, true );
registerForExtensions( handle, bRegisterAll );
diff --git a/setup_native/source/win32/customactions/regactivex/regactivex.cxx b/setup_native/source/win32/customactions/regactivex/regactivex.cxx
index 7be03a2dabc4..4f16a9fc9c36 100644
--- a/setup_native/source/win32/customactions/regactivex/regactivex.cxx
+++ b/setup_native/source/win32/customactions/regactivex/regactivex.cxx
@@ -23,7 +23,7 @@
#pragma warning(push, 1) /* disable warnings within system headers */
#endif
#include <windows.h>
-#include <msiquery.h>
+#include <../tools/msiprop.hxx>
#ifdef _MSC_VER
#pragma warning(pop)
#endif
@@ -122,29 +122,10 @@ void UnregisterActiveXNative( const char* pActiveXPath, int nMode, BOOL InstallF
}
//----------------------------------------------------------
-BOOL GetMsiProp( MSIHANDLE hMSI, const wchar_t* pPropName, wchar_t** ppValue )
-{
- DWORD sz = 0;
- if ( MsiGetProperty( hMSI, pPropName, L"", &sz ) == ERROR_MORE_DATA )
- {
- sz++;
- DWORD nbytes = sz * sizeof( wchar_t );
- wchar_t* buff = reinterpret_cast<wchar_t*>( malloc( nbytes ) );
- ZeroMemory( buff, nbytes );
- MsiGetProperty( hMSI, pPropName, buff, &sz );
- *ppValue = buff;
-
- return TRUE;
- }
-
- return FALSE;
-}
-
-//----------------------------------------------------------
BOOL GetActiveXControlPath( MSIHANDLE hMSI, char** ppActiveXPath )
{
wchar_t* pProgPath = NULL;
- if ( GetMsiProp( hMSI, L"INSTALLLOCATION", &pProgPath ) && pProgPath )
+ if ( GetMsiProp( hMSI, L"INSTALLLOCATION", &pProgPath ) )
{
char* pCharProgPath = UnicodeToAnsiString( pProgPath );
@@ -271,7 +252,7 @@ BOOL MakeInstallForAllUsers( MSIHANDLE hMSI )
{
BOOL bResult = FALSE;
wchar_t* pVal = NULL;
- if ( GetMsiProp( hMSI, L"ALLUSERS", &pVal ) && pVal )
+ if ( GetMsiProp( hMSI, L"ALLUSERS", &pVal ) )
{
bResult = UnicodeEquals( pVal , L"1" );
free( pVal );
@@ -285,7 +266,7 @@ BOOL MakeInstallFor64Bit( MSIHANDLE hMSI )
{
BOOL bResult = FALSE;
wchar_t* pVal = NULL;
- if ( GetMsiProp( hMSI, L"VersionNT64", &pVal ) && pVal )
+ if ( GetMsiProp( hMSI, L"VersionNT64", &pVal ) )
{
bResult = TRUE;
free( pVal );
diff --git a/setup_native/source/win32/customactions/regpatchactivex/regpatchactivex.cxx b/setup_native/source/win32/customactions/regpatchactivex/regpatchactivex.cxx
index 0c51ccb8f97e..2362c61695aa 100644
--- a/setup_native/source/win32/customactions/regpatchactivex/regpatchactivex.cxx
+++ b/setup_native/source/win32/customactions/regpatchactivex/regpatchactivex.cxx
@@ -23,7 +23,7 @@
#pragma warning(push,1) // disable warnings within system headers
#endif
#include <windows.h>
-#include <msiquery.h>
+#include <../tools/msiprop.hxx>
#ifdef _MSC_VER
#pragma warning(pop)
#endif
@@ -33,46 +33,13 @@
#include <stdio.h>
//----------------------------------------------------------
-BOOL UnicodeEquals( wchar_t* pStr1, wchar_t* pStr2 )
-{
- if ( pStr1 == NULL && pStr2 == NULL )
- return TRUE;
- else if ( pStr1 == NULL || pStr2 == NULL )
- return FALSE;
-
- while( *pStr1 == *pStr2 && *pStr1 && *pStr2 )
- pStr1++, pStr2++;
-
- return ( *pStr1 == 0 && *pStr2 == 0 );
-}
-
-//----------------------------------------------------------
-BOOL GetMsiProp( MSIHANDLE hMSI, const wchar_t* pPropName, wchar_t** ppValue )
-{
- DWORD sz = 0;
- if ( MsiGetProperty( hMSI, pPropName, L"", &sz ) == ERROR_MORE_DATA )
- {
- sz++;
- DWORD nbytes = sz * sizeof( wchar_t );
- wchar_t* buff = reinterpret_cast<wchar_t*>( malloc( nbytes ) );
- ZeroMemory( buff, nbytes );
- MsiGetProperty( hMSI, pPropName, buff, &sz );
- *ppValue = buff;
-
- return TRUE;
- }
-
- return FALSE;
-}
-
-//----------------------------------------------------------
BOOL MakeInstallForAllUsers( MSIHANDLE hMSI )
{
BOOL bResult = FALSE;
- wchar_t* pVal = NULL;
- if ( GetMsiProp( hMSI, L"ALLUSERS", &pVal ) && pVal )
+ LPTSTR* pVal = NULL;
+ if ( GetMsiProp( hMSI, TEXT("ALLUSERS"), pVal ) )
{
- bResult = UnicodeEquals( pVal , L"1" );
+ bResult = ( int (pVal) == 1 );
free( pVal );
}
diff --git a/setup_native/source/win32/customactions/sellang/sellang.cxx b/setup_native/source/win32/customactions/sellang/sellang.cxx
index b6f7ec559ea0..893a04f386a4 100644
--- a/setup_native/source/win32/customactions/sellang/sellang.cxx
+++ b/setup_native/source/win32/customactions/sellang/sellang.cxx
@@ -28,7 +28,7 @@
#define WINVER 0x0500
#include <windows.h>
-#include <msiquery.h>
+#include <../tools/msiprop.hxx>
#include <malloc.h>
#include <stdio.h>
@@ -40,21 +40,6 @@
#include "spellchecker_selection.hxx"
-BOOL GetMsiProp( MSIHANDLE hMSI, const char* pPropName, char** ppValue )
-{
- DWORD sz = 0;
- if ( MsiGetProperty( hMSI, pPropName, "", &sz ) == ERROR_MORE_DATA ) {
- sz++;
- DWORD nbytes = sz * sizeof( char );
- char* buff = reinterpret_cast<char*>( malloc( nbytes ) );
- ZeroMemory( buff, nbytes );
- MsiGetProperty( hMSI, pPropName, buff, &sz );
- *ppValue = buff;
- return ( strlen(buff) > 0 );
- }
- return FALSE;
-}
-
static const char *
langid_to_string( LANGID langid )
{
@@ -314,8 +299,8 @@ extern "C" UINT __stdcall SelectLanguage( MSIHANDLE handle )
/* Keep track of what UI languages are relevant, either the ones explicitly
* requested with the UI_LANGS property, or all available on the system:
*/
- char* pVal = NULL;
- if ( (GetMsiProp( handle, "UI_LANGS", &pVal )) && pVal ) {
+ LPTSTR pVal = NULL;
+ if ( (GetMsiProp( handle, "UI_LANGS", &pVal )) ) {
char *str_ptr;
str_ptr = strtok(pVal, ",");
for(; str_ptr != NULL ;) {
diff --git a/setup_native/source/win32/customactions/shellextensions/checkdirectory.cxx b/setup_native/source/win32/customactions/shellextensions/checkdirectory.cxx
index 7b35b3cf518c..60ed8b5ed3c0 100644
--- a/setup_native/source/win32/customactions/shellextensions/checkdirectory.cxx
+++ b/setup_native/source/win32/customactions/shellextensions/checkdirectory.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
@@ -46,44 +46,17 @@
#include <systools/win32/uwinapi.h>
#include <../tools/seterror.hxx>
-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 void UnsetMsiProperty(MSIHANDLE handle, const std::_tstring& sProperty)
-{
- MsiSetProperty(handle, sProperty.c_str(), NULL);
-}
-
-static void SetMsiProperty(MSIHANDLE handle, const std::_tstring& sProperty, const std::_tstring&)
-{
- MsiSetProperty(handle, sProperty.c_str(), TEXT("1"));
-}
extern "C" UINT __stdcall CheckInstallDirectory(MSIHANDLE handle)
{
- std::_tstring sInstallPath = GetMsiProperty(handle, TEXT("INSTALLLOCATION"));
- std::_tstring sOfficeHostnamePath = GetMsiProperty(handle, TEXT("OFFICEDIRHOSTNAME"));
+ std::_tstring sInstallPath = GetMsiPropValue(handle, TEXT("INSTALLLOCATION"));
+ std::_tstring sOfficeHostnamePath = GetMsiPropValue(handle, TEXT("OFFICEDIRHOSTNAME"));
// MessageBox(NULL, sInstallPath.c_str(), "DEBUG", MB_OK);
// unsetting all properties
- UnsetMsiProperty( handle, TEXT("DIRECTORY_NOT_EMPTY") );
+ MsiSetProperty( handle, TEXT("DIRECTORY_NOT_EMPTY"), NULL );
// 1. Searching for file setup.ini
@@ -98,7 +71,7 @@ extern "C" UINT __stdcall CheckInstallDirectory(MSIHANDLE handle)
if ( IsValidHandle(hdl) )
{
// setup.ini found -> directory cannot be used for installation.
- SetMsiProperty( handle, TEXT("DIRECTORY_NOT_EMPTY"), TEXT("1") );
+ MsiSetProperty( handle, TEXT("DIRECTORY_NOT_EMPTY"), TEXT("1") );
SetMsiErrorCode( MSI_ERROR_DIRECTORY_NOT_EMPTY );
// std::_tstring notEmptyStr = "Directory is not empty. Please choose another installation directory.";
// std::_tstring notEmptyTitle = "Directory not empty";
diff --git a/setup_native/source/win32/customactions/shellextensions/checkpatches.cxx b/setup_native/source/win32/customactions/shellextensions/checkpatches.cxx
index 94a24cd7687c..99fb2403de65 100644
--- a/setup_native/source/win32/customactions/shellextensions/checkpatches.cxx
+++ b/setup_native/source/win32/customactions/shellextensions/checkpatches.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
@@ -63,44 +63,24 @@ 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 void SetMsiProperty( MSIHANDLE handle, const std::_tstring& sProperty )
-{
- MsiSetProperty( handle, sProperty.c_str(), TEXT("1") );
-}
-
extern "C" UINT __stdcall CheckPatchList( MSIHANDLE handle )
{
- std::_tstring sPatchList = GetMsiProperty( handle, TEXT("PATCH") );
- std::_tstring sRequiredPatch = GetMsiProperty( handle, TEXT("PREREQUIREDPATCH") );
+ LPTSTR sPatchList = NULL;
+ LPTSTR sRequiredPatch = NULL;
- OutputDebugStringFormat( "CheckPatchList called with PATCH=%s and PRQ= %s\n", sPatchList.c_str(), sRequiredPatch.c_str() );
-
- if ( ( sPatchList.length() != 0 ) && ( sRequiredPatch.length() != 0 ) )
+ if ( GetMsiProp( handle, TEXT("PATCH"), &sPatchList ) && GetMsiProp( handle, TEXT("PREREQUIREDPATCH"), &sRequiredPatch ) )
{
- if ( _tcsstr( sPatchList.c_str(), sRequiredPatch.c_str() ) )
+ OutputDebugStringFormat( "CheckPatchList called with PATCH=%s and PRQ= %s\n", sPatchList, sRequiredPatch );
+ if ( _tcsstr( sPatchList, sRequiredPatch ) )
{
- SetMsiProperty( handle, TEXT("IGNOREPREREQUIREDPATCH") );
+ MsiSetProperty( handle, TEXT("IGNOREPREREQUIREDPATCH"), TEXT("1") );
OutputDebugStringFormat( "Set Property IgnorePrerequiredPatch!\n" );
}
}
+ else
+ {
+ OutputDebugStringFormat( "CheckPatchList called with PATCH=%s and PRQ= %s\n", sPatchList, sRequiredPatch );
+ }
return ERROR_SUCCESS;
}
diff --git a/setup_native/source/win32/customactions/shellextensions/completeinstallpath.cxx b/setup_native/source/win32/customactions/shellextensions/completeinstallpath.cxx
index d56ad5e7db15..5f684c1265f3 100644
--- a/setup_native/source/win32/customactions/shellextensions/completeinstallpath.cxx
+++ b/setup_native/source/win32/customactions/shellextensions/completeinstallpath.cxx
@@ -23,7 +23,7 @@
#endif
#define WIN32_LEAN_AND_MEAN
#include <windows.h>
-#include <msiquery.h>
+#include <../tools/msiprop.hxx>
#ifdef _MSC_VER
#pragma warning(pop)
#endif
@@ -41,27 +41,6 @@
using namespace std;
-namespace
-{
- 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;
- }
-} // namespace
-
extern "C" UINT __stdcall CompleteInstallPath( MSIHANDLE handle )
{
// This CustomAction is necessary for updates from OOo 3.0, OOo 3.1 and OOo 3.2 to versions
@@ -76,8 +55,8 @@ extern "C" UINT __stdcall CompleteInstallPath( MSIHANDLE handle )
// Reading property OFFICEDIRHOSTNAME_, that contains the part of the path behind
// the program files folder.
- std::_tstring sInstallLocation = GetMsiProperty( handle, TEXT("INSTALLLOCATION") );
- std::_tstring sOfficeDirHostname = GetMsiProperty( handle, TEXT("OFFICEDIRHOSTNAME_") );
+ std::_tstring sInstallLocation = GetMsiPropValue( handle, TEXT("INSTALLLOCATION") );
+ std::_tstring sOfficeDirHostname = GetMsiPropValue( handle, TEXT("OFFICEDIRHOSTNAME_") );
// If sInstallLocation ends with (contains) the string sOfficeDirHostname,
// INSTALLLOCATION is good and nothing has to be done here.
@@ -94,9 +73,9 @@ extern "C" UINT __stdcall CompleteInstallPath( MSIHANDLE handle )
if ( pathCompletionRequired )
{
- std::_tstring sManufacturer = GetMsiProperty( handle, TEXT("Manufacturer") );
- std::_tstring sDefinedName = GetMsiProperty( handle, TEXT("DEFINEDPRODUCT") );
- std::_tstring sUpgradeCode = GetMsiProperty( handle, TEXT("UpgradeCode") );
+ std::_tstring sManufacturer = GetMsiPropValue( handle, TEXT("Manufacturer") );
+ std::_tstring sDefinedName = GetMsiPropValue( handle, TEXT("DEFINEDPRODUCT") );
+ std::_tstring sUpgradeCode = GetMsiPropValue( handle, TEXT("UpgradeCode") );
// sUpdateVersion can be "3.0", "3.1" or "3.2"
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
diff --git a/setup_native/source/win32/customactions/shellextensions/dotnetcheck.cxx b/setup_native/source/win32/customactions/shellextensions/dotnetcheck.cxx
index 864b886f3be6..42f7f093e3b5 100644
--- a/setup_native/source/win32/customactions/shellextensions/dotnetcheck.cxx
+++ b/setup_native/source/win32/customactions/shellextensions/dotnetcheck.cxx
@@ -27,7 +27,7 @@
#endif
#define WIN32_LEAN_AND_MEAN
#include <windows.h>
-#include <msiquery.h>
+#include <../tools/msiprop.hxx>
#ifdef _MSC_VER
#pragma warning(pop)
#endif
@@ -45,28 +45,6 @@ using namespace std;
namespace
{
- string GetMsiProperty(MSIHANDLE handle, const string& sProperty)
- {
- string 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;
- }
-
- inline void SetMsiProperty(MSIHANDLE handle, const string& sProperty, const string& sValue)
- {
- MsiSetProperty(handle, sProperty.c_str(), sValue.c_str());
- }
-
void stripFinalBackslash(std::string * path) {
std::string::size_type i = path->size();
if (i > 1) {
@@ -126,20 +104,20 @@ Order compareVersions(string const & version1, string const & version2) {
} // namespace
extern "C" UINT __stdcall DotNetCheck(MSIHANDLE handle) {
- string present(GetMsiProperty(handle, TEXT("MsiNetAssemblySupport")));
- string required(GetMsiProperty(handle, TEXT("REQUIRED_DOTNET_VERSION")));
+ string present(GetMsiPropValue(handle, TEXT("MsiNetAssemblySupport")));
+ string required(GetMsiPropValue(handle, TEXT("REQUIRED_DOTNET_VERSION")));
// string myText1 = TEXT("MsiNetAssemblySupport: ") + present;
// string myText2 = TEXT("REQUIRED_DOTNET_VERSION: ") + required;
// MessageBox(NULL, myText1.c_str(), "DEBUG", MB_OK);
// MessageBox(NULL, myText2.c_str(), "DEBUG", MB_OK);
- SetMsiProperty(
+ MsiSetProperty(
handle, TEXT("DOTNET_SUFFICIENT"),
(present.empty() || compareVersions(present, required) == ORDER_LESS ?
TEXT("0") : TEXT("1")));
- // string result(GetMsiProperty(handle, TEXT("DOTNET_SUFFICIENT")));
+ // string result(GetMsiPropValue(handle, TEXT("DOTNET_SUFFICIENT")));
// string myText3 = TEXT("DOTNET_SUFFICIENT: ") + result;
// MessageBox(NULL, myText3.c_str(), "DEBUG", MB_OK);
@@ -149,23 +127,23 @@ extern "C" UINT __stdcall DotNetCheck(MSIHANDLE handle) {
extern "C" UINT __stdcall ShowProperties(MSIHANDLE handle)
{
- string property = GetMsiProperty(handle, TEXT("INSTALLLOCATION"));
+ string property = GetMsiPropValue(handle, TEXT("INSTALLLOCATION"));
string myText = TEXT("INSTALLLOCATION: ") + property;
MessageBox(NULL, myText.c_str(), "INSTALLLOCATION", MB_OK);
- property = GetMsiProperty(handle, TEXT("Installed"));
+ property = GetMsiPropValue(handle, TEXT("Installed"));
myText = TEXT("Installed: ") + property;
MessageBox(NULL, myText.c_str(), "Installed", MB_OK);
- property = GetMsiProperty(handle, TEXT("PATCH"));
+ property = GetMsiPropValue(handle, TEXT("PATCH"));
myText = TEXT("PATCH: ") + property;
MessageBox(NULL, myText.c_str(), "PATCH", MB_OK);
- property = GetMsiProperty(handle, TEXT("REMOVE"));
+ property = GetMsiPropValue(handle, TEXT("REMOVE"));
myText = TEXT("REMOVE: ") + property;
MessageBox(NULL, myText.c_str(), "REMOVE", MB_OK);
- property = GetMsiProperty(handle, TEXT("ALLUSERS"));
+ property = GetMsiPropValue(handle, TEXT("ALLUSERS"));
myText = TEXT("ALLUSERS: ") + property;
MessageBox(NULL, myText.c_str(), "ALLUSERS", MB_OK);
diff --git a/setup_native/source/win32/customactions/shellextensions/layerlinks.cxx b/setup_native/source/win32/customactions/shellextensions/layerlinks.cxx
index 88e020f5b27e..67919ecce8d5 100644
--- a/setup_native/source/win32/customactions/shellextensions/layerlinks.cxx
+++ b/setup_native/source/win32/customactions/shellextensions/layerlinks.cxx
@@ -27,7 +27,7 @@
#endif
#define WIN32_LEAN_AND_MEAN
#include <windows.h>
-#include <msiquery.h>
+#include <../tools/msiprop.hxx>
#ifdef _MSC_VER
#pragma warning(pop)
#endif
@@ -45,38 +45,6 @@ using namespace std;
namespace
{
- string GetMsiProperty(MSIHANDLE handle, const string& sProperty)
- {
- string 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;
- }
-
- inline bool IsSetMsiProperty(MSIHANDLE handle, const string& sProperty)
- {
- return (GetMsiProperty(handle, sProperty).length() > 0);
- }
-
- inline void UnsetMsiProperty(MSIHANDLE handle, const string& sProperty)
- {
- MsiSetProperty(handle, sProperty.c_str(), NULL);
- }
-
- inline void SetMsiProperty(MSIHANDLE handle, const string& sProperty, const string&)
- {
- MsiSetProperty(handle, sProperty.c_str(), TEXT("1"));
- }
-
void stripFinalBackslash(std::string * path) {
std::string::size_type i = path->size();
if (i > 1) {
@@ -90,13 +58,13 @@ namespace
extern "C" UINT __stdcall CreateLayerLinks(MSIHANDLE handle)
{
- string sInstallPath = GetMsiProperty(handle, TEXT("INSTALLLOCATION"));
+ string sInstallPath = GetMsiPropValue(handle, TEXT("INSTALLLOCATION"));
string sUreInstallPath = sInstallPath + TEXT("URE");
string sUreLinkPath = sInstallPath + TEXT("ure-link");
- if ( IsSetMsiProperty(handle, TEXT("ADMININSTALL")) )
+ if ( GetMsiPropValue(handle, TEXT("ADMININSTALL")).length() > 0 )
{
sUreInstallPath = TEXT("..\\URE");
}
@@ -149,7 +117,7 @@ extern "C" UINT __stdcall CreateLayerLinks(MSIHANDLE handle)
extern "C" UINT __stdcall RemoveLayerLinks(MSIHANDLE handle)
{
- string sInstallPath = GetMsiProperty(handle, TEXT("INSTALLLOCATION"));
+ string sInstallPath = GetMsiPropValue(handle, TEXT("INSTALLLOCATION"));
string sUreLinkPath = sInstallPath + TEXT("ure-link");
string sUreDirName = sInstallPath + TEXT("URE\\bin");
diff --git a/setup_native/source/win32/customactions/shellextensions/migrateinstallpath.cxx b/setup_native/source/win32/customactions/shellextensions/migrateinstallpath.cxx
index 1b159fd22e79..476d2351e527 100644
--- a/setup_native/source/win32/customactions/shellextensions/migrateinstallpath.cxx
+++ b/setup_native/source/win32/customactions/shellextensions/migrateinstallpath.cxx
@@ -23,7 +23,7 @@
#endif
#define WIN32_LEAN_AND_MEAN
#include <windows.h>
-#include <msiquery.h>
+#include <../tools/msiprop.hxx>
#ifdef _MSC_VER
#pragma warning(pop)
#endif
@@ -41,27 +41,6 @@
using namespace std;
-namespace
-{
- 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;
- }
-} // namespace
-
extern "C" UINT __stdcall MigrateInstallPath( MSIHANDLE handle )
{
TCHAR szValue[8192];
@@ -69,10 +48,10 @@ extern "C" UINT __stdcall MigrateInstallPath( MSIHANDLE handle )
HKEY hKey;
std::_tstring sInstDir;
- std::_tstring sManufacturer = GetMsiProperty( handle, TEXT("Manufacturer") );
- std::_tstring sDefinedName = GetMsiProperty( handle, TEXT("DEFINEDPRODUCT") );
- std::_tstring sUpdateVersion = GetMsiProperty( handle, TEXT("DEFINEDVERSION") );
- std::_tstring sUpgradeCode = GetMsiProperty( handle, TEXT("UpgradeCode") );
+ std::_tstring sManufacturer = GetMsiPropValue( handle, TEXT("Manufacturer") );
+ std::_tstring sDefinedName = GetMsiPropValue( handle, TEXT("DEFINEDPRODUCT") );
+ std::_tstring sUpdateVersion = GetMsiPropValue( handle, TEXT("DEFINEDVERSION") );
+ std::_tstring sUpgradeCode = GetMsiPropValue( handle, TEXT("UpgradeCode") );
std::_tstring sProductKey = "Software\\" + sManufacturer + "\\" + sDefinedName +
"\\" + sUpdateVersion + "\\" + sUpgradeCode;
diff --git a/setup_native/source/win32/customactions/shellextensions/postuninstall.cxx b/setup_native/source/win32/customactions/shellextensions/postuninstall.cxx
index 2ae17694cf42..b8f6e6655f79 100644
--- a/setup_native/source/win32/customactions/shellextensions/postuninstall.cxx
+++ b/setup_native/source/win32/customactions/shellextensions/postuninstall.cxx
@@ -23,7 +23,7 @@
#endif
#define WIN32_LEAN_AND_MEAN
#include <windows.h>
-#include <msiquery.h>
+#include <../tools/msiprop.hxx>
#ifdef _MSC_VER
#pragma warning(pop)
#endif
@@ -41,25 +41,6 @@
#include <io.h>
-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 ExecuteCommand( LPCTSTR lpCommand, BOOL bSync )
{
BOOL fSuccess = FALSE;
@@ -101,7 +82,7 @@ extern "C" UINT __stdcall ExecutePostUninstallScript( MSIHANDLE handle )
HKEY hKey;
std::_tstring sInstDir;
- std::_tstring sProductKey = GetMsiProperty( handle, TEXT("FINDPRODUCT") );
+ std::_tstring sProductKey = GetMsiPropValue( handle, TEXT("FINDPRODUCT") );
// MessageBox( NULL, sProductKey.c_str(), "Titel", MB_OK );
diff --git a/setup_native/source/win32/customactions/shellextensions/setadmininstall.cxx b/setup_native/source/win32/customactions/shellextensions/setadmininstall.cxx
index bc010c630942..d1b7b9b26f45 100644
--- a/setup_native/source/win32/customactions/shellextensions/setadmininstall.cxx
+++ b/setup_native/source/win32/customactions/shellextensions/setadmininstall.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
@@ -53,7 +53,7 @@ static void SetMsiProperty(MSIHANDLE handle, const std::_tstring& sProperty)
extern "C" UINT __stdcall SetAdminInstallProperty(MSIHANDLE handle)
{
- SetMsiProperty(handle, TEXT("ADMININSTALL"));
+ MsiSetProperty(handle, TEXT("ADMININSTALL"), TEXT("1"));
return ERROR_SUCCESS;
}
diff --git a/setup_native/source/win32/customactions/shellextensions/startmenuicon.cxx b/setup_native/source/win32/customactions/shellextensions/startmenuicon.cxx
index de3f3f6b461e..92ad25c45324 100644
--- a/setup_native/source/win32/customactions/shellextensions/startmenuicon.cxx
+++ b/setup_native/source/win32/customactions/shellextensions/startmenuicon.cxx
@@ -24,50 +24,25 @@
#endif
#define WIN32_LEAN_AND_MEAN
#include <windows.h>
-#include <msiquery.h>
+#include <../tools/msiprop.hxx>
#ifdef _MSC_VER
#pragma warning(pop)
#endif
#include <malloc.h>
-
-#ifdef UNICODE
-#define _UNICODE
-#define _tstring wstring
-#else
-#define _tstring string
-#endif
#include <tchar.h>
#include <string>
-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;
-}
-
/*
Called during installation to customize the start menu folder icon.
See: http://msdn.microsoft.com/library/en-us/shellcc/platform/shell/programmersguide/shell_basics/shell_basics_extending/custom.asp
*/
extern "C" UINT __stdcall InstallStartmenuFolderIcon( MSIHANDLE handle )
{
- std::_tstring sOfficeMenuFolder = GetMsiProperty( handle, TEXT("OfficeMenuFolder") );
- std::_tstring sDesktopFile = sOfficeMenuFolder + TEXT("Desktop.ini");
- std::_tstring sIconFile = GetMsiProperty( handle, TEXT("INSTALLLOCATION") ) + TEXT("program\\soffice.exe");
+ std::string sOfficeMenuFolder = GetMsiPropValue( handle, TEXT("OfficeMenuFolder") );
+ std::string sDesktopFile = sOfficeMenuFolder + TEXT("Desktop.ini");
+ std::string sIconFile = GetMsiPropValue( handle, TEXT("INSTALLLOCATION") ) + TEXT("program\\soffice.exe");
OSVERSIONINFO osverinfo;
osverinfo.dwOSVersionInfoSize = sizeof(OSVERSIONINFO);
@@ -109,8 +84,8 @@ extern "C" UINT __stdcall InstallStartmenuFolderIcon( MSIHANDLE handle )
extern "C" UINT __stdcall DeinstallStartmenuFolderIcon(MSIHANDLE handle)
{
- std::_tstring sOfficeMenuFolder = GetMsiProperty( handle, TEXT("OfficeMenuFolder") );
- std::_tstring sDesktopFile = sOfficeMenuFolder + TEXT("Desktop.ini");
+ std::string sOfficeMenuFolder = GetMsiPropValue( handle, TEXT("OfficeMenuFolder") );
+ std::string sDesktopFile = sOfficeMenuFolder + TEXT("Desktop.ini");
SetFileAttributes( sDesktopFile.c_str(), FILE_ATTRIBUTE_NORMAL );
DeleteFile( sDesktopFile.c_str() );
diff --git a/setup_native/source/win32/customactions/shellextensions/upgrade.cxx b/setup_native/source/win32/customactions/shellextensions/upgrade.cxx
index 9a5496352395..92e33c79b603 100644
--- a/setup_native/source/win32/customactions/shellextensions/upgrade.cxx
+++ b/setup_native/source/win32/customactions/shellextensions/upgrade.cxx
@@ -27,7 +27,7 @@
#endif
#define WIN32_LEAN_AND_MEAN
#include <windows.h>
-#include <msiquery.h>
+#include <../tools/msiprop.hxx>
#ifdef _MSC_VER
#pragma warning(pop)
#endif
@@ -111,38 +111,6 @@ namespace
return convertedGuid;
}
- string GetMsiProperty(MSIHANDLE handle, const string& sProperty)
- {
- string 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;
- }
-
- inline bool IsSetMsiProperty(MSIHANDLE handle, const string& sProperty)
- {
- return (GetMsiProperty(handle, sProperty).length() > 0);
- }
-
- inline void UnsetMsiProperty(MSIHANDLE handle, const string& sProperty)
- {
- MsiSetProperty(handle, sProperty.c_str(), NULL);
- }
-
- inline void SetMsiProperty(MSIHANDLE handle, const string& sProperty)
- {
- MsiSetProperty(handle, sProperty.c_str(), TEXT("1"));
- }
-
bool RegistryKeyHasUpgradeSubKey(
HKEY hRootKey, const string& regKey, const string& upgradeKey)
{
@@ -171,7 +139,7 @@ namespace
extern "C" UINT __stdcall SetProductInstallMode(MSIHANDLE handle)
{
- string upgradeCode = GetMsiProperty(handle, TEXT("UpgradeCode"));
+ string upgradeCode = GetMsiPropValue(handle, TEXT("UpgradeCode"));
upgradeCode = ConvertGuid(string(upgradeCode.c_str() + 1, upgradeCode.length() - 2));
//MessageBox(NULL, upgradeCode.c_str(), TEXT("Debug"), MB_OK);
@@ -179,17 +147,17 @@ extern "C" UINT __stdcall SetProductInstallMode(MSIHANDLE handle)
if (RegistryKeyHasUpgradeSubKey(
HKEY_CURRENT_USER,
TEXT("Software\\Microsoft\\Installer\\UpgradeCodes"),
- upgradeCode) && IsSetMsiProperty(handle, TEXT("ALLUSERS")))
+ upgradeCode))
{
- UnsetMsiProperty(handle, TEXT("ALLUSERS"));
+ MsiSetProperty(handle, TEXT("ALLUSERS"), NULL);
//MessageBox(NULL, "ALLUSERS removed", "DEBUG", MB_OK);
}
else if (RegistryKeyHasUpgradeSubKey(
HKEY_LOCAL_MACHINE,
TEXT("Software\\Classes\\Installer\\UpgradeCodes"),
- upgradeCode) && !IsSetMsiProperty(handle, TEXT("ALLUSERS")))
+ upgradeCode))
{
- SetMsiProperty(handle, TEXT("ALLUSERS"));
+ MsiSetProperty(handle, TEXT("ALLUSERS"), TEXT("1"));
//MessageBox(NULL, "ALLUSERS set", "DEBUG", MB_OK);
}
return ERROR_SUCCESS;
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 );
diff --git a/setup_native/source/win32/customactions/thesaurus/thesaurus.cxx b/setup_native/source/win32/customactions/thesaurus/thesaurus.cxx
index 349ed75d8faf..a27801c58382 100644
--- a/setup_native/source/win32/customactions/thesaurus/thesaurus.cxx
+++ b/setup_native/source/win32/customactions/thesaurus/thesaurus.cxx
@@ -23,7 +23,7 @@
#define WINVER 0x0500
#include <windows.h>
-#include <msiquery.h>
+#include <../tools/msiprop.hxx>
#include <malloc.h>
#include <stdio.h>
@@ -43,38 +43,6 @@ using namespace std;
namespace
{
- string GetMsiProperty(MSIHANDLE handle, const string& sProperty)
- {
- string 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;
- }
-
- inline bool IsSetMsiProperty(MSIHANDLE handle, const string& sProperty)
- {
- return (GetMsiProperty(handle, sProperty).length() > 0);
- }
-
- inline void UnsetMsiProperty(MSIHANDLE handle, const string& sProperty)
- {
- MsiSetProperty(handle, sProperty.c_str(), NULL);
- }
-
- inline void SetMsiProperty(MSIHANDLE handle, const string& sProperty, const string&)
- {
- MsiSetProperty(handle, sProperty.c_str(), TEXT("1"));
- }
-
static const int MAXLINE = 1024*64;
@@ -193,7 +161,7 @@ namespace
extern "C" UINT __stdcall CreateIndexes( MSIHANDLE handle )
{
- string sOfficeInstallPath = GetMsiProperty(handle, TEXT("INSTALLLOCATION"));
+ string sOfficeInstallPath = GetMsiPropValue(handle, TEXT("INSTALLLOCATION"));
createIndexesForThesaurusFiles(sOfficeInstallPath);
return ERROR_SUCCESS;
}
diff --git a/setup_native/source/win32/customactions/tools/checkversion.cxx b/setup_native/source/win32/customactions/tools/checkversion.cxx
index dc42bfa63288..0484488b6ccd 100644
--- a/setup_native/source/win32/customactions/tools/checkversion.cxx
+++ b/setup_native/source/win32/customactions/tools/checkversion.cxx
@@ -23,7 +23,7 @@
#pragma warning(push,1) // disable warnings within system headers
#endif
#include <windows.h>
-#include <msiquery.h>
+#include <../tools/msiprop.hxx>
#ifdef _MSC_VER
#pragma warning(pop)
#endif
@@ -36,25 +36,6 @@
#include <seterror.hxx>
//----------------------------------------------------------
-BOOL GetMsiProp( MSIHANDLE hMSI, const wchar_t* pPropName, wchar_t** ppValue )
-{
- DWORD sz = 0;
- if ( MsiGetProperty( hMSI, pPropName, L"", &sz ) == ERROR_MORE_DATA )
- {
- sz++;
- DWORD nbytes = sz * sizeof( wchar_t );
- wchar_t* buff = reinterpret_cast<wchar_t*>( malloc( nbytes ) );
- ZeroMemory( buff, nbytes );
- MsiGetProperty( hMSI, pPropName, buff, &sz );
- *ppValue = buff;
-
- return TRUE;
- }
-
- return FALSE;
-}
-
-//----------------------------------------------------------
#ifdef DEBUG
inline void OutputDebugStringFormat( LPCTSTR pFormat, ... )
{
@@ -78,7 +59,7 @@ extern "C" UINT __stdcall CheckVersions( MSIHANDLE hMSI )
wchar_t* pVal = NULL;
- if ( GetMsiProp( hMSI, L"NEWPRODUCTS", &pVal ) && pVal )
+ if ( GetMsiProp( hMSI, L"NEWPRODUCTS", &pVal ) )
{
OutputDebugStringFormat( TEXT("DEBUG: NEWPRODUCTS found [%s]"), pVal );
if ( *pVal != 0 )
@@ -86,7 +67,7 @@ extern "C" UINT __stdcall CheckVersions( MSIHANDLE hMSI )
free( pVal );
}
pVal = NULL;
- if ( GetMsiProp( hMSI, L"SAMEPRODUCTS", &pVal ) && pVal )
+ if ( GetMsiProp( hMSI, L"SAMEPRODUCTS", &pVal ) )
{
OutputDebugStringFormat( TEXT("DEBUG: SAMEPRODUCTS found [%s]"), pVal );
if ( *pVal != 0 )
@@ -94,7 +75,7 @@ extern "C" UINT __stdcall CheckVersions( MSIHANDLE hMSI )
free( pVal );
}
pVal = NULL;
- if ( GetMsiProp( hMSI, L"OLDPRODUCTS", &pVal ) && pVal )
+ if ( GetMsiProp( hMSI, L"OLDPRODUCTS", &pVal ) )
{
OutputDebugStringFormat( TEXT("DEBUG: OLDPRODUCTS found [%s]"), pVal );
if ( *pVal != 0 )
@@ -102,7 +83,7 @@ extern "C" UINT __stdcall CheckVersions( MSIHANDLE hMSI )
free( pVal );
}
pVal = NULL;
- if ( GetMsiProp( hMSI, L"BETAPRODUCTS", &pVal ) && pVal )
+ if ( GetMsiProp( hMSI, L"BETAPRODUCTS", &pVal ) )
{
OutputDebugStringFormat( TEXT("DEBUG: BETAPRODUCTS found [%s]"), pVal );
if ( *pVal != 0 )
@@ -111,7 +92,7 @@ extern "C" UINT __stdcall CheckVersions( MSIHANDLE hMSI )
}
pVal = NULL;
- if ( GetMsiProp( hMSI, L"NEWPRODUCTSPATCH", &pVal ) && pVal )
+ if ( GetMsiProp( hMSI, L"NEWPRODUCTSPATCH", &pVal ) )
{
OutputDebugStringFormat( TEXT("DEBUG: NEWPRODUCTSPATCH found [%s]"), pVal );
if ( *pVal != 0 )
@@ -119,7 +100,7 @@ extern "C" UINT __stdcall CheckVersions( MSIHANDLE hMSI )
free( pVal );
}
pVal = NULL;
- if ( GetMsiProp( hMSI, L"SAMEPRODUCTSPATCH", &pVal ) && pVal )
+ if ( GetMsiProp( hMSI, L"SAMEPRODUCTSPATCH", &pVal ) )
{
OutputDebugStringFormat( TEXT("DEBUG: SAMEPRODUCTSPATCH found [%s]"), pVal );
if ( *pVal != 0 )
@@ -127,7 +108,7 @@ extern "C" UINT __stdcall CheckVersions( MSIHANDLE hMSI )
free( pVal );
}
pVal = NULL;
- if ( GetMsiProp( hMSI, L"OLDPRODUCTSPATCH", &pVal ) && pVal )
+ if ( GetMsiProp( hMSI, L"OLDPRODUCTSPATCH", &pVal ) )
{
OutputDebugStringFormat( TEXT("DEBUG: OLDPRODUCTSPATCH found [%s]"), pVal );
if ( *pVal != 0 )
diff --git a/setup_native/source/win32/customactions/tools/msiprop.hxx b/setup_native/source/win32/customactions/tools/msiprop.hxx
new file mode 100755
index 000000000000..5d75130d5d9b
--- /dev/null
+++ b/setup_native/source/win32/customactions/tools/msiprop.hxx
@@ -0,0 +1,62 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#pragma once
+#include <windows.h>
+#include <string>
+//#include <malloc.h>
+#include <msiquery.h>
+#ifdef UNICODE
+#define _UNICODE
+#define _tstring wstring
+#else
+#define _tstring string
+#endif
+
+using namespace std;
+
+namespace {
+inline bool GetMsiProp(MSIHANDLE hMSI, LPCTSTR pPropName, LPTSTR* ppValue)
+{
+ DWORD sz = 0;
+ ppValue = NULL;
+ if (MsiGetProperty(hMSI, pPropName, TEXT(""), &sz) == ERROR_MORE_DATA)
+ {
+ DWORD nBytes = ++sz * sizeof(TCHAR); // add 1 for null termination
+ LPTSTR buffer = reinterpret_cast<LPTSTR>(_alloca( nBytes ));
+ ZeroMemory(buffer, nBytes);
+ MsiGetProperty(hMSI, pPropName, buffer, &sz);
+ *ppValue = buffer;
+ }
+
+ return ppValue?true:false ;
+
+}
+
+//std::_tstring GMPV( , const std::_tstring& sProperty)
+inline string GetMsiPropValue(MSIHANDLE hMSI, LPCTSTR pPropName)
+{
+ LPTSTR ppValue = NULL;
+ (void)GetMsiProp(hMSI, pPropName, &ppValue);
+ string toto = reinterpret_cast<const char *> (ppValue);
+ return toto;
+}
+
+}
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ \ No newline at end of file