summaryrefslogtreecommitdiff
path: root/setup_native/source/win32/customactions
diff options
context:
space:
mode:
authorJan Holesovsky <kendy@suse.cz>2011-04-22 15:08:05 +0200
committerJan Holesovsky <kendy@suse.cz>2011-04-22 15:08:05 +0200
commit2554b31146823b9850d1e0c437bc75a2e8c95033 (patch)
tree106d014f2a58792ec1e258f5e5baddecb6adcf9f /setup_native/source/win32/customactions
parent0be571d9a673ab48fc7d3a94541c5720e0845016 (diff)
parente19358aa28e2a43134b49d1c37a27b6fa33ecc2f (diff)
Merge commit 'ooo/DEV300_m106' into libreoffice-3-4
Conflicts: extensions/source/svg/svgaction.cxx extensions/source/svg/svgaction.hxx extensions/source/svg/svgcom.hxx extensions/source/svg/svgprinter.cxx extensions/source/svg/svgprinter.hxx extensions/source/svg/svguno.cxx extensions/source/svg/svgwriter.cxx extensions/source/svg/svgwriter.hxx javainstaller2/src/JavaSetup/org/openoffice/setup/Controller/InstallationOngoingCtrl.java javainstaller2/src/JavaSetup/org/openoffice/setup/InstallData.java javainstaller2/src/JavaSetup/org/openoffice/setup/Installer/LinuxInstaller.java package/inc/ZipFile.hxx package/inc/ZipOutputStream.hxx package/inc/ZipPackage.hxx package/inc/ZipPackageStream.hxx package/source/manifest/ManifestExport.cxx package/source/manifest/ManifestImport.cxx package/source/manifest/UnoRegister.cxx package/source/xstor/owriteablestream.cxx package/source/xstor/xstorage.cxx package/source/xstor/xstorage.hxx package/source/zipapi/EntryInputStream.cxx package/source/zipapi/EntryInputStream.hxx package/source/zipapi/XFileStream.cxx package/source/zipapi/XFileStream.hxx package/source/zipapi/XMemoryStream.cxx package/source/zipapi/XUnbufferedStream.cxx package/source/zipapi/XUnbufferedStream.hxx package/source/zipapi/ZipFile.cxx package/source/zipapi/ZipOutputStream.cxx package/source/zipapi/sha1context.hxx package/source/zippackage/ZipPackage.cxx package/source/zippackage/ZipPackageFolder.cxx package/source/zippackage/ZipPackageStream.cxx setup_native/source/win32/customactions/shellextensions/registerextensions.cxx wizards/com/sun/star/wizards/letter/LetterWizardDialogImpl.java xmlsecurity/prj/build.lst xmlsecurity/source/helper/xmlsignaturehelper.cxx xmlsecurity/source/xmlsec/nss/seinitializer_nssimpl.cxx xmlsecurity/source/xmlsec/nss/seinitializer_nssimpl.hxx
Diffstat (limited to 'setup_native/source/win32/customactions')
-rw-r--r--setup_native/source/win32/customactions/rebase/rebase.cxx85
-rw-r--r--setup_native/source/win32/customactions/shellextensions/registerextensions.cxx55
2 files changed, 104 insertions, 36 deletions
diff --git a/setup_native/source/win32/customactions/rebase/rebase.cxx b/setup_native/source/win32/customactions/rebase/rebase.cxx
index 1eb3fedbf2f0..601af93dd20a 100644
--- a/setup_native/source/win32/customactions/rebase/rebase.cxx
+++ b/setup_native/source/win32/customactions/rebase/rebase.cxx
@@ -20,11 +20,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;
@@ -34,7 +37,7 @@ inline void OutputDebugStringFormat( LPCSTR pFormat, ... )
OutputDebugStringA( buffer );
}
#else
-static inline void OutputDebugStringFormat( LPCSTR, ... )
+static void OutputDebugStringFormat( LPCSTR, ... )
{
}
#endif
@@ -99,22 +102,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 );
@@ -125,7 +137,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"));
@@ -133,9 +145,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;
}
@@ -147,21 +159,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 6b32b33cc881..323407e54875 100644
--- a/setup_native/source/win32/customactions/shellextensions/registerextensions.cxx
+++ b/setup_native/source/win32/customactions/shellextensions/registerextensions.cxx
@@ -318,14 +318,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 );
@@ -334,32 +333,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 occurred 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 occurred 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;
+ }
}