summaryrefslogtreecommitdiff
path: root/setup_native
diff options
context:
space:
mode:
authorAndras Timar <atimar@suse.com>2013-01-27 20:29:45 +0100
committerAndras Timar <atimar@suse.com>2013-01-27 20:34:31 +0100
commit55fc2b96bb808381fff62b3d34f0e25c13de84a4 (patch)
treefe9eee790e09705ea3dd1ccf541eee1f16dd4118 /setup_native
parent2d70b928a982a787aa975acd0770e3bf9ffb94b1 (diff)
Revert "fix for fdo#39632 : Consolidate GetMsiProperty()"
Diffstat (limited to 'setup_native')
-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, 584 insertions, 218 deletions
diff --git a/setup_native/source/win32/customactions/languagepacks/respintest.cxx b/setup_native/source/win32/customactions/languagepacks/respintest.cxx
index 864f9bf64d42..f757a880f912 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 <../tools/msiprop.hxx>
+#include <msiquery.h>
#ifdef _MSC_VER
#pragma warning(pop)
#endif
@@ -44,18 +44,53 @@
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 = GetMsiPropValue(handle, TEXT("INSTALLLOCATION"));
+ string sOfficeInstallPath = GetMsiProperty(handle, TEXT("INSTALLLOCATION"));
// MessageBox(NULL, sOfficeInstallPath.c_str(), "DEBUG", MB_OK);
// unsetting all properties
- MsiSetProperty( handle, TEXT("INVALIDDIRECTORY"), NULL );
- MsiSetProperty( handle, TEXT("ISWRONGPRODUCT"), NULL );
- MsiSetProperty( handle, TEXT("PATCHISOLDER"), NULL );
- MsiSetProperty( handle, TEXT("ALLUSERS"), NULL );
+ UnsetMsiProperty( handle, TEXT("INVALIDDIRECTORY") );
+ UnsetMsiProperty( handle, TEXT("ISWRONGPRODUCT") );
+ UnsetMsiProperty( handle, TEXT("PATCHISOLDER") );
+ UnsetMsiProperty( handle, TEXT("ALLUSERS") );
// 1. Searching for "ProductCode" in setup.ini
@@ -75,7 +110,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.
- MsiSetProperty( handle, TEXT("INVALIDDIRECTORY"), TEXT("YES") );
+ SetMsiProperty( 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;
@@ -96,20 +131,20 @@ extern "C" UINT __stdcall GetUserInstallMode(MSIHANDLE handle)
if ( !_tcsicmp( szValue, TEXT("ISWRONGPRODUCT") ) )
{
- MsiSetProperty( handle, TEXT("ISWRONGPRODUCT"), TEXT("YES") );
+ SetMsiProperty( 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 = GetMsiPropValue(handle, TEXT("PRODUCTMAJOR"));
+ string ProductMajor = GetMsiProperty(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))
{
- MsiSetProperty( handle, TEXT("ISWRONGPRODUCT"), TEXT("YES") );
+ SetMsiProperty( handle, TEXT("ISWRONGPRODUCT"), TEXT("YES") );
// MessageBox(NULL, "ISWRONGPRODUCT 2 set after searching PRODUCTMAJOR", "DEBUG", MB_OK);
SetMsiErrorCode( MSI_ERROR_ISWRONGPRODUCT );
return ERROR_SUCCESS;
@@ -130,7 +165,7 @@ extern "C" UINT __stdcall GetUserInstallMode(MSIHANDLE handle)
if ( szValue[0] )
{
- MsiSetProperty( handle, TEXT("ALLUSERS"), szValue );
+ SetMsiProperty( 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 4197053411ad..a0f930ad7d35 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 <../tools/msiprop.hxx>
+#include <msiquery.h>
#ifdef _MSC_VER
#pragma warning(pop)
#endif
@@ -66,9 +66,6 @@ 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
@@ -179,6 +176,30 @@ 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];
@@ -292,16 +313,56 @@ 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 ( GetMsiPropValue( handle, TEXT("REGISTER_NO_MSO_TYPES") ).compare( PROP_OFF ) == 0 )
+ if ( ! bRegisterNone )
{
-
- if ( GetMsiPropValue( handle, TEXT("REGISTER_ALL_MSO_TYPES") ).compare( PROP_ON ) == 0 )
+ if ( IsSetMsiProp( handle, "REGISTER_ALL_MSO_TYPES" ) )
{
if ( bWriterEnabled )
MsiSetPropertyA( handle, "SELECT_WORD", "1" );
@@ -314,47 +375,6 @@ 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" );
@@ -370,7 +390,7 @@ extern "C" UINT __stdcall LookForRegisteredExtensions( MSIHANDLE handle )
MsiSetPropertyA( handle, "SELECT_POWERPOINT", "1" );
OutputDebugStringFormat( "LookForRegisteredExtensions: Register for Microsoft PowerPoint" );
}
- if ( bDrawEnabled && ! checkSomeExtensionInRegistry( VISIO_START, VISIO_END ) )
+ if ( bImpressEnabled && ! checkSomeExtensionInRegistry( VISIO_START, VISIO_END ) )
{
MsiSetPropertyA( handle, "SELECT_VISIO", "1" );
OutputDebugStringFormat( "LookForRegisteredExtensions: Register for Microsoft Visio" );
@@ -387,7 +407,7 @@ extern "C" UINT __stdcall RegisterSomeExtensions( MSIHANDLE handle )
{
OutputDebugStringFormat( "RegisterSomeExtensions: " );
- if ( GetMsiPropValue( handle, TEXT("SELECT_WORD") ).compare( PROP_ON ) == 0 )
+ if ( IsSetMsiProp( handle, "SELECT_WORD" ) )
{
registerSomeExtensions( handle, WORD_START, EXCEL_START, true );
MsiSetFeatureState( handle, L"gm_p_Wrt_MSO_Reg", INSTALLSTATE_LOCAL );
@@ -399,7 +419,7 @@ extern "C" UINT __stdcall RegisterSomeExtensions( MSIHANDLE handle )
MsiSetFeatureState( handle, L"gm_p_Wrt_MSO_Reg", INSTALLSTATE_ABSENT );
}
- if ( GetMsiPropValue( handle, TEXT("SELECT_EXCEL") ).compare( PROP_ON ) == 0 )
+ if ( IsSetMsiProp( handle, "SELECT_EXCEL" ) )
{
registerSomeExtensions( handle, EXCEL_START, POWERPOINT_START, true );
MsiSetFeatureState( handle, L"gm_p_Calc_MSO_Reg", INSTALLSTATE_LOCAL );
@@ -411,7 +431,7 @@ extern "C" UINT __stdcall RegisterSomeExtensions( MSIHANDLE handle )
MsiSetFeatureState( handle, L"gm_p_Calc_MSO_Reg", INSTALLSTATE_ABSENT );
}
- if ( GetMsiPropValue( handle, TEXT("SELECT_POWERPOINT") ).compare( PROP_ON ) == 0 )
+ if ( IsSetMsiProp( handle, "SELECT_POWERPOINT" ) )
{
registerSomeExtensions( handle, POWERPOINT_START, VISIO_START, true );
MsiSetFeatureState( handle, L"gm_p_Impress_MSO_Reg", INSTALLSTATE_LOCAL );
@@ -423,7 +443,7 @@ extern "C" UINT __stdcall RegisterSomeExtensions( MSIHANDLE handle )
MsiSetFeatureState( handle, L"gm_p_Impress_MSO_Reg", INSTALLSTATE_ABSENT );
}
- if ( GetMsiPropValue( handle, TEXT("SELECT_VISIO") ).compare( PROP_ON ) == 0 )
+ if ( IsSetMsiProp( handle, "SELECT_VISIO" ) )
{
registerSomeExtensions( handle, VISIO_START, VISIO_END, true );
MsiSetFeatureState( handle, L"gm_p_Draw_MSO_Reg", INSTALLSTATE_LOCAL );
@@ -439,7 +459,7 @@ extern "C" UINT __stdcall RegisterSomeExtensions( MSIHANDLE handle )
extern "C" UINT __stdcall FindRegisteredExtensions( MSIHANDLE handle )
{
- if ( GetMsiPropValue( handle, TEXT("FILETYPEDIALOGUSED") ).compare( PROP_ON ) == 0 )
+ if ( IsSetMsiProp( handle, "FILETYPEDIALOGUSED" ) )
{
OutputDebugStringFormat( "FindRegisteredExtensions: FILETYPEDIALOGUSED!" );
return ERROR_SUCCESS;
@@ -447,9 +467,9 @@ extern "C" UINT __stdcall FindRegisteredExtensions( MSIHANDLE handle )
OutputDebugStringFormat( "FindRegisteredExtensions:" );
- bool bRegisterAll = GetMsiPropValue( handle, TEXT("REGISTER_ALL_MSO_TYPES") ).compare( PROP_ON ) == 0;
+ bool bRegisterAll = IsSetMsiProp( handle, "REGISTER_ALL_MSO_TYPES" );
- if ( GetMsiPropValue( handle, TEXT("REGISTER_NO_MSO_TYPES") ).compare( PROP_ON ) == 0 )
+ if ( IsSetMsiProp( handle, "REGISTER_NO_MSO_TYPES" ) )
{
OutputDebugStringFormat( "FindRegisteredExtensions: Register none!" );
return ERROR_SUCCESS;
@@ -461,13 +481,13 @@ extern "C" UINT __stdcall FindRegisteredExtensions( MSIHANDLE handle )
// setting the msi properties SELECT_* will force registering for all corresponding
// file types
- if ( GetMsiPropValue( handle, TEXT("SELECT_WORD") ).compare( PROP_ON ) == 0 )
+ if ( IsSetMsiProp( handle, "SELECT_WORD" ) )
registerSomeExtensions( handle, WORD_START, EXCEL_START, true );
- if ( GetMsiPropValue( handle, TEXT("SELECT_EXCEL") ).compare( PROP_ON ) == 0 )
+ if ( IsSetMsiProp( handle, "SELECT_EXCEL" ) )
registerSomeExtensions( handle, EXCEL_START, POWERPOINT_START, true );
- if ( GetMsiPropValue( handle, TEXT("SELECT_POWERPOINT") ).compare( PROP_ON ) == 0)
+ if ( IsSetMsiProp( handle, "SELECT_POWERPOINT" ) )
registerSomeExtensions( handle, POWERPOINT_START, VISIO_START, true );
- if ( GetMsiPropValue( handle, TEXT("SELECT_VISIO") ).compare( PROP_ON ) == 0)
+ if ( IsSetMsiProp( handle, "SELECT_VISIO" ) )
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 4f16a9fc9c36..7be03a2dabc4 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 <../tools/msiprop.hxx>
+#include <msiquery.h>
#ifdef _MSC_VER
#pragma warning(pop)
#endif
@@ -122,10 +122,29 @@ 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 ) )
+ if ( GetMsiProp( hMSI, L"INSTALLLOCATION", &pProgPath ) && pProgPath )
{
char* pCharProgPath = UnicodeToAnsiString( pProgPath );
@@ -252,7 +271,7 @@ BOOL MakeInstallForAllUsers( MSIHANDLE hMSI )
{
BOOL bResult = FALSE;
wchar_t* pVal = NULL;
- if ( GetMsiProp( hMSI, L"ALLUSERS", &pVal ) )
+ if ( GetMsiProp( hMSI, L"ALLUSERS", &pVal ) && pVal )
{
bResult = UnicodeEquals( pVal , L"1" );
free( pVal );
@@ -266,7 +285,7 @@ BOOL MakeInstallFor64Bit( MSIHANDLE hMSI )
{
BOOL bResult = FALSE;
wchar_t* pVal = NULL;
- if ( GetMsiProp( hMSI, L"VersionNT64", &pVal ) )
+ if ( GetMsiProp( hMSI, L"VersionNT64", &pVal ) && 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 2362c61695aa..0c51ccb8f97e 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 <../tools/msiprop.hxx>
+#include <msiquery.h>
#ifdef _MSC_VER
#pragma warning(pop)
#endif
@@ -33,13 +33,46 @@
#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;
- LPTSTR* pVal = NULL;
- if ( GetMsiProp( hMSI, TEXT("ALLUSERS"), pVal ) )
+ wchar_t* pVal = NULL;
+ if ( GetMsiProp( hMSI, L"ALLUSERS", &pVal ) && pVal )
{
- bResult = ( int (pVal) == 1 );
+ bResult = UnicodeEquals( pVal , L"1" );
free( pVal );
}
diff --git a/setup_native/source/win32/customactions/sellang/sellang.cxx b/setup_native/source/win32/customactions/sellang/sellang.cxx
index 893a04f386a4..b6f7ec559ea0 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 <../tools/msiprop.hxx>
+#include <msiquery.h>
#include <malloc.h>
#include <stdio.h>
@@ -40,6 +40,21 @@
#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 )
{
@@ -299,8 +314,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:
*/
- LPTSTR pVal = NULL;
- if ( (GetMsiProp( handle, "UI_LANGS", &pVal )) ) {
+ char* pVal = NULL;
+ if ( (GetMsiProp( handle, "UI_LANGS", &pVal )) && 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 60ed8b5ed3c0..7b35b3cf518c 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 <../tools/msiprop.hxx>
+#include <msiquery.h>
#ifdef _MSC_VER
#pragma warning(pop)
#endif
@@ -46,17 +46,44 @@
#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 = GetMsiPropValue(handle, TEXT("INSTALLLOCATION"));
- std::_tstring sOfficeHostnamePath = GetMsiPropValue(handle, TEXT("OFFICEDIRHOSTNAME"));
+ std::_tstring sInstallPath = GetMsiProperty(handle, TEXT("INSTALLLOCATION"));
+ std::_tstring sOfficeHostnamePath = GetMsiProperty(handle, TEXT("OFFICEDIRHOSTNAME"));
// MessageBox(NULL, sInstallPath.c_str(), "DEBUG", MB_OK);
// unsetting all properties
- MsiSetProperty( handle, TEXT("DIRECTORY_NOT_EMPTY"), NULL );
+ UnsetMsiProperty( handle, TEXT("DIRECTORY_NOT_EMPTY") );
// 1. Searching for file setup.ini
@@ -71,7 +98,7 @@ extern "C" UINT __stdcall CheckInstallDirectory(MSIHANDLE handle)
if ( IsValidHandle(hdl) )
{
// setup.ini found -> directory cannot be used for installation.
- MsiSetProperty( handle, TEXT("DIRECTORY_NOT_EMPTY"), TEXT("1") );
+ SetMsiProperty( 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 99fb2403de65..94a24cd7687c 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 <../tools/msiprop.hxx>
+#include <msiquery.h>
#ifdef _MSC_VER
#pragma warning(pop)
#endif
@@ -63,24 +63,44 @@ 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 )
{
- LPTSTR sPatchList = NULL;
- LPTSTR sRequiredPatch = NULL;
+ std::_tstring sPatchList = GetMsiProperty( handle, TEXT("PATCH") );
+ std::_tstring sRequiredPatch = GetMsiProperty( handle, TEXT("PREREQUIREDPATCH") );
- if ( GetMsiProp( handle, TEXT("PATCH"), &sPatchList ) && GetMsiProp( handle, TEXT("PREREQUIREDPATCH"), &sRequiredPatch ) )
+ OutputDebugStringFormat( "CheckPatchList called with PATCH=%s and PRQ= %s\n", sPatchList.c_str(), sRequiredPatch.c_str() );
+
+ if ( ( sPatchList.length() != 0 ) && ( sRequiredPatch.length() != 0 ) )
{
- OutputDebugStringFormat( "CheckPatchList called with PATCH=%s and PRQ= %s\n", sPatchList, sRequiredPatch );
- if ( _tcsstr( sPatchList, sRequiredPatch ) )
+ if ( _tcsstr( sPatchList.c_str(), sRequiredPatch.c_str() ) )
{
- MsiSetProperty( handle, TEXT("IGNOREPREREQUIREDPATCH"), TEXT("1") );
+ SetMsiProperty( handle, TEXT("IGNOREPREREQUIREDPATCH") );
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 5f684c1265f3..d56ad5e7db15 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 <../tools/msiprop.hxx>
+#include <msiquery.h>
#ifdef _MSC_VER
#pragma warning(pop)
#endif
@@ -41,6 +41,27 @@
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
@@ -55,8 +76,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 = GetMsiPropValue( handle, TEXT("INSTALLLOCATION") );
- std::_tstring sOfficeDirHostname = GetMsiPropValue( handle, TEXT("OFFICEDIRHOSTNAME_") );
+ std::_tstring sInstallLocation = GetMsiProperty( handle, TEXT("INSTALLLOCATION") );
+ std::_tstring sOfficeDirHostname = GetMsiProperty( handle, TEXT("OFFICEDIRHOSTNAME_") );
// If sInstallLocation ends with (contains) the string sOfficeDirHostname,
// INSTALLLOCATION is good and nothing has to be done here.
@@ -73,9 +94,9 @@ extern "C" UINT __stdcall CompleteInstallPath( MSIHANDLE handle )
if ( pathCompletionRequired )
{
- std::_tstring sManufacturer = GetMsiPropValue( handle, TEXT("Manufacturer") );
- std::_tstring sDefinedName = GetMsiPropValue( handle, TEXT("DEFINEDPRODUCT") );
- std::_tstring sUpgradeCode = GetMsiPropValue( handle, TEXT("UpgradeCode") );
+ std::_tstring sManufacturer = GetMsiProperty( handle, TEXT("Manufacturer") );
+ std::_tstring sDefinedName = GetMsiProperty( handle, TEXT("DEFINEDPRODUCT") );
+ std::_tstring sUpgradeCode = GetMsiProperty( 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 758d9d9cca24..1a52dad88d04 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 <../tools/msiprop.hxx>
+#include <msiquery.h>
#include <shellapi.h>
#ifdef _MSC_VER
#pragma warning(pop)
@@ -48,9 +48,27 @@
#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 = GetMsiPropValue( handle, TEXT("SourceDir") );
+ std::_tstring sSourceDir = GetMsiProperty( handle, TEXT("SourceDir") );
std::_tstring sExtensionDir = sSourceDir + TEXT("extension\\");
std::_tstring sPattern = sExtensionDir + TEXT("*.oxt");
@@ -65,7 +83,7 @@ extern "C" UINT __stdcall copyExtensionData(MSIHANDLE handle) {
bool fNextFile = false;
bool bFailIfExist = true;
- std::_tstring sDestDir = GetMsiPropValue( handle, TEXT("INSTALLLOCATION") );
+ std::_tstring sDestDir = GetMsiProperty( 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 42f7f093e3b5..864b886f3be6 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 <../tools/msiprop.hxx>
+#include <msiquery.h>
#ifdef _MSC_VER
#pragma warning(pop)
#endif
@@ -45,6 +45,28 @@ 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) {
@@ -104,20 +126,20 @@ Order compareVersions(string const & version1, string const & version2) {
} // namespace
extern "C" UINT __stdcall DotNetCheck(MSIHANDLE handle) {
- string present(GetMsiPropValue(handle, TEXT("MsiNetAssemblySupport")));
- string required(GetMsiPropValue(handle, TEXT("REQUIRED_DOTNET_VERSION")));
+ string present(GetMsiProperty(handle, TEXT("MsiNetAssemblySupport")));
+ string required(GetMsiProperty(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);
- MsiSetProperty(
+ SetMsiProperty(
handle, TEXT("DOTNET_SUFFICIENT"),
(present.empty() || compareVersions(present, required) == ORDER_LESS ?
TEXT("0") : TEXT("1")));
- // string result(GetMsiPropValue(handle, TEXT("DOTNET_SUFFICIENT")));
+ // string result(GetMsiProperty(handle, TEXT("DOTNET_SUFFICIENT")));
// string myText3 = TEXT("DOTNET_SUFFICIENT: ") + result;
// MessageBox(NULL, myText3.c_str(), "DEBUG", MB_OK);
@@ -127,23 +149,23 @@ extern "C" UINT __stdcall DotNetCheck(MSIHANDLE handle) {
extern "C" UINT __stdcall ShowProperties(MSIHANDLE handle)
{
- string property = GetMsiPropValue(handle, TEXT("INSTALLLOCATION"));
+ string property = GetMsiProperty(handle, TEXT("INSTALLLOCATION"));
string myText = TEXT("INSTALLLOCATION: ") + property;
MessageBox(NULL, myText.c_str(), "INSTALLLOCATION", MB_OK);
- property = GetMsiPropValue(handle, TEXT("Installed"));
+ property = GetMsiProperty(handle, TEXT("Installed"));
myText = TEXT("Installed: ") + property;
MessageBox(NULL, myText.c_str(), "Installed", MB_OK);
- property = GetMsiPropValue(handle, TEXT("PATCH"));
+ property = GetMsiProperty(handle, TEXT("PATCH"));
myText = TEXT("PATCH: ") + property;
MessageBox(NULL, myText.c_str(), "PATCH", MB_OK);
- property = GetMsiPropValue(handle, TEXT("REMOVE"));
+ property = GetMsiProperty(handle, TEXT("REMOVE"));
myText = TEXT("REMOVE: ") + property;
MessageBox(NULL, myText.c_str(), "REMOVE", MB_OK);
- property = GetMsiPropValue(handle, TEXT("ALLUSERS"));
+ property = GetMsiProperty(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 67919ecce8d5..88e020f5b27e 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 <../tools/msiprop.hxx>
+#include <msiquery.h>
#ifdef _MSC_VER
#pragma warning(pop)
#endif
@@ -45,6 +45,38 @@ 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) {
@@ -58,13 +90,13 @@ namespace
extern "C" UINT __stdcall CreateLayerLinks(MSIHANDLE handle)
{
- string sInstallPath = GetMsiPropValue(handle, TEXT("INSTALLLOCATION"));
+ string sInstallPath = GetMsiProperty(handle, TEXT("INSTALLLOCATION"));
string sUreInstallPath = sInstallPath + TEXT("URE");
string sUreLinkPath = sInstallPath + TEXT("ure-link");
- if ( GetMsiPropValue(handle, TEXT("ADMININSTALL")).length() > 0 )
+ if ( IsSetMsiProperty(handle, TEXT("ADMININSTALL")) )
{
sUreInstallPath = TEXT("..\\URE");
}
@@ -117,7 +149,7 @@ extern "C" UINT __stdcall CreateLayerLinks(MSIHANDLE handle)
extern "C" UINT __stdcall RemoveLayerLinks(MSIHANDLE handle)
{
- string sInstallPath = GetMsiPropValue(handle, TEXT("INSTALLLOCATION"));
+ string sInstallPath = GetMsiProperty(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 476d2351e527..1b159fd22e79 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 <../tools/msiprop.hxx>
+#include <msiquery.h>
#ifdef _MSC_VER
#pragma warning(pop)
#endif
@@ -41,6 +41,27 @@
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];
@@ -48,10 +69,10 @@ extern "C" UINT __stdcall MigrateInstallPath( MSIHANDLE handle )
HKEY hKey;
std::_tstring sInstDir;
- 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 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 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 b8f6e6655f79..2ae17694cf42 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 <../tools/msiprop.hxx>
+#include <msiquery.h>
#ifdef _MSC_VER
#pragma warning(pop)
#endif
@@ -41,6 +41,25 @@
#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;
@@ -82,7 +101,7 @@ extern "C" UINT __stdcall ExecutePostUninstallScript( MSIHANDLE handle )
HKEY hKey;
std::_tstring sInstDir;
- std::_tstring sProductKey = GetMsiPropValue( handle, TEXT("FINDPRODUCT") );
+ std::_tstring sProductKey = GetMsiProperty( 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 d1b7b9b26f45..bc010c630942 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 <../tools/msiprop.hxx>
+#include <msiquery.h>
#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)
{
- MsiSetProperty(handle, TEXT("ADMININSTALL"), TEXT("1"));
+ SetMsiProperty(handle, TEXT("ADMININSTALL"));
return ERROR_SUCCESS;
}
diff --git a/setup_native/source/win32/customactions/shellextensions/startmenuicon.cxx b/setup_native/source/win32/customactions/shellextensions/startmenuicon.cxx
index 92ad25c45324..de3f3f6b461e 100644
--- a/setup_native/source/win32/customactions/shellextensions/startmenuicon.cxx
+++ b/setup_native/source/win32/customactions/shellextensions/startmenuicon.cxx
@@ -24,25 +24,50 @@
#endif
#define WIN32_LEAN_AND_MEAN
#include <windows.h>
-#include <../tools/msiprop.hxx>
+#include <msiquery.h>
#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::string sOfficeMenuFolder = GetMsiPropValue( handle, TEXT("OfficeMenuFolder") );
- std::string sDesktopFile = sOfficeMenuFolder + TEXT("Desktop.ini");
- std::string sIconFile = GetMsiPropValue( handle, TEXT("INSTALLLOCATION") ) + TEXT("program\\soffice.exe");
+ 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");
OSVERSIONINFO osverinfo;
osverinfo.dwOSVersionInfoSize = sizeof(OSVERSIONINFO);
@@ -84,8 +109,8 @@ extern "C" UINT __stdcall InstallStartmenuFolderIcon( MSIHANDLE handle )
extern "C" UINT __stdcall DeinstallStartmenuFolderIcon(MSIHANDLE handle)
{
- std::string sOfficeMenuFolder = GetMsiPropValue( handle, TEXT("OfficeMenuFolder") );
- std::string sDesktopFile = sOfficeMenuFolder + TEXT("Desktop.ini");
+ std::_tstring sOfficeMenuFolder = GetMsiProperty( handle, TEXT("OfficeMenuFolder") );
+ std::_tstring 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 92e33c79b603..9a5496352395 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 <../tools/msiprop.hxx>
+#include <msiquery.h>
#ifdef _MSC_VER
#pragma warning(pop)
#endif
@@ -111,6 +111,38 @@ 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)
{
@@ -139,7 +171,7 @@ namespace
extern "C" UINT __stdcall SetProductInstallMode(MSIHANDLE handle)
{
- string upgradeCode = GetMsiPropValue(handle, TEXT("UpgradeCode"));
+ string upgradeCode = GetMsiProperty(handle, TEXT("UpgradeCode"));
upgradeCode = ConvertGuid(string(upgradeCode.c_str() + 1, upgradeCode.length() - 2));
//MessageBox(NULL, upgradeCode.c_str(), TEXT("Debug"), MB_OK);
@@ -147,17 +179,17 @@ extern "C" UINT __stdcall SetProductInstallMode(MSIHANDLE handle)
if (RegistryKeyHasUpgradeSubKey(
HKEY_CURRENT_USER,
TEXT("Software\\Microsoft\\Installer\\UpgradeCodes"),
- upgradeCode))
+ upgradeCode) && IsSetMsiProperty(handle, TEXT("ALLUSERS")))
{
- MsiSetProperty(handle, TEXT("ALLUSERS"), NULL);
+ UnsetMsiProperty(handle, TEXT("ALLUSERS"));
//MessageBox(NULL, "ALLUSERS removed", "DEBUG", MB_OK);
}
else if (RegistryKeyHasUpgradeSubKey(
HKEY_LOCAL_MACHINE,
TEXT("Software\\Classes\\Installer\\UpgradeCodes"),
- upgradeCode))
+ upgradeCode) && !IsSetMsiProperty(handle, TEXT("ALLUSERS")))
{
- MsiSetProperty(handle, TEXT("ALLUSERS"), TEXT("1"));
+ SetMsiProperty(handle, TEXT("ALLUSERS"));
//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 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 );
diff --git a/setup_native/source/win32/customactions/thesaurus/thesaurus.cxx b/setup_native/source/win32/customactions/thesaurus/thesaurus.cxx
index a27801c58382..349ed75d8faf 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 <../tools/msiprop.hxx>
+#include <msiquery.h>
#include <malloc.h>
#include <stdio.h>
@@ -43,6 +43,38 @@ 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;
@@ -161,7 +193,7 @@ namespace
extern "C" UINT __stdcall CreateIndexes( MSIHANDLE handle )
{
- string sOfficeInstallPath = GetMsiPropValue(handle, TEXT("INSTALLLOCATION"));
+ string sOfficeInstallPath = GetMsiProperty(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 0484488b6ccd..dc42bfa63288 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 <../tools/msiprop.hxx>
+#include <msiquery.h>
#ifdef _MSC_VER
#pragma warning(pop)
#endif
@@ -36,6 +36,25 @@
#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, ... )
{
@@ -59,7 +78,7 @@ extern "C" UINT __stdcall CheckVersions( MSIHANDLE hMSI )
wchar_t* pVal = NULL;
- if ( GetMsiProp( hMSI, L"NEWPRODUCTS", &pVal ) )
+ if ( GetMsiProp( hMSI, L"NEWPRODUCTS", &pVal ) && pVal )
{
OutputDebugStringFormat( TEXT("DEBUG: NEWPRODUCTS found [%s]"), pVal );
if ( *pVal != 0 )
@@ -67,7 +86,7 @@ extern "C" UINT __stdcall CheckVersions( MSIHANDLE hMSI )
free( pVal );
}
pVal = NULL;
- if ( GetMsiProp( hMSI, L"SAMEPRODUCTS", &pVal ) )
+ if ( GetMsiProp( hMSI, L"SAMEPRODUCTS", &pVal ) && pVal )
{
OutputDebugStringFormat( TEXT("DEBUG: SAMEPRODUCTS found [%s]"), pVal );
if ( *pVal != 0 )
@@ -75,7 +94,7 @@ extern "C" UINT __stdcall CheckVersions( MSIHANDLE hMSI )
free( pVal );
}
pVal = NULL;
- if ( GetMsiProp( hMSI, L"OLDPRODUCTS", &pVal ) )
+ if ( GetMsiProp( hMSI, L"OLDPRODUCTS", &pVal ) && pVal )
{
OutputDebugStringFormat( TEXT("DEBUG: OLDPRODUCTS found [%s]"), pVal );
if ( *pVal != 0 )
@@ -83,7 +102,7 @@ extern "C" UINT __stdcall CheckVersions( MSIHANDLE hMSI )
free( pVal );
}
pVal = NULL;
- if ( GetMsiProp( hMSI, L"BETAPRODUCTS", &pVal ) )
+ if ( GetMsiProp( hMSI, L"BETAPRODUCTS", &pVal ) && pVal )
{
OutputDebugStringFormat( TEXT("DEBUG: BETAPRODUCTS found [%s]"), pVal );
if ( *pVal != 0 )
@@ -92,7 +111,7 @@ extern "C" UINT __stdcall CheckVersions( MSIHANDLE hMSI )
}
pVal = NULL;
- if ( GetMsiProp( hMSI, L"NEWPRODUCTSPATCH", &pVal ) )
+ if ( GetMsiProp( hMSI, L"NEWPRODUCTSPATCH", &pVal ) && pVal )
{
OutputDebugStringFormat( TEXT("DEBUG: NEWPRODUCTSPATCH found [%s]"), pVal );
if ( *pVal != 0 )
@@ -100,7 +119,7 @@ extern "C" UINT __stdcall CheckVersions( MSIHANDLE hMSI )
free( pVal );
}
pVal = NULL;
- if ( GetMsiProp( hMSI, L"SAMEPRODUCTSPATCH", &pVal ) )
+ if ( GetMsiProp( hMSI, L"SAMEPRODUCTSPATCH", &pVal ) && pVal )
{
OutputDebugStringFormat( TEXT("DEBUG: SAMEPRODUCTSPATCH found [%s]"), pVal );
if ( *pVal != 0 )
@@ -108,7 +127,7 @@ extern "C" UINT __stdcall CheckVersions( MSIHANDLE hMSI )
free( pVal );
}
pVal = NULL;
- if ( GetMsiProp( hMSI, L"OLDPRODUCTSPATCH", &pVal ) )
+ if ( GetMsiProp( hMSI, L"OLDPRODUCTSPATCH", &pVal ) && 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
deleted file mode 100755
index 5d75130d5d9b..000000000000
--- a/setup_native/source/win32/customactions/tools/msiprop.hxx
+++ /dev/null
@@ -1,62 +0,0 @@
-/* -*- 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