summaryrefslogtreecommitdiff
path: root/setup_native
diff options
context:
space:
mode:
Diffstat (limited to 'setup_native')
-rwxr-xr-xsetup_native/source/packinfo/shellscripts_extensions.txt24
-rw-r--r--setup_native/source/win32/customactions/rebase/rebase.cxx85
-rw-r--r--setup_native/source/win32/customactions/shellextensions/registerextensions.cxx55
3 files changed, 128 insertions, 36 deletions
diff --git a/setup_native/source/packinfo/shellscripts_extensions.txt b/setup_native/source/packinfo/shellscripts_extensions.txt
index 0be870990b71..3ab47f925802 100755
--- a/setup_native/source/packinfo/shellscripts_extensions.txt
+++ b/setup_native/source/packinfo/shellscripts_extensions.txt
@@ -76,6 +76,12 @@ END
if [ -x "$$RPM_INSTALL_PREFIX/PRODUCTDIRECTORYNAME/program/unopkg" ]; then
"$$RPM_INSTALL_PREFIX/PRODUCTDIRECTORYNAME/program/unopkg" sync
+ if [ "$$?" != "0" ]; then
+ echo "ERROR: Registration of extensions failed!"
+ exit 1
+ else
+ echo "SUCCESS: unopkg returns successful!"
+ fi
find "$$RPM_INSTALL_PREFIX/PRODUCTDIRECTORYNAME/share/prereg/bundled" -type f -exec chmod 644 {} \;
fi
@@ -87,6 +93,12 @@ END
if [ -x "$$RPM_INSTALL_PREFIX/PRODUCTDIRECTORYNAME/program/unopkg" ]; then
"$$RPM_INSTALL_PREFIX/PRODUCTDIRECTORYNAME/program/unopkg" sync
+ if [ "$$?" != "0" ]; then
+ echo "ERROR: Registration of extensions failed!"
+ exit 1
+ else
+ echo "SUCCESS: unopkg returns successful!"
+ fi
find "$$RPM_INSTALL_PREFIX/PRODUCTDIRECTORYNAME/share/prereg/bundled" -type f -exec chmod 644 {} \;
fi
@@ -99,6 +111,12 @@ END
if [ -x "PRODUCTDIRECTORYNAME/program/unopkg" ]; then
"PRODUCTDIRECTORYNAME/program/unopkg" sync
+ if [ "$$?" != "0" ]; then
+ echo "ERROR: Registration of extensions failed!"
+ exit 1
+ else
+ echo "SUCCESS: unopkg returns successful!"
+ fi
find "PRODUCTDIRECTORYNAME/share/prereg/bundled" -type f -exec chmod 644 {} \;
fi
@@ -111,6 +129,12 @@ END
if [ -x "PRODUCTDIRECTORYNAME/program/unopkg" ]
then
"PRODUCTDIRECTORYNAME/program/unopkg" sync
+ if [ "$$?" != "0" ]; then
+ echo "ERROR: Registration of extensions failed!"
+ exit 1
+ else
+ echo "SUCCESS: unopkg returns successful!"
+ fi
find "PRODUCTDIRECTORYNAME/share/prereg/bundled" -type f -exec chmod 644 {} \;
fi
diff --git a/setup_native/source/win32/customactions/rebase/rebase.cxx b/setup_native/source/win32/customactions/rebase/rebase.cxx
index dfe1e82e1e9b..2a7026675107 100644
--- a/setup_native/source/win32/customactions/rebase/rebase.cxx
+++ b/setup_native/source/win32/customactions/rebase/rebase.cxx
@@ -19,11 +19,14 @@
#include <malloc.h>
#include <time.h>
#include <string>
+#include <hash_map>
const DWORD PE_Signature = 0x00004550;
+typedef std::pair< std::string, bool > StringPair;
+typedef std::hash_map< std::string, bool > ExcludeLibsMap;
#ifdef DEBUG
-inline void OutputDebugStringFormat( LPCSTR pFormat, ... )
+static void OutputDebugStringFormat( LPCSTR pFormat, ... )
{
CHAR buffer[1024];
va_list args;
@@ -33,7 +36,7 @@ inline void OutputDebugStringFormat( LPCSTR pFormat, ... )
OutputDebugStringA( buffer );
}
#else
-static inline void OutputDebugStringFormat( LPCSTR, ... )
+static void OutputDebugStringFormat( LPCSTR, ... )
{
}
#endif
@@ -98,22 +101,31 @@ static BOOL rebaseImage( MSIHANDLE /*handle*/, const std::string& sFilePath, LPV
return bResult;
}
-static BOOL rebaseImagesInFolder( MSIHANDLE handle, const std::string& sPath, LPVOID address )
+static BOOL rebaseImagesInFolder( MSIHANDLE handle, const std::string& sPath, LPVOID address, ExcludeLibsMap& rExcludeMap )
{
- std::string sDir = sPath;
- std::string sPattern = sPath + TEXT("*.dll");
-
+ std::string sDir = sPath;
+ std::string sPattern = sPath + TEXT("*.dll");
WIN32_FIND_DATA aFindFileData;
- HANDLE hFind = FindFirstFile( sPattern.c_str(), &aFindFileData );
+ HANDLE hFind = FindFirstFile( sPattern.c_str(), &aFindFileData );
if ( IsValidHandle(hFind) )
{
BOOL fSuccess = false;
do
{
- std::string sLibFile = sDir + aFindFileData.cFileName;
- rebaseImage( handle, sLibFile, address );
+ std::string sFileName = aFindFileData.cFileName;
+ if ( rExcludeMap.find( sFileName ) == rExcludeMap.end() )
+ {
+ OutputDebugStringFormat( "Rebase library: %s", sFileName.c_str() );
+ std::string sLibFile = sDir + sFileName;
+ rebaseImage( handle, sLibFile, address );
+ }
+ else
+ {
+ OutputDebugStringFormat( "Exclude library %s from rebase", sFileName.c_str() );
+ }
+
fSuccess = FindNextFile( hFind, &aFindFileData );
}
while ( fSuccess );
@@ -124,7 +136,7 @@ static BOOL rebaseImagesInFolder( MSIHANDLE handle, const std::string& sPath, LP
return ERROR_SUCCESS;
}
-static BOOL rebaseImages( MSIHANDLE handle, LPVOID pAddress )
+static BOOL rebaseImages( MSIHANDLE handle, LPVOID pAddress, ExcludeLibsMap& rMap )
{
std::string sInstallPath = GetMsiProperty(handle, TEXT("INSTALLLOCATION"));
@@ -132,9 +144,9 @@ static BOOL rebaseImages( MSIHANDLE handle, LPVOID pAddress )
std::string sOfficeDir = sInstallPath + TEXT("program\\");
std::string sUreDir = sInstallPath + TEXT("URE\\bin\\");
- BOOL bResult = rebaseImagesInFolder( handle, sBasisDir, pAddress );
- bResult &= rebaseImagesInFolder( handle, sOfficeDir, pAddress );
- bResult &= rebaseImagesInFolder( handle, sUreDir, pAddress );
+ BOOL bResult = rebaseImagesInFolder( handle, sBasisDir, pAddress, rMap );
+ bResult &= rebaseImagesInFolder( handle, sOfficeDir, pAddress, rMap );
+ bResult &= rebaseImagesInFolder( handle, sUreDir, pAddress, rMap );
return bResult;
}
@@ -146,21 +158,66 @@ static BOOL IsServerSystem( MSIHANDLE /*handle*/ )
GetVersionEx(reinterpret_cast<LPOSVERSIONINFO>(&osVersionInfoEx));
if ( osVersionInfoEx.wProductType != VER_NT_WORKSTATION )
+ {
+ OutputDebugStringFormat( "Server system detected. No rebase necessary!" );
return TRUE;
+ }
else
+ {
+ OutputDebugStringFormat( "Client system detected. Rebase necessary!" );
return FALSE;
+ }
+}
+
+static void InitExcludeFromRebaseList( MSIHANDLE handle, ExcludeLibsMap& rMap )
+{
+ size_t nPos( 0 );
+ const TCHAR cDelim = ',';
+ std::string sLibsExcluded = GetMsiProperty(handle, TEXT("EXCLUDE_FROM_REBASE"));
+
+ while ( nPos < sLibsExcluded.size() )
+ {
+ size_t nDelPos = sLibsExcluded.find_first_of( cDelim, nPos );
+
+ std::string sExcludedLibName;
+ if ( nDelPos != std::string::npos )
+ {
+ sExcludedLibName = sLibsExcluded.substr( nPos, nDelPos - nPos );
+ nPos = nDelPos+1;
+ }
+ else
+ {
+ sExcludedLibName = sLibsExcluded.substr( nPos );
+ nPos = sLibsExcluded.size();
+ }
+
+ if ( sExcludedLibName.size() > 0 )
+ {
+ OutputDebugStringFormat( "Insert library %s into exclude from rebase list", sExcludedLibName.c_str() );
+ rMap.insert( StringPair( sExcludedLibName, true ));
+ }
+ }
}
extern "C" BOOL __stdcall RebaseLibrariesOnProperties( MSIHANDLE handle )
{
static LPVOID pDefault = reinterpret_cast<LPVOID>(0x10000000);
+ OutputDebugStringFormat( "RebaseLibrariesOnProperties has been called" );
std::string sDontOptimizeLibs = GetMsiProperty(handle, TEXT("DONTOPTIMIZELIBS"));
if ( sDontOptimizeLibs.length() > 0 && sDontOptimizeLibs == "1" )
+ {
+ OutputDebugStringFormat( "Don't optimize libraries set. No rebase necessary!" );
return TRUE;
+ }
if ( !IsServerSystem( handle ))
- return rebaseImages( handle, pDefault );
+ {
+ ExcludeLibsMap aExcludeLibsMap;
+ InitExcludeFromRebaseList( handle, aExcludeLibsMap );
+
+ return rebaseImages( handle, pDefault, aExcludeLibsMap );
+ }
return TRUE;
}
diff --git a/setup_native/source/win32/customactions/shellextensions/registerextensions.cxx b/setup_native/source/win32/customactions/shellextensions/registerextensions.cxx
index 9a748e9f2008..4a44b360fdba 100644
--- a/setup_native/source/win32/customactions/shellextensions/registerextensions.cxx
+++ b/setup_native/source/win32/customactions/shellextensions/registerextensions.cxx
@@ -317,14 +317,13 @@ static BOOL RemoveCompleteDirectory( std::_tstring sPath )
extern "C" UINT __stdcall RegisterExtensions(MSIHANDLE handle)
{
- std::_tstring sInstDir = GetMsiProperty( handle, TEXT("INSTALLLOCATION") );
+ // std::_tstring sInstDir = GetMsiProperty( handle, TEXT("INSTALLLOCATION") );
+ std::_tstring sInstDir = GetMsiProperty( handle, TEXT("CustomActionData") );
std::_tstring sUnoPkgFile = sInstDir + TEXT("program\\unopkg.exe");
std::_tstring mystr;
WIN32_FIND_DATA aFindFileData;
-
- mystr = "unopkg file: " + sUnoPkgFile;
- //MessageBox(NULL, mystr.c_str(), "Command", MB_OK);
+ bool registrationError = false;
// Find unopkg.exe
HANDLE hFindUnopkg = FindFirstFile( sUnoPkgFile.c_str(), &aFindFileData );
@@ -333,32 +332,44 @@ extern "C" UINT __stdcall RegisterExtensions(MSIHANDLE handle)
{
// unopkg.exe exists in program directory
std::_tstring sCommand = sUnoPkgFile + " sync";
- mystr = "Command: " + sCommand;
- //MessageBox(NULL, mystr.c_str(), "Command", MB_OK);
DWORD exitCode = 0;
bool fSuccess = ExecuteCommand( sCommand.c_str(), & exitCode);
-// if ( fSuccess )
-// {
-// mystr = "Executed successfully!";
-// MessageBox(NULL, mystr.c_str(), "Command", MB_OK);
-// }
-// else
-// {
-// mystr = "An error occured during execution!";
-// MessageBox(NULL, mystr.c_str(), "Command", MB_OK);
-// }
+// if ( fSuccess )
+// {
+// mystr = "Executed successfully!";
+// MessageBox(NULL, mystr.c_str(), "Command", MB_OK);
+// }
+// else
+// {
+// mystr = "An error occured during execution!";
+// MessageBox(NULL, mystr.c_str(), "Command", MB_OK);
+// }
+
+ if ( ! fSuccess )
+ {
+ mystr = "ERROR: An error occured during registration of extensions!";
+ MessageBox(NULL, mystr.c_str(), "ERROR", MB_OK);
+ registrationError = true;
+ }
FindClose( hFindUnopkg );
}
-// else
-// {
-// mystr = "Error: Did not find " + sUnoPkgFile;
-// MessageBox(NULL, mystr.c_str(), "Command", MB_OK);
-// }
+ // else
+ // {
+ // mystr = "Error: Did not find " + sUnoPkgFile;
+ // MessageBox(NULL, mystr.c_str(), "Command", MB_OK);
+ // }
- return ERROR_SUCCESS;
+ if ( registrationError )
+ {
+ return 1;
+ }
+ else
+ {
+ return ERROR_SUCCESS;
+ }
}