diff options
Diffstat (limited to 'setup_native')
173 files changed, 22890 insertions, 0 deletions
diff --git a/setup_native/inc/setup_native/qswin32.h b/setup_native/inc/setup_native/qswin32.h new file mode 100644 index 000000000000..a7d82975b0b2 --- /dev/null +++ b/setup_native/inc/setup_native/qswin32.h @@ -0,0 +1,49 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#ifndef _QSWIN32_H +#define _QSWIN32_H + +#define QUICKSTART_CLASSNAMEA "SO Listener Class" +#define QUICKSTART_WINDOWNAMEA "SO Listener Window" +#define SHUTDOWN_QUICKSTART_MESSAGEA "SO KillTray" + +#define QUICKSTART_CLASSNAMEW L##QUICKSTART_CLASSNAMEA +#define QUICKSTART_WINDOWNAMEW L##QUICKSTART_WINDOWNAMEA +#define SHUTDOWN_QUICKSTART_MESSAGEW L##SHUTDOWN_QUICKSTART_MESSAGEA + +#ifdef UNICODE +# define QUICKSTART_CLASSNAME QUICKSTART_CLASSNAMEW +# define QUICKSTART_WINDOWNAME QUICKSTART_WINDOWNAMEW +# define SHUTDOWN_QUICKSTART_MESSAGE SHUTDOWN_QUICKSTART_MESSAGEW +#else +# define QUICKSTART_CLASSNAME QUICKSTART_CLASSNAMEA +# define QUICKSTART_WINDOWNAME QUICKSTART_WINDOWNAMEA +# define SHUTDOWN_QUICKSTART_MESSAGE SHUTDOWN_QUICKSTART_MESSAGEA +#endif + +#endif /* _QSWIN32_H */ diff --git a/setup_native/prj/build.lst b/setup_native/prj/build.lst new file mode 100644 index 000000000000..df7b02484039 --- /dev/null +++ b/setup_native/prj/build.lst @@ -0,0 +1,20 @@ +pk setup_native : l10n l10ntools soltools sal xml2cmp NULL +pk setup_native usr1 - all sn_mkout NULL +pk setup_native\scripts\source nmake - u sn_source NULL +pk setup_native\scripts nmake - u sn_scripts sn_source.u NULL +pk setup_native\source\mac nmake - u sn_mac NULL +pk setup_native\source\win32\customactions\tools nmake - w sn_tools NULL +pk setup_native\source\win32\customactions\relnotes nmake - w sn_relnotes NULL +pk setup_native\source\win32\customactions\rebase nmake - w sn_rebase NULL +pk setup_native\source\win32\customactions\regactivex nmake - w sn_regactivex NULL +pk setup_native\source\win32\customactions\regpatchactivex nmake - w sn_regpatchactivex NULL +pk setup_native\source\win32\customactions\reg4allmsdoc nmake - w sn_reg4allmsdoc NULL +pk setup_native\source\win32\customactions\reg64 nmake - w sn_reg64 NULL +pk setup_native\source\win32\customactions\javafilter nmake - w sn_javafilter NULL +pk setup_native\source\win32\customactions\quickstarter nmake - w sn_quickstarter NULL +pk setup_native\source\win32\customactions\shellextensions nmake - w sn_shellextensions sn_tools.w NULL +pk setup_native\source\win32\customactions\indexingfilter nmake - w sn_indexingfilter NULL +pk setup_native\source\win32\customactions\languagepacks nmake - w sn_languagepacks sn_shellextensions.w sn_tools.w NULL +pk setup_native\source\win32\customactions\patch nmake - w sn_patch sn_languagepacks.w sn_shellextensions.w sn_quickstarter.w sn_tools.w NULL +pk setup_native\source\win32\stwrapper nmake - w sn_stwrapper NULL +pk setup_native\source\ulfconv nmake - all sn_ulfconv NULL diff --git a/setup_native/prj/d.lst b/setup_native/prj/d.lst new file mode 100644 index 000000000000..9d429454ebba --- /dev/null +++ b/setup_native/prj/d.lst @@ -0,0 +1,53 @@ +mkdir: %_DEST%\bin%_EXT%\osl +..\%__SRC%\bin\*.dll %_DEST%\bin%_EXT%\*.dll +..\%__SRC%\bin\*.exe %_DEST%\bin%_EXT%\*.exe +..\%__SRC%\class\*.jar %_DEST%\bin%_EXT%\*.jar + +mkdir: %_DEST%\bin%_EXT%\userscripts +..\%__SRC%\bin\install %_DEST%\bin%_EXT%\userscripts\install +..\%__SRC%\bin\uninstall %_DEST%\bin%_EXT%\userscripts\uninstall +..\%__SRC%\bin\noarch\fake-db-1.0-0.noarch.rpm %_DEST%\bin%_EXT%\openoffice.org-userland-1.0-0.noarch.rpm + +mkdir: %_DEST%\bin%_EXT%\osolsmf +..\%__SRC%\bin\ulfconv %_DEST%\bin%_EXT%\ulfconv +..\%__SRC%\bin\langpackscript.sh %_DEST%\bin%_EXT%\langpackscript.sh +..\%__SRC%\bin\linuxpatchscript.sh %_DEST%\bin%_EXT%\linuxpatchscript.sh +..\%__SRC%\bin\downloadscript.sh %_DEST%\bin%_EXT%\downloadscript.sh +..\%__SRC%\bin\register_extensions %_DEST%\bin%_EXT%\register_extensions +..\%__SRC%\bin\deregister_extensions %_DEST%\bin%_EXT%\deregister_extensions +..\%__SRC%\bin\unpack_update.sh %_DEST%\bin%_EXT%\unpack_update +..\%__SRC%\bin\update.sh %_DEST%\bin%_EXT%\update +..\%__SRC%\bin\javaloader.sh %_DEST%\bin%_EXT%\javaloader.sh +..\%__SRC%\bin\stclient_wrapper.sh %_DEST%\bin%_EXT%\stclient_wrapper +..\%__SRC%\bin\stclient_wrapper.exe %_DEST%\bin%_EXT%\stclient_wrapper.exe +..\%__SRC%\misc\mac_ulffiles_dest\*.ulf %_DEST%\bin%_EXT%\*.ulf +..\source\win32\msi-encodinglist.txt %_DEST%\bin%_EXT%\msi-encodinglist.txt +..\source\win32\patchlist.txt %_DEST%\bin%_EXT%\patchlist.txt +..\source\win32\desktophelper.txt %_DEST%\bin%_EXT%\desktophelper.txt +..\source\win32\get_retval.bat %_DEST%\bin%_EXT%\get_retval.bat +..\source\win32\nsis\downloadtemplate.nsi %_DEST%\bin%_EXT%\downloadtemplate.nsi +..\source\win32\nsis\*.ico %_DEST%\bin%_EXT%\*.ico +..\source\win32\nsis\*.bmp %_DEST%\bin%_EXT%\*.bmp +..\source\linux\*.dat %_DEST%\bin%_EXT%\*.dat +..\source\mac\*.icns %_DEST%\bin%_EXT%\*.icns +..\source\mac\Info.plist.langpack %_DEST%\bin%_EXT%\Info.plist.langpack +..\source\java\openofficeorg_setup.gif %_DEST%\bin%_EXT%\osl\Setup.gif +..\source\java\javaversion.dat %_DEST%\bin%_EXT%\javaversion.dat +..\source\java\javaversion2.dat %_DEST%\bin%_EXT%\javaversion2.dat +..\source\opensolaris\bundledextensions\installed %_DEST%\bin%_EXT%\osolsmf\installed +..\source\opensolaris\bundledextensions\README %_DEST%\bin%_EXT%\osolsmf\README +..\source\opensolaris\bundledextensions\ooo_bundled_extensions.xml %_DEST%\bin%_EXT%\osolsmf\ooo_bundled_extensions.xml +..\source\opensolaris\bundledextensions\svc-ooo_bundled_extensions %_DEST%\bin%_EXT%\osolsmf\svc-ooo_bundled_extensions +..\source\packinfo\solariscopyrightfile %_DEST%\bin%_EXT%\solariscopyrightfile +..\source\packinfo\*.txt %_DEST%\bin%_EXT%\*.txt +..\source\packinfo\*.pcp %_DEST%\bin%_EXT%\*.pcp +..\scripts\admin.pl %_DEST%\bin%_EXT%\admin.pl +..\scripts\*.txt %_DEST%\bin%_EXT%\*.txt +..\scripts\mac_install.script %_DEST%\bin%_EXT%\mac_install.script +..\scripts\osx_install_languagepack.applescript %_DEST%\bin%_EXT%\osx_install_languagepack.applescript +..\scripts\osx_install_patch.applescript %_DEST%\bin%_EXT%\osx_install_patch.applescript + +..\%__SRC%\lib\getuid.so %_DEST%\bin%_EXT%\getuid.so + +..\inc\setup_native\qswin32.h %_DEST%\inc%_EXT%\setup_native\qswin32.h + diff --git a/setup_native/scripts/admin.pl b/setup_native/scripts/admin.pl new file mode 100644 index 000000000000..77a7f18fbc7d --- /dev/null +++ b/setup_native/scripts/admin.pl @@ -0,0 +1,1389 @@ +#************************************************************************* +# +# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. +# +# Copyright 2000, 2010 Oracle and/or its affiliates. +# +# OpenOffice.org - a multi-platform office productivity suite +# +# This file is part of OpenOffice.org. +# +# OpenOffice.org is free software: you can redistribute it and/or modify +# it under the terms of the GNU Lesser General Public License version 3 +# only, as published by the Free Software Foundation. +# +# OpenOffice.org is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU Lesser General Public License version 3 for more details +# (a copy is included in the LICENSE file that accompanied this code). +# +# You should have received a copy of the GNU Lesser General Public License +# version 3 along with OpenOffice.org. If not, see +# <http://www.openoffice.org/license.html> +# for a copy of the LGPLv3 License. +# +#************************************************************************* + +use Cwd; +use File::Copy; + +################################################################################# +# Global settings +################################################################################# + +BEGIN +{ + $prog = "msi installer"; + $targetdir = ""; + $databasepath = ""; + $starttime = ""; + $globaltempdirname = "ooopackaging"; + $savetemppath = ""; + $msiinfo_available = 0; + $path_displayed = 0; + $localmsidbpath = ""; + + $plat = $^O; + + if ( $plat =~ /cygwin/i ) + { + $separator = "/"; + $pathseparator = "\:"; + } + else + { + $separator = "\\"; + $pathseparator = "\;"; + } +} + +################################################################################# +# Program information +################################################################################# + +sub usage +{ + print <<Ende; +---------------------------------------------------------------------- +$prog V1.0 (c) Sun Microsystems 2009 +This program installs a Windows Installer installation set +without using msiexec.exe. The installation is comparable +with an administrative installation using the Windows Installer +service. +Required parameter: +-d Path to installation set or msi database +-t Target directory +--------------------------------------------------------------------- +Ende + exit(-1); +} + +################################################################################# +# Collecting parameter +################################################################################# + +sub getparameter +{ + if (( $#ARGV < 3 ) || ( $#ARGV > 3 )) { usage(); } + + while ( $#ARGV >= 0 ) + { + my $param = shift(@ARGV); + + if ($param eq "-t") { $targetdir = shift(@ARGV); } + elsif ($param eq "-d") { $databasepath = shift(@ARGV); } + else + { + print "\n**********************************************\n"; + print "Error: Unknows parameter: $param"; + print "\n**********************************************\n"; + usage(); + exit(-1); + } + } +} + +################################################################################# +# Checking content of parameter +################################################################################# + +sub controlparameter +{ + if ( $targetdir eq "" ) + { + print "\n******************************************************\n"; + print "Error: Target directory not defined (parameter -t)!"; + print "\n******************************************************\n"; + usage(); + exit(-1); + } + + if ( $databasepath eq "" ) + { + print "\n******************************************************\n"; + print "Error: Path to msi database not defined (parameter -d)!"; + print "\n******************************************************\n"; + usage(); + exit(-1); + } + + if ( -d $databasepath ) + { + $databasepath =~ s/\\\s*$//; + $databasepath =~ s/\/\s*$//; + + my $msifiles = find_file_with_file_extension("msi", $databasepath); + + if ( $#{$msifiles} < 0 ) { exit_program("ERROR: Did not find msi database in directory $installationdir"); } + if ( $#{$msifiles} > 0 ) { exit_program("ERROR: Did find more than one msi database in directory $installationdir"); } + + $databasepath = $databasepath . $separator . ${$msifiles}[0]; + } + + if ( ! -f $databasepath ) { exit_program("ERROR: Did not find msi database in directory $databasepath."); } + + if ( ! -d $targetdir ) { create_directories($targetdir); } +} + +############################################################################# +# The program msidb.exe can be located next to the Perl program. Then it is +# not neccessary to find it in the PATH variable. +############################################################################# + +sub check_local_msidb +{ + my $msidbname = "msidb.exe"; + my $perlprogramm = $0; + my $path = $perlprogramm; + + get_path_from_fullqualifiedname(\$path); + + $path =~ s/\\\s*$//; + $path =~ s/\/\s*$//; + + my $msidbpath = ""; + if ( $path =~ /^\s*$/ ) { $msidbpath = $msidbname; } + else { $msidbpath = $path . $separator . $msidbname; } + + if ( -f $msidbpath ) + { + $localmsidbpath = $msidbpath; + print "Using $msidbpath (next to \"admin.pl\")\n"; + } +} + +############################################################################# +# Converting a string list with separator $listseparator +# into an array +############################################################################# + +sub convert_stringlist_into_array +{ + my ( $includestringref, $listseparator ) = @_; + + my @newarray = (); + my $first; + my $last = ${$includestringref}; + + while ( $last =~ /^\s*(.+?)\Q$listseparator\E(.+)\s*$/) # "$" for minimal matching + { + $first = $1; + $last = $2; + if ( defined($ENV{'USE_SHELL'}) && $ENV{'USE_SHELL'} eq "4nt" ) { $first =~ s/\//\\/g; } + # Problem with two directly following listseparators. For example a path with two ";;" directly behind each other + $first =~ s/^$listseparator//; + push(@newarray, "$first\n"); + } + + if ( defined($ENV{'USE_SHELL'}) && $ENV{'USE_SHELL'} eq "4nt" ) { $last =~ s/\//\\/g; } + push(@newarray, "$last\n"); + + return \@newarray; +} + +######################################################### +# Checking the local system +# Checking existence of needed files in include path +######################################################### + +sub check_system_path +{ + my $onefile; + my $error = 0; + my $pathvariable = $ENV{'PATH'}; + my $local_pathseparator = $pathseparator; + + if( $^O =~ /cygwin/i ) + { # When using cygwin's perl the PATH variable is POSIX style and ... + $pathvariable = qx{cygpath -mp "$pathvariable"} ; + # has to be converted to DOS style for further use. + $local_pathseparator = ';'; + } + my $patharrayref = convert_stringlist_into_array(\$pathvariable, $local_pathseparator); + + my @needed_files_in_path = ("expand.exe"); + if ( $localmsidbpath eq "" ) { push(@needed_files_in_path, "msidb.exe"); } # not found locally -> search in path + my @optional_files_in_path = ("msiinfo.exe"); + + print("\nChecking required files:\n"); + + foreach $onefile ( @needed_files_in_path ) + { + print("...... searching $onefile ..."); + + my $fileref = get_sourcepath_from_filename_and_includepath(\$onefile, $patharrayref); + + if ( $$fileref eq "" ) + { + $error = 1; + print( "$onefile not found\n" ); + } + else + { + print( "\tFound: $$fileref\n" ); + } + } + + if ( $error ) { exit_program("ERROR: Could not find all needed files in path (using setsolar should help)!"); } + + print("\nChecking optional files:\n"); + + foreach $onefile ( @optional_files_in_path ) + { + print("...... searching $onefile ..."); + + my $fileref = get_sourcepath_from_filename_and_includepath(\$onefile, $patharrayref); + + if ( $$fileref eq "" ) + { + print( "$onefile not found\n" ); + if ( $onefile eq "msiinfo.exe" ) { $msiinfo_available = 0; } + } + else + { + print( "\tFound: $$fileref\n" ); + if ( $onefile eq "msiinfo.exe" ) { $msiinfo_available = 1; } + } + } + +} + +########################################################################## +# Searching a file in a list of pathes +########################################################################## + +sub get_sourcepath_from_filename_and_includepath +{ + my ($searchfilenameref, $includepatharrayref) = @_; + + my $onefile = ""; + my $foundsourcefile = 0; + + for ( my $j = 0; $j <= $#{$includepatharrayref}; $j++ ) + { + my $includepath = ${$includepatharrayref}[$j]; + $includepath =~ s/^\s*//; + $includepath =~ s/\s*$//; + + $onefile = $includepath . $separator . $$searchfilenameref; + + if ( -f $onefile ) + { + $foundsourcefile = 1; + last; + } + } + + if (!($foundsourcefile)) { $onefile = ""; } + + return \$onefile; +} + +######################################################## +# Finding all files with a specified file extension +# in a specified directory. +######################################################## + +sub find_file_with_file_extension +{ + my ($extension, $dir) = @_; + + my @allfiles = (); + my @sourcefiles = (); + + $dir =~ s/\Q$separator\E\s*$//; + + opendir(DIR, $dir); + @sourcefiles = readdir(DIR); + closedir(DIR); + + my $onefile; + + foreach $onefile (@sourcefiles) + { + if ((!($onefile eq ".")) && (!($onefile eq ".."))) + { + if ( $onefile =~ /^\s*(\S.*?)\.$extension\s*$/ ) + { + push(@allfiles, $onefile) + } + } + } + + return \@allfiles; +} + +############################################################## +# Creating a directory with all parent directories +############################################################## + +sub create_directories +{ + my ($directory) = @_; + + if ( ! try_to_create_directory($directory) ) + { + my $parentdir = $directory; + get_path_from_fullqualifiedname(\$parentdir); + create_directories($parentdir); # recursive + } + + create_directory($directory); # now it has to succeed +} + +############################################################## +# Creating one directory +############################################################## + +sub create_directory +{ + my ($directory) = @_; + + if ( ! -d $directory ) { mkdir($directory, 0775); } +} + +############################################################## +# Trying to create a directory, no error if this fails +############################################################## + +sub try_to_create_directory +{ + my ($directory) = @_; + + my $returnvalue = 1; + my $created_directory = 0; + + if (!(-d $directory)) + { + $returnvalue = mkdir($directory, 0775); + + if ($returnvalue) + { + $created_directory = 1; + + if ( defined $ENV{'USE_SHELL'} && $ENV{'USE_SHELL'} ne "4nt" ) + { + my $localcall = "chmod 775 $directory \>\/dev\/null 2\>\&1"; + system($localcall); + } + } + else + { + $created_directory = 0; + } + } + else + { + $created_directory = 1; + } + + return $created_directory; +} + +########################################### +# Getting path from full file name +########################################### + +sub get_path_from_fullqualifiedname +{ + my ($longfilenameref) = @_; + + if ( $$longfilenameref =~ /\Q$separator\E/ ) # Is there a separator in the path? Otherwise the path is empty. + { + if ( $$longfilenameref =~ /^\s*(\S.*\Q$separator\E)(\S.+\S?)/ ) + { + $$longfilenameref = $1; + } + } + else + { + $$longfilenameref = ""; # there is no path + } +} + +############################################################## +# Getting file name from full file name +############################################################## + +sub make_absolute_filename_to_relative_filename +{ + my ($longfilenameref) = @_; + + # Either '/' or '\'. + if ( $$longfilenameref =~ /^.*[\/\\](\S.+\S?)/ ) + { + $$longfilenameref = $1; + } +} + +############################################ +# Exiting the program with an error +# This function is used instead of "die" +############################################ + +sub exit_program +{ + my ($message) = @_; + + print "\n***************************************************************\n"; + print "$message\n"; + print "***************************************************************\n"; + remove_complete_directory($savetemppath, 1); + print "\n" . get_time_string(); + exit(-1); +} + +################################################################################# +# Unpacking cabinet files with expand +################################################################################# + +sub unpack_cabinet_file +{ + my ($cabfilename, $unpackdir) = @_; + + my $expandfile = "expand.exe"; # has to be in the PATH + + # expand.exe has to be located in the system directory. + # Cygwin has another tool expand.exe, that converts tabs to spaces. This cannot be used of course. + # But this wrong expand.exe is typically in the PATH before this expand.exe, to unpack + # cabinet files. + + if ( $^O =~ /cygwin/i ) + { + $expandfile = $ENV{'SYSTEMROOT'} . "/system32/expand.exe"; # Has to be located in the systemdirectory + $expandfile =~ s/\\/\//; + if ( ! -f $expandfile ) { exit_program("ERROR: Did not find file $expandfile in the Windows system folder!"); } + } + + my $expandlogfile = $unpackdir . $separator . "expand.log"; + + # exclude cabinet file + # my $systemcall = $cabarc . " -o X " . $mergemodulehash->{'cabinetfile'}; + + my $systemcall = ""; + if ( $^O =~ /cygwin/i ) { + my $localunpackdir = qx{cygpath -w "$unpackdir"}; + $localunpackdir =~ s/\\/\\\\/g; + + my $localcabfilename = qx{cygpath -w "$cabfilename"}; + $localcabfilename =~ s/\\/\\\\/g; + $localcabfilename =~ s/\s*$//g; + + $systemcall = $expandfile . " " . $localcabfilename . " -F:\* " . $localunpackdir . " \>\/dev\/null 2\>\&1"; + } + else + { + $systemcall = $expandfile . " " . $cabfilename . " -F:\* " . $unpackdir . " \> " . $expandlogfile; + } + + my $returnvalue = system($systemcall); + + if ($returnvalue) { exit_program("ERROR: Could not execute $systemcall !"); } +} + +################################################################################# +# Extracting tables from msi database +################################################################################# + +sub extract_tables_from_database +{ + my ($fullmsidatabasepath, $workdir, $tablelist) = @_; + + my $msidb = "msidb.exe"; # Has to be in the path + if ( $localmsidbpath ) { $msidb = $localmsidbpath; } + my $infoline = ""; + my $systemcall = ""; + my $returnvalue = ""; + + if ( $^O =~ /cygwin/i ) { + chomp( $fullmsidatabasepath = qx{cygpath -w "$fullmsidatabasepath"} ); + # msidb.exe really wants backslashes. (And double escaping because system() expands the string.) + $fullmsidatabasepath =~ s/\\/\\\\/g; + $workdir =~ s/\\/\\\\/g; + # and if there are still slashes, they also need to be double backslash + $fullmsidatabasepath =~ s/\//\\\\/g; + $workdir =~ s/\//\\\\/g; + } + + # Export of all tables by using "*" + + $systemcall = $msidb . " -d " . $fullmsidatabasepath . " -f " . $workdir . " -e $tablelist"; + print "\nAnalyzing msi database\n"; + $returnvalue = system($systemcall); + + if ($returnvalue) + { + $infoline = "ERROR: Could not execute $systemcall !\n"; + exit_program($infoline); + } +} + +######################################################## +# Check, if this installation set contains +# internal cabinet files included into the msi +# database. +######################################################## + +sub check_for_internal_cabfiles +{ + my ($cabfilehash) = @_; + + my $contains_internal_cabfiles = 0; + my %allcabfileshash = (); + + foreach my $filename ( keys %{$cabfilehash} ) + { + if ( $filename =~ /^\s*\#/ ) # starting with a hash + { + $contains_internal_cabfiles = 1; + # setting real filename without hash as key and name with hash as value + my $realfilename = $filename; + $realfilename =~ s/^\s*\#//; + $allcabfileshash{$realfilename} = $filename; + } + } + + return ( $contains_internal_cabfiles, \%allcabfileshash ); +} + +################################################################# +# Exclude all cab files from the msi database. +################################################################# + +sub extract_cabs_from_database +{ + my ($msidatabase, $allcabfiles) = @_; + + my $infoline = ""; + my $fullsuccess = 1; + my $msidb = "msidb.exe"; # Has to be in the path + if ( $localmsidbpath ) { $msidb = $localmsidbpath; } + + my @all_excluded_cabfiles = (); + + if( $^O =~ /cygwin/i ) + { + $msidatabase = qx{cygpath -w "$msidatabase"}; + $msidatabase =~ s/\\/\\\\/g; + $msidatabase =~ s/\s*$//g; + } + else + { + # msidb.exe really wants backslashes. (And double escaping because system() expands the string.) + $msidatabase =~ s/\//\\\\/g; + } + + foreach my $onefile ( keys %{$allcabfiles} ) + { + my $systemcall = $msidb . " -d " . $msidatabase . " -x " . $onefile; + system($systemcall); + push(@all_excluded_cabfiles, $onefile); + } + + \@all_excluded_cabfiles; +} + +################################################################################ +# Collect all DiskIds to the corresponding cabinet files from Media.idt. +################################################################################ + +sub analyze_media_file +{ + my ($filecontent) = @_; + + my %diskidhash = (); + + for ( my $i = 0; $i <= $#{$filecontent}; $i++ ) + { + if ( $i < 3 ) { next; } + + if ( ${$filecontent}[$i] =~ /^\s*(.*?)\t(.*?)\t(.*?)\t(.*?)\t(.*?)\t(.*?)\s*$/ ) + { + my $diskid = $1; + my $cabfile = $4; + + $diskidhash{$cabfile} = $diskid; + } + } + + return \%diskidhash; +} + +sub analyze_customaction_file +{ + my ($filecontent) = @_; + + my $register_extensions_exists = 0; + + my %table = (); + + for ( my $i = 0; $i <= $#{$filecontent}; $i++ ) + { + if ( ${$filecontent}[$i] =~ /^\s*RegisterExtensions\s+/ ) + { + $register_extensions_exists = 1; + last; + } + } + + return $register_extensions_exists; +} + +################################################################################ +# Analyzing the content of Directory.idt +################################################################################# + +sub analyze_directory_file +{ + my ($filecontent) = @_; + + my %table = (); + + for ( my $i = 0; $i <= $#{$filecontent}; $i++ ) + { + if (( $i == 0 ) || ( $i == 1 ) || ( $i == 2 )) { next; } + + if ( ${$filecontent}[$i] =~ /^\s*(.*?)\t(.*?)\t(.*?)\s*$/ ) + { + my $dir = $1; + my $parent = $2; + my $name = $3; + + if ( $name =~ /^\s*(.*?)\s*\:\s*(.*?)\s*$/ ) { $name = $2; } + if ( $name =~ /^\s*(.*?)\s*\|\s*(.*?)\s*$/ ) { $name = $2; } + + my %helphash = (); + $helphash{'Directory_Parent'} = $parent; + $helphash{'DefaultDir'} = $name; + $table{$dir} = \%helphash; + } + } + + return \%table; +} + +################################################################################# +# Analyzing the content of Component.idt +################################################################################# + +sub analyze_component_file +{ + my ($filecontent) = @_; + + my %table = (); + + for ( my $i = 0; $i <= $#{$filecontent}; $i++ ) + { + if (( $i == 0 ) || ( $i == 1 ) || ( $i == 2 )) { next; } + + if ( ${$filecontent}[$i] =~ /^\s*(.*?)\t(.*?)\t(.*?)\t(.*?)\t(.*?)\t(.*?)\s*$/ ) + { + my $component = $1; + my $dir = $3; + + $table{$component} = $dir; + } + } + + return \%table; +} + +################################################################################# +# Analyzing the content of File.idt +################################################################################# + +sub analyze_file_file +{ + my ($filecontent) = @_; + + my %table = (); + my %fileorder = (); + my $maxsequence = 0; + + for ( my $i = 0; $i <= $#{$filecontent}; $i++ ) + { + if (( $i == 0 ) || ( $i == 1 ) || ( $i == 2 )) { next; } + + if ( ${$filecontent}[$i] =~ /^\s*(.*?)\t(.*?)\t(.*?)\t(.*?)\t(.*?)\t(.*?)\t(.*?)\t(.*?)\s*$/ ) + { + my $file = $1; + my $comp = $2; + my $filename = $3; + my $sequence = $8; + + if ( $filename =~ /^\s*(.*?)\s*\|\s*(.*?)\s*$/ ) { $filename = $2; } + + my %helphash = (); + $helphash{'Component'} = $comp; + $helphash{'FileName'} = $filename; + $helphash{'Sequence'} = $sequence; + + $table{$file} = \%helphash; + + $fileorder{$sequence} = $file; + + if ( $sequence > $maxsequence ) { $maxsequence = $sequence; } + } + } + + return (\%table, \%fileorder, $maxsequence); +} + +#################################################################################### +# Recursively creating the directory tree +#################################################################################### + +sub create_directory_tree +{ + my ($parent, $pathcollector, $fulldir, $dirhash) = @_; + + foreach my $dir ( keys %{$dirhash} ) + { + if (( $dirhash->{$dir}->{'Directory_Parent'} eq $parent ) && ( $dirhash->{$dir}->{'DefaultDir'} ne "." )) + { + my $dirname = $dirhash->{$dir}->{'DefaultDir'}; + # Create the directory + my $newdir = $fulldir . $separator . $dirname; + if ( ! -f $newdir ) { mkdir $newdir; } + # Saving in collector + $pathcollector->{$dir} = $newdir; + # Iteration + create_directory_tree($dir, $pathcollector, $newdir, $dirhash); + } + } +} + +#################################################################################### +# Creating the directory tree +#################################################################################### + +sub create_directory_structure +{ + my ($dirhash, $targetdir) = @_; + + print "Creating directories\n"; + + my %fullpathhash = (); + + my @startparents = ("TARGETDIR", "INSTALLLOCATION"); + + foreach $dir (@startparents) { create_directory_tree($dir, \%fullpathhash, $targetdir, $dirhash); } + + return \%fullpathhash; +} + +#################################################################################### +# Cygwin: Setting privileges for files +#################################################################################### + +sub change_privileges +{ + my ($destfile, $privileges) = @_; + + my $localcall = "chmod $privileges " . "\"" . $destfile . "\""; + system($localcall); +} + +#################################################################################### +# Cygwin: Setting privileges for files recursively +#################################################################################### + +sub change_privileges_full +{ + my ($target) = @_; + + print "Changing privileges\n"; + + my $localcall = "chmod -R 755 " . "\"" . $target . "\""; + system($localcall); +} + +###################################################### +# Creating a new directory with defined privileges +###################################################### + +sub create_directory_with_privileges +{ + my ($directory, $privileges) = @_; + + my $returnvalue = 1; + my $infoline = ""; + + if (!(-d $directory)) + { + my $localprivileges = oct("0".$privileges); # changes "777" to 0777 + $returnvalue = mkdir($directory, $localprivileges); + + if ($returnvalue) + { + if ( defined $ENV{'USE_SHELL'} && $ENV{'USE_SHELL'} ne "4nt" ) + { + my $localcall = "chmod $privileges $directory \>\/dev\/null 2\>\&1"; + system($localcall); + } + } + } + else + { + if ( defined $ENV{'USE_SHELL'} && $ENV{'USE_SHELL'} ne "4nt" ) + { + my $localcall = "chmod $privileges $directory \>\/dev\/null 2\>\&1"; + system($localcall); + } + } +} + +###################################################### +# Creating a unique directory with pid extension +###################################################### + +sub create_pid_directory +{ + my ($directory) = @_; + + $directory =~ s/\Q$separator\E\s*$//; + my $pid = $$; # process id + my $time = time(); # time + + $directory = $directory . "_" . $pid . $time; + + if ( ! -d $directory ) { create_directory($directory); } + else { exit_program("ERROR: Directory $directory already exists!"); } + + return $directory; +} + +#################################################################################### +# Copying files into installation set +#################################################################################### + +sub copy_files_into_directory_structure +{ + my ($fileorder, $filehash, $componenthash, $fullpathhash, $maxsequence, $unpackdir, $installdir, $dirhash) = @_; + + print "Copying files\n"; + + my $unopkgfile = ""; + my @extensions = (); + + for ( my $i = 1; $i <= $maxsequence; $i++ ) + { + if ( exists($fileorder->{$i}) ) + { + my $file = $fileorder->{$i}; + if ( ! exists($filehash->{$file}->{'Component'}) ) { exit_program("ERROR: Did not find component for file: \"$file\"."); } + my $component = $filehash->{$file}->{'Component'}; + if ( ! exists($componenthash->{$component}) ) { exit_program("ERROR: Did not find directory for component: \"$component\"."); } + my $dirname = $componenthash->{$component}; + if ( ! exists($fullpathhash->{$dirname}) ) { exit_program("ERROR: Did not find full directory path for dir: \"$dirname\"."); } + my $destdir = $fullpathhash->{$dirname}; + if ( ! exists($filehash->{$file}->{'FileName'}) ) { exit_program("ERROR: Did not find \"FileName\" for file: \"$file\"."); } + my $destfile = $filehash->{$file}->{'FileName'}; + + $destfile = $destdir . $separator . $destfile; + my $sourcefile = $unpackdir . $separator . $file; + + if ( ! -f $sourcefile ) + { + # It is possible, that this was an unpacked file + # Looking in the dirhash, to find the subdirectory in the installation set (the id is $dirname) + # subdir is not recursively analyzed, only one directory. + + my $oldsourcefile = $sourcefile; + my $subdir = ""; + if ( exists($dirhash->{$dirname}->{'DefaultDir'}) ) { $subdir = $dirhash->{$dirname}->{'DefaultDir'} . $separator; } + my $realfilename = $filehash->{$file}->{'FileName'}; + my $localinstalldir = $installdir; + + $localinstalldir =~ s/\\\s*$//; + $localinstalldir =~ s/\/\s*$//; + + $sourcefile = $localinstalldir . $separator . $subdir . $realfilename; + + if ( ! -f $sourcefile ) { exit_program("ERROR: File not found: \"$oldsourcefile\" (or \"$sourcefile\")."); } + } + + my $copyreturn = copy($sourcefile, $destfile); + + if ( ! $copyreturn) { exit_program("ERROR: Could not copy $source to $dest\n"); } + + # Collecting all extensions + if ( $destfile =~ /\.oxt\s*$/ ) { push(@extensions, $destfile); } + # Searching unopkg.exe + if ( $destfile =~ /unopkg\.exe\s*$/ ) { $unopkgfile = $destfile; } + # if (( $^O =~ /cygwin/i ) && ( $destfile =~ /\.exe\s*$/ )) { change_privileges($destfile, "775"); } + } + # else # allowing missing sequence numbers ? + # { + # exit_program("ERROR: No file assigned to sequence $i"); + # } + } + + return ($unopkgfile, \@extensions); +} + +###################################################### +# Removing a complete directory with subdirectories +###################################################### + +sub remove_complete_directory +{ + my ($directory, $start) = @_; + + my @content = (); + my $infoline = ""; + + $directory =~ s/\Q$separator\E\s*$//; + + if ( -d $directory ) + { + if ( $start ) { print "Removing directory $directory\n"; } + + opendir(DIR, $directory); + @content = readdir(DIR); + closedir(DIR); + + my $oneitem; + + foreach $oneitem (@content) + { + if ((!($oneitem eq ".")) && (!($oneitem eq ".."))) + { + my $item = $directory . $separator . $oneitem; + + if ( -f $item || -l $item ) # deleting files or links + { + unlink($item); + } + + if ( -d $item ) # recursive + { + remove_complete_directory($item, 0); + } + } + } + + # try to remove empty directory + my $returnvalue = rmdir $directory; + if ( ! $returnvalue ) { print "Warning: Problem with removing empty dir $directory\n"; } + } +} + +#################################################################################### +# Defining a temporary path +#################################################################################### + +sub get_temppath +{ + my $temppath = ""; + + if (( $ENV{'TMP'} ) || ( $ENV{'TEMP'} )) + { + if ( $ENV{'TMP'} ) { $temppath = $ENV{'TMP'}; } + elsif ( $ENV{'TEMP'} ) { $temppath = $ENV{'TEMP'}; } + + $temppath =~ s/\Q$separator\E\s*$//; # removing ending slashes and backslashes + $temppath = $temppath . $separator . $globaltempdirname; + create_directory_with_privileges($temppath, "777"); + + my $dirsave = $temppath; + + $temppath = $temppath . $separator . "a"; + $temppath = create_pid_directory($temppath); + + if ( ! -d $temppath ) { exit_program("ERROR: Failed to create directory $temppath ! Possible reason: Wrong privileges in directory $dirsave."); } + + if ( $^O =~ /cygwin/i ) + { + $temppath =~ s/\\/\\\\/g; + chomp( $temppath = qx{cygpath -w "$temppath"} ); + } + + $savetemppath = $temppath; + } + else + { + exit_program("ERROR: Could not set temporary directory (TMP and TEMP not set!)."); + } + + return $temppath; +} + +#################################################################################### +# Registering one extension +#################################################################################### + +sub register_one_extension +{ + my ($unopkgfile, $extension, $temppath) = @_; + + my $from = cwd(); + + my $path = $unopkgfile; + get_path_from_fullqualifiedname(\$path); + $path =~ s/\\\s*$//; + $path =~ s/\/\s*$//; + + my $executable = $unopkgfile; + make_absolute_filename_to_relative_filename(\$executable); + + chdir($path); + + if ( ! $path_displayed ) + { + print "... current dir: $path ...\n"; + $path_displayed = 1; + } + + $temppath =~ s/\\/\//g; + $temppath = "/".$temppath; + + # Converting path of $extension for cygwin + + my $localextension = $extension; + if ( $^O =~ /cygwin/i ) { + $localextension = qx{cygpath -w "$extension"}; + $localextension =~ s/\\/\\\\/g; + } + + if ( $^O =~ /cygwin/i ) { + $executable = "./" . $executable; + } + + my $systemcall = $executable . " add --shared --verbose --suppress-license " . "\"" . $localextension . "\"" . " -env:UserInstallation=file://" . $temppath . " 2\>\&1 |"; + + print "... $systemcall\n"; + + my @unopkgoutput = (); + + open (UNOPKG, $systemcall); + while (<UNOPKG>) {push(@unopkgoutput, $_); } + close (UNOPKG); + + my $returnvalue = $?; # $? contains the return value of the systemcall + + if ($returnvalue) + { + print "ERROR: Could not execute \"$systemcall\"!\nExitcode: '$returnvalue'\n"; + for ( my $j = 0; $j <= $#unopkgoutput; $j++ ) { print "$unopkgoutput[$j]"; } + exit_program("ERROR: $systemcall failed!"); + } + + chdir($from); +} + +#################################################################################### +# Registering all extensions located in /share/extension/install +#################################################################################### + +sub register_extensions +{ + my ($unopkgfile, $extensions, $temppath) = @_; + + if ( $#{$extensions} > -1 ) + { + print "Registering extensions:\n"; + + if (( ! -f $unopkgfile ) || ( $unopkgfile eq "" )) + { + print("WARNING: Could not find unopkg.exe (Language Pack?)!\n"); + } + else + { + foreach $extension ( @{$extensions} ) { register_one_extension($unopkgfile, $extension, $temppath); } + remove_complete_directory($temppath, 1) + } + } + else + { + print "No extensions to register.\n"; + } +} + +#################################################################################### +# Reading one file +#################################################################################### + +sub read_file +{ + my ($localfile) = @_; + + my @localfile = (); + + open( IN, "<$localfile" ) || exit_program("ERROR: Cannot open file $localfile for reading"); + + # Don't use "my @localfile = <IN>" here, because + # perl has a problem with the internal "large_and_huge_malloc" function + # when calling perl using MacOS 10.5 with a perl built with MacOS 10.4 + while ( $line = <IN> ) { + push @localfile, $line; + } + + close( IN ); + + return \@localfile; +} + +############################################################### +# Setting the time string for the +# Summary Information stream in the +# msi database of the admin installations. +############################################################### + +sub get_sis_time_string +{ + # Syntax: <yyyy/mm/dd hh:mm:ss> + my $second = (localtime())[0]; + my $minute = (localtime())[1]; + my $hour = (localtime())[2]; + my $day = (localtime())[3]; + my $month = (localtime())[4]; + my $year = 1900 + (localtime())[5]; + $month++; + + if ( $second < 10 ) { $second = "0" . $second; } + if ( $minute < 10 ) { $minute = "0" . $minute; } + if ( $hour < 10 ) { $hour = "0" . $hour; } + if ( $day < 10 ) { $day = "0" . $day; } + if ( $month < 10 ) { $month = "0" . $month; } + + my $timestring = $year . "/" . $month . "/" . $day . " " . $hour . ":" . $minute . ":" . $second; + + return $timestring; +} + +############################################################### +# Writing content of administrative installations into +# Summary Information Stream of msi database. +# This is required for example for following +# patch processes using Windows Installer service. +############################################################### + +sub write_sis_info +{ + my ($msidatabase) = @_; + + print "Setting SIS in msi database\n"; + + if ( ! -f $msidatabase ) { exit_program("ERROR: Cannot find file $msidatabase"); } + + my $msiinfo = "msiinfo.exe"; # Has to be in the path + my $infoline = ""; + my $systemcall = ""; + my $returnvalue = ""; + + # Required setting for administrative installations: + # -w 4 (source files are unpacked), wordcount + # -s <date of admin installation>, LastPrinted, Syntax: <yyyy/mm/dd hh:mm:ss> + # -l <person_making_admin_installation>, LastSavedBy + + my $wordcount = 4; # Unpacked files + my $lastprinted = get_sis_time_string(); + my $lastsavedby = "Installer"; + + my $localmsidatabase = $msidatabase; + + if( $^O =~ /cygwin/i ) + { + $localmsidatabase = qx{cygpath -w "$localmsidatabase"}; + $localmsidatabase =~ s/\\/\\\\/g; + $localmsidatabase =~ s/\s*$//g; + } + + $systemcall = $msiinfo . " " . "\"" . $localmsidatabase . "\"" . " -w " . $wordcount . " -s " . "\"" . $lastprinted . "\"" . " -l $lastsavedby"; + + $returnvalue = system($systemcall); + + if ($returnvalue) + { + $infoline = "ERROR: Could not execute $systemcall !\n"; + exit_program($infoline); + } +} + +############################################################### +# Convert time string +############################################################### + +sub convert_timestring +{ + my ($secondstring) = @_; + + my $timestring = ""; + + if ( $secondstring < 60 ) # less than a minute + { + if ( $secondstring < 10 ) { $secondstring = "0" . $secondstring; } + $timestring = "00\:$secondstring min\."; + } + elsif ( $secondstring < 3600 ) + { + my $minutes = $secondstring / 60; + my $seconds = $secondstring % 60; + if ( $minutes =~ /(\d*)\.\d*/ ) { $minutes = $1; } + if ( $minutes < 10 ) { $minutes = "0" . $minutes; } + if ( $seconds < 10 ) { $seconds = "0" . $seconds; } + $timestring = "$minutes\:$seconds min\."; + } + else # more than one hour + { + my $hours = $secondstring / 3600; + my $secondstring = $secondstring % 3600; + my $minutes = $secondstring / 60; + my $seconds = $secondstring % 60; + if ( $hours =~ /(\d*)\.\d*/ ) { $hours = $1; } + if ( $minutes =~ /(\d*)\.\d*/ ) { $minutes = $1; } + if ( $hours < 10 ) { $hours = "0" . $hours; } + if ( $minutes < 10 ) { $minutes = "0" . $minutes; } + if ( $seconds < 10 ) { $seconds = "0" . $seconds; } + $timestring = "$hours\:$minutes\:$seconds hours"; + } + + return $timestring; +} + +############################################################### +# Returning time string for logging +############################################################### + +sub get_time_string +{ + my $currenttime = time(); + $currenttime = $currenttime - $starttime; + $currenttime = convert_timestring($currenttime); + $currenttime = localtime() . " \(" . $currenttime . "\)\n"; + return $currenttime; +} + +#################################################################################### +# Simulating an administrative installation +#################################################################################### + +$starttime = time(); + +getparameter(); +controlparameter(); +check_local_msidb(); +check_system_path(); +my $temppath = get_temppath(); + +print("\nmsi database: $databasepath\n"); +print("Destination directory: $targetdir\n" ); + +my $helperdir = $temppath . $separator . "installhelper"; +create_directory($helperdir); + +# Get File.idt, Component.idt and Directory.idt from database + +my $tablelist = "File Directory Component Media CustomAction"; +extract_tables_from_database($databasepath, $helperdir, $tablelist); + +# Set unpackdir +my $unpackdir = $helperdir . $separator . "unpack"; +create_directory($unpackdir); + +# Reading media table to check for internal cabinet files +my $filename = $helperdir . $separator . "Media.idt"; +if ( ! -f $filename ) { exit_program("ERROR: Could not find required file: $filename !"); } +my $filecontent = read_file($filename); +my $cabfilehash = analyze_media_file($filecontent); + +# Check, if there are internal cab files +my ( $contains_internal_cabfiles, $all_internal_cab_files) = check_for_internal_cabfiles($cabfilehash); + +if ( $contains_internal_cabfiles ) +{ + # Set unpackdir + my $cabdir = $helperdir . $separator . "internal_cabs"; + create_directory($cabdir); + my $from = cwd(); + chdir($cabdir); + # Exclude all cabinet files from database + my $all_excluded_cabs = extract_cabs_from_database($databasepath, $all_internal_cab_files); + print "Unpacking files from internal cabinet file(s)\n"; + foreach my $cabfile ( @{$all_excluded_cabs} ) { unpack_cabinet_file($cabfile, $unpackdir); } + chdir($from); +} + +# Unpack all cab files into $helperdir, cab files must be located next to msi database +my $installdir = $databasepath; + +get_path_from_fullqualifiedname(\$installdir); + +my $databasefilename = $databasepath; +make_absolute_filename_to_relative_filename(\$databasefilename); + +my $cabfiles = find_file_with_file_extension("cab", $installdir); + +if (( $#{$cabfiles} < 0 ) && ( ! $contains_internal_cabfiles )) { exit_program("ERROR: Did not find any cab file in directory $installdir"); } + +print "Unpacking files from cabinet file(s)\n"; +for ( my $i = 0; $i <= $#{$cabfiles}; $i++ ) +{ + my $cabfile = $installdir . $separator . ${$cabfiles}[$i]; + unpack_cabinet_file($cabfile, $unpackdir); +} + +# Reading tables +$filename = $helperdir . $separator . "Directory.idt"; +$filecontent = read_file($filename); +my $dirhash = analyze_directory_file($filecontent); + +$filename = $helperdir . $separator . "Component.idt"; +$filecontent = read_file($filename); +my $componenthash = analyze_component_file($filecontent); + +$filename = $helperdir . $separator . "File.idt"; +$filecontent = read_file($filename); +my ( $filehash, $fileorder, $maxsequence ) = analyze_file_file($filecontent); + +# Creating the directory structure +my $fullpathhash = create_directory_structure($dirhash, $targetdir); + +# Copying files +my ($unopkgfile, $extensions) = copy_files_into_directory_structure($fileorder, $filehash, $componenthash, $fullpathhash, $maxsequence, $unpackdir, $installdir, $dirhash); +if ( $^O =~ /cygwin/i ) { change_privileges_full($targetdir); } + +my $msidatabase = $targetdir . $separator . $databasefilename; +my $copyreturn = copy($databasepath, $msidatabase); +if ( ! $copyreturn) { exit_program("ERROR: Could not copy $source to $dest\n"); } + +# Reading tables +$filename = $helperdir . $separator . "CustomAction.idt"; +$filecontent = read_file($filename); +my $register_extensions_exists = analyze_customaction_file($filecontent); + +if ( $register_extensions_exists ) +{ + # Registering extensions + register_extensions($unopkgfile, $extensions, $temppath); +} + +# Saving info in Summary Information Stream of msi database (required for following patches) +if ( $msiinfo_available ) { write_sis_info($msidatabase); } + +# Removing the helper directory +remove_complete_directory($temppath, 1); + +print "\nSuccessful installation: " . get_time_string(); diff --git a/setup_native/scripts/deregister_extensions b/setup_native/scripts/deregister_extensions new file mode 100644 index 000000000000..4a8f91de41f0 --- /dev/null +++ b/setup_native/scripts/deregister_extensions @@ -0,0 +1,78 @@ +#!/bin/bash + +USAGE="Usage: $0" + +SCRIPTNAME=`basename "$0"` +PROGRAMDIR=`dirname "$0"` +OFFICEDIR="$PROGRAMDIR/.." +EXTENSIONDIR=$OFFICEDIR/share/extension/install +UNOPKG=$PROGRAMDIR/unopkg + +help() +{ + echo + echo "Uninstallation script for office extensions located in <office>/share/extension/install" + echo + echo "This uninstallation script can be executed after successful installation of packages." + echo "Please execute this script, before uninstallation of packages." + echo "Usage: $0" + echo "No parameter required." + echo +} + +# +# This script is only for root installations +# (How about installations done with user privileges?) +# + +# if [ $UID -ne 0 ] +# then +# printf "\nThis script is for installation only wiht administrative rights only\n" +# help +# exit 2 +# fi + +# +# Checking existence of unopkg in program directory +# + +if [ ! -f "$UNOPKG" ]; then + echo "Error: File $UNOPKG does not exist" + exit 1 +fi + +if [ ! -x "$UNOPKG" ]; then + echo "Error: File $UNOPKG is not an executable file" + exit 1 +fi + +# +# Collecting all files located in share/install/extensions +# + +FILELIST=`find $EXTENSIONDIR -type f -name "*.oxt" -print` + +if [ -z "$FILELIST" ] +then + printf "\n$0: No extensions found in $EXTENSIONDIR\n" + exit 2 +fi + +echo +echo "Uninstalling:" +for i in $FILELIST; do + echo `basename $i` +done +echo + +for i in $FILELIST; do + COMMAND="$UNOPKG remove --shared `basename $i`" + echo $COMMAND + $COMMAND +done + +echo +echo "Uninstallation done ..." +echo + +exit 0 diff --git a/setup_native/scripts/downloadscript.sh b/setup_native/scripts/downloadscript.sh new file mode 100644 index 000000000000..e138ae057dd0 --- /dev/null +++ b/setup_native/scripts/downloadscript.sh @@ -0,0 +1,87 @@ +#!/bin/sh + +linenum=LINENUMBERPLACEHOLDER + +UNPACKDIR=/var/tmp/unpack_PRODUCTNAMEPLACEHOLDER +diskSpaceRequired=DISCSPACEPLACEHOLDER +checksum=CHECKSUMPLACEHOLDER + +EXTRACTONLY="no" +if [ "$1" = "-x" ] +then + EXTRACTONLY=yes +fi + +# Determining current platform + +platform=`uname -s` + +case $platform in +SunOS) + tail_prog="tail" + ;; +Linux) + tail_prog="tail -n" + ;; +*) + tail_prog="tail" + ;; +esac + +# Asking for the unpack directory + +echo +echo "Select the directory in which to save the unpacked files. [$UNPACKDIR] " +read reply leftover +if [ "x$reply" != "x" ] +then + UNPACKDIR="$reply" +fi + +if [ -d $UNPACKDIR ]; then + printf "Directory $UNPACKDIR already exists.\n" + printf "Please select a new directory name.\n" + exit 1 +fi + +# Unpacking + +mkdir -m 700 $UNPACKDIR + +diskSpace=`df -k $UNPACKDIR | $tail_prog -1 | awk '{if ( $4 ~ /%/) { print $3 } else { print $4 } }'` +if [ $diskSpace -lt $diskSpaceRequired ]; then + printf "The selected drive does not have enough disk space available.\n" + printf "PRODUCTNAMEPLACEHOLDER requires at least %s kByte.\n" $diskSpaceRequired + exit 1 +fi + +trap 'rm -rf $UNPACKDIR; exit 1' HUP INT QUIT TERM + +if [ -x /usr/bin/sum ] ; then + echo "File is being checked for errors ..." + + sum=`$tail_prog +$linenum $0 | /usr/bin/sum` + sum=`echo $sum | awk '{ print $1 }'` + + if [ $sum != $checksum ]; then + echo "The download file appears to be corrupted. Please download PRODUCTNAMEPLACEHOLDER again." + exit 1 + fi +fi + +echo "Unpacking ..." + +$tail_prog +$linenum $0 | (cd $UNPACKDIR; tar xf -) + +echo "All files have been successfully unpacked." + +if [ "$EXTRACTONLY" != "yes" ] +then + if [ -f $UNPACKDIR/setup ] + then + chmod 775 $UNPACKDIR/setup + $UNPACKDIR/setup + fi +fi + +exit 0 diff --git a/setup_native/scripts/fake-db.spec b/setup_native/scripts/fake-db.spec new file mode 100644 index 000000000000..e6275048efe3 --- /dev/null +++ b/setup_native/scripts/fake-db.spec @@ -0,0 +1,38 @@ +Name: fake-db +Version: 1.0 +Release: 0 +Summary: This is a dummy package +Group: dummy +License: LGPL +BuildArch: noarch +AutoReqProv: no +%define _tmppath /tmp +#BuildRoot: %{_tmppath}/%{name}-root +Provides: libgnomevfs-2.so.0 +Provides: libgconf-2.so.4 +Provides: libfreetype.so.6 +Provides: /bin/sh +Provides: /bin/basename +Provides: /bin/cat +Provides: /bin/cp +Provides: /bin/gawk +Provides: /bin/grep +Provides: /bin/ln +Provides: /bin/ls +Provides: /bin/mkdir +Provides: /bin/mv +Provides: /bin/pwd +Provides: /bin/rm +Provides: /bin/sed +Provides: /bin/sort +Provides: /bin/touch +Provides: /usr/bin/cut +Provides: /usr/bin/dirname +Provides: /usr/bin/expr +Provides: /usr/bin/find +Provides: /usr/bin/tail +Provides: /usr/bin/tr +Provides: /usr/bin/wc +%description +a dummy package +%files diff --git a/setup_native/scripts/install_create.pl b/setup_native/scripts/install_create.pl new file mode 100755 index 000000000000..c49f22ddbc70 --- /dev/null +++ b/setup_native/scripts/install_create.pl @@ -0,0 +1,44 @@ +: # -*- perl -*- +eval 'exec perl -wS $0 ${1+"$@"}' + if 0; +# create setup self extracting script + +if( $#ARGV < 2 ) + { + print <<ENDHELP; +USAGE: $0 <inputshellscript> <libraryfile> <outputshellscript> + <inputshellscript>: the start shell script, located next to this perl script + <libraryfile>: the library file, that is included into the shell script + <outfile>: the target shellscript + +ENDHELP + exit; + } + +$infile = $ARGV[0]; +$library = $ARGV[1]; +$outfile = $ARGV[2]; +$infile =~ tr/[A-Z]/[a-z]/; + +# read script header +open( SCRIPT, "<$infile" ) || die "cannot open $infile"; +open( OUTFILE, ">$outfile$$.tmp" ) || die "cannot open $outfile"; +@scriptlines = <SCRIPT>; +$linenum = $#scriptlines+2; +foreach (@scriptlines) +{ + # lineend conversion (be on the safe side) + chomp; + $_ =~ tr/\r//; + s/^\s*linenum=.*$/linenum=$linenum/; + print OUTFILE "$_\n"; +} +close( SCRIPT ); +close( OUTFILE ); + +system( "cat $library >>$outfile$$.tmp" ); +rename "$outfile$$.tmp", "$outfile"; + +chmod 0775, $outfile; + +exit; diff --git a/setup_native/scripts/install_linux.sh b/setup_native/scripts/install_linux.sh new file mode 100644 index 000000000000..fe4be73f77ea --- /dev/null +++ b/setup_native/scripts/install_linux.sh @@ -0,0 +1,293 @@ +#!/bin/bash + +ADD="no" +LINK="no" +UPDATE="ask" +UNPACKDIR="" +USAGE="Usage: $0 [-a,--add] [-l,--link] [-U,--update] [-h,--help] <rpm-source-dir> <office-installation-dir>" + +help() +{ + echo + echo "User Mode Installation script for developer and knowledgeable early access tester" + echo + echo "This installation method is not intended for use in a production environment!" + echo "Using this script is unsupported and completely at your own risk" + echo + echo "Usage:" $0 [-lU] "<rpm-source-dir> <office-installation-dir>" + echo " <rpm-source-dir>: directory *only* containing the Linux rpm packages to be installed" + echo " or language pack shell script containing the rpm packages" + echo " <office-installation-dir>: directory to where the office will get installed into" + echo + echo "Optional Parameter:" + echo " -a,--add: add to an existing <office-installation-dir>" + echo " -l,--link: create a link \"soffice\" in $HOME" + echo " -U,--update: update without asking" + echo " -h,--help: output this help" + echo +} + +try_to_unpack_languagepack_file() +{ + FILENAME=$PACKAGE_PATH + + # Checking, if $FILENAME is a language pack. + # String "language package" has to exist in the shell script file. + # If this is no language pack, the installation is not supported + + SEARCHSTRING=`head --lines=10 $FILENAME | grep "language package"` + + if [ ! -z "$SEARCHSTRING" ] + then + echo "First parameter $FILENAME is a language pack"; + else + printf "\nERROR: First parameter $FILENAME is a file, but no language pack shell script.\n" + echo $USAGE + exit 2 + fi + + echo "Unpacking shell script $FILENAME" + TAILLINE=`head --lines=20 $FILENAME | sed --quiet 's/linenum=//p'` + + UNPACKDIR=/var/tmp/install_$$ + mkdir $UNPACKDIR + # UNPACKDIR=`mktemp -d` + tail -n +$TAILLINE $FILENAME | gunzip | (cd $UNPACKDIR; tar xvf -) + + # Setting the new package path, in which the packages exist + PACKAGE_PATH=$UNPACKDIR + + # Setting variable UPDATE, because an Office installation has to exist, if a language pack shall be installed + UPDATE="yes" +} + +# +# this script is for userland not for root +# + +if [ $UID -eq 0 ] +then + printf "\nThis script is for installation without administrative rights only\nPlease use rpm to install as root\n" + help + exit 2 +fi + +set -- `getopt -u -o 'alhU' -l 'add,link,help,update' -- $*` + +if [ $? != 0 ] +then + echo $USAGE + exit 2 +fi + +for i in $* +do + case $i in + -a|--add) ADD="yes"; shift;; + -h|--help) help; exit 0;; + -l|--link) LINK="yes"; shift;; + -U|--update) UPDATE="yes"; shift;; + --) shift; break;; + esac +done + +if [ $# != 2 ] +then + echo $USAGE + exit 2 +fi + +PACKAGE_PATH=$1 + +# +# If the first parameter is a shell script (download installation set), the packages have to +# be unpacked into temp directory +# + +if [ -f "$PACKAGE_PATH" ] +then + try_to_unpack_languagepack_file +fi + +# +# Check and get the list of packages to install +# + +RPMLIST=`find $PACKAGE_PATH -maxdepth 2 -type f -name "*.rpm" ! -name "*-menus-*" ! -name "*-desktop-integration-*" ! -name "jre*" ! -name "*-userland-*" -print` + +if [ -z "$RPMLIST" ] +then + printf "\n$0: No packages found in $PACKAGE_PATH\n" + exit 2 +fi + +# +# Determine whether this should be an update or a fresh install +# + +INSTALLDIR=$2 +RPM_DB_PATH=${INSTALLDIR}/var/lib/rpm + +# Check for versionrc +if [ -f ${INSTALLDIR}/program/versionrc ]; then VERSIONRC=versionrc; fi + +if [ "$UPDATE" = "ask" ] +then + PRODUCT=`sed --silent -e " +/^buildid=/ { +s/buildid=\(.*\)/ [\1]/ +h +} +/^ProductKey=/ { +s/ProductKey=// +G +p +}" ${INSTALLDIR}/program/${VERSIONRC:-bootstraprc} 2>/dev/null | tr -d "\012"` + + if [ ! -z "$PRODUCT" ] + then + echo + echo "Found an installation of $PRODUCT in $INSTALLDIR" + echo + while [ "$UPDATE" != "yes" ] + do + read -a UPDATE -p "Do you want to update this installation (yes/no)? " + if [ "$UPDATE" = "no" ] + then + exit 2 + fi + done + elif [ -d $RPM_DB_PATH -a "$ADD" = "no" ] + then + echo + echo "The following packages are already installed in $INSTALLDIR" + echo + rpm --dbpath `cd $RPM_DB_PATH; pwd` --query --all + echo + while [ "$UPDATE" != "yes" ] + do + read -a UPDATE -p "Do you want to continue with this installation (yes/no)? " + if [ "$UPDATE" = "no" ] + then + exit 2 + fi + done + else + UPDATE="no" + fi +fi + +# +# Check/Create installation directory +# + +if [ "$UPDATE" = "yes" ] +then + # restore original bootstraprc + mv -f ${INSTALLDIR}/program/bootstraprc.orig ${INSTALLDIR}/program/bootstraprc 2>/dev/null + + # the RPM_DB_PATH must be absolute + if [ ! "${RPM_DB_PATH:0:1}" = "/" ]; then + RPM_DB_PATH=`cd ${RPM_DB_PATH}; pwd` + fi + + # we should use --freshen for updates to not add languages with patches, but this will break + # language packs, so leave it for now .. +# RPMCMD="--freshen" + RPMCMD="--upgrade" +else + rmdir ${INSTALLDIR} 2>/dev/null + + if [ -d ${INSTALLDIR} -a "$ADD" = "no" ] + then + printf "\n$0: ${INSTALLDIR} exists and is not empty.\n" + exit 2 + fi + + mkdir -p $RPM_DB_PATH || exit 2 + # XXX why ? XXX + chmod 700 $RPM_DB_PATH + + # the RPM_DB_PATH must be absolute + if [ ! "${RPM_DB_PATH:0:1}" = "/" ]; then + RPM_DB_PATH=`cd ${RPM_DB_PATH}; pwd` + fi + + # Creating RPM database and initializing + if [ "$ADD" = "no" ]; then + rpm --initdb --dbpath $RPM_DB_PATH + fi + + # Default install command + RPMCMD="--install" +fi + +# populate the private rpm database with the dependencies needed +FAKEDBRPM=/tmp/fake-db-1.0-$$.noarch.rpm +linenum=??? +tail -n +$linenum $0 > $FAKEDBRPM + +rpm --upgrade --ignoresize --dbpath $RPM_DB_PATH $FAKEDBRPM + +rm -f $FAKEDBRPM + +echo "Packages found:" +for i in $RPMLIST ; do + echo `basename $i` +done + +# +# Perform the installation +# + +echo +echo "####################################################################" +echo "# Installation of the found packages #" +echo "####################################################################" +echo +echo "Path to the database: " $RPM_DB_PATH +echo "Path to the packages: " $PACKAGE_PATH +echo "Path to the installation: " $INSTALLDIR +echo +echo "Installing the RPMs" + +ABSROOT=`cd ${INSTALLDIR}; pwd` +RELOCATIONS=`rpm -qp --qf "--relocate %{PREFIXES}=${ABSROOT}%{PREFIXES} \n" $RPMLIST | sort -u | tr -d "\012"` +UserInstallation=\$BRAND_BASE_DIR/../UserInstallation rpm $RPMCMD --ignoresize -vh $RELOCATIONS --dbpath $RPM_DB_PATH $RPMLIST + +# +# Create a link into the users home directory +# + +if [ "$LINK" = "yes" ] +then + find `cd "$INSTALLDIR" && pwd` -name soffice -type f -perm /u+x -exec /bin/bash -ce 'ln -sf "$0" "$HOME/soffice" && echo "Creating link from $0 to $HOME/soffice"' {} \; +fi + +if [ "$UPDATE" = "yes" -a ! -f $INSTALLDIR/program/bootstraprc ] +then + echo + echo "Update failed due to a bug in RPM, uninstalling .." + rpm --erase -v --nodeps --dbpath $RPM_DB_PATH `rpm --query --queryformat "%{NAME} " --package $RPMLIST --dbpath $RPM_DB_PATH` + echo + echo "Now re-installing new packages .." + echo + rpm --install --nodeps --ignoresize -vh $RELOCATIONS --dbpath $RPM_DB_PATH $RPMLIST + echo +fi + +# patch the "bootstraprc" to create a self-containing installation +find "$INSTALLDIR" -type f -name bootstraprc -exec /bin/bash -ce 'test ! -e "$0".orig && mv "$0" "$0".orig && sed '\''s,^UserInstallation=$SYSUSERCONFIG.*,UserInstallation=$BRAND_BASE_DIR/../UserInstallation,'\'' "$0".orig > "$0"' {} \; + +# if an unpack directory exists, it can be removed now +if [ ! -z "$UNPACKDIR" ] +then + rm $UNPACKDIR/*.rpm + rmdir $UNPACKDIR + echo "Removed temporary directory $UNPACKDIR" +fi + +echo +echo "Installation done ..." + +exit 0 diff --git a/setup_native/scripts/install_solaris.sh b/setup_native/scripts/install_solaris.sh new file mode 100644 index 000000000000..624999f44f37 --- /dev/null +++ b/setup_native/scripts/install_solaris.sh @@ -0,0 +1,364 @@ +#!/bin/bash + +ADD="no" +LINK="no" +UPDATE="no" +USAGE="Usage: $0 [-a] [-l] [-h] <pkg-source-dir> <office-installation-dir>" + +help() +{ + echo + echo "User Mode Installation script for developer and knowledgeable early access tester" + echo + echo "This installation method is not intended for use in a production environment!" + echo "Using this script is unsupported and completely at your own risk" + echo + echo "Usage:" $0 "<pkg-source-dir> <office-installation-dir> [-l]" + echo " <pkg-source-dir>: directory *only* containing the Solaris pkg packages to be installed" + echo " or language pack shell script containing the Solaris pkg packages" + echo " <office-installation-dir>: directory to where the office and the pkg database will get installed into" + echo + echo "Optional Parameter:" + echo " -a : add to an existing <office-installation-dir>" + echo " -l : create a link \"soffice\" in $HOME" + echo " -h : output this help" +} + +try_to_unpack_languagepack_file() +{ + FILENAME=$PACKAGE_PATH + + # Checking, if $FILENAME is a language pack. + # String "language package" has to exist in the shell script file. + # If this is no language pack, the installation is not supported + + SEARCHSTRING=`head -n 10 $FILENAME | grep "language package"` + + if [ ! -z "$SEARCHSTRING" ] + then + echo "First parameter $FILENAME is a language pack"; + else + printf "\nERROR: First parameter $FILENAME is a file, but no language pack shell script.\n" + echo $USAGE + exit 2 + fi + + echo "Unpacking shell script $FILENAME" + # TAILLINE=`head -n 20 $FILENAME | sed --quiet 's/linenum=//p'` + TAILLINE=`head -n 20 $FILENAME | sed -n 's/linenum=//p'` + + if [ -x "/usr/bin/mktemp" ] # available in Solaris 10 + then + UNPACKDIR=`mktemp -d` + else + UNPACKDIR=/var/tmp/install_$$ + mkdir $UNPACKDIR + fi + + echo $UNPACKDIR + tail +$TAILLINE $FILENAME | gunzip | (cd $UNPACKDIR; tar xvf -) + + # Setting the new package path, in which the packages exist + PACKAGE_PATH=$UNPACKDIR + + # Setting variable UPDATE, because an Office installation has to exist, if a language pack shall be installed + UPDATE="yes" +} + +pkg_error() +{ + # pkg command failed, check for admin log and report help + if [ -f /tmp/.ai.pkg.zone.lock-afdb66cf-1dd1-11b2-a049-000d560ddc3e ] + then + echo "####################################################################" + echo "# Installation failed due to stale administrative lock #" + echo "####################################################################" + printf "\nERROR: please remove the following file first:\n" + ls -l /tmp/.ai.pkg.zone.lock-afdb66cf-1dd1-11b2-a049-000d560ddc3e + fi + rm -f $GETUID_SO + exit 1 +} + +get_pkg_list() +{ + cd $1; ls -1 +} + +# +# this script is for userland not for root +# + +if [ $UID -eq 0 ] +then + printf "\nThis script is for installation without administrative rights only\nPlease use pkgadd/patchadd to install as root\n" + help + exit 2 +fi + +while getopts "alh" VALUE +do + echo $VALUE + case $VALUE in + a) ADD="yes"; break;; + h) help; exit 0;; + l) LINK="yes"; break;; + ?) echo $USAGE; exit 2;; + esac +done +shift `expr $OPTIND - 1` + +if [ $# != 2 ] +then + echo $USAGE + exit 2 +fi + +# Determine whether this is a patch or a regular install set .. +/bin/bash -c "ls $1/*/patchinfo >/dev/null 2>&1" +if [ "$?" = 0 ] +then + UPDATE="yes" + PATCH_PATH="$1" + PATCH_INFO_LIST=`/bin/bash -c "cd $1; ls */patchinfo"` + PATCH_LIST=`for i in ${PATCH_INFO_LIST}; do dirname $i; done` +elif [ -f "$1/patchinfo" ] +then + UPDATE="yes" + PATCH_PATH=`dirname "$1"` + PATCH_LIST=`basename "$1"` +else + if [ -d "$1/packages" ] + then + PACKAGE_PATH="$1/packages" + else + PACKAGE_PATH=$1 + fi + + # + # If the first parameter is a shell script (download installation set), the packages have to + # be unpacked into temp directory + # + if [ -f "$PACKAGE_PATH" ] + then + try_to_unpack_languagepack_file + fi + + # + # Create sed filter script for unwanted packages + # + + cat > /tmp/userinstall_filer.$$ << EOF +/SUNWadabas/d +/^SUNWj[0-9]/d +/-desktop-int/d +/-shared-mime-info/d +/-cde/d +EOF + + # Do not install gnome-integration package on systems without GNOME + pkginfo -q SUNWgnome-vfs + if [ $? -ne 0 ] + then + + echo '/-gnome/d' >> /tmp/userinstall_filer.$$ + fi + + # pkgdep sorts the packages based on their dependencies + PKGDEP="`dirname $0`/pkgdep" + if [ ! -x $PKGDEP ]; then + PKGDEP="get_pkg_list" + fi + + # + # Get the list of packages to install + # + + PKG_LIST=`$PKGDEP $PACKAGE_PATH | sed -f /tmp/userinstall_filer.$$` + rm -f /tmp/userinstall_filer.$$ + + if [ -z "$PKG_LIST" ] + then + printf "\n$0: No packages found in $PACKAGE_PATH\n" + exit 2 + fi + + echo "Packages found:" + for i in $PKG_LIST ; do + echo $i + done +fi + +INSTALL_ROOT=$2 +if [ "$UPDATE" = "yes" ] +then + if [ ! -d ${INSTALL_ROOT}/var/sadm/install/admin ] + then + printf "\n$0: No package database in ${INSTALL_ROOT}.\n" + exit 2 + fi +else + if [ "$ADD" = "no" ] + then + rmdir ${INSTALL_ROOT} 2>/dev/null + if [ -d ${INSTALL_ROOT} ] + then + printf "\n$0: ${INSTALL_ROOT} exists and is not empty.\n" + exit 2 + fi + fi + mkdir -p ${INSTALL_ROOT}/var/sadm/install/admin +fi + +# Previous versions of this script did not write this file +if [ ! -f ${INSTALL_ROOT}/var/sadm/install/admin/default ] +then + cat > ${INSTALL_ROOT}/var/sadm/install/admin/default << EOF +action=nocheck +conflict=nocheck +setuid=nocheck +idepend=nocheck +mail= +EOF +fi + +if [ ! "${INSTALL_ROOT:0:1}" = "/" ]; then + INSTALL_ROOT=`cd ${INSTALL_ROOT}; pwd` +fi + +# This script must exist to make extension registration work +# always overwrite to get the latest version. +mkdir -p ${INSTALL_ROOT}/usr/lib +cat > ${INSTALL_ROOT}/usr/lib/postrun << \EOF +#!/bin/sh +set -e + +# Override UserInstallation in bootstraprc for unopkg .. +UserInstallation='$BRAND_BASE_DIR/../UserInstallation' +export UserInstallation + +if [ -x /usr/bin/mktemp ] +then + CMD=`/usr/bin/mktemp /tmp/userinstall.XXXXXX` +else + CMD=/tmp/userinstall.$$; echo "" > $CMD +fi + +sed -e 's|"/|"${PKG_INSTALL_ROOT}/|g' > $CMD +/bin/sh -e $CMD +rm -f $CMD +EOF +chmod +x ${INSTALL_ROOT}/usr/lib/postrun 2>/dev/null + +# create local tmp directory to install on S10 +LOCAL_TMP= +if [ -x /usr/bin/mktemp ] +then + LOCAL_TMP=`mktemp -d` + rmdir ${INSTALL_ROOT}/tmp 2>/dev/null + ln -s ${LOCAL_TMP} ${INSTALL_ROOT}/tmp +fi + +# +# the tail of the script contains a shared object for overloading the getuid() +# and a few other calls +# + +GETUID_SO=/tmp/getuid.so.$$ +linenum=??? +tail +$linenum $0 > $GETUID_SO + +# +# Perform the installation +# +if [ "$UPDATE" = "yes" ] +then + # restore original "bootstraprc" prior to patching + for i in ${PKG_LIST}; do + my_dir=${INSTALL_ROOT}`pkgparam -d ${PACKAGE_PATH} "$i" BASEDIR` + find "$my_dir" -type f -name bootstraprc.orig -exec sh -ce 'mv "$0" `dirname "$0"`/bootstraprc' {} \; + done + + # copy INST_RELEASE file + if [ ! -f ${INSTALL_ROOT}/var/sadm/system/admin/INST_RELEASE ] + then + mkdir -p ${INSTALL_ROOT}/var/sadm/system/admin 2>/dev/null + cp -f /var/sadm/system/admin/INST_RELEASE ${INSTALL_ROOT}/var/sadm/system/admin/INST_RELEASE + fi + + # The case UPDATE="yes" is valid for patch installation and for language packs. + # For patches the variable PKG_LIST is empty, for language packs it is not empty. + # Patches have to be installed with patchadd, language packs with pkgadd + + if [ -z "${PKG_LIST}" ] + then + LD_PRELOAD_32=$GETUID_SO /usr/sbin/patchadd -R ${INSTALL_ROOT} -M ${PATCH_PATH} ${PATCH_LIST} 2>&1 | grep -v '/var/sadm/patch' || pkg_error + else + LD_PRELOAD_32=$GETUID_SO /usr/sbin/pkgadd -d ${PACKAGE_PATH} -R ${INSTALL_ROOT} ${PKG_LIST} >/dev/null || pkg_error + fi + +else + + # Create BASEDIR directories to avoid manual user interaction + for i in ${PKG_LIST}; do + mkdir -m 0755 -p ${INSTALL_ROOT}`pkgparam -d ${PACKAGE_PATH} $i BASEDIR` 2>/dev/null + done + + if [ ! "${INSTALL_ROOT:0:1}" = "/" ]; then + INSTALL_ROOT=`cd ${INSTALL_ROOT}; pwd` + fi + + echo "####################################################################" + echo "# Installation of the found packages #" + echo "####################################################################" + echo + echo "Path to the packages : " $PACKAGE_PATH + echo "Path to the installation : " $INSTALL_ROOT + + LD_PRELOAD_32=$GETUID_SO /usr/sbin/pkgadd -d ${PACKAGE_PATH} -R ${INSTALL_ROOT} ${PKG_LIST} >/dev/null || pkg_error +fi + +rm -f $GETUID_SO +rm -f /tmp/.ai.pkg.zone.lock* + +# remove local tmp directory +if [ ! -z ${LOCAL_TMP} ] +then + rm -f ${LOCAL_TMP}/.ai.pkg.zone.lock* + rmdir ${LOCAL_TMP} + rm -f ${INSTALL_ROOT}/tmp + mkdir ${INSTALL_ROOT}/tmp +fi + +# +# Create a link into the users home directory +# + +if [ "$LINK" = "yes" ] +then + rm -f $HOME/soffice 2>/dev/null + find `cd "$INSTALL_ROOT" && pwd` -name soffice -type f -perm -u+x -exec /bin/sh -ce 'ln -sf "$0" "$HOME/soffice" && echo "Creating link from $0 to $HOME/soffice"' {} \; +fi + +# patch the "bootstraprc" to create a self-containing installation +for i in ${PKG_LIST}; do + my_dir=${INSTALL_ROOT}`pkgparam -d ${PACKAGE_PATH} "$i" BASEDIR` + find "$my_dir" -type f -name bootstraprc -exec sh -ce 'test ! -f "$0".orig && mv "$0" "$0".orig && sed '\''s,^UserInstallation=$SYSUSERCONFIG.*,UserInstallation=$BRAND_BASE_DIR/../UserInstallation,'\'' "$0".orig > "$0"' {} \; +done + +# if an unpack directory exists, it can be removed now +if [ ! -z "$UNPACKDIR" ] +then + # for i in ${PKG_LIST}; do + # cd $UNPACKDIR; rm -rf $i + # done + # rmdir $UNPACKDIR + + rm -rf $UNPACKDIR + echo "Removed temporary directory $UNPACKDIR" +fi + +echo +echo "Installation done ..." +exit 0 + diff --git a/setup_native/scripts/javaloader.sh b/setup_native/scripts/javaloader.sh new file mode 100644 index 000000000000..e23505f586b0 --- /dev/null +++ b/setup_native/scripts/javaloader.sh @@ -0,0 +1,498 @@ +#!/bin/sh + +jarfilename="JavaSetup.jar" +tempdir=/var/tmp/install_$$ +java_runtime="java" +java_runtime_set="no" +java_runtime_found="no" +java_runtime_sufficient="no" +java_versions_supported="1.4 1.5 1.6" +rpm2cpio_found="no" +rpm_found="no" +sunjavahotspot="HotSpot" +errortext="" +errorcode="" + +start_java() +{ + umask 022 + + echo "Using $java_runtime" + echo `$java_runtime -version` + echo "Running installer" + + # looking for environment variables + + home="" + if [ "x" != "x$HOME" ]; then + home=-DHOME=$HOME + fi + + log_module_states="" + if [ "x" != "x$LOG_MODULE_STATES" ]; then + log_module_states=-DLOG_MODULE_STATES=$LOG_MODULE_STATES + fi + + getuid_path="" + if [ "x" != "x$GETUID_PATH" ]; then + getuid_path=-DGETUID_PATH=$GETUID_PATH + fi + + if [ "x" != "x$jrefile" ]; then + jrecopy=-DJRE_FILE=$jrefile + fi + + # run the installer class file + echo $java_runtime $home $log_module_states $getuid_path $jrecopy -jar $jarfilename + $java_runtime $home $log_module_states $getuid_path $jrecopy -jar $jarfilename +} + +cleanup() +{ + if [ "x$tempdir" != "x" -a -d "$tempdir" ]; then + rm -rf $tempdir + fi +} + +do_exit() +{ + exitstring=$errortext + if [ "x" != "x$errorcode" ]; then + exitstring="$exitstring (exit code $errorcode)" + fi + + # simply echo the exitstring or open a xterm + # -> dependent from tty + + if tty ; then + echo $exitstring + else + mkdir $tempdir + + # creating error file + errorfile=$tempdir/error + + cat > $errorfile << EOF +echo "$exitstring" +echo "Press return to continue ..." +read a +EOF + + chmod 755 $errorfile + + # searching for xterm in path + xtermname="xterm" + xtermfound="no"; + for i in `echo $PATH | sed -e 's/^:/.:/g' -e 's/:$/:./g' -e 's/::/:.:/g' -e 's/:/ /g'`; do + if [ -x "$i/$xtermname" -a ! -d "$i/$xtermname" ]; then + xtermname="$i/$xtermname" + xtermfound="yes" + break + fi + done + + if [ $xtermfound = "no" -a "`uname -s`" = "SunOS" ]; then + if [ -x /usr/openwin/bin/xterm ]; then + xtermname=/usr/openwin/bin/xterm + xtermfound="yes" + fi + fi + + if [ $xtermfound = "yes" ]; then + $xtermname -e $errorfile + fi + fi + + cleanup + + exit $errorcode +} + +set_jre_for_uninstall() +{ + # if "uninstalldata" exists, this is not required + if [ ! -d "uninstalldata" ]; then + packagepath="RPMS" + jrefile=`find $packagepath -type f -name "jre*.rpm" -print` + jrefile=`basename $jrefile` + if [ -z "$jrefile" ]; then + jrefile="notfound" + fi + + # check existence of jre rpm + if [ ! -f $packagepath/$jrefile ]; then + errortext="Error: Java Runtime Environment (JRE) not found in directory: $packagepath" + errorcode="4" + do_exit + fi + fi +} + +install_linux_rpm() +{ + # Linux requires usage of rpm2cpio to install JRE with user privileges + # 1. --relocate /usr/java=/var/tmp does not work, because not all files are + # relocatable. Some are always installed into /etc + # 2. --root only works with root privileges. With user privileges only the + # database is shifted, but not the files. + + # On Linux currently rpm2cpio is required (and rpm anyhow) + + find_rpm2cpio() + + if [ ! "$rpm2cpio_found" = "yes" ]; then + errortext="Error: Did not find rpm2cpio. rpm2cpio is currently required for installations on Linux." + errorcode="11" + do_exit + fi + + find_rpm() + + if [ ! "$rpm_found" = "yes" ]; then + errortext="Error: Did not find rpm. rpm is currently required for installations on Linux." + errorcode="12" + do_exit + fi + + # jrefile=jre-6-linux-i586.rpm + # javahome=usr/java/jre1.6.0 + + packagepath="RPMS" + + # using "uninstalldata" for uninstallation + if [ -d "uninstalldata" ]; then + packagepath="uninstalldata/jre" + fi + + jrefile=`find $packagepath -type f -name "jre*.rpm" -print` + jrefile=`basename $jrefile` + if [ -z "$jrefile" ]; then + jrefile="notfound" + fi + + # check existence of jre rpm + if [ ! -f $packagepath/$jrefile ]; then + errortext="Error: Java Runtime Environment (JRE) not found in directory: $packagepath" + errorcode="4" + do_exit + fi + + PACKED_JARS="lib/rt.jar lib/jsse.jar lib/charsets.jar lib/ext/localedata.jar lib/plugin.jar lib/javaws.jar lib/deploy.jar" + + mkdir $tempdir + + trap 'rm -rf $tempdir; exit 1' HUP INT QUIT TERM + + tempjrefile=$tempdir/$jrefile + cp $packagepath/$jrefile $tempjrefile + + if [ ! -f "$tempjrefile" ]; then + errortext="Error: Failed to copy Java Runtime Environment (JRE) temporarily." + errorcode="5" + do_exit + fi + + # check if copy was successful + if [ -x /usr/bin/sum ]; then + + echo "Checksumming..." + + sumA=`/usr/bin/sum $packagepath/$jrefile` + index=1 + for s in $sumA; do + case $index in + 1) + sumA1=$s; + index=2; + ;; + 2) + sumA2=$s; + index=3; + ;; + esac + done + + sumB=`/usr/bin/sum $tempjrefile` + index=1 + for s in $sumB; do + case $index in + 1) + sumB1=$s; + index=2; + ;; + 2) + sumB2=$s; + index=3; + ;; + esac + done + + # echo "Checksum 1: A1: $sumA1 B1: $sumB1" + # echo "Checksum 2: A2: $sumA2 B2: $sumB2" + + if [ $sumA1 -ne $sumB1 ] || [ $sumA2 -ne $sumB2 ]; then + errortext="Error: Failed to install Java Runtime Environment (JRE) temporarily." + errorcode="6" + do_exit + fi + else + echo "Can't find /usr/bin/sum to do checksum. Continuing anyway." + fi + + # start to install jre + echo "Extracting ..." + olddir=`pwd` + cd "$tempdir" + rpm2cpio $tempjrefile | cpio -i --make-directories + rm -f $tempjrefile # we do not need it anymore, so conserve discspace + + javahomeparent=usr/java + javahomedir=`find $javahomeparent -maxdepth 1 -type d -name "jre*" -print` + javahomedir=`basename $javahomedir` + if [ -z "$javahomedir" ]; then + javahomedir="notfound" + fi + + javahome=$javahomeparent/$javahomedir + + if [ ! -d ${javahome} ]; then + errortext="Error: Failed to extract the Java Runtime Environment (JRE) files." + errorcode="7" + do_exit + fi + + UNPACK_EXE=$javahome/bin/unpack200 + if [ -f $UNPACK_EXE ]; then + chmod +x $UNPACK_EXE + packerror="" + for i in $PACKED_JARS; do + if [ -f $javahome/`dirname $i`/`basename $i .jar`.pack ]; then + # printf "Creating %s\n" $javahome/$i + $UNPACK_EXE $javahome/`dirname $i`/`basename $i .jar`.pack $javahome/$i + if [ $? -ne 0 ] || [ ! -f $javahome/$i ]; then + printf "ERROR: Failed to unpack JAR file:\n\n\t%s\n\n" $i + printf "Installation failed. Please refer to the Troubleshooting Section of\n" + printf "the Installation Instructions on the download page.\n" + packerror="1" + break + fi + + # remove the old pack file + rm -f $javahome/`dirname $i`/`basename $i .jar`.pack + fi + done + if [ "$packerror" = "1" ]; then + if [ -d $javahome ]; then + /bin/rm -rf $javahome + fi + + errortext="Error: Failed to extract the Java Runtime Environment (JRE) files." + errorcode="8" + do_exit + fi + fi + + PREFS_LOCATION="`echo \"${javahome}\" | sed -e 's/^jdk.*/&\/jre/'`/.systemPrefs" + + if [ ! -d "${PREFS_LOCATION}" ]; then + mkdir -m 755 "${PREFS_LOCATION}" + fi + if [ ! -f "${PREFS_LOCATION}/.system.lock" ]; then + touch "${PREFS_LOCATION}/.system.lock" + chmod 644 "${PREFS_LOCATION}/.system.lock" + fi + if [ ! -f "${PREFS_LOCATION}/.systemRootModFile" ]; then + touch "${PREFS_LOCATION}/.systemRootModFile" + chmod 644 "${PREFS_LOCATION}/.systemRootModFile" + fi + + if [ x$ARCH = "x32" ] && [ -f "$javahome/bin/java" ]; then + "$javahome/bin/java" -client -Xshare:dump > /dev/null 2>&1 + fi + + java_runtime=$tempdir/$javahome/bin/java + + # Make symbolic links to all TrueType font files installed in the system + # to avoid garbles for Japanese, Korean or Chinese + language=`printenv LANG | cut -c 1-3` + if [ x$language = "xja_" -o x$language = "xko_" -o x$language = "xzh_" ]; then + font_fallback_dir=$javahome/lib/fonts/fallback + echo "Making symbolic links to TrueType font files into $font_fallback_dir." + mkdir -p $font_fallback_dir + ttf_files=`locate "*.ttf" | xargs` + if [ x$ttf_files = "x" ]; then + ttf_files=`find /usr/share/fonts/ -name "*ttf"` + if [ x$ttf_files = "x" ]; then + ttf_files=`find /usr/X11R6/lib/ -name "*ttf"` + fi + fi + ln -s $ttf_files $font_fallback_dir + fi + + echo "Done." + cd "$olddir" +} + +find_rpm2cpio() +{ + # searching for rpm2cpio in path + for i in `echo $PATH | sed -e 's/^:/.:/g' -e 's/:$/:./g' -e 's/::/:.:/g' -e 's/:/ /g'`; do + if [ -x "$i/rpm2cpio" -a ! -d "$i/$rpm2cpio" ]; then + rpm2cpio_found="yes" + break + fi + done +} + +find_rpm() +{ + # searching for rpm in path + for i in `echo $PATH | sed -e 's/^:/.:/g' -e 's/:$/:./g' -e 's/::/:.:/g' -e 's/:/ /g'`; do + if [ -x "$i/rpm" -a ! -d "$i/$rpm" ]; then + rpm_found="yes" + break + fi + done +} + +check_architecture() +{ + # Check, if system and installation set fit together (x86 and sparc). + # If not, throw a warning. + # Architecture of the installation set is saved in file "installdata/xpd/setup.xpd" + # <architecture>sparc</architecture> or <architecture>i386</architecture> + # Architecture of system is determined with "uname -p" + + setupxpdfile="installdata/xpd/setup.xpd" + + if [ -f $setupxpdfile ]; then + platform=`uname -p` # valid values are "sparc" or "i386" + searchstring="<architecture>$platform</architecture>" + match=`cat $setupxpdfile | grep $searchstring` + + if [ -z "$match" ]; then + # architecture does not fit, warning required + if [ "$platform" = "sparc" ]; then + echo "Warning: This is an attempt to install Solaris x86 packages on Solaris Sparc." + else + echo "Warning: This is an attempt to install Solaris Sparc packages on Solaris x86." + fi + fi + fi +} + +find_solaris_jre() +{ + # searching for java runtime in path + for i in `echo $PATH | sed -e 's/^:/.:/g' -e 's/:$/:./g' -e 's/::/:.:/g' -e 's/:/ /g'`; do + if [ -x "$i/$java_runtime" -a ! -d "$i/$java_runtime" ]; then + java_runtime="$i/$java_runtime" + java_runtime_found="yes" + break + fi + done +} + +check_jre_version() +{ + # check version of an installed JRE + javaoutput=`$java_runtime -version 2>&1 | tail ${tail_args} -1` + hotspot=`echo $javaoutput | grep $sunjavahotspot` + if [ ! -z "$hotspot" ]; then + for i in $java_versions_supported; do + versionmatch=`echo $javaoutput | grep $i` + if [ ! -z "$versionmatch" ]; then + java_runtime_sufficient="yes" + break + fi + done + + # check new version format, where version number is not part of line 3 (1.6) + if [ ! "$java_runtime_sufficient" = "yes" ]; then + javaoutput=`$java_runtime -version 2>&1 | head ${tail_args} -3` + for i in $java_versions_supported; do + versionmatch=`echo $javaoutput | grep $i` + if [ ! -z "$versionmatch" ]; then + java_runtime_sufficient="yes" + break + fi + done + fi + fi +} + +# the user might want to specify java runtime on the commandline +USAGE="Usage: $0 [ -j <java_runtime> ]" +while getopts hj: opt; do + echo "Parameter: $opt" + case $opt in + j) java_runtime_set="yes"; + java_runtime="${OPTARG}" + if [ ! -f "$java_runtime" ]; then + errortext="Error: Invalid java runtime $java_runtime, file does not exist." + errorcode="2" + do_exit + fi + if [ ! -x "$java_runtime" ]; then + errortext="Error: Invalid java runtime $java_runtime, not an executable file." + errorcode="3" + do_exit + fi + java_runtime_found="yes"; + ;; + h) echo ${USAGE} + errortext="" + errorcode="" + do_exit + ;; + \?) echo ${USAGE} + errortext="" + errorcode="" + do_exit + ;; + esac +done + +# changing into setup directory +cd "`dirname "$0"`" + +# prepare jre, if not set on command line +if [ "$java_runtime_set" != "yes" ]; then + platform=`uname -s` + if [ "`uname -s`" = "Linux" ]; then + install_linux_rpm + elif [ "`uname -s`" = "SunOS" ]; then + check_architecture + find_solaris_jre + if [ "$java_runtime_found" = "yes" ]; then + check_jre_version + if [ ! "$java_runtime_sufficient" = "yes" ]; then + errortext="Error: Did not find a valid Java Runtime Environment (JRE). Required JRE versions: $java_versions_supported" + errorcode="9" + do_exit + fi + else + errortext="Error: Did not find an installed Java Runtime Environment (JRE)." + errorcode="10" + do_exit + fi + else + errortext="Error: Platform $platform not supported for Java Runtime Environment (JRE) installation." + errorcode="1" + do_exit + fi +fi + +# jre for Linux is also required, if java runtime is set (for uninstallation mode) +if [ "$java_runtime_set" = "yes" ]; then + platform=`uname -s` + if [ "`uname -s`" = "Linux" ]; then + set_jre_for_uninstall + fi +fi + +start_java + +cleanup + +exit 0 diff --git a/setup_native/scripts/langpackscript.sh b/setup_native/scripts/langpackscript.sh new file mode 100644 index 000000000000..bf221909ebf4 --- /dev/null +++ b/setup_native/scripts/langpackscript.sh @@ -0,0 +1,153 @@ +#!/bin/sh + +MYUID=`id | sed "s/(.*//g" | sed "s/.*=//"` + +if [ $MYUID -ne 0 ] +then + echo You need to have super-user rights to install this language package + exit 1 +fi + +linenum=LINENUMBERPLACEHOLDER + +# Determining current platform + +platform=`uname -s` + +case $platform in +SunOS) + tail_prog="tail" + ;; +Linux) + tail_prog="tail -n" + ;; +*) + tail_prog="tail" + ;; +esac + +more << "EOF" +LICENSEFILEPLACEHOLDER +EOF + +agreed= +while [ x$agreed = x ]; do + echo + echo "Do you agree to the above license terms? [yes or no] " + read reply leftover + case $reply in + y* | Y*) + agreed=1;; + n* | N*) + echo "If you don't agree to the license you can't install this software"; + exit 1;; + esac +done + +case $platform in +SunOS) + SEARCHPACKAGENAME="BASISPACKAGEPREFIXPLACEHOLDEROOOBASEVERSIONPLACEHOLDER-core01" + echo + echo "Searching for the FULLPRODUCTNAMELONGPLACEHOLDER installation ..." + PACKAGENAME=`pkginfo -x | grep $SEARCHPACKAGENAME | sed "s/ .*//"` + if [ "x$PACKAGENAME" != "x" ] + then + PRODUCTINSTALLLOCATION="`pkginfo -r $PACKAGENAME`" + else + echo "FULLPRODUCTNAMELONGPLACEHOLDER not installed (no package $SEARCHPACKAGENAME installed)" + exit 1 + fi + ;; +Linux) + SEARCHPACKAGENAME="BASISPACKAGEPREFIXPLACEHOLDEROOOBASEVERSIONPLACEHOLDER-core01" + FIXPATH="/openoffice.org" + echo + echo "Searching for the FULLPRODUCTNAMELONGPLACEHOLDER installation ..." + RPMNAME=`rpm -qa | grep $SEARCHPACKAGENAME` + if [ "x$RPMNAME" != "x" ] + then + PRODUCTINSTALLLOCATION="`rpm -ql $RPMNAME | head -n 1`" + else + echo "FULLPRODUCTNAMELONGPLACEHOLDER not installed (no package $SEARCHPACKAGENAME installed)" + exit 1 + fi + PRODUCTINSTALLLOCATION=`echo $PRODUCTINSTALLLOCATION | sed "s#${FIXPATH}##"` + ;; +*) + echo "Unsupported platform" + exit 1 + ;; +esac + +# Asking for the installation directory + +# echo +# echo "Where do you want to install the language pack ? [$PRODUCTINSTALLLOCATION] " +# read reply leftover +# if [ "x$reply" != "x" ] +# then +# PRODUCTINSTALLLOCATION="$reply" +# fi + +# Unpacking + +outdir=/var/tmp/install_$$ +mkdir $outdir + +#diskSpace=`df -k $outdir | $tail_prog -1 | awk '{if ( $4 ~ /%/) { print $3 } else { print $4 } }'` +#if [ $diskSpace -lt $diskSpaceRequired ]; then +# printf "You will need atleast %s kBytes of Disk Free\n" $diskSpaceRequired +# printf "Please free up the required Disk Space and try again\n" +# exit 3 +#fi + +trap 'rm -rf $outdir; exit 1' HUP INT QUIT TERM +echo "Unpacking and installing..." + +#if [ -x /usr/bin/sum ] ; then +# echo "Checksumming..." +# +# sum=`/usr/bin/sum $outdir/$outname` +# index=1 +# for s in $sum +# do +# case $index in +# 1) sum1=$s; +# index=2; +# ;; +# 2) sum2=$s; +# index=3; +# ;; +# esac +# done +# if expr $sum1 != <sum1replace> || expr $sum2 != <sum2replace> ; then +# echo "The download file appears to be corrupted. Please refer" +# echo "to the Troubleshooting section of the Installation" +# exit 1 +# fi +#else +# echo "Can't find /usr/bin/sum to do checksum. Continuing anyway." +#fi + +case $platform in +SunOS) + $tail_prog +$linenum $0 | gunzip | (cd $outdir; tar xvf -) + adminfile=$outdir/admin.$$ + echo "basedir=$PRODUCTINSTALLLOCATION" > $adminfile +INSTALLLINES + ;; +Linux) + $tail_prog +$linenum $0 | gunzip | (cd $outdir; tar xvf -) +INSTALLLINES + ;; +*) + echo "Unsupported platform" + exit 1 + ;; +esac + +rm -rf $outdir + +echo "Done..." + +exit 0 diff --git a/setup_native/scripts/linuxpatchscript.sh b/setup_native/scripts/linuxpatchscript.sh new file mode 100644 index 000000000000..33a0d4127301 --- /dev/null +++ b/setup_native/scripts/linuxpatchscript.sh @@ -0,0 +1,84 @@ +#!/bin/sh + +MYUID=`id | sed "s/(.*//g" | sed "s/.*=//"` + +if [ $MYUID -ne 0 ] +then + echo You need to have super-user permissions to run this patch script + exit 1 +fi + +echo +echo "Searching for the PRODUCTNAMEPLACEHOLDER installation ..." + +RPMNAME=`rpm -qa | grep SEARCHPACKAGENAMEPLACEHOLDER` + +if [ "x$RPMNAME" != "x" ] +then + PRODUCTINSTALLLOCATION="`rpm --query --queryformat "%{INSTALLPREFIX}" $RPMNAME`" + FULLPRODUCTINSTALLLOCATION="${PRODUCTINSTALLLOCATION}/PRODUCTDIRECTORYNAME" +else + echo "PRODUCTNAMEPLACEHOLDER is not installed" + exit 1 +fi + +# Last chance to exit .. +echo +read -p "Patching the installation in ${FULLPRODUCTINSTALLLOCATION}. Continue (y/n) ? " -n 1 reply leftover +echo +[ "$reply" == "y" ] || exit 1 + +echo +echo "About to update the following packages ..." + +BASEDIR=`dirname $0` + +RPMLIST="" +for i in `ls $BASEDIR/RPMS/*.rpm` +do + rpm --query `rpm --query --queryformat "%{NAME}\n" --package $i` && RPMLIST="$RPMLIST $i" +done + +# Save UserInstallation value +BOOTSTRAPRC="${FULLPRODUCTINSTALLLOCATION}/program/bootstraprc" +USERINST=`grep UserInstallation ${BOOTSTRAPRC}` + +# Check, if kde-integration rpm is available +KDERPM=`ls $BASEDIR/RPMS/*.rpm | grep kde-integration` + +if [ "x$KDERPM" != "x" ]; then + # Check, that $RPMLIST does not contain kde integration rpm (then it is already installed) + KDERPMINSTALLED=`grep kde-integration ${RPMLIST}` + + if [ "x$KDERPMINSTALLED" == "x" ]; then + # Install the kde integration rpm + RPMLIST="$RPMLIST $KDERPM" + fi +fi + +echo +rpm --upgrade -v --hash --prefix $PRODUCTINSTALLLOCATION --notriggers $RPMLIST +echo + +# Some RPM versions have problems with -U and --prefix +if [ ! -f ${BOOTSTRAPRC} ]; then + echo Update failed due to a bug in RPM, uninstalling .. + rpm --erase -v --nodeps --notriggers `rpm --query --queryformat "%{NAME} " --package $RPMLIST` + echo + echo Now re-installing new packages .. + echo + rpm --install -v --hash --prefix $PRODUCTINSTALLLOCATION --notriggers $RPMLIST + echo +fi + +# Restore the UserInstallation key if necessary +DEFUSERINST=`grep UserInstallation ${BOOTSTRAPRC}` +if [ "${USERINST}" != "${DEFUSERINST}" ]; then + mv -f ${BOOTSTRAPRC} ${BOOTSTRAPRC}.$$ + sed "s|UserInstallation.*|${USERINST}|" ${BOOTSTRAPRC}.$$ > ${BOOTSTRAPRC} + rm -f ${BOOTSTRAPRC}.$$ +fi + +echo "Done." + +exit 0 diff --git a/setup_native/scripts/mac_install.script b/setup_native/scripts/mac_install.script new file mode 100644 index 000000000000..2b34da1b04ed --- /dev/null +++ b/setup_native/scripts/mac_install.script @@ -0,0 +1,10 @@ +#!/bin/bash + +# shell script as a workaraound since it is hard to impossible to store compiled +# applescript in CVS and running osacompile would require a GUI session while +# building (or root privileges) +# using osascript only works when the shell script is camouflaged as application + +MY_DIR=$(dirname "$0") + +osascript "$MY_DIR/osx_install.applescript" diff --git a/setup_native/scripts/makefile.mk b/setup_native/scripts/makefile.mk new file mode 100644 index 000000000000..b8fc6649eddf --- /dev/null +++ b/setup_native/scripts/makefile.mk @@ -0,0 +1,99 @@ +#************************************************************************* +# +# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. +# +# Copyright 2000, 2010 Oracle and/or its affiliates. +# +# OpenOffice.org - a multi-platform office productivity suite +# +# This file is part of OpenOffice.org. +# +# OpenOffice.org is free software: you can redistribute it and/or modify +# it under the terms of the GNU Lesser General Public License version 3 +# only, as published by the Free Software Foundation. +# +# OpenOffice.org is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU Lesser General Public License version 3 for more details +# (a copy is included in the LICENSE file that accompanied this code). +# +# You should have received a copy of the GNU Lesser General Public License +# version 3 along with OpenOffice.org. If not, see +# <http://www.openoffice.org/license.html> +# for a copy of the LGPLv3 License. +# +#************************************************************************* + +PRJ=.. + +PRJNAME=setup_native +TARGET=install + +# --- Settings ----------------------------------------------------- + +.INCLUDE : settings.mk +.IF "$(L10N_framework)"=="" +# --- Files -------------------------------------------------------- + +UNIXTEXT= \ + $(BIN)$/langpackscript.sh \ + $(BIN)$/linuxpatchscript.sh \ + $(BIN)$/javaloader.sh \ + $(BIN)$/register_extensions \ + $(BIN)$/deregister_extensions \ + $(BIN)$/unpack_update.sh \ + $(BIN)$/update.sh \ + $(BIN)$/downloadscript.sh + +.IF "$(OS)" == "SOLARIS" || "$(OS)" == "LINUX" +UNIXTEXT+= $(BIN)$/stclient_wrapper.sh +.ENDIF + +FAKEDB=$(BIN)$/noarch/fake-db-1.0-0.noarch.rpm +FAKEDBROOT=$(COMMONMISC)/$(TARGET)/fake-db-root + +# --- Targets ------------------------------------------------------ + +.ENDIF # L10N_framework +.INCLUDE : target.mk +.IF "$(L10N_framework)"=="" +.IF "$(OS)" == "SOLARIS" || "$(OS)" == "LINUX" + +ALLTAR: $(BIN)$/install $(BIN)$/uninstall + +$(BIN)$/install: install_$(OS:l).sh + $(PERL) install_create.pl $& $@ + -chmod 775 $@ + +.ENDIF + +.IF "$(OS)" == "LINUX" + +$(FAKEDB) : fake-db.spec + $(MKDIRHIER) $(FAKEDBROOT) + $(RPM) --define "_builddir $(shell @cd $(FAKEDBROOT) && pwd)" --define "_rpmdir $(shell @cd $(BIN) && pwd)" -bb $< + +$(BIN)$/install: $(FAKEDB) + +$(BIN)$/uninstall: uninstall_linux.sh + $(TYPE) $< | tr -d "\015" > $@ + -chmod 775 $@ + +.ENDIF + +.IF "$(OS)" == "SOLARIS" + +$(BIN)$/install: $(LB)$/getuid.so.stripped + +$(BIN)$/uninstall: uninstall_solaris.sh $(LB)$/getuid.so.stripped + $(PERL) install_create.pl $< $@ + -chmod 775 $@ + +$(LB)$/getuid.so.stripped: $(LB)$/getuid.so + @$(COPY) $< $@ + @/usr/ccs/bin/strip $@ + +.ENDIF + +.ENDIF # L10N_framework diff --git a/setup_native/scripts/osx_install_languagepack.applescript b/setup_native/scripts/osx_install_languagepack.applescript new file mode 100644 index 000000000000..33d376adec1b --- /dev/null +++ b/setup_native/scripts/osx_install_languagepack.applescript @@ -0,0 +1,115 @@ +(* +This script is meant to + 1) Identify installed instances of the product + 2) check whether the user has write-access (and if not + ask for authentification) + 3) install the shipped tarball +*) + +-- strings for localisations - to be meant to be replaced +-- by a makefile or similar +set OKLabel to "[OKLabel]" +set InstallLabel to "[InstallLabel]" +set AbortLabel to "[AbortLabel]" +set intro to "[IntroText1] + +[IntroText2] + +[IntroText3]" +set chooseMyOwn to "[ChooseMyOwnText]" +set listPrompt to "[ListPromptText]" +set chooseManual to "[ChooseManualText]" +set listOKLabel to "[ListOKLabelText]" +set listCancelLabel to "[ListCancelLabel]" +set appInvalid to "[AppInvalidText1] + +[AppInvalidText2]" -- string will begin with the chosen application's name +set startInstall to "[StartInstallText1] + +[StartInstallText2]" +set IdentifyQ to "[IdentifyQText] + +[IdentifyQText2]" +set IdentifyYES to "[IdentifyYES]" +set IdentifyNO to "[IdentifyNO]" +set installFailed to "[InstallFailedText]" +set installComplete to "[InstallCompleteText] + +[InstallCompleteText2]" + +set sourcedir to (do shell script "dirname " & quoted form of POSIX path of (path to of me)) + +display dialog intro buttons {AbortLabel, InstallLabel} default button 2 + +if (button returned of result) is AbortLabel then + return 2 +end if + +set the found_ooos to (do shell script "mdfind \"kMDItemContentType == 'com.apple.application-bundle' && kMDItemDisplayName == '[PRODUCTNAME]*' && kMDItemDisplayName != '[FULLPRODUCTNAME].app'\"") & " +" & chooseMyOwn + +-- the choice returned is of type "list" +-- Show selection dialog only if more than one or no product was found +if (get first paragraph of found_ooos) is "" then + set the choice to (choose from list of paragraphs in found_ooos default items (get last paragraph of found_ooos) with prompt listPrompt OK button name listOKLabel cancel button name listCancelLabel) + if choice is false then + -- do nothing, the user cancelled the installation + return 2 --aborted by user + else if (choice as string) is chooseMyOwn then + -- yeah, one needs to use "choose file", otherwise + -- the user would not be able to select the .app + set the choice to POSIX path of (choose file with prompt chooseManual of type "com.apple.application-bundle" without showing package contents and invisibles) + end if +else if (get second paragraph of found_ooos) is chooseMyOwn then + -- set choice to found installation + set the choice to (get first paragraph of found_ooos) +else + set the choice to (choose from list of paragraphs in found_ooos default items (get first paragraph of found_ooos) with prompt listPrompt OK button name listOKLabel cancel button name listCancelLabel) + if choice is false then + -- do nothing, the user cancelled the installation + return 2 --aborted by user + else if (choice as string) is chooseMyOwn then + -- yeah, one needs to use "choose file", otherwise + -- the user would not be able to select the .app + set the choice to POSIX path of (choose file with prompt chooseManual of type "com.apple.application-bundle" without showing package contents and invisibles) + end if +end if + +-- now only check whether the path is really from [PRODUCTNAME] +try + do shell script "grep '<string>[PRODUCTNAME] [PRODUCTVERSION]' " & quoted form of (choice as string) & "/Contents/Info.plist" +on error + display dialog (choice as string) & appInvalid buttons {InstallLabel} default button 1 with icon 0 + return 3 --wrong target-directory +end try + +(* +display dialog startInstall buttons {AbortLabel, InstallLabel} default button 2 + +if (button returned of result) is AbortLabel then + return 2 +end if +*) + +set tarCommand to "/usr/bin/tar -C " & quoted form of (choice as string) & " -xjf " & quoted form of sourcedir & "/tarball.tar.bz2" +try + do shell script tarCommand + +on error errMSG number errNUM + display dialog IdentifyQ buttons {IdentifyYES, IdentifyNO} with icon 2 + if (button returned of result) is IdentifyYES then + try + do shell script tarCommand with administrator privileges + on error errMSG number errNUM + display dialog installFailed buttons {OKLabel} default button 1 with icon 0 + -- -60005 username/password wrong + -- -128 aborted by user + -- 2 error from tar - tarball not found (easy to test) + return errNUM + end try + else + return 2 -- aborted by user + end if +end try + +display dialog installComplete buttons {OKLabel} default button 1 diff --git a/setup_native/scripts/osx_install_patch.applescript b/setup_native/scripts/osx_install_patch.applescript new file mode 100644 index 000000000000..33a9d4126339 --- /dev/null +++ b/setup_native/scripts/osx_install_patch.applescript @@ -0,0 +1,113 @@ +(* +This script is meant to + 1) Identify installed instances of the product + 2) check whether the user has write-access (and if not + ask for authentification) + 3) install the shipped tarball +*) + +-- strings for localisations - to be meant to be replaced +-- by a makefile or similar +set OKLabel to "[OKLabel]" +set InstallLabel to "[InstallLabel]" +set AbortLabel to "[AbortLabel]" +set intro to "[IntroText1] + +[IntroText2] + +[IntroText3]" +set chooseMyOwn to "[ChooseMyOwnText]" +set listPrompt to "[ListPromptText]" +set chooseManual to "[ChooseManualText]" +set listOKLabel to "[ListOKLabelText]" +set listCancelLabel to "[ListCancelLabel]" +set appInvalid to "[AppInvalidText1] + +[AppInvalidText2]" -- string will begin with the chosen application's name +set startInstall to "[StartInstallText1] + +[StartInstallText2]" +set IdentifyQ to "[IdentifyQText] + +[IdentifyQText2]" +set IdentifyYES to "[IdentifyYES]" +set IdentifyNO to "[IdentifyNO]" +set installFailed to "[InstallFailedText]" +set installComplete to "[InstallCompleteTextPatch]" + +set sourcedir to (do shell script "dirname " & quoted form of POSIX path of (path to of me)) + +display dialog intro buttons {AbortLabel, InstallLabel} default button 2 + +if (button returned of result) is AbortLabel then + return 2 +end if + +set the found_ooos to (do shell script "mdfind \"kMDItemContentType == 'com.apple.application-bundle' && kMDItemDisplayName == '[PRODUCTNAME]*' && kMDItemDisplayName != '[FULLPRODUCTNAME].app'\"") & " +" & chooseMyOwn + +-- the choice returned is of type "list" +-- Show selection dialog only if more than one or no product was found +if (get first paragraph of found_ooos) is "" then + set the choice to (choose from list of paragraphs in found_ooos default items (get last paragraph of found_ooos) with prompt listPrompt OK button name listOKLabel cancel button name listCancelLabel) + if choice is false then + -- do nothing, the user cancelled the installation + return 2 --aborted by user + else if (choice as string) is chooseMyOwn then + -- yeah, one needs to use "choose file", otherwise + -- the user would not be able to select the .app + set the choice to POSIX path of (choose file with prompt chooseManual of type "com.apple.application-bundle" without showing package contents and invisibles) + end if +else if (get second paragraph of found_ooos) is chooseMyOwn then + -- set choice to found installation + set the choice to (get first paragraph of found_ooos) +else + set the choice to (choose from list of paragraphs in found_ooos default items (get first paragraph of found_ooos) with prompt listPrompt OK button name listOKLabel cancel button name listCancelLabel) + if choice is false then + -- do nothing, the user cancelled the installation + return 2 --aborted by user + else if (choice as string) is chooseMyOwn then + -- yeah, one needs to use "choose file", otherwise + -- the user would not be able to select the .app + set the choice to POSIX path of (choose file with prompt chooseManual of type "com.apple.application-bundle" without showing package contents and invisibles) + end if +end if + +-- now only check whether the path is really from [PRODUCTNAME] +try + do shell script "grep '<string>[PRODUCTNAME] [PRODUCTVERSION]' " & quoted form of (choice as string) & "/Contents/Info.plist" +on error + display dialog (choice as string) & appInvalid buttons {InstallLabel} default button 1 with icon 0 + return 3 --wrong target-directory +end try + +(* +display dialog startInstall buttons {AbortLabel, InstallLabel} default button 2 + +if (button returned of result) is AbortLabel then + return 2 +end if +*) + +set tarCommand to "/usr/bin/tar -C " & quoted form of (choice as string) & " -xjf " & quoted form of sourcedir & "/tarball.tar.bz2" +try + do shell script tarCommand + +on error errMSG number errNUM + display dialog IdentifyQ buttons {IdentifyYES, IdentifyNO} with icon 2 + if (button returned of result) is IdentifyYES then + try + do shell script tarCommand with administrator privileges + on error errMSG number errNUM + display dialog installFailed buttons {OKLabel} default button 1 with icon 0 + -- -60005 username/password wrong + -- -128 aborted by user + -- 2 error from tar - tarball not found (easy to test) + return errNUM + end try + else + return 2 -- aborted by user + end if +end try + +display dialog installComplete buttons {OKLabel} default button 1 diff --git a/setup_native/scripts/register_extensions b/setup_native/scripts/register_extensions new file mode 100644 index 000000000000..034642175c29 --- /dev/null +++ b/setup_native/scripts/register_extensions @@ -0,0 +1,84 @@ +#!/bin/bash + +USAGE="Usage: $0" + +SCRIPTNAME=`basename "$0"` +PROGRAMDIR=`dirname "$0"` +OFFICEDIR="$PROGRAMDIR/.." +EXTENSIONDIR=$OFFICEDIR/share/extension/install +REGISTERFILE=$PROGRAMDIR/register.dat +UNOPKG=$PROGRAMDIR/unopkg + +help() +{ + echo + echo "Installation script for office extensions located in <office>/share/extension/install" + echo + echo "This installation script can be executed after successful installation of packages." + echo "Before uninstallation please execute the script \"deregister_extensions\" located next" + echo "to this script." + echo "Usage: $0" + echo "No parameter required." + echo +} + +# +# This script is only for root installations +# (How about installations done with user privileges?) +# + +# if [ $UID -ne 0 ] +# then +# printf "\nThis script is for installation only wiht administrative rights only\n" +# help +# exit 2 +# fi + +# +# Checking existence of unopkg in program directory +# + +if [ ! -f "$UNOPKG" ]; then + echo "Error: File $UNOPKG does not exist" + exit 1 +fi + +if [ ! -x "$UNOPKG" ]; then + echo "Error: File $UNOPKG is not an executable file" + exit 1 +fi + +# +# Collecting all files located in share/install/extensions +# + +FILELIST=`find $EXTENSIONDIR -type f -name "*.oxt" -print` + +if [ -z "$FILELIST" ] +then + printf "\n$0: No extensions found in $EXTENSIONDIR\n" + exit 2 +fi + +echo +echo "Installing:" +for i in $FILELIST; do + echo `basename $i` +done +echo + +for i in $FILELIST; do + COMMAND="$UNOPKG add --shared --suppress-license $i" + echo $COMMAND + $COMMAND +done + +if [ -f $REGISTERFILE ]; then + rm $REGISTERFILE +fi + +echo +echo "Installation done ..." +echo + +exit 0 diff --git a/setup_native/scripts/source/getuid.c b/setup_native/scripts/source/getuid.c new file mode 100644 index 000000000000..9af63f4f079d --- /dev/null +++ b/setup_native/scripts/source/getuid.c @@ -0,0 +1,135 @@ +#include <fcntl.h> +#include <sys/types.h> +#include <sys/stat.h> +#include <unistd.h> +#include <dlfcn.h> + +#ifdef _cplusplus +extern "C" { +#endif + +#ifdef SOLARIS + +#include <sys/systeminfo.h> +#include <strings.h> + +int chown (const char *path, uid_t owner, gid_t group) {return 0;} +int lchown (const char *path, uid_t owner, gid_t group) {return 0;} +int fchown (int fildes, uid_t owner, gid_t group) {return 0;} + +uid_t getuid (void) {return 0;} +int stat(const char *path, struct stat *buf); +#ifdef __notdef__ +uid_t geteuid (void) {return 0;} +gid_t getgid (void) {return 0;} +gid_t getegid (void) {return 0;} +#endif + +int setuid (uid_t p) {return 0;} +int setgid (gid_t p) {return 0;} + +/* This is to fool cpio and pkgmk */ +int fstat(int fildes, struct stat *buf) +{ + int ret = 0; + static int (*p_fstat) (int fildes, struct stat *buf) = NULL; + if (p_fstat == NULL) + p_fstat = (int (*)(int fildes, struct stat *buf)) + dlsym (RTLD_NEXT, "fstat"); + ret = (*p_fstat)(fildes, buf); + if (buf != NULL) + { + buf->st_uid = 0; /* root */ + buf->st_gid = 2; /* bin */ + } + + return ret; +} + +/* this is to fool mkdir, don't allow to remove owner execute right from directories */ +int chmod(const char *path, mode_t mode) +{ + int ret = 0; + static int (*p_chmod) (const char *path, mode_t mode) = NULL; + if (p_chmod == NULL) + p_chmod = (int (*)(const char *path, mode_t mode)) + dlsym (RTLD_NEXT, "chmod"); + + if ((mode & S_IXUSR) == 0) + { + struct stat statbuf; + if (stat(path, &statbuf) == 0) + { + if ((statbuf.st_mode & S_IFDIR) != 0) + mode = (mode | S_IXUSR); + } + } + + ret = (*p_chmod)(path, mode); + return ret; +} + + + +/* This is to fool tar */ +int fstatat64(int fildes, const char *path, struct stat64 *buf, int flag) +{ + int ret = 0; + static int (*p_fstatat) (int fildes, const char *path, struct stat64 *buf, int flag) = NULL; + if (p_fstatat == NULL) + p_fstatat = (int (*)(int fildes, const char *path, struct stat64 *buf, int flag)) + dlsym (RTLD_NEXT, "fstatat64"); + ret = (*p_fstatat)(fildes, path, buf, flag); + if (buf != NULL) + { + buf->st_uid = 0; /* root */ + buf->st_gid = 2; /* bin */ + } + + return ret; +} +#elif defined LINUX + +uid_t getuid (void) {return 0;} +uid_t geteuid (void) {return 0;} + +/* This is to fool tar */ +#ifdef X86_64 +int __lxstat(int n, const char *path, struct stat *buf) +{ + int ret = 0; + static int (*p_lstat) (int n, const char *path, struct stat *buf) = NULL; + if (p_lstat == NULL) + p_lstat = (int (*)(int n, const char *path, struct stat *buf)) + dlsym (RTLD_NEXT, "__lxstat"); + ret = (*p_lstat)(n, path, buf); + if (buf != NULL) + { + buf->st_uid = 0; /* root */ + buf->st_gid = 0; /* root */ + } + return ret; +} +#else +int __lxstat64(int n, const char *path, struct stat64 *buf) +{ + int ret = 0; + static int (*p_lstat) (int n, const char *path, struct stat64 *buf) = NULL; + if (p_lstat == NULL) + p_lstat = (int (*)(int n, const char *path, struct stat64 *buf)) + dlsym (RTLD_NEXT, "__lxstat64"); + ret = (*p_lstat)(n, path, buf); + if (buf != NULL) + { + buf->st_uid = 0; + buf->st_gid = 0; + } + return ret; +} +#endif +#endif + +#ifdef _cplusplus +} +#endif + diff --git a/setup_native/scripts/source/makefile.mk b/setup_native/scripts/source/makefile.mk new file mode 100644 index 000000000000..6933f53d6149 --- /dev/null +++ b/setup_native/scripts/source/makefile.mk @@ -0,0 +1,90 @@ +#************************************************************************* +# +# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. +# +# Copyright 2000, 2010 Oracle and/or its affiliates. +# +# OpenOffice.org - a multi-platform office productivity suite +# +# This file is part of OpenOffice.org. +# +# OpenOffice.org is free software: you can redistribute it and/or modify +# it under the terms of the GNU Lesser General Public License version 3 +# only, as published by the Free Software Foundation. +# +# OpenOffice.org is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU Lesser General Public License version 3 for more details +# (a copy is included in the LICENSE file that accompanied this code). +# +# You should have received a copy of the GNU Lesser General Public License +# version 3 along with OpenOffice.org. If not, see +# <http://www.openoffice.org/license.html> +# for a copy of the LGPLv3 License. +# +#************************************************************************* + +PRJ=..$/.. + +PRJNAME=setup_native +TARGET=getuid + +NO_DEFAULT_STL=TRUE +LIBSALCPPRT=$(0) +LIBTARGET=NO + +# --- Settings ----------------------------------------------------- + +.INCLUDE : settings.mk + +# --- Files -------------------------------------------------------- + +# no 'lib' prefix +DLLPRE= + +# no _version.o +VERSIONOBJ= + +.IF "$(OS)" == "LINUX" || "$(OS)" == "SOLARIS" + +.IF "$(OS)" == "LINUX" +CFLAGS+=-D_GNU_SOURCE +.ENDIF + +.IF "$(OS)" == "SOLARIS" +.IF "$(CPU)" == "I" +.IF "$(COM)" != "GCC" +CFLAGS+=-D_KERNEL +.ENDIF +.ENDIF +.ENDIF + +# this object must not be a Ultra SPARC binary, this does not +# work with /usr/bin/sort and such. Needs to be 32 bit even in +# 64 bit builds +.IF "$(OS)" == "SOLARIS" +.IF "$(COM)" != "GCC" +.IF "$(CPU)" == "S" +ENVCFLAGS=-xarch=v8 +.ENDIF +.IF "$(CPU)"=="U" +CFLAGSAPPEND+=-m32 +LINKFLAGSSHL+=-m32 +.ENDIF +.ENDIF +.ENDIF + +SLOFILES = $(SLO)$/getuid.obj + +SHL1OBJS=$(SLOFILES) +SHL1TARGET=$(TARGET) +SHL1STDLIBS=-ldl +SHL1CODETYPE=C + +.ENDIF + +# --- Targets ------------------------------------------------------ + +.INCLUDE : target.mk + diff --git a/setup_native/scripts/stclient_wrapper.sh b/setup_native/scripts/stclient_wrapper.sh new file mode 100644 index 000000000000..52ff8abcb0ee --- /dev/null +++ b/setup_native/scripts/stclient_wrapper.sh @@ -0,0 +1,66 @@ +#!/bin/sh +# +# Copyright 2000, 2010 Oracle and/or its affiliates. +# All rights reserved. +# + +if [ `uname -s` = "SunOS" ]; then + STCLIENT=/usr/bin/stclient +else + STCLIENT=/opt/sun/servicetag/bin/stclient +fi + +TARGET_URN= +PRODUCT_NAME= +PRODUCT_VERSION= +PRODUCT_SOURCE= +PARENT_PRODUCT_NAME= +INSTANCE_URN= + +while [ $# -gt 0 ] +do + case "$1" in + -t) TARGET_URN="$2"; shift;; + -p) PRODUCT_NAME="$2"; shift;; + -e) PRODUCT_VERSION="$2"; shift;; + -i) INSTANCE_URN="$2"; shift;; + -P) PARENT_PRODUCT_NAME="$2"; shift;; + -S) PRODUCT_SOURCE="$2"; shift;; + --) shift; break;; + -*) + echo >&2 \ + "usage: $0 -p <product name> -e <product version> -t <urn> -S <source> -P <parent product name> [-i <instance urn>]" + exit 1;; + *) break;; + esac + shift +done + +[ -x "$STCLIENT" ] || exit 1 + +# test if already registered +if [ ! -n $INSTANCE_URN ]; then + TEST=`${STCLIENT} -f -t ${TARGET_URN}`; EXITCODE=$? + + # retry on unexpected error codes + [ ${EXITCODE} -eq 0 -o ${EXITCODE} -eq 225 ] || exit 1 + + # early versions did not have a dedicated exitcode, so need to compare text output + [ ${EXITCODE} -eq 225 -o "${TEST}" = "No records found" ] || echo "${TEST}"; exit 0 +fi + +uname=`uname -p` +zone="global" + +if [ `uname -s` = "SunOS" ]; then + if [ -x /usr/bin/zonename ]; then + zone=`/usr/bin/zonename` + fi +fi + +output=`"${STCLIENT}" -a -p "${PRODUCT_NAME}" -e "${PRODUCT_VERSION}" -t ${TARGET_URN} -S "${PRODUCT_SOURCE}" -P "${PARENT_PRODUCT_NAME}" ${INSTANCE_URN:+"-i"} ${INSTANCE_URN} -m "Sun Microsystems, Inc." -A "${uname}" -z "${zone}"`; EXITCODE=$? + +[ "${INSTANCE_URN}" = "" -a ${EXITCODE} -eq 226 ] && exit 0 + +exit ${EXITCODE} + diff --git a/setup_native/scripts/uninstall_linux.sh b/setup_native/scripts/uninstall_linux.sh new file mode 100644 index 000000000000..9ec68855c927 --- /dev/null +++ b/setup_native/scripts/uninstall_linux.sh @@ -0,0 +1,55 @@ +#!/bin/bash + +# Linux deinstallation +# No parameter required, all RPMs listed in $HOME/.RPM_OFFICEDATABASE +# will be removed. + +if [ $# -ne 1 ] +then + echo + echo "Usage:" $0 "<office-installation-dir>" + echo " <inst-destination-dir>: directory where the office to be removed is installed" + echo + exit 2 +fi + +INSTALLDIR=$1 + +# Check for old style .RPM_OFFICEDATABASE first +if [ -d ${INSTALLDIR}/.RPM_OFFICEDATABASE ]; then + RPM_DB_PATH=${INSTALLDIR}/.RPM_OFFICEDATABASE +else + RPM_DB_PATH=${INSTALLDIR}/.RPM_DATABASE +fi + +# the RPM_DB_PATH must be absolute +if [ ! "${RPM_DB_PATH:0:1}" = "/" ]; then + RPM_DB_PATH=`cd ${RPM_DB_PATH}; pwd` +fi + +RPMLIST=`rpm --dbpath $RPM_DB_PATH --query --all` + +# Output ... +clear +echo "#########################################" +echo "# Deinstallation of Office RPMs #" +echo "#########################################" +echo +echo "Path to the RPM database: " $RPM_DB_PATH +echo "RPMs to deinstall:" +echo "$RPMLIST" +echo "====================================================================" +echo + +# Restore original bootstraprc +mv -f $1/program/bootstraprc.orig $1/program/bootstraprc + +rpm --dbpath $RPM_DB_PATH --erase $RPMLIST || exit 2 + +echo "Removing RPM database ..." +rm -rf $RPM_DB_PATH + +echo +echo "Deinstallation done." + +exit 0 diff --git a/setup_native/scripts/uninstall_solaris.sh b/setup_native/scripts/uninstall_solaris.sh new file mode 100644 index 000000000000..970191f08421 --- /dev/null +++ b/setup_native/scripts/uninstall_solaris.sh @@ -0,0 +1,57 @@ +#!/bin/bash + +# First parameter: Root path that will be removed +# MY_ROOT=/export/home/is/root + +if [ $# -ne 1 -o -z "$1" ] +then + echo "One parameter required" + echo "Usage:" + echo "1. parameter: Path to the local root directory" + echo "All packages in local database will be removed!" + exit 2 +fi + +MY_ROOT=$1 + +cd `dirname $0` +DIRECTORY=`pwd` + +GETUID_SO=/tmp/getuid.so.$$ +linenum=??? +tail +$linenum `basename $0` > $GETUID_SO + +PKGLIST=`pkginfo -R $MY_ROOT | cut -f 2 -d ' ' | grep -v core` +COREPKG=`pkginfo -R $MY_ROOT | cut -f 2 -d ' ' | grep core` +COREPKG01=`pkginfo -R $MY_ROOT | cut -f 2 -d ' ' | grep core01` + +echo "#############################################" +echo "# Deinstallation of Office packages #" +echo "#############################################" +echo +echo "Path to the root directory : " $MY_ROOT +echo +echo "Packages to deinstall:" +for i in $PKGLIST $COREPKG; do + echo $i +done + +INSTALL_DIR=$MY_ROOT`pkginfo -R $MY_ROOT -r $COREPKG01` + +# Restore original bootstraprc +mv -f $INSTALL_DIR/program/bootstraprc.orig $INSTALL_DIR/program/bootstraprc + +for i in $PKGLIST $COREPKG; do + LD_PRELOAD=$GETUID_SO /usr/sbin/pkgrm -n -R $MY_ROOT $i +done + +# Removing old root directory, very dangerous! +# rm -rf $MY_ROOT + +# removing library in temp directory +rm -f $GETUID_SO + +echo +echo "Deinstallation done..." + +exit 0 diff --git a/setup_native/scripts/unpack_update.sh b/setup_native/scripts/unpack_update.sh new file mode 100644 index 000000000000..d93bb2749c07 --- /dev/null +++ b/setup_native/scripts/unpack_update.sh @@ -0,0 +1,33 @@ +#!/bin/sh + +EXTENSION=`expr "//$1" : '.*\/.*\.\(t.*\)'` +[ -z $EXTENSION ] && ( echo "Unable to determine file type"; exit 2 ) + +BASEDIR=`dirname "$1"` +FOLDER=`basename "$1" ".$EXTENSION"` +NUM=1 + +DESTPATH="$BASEDIR/$FOLDER" + +while [ -d "$DESTPATH" ]; do + NUM=`expr $NUM + 1` + DESTPATH="$BASEDIR/$FOLDER-$NUM" +done + +mkdir "$DESTPATH" +cd "$DESTPATH" + +if [ "$EXTENSION" = "tar.gz" -o "$EXTENSION" = "tgz" ]; then + if [ -x /usr/bin/gzcat ]; then + /usr/bin/gzcat "$1" | tar -xf - + else + tar -xzf "$1" + fi +elif [ "$EXTENSION" = "tar.bz2" -o "$EXTENSION" = "tbz2" ]; then + /usr/bin/bzcat "$1" | tar -xf - +else + echo "Unsupported type of archive" + exit 2 +fi + +UPDATE=`eval ls */update` && SUBFOLDER=`dirname $UPDATE` && mv $SUBFOLDER/* . && rmdir $SUBFOLDER && echo "$DESTPATH/update" diff --git a/setup_native/scripts/update.sh b/setup_native/scripts/update.sh new file mode 100644 index 000000000000..20b8bbae0292 --- /dev/null +++ b/setup_native/scripts/update.sh @@ -0,0 +1,195 @@ +#!/bin/sh + +GNOMEXCMDS="/usr/bin/gksu" +GNOMECMDS="/usr/bin/gnome-terminal /opt/gnome/bin/gnome-terminal" +KDEXCMDS="/usr/bin/kdesu /opt/kde/bin/kdesu /opt/kde?/bin/kdesu" +KDECMDS="/usr/bin/konsole /opt/kde/bin/konsole /opt/kde?/bin/konsole" +MISCCMDS="/usr/bin/x-terminal-emulator /usr/X11/bin/xterm /usr/openwin/bin/xterm" + +TITLE='${PRODUCTNAME} update' + +# +# Usage +# + +Usage () { + if [ "`basename $0`" = "update" ]; then + echo "Usage: `basename $0` [<path to ${PRODUCTNAME} installation>]" + fi + echo + exit 2 +} + +make_tempfile() { + + # Always prefer mktemp when available + if [ -x "$MKTEMP" ]; then + "$MKTEMP" "/tmp/$1.XXXXXX" + else + TMPCMD="/tmp/$1.$$" + touch $TMPCMD + echo $TMPCMD + fi + +} + +# +# make_command_file - generate a command file to pass to xterm & co +# +run_in_terminal () { + + TMPCMD=`make_tempfile 'OpenOffice.org-Online-Update'` + + cat >> $TMPCMD + + cat >> $TMPCMD << \EOF +if [ $? -eq 0 -a ! -z "$DISPLAY" ]; then + echo + echo "Press <Enter> to close this window" + read DUMMY +fi +EOF + + cat >> $TMPCMD << EOF +rm -f $TMPCMD +EOF + + chmod a+x $TMPCMD + exec "$@" -e $TMPCMD +} + +# +# run the command line passed as positional parameters either via +# gksu/kdesu or via su command in a terminal emulator. +# +elevate() { + + TITLEOPT="" + GEOMOPT="" + case `basename $XTERM` in + "xterm") + TITLEOPT="-title" + GEOMOPT="-geometry " + ;; + "gnome-terminal" | "konsole" | "x-terminal-emulator") + TITLEOPT="--title" + GEOMOPT="--geometry=" + ;; + esac + + case `basename $SU` in + "kdesu" ) + # --caption + SUOPT="-t" + ;; + "gksu" ) + # --title + SUOPT="" + ;; + "su" ) + SUOPT="- root -c" + ;; + esac + + ( echo "echo The application \"$@\" will update your ${PRODUCTNAME} installation." + echo "echo" + echo "$SU" "$SUOPT" "$@" + ) | run_in_terminal "$XTERM" "$TITLEOPT" "$TITLE" ${GEOMOPT}+300+300 +} + + +update_pkg() { + ADMINFILE=`make_tempfile 'OpenOffice.org-Online-Update-admin'` + +cat >> $ADMINFILE << EOF +action=nocheck +conflict=nocheck +setuid=nocheck +idepend=nocheck +rdepend=nocheck +mail= +EOF + + PKGLIST="" + for i in `cd $1; ls -d *`; do + pkginfo -q $i && PKGLIST="$PKGLIST $i" + done + + pkgrm -n -a $ADMINFILE $PKGLIST + pkgadd -n -a $ADMINFILE -d $1 $PKGLIST + + rm -f $ADMINFILE +} + +# +# main +# + +CMD="`basename $0`" +BASEDIR="`dirname $0`" +ABSBASEDIR="`cd $BASEDIR; pwd`" + +if [ -z "$DISPLAY" ]; then + SU="su" + XTERM="" +else + # define search order depending on the desktop in use .. + if [ "`uname -s`" = "SunOS" ]; then + XPROP=/usr/openwin/bin/xprop + GREP=/usr/xpg4/bin/grep + MKTEMP=/usr/bin/mktemp + else + if [ -x /usr/X11/bin/xprop ]; then + XPROP=/usr/X11/bin/xprop + else + XPROP=/usr/bin/xprop + fi + GREP=grep + MKTEMP=/bin/mktemp + fi + + # use desktop specific tools where possible, but prefer X11 su over terminal emulators + if $XPROP -root | $GREP -q '^KWIN_RUNNING'; then + SULIST="$KDEXCMDS $GNOMEXCMDS" + XTERMLIST="$KDECMDS $MISCCMDS" + else + SULIST="$GNOMEXCMDS $KDEXCMDS" + XTERMLIST="$GNOMECMDS $MISCCMDS" + fi + + # search for the first available terminal emulator + for i in $XTERMLIST; do + if [ -x $i ]; then + XTERM=$i + break + fi + done + + # we prefer gksu or kdesu if available + SU="su" + for i in $SULIST; do + if [ -x $i ]; then + SU=$i + break + fi + done +fi + +if [ "$CMD" = "update" ]; then + if [ $# -gt 0 ]; then + [ -d $1 -a $# -eq 1 ] || Usage + elevate "$ABSBASEDIR/$CMD" + else + if [ -d "$BASEDIR/RPMS" ]; then + # do not use --hash as the control sequence to edit the current line does not work + # in our setup (at least not with kdesu) + rpm -v --freshen `find "$BASEDIR"/RPMS -name '*.rpm'` + elif [ -d "$BASEDIR/DEBS" ]; then + dpkg --install --selected-only --recursive "$BASEDIR"/DEBS + elif [ -d "$BASEDIR/packages" ]; then + update_pkg "$BASEDIR/packages" + fi + fi +else + Usage +fi diff --git a/setup_native/scripts/userland.txt b/setup_native/scripts/userland.txt new file mode 100644 index 000000000000..9983ab46fe16 --- /dev/null +++ b/setup_native/scripts/userland.txt @@ -0,0 +1,28 @@ +#************************************************************************* +# +# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. +# +# Copyright 2000, 2010 Oracle and/or its affiliates. +# +# OpenOffice.org - a multi-platform office productivity suite +# +# This file is part of OpenOffice.org. +# +# OpenOffice.org is free software: you can redistribute it and/or modify +# it under the terms of the GNU Lesser General Public License version 3 +# only, as published by the Free Software Foundation. +# +# OpenOffice.org is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU Lesser General Public License version 3 for more details +# (a copy is included in the LICENSE file that accompanied this code). +# +# You should have received a copy of the GNU Lesser General Public License +# version 3 along with OpenOffice.org. If not, see +# <http://www.openoffice.org/license.html> +# for a copy of the LGPLv3 License. +# +#************************************************************************* + +USERLANDPACKAGENAME=openoffice.org-userland-1.0-0.noarch.rpm diff --git a/setup_native/source/java/javaversion.dat b/setup_native/source/java/javaversion.dat new file mode 100755 index 000000000000..17084cc92234 --- /dev/null +++ b/setup_native/source/java/javaversion.dat @@ -0,0 +1,57 @@ +#************************************************************************* +# +# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. +# +# Copyright 2000, 2010 Oracle and/or its affiliates. +# +# OpenOffice.org - a multi-platform office productivity suite +# +# This file is part of OpenOffice.org. +# +# OpenOffice.org is free software: you can redistribute it and/or modify +# it under the terms of the GNU Lesser General Public License version 3 +# only, as published by the Free Software Foundation. +# +# OpenOffice.org is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU Lesser General Public License version 3 for more details +# (a copy is included in the LICENSE file that accompanied this code). +# +# You should have received a copy of the GNU Lesser General Public License +# version 3 along with OpenOffice.org. If not, see +# <http://www.openoffice.org/license.html> +# for a copy of the LGPLv3 License. +# +#************************************************************************* + +# GUI String in the installer ("Java Runtime Environment (${JAVAVERSION})") +JAVAVERSION=Java 6 Update 18 +WINDOWSJAVAVERSION=Java 6 Update 18 + +# Windows (scp2 and downloadtemplate.nsi) +WINDOWSJAVAFILENAME=jre-6u18-windows-i586.exe +WINDOWSJAVAREGISTRYENTRY=1.6.0_18 + +# Linux (scp2) +LINUXJAVAFILENAME=jre-6u18-linux-i586.rpm +# Linux (rpmUnit.xml, rpm -qp <filename> ) +LINUXJAVANAME=jre-1.6.0_18-fcs + +# Linux-x64 (scp2) +LINUXX64JAVAFILENAME=jre-6u18-linux-amd64.rpm + +# Solaris Sparc (scp2) +SOLSJAVARTPACKED=SUNWj6rt_1_6_0_18_sparc.tar.gz +SOLSJAVACFGPACKED=SUNWj6cfg_1_6_0_18_sparc.tar.gz +SOLSJAVAMANPACKED=SUNWj6man_1_6_0_18_sparc.tar.gz + +# Solaris x86 (scp2) +SOLIJAVARTPACKED=SUNWj6rt_1_6_0_18_x86.tar.gz +SOLIJAVACFGPACKED=SUNWj6cfg_1_6_0_18_x86.tar.gz +SOLIJAVAMANPACKED=SUNWj6man_1_6_0_18_x86.tar.gz + +# Solaris (pkgUnit.xml, needs only to be changed in major changes) +SOLARISJAVART=SUNWj6rt +SOLARISJAVACFG=SUNWj6cfg +SOLARISJAVAMAN=SUNWj6man diff --git a/setup_native/source/java/javaversion2.dat b/setup_native/source/java/javaversion2.dat new file mode 100644 index 000000000000..17084cc92234 --- /dev/null +++ b/setup_native/source/java/javaversion2.dat @@ -0,0 +1,57 @@ +#************************************************************************* +# +# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. +# +# Copyright 2000, 2010 Oracle and/or its affiliates. +# +# OpenOffice.org - a multi-platform office productivity suite +# +# This file is part of OpenOffice.org. +# +# OpenOffice.org is free software: you can redistribute it and/or modify +# it under the terms of the GNU Lesser General Public License version 3 +# only, as published by the Free Software Foundation. +# +# OpenOffice.org is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU Lesser General Public License version 3 for more details +# (a copy is included in the LICENSE file that accompanied this code). +# +# You should have received a copy of the GNU Lesser General Public License +# version 3 along with OpenOffice.org. If not, see +# <http://www.openoffice.org/license.html> +# for a copy of the LGPLv3 License. +# +#************************************************************************* + +# GUI String in the installer ("Java Runtime Environment (${JAVAVERSION})") +JAVAVERSION=Java 6 Update 18 +WINDOWSJAVAVERSION=Java 6 Update 18 + +# Windows (scp2 and downloadtemplate.nsi) +WINDOWSJAVAFILENAME=jre-6u18-windows-i586.exe +WINDOWSJAVAREGISTRYENTRY=1.6.0_18 + +# Linux (scp2) +LINUXJAVAFILENAME=jre-6u18-linux-i586.rpm +# Linux (rpmUnit.xml, rpm -qp <filename> ) +LINUXJAVANAME=jre-1.6.0_18-fcs + +# Linux-x64 (scp2) +LINUXX64JAVAFILENAME=jre-6u18-linux-amd64.rpm + +# Solaris Sparc (scp2) +SOLSJAVARTPACKED=SUNWj6rt_1_6_0_18_sparc.tar.gz +SOLSJAVACFGPACKED=SUNWj6cfg_1_6_0_18_sparc.tar.gz +SOLSJAVAMANPACKED=SUNWj6man_1_6_0_18_sparc.tar.gz + +# Solaris x86 (scp2) +SOLIJAVARTPACKED=SUNWj6rt_1_6_0_18_x86.tar.gz +SOLIJAVACFGPACKED=SUNWj6cfg_1_6_0_18_x86.tar.gz +SOLIJAVAMANPACKED=SUNWj6man_1_6_0_18_x86.tar.gz + +# Solaris (pkgUnit.xml, needs only to be changed in major changes) +SOLARISJAVART=SUNWj6rt +SOLARISJAVACFG=SUNWj6cfg +SOLARISJAVAMAN=SUNWj6man diff --git a/setup_native/source/java/openofficeorg_setup.gif b/setup_native/source/java/openofficeorg_setup.gif Binary files differnew file mode 100644 index 000000000000..8beb9e12bf23 --- /dev/null +++ b/setup_native/source/java/openofficeorg_setup.gif diff --git a/setup_native/source/linux/root3.dat b/setup_native/source/linux/root3.dat new file mode 100644 index 000000000000..13ba57793426 --- /dev/null +++ b/setup_native/source/linux/root3.dat @@ -0,0 +1,4 @@ +Base file in core03 package. +Never include into patch. + + diff --git a/setup_native/source/linux/root4.dat b/setup_native/source/linux/root4.dat new file mode 100644 index 000000000000..7f99a3d8004d --- /dev/null +++ b/setup_native/source/linux/root4.dat @@ -0,0 +1,4 @@ +Base file in core04 package. +Never include into patch. + + diff --git a/setup_native/source/linux/root5.dat b/setup_native/source/linux/root5.dat new file mode 100644 index 000000000000..a3a9f6178bd5 --- /dev/null +++ b/setup_native/source/linux/root5.dat @@ -0,0 +1,4 @@ +Base file in core05 package. +Never include into patch. + + diff --git a/setup_native/source/mac/Info.plist.langpack b/setup_native/source/mac/Info.plist.langpack new file mode 100644 index 000000000000..3c1eb2c6f369 --- /dev/null +++ b/setup_native/source/mac/Info.plist.langpack @@ -0,0 +1,36 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> +<plist version="1.0"> +<dict> + <key>CFBundleDevelopmentRegion</key> + <string>English</string> + <!-- UTI declarations for OS X >= 10.4 --> + <key>UTExportedTypeDeclarations</key> + + <key>UTImportedTypeDeclarations</key> + + <key>CFBundleExecutable</key> + <string>[FULLPRODUCTNAME]</string> + <key>CFBundleGetInfoString</key> + <string>[FULLPRODUCTNAME]</string> + <key>CFBundleIconFile</key> + <string>ooo3_installer.icns</string> + <key>CFBundleShortVersionString</key> + <string>9</string> + <key>CFBundleIdentifier</key> + <string>org.openoffice.script</string> + <key>CFBundleInfoDictionaryVersion</key> + <string>6.0</string> + <key>CFBundleName</key> + <string>[FULLPRODUCTNAME]</string> + <key>CFBundlePackageType</key> + <string>APPL</string> + <key>CFBundleSignature</key> + <string>OOo3</string> + <key>LSRequiresCarbon</key> + <string>1</string> + <key>NSPrincipalClass</key> + <string>VCL_NSApplication</string> +</dict> +</plist> + diff --git a/setup_native/source/mac/macinstall.ulf b/setup_native/source/mac/macinstall.ulf new file mode 100644 index 000000000000..2d92e8c260fb --- /dev/null +++ b/setup_native/source/mac/macinstall.ulf @@ -0,0 +1,68 @@ +[OKLabel] +en-US = "Ok" + +[InstallLabel] +en-US = "Install" + +[AbortLabel] +en-US = "Abort" + +[IntroText1] +en-US = "Welcome to the [FULLPRODUCTNAME] Installation Wizard" + +[IntroText2] +en-US = "This installation will update your installed versions of [PRODUCTNAME]" + +[IntroText3] +en-US = "This might take a moment." + +[ChooseMyOwnText] +en-US = "Not listed (choose location in an extra step)" + +[ListPromptText] +en-US = "Choose [PRODUCTNAME] [PRODUCTVERSION] installation for which you want to install the [FULLPRODUCTNAME]" + +[ChooseManualText] +en-US = "Point the dialog to your [PRODUCTNAME] [PRODUCTVERSION] installation." + +[ListOKLabelText] +en-US = "Install" + +[ListCancelLabel] +en-US = "Abort" + +[AppInvalidText1] +en-US = "This is not a valid [PRODUCTNAME] [PRODUCTVERSION] installation." + +[AppInvalidText2] +en-US = "Run the installer again and choose a valid [PRODUCTNAME] [PRODUCTVERSION] installation" + +[StartInstallText1] +en-US = "Click Install to start the installation" + +[StartInstallText2] +en-US = "Installation might take a minute..." + +[IdentifyQText] +en-US = "Installation failed, most likely your account does not have the necessary privileges." + +[IdentifyQText2] +en-US = "Do you want to identify as administrator and try again?" + +[IdentifyYES] +en-US = "Yes, identify" + +[IdentifyNO] +en-US = "No, abort installation" + +[InstallFailedText] +en-US = "Installation failed." + +[InstallCompleteText] +en-US = "Installation of [PRODUCTNAME] language pack completed." + +[InstallCompleteText2] +en-US = "Call '[PRODUCTNAME]-Preferences-Language Settings-Languages' to change the user interface language." + +[InstallCompleteTextPatch] +en-US = "Installation of [FULLPRODUCTNAME] completed" diff --git a/setup_native/source/mac/makefile.mk b/setup_native/source/mac/makefile.mk new file mode 100644 index 000000000000..ac341370fe01 --- /dev/null +++ b/setup_native/source/mac/makefile.mk @@ -0,0 +1,57 @@ +#************************************************************************* +# +# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. +# +# Copyright 2000, 2010 Oracle and/or its affiliates. +# +# OpenOffice.org - a multi-platform office productivity suite +# +# This file is part of OpenOffice.org. +# +# OpenOffice.org is free software: you can redistribute it and/or modify +# it under the terms of the GNU Lesser General Public License version 3 +# only, as published by the Free Software Foundation. +# +# OpenOffice.org is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU Lesser General Public License version 3 for more details +# (a copy is included in the LICENSE file that accompanied this code). +# +# You should have received a copy of the GNU Lesser General Public License +# version 3 along with OpenOffice.org. If not, see +# <http://www.openoffice.org/license.html> +# for a copy of the LGPLv3 License. +# +#************************************************************************* + +PRJ=..$/.. + +PRJNAME=setup_native +TARGET=mac_ulffiles + +# --- Settings ----------------------------------------------------- + +.INCLUDE : settings.mk + +# ------------------------------------------------------------------ + +ULFFILES = macinstall.ulf + +ULFDESTFILES=$(foreach,i,$(ULFFILES) $(MISC)$/$(TARGET)_dest$/$i) + +# --- Targets ------------------------------------------------------ + +.IF "$(OS)"=="MACOSX" +ALLTAR : $(ULFDESTFILES) +.ENDIF + +.INCLUDE : target.mk + +.IF "$(WITH_LANG)"!="" +$(MISC)$/$(TARGET)_dest$/%.ulf : $(COMMONMISC)$/$(TARGET)$/%.ulf +.ELSE # "$(WITH_LANG)"!="" +$(MISC)$/$(TARGET)_dest$/%.ulf : %.ulf +.ENDIF # "$(WITH_LANG)"!="" + @-$(MKDIRHIER) $(MISC)$/$(TARGET)_dest + $(COPY) $< $@ diff --git a/setup_native/source/mac/ooo3_installer.icns b/setup_native/source/mac/ooo3_installer.icns Binary files differnew file mode 100644 index 000000000000..e064ad70479d --- /dev/null +++ b/setup_native/source/mac/ooo3_installer.icns diff --git a/setup_native/source/opensolaris/bundledextensions/README b/setup_native/source/opensolaris/bundledextensions/README new file mode 100644 index 000000000000..f64c225d9df9 --- /dev/null +++ b/setup_native/source/opensolaris/bundledextensions/README @@ -0,0 +1,80 @@ +================================================================================ +Installation information +================================================================================ + +In order to properly install the bundled extensions, such as dictionaries, it is +necessary that the files + +installed +ooo_bundled_extensions.xml +svc-ooo_bundled_extensions + +are part of the OpenOffice.org IPS package. They must be added to the package +after all other files have been added. Those other files are the SVR4 packages +of OOo which can be imported by pkg (pkg import). +The files have to be uploaded this way: + +pkgsend -s url_to_pkg_server add file installed mode=644 owner=root group=bin path=${EXTENSIONPATH}/installed restart_fmri=svc:/application/ooo_bundled_extensions:default +pkgsend -s url_to_pkg_server add file svc-ooo_bundled_extensions mode=744 owner=root group=bin path=/lib/svc/method/svc-ooo_bundled_extensions +pkgsend -s url_to_pkg_server add file ooo_bundled_extensions.xml mode=644 owner=root group=bin path=/var/svc/manifest/application/ooo_bundled_extensions.xml restart_fmri=svc:/system/manifest-import:default + + +--- + +${EXTENSIONPATH} must be replaced by the path to the folder containing the +bundled extensions. This path changes with every major release of OOo because of +the version number which is part of a folder name. The +current value is: + +EXTENSIONPATH=/opt/openoffice.org3/share/extension/install + +The service was tested with OpenSolaris release 2009.6 and may not work with a +previous release. + + +================================================================================ +What do these files do +================================================================================ + +The three files constitute a SMF service. When this service is started, then it +installes the bundled extensions which are contained in +/opt/openoffice.org3/share/extension/install. To install them, the service calls +"unopkg add --shared ..." with the appropriate arguments. + +The service is started initially after the installation of +ooo_bundled_extensions.xml. At this time, all files of OOo, including the +extensions, have been copied to their destination. The service calls unopkg on +behalf of every extension and adds the path to that extension to the file +'installed'. The file 'installed' is used to remember what extensions have +already been installed with unopkg. This will prevent to reinstall those +extensions whenever the service is restarted. + +When a new version of OOo becomes available, then the respective OOo package +containes a new version of 'installed'. That is, it contains a version string, +such as 3.2.0. The sole reason for that string is, to change the content of this +file in every release. Otherwise IPS would not replace the installed version of +'installed' with the one contained in the package. + +The update procedure of OOo will replace 'installed'. 'installed' is associated +with a restart_fmri of the service ooo_bundled_extensions. That is after +copying 'installed' the service will be restarted. It then installes all +extensions contained in /opt/openoffice.org3/share/extension/install, because +the newly installed 'installed' file does not contain any entries yet, except +for the version string. + + +================================================================================ +Known issues +================================================================================ + +If OOo, which contains this service, is uninstalled and later it is installed +again, then the bundled extensions are not installed. That is, unopkg is not +called to install them with OOo's Extensions Manager. The reasons is a bug in +OpenSolaris: + +http://defect.opensolaris.org/bz/show_bug.cgi?id=5742 + +To work around this, one can call after uninstalling OOo + +svccfg delete -f ooo_bundled_extensions +svccfg delete smf/manifest diff --git a/setup_native/source/opensolaris/bundledextensions/installed b/setup_native/source/opensolaris/bundledextensions/installed new file mode 100644 index 000000000000..0c8d8df5ae26 --- /dev/null +++ b/setup_native/source/opensolaris/bundledextensions/installed @@ -0,0 +1 @@ +${OOOPACKAGEVERSION} diff --git a/setup_native/source/opensolaris/bundledextensions/ooo_bundled_extensions.xml b/setup_native/source/opensolaris/bundledextensions/ooo_bundled_extensions.xml new file mode 100644 index 000000000000..66acd508c281 --- /dev/null +++ b/setup_native/source/opensolaris/bundledextensions/ooo_bundled_extensions.xml @@ -0,0 +1,60 @@ +<?xml version="1.0"?> + +<!DOCTYPE service_bundle SYSTEM "/usr/share/lib/xml/dtd/service_bundle.dtd.1"> + +<service_bundle type="manifest" name="ooo_bundled_extensions"> + +<service + name="application/ooo_bundled_extensions" + type="service" + version="1"> + + <create_default_instance enabled="true" /> + <single_instance/> + + <dependency name="service_available" + grouping="require_all" + restart_on="none" + type="service"> + <service_fmri value="svc:/system/filesystem/local:default" /> + </dependency> + + <exec_method + type="method" name="start" + exec="/lib/svc/method/svc-ooo_bundled_extensions start" + timeout_seconds="160"> + <method_context> + <method_credential user="root" group="root" /> + </method_context> + </exec_method> + + + <exec_method + type="method" name="stop" + exec="/lib/svc/method/svc-ooo_bundled_extensions stop" + timeout_seconds="160" > + <method_context> + <method_credential user="root" group="root" /> + </method_context> + </exec_method> + + <property_group name="startd" type="framework"> + <propval name="duration" type="astring" + value="transient" /> + <propval name="ignore_error" + type="astring" value="core,signal" /> + + </property_group> + + <stability value="Unstable" /> + + <template> + <common_name> + <loctext xml:lang="C"> + Installation of OpenOffice.org's bundled extensions. + </loctext> + </common_name> + </template> +</service> + +</service_bundle> diff --git a/setup_native/source/opensolaris/bundledextensions/svc-ooo_bundled_extensions b/setup_native/source/opensolaris/bundledextensions/svc-ooo_bundled_extensions new file mode 100644 index 000000000000..696277011133 --- /dev/null +++ b/setup_native/source/opensolaris/bundledextensions/svc-ooo_bundled_extensions @@ -0,0 +1,108 @@ +#!/sbin/sh + +. /lib/svc/share/smf_include.sh + +#The start method is used for installing and updating the +#extensions. The service keeps a list +#(share/extensions/install/installed) of the extensions which were +#already installed. During installation, the bundled extensions are +#copied to the install folder (share/extensions/install). Finally this +#service, which is part of the office installation package, will be +#started and the start "method" of this script is called. Then all +#extensions in the "install" folder are checked if they are already +#installed by reading the list "installed". Because the list is empty +#at this time, all the extensions will be installed. +# +#If this service is restarted then the script checks if there is an +#extensions which is not yet installed, that is there is no entry for +#it in the 'installed' file. Only if this is the case then that +#extensions will be installed and its path is added to 'installed'. +# +#In case of an update, new versions of existing extensions and +#completely new extensions may be copied to the 'install' folder. Also +#a new 'installed' file will be copied which replaces the existing +#file. The new 'installed' file does not contain any entries of +#installed extensions. Therefore the next time when the start method is +#run all extensions contained in share/extensions/install will be +#installed. + +#Create the folder which contains the temporary user installation +INSTDIR=`/usr/bin/mktemp -d "/tmp/userinstall.XXXXXX"` + +OOO_BASE_DIR="/opt/openoffice.org/basis${OOOBASEVERSION}" + +case "$1" in +'start') + EXTENSIONDIR=/opt/openoffice.org${OOOBRANDPACKAGEVERSION}/share/extension/install + for FILE in $EXTENSIONDIR/*.oxt + do + #We check if the file exist, because if there is no extension + #then $FILE will contain "<..>/*.oxt" + if [ -f "$FILE" ]; then + #Determine if this extension is already installed. We do + #that by checking the file "installed" which contains a + #list of all installed extensions including the full path + EXTENSIONFILE=`basename $FILE` + INSTALLED=`sed -n "/$EXTENSIONFILE/p" $EXTENSIONDIR/installed` + + if [ -z "$INSTALLED" ]; then + #We have not found the name of the extension in the + #list. That is, it has not been installed (with unopkg) yet. + #Therefore we do it now. + echo installing $FILE + /opt/openoffice.org${OOOBRANDPACKAGEVERSION}/program/unopkg add --shared --bundled "$FILE" '-env:UserInstallation=file://$INSTDIR' '-env:UNO_JAVA_JFW_INSTALL_DATA=$OOO_BASE_DIR/share/config/javasettingsunopkginstall.xml' '-env:JFW_PLUGIN_DO_NOT_CHECK_ACCESSIBILITY=1' + #Let us remember that this extensions has been installed + #by adding the path name of the extension to the file + #installed + echo $FILE >> $EXTENSIONDIR/installed + fi + fi + done + + #Now check for extensions which need to be uninstalled + #(unopkg). This is the case if the list of extensions in the file + #installed contains the name of an extension which does not exist + #in the the folder <..>/share/extension/install. +# LINE="" +# NEWCONTENT="" +# REMOVED="" +# LIST=`cat $EXTENSIONDIR/installed` +# #remove blank lines +# LIST=`echo "$LIST" | sed '/^[:blank:]*$/d'` + +# echo "$LIST" | while [ 1 ] +# do +# read LINE || break +# if [ ! -f "$LINE" ]; then +# #The extension file has been removed from +# #share/extension/install. Now we remove the installed +# #extension +# echo removing `basename $LINE` +# /opt/openoffice.org${OOOBRANDPACKAGEVERSION}/program/unopkg remove --shared --bundled "`basename $LINE`" '-env:UserInstallation=file://$INSTDIR' '-env:UNO_JAVA_JFW_INSTALL_DATA=$OOO_BASE_DIR/share/config/javasettingsunopkginstall.xml' '-env:JFW_PLUGIN_DO_NOT_CHECK_ACCESSIBILITY=1' +# REMOVED=1 +# else +# NEWCONTENT+=$LINE +# NEWCONTENT+="\n" +# fi +# done + +# #Write the new list to the file "installed". It now has all names +# #remove which refered to previously removed extensions (removed +# #from .../share/extension/install) +# if [ "$REMOVED" ]; then +# #remove the last empty line +# NEWCONTENT=`echo "$NEWCONTENT" | sed '/^[:space:]*$/d'` +# echo "$NEWCONTENT" > $EXTENSIONDIR/installed +# fi + + ;; + 'stop') + echo "#### stop ####" + ;; + *) + echo "Usage: $0 { start | stop }" + exit 1 + ;; +esac + +exit $SMF_EXIT_OK diff --git a/setup_native/source/packinfo/finals_instsetoo.txt b/setup_native/source/packinfo/finals_instsetoo.txt new file mode 100644 index 000000000000..5832dfa54a7a --- /dev/null +++ b/setup_native/source/packinfo/finals_instsetoo.txt @@ -0,0 +1,14 @@ +# Comment line +# Syntax: +# Column 1: Product +# Column 2: pro or nonpro +# Column 3: languages, comma separated list +# Column 4: path to msi database in installation set +# Separator between columns is one or more than one tabulator + +# Examples: +# OpenOffice pro en-US \\<server>\<path>\msi\OOO300_m6_native_packed-1_en-US.9352\openofficeorg30.msi +# OpenOffice pro en-US,de,es \\<server>\<path>\msi\OOO300_m6_native_packed-1_en-US_de_es.9352\openofficeorg30.msi +# OpenOffice pro de \\<server>\<path>\msi\OOO300_m6_native_packed-1_de.9352\openofficeorg30.msi +# OpenOfficeLanguagePack pro es \\<server>\<path>\msi\OOO300_m6_native_packed-1_es.9352\openofficeorg30.msi +# URE pro en-US \\<server>\<path>\msi\OOO300_m6_native_packed-1_en-US.9352\ure14.msi diff --git a/setup_native/source/packinfo/openoffice.pcp b/setup_native/source/packinfo/openoffice.pcp Binary files differnew file mode 100644 index 000000000000..142822728ec8 --- /dev/null +++ b/setup_native/source/packinfo/openoffice.pcp diff --git a/setup_native/source/packinfo/openofficelanguagepack.pcp b/setup_native/source/packinfo/openofficelanguagepack.pcp Binary files differnew file mode 100644 index 000000000000..013a11ed0c2b --- /dev/null +++ b/setup_native/source/packinfo/openofficelanguagepack.pcp diff --git a/setup_native/source/packinfo/package_names.txt b/setup_native/source/packinfo/package_names.txt new file mode 100644 index 000000000000..7e7276c2fa40 --- /dev/null +++ b/setup_native/source/packinfo/package_names.txt @@ -0,0 +1,73 @@ +%BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-%LANGUAGESTRING Language module for OpenOffice.org %OOOBASEVERSION, language %LANGUAGESTRING +%BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-%LANGUAGESTRING-base Base language module for OpenOffice.org %OOOBASEVERSION, language %LANGUAGESTRING +%BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-%LANGUAGESTRING-binfilter Legacy filters (e.g. StarOffice 5.2) for OpenOffice.org %OOOBASEVERSION, language %LANGUAGESTRING +%BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-%LANGUAGESTRING-calc Calc language module for OpenOffice.org %OOOBASEVERSION, language %LANGUAGESTRING +%BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-%LANGUAGESTRING-draw Draw language module for OpenOffice.org %OOOBASEVERSION, language %LANGUAGESTRING +%BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-%LANGUAGESTRING-fonts Language fonts module for OpenOffice.org %OOOBASEVERSION, language %LANGUAGESTRING +%BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-%LANGUAGESTRING-help Language help module for OpenOffice.org %OOOBASEVERSION, language %LANGUAGESTRING +%BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-%LANGUAGESTRING-impress Impress language module for OpenOffice.org %OOOBASEVERSION, language %LANGUAGESTRING +%BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-%LANGUAGESTRING-math Math language module for OpenOffice.org %OOOBASEVERSION, language %LANGUAGESTRING +%BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-%LANGUAGESTRING-onlineupd Online update language module for OpenOffice.org %OOOBASEVERSION, language %LANGUAGESTRING +%BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-%LANGUAGESTRING-res Language resource module for OpenOffice.org %OOOBASEVERSION, language %LANGUAGESTRING +%BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-%LANGUAGESTRING-writer Writer language module for OpenOffice.org %OOOBASEVERSION, language %LANGUAGESTRING +%BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-activex ActiveX control for OpenOffice.org %OOOBASEVERSION +%BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-base Base module for OpenOffice.org %OOOBASEVERSION +%BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-binfilter Legacy filters (e.g. StarOffice 5.2) for OpenOffice.org %OOOBASEVERSION +%BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-calc Calc module for OpenOffice.org %OOOBASEVERSION +%BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core01 Core module for OpenOffice.org %OOOBASEVERSION +%BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core02 Office core module for OpenOffice.org %OOOBASEVERSION +%BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core03 Office core module for OpenOffice.org %OOOBASEVERSION +%BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core04 Office core module for OpenOffice.org %OOOBASEVERSION +%BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core05 Office core module for OpenOffice.org %OOOBASEVERSION +%BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core06 Office core module for OpenOffice.org %OOOBASEVERSION +%BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core07 Office core module for OpenOffice.org %OOOBASEVERSION +%BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-dict-gl Gl dictionary for %PRODUCTNAME %PRODUCTVERSION +%BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-dict-vi Vietnamese dictionary for %PRODUCTNAME %PRODUCTVERSION +%BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-draw Draw module for OpenOffice.org %OOOBASEVERSION +%BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-emailmerge Email mailmerge module for OpenOffice.org %OOOBASEVERSION +%BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-gnome-integratn Gnome integration module for OpenOffice.org %OOOBASEVERSION +%BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-graphicfilter Graphic filter module for OpenOffice.org %OOOBASEVERSION +%BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-headless Headless display module for OpenOffice.org %OOOBASEVERSION +%BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-images Images module for OpenOffice.org %OOOBASEVERSION +%BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-impress Impress module for OpenOffice.org %OOOBASEVERSION +%BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-javafilter Java filter module for OpenOffice.org %OOOBASEVERSION +%BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-kde-integration KDE integration module for OpenOffice.org %OOOBASEVERSION +%BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-math Math module for OpenOffice.org %OOOBASEVERSION +%BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-onlineupdate Online update modul for OpenOffice.org %OOOBASEVERSION +%BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-ooofonts Mailcap module for OpenOffice.org %OOOBASEVERSION +%BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-ooolinguistic Linguistic module for OpenOffice.org %OOOBASEVERSION +%BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-pyuno Pyuno module for OpenOffice.org %OOOBASEVERSION +%BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-spellcheck English spellchecker module for OpenOffice.org %OOOBASEVERSION +%BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-testtool Testtool module for OpenOffice.org %OOOBASEVERSION +%BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-writer Writer module for OpenOffice.org %OOOBASEVERSION +%BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-xsltfilter XSLT filter samples module for OpenOffice.org %OOOBASEVERSION +%PACKAGEPREFIX%SOLARISBRANDPACKAGENAME%BRANDPACKAGEVERSION-dict-af Af dictionary for %PRODUCTNAME %PRODUCTVERSION +%PACKAGEPREFIX%SOLARISBRANDPACKAGENAME%BRANDPACKAGEVERSION-dict-cs Cs dictionary for %PRODUCTNAME %PRODUCTVERSION +%PACKAGEPREFIX%SOLARISBRANDPACKAGENAME%BRANDPACKAGEVERSION-dict-da Da dictionary for %PRODUCTNAME %PRODUCTVERSION +%PACKAGEPREFIX%SOLARISBRANDPACKAGENAME%BRANDPACKAGEVERSION-dict-de De dictionary for %PRODUCTNAME %PRODUCTVERSION +%PACKAGEPREFIX%SOLARISBRANDPACKAGENAME%BRANDPACKAGEVERSION-dict-en En dictionary for %PRODUCTNAME %PRODUCTVERSION +%PACKAGEPREFIX%SOLARISBRANDPACKAGENAME%BRANDPACKAGEVERSION-dict-es Es dictionary for %PRODUCTNAME %PRODUCTVERSION +%PACKAGEPREFIX%SOLARISBRANDPACKAGENAME%BRANDPACKAGEVERSION-dict-et Et dictionary for %PRODUCTNAME %PRODUCTVERSION +%PACKAGEPREFIX%SOLARISBRANDPACKAGENAME%BRANDPACKAGEVERSION-dict-fr Fr dictionary for %PRODUCTNAME %PRODUCTVERSION +%PACKAGEPREFIX%SOLARISBRANDPACKAGENAME%BRANDPACKAGEVERSION-dict-hu Hu dictionary for %PRODUCTNAME %PRODUCTVERSION +%PACKAGEPREFIX%SOLARISBRANDPACKAGENAME%BRANDPACKAGEVERSION-dict-it It dictionary for %PRODUCTNAME %PRODUCTVERSION +%PACKAGEPREFIX%SOLARISBRANDPACKAGENAME%BRANDPACKAGEVERSION-dict-lt Lt dictionary for %PRODUCTNAME %PRODUCTVERSION +%PACKAGEPREFIX%SOLARISBRANDPACKAGENAME%BRANDPACKAGEVERSION-dict-ne Ne dictionary for %PRODUCTNAME %PRODUCTVERSION +%PACKAGEPREFIX%SOLARISBRANDPACKAGENAME%BRANDPACKAGEVERSION-dict-nl Nl dictionary for %PRODUCTNAME %PRODUCTVERSION +%PACKAGEPREFIX%SOLARISBRANDPACKAGENAME%BRANDPACKAGEVERSION-dict-pl Pl dictionary for %PRODUCTNAME %PRODUCTVERSION +%PACKAGEPREFIX%SOLARISBRANDPACKAGENAME%BRANDPACKAGEVERSION-dict-pt Pt dictionary for %PRODUCTNAME %PRODUCTVERSION +%PACKAGEPREFIX%SOLARISBRANDPACKAGENAME%BRANDPACKAGEVERSION-dict-ru Ru dictionary for %PRODUCTNAME %PRODUCTVERSION +%PACKAGEPREFIX%SOLARISBRANDPACKAGENAME%BRANDPACKAGEVERSION-dict-sk Sk dictionary for %PRODUCTNAME %PRODUCTVERSION +%PACKAGEPREFIX%SOLARISBRANDPACKAGENAME%BRANDPACKAGEVERSION-dict-sl Sl dictionary for %PRODUCTNAME %PRODUCTVERSION +%PACKAGEPREFIX%SOLARISBRANDPACKAGENAME%BRANDPACKAGEVERSION-dict-sv Sv dictionary for %PRODUCTNAME %PRODUCTVERSION +%PACKAGEPREFIX%SOLARISBRANDPACKAGENAME%BRANDPACKAGEVERSION-dict-sw Sw dictionary for %PRODUCTNAME %PRODUCTVERSION +%PACKAGEPREFIX%SOLARISBRANDPACKAGENAME%BRANDPACKAGEVERSION-dict-th Th dictionary for %PRODUCTNAME %PRODUCTVERSION +%PACKAGEPREFIX%SOLARISBRANDPACKAGENAME%BRANDPACKAGEVERSION-dict-zu Zu dictionary for %PRODUCTNAME %PRODUCTVERSION +%WITHOUTDOTUNIXPACKAGENAME%BRANDPACKAGEVERSION Brand module for %PRODUCTNAME %PRODUCTVERSION +%WITHOUTDOTUNIXPACKAGENAME%BRANDPACKAGEVERSION-%LANGUAGESTRING Brand language module for %PRODUCTNAME %PRODUCTVERSION +%WITHOUTDOTUNIXPACKAGENAME%BRANDPACKAGEVERSION-base Base brand module for %PRODUCTNAME %PRODUCTVERSION +%WITHOUTDOTUNIXPACKAGENAME%BRANDPACKAGEVERSION-calc Calc brand module for %PRODUCTNAME %PRODUCTVERSION +%WITHOUTDOTUNIXPACKAGENAME%BRANDPACKAGEVERSION-draw Draw brand module for %PRODUCTNAME %PRODUCTVERSION +%WITHOUTDOTUNIXPACKAGENAME%BRANDPACKAGEVERSION-impress Impress brand module for %PRODUCTNAME %PRODUCTVERSION +%WITHOUTDOTUNIXPACKAGENAME%BRANDPACKAGEVERSION-math Math brand module for %PRODUCTNAME %PRODUCTVERSION +%WITHOUTDOTUNIXPACKAGENAME%BRANDPACKAGEVERSION-writer Writer brand module for %PRODUCTNAME %PRODUCTVERSION diff --git a/setup_native/source/packinfo/package_names_ext.txt b/setup_native/source/packinfo/package_names_ext.txt new file mode 100644 index 000000000000..18e167948cb2 --- /dev/null +++ b/setup_native/source/packinfo/package_names_ext.txt @@ -0,0 +1,21 @@ +%SOLSUREPACKAGEPREFIX-ure UNO Runtime Environment +SUNWcar Core Architecture, (Root) +SUNWcsd Core Solaris Devices +SUNWcsl Core Solaris, (Shared Libs) +SUNWcsr Core Solaris, (Root) +SUNWcsu Core Solaris, (Usr) +SUNWfreetype2 FreeType2 font library +SUNWgnome-base-libs GNOME base GUI libraries - platform dependent files, /usr filesystem +SUNWgnome-config GNOME configuration framework - platform dependent files, /usr filesystem +SUNWgnome-vfs GNOME Virtual File System Framework and application/MIME type registry - platform dependent files, /usr filesystem +SUNWgzip The GNU Zip (gzip) compression utility +SUNWmfrun Motif RunTime Kit +SUNWkvm Core Architecture, (Kvm) +SUNWlibC Sun Workshop Compilers Bundled libC +SUNWPython The Python interpreter, libraries and utilities +SUNWxwplt X Window System platform software +SUNWxwrtl X Window System & Graphics Runtime Library Links in /usr/lib +SUNWzlibr The Zip compression library (Root) +SUNWbtool CCS tools bundled with SunOS +SUNWxcu4 XCU4 Utilities + diff --git a/setup_native/source/packinfo/packinfo_brand.txt b/setup_native/source/packinfo/packinfo_brand.txt new file mode 100644 index 000000000000..3c9a17a5cab1 --- /dev/null +++ b/setup_native/source/packinfo/packinfo_brand.txt @@ -0,0 +1,139 @@ +#************************************************************************* +# +# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. +# +# Copyright 2000, 2010 Oracle and/or its affiliates. +# +# OpenOffice.org - a multi-platform office productivity suite +# +# This file is part of OpenOffice.org. +# +# OpenOffice.org is free software: you can redistribute it and/or modify +# it under the terms of the GNU Lesser General Public License version 3 +# only, as published by the Free Software Foundation. +# +# OpenOffice.org is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU Lesser General Public License version 3 for more details +# (a copy is included in the LICENSE file that accompanied this code). +# +# You should have received a copy of the GNU Lesser General Public License +# version 3 along with OpenOffice.org. If not, see +# <http://www.openoffice.org/license.html> +# for a copy of the LGPLv3 License. +# +#************************************************************************* + +Start +module = "gid_Module_Root_Brand" +# script = "shellscripts_brand.txt" +solarispackagename = "%WITHOUTDOTUNIXPACKAGENAME%BRANDPACKAGEVERSION" +packagename = "%UNIXPACKAGENAME%BRANDPACKAGEVERSION" +requires = "%UREPACKAGEPREFIX-ure,%BASISPACKAGEPREFIX%OOOBASEVERSION-core01,%BASISPACKAGEPREFIX%OOOBASEVERSION-core02,%BASISPACKAGEPREFIX%OOOBASEVERSION-core03,%BASISPACKAGEPREFIX%OOOBASEVERSION-core04,%BASISPACKAGEPREFIX%OOOBASEVERSION-core05,%BASISPACKAGEPREFIX%OOOBASEVERSION-core06,%BASISPACKAGEPREFIX%OOOBASEVERSION-core07,%BASISPACKAGEPREFIX%OOOBASEVERSION-images" +solarisrequires = "%SOLSUREPACKAGEPREFIX-ure (Name="UNO Runtime Environment"), %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core01 (Name="Core module for %PRODUCTNAME %PRODUCTVERSION"), %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core02 (Name="Core module for %PRODUCTNAME %PRODUCTVERSION"), %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core03 (Name="Core module for %PRODUCTNAME %PRODUCTVERSION"), %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core04 (Name="Core module for %PRODUCTNAME %PRODUCTVERSION"), %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core05 (Name="Core module for %PRODUCTNAME %PRODUCTVERSION"), %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core06 (Name="Core module for %PRODUCTNAME %PRODUCTVERSION"), %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core07 (Name="Core module for %PRODUCTNAME %PRODUCTVERSION"), %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-images (Name="Images module for %PRODUCTNAME %PRODUCTVERSION")" +copyright = "1999-2009 by %PRODUCTNAME" +solariscopyright = "solariscopyrightfile" +vendor = "%PRODUCTNAME" +description = "Brand module for %PRODUCTNAME %PRODUCTVERSION" +destpath = "/opt" +packageversion = "%PACKAGEVERSION" +End + +Start +module = "gid_Module_Brand_Prg_Wrt" +solarispackagename = "%WITHOUTDOTUNIXPACKAGENAME%BRANDPACKAGEVERSION-writer" +packagename = "%UNIXPACKAGENAME%BRANDPACKAGEVERSION-writer" +requires = "%UNIXPACKAGENAME%BRANDPACKAGEVERSION,%BASISPACKAGEPREFIX%OOOBASEVERSION-writer" +solarisrequires = "%WITHOUTDOTUNIXPACKAGENAME%BRANDPACKAGEVERSION,%BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-writer" +copyright = "1999-2009 by %PRODUCTNAME" +solariscopyright = "solariscopyrightfile" +vendor = "%PRODUCTNAME" +description = "Writer brand module for %PRODUCTNAME %PRODUCTVERSION" +destpath = "/opt" +packageversion = "%PACKAGEVERSION" +End + +Start +module = "gid_Module_Brand_Prg_Calc" +solarispackagename = "%WITHOUTDOTUNIXPACKAGENAME%BRANDPACKAGEVERSION-calc" +packagename = "%UNIXPACKAGENAME%BRANDPACKAGEVERSION-calc" +requires = "%UNIXPACKAGENAME%BRANDPACKAGEVERSION,%BASISPACKAGEPREFIX%OOOBASEVERSION-calc" +solarisrequires = "%WITHOUTDOTUNIXPACKAGENAME%BRANDPACKAGEVERSION,%BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-calc" +copyright = "1999-2009 by %PRODUCTNAME" +solariscopyright = "solariscopyrightfile" +vendor = "%PRODUCTNAME" +description = "Calc brand module for %PRODUCTNAME %PRODUCTVERSION" +destpath = "/opt" +packageversion = "%PACKAGEVERSION" +End + +Start +module = "gid_Module_Brand_Prg_Impress" +solarispackagename = "%WITHOUTDOTUNIXPACKAGENAME%BRANDPACKAGEVERSION-impress" +packagename = "%UNIXPACKAGENAME%BRANDPACKAGEVERSION-impress" +requires = "%UNIXPACKAGENAME%BRANDPACKAGEVERSION,%BASISPACKAGEPREFIX%OOOBASEVERSION-impress" +solarisrequires = "%WITHOUTDOTUNIXPACKAGENAME%BRANDPACKAGEVERSION,%BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-impress" +copyright = "1999-2009 by %PRODUCTNAME" +solariscopyright = "solariscopyrightfile" +vendor = "%PRODUCTNAME" +description = "Impress brand module for %PRODUCTNAME %PRODUCTVERSION" +destpath = "/opt" +packageversion = "%PACKAGEVERSION" +End + +Start +module = "gid_Module_Brand_Prg_Draw" +solarispackagename = "%WITHOUTDOTUNIXPACKAGENAME%BRANDPACKAGEVERSION-draw" +packagename = "%UNIXPACKAGENAME%BRANDPACKAGEVERSION-draw" +requires = "%UNIXPACKAGENAME%BRANDPACKAGEVERSION,%BASISPACKAGEPREFIX%OOOBASEVERSION-draw" +solarisrequires = "%WITHOUTDOTUNIXPACKAGENAME%BRANDPACKAGEVERSION,%BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-draw" +copyright = "1999-2009 by %PRODUCTNAME" +solariscopyright = "solariscopyrightfile" +vendor = "%PRODUCTNAME" +description = "Draw brand module for %PRODUCTNAME %PRODUCTVERSION" +destpath = "/opt" +packageversion = "%PACKAGEVERSION" +End + +Start +module = "gid_Module_Brand_Prg_Math" +solarispackagename = "%WITHOUTDOTUNIXPACKAGENAME%BRANDPACKAGEVERSION-math" +packagename = "%UNIXPACKAGENAME%BRANDPACKAGEVERSION-math" +requires = "%UNIXPACKAGENAME%BRANDPACKAGEVERSION,%BASISPACKAGEPREFIX%OOOBASEVERSION-math" +solarisrequires = "%WITHOUTDOTUNIXPACKAGENAME%BRANDPACKAGEVERSION,%BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-math" +copyright = "1999-2009 by %PRODUCTNAME" +solariscopyright = "solariscopyrightfile" +vendor = "%PRODUCTNAME" +description = "Math brand module for %PRODUCTNAME %PRODUCTVERSION" +destpath = "/opt" +packageversion = "%PACKAGEVERSION" +End + +Start +module = "gid_Module_Brand_Prg_Base" +solarispackagename = "%WITHOUTDOTUNIXPACKAGENAME%BRANDPACKAGEVERSION-base" +packagename = "%UNIXPACKAGENAME%BRANDPACKAGEVERSION-base" +requires = "%UNIXPACKAGENAME%BRANDPACKAGEVERSION,%BASISPACKAGEPREFIX%OOOBASEVERSION-base" +solarisrequires = "%WITHOUTDOTUNIXPACKAGENAME%BRANDPACKAGEVERSION,%BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-base" +copyright = "1999-2009 by %PRODUCTNAME" +solariscopyright = "solariscopyrightfile" +vendor = "%PRODUCTNAME" +description = "Base brand module for %PRODUCTNAME %PRODUCTVERSION" +destpath = "/opt" +packageversion = "%PACKAGEVERSION" +End + +Start +module = "gid_Module_Langpack_Brand" +solarispackagename = "%WITHOUTDOTUNIXPACKAGENAME%BRANDPACKAGEVERSION-%LANGUAGESTRING" +packagename = "%UNIXPACKAGENAME%BRANDPACKAGEVERSION-%LANGUAGESTRING" +requires = "%UNIXPACKAGENAME%BRANDPACKAGEVERSION,%BASISPACKAGEPREFIX%OOOBASEVERSION-%LANGUAGESTRING,%BASISPACKAGEPREFIX%OOOBASEVERSION-%LANGUAGESTRING-base,%BASISPACKAGEPREFIX%OOOBASEVERSION-%LANGUAGESTRING-calc,%BASISPACKAGEPREFIX%OOOBASEVERSION-%LANGUAGESTRING-draw,%BASISPACKAGEPREFIX%OOOBASEVERSION-%LANGUAGESTRING-help,%BASISPACKAGEPREFIX%OOOBASEVERSION-%LANGUAGESTRING-impress,%BASISPACKAGEPREFIX%OOOBASEVERSION-%LANGUAGESTRING-math,%BASISPACKAGEPREFIX%OOOBASEVERSION-%LANGUAGESTRING-res,%BASISPACKAGEPREFIX%OOOBASEVERSION-%LANGUAGESTRING-writer" +solarisrequires = "%WITHOUTDOTUNIXPACKAGENAME%BRANDPACKAGEVERSION,%BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-%LANGUAGESTRING (Name="Language module for %PRODUCTNAME %PRODUCTVERSION\, language %LANGUAGESTRING"),%BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-%LANGUAGESTRING-base (Name="Base language module for %PRODUCTNAME %PRODUCTVERSION\, language %LANGUAGESTRING"),%BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-%LANGUAGESTRING-calc (Name="Calc language module for %PRODUCTNAME %PRODUCTVERSION\, language %LANGUAGESTRING"),%BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-%LANGUAGESTRING-draw (Name="Draw language module for %PRODUCTNAME %PRODUCTVERSION\, language %LANGUAGESTRING"),%BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-%LANGUAGESTRING-help (Name="Help language module for %PRODUCTNAME %PRODUCTVERSION\, language %LANGUAGESTRING"),%BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-%LANGUAGESTRING-impress (Name="Impress language module for %PRODUCTNAME %PRODUCTVERSION\, language %LANGUAGESTRING"),%BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-%LANGUAGESTRING-math (Name="Math language module for %PRODUCTNAME %PRODUCTVERSION\, language %LANGUAGESTRING"),%BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-%LANGUAGESTRING-res (Name="Resource language module for %PRODUCTNAME %PRODUCTVERSION\, language %LANGUAGESTRING"),%BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-%LANGUAGESTRING-writer (Name="Writer language module for %PRODUCTNAME %PRODUCTVERSION\, language %LANGUAGESTRING")" +copyright = "1999-2009 by %PRODUCTNAME" +solariscopyright = "solariscopyrightfile" +vendor = "%PRODUCTNAME" +description = "Brand language module for %PRODUCTNAME %PRODUCTVERSION" +destpath = "/opt" +packageversion = "%PACKAGEVERSION" +End diff --git a/setup_native/source/packinfo/packinfo_office.txt b/setup_native/source/packinfo/packinfo_office.txt new file mode 100755 index 000000000000..b9c26f9f9572 --- /dev/null +++ b/setup_native/source/packinfo/packinfo_office.txt @@ -0,0 +1,1004 @@ +# Format: + +# Start +# scpModule +# shellscript file (optional) +# solarispackagename +# solarisrequires (optional) +# solarisprovides (optional) +# packagename +# linuxreplaces (optional) +# requires (optional) +# provides (optional) +# copyright +# vendor +# description +# destpath +# End + +Start +module = "gid_Module_Optional_Gnome" +solarispackagename = "%BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-gnome-integratn" +solarisrequires = "%BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core01, SUNWgnome-config, SUNWgnome-vfs, SUNWlibC, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core04, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core05" +packagename = "%BASISPACKAGEPREFIX%OOOBASEVERSION-gnome-integration" +freebsdrequires = "%BASISPACKAGEPREFIX%OOOBASEVERSION-core01" +requires = "%BASISPACKAGEPREFIX%OOOBASEVERSION-core01" +findrequires = "find-requires-gnome.sh" +copyright = "1999-2009 by OpenOffice.org" +solariscopyright = "solariscopyrightfile" +vendor = "OpenOffice.org" +description = "Gnome integration module for OpenOffice.org %OOOBASEVERSION" +destpath = "/opt" +packageversion = "%OOOPACKAGEVERSION" +End + +Start +module = "gid_Module_Optional_Kde" +solarispackagename = "%BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-kde-integration" +solarisrequires = "%BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core01" +packagename = "%BASISPACKAGEPREFIX%OOOBASEVERSION-kde-integration" +freebsdrequires = "%BASISPACKAGEPREFIX%OOOBASEVERSION-core01" +requires = "%BASISPACKAGEPREFIX%OOOBASEVERSION-core01" +copyright = "1999-2009 by OpenOffice.org" +solariscopyright = "solariscopyrightfile" +vendor = "OpenOffice.org" +description = "KDE integration module for OpenOffice.org %OOOBASEVERSION" +destpath = "/opt" +packageversion = "%OOOPACKAGEVERSION" +End + +Start +module = "gid_Module_Root" +# script = "shellscripts_core01.txt" +solarispackagename = "%BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core01" +packagename = "%BASISPACKAGEPREFIX%OOOBASEVERSION-core01" +requires = "%UREPACKAGEPREFIX-ure" +solarisrequires = "SUNWcar, SUNWkvm, SUNWcsr, SUNWcsu, SUNWcsd, SUNWcsl, SUNWxwrtl, SUNWxwplt, SUNWlibC, %SOLSUREPACKAGEPREFIX-ure" +freebsdrequires = "%BASISPACKAGEPREFIX%OOOBASEVERSION-core02,%BASISPACKAGEPREFIX%OOOBASEVERSION-core03,%BASISPACKAGEPREFIX%OOOBASEVERSION-core04,%BASISPACKAGEPREFIX%OOOBASEVERSION-core05,%BASISPACKAGEPREFIX%OOOBASEVERSION-core06,%BASISPACKAGEPREFIX%OOOBASEVERSION-core07" +copyright = "1999-2009 by OpenOffice.org" +solariscopyright = "solariscopyrightfile" +vendor = "OpenOffice.org" +description = "Core module for OpenOffice.org %OOOBASEVERSION" +destpath = "/opt" +packageversion = "%OOOPACKAGEVERSION" +End + +Start +module = "gid_Module_Prg_Wrt_Bin" +script = "shellscripts_module.txt" +solarispackagename = "%BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-writer" +packagename = "%BASISPACKAGEPREFIX%OOOBASEVERSION-writer" +solarisrequires = "%BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core01,%BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core02,%BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core03,%BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core04,%BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core05,%BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core06,%BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core07, SUNWlibC" +freebsdrequires = "%BASISPACKAGEPREFIX%OOOBASEVERSION-core01" +requires = "%BASISPACKAGEPREFIX%OOOBASEVERSION-core01" +copyright = "1999-2009 by OpenOffice.org" +solariscopyright = "solariscopyrightfile" +vendor = "OpenOffice.org" +description = "Writer module for OpenOffice.org %OOOBASEVERSION" +destpath = "/opt" +packageversion = "%OOOPACKAGEVERSION" +End + +Start +module = "gid_Module_Prg_Calc_Bin" +script = "shellscripts_module.txt" +solarispackagename = "%BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-calc" +solarisrequires = "%BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core01,%BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core02,%BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core03,%BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core04,%BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core05,%BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core06,%BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core07, SUNWlibC" +packagename = "%BASISPACKAGEPREFIX%OOOBASEVERSION-calc" +freebsdrequires = "%BASISPACKAGEPREFIX%OOOBASEVERSION-core01" +requires = "%BASISPACKAGEPREFIX%OOOBASEVERSION-core01" +copyright = "1999-2009 by OpenOffice.org" +solariscopyright = "solariscopyrightfile" +vendor = "OpenOffice.org" +description = "Calc module for OpenOffice.org %OOOBASEVERSION" +destpath = "/opt" +packageversion = "%OOOPACKAGEVERSION" +End + +Start +module = "gid_Module_Prg_Draw_Bin" +script = "shellscripts_module.txt" +solarispackagename = "%BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-draw" +solarisrequires = "%BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core01,%BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core02,%BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core03,%BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core04,%BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core05,%BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core06,%BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core07, SUNWlibC" +packagename = "%BASISPACKAGEPREFIX%OOOBASEVERSION-draw" +freebsdrequires = "%BASISPACKAGEPREFIX%OOOBASEVERSION-core01" +requires = "%BASISPACKAGEPREFIX%OOOBASEVERSION-core01" +copyright = "1999-2009 by OpenOffice.org" +solariscopyright = "solariscopyrightfile" +vendor = "OpenOffice.org" +description = "Draw module for OpenOffice.org %OOOBASEVERSION" +destpath = "/opt" +packageversion = "%OOOPACKAGEVERSION" +End + +Start +module = "gid_Module_Prg_Impress_Bin" +script = "shellscripts_module.txt" +solarispackagename = "%BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-impress" +solarisrequires = "%BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core01,%BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core02,%BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core03,%BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core04,%BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core05,%BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core06,%BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core07, SUNWlibC" +packagename = "%BASISPACKAGEPREFIX%OOOBASEVERSION-impress" +freebsdrequires = "%BASISPACKAGEPREFIX%OOOBASEVERSION-core01" +requires = "%BASISPACKAGEPREFIX%OOOBASEVERSION-core01" +copyright = "1999-2009 by OpenOffice.org" +solariscopyright = "solariscopyrightfile" +vendor = "OpenOffice.org" +description = "Impress module for OpenOffice.org %OOOBASEVERSION" +destpath = "/opt" +packageversion = "%OOOPACKAGEVERSION" +End + +Start +module = "gid_Module_Prg_Base_Bin" +script = "shellscripts_module.txt" +solarispackagename = "%BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-base" +solarisrequires = "%BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core01,%BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core02,%BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core03,%BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core04,%BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core05,%BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core06,%BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core07, SUNWlibC" +packagename = "%BASISPACKAGEPREFIX%OOOBASEVERSION-base" +freebsdrequires = "%BASISPACKAGEPREFIX%OOOBASEVERSIONg-core01" +requires = "%BASISPACKAGEPREFIX%OOOBASEVERSION-core01" +copyright = "1999-2009 by OpenOffice.org" +solariscopyright = "solariscopyrightfile" +vendor = "OpenOffice.org" +description = "Base module for OpenOffice.org %OOOBASEVERSION" +destpath = "/opt" +packageversion = "%OOOPACKAGEVERSION" +End + +Start +module = "gid_Module_Prg_Math_Bin" +script = "shellscripts_module.txt" +solarispackagename = "%BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-math" +solarisrequires = "%BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core01,%BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core02,%BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core03,%BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core04,%BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core05,%BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core06,%BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core07, SUNWlibC" +packagename = "%BASISPACKAGEPREFIX%OOOBASEVERSION-math" +freebsdrequires = "%BASISPACKAGEPREFIX%OOOBASEVERSION-core01" +requires = "%BASISPACKAGEPREFIX%OOOBASEVERSION-core01" +copyright = "1999-2009 by OpenOffice.org" +solariscopyright = "solariscopyrightfile" +vendor = "OpenOffice.org" +description = "Math module for OpenOffice.org %OOOBASEVERSION" +destpath = "/opt" +packageversion = "%OOOPACKAGEVERSION" +End + +Start +module = "gid_Module_Optional_Binfilter" +solarispackagename = "%BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-binfilter" +solarisrequires = "%BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core01,%BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core04,%BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core05" +packagename = "%BASISPACKAGEPREFIX%OOOBASEVERSION-binfilter" +freebsdrequires = "%BASISPACKAGEPREFIX%OOOBASEVERSION-core01" +requires = "%BASISPACKAGEPREFIX%OOOBASEVERSION-core01" +copyright = "1999-2009 by OpenOffice.org" +solariscopyright = "solariscopyrightfile" +vendor = "OpenOffice.org" +description = "Legacy filters (e.g. StarOffice 5.2) for OpenOffice.org %OOOBASEVERSION" +destpath = "/opt" +packageversion = "%OOOPACKAGEVERSION" +End + +Start +module = "gid_Module_Optional_Grfflt" +solarispackagename = "%BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-graphicfilter" +solarisrequires = "%BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core01,%BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core04,%BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core05" +packagename = "%BASISPACKAGEPREFIX%OOOBASEVERSION-graphicfilter" +freebsdrequires = "%BASISPACKAGEPREFIX%OOOBASEVERSION-core01" +requires = "%BASISPACKAGEPREFIX%OOOBASEVERSION-core01" +copyright = "1999-2009 by OpenOffice.org" +solariscopyright = "solariscopyrightfile" +vendor = "OpenOffice.org" +description = "Graphic filter module for OpenOffice.org %OOOBASEVERSION" +destpath = "/opt" +packageversion = "%OOOPACKAGEVERSION" +End + +Start +module = "gid_Module_Oooimprovement" +solarispackagename = "%BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-oooimprovement" +solarisrequires = "%BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core01,%BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core04,%BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core05,SUNWmfrun" +packagename = "%BASISPACKAGEPREFIX%OOOBASEVERSION-oooimprovement" +freebsdrequires = "%BASISPACKAGEPREFIX%OOOBASEVERSION-core01" +requires = "%BASISPACKAGEPREFIX%OOOBASEVERSION-core01" +copyright = "1999-2009 by OpenOffice.org" +solariscopyright = "solariscopyrightfile" +vendor = "OpenOffice.org" +description = "Usage tracking module for OpenOffice.org %OOOBASEVERSION" +destpath = "/opt" +packageversion = "%OOOPACKAGEVERSION" +End + +Start +module = "gid_Module_Optional_Testtool" +solarispackagename = "%BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-testtool" +solarisrequires = "%BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core01,%BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core04,%BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core05,SUNWmfrun" +packagename = "%BASISPACKAGEPREFIX%OOOBASEVERSION-testtool" +freebsdrequires = "%BASISPACKAGEPREFIX%OOOBASEVERSION-core01" +requires = "%BASISPACKAGEPREFIX%OOOBASEVERSION-core01" +copyright = "1999-2009 by OpenOffice.org" +solariscopyright = "solariscopyrightfile" +vendor = "OpenOffice.org" +description = "Testtool module for OpenOffice.org %OOOBASEVERSION" +destpath = "/opt" +packageversion = "%OOOPACKAGEVERSION" +End + +Start +module = "gid_Module_Optional_Oo_English" +solarispackagename = "%BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-spellcheck" +solarisrequires = "%BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core01" +packagename = "%BASISPACKAGEPREFIX%OOOBASEVERSION-spellcheck" +freebsdrequires = "%BASISPACKAGEPREFIX%OOOBASEVERSION-core01" +requires = "%BASISPACKAGEPREFIX%OOOBASEVERSION-core01" +copyright = "1999-2009 by OpenOffice.org" +solariscopyright = "solariscopyrightfile" +vendor = "OpenOffice.org" +description = "English spellchecker module for OpenOffice.org %OOOBASEVERSION" +destpath = "/opt" +packageversion = "%OOOPACKAGEVERSION" +End + +Start +module = "gid_Module_Optional_Xsltfiltersamples" +solarispackagename = "%BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-xsltfilter" +solarisrequires = "%BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core01" +packagename = "%BASISPACKAGEPREFIX%OOOBASEVERSION-xsltfilter" +freebsdrequires = "%BASISPACKAGEPREFIX%OOOBASEVERSION-core01" +requires = "%BASISPACKAGEPREFIX%OOOBASEVERSION-core01" +copyright = "1999-2009 by OpenOffice.org" +solariscopyright = "solariscopyrightfile" +vendor = "OpenOffice.org" +description = "XSLT filter samples module for OpenOffice.org %OOOBASEVERSION" +destpath = "/opt" +packageversion = "%OOOPACKAGEVERSION" +End + +Start +module = "gid_Module_Optional_Javafilter" +solarispackagename = "%BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-javafilter" +solarisrequires = "%BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core01" +packagename = "%BASISPACKAGEPREFIX%OOOBASEVERSION-javafilter" +freebsdrequires = "%BASISPACKAGEPREFIX%OOOBASEVERSION-core01" +requires = "%BASISPACKAGEPREFIX%OOOBASEVERSION-core01" +copyright = "1999-2009 by OpenOffice.org" +solariscopyright = "solariscopyrightfile" +vendor = "OpenOffice.org" +description = "Java filter module for OpenOffice.org %OOOBASEVERSION" +destpath = "/opt" +packageversion = "%OOOPACKAGEVERSION" +End + +Start +module = "gid_Module_Optional_Activexcontrol" +solarispackagename = "%BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-activex" +solarisrequires = "%BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core01" +packagename = "%BASISPACKAGEPREFIX%OOOBASEVERSION-activex" +freebsdrequires = "%BASISPACKAGEPREFIX%OOOBASEVERSION-core01" +requires = "%BASISPACKAGEPREFIX%OOOBASEVERSION-core01" +copyright = "1999-2009 by OpenOffice.org" +solariscopyright = "solariscopyrightfile" +vendor = "OpenOffice.org" +description = "ActiveX control for OpenOffice.org %OOOBASEVERSION" +destpath = "/opt" +packageversion = "%OOOPACKAGEVERSION" +End + +Start +module = "gid_Module_Optional_Onlineupdate" +solarispackagename = "%BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-onlineupdate" +solarisrequires = "%BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core01, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core05, SUNWlibC, SUNWgzip" +packagename = "%BASISPACKAGEPREFIX%OOOBASEVERSION-onlineupdate" +requires = "%BASISPACKAGEPREFIX%OOOBASEVERSION-core01" +copyright = "1999-2010 by Oracle" +solariscopyright = "solariscopyrightfile" +vendor = "Oracle" +description = "Online update modul for OpenOffice.org %OOOBASEVERSION" +destpath = "/opt" +packageversion = "%OOOPACKAGEVERSION" +End + +Start +module = "gid_Module_Optional_Pyuno" +solarispackagename = "%BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-pyuno" +solarisrequires = "%BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core01, SUNWPython" +packagename = "%BASISPACKAGEPREFIX%OOOBASEVERSION-pyuno" +freebsdrequires = "%BASISPACKAGEPREFIX%OOOBASEVERSION-core01" +requires = "%BASISPACKAGEPREFIX%OOOBASEVERSION-core01" +copyright = "1999-2009 by OpenOffice.org" +solariscopyright = "solariscopyrightfile" +vendor = "OpenOffice.org" +description = "Pyuno module for OpenOffice.org %OOOBASEVERSION" +destpath = "/opt" +packageversion = "%OOOPACKAGEVERSION" +End + +Start +module = "gid_Module_Optional_Pymailmerge" +solarispackagename = "%BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-emailmerge" +solarisrequires = "%BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-pyuno" +packagename = "%BASISPACKAGEPREFIX%OOOBASEVERSION-emailmerge" +freebsdrequires = "%BASISPACKAGEPREFIX%OOOBASEVERSION-core01" +requires = "%BASISPACKAGEPREFIX%OOOBASEVERSION-pyuno" +copyright = "1999-2009 by OpenOffice.org" +solariscopyright = "solariscopyrightfile" +vendor = "OpenOffice.org" +description = "Email mailmerge module for OpenOffice.org %OOOBASEVERSION" +destpath = "/opt" +packageversion = "%OOOPACKAGEVERSION" +End + +Start +module = "gid_Module_Optional_Headless" +solarispackagename = "%BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-headless" +solarisrequires = "%BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core01" +packagename = "%BASISPACKAGEPREFIX%OOOBASEVERSION-headless" +freebsdrequires = "%BASISPACKAGEPREFIX%OOOBASEVERSION-core01" +requires = "%BASISPACKAGEPREFIX%OOOBASEVERSION-core01" +copyright = "1999-2009 by OpenOffice.org" +solariscopyright = "solariscopyrightfile" +vendor = "OpenOffice.org" +description = "Headless display module for OpenOffice.org %OOOBASEVERSION" +destpath = "/opt" +packageversion = "%OOOPACKAGEVERSION" +End + +Start +module = "gid_Module_Root_Files_Images" +solarispackagename = "%BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-images" +solarisrequires = "%BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core01" +packagename = "%BASISPACKAGEPREFIX%OOOBASEVERSION-images" +freebsdrequires = "%BASISPACKAGEPREFIX%OOOBASEVERSION-core01" +requires = "%BASISPACKAGEPREFIX%OOOBASEVERSION-core01" +copyright = "1999-2009 by OpenOffice.org" +solariscopyright = "solariscopyrightfile" +vendor = "OpenOffice.org" +description = "Images module for OpenOffice.org %OOOBASEVERSION" +destpath = "/opt" +packageversion = "%OOOPACKAGEVERSION" +End + +Start +module = "gid_Module_Root_Fonts_OOo_Hidden" +solarispackagename = "%BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-ooofonts" +solarisrequires = "%BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core01" +packagename = "%BASISPACKAGEPREFIX%OOOBASEVERSION-ooofonts" +freebsdrequires = "%BASISPACKAGEPREFIX%OOOBASEVERSION-core01" +requires = "%BASISPACKAGEPREFIX%OOOBASEVERSION-core01" +copyright = "1999-2009 by OpenOffice.org" +solariscopyright = "solariscopyrightfile" +vendor = "OpenOffice.org" +description = "Mailcap module for OpenOffice.org %OOOBASEVERSION" +destpath = "/opt" +packageversion = "%OOOPACKAGEVERSION" +End + +Start +module = "gid_Module_Oo_Linguistic" +solarispackagename = "%BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-ooolinguistic" +solarisrequires = "%BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core01, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core04, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core05" +packagename = "%BASISPACKAGEPREFIX%OOOBASEVERSION-ooolinguistic" +freebsdrequires = "%BASISPACKAGEPREFIX%OOOBASEVERSION-core01" +requires = "%BASISPACKAGEPREFIX%OOOBASEVERSION-core01" +copyright = "1999-2009 by OpenOffice.org" +solariscopyright = "solariscopyrightfile" +vendor = "OpenOffice.org" +description = "Linguistic module for OpenOffice.org %OOOBASEVERSION" +destpath = "/opt" +packageversion = "%OOOPACKAGEVERSION" +End + +Start +module = "gid_Module_Root_Files_2" +script = "shellscripts_module.txt" +solarispackagename = "%BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core02" +solarisrequires = "%BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core01, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core04, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core05, SUNWlibC, SUNWmfrun" +packagename = "%BASISPACKAGEPREFIX%OOOBASEVERSION-core02" +requires = "%BASISPACKAGEPREFIX%OOOBASEVERSION-core01" +freebsdrequires = "" +copyright = "1999-2009 by OpenOffice.org" +solariscopyright = "solariscopyrightfile" +vendor = "OpenOffice.org" +description = "Office core module for OpenOffice.org %OOOBASEVERSION" +destpath = "/opt" +packageversion = "%OOOPACKAGEVERSION" +End + +Start +module = "gid_Module_Root_Files_3" +solarispackagename = "%BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core03" +solarisrequires = "%BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core01, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core04, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core05, SUNWlibC" +packagename = "%BASISPACKAGEPREFIX%OOOBASEVERSION-core03" +requires = "%BASISPACKAGEPREFIX%OOOBASEVERSION-core01" +freebsdrequires = "" +copyright = "1999-2009 by OpenOffice.org" +solariscopyright = "solariscopyrightfile" +vendor = "OpenOffice.org" +description = "Office core module for OpenOffice.org %OOOBASEVERSION" +destpath = "/opt" +packageversion = "%OOOPACKAGEVERSION" +End + +Start +module = "gid_Module_Root_Files_4" +solarispackagename = "%BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core04" +solarisrequires = "SUNWfreetype2, SUNWgnome-base-libs, SUNWlibC, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core01" +packagename = "%BASISPACKAGEPREFIX%OOOBASEVERSION-core04" +requires = "%BASISPACKAGEPREFIX%OOOBASEVERSION-core01" +findrequires = "find-requires-x11.sh" +freebsdrequires = "" +copyright = "1999-2009 by OpenOffice.org" +solariscopyright = "solariscopyrightfile" +vendor = "OpenOffice.org" +description = "Office core module for OpenOffice.org %OOOBASEVERSION" +destpath = "/opt" +packageversion = "%OOOPACKAGEVERSION" +End + +Start +module = "gid_Module_Root_Files_5" +solarispackagename = "%BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core05" +solarisrequires = "%BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core01, SUNWgnome-base-libs, SUNWlibC" +packagename = "%BASISPACKAGEPREFIX%OOOBASEVERSION-core05" +requires = "%BASISPACKAGEPREFIX%OOOBASEVERSION-core01" +freebsdrequires = "" +copyright = "1999-2009 by OpenOffice.org" +solariscopyright = "solariscopyrightfile" +vendor = "OpenOffice.org" +description = "Office core module for OpenOffice.org %OOOBASEVERSION" +destpath = "/opt" +packageversion = "%OOOPACKAGEVERSION" +End + +Start +module = "gid_Module_Root_Files_6" +solarispackagename = "%BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core06" +solarisrequires = "%BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core01" +packagename = "%BASISPACKAGEPREFIX%OOOBASEVERSION-core06" +requires = "%BASISPACKAGEPREFIX%OOOBASEVERSION-core01" +freebsdrequires = "" +copyright = "1999-2009 by OpenOffice.org" +solariscopyright = "solariscopyrightfile" +vendor = "OpenOffice.org" +description = "Office core module for OpenOffice.org %OOOBASEVERSION" +destpath = "/opt" +packageversion = "%OOOPACKAGEVERSION" +End + +Start +module = "gid_Module_Root_Files_7" +solarispackagename = "%BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core07" +solarisrequires = "%BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core01" +packagename = "%BASISPACKAGEPREFIX%OOOBASEVERSION-core07" +requires = "%BASISPACKAGEPREFIX%OOOBASEVERSION-core01" +freebsdrequires = "" +copyright = "1999-2009 by OpenOffice.org" +solariscopyright = "solariscopyrightfile" +vendor = "OpenOffice.org" +description = "Office core module for OpenOffice.org %OOOBASEVERSION" +destpath = "/opt" +packageversion = "%OOOPACKAGEVERSION" +End + +Start +module = "gid_Module_Root_Extension_Oooimprovement" +script = "shellscripts_extensions.txt" +solarispackagename = "%PACKAGEPREFIX%SOLARISBRANDPACKAGENAME%BRANDPACKAGEVERSION-oooimprovement" +solarisrequires = "%SOLSUREPACKAGEPREFIX-ure, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core01, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core02, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core03, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core04, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core05, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core06, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core07, %PACKAGEPREFIX%SOLARISBRANDPACKAGENAME%BRANDPACKAGEVERSION" +packagename = "%UNIXPACKAGENAME%BRANDPACKAGEVERSION-oooimprovement" +requires = "%UREPACKAGEPREFIX-ure,%BASISPACKAGEPREFIX%OOOBASEVERSION-core01,%BASISPACKAGEPREFIX%OOOBASEVERSION-core02,%BASISPACKAGEPREFIX%OOOBASEVERSION-core03,%BASISPACKAGEPREFIX%OOOBASEVERSION-core04,%BASISPACKAGEPREFIX%OOOBASEVERSION-core05,%BASISPACKAGEPREFIX%OOOBASEVERSION-core06,%BASISPACKAGEPREFIX%OOOBASEVERSION-core07,%UNIXPACKAGENAME%BRANDPACKAGEVERSION" +linuxpatchrequires = "" +copyright = "1999-2010 by Oracle" +solariscopyright = "solariscopyrightfile" +vendor = "Oracle" +description = "OOo improvement extension for %PRODUCTNAME %PRODUCTVERSION" +destpath = "/opt" +packageversion = "%PACKAGEVERSION" +End + +Start +module = "gid_Module_Root_Extension_Dictionary_Af" +script = "shellscripts_extensions.txt" +solarispackagename = "%PACKAGEPREFIX%SOLARISBRANDPACKAGENAME%BRANDPACKAGEVERSION-dict-af" +solarisrequires = "%SOLSUREPACKAGEPREFIX-ure, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core01, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core02, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core03, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core04, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core05, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core06, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core07, %PACKAGEPREFIX%SOLARISBRANDPACKAGENAME%BRANDPACKAGEVERSION" +packagename = "%UNIXPACKAGENAME%BRANDPACKAGEVERSION-dict-af" +requires = "%UREPACKAGEPREFIX-ure,%BASISPACKAGEPREFIX%OOOBASEVERSION-core01,%BASISPACKAGEPREFIX%OOOBASEVERSION-core02,%BASISPACKAGEPREFIX%OOOBASEVERSION-core03,%BASISPACKAGEPREFIX%OOOBASEVERSION-core04,%BASISPACKAGEPREFIX%OOOBASEVERSION-core05,%BASISPACKAGEPREFIX%OOOBASEVERSION-core06,%BASISPACKAGEPREFIX%OOOBASEVERSION-core07,%UNIXPACKAGENAME%BRANDPACKAGEVERSION" +linuxpatchrequires = "" +copyright = "1999-2010 by Oracle" +solariscopyright = "solariscopyrightfile" +vendor = "Oracle" +description = "Af dictionary for %PRODUCTNAME %PRODUCTVERSION" +destpath = "/opt" +packageversion = "%PACKAGEVERSION" +End + +Start +module = "gid_Module_Root_Extension_Dictionary_Ca" +script = "shellscripts_extensions.txt" +solarispackagename = "%PACKAGEPREFIX%SOLARISBRANDPACKAGENAME%BRANDPACKAGEVERSION-dict-ca" +solarisrequires = "%SOLSUREPACKAGEPREFIX-ure, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core01, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core02, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core03, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core04, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core05, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core06, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core07, %PACKAGEPREFIX%SOLARISBRANDPACKAGENAME%BRANDPACKAGEVERSION" +packagename = "%UNIXPACKAGENAME%BRANDPACKAGEVERSION-dict-ca" +requires = "%UREPACKAGEPREFIX-ure,%BASISPACKAGEPREFIX%OOOBASEVERSION-core01,%BASISPACKAGEPREFIX%OOOBASEVERSION-core02,%BASISPACKAGEPREFIX%OOOBASEVERSION-core03,%BASISPACKAGEPREFIX%OOOBASEVERSION-core04,%BASISPACKAGEPREFIX%OOOBASEVERSION-core05,%BASISPACKAGEPREFIX%OOOBASEVERSION-core06,%BASISPACKAGEPREFIX%OOOBASEVERSION-core07,%UNIXPACKAGENAME%BRANDPACKAGEVERSION" +linuxpatchrequires = "" +copyright = "1999-2010 by Oracle" +solariscopyright = "solariscopyrightfile" +vendor = "Oracle" +description = "Ca dictionary for %PRODUCTNAME %PRODUCTVERSION" +destpath = "/opt" +packageversion = "%PACKAGEVERSION" +End + +Start +module = "gid_Module_Root_Extension_Dictionary_Cs" +script = "shellscripts_extensions.txt" +solarispackagename = "%PACKAGEPREFIX%SOLARISBRANDPACKAGENAME%BRANDPACKAGEVERSION-dict-cs" +solarisrequires = "%SOLSUREPACKAGEPREFIX-ure, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core01, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core02, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core03, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core04, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core05, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core06, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core07, %PACKAGEPREFIX%SOLARISBRANDPACKAGENAME%BRANDPACKAGEVERSION" +packagename = "%UNIXPACKAGENAME%BRANDPACKAGEVERSION-dict-cs" +requires = "%UREPACKAGEPREFIX-ure,%BASISPACKAGEPREFIX%OOOBASEVERSION-core01,%BASISPACKAGEPREFIX%OOOBASEVERSION-core02,%BASISPACKAGEPREFIX%OOOBASEVERSION-core03,%BASISPACKAGEPREFIX%OOOBASEVERSION-core04,%BASISPACKAGEPREFIX%OOOBASEVERSION-core05,%BASISPACKAGEPREFIX%OOOBASEVERSION-core06,%BASISPACKAGEPREFIX%OOOBASEVERSION-core07,%UNIXPACKAGENAME%BRANDPACKAGEVERSION" +linuxpatchrequires = "" +copyright = "1999-2010 by Oracle" +solariscopyright = "solariscopyrightfile" +vendor = "Oracle" +description = "Cs dictionary for %PRODUCTNAME %PRODUCTVERSION" +destpath = "/opt" +packageversion = "%PACKAGEVERSION" +End + +Start +module = "gid_Module_Root_Extension_Dictionary_Da" +script = "shellscripts_extensions.txt" +solarispackagename = "%PACKAGEPREFIX%SOLARISBRANDPACKAGENAME%BRANDPACKAGEVERSION-dict-da" +solarisrequires = "%SOLSUREPACKAGEPREFIX-ure, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core01, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core02, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core03, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core04, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core05, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core06, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core07, %PACKAGEPREFIX%SOLARISBRANDPACKAGENAME%BRANDPACKAGEVERSION" +packagename = "%UNIXPACKAGENAME%BRANDPACKAGEVERSION-dict-da" +requires = "%UREPACKAGEPREFIX-ure,%BASISPACKAGEPREFIX%OOOBASEVERSION-core01,%BASISPACKAGEPREFIX%OOOBASEVERSION-core02,%BASISPACKAGEPREFIX%OOOBASEVERSION-core03,%BASISPACKAGEPREFIX%OOOBASEVERSION-core04,%BASISPACKAGEPREFIX%OOOBASEVERSION-core05,%BASISPACKAGEPREFIX%OOOBASEVERSION-core06,%BASISPACKAGEPREFIX%OOOBASEVERSION-core07,%UNIXPACKAGENAME%BRANDPACKAGEVERSION" +linuxpatchrequires = "" +copyright = "1999-2010 by Oracle" +solariscopyright = "solariscopyrightfile" +vendor = "Oracle" +description = "Da dictionary for %PRODUCTNAME %PRODUCTVERSION" +destpath = "/opt" +packageversion = "%PACKAGEVERSION" +End + +Start +module = "gid_Module_Root_Extension_Dictionary_De_AT" +script = "shellscripts_extensions.txt" +solarispackagename = "%PACKAGEPREFIX%SOLARISBRANDPACKAGENAME%BRANDPACKAGEVERSION-dict-de-AT" +solarisrequires = "%SOLSUREPACKAGEPREFIX-ure, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core01, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core02, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core03, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core04, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core05, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core06, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core07, %PACKAGEPREFIX%SOLARISBRANDPACKAGENAME%BRANDPACKAGEVERSION" +packagename = "%UNIXPACKAGENAME%BRANDPACKAGEVERSION-dict-de-AT" +requires = "%UREPACKAGEPREFIX-ure,%BASISPACKAGEPREFIX%OOOBASEVERSION-core01,%BASISPACKAGEPREFIX%OOOBASEVERSION-core02,%BASISPACKAGEPREFIX%OOOBASEVERSION-core03,%BASISPACKAGEPREFIX%OOOBASEVERSION-core04,%BASISPACKAGEPREFIX%OOOBASEVERSION-core05,%BASISPACKAGEPREFIX%OOOBASEVERSION-core06,%BASISPACKAGEPREFIX%OOOBASEVERSION-core07,%UNIXPACKAGENAME%BRANDPACKAGEVERSION" +linuxpatchrequires = "" +copyright = "1999-2010 by Oracle" +solariscopyright = "solariscopyrightfile" +vendor = "Oracle" +description = "De-AT dictionary for %PACKAGENAME %PRODUCTVERSION" +destpath = "/opt" +packageversion = "%PACKAGEVERSION" +End + +Start +module = "gid_Module_Root_Extension_Dictionary_De_CH" +script = "shellscripts_extensions.txt" +solarispackagename = "%PACKAGEPREFIX%SOLARISBRANDPACKAGENAME%BRANDPACKAGEVERSION-dict-de-CH" +solarisrequires = "%SOLSUREPACKAGEPREFIX-ure, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core01, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core02, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core03, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core04, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core05, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core06, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core07, %PACKAGEPREFIX%SOLARISBRANDPACKAGENAME%BRANDPACKAGEVERSION" +packagename = "%UNIXPACKAGENAME%BRANDPACKAGEVERSION-dict-de-CH" +requires = "%UREPACKAGEPREFIX-ure,%BASISPACKAGEPREFIX%OOOBASEVERSION-core01,%BASISPACKAGEPREFIX%OOOBASEVERSION-core02,%BASISPACKAGEPREFIX%OOOBASEVERSION-core03,%BASISPACKAGEPREFIX%OOOBASEVERSION-core04,%BASISPACKAGEPREFIX%OOOBASEVERSION-core05,%BASISPACKAGEPREFIX%OOOBASEVERSION-core06,%BASISPACKAGEPREFIX%OOOBASEVERSION-core07,%UNIXPACKAGENAME%BRANDPACKAGEVERSION" +linuxpatchrequires = "" +copyright = "1999-2010 by Oracle" +solariscopyright = "solariscopyrightfile" +vendor = "Oracle" +description = "De-CH dictionary for %PACKAGENAME %PRODUCTVERSION" +destpath = "/opt" +packageversion = "%PACKAGEVERSION" +End + +Start +module = "gid_Module_Root_Extension_Dictionary_De_DE" +script = "shellscripts_extensions.txt" +solarispackagename = "%PACKAGEPREFIX%SOLARISBRANDPACKAGENAME%BRANDPACKAGEVERSION-dict-de-DE" +solarisrequires = "%SOLSUREPACKAGEPREFIX-ure, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core01, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core02, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core03, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core04, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core05, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core06, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core07, %PACKAGEPREFIX%SOLARISBRANDPACKAGENAME%BRANDPACKAGEVERSION" +packagename = "%UNIXPACKAGENAME%BRANDPACKAGEVERSION-dict-de-DE" +requires = "%UREPACKAGEPREFIX-ure,%BASISPACKAGEPREFIX%OOOBASEVERSION-core01,%BASISPACKAGEPREFIX%OOOBASEVERSION-core02,%BASISPACKAGEPREFIX%OOOBASEVERSION-core03,%BASISPACKAGEPREFIX%OOOBASEVERSION-core04,%BASISPACKAGEPREFIX%OOOBASEVERSION-core05,%BASISPACKAGEPREFIX%OOOBASEVERSION-core06,%BASISPACKAGEPREFIX%OOOBASEVERSION-core07,%UNIXPACKAGENAME%BRANDPACKAGEVERSION" +linuxpatchrequires = "" +copyright = "1999-2010 by Oracle" +solariscopyright = "solariscopyrightfile" +vendor = "Oracle" +description = "De-DE dictionary for %PACKAGENAME %PRODUCTVERSION" +destpath = "/opt" +packageversion = "%PACKAGEVERSION" +End + +Start +module = "gid_Module_Root_Extension_Dictionary_En" +script = "shellscripts_extensions.txt" +solarispackagename = "%PACKAGEPREFIX%SOLARISBRANDPACKAGENAME%BRANDPACKAGEVERSION-dict-en" +solarisrequires = "%SOLSUREPACKAGEPREFIX-ure, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core01, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core02, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core03, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core04, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core05, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core06, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core07, %PACKAGEPREFIX%SOLARISBRANDPACKAGENAME%BRANDPACKAGEVERSION" +packagename = "%UNIXPACKAGENAME%BRANDPACKAGEVERSION-dict-en" +requires = "%UREPACKAGEPREFIX-ure,%BASISPACKAGEPREFIX%OOOBASEVERSION-core01,%BASISPACKAGEPREFIX%OOOBASEVERSION-core02,%BASISPACKAGEPREFIX%OOOBASEVERSION-core03,%BASISPACKAGEPREFIX%OOOBASEVERSION-core04,%BASISPACKAGEPREFIX%OOOBASEVERSION-core05,%BASISPACKAGEPREFIX%OOOBASEVERSION-core06,%BASISPACKAGEPREFIX%OOOBASEVERSION-core07,%UNIXPACKAGENAME%BRANDPACKAGEVERSION" +linuxpatchrequires = "" +copyright = "1999-2010 by Oracle" +solariscopyright = "solariscopyrightfile" +vendor = "Oracle" +description = "En dictionary for %PRODUCTNAME %PRODUCTVERSION" +destpath = "/opt" +packageversion = "%PACKAGEVERSION" +End + +Start +module = "gid_Module_Root_Extension_Dictionary_Es" +script = "shellscripts_extensions.txt" +solarispackagename = "%PACKAGEPREFIX%SOLARISBRANDPACKAGENAME%BRANDPACKAGEVERSION-dict-es" +solarisrequires = "%SOLSUREPACKAGEPREFIX-ure, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core01, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core02, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core03, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core04, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core05, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core06, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core07, %PACKAGEPREFIX%SOLARISBRANDPACKAGENAME%BRANDPACKAGEVERSION" +packagename = "%UNIXPACKAGENAME%BRANDPACKAGEVERSION-dict-es" +requires = "%UREPACKAGEPREFIX-ure,%BASISPACKAGEPREFIX%OOOBASEVERSION-core01,%BASISPACKAGEPREFIX%OOOBASEVERSION-core02,%BASISPACKAGEPREFIX%OOOBASEVERSION-core03,%BASISPACKAGEPREFIX%OOOBASEVERSION-core04,%BASISPACKAGEPREFIX%OOOBASEVERSION-core05,%BASISPACKAGEPREFIX%OOOBASEVERSION-core06,%BASISPACKAGEPREFIX%OOOBASEVERSION-core07,%UNIXPACKAGENAME%BRANDPACKAGEVERSION" +linuxpatchrequires = "" +copyright = "1999-2010 by Oracle" +solariscopyright = "solariscopyrightfile" +vendor = "Oracle" +description = "Es dictionary for %PRODUCTNAME %PRODUCTVERSION" +destpath = "/opt" +packageversion = "%PACKAGEVERSION" +End + +Start +module = "gid_Module_Root_Extension_Dictionary_Et" +script = "shellscripts_extensions.txt" +solarispackagename = "%PACKAGEPREFIX%SOLARISBRANDPACKAGENAME%BRANDPACKAGEVERSION-dict-et" +solarisrequires = "%SOLSUREPACKAGEPREFIX-ure, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core01, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core02, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core03, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core04, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core05, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core06, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core07, %PACKAGEPREFIX%SOLARISBRANDPACKAGENAME%BRANDPACKAGEVERSION" +packagename = "%UNIXPACKAGENAME%BRANDPACKAGEVERSION-dict-et" +requires = "%UREPACKAGEPREFIX-ure,%BASISPACKAGEPREFIX%OOOBASEVERSION-core01,%BASISPACKAGEPREFIX%OOOBASEVERSION-core02,%BASISPACKAGEPREFIX%OOOBASEVERSION-core03,%BASISPACKAGEPREFIX%OOOBASEVERSION-core04,%BASISPACKAGEPREFIX%OOOBASEVERSION-core05,%BASISPACKAGEPREFIX%OOOBASEVERSION-core06,%BASISPACKAGEPREFIX%OOOBASEVERSION-core07,%UNIXPACKAGENAME%BRANDPACKAGEVERSION" +linuxpatchrequires = "" +copyright = "1999-2010 by Oracle" +solariscopyright = "solariscopyrightfile" +vendor = "Oracle" +description = "Et dictionary for %PRODUCTNAME %PRODUCTVERSION" +destpath = "/opt" +packageversion = "%PACKAGEVERSION" +End + +Start +module = "gid_Module_Root_Extension_Dictionary_Fr" +script = "shellscripts_extensions.txt" +solarispackagename = "%PACKAGEPREFIX%SOLARISBRANDPACKAGENAME%BRANDPACKAGEVERSION-dict-fr" +solarisrequires = "%SOLSUREPACKAGEPREFIX-ure, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core01, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core02, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core03, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core04, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core05, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core06, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core07, %PACKAGEPREFIX%SOLARISBRANDPACKAGENAME%BRANDPACKAGEVERSION" +packagename = "%UNIXPACKAGENAME%BRANDPACKAGEVERSION-dict-fr" +requires = "%UREPACKAGEPREFIX-ure,%BASISPACKAGEPREFIX%OOOBASEVERSION-core01,%BASISPACKAGEPREFIX%OOOBASEVERSION-core02,%BASISPACKAGEPREFIX%OOOBASEVERSION-core03,%BASISPACKAGEPREFIX%OOOBASEVERSION-core04,%BASISPACKAGEPREFIX%OOOBASEVERSION-core05,%BASISPACKAGEPREFIX%OOOBASEVERSION-core06,%BASISPACKAGEPREFIX%OOOBASEVERSION-core07,%UNIXPACKAGENAME%BRANDPACKAGEVERSION" +linuxpatchrequires = "" +copyright = "1999-2010 by Oracle" +solariscopyright = "solariscopyrightfile" +vendor = "Oracle" +description = "Fr dictionary for %PRODUCTNAME %PRODUCTVERSION" +destpath = "/opt" +packageversion = "%PACKAGEVERSION" +End + +Start +module = "gid_Module_Root_Extension_Dictionary_Gl" +script = "shellscripts_extensions.txt" +solarispackagename = "%PACKAGEPREFIX%SOLARISBRANDPACKAGENAME%BRANDPACKAGEVERSION-dict-gl" +solarisrequires = "%SOLSUREPACKAGEPREFIX-ure, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core01, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core02, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core03, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core04, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core05, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core06, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core07, %PACKAGEPREFIX%SOLARISBRANDPACKAGENAME%BRANDPACKAGEVERSION" +packagename = "%BASISPACKAGEPREFIX%OOOBASEVERSION-dict-gl" +requires = "%UREPACKAGEPREFIX-ure,%BASISPACKAGEPREFIX%OOOBASEVERSION-core01,%BASISPACKAGEPREFIX%OOOBASEVERSION-core02,%BASISPACKAGEPREFIX%OOOBASEVERSION-core03,%BASISPACKAGEPREFIX%OOOBASEVERSION-core04,%BASISPACKAGEPREFIX%OOOBASEVERSION-core05,%BASISPACKAGEPREFIX%OOOBASEVERSION-core06,%BASISPACKAGEPREFIX%OOOBASEVERSION-core07,%UNIXPACKAGENAME%BRANDPACKAGEVERSION" +linuxpatchrequires = "" +copyright = "1999-2010 by Oracle" +solariscopyright = "solariscopyrightfile" +vendor = "Oracle" +description = "Gl dictionary for %PRODUCTNAME %PRODUCTVERSION" +destpath = "/opt" +packageversion = "%OOOPACKAGEVERSION" +End + +Start +module = "gid_Module_Root_Extension_Dictionary_He" +script = "shellscripts_extensions.txt" +solarispackagename = "%PACKAGEPREFIX%SOLARISBRANDPACKAGENAME%BRANDPACKAGEVERSION-dict-he" +solarisrequires = "%SOLSUREPACKAGEPREFIX-ure, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core01, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core02, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core03, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core04, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core05, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core06, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core07, %PACKAGEPREFIX%SOLARISBRANDPACKAGENAME%BRANDPACKAGEVERSION" +packagename = "%UNIXPACKAGENAME%BRANDPACKAGEVERSION-dict-he" +requires = "%UREPACKAGEPREFIX-ure,%BASISPACKAGEPREFIX%OOOBASEVERSION-core01,%BASISPACKAGEPREFIX%OOOBASEVERSION-core02,%BASISPACKAGEPREFIX%OOOBASEVERSION-core03,%BASISPACKAGEPREFIX%OOOBASEVERSION-core04,%BASISPACKAGEPREFIX%OOOBASEVERSION-core05,%BASISPACKAGEPREFIX%OOOBASEVERSION-core06,%BASISPACKAGEPREFIX%OOOBASEVERSION-core07,%UNIXPACKAGENAME%BRANDPACKAGEVERSION" +linuxpatchrequires = "" +copyright = "1999-2010 by Oracle" +solariscopyright = "solariscopyrightfile" +vendor = "Oracle" +description = "He dictionary for %PRODUCTNAME %PRODUCTVERSION" +destpath = "/opt" +packageversion = "%PACKAGEVERSION" +End + +Start +module = "gid_Module_Root_Extension_Dictionary_Hu" +script = "shellscripts_extensions.txt" +solarispackagename = "%PACKAGEPREFIX%SOLARISBRANDPACKAGENAME%BRANDPACKAGEVERSION-dict-hu" +solarisrequires = "%SOLSUREPACKAGEPREFIX-ure, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core01, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core02, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core03, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core04, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core05, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core06, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core07, %PACKAGEPREFIX%SOLARISBRANDPACKAGENAME%BRANDPACKAGEVERSION" +packagename = "%UNIXPACKAGENAME%BRANDPACKAGEVERSION-dict-hu" +requires = "%UREPACKAGEPREFIX-ure,%BASISPACKAGEPREFIX%OOOBASEVERSION-core01,%BASISPACKAGEPREFIX%OOOBASEVERSION-core02,%BASISPACKAGEPREFIX%OOOBASEVERSION-core03,%BASISPACKAGEPREFIX%OOOBASEVERSION-core04,%BASISPACKAGEPREFIX%OOOBASEVERSION-core05,%BASISPACKAGEPREFIX%OOOBASEVERSION-core06,%BASISPACKAGEPREFIX%OOOBASEVERSION-core07,%UNIXPACKAGENAME%BRANDPACKAGEVERSION" +linuxpatchrequires = "" +copyright = "1999-2010 by Oracle" +solariscopyright = "solariscopyrightfile" +vendor = "Oracle" +description = "Hu dictionary for %PRODUCTNAME %PRODUCTVERSION" +destpath = "/opt" +packageversion = "%PACKAGEVERSION" +End + +Start +module = "gid_Module_Root_Extension_Dictionary_It" +script = "shellscripts_extensions.txt" +solarispackagename = "%PACKAGEPREFIX%SOLARISBRANDPACKAGENAME%BRANDPACKAGEVERSION-dict-it" +solarisrequires = "%SOLSUREPACKAGEPREFIX-ure, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core01, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core02, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core03, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core04, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core05, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core06, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core07, %PACKAGEPREFIX%SOLARISBRANDPACKAGENAME%BRANDPACKAGEVERSION" +packagename = "%UNIXPACKAGENAME%BRANDPACKAGEVERSION-dict-it" +requires = "%UREPACKAGEPREFIX-ure,%BASISPACKAGEPREFIX%OOOBASEVERSION-core01,%BASISPACKAGEPREFIX%OOOBASEVERSION-core02,%BASISPACKAGEPREFIX%OOOBASEVERSION-core03,%BASISPACKAGEPREFIX%OOOBASEVERSION-core04,%BASISPACKAGEPREFIX%OOOBASEVERSION-core05,%BASISPACKAGEPREFIX%OOOBASEVERSION-core06,%BASISPACKAGEPREFIX%OOOBASEVERSION-core07,%UNIXPACKAGENAME%BRANDPACKAGEVERSION" +linuxpatchrequires = "" +copyright = "1999-2010 by Oracle" +solariscopyright = "solariscopyrightfile" +vendor = "Oracle" +description = "It dictionary for %PRODUCTNAME %PRODUCTVERSION" +destpath = "/opt" +packageversion = "%PACKAGEVERSION" +End + +Start +module = "gid_Module_Root_Extension_Dictionary_Lt" +script = "shellscripts_extensions.txt" +solarispackagename = "%PACKAGEPREFIX%SOLARISBRANDPACKAGENAME%BRANDPACKAGEVERSION-dict-lt" +solarisrequires = "%SOLSUREPACKAGEPREFIX-ure, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core01, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core02, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core03, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core04, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core05, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core06, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core07, %PACKAGEPREFIX%SOLARISBRANDPACKAGENAME%BRANDPACKAGEVERSION" +packagename = "%UNIXPACKAGENAME%BRANDPACKAGEVERSION-dict-lt" +requires = "%UREPACKAGEPREFIX-ure,%BASISPACKAGEPREFIX%OOOBASEVERSION-core01,%BASISPACKAGEPREFIX%OOOBASEVERSION-core02,%BASISPACKAGEPREFIX%OOOBASEVERSION-core03,%BASISPACKAGEPREFIX%OOOBASEVERSION-core04,%BASISPACKAGEPREFIX%OOOBASEVERSION-core05,%BASISPACKAGEPREFIX%OOOBASEVERSION-core06,%BASISPACKAGEPREFIX%OOOBASEVERSION-core07,%UNIXPACKAGENAME%BRANDPACKAGEVERSION" +linuxpatchrequires = "" +copyright = "1999-2010 by Oracle" +solariscopyright = "solariscopyrightfile" +vendor = "Oracle" +description = "Lt dictionary for %PRODUCTNAME %PRODUCTVERSION" +destpath = "/opt" +packageversion = "%PACKAGEVERSION" +End + +Start +module = "gid_Module_Root_Extension_Dictionary_Ne" +script = "shellscripts_extensions.txt" +solarispackagename = "%PACKAGEPREFIX%SOLARISBRANDPACKAGENAME%BRANDPACKAGEVERSION-dict-ne" +solarisrequires = "%SOLSUREPACKAGEPREFIX-ure, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core01, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core02, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core03, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core04, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core05, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core06, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core07, %PACKAGEPREFIX%SOLARISBRANDPACKAGENAME%BRANDPACKAGEVERSION" +packagename = "%UNIXPACKAGENAME%BRANDPACKAGEVERSION-dict-ne" +requires = "%UREPACKAGEPREFIX-ure,%BASISPACKAGEPREFIX%OOOBASEVERSION-core01,%BASISPACKAGEPREFIX%OOOBASEVERSION-core02,%BASISPACKAGEPREFIX%OOOBASEVERSION-core03,%BASISPACKAGEPREFIX%OOOBASEVERSION-core04,%BASISPACKAGEPREFIX%OOOBASEVERSION-core05,%BASISPACKAGEPREFIX%OOOBASEVERSION-core06,%BASISPACKAGEPREFIX%OOOBASEVERSION-core07,%UNIXPACKAGENAME%BRANDPACKAGEVERSION" +linuxpatchrequires = "" +copyright = "1999-2010 by Oracle" +solariscopyright = "solariscopyrightfile" +vendor = "Oracle" +description = "Ne dictionary for %PRODUCTNAME %PRODUCTVERSION" +destpath = "/opt" +packageversion = "%PACKAGEVERSION" +End + +Start +module = "gid_Module_Root_Extension_Dictionary_Nl" +script = "shellscripts_extensions.txt" +solarispackagename = "%PACKAGEPREFIX%SOLARISBRANDPACKAGENAME%BRANDPACKAGEVERSION-dict-nl" +solarisrequires = "%SOLSUREPACKAGEPREFIX-ure, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core01, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core02, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core03, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core04, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core05, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core06, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core07, %PACKAGEPREFIX%SOLARISBRANDPACKAGENAME%BRANDPACKAGEVERSION" +packagename = "%UNIXPACKAGENAME%BRANDPACKAGEVERSION-dict-nl" +requires = "%UREPACKAGEPREFIX-ure,%BASISPACKAGEPREFIX%OOOBASEVERSION-core01,%BASISPACKAGEPREFIX%OOOBASEVERSION-core02,%BASISPACKAGEPREFIX%OOOBASEVERSION-core03,%BASISPACKAGEPREFIX%OOOBASEVERSION-core04,%BASISPACKAGEPREFIX%OOOBASEVERSION-core05,%BASISPACKAGEPREFIX%OOOBASEVERSION-core06,%BASISPACKAGEPREFIX%OOOBASEVERSION-core07,%UNIXPACKAGENAME%BRANDPACKAGEVERSION" +linuxpatchrequires = "" +copyright = "1999-2010 by Oracle" +solariscopyright = "solariscopyrightfile" +vendor = "Oracle" +description = "Nl dictionary for %PRODUCTNAME %PRODUCTVERSION" +destpath = "/opt" +packageversion = "%PACKAGEVERSION" +End + +Start +module = "gid_Module_Root_Extension_Dictionary_No" +script = "shellscripts_extensions.txt" +solarispackagename = "%PACKAGEPREFIX%SOLARISBRANDPACKAGENAME%BRANDPACKAGEVERSION-dict-no" +solarisrequires = "%SOLSUREPACKAGEPREFIX-ure, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core01, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core02, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core03, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core04, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core05, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core06, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core07, %PACKAGEPREFIX%SOLARISBRANDPACKAGENAME%BRANDPACKAGEVERSION" +packagename = "%UNIXPACKAGENAME%BRANDPACKAGEVERSION-dict-no" +requires = "%UREPACKAGEPREFIX-ure,%BASISPACKAGEPREFIX%OOOBASEVERSION-core01,%BASISPACKAGEPREFIX%OOOBASEVERSION-core02,%BASISPACKAGEPREFIX%OOOBASEVERSION-core03,%BASISPACKAGEPREFIX%OOOBASEVERSION-core04,%BASISPACKAGEPREFIX%OOOBASEVERSION-core05,%BASISPACKAGEPREFIX%OOOBASEVERSION-core06,%BASISPACKAGEPREFIX%OOOBASEVERSION-core07,%UNIXPACKAGENAME%BRANDPACKAGEVERSION" +linuxpatchrequires = "" +copyright = "1999-2010 by Oracle" +solariscopyright = "solariscopyrightfile" +vendor = "Oracle" +description = "No dictionary for %PRODUCTNAME %PRODUCTVERSION" +destpath = "/opt" +packageversion = "%PACKAGEVERSION" +End + +Start +module = "gid_Module_Root_Extension_Dictionary_Pl" +script = "shellscripts_extensions.txt" +solarispackagename = "%PACKAGEPREFIX%SOLARISBRANDPACKAGENAME%BRANDPACKAGEVERSION-dict-pl" +solarisrequires = "%SOLSUREPACKAGEPREFIX-ure, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core01, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core02, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core03, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core04, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core05, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core06, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core07, %PACKAGEPREFIX%SOLARISBRANDPACKAGENAME%BRANDPACKAGEVERSION" +packagename = "%UNIXPACKAGENAME%BRANDPACKAGEVERSION-dict-pl" +requires = "%UREPACKAGEPREFIX-ure,%BASISPACKAGEPREFIX%OOOBASEVERSION-core01,%BASISPACKAGEPREFIX%OOOBASEVERSION-core02,%BASISPACKAGEPREFIX%OOOBASEVERSION-core03,%BASISPACKAGEPREFIX%OOOBASEVERSION-core04,%BASISPACKAGEPREFIX%OOOBASEVERSION-core05,%BASISPACKAGEPREFIX%OOOBASEVERSION-core06,%BASISPACKAGEPREFIX%OOOBASEVERSION-core07,%UNIXPACKAGENAME%BRANDPACKAGEVERSION" +linuxpatchrequires = "" +copyright = "1999-2010 by Oracle" +solariscopyright = "solariscopyrightfile" +vendor = "Oracle" +description = "Pl dictionary for %PRODUCTNAME %PRODUCTVERSION" +destpath = "/opt" +packageversion = "%PACKAGEVERSION" +End + +Start +module = "gid_Module_Root_Extension_Dictionary_Pt" +script = "shellscripts_extensions.txt" +solarispackagename = "%PACKAGEPREFIX%SOLARISBRANDPACKAGENAME%BRANDPACKAGEVERSION-dict-pt" +solarisrequires = "%SOLSUREPACKAGEPREFIX-ure, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core01, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core02, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core03, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core04, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core05, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core06, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core07, %PACKAGEPREFIX%SOLARISBRANDPACKAGENAME%BRANDPACKAGEVERSION" +packagename = "%UNIXPACKAGENAME%BRANDPACKAGEVERSION-dict-pt" +requires = "%UREPACKAGEPREFIX-ure,%BASISPACKAGEPREFIX%OOOBASEVERSION-core01,%BASISPACKAGEPREFIX%OOOBASEVERSION-core02,%BASISPACKAGEPREFIX%OOOBASEVERSION-core03,%BASISPACKAGEPREFIX%OOOBASEVERSION-core04,%BASISPACKAGEPREFIX%OOOBASEVERSION-core05,%BASISPACKAGEPREFIX%OOOBASEVERSION-core06,%BASISPACKAGEPREFIX%OOOBASEVERSION-core07,%UNIXPACKAGENAME%BRANDPACKAGEVERSION" +linuxpatchrequires = "" +copyright = "1999-2010 by Oracle" +solariscopyright = "solariscopyrightfile" +vendor = "Oracle" +description = "Pt dictionary for %PRODUCTNAME %PRODUCTVERSION" +destpath = "/opt" +packageversion = "%PACKAGEVERSION" +End + +Start +module = "gid_Module_Root_Extension_Dictionary_Ro" +script = "shellscripts_extensions.txt" +solarispackagename = "%PACKAGEPREFIX%SOLARISBRANDPACKAGENAME%BRANDPACKAGEVERSION-dict-ro" +solarisrequires = "%SOLSUREPACKAGEPREFIX-ure, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core01, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core02, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core03, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core04, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core05, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core06, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core07, %PACKAGEPREFIX%SOLARISBRANDPACKAGENAME%BRANDPACKAGEVERSION" +packagename = "%UNIXPACKAGENAME%BRANDPACKAGEVERSION-dict-ro" +requires = "%UREPACKAGEPREFIX-ure,%BASISPACKAGEPREFIX%OOOBASEVERSION-core01,%BASISPACKAGEPREFIX%OOOBASEVERSION-core02,%BASISPACKAGEPREFIX%OOOBASEVERSION-core03,%BASISPACKAGEPREFIX%OOOBASEVERSION-core04,%BASISPACKAGEPREFIX%OOOBASEVERSION-core05,%BASISPACKAGEPREFIX%OOOBASEVERSION-core06,%BASISPACKAGEPREFIX%OOOBASEVERSION-core07,%UNIXPACKAGENAME%BRANDPACKAGEVERSION" +linuxpatchrequires = "" +copyright = "1999-2010 by Oracle" +solariscopyright = "solariscopyrightfile" +vendor = "Oracle" +description = "Ro dictionary for %PRODUCTNAME %PRODUCTVERSION" +destpath = "/opt" +packageversion = "%PACKAGEVERSION" +End + +Start +module = "gid_Module_Root_Extension_Dictionary_Ru" +script = "shellscripts_extensions.txt" +solarispackagename = "%PACKAGEPREFIX%SOLARISBRANDPACKAGENAME%BRANDPACKAGEVERSION-dict-ru" +solarisrequires = "%SOLSUREPACKAGEPREFIX-ure, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core01, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core02, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core03, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core04, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core05, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core06, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core07, %PACKAGEPREFIX%SOLARISBRANDPACKAGENAME%BRANDPACKAGEVERSION" +packagename = "%UNIXPACKAGENAME%BRANDPACKAGEVERSION-dict-ru" +requires = "%UREPACKAGEPREFIX-ure,%BASISPACKAGEPREFIX%OOOBASEVERSION-core01,%BASISPACKAGEPREFIX%OOOBASEVERSION-core02,%BASISPACKAGEPREFIX%OOOBASEVERSION-core03,%BASISPACKAGEPREFIX%OOOBASEVERSION-core04,%BASISPACKAGEPREFIX%OOOBASEVERSION-core05,%BASISPACKAGEPREFIX%OOOBASEVERSION-core06,%BASISPACKAGEPREFIX%OOOBASEVERSION-core07,%UNIXPACKAGENAME%BRANDPACKAGEVERSION" +linuxpatchrequires = "" +copyright = "1999-2010 by Oracle" +solariscopyright = "solariscopyrightfile" +vendor = "Oracle" +description = "Ru dictionary for %PRODUCTNAME %PRODUCTVERSION" +destpath = "/opt" +packageversion = "%PACKAGEVERSION" +End + +Start +module = "gid_Module_Root_Extension_Dictionary_Sk" +script = "shellscripts_extensions.txt" +solarispackagename = "%PACKAGEPREFIX%SOLARISBRANDPACKAGENAME%BRANDPACKAGEVERSION-dict-sk" +solarisrequires = "%SOLSUREPACKAGEPREFIX-ure, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core01, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core02, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core03, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core04, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core05, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core06, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core07, %PACKAGEPREFIX%SOLARISBRANDPACKAGENAME%BRANDPACKAGEVERSION" +packagename = "%UNIXPACKAGENAME%BRANDPACKAGEVERSION-dict-sk" +requires = "%UREPACKAGEPREFIX-ure,%BASISPACKAGEPREFIX%OOOBASEVERSION-core01,%BASISPACKAGEPREFIX%OOOBASEVERSION-core02,%BASISPACKAGEPREFIX%OOOBASEVERSION-core03,%BASISPACKAGEPREFIX%OOOBASEVERSION-core04,%BASISPACKAGEPREFIX%OOOBASEVERSION-core05,%BASISPACKAGEPREFIX%OOOBASEVERSION-core06,%BASISPACKAGEPREFIX%OOOBASEVERSION-core07,%UNIXPACKAGENAME%BRANDPACKAGEVERSION" +linuxpatchrequires = "" +copyright = "1999-2010 by Oracle" +solariscopyright = "solariscopyrightfile" +vendor = "Oracle" +description = "Sk dictionary for %PRODUCTNAME %PRODUCTVERSION" +destpath = "/opt" +packageversion = "%PACKAGEVERSION" +End + +Start +module = "gid_Module_Root_Extension_Dictionary_Sl" +script = "shellscripts_extensions.txt" +solarispackagename = "%PACKAGEPREFIX%SOLARISBRANDPACKAGENAME%BRANDPACKAGEVERSION-dict-sl" +solarisrequires = "%SOLSUREPACKAGEPREFIX-ure, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core01, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core02, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core03, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core04, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core05, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core06, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core07, %PACKAGEPREFIX%SOLARISBRANDPACKAGENAME%BRANDPACKAGEVERSION" +packagename = "%UNIXPACKAGENAME%BRANDPACKAGEVERSION-dict-sl" +requires = "%UREPACKAGEPREFIX-ure,%BASISPACKAGEPREFIX%OOOBASEVERSION-core01,%BASISPACKAGEPREFIX%OOOBASEVERSION-core02,%BASISPACKAGEPREFIX%OOOBASEVERSION-core03,%BASISPACKAGEPREFIX%OOOBASEVERSION-core04,%BASISPACKAGEPREFIX%OOOBASEVERSION-core05,%BASISPACKAGEPREFIX%OOOBASEVERSION-core06,%BASISPACKAGEPREFIX%OOOBASEVERSION-core07,%UNIXPACKAGENAME%BRANDPACKAGEVERSION" +linuxpatchrequires = "" +copyright = "1999-2010 by Oracle" +solariscopyright = "solariscopyrightfile" +vendor = "Oracle" +description = "Sl dictionary for %PRODUCTNAME %PRODUCTVERSION" +destpath = "/opt" +packageversion = "%PACKAGEVERSION" +End + +Start +module = "gid_Module_Root_Extension_Dictionary_Sr" +script = "shellscripts_extensions.txt" +solarispackagename = "%PACKAGEPREFIX%SOLARISBRANDPACKAGENAME%BRANDPACKAGEVERSION-dict-sr" +solarisrequires = "%SOLSUREPACKAGEPREFIX-ure, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core01, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core02, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core03, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core04, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core05, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core06, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core07, %PACKAGEPREFIX%SOLARISBRANDPACKAGENAME%BRANDPACKAGEVERSION" +packagename = "%UNIXPACKAGENAME%BRANDPACKAGEVERSION-dict-sr" +requires = "%UREPACKAGEPREFIX-ure,%BASISPACKAGEPREFIX%OOOBASEVERSION-core01,%BASISPACKAGEPREFIX%OOOBASEVERSION-core02,%BASISPACKAGEPREFIX%OOOBASEVERSION-core03,%BASISPACKAGEPREFIX%OOOBASEVERSION-core04,%BASISPACKAGEPREFIX%OOOBASEVERSION-core05,%BASISPACKAGEPREFIX%OOOBASEVERSION-core06,%BASISPACKAGEPREFIX%OOOBASEVERSION-core07,%UNIXPACKAGENAME%BRANDPACKAGEVERSION" +linuxpatchrequires = "" +copyright = "1999-2010 by Oracle" +solariscopyright = "solariscopyrightfile" +vendor = "Oracle" +description = "Sr dictionary for %PRODUCTNAME %PRODUCTVERSION" +destpath = "/opt" +packageversion = "%PACKAGEVERSION" +End + +Start +module = "gid_Module_Root_Extension_Dictionary_Sv" +script = "shellscripts_extensions.txt" +solarispackagename = "%PACKAGEPREFIX%SOLARISBRANDPACKAGENAME%BRANDPACKAGEVERSION-dict-sv" +solarisrequires = "%SOLSUREPACKAGEPREFIX-ure, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core01, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core02, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core03, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core04, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core05, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core06, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core07, %PACKAGEPREFIX%SOLARISBRANDPACKAGENAME%BRANDPACKAGEVERSION" +packagename = "%UNIXPACKAGENAME%BRANDPACKAGEVERSION-dict-sv" +requires = "%UREPACKAGEPREFIX-ure,%BASISPACKAGEPREFIX%OOOBASEVERSION-core01,%BASISPACKAGEPREFIX%OOOBASEVERSION-core02,%BASISPACKAGEPREFIX%OOOBASEVERSION-core03,%BASISPACKAGEPREFIX%OOOBASEVERSION-core04,%BASISPACKAGEPREFIX%OOOBASEVERSION-core05,%BASISPACKAGEPREFIX%OOOBASEVERSION-core06,%BASISPACKAGEPREFIX%OOOBASEVERSION-core07,%UNIXPACKAGENAME%BRANDPACKAGEVERSION" +linuxpatchrequires = "" +copyright = "1999-2010 by Oracle" +solariscopyright = "solariscopyrightfile" +vendor = "Oracle" +description = "Sv dictionary for %PRODUCTNAME %PRODUCTVERSION" +destpath = "/opt" +packageversion = "%PACKAGEVERSION" +End + +Start +module = "gid_Module_Root_Extension_Dictionary_Sw" +script = "shellscripts_extensions.txt" +solarispackagename = "%PACKAGEPREFIX%SOLARISBRANDPACKAGENAME%BRANDPACKAGEVERSION-dict-sw" +solarisrequires = "%SOLSUREPACKAGEPREFIX-ure, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core01, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core02, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core03, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core04, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core05, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core06, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core07, %PACKAGEPREFIX%SOLARISBRANDPACKAGENAME%BRANDPACKAGEVERSION" +packagename = "%UNIXPACKAGENAME%BRANDPACKAGEVERSION-dict-sw" +requires = "%UREPACKAGEPREFIX-ure,%BASISPACKAGEPREFIX%OOOBASEVERSION-core01,%BASISPACKAGEPREFIX%OOOBASEVERSION-core02,%BASISPACKAGEPREFIX%OOOBASEVERSION-core03,%BASISPACKAGEPREFIX%OOOBASEVERSION-core04,%BASISPACKAGEPREFIX%OOOBASEVERSION-core05,%BASISPACKAGEPREFIX%OOOBASEVERSION-core06,%BASISPACKAGEPREFIX%OOOBASEVERSION-core07,%UNIXPACKAGENAME%BRANDPACKAGEVERSION" +linuxpatchrequires = "" +copyright = "1999-2010 by Oracle" +solariscopyright = "solariscopyrightfile" +vendor = "Oracle" +description = "Sw dictionary for %PRODUCTNAME %PRODUCTVERSION" +destpath = "/opt" +packageversion = "%PACKAGEVERSION" +End + +Start +module = "gid_Module_Root_Extension_Dictionary_Th" +script = "shellscripts_extensions.txt" +solarispackagename = "%PACKAGEPREFIX%SOLARISBRANDPACKAGENAME%BRANDPACKAGEVERSION-dict-th" +solarisrequires = "%SOLSUREPACKAGEPREFIX-ure, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core01, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core02, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core03, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core04, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core05, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core06, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core07, %PACKAGEPREFIX%SOLARISBRANDPACKAGENAME%BRANDPACKAGEVERSION" +packagename = "%UNIXPACKAGENAME%BRANDPACKAGEVERSION-dict-th" +requires = "%UREPACKAGEPREFIX-ure,%BASISPACKAGEPREFIX%OOOBASEVERSION-core01,%BASISPACKAGEPREFIX%OOOBASEVERSION-core02,%BASISPACKAGEPREFIX%OOOBASEVERSION-core03,%BASISPACKAGEPREFIX%OOOBASEVERSION-core04,%BASISPACKAGEPREFIX%OOOBASEVERSION-core05,%BASISPACKAGEPREFIX%OOOBASEVERSION-core06,%BASISPACKAGEPREFIX%OOOBASEVERSION-core07,%UNIXPACKAGENAME%BRANDPACKAGEVERSION" +linuxpatchrequires = "" +copyright = "1999-2010 by Oracle" +solariscopyright = "solariscopyrightfile" +vendor = "Oracle" +description = "Th dictionary for %PRODUCTNAME %PRODUCTVERSION" +destpath = "/opt" +packageversion = "%PACKAGEVERSION" +End + +Start +module = "gid_Module_Root_Extension_Dictionary_Vi" +script = "shellscripts_extensions.txt" +solarispackagename = "%PACKAGEPREFIX%SOLARISBRANDPACKAGENAME%BRANDPACKAGEVERSION-dict-vi" +solarisrequires = "%SOLSUREPACKAGEPREFIX-ure, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core01, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core02, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core03, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core04, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core05, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core06, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core07, %PACKAGEPREFIX%SOLARISBRANDPACKAGENAME%BRANDPACKAGEVERSION" +packagename = "%BASISPACKAGEPREFIX%OOOBASEVERSION-dict-vi" +requires = "%UREPACKAGEPREFIX-ure,%BASISPACKAGEPREFIX%OOOBASEVERSION-core01,%BASISPACKAGEPREFIX%OOOBASEVERSION-core02,%BASISPACKAGEPREFIX%OOOBASEVERSION-core03,%BASISPACKAGEPREFIX%OOOBASEVERSION-core04,%BASISPACKAGEPREFIX%OOOBASEVERSION-core05,%BASISPACKAGEPREFIX%OOOBASEVERSION-core06,%BASISPACKAGEPREFIX%OOOBASEVERSION-core07,%UNIXPACKAGENAME%BRANDPACKAGEVERSION" +linuxpatchrequires = "" +copyright = "1999-2010 by Oracle" +solariscopyright = "solariscopyrightfile" +vendor = "Oracle" +description = "Vietnamese dictionary for %PRODUCTNAME %PRODUCTVERSION" +destpath = "/opt" +packageversion = "%OOOPACKAGEVERSION" +End + +Start +module = "gid_Module_Root_Extension_Dictionary_Zu" +script = "shellscripts_extensions.txt" +solarispackagename = "%PACKAGEPREFIX%SOLARISBRANDPACKAGENAME%BRANDPACKAGEVERSION-dict-zu" +solarisrequires = "%SOLSUREPACKAGEPREFIX-ure, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core01, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core02, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core03, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core04, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core05, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core06, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core07, %PACKAGEPREFIX%SOLARISBRANDPACKAGENAME%BRANDPACKAGEVERSION" +packagename = "%UNIXPACKAGENAME%BRANDPACKAGEVERSION-dict-zu" +requires = "%UREPACKAGEPREFIX-ure,%BASISPACKAGEPREFIX%OOOBASEVERSION-core01,%BASISPACKAGEPREFIX%OOOBASEVERSION-core02,%BASISPACKAGEPREFIX%OOOBASEVERSION-core03,%BASISPACKAGEPREFIX%OOOBASEVERSION-core04,%BASISPACKAGEPREFIX%OOOBASEVERSION-core05,%BASISPACKAGEPREFIX%OOOBASEVERSION-core06,%BASISPACKAGEPREFIX%OOOBASEVERSION-core07,%UNIXPACKAGENAME%BRANDPACKAGEVERSION" +linuxpatchrequires = "" +copyright = "1999-2010 by Oracle" +solariscopyright = "solariscopyrightfile" +vendor = "Oracle" +description = "Zu dictionary for %PRODUCTNAME %PRODUCTVERSION" +destpath = "/opt" +packageversion = "%PACKAGEVERSION" +End + + +Start +module = "gid_Module_Optional_OGLTrans" +solarispackagename = "%BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-ogltrans" +solarisrequires = "%BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-impress" +packagename = "%BASISPACKAGEPREFIX%OOOBASEVERSION-ogltrans" +freebsdrequires = "%BASISPACKAGEPREFIX%OOOBASEVERSION-impress" +requires = "%BASISPACKAGEPREFIX%OOOBASEVERSION-impress" +copyright = "1999-2007 by OpenOffice.org" +solariscopyright = "solariscopyrightfile" +vendor = "OpenOffice.org" +description = "OpenGL slide transitions module for OpenOffice.org %OOOBASEVERSION" +destpath = "/opt" +packageversion = "%OOOPACKAGEVERSION" +End diff --git a/setup_native/source/packinfo/packinfo_office_lang.txt b/setup_native/source/packinfo/packinfo_office_lang.txt new file mode 100755 index 000000000000..8f3f6dddefbd --- /dev/null +++ b/setup_native/source/packinfo/packinfo_office_lang.txt @@ -0,0 +1,209 @@ +# Format: + +# Start +# scpModule +# shellscript file (optional) +# solarispackagename +# solarisrequires (optional) +# solarisprovides (optional) +# packagename +# linuxreplaces (optional) +# requires (optional) +# provides (optional) +# copyright +# vendor +# description +# destpath +# End + +Start +module = "gid_Module_Langpack_Basis" +solarispackagename = "%BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-%LANGUAGESTRING" +solarisrequires = "%BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core01" +packagename = "%BASISPACKAGEPREFIX%OOOBASEVERSION-%LANGUAGESTRING" +provides = "%BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-%LANGUAGESTRING" +requires = "%BASISPACKAGEPREFIX%OOOBASEVERSION-core01" +copyright = "1999-2009 by OpenOffice.org" +solariscopyright = "solariscopyrightfile" +vendor = "OpenOffice.org" +description = "Language module for OpenOffice.org %OOOBASEVERSION, language %LANGUAGESTRING" +destpath = "/opt" +packageversion = "%OOOPACKAGEVERSION" +pkg_list_entry = "%BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core01" +End + +Start +module = "gid_Module_Langpack_Fonts" +solarispackagename = "%BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-%LANGUAGESTRING-fonts" +solarisrequires = "%BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-%LANGUAGESTRING" +packagename = "%BASISPACKAGEPREFIX%OOOBASEVERSION-%LANGUAGESTRING-fonts" +provides = "%BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-%LANGUAGESTRING-fonts" +requires = "%BASISPACKAGEPREFIX%OOOBASEVERSION-%LANGUAGESTRING" +copyright = "1999-2009 by OpenOffice.org" +solariscopyright = "solariscopyrightfile" +vendor = "OpenOffice.org" +description = "Language fonts module for OpenOffice.org %OOOBASEVERSION, language %LANGUAGESTRING" +destpath = "/opt" +packageversion = "%OOOPACKAGEVERSION" +pkg_list_entry = "%BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core01" +End + +Start +module = "gid_Module_Langpack_Resource" +solarispackagename = "%BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-%LANGUAGESTRING-res" +solarisrequires = "%BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-%LANGUAGESTRING" +packagename = "%BASISPACKAGEPREFIX%OOOBASEVERSION-%LANGUAGESTRING-res" +provides = "%BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-%LANGUAGESTRING-res" +requires = "%BASISPACKAGEPREFIX%OOOBASEVERSION-%LANGUAGESTRING" +copyright = "1999-2009 by OpenOffice.org" +solariscopyright = "solariscopyrightfile" +vendor = "OpenOffice.org" +description = "Language resource module for OpenOffice.org %OOOBASEVERSION, language %LANGUAGESTRING" +destpath = "/opt" +packageversion = "%OOOPACKAGEVERSION" +pkg_list_entry = "%BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core01" +End + +Start +module = "gid_Module_Langpack_Help" +solarispackagename = "%BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-%LANGUAGESTRING-help" +solarisrequires = "%BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-%LANGUAGESTRING" +packagename = "%BASISPACKAGEPREFIX%OOOBASEVERSION-%LANGUAGESTRING-help" +provides = "%BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-%LANGUAGESTRING-help" +requires = "%BASISPACKAGEPREFIX%OOOBASEVERSION-%LANGUAGESTRING" +copyright = "1999-2009 by OpenOffice.org" +solariscopyright = "solariscopyrightfile" +vendor = "OpenOffice.org" +description = "Language help module for OpenOffice.org %OOOBASEVERSION, language %LANGUAGESTRING" +destpath = "/opt" +packageversion = "%OOOPACKAGEVERSION" +pkg_list_entry = "%BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core01" +End + +Start +module = "gid_Module_Langpack_Writer" +solarispackagename = "%BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-%LANGUAGESTRING-writer" +solarisrequires = "%BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-%LANGUAGESTRING" +packagename = "%BASISPACKAGEPREFIX%OOOBASEVERSION-%LANGUAGESTRING-writer" +provides = "%BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-%LANGUAGESTRING-writer" +requires = "%BASISPACKAGEPREFIX%OOOBASEVERSION-%LANGUAGESTRING" +copyright = "1999-2009 by OpenOffice.org" +solariscopyright = "solariscopyrightfile" +vendor = "OpenOffice.org" +description = "Writer language module for OpenOffice.org %OOOBASEVERSION, language %LANGUAGESTRING" +destpath = "/opt" +packageversion = "%OOOPACKAGEVERSION" +pkg_list_entry = "%BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-writer" +End + +Start +module = "gid_Module_Langpack_Calc" +solarispackagename = "%BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-%LANGUAGESTRING-calc" +solarisrequires = "%BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-%LANGUAGESTRING" +packagename = "%BASISPACKAGEPREFIX%OOOBASEVERSION-%LANGUAGESTRING-calc" +provides = "%BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-%LANGUAGESTRING-calc" +requires = "%BASISPACKAGEPREFIX%OOOBASEVERSION-%LANGUAGESTRING" +copyright = "1999-2009 by OpenOffice.org" +solariscopyright = "solariscopyrightfile" +vendor = "OpenOffice.org" +description = "Calc language module for OpenOffice.org %OOOBASEVERSION, language %LANGUAGESTRING" +destpath = "/opt" +packageversion = "%OOOPACKAGEVERSION" +pkg_list_entry = "%BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-calc" +End + +Start +module = "gid_Module_Langpack_Impress" +solarispackagename = "%BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-%LANGUAGESTRING-impress" +solarisrequires = "%BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-%LANGUAGESTRING" +packagename = "%BASISPACKAGEPREFIX%OOOBASEVERSION-%LANGUAGESTRING-impress" +provides = "%BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-%LANGUAGESTRING-impress" +requires = "%BASISPACKAGEPREFIX%OOOBASEVERSION-%LANGUAGESTRING" +copyright = "1999-2009 by OpenOffice.org" +solariscopyright = "solariscopyrightfile" +vendor = "OpenOffice.org" +description = "Impress language module for OpenOffice.org %OOOBASEVERSION, language %LANGUAGESTRING" +destpath = "/opt" +packageversion = "%OOOPACKAGEVERSION" +pkg_list_entry = "%BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-impress" +End + +Start +module = "gid_Module_Langpack_Draw" +solarispackagename = "%BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-%LANGUAGESTRING-draw" +solarisrequires = "%BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-%LANGUAGESTRING" +packagename = "%BASISPACKAGEPREFIX%OOOBASEVERSION-%LANGUAGESTRING-draw" +provides = "%BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-%LANGUAGESTRING-draw" +requires = "%BASISPACKAGEPREFIX%OOOBASEVERSION-%LANGUAGESTRING" +copyright = "1999-2009 by OpenOffice.org" +solariscopyright = "solariscopyrightfile" +vendor = "OpenOffice.org" +description = "Draw language module for OpenOffice.org %OOOBASEVERSION, language %LANGUAGESTRING" +destpath = "/opt" +packageversion = "%OOOPACKAGEVERSION" +pkg_list_entry = "%BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-draw" +End + +Start +module = "gid_Module_Langpack_Math" +solarispackagename = "%BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-%LANGUAGESTRING-math" +solarisrequires = "%BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-%LANGUAGESTRING" +packagename = "%BASISPACKAGEPREFIX%OOOBASEVERSION-%LANGUAGESTRING-math" +provides = "%BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-%LANGUAGESTRING-math" +requires = "%BASISPACKAGEPREFIX%OOOBASEVERSION-%LANGUAGESTRING" +copyright = "1999-2009 by OpenOffice.org" +solariscopyright = "solariscopyrightfile" +vendor = "OpenOffice.org" +description = "Math language module for OpenOffice.org %OOOBASEVERSION, language %LANGUAGESTRING" +destpath = "/opt" +packageversion = "%OOOPACKAGEVERSION" +pkg_list_entry = "%BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-math" +End + +Start +module = "gid_Module_Langpack_Base" +solarispackagename = "%BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-%LANGUAGESTRING-base" +solarisrequires = "%BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-%LANGUAGESTRING" +packagename = "%BASISPACKAGEPREFIX%OOOBASEVERSION-%LANGUAGESTRING-base" +provides = "%BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-%LANGUAGESTRING-base" +requires = "%BASISPACKAGEPREFIX%OOOBASEVERSION-%LANGUAGESTRING" +copyright = "1999-2009 by OpenOffice.org" +solariscopyright = "solariscopyrightfile" +vendor = "OpenOffice.org" +description = "Base language module for OpenOffice.org %OOOBASEVERSION, language %LANGUAGESTRING" +destpath = "/opt" +packageversion = "%OOOPACKAGEVERSION" +pkg_list_entry = "%BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-base" +End + +Start +module = "gid_Module_Langpack_Binfilter" +solarispackagename = "%BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-%LANGUAGESTRING-binfilter" +solarisrequires = "%BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-%LANGUAGESTRING" +packagename = "%BASISPACKAGEPREFIX%OOOBASEVERSION-%LANGUAGESTRING-binfilter" +provides = "%BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-%LANGUAGESTRING-binfilter" +requires = "%BASISPACKAGEPREFIX%OOOBASEVERSION-%LANGUAGESTRING" +copyright = "1999-2009 by OpenOffice.org" +solariscopyright = "solariscopyrightfile" +vendor = "OpenOffice.org" +description = "Legacy filters (e.g. StarOffice 5.2) for OpenOffice.org %OOOBASEVERSION, language %LANGUAGESTRING" +destpath = "/opt" +packageversion = "%OOOPACKAGEVERSION" +pkg_list_entry = "%BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-binfilter" +End + +Start +module = "gid_Module_Langpack_Onlineupdate" +solarispackagename = "%BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-%LANGUAGESTRING-onlineupd" +solarisrequires = "%BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-%LANGUAGESTRING" +packagename = "%BASISPACKAGEPREFIX%OOOBASEVERSION-%LANGUAGESTRING-onlineupd" +provides = "%BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-%LANGUAGESTRING-onlineupd" +requires = "%BASISPACKAGEPREFIX%OOOBASEVERSION-%LANGUAGESTRING" +copyright = "1999-2009 by OpenOffice.org" +solariscopyright = "solariscopyrightfile" +vendor = "OpenOffice.org" +description = "Online update language module for OpenOffice.org %OOOBASEVERSION, language %LANGUAGESTRING" +destpath = "/opt" +packageversion = "%OOOPACKAGEVERSION" +pkg_list_entry = "%BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-onlineupdate" +End diff --git a/setup_native/source/packinfo/packinfo_sdkoo.txt b/setup_native/source/packinfo/packinfo_sdkoo.txt new file mode 100755 index 000000000000..8fb9c53de80b --- /dev/null +++ b/setup_native/source/packinfo/packinfo_sdkoo.txt @@ -0,0 +1,41 @@ +#************************************************************************* +# +# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. +# +# Copyright 2000, 2010 Oracle and/or its affiliates. +# +# OpenOffice.org - a multi-platform office productivity suite +# +# This file is part of OpenOffice.org. +# +# OpenOffice.org is free software: you can redistribute it and/or modify +# it under the terms of the GNU Lesser General Public License version 3 +# only, as published by the Free Software Foundation. +# +# OpenOffice.org is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU Lesser General Public License version 3 for more details +# (a copy is included in the LICENSE file that accompanied this code). +# +# You should have received a copy of the GNU Lesser General Public License +# version 3 along with OpenOffice.org. If not, see +# <http://www.openoffice.org/license.html> +# for a copy of the LGPLv3 License. +# +#************************************************************************* + +Start +module = "gid_Module_Root" +solarispackagename = "%BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-sdk" +solarisrequires = "%BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core01, SUNWbtool (Name="CCS tools bundled with SunOS"), SUNWxcu4 (Name="XCU4 Utilities")" +packagename = "%BASISPACKAGEPREFIX%OOOBASEVERSION-sdk" +freebsdrequires = "%BASISPACKAGEPREFIX%OOOBASEVERSION-core01" +requires = "%BASISPACKAGEPREFIX%OOOBASEVERSION-core01" +copyright = "1999-2009 by OpenOffice.org" +solariscopyright = "solariscopyrightfile" +vendor = "OpenOffice.org" +description = "Software Development Kit for OpenOffice.org %OOOBASEVERSION" +destpath = "/opt" +packageversion = "%OOOPACKAGEVERSION" +End diff --git a/setup_native/source/packinfo/packinfo_ure.txt b/setup_native/source/packinfo/packinfo_ure.txt new file mode 100755 index 000000000000..fd15f91a4380 --- /dev/null +++ b/setup_native/source/packinfo/packinfo_ure.txt @@ -0,0 +1,52 @@ +#************************************************************************* +# +# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. +# +# Copyright 2000, 2010 Oracle and/or its affiliates. +# +# OpenOffice.org - a multi-platform office productivity suite +# +# This file is part of OpenOffice.org. +# +# OpenOffice.org is free software: you can redistribute it and/or modify +# it under the terms of the GNU Lesser General Public License version 3 +# only, as published by the Free Software Foundation. +# +# OpenOffice.org is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU Lesser General Public License version 3 for more details +# (a copy is included in the LICENSE file that accompanied this code). +# +# You should have received a copy of the GNU Lesser General Public License +# version 3 along with OpenOffice.org. If not, see +# <http://www.openoffice.org/license.html> +# for a copy of the LGPLv3 License. +# +#************************************************************************* + +Start +module = "gid_Module_Root" +solarispackagename = "%SOLSUREPACKAGEPREFIX-ure" +solarisrequires = "SUNWzlibr" +packagename = "%UREPACKAGEPREFIX-ure" +copyright = "2005-2009 by OpenOffice.org" +solariscopyright = "solariscopyrightfile" +vendor = "OpenOffice.org" +description = "UNO Runtime Environment" +destpath = "/opt" +packageversion = "%UREPACKAGEVERSION" +End + +Start +module = "gid_Module_Root_Ure_Hidden" +solarispackagename = "%SOLSUREPACKAGEPREFIX-ure" +solarisrequires = "SUNWzlibr" +packagename = "%UREPACKAGEPREFIX-ure" +copyright = "2005-2009 by OpenOffice.org" +solariscopyright = "solariscopyrightfile" +vendor = "OpenOffice.org" +description = "UNO Runtime Environment" +destpath = "/opt" +packageversion = "%UREPACKAGEVERSION" +End diff --git a/setup_native/source/packinfo/private1copyrightfile b/setup_native/source/packinfo/private1copyrightfile new file mode 100644 index 000000000000..bc2059a3ef79 --- /dev/null +++ b/setup_native/source/packinfo/private1copyrightfile @@ -0,0 +1,2 @@ +Copyright 2000, 2010 Oracle and/or its affiliates. All rights reserved. +Use is subject to license terms. diff --git a/setup_native/source/packinfo/shellscripts.txt b/setup_native/source/packinfo/shellscripts.txt new file mode 100755 index 000000000000..664cfbd887d7 --- /dev/null +++ b/setup_native/source/packinfo/shellscripts.txt @@ -0,0 +1,11 @@ +%preinstall << END +END + +%postinstall << END +END + +%preremove << END +END + +%postremove << END +END diff --git a/setup_native/source/packinfo/shellscripts_brand.txt b/setup_native/source/packinfo/shellscripts_brand.txt new file mode 100644 index 000000000000..62039f504c32 --- /dev/null +++ b/setup_native/source/packinfo/shellscripts_brand.txt @@ -0,0 +1,69 @@ +%preinstall << END +END + +%postinstall << END + +# echo Command after installing +# searching for the PRODUCTINSTALLLOCATION for the different platforms +platform=`uname -s` +case $$platform in +SunOS) + BASISPACKAGE=openofficeorg-core01 + BASISDIR=`pkginfo -r $$BASISPACKAGE` + PRODUCTINSTALLLOCATION="$$BASEDIR" + ;; +Linux) + BASISPACKAGE=openoffice.org-core01 + BASISDIR=`rpm -q --queryformat "%{INSTALLPREFIX}" $$BASISPACKAGE` + PRODUCTINSTALLLOCATION="$$RPM_INSTALL_PREFIX" + ;; +*) + PRODUCTINSTALLLOCATION="$$BASEDIR" + ;; +esac + +# creating link to basis layer +if [ -d $$BASISDIR/openoffice.org/basisBASISDIRECTORYVERSION ] +then + ln -s $$BASISDIR/openoffice.org/basisBASISDIRECTORYVERSION $$PRODUCTINSTALLLOCATION/PRODUCTDIRECTORYNAME/basis-link >/dev/null 2>&1 +else + ln -s ../openoffice.org/basisBASISDIRECTORYVERSION $$PRODUCTINSTALLLOCATION/PRODUCTDIRECTORYNAME/basis-link >/dev/null 2>&1 +fi + +exit 0 +END + +%preremove << END +END + +%postremove << END +# echo Command after removing + +LASTUNINSTALL=1 # important for RPM deinstallation + +# searching for the PRODUCTINSTALLLOCATION for the different platforms +platform=`uname -s` +case $$platform in +SunOS) + PRODUCTINSTALLLOCATION="$$BASEDIR" + ;; +Linux) + PRODUCTINSTALLLOCATION="$$RPM_INSTALL_PREFIX" + if [ "$$1" = 1 ] # one package left after deinstallation -> update + then + LASTUNINSTALL=0 + fi + ;; +*) + PRODUCTINSTALLLOCATION="$$BASEDIR" + ;; +esac + +if [ -h $$PRODUCTINSTALLLOCATION/PRODUCTDIRECTORYNAME/basis-link -a $$LASTUNINSTALL -eq 1 ] +then + rm -f $$PRODUCTINSTALLLOCATION/PRODUCTDIRECTORYNAME/basis-link 2>/dev/null + rmdir $$PRODUCTINSTALLLOCATION/PRODUCTDIRECTORYNAME 2>/dev/null +fi + +exit 0 +END diff --git a/setup_native/source/packinfo/shellscripts_core01.txt b/setup_native/source/packinfo/shellscripts_core01.txt new file mode 100644 index 000000000000..623e5e901be2 --- /dev/null +++ b/setup_native/source/packinfo/shellscripts_core01.txt @@ -0,0 +1,70 @@ +%preinstall << END +END + +%postinstall << END + +# echo Command after installing +# searching for the PRODUCTINSTALLLOCATION for the different platforms +platform=`uname -s` +case $$platform in +SunOS) + UREPACKAGE=SOLSUREPACKAGEPREFIX-ure + UREDIR=`pkginfo -r $$UREPACKAGE` + PRODUCTINSTALLLOCATION="$$BASEDIR" + ;; +Linux) + UREPACKAGE=UREPACKAGEPREFIX-ure + UREDIR=`rpm -q --queryformat "%{INSTALLPREFIX}" $$UREPACKAGE` + PRODUCTINSTALLLOCATION="$$RPM_INSTALL_PREFIX" + ;; +*) + PRODUCTINSTALLLOCATION="$$BASEDIR" + ;; +esac + +# creating link to ure +if [ -d $$UREDIR/openoffice.org/ure ] +then + ln -s $$UREDIR/openoffice.org/ure $$PRODUCTINSTALLLOCATION/openoffice.org/basisBASISDIRECTORYVERSION/ure-link >/dev/null 2>&1 +else + ln -s ../ure $$PRODUCTINSTALLLOCATION/openoffice.org/basisBASISDIRECTORYVERSION/ure-link >/dev/null 2>&1 +fi + +exit 0 +END + +%preremove << END +END + +%postremove << END +# echo Command after removing + +LASTUNINSTALL=1 # important for RPM deinstallation + +# searching for the PRODUCTINSTALLLOCATION for the different platforms +platform=`uname -s` +case $$platform in +SunOS) + PRODUCTINSTALLLOCATION="$$BASEDIR" + ;; +Linux) + PRODUCTINSTALLLOCATION="$$RPM_INSTALL_PREFIX" + if [ "$$1" = 1 ] # one package left after deinstallation -> update + then + LASTUNINSTALL=0 + fi + ;; +*) + PRODUCTINSTALLLOCATION="$$BASEDIR" + ;; +esac + +if [ -h $$PRODUCTINSTALLLOCATION/openoffice.org/basisBASISDIRECTORYVERSION/ure-link -a $$LASTUNINSTALL -eq 1 ] +then + rm -f $$PRODUCTINSTALLLOCATION/openoffice.org/basisBASISDIRECTORYVERSION/ure-link 2>/dev/null + rmdir $$PRODUCTINSTALLLOCATION/openoffice.org/basisBASISDIRECTORYVERSION 2>/dev/null + rmdir $$PRODUCTINSTALLLOCATION/openoffice.org 2>/dev/null +fi + +exit 0 +END diff --git a/setup_native/source/packinfo/shellscripts_extensions.txt b/setup_native/source/packinfo/shellscripts_extensions.txt new file mode 100755 index 000000000000..424962e3d874 --- /dev/null +++ b/setup_native/source/packinfo/shellscripts_extensions.txt @@ -0,0 +1,360 @@ +%system solaris + +%postinstall << END + +if [ -n "$$TMPDIR" ]; then + UNOPKGTMP="$$TMPDIR" +elif [ -n "$$TMP" ]; then + UNOPKGTMP="$$TMP" +elif [ -d "/tmp" ]; then + UNOPKGTMP="/tmp" +else + echo "No tmp directory found!" + exit 1 +fi + +#Create the command which creates a temporary directory +if [ -x "/usr/bin/mktemp" ] +then + INSTDIR=`/usr/bin/mktemp -d "$${UNOPKGTMP}/userinstall.XXXXXX"` +else + INSTDIR="$${UNOPKGTMP}/userinstall.$$$$" + mkdir "$$INSTDIR" +fi + +# +# Need to check diskless service install and make sure use the correct unpkg +# +DISKLESS_SRVC=`echo $$BASEDIR | /usr/bin/grep export/Solaris_[1-9][0-9]/usr_$${ARCH}.all` +if [ "$$DISKLESS_SRVC" ]; then + UNOPKG=/export/Solaris_11/usr_`uname -p`.all/opt/staroffice9/program/unopkg + POSTRUN=$$PKG_INSTALL_ROOT/usr_`uname -p`.all/usr/lib/postrun + CLIENT_BASEDIR=$$PKG_INSTALL_ROOT/usr_$${ARCH}.all +else + UNOPKG=$$BASEDIR/PRODUCTDIRECTORYNAME/program/unopkg + POSTRUN=$$PKG_INSTALL_ROOT/usr/lib/postrun +fi +# Use postrun command on Solaris where available (OpenSolaris) +if [ -x $$POSTRUN ]; then +( echo "test -x \"$$CLIENT_BASEDIR/PRODUCTDIRECTORYNAME/program/unopkg\" || exit 0" + echo "umask 022" + echo "\"$$CLIENT_BASEDIR/PRODUCTDIRECTORYNAME/program/unopkg\" add --shared --suppress-license --bundled \"$$CLIENT_BASEDIR/PRODUCTDIRECTORYNAME/share/extension/install/${OXTFILENAME}\" \"-env:UserInstallation=file:////$$INSTDIR\" '-env:UNO_JAVA_JFW_INSTALL_DATA=\$$OOO_BASE_DIR/share/config/javasettingsunopkginstall.xml' '-env:JFW_PLUGIN_DO_NOT_CHECK_ACCESSIBILITY=1'" +) | $$POSTRUN -b -c UNOPKG + if [ "$$?" != "0" ]; then + echo "\nERROR: Installation of UNO extension ${OXTFILENAME}" + echo " through $$POSTRUN failed." + exit 1 + fi +else + # No postrun available, try running unopkg directly + "$$UNOPKG" add --shared --suppress-license --bundled "$$BASEDIR/PRODUCTDIRECTORYNAME/share/extension/install/${OXTFILENAME}" "-env:UserInstallation=file:////$$INSTDIR" '-env:UNO_JAVA_JFW_INSTALL_DATA=$$OOO_BASE_DIR/share/config/javasettingsunopkginstall.xml' '-env:JFW_PLUGIN_DO_NOT_CHECK_ACCESSIBILITY=1' + if [ "$$?" != "0" ]; then + echo "\nERROR: Installation of UNO extension ${OXTFILENAME} failed." + test "$$BASEDIR" = "$$CLIENT_BASEDIR" || echo "ERROR: alternate root install requires SUNWpostrun package to be installed" + echo 'ERROR: Make sure the runtime requirements (operating system, patch level, architecture) are met.' + exit 1 + fi +fi + +if [ -n "$$INSTDIR" ]; then + rm -rf "$$INSTDIR" +fi + +exit 0 +END + +%preremove << END +if [ -n "$$TMPDIR" ]; then + UNOPKGTMP="$$TMPDIR" +elif [ -n "$$TMP" ]; then + UNOPKGTMP="$$TMP" +elif [ -d "/tmp" ]; then + UNOPKGTMP="/tmp" +else + echo "No tmp directory found!" + exit 1 +fi + +#Create the command which creates a temporary directory +if [ -x "/usr/bin/mktemp" ] +then + INSTDIR=`/usr/bin/mktemp -d "$${UNOPKGTMP}/userinstall.XXXXXX"` +else + INSTDIR="$${UNOPKGTMP}/userinstall.$$$$" + mkdir "$$INSTDIR" +fi + +# Use postrun command on Solaris where available (OpenSolaris) +if [ -x $$PKG_INSTALL_ROOT/usr/lib/postrun ]; then +( echo "test -x \"$$CLIENT_BASEDIR/PRODUCTDIRECTORYNAME/program/unopkg\" || exit 0" + echo "cd \"$$CLIENT_BASEDIR/PRODUCTDIRECTORYNAME/program\"" + echo "umask 022" + echo "\"$$CLIENT_BASEDIR/PRODUCTDIRECTORYNAME/program/unopkg\" remove --shared --bundled \"${OXTFILENAME}\" \"-env:UserInstallation=file:////$$INSTDIR\" '-env:UNO_JAVA_JFW_INSTALL_DATA=\$$OOO_BASE_DIR/share/config/javasettingsunopkginstall.xml' '-env:JFW_PLUGIN_DO_NOT_CHECK_ACCESSIBILITY=1'" + echo "rm -rf \"$$INSTDIR\"" +) | $$PKG_INSTALL_ROOT/usr/lib/postrun -c UNOPKG +else + # No postrun available, try running unopkg directly + test -x $$BASEDIR/PRODUCTDIRECTORYNAME/program/unopkg || exit 0 + "$$BASEDIR/PRODUCTDIRECTORYNAME/program/unopkg" remove --shared --bundled "${OXTFILENAME}" "-env:UserInstallation=file:////$$INSTDIR" '-env:UNO_JAVA_JFW_INSTALL_DATA=$$OOO_BASE_DIR/share/config/javasettingsunopkginstall.xml' '-env:JFW_PLUGIN_DO_NOT_CHECK_ACCESSIBILITY=1' + if [ "$$?" != "0" ]; then + echo "\nERROR: Removal of UNO extension ${OXTFILENAME} failed." + test "$$BASEDIR" = "$$CLIENT_BASEDIR" || echo "ERROR: alternate root uninstall requires SUNWpostrun package to be installed" + echo 'ERROR: Make sure the runtime requirements (operating system, patch level, architecture) are met.' + exit 1 + fi +fi + +if [ -n "$$INSTDIR" ]; then + rm -rf "$$INSTDIR" +fi + +exit 0 +END + +%system linux + +%format rpm + +# As remove does not need the oxt file, this could potentially +# be done in the postinstall script as well. +%preinstall << END +# if this is an update, remove the old package instance first +test "$$1" = "2" || exit 0 + +#Find the temp dir +if [ -n "$$TMPDIR" ]; then + UNOPKGTMP="$$TMPDIR" +elif [ -n "$$TMP" ]; then + UNOPKGTMP="$$TMP" +elif [ -d "/tmp" ]; then + UNOPKGTMP="/tmp" +else + echo "No tmp directory found!" + exit 1 +fi + +#Create the command which creates a temporary directory +if [ -x "/bin/mktemp" ] +then + INSTDIR=`/bin/mktemp -d "$${UNOPKGTMP}/userinstall.XXXXXX"` +else + INSTDIR="$${UNOPKGTMP}/userinstall.$$$$" + mkdir "$$INSTDIR" +fi + +if [ -x "$$RPM_INSTALL_PREFIX/PRODUCTDIRECTORYNAME/program/unopkg" ]; then + "$$RPM_INSTALL_PREFIX/PRODUCTDIRECTORYNAME/program/unopkg" remove --shared --bundled "${OXTFILENAME}" "-env:UserInstallation=file:////$$INSTDIR" '-env:UNO_JAVA_JFW_INSTALL_DATA=$$OOO_BASE_DIR/share/config/javasettingsunopkginstall.xml' '-env:JFW_PLUGIN_DO_NOT_CHECK_ACCESSIBILITY=1' +fi + +if [ -n "$$INSTDIR" ]; then + rm -rf "$$INSTDIR" +fi + +exit 0 +END + +%postinstall << END +#Find the temp dir +if [ -n "$$TMPDIR" ]; then + UNOPKGTMP="$$TMPDIR" +elif [ -n "$$TMP" ]; then + UNOPKGTMP="$$TMP" +elif [ -d "/tmp" ]; then + UNOPKGTMP="/tmp" +else + echo "No tmp directory found!" + exit 1 +fi + +#Create the command which creates a temporary directory +if [ -x "/bin/mktemp" ] +then + INSTDIR=`/bin/mktemp -d "$${UNOPKGTMP}/userinstall.XXXXXX"` +else + INSTDIR="$${UNOPKGTMP}/userinstall.$$$$" + mkdir "$$INSTDIR" +fi + +if [ -x "$$RPM_INSTALL_PREFIX/PRODUCTDIRECTORYNAME/program/unopkg" ]; then + "$$RPM_INSTALL_PREFIX/PRODUCTDIRECTORYNAME/program/unopkg" add --shared --suppress-license --shared "$$RPM_INSTALL_PREFIX/PRODUCTDIRECTORYNAME/share/extension/install/${OXTFILENAME}" "-env:UserInstallation=file://////$$INSTDIR" '-env:UNO_JAVA_JFW_INSTALL_DATA=$$OOO_BASE_DIR/share/config/javasettingsunopkginstall.xml' '-env:JFW_PLUGIN_DO_NOT_CHECK_ACCESSIBILITY=1' +fi + +if [ -n "$$INSTDIR" ]; then + rm -rf "$$INSTDIR" +fi + +exit 0 + + +END + +%preremove << END +# if this is an update, just do nothing +test "$$1" = "0" || exit 0 + +#Find the temp dir +if [ -n "$$TMPDIR" ]; then + UNOPKGTMP="$$TMPDIR" +elif [ -n "$$TMP" ]; then + UNOPKGTMP="$$TMP" +elif [ -d "/tmp" ]; then + UNOPKGTMP="/tmp" +else + echo "No tmp directory found!" + exit 1 +fi + +#Create the command which creates a temporary directory +if [ -x "/bin/mktemp" ] +then + INSTDIR=`/bin/mktemp -d "$${UNOPKGTMP}/userinstall.XXXXXX"` +else + INSTDIR="$${UNOPKGTMP}/userinstall.$$$$" + mkdir "$$INSTDIR" +fi + +if [ -x "$$RPM_INSTALL_PREFIX/PRODUCTDIRECTORYNAME/program/unopkg" ]; then + "$$RPM_INSTALL_PREFIX/PRODUCTDIRECTORYNAME/program/unopkg" remove --shared --bundled "${OXTFILENAME}" "-env:UserInstallation=file:////$$INSTDIR" '-env:UNO_JAVA_JFW_INSTALL_DATA=$$OOO_BASE_DIR/share/config/javasettingsunopkginstall.xml' '-env:JFW_PLUGIN_DO_NOT_CHECK_ACCESSIBILITY=1' +fi + +if [ -n "$$INSTDIR" ]; then + rm -rf "$$INSTDIR" +fi + +exit 0 +END + +%format deb + +# As remove does not need the oxt file, this could potentially +# be done in the postinstall script as well. +%preinstall << END +# if this is an update, remove the old package instance first +if [ "$$1" != "upgrade" ] +then + exit 0 +fi + +#Find the temp dir +if [ -n "$$TMPDIR" ] +then + UNOPKGTMP="$$TMPDIR" +elif [ -n "$$TMP" ] +then + UNOPKGTMP="$$TMP" +elif [ -d "/tmp" ] +then + UNOPKGTMP="/tmp" +else + echo "No tmp directory found!" + exit 1 +fi + + +#Create the command which creates a temporary directory +if [ -x "/bin/mktemp" ] +then + INSTDIR=`/bin/mktemp -d "$${UNOPKGTMP}/userinstall.XXXXXX"` +else + INSTDIR="$${UNOPKGTMP}/userinstall.$$$$" + mkdir "$$INSTDIR" +fi + +if [ -x "PRODUCTDIRECTORYNAME/program/unopkg" ] +then + "PRODUCTDIRECTORYNAME/program/unopkg" remove --shared --bundled "${OXTFILENAME}" "-env:UserInstallation=file:////$$INSTDIR" '-env:UNO_JAVA_JFW_INSTALL_DATA=$$OOO_BASE_DIR/share/config/javasettingsunopkginstall.xml' '-env:JFW_PLUGIN_DO_NOT_CHECK_ACCESSIBILITY=1' +fi + +if [ -n "$$INSTDIR" ] +then + rm -rf "$$INSTDIR" +fi + +exit 0 +END + +%postinstall << END +#Find the temp dir +if [ -n "$$TMPDIR" ] +then + UNOPKGTMP="$$TMPDIR" +elif [ -n "$$TMP" ] +then + UNOPKGTMP="$$TMP" +elif [ -d "/tmp" ] +then + UNOPKGTMP="/tmp" +else + echo "No tmp directory found!" + exit 1 +fi + +#Create the command which creates a temporary directory +if [ -x "/bin/mktemp" ] +then + INSTDIR=`/bin/mktemp -d "$${UNOPKGTMP}/userinstall.XXXXXX"` +else + INSTDIR="$${UNOPKGTMP}/userinstall.$$$$" + mkdir "$$INSTDIR" +fi + +if [ -x "PRODUCTDIRECTORYNAME/program/unopkg" ]; then + "PRODUCTDIRECTORYNAME/program/unopkg" add --shared --suppress-license --bundled "PRODUCTDIRECTORYNAME/share/extension/install/${OXTFILENAME}" "-env:UserInstallation=file://////$$INSTDIR" '-env:UNO_JAVA_JFW_INSTALL_DATA=$$OOO_BASE_DIR/share/config/javasettingsunopkginstall.xml' '-env:JFW_PLUGIN_DO_NOT_CHECK_ACCESSIBILITY=1' +fi + +if [ -n "$$INSTDIR" ] +then + rm -rf "$$INSTDIR" +fi + +exit 0 + + +END + +%preremove << END +# if this is an update, just do nothing + +if [ "$$1" = "upgrade" ] +then + exit 0 +fi + +#Find the temp dir +if [ -n "$$TMPDIR" ] +then + UNOPKGTMP="$$TMPDIR" +elif [ -n "$$TMP" ] +then + UNOPKGTMP="$$TMP" +elif [ -d "/tmp" ] +then + UNOPKGTMP="/tmp" +else + echo "No tmp directory found!" + exit 1 +fi + +#Create the command which creates a temporary directory +if [ -x "/bin/mktemp" ] +then + INSTDIR=`/bin/mktemp -d "$${UNOPKGTMP}/userinstall.XXXXXX"` +else + INSTDIR="$${UNOPKGTMP}/userinstall.$$$$" + mkdir "$$INSTDIR" +fi + +if [ -x "PRODUCTDIRECTORYNAME/program/unopkg" ] +then + "PRODUCTDIRECTORYNAME/program/unopkg" remove --shared --bundled "${OXTFILENAME}" "-env:UserInstallation=file:////$$INSTDIR" '-env:UNO_JAVA_JFW_INSTALL_DATA=$$OOO_BASE_DIR/share/config/javasettingsunopkginstall.xml' '-env:JFW_PLUGIN_DO_NOT_CHECK_ACCESSIBILITY=1' +fi + +if [ -n "$$INSTDIR" ] +then + rm -rf "$$INSTDIR" +fi + +exit 0 +END + +%system all diff --git a/setup_native/source/packinfo/shellscripts_module.txt b/setup_native/source/packinfo/shellscripts_module.txt new file mode 100755 index 000000000000..32a15da9bdc6 --- /dev/null +++ b/setup_native/source/packinfo/shellscripts_module.txt @@ -0,0 +1,33 @@ +%format deb + +%postinstall << END +if [ "$$1" = "configure" ] ; then + # update desktop database + if [ -x /usr/bin/update-desktop-database ]; then + update-desktop-database -q /usr/share/applications + fi + # update debian style menus + if [ -x /usr/bin/update-menus ]; then + update-menus + fi +fi +exit 0 +END + +%postremove << END +if [ "$$1" != "purge" ] +then + if [ -x /usr/bin/update-desktop-database ] + then + update-desktop-database -q /usr/share/applications + fi + if [ -x /usr/bin/update-menus ] + then + update-menus + fi +fi +exit 0 +END + +%format all + diff --git a/setup_native/source/packinfo/shellscripts_root.txt b/setup_native/source/packinfo/shellscripts_root.txt new file mode 100755 index 000000000000..664cfbd887d7 --- /dev/null +++ b/setup_native/source/packinfo/shellscripts_root.txt @@ -0,0 +1,11 @@ +%preinstall << END +END + +%postinstall << END +END + +%preremove << END +END + +%postremove << END +END diff --git a/setup_native/source/packinfo/solariscopyrightfile b/setup_native/source/packinfo/solariscopyrightfile new file mode 100755 index 000000000000..6e2c0ef08e79 --- /dev/null +++ b/setup_native/source/packinfo/solariscopyrightfile @@ -0,0 +1,2 @@ +Copyright 2000, 2010 Oracle and/or its affiliates. All rights reserved. +Use is subject to license terms. diff --git a/setup_native/source/packinfo/spellchecker_selection.txt b/setup_native/source/packinfo/spellchecker_selection.txt new file mode 100644 index 000000000000..526058086f67 --- /dev/null +++ b/setup_native/source/packinfo/spellchecker_selection.txt @@ -0,0 +1,50 @@ +# This file defines the languages of the spellchecker, that are +# included into the language specific installation sets. +# First column: Language in the installation set. +# Second column: Assigned spellchecker languages. Comma separated list. + +# The first entry after the "=" is the entry, that will be included into +# a language pack of the corresponding language. If no spellchecker +# shall be included into the language pack, the keyword "EMPTY" can +# be used as first entry. + +af = "af,en-US" +ar = "EMPTY,en-US" +ca = "ca,es,en-US,fr" +cs = "cs,en-US" +da = "da,de-DE,en-US" +de = "de-DE,de-AT,de-CH,en-US,fr,it" +en-US = "en-US,es,fr" +en-GB = "en-US,es,fr" +es = "es,en-US,fr,pt" +et = "et,en-US" +fr = "fr,en-US,es" +gl = "gl,en-US,pt,es" +he = "he,en-US" +hu = "hu,de-DE,en-US" +it = "it,de-DE,en-US,fr" +ja = "EMPTY,en-US" +ko = "EMPTY,en-US" +lt = "lt,en-US" +nb = "no,en-US,fr,de-DE,es" +ne = "ne,en-US" +nl = "nl,en-US,fr,de-DE" +nn = "no,en-US,fr,de-DE,es" +pl = "pl,de-DE,en-US,ru" +pt-BR = "pt,en-US,es" +pt = "pt,en-US,es" +ro = "ro,en-US,de-DE,hu" +ru = "ru,de-DE,en-US" +sk = "sk,en-US" +sl = "sl,en-US" +sv = "sv,de-DE,en-US" +sr = "sr,en-US" +# ! Note the package 'sr' also holds the dictionaries for 'sh' ! +sh = "sr,en-US" +sw = "sw,en-US" +th = "th,en-US" +vi = "vi,en-US,fr" +zh-TW = "EMPTY,en-US" +zh-CN = "EMPTY,en-US" +zu = "zu,en-US" + diff --git a/setup_native/source/packinfo/ure.pcp b/setup_native/source/packinfo/ure.pcp Binary files differnew file mode 100644 index 000000000000..982656647647 --- /dev/null +++ b/setup_native/source/packinfo/ure.pcp diff --git a/setup_native/source/ulfconv/makefile.mk b/setup_native/source/ulfconv/makefile.mk new file mode 100644 index 000000000000..7f23df4cd897 --- /dev/null +++ b/setup_native/source/ulfconv/makefile.mk @@ -0,0 +1,54 @@ +#************************************************************************* +# +# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. +# +# Copyright 2000, 2010 Oracle and/or its affiliates. +# +# OpenOffice.org - a multi-platform office productivity suite +# +# This file is part of OpenOffice.org. +# +# OpenOffice.org is free software: you can redistribute it and/or modify +# it under the terms of the GNU Lesser General Public License version 3 +# only, as published by the Free Software Foundation. +# +# OpenOffice.org is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU Lesser General Public License version 3 for more details +# (a copy is included in the LICENSE file that accompanied this code). +# +# You should have received a copy of the GNU Lesser General Public License +# version 3 along with OpenOffice.org. If not, see +# <http://www.openoffice.org/license.html> +# for a copy of the LGPLv3 License. +# +#************************************************************************* + +PRJ=..$/.. + +PRJNAME=setup_native +TARGET=ulfconv +TARGETTYPE=CUI +LIBTARGET=NO +ENABLE_EXCEPTIONS=TRUE + +# --- Settings ----------------------------------------------------- + +.INCLUDE : settings.mk + +# --- Files -------------------------------------------------------- + +SLOFILES = $(SLO)$/$(TARGET).obj + +APP1TARGET=$(TARGET) +APP1OBJS=$(OBJ)$/$(TARGET).obj +APP1LIBS= +APP1STDLIBS= $(SALLIB) +APP1RPATH=NONE + +# --- Targets ------------------------------------------------------ + + +.INCLUDE : target.mk + diff --git a/setup_native/source/ulfconv/ulfconv.cxx b/setup_native/source/ulfconv/ulfconv.cxx new file mode 100644 index 000000000000..49f6861c3683 --- /dev/null +++ b/setup_native/source/ulfconv/ulfconv.cxx @@ -0,0 +1,357 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#include <stdlib.h> +#include <stdio.h> +#include <fcntl.h> +#include <errno.h> +#include <string.h> +#include <unistd.h> +#include <ctype.h> +#include <sal/alloca.h> + +#include <rtl/ustring.hxx> + +#include <map> +#include <string> + +/***************************************************************************** + * typedefs + *****************************************************************************/ + +typedef std::map< const std::string, rtl_TextEncoding > EncodingMap; + +struct _pair { + const char *key; + rtl_TextEncoding value; +}; + +static int _pair_compare (const char *key, const _pair *pair); +static const _pair* _pair_search (const char *key, const _pair *base, unsigned int member ); + + +const _pair _ms_encoding_list[] = { + { "0", RTL_TEXTENCODING_UTF8 }, + { "1250", RTL_TEXTENCODING_MS_1250 }, + { "1251", RTL_TEXTENCODING_MS_1251 }, + { "1252", RTL_TEXTENCODING_MS_1252 }, + { "1253", RTL_TEXTENCODING_MS_1253 }, + { "1254", RTL_TEXTENCODING_MS_1254 }, + { "1255", RTL_TEXTENCODING_MS_1255 }, + { "1256", RTL_TEXTENCODING_MS_1256 }, + { "1257", RTL_TEXTENCODING_MS_1257 }, + { "1258", RTL_TEXTENCODING_MS_1258 }, + { "874", RTL_TEXTENCODING_MS_874 }, + { "932", RTL_TEXTENCODING_MS_932 }, + { "936", RTL_TEXTENCODING_MS_936 }, + { "949", RTL_TEXTENCODING_MS_949 }, + { "950", RTL_TEXTENCODING_MS_950 } +}; + + +/***************************************************************************** + * fgets that work with unix line ends on Windows + *****************************************************************************/ + +char * my_fgets(char *s, int n, FILE *fp) +{ + int i; + for( i=0; i < n-1; i++ ) + { + int c = getc(fp); + + if( c == EOF ) + break; + + s[i] = (char) c; + + if( s[i] == '\n' ) + { + i++; + break; + } + } + + if( i>0 ) + { + s[i] = '\0'; + return s; + } + else + { + return NULL; + } +} + +/***************************************************************************** + * compare function for binary search + *****************************************************************************/ + +static int +_pair_compare (const char *key, const _pair *pair) +{ + int result = rtl_str_compareIgnoreAsciiCase( key, pair->key ); + return result; +} + +/***************************************************************************** + * binary search on encoding tables + *****************************************************************************/ + +static const _pair* +_pair_search (const char *key, const _pair *base, unsigned int member ) +{ + unsigned int lower = 0; + unsigned int upper = member; + unsigned int current; + int comparison; + + /* check for validity of input */ + if ( (key == NULL) || (base == NULL) || (member == 0) ) + return NULL; + + /* binary search */ + while ( lower < upper ) + { + current = (lower + upper) / 2; + comparison = _pair_compare( key, base + current ); + if (comparison < 0) + upper = current; + else + if (comparison > 0) + lower = current + 1; + else + return base + current; + } + + return NULL; +} + + +/************************************************************************ + * read_encoding_table + ************************************************************************/ + +void read_encoding_table(char * file, EncodingMap& aEncodingMap) +{ + FILE * fp = fopen(file, "r"); + if ( ! fp ) { + fprintf(stderr, "ulfconv: %s %s\n", file, strerror(errno)); + exit(2); + } + + char buffer[512]; + while ( NULL != my_fgets(buffer, sizeof(buffer), fp) ) { + + // strip comment lines + if ( buffer[0] == '#' ) + continue; + + // find end of language string + char * cp; + for ( cp = buffer; ! isspace(*cp); cp++ ) + ; + *cp = '\0'; + + // find start of codepage string + for ( ++cp; isspace(*cp); ++cp ) + ; + char * codepage = cp; + + // find end of codepage string + for ( ++cp; ! isspace(*cp); ++cp ) + ; + *cp = '\0'; + + // find the correct mapping for codepage + const unsigned int members = sizeof( _ms_encoding_list ) / sizeof( _pair ); + const _pair *encoding = _pair_search( codepage, _ms_encoding_list, members ); + + if ( encoding != NULL ) { + const std::string language(buffer); + aEncodingMap.insert( EncodingMap::value_type(language, encoding->value) ); + } + } + + fclose(fp); +} + +/************************************************************************ + * print_legacy_mixed + ************************************************************************/ + +void print_legacy_mixed( + FILE * ostream, + const rtl::OUString& aString, + const std::string& language, + EncodingMap& aEncodingMap) +{ + EncodingMap::iterator iter = aEncodingMap.find(language); + + if ( iter != aEncodingMap.end() ) { + fputs(OUStringToOString(aString, iter->second).getStr(), ostream); + } else { + fprintf(stderr, "ulfconv: WARNING: no legacy encoding found for %s\n", language.c_str()); + } +} + +/************************************************************************ + * print_java_style + ************************************************************************/ + +void print_java_style(FILE * ostream, const rtl::OUString& aString) +{ + int imax = aString.getLength(); + for (int i = 0; i < imax; i++) { + sal_Unicode uc = aString[i]; + if ( uc < 128 ) { + fprintf(ostream, "%c", (char) uc); + } else { + fprintf(ostream, "\\u%2.2x%2.2x", uc >> 8, uc & 0xFF ); + } + } +} + +/************************************************************************ + * main + ************************************************************************/ + +int main( int argc, char * const argv[] ) +{ + EncodingMap aEncodingMap; + + FILE *istream = stdin; + FILE *ostream = stdout; + + char *outfile = NULL; + + int errflg = 0; + int argi; + + for( argi=1; argi < argc; argi++ ) + { + if( argv[argi][0] == '-' && argv[argi][2] == '\0' ) + { + switch(argv[argi][1]) { + case 'o': + if (argi+1 >= argc || argv[argi+1][0] == '-') + { + fprintf(stderr, "Option -%c requires an operand\n", argv[argi][1]); + errflg++; + break; + } + + ++argi; + outfile = argv[argi]; + break; + case 't': + if (argi+1 >= argc || argv[argi+1][0] == '-') + { + fprintf(stderr, "Option -%c requires an operand\n", argv[argi][1]); + errflg++; + break; + } + + read_encoding_table(argv[++argi], aEncodingMap); + break; + default: + fprintf(stderr, "Unrecognized option: -%c\n", argv[argi][1]); + errflg++; + } + } + else + { + break; + } + } + + if (errflg) { + fprintf(stderr, "Usage: ulfconv [-o <output file>] [-t <encoding table>] [<ulf file>]\n"); + exit(2); + } + + /* assign input file to stdin */ + if ( argi < argc ) + { + istream = fopen(argv[argi], "r"); + if ( istream == NULL ) { + fprintf(stderr, "ulfconv: %s : %s\n", argv[argi], strerror(errno)); + exit(2); + } + } + + /* open output file if any */ + if ( outfile ) + { + ostream = fopen(outfile, "w"); + if ( ostream == NULL ) { + fprintf(stderr, "ulfconv: %s : %s\n", outfile, strerror(errno)); + fclose(istream); + exit(2); + } + } + + /* read line by line from stdin */ + char buffer[65536]; + while ( NULL != fgets(buffer, sizeof(buffer), istream) ) { + + /* only handle lines containing " = " */ + char * cp = strstr(buffer, " = \""); + if ( cp ) { + rtl::OUString aString; + + /* find end of lang string */ + int n; + for ( n=0; ! isspace(buffer[n]); n++ ) + ; + + std::string line = buffer; + std::string lang(line, 0, n); + + cp += 4; + rtl_string2UString( &aString.pData, cp, strrchr(cp, '\"') - cp, + RTL_TEXTENCODING_UTF8, OSTRING_TO_OUSTRING_CVTFLAGS ); + + fprintf(ostream, "%s = \"", lang.c_str()); + + if ( aEncodingMap.empty() ) { + print_java_style(ostream, aString); + } else { + print_legacy_mixed(ostream, aString, lang, aEncodingMap); + } + + fprintf(ostream, "\"\n"); + + + } else { + fputs(buffer, ostream); + } + } + + fclose(ostream); + fclose(istream); +} diff --git a/setup_native/source/win32/customactions/indexingfilter/exports.dxp b/setup_native/source/win32/customactions/indexingfilter/exports.dxp new file mode 100644 index 000000000000..bb23f3d02803 --- /dev/null +++ b/setup_native/source/win32/customactions/indexingfilter/exports.dxp @@ -0,0 +1,3 @@ +RestartIndexingService + +
\ No newline at end of file diff --git a/setup_native/source/win32/customactions/indexingfilter/makefile.mk b/setup_native/source/win32/customactions/indexingfilter/makefile.mk new file mode 100644 index 000000000000..0298d05960db --- /dev/null +++ b/setup_native/source/win32/customactions/indexingfilter/makefile.mk @@ -0,0 +1,68 @@ +#************************************************************************* +# +# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. +# +# Copyright 2000, 2010 Oracle and/or its affiliates. +# +# OpenOffice.org - a multi-platform office productivity suite +# +# This file is part of OpenOffice.org. +# +# OpenOffice.org is free software: you can redistribute it and/or modify +# it under the terms of the GNU Lesser General Public License version 3 +# only, as published by the Free Software Foundation. +# +# OpenOffice.org is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU Lesser General Public License version 3 for more details +# (a copy is included in the LICENSE file that accompanied this code). +# +# You should have received a copy of the GNU Lesser General Public License +# version 3 along with OpenOffice.org. If not, see +# <http://www.openoffice.org/license.html> +# for a copy of the LGPLv3 License. +# +#************************************************************************* + +PRJ=..$/..$/..$/.. +PRJNAME=setup_native +TARGET=instooofiltmsi + +# --- Settings ----------------------------------------------------- + +ENABLE_EXCEPTIONS=TRUE +DYNAMIC_CRT= +NO_DEFAULT_STL=TRUE +USE_DEFFILE=TRUE + +.INCLUDE : settings.mk + +# --- Files -------------------------------------------------------- + +.IF "$(GUI)"=="WNT" + +UWINAPILIB= + +SLOFILES = $(SLO)$/restartindexingservice.obj + +SHL1LIBS = $(SLB)$/$(TARGET).lib + +SHL1TARGET = $(TARGET) +SHL1IMPLIB = i$(TARGET) + +SHL1DEF = $(MISC)$/$(SHL1TARGET).def +SHL1DEPN = $(SLB)$/$(TARGET).lib +SHL1BASE = 0x1c000000 +DEF1NAME=$(SHL1TARGET) +DEF1EXPORTFILE=exports.dxp + +.ENDIF + +# --- Targets -------------------------------------------------------------- + +.INCLUDE : target.mk + +# ------------------------------------------------------------------------- + + diff --git a/setup_native/source/win32/customactions/indexingfilter/restartindexingservice.cxx b/setup_native/source/win32/customactions/indexingfilter/restartindexingservice.cxx new file mode 100644 index 000000000000..a01e3e1f9a4d --- /dev/null +++ b/setup_native/source/win32/customactions/indexingfilter/restartindexingservice.cxx @@ -0,0 +1,208 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +/* + After installation of the OOo filter for the indexing service + it is necessary to restart the indexing service in order to + activate the filter. This is the most reliable way to get the + indexing service working. We only restart the service if it is + already running. If we have insufficient privileges to restart + the service we do nothing. +*/ + +#ifdef _MSC_VER +#pragma warning(push, 1) /* disable warnings within system headers */ +#endif +#define WIN32_LEAN_AND_MEAN +#include <windows.h> +#include <msiquery.h> +#ifdef _MSC_VER +#pragma warning(pop) +#endif + +/* + Advapi.dll needs to be loaded dynamically because the service + control functions are not available under Windows 9x. +*/ +typedef BOOL (__stdcall * CloseServiceHandle_t)(SC_HANDLE); +typedef BOOL (__stdcall * ControlService_t)(SC_HANDLE, DWORD, LPSERVICE_STATUS); +typedef SC_HANDLE (__stdcall * OpenSCManager_t)(LPCSTR, LPCSTR, DWORD); +typedef SC_HANDLE (__stdcall * OpenService_t)(SC_HANDLE, LPCSTR, DWORD); +typedef BOOL (__stdcall * QueryServiceStatus_t)(SC_HANDLE, LPSERVICE_STATUS); +typedef BOOL (__stdcall * StartService_t)(SC_HANDLE, DWORD, LPCSTR*); + +CloseServiceHandle_t CloseServiceHandle_ = NULL; +ControlService_t ControlService_ = NULL; +OpenSCManager_t OpenSCManager_ = NULL; +OpenService_t OpenService_ = NULL; +QueryServiceStatus_t QueryServiceStatus_ = NULL; +StartService_t StartService_ = NULL; + +const LPTSTR INDEXING_SERVICE_NAME = TEXT("cisvc"); + +bool StopIndexingService(SC_HANDLE hService) +{ + SERVICE_STATUS status; + + if (ControlService_(hService, SERVICE_CONTROL_STOP, &status)) + { + // Check the status until the service is no longer stop pending. + if (QueryServiceStatus_(hService, &status)) + { + DWORD startTime = GetTickCount(); + DWORD oldCheckPoint = status.dwCheckPoint; + + while (status.dwCurrentState == SERVICE_STOP_PENDING) + { + // Do not wait longer than the wait hint. A good interval is + // one tenth the wait hint, but no less than 1 second and no + // more than 10 seconds. + DWORD waitTime = status.dwWaitHint / 10; + + if (waitTime < 1000) + waitTime = 1000; + else if (waitTime > 10000) + waitTime = 10000; + + Sleep(waitTime); + + // Check the status again. + if (!QueryServiceStatus_(hService, &status) || + (status.dwCurrentState == SERVICE_STOPPED)) + break; + + if (status.dwCheckPoint > oldCheckPoint) + { + startTime = GetTickCount(); + oldCheckPoint = status.dwCheckPoint; + } + else if ((GetTickCount() - startTime) > status.dwWaitHint) + { + break; // service doesn't react anymore + } + } + } + } + return (status.dwCurrentState == SERVICE_STOPPED); +} + +void StartIndexingService(SC_HANDLE hService) +{ + if (StartService_(hService, 0, NULL)) + { + SERVICE_STATUS status; + + // Check the status until the service is no longer stop pending. + if (QueryServiceStatus_(hService, &status)) + { + DWORD startTime = GetTickCount(); + DWORD oldCheckPoint = status.dwCheckPoint; + + while (status.dwCurrentState == SERVICE_START_PENDING) + { + // Do not wait longer than the wait hint. A good interval is + // one tenth the wait hint, but no less than 1 second and no + // more than 10 seconds. + DWORD waitTime = status.dwWaitHint / 10; + + if (waitTime < 1000) + waitTime = 1000; + else if (waitTime > 10000) + waitTime = 10000; + + Sleep(waitTime); + + // Check the status again. + if (!QueryServiceStatus_(hService, &status) || + (status.dwCurrentState == SERVICE_STOPPED)) + break; + + if (status.dwCheckPoint > oldCheckPoint) + { + startTime = GetTickCount(); + oldCheckPoint = status.dwCheckPoint; + } + else if ((GetTickCount() - startTime) > status.dwWaitHint) + { + // service doesn't react anymore + break; + } + } + } + } +} + +extern "C" UINT __stdcall RestartIndexingService(MSIHANDLE) +{ + //MessageBox(NULL, TEXT("Restarting Indexing Service"), TEXT("Message"), MB_OK | MB_ICONINFORMATION); + + HMODULE hAdvapi32 = LoadLibrary("advapi32.dll"); + + if (hAdvapi32) + { + CloseServiceHandle_ = reinterpret_cast<CloseServiceHandle_t>(GetProcAddress(hAdvapi32, "CloseServiceHandle")); + ControlService_ = reinterpret_cast<ControlService_t>(GetProcAddress(hAdvapi32, "ControlService")); + OpenSCManager_ = reinterpret_cast<OpenSCManager_t>(GetProcAddress(hAdvapi32, "OpenSCManagerA")); + OpenService_ = reinterpret_cast<OpenService_t>(GetProcAddress(hAdvapi32, "OpenServiceA")); + QueryServiceStatus_ = reinterpret_cast<QueryServiceStatus_t>(GetProcAddress(hAdvapi32, "QueryServiceStatus")); + StartService_ = reinterpret_cast<StartService_t>(GetProcAddress(hAdvapi32, "StartServiceA")); + } + + /* On systems other than Windows 2000/XP the service API + functions might not be available */ + if (!hAdvapi32 || + !(CloseServiceHandle_ && ControlService_ && OpenSCManager_ && OpenService_ && QueryServiceStatus_ && StartService_)) + return ERROR_SUCCESS; + + SC_HANDLE hSCManager = OpenSCManager_( + NULL, // local machine + NULL, // ServicesActive database + SC_MANAGER_ALL_ACCESS); + + if (hSCManager != NULL) + { + SC_HANDLE hIndexingService = OpenService_( + hSCManager, INDEXING_SERVICE_NAME, SERVICE_QUERY_STATUS | SERVICE_START | SERVICE_STOP); + + if (hIndexingService) + { + SERVICE_STATUS status; + ZeroMemory(&status, sizeof(status)); + + if (QueryServiceStatus_(hIndexingService, &status) && + (status.dwCurrentState == SERVICE_RUNNING)) + { + if (StopIndexingService(hIndexingService)) + StartIndexingService(hIndexingService); + } + CloseServiceHandle_(hIndexingService); + } + CloseServiceHandle_(hSCManager); + } + return ERROR_SUCCESS; +} + diff --git a/setup_native/source/win32/customactions/javafilter/exports.dxp b/setup_native/source/win32/customactions/javafilter/exports.dxp new file mode 100644 index 000000000000..209a9ed2a5f3 --- /dev/null +++ b/setup_native/source/win32/customactions/javafilter/exports.dxp @@ -0,0 +1,2 @@ +install_jf +uninstall_jf diff --git a/setup_native/source/win32/customactions/javafilter/jfregca.cxx b/setup_native/source/win32/customactions/javafilter/jfregca.cxx new file mode 100644 index 000000000000..80a8937cbe3a --- /dev/null +++ b/setup_native/source/win32/customactions/javafilter/jfregca.cxx @@ -0,0 +1,330 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ +//#include <stdio.h> + +#ifdef _MSC_VER +#pragma warning(push, 1) /* disable warnings within system headers */ +#endif +#include <windows.h> +#include <msi.h> +#include <msiquery.h> +#ifdef _MSC_VER +#pragma warning(pop) +#endif + +#if defined UNICODE +#define _UNICODE +#endif +#include <tchar.h> + +//Simple function prototypes +bool update_activesync_regvalues(bool, bool, char** ); +void createKeys(HKEY hKey, char **); +void deleteKeys(HKEY hKey, char **); +bool isMulti(MSIHANDLE); + +//Simple data arrays for registry values +TCHAR *pxlData[8]= { + "{C6AB3E74-9F4F-4370-8120-A8A6FABB7A7C}", //CLSID 1 - key name at InstalledFilters Key + "{43887C67-4D5D-4127-BAAC-87A288494C7C}", //CLSID 2 - key value for Default Export + ".pxl", //Registry key for device type - already there if ActiveSync installerd + ".sxc", //New registry key for SO docs + "InstalledFilters", //Sub-key of device/so doc key + "DefaultImport", //Key name added at device/so level key + "DefaultExport", //Key name added at device/so level key + "Binary Copy", //Key value for DefaultImport +}; + +TCHAR *pswData[8] = { + "{BDD611C3-7BAB-460F-8711-5B9AC9EF6020}", //CLSID 1 - key name at InstalledFilters Key + "{CB43F086-838D-4FA4-B5F6-3406B9A57439}", //CLSID 2 - key value for Default Export + ".psw", //Registry key for device type - already there if ActiveSync installe + ".sxw", //New registry key for SO docs + "InstalledFilters", //Sub-key of device/so doc key + "DefaultImport", //Key name added at device/so level key + "DefaultExport", //Key name added at device/so level key + "Binary Copy", //Key value for DefaultImport +}; + + +//index into registry value arrays +#define CLSID1 0 +#define CLSID2 1 +#define DEVICE_PATH 2 +#define SO_PATH 3 +#define IF_PATH 4 +#define DEFIMPORT_KEY 5 +#define DEFEXPORT_KEY 6 +#define BC_VALUE 7 + +//Constants for Registry buffers +const int MAX_KEY_LENGTH=255; +const int MAX_VALUE_NAME=16383; + +BOOL APIENTRY DllMain( HANDLE, + DWORD ul_reason, + LPVOID + ) +{ + switch (ul_reason) + { + case DLL_PROCESS_ATTACH: + case DLL_THREAD_ATTACH: + case DLL_THREAD_DETACH: + case DLL_PROCESS_DETACH: + break; + } + return TRUE; +} + +extern "C" UINT install_jf ( MSIHANDLE hModule ) { + bool bMulti = isMulti(hModule); +#ifdef _JRGREG_DEBUG + MessageBox(NULL, bMulti ? "Multi" : "Single", "Install", MB_OK); +#endif + update_activesync_regvalues(bMulti, true, pxlData); + update_activesync_regvalues(bMulti, true, pswData); + + return ERROR_SUCCESS; +} + +extern "C" UINT uninstall_jf ( MSIHANDLE hModule ) { + bool bMulti = isMulti(hModule); +#ifdef _JRGREG_DEBUG + MessageBox(NULL, bMulti ? "Multi" : "Single", "Uninstall", MB_OK); +#endif + update_activesync_regvalues(false, bMulti, pxlData); + update_activesync_regvalues(false, bMulti, pswData); + + return ERROR_SUCCESS; +} + +/** + Determines if this is being installed on a per user or a machine wide basis + @param hModule + [in] a valid msi handle. + + + @returns + <TRUE/>if this is a multi-user install. +*/ +bool isMulti( MSIHANDLE hModule ) { + TCHAR* szValueBuf = NULL; + DWORD cchValueBuf = 0; + bool bRet = false; + UINT uiStat = MsiGetProperty(hModule, TEXT("ALLUSERS"), TEXT(""), &cchValueBuf); + if (ERROR_MORE_DATA == uiStat) + { + ++cchValueBuf; // on output does not include terminating null, so add 1 + szValueBuf = new TCHAR[cchValueBuf]; + if (szValueBuf) + { + uiStat = MsiGetProperty(hModule, TEXT("ALLUSERS"), szValueBuf, &cchValueBuf); + } + } + if (ERROR_SUCCESS != uiStat) + { + return false; + } + bRet = _tcscmp(szValueBuf, TEXT("1")) == 0; + delete [] szValueBuf; + + return bRet; +} + +/** + Add or remove ActiveSync integration entries from the registry + @param bMultiUser + [in] <TRUE/>if this is a multiuser install (<FALSE/> for single user install) + + @param bInstall + [in] <TRUE/>if installing + + @param data + [in] an array of string containing names of registry keys and values + + + @returns + <TRUE/>if this is a multi-user install. +*/ + +bool update_activesync_regvalues(bool bMultiUser, bool bInstall, char **data) { + bool bReturn = false; + CHAR SUKey[] = "Software\\Microsoft\\Windows CE Services\\Partners"; + CHAR MUKey[] = "Software\\Microsoft\\Windows CE Services\\Filters"; + HKEY hKey; + + if (bMultiUser) { + if (ERROR_SUCCESS != RegOpenKeyEx(HKEY_LOCAL_MACHINE, (LPCSTR)MUKey, 0, KEY_ALL_ACCESS, &hKey)) { + return false; + } + if (bInstall) { + createKeys(hKey, data); + } else { + deleteKeys(hKey, data); + } + bReturn = true; + } else { + if (ERROR_SUCCESS != RegOpenKeyEx(HKEY_CURRENT_USER, (LPCSTR)SUKey, 0, KEY_ALL_ACCESS, &hKey)) { + return false; + } + + CHAR achKey[MAX_KEY_LENGTH]; // buffer for subkey name + DWORD cbName; // size of name string + CHAR achClass[MAX_PATH] = ""; // buffer for class name + DWORD cchClassName = MAX_PATH; // size of class string + DWORD cSubKeys=0; // number of subkeys + DWORD cbMaxSubKey; // longest subkey size + DWORD cchMaxClass; // longest class string + DWORD cValues; // number of values for key + DWORD cchMaxValue; // longest value name + DWORD cbMaxValueData; // longest value data + DWORD cbSecurityDescriptor; // size of security descriptor + FILETIME ftLastWriteTime; // last write time + + // Get the class name and the value count. + if (ERROR_SUCCESS == RegQueryInfoKey( + hKey, // key handle + achClass, // buffer for class name + &cchClassName, // size of class string + NULL, // reserved + &cSubKeys, // number of subkeys + &cbMaxSubKey, // longest subkey size + &cchMaxClass, // longest class string + &cValues, // number of values for this key + &cchMaxValue, // longest value name + &cbMaxValueData, // longest value data + &cbSecurityDescriptor, // security descriptor + &ftLastWriteTime)) { // last write time + + if (cSubKeys) { + for (DWORD i=0; i<cSubKeys; i++) { + cbName = 1024; + if (ERROR_SUCCESS == RegEnumKeyEx(hKey,i,achKey,&cbName,NULL,NULL,NULL,&ftLastWriteTime)) { + HKEY subKey; + if (ERROR_SUCCESS == RegOpenKeyEx(hKey, achKey, 0, KEY_ALL_ACCESS, &subKey)) { + if (ERROR_SUCCESS == RegOpenKeyEx(subKey, "Filters", 0, KEY_ALL_ACCESS, &subKey)) { + if (bInstall) { + createKeys(subKey, data); + } else { + deleteKeys(subKey, data); + } + RegCloseKey(subKey); + } + } + } + } + } + + bReturn = true; + } + } + if (hKey != NULL) { + RegCloseKey(hKey); + } + + return bReturn; +} + +/** + Create Registry Keys + + @param hKey + [in] Handle to the parent registry key + + @param data + [in] an array of string containing names of registry keys and values +*/ + +void createKeys(HKEY hKey, char **data) { + + LPCSTR clsid1 = data[CLSID1]; + LPCSTR clsid2 = data[CLSID2]; + LPCSTR devicePath = data[DEVICE_PATH]; + LPCSTR soPath = data[SO_PATH]; + LPCSTR defImport = data[DEFIMPORT_KEY]; + LPCSTR defExport = data[DEFEXPORT_KEY]; + LPCSTR binaryCopy = data[BC_VALUE]; + LPCSTR IFPath = data[IF_PATH]; + + HKEY deviceKey, deviceIFKey, soKey, soIFKey; + + if (ERROR_SUCCESS == RegOpenKeyEx(hKey,devicePath,0,KEY_ALL_ACCESS, &deviceKey)) { + if (ERROR_SUCCESS == RegOpenKeyEx(deviceKey,IFPath,0,KEY_ALL_ACCESS, &deviceIFKey)) { + RegSetValueEx(deviceIFKey, clsid1, 0, REG_SZ, NULL, NULL); + } + } + + if (ERROR_SUCCESS == RegCreateKeyEx(hKey, soPath, 0, NULL, + REG_OPTION_NON_VOLATILE, KEY_ALL_ACCESS, NULL, &soKey, NULL)) { + RegSetValueEx(soKey, defExport, 0, REG_SZ, (LPBYTE)binaryCopy, strlen(binaryCopy)); + RegSetValueEx(soKey, defImport, 0, REG_SZ, (LPBYTE)clsid2, strlen(clsid2)); + + + if (ERROR_SUCCESS == RegCreateKeyEx(soKey, IFPath, 0, NULL, + REG_OPTION_NON_VOLATILE, KEY_ALL_ACCESS, NULL, &soIFKey, NULL)) { + RegSetValueEx(soIFKey, clsid2, 0, REG_SZ, NULL, NULL); + } + } +} + +/** + Delete registry keys + + @param hKey + [in] Handle to the parent registry key +*/ +void deleteKeys(HKEY hKey, TCHAR **data) { + LPCSTR clsid1 = data[CLSID1]; + LPCSTR clsid2 = data[CLSID2]; + LPCSTR devicePath = data[DEVICE_PATH]; + LPCSTR soPath = data[SO_PATH]; + LPCSTR defImport = data[DEFIMPORT_KEY]; + LPCSTR defExport = data[DEFEXPORT_KEY]; + LPCSTR IFPath = data[IF_PATH]; + + HKEY deviceKey, deviceIFKey, soKey, soIFKey; + + if (ERROR_SUCCESS == RegOpenKeyEx(hKey,devicePath,0,KEY_ALL_ACCESS, &deviceKey)) { + if (ERROR_SUCCESS == RegOpenKeyEx(deviceKey,IFPath,0,KEY_ALL_ACCESS, &deviceIFKey)) { + RegDeleteValue(deviceIFKey, clsid1); + } + } + + if (ERROR_SUCCESS == RegOpenKeyEx(hKey, soPath, 0, KEY_ALL_ACCESS, &soKey)) { + RegDeleteValue(soKey, defExport); + RegDeleteValue(soKey, defImport); + + if (ERROR_SUCCESS == RegOpenKeyEx(soKey, IFPath, 0, KEY_ALL_ACCESS, &soIFKey)) { + RegDeleteValue(soIFKey, clsid2); + RegCloseKey(soIFKey); + RegDeleteKey(soKey, IFPath); + } + RegCloseKey(soKey); + RegDeleteKey(hKey, soPath); + } +} diff --git a/setup_native/source/win32/customactions/javafilter/makefile.mk b/setup_native/source/win32/customactions/javafilter/makefile.mk new file mode 100644 index 000000000000..3ee19cff53b4 --- /dev/null +++ b/setup_native/source/win32/customactions/javafilter/makefile.mk @@ -0,0 +1,70 @@ +#************************************************************************* +# +# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. +# +# Copyright 2000, 2010 Oracle and/or its affiliates. +# +# OpenOffice.org - a multi-platform office productivity suite +# +# This file is part of OpenOffice.org. +# +# OpenOffice.org is free software: you can redistribute it and/or modify +# it under the terms of the GNU Lesser General Public License version 3 +# only, as published by the Free Software Foundation. +# +# OpenOffice.org is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU Lesser General Public License version 3 for more details +# (a copy is included in the LICENSE file that accompanied this code). +# +# You should have received a copy of the GNU Lesser General Public License +# version 3 along with OpenOffice.org. If not, see +# <http://www.openoffice.org/license.html> +# for a copy of the LGPLv3 License. +# +#************************************************************************* + +PRJ=..$/..$/..$/.. +PRJNAME=setup_native +TARGET=jfregca + + +# --- Settings ----------------------------------------------------- + +NO_DEFAULT_STL=TRUE +ENABLE_EXCEPTIONS=TRUE +DYNAMIC_CRT= + +.INCLUDE : settings.mk + +# --- Files -------------------------------------------------------- + +.IF "$(GUI)"=="WNT" + +UWINAPILIB= + +SLOFILES = $(SLO)$/jfregca.obj + +STDSHL += \ + $(ADVAPI32LIB)\ + $(MSILIB) + +SHL1LIBS = $(SLB)$/$(TARGET).lib + +SHL1TARGET = $(TARGET) +SHL1IMPLIB = i$(TARGET) + +SHL1DEF = $(MISC)$/$(SHL1TARGET).def +SHL1DEPN = $(SLB)$/$(TARGET).lib +SHL1BASE = 0x1c000000 +DEF1NAME=$(SHL1TARGET) +DEF1EXPORTFILE=exports.dxp + +.ENDIF +# --- Targets -------------------------------------------------------------- + +.INCLUDE : target.mk + +# ------------------------------------------------------------------------- + diff --git a/setup_native/source/win32/customactions/languagepacks/checkrunningofficelanguagepack.cxx b/setup_native/source/win32/customactions/languagepacks/checkrunningofficelanguagepack.cxx new file mode 100755 index 000000000000..86cba0908bbb --- /dev/null +++ b/setup_native/source/win32/customactions/languagepacks/checkrunningofficelanguagepack.cxx @@ -0,0 +1,218 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#define _WIN32_WINDOWS 0x0410 + +#ifdef _MSC_VER +#pragma warning(push, 1) /* disable warnings within system headers */ +#endif +#define WIN32_LEAN_AND_MEAN +#include <windows.h> +#include <msiquery.h> +#ifdef _MSC_VER +#pragma warning(pop) +#endif + +#include <malloc.h> +#include <assert.h> + +#ifdef UNICODE +#define _UNICODE +#define _tstring wstring +#else +#define _tstring string +#endif +#include <tchar.h> +#include <string> +#include <queue> +#include <stdio.h> + +#include <systools/win32/uwinapi.h> +#include <../tools/seterror.hxx> + +#define WININIT_FILENAME "wininit.ini" +#define RENAME_SECTION "rename" + +#ifdef DEBUG +inline void OutputDebugStringFormat( LPCTSTR pFormat, ... ) +{ + _TCHAR buffer[1024]; + va_list args; + + va_start( args, pFormat ); + _vsntprintf( buffer, elementsof(buffer), pFormat, args ); + OutputDebugString( buffer ); +} +#else +static inline void OutputDebugStringFormat( LPCTSTR, ... ) +{ +} +#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 inline bool IsSetMsiProperty(MSIHANDLE handle, const std::_tstring& sProperty) +{ + std::_tstring value = GetMsiProperty(handle, sProperty); + return (value.length() > 0); +} + +static inline void UnsetMsiProperty(MSIHANDLE handle, const std::_tstring& sProperty) +{ + MsiSetProperty(handle, sProperty.c_str(), NULL); +} + +static inline void SetMsiProperty(MSIHANDLE handle, const std::_tstring& sProperty) +{ + MsiSetProperty(handle, sProperty.c_str(), TEXT("1")); +} + +static BOOL MoveFileEx9x( LPCSTR lpExistingFileNameA, LPCSTR lpNewFileNameA, DWORD dwFlags ) +{ + BOOL fSuccess = FALSE; // assume failure + + // Windows 9x has a special mechanism to move files after reboot + + if ( dwFlags & MOVEFILE_DELAY_UNTIL_REBOOT ) + { + CHAR szExistingFileNameA[MAX_PATH]; + CHAR szNewFileNameA[MAX_PATH] = "NUL"; + + // Path names in WININIT.INI must be in short path name form + + if ( + GetShortPathNameA( lpExistingFileNameA, szExistingFileNameA, MAX_PATH ) && + (!lpNewFileNameA || GetShortPathNameA( lpNewFileNameA, szNewFileNameA, MAX_PATH )) + ) + { + CHAR szBuffer[32767]; // The buffer size must not exceed 32K + DWORD dwBufLen = GetPrivateProfileSectionA( RENAME_SECTION, szBuffer, elementsof(szBuffer), WININIT_FILENAME ); + + CHAR szRename[MAX_PATH]; // This is enough for at most to times 67 chracters + strcpy( szRename, szNewFileNameA ); + strcat( szRename, "=" ); + strcat( szRename, szExistingFileNameA ); + size_t lnRename = strlen(szRename); + + if ( dwBufLen + lnRename + 2 <= elementsof(szBuffer) ) + { + CopyMemory( &szBuffer[dwBufLen], szRename, lnRename ); + szBuffer[dwBufLen + lnRename ] = 0; + szBuffer[dwBufLen + lnRename + 1 ] = 0; + + fSuccess = WritePrivateProfileSectionA( RENAME_SECTION, szBuffer, WININIT_FILENAME ); + } + else + SetLastError( ERROR_BUFFER_OVERFLOW ); + } + } + else + { + + fSuccess = MoveFileA( lpExistingFileNameA, lpNewFileNameA ); + + if ( !fSuccess && GetLastError() != ERROR_ACCESS_DENIED && + 0 != (dwFlags & (MOVEFILE_COPY_ALLOWED | MOVEFILE_REPLACE_EXISTING)) ) + { + BOOL bFailIfExist = 0 == (dwFlags & MOVEFILE_REPLACE_EXISTING); + + fSuccess = CopyFileA( lpExistingFileNameA, lpNewFileNameA, bFailIfExist ); + + if ( fSuccess ) + fSuccess = DeleteFileA( lpExistingFileNameA ); + } + + } + + return fSuccess; +} + +static BOOL MoveFileExImpl( LPCSTR lpExistingFileNameA, LPCSTR lpNewFileNameA, DWORD dwFlags ) +{ + if ( 0 > ((LONG)GetVersion())) // High order bit indicates Win 9x + return MoveFileEx9x( lpExistingFileNameA, lpNewFileNameA, dwFlags ); + else + return MoveFileExA( lpExistingFileNameA, lpNewFileNameA, dwFlags ); +} + +extern "C" UINT __stdcall IsOfficeRunning( MSIHANDLE handle ) +{ + std::_tstring sInstDir = GetMsiProperty( handle, TEXT("BASISINSTALLLOCATION") ); + std::_tstring sResourceDir = sInstDir + TEXT("program\\resource\\"); + std::_tstring sPattern = sResourceDir + TEXT("vcl*.res"); + + WIN32_FIND_DATA aFindFileData; + HANDLE hFind = FindFirstFile( sPattern.c_str(), &aFindFileData ); + + if ( IsValidHandle(hFind) ) + { + BOOL fSuccess = false; + bool fRenameSucceeded; + + do + { + std::_tstring sResourceFile = sResourceDir + aFindFileData.cFileName; + std::_tstring sIntermediate = sResourceFile + TEXT(".tmp"); + + fRenameSucceeded = MoveFileExImpl( sResourceFile.c_str(), sIntermediate.c_str(), MOVEFILE_REPLACE_EXISTING ); + if ( fRenameSucceeded ) + { + MoveFileExImpl( sIntermediate.c_str(), sResourceFile.c_str(), 0 ); + fSuccess = FindNextFile( hFind, &aFindFileData ); + } + } while ( fSuccess && fRenameSucceeded ); + + if ( !fRenameSucceeded ) + { + MsiSetProperty(handle, TEXT("OFFICERUNS"), TEXT("1")); + SetMsiErrorCode( MSI_ERROR_OFFICE_IS_RUNNING ); + } + + FindClose( hFind ); + } + + return ERROR_SUCCESS; +} + + + diff --git a/setup_native/source/win32/customactions/languagepacks/exports.dxp b/setup_native/source/win32/customactions/languagepacks/exports.dxp new file mode 100644 index 000000000000..7461090d7233 --- /dev/null +++ b/setup_native/source/win32/customactions/languagepacks/exports.dxp @@ -0,0 +1,7 @@ +SetProductInstallationPath +RegisterLanguagePack +GetUserInstallMode +IsOfficeRunning +RegisterExtensions +DeregisterExtensions +RemoveExtensions diff --git a/setup_native/source/win32/customactions/languagepacks/lngpckinsthelper.cxx b/setup_native/source/win32/customactions/languagepacks/lngpckinsthelper.cxx new file mode 100644 index 000000000000..d3a6c81b59ed --- /dev/null +++ b/setup_native/source/win32/customactions/languagepacks/lngpckinsthelper.cxx @@ -0,0 +1,204 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#ifdef _MSC_VER +#pragma warning(push, 1) /* disable warnings within system headers */ +#endif +#define WIN32_LEAN_AND_MEAN +#include <windows.h> +#include <msiquery.h> +#ifdef _MSC_VER +#pragma warning(pop) +#endif + +#include <malloc.h> +#include <tchar.h> +#include <string> +#include <stdexcept> +#include <vector> + +class RegistryKeyGuard +{ +public: + RegistryKeyGuard(HKEY hkey = 0) : + hkey_(hkey) + { + } + + ~RegistryKeyGuard() + { + if (hkey_) + RegCloseKey(hkey_); + } +private: + HKEY hkey_; + +private: + RegistryKeyGuard(const RegistryKeyGuard&); + RegistryKeyGuard& operator=(const RegistryKeyGuard&); +}; + +typedef std::vector<TCHAR> CharacterBuffer_t; + +/* throws std::runtime_error when the value "Path" could + not be found or contains an empty string or is not of + type REG_SZ. All such conditions are invalid for a + properly installed product. */ +std::string FindProductInstallationPath(HKEY hkey) +{ + DWORD nSubKeys; + DWORD lLongestSubKey; + + if (RegQueryInfoKey(hkey, NULL, NULL, NULL, &nSubKeys, &lLongestSubKey, NULL, NULL, NULL, NULL, NULL, NULL) != + ERROR_SUCCESS) + throw std::runtime_error("Cannot query info for registery key"); + + CharacterBuffer_t buff(lLongestSubKey + 1); + + for (DWORD i = 0; i < nSubKeys; i++) + { + buff[0] = 0; + LONG ret = RegEnumKey(hkey, i, &buff[0], buff.size()); + + if ((ret != ERROR_SUCCESS) && (ret != ERROR_MORE_DATA)) + throw std::runtime_error("Error enumerating registry key"); + + HKEY hSubKey; + if (RegOpenKey(hkey, &buff[0], &hSubKey) != ERROR_SUCCESS) + continue; + + RegistryKeyGuard guard(hSubKey); + + DWORD type; + TCHAR pbuff[MAX_PATH]; + DWORD size = sizeof(pbuff); + if ((RegQueryValueEx( + hSubKey, TEXT("Path"), NULL, &type, reinterpret_cast<LPBYTE>(pbuff), &size) != ERROR_SUCCESS) || + (type != REG_SZ)) + continue; + + std::string path(pbuff); + std::string::size_type idx = path.rfind("program\\soffice.exe"); + if (idx != std::string::npos) + return path.substr(0, idx); + } // for + + throw std::runtime_error("No valid product path found"); +} + +UINT GetInstallProperty(MSIHANDLE handle, LPCTSTR name, CharacterBuffer_t* buffer) +{ + DWORD size = buffer->size(); + UINT ret = MsiGetProperty(handle, name, &(*buffer)[0], &size); + + if (ret == ERROR_MORE_DATA) + { + buffer->resize(size + 1); + size = buffer->size(); + ret = MsiGetProperty(handle, name, &(*buffer)[0], &size); + } + return ret; +} + +/* + Try to find the installation path to an already installed product. + The installation path will be written in the Windows registry + during the installation. There may exist different products in + parallel e.g. StarOffice, StarSuite, OpenOffice.org. It will be + searched in this order for an installed product. If a product + will be found the path to the product will be set in the property + "INSTALLLOCATION" else nothing will be done. +*/ +extern "C" UINT __stdcall SetProductInstallationPath(MSIHANDLE handle) +{ + //MessageBox(NULL, TEXT("SetProductInstallationPath"), TEXT("Language Pack Installation Helper"), MB_OK | MB_ICONINFORMATION); + + try + { + CharacterBuffer_t regKeyProdPath(MAX_PATH); + + GetInstallProperty(handle, TEXT("REGKEYPRODPATH"), ®KeyProdPath); + + HKEY hKey; + if ((RegOpenKey(HKEY_CURRENT_USER, ®KeyProdPath[0], &hKey) == ERROR_SUCCESS) || + (RegOpenKey(HKEY_LOCAL_MACHINE, ®KeyProdPath[0], &hKey) == ERROR_SUCCESS)) + { + RegistryKeyGuard guard(hKey); + std::string path = FindProductInstallationPath(hKey); + MsiSetProperty(handle, TEXT("INSTALLLOCATION"), path.c_str()); + } + } + catch(std::runtime_error& ex) + { + ex = ex; // no warnings + } + return ERROR_SUCCESS; +} + +void MakeCfgimportCommandLine(CharacterBuffer_t* productPath) +{ + char* p = &(*productPath)[0] + lstrlen(&(*productPath)[0]) - 1; + + if (*p != '\\') + lstrcat(&(*productPath)[0], "\\program\\configimport.exe --spool"); + else + lstrcat(&(*productPath)[0], "program\\configimport.exe --spool"); +} + +/* + Calls configimport.exe --spool +*/ +extern "C" UINT __stdcall RegisterLanguagePack(MSIHANDLE handle) +{ + //MessageBox(NULL, TEXT("RegisterLanguagePack"), TEXT("Language Pack Installation Helper"), MB_OK | MB_ICONINFORMATION); + + CharacterBuffer_t productPath(MAX_PATH); + GetInstallProperty(handle, TEXT("INSTALLLOCATION"), &productPath); + MakeCfgimportCommandLine(&productPath); + + STARTUPINFO si; + ZeroMemory(&si, sizeof(si)); + si.cb = sizeof(si); + + PROCESS_INFORMATION pi; + ZeroMemory(&pi, sizeof(pi)); + + if (CreateProcess( + NULL, &productPath[0], NULL, NULL, + FALSE, CREATE_NO_WINDOW | NORMAL_PRIORITY_CLASS, NULL, + NULL, &si, &pi)) + { + // Wait until child process exits. + WaitForSingleObject(pi.hProcess, INFINITE); + + // Close process and thread handles. + CloseHandle(pi.hProcess); + CloseHandle(pi.hThread); + } + return ERROR_SUCCESS; +} + diff --git a/setup_native/source/win32/customactions/languagepacks/makefile.mk b/setup_native/source/win32/customactions/languagepacks/makefile.mk new file mode 100644 index 000000000000..8da47ab1cc4f --- /dev/null +++ b/setup_native/source/win32/customactions/languagepacks/makefile.mk @@ -0,0 +1,100 @@ +#************************************************************************* +# +# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. +# +# Copyright 2000, 2010 Oracle and/or its affiliates. +# +# OpenOffice.org - a multi-platform office productivity suite +# +# This file is part of OpenOffice.org. +# +# OpenOffice.org is free software: you can redistribute it and/or modify +# it under the terms of the GNU Lesser General Public License version 3 +# only, as published by the Free Software Foundation. +# +# OpenOffice.org is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU Lesser General Public License version 3 for more details +# (a copy is included in the LICENSE file that accompanied this code). +# +# You should have received a copy of the GNU Lesser General Public License +# version 3 along with OpenOffice.org. If not, see +# <http://www.openoffice.org/license.html> +# for a copy of the LGPLv3 License. +# +#************************************************************************* + +PRJ=..$/..$/..$/.. +PRJNAME=setup_native +TARGET=lngpckinsthlp + + +# --- Settings ----------------------------------------------------- + +ENABLE_EXCEPTIONS=TRUE +NO_DEFAULT_STL=TRUE +DYNAMIC_CRT= +USE_DEFFILE=TRUE + +.INCLUDE : settings.mk + +.IF "$(USE_SYSTEM_STL)" != "YES" +CFLAGS+=-D_STLP_USE_STATIC_LIB +.ENDIF + +#Disable precompiled header +CDEFS+=-Dnot_used_define_to_disable_pch + +# --- Files -------------------------------------------------------- + +.IF "$(GUI)"=="WNT" + +UWINAPILIB= + +SLOFILES = $(SLO)$/lngpckinsthelper.obj \ + $(SLO)$/respintest.obj \ + $(SLO)$/checkrunningofficelanguagepack.obj + +STDSHL+= \ + $(ADVAPI32LIB) \ + $(MSILIB) \ + $(SHELL32LIB) + +.IF "$(USE_SYSTEM_STL)" != "YES" +STDSHL+=$(LIBSTLPORTST) +.ENDIF + +SHL1OBJS = $(SLOFILES) \ + $(SLO)$/seterror.obj + +.IF "$(COM)"=="GCC" +STDSHL+= \ + $(KERNEL32LIB)\ + -lmsvcrt +.ENDIF + +#SHL1LIBS = $(SLB)$/$(TARGET).lib + +SHL1OBJS = $(SLOFILES) \ + $(SLO)$/registerextensions.obj \ + $(SLO)$/seterror.obj + +SHL1TARGET = $(TARGET) +SHL1IMPLIB = i$(TARGET) + +SHL1DEF = $(MISC)$/$(SHL1TARGET).def +SHL1DEPN = $(SLB)$/$(TARGET).lib +SHL1BASE = 0x1c000000 +DEF1NAME=$(SHL1TARGET) +DEF1EXPORTFILE=exports.dxp + +.ENDIF + +# --- Targets -------------------------------------------------------------- + +.INCLUDE : target.mk + +# ------------------------------------------------------------------------- + + diff --git a/setup_native/source/win32/customactions/languagepacks/respintest.cxx b/setup_native/source/win32/customactions/languagepacks/respintest.cxx new file mode 100644 index 000000000000..bdfb97dfb3e1 --- /dev/null +++ b/setup_native/source/win32/customactions/languagepacks/respintest.cxx @@ -0,0 +1,211 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#undef UNICODE +#undef _UNICODE + +#define _WIN32_WINDOWS 0x0410 + +#ifdef _MSC_VER +#pragma warning(push, 1) /* disable warnings within system headers */ +#endif +#define WIN32_LEAN_AND_MEAN +#include <windows.h> +#include <msiquery.h> +#ifdef _MSC_VER +#pragma warning(pop) +#endif + +#include <malloc.h> +#include <assert.h> + +#include <tchar.h> +#include <string> +#include <systools/win32/uwinapi.h> + +#include <../tools/seterror.hxx> + +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("OFFICEINSTALLLOCATION")); + + // 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") ); + + // 1. Searching for "ProductCode" in setup.ini + + string sSetupiniPath = sOfficeInstallPath + TEXT("program\\setup.ini"); + + TCHAR szValue[32767]; + + GetPrivateProfileString( + TEXT("Bootstrap"), + TEXT("ProductCode"), + TEXT("INVALIDDIRECTORY"), + szValue, + elementsof(szValue), + sSetupiniPath.c_str() + ); + + 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") ); + // MessageBox(NULL, "INVALIDDIRECTORY set, no setup.ini or ProductCode in setup.ini.", "DEBUG", MB_OK); + SetMsiErrorCode( MSI_ERROR_INVALIDDIRECTORY ); + return ERROR_SUCCESS; + } + + // 2. Comparing first three characters of "PRODUCTMAJOR" from property table and "buildid" from InfoFile + + szValue[0] = '\0'; + + GetPrivateProfileString( + TEXT("Bootstrap"), + TEXT("buildid"), + TEXT("ISWRONGPRODUCT"), + szValue, + elementsof(szValue), + sSetupiniPath.c_str() + ); + + if ( !_tcsicmp( szValue, TEXT("ISWRONGPRODUCT") ) ) + { + 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 = 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)) + { + SetMsiProperty( handle, TEXT("ISWRONGPRODUCT"), TEXT("YES") ); + // MessageBox(NULL, "ISWRONGPRODUCT 2 set after searching PRODUCTMAJOR", "DEBUG", MB_OK); + SetMsiErrorCode( MSI_ERROR_ISWRONGPRODUCT ); + return ERROR_SUCCESS; + } + + // 3. Only for patch: Comparing "PRODUCTMINOR from property table and "ProductMinor" from InfoFile + + string isPatch = GetMsiProperty(handle, TEXT("ISPATCH")); + + if (isPatch=="1") + { + string ProductMinor = GetMsiProperty(handle, TEXT("PRODUCTBUILDID")); + int PatchProductMinor = atoi(ProductMinor.c_str()); + + szValue[0] = '\0'; + + GetPrivateProfileString( + TEXT("Bootstrap"), + TEXT("ProductBuildid"), + TEXT("8918"), + szValue, + elementsof(szValue), + sSetupiniPath.c_str() + ); + + int InstalledProductMinor = atoi(szValue); + + if ( InstalledProductMinor >= PatchProductMinor ) + { + SetMsiProperty( handle, TEXT("PATCHISOLDER"), TEXT("YES") ); + // MessageBox(NULL, "PATCHISOLDER set", "DEBUG", MB_OK); + SetMsiErrorCode( MSI_ERROR_PATCHISOLDER ); + return ERROR_SUCCESS; + } + } + + // 4. Setting property ALLUSERS with value from "setup.ini" + + szValue[0] = '\0'; + + GetPrivateProfileString( + TEXT("Bootstrap"), + TEXT("ALLUSERS"), + TEXT(""), + szValue, + elementsof(szValue), + sSetupiniPath.c_str() + ); + + if ( szValue[0] ) + { + SetMsiProperty( handle, TEXT("ALLUSERS"), szValue ); + // MessageBox(NULL, "ALLUSERS set", "DEBUG", MB_OK); + } + + return ERROR_SUCCESS; +} diff --git a/setup_native/source/win32/customactions/patch/exports.dxp b/setup_native/source/win32/customactions/patch/exports.dxp new file mode 100755 index 000000000000..b5f7bfcd099a --- /dev/null +++ b/setup_native/source/win32/customactions/patch/exports.dxp @@ -0,0 +1,12 @@ +InstallPatchedFiles +UninstallPatchedFiles +GetUserInstallMode +SetProductInstallMode +ShutDownQuickstarter +IsOfficeRunning +SetFeatureState +SetNewFeatureState +ShowOnlineUpdateDialog +RegisterExtensions +DeregisterExtensions +RemoveExtensions diff --git a/setup_native/source/win32/customactions/patch/makefile.mk b/setup_native/source/win32/customactions/patch/makefile.mk new file mode 100755 index 000000000000..6af0ddf9ab2a --- /dev/null +++ b/setup_native/source/win32/customactions/patch/makefile.mk @@ -0,0 +1,98 @@ +#************************************************************************* +# +# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. +# +# Copyright 2000, 2010 Oracle and/or its affiliates. +# +# OpenOffice.org - a multi-platform office productivity suite +# +# This file is part of OpenOffice.org. +# +# OpenOffice.org is free software: you can redistribute it and/or modify +# it under the terms of the GNU Lesser General Public License version 3 +# only, as published by the Free Software Foundation. +# +# OpenOffice.org is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU Lesser General Public License version 3 for more details +# (a copy is included in the LICENSE file that accompanied this code). +# +# You should have received a copy of the GNU Lesser General Public License +# version 3 along with OpenOffice.org. If not, see +# <http://www.openoffice.org/license.html> +# for a copy of the LGPLv3 License. +# +#************************************************************************* + +PRJ=..$/..$/..$/.. +PRJNAME=setup_native +TARGET=patchmsi + +# --- Settings ----------------------------------------------------- + +ENABLE_EXCEPTIONS=TRUE +NO_DEFAULT_STL=TRUE +DYNAMIC_CRT= +USE_DEFFILE=TRUE + +.INCLUDE : settings.mk + +.IF "$(USE_SYSTEM_STL)" != "YES" +CFLAGS+=-D_STLP_USE_STATIC_LIB +.ENDIF + +#Disable precompiled header +CDEFS+=-Dnot_used_define_to_disable_pch + +# --- Files -------------------------------------------------------- + +.IF "$(GUI)"=="WNT" + +UWINAPILIB= + +SLOFILES = \ + $(SLO)$/swappatchfiles.obj + +STDSHL += \ + $(ADVAPI32LIB)\ + $(MSILIB)\ + $(SHELL32LIB) + +.IF "$(USE_SYSTEM_STL)" != "YES" +STDSHL += $(LIBSTLPORTST) +.ENDIF + +.IF "$(COM)"=="GCC" +STDSHL+= \ + $(KERNEL32LIB)\ + -lmsvcrt +.ENDIF + +#SHL1LIBS = $(SLB)$/$(TARGET).lib + +SHL1OBJS = $(SLOFILES) \ + $(SLO)$/respintest.obj \ + $(SLO)$/shutdown_quickstart.obj \ + $(SLO)$/quickstarter.obj \ + $(SLO)$/upgrade.obj \ + $(SLO)$/registerextensions.obj \ + $(SLO)$/seterror.obj + +SHL1TARGET = $(TARGET) +SHL1IMPLIB = i$(TARGET) + +SHL1DEF = $(MISC)$/$(SHL1TARGET).def +SHL1DEPN = $(SLB)$/$(TARGET).lib +SHL1BASE = 0x1c000000 +DEF1NAME=$(SHL1TARGET) +DEF1EXPORTFILE=exports.dxp + +.ENDIF + +# --- Targets -------------------------------------------------------------- + +.INCLUDE : target.mk + +# ------------------------------------------------------------------------- + diff --git a/setup_native/source/win32/customactions/patch/swappatchfiles.cxx b/setup_native/source/win32/customactions/patch/swappatchfiles.cxx new file mode 100755 index 000000000000..d6f0933077fc --- /dev/null +++ b/setup_native/source/win32/customactions/patch/swappatchfiles.cxx @@ -0,0 +1,908 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#define _WIN32_WINDOWS 0x0410 + +#ifdef _MSC_VER +#pragma warning(push, 1) /* disable warnings within system headers */ +#endif +#define WIN32_LEAN_AND_MEAN +#include <windows.h> +#include <msiquery.h> +#ifdef _MSC_VER +#pragma warning(pop) +#endif + +#include <malloc.h> +#include <assert.h> + +#ifdef UNICODE +#define _UNICODE +#define _tstring wstring +#else +#define _tstring string +#endif +#include <tchar.h> +#include <string> +#include <queue> +#include <stdio.h> + +#include <systools/win32/uwinapi.h> +#include <../tools/seterror.hxx> + +#define WININIT_FILENAME "wininit.ini" +#define RENAME_SECTION "rename" + +#ifdef DEBUG +inline void OutputDebugStringFormat( LPCTSTR pFormat, ... ) +{ + _TCHAR buffer[1024]; + va_list args; + + va_start( args, pFormat ); + _vsntprintf( buffer, elementsof(buffer), pFormat, args ); + OutputDebugString( buffer ); +} +#else +static inline void OutputDebugStringFormat( LPCTSTR, ... ) +{ +} +#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; +} + +// The provided GUID must be without surounding '{}' +static std::_tstring GetGuidPart(const std::_tstring& guid, int index) +{ + assert((guid.length() == 36) && "No GUID or wrong format!"); + assert(((index > -1) && (index < 5)) && "Out of range!"); + + if (index == 0) return std::_tstring(guid.c_str(), 8); + if (index == 1) return std::_tstring(guid.c_str() + 9, 4); + if (index == 2) return std::_tstring(guid.c_str() + 14, 4); + if (index == 3) return std::_tstring(guid.c_str() + 19, 4); + if (index == 4) return std::_tstring(guid.c_str() + 24, 12); + + return std::_tstring(); +} + +static void Swap(char* p1, char* p2) +{ + char tmp = *p1; + *p1 = *p2; + *p2 = tmp; +} + +static std::_tstring Invert(const std::_tstring& str) +{ + char* buff = reinterpret_cast<char*>(_alloca(str.length())); + strncpy(buff, str.c_str(), str.length()); + + char* front = buff; + char* back = buff + str.length() - 1; + + while (front < back) + Swap(front++, back--); + + return std::_tstring(buff, str.length()); +} + +// Convert the upgrade code (which is a GUID) according +// to the way the windows installer does when writing it +// to the registry +// The first 8 bytes will be inverted, from the the last +// 8 bytes always the nibbles will be inverted for further +// details look in the MSDN under compressed registry keys +static std::_tstring ConvertGuid(const std::_tstring& guid) +{ + std::_tstring convertedGuid; + + std::_tstring part = GetGuidPart(guid, 0); + convertedGuid = Invert(part); + + part = GetGuidPart(guid, 1); + convertedGuid += Invert(part); + + part = GetGuidPart(guid, 2); + convertedGuid += Invert(part); + + part = GetGuidPart(guid, 3); + convertedGuid += Invert(std::_tstring(part.c_str(), 2)); + convertedGuid += Invert(std::_tstring(part.c_str() + 2, 2)); + + part = GetGuidPart(guid, 4); + int pos = 0; + for (int i = 0; i < 6; i++) + { + convertedGuid += Invert(std::_tstring(part.c_str() + pos, 2)); + pos += 2; + } + return convertedGuid; +} + +static inline bool IsSetMsiProperty(MSIHANDLE handle, const std::_tstring& sProperty) +{ + std::_tstring value = GetMsiProperty(handle, sProperty); + return (value.length() > 0); +} + +static inline void UnsetMsiProperty(MSIHANDLE handle, const std::_tstring& sProperty) +{ + MsiSetProperty(handle, sProperty.c_str(), NULL); +} + +static inline void SetMsiProperty(MSIHANDLE handle, const std::_tstring& sProperty) +{ + MsiSetProperty(handle, sProperty.c_str(), TEXT("1")); +} + +static BOOL MoveFileEx9x( LPCSTR lpExistingFileNameA, LPCSTR lpNewFileNameA, DWORD dwFlags ) +{ + BOOL fSuccess = FALSE; // assume failure + + // Windows 9x has a special mechanism to move files after reboot + + if ( dwFlags & MOVEFILE_DELAY_UNTIL_REBOOT ) + { + CHAR szExistingFileNameA[MAX_PATH]; + CHAR szNewFileNameA[MAX_PATH] = "NUL"; + + // Path names in WININIT.INI must be in short path name form + + if ( + GetShortPathNameA( lpExistingFileNameA, szExistingFileNameA, MAX_PATH ) && + (!lpNewFileNameA || GetShortPathNameA( lpNewFileNameA, szNewFileNameA, MAX_PATH )) + ) + { + CHAR szBuffer[32767]; // The buffer size must not exceed 32K + DWORD dwBufLen = GetPrivateProfileSectionA( RENAME_SECTION, szBuffer, elementsof(szBuffer), WININIT_FILENAME ); + + CHAR szRename[MAX_PATH]; // This is enough for at most to times 67 chracters + strcpy( szRename, szNewFileNameA ); + strcat( szRename, "=" ); + strcat( szRename, szExistingFileNameA ); + size_t lnRename = strlen(szRename); + + if ( dwBufLen + lnRename + 2 <= elementsof(szBuffer) ) + { + CopyMemory( &szBuffer[dwBufLen], szRename, lnRename ); + szBuffer[dwBufLen + lnRename ] = 0; + szBuffer[dwBufLen + lnRename + 1 ] = 0; + + fSuccess = WritePrivateProfileSectionA( RENAME_SECTION, szBuffer, WININIT_FILENAME ); + } + else + SetLastError( ERROR_BUFFER_OVERFLOW ); + } + } + else + { + + fSuccess = MoveFileA( lpExistingFileNameA, lpNewFileNameA ); + + if ( !fSuccess && GetLastError() != ERROR_ACCESS_DENIED && + 0 != (dwFlags & (MOVEFILE_COPY_ALLOWED | MOVEFILE_REPLACE_EXISTING)) ) + { + BOOL bFailIfExist = 0 == (dwFlags & MOVEFILE_REPLACE_EXISTING); + + fSuccess = CopyFileA( lpExistingFileNameA, lpNewFileNameA, bFailIfExist ); + + if ( fSuccess ) + fSuccess = DeleteFileA( lpExistingFileNameA ); + } + + } + + return fSuccess; +} + +static BOOL MoveFileExImpl( LPCSTR lpExistingFileNameA, LPCSTR lpNewFileNameA, DWORD dwFlags ) +{ + if ( 0 > ((LONG)GetVersion())) // High order bit indicates Win 9x + return MoveFileEx9x( lpExistingFileNameA, lpNewFileNameA, dwFlags ); + else + return MoveFileExA( lpExistingFileNameA, lpNewFileNameA, dwFlags ); +} + +static bool SwapFiles( const std::_tstring& sFileName1, const std::_tstring& sFileName2 ) +{ + std::_tstring sTempFileName = sFileName1 + TEXT(".tmp"); + + bool fSuccess = true; + + //Try to move the original file to a temp file + fSuccess = MoveFileExImpl( sFileName1.c_str(), sTempFileName.c_str(), MOVEFILE_REPLACE_EXISTING); + + std::_tstring mystr; + + if ( fSuccess ) + { + fSuccess = MoveFileExImpl( sFileName2.c_str(), sFileName1.c_str(), MOVEFILE_REPLACE_EXISTING ); + + if ( fSuccess ) + { + fSuccess = MoveFileExImpl( sTempFileName.c_str(), sFileName2.c_str(), + MOVEFILE_REPLACE_EXISTING ); + if ( !fSuccess ) + { + MoveFileExImpl( sFileName1.c_str(), sFileName2.c_str(), MOVEFILE_REPLACE_EXISTING ); + } + } + else + { + MoveFileExImpl( sTempFileName.c_str(), sFileName1.c_str(), MOVEFILE_REPLACE_EXISTING ); + } + } + else + { + //It could be that there is no original file and therefore copying the original to a temp + // file failed. Examine if there is no original and if so then move file2 to file1 + + WIN32_FIND_DATA data; + HANDLE hdl = FindFirstFile(sFileName1.c_str(), &data); + if (hdl == INVALID_HANDLE_VALUE) + { + fSuccess = MoveFileExImpl( sFileName2.c_str(), sFileName1.c_str(), MOVEFILE_REPLACE_EXISTING ); + + // if ( fSuccess ) + // { + // mystr = "Success"; + // MessageBox( NULL, mystr.c_str(), "Titel", MB_OK ); + // } + // else + // { + // char buff[256]; + // wsprintf(buff, "Failure %d", GetLastError()); + // MessageBox( NULL, buff, "Titel", MB_OK ); + // } + } + else + { + FindClose(hdl); + } + } + + OutputDebugStringFormat( TEXT("%s <-> %s: %s"), sFileName1.c_str(), sFileName2.c_str(), fSuccess ? TEXT("OK") : TEXT("FAILED") ); + + if (!fSuccess ) + { + DWORD dwError = GetLastError(); + LPVOID lpMsgBuf; + if ( FormatMessage( + FORMAT_MESSAGE_ALLOCATE_BUFFER | + FORMAT_MESSAGE_FROM_SYSTEM | + FORMAT_MESSAGE_IGNORE_INSERTS, + NULL, + GetLastError(), + MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), // Default language + (LPTSTR) &lpMsgBuf, + 0, + NULL )) + { + OutputDebugStringFormat( TEXT("Error Code %d: %s"), dwError, lpMsgBuf ); + LocalFree( lpMsgBuf ); + } + else + OutputDebugStringFormat( TEXT("Error Code %d: Unknown"), dwError ); + SetMsiErrorCode( dwError ); + } + + return fSuccess; +} + +static std::_tstring strip( const std::_tstring& s, _TCHAR c ) +{ + std::_tstring result = s; + + std::_tstring::size_type f; + + do + { + f = result.find( c ); + if ( f != std::_tstring::npos ) + result.erase( f, 1 ); + } while ( f != std::_tstring::npos ); + + return result; +} + +static std::_tstring trim( const std::_tstring& rString ) +{ + std::_tstring temp = rString; + + while ( temp.length() && temp[0] == ' ' || temp[0] == '\t' ) + temp.erase( 0, 1 ); + + std::_tstring::size_type len = temp.length(); + + while ( len && temp[len-1] == ' ' || temp[len-1] == '\t' ) + { + temp.erase( len - 1, 1 ); + len = temp.length(); + } + + return temp; +} + +static bool readLine( FILE *fp, std::_tstring& rLine ) +{ + _TCHAR szBuffer[1024]; + bool bSuccess = false; + bool bEOL = false; + std::_tstring line; + + + while ( !bEOL && _fgetts( szBuffer, sizeof(szBuffer), fp ) ) + { + int len = _tcslen(szBuffer); + + bSuccess = true; + + while ( len && szBuffer[len - 1] == '\n' ) + { + szBuffer[--len] = 0; + bEOL = true; + } + + line.append( szBuffer ); + } + + rLine = line; + return bSuccess; +} + + +static std::_tstring getProfileString( + const std::_tstring& aFileName, + const std::_tstring& aSectionName, + const std::_tstring& aKeyName, + const std::_tstring& aDefault = _T("") ) +{ + FILE *fp = _tfopen( aFileName.c_str(), _T("r") ); + std::_tstring retValue = aDefault.length() ? aDefault : _T(""); + + if ( fp ) + { + std::_tstring line; + std::_tstring section; + + while ( readLine( fp, line ) ) + { + line = trim( line ); + + if ( line.length() && line[0] == '[' ) + { + line.erase( 0, 1 ); + std::_tstring::size_type end = line.find( ']', 0 ); + + if ( std::_tstring::npos != end ) + section = trim( line.substr( 0, end ) ); + } + else + { + + std::_tstring::size_type iEqualSign = line.find( '=', 0 ); + + if ( iEqualSign != std::_tstring::npos ) + { + std::_tstring keyname = line.substr( 0, iEqualSign ); + keyname = trim( keyname ); + + std::_tstring value = line.substr( iEqualSign + 1 /*, std::_tstring::npos */ ); + value = trim( value ); + + if ( + 0 == _tcsicmp( section.c_str(), aSectionName.c_str() ) && + 0 == _tcsicmp( keyname.c_str(), aKeyName.c_str() ) + ) + { + retValue = value; + break; + } + } + } + } + + fclose( fp ); + } + + return retValue; +} + +static std::queue< std::_tstring > getProfileSections( const std::_tstring& aFileName ) +{ + FILE *fp = _tfopen( aFileName.c_str(), _T("r") ); + std::queue< std::_tstring > aResult; + + OutputDebugStringFormat( TEXT("*** Retrieving Section Names ****") ); + + if ( fp ) + { + std::_tstring line; + std::_tstring section; + + while ( readLine( fp, line ) ) + { + line = trim( line ); + + if ( line.length() && line[0] == '[' ) + { + line.erase( 0, 1 ); + std::_tstring::size_type end = line.find( ']', 0 ); + + if ( std::_tstring::npos != end ) + section = trim( line.substr( 0, end ) ); + + aResult.push( section ); + + OutputDebugStringFormat( TEXT("Section: %s"), section.c_str() ); + + } + } + + fclose( fp ); + } + + OutputDebugStringFormat( TEXT("*** Done Section Names ***") ); + + return aResult; +} + +static std::queue< std::_tstring > getProfileKeys( const std::_tstring& aFileName, const std::_tstring& aSectionName ) +{ + FILE *fp = _tfopen( aFileName.c_str(), _T("r") ); + std::queue< std::_tstring > aResult; + + OutputDebugStringFormat( TEXT("*** Retrieving Key Names for [%s] ***"), aSectionName.c_str() ); + + if ( fp ) + { + std::_tstring line; + std::_tstring section; + + while ( readLine( fp, line ) ) + { + line = trim( line ); + + if ( line.length() && line[0] == '[' ) + { + line.erase( 0, 1 ); + std::_tstring::size_type end = line.find( ']', 0 ); + + if ( std::_tstring::npos != end ) + section = trim( line.substr( 0, end ) ); + } + else + { + + std::_tstring::size_type iEqualSign = line.find( '=', 0 ); + + if ( iEqualSign != std::_tstring::npos ) + { + std::_tstring keyname = line.substr( 0, iEqualSign ); + keyname = trim( keyname ); + + if ( 0 == _tcsicmp( section.c_str(), aSectionName.c_str() ) ) + { + aResult.push( keyname ); + + OutputDebugStringFormat( keyname.c_str() ); + + } + } + } + } + + fclose( fp ); + } + + OutputDebugStringFormat( TEXT("*** Done Key Names for [%s] ***"), aSectionName.c_str() ); + + return aResult; +} + +extern "C" UINT __stdcall InstallPatchedFiles( MSIHANDLE handle ) +{ + std::_tstring sInstDir = GetMsiProperty( handle, TEXT("INSTALLLOCATION") ); + std::_tstring sBasisInstDir = GetMsiProperty( handle, TEXT("BASISINSTALLLOCATION") ); + std::_tstring sProgramDir = sBasisInstDir + TEXT("program\\"); + std::_tstring sPatchFile = sProgramDir + TEXT("patchlist.txt"); + + std::queue< std::_tstring > aSectionNames; + std::queue< std::_tstring > aKeyNames; + + OutputDebugStringA( "Starting Custom Action" ); + + // std::_tstring mystr; + // mystr = "Patchfile: " + sPatchFile; + // MessageBox( NULL, mystr.c_str(), "Patchfile", MB_OK ); + + aSectionNames = getProfileSections( sPatchFile ); + while ( !aSectionNames.empty() ) + { + std::_tstring sSectionName = aSectionNames.front(); + if ( std::_tstring(TEXT("_root")) == sSectionName ) { sSectionName = TEXT(""); } + // mystr = "Section: " + sSectionName; + // MessageBox( NULL, mystr.c_str(), "Titel", MB_OK ); + + aKeyNames = getProfileKeys( sPatchFile, sSectionName ); + while ( !aKeyNames.empty() ) + { + std::_tstring sKeyName = aKeyNames.front(); + std::_tstring sValue = getProfileString( sPatchFile, sSectionName, sKeyName ); + + if ( sValue.length() ) + { + std::_tstring sFileName1 = sKeyName; + std::_tstring sExtension = sValue; + std::_tstring sFileName2; + + sFileName1 = strip( sFileName1, '\"' ); + sExtension = strip( sExtension, '\"' ); + + sFileName1 = sInstDir + sSectionName + sFileName1; + sFileName2 = sFileName1 + sExtension; + + // mystr = "Convert: " + sFileName1 + " to " + sFileName2; + // MessageBox( NULL, mystr.c_str(), "Titel", MB_OK ); + + SwapFiles( sFileName1, sFileName2 ); + } + + aKeyNames.pop(); + } + + aSectionNames.pop(); + } + + return ERROR_SUCCESS; +} + +extern "C" UINT __stdcall UninstallPatchedFiles( MSIHANDLE handle ) +{ + TCHAR szValue[8192]; + DWORD nValueSize = sizeof(szValue); + HKEY hKey; + + std::_tstring sInstDir; + std::_tstring sBasisInstDir; + + std::_tstring sProductKey = GetMsiProperty( handle, TEXT("FINDPRODUCT") ); + + if ( ERROR_SUCCESS == RegOpenKey( HKEY_CURRENT_USER, sProductKey.c_str(), &hKey ) ) + { + if ( ERROR_SUCCESS == RegQueryValueEx( hKey, TEXT("BASISINSTALLLOCATION"), NULL, NULL, (LPBYTE)szValue, &nValueSize ) ) + { + sBasisInstDir = szValue; + } + if ( ERROR_SUCCESS == RegQueryValueEx( hKey, TEXT("INSTALLLOCATION"), NULL, NULL, (LPBYTE)szValue, &nValueSize ) ) + { + sInstDir = szValue; + } + RegCloseKey( hKey ); + } + else if ( ERROR_SUCCESS == RegOpenKey( HKEY_LOCAL_MACHINE, sProductKey.c_str(), &hKey ) ) + { + if ( ERROR_SUCCESS == RegQueryValueEx( hKey, TEXT("BASISINSTALLLOCATION"), NULL, NULL, (LPBYTE)szValue, &nValueSize ) ) + { + sBasisInstDir = szValue; + } + if ( ERROR_SUCCESS == RegQueryValueEx( hKey, TEXT("INSTALLLOCATION"), NULL, NULL, (LPBYTE)szValue, &nValueSize ) ) + { + sInstDir = szValue; + } + RegCloseKey( hKey ); + } + else + return ERROR_SUCCESS; + + std::_tstring sProgramDir = sBasisInstDir + TEXT("program\\"); + std::_tstring sPatchFile = sProgramDir + TEXT("patchlist.txt"); + + std::queue< std::_tstring > aSectionNames; + std::queue< std::_tstring > aKeyNames; + + // std::_tstring mystr; + // mystr = "Patchfile: " + sPatchFile; + // MessageBox( NULL, mystr.c_str(), "Titel", MB_OK ); + + aSectionNames = getProfileSections( sPatchFile ); + while ( !aSectionNames.empty() ) + { + std::_tstring sSectionName = aSectionNames.front(); + if ( std::_tstring(TEXT("_root")) == sSectionName ) { sSectionName = TEXT(""); } + // mystr = "Section: " + sSectionName; + // MessageBox( NULL, mystr.c_str(), "Titel", MB_OK ); + + aKeyNames = getProfileKeys( sPatchFile, sSectionName ); + while( !aKeyNames.empty() ) + { + std::_tstring sKeyName = aKeyNames.front(); + std::_tstring sValue = getProfileString( sPatchFile, sSectionName, sKeyName ); + + if ( sValue.length() ) + { + std::_tstring sFileName1 = sKeyName; + std::_tstring sExtension = sValue; + std::_tstring sFileName2; + + sFileName1 = strip( sFileName1, '\"' ); + sExtension = strip( sExtension, '\"' ); + + sFileName1 = sInstDir + sSectionName + sFileName1; + sFileName2 = sFileName1 + sExtension; + + // mystr = "Convert: " + sFileName1 + " to " + sFileName2; + // MessageBox( NULL, mystr.c_str(), "Titel", MB_OK ); + + SwapFiles( sFileName2, sFileName1 ); + } + + aKeyNames.pop(); + } + + aSectionNames.pop(); + } + + return ERROR_SUCCESS; +} + +extern "C" UINT __stdcall IsOfficeRunning( MSIHANDLE handle ) +{ + std::_tstring sInstDir = GetMsiProperty( handle, TEXT("BASISINSTALLLOCATION") ); + std::_tstring sResourceDir = sInstDir + TEXT("program\\resource\\"); + std::_tstring sPattern = sResourceDir + TEXT("vcl*.res"); + + WIN32_FIND_DATA aFindFileData; + HANDLE hFind = FindFirstFile( sPattern.c_str(), &aFindFileData ); + + if ( IsValidHandle(hFind) ) + { + BOOL fSuccess = false; + bool fRenameSucceeded; + + do + { + std::_tstring sResourceFile = sResourceDir + aFindFileData.cFileName; + std::_tstring sIntermediate = sResourceFile + TEXT(".tmp"); + + fRenameSucceeded = MoveFileExImpl( sResourceFile.c_str(), sIntermediate.c_str(), MOVEFILE_REPLACE_EXISTING ); + if ( fRenameSucceeded ) + { + MoveFileExImpl( sIntermediate.c_str(), sResourceFile.c_str(), 0 ); + fSuccess = FindNextFile( hFind, &aFindFileData ); + } + } while ( fSuccess && fRenameSucceeded ); + + if ( !fRenameSucceeded ) + { + MsiSetProperty(handle, TEXT("OFFICERUNS"), TEXT("1")); + SetMsiErrorCode( MSI_ERROR_OFFICE_IS_RUNNING ); + } + + FindClose( hFind ); + } + + + return ERROR_SUCCESS; +} + +extern "C" UINT __stdcall SetFeatureState( MSIHANDLE handle ) +{ + std::_tstring mystr; + + // 1. Reading Product Code from setup.ini of installed Office + + std::_tstring sInstallPath = GetMsiProperty(handle, TEXT("OFFICEINSTALLLOCATION")); + // MessageBox(NULL, sInstallPath.c_str(), "BASISINSTALLLOCATION", MB_OK); + std::_tstring sSetupiniPath = sInstallPath + TEXT("program\\setup.ini"); + + TCHAR szProductCode[32767]; + + GetPrivateProfileString( + TEXT("Bootstrap"), + TEXT("ProductCode"), + TEXT("NOTFOUND"), + szProductCode, + elementsof(szProductCode), + sSetupiniPath.c_str() + ); + + if ( !_tcsicmp( szProductCode, TEXT("NOTFOUND") ) ) + { + // No setup.ini or no "ProductCode" in setup.ini. This is an invalid directory. + // MessageBox(NULL, "NOTFOUND set", "DEBUG", MB_OK); + return ERROR_SUCCESS; + } + + // 2. Converting Product code + + std::_tstring productCode = TEXT(szProductCode); + productCode = ConvertGuid(std::_tstring(productCode.c_str() + 1, productCode.length() - 2)); + mystr = TEXT("Changed product code: ") + productCode; + // MessageBox(NULL, mystr.c_str(), "ProductCode", MB_OK); + + // 3. Setting path in the Windows registry to find installed features + + std::_tstring registryKey; + HKEY registryRoot; + + if ( IsSetMsiProperty(handle, TEXT("ALLUSERS")) ) + { + registryRoot = HKEY_LOCAL_MACHINE; + registryKey = TEXT("Software\\Classes\\Installer\\Features\\") + productCode; + mystr = registryKey; + // MessageBox( NULL, mystr.c_str(), "ALLUSERS", MB_OK ); + } + else + { + registryRoot = HKEY_CURRENT_USER; + registryKey = TEXT("Software\\Microsoft\\Installer\\Features\\") + productCode; + mystr = registryKey; + // MessageBox( NULL, mystr.c_str(), "ALLUSERS", MB_OK ); + } + + // 4. Collecting all installed features from Windows registry + + HKEY hKey; + if (RegOpenKey(registryRoot, registryKey.c_str(), &hKey) == ERROR_SUCCESS) + { + int counter = 0; + // DWORD counter = 0; + LONG lEnumResult; + + do + { + TCHAR szValueName[8192]; + DWORD nValueNameSize = sizeof(szValueName); + LPDWORD pValueNameSize = &nValueNameSize; + TCHAR szValueData[8192]; + DWORD nValueDataSize = sizeof(szValueData); + + lEnumResult = RegEnumValue( hKey, counter, szValueName, pValueNameSize, NULL, NULL, (LPBYTE)szValueData, &nValueDataSize); + + if ( ERROR_SUCCESS == lEnumResult ) + { + std::_tstring sValueName = szValueName; + std::_tstring sValueData = szValueData; + + // mystr = sValueName; + // MessageBox( NULL, mystr.c_str(), "ValueName", MB_OK ); + // mystr = sValueData; + // MessageBox( NULL, mystr.c_str(), "ValueData", MB_OK ); + + // Does this feature exist in this patch? + if ( IsSetMsiProperty(handle, sValueName) ) + { + // Feature is not installed, if szValueData starts with a "square" (ascii 6) + if ( 6 == szValueData[0] ) + { + MsiSetFeatureState(handle,sValueName.c_str(),INSTALLSTATE_ABSENT); // do not install this feature + // mystr = TEXT("Do NOT install: ") + sValueName; + // MessageBox( NULL, mystr.c_str(), "ValueName", MB_OK ); + } + else + { + MsiSetFeatureState(handle,sValueName.c_str(),INSTALLSTATE_LOCAL); // do install this feature + // mystr = TEXT("Do install: ") + sValueName; + // MessageBox( NULL, mystr.c_str(), "ValueName", MB_OK ); + } + } + } + + counter = counter + 1; + + } while ( ERROR_SUCCESS == lEnumResult ); + + RegCloseKey( hKey ); + } + + return ERROR_SUCCESS; +} + +extern "C" UINT __stdcall SetNewFeatureState( MSIHANDLE handle ) +{ + std::_tstring mystr; + std::_tstring sValueName; + + sValueName = TEXT("gm_o_Onlineupdate"); + + if (IsSetMsiProperty(handle, TEXT("SELECT_OU_FEATURE"))) + { + MsiSetFeatureState(handle,sValueName.c_str(),INSTALLSTATE_LOCAL); // do install this feature + // mystr = TEXT("OnlineUpdate wird installiert!"); + // MessageBox(NULL, mystr.c_str(), "INSTALLSTATE_LOCAL", MB_OK); + } + else + { + MsiSetFeatureState(handle,sValueName.c_str(),INSTALLSTATE_ABSENT); // do not install this feature + // mystr = TEXT("OnlineUpdate wird NICHT installiert!"); + // MessageBox(NULL, mystr.c_str(), "INSTALLSTATE_ABSENT", MB_OK); + } + + return ERROR_SUCCESS; +} + +extern "C" UINT __stdcall ShowOnlineUpdateDialog( MSIHANDLE handle ) +{ + // Checking existence of file "updchk.uno.dll", which shows, that + // Online Update functionality is always available. Then the dialog + // that offers the Online Update is superfluous. + + std::_tstring sInstDir = GetMsiProperty( handle, TEXT("BASISINSTALLLOCATION") ); + std::_tstring sProgramDir = sInstDir + TEXT("program\\"); + std::_tstring sSearchFile = sProgramDir + TEXT("updchk.uno.dll"); + + WIN32_FIND_DATA data; + HANDLE hdl = FindFirstFile(sSearchFile.c_str(), &data); + if (hdl != INVALID_HANDLE_VALUE) // the file exists + { + // std::_tstring mystr; + // mystr = "Found file: " + sSearchFile; + // MessageBox( NULL, mystr.c_str(), "Found file", MB_OK ); + + // And finally setting property SHOW_ONLINEUPDATE_DIALOG + // to hide this dialog + UnsetMsiProperty(handle, TEXT("SHOW_ONLINEUPDATE_DIALOG")); + + // Setting SELECT_OU_FEATURE to 1, which is probably superfluous + // because this is already the default value. But only this + // guarantees, that CustomAction SetNewFeatureState always sets + // the correct FeatureState for "gm_o_Onlineupdate", if it is + // already installed. + SetMsiProperty(handle, TEXT("SELECT_OU_FEATURE")); + } + else + { + // std::_tstring mystr; + // mystr = "Did not find file: " + sSearchFile; + // MessageBox( NULL, mystr.c_str(), "File not found", MB_OK ); + + // If the file does not exist, the Online Update dialog + // has to be shown. + SetMsiProperty(handle, TEXT("SHOW_ONLINEUPDATE_DIALOG")); + FindClose(hdl); + } + + return ERROR_SUCCESS; +} diff --git a/setup_native/source/win32/customactions/quickstarter/exports.dxp b/setup_native/source/win32/customactions/quickstarter/exports.dxp new file mode 100644 index 000000000000..c1343f8e7e76 --- /dev/null +++ b/setup_native/source/win32/customactions/quickstarter/exports.dxp @@ -0,0 +1,3 @@ +InstallExecSequenceEntry +DeinstallExecSequenceEntry +
\ No newline at end of file diff --git a/setup_native/source/win32/customactions/quickstarter/makefile.mk b/setup_native/source/win32/customactions/quickstarter/makefile.mk new file mode 100644 index 000000000000..0861c20efed8 --- /dev/null +++ b/setup_native/source/win32/customactions/quickstarter/makefile.mk @@ -0,0 +1,102 @@ +#************************************************************************* +# +# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. +# +# Copyright 2000, 2010 Oracle and/or its affiliates. +# +# OpenOffice.org - a multi-platform office productivity suite +# +# This file is part of OpenOffice.org. +# +# OpenOffice.org is free software: you can redistribute it and/or modify +# it under the terms of the GNU Lesser General Public License version 3 +# only, as published by the Free Software Foundation. +# +# OpenOffice.org is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU Lesser General Public License version 3 for more details +# (a copy is included in the LICENSE file that accompanied this code). +# +# You should have received a copy of the GNU Lesser General Public License +# version 3 along with OpenOffice.org. If not, see +# <http://www.openoffice.org/license.html> +# for a copy of the LGPLv3 License. +# +#************************************************************************* + +PRJ=..$/..$/..$/.. +PRJNAME=setup_native +TARGET=quickstarter +TARGET1=sdqsmsi +TARGET2=qslnkmsi + +# --- Settings ----------------------------------------------------- + +LIBTARGET=NO +ENABLE_EXCEPTIONS=TRUE +NO_DEFAULT_STL=TRUE +DYNAMIC_CRT= +USE_DEFFILE=TRUE + +.INCLUDE : settings.mk + +.IF "$(USE_SYSTEM_STL)" != "YES" +CFLAGS+=-D_STLP_USE_STATIC_LIB +.ENDIF + +UWINAPILIB= + +# --- Files -------------------------------------------------------- + +.IF "$(GUI)"=="WNT" + +STDSHL += \ + $(ADVAPI32LIB)\ + $(SHELL32LIB)\ + $(MSILIB) + +.IF "$(USE_SYSTEM_STL)" != "YES" +STDSHL += $(LIBSTLPORTST) +.ENDIF + +.IF "$(COM)"=="GCC" +STDSHL+= \ + $(KERNEL32LIB)\ + -lmsvcrt +.ENDIF + +SHL1OBJS = $(SLO)$/shutdown_quickstart.obj \ + $(SLO)$/quickstarter.obj + +SHL1TARGET = $(TARGET1) +SHL1IMPLIB = i$(TARGET1) + +SHL1DEF = $(MISC)$/$(SHL1TARGET).def +SHL1BASE = 0x1c000000 +DEF1NAME=$(SHL1TARGET) +SHL1DEPN=$(SHL1OBJS) +DEF1EXPORTFILE=$(TARGET1).dxp + +# --- Files -------------------------------------------------------- + +SHL2OBJS = $(SLO)$/remove_quickstart_link.obj \ + $(SLO)$/quickstarter.obj + +SHL2TARGET = $(TARGET2) +SHL2IMPLIB = i$(TARGET2) + +SHL2DEF = $(MISC)$/$(SHL2TARGET).def +SHL2BASE = 0x1c000000 +DEF2NAME=$(SHL2TARGET) +SHL2DEPN=$(SHL1OBJS) +DEF2EXPORTFILE=$(TARGET2).dxp + +.ENDIF + +# --- Targets -------------------------------------------------------------- + +.INCLUDE : target.mk + +# ------------------------------------------------------------------------- + diff --git a/setup_native/source/win32/customactions/quickstarter/qslnkmsi.dxp b/setup_native/source/win32/customactions/quickstarter/qslnkmsi.dxp new file mode 100644 index 000000000000..56f67cc93783 --- /dev/null +++ b/setup_native/source/win32/customactions/quickstarter/qslnkmsi.dxp @@ -0,0 +1,2 @@ +RemoveQuickstarterLink +
\ No newline at end of file diff --git a/setup_native/source/win32/customactions/quickstarter/quickstarter.cxx b/setup_native/source/win32/customactions/quickstarter/quickstarter.cxx new file mode 100644 index 000000000000..f732a3a8ad57 --- /dev/null +++ b/setup_native/source/win32/customactions/quickstarter/quickstarter.cxx @@ -0,0 +1,221 @@ +#include "quickstarter.hxx" +#ifdef _MSC_VER +#pragma warning(push, 1) /* disable warnings within system headers */ +#endif +#include <psapi.h> +#ifdef _MSC_VER +#pragma warning(pop) +#endif +#include <tlhelp32.h> +#include <malloc.h> + +std::string GetOfficeInstallationPath(MSIHANDLE handle) +{ + std::string progpath; + DWORD sz = 0; + LPTSTR dummy = TEXT(""); + + if (MsiGetProperty(handle, TEXT("OFFICEINSTALLLOCATION"), dummy, &sz) == ERROR_MORE_DATA) + { + sz++; // space for the final '\0' + DWORD nbytes = sz * sizeof(TCHAR); + LPTSTR buff = reinterpret_cast<LPTSTR>(_alloca(nbytes)); + ZeroMemory(buff, nbytes); + MsiGetProperty(handle, TEXT("OFFICEINSTALLLOCATION"), buff, &sz); + progpath = buff; + } + return progpath; +} + +std::string GetOfficeProductName(MSIHANDLE handle) +{ + std::string productname; + DWORD sz = 0; + LPTSTR dummy = TEXT(""); + + if (MsiGetProperty(handle, TEXT("ProductName"), dummy, &sz) == ERROR_MORE_DATA) + { + sz++; // space for the final '\0' + DWORD nbytes = sz * sizeof(TCHAR); + LPTSTR buff = reinterpret_cast<LPTSTR>(_alloca(nbytes)); + ZeroMemory(buff, nbytes); + MsiGetProperty(handle, TEXT("ProductName"), buff, &sz); + productname = buff; + } + return productname; +} + +std::string GetQuickstarterLinkName(MSIHANDLE handle) +{ + std::string quickstarterlinkname; + DWORD sz = 0; + LPTSTR dummy = TEXT(""); + + if (MsiGetProperty(handle, TEXT("Quickstarterlinkname"), dummy, &sz) == ERROR_MORE_DATA) + { + sz++; // space for the final '\0' + DWORD nbytes = sz * sizeof(TCHAR); + LPTSTR buff = reinterpret_cast<LPTSTR>(_alloca(nbytes)); + ZeroMemory(buff, nbytes); + MsiGetProperty(handle, TEXT("Quickstarterlinkname"), buff, &sz); + quickstarterlinkname = buff; + } + else if (MsiGetProperty(handle, TEXT("ProductName"), dummy, &sz) == ERROR_MORE_DATA) + { + sz++; // space for the final '\0' + DWORD nbytes = sz * sizeof(TCHAR); + LPTSTR buff = reinterpret_cast<LPTSTR>(_alloca(nbytes)); + ZeroMemory(buff, nbytes); + MsiGetProperty(handle, TEXT("ProductName"), buff, &sz); + quickstarterlinkname = buff; + } + return quickstarterlinkname; +} + +inline bool IsValidHandle( HANDLE handle ) +{ + return NULL != handle && INVALID_HANDLE_VALUE != handle; +} + + +static HANDLE WINAPI _CreateToolhelp32Snapshot( DWORD dwFlags, DWORD th32ProcessID ) +{ + typedef HANDLE (WINAPI *FN_PROC)( DWORD dwFlags, DWORD th32ProcessID ); + static FN_PROC lpProc = NULL; + + HANDLE hSnapshot = NULL; + + if ( !lpProc ) + { + HMODULE hLibrary = GetModuleHandle("KERNEL32.DLL"); + + if ( hLibrary ) + lpProc = reinterpret_cast< FN_PROC >(GetProcAddress( hLibrary, "CreateToolhelp32Snapshot" )); + } + + if ( lpProc ) + hSnapshot = lpProc( dwFlags, th32ProcessID ); + + return hSnapshot; +} + +static BOOL WINAPI _Process32First( HANDLE hSnapshot, PROCESSENTRY32 *lppe32 ) +{ + typedef BOOL (WINAPI *FN_PROC)( HANDLE hSnapshot, PROCESSENTRY32 *lppe32 ); + static FN_PROC lpProc = NULL; + + BOOL fSuccess = FALSE; + + if ( !lpProc ) + { + HMODULE hLibrary = GetModuleHandle("KERNEL32.DLL"); + + if ( hLibrary ) + lpProc = reinterpret_cast< FN_PROC >(GetProcAddress( hLibrary, "Process32First" )); + } + + if ( lpProc ) + fSuccess = lpProc( hSnapshot, lppe32 ); + + return fSuccess; +} + +static BOOL WINAPI _Process32Next( HANDLE hSnapshot, PROCESSENTRY32 *lppe32 ) +{ + typedef BOOL (WINAPI *FN_PROC)( HANDLE hSnapshot, PROCESSENTRY32 *lppe32 ); + static FN_PROC lpProc = NULL; + + BOOL fSuccess = FALSE; + + if ( !lpProc ) + { + HMODULE hLibrary = GetModuleHandle("KERNEL32.DLL"); + + if ( hLibrary ) + lpProc = reinterpret_cast< FN_PROC >(GetProcAddress( hLibrary, "Process32Next" )); + } + + if ( lpProc ) + fSuccess = lpProc( hSnapshot, lppe32 ); + + return fSuccess; +} + +static std::string GetProcessImagePath_9x( DWORD dwProcessId ) +{ + std::string sImagePath; + + HANDLE hSnapshot = _CreateToolhelp32Snapshot( TH32CS_SNAPPROCESS, 0 ); + + if ( IsValidHandle( hSnapshot ) ) + { + PROCESSENTRY32 pe32 = { 0 }; + + pe32.dwSize = sizeof(PROCESSENTRY32); + + BOOL fSuccess = _Process32First( hSnapshot, &pe32 ); + bool found = false; + + while ( !found && fSuccess ) + { + if ( pe32.th32ProcessID == dwProcessId ) + { + found = true; + sImagePath = pe32.szExeFile; + } + + if ( !found ) + fSuccess = _Process32Next( hSnapshot, &pe32 ); + } + + CloseHandle( hSnapshot ); + } + + return sImagePath; +} + +static DWORD WINAPI _GetModuleFileNameExA( HANDLE hProcess, HMODULE hModule, LPSTR lpFileName, DWORD nSize ) +{ + typedef DWORD (WINAPI *FN_PROC)( HANDLE hProcess, HMODULE hModule, LPSTR lpFileName, DWORD nSize ); + + static FN_PROC lpProc = NULL; + + if ( !lpProc ) + { + HMODULE hLibrary = LoadLibrary("PSAPI.DLL"); + + if ( hLibrary ) + lpProc = reinterpret_cast< FN_PROC >(GetProcAddress( hLibrary, "GetModuleFileNameExA" )); + } + + if ( lpProc ) + return lpProc( hProcess, hModule, lpFileName, nSize ); + + return 0; + +} + +static std::string GetProcessImagePath_NT( DWORD dwProcessId ) +{ + std::string sImagePath; + + HANDLE hProcess = OpenProcess( PROCESS_QUERY_INFORMATION | PROCESS_VM_READ, FALSE, dwProcessId ); + + if ( IsValidHandle( hProcess ) ) + { + CHAR szPathBuffer[MAX_PATH] = ""; + + if ( _GetModuleFileNameExA( hProcess, NULL, szPathBuffer, sizeof(szPathBuffer) ) ) + sImagePath = szPathBuffer; + + CloseHandle( hProcess ); + } + + return sImagePath; +} + +std::string GetProcessImagePath( DWORD dwProcessId ) +{ + return (LONG)GetVersion() < 0 ? GetProcessImagePath_9x( dwProcessId ) : GetProcessImagePath_NT( dwProcessId ); +} + diff --git a/setup_native/source/win32/customactions/quickstarter/quickstarter.hxx b/setup_native/source/win32/customactions/quickstarter/quickstarter.hxx new file mode 100644 index 000000000000..9ec8da1df10f --- /dev/null +++ b/setup_native/source/win32/customactions/quickstarter/quickstarter.hxx @@ -0,0 +1,18 @@ +#pragma once + +#ifdef _MSC_VER +#pragma warning(push, 1) /* disable warnings within system headers */ +#endif +#define WIN32_LEAN_AND_MEAN +#include <windows.h> +#include <msiquery.h> +#ifdef _MSC_VER +#pragma warning(pop) +#endif + +#include <string> + +std::string GetOfficeInstallationPath(MSIHANDLE handle); +std::string GetOfficeProductName(MSIHANDLE handle); +std::string GetQuickstarterLinkName(MSIHANDLE handle); +std::string GetProcessImagePath( DWORD dwProcessId ); diff --git a/setup_native/source/win32/customactions/quickstarter/remove_quickstart_link.cxx b/setup_native/source/win32/customactions/quickstarter/remove_quickstart_link.cxx new file mode 100644 index 000000000000..ef52ecfe2941 --- /dev/null +++ b/setup_native/source/win32/customactions/quickstarter/remove_quickstart_link.cxx @@ -0,0 +1,60 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#ifdef _MSC_VER +#pragma warning(push, 1) /* disable warnings within system headers */ +#pragma warning(disable: 4917) +#endif +#define WIN32_LEAN_AND_MEAN +#include <windows.h> +#include <shlobj.h> +#include <msiquery.h> +#ifdef _MSC_VER +#pragma warning(pop) +#endif + +#include <string> +#include "quickstarter.hxx" + + +extern "C" UINT __stdcall RemoveQuickstarterLink( MSIHANDLE hMSI ) +{ + CHAR szStartupPath[MAX_PATH]; + + if ( SHGetSpecialFolderPathA( NULL, szStartupPath, CSIDL_STARTUP, FALSE ) ) + { + std::string sQuickstartLinkPath = szStartupPath; + + sQuickstartLinkPath += "\\"; + sQuickstartLinkPath += GetQuickstarterLinkName( hMSI ); + sQuickstartLinkPath += ".lnk"; + + DeleteFileA( sQuickstartLinkPath.c_str() ); + } + + return ERROR_SUCCESS; +} diff --git a/setup_native/source/win32/customactions/quickstarter/sdqsmsi.dxp b/setup_native/source/win32/customactions/quickstarter/sdqsmsi.dxp new file mode 100644 index 000000000000..49ec00aff0d8 --- /dev/null +++ b/setup_native/source/win32/customactions/quickstarter/sdqsmsi.dxp @@ -0,0 +1,2 @@ +ShutDownQuickstarter +
\ No newline at end of file diff --git a/setup_native/source/win32/customactions/quickstarter/shutdown_quickstart.cxx b/setup_native/source/win32/customactions/quickstarter/shutdown_quickstart.cxx new file mode 100644 index 000000000000..6f931d2b0175 --- /dev/null +++ b/setup_native/source/win32/customactions/quickstarter/shutdown_quickstart.cxx @@ -0,0 +1,79 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#include "quickstarter.hxx" +#include <setup_native/qswin32.h> + +static BOOL CALLBACK EnumWindowsProc( HWND hWnd, LPARAM lParam ) +{ + MSIHANDLE hMSI = static_cast< MSIHANDLE >( lParam ); + CHAR szClassName[sizeof(QUICKSTART_CLASSNAMEA) + 1]; + + int nCharsCopied = GetClassName( hWnd, szClassName, sizeof( szClassName ) ); + + if ( nCharsCopied && !stricmp( QUICKSTART_CLASSNAMEA, szClassName ) ) + { + DWORD dwProcessId; + + if ( GetWindowThreadProcessId( hWnd, &dwProcessId ) ) + { + std::string sImagePath = GetProcessImagePath( dwProcessId ); + std::string sOfficeImageDir = GetOfficeInstallationPath( hMSI ) + "program\\"; + + if ( !strnicmp( sImagePath.c_str(), sOfficeImageDir.c_str(), sOfficeImageDir.length() ) ) + { + UINT uMsgShutdownQuickstart = RegisterWindowMessageA( SHUTDOWN_QUICKSTART_MESSAGEA ); + + if ( uMsgShutdownQuickstart ) + SendMessageA( hWnd, uMsgShutdownQuickstart, 0, 0 ); + + + HANDLE hProcess = OpenProcess( SYNCHRONIZE, FALSE, dwProcessId ); + + if ( hProcess ) + { + WaitForSingleObject( hProcess, 30000 ); // Wait at most 30 seconds for process to terminate + CloseHandle( hProcess ); + } + + return FALSE; + } + + } + } + + return TRUE; +} + + +extern "C" UINT __stdcall ShutDownQuickstarter( MSIHANDLE hMSI ) +{ + EnumWindows( EnumWindowsProc, hMSI ); + + return ERROR_SUCCESS; +} + diff --git a/setup_native/source/win32/customactions/rebase/makefile.mk b/setup_native/source/win32/customactions/rebase/makefile.mk new file mode 100644 index 000000000000..47cd8fd59c87 --- /dev/null +++ b/setup_native/source/win32/customactions/rebase/makefile.mk @@ -0,0 +1,90 @@ +#************************************************************************* +# +# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. +# +# Copyright 2000, 2010 Oracle and/or its affiliates. +# +# OpenOffice.org - a multi-platform office productivity suite +# +# This file is part of OpenOffice.org. +# +# OpenOffice.org is free software: you can redistribute it and/or modify +# it under the terms of the GNU Lesser General Public License version 3 +# only, as published by the Free Software Foundation. +# +# OpenOffice.org is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU Lesser General Public License version 3 for more details +# (a copy is included in the LICENSE file that accompanied this code). +# +# You should have received a copy of the GNU Lesser General Public License +# version 3 along with OpenOffice.org. If not, see +# <http://www.openoffice.org/license.html> +# for a copy of the LGPLv3 License. +# +#************************************************************************* + +PRJ=..$/..$/..$/.. +PRJNAME=setup_native +TARGET=rebase + +# --- Settings ----------------------------------------------------- + +LIBTARGET=NO +ENABLE_EXCEPTIONS=TRUE +NO_DEFAULT_STL=TRUE +DYNAMIC_CRT= +USE_DEFFILE=TRUE +MINGW_NODLL=YES + +.INCLUDE : settings.mk + +.IF "$(USE_SYSTEM_STL)" != "YES" +CFLAGS+=-D_STLP_USE_STATIC_LIB +.ENDIF + +UWINAPILIB= + +# --- Files -------------------------------------------------------- + +.IF "$(GUI)"=="WNT" + +STDSHL += \ + $(ADVAPI32LIB)\ + $(SHELL32LIB)\ + $(MSILIB) + +.IF "$(USE_SYSTEM_STL)" != "YES" +STDSHL += $(LIBSTLPORTST) +.ENDIF + +.IF "$(COM)"=="GCC" +STDSHL+= \ + $(KERNEL32LIB)\ + -lmsvcrt \ + $(PSDK_HOME)$/lib$/imagehlp.lib +.ELSE +STDSHL+= \ + Imagehlp.lib +.ENDIF + +SHL1OBJS = \ + $(SLO)$/rebase.obj + +SHL1TARGET = $(TARGET) +SHL1IMPLIB = i$(TARGET) + +SHL1DEF = $(MISC)$/$(SHL1TARGET).def +SHL1BASE = 0x1c000000 +DEF1NAME=$(SHL1TARGET) +SHL1DEPN=$(SHL1OBJS) +DEF1EXPORTFILE=$(TARGET).dxp + +.ENDIF + +# --- Targets -------------------------------------------------------------- + +.INCLUDE : target.mk + +# ------------------------------------------------------------------------- diff --git a/setup_native/source/win32/customactions/rebase/rebase.cxx b/setup_native/source/win32/customactions/rebase/rebase.cxx new file mode 100644 index 000000000000..4d031bee908a --- /dev/null +++ b/setup_native/source/win32/customactions/rebase/rebase.cxx @@ -0,0 +1,168 @@ +#undef UNICODE +#undef _UNICODE + +#pragma once + +#ifdef _MSC_VER +#pragma warning(push, 1) /* disable warnings within system headers */ +#endif +#define WIN32_LEAN_AND_MEAN +#include <windows.h> +#include <msiquery.h> +#include <imagehlp.h> +#include <tchar.h> +#include <strsafe.h> +#ifdef _MSC_VER +#pragma warning(pop) +#endif + +#include <malloc.h> +#include <time.h> +#include <string> + +const DWORD PE_Signature = 0x00004550; + +#ifdef DEBUG +inline void OutputDebugStringFormat( LPCSTR pFormat, ... ) +{ + CHAR buffer[1024]; + va_list args; + + va_start( args, pFormat ); + StringCchVPrintfA( buffer, sizeof(buffer), pFormat, args ); + OutputDebugStringA( buffer ); +} +#else +static inline void OutputDebugStringFormat( LPCSTR, ... ) +{ +} +#endif + +static bool IsValidHandle( HANDLE handle ) +{ + return NULL != handle && INVALID_HANDLE_VALUE != handle; +} + +static std::string GetMsiProperty(MSIHANDLE handle, const std::string& sProperty) +{ + std::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; +} + +static BOOL rebaseImage( const std::string& filePath, LPVOID address ) +{ + ULONG ulOldImageSize; + ULONG_PTR lpOldImageBase; + ULONG ulNewImageSize; + ULONG_PTR lpNewImageBase = reinterpret_cast<ULONG_PTR>(address); + + BOOL bResult = ReBaseImage( + filePath.c_str(), + "", + TRUE, + FALSE, + FALSE, + 0, + &ulOldImageSize, + &lpOldImageBase, + &ulNewImageSize, + &lpNewImageBase, + (ULONG)time(NULL) ); + + return bResult; +} + +static BOOL rebaseImage( MSIHANDLE /*handle*/, const std::string& sFilePath, LPVOID address ) +{ + std::string mystr; + mystr = "Full file: " + sFilePath; + + BOOL bResult = rebaseImage( sFilePath, address ); + + if ( !bResult ) + { + OutputDebugStringFormat( "Rebasing library %s failed", mystr.c_str() ); + } + + return bResult; +} + +static BOOL rebaseImagesInFolder( MSIHANDLE handle, const std::string& sPath, LPVOID address ) +{ + std::string sDir = sPath; + std::string sPattern = sPath + TEXT("*.dll"); + + WIN32_FIND_DATA 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 ); + fSuccess = FindNextFile( hFind, &aFindFileData ); + } + while ( fSuccess ); + + FindClose( hFind ); + } + + return ERROR_SUCCESS; +} + +static BOOL rebaseImages( MSIHANDLE handle, LPVOID pAddress ) +{ + std::string sOfficeInstallPath = GetMsiProperty(handle, TEXT("OFFICEINSTALLLOCATION")); + std::string sBasisInstallPath = GetMsiProperty(handle, TEXT("BASISINSTALLLOCATION")); + std::string sUreInstallPath = GetMsiProperty(handle, TEXT("UREINSTALLLOCATION")); + + std::string sBasisDir = sBasisInstallPath + TEXT("program\\"); + std::string sOfficeDir = sOfficeInstallPath + TEXT("program\\"); + std::string sUreDir = sUreInstallPath + TEXT("bin\\"); + + BOOL bResult = rebaseImagesInFolder( handle, sBasisDir, pAddress ); + bResult &= rebaseImagesInFolder( handle, sOfficeDir, pAddress ); + bResult &= rebaseImagesInFolder( handle, sUreDir, pAddress ); + + return bResult; +} + +static BOOL IsServerSystem( MSIHANDLE /*handle*/ ) +{ + OSVERSIONINFOEX osVersionInfoEx; + osVersionInfoEx.dwOSVersionInfoSize = sizeof(OSVERSIONINFOEX); + GetVersionEx(reinterpret_cast<LPOSVERSIONINFO>(&osVersionInfoEx)); + + if ( osVersionInfoEx.wProductType != VER_NT_WORKSTATION ) + return TRUE; + else + return FALSE; +} + +extern "C" BOOL __stdcall RebaseLibrariesOnProperties( MSIHANDLE handle ) +{ + static LPVOID pDefault = reinterpret_cast<LPVOID>(0x10000000); + + std::string sDontOptimizeLibs = GetMsiProperty(handle, TEXT("DONTOPTIMIZELIBS")); + if ( sDontOptimizeLibs.length() > 0 && sDontOptimizeLibs == "1" ) + return TRUE; + + if ( !IsServerSystem( handle )) + return rebaseImages( handle, pDefault ); + + return TRUE; +} diff --git a/setup_native/source/win32/customactions/rebase/rebase.dxp b/setup_native/source/win32/customactions/rebase/rebase.dxp new file mode 100644 index 000000000000..47ea23951f04 --- /dev/null +++ b/setup_native/source/win32/customactions/rebase/rebase.dxp @@ -0,0 +1 @@ +RebaseLibrariesOnProperties
diff --git a/setup_native/source/win32/customactions/reg4allmsdoc/exports.dxp b/setup_native/source/win32/customactions/reg4allmsdoc/exports.dxp new file mode 100644 index 000000000000..364ebc705df8 --- /dev/null +++ b/setup_native/source/win32/customactions/reg4allmsdoc/exports.dxp @@ -0,0 +1 @@ +FindRegisteredExtensions diff --git a/setup_native/source/win32/customactions/reg4allmsdoc/makefile.mk b/setup_native/source/win32/customactions/reg4allmsdoc/makefile.mk new file mode 100644 index 000000000000..d58291966ef2 --- /dev/null +++ b/setup_native/source/win32/customactions/reg4allmsdoc/makefile.mk @@ -0,0 +1,83 @@ +#************************************************************************* +# +# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. +# +# Copyright 2000, 2010 Oracle and/or its affiliates. +# +# OpenOffice.org - a multi-platform office productivity suite +# +# This file is part of OpenOffice.org. +# +# OpenOffice.org is free software: you can redistribute it and/or modify +# it under the terms of the GNU Lesser General Public License version 3 +# only, as published by the Free Software Foundation. +# +# OpenOffice.org is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU Lesser General Public License version 3 for more details +# (a copy is included in the LICENSE file that accompanied this code). +# +# You should have received a copy of the GNU Lesser General Public License +# version 3 along with OpenOffice.org. If not, see +# <http://www.openoffice.org/license.html> +# for a copy of the LGPLv3 License. +# +#************************************************************************* + +PRJ=..$/..$/..$/.. +PRJNAME=setup_native +TARGET=reg4allmsdoc + +# --- Settings ----------------------------------------------------- + +ENABLE_EXCEPTIONS=TRUE +NO_DEFAULT_STL=TRUE +DYNAMIC_CRT= +USE_DEFFILE=TRUE + +.INCLUDE : settings.mk + +CFLAGS+=-DUNICODE -D_UNICODE +.IF "$(USE_SYSTEM_STL)" != "YES" +CFLAGS+=-D_STLP_USE_STATIC_LIB +.ENDIF + +# --- Files -------------------------------------------------------- + +.IF "$(GUI)"=="WNT" + +UWINAPILIB= + +SLOFILES = $(SLO)$/reg4allmsi.obj + +SHL1STDLIBS= $(KERNEL32LIB)\ + $(USER32LIB)\ + $(ADVAPI32LIB)\ + $(SHELL32LIB)\ + $(MSILIB)\ + $(SHLWAPILIB) + +.IF "$(USE_SYSTEM_STL)" != "YES" +SHL1STDLIBS+=$(LIBSTLPORTST) +.ENDIF + +SHL1LIBS = $(SLB)$/$(TARGET).lib + +SHL1TARGET = $(TARGET) +SHL1IMPLIB = i$(TARGET) + +SHL1DEF = $(MISC)$/$(SHL1TARGET).def +SHL1DEPN = $(SLB)$/$(TARGET).lib +SHL1BASE = 0x1c000000 +DEF1NAME=$(SHL1TARGET) +DEF1EXPORTFILE=exports.dxp + +.ENDIF + +# --- Targets -------------------------------------------------------------- + +.INCLUDE : target.mk + +# ------------------------------------------------------------------------- + diff --git a/setup_native/source/win32/customactions/reg4allmsdoc/reg4allmsi.cxx b/setup_native/source/win32/customactions/reg4allmsdoc/reg4allmsi.cxx new file mode 100644 index 000000000000..1be921ca5846 --- /dev/null +++ b/setup_native/source/win32/customactions/reg4allmsdoc/reg4allmsi.cxx @@ -0,0 +1,322 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#ifdef _MSC_VER +#pragma warning(push, 1) /* disable warnings within system headers */ +#endif +#define WIN32_LEAN_AND_MEAN +#include <windows.h> +#include <msiquery.h> +#ifdef _MSC_VER +#pragma warning(pop) +#endif + +#include <malloc.h> +#include <string> +#include <strsafe.h> + +//---------------------------------------------------------- +static const CHAR* g_Extensions[] = +{ + ".doc", // Microsoft Word Text [0] + ".dot", // Microsoft Word Template + ".rtf", // rtf text + ".docx", // Office Word 2007 XML document + ".docm", // Office Word 2007 XML macro-enabled document + ".dotx", // Office Word 2007 XML template + ".dotm", // Office Word 2007 XML macro-enabled template + ".xlw", // Microsoft Excel + ".xls", // Microsoft Excel + ".xlt", // Microsoft Excel Template + ".xlsx", // Office Excel 2007 XML workbook + ".xlsm", // Office Excel 2007 XML macro-enabled workbook + ".xltx", // Office Excel 2007 XML template + ".xltm", // Office Excel 2007 XML macro-enabled template + ".xlsb", // Office Excel 2007 binary workbook (BIFF12) + ".ppt", // Microsoft Powerpoint + ".pps", // Microsoft Powerpoint + ".pot", // Microsoft Powerpoint Template + ".pptx", // Office PowerPoint 2007 XML presentation + ".pptm", // Office PowerPoint 2007 macro-enabled XML presentation + ".potx", // Office PowerPoint 2007 XML template + ".potm", // Office PowerPoint 2007 macro-enabled XML template + ".ppsx", // Office PowerPoint 2007 XML show + 0 +}; + +// ".xlam", // Office Excel 2007 XML macro-enabled add-in +// ".ppam", // Office PowerPoint 2007 macro-enabled XML add-in +// ".ppsm", // Office PowerPoint 2007 macro-enabled XML show + +//---------------------------------------------------------- +#ifdef DEBUG +inline void OutputDebugStringFormat( LPCSTR pFormat, ... ) +{ + CHAR buffer[1024]; + va_list args; + + va_start( args, pFormat ); + StringCchVPrintfA( buffer, sizeof(buffer), pFormat, args ); + OutputDebugStringA( buffer ); +} +#else +static inline void OutputDebugStringFormat( LPCSTR, ... ) +{ +} +#endif + +//---------------------------------------------------------- +static bool IsModuleSelectedForInstallation( MSIHANDLE handle, LPCTSTR name ) +{ + INSTALLSTATE current_state; + INSTALLSTATE future_state; + MsiGetFeatureState(handle, name, ¤t_state, &future_state); + return (future_state == INSTALLSTATE_LOCAL); +} + +//---------------------------------------------------------- +static BOOL CheckExtensionInRegistry( LPCSTR lpSubKey ) +{ + BOOL bRet = false; + HKEY hKey = NULL; + LONG lResult = RegOpenKeyExA( HKEY_CLASSES_ROOT, lpSubKey, 0, KEY_QUERY_VALUE, &hKey ); + + if ( ERROR_SUCCESS == lResult ) + { + CHAR szBuffer[1024]; + DWORD nSize = sizeof( szBuffer ); + + lResult = RegQueryValueExA( hKey, "", NULL, NULL, (LPBYTE)szBuffer, &nSize ); + if ( ERROR_SUCCESS == lResult ) + { + szBuffer[nSize] = '\0'; + OutputDebugStringFormat( "Found value [%s] for key [%s].\n", szBuffer, lpSubKey ); + + if ( strncmp( szBuffer, "WordPad.Document.1", 18 ) == 0 ) + { // We will replace registration for word pad + bRet = true; + } + if ( strncmp( szBuffer, "OpenOffice.org.", 15 ) == 0 ) + { // We will replace registration for our own types, too + bRet = true; + } + if ( strncmp( szBuffer, "ooostub.", 8 ) == 0 ) + { // We will replace registration for ooostub, too + bRet = true; + } + } + else // no default value found -> return TRUE to register for that key + bRet = true; + + RegCloseKey( hKey ); + } + else // no key found -> return TRUE to register for that key + bRet = true; + + return bRet; +} + +//---------------------------------------------------------- +static LONG DeleteSubKeyTree( HKEY RootKey, LPCSTR lpKey ) +{ + HKEY hKey; + LONG rc = RegOpenKeyExA( RootKey, lpKey, 0, KEY_READ | DELETE, &hKey ); + + if (ERROR_SUCCESS == rc) + { + LPCSTR lpSubKey; + DWORD nMaxSubKeyLen; + + rc = RegQueryInfoKeyA( hKey, 0, 0, 0, 0, &nMaxSubKeyLen, 0, 0, 0, 0, 0, 0 ); + nMaxSubKeyLen++; // space for trailing '\0' + lpSubKey = reinterpret_cast<CHAR*>( _alloca( nMaxSubKeyLen*sizeof(CHAR) ) ); + + while (ERROR_SUCCESS == rc) + { + DWORD nLen = nMaxSubKeyLen; + rc = RegEnumKeyExA( hKey, 0, (LPSTR)lpSubKey, &nLen, 0, 0, 0, 0); // always index zero + + if ( ERROR_NO_MORE_ITEMS == rc ) + { + rc = RegDeleteKeyA( RootKey, lpKey ); + if ( rc == ERROR_SUCCESS ) + OutputDebugStringFormat( "deleted key [%s] from registry.\n", lpKey ); + else + OutputDebugStringFormat( "RegDeleteKeyA %s returned %ld.\n", lpKey, rc ); + break; + } + else if ( rc == ERROR_SUCCESS ) + { + rc = DeleteSubKeyTree( hKey, lpSubKey ); + if ( ERROR_SUCCESS != rc ) + OutputDebugStringFormat( "RegDeleteKeyA %s returned %ld.\n", lpSubKey, rc ); + } + + } + RegCloseKey(hKey); + } + else + { + OutputDebugStringFormat( "RegOpenKeyExA %s returned %ld.\n", lpKey, rc ); + } + + return rc; +} + +//---------------------------------------------------------- +static BOOL RemoveExtensionInRegistry( LPCSTR lpSubKey ) +{ + CHAR szBuffer[4096]; + DWORD nSize = sizeof( szBuffer ); + HKEY hKey = NULL; + HKEY hSubKey = NULL; + LONG lResult = RegOpenKeyExA( HKEY_LOCAL_MACHINE, "SOFTWARE\\Classes", 0, KEY_QUERY_VALUE, &hKey ); + + if ( ERROR_SUCCESS == lResult ) + { + lResult = RegOpenKeyExA( hKey, lpSubKey, 0, KEY_QUERY_VALUE, &hSubKey ); + + if ( ERROR_SUCCESS == lResult ) + { + DWORD nSubKeys = 1; + szBuffer[0] = '\0'; + + // we get the value of the default key fist and while we are on querying, + // we ask for the subkey count, too + lResult = RegQueryValueExA( hSubKey, "", NULL, NULL, (LPBYTE)szBuffer, &nSize ); + if ( ERROR_SUCCESS == lResult ) + RegQueryInfoKeyA( hSubKey, 0, 0, 0, &nSubKeys, 0, 0, 0, 0, 0, 0, 0 ); + RegCloseKey( hSubKey ); + + // we will remove all key with an default value starting with ooostub but + // we have to be careful about MSO keys + if ( strncmp( szBuffer, "opendocument.", 13 ) == 0 ) + { + if ( nSubKeys == 0 ) + { + DeleteSubKeyTree( hKey, lpSubKey ); + } + else + { + lResult = RegOpenKeyExA( hKey, lpSubKey, 0, KEY_SET_VALUE, &hSubKey ); + if ( ERROR_SUCCESS == lResult ) + RegDeleteValueA( hSubKey, "" ); + else + OutputDebugStringFormat( "Could not open key %s for deleting: RegOpenKeyEx returned %ld.\n", lpSubKey, lResult ); + } + } + } + + RegCloseKey( hKey ); + } + + return ( ERROR_SUCCESS == lResult ); +} + +//---------------------------------------------------------- +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 registerForExtensions( MSIHANDLE handle, BOOL bRegisterAll ) +{ // Check all file extensions + int nIndex = 0; + while ( g_Extensions[nIndex] != 0 ) + { + BOOL bRegister = bRegisterAll || CheckExtensionInRegistry( g_Extensions[nIndex] ); + if ( bRegister ) + { + CHAR sPropName[256]; + StringCchCopyA( sPropName, 256, "REGISTER_" ); + StringCchCatA( sPropName, 256, (g_Extensions[nIndex])+1 ); + CharUpperBuffA( sPropName+9, 4 ); + MsiSetPropertyA( handle, sPropName, "1" ); + OutputDebugStringFormat( "Set MSI property %s.\n", sPropName ); + } + ++nIndex; + } +} + +//---------------------------------------------------------- +//---------------------------------------------------------- +//---------------------------------------------------------- +extern "C" UINT __stdcall FindRegisteredExtensions( MSIHANDLE handle ) +{ + bool bRegisterAll = IsSetMsiProp( handle, "REGISTER_ALL_MSO_TYPES" ); + + if ( IsSetMsiProp( handle, "REGISTER_NO_MSO_TYPES" ) ) + { + OutputDebugStringFormat( "FindRegisteredExtensions: Register none!" ); + return ERROR_SUCCESS; + } + else if ( bRegisterAll ) + OutputDebugStringFormat( "FindRegisteredExtensions: Force all on" ); + else + OutputDebugStringFormat( "FindRegisteredExtensions: " ); + + registerForExtensions( handle, bRegisterAll ); + + return ERROR_SUCCESS; +} + +//---------------------------------------------------------- +extern "C" UINT __stdcall DeleteRegisteredExtensions( MSIHANDLE /*handle*/ ) +{ + OutputDebugStringFormat( "DeleteRegisteredExtensions\n" ); + + // remove all file extensions + int nIndex = 0; + while ( g_Extensions[nIndex] != 0 ) + { + RemoveExtensionInRegistry( g_Extensions[nIndex] ); + ++nIndex; + } + + return ERROR_SUCCESS; +} diff --git a/setup_native/source/win32/customactions/reg4msdoc/constants.hxx b/setup_native/source/win32/customactions/reg4msdoc/constants.hxx new file mode 100644 index 000000000000..f37c2060a601 --- /dev/null +++ b/setup_native/source/win32/customactions/reg4msdoc/constants.hxx @@ -0,0 +1,39 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + + #ifndef _CONSTANTS_HXX_ + #define _CONSTANTS_HXX_ + +extern const int MSWORD; +extern const int MSEXCEL; +extern const int MSPOWERPOINT; +extern const int DEFAULT_HTML_EDITOR_FOR_IE; +extern const int HTML_EDITOR; +extern const int DEFAULT_SHELL_HTML_EDITOR; + + #endif + diff --git a/setup_native/source/win32/customactions/reg4msdoc/exports.dxp b/setup_native/source/win32/customactions/reg4msdoc/exports.dxp new file mode 100644 index 000000000000..0f3d16886098 --- /dev/null +++ b/setup_native/source/win32/customactions/reg4msdoc/exports.dxp @@ -0,0 +1,3 @@ +InstallUiSequenceEntry +InstallExecSequenceEntry +DeinstallExecSequenceEntry diff --git a/setup_native/source/win32/customactions/reg4msdoc/makefile.mk b/setup_native/source/win32/customactions/reg4msdoc/makefile.mk new file mode 100644 index 000000000000..fe2bf60949be --- /dev/null +++ b/setup_native/source/win32/customactions/reg4msdoc/makefile.mk @@ -0,0 +1,96 @@ +#************************************************************************* +# +# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. +# +# Copyright 2000, 2010 Oracle and/or its affiliates. +# +# OpenOffice.org - a multi-platform office productivity suite +# +# This file is part of OpenOffice.org. +# +# OpenOffice.org is free software: you can redistribute it and/or modify +# it under the terms of the GNU Lesser General Public License version 3 +# only, as published by the Free Software Foundation. +# +# OpenOffice.org is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU Lesser General Public License version 3 for more details +# (a copy is included in the LICENSE file that accompanied this code). +# +# You should have received a copy of the GNU Lesser General Public License +# version 3 along with OpenOffice.org. If not, see +# <http://www.openoffice.org/license.html> +# for a copy of the LGPLv3 License. +# +#************************************************************************* + +PRJ=..$/..$/..$/.. +PRJNAME=setup_native +TARGET=reg4msdocmsi + +# --- Settings ----------------------------------------------------- + +ENABLE_EXCEPTIONS=TRUE +NO_DEFAULT_STL=TRUE +DYNAMIC_CRT= +USE_DEFFILE=TRUE +MINGW_NODLL=YES + +.INCLUDE : settings.mk + +CFLAGS+=-DUNICODE -D_UNICODE +.IF "$(USE_SYSTEM_STL)" != "YES" +CFLAGS+=-D_STLP_USE_STATIC_LIB +.ENDIF + +# --- Files -------------------------------------------------------- + +.IF "$(GUI)"=="WNT" + +UWINAPILIB= + +SLOFILES = $(SLO)$/msihelper.obj\ + $(SLO)$/windowsregistry.obj\ + $(SLO)$/userregistrar.obj\ + $(SLO)$/stringconverter.obj\ + $(SLO)$/registrywnt.obj\ + $(SLO)$/registryw9x.obj\ + $(SLO)$/registryvalueimpl.obj\ + $(SLO)$/registryexception.obj\ + $(SLO)$/registry.obj\ + $(SLO)$/registrationcontextinformation.obj\ + $(SLO)$/registrar.obj\ + $(SLO)$/register.obj\ + $(SLO)$/reg4msdocmsi.obj + +SHL1STDLIBS= $(KERNEL32LIB)\ + $(USER32LIB)\ + $(ADVAPI32LIB)\ + $(SHELL32LIB)\ + $(MSILIB)\ + $(SHLWAPILIB) + +.IF "$(USE_SYSTEM_STL)" != "YES" +SHL1STDLIBS+=$(LIBSTLPORTST) +.ENDIF + +SHL1LIBS = $(SLB)$/$(TARGET).lib + +SHL1TARGET = $(TARGET) +SHL1IMPLIB = i$(TARGET) + +SHL1DEF = $(MISC)$/$(SHL1TARGET).def +SHL1DEPN = $(SLB)$/$(TARGET).lib +SHL1BASE = 0x1c000000 +DEF1NAME=$(SHL1TARGET) +DEF1EXPORTFILE=exports.dxp + +.ENDIF + +# --- Targets -------------------------------------------------------------- + +.INCLUDE : target.mk + +# ------------------------------------------------------------------------- + diff --git a/setup_native/source/win32/customactions/reg4msdoc/msihelper.cxx b/setup_native/source/win32/customactions/reg4msdoc/msihelper.cxx new file mode 100644 index 000000000000..8cfc1fb08597 --- /dev/null +++ b/setup_native/source/win32/customactions/reg4msdoc/msihelper.cxx @@ -0,0 +1,102 @@ +#include "msihelper.hxx" + +#include <malloc.h> +#include <assert.h> + +bool GetMsiProp(MSIHANDLE handle, LPCTSTR name, /*out*/std::wstring& value) +{ + DWORD sz = 0; + LPTSTR dummy = TEXT(""); + if (MsiGetProperty(handle, name, dummy, &sz) == ERROR_MORE_DATA) + { + sz++; + DWORD nbytes = sz * sizeof(TCHAR); + LPTSTR buff = reinterpret_cast<LPTSTR>(_alloca(nbytes)); + ZeroMemory(buff, nbytes); + MsiGetProperty(handle, name, buff, &sz); + value = buff; + return true; + } + return false; +} + +void SetMsiProp(MSIHANDLE handle, LPCTSTR name) +{ + MsiSetProperty(handle, name, TEXT("1")); +} + +void UnsetMsiProp(MSIHANDLE handle, LPCTSTR name) +{ + MsiSetProperty(handle, name, TEXT("")); +} + +bool IsSetMsiProp(MSIHANDLE handle, LPCTSTR name) +{ + std::wstring val; + GetMsiProp(handle, name, val); + return (val == TEXT("1")); +} + +bool IsMsiPropNotEmpty(MSIHANDLE handle, LPCTSTR name) +{ + std::wstring val; + GetMsiProp(handle, name, val); + return (val != TEXT("")); +} + +bool IsAllUserInstallation(MSIHANDLE handle) +{ + return IsSetMsiProp(handle, TEXT("ALLUSERS")); +} + +std::wstring GetOfficeInstallationPath(MSIHANDLE handle) +{ + std::wstring progpath; + GetMsiProp(handle, TEXT("OFFICEINSTALLLOCATION"), progpath); + return progpath; +} + +std::wstring GetOfficeExecutablePath(MSIHANDLE handle) +{ + std::wstring exepath = GetOfficeInstallationPath(handle); + exepath += TEXT("program\\soffice.exe"); + return exepath; +} + +std::wstring GetProductName(MSIHANDLE handle) +{ + std::wstring prodname; + GetMsiProp(handle, TEXT("ProductName"), prodname); + return prodname; +} + +bool IsModuleInstalled(MSIHANDLE handle, LPCTSTR name) +{ + INSTALLSTATE current_state; + INSTALLSTATE future_state; + MsiGetFeatureState(handle, name, ¤t_state, &future_state); + return (current_state == INSTALLSTATE_LOCAL); +} + +bool IsModuleSelectedForInstallation(MSIHANDLE handle, LPCTSTR name) +{ + INSTALLSTATE current_state; + INSTALLSTATE future_state; + MsiGetFeatureState(handle, name, ¤t_state, &future_state); + return (future_state == INSTALLSTATE_LOCAL); +} + +bool IsModuleSelectedForDeinstallation(MSIHANDLE handle, LPCTSTR name) +{ + INSTALLSTATE current_state; + INSTALLSTATE future_state; + MsiGetFeatureState(handle, name, ¤t_state, &future_state); + return ((current_state == INSTALLSTATE_LOCAL) && (future_state == INSTALLSTATE_ABSENT)); +} + +bool IsCompleteDeinstallation(MSIHANDLE handle) +{ + std::wstring rm; + GetMsiProp(handle, TEXT("REMOVE"), rm); + return (rm == TEXT("ALL")); +} diff --git a/setup_native/source/win32/customactions/reg4msdoc/msihelper.hxx b/setup_native/source/win32/customactions/reg4msdoc/msihelper.hxx new file mode 100644 index 000000000000..6aa1af9f975b --- /dev/null +++ b/setup_native/source/win32/customactions/reg4msdoc/msihelper.hxx @@ -0,0 +1,184 @@ +#ifndef INCLUDED_MSIHELPER_HXX +#define INCLUDED_MSIHELPER_HXX + +#ifdef _MSC_VER +#pragma warning(push, 1) /* disable warnings within system headers */ +#endif +#define WIN32_LEAN_AND_MEAN +#include <windows.h> +#include <msiquery.h> +#ifdef _MSC_VER +#pragma warning(pop) +#endif + +#include <string> + +/** + Get the value of the named property + + @param handle + [in] a valid msi handle. + + @param name + [in] the name of the property. + + @param value + [out] receives thes value of the property. + + @returns + <TRUE/>if the property was found. +*/ +bool GetMsiProp(MSIHANDLE handle, LPCTSTR name, /*out*/std::wstring& value); + +/** + Set the value of a binary property which can only + have the values "0" or "1" to "1". + + @param handle + [in] a valid msi handle. + + @param name + [in] the name of the property. +*/ +void SetMsiProp(MSIHANDLE handle, LPCTSTR name); + +/** + Set the value of a binary property which can only + have the values "0" or "1" to "0". + + @param handle + [in] a valid msi handle. + + @param name + [in] the name of the property. +*/ +void UnsetMsiProp(MSIHANDLE handle, LPCTSTR name); + +/** + Returns whether a certain property is set meaning + its value is "1". This method should be used for + binary properties whose value can be "0" or "1". + + @returns + <TRUE/>if the value of the specified property is + "1" else if the property is not defined or its + value is other than "1" <FALSE/> will be returned. +*/ +bool IsSetMsiProp(MSIHANDLE handle, LPCTSTR name); + +/** + Returns whether a certain property is set meaning + its value is not empty. This method should be used for + properties, that can have different values. + + @returns + <TRUE/>if the value of the specified property is + not empty. If it is empty <FALSE/> will be returned. +*/ +bool IsMsiPropNotEmpty(MSIHANDLE handle, LPCTSTR name); + +/** + Query if this is an installation for all user or not. + + @param handle + [in] a valid msi handle. + + @returns + <TRUE/>if this is an all user installation +*/ +bool IsAllUserInstallation(MSIHANDLE handle); + +/** + Returns the destination folder of the office installation + as system path. The returned path contains a final '\'. + + @param handle + [in] a valid msi handle. + + @returns + the destination path of the office installation finalized + with a '\'. +*/ +std::wstring GetOfficeInstallationPath(MSIHANDLE handle); + +/** + Returns the absolute path of the office executable that + will be installed as system path. + + @param handle + [in] a valid msi handle. + + @returns + the absolute system path of the office executable (e.g. + (C:\Program Files\StarOffice 8\program\soffice.exe"). +*/ +std::wstring GetOfficeExecutablePath(MSIHANDLE handle); + +/** + Get the name of the office that will be installed + (e.g. StarOffice 8, StarSuite 8, ...). + + @param handle + [in] a valid msi handle. + + @returns + the name of the office product that will be installed. +*/ +std::wstring GetProductName(MSIHANDLE handle); + +/** + Determine if the specified module is installed locally. + + @param handle + [in] a valid msi handle. + + @param name + [in] the name of the module. + + @returns + <TRUE/>if the specified module is installed locally. +*/ +bool IsModuleInstalled(MSIHANDLE handle, LPCTSTR name); + +/** + Determine if the specified module is selected to be installed + locally. + + @param handle + [in] a valid msi handle. + + @param name + [in] the name of the module. + + @returns + <TRUE/>if the specified module is about to be installed locally. +*/ +bool IsModuleSelectedForInstallation(MSIHANDLE handle, LPCTSTR name); + +/** + Determine if the specified module which is locally installed is + selected for deinstallation. + + @param handle + [in] a valid msi handle. + + @param name + [in] the name of the module. + + @returns + <TRUE/>if the specified module is about to be deinstalled. +*/ +bool IsModuleSelectedForDeinstallation(MSIHANDLE handle, LPCTSTR name); + +/** + Determine whether this is a complete uninstallation or not. + + @param handle + [in] a valid msi handle. + + @returns + <TRUE/>if this is a complete deinstallation. +*/ +bool IsCompleteDeinstallation(MSIHANDLE handle); + +#endif diff --git a/setup_native/source/win32/customactions/reg4msdoc/reg4msdocmsi.cxx b/setup_native/source/win32/customactions/reg4msdoc/reg4msdocmsi.cxx new file mode 100644 index 000000000000..19623e77ebc3 --- /dev/null +++ b/setup_native/source/win32/customactions/reg4msdoc/reg4msdocmsi.cxx @@ -0,0 +1,189 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#ifdef _MSC_VER +#pragma warning(push, 1) /* disable warnings within system headers */ +#endif +#define WIN32_LEAN_AND_MEAN +#include <windows.h> +#include <msiquery.h> +#ifdef _MSC_VER +#pragma warning(pop) +#endif + +#include <tchar.h> +#include "register.hxx" +#include "msihelper.hxx" + +#include <memory> +#include <string> + +#define ELEMENTS_OF_ARRAY(a) (sizeof(a)/sizeof(a[0])) + +void DetermineWordPreselectionState(MSIHANDLE handle) +{ + if (query_preselect_registration_for_ms_application(handle, MSWORD)) + SetMsiProp(handle, TEXT("SELECT_WORD")); +} + +void DetermineExcelPreselectionState(MSIHANDLE handle) +{ + if (query_preselect_registration_for_ms_application(handle, MSEXCEL)) + SetMsiProp(handle, TEXT("SELECT_EXCEL")); +} + +void DeterminePowerPointPreselectionState(MSIHANDLE handle) +{ + if (query_preselect_registration_for_ms_application(handle, MSPOWERPOINT)) + SetMsiProp(handle, TEXT("SELECT_POWERPOINT")); +} + +extern "C" UINT __stdcall InstallUiSequenceEntry(MSIHANDLE handle) +{ + //MessageBox(NULL, TEXT("InstallUiSequenceEntry"), TEXT("Information"), MB_OK | MB_ICONINFORMATION); + + if (IsModuleSelectedForInstallation(handle, TEXT("gm_p_Wrt_Bin"))) + { + DetermineWordPreselectionState(handle); + } + else if (IsModuleInstalled(handle, TEXT("gm_p_Wrt_Bin")) && + !IsModuleSelectedForDeinstallation(handle, TEXT("gm_p_Wrt_Bin")) && + IsRegisteredFor(handle, MSWORD)) + { + SetMsiProp(handle, TEXT("SELECT_WORD")); + } + else + { + UnsetMsiProp(handle, TEXT("SELECT_WORD")); + } + + if (IsModuleSelectedForInstallation(handle, TEXT("gm_p_Calc_Bin"))) + { + DetermineExcelPreselectionState(handle); + } + else if (IsModuleInstalled(handle, TEXT("gm_p_Calc_Bin")) && + !IsModuleSelectedForDeinstallation(handle, TEXT("gm_p_Calc_Bin")) && + IsRegisteredFor(handle, MSEXCEL)) + { + SetMsiProp(handle, TEXT("SELECT_EXCEL")); + } + else + { + UnsetMsiProp(handle, TEXT("SELECT_EXCEL")); + } + + if (IsModuleSelectedForInstallation(handle, TEXT("gm_p_Impress_Bin"))) + { + DeterminePowerPointPreselectionState(handle); + } + else if (IsModuleInstalled(handle, TEXT("gm_p_Impress_Bin")) && + !IsModuleSelectedForDeinstallation(handle, TEXT("gm_p_Impress_Bin")) && + IsRegisteredFor(handle, MSPOWERPOINT)) + { + SetMsiProp(handle, TEXT("SELECT_POWERPOINT")); + } + else + { + UnsetMsiProp(handle, TEXT("SELECT_POWERPOINT")); + } + + SetMsiProp(handle, TEXT("UI_SEQUENCE_EXECUTED")); + + return ERROR_SUCCESS; +} + +extern "C" UINT __stdcall InstallExecSequenceEntry(MSIHANDLE handle) +{ + //MessageBox(NULL, TEXT("InstallExecSequenceEntry"), TEXT("Information"), MB_OK | MB_ICONINFORMATION); + + // Do nothing in repair mode. + // Then UI_SEQUENCE_EXECUTED is not set and Installed is set! + // In silent installation UI_SEQUENCE_EXECUTED is also not set, but Installed is not set. + if ((!IsSetMsiProp(handle, TEXT("UI_SEQUENCE_EXECUTED"))) && (IsMsiPropNotEmpty(handle, TEXT("Installed")))) { return ERROR_SUCCESS; } + + int reg4 = 0; + int unreg4 = 0; + + // we always register as html editor for Internet Explorer + // if writer is installed because there's no harm if we do so + if (IsModuleSelectedForInstallation(handle, TEXT("gm_p_Wrt_Bin"))) + reg4 |= HTML_EDITOR; + + if (IsSetMsiProp(handle, TEXT("SELECT_WORD")) && !IsRegisteredFor(handle, MSWORD)) + reg4 |= MSWORD; + else if (!IsSetMsiProp(handle, TEXT("SELECT_WORD")) && IsRegisteredFor(handle, MSWORD)) + unreg4 |= MSWORD; + + if (IsSetMsiProp(handle, TEXT("SELECT_EXCEL")) && !IsRegisteredFor(handle, MSEXCEL)) + reg4 |= MSEXCEL; + else if (!IsSetMsiProp(handle, TEXT("SELECT_EXCEL")) && IsRegisteredFor(handle, MSEXCEL)) + unreg4 |= MSEXCEL; + + if (IsSetMsiProp(handle, TEXT("SELECT_POWERPOINT")) && !IsRegisteredFor(handle, MSPOWERPOINT)) + reg4 |= MSPOWERPOINT; + else if (!IsSetMsiProp(handle, TEXT("SELECT_POWERPOINT")) && IsRegisteredFor(handle, MSPOWERPOINT)) + unreg4 |= MSPOWERPOINT; + + if (reg4) + { + Register4MsDoc(handle, reg4); + } + + if (unreg4) + { + Unregister4MsDoc(handle, unreg4); + } + return ERROR_SUCCESS; +} + +extern "C" UINT __stdcall DeinstallExecSequenceEntry(MSIHANDLE handle) +{ + //MessageBox(NULL, TEXT("DeinstallExecSequenceEntry"), TEXT("Information"), MB_OK | MB_ICONINFORMATION); + + if (IsCompleteDeinstallation(handle)) + { + Unregister4MsDocAll(handle); + return ERROR_SUCCESS; + } + + if (IsModuleSelectedForDeinstallation(handle, TEXT("gm_p_Wrt_Bin"))) + { + Unregister4MsDoc(handle, MSWORD | HTML_EDITOR); + } + + if (IsModuleSelectedForDeinstallation(handle, TEXT("gm_p_Calc_Bin"))) + { + Unregister4MsDoc(handle, MSEXCEL); + } + + if (IsModuleSelectedForDeinstallation(handle, TEXT("gm_p_Impress_Bin"))) + { + Unregister4MsDoc(handle, MSPOWERPOINT); + } + + return ERROR_SUCCESS; +} diff --git a/setup_native/source/win32/customactions/reg4msdoc/register.cxx b/setup_native/source/win32/customactions/reg4msdoc/register.cxx new file mode 100644 index 000000000000..77d091806acd --- /dev/null +++ b/setup_native/source/win32/customactions/reg4msdoc/register.cxx @@ -0,0 +1,340 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#include "register.hxx" +#include "registryexception.hxx" +#include "registrationcontextinformation.hxx" +#include "userregistrar.hxx" +#include "windowsregistry.hxx" +#include "stringconverter.hxx" +#include "msihelper.hxx" + +#ifdef _MSC_VER +#pragma warning(push, 1) /* disable warnings within system headers */ +#pragma warning(disable: 4917) +#endif +#include <shlobj.h> +#ifdef _MSC_VER +#pragma warning(pop) +#endif + + +#include <assert.h> +#ifdef _MSC_VER +#pragma warning(disable: 4350) +#endif + +typedef std::auto_ptr<Registrar> RegistrarPtr; + +namespace /* private */ +{ + RegistrarPtr CreateRegistrar(bool InstallForAllUser, const RegistrationContextInformation& RegCtx) + { + RegistrarPtr RegPtr; + + if (InstallForAllUser) + RegPtr = RegistrarPtr(new Registrar(RegCtx)); + else + RegPtr = RegistrarPtr(new UserRegistrar(RegCtx)); + + return RegPtr; + } +} // namespace private + +bool query_preselect_registration_for_ms_application(MSIHANDLE handle, int Register) +{ + bool preselect = false; + + try + { + RegistrationContextInformation RegContext(handle, GetOfficeExecutablePath(handle)); + RegistrarPtr CurrentRegistrar = CreateRegistrar(IsAllUserInstallation(handle), RegContext); + + if (Register & MSWORD) + preselect = CurrentRegistrar->QueryPreselectMsWordRegistration(); + else if (Register & MSEXCEL) + preselect = CurrentRegistrar->QueryPreselectMsExcelRegistration(); + else if (Register & MSPOWERPOINT) + preselect = CurrentRegistrar->QueryPreselectMsPowerPointRegistration(); + } + catch(RegistryException&) + { + assert(false); + } + return preselect; +} + +//----------------------------------------- +// registers StarOffice for MS document +// types and as default HTML editor if +// specified +//----------------------------------------- + +void Register4MsDoc(MSIHANDLE handle, int Register) +{ + try + { + RegistrationContextInformation RegContext(handle, GetOfficeExecutablePath(handle)); + RegistrarPtr CurrentRegistrar = CreateRegistrar(IsAllUserInstallation(handle), RegContext); + + if ((Register & MSWORD)) + CurrentRegistrar->RegisterForMsWord(); + + if ((Register & MSEXCEL)) + CurrentRegistrar->RegisterForMsExcel(); + + if ((Register & MSPOWERPOINT)) + CurrentRegistrar->RegisterForMsPowerPoint(); + + if ((Register & HTML_EDITOR)) + CurrentRegistrar->RegisterAsHtmlEditorForInternetExplorer(); + + if ((Register & DEFAULT_SHELL_HTML_EDITOR)) + { + CurrentRegistrar->RegisterAsDefaultHtmlEditorForInternetExplorer(); + CurrentRegistrar->RegisterAsDefaultShellHtmlEditor(); + } + } + catch(RegistryException&) + { + assert(false); + } + + if (Register) + SHChangeNotify(SHCNE_ASSOCCHANGED, SHCNF_IDLIST, 0, 0); +} + +void Unregister4MsDoc(MSIHANDLE handle, int Unregister) +{ + try + { + RegistrationContextInformation RegContext(handle, GetOfficeExecutablePath(handle)); + RegistrarPtr CurrentRegistrar = CreateRegistrar(IsAllUserInstallation(handle), RegContext); + + if ((Unregister & MSWORD) && CurrentRegistrar->IsRegisteredFor(MSWORD)) + CurrentRegistrar->UnregisterForMsWord(); + + if ((Unregister & HTML_EDITOR) && CurrentRegistrar->IsRegisteredFor(HTML_EDITOR)) + CurrentRegistrar->UnregisterAsHtmlEditorForInternetExplorer(); + + if ((Unregister & MSEXCEL) && CurrentRegistrar->IsRegisteredFor(MSEXCEL)) + CurrentRegistrar->UnregisterForMsExcel(); + + if ((Unregister & MSPOWERPOINT) && CurrentRegistrar->IsRegisteredFor(MSPOWERPOINT)) + CurrentRegistrar->UnregisterForMsPowerPoint(); + + if ((Unregister & DEFAULT_HTML_EDITOR_FOR_IE) && CurrentRegistrar->IsRegisteredFor(DEFAULT_HTML_EDITOR_FOR_IE)) + CurrentRegistrar->UnregisterAsDefaultHtmlEditorForInternetExplorer(); + + if ((Unregister & DEFAULT_SHELL_HTML_EDITOR) && CurrentRegistrar->IsRegisteredFor(DEFAULT_SHELL_HTML_EDITOR)) + CurrentRegistrar->UnregisterAsDefaultShellHtmlEditor(); + } + catch(RegistryException&) + { + assert(false); + } + + if (Unregister) + SHChangeNotify(SHCNE_ASSOCCHANGED, SHCNF_IDLIST, 0, 0); +} + +//----------------------------------------- +// restores the entries for the selected +// registry entries +// Algorithm: +// +// 1. +// Target key exist (e.g. '.doc') +// Default value == soffice.? +// Backup key != empty +// Action: Replace Default value with backup +// key +// +// 2. +// Target key exist +// Default value == soffice.? +// Backup key == empty +// Action: delete default value +// +// 3. +// Target key exist +// Default value != soffice.? +// Action: nop +// +// 4. +// Target key does not exist +// Action: nop +//----------------------------------------- + +void Unregister4MsDocAll(MSIHANDLE handle) +{ + try + { + RegistrationContextInformation RegContext(handle, GetOfficeExecutablePath(handle)); + RegistrarPtr CurrentRegistrar = CreateRegistrar(IsAllUserInstallation(handle), RegContext); + + CurrentRegistrar->UnregisterAllAndCleanUpRegistry(); + } + catch(RegistryException&) + { + assert(false); + } +} + +//----------------------------------------- +// restores lost settings formerly made +// with Register4MsDoc +//----------------------------------------- + +void RepairRegister4MsDocSettings(MSIHANDLE handle) +{ + try + { + RegistrationContextInformation RegContext(handle, GetOfficeExecutablePath(handle)); + RegistrarPtr CurrentRegistrar = CreateRegistrar(IsAllUserInstallation(handle), RegContext); + + CurrentRegistrar->RepairRegistrationState(); + } + catch(RegistryException&) + { + assert(false); + } +} + +bool IsRegisteredFor(MSIHANDLE handle, int State) +{ + bool Registered = false; + + try + { + RegistrationContextInformation RegContext(handle, GetOfficeExecutablePath(handle)); + RegistrarPtr CurrentRegistrar = CreateRegistrar(IsAllUserInstallation(handle), RegContext); + + Registered = CurrentRegistrar->IsRegisteredFor(State); + } + catch(RegistryException&) + { + assert(false); + } + return Registered; +} + +#define SO60_UNINSTALL_KEY L"Software\\Microsoft\\Windows\\CurrentVersion\\Uninstall\\StarOffice 6.0" +#define SO_BACKUP_KEY L"soffice6.bak" +#define REGMSDOCSTATE L"Reg4MsDocState" +#define SOFTWARE_CLASSES L"Software\\Classes" + +int FixReturnRegistrationState(MSIHANDLE handle) +{ + int registration_state = 0; + + try + { + WindowsRegistry registry; + + RegistryValue rv_regmsdocstate = RegistryValue( + new RegistryValueImpl(REGMSDOCSTATE, 0)); + + RegistryKey so_bak_key; + + if (IsAllUserInstallation(handle)) + { + RegistryKey hkcr_key = registry.GetClassesRootKey(); + + if (hkcr_key->HasSubKey(SO_BACKUP_KEY)) + so_bak_key = hkcr_key->OpenSubKey(SO_BACKUP_KEY); + else + so_bak_key = hkcr_key->CreateSubKey(SO_BACKUP_KEY); + + if (!so_bak_key->HasValue(REGMSDOCSTATE)) + { + // set a defined value + so_bak_key->SetValue(rv_regmsdocstate); + + RegistryKey hklm_key = registry.GetLocalMachineKey(); + + if (hklm_key->HasSubKey(SO60_UNINSTALL_KEY)) + { + RegistryKey so_uninst_key = + hklm_key->OpenSubKey(SO60_UNINSTALL_KEY); + + if (so_uninst_key->HasValue(REGMSDOCSTATE)) + so_bak_key->CopyValue(so_uninst_key, REGMSDOCSTATE); + } + } + } + else + { + RegistryKey hkcu_classes_key = + registry.GetCurrentUserKey()->OpenSubKey(SOFTWARE_CLASSES); + + so_bak_key = hkcu_classes_key->CreateSubKey(SO_BACKUP_KEY); + + if (!so_bak_key->HasValue(REGMSDOCSTATE)) + { + // set a defined value + so_bak_key->SetValue(rv_regmsdocstate); + + RegistryKey hklm_sftw_classes = + registry.GetLocalMachineKey()->OpenSubKey(SOFTWARE_CLASSES, false); + + RegistryKey so_bak_key_old; + + if (hklm_sftw_classes->HasSubKey(SO_BACKUP_KEY)) + { + so_bak_key_old = hklm_sftw_classes->OpenSubKey(SO_BACKUP_KEY, false); + + if (so_bak_key_old->HasValue(REGMSDOCSTATE)) + so_bak_key->CopyValue(so_bak_key_old, REGMSDOCSTATE); + } + else // try the uninstall key + { + RegistryKey hklm_key = registry.GetLocalMachineKey(); + + if (hklm_key->HasSubKey(SO60_UNINSTALL_KEY)) + { + RegistryKey so_uninst_key = + hklm_key->OpenSubKey(SO60_UNINSTALL_KEY); + + if (so_uninst_key->HasValue(REGMSDOCSTATE)) + so_bak_key->CopyValue(so_uninst_key, REGMSDOCSTATE); + } + } + } + } + + rv_regmsdocstate = so_bak_key->GetValue(REGMSDOCSTATE); + registration_state = rv_regmsdocstate->GetDataAsInt(); + } + catch(RegistryException&) + { + registration_state = 0; + } + + return registration_state; +} + diff --git a/setup_native/source/win32/customactions/reg4msdoc/register.hxx b/setup_native/source/win32/customactions/reg4msdoc/register.hxx new file mode 100644 index 000000000000..29b9e8bdae00 --- /dev/null +++ b/setup_native/source/win32/customactions/reg4msdoc/register.hxx @@ -0,0 +1,84 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#ifndef _REGISTER_HXX_ +#define _REGISTER_HXX_ + +#ifndef _CONSTANTS_HXX_ +#include "constants.hxx" +#endif + +#ifdef _MSC_VER +#pragma warning(push, 1) /* disable warnings within system headers */ +#endif +#define WIN32_LEAN_AND_MEAN +#include <windows.h> +#include <msi.h> +#ifdef _MSC_VER +#pragma warning(pop) +#endif + +#include <string> + +const int MOD_WRITER = 0x1; +const int MOD_CALC = 0x2; +const int MOD_IMPRESS = 0x4; +const int MOD_ACTIVEX = 0x40; + +/* registers StarOffice for MS document + types and as default HTML editor if + specified */ +void Register4MsDoc(MSIHANDLE handle, int Register); + +void Unregister4MsDoc(MSIHANDLE handle, int Unregister); + +/* restores the entries for the selected + registry entries */ +void Unregister4MsDocAll(MSIHANDLE handle); + +/* restores lost settings formerly made + with Register4MsDoc */ +void RepairRegister4MsDocSettings(MSIHANDLE handle); + +/** Returns whether we are registered for */ +bool IsRegisteredFor(MSIHANDLE handle, int State); + +/** Returns whether we should preselect the + registration checkbox for a certain + application type or not */ +bool query_preselect_registration_for_ms_application( + MSIHANDLE handle, int Register); + +// StarOffice 6.0 saved the registration +// state in HKEY_LOCAL_MACHINE\Software\ +// Microsoft\Windows\CurrentVersion\Uninstall\ +// StarOffice 6.0\Reg4MsdocState we move this +// value if available to the new registry +// location +int FixReturnRegistrationState(MSIHANDLE handle); + +#endif diff --git a/setup_native/source/win32/customactions/reg4msdoc/registrar.cxx b/setup_native/source/win32/customactions/reg4msdoc/registrar.cxx new file mode 100644 index 000000000000..7919d0fe833d --- /dev/null +++ b/setup_native/source/win32/customactions/reg4msdoc/registrar.cxx @@ -0,0 +1,759 @@ +// Registrar.cpp: Implementierung der Klasse Registrar. +// +////////////////////////////////////////////////////////////////////// + +#include "registrar.hxx" + +#ifndef _REGISTRYVALUEIMPL_HXX_ +#include "RegistryValueImpl.hxx" +#endif +#include "windowsregistry.hxx" +#include "registryexception.hxx" + +#include <assert.h> +#ifdef _MSC_VER +#pragma warning(disable: 4350 4482) +#include "strsafe.h" +#endif + +//---------------------------------------------------------- +#ifdef DEBUG +inline void OutputDebugStringFormat( LPCTSTR pFormat, ... ) +{ + TCHAR buffer[1024]; + va_list args; + + va_start( args, pFormat ); + StringCchVPrintf( buffer, sizeof(buffer), pFormat, args ); + OutputDebugString( buffer ); +} +#else +static inline void OutputDebugStringFormat( LPCTSTR, ... ) +{ +} +#endif +//---------------------------------------------------------- + +const int MSWORD = 0x1; +const int MSEXCEL = 0x2; +const int MSPOWERPOINT = 0x4; +const int DEFAULT_HTML_EDITOR_FOR_IE = 0x8; +const int HTML_EDITOR = 0x10; +const int DEFAULT_SHELL_HTML_EDITOR = 0x20; + +namespace /* private */ +{ + const std::wstring HTM_OPENWITHLIST = L".htm\\OpenWithList"; + const std::wstring APPLICATIONS = L"Applications"; + const std::wstring SHELL_EDIT_COMMAND = L"shell\\edit\\command"; + const std::wstring HTML_EDIT = L"HTML Edit"; + const std::wstring HTML_EDIT_DISPLAY_NAME = L"Edit Display Name"; + const std::wstring SHELL_EDIT_COMMAND_BACKUP = L"Shell Edit Cmd"; + const std::wstring DEFAULT_HTML_EDITOR = L"Default HTML Editor"; + const std::wstring MS_IE_DEF_HTML_EDITOR = L"Software\\Microsoft\\Internet Explorer\\Default HTML Editor"; + const std::wstring MS_IE_DEF_HTML_EDITOR_SHL_EDIT_CMD = L"Software\\Microsoft\\Internet Explorer\\Default HTML Editor\\shell\\edit\\command"; +} + +Registrar::Registrar(const RegistrationContextInformation& RegContext) : + m_ContextInformation(RegContext), + FORWARD_KEY_PREFIX(L"OpenOffice.org"),//FORWARD_KEY_PREFIX(L"soffice6"), + DEFAULT_VALUE_NAME(L""), + BACKUP_VALUE_NAME(L"Backup"), + PRIVATE_BACKUP_KEY_NAME(L"OpenOffice.org.reg4msdocmsi"),//PRIVATE_BACKUP_KEY_NAME(L"soffice6.bak"), + REGISTRATION_STATE(L"Reg4MsDocState") +{ + m_RootKey = WindowsRegistry().GetClassesRootKey(); +} + +Registrar::~Registrar() +{ +} + +void Registrar::RegisterForMsWord() const +{ + assert(m_RootKey.get()); + + RegisterForMsOfficeApplication( + m_ContextInformation.GetWordDocumentFileExtension(), + m_ContextInformation.GetWordDocumentDisplayName(), + m_ContextInformation.GetWordDocumentDefaultIconEntry(), + m_ContextInformation.GetWordDocumentDefaultShellCommand(), + m_ContextInformation.ShellNewCommandDisplayName(), + RegistrationContextInformation::Writer); + + RegisterForMsOfficeApplication( + m_ContextInformation.GetWordTemplateFileExtension(), + m_ContextInformation.GetWordTemplateDisplayName(), + m_ContextInformation.GetWordTemplateDefaultIconEntry(), + m_ContextInformation.GetWordTemplateDefaultShellCommand(), + m_ContextInformation.ShellNewCommandDisplayName(), + RegistrationContextInformation::Writer); + + RegisterForMsOfficeApplication( + m_ContextInformation.GetRtfDocumentFileExtension(), + m_ContextInformation.GetRtfDocumentDisplayName(), + m_ContextInformation.GetRtfDocumentDefaultIconEntry(), + m_ContextInformation.GetRtfDocumentDefaultShellCommand(), + m_ContextInformation.ShellNewCommandDisplayName(), + RegistrationContextInformation::Writer); + + SaveRegisteredFor(MSWORD); +} + +void Registrar::UnregisterForMsWord() const +{ + assert(m_RootKey.get()); + + try + { + UnregisterForMsOfficeApplication( + m_ContextInformation.GetWordDocumentFileExtension()); + } + catch(RegistryKeyNotFoundException&) + {} + + try + { + UnregisterForMsOfficeApplication( + m_ContextInformation.GetWordTemplateFileExtension()); + } + catch(RegistryKeyNotFoundException&) + {} + + try + { + UnregisterForMsOfficeApplication( + m_ContextInformation.GetRtfDocumentFileExtension()); + } + catch(RegistryKeyNotFoundException&) + {} + + SaveNotRegisteredFor(MSWORD); +} + +bool Registrar::QueryPreselectForMsApplication(const std::wstring& file_extension) const +{ + bool preselect = false; + + // We use HKCR else we would not see that a registration for + // MS Office applications already exist if we are about to + // register in HKCU\Software\Classes + RegistryKey root_key = WindowsRegistry().GetClassesRootKey(); + + if (!root_key->HasSubKey(file_extension)) + { + preselect = true; + OutputDebugStringFormat( TEXT("QueryPreselect: No SubKey found for (%s), preselected!\n"), file_extension.c_str() ); + } + else + { + RegistryKey RegKey = root_key->OpenSubKey(file_extension, false); + + if (RegKey->HasValue(DEFAULT_VALUE_NAME)) + { + RegistryValue RegVal = RegKey->GetValue(DEFAULT_VALUE_NAME); + + if (REG_SZ == RegVal->GetType() && + IsOpenOfficeRegisteredForMsApplication(RegVal->GetDataAsUniString())) + { + preselect = true; + OutputDebugStringFormat( TEXT("QueryPreselect: (%s) registered to Office, preselected!\n"), file_extension.c_str() ); + } + else if ( (REG_SZ == RegVal->GetType()) && ! root_key->HasSubKey( RegVal->GetDataAsUniString() ) ) + { + preselect = true; + OutputDebugStringFormat( TEXT("QueryPreselect: (%s) registered but destination is empty, preselected!\n"), file_extension.c_str() ); + } + } + else + { + preselect = true; + OutputDebugStringFormat( TEXT("QueryPreselect: No default found for SubKey (%s), preselected!\n"), file_extension.c_str() ); + } + } + return preselect; +} + +bool Registrar::QueryPreselectMsWordRegistration() const +{ + return QueryPreselectForMsApplication( + m_ContextInformation.GetWordDocumentFileExtension()); +} + +void Registrar::RegisterForMsExcel() const +{ + assert(m_RootKey.get()); + + RegisterForMsOfficeApplication( + m_ContextInformation.GetExcelSheetFileExtension(), + m_ContextInformation.GetExcelSheetDisplayName(), + m_ContextInformation.GetExcelSheetDefaultIconEntry(), + m_ContextInformation.GetExcelSheetDefaultShellCommand(), + m_ContextInformation.ShellNewCommandDisplayName(), + RegistrationContextInformation::Calc); + + RegisterForMsOfficeApplication( + m_ContextInformation.GetExcelTemplateFileExtension(), + m_ContextInformation.GetExcelTemplateDisplayName(), + m_ContextInformation.GetExcelTemplateDefaultIconEntry(), + m_ContextInformation.GetExcelTemplateDefaultShellCommand(), + m_ContextInformation.ShellNewCommandDisplayName(), + RegistrationContextInformation::Calc); + + SaveRegisteredFor(MSEXCEL); +} + +void Registrar::UnregisterForMsExcel() const +{ + assert(m_RootKey.get()); + + try + { + UnregisterForMsOfficeApplication( + m_ContextInformation.GetExcelSheetFileExtension()); + } + catch(RegistryKeyNotFoundException&) + {} + + try + { + UnregisterForMsOfficeApplication( + m_ContextInformation.GetExcelTemplateFileExtension()); + } + catch(RegistryKeyNotFoundException&) + {} + + SaveNotRegisteredFor(MSEXCEL); +} + +bool Registrar::QueryPreselectMsExcelRegistration() const +{ + return QueryPreselectForMsApplication( + m_ContextInformation.GetExcelSheetFileExtension()); +} + +void Registrar::RegisterForMsPowerPoint() const +{ + assert(m_RootKey.get()); + + RegisterForMsOfficeApplication( + m_ContextInformation.GetPowerPointDocumentFileExtension(), + m_ContextInformation.GetPowerPointDocumentDisplayName(), + m_ContextInformation.GetPowerPointDocumentDefaultIconEntry(), + m_ContextInformation.GetPowerPointDocumentDefaultShellCommand(), + m_ContextInformation.ShellNewCommandDisplayName(), + RegistrationContextInformation::Impress); + + RegisterForMsOfficeApplication( + m_ContextInformation.GetPowerPointShowFileExtension(), + m_ContextInformation.GetPowerPointShowDisplayName(), + m_ContextInformation.GetPowerPointShowDefaultIconEntry(), + m_ContextInformation.GetPowerPointShowDefaultShellCommand(), + m_ContextInformation.ShellNewCommandDisplayName(), + RegistrationContextInformation::Impress); + + RegisterForMsOfficeApplication( + m_ContextInformation.GetPowerPointTemplateFileExtension(), + m_ContextInformation.GetPowerPointTemplateDisplayName(), + m_ContextInformation.GetPowerPointTemplateDefaultIconEntry(), + m_ContextInformation.GetPowerPointTemplateDefaultShellCommand(), + m_ContextInformation.ShellNewCommandDisplayName(), + RegistrationContextInformation::Impress); + + SaveRegisteredFor(MSPOWERPOINT); +} + +void Registrar::UnregisterForMsPowerPoint() const +{ + assert(m_RootKey.get()); + + try + { + UnregisterForMsOfficeApplication( + m_ContextInformation.GetPowerPointDocumentFileExtension()); + } + catch(RegistryKeyNotFoundException&) + {} + + try + { + UnregisterForMsOfficeApplication( + m_ContextInformation.GetPowerPointShowFileExtension()); + } + catch(RegistryKeyNotFoundException&) + {} + + try + { + UnregisterForMsOfficeApplication( + m_ContextInformation.GetPowerPointTemplateFileExtension()); + } + catch(RegistryKeyNotFoundException&) + {} + + SaveNotRegisteredFor(MSPOWERPOINT); +} + +//----------------------------------------- +/* +*/ +bool Registrar::QueryPreselectMsPowerPointRegistration() const +{ + return QueryPreselectForMsApplication( m_ContextInformation.GetPowerPointDocumentFileExtension()) && + QueryPreselectForMsApplication( m_ContextInformation.GetPowerPointShowFileExtension()); +} + +//----------------------------------------- +/** The documentation says we have to + make the following entries to register + a html editor for the Internet Explorer + HKCR\.htm\OpenWithList\App Friendly Name\shell\edit\command + But the reality shows that this works only + with Internet Explorer 5.x + Internet Explorer 6.0 wants the follwoing + entries: + HKCR\.htm\OpenWithList\App.exe + HKCR\Applications\App.ex\shell\edit\command +*/ +void Registrar::RegisterAsHtmlEditorForInternetExplorer() const +{ + assert(m_RootKey.get()); + + std::wstring OOFriendlyAppName = m_ContextInformation.GetOpenOfficeFriendlyAppName(); + + std::wstring RegKeyName = HTM_OPENWITHLIST + std::wstring(L"\\") + OOFriendlyAppName; + RegistryKey RegKey = m_RootKey->CreateSubKey(RegKeyName); + + RegKey = RegKey->CreateSubKey(SHELL_EDIT_COMMAND); + + RegistryValue RegVal( + new RegistryValueImpl( + DEFAULT_VALUE_NAME, + m_ContextInformation.GetOpenOfficeCommandline(RegistrationContextInformation::Open, + RegistrationContextInformation::Writer))); + + RegKey->SetValue(RegVal); + + RegKeyName = APPLICATIONS + std::wstring(L"\\") + OOFriendlyAppName; + RegKey = m_RootKey->CreateSubKey(RegKeyName); + + RegVal->SetName(L"FriendlyAppName"); + RegVal->SetValue(OOFriendlyAppName); + RegKey->SetValue(RegVal); + + RegKey = RegKey->CreateSubKey(SHELL_EDIT_COMMAND); + RegVal->SetName(DEFAULT_VALUE_NAME); + RegVal->SetValue( + m_ContextInformation.GetOpenOfficeCommandline(RegistrationContextInformation::Open, + RegistrationContextInformation::Writer)); + RegKey->SetValue(RegVal); + + SaveRegisteredFor(HTML_EDITOR); +} + +void Registrar::UnregisterAsHtmlEditorForInternetExplorer() const +{ + assert(m_RootKey.get()); + + try + { + std::wstring OOFriendlyAppName = m_ContextInformation.GetOpenOfficeFriendlyAppName(); + + RegistryKey aRegKey = m_RootKey->OpenSubKey( APPLICATIONS ); + if ( aRegKey->HasSubKey( OOFriendlyAppName ) ) + aRegKey->DeleteSubKeyTree( OOFriendlyAppName ); + + aRegKey = m_RootKey->OpenSubKey( HTM_OPENWITHLIST ); + if ( aRegKey->HasSubKey( OOFriendlyAppName ) ) + aRegKey->DeleteSubKeyTree( OOFriendlyAppName ); + } + catch(RegistryKeyNotFoundException&) + {} + + SaveNotRegisteredFor(HTML_EDITOR); +} + +void Registrar::RegisterAsDefaultHtmlEditorForInternetExplorer() const +{ + assert(m_RootKey.get()); + + RegistryKey RegistrationRootKey = GetRootKeyForDefHtmlEditorForIERegistration(); + + RegistryKey RegKey = RegistrationRootKey->CreateSubKey(MS_IE_DEF_HTML_EDITOR_SHL_EDIT_CMD); + + RegistryValue RegVal = RegistryValue(new RegistryValueImpl(DEFAULT_VALUE_NAME, L"")); + + if (RegKey->HasValue(DEFAULT_VALUE_NAME)) + { + RegVal = RegKey->GetValue(DEFAULT_VALUE_NAME); + + std::wstring CmdLine = RegVal->GetDataAsUniString(); + + if (std::wstring::npos == CmdLine.find(m_ContextInformation.GetOpenOfficeExecutableName())) + { + RegistryKey BackupRegKey = m_RootKey->CreateSubKey(PRIVATE_BACKUP_KEY_NAME + L"\\" + DEFAULT_HTML_EDITOR); + + if (RegKey->HasValue(DEFAULT_VALUE_NAME)) + BackupRegKey->CopyValue(RegKey, DEFAULT_VALUE_NAME); + + RegKey = RegistrationRootKey->OpenSubKey(MS_IE_DEF_HTML_EDITOR); + if (RegKey->HasValue(L"Description")) + BackupRegKey->CopyValue(RegKey, L"Description"); + } + } + + RegVal->SetValue( + m_ContextInformation.GetOpenOfficeCommandline(RegistrationContextInformation::Open, + RegistrationContextInformation::Writer)); + RegKey = RegistrationRootKey->OpenSubKey(MS_IE_DEF_HTML_EDITOR_SHL_EDIT_CMD); + RegKey->SetValue(RegVal); + + RegVal->SetName(L"Description"); + RegVal->SetValue(m_ContextInformation.GetOpenOfficeFriendlyAppName()); + RegKey = RegistrationRootKey->OpenSubKey(MS_IE_DEF_HTML_EDITOR); + RegKey->SetValue(RegVal); + + SaveRegisteredFor(DEFAULT_HTML_EDITOR_FOR_IE); +} + +void Registrar::UnregisterAsDefaultHtmlEditorForInternetExplorer() const +{ + assert(m_RootKey.get()); + + RegistryKey RegistrationRootKey = GetRootKeyForDefHtmlEditorForIERegistration(); + + RegistryKey RegKey = RegistrationRootKey->OpenSubKey(MS_IE_DEF_HTML_EDITOR_SHL_EDIT_CMD); + + if (RegKey->HasValue(DEFAULT_VALUE_NAME)) + { + RegistryValue RegVal = RegKey->GetValue(DEFAULT_VALUE_NAME); + + std::wstring CmdLine = RegVal->GetDataAsUniString(); + + if (std::wstring::npos != CmdLine.find(m_ContextInformation.GetOpenOfficeExecutableName())) + { + RegistryKey BackupRegKey = m_RootKey->OpenSubKey(PRIVATE_BACKUP_KEY_NAME); + + if (BackupRegKey->HasSubKey(DEFAULT_HTML_EDITOR)) + { + BackupRegKey = BackupRegKey->OpenSubKey(DEFAULT_HTML_EDITOR); + + if (BackupRegKey->HasValue(DEFAULT_VALUE_NAME)) + RegKey->CopyValue(BackupRegKey, DEFAULT_VALUE_NAME); + else + RegKey->DeleteValue(DEFAULT_VALUE_NAME); + + RegKey = RegistrationRootKey->OpenSubKey(MS_IE_DEF_HTML_EDITOR); + + if (BackupRegKey->HasValue(L"Description")) + RegKey->CopyValue(BackupRegKey, L"Description"); + else + RegKey->DeleteValue(L"Description"); + } + else + { + RegKey->DeleteValue(DEFAULT_VALUE_NAME); + RegKey = RegistrationRootKey->OpenSubKey(MS_IE_DEF_HTML_EDITOR); + RegKey->DeleteValue(L"Description"); + } + } + } + + SaveNotRegisteredFor(DEFAULT_HTML_EDITOR_FOR_IE); +} + +void Registrar::RegisterAsDefaultShellHtmlEditor() const +{ + assert(m_RootKey.get()); + + RegistryKey RegKey = m_RootKey->CreateSubKey(L".htm"); + + RegistryValue RegVal = RegistryValue( + new RegistryValueImpl(DEFAULT_VALUE_NAME, L"")); + + if (RegKey->HasValue(DEFAULT_VALUE_NAME)) + RegVal = RegKey->GetValue(DEFAULT_VALUE_NAME); + + std::wstring HtmFwdKey = RegVal->GetDataAsUniString(); + if (0 == HtmFwdKey.length() || !m_RootKey->HasSubKey(HtmFwdKey)) + HtmFwdKey = L".htm"; + + RegKey = m_RootKey->CreateSubKey(HtmFwdKey + L"\\" + SHELL_EDIT_COMMAND); + + if (RegKey->HasValue(DEFAULT_VALUE_NAME)) + { + RegVal = RegKey->GetValue(DEFAULT_VALUE_NAME); + + std::wstring CmdLine = RegVal->GetDataAsUniString(); + + // backup old values if we are not in place + if (std::wstring::npos == CmdLine.find(m_ContextInformation.GetOpenOfficeExecutableName())) + { + RegistryKey BackupRegKey = m_RootKey->CreateSubKey(PRIVATE_BACKUP_KEY_NAME + L"\\" + HTML_EDIT); + BackupRegKey->CopyValue(RegKey, DEFAULT_VALUE_NAME, SHELL_EDIT_COMMAND_BACKUP); + } + } + + RegVal->SetValue( + m_ContextInformation.GetOpenOfficeCommandline(RegistrationContextInformation::Open, + RegistrationContextInformation::Writer)); + + RegKey->SetValue(RegVal); + + SaveRegisteredFor(DEFAULT_SHELL_HTML_EDITOR); +} + +void Registrar::UnregisterAsDefaultShellHtmlEditor() const +{ + assert(m_RootKey.get()); + + try + { + RegistryKey RegKey = m_RootKey->OpenSubKey(L".htm"); + + RegistryValue RegVal = RegistryValue( + new RegistryValueImpl(DEFAULT_VALUE_NAME, L"")); + + if (RegKey->HasValue(DEFAULT_VALUE_NAME)) + RegVal = RegKey->GetValue(DEFAULT_VALUE_NAME); + + std::wstring HtmFwdKey = RegVal->GetDataAsUniString(); + + if (0 == HtmFwdKey.length() || !m_RootKey->HasSubKey(HtmFwdKey)) + HtmFwdKey = L".htm"; + + RegKey = m_RootKey->OpenSubKey(HtmFwdKey + L"\\" + SHELL_EDIT_COMMAND); + + RegVal = RegKey->GetValue(DEFAULT_VALUE_NAME); + + std::wstring CmdLine = RegVal->GetDataAsUniString(); + + if (std::wstring::npos != CmdLine.find(m_ContextInformation.GetOpenOfficeExecutableName())) + { + RegistryKey BackupRegKey = m_RootKey->CreateSubKey(PRIVATE_BACKUP_KEY_NAME + L"\\" + HTML_EDIT); + + if (BackupRegKey->HasValue(SHELL_EDIT_COMMAND_BACKUP)) + RegKey->CopyValue(BackupRegKey, SHELL_EDIT_COMMAND_BACKUP, DEFAULT_VALUE_NAME); + else + RegKey->DeleteValue(DEFAULT_VALUE_NAME); + } + } + catch(RegistryKeyNotFoundException&) + { + } + + SaveNotRegisteredFor(DEFAULT_SHELL_HTML_EDITOR); +} + +void Registrar::SaveRegisteredFor(int State) const +{ + assert(m_RootKey.get()); + + int NewState = GetRegisterState(); + NewState |= State; + SetRegisterState(NewState); +} + +void Registrar::SaveNotRegisteredFor(int State) const +{ + assert(m_RootKey.get()); + + int NewState = GetRegisterState(); + NewState &= ~State; + SetRegisterState(NewState); +} + +int Registrar::GetRegisterState() const +{ + int State = 0; + + RegistryKey RegKey = m_RootKey->CreateSubKey(PRIVATE_BACKUP_KEY_NAME); + + if (RegKey->HasValue(REGISTRATION_STATE)) + { + RegistryValue RegVal = RegKey->GetValue(REGISTRATION_STATE); + if (REG_DWORD == RegVal->GetType()) + State = RegVal->GetDataAsInt(); + } + + return State; +} + +void Registrar::SetRegisterState(int NewState) const +{ + RegistryKey RegKey = m_RootKey->CreateSubKey(PRIVATE_BACKUP_KEY_NAME); + RegistryValue RegVal = RegistryValue(new RegistryValueImpl(REGISTRATION_STATE, NewState)); + RegKey->SetValue(RegVal); +} + +bool Registrar::IsRegisteredFor(int State) const +{ + assert(m_RootKey.get()); + + RegistryKey RegKey = m_RootKey->CreateSubKey(PRIVATE_BACKUP_KEY_NAME); + + int SavedState = 0; + + if (RegKey->HasValue(REGISTRATION_STATE)) + { + RegistryValue RegVal = RegKey->GetValue(REGISTRATION_STATE); + if (REG_DWORD == RegVal->GetType()) + SavedState = RegVal->GetDataAsInt(); + } + + return ((SavedState & State) == State); +} + +//-------------------------------------- +/** Restore the last registration state (necessary for + Setup repair) */ +void Registrar::RepairRegistrationState() const +{ + assert(m_RootKey.get()); + + if (IsRegisteredFor(MSWORD)) + RegisterForMsWord(); + + if (IsRegisteredFor(MSEXCEL)) + RegisterForMsExcel(); + + if (IsRegisteredFor(MSPOWERPOINT)) + RegisterForMsPowerPoint(); + + if (IsRegisteredFor(DEFAULT_HTML_EDITOR_FOR_IE)) + RegisterAsDefaultHtmlEditorForInternetExplorer(); + + if (IsRegisteredFor(HTML_EDITOR)) + RegisterAsHtmlEditorForInternetExplorer(); + + if (IsRegisteredFor(DEFAULT_SHELL_HTML_EDITOR)) + RegisterAsDefaultShellHtmlEditor(); +} + +/** Unregisters all and delete all Registry keys we have written */ +void Registrar::UnregisterAllAndCleanUpRegistry() const +{ + assert(m_RootKey.get()); + + if (IsRegisteredFor(MSWORD)) + UnregisterForMsWord(); + + if (IsRegisteredFor(MSEXCEL)) + UnregisterForMsExcel(); + + if (IsRegisteredFor(MSPOWERPOINT)) + UnregisterForMsPowerPoint(); + + if (IsRegisteredFor(DEFAULT_HTML_EDITOR_FOR_IE)) + UnregisterAsDefaultHtmlEditorForInternetExplorer(); + + if (IsRegisteredFor(HTML_EDITOR)) + UnregisterAsHtmlEditorForInternetExplorer(); + + if (IsRegisteredFor(DEFAULT_SHELL_HTML_EDITOR)) + UnregisterAsDefaultShellHtmlEditor(); + + if (m_RootKey->HasSubKey(PRIVATE_BACKUP_KEY_NAME)) + m_RootKey->DeleteSubKeyTree(PRIVATE_BACKUP_KEY_NAME); +} + +void Registrar::RegisterForMsOfficeApplication( + const std::wstring& FileExtension, + const std::wstring& DocumentDisplayName, + const std::wstring& DefaultIconEntry, + const std::wstring& DefaultShellCommand, + const std::wstring& ShellNewCommandDisplayName, + const RegistrationContextInformation::OFFICE_APPLICATION eOfficeApp) const +{ + assert(m_RootKey.get()); + + std::wstring ForwardKeyName = FORWARD_KEY_PREFIX + FileExtension; + + RegistryKey ForwardKey = m_RootKey->CreateSubKey(ForwardKeyName); + RegistryValue RegVal(new RegistryValueImpl(std::wstring(DEFAULT_VALUE_NAME), DocumentDisplayName)); + ForwardKey->SetValue(RegVal); + + RegistryKey RegKey = ForwardKey->CreateSubKey(L"DefaultIcon"); + RegVal->SetValue(DefaultIconEntry); + RegKey->SetValue(RegVal); + + RegistryKey RegKeyShell = ForwardKey->CreateSubKey(L"shell"); + RegVal->SetValue(DefaultShellCommand); + RegKeyShell->SetValue(RegVal); + + RegKey = RegKeyShell->CreateSubKey(L"new"); + RegVal->SetValue(ShellNewCommandDisplayName); + RegKey->SetValue(RegVal); + + RegKey = RegKey->CreateSubKey(L"command"); + RegVal->SetValue(m_ContextInformation.GetOpenOfficeCommandline(RegistrationContextInformation::New, eOfficeApp)); + RegKey->SetValue(RegVal); + + RegKey = RegKeyShell->CreateSubKey(L"open\\command"); + RegVal->SetValue(m_ContextInformation.GetOpenOfficeCommandline(RegistrationContextInformation::Open, eOfficeApp)); + RegKey->SetValue(RegVal); + + RegKey = RegKeyShell->CreateSubKey(L"print\\command"); + RegVal->SetValue(m_ContextInformation.GetOpenOfficeCommandline(RegistrationContextInformation::Print, eOfficeApp)); + RegKey->SetValue(RegVal); + + RegKey = RegKeyShell->CreateSubKey(L"printto\\command"); + RegVal->SetValue(m_ContextInformation.GetOpenOfficeCommandline(RegistrationContextInformation::Printto, eOfficeApp)); + RegKey->SetValue(RegVal); + + // set the new forward key under the appropriate extension + RegKey = m_RootKey->CreateSubKey(FileExtension); + + if (RegKey->HasValue(DEFAULT_VALUE_NAME)) + { + RegVal = RegKey->GetValue(DEFAULT_VALUE_NAME); + + if (REG_SZ == RegVal->GetType()) + { + std::wstring str = RegVal->GetDataAsUniString(); + if (!IsOpenOfficeRegisteredForMsApplication(str)) + ForwardKey->CopyValue(RegKey, DEFAULT_VALUE_NAME, BACKUP_VALUE_NAME); + } + } + + RegVal->SetValue(ForwardKeyName); + RegKey->SetValue(RegVal); +} + +void Registrar::UnregisterForMsOfficeApplication(const std::wstring& FileExtension) const +{ + std::wstring FwdRegKeyName = FORWARD_KEY_PREFIX + FileExtension; + + if (m_RootKey->HasSubKey(FileExtension)) + { + RegistryKey RegKey = m_RootKey->OpenSubKey(FileExtension); + + if (RegKey->HasValue(DEFAULT_VALUE_NAME)) + { + RegistryValue RegVal = RegKey->GetValue(DEFAULT_VALUE_NAME); + if (REG_SZ == RegVal->GetType() && + IsOpenOfficeRegisteredForMsApplication(RegVal->GetDataAsUniString())) + { + RegistryKey FwdRegKey = m_RootKey->CreateSubKey(FwdRegKeyName); + + if (FwdRegKey->HasValue(BACKUP_VALUE_NAME)) + RegKey->CopyValue(FwdRegKey, BACKUP_VALUE_NAME, DEFAULT_VALUE_NAME); + else + RegKey->DeleteValue(DEFAULT_VALUE_NAME); + } + } + } + + if (m_RootKey->HasSubKey(FwdRegKeyName)) + m_RootKey->DeleteSubKeyTree(FwdRegKeyName); +} + +RegistryKey Registrar::GetRootKeyForDefHtmlEditorForIERegistration() const +{ + return WindowsRegistry().GetLocalMachineKey(); +} + +bool Registrar::IsOpenOfficeRegisteredForMsApplication(const std::wstring& DocumentExtensionDefValue) const +{ + return (std::wstring::npos != DocumentExtensionDefValue.find(FORWARD_KEY_PREFIX)); +} diff --git a/setup_native/source/win32/customactions/reg4msdoc/registrar.hxx b/setup_native/source/win32/customactions/reg4msdoc/registrar.hxx new file mode 100644 index 000000000000..529a39d5c9c8 --- /dev/null +++ b/setup_native/source/win32/customactions/reg4msdoc/registrar.hxx @@ -0,0 +1,103 @@ +// Registrar.h: Schnittstelle f�r die Klasse Registrar. +// +////////////////////////////////////////////////////////////////////// + +#ifndef _REGISTRAR_HXX_ +#define _REGISTRAR_HXX_ + +#include "registry.hxx" +#include "registrationcontextinformation.hxx" + +#ifndef _CONSTANTS_HXX_ +#include "constants.hxx" +#endif + +class Registrar +{ +public: + + Registrar(const RegistrationContextInformation& RegContext); + + virtual ~Registrar(); + + bool IsRegisteredFor(int State) const; + + virtual void RegisterForMsWord() const; + virtual void UnregisterForMsWord() const; + virtual bool QueryPreselectMsWordRegistration() const; + + virtual void RegisterForMsExcel() const; + virtual void UnregisterForMsExcel() const; + virtual bool QueryPreselectMsExcelRegistration() const; + + virtual void RegisterForMsPowerPoint() const; + virtual void UnregisterForMsPowerPoint() const; + virtual bool QueryPreselectMsPowerPointRegistration() const; + + virtual void RegisterAsHtmlEditorForInternetExplorer() const; + virtual void UnregisterAsHtmlEditorForInternetExplorer() const; + + virtual void RegisterAsDefaultHtmlEditorForInternetExplorer() const; + virtual void UnregisterAsDefaultHtmlEditorForInternetExplorer() const; + + virtual void RegisterAsDefaultShellHtmlEditor() const; + virtual void UnregisterAsDefaultShellHtmlEditor() const; + + /** Restore the last registration state (necessary for + Setup repair) + */ + virtual void RepairRegistrationState() const; + + /** Unregisters all and delete all Registry keys we have written + */ + virtual void UnregisterAllAndCleanUpRegistry() const; + +protected: + + virtual void RegisterForMsOfficeApplication( + const std::wstring& FileExtension, + const std::wstring& DocumentDisplayName, + const std::wstring& DefaultIconEntry, + const std::wstring& DefaultShellCommand, + const std::wstring& ShellNewCommandDisplayName, + const RegistrationContextInformation::OFFICE_APPLICATION eOfficeApp) const; + + virtual void UnregisterForMsOfficeApplication( + const std::wstring& FileExtension) const; + + virtual RegistryKey GetRootKeyForDefHtmlEditorForIERegistration() const; + + void SaveRegisteredFor(int State) const; + void SaveNotRegisteredFor(int State) const; + + int GetRegisterState() const; + void SetRegisterState(int NewState) const; + + virtual bool QueryPreselectForMsApplication(const std::wstring& file_extension) const; + + /** A helper function (for readability) returns true if OpenOffice is already + registered for a MS application + + @param DocumentExtensionDefValue + The default value of the appropriate document extension Registry key + */ + bool IsOpenOfficeRegisteredForMsApplication(const std::wstring& DocumentExtensionDefValue) const; + +protected: + const RegistrationContextInformation& m_ContextInformation; + + const std::wstring FORWARD_KEY_PREFIX; + const std::wstring DEFAULT_VALUE_NAME; + const std::wstring BACKUP_VALUE_NAME; + const std::wstring PRIVATE_BACKUP_KEY_NAME; + const std::wstring REGISTRATION_STATE; + + RegistryKey m_RootKey; + +// prevent copy/assignment +private: + Registrar(const Registrar&); + Registrar& operator=(const Registrar&); +}; + +#endif diff --git a/setup_native/source/win32/customactions/reg4msdoc/registrationcontextinformation.cxx b/setup_native/source/win32/customactions/reg4msdoc/registrationcontextinformation.cxx new file mode 100644 index 000000000000..ebe836926337 --- /dev/null +++ b/setup_native/source/win32/customactions/reg4msdoc/registrationcontextinformation.cxx @@ -0,0 +1,351 @@ +//Implementierung der Klasse RegistrationContextInformation. + +#include <assert.h> +#include "registrationcontextinformation.hxx" +#include "msihelper.hxx" + +#define WINDOWS_LEAN_AND_MEAN +#include <windows.h> +#include <assert.h> +#include <algorithm> + +namespace /* private */ +{ + const int MAX_REGKEY_LENGTH_WIN9X = 16300; +} + +RegistrationContextInformation::RegistrationContextInformation(MSIHANDLE hMsi, const std::wstring& OpenOfficeExecutablePath) : + msihandle_(hMsi), + m_IsWin9x(true), + m_OOExecPath(OpenOfficeExecutablePath) +{ + OSVERSIONINFOA osverinfo; + ZeroMemory(&osverinfo, sizeof(osverinfo)); + osverinfo.dwOSVersionInfoSize = sizeof(osverinfo); + GetVersionExA(&osverinfo); + + m_IsWin9x = (osverinfo.dwPlatformId == VER_PLATFORM_WIN32_WINDOWS); + assert(m_OOExecPath.length()); + ExtractOpenOfficeExecNameFromPath(); +} + +std::wstring RegistrationContextInformation::GetWordDocumentDisplayName() const +{ + std::wstring str; + GetMsiProp(msihandle_, TEXT("STR_MS_WORD_DOCUMENT"), str); + if (m_IsWin9x && !IsConvertableToAnsi(str)) + str = TEXT("Microsoft Word Document"); + return str; +} + +std::wstring RegistrationContextInformation::GetWordDocumentFileExtension() const +{ + return std::wstring(TEXT(".doc")); +} + +std::wstring RegistrationContextInformation::GetWordDocumentDefaultIconEntry() const +{ + return m_OOExecPath + std::wstring(TEXT(",1")); +} + +std::wstring RegistrationContextInformation::GetWordDocumentDefaultShellCommand() const +{ + return std::wstring(TEXT("open")); +} + +std::wstring RegistrationContextInformation::GetWordTemplateDisplayName() const +{ + std::wstring str; + GetMsiProp(msihandle_, TEXT("STR_MS_WORD_TEMPLATE"), str); + if (m_IsWin9x && !IsConvertableToAnsi(str)) + str = TEXT("Microsoft Word Template"); + return str; +} + +std::wstring RegistrationContextInformation::GetWordTemplateFileExtension() const +{ + return std::wstring(TEXT(".dot")); +} + +std::wstring RegistrationContextInformation::GetWordTemplateDefaultIconEntry() const +{ + return m_OOExecPath + std::wstring(TEXT(",2")); +} + +std::wstring RegistrationContextInformation::GetWordTemplateDefaultShellCommand() const +{ + return std::wstring(TEXT("new")); +} + +std::wstring RegistrationContextInformation::GetRtfDocumentDisplayName() const +{ + std::wstring str; + GetMsiProp(msihandle_, TEXT("STR_RTF_DOCUMENT"), str); + if (m_IsWin9x && !IsConvertableToAnsi(str)) + str = TEXT("Rich Text Document"); + return str; +} + +std::wstring RegistrationContextInformation::GetRtfDocumentFileExtension() const +{ + return std::wstring(TEXT(".rtf")); +} + +std::wstring RegistrationContextInformation::GetRtfDocumentDefaultIconEntry() const +{ + return m_OOExecPath + std::wstring(TEXT(",1")); +} + +std::wstring RegistrationContextInformation::GetRtfDocumentDefaultShellCommand() const +{ + return std::wstring(TEXT("open")); +} + +std::wstring RegistrationContextInformation::GetExcelSheetDisplayName() const +{ + std::wstring str; + GetMsiProp(msihandle_, TEXT("STR_MS_EXCEL_WORKSHEET"), str); + if (m_IsWin9x && !IsConvertableToAnsi(str)) + str = TEXT("Microsoft Excel Worksheet"); + return str; +} + +std::wstring RegistrationContextInformation::GetExcelSheetFileExtension() const +{ + return std::wstring(TEXT(".xls")); +} + +std::wstring RegistrationContextInformation::GetExcelSheetDefaultIconEntry() const +{ + return m_OOExecPath + std::wstring(TEXT(",3")); +} + +std::wstring RegistrationContextInformation::GetExcelSheetDefaultShellCommand() const +{ + return std::wstring(TEXT("open")); +} + +std::wstring RegistrationContextInformation::GetExcelTemplateDisplayName() const +{ + std::wstring str; + GetMsiProp(msihandle_, TEXT("STR_MS_EXCEL_TEMPLATE"), str); + if (m_IsWin9x && !IsConvertableToAnsi(str)) + str = TEXT("Microsoft Excel Template"); + return str; +} + +std::wstring RegistrationContextInformation::GetExcelTemplateFileExtension() const +{ + return std::wstring(TEXT(".xlt")); +} + +std::wstring RegistrationContextInformation::GetExcelTemplateDefaultIconEntry() const +{ + return m_OOExecPath + std::wstring(TEXT(",4")); +} + +std::wstring RegistrationContextInformation::GetExcelTemplateDefaultShellCommand() const +{ + return std::wstring(TEXT("new")); +} + +std::wstring RegistrationContextInformation::GetPowerPointDocumentDisplayName() const +{ + std::wstring str; + GetMsiProp(msihandle_, TEXT("STR_MS_POWERPOINT_PRESENTATION"), str); + if (m_IsWin9x && !IsConvertableToAnsi(str)) + str = TEXT("Microsoft PowerPoint Presentation"); + return str; +} + +std::wstring RegistrationContextInformation::GetPowerPointDocumentFileExtension() const +{ + return std::wstring(TEXT(".ppt")); +} + +std::wstring RegistrationContextInformation::GetPowerPointDocumentDefaultIconEntry() const +{ + return m_OOExecPath + std::wstring(TEXT(",7")); +} + +std::wstring RegistrationContextInformation::GetPowerPointDocumentDefaultShellCommand() const +{ + return std::wstring(TEXT("open")); +} + +std::wstring RegistrationContextInformation::GetPowerPointTemplateDisplayName() const +{ + std::wstring str; + GetMsiProp(msihandle_, TEXT("STR_MS_POWERPOINT_TEMPLATE"), str); + if (m_IsWin9x && !IsConvertableToAnsi(str)) + str = TEXT("Microsoft PowerPoint Template"); + return str; +} + +std::wstring RegistrationContextInformation::GetPowerPointTemplateFileExtension() const +{ + return std::wstring(TEXT(".pot")); +} + +std::wstring RegistrationContextInformation::GetPowerPointTemplateDefaultIconEntry() const +{ + return m_OOExecPath + std::wstring(TEXT(",8")); +} + +std::wstring RegistrationContextInformation::GetPowerPointTemplateDefaultShellCommand() const +{ + return std::wstring(TEXT("new")); +} + +std::wstring RegistrationContextInformation::GetPowerPointShowDisplayName() const +{ + std::wstring str; + GetMsiProp(msihandle_, TEXT("STR_MS_POWERPOINT_SHOW"), str); + if (m_IsWin9x && !IsConvertableToAnsi(str)) + str = TEXT("Microsoft PowerPoint Show"); + return str; +} + +std::wstring RegistrationContextInformation::GetPowerPointShowFileExtension() const +{ + return std::wstring(TEXT(".pps")); +} + +std::wstring RegistrationContextInformation::GetPowerPointShowDefaultIconEntry() const +{ + return m_OOExecPath + std::wstring(TEXT(",7")); +} + +std::wstring RegistrationContextInformation::GetPowerPointShowDefaultShellCommand() const +{ + return std::wstring(TEXT("open")); +} + +//---------------------------------------------- +/** The string for the "New" command that should appear + in the Explorer context menu when someone right + clicks a Microsoft document +*/ +std::wstring RegistrationContextInformation::ShellNewCommandDisplayName() const +{ + std::wstring str; + GetMsiProp(msihandle_, TEXT("STR_NEW_DISPLAY_NAME"), str); + std::wstring::size_type idx = str.find(TEXT("~")); + + if(std::wstring::npos != idx) + str.replace(idx, 1, TEXT("&")); + + if (m_IsWin9x && !IsConvertableToAnsi(str)) + str = TEXT("&New"); + + return str; +} + +/** The string for the "Edit" command that should + appear in the Explorer context menu when someone + right clicks a document +*/ +std::wstring RegistrationContextInformation::ShellEditCommandDisplayName() const +{ + std::wstring str; + GetMsiProp(msihandle_, TEXT("STR_EDIT"), str); + std::wstring::size_type idx = str.find(TEXT("~")); + + if(std::wstring::npos != idx) + str.replace(idx, 1, TEXT("&")); + + if (m_IsWin9x && !IsConvertableToAnsi(str)) + str = TEXT("&Edit"); + + return str; +} + +std::wstring RegistrationContextInformation::GetOpenOfficeFriendlyAppName() const +{ + std::wstring str; + GetMsiProp(msihandle_, TEXT("ProductName"), str); + return str; +} + +std::wstring RegistrationContextInformation::GetOpenOfficeExecutablePath() const +{ + return m_OOExecPath; +} + +//---------------------------------------------- +/** The name of the executable (currently "soffice.exe" + but may change in the future, who knows) */ +std::wstring RegistrationContextInformation::GetOpenOfficeExecutableName() const +{ + return m_OOExecName; +} + +/** A command line for the specified shell command */ +std::wstring RegistrationContextInformation::GetOpenOfficeCommandline(SHELL_COMMAND ShellCommand, + OFFICE_APPLICATION OfficeApp) const +{ + // quote the path to OpenOffice, this is important + // for Windows 9x + std::wstring cmd_line = std::wstring(TEXT("\"")) + m_OOExecPath + std::wstring(TEXT("\"")); + + switch( OfficeApp ) + { + case Writer: + cmd_line += std::wstring( TEXT( " -writer" ) ); + break; + case Calc: + cmd_line += std::wstring( TEXT( " -calc" ) ); + break; + case Impress: + cmd_line += std::wstring( TEXT( " -impress" ) ); + break; + case Office: // default to std command line + break; + // default: no default to find new added enums at compile time + } + switch(ShellCommand) + { + case New: + cmd_line += std::wstring(TEXT(" -n \"%1\"")); + break; + case Open: + cmd_line += std::wstring(TEXT(" -o \"%1\"")); + break; + case Print: + cmd_line += std::wstring(TEXT(" -p \"%1\"")); + break; + case Printto: + cmd_line += std::wstring(TEXT(" -pt \"%2\" \"%1\"")); + break; + // default: no default to find new added enums at compile time + } + return cmd_line; +} + +bool RegistrationContextInformation::IsConvertableToAnsi(const std::wstring& String) const +{ + char buff[MAX_REGKEY_LENGTH_WIN9X]; + BOOL bUsedDefChar = 0; + + if (String.length() > 0) + { + WideCharToMultiByte( + CP_ACP, + WC_COMPOSITECHECK | WC_DEFAULTCHAR, + String.c_str(), + static_cast<int>(String.length()), + buff, + sizeof(buff), + NULL, + &bUsedDefChar); + } + return !bUsedDefChar; +} + +void RegistrationContextInformation::ExtractOpenOfficeExecNameFromPath() +{ + std::wstring::size_type idx = m_OOExecPath.find_last_of(TEXT('\\')); + assert(idx != std::wstring::npos); // assert valid path + m_OOExecName = m_OOExecPath.substr(idx + 1); +} + diff --git a/setup_native/source/win32/customactions/reg4msdoc/registrationcontextinformation.hxx b/setup_native/source/win32/customactions/reg4msdoc/registrationcontextinformation.hxx new file mode 100644 index 000000000000..aeb6c86c2c3c --- /dev/null +++ b/setup_native/source/win32/customactions/reg4msdoc/registrationcontextinformation.hxx @@ -0,0 +1,158 @@ +// MsOfficeDocumentInformation.h: Schnittstelle f�r die Klasse MsOfficeDocumentInformation. +// +////////////////////////////////////////////////////////////////////// + +#ifndef _REGISTRATIONCONTEXTINFORMATION_HXX_ +#define _REGISTRATIONCONTEXTINFORMATION_HXX_ + +#ifdef _MSC_VER +#pragma warning(push, 1) /* disable warnings within system headers */ +#endif +#define WIN32_LEAN_AND_MEAN +#include <windows.h> +#include <msi.h> +#ifdef _MSC_VER +#pragma warning(pop) +#endif + +#include <string> + +/** A simple implementation class that returns the + appropriate display names for the Microsoft + Office document types. + Under Windows 9x this class checks if the + document display name is convertable to an ANSI + string and if not returns an english default. + So we avoid garbage if soemone for instance + installs an japanese StarOffice/OpenOffice + under a German Windows 98 for instance. +*/ +class RegistrationContextInformation +{ +public: + + enum SHELL_COMMAND {New, Open, Print, Printto}; + enum OFFICE_APPLICATION {Office, Writer, Calc, Impress}; + + RegistrationContextInformation(MSIHANDLE hMsi, const std::wstring& OpenOfficeExecutablePath); + + /** Word document information + The icon index is the index of the icon + in soffice.exe to be associated with + word document files + */ + std::wstring GetWordDocumentDisplayName() const; + std::wstring GetWordDocumentFileExtension() const; + std::wstring GetWordDocumentDefaultIconEntry() const; + std::wstring GetWordDocumentDefaultShellCommand() const; + + /** Word template information + The icon index is the index of the icon + in soffice.exe to be associated with + word template files + */ + std::wstring GetWordTemplateDisplayName() const; + std::wstring GetWordTemplateFileExtension() const; + std::wstring GetWordTemplateDefaultIconEntry() const; + std::wstring GetWordTemplateDefaultShellCommand() const; + + /** Rtf document information + The icon index is the index of the icon + in soffice.exe to be associated with + rtf document files + */ + std::wstring GetRtfDocumentDisplayName() const; + std::wstring GetRtfDocumentFileExtension() const; + std::wstring GetRtfDocumentDefaultIconEntry() const; + std::wstring GetRtfDocumentDefaultShellCommand() const; + + /** Excel sheet information + The icon index is the index of the icon + in soffice.exe to be associated with + Excel sheets + */ + std::wstring GetExcelSheetDisplayName() const; + std::wstring GetExcelSheetFileExtension() const; + std::wstring GetExcelSheetDefaultIconEntry() const; + std::wstring GetExcelSheetDefaultShellCommand() const; + + /** Excel template information + The icon index is the index of the icon + in soffice.exe to be associated with + Excel template files + */ + std::wstring GetExcelTemplateDisplayName() const; + std::wstring GetExcelTemplateFileExtension() const; + std::wstring GetExcelTemplateDefaultIconEntry() const; + std::wstring GetExcelTemplateDefaultShellCommand() const; + + /** PowerPoint document information + The icon index is the index of the icon + in soffice.exe to be associated with + PowerPoint document files + */ + std::wstring GetPowerPointDocumentDisplayName() const; + std::wstring GetPowerPointDocumentFileExtension() const; + std::wstring GetPowerPointDocumentDefaultIconEntry() const; + std::wstring GetPowerPointDocumentDefaultShellCommand() const; + + /** PowerPoint template information + The icon index is the index of the icon + in soffice.exe to be associated with + PowerPoint template files + */ + std::wstring GetPowerPointTemplateDisplayName() const; + std::wstring GetPowerPointTemplateFileExtension() const; + std::wstring GetPowerPointTemplateDefaultIconEntry() const; + std::wstring GetPowerPointTemplateDefaultShellCommand() const; + + /** PowerPoint Show information + */ + std::wstring GetPowerPointShowDisplayName() const; + std::wstring GetPowerPointShowFileExtension() const; + std::wstring GetPowerPointShowDefaultIconEntry() const; + std::wstring GetPowerPointShowDefaultShellCommand() const; + + /** The string for the "New" command that should appear + in the Explorer context menu when someone right + clicks a Microsoft document + */ + std::wstring ShellNewCommandDisplayName() const; + + /** The string for the "Edit" command that should + appear in the Explorer context menu when someone + right clicks a document + */ + std::wstring ShellEditCommandDisplayName() const; + + /** A friendly name for the application + */ + std::wstring GetOpenOfficeFriendlyAppName() const; + + /** The path to the StarOffice/OpenOffice executable + */ + std::wstring GetOpenOfficeExecutablePath() const; + + /** The name of the executable (currently "soffice.exe" + but may change in the future, who knows) + */ + std::wstring GetOpenOfficeExecutableName() const; + + /** A command line for the specified shell command + */ + std::wstring GetOpenOfficeCommandline(SHELL_COMMAND ShellCommand, + OFFICE_APPLICATION OfficeApp) const; + +private: + bool IsConvertableToAnsi(const std::wstring& String) const; + + void ExtractOpenOfficeExecNameFromPath(); + +private: + MSIHANDLE msihandle_; + bool m_IsWin9x; + std::wstring m_OOExecPath; + std::wstring m_OOExecName; +}; + +#endif diff --git a/setup_native/source/win32/customactions/reg4msdoc/registry.cxx b/setup_native/source/win32/customactions/reg4msdoc/registry.cxx new file mode 100644 index 000000000000..2572a3a2d287 --- /dev/null +++ b/setup_native/source/win32/customactions/reg4msdoc/registry.cxx @@ -0,0 +1,242 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#include "registry.hxx" + +#include <Shlwapi.h> +#include <assert.h> +#include <algorithm> + +#ifdef _MSC_VER +#pragma warning(disable : 4786 4350) +#endif + +//----------------------------------------------------- +/** Create instance and open the specified Registry key + + @throws RegistryWriteAccessDenyException + RegistryAccessDenyException + RegistryKeyNotFoundException +*/ +RegistryKeyImpl::RegistryKeyImpl(HKEY RootKey, const std::wstring& KeyName) : + m_hRootKey(RootKey), + m_hSubKey(0), + m_KeyName(KeyName), + m_IsWriteable(false) +{ +} + +//----------------------------------------------------- +/** Create instance and open the specified Registry key + + @throws RegistryWriteAccessDenyException + RegistryAccessDenyException + RegistryKeyNotFoundException +*/ +RegistryKeyImpl::RegistryKeyImpl(HKEY RootKey) : + m_hRootKey(RootKey), + m_hSubKey(0), + m_IsWriteable(false) +{ +} + +//----------------------------------------------------- +/** Create an instances of the specified Registry key, + the key is assumed to be already opened. +*/ +RegistryKeyImpl::RegistryKeyImpl(HKEY RootKey, HKEY SubKey, const std::wstring& KeyName, bool Writeable) : + m_hRootKey(RootKey), + m_hSubKey(SubKey), + m_KeyName(KeyName), + m_IsWriteable(Writeable) +{ +} + +//----------------------------------------------------- +/** +*/ +RegistryKeyImpl::~RegistryKeyImpl() +{ + if (IsOpen()) + Close(); +} + + +//############################################ +// Queries +//############################################ + + +//----------------------------------------------------- +/** The name of the key at hand, maybe empty + if this is any of the root keys +*/ +std::wstring RegistryKeyImpl::GetName() const +{ + return m_KeyName; +} + +//----------------------------------------------------- +/** +*/ +bool RegistryKeyImpl::IsOpen() const +{ + return m_hSubKey != 0; +} + +//----------------------------------------------------- +/** Is this one of the root keys + HKEY_CLASSES_ROOT + HKEY_CURRENT_USER + etc. +*/ +bool RegistryKeyImpl::IsRootKey() const +{ + return (0 == m_KeyName.length()); +} + +//----------------------------------------------------- +/** Do we have write access on the key at hand +*/ +bool RegistryKeyImpl::IsWriteable() const +{ + return m_IsWriteable; +} + +//----------------------------------------------------- +/** Convenience function to determine if the + Registry key at hand has the specified + value + + @precond IsOpen = true + + throws RegistryAccessDenyException +*/ +bool RegistryKeyImpl::HasValue(const std::wstring& Name) const +{ + StringListPtr names = GetSubValueNames(); + + StringList::iterator iter_end = names->end(); + StringList::iterator iter = std::find(names->begin(), iter_end, Name); + + return (iter != iter_end); +} + +struct CompareNamesCaseInsensitive +{ + CompareNamesCaseInsensitive(const std::wstring& Name) : + name_(Name) + {} + + bool operator() (const std::wstring& value) + { + return (0 == StrCmpI(value.c_str(), name_.c_str())); + } + + std::wstring name_; +}; + +//----------------------------------------------------- +/** Convenience function to determine if the + Registry key at hand has the specified + sub-key + + @precond IsOpen = true + + throws RegistryAccessDenyException +*/ +bool RegistryKeyImpl::HasSubKey(const std::wstring& Name) const +{ + StringListPtr names = GetSubKeyNames(); + + StringList::iterator iter_end = names->end(); + StringList::iterator iter = std::find_if(names->begin(), iter_end, CompareNamesCaseInsensitive(Name)); + + return (iter != iter_end); +} + +//----------------------------------------------------- +/** +*/ +void RegistryKeyImpl::Close() +{ + if (RegCloseKey(m_hSubKey) != ERROR_SUCCESS) { + assert(false); + } + + m_hSubKey = 0; + m_IsWriteable = false; +} + +//----------------------------------------------------- +/** Copies the specified value from RegistryKey to + the registry key at hand, if a value with this + name already exist under the registry key at hand + it will be overwritten + + @precond IsOpen = true + IsWriteable = true + RegistryKey.HasSubValue(Name) = true + + @throws RegistryIOException + RegistryWriteAccessDeniedException + RegistryValueNotFoundException +*/ +void RegistryKeyImpl::CopyValue(const RegistryKey& RegistryKey, const std::wstring& Name) +{ + assert(RegistryKey->HasValue(Name)); +#ifdef __MINGW32__ + SetValue((const RegistryValue&)(RegistryKey->GetValue(Name))); +#else + SetValue(RegistryKey->GetValue(Name)); +#endif + assert(HasValue(Name)); +} + +/** Copies the specified value from RegistryKey to + the registry key at hand under a new name, + if a value with this name already exist there + it will be overwritten + + @precond IsOpen = true + IsWriteable = true + RegistryKey.HasSubValue(Name) = true + + @throws RegistryIOException + RegistryWriteAccessDeniedException + RegistryValueNotFoundException +*/ +void RegistryKeyImpl::CopyValue(const RegistryKey& RegistryKey, const std::wstring& Name, const std::wstring& NewName) +{ + assert(RegistryKey->HasValue(Name)); + + RegistryValue RegVal = RegistryKey->GetValue(Name); + RegVal->SetName(NewName); + SetValue(RegVal); + + assert(HasValue(NewName)); +} diff --git a/setup_native/source/win32/customactions/reg4msdoc/registry.hxx b/setup_native/source/win32/customactions/reg4msdoc/registry.hxx new file mode 100644 index 000000000000..791790c1f86c --- /dev/null +++ b/setup_native/source/win32/customactions/reg4msdoc/registry.hxx @@ -0,0 +1,338 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#ifndef _REGISTRY_HXX_ +#define _REGISTRY_HXX_ + +#ifdef _MSC_VER +#pragma warning(push, 1) /* disable warnings within system headers */ +#endif +#include <windows.h> +#ifdef _MSC_VER +#pragma warning(pop) +#endif + +#include <memory> +#include <vector> +#include <string> + +#include "registryvalueimpl.hxx" + +//--------------------------------------- +// forward declaration +//--------------------------------------- + +class RegistryKeyImpl; + +//--------------------------------------- +// typedefs +//--------------------------------------- + +typedef std::auto_ptr<RegistryKeyImpl> RegistryKey; +typedef std::vector<std::wstring> StringList; +typedef std::auto_ptr<StringList> StringListPtr; + +//--------------------------------------- +// +//--------------------------------------- + +class RegistryKeyImpl +{ +public: + + //############################################ + // Destruction + //############################################ + + virtual ~RegistryKeyImpl(); + + + //############################################ + // Queries + //############################################ + + + /** The name of the key at hand, maybe empty + if this is any of the root keys + */ + std::wstring GetName() const; + + /** The number of sub values of the key at hand + + @precond IsOpen = true + + @throws + */ + virtual size_t GetSubValueCount() const = 0; + + /** The number of sub-keys of the key at hand + + @precond IsOpen = true + + @throws + */ + virtual size_t GetSubKeyCount() const = 0; + + bool IsOpen() const; + + /** Do we have write access on the key at hand + */ + bool IsWriteable() const; + + /** The StringList will be allocated on the heap, + so this is in fact a transfer of ownership + to the caller + + @precond IsOpen = true + + @throws RegistryIOException + */ + virtual StringListPtr GetSubKeyNames() const = 0; + + /** The StringList will be allocated on the heap, + so this is in fact a transfer of ownership + to the caller + + @precond IsOpen = true + + @throws RegistryIOException + */ + virtual StringListPtr GetSubValueNames() const = 0; + + /** Get the specified registry value + + @precond IsOpen = true + */ + virtual RegistryValue GetValue(const std::wstring& Name) const = 0; + + /** Get the specified registry value, return the given + default value if value not found + + @precond IsOpen = true + */ + virtual RegistryValue GetValue(const std::wstring& Name, const RegistryValue& Default) const = 0; + + /** Convenience function to determine if the + Registry key at hand has the specified + value + + @precond IsOpen = true + + throws RegistryAccessDenyException + */ + bool HasValue(const std::wstring& Name) const; + + /** Convenience function to determine if the + Registry key at hand has the specified + sub-key + + @precond IsOpen = true + + throws RegistryAccessDenyException + */ + bool HasSubKey(const std::wstring& Name) const; + + + //############################################ + // Commands + //############################################ + + + /** Open the registry key, has no effect if + the key is already open + + @precond IsOpen = false + + @throws RegistryWriteAccessDenyException + RegistryAccessDenyException + */ + virtual void Open(bool Writeable = true) = 0; + + /** Close the registry key at hand, further + using it without re-opening may cause + RegistryIOExceptions to be thrown + + This is a template method that calls + ImplClose which has to be overwritten + by sub-classes + */ + void Close(); + + /** Open the specified sub-key of the registry key + at hand + + @precond IsOpen = true + HasSubKey(Name) = true + + @throws RegistryIOException + RegistryKeyNotFoundException + RegistryAccessDeniedException + */ + virtual RegistryKey OpenSubKey(const std::wstring& Name, bool Writeable = true) = 0; + + /** Creates a new sub-key below the key at hand + + @precond IsOpen = true + IsWriteable = true + + @throws RegistryIOException + RegistryWriteAccessDenyException + */ + virtual RegistryKey CreateSubKey(const std::wstring& Name) = 0; + + /** Deletes a sub-key below the key at hand, the + key must not have sub-keys + + @precond IsOpen = true + IsWriteable = true + + @throws RegistryIOException + RegistryWriteAccessDenyException + */ + virtual void DeleteSubKey(const std::wstring& Name) = 0; + + /** Deletes a sub-key below the key at hand with all + its sub-keys + + @precond IsOpen = true + IsWriteable = true; + + @throws RegistryIOException + RegistryWriteAccessDenyException + */ + virtual void DeleteSubKeyTree(const std::wstring& Name) = 0; + + /** Delete the specified value + + @precond IsOpen = true + IsWriteable = true + HasValue(Name) = true + + @throws RegistryIOException + RegistryWriteAccessDeniedException + RegistryValueNotFoundException + */ + virtual void DeleteValue(const std::wstring& Name) = 0; + + /** Set the specified registry value + + @precond IsOpen = true + IsWriteable = true + + @throws RegistryIOException + RegistryWriteAccessDenyException + */ + virtual void SetValue(const RegistryValue& Value) = 0; + + + /** Copies the specified value from RegistryKey to + the registry key at hand, if a value with this + name already exist under the registry key at hand + it will be overwritten + + @precond IsOpen = true + IsWriteable = true + RegistryKey.HasSubValue(Name) = true + + @throws RegistryIOException + RegistryWriteAccessDeniedException + RegistryValueNotFoundException + */ + virtual void CopyValue(const RegistryKey& RegistryKey, const std::wstring& Name); + + /** Copies the specified value from RegistryKey to + the registry key at hand under a new name, + if a value with this name already exist there + it will be overwritten + + @precond IsOpen = true + IsWriteable = true + RegistryKey.HasSubValue(Name) = true + + @throws RegistryIOException + RegistryWriteAccessDeniedException + RegistryValueNotFoundException + */ + virtual void CopyValue(const RegistryKey& RegistryKey, const std::wstring& Name, const std::wstring& NewName); + + //############################################ + // Creation + // only possible through WindowsRegistry class + //############################################ + + +protected: + /** Create instance of the specified Registry key + + @throws RegistryWriteAccessDenyException + RegistryAccessDenyException + RegistryKeyNotFoundException + */ + RegistryKeyImpl(HKEY RootKey, const std::wstring& KeyName); + + /** Create instance of the specified Registry key. + RootKey should only one of the predefined + keys HKEY_CLASSES_ROOT, HKEY_CURRENT_USER, + HKEY_LOCAL_MACHINE, HKEY_USERS + + @throws RegistryWriteAccessDenyException + RegistryAccessDenyException + RegistryKeyNotFoundException + */ + RegistryKeyImpl(HKEY RootKey); + + /** Create an instances of the specified Registry key, + the key is assumed to be already opened. + */ + RegistryKeyImpl(HKEY RootKey, HKEY SubKey, const std::wstring& KeyName, bool Writeable = true); + + /** Is this one of the root keys + HKEY_CLASSES_ROOT + HKEY_CURRENT_USER + etc. + */ + bool IsRootKey() const; + +protected: + HKEY m_hRootKey; + HKEY m_hSubKey; + std::wstring m_KeyName; + bool m_IsWriteable; + +// prevent copy and assignment +private: + RegistryKeyImpl(const RegistryKeyImpl&); + RegistryKeyImpl& operator=(const RegistryKeyImpl&); + +//###################################### +// Friend declarations +//###################################### + +friend class WindowsRegistry; +}; + +#endif diff --git a/setup_native/source/win32/customactions/reg4msdoc/registryexception.cxx b/setup_native/source/win32/customactions/reg4msdoc/registryexception.cxx new file mode 100644 index 000000000000..9eaa05df38f7 --- /dev/null +++ b/setup_native/source/win32/customactions/reg4msdoc/registryexception.cxx @@ -0,0 +1,111 @@ +// RegistryException.cpp: Implementierung der Klasse RegistryException. +// +////////////////////////////////////////////////////////////////////// + +#include "registryexception.hxx" + +#ifdef _MSC_VER +#pragma warning(push, 1) /* disable warnings within system headers */ +#endif +#include <windows.h> +#ifdef _MSC_VER +#pragma warning(pop) +#endif + +////////////////////////////////////////////////////////////////////// +// Konstruktion/Destruktion +////////////////////////////////////////////////////////////////////// + +RegistryException::RegistryException(long ErrorCode) : + m_ErrorCode(ErrorCode), + m_ErrorMsg(0) +{ +} + +/** +*/ +RegistryException::~RegistryException() throw() +{ + if (m_ErrorMsg) + LocalFree(m_ErrorMsg); +} + +/** +*/ +const char* RegistryException::what() const throw() +{ + FormatMessage( + FORMAT_MESSAGE_ALLOCATE_BUFFER | + FORMAT_MESSAGE_FROM_SYSTEM | + FORMAT_MESSAGE_IGNORE_INSERTS, + NULL, + m_ErrorCode, + MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), // Default language + (LPTSTR) &m_ErrorMsg, + 0, + NULL); + + return reinterpret_cast<char*>(m_ErrorMsg); +} + +/** +*/ +long RegistryException::GetErrorCode() const +{ + return m_ErrorCode; +} + +//####################################### +// Thrown when a Registry key is accessed +// that is closed +//####################################### + +RegistryIOException::RegistryIOException(long ErrorCode) : + RegistryException(ErrorCode) +{ +}; + +//####################################### +// +//####################################### + +RegistryNoWriteAccessException::RegistryNoWriteAccessException(long ErrorCode) : + RegistryException(ErrorCode) +{ +}; + +//####################################### +// +//####################################### + +RegistryAccessDeniedException::RegistryAccessDeniedException(long ErrorCode) : + RegistryException(ErrorCode) +{ +}; + +//####################################### +// +//####################################### + +RegistryValueNotFoundException::RegistryValueNotFoundException(long ErrorCode) : + RegistryException(ErrorCode) +{ +}; + +//####################################### +// +//####################################### + +RegistryKeyNotFoundException::RegistryKeyNotFoundException(long ErrorCode) : + RegistryException(ErrorCode) +{ +}; + +//####################################### +// +//####################################### + +RegistryInvalidOperationException::RegistryInvalidOperationException(long ErrorCode) : + RegistryException(ErrorCode) +{ +}; diff --git a/setup_native/source/win32/customactions/reg4msdoc/registryexception.hxx b/setup_native/source/win32/customactions/reg4msdoc/registryexception.hxx new file mode 100644 index 000000000000..38db0a599e82 --- /dev/null +++ b/setup_native/source/win32/customactions/reg4msdoc/registryexception.hxx @@ -0,0 +1,104 @@ +// RegistryException.h: Schnittstelle für die Klasse RegistryException. +// +////////////////////////////////////////////////////////////////////// + +#ifndef _REGISTRYEXCEPTION_HXX_ +#define _REGISTRYEXCEPTION_HXX_ + +#include <exception> + +//####################################### +// Base class for all Registry exceptions +//####################################### + +class RegistryException : public std::exception +{ +public: + + RegistryException(long ErrorCode); + + virtual ~RegistryException() throw(); + + /** + @descr Returns a string that describes the error if + available, else NULL will be returned. The + returned string is only temporary so the caller + has to copy it if he needs the string further. + */ + virtual const char* what() const throw(); + + /** + @descr Returns the error code. + */ + + long GetErrorCode() const; + +private: + long m_ErrorCode; + void* m_ErrorMsg; +}; + +//####################################### +// Thrown when a Registry key is accessed +// that is closed +//####################################### + +class RegistryIOException : public RegistryException +{ +public: + RegistryIOException(long ErrorCode); +}; + +//####################################### +// Thrown when trying to write to a readonly registry key +//####################################### + +class RegistryNoWriteAccessException : public RegistryException +{ +public: + RegistryNoWriteAccessException(long ErrorCode); +}; + +//####################################### +// Thrown when trying to access an registry key, with improper +// access rights +//####################################### + +class RegistryAccessDeniedException : public RegistryException +{ +public: + RegistryAccessDeniedException(long ErrorCode); +}; + +//####################################### +// A specified registry value could not be read because it is not +// available +//####################################### + +class RegistryValueNotFoundException : public RegistryException +{ +public: + RegistryValueNotFoundException(long ErrorCode); +}; + +//####################################### +// A specified registry key was not found +//####################################### + +class RegistryKeyNotFoundException : public RegistryException +{ +public: + RegistryKeyNotFoundException(long ErrorCode); +}; + +//####################################### +// A specified registry operation is invalid +//####################################### + +class RegistryInvalidOperationException : public RegistryException +{ +public: + RegistryInvalidOperationException(long ErrorCode); +}; + +#endif diff --git a/setup_native/source/win32/customactions/reg4msdoc/registryvalueimpl.cxx b/setup_native/source/win32/customactions/reg4msdoc/registryvalueimpl.cxx new file mode 100644 index 000000000000..eabc32f19cff --- /dev/null +++ b/setup_native/source/win32/customactions/reg4msdoc/registryvalueimpl.cxx @@ -0,0 +1,189 @@ +// RegistryValueImpl.cpp: Implementierung der Klasse RegistryValueImpl. +// +////////////////////////////////////////////////////////////////////// + +#include "registryvalueimpl.hxx" + +#ifdef _MSC_VER +#pragma warning(push, 1) /* disable warnings within system headers */ +#endif +#include <windows.h> +#ifdef _MSC_VER +#pragma warning(pop) +#endif + +#include <malloc.h> +#include <assert.h> + +#include "stringconverter.hxx" + +//################################# +// Creation/Destruction +//################################# + +//-------------------------------------------- +/** +*/ +RegistryValueImpl::RegistryValueImpl(const std::wstring& Name, int Value) : + m_Name(Name), + m_Type(REG_DWORD), + m_IntData(Value) +{ +} + +//-------------------------------------------- +/** +*/ +RegistryValueImpl::RegistryValueImpl(const std::wstring& Name, const std::wstring& Value) : + m_Name(Name), + m_Type(REG_SZ), + m_StringData(Value), + m_IntData(0) +{ +} + +//-------------------------------------------- +/** +*/ +RegistryValueImpl::RegistryValueImpl(const std::wstring& Name, const std::string& Value) : + m_Name(Name), + m_Type(REG_SZ), + m_IntData(0) +{ + m_StringData = AnsiToUnicodeString(Value); +} + +#if (_MSC_VER >= 1300) +RegistryValueImpl::RegistryValueImpl(const RegistryValueImpl& s) : + m_Name(s.m_Name), + m_Type(s.m_Type), + m_StringData(s.m_StringData), + m_IntData(s.m_IntData) + { +} +#endif +//-------------------------------------------- +/** +*/ +RegistryValueImpl::~RegistryValueImpl() +{ +} + +//################################# +// Query +//################################# + +//-------------------------------------------- +/** Returns the name of the value +*/ +std::wstring RegistryValueImpl::GetName() const +{ + return m_Name; +} + +//-------------------------------------------- +/** Return the size of data held +*/ +size_t RegistryValueImpl::GetDataSize() const +{ + size_t size = 0; + + if (REG_DWORD == m_Type) + size = sizeof(m_IntData); + else if (REG_SZ == m_Type) + size = m_StringData.length() ? ((m_StringData.length() + 1) * sizeof(wchar_t)) : 0; + + return size; +} + +//-------------------------------------------- +/** Get a pointer to the data buffer + in order to copy the data +*/ +const void* RegistryValueImpl::GetDataBuffer() const +{ + const void* pData = 0; + + if (REG_DWORD == m_Type) + pData = reinterpret_cast<const void*>(&m_IntData); + else if (REG_SZ == m_Type) + pData = reinterpret_cast<const void*>(m_StringData.c_str()); + + return pData; +} + +//-------------------------------------------- +/** Returns the data as string +*/ +std::wstring RegistryValueImpl::GetDataAsUniString() const +{ + assert(REG_SZ == m_Type); + return m_StringData; +} + +//-------------------------------------------- +/** Returns the data as string +*/ +std::string RegistryValueImpl::GetDataAsAnsiString() const +{ + assert(REG_SZ == m_Type); + return UnicodeToAnsiString(m_StringData); +} + +//-------------------------------------------- +/** Returns the data as number +*/ +int RegistryValueImpl::GetDataAsInt() const +{ + assert(REG_DWORD == m_Type); + return m_IntData; +} + +//-------------------------------------------- +/** Returns the type of the data +*/ +int RegistryValueImpl::GetType() const +{ + return m_Type; +} + + +//################################# +// Command +//################################# + + +//-------------------------------------------- +/** Set a new name +*/ +void RegistryValueImpl::SetName(const std::wstring& NewName) +{ + m_Name = NewName; +} + +//-------------------------------------------- +/** +*/ +void RegistryValueImpl::SetValue(const std::wstring& NewValue) +{ + m_Type = REG_SZ; + m_StringData = NewValue; +} + +//-------------------------------------------- +/** +*/ +void RegistryValueImpl::SetValue(const std::string& NewValue) +{ + m_Type = REG_SZ; + m_StringData = AnsiToUnicodeString(NewValue); +} + +//-------------------------------------------- +/** +*/ +void RegistryValueImpl::SetValue(int NewValue) +{ + m_Type = REG_DWORD; + m_IntData = NewValue; +} diff --git a/setup_native/source/win32/customactions/reg4msdoc/registryvalueimpl.hxx b/setup_native/source/win32/customactions/reg4msdoc/registryvalueimpl.hxx new file mode 100644 index 000000000000..a64058e29141 --- /dev/null +++ b/setup_native/source/win32/customactions/reg4msdoc/registryvalueimpl.hxx @@ -0,0 +1,108 @@ +// RegistryValueImpl.h: Schnittstelle für die Klasse RegistryValueImpl. +// +////////////////////////////////////////////////////////////////////// + +#ifndef _REGISTRYVALUEIMPL_HXX_ +#define _REGISTRYVALUEIMPL_HXX_ + +#include <memory> +#include <string> + +class RegistryValueImpl +{ +public: + + //################################# + // Creation/Destruction + //################################# + + RegistryValueImpl(const std::wstring& Name, int Value); + + RegistryValueImpl(const std::wstring& Name, const std::wstring& Value); + + RegistryValueImpl(const std::wstring& Name, const std::string& Value); + + #if (_MSC_VER >= 1300) + RegistryValueImpl::RegistryValueImpl(const RegistryValueImpl& s); + #endif + + virtual ~RegistryValueImpl(); + + + //################################# + // Query + //################################# + + + /** Returns the name of the value + */ + std::wstring GetName() const; + + /** Return the size of data held + */ + size_t GetDataSize() const; + + /** Get a pointer to the data buffer + in order to copy the data + */ + const void* GetDataBuffer() const; + + /** Returns the data as unicode string + + @precond GetType = STRING + */ + std::wstring GetDataAsUniString() const; + + /** Returns the data as ansi string + + @precond GetType = STRING + */ + std::string GetDataAsAnsiString() const; + + /** Returns the data as number + + @precond GetType = NUMBER + */ + int GetDataAsInt() const; + + /** Returns the type of the data + */ + int GetType() const; + + //################################# + // Command + //################################# + + + /** Set a new name + */ + void SetName(const std::wstring& NewName); + + /** + */ + void SetValue(const std::wstring& NewValue); + + /** + */ + void SetValue(const std::string& NewValue); + + /** + */ + void SetValue(int NewValue); + + //################################# + // Private data + //################################# + +private: + std::wstring m_Name; + int m_Type; + std::wstring m_StringData; + int m_IntData; +}; + + +typedef std::auto_ptr<RegistryValueImpl> RegistryValue; + + +#endif diff --git a/setup_native/source/win32/customactions/reg4msdoc/registryw9x.cxx b/setup_native/source/win32/customactions/reg4msdoc/registryw9x.cxx new file mode 100644 index 000000000000..620a32f028bb --- /dev/null +++ b/setup_native/source/win32/customactions/reg4msdoc/registryw9x.cxx @@ -0,0 +1,550 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +//--------------------------------------- +// +//--------------------------------------- + +#include "registryw9x.hxx" + +#include <windows.h> +#include <malloc.h> +#include "registryvalueimpl.hxx" +#include "registryexception.hxx" +#include "stringconverter.hxx" + +#include <assert.h> + +#ifdef _MSC_VER +#pragma warning(disable : 4786 4350) +#endif + +//--------------------------------------- +// +//--------------------------------------- + +const size_t MAX_TMP_BUFF_SIZE = 1024 * sizeof(wchar_t); + + +//############################################ +// Creation +// only possible through WindowsRegistry class +//############################################ + + +//----------------------------------------------------- +/** Create instance and open the specified Registry key +*/ +RegistryKeyImplWin9x::RegistryKeyImplWin9x(HKEY RootKey, const std::wstring& KeyName) : + RegistryKeyImpl(RootKey, KeyName) +{ +} + +//----------------------------------------------------- +/** Create instance and open the specified Registry key +*/ +RegistryKeyImplWin9x::RegistryKeyImplWin9x(HKEY RootKey) : + RegistryKeyImpl(RootKey) +{ +} + +//----------------------------------------------------- +/** Create an instances of the specified Registry key, + the key is assumed to be already opened. +*/ +RegistryKeyImplWin9x::RegistryKeyImplWin9x(HKEY RootKey, HKEY SubKey, const std::wstring& KeyName, bool Writeable) : + RegistryKeyImpl(RootKey, SubKey, KeyName, Writeable) +{ +} + + +//############################################ +// Queries +//############################################ + + +//----------------------------------------------------- +/** The number of sub values of the key at hand + + @precond IsOpen = true + + @throws +*/ +size_t RegistryKeyImplWin9x::GetSubValueCount() const +{ + assert(IsOpen()); + + DWORD nSubValues = 0; + + LONG rc = RegQueryInfoKeyA( + m_hSubKey, + 0, 0, 0, 0, 0, 0, &nSubValues, 0, 0, 0, 0); + + if (ERROR_INVALID_HANDLE == rc) + throw RegistryIOException(rc); + else if (ERROR_SUCCESS != rc) + throw RegistryException(rc); + + return nSubValues; +} + +//----------------------------------------------------- +/** The number of sub-keys of the key at hand + + @precond IsOpen = true + + @throws +*/ +size_t RegistryKeyImplWin9x::GetSubKeyCount() const +{ + assert(IsOpen()); + + DWORD nSubKeys = 0; + + LONG rc = RegQueryInfoKeyA( + m_hSubKey, + 0, 0, 0, &nSubKeys, 0, 0, 0, 0, 0, 0, 0); + + if (ERROR_INVALID_HANDLE == rc) + throw RegistryIOException(rc); + else if (ERROR_SUCCESS != rc) + throw RegistryException(rc); + + return nSubKeys; +} + +//----------------------------------------------------- +/** +*/ +StringListPtr RegistryKeyImplWin9x::GetSubKeyNames() const +{ + assert(IsOpen()); + + char buff[1024]; + DWORD buff_size = sizeof(buff); + FILETIME ftime; + + StringList* key_names = new StringList(); + + LONG rc = ERROR_SUCCESS; + + for (DWORD i = 0; /* left empty */; i++) + { + rc = RegEnumKeyExA( + m_hSubKey, i, buff, &buff_size, + 0, 0, 0, &ftime); + + if (ERROR_SUCCESS != rc && + ERROR_MORE_DATA != rc) + break; + + buff_size = sizeof(buff); + + key_names->push_back(AnsiToUnicodeString(buff)); + } + + if (ERROR_INVALID_HANDLE == rc) + throw RegistryIOException(rc); + else if (ERROR_NO_MORE_ITEMS != rc && ERROR_SUCCESS != rc) + throw RegistryException(rc); + + return (StringListPtr) key_names; +} + +//----------------------------------------------------- +/** +*/ +StringListPtr RegistryKeyImplWin9x::GetSubValueNames() const +{ + assert(IsOpen()); + + char buff[1024]; + DWORD buff_size = sizeof(buff); + + StringList* value_names = new StringList(); + + LONG rc = ERROR_SUCCESS; + + for (DWORD i = 0; /* left empty */; i++) + { + rc = RegEnumValueA( + m_hSubKey, i, buff, &buff_size, + 0, 0, 0, 0); + + if (ERROR_SUCCESS != rc && + ERROR_MORE_DATA != rc) + break; + + buff_size = sizeof(buff); + + value_names->push_back(AnsiToUnicodeString(buff)); + } + + if (ERROR_INVALID_HANDLE == rc) + throw RegistryIOException(rc); + else if (ERROR_NO_MORE_ITEMS != rc && ERROR_SUCCESS != rc) + throw RegistryException(rc); + + return (StringListPtr) value_names; +} + +//----------------------------------------------------- +/** Get the specified registry value + + @precond IsOpen = true +*/ +RegistryValue RegistryKeyImplWin9x::GetValue(const std::wstring& Name) const +{ + assert(IsOpen()); + + DWORD Type; + char buff[MAX_TMP_BUFF_SIZE]; + DWORD size = sizeof(buff); + + LONG rc = RegQueryValueExA( + m_hSubKey, + UnicodeToAnsiString(Name).c_str(), + 0, + &Type, + reinterpret_cast<LPBYTE>(buff), + &size); + + if (ERROR_FILE_NOT_FOUND == rc) + throw RegistryValueNotFoundException(rc); + else if (ERROR_ACCESS_DENIED == rc) + throw RegistryAccessDeniedException(rc); + else if (ERROR_SUCCESS != rc) + throw RegistryException(rc); + + RegistryValue regval; + + if (REG_DWORD == Type) + { + regval = RegistryValue(new RegistryValueImpl(Name, *(reinterpret_cast<int*>(buff)))); + } + else if (REG_SZ == Type || REG_EXPAND_SZ == Type || REG_MULTI_SZ == Type) + { + if (size > 0) + regval = RegistryValue(new RegistryValueImpl(Name, std::string(reinterpret_cast<char*>(buff)))); + else + regval = RegistryValue(new RegistryValueImpl(Name, std::string())); + } + else + { + assert(false); + } + + return regval; +} + +//----------------------------------------------------- +/** Get the specified registry value, return the given + default value if value not found + + @precond IsOpen = true +*/ +RegistryValue RegistryKeyImplWin9x::GetValue(const std::wstring& Name, const RegistryValue& Default) const +{ + assert(IsOpen()); + + DWORD Type; + char buff[MAX_TMP_BUFF_SIZE]; + DWORD size = sizeof(buff); + + LONG rc = RegQueryValueExA( + m_hSubKey, + UnicodeToAnsiString(Name).c_str(), + 0, + &Type, + reinterpret_cast<LPBYTE>(buff), + &size); + + if (ERROR_FILE_NOT_FOUND == rc) + { + #if !defined(__MINGW32__) && (_MSC_VER < 1300) + return Default; + #else + RegistryValue regval_ptr; + regval_ptr = RegistryValue(new RegistryValueImpl(*Default)); + return regval_ptr; + #endif + } + + if (ERROR_ACCESS_DENIED == rc) + throw RegistryAccessDeniedException(rc); + else if (ERROR_SUCCESS != rc) + throw RegistryException(rc); + + RegistryValue regval; + + if (REG_DWORD == Type) + regval = RegistryValue(new RegistryValueImpl(Name, *reinterpret_cast<int*>(buff))); + else if (REG_SZ == Type || REG_EXPAND_SZ == Type || REG_MULTI_SZ == Type) + regval = RegistryValue(new RegistryValueImpl(Name, std::string(reinterpret_cast<char*>(buff)))); + else + assert(false); + + return regval; +} + + +//############################################ +// Commands +//############################################ + + +//----------------------------------------------------- +/** Open the registry key, has no effect if + the key is already open + + @precond IsOpen = false + + @throws RegistryKeyNotFoundException + RegistryWriteAccessDenyException + RegistryAccessDenyException +*/ +void RegistryKeyImplWin9x::Open(bool Writeable) +{ + assert(!IsOpen()); + + REGSAM regsam = KEY_READ; + + if (Writeable) + regsam |= KEY_WRITE; + + LONG rc = RegOpenKeyExA( + m_hRootKey, + UnicodeToAnsiString(m_KeyName).c_str(), + 0, + regsam, + &m_hSubKey); + + if (ERROR_FILE_NOT_FOUND == rc) + throw RegistryKeyNotFoundException(rc); + else if (ERROR_ACCESS_DENIED == rc) + throw RegistryAccessDeniedException(rc); + else if (ERROR_SUCCESS != rc) + throw RegistryException(rc); + + m_IsWriteable = Writeable; + + assert(IsOpen()); +} + +//----------------------------------------------------- +/** Open the specified sub-key of the registry key + at hand + + @precond IsOpen = true + HasSubKey(Name) = true + + @throws RegistryIOException + RegistryKeyNotFoundException + RegistryAccessDeniedException +*/ +RegistryKey RegistryKeyImplWin9x::OpenSubKey(const std::wstring& Name, bool Writeable) +{ + RegistryKey regkey(new RegistryKeyImplWin9x(m_hSubKey, Name)); + regkey->Open(Writeable); + return regkey; +} + +//----------------------------------------------------- +/** Creates a new sub-key below the key at hand + + @precond IsOpen = true + IsWriteable = true + + @throws RegistryIOException + RegistryWriteAccessDenyException +*/ + +RegistryKey RegistryKeyImplWin9x::CreateSubKey(const std::wstring& Name) +{ + assert(IsOpen()); + assert(IsWriteable()); + + HKEY hRoot = IsRootKey() ? m_hRootKey : m_hSubKey; + + HKEY hKey; + + LONG rc = RegCreateKeyExA( + hRoot, + UnicodeToAnsiString(Name).c_str(), + 0, + 0, + REG_OPTION_NON_VOLATILE, + KEY_READ | KEY_WRITE, + 0, + &hKey, + 0); + + if (ERROR_INVALID_HANDLE == rc) + throw RegistryIOException(rc); + else if (ERROR_ACCESS_DENIED == rc) + throw RegistryAccessDeniedException(rc); + else if (ERROR_SUCCESS != rc) + throw RegistryException(rc); + + return RegistryKey(new RegistryKeyImplWin9x(hRoot, hKey, Name)); +} + +//----------------------------------------------------- +/** Deletes a sub-key below the key at hand, the + key must not have sub-keys + + @precond IsOpen = true + IsWriteable = true + + @throws RegistryIOException + RegistryWriteAccessDenyException +*/ +void RegistryKeyImplWin9x::DeleteSubKey(const std::wstring& Name) +{ + assert(IsOpen()); + assert(IsWriteable()); + assert(HasSubKey(Name)); + + RegistryKey SubKey = OpenSubKey(Name); + + size_t nSubKeyCount = SubKey->GetSubKeyCount(); + + assert(0 == nSubKeyCount); + + if (nSubKeyCount) + throw RegistryInvalidOperationException(ERROR_NOT_SUPPORTED); + + LONG rc = RegDeleteKeyA(m_hSubKey, UnicodeToAnsiString(Name).c_str()); + + if (ERROR_INVALID_HANDLE == rc) + throw RegistryIOException(rc); + else if (ERROR_ACCESS_DENIED == rc) + throw RegistryAccessDeniedException(rc); + else if (ERROR_SUCCESS != rc) + throw RegistryException(rc); +} + +//----------------------------------------------------- +/** Deletes a sub-key below the key at hand with all + its sub-keys + + @precond IsOpen = true + IsWriteable = true; + + @throws RegistryIOException + RegistryWriteAccessDenyException +*/ +void RegistryKeyImplWin9x::DeleteSubKeyTree(const std::wstring& Name) +{ + LONG rc = RegDeleteKeyA(m_hSubKey, UnicodeToAnsiString(Name).c_str()); + + if (ERROR_INVALID_HANDLE == rc) + throw RegistryIOException(rc); + else if (ERROR_ACCESS_DENIED == rc) + throw RegistryAccessDeniedException(rc); + else if (ERROR_SUCCESS != rc) + throw RegistryException(rc); +} + +//----------------------------------------------------- +/** Delete the specified value + + @precond IsOpen = true + IsWriteable = true + HasValue(Name) = true + + @throws RegistryIOException + RegistryWriteAccessDeniedException + RegistryValueNotFoundException +*/ +void RegistryKeyImplWin9x::DeleteValue(const std::wstring& Name) +{ + assert(IsOpen()); + assert(HasValue(Name)); + assert(IsWriteable()); + + LONG rc = RegDeleteValueA( + m_hSubKey, + UnicodeToAnsiString(Name).c_str()); + + if (ERROR_INVALID_HANDLE == rc) + throw RegistryIOException(rc); + else if (ERROR_ACCESS_DENIED == rc) + throw RegistryNoWriteAccessException(rc); + else if (ERROR_FILE_NOT_FOUND == rc) + throw RegistryValueNotFoundException(rc); + else if (ERROR_SUCCESS != rc) + throw RegistryException(rc); +} + +//----------------------------------------------------- +/** Set the specified registry value + + @precond IsOpen = true + IsWriteable = true + + @throws RegistryIOException + RegistryWriteAccessDenyException +*/ +void RegistryKeyImplWin9x::SetValue(const RegistryValue& Value) +{ + assert(IsOpen()); + assert(IsWriteable()); + + LONG rc = ERROR_SUCCESS; + + if (REG_SZ == Value->GetType()) + { + std::string AnsiStr = Value->GetDataAsAnsiString(); + + rc = RegSetValueExA( + m_hSubKey, + UnicodeToAnsiString(Value->GetName()).c_str(), + 0, + Value->GetType(), + reinterpret_cast<const unsigned char*>(AnsiStr.c_str()), + static_cast<DWORD>((AnsiStr.length() + 1))); + } + else + { + rc = RegSetValueExA( + m_hSubKey, + UnicodeToAnsiString(Value->GetName()).c_str(), + 0, + Value->GetType(), + reinterpret_cast<const unsigned char*>(Value->GetDataBuffer()), + static_cast<DWORD>(Value->GetDataSize())); + } + + if (ERROR_INVALID_HANDLE == rc) + throw RegistryIOException(rc); + else if (ERROR_ACCESS_DENIED == rc) + throw RegistryAccessDeniedException(rc); + else if (ERROR_SUCCESS != rc) + throw RegistryException(rc); +} + diff --git a/setup_native/source/win32/customactions/reg4msdoc/registryw9x.hxx b/setup_native/source/win32/customactions/reg4msdoc/registryw9x.hxx new file mode 100644 index 000000000000..fce0f14441a3 --- /dev/null +++ b/setup_native/source/win32/customactions/reg4msdoc/registryw9x.hxx @@ -0,0 +1,199 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#ifndef _REGISTRYW9X_HXX_ +#define _REGISTRYW9X_HXX_ + +#include "registry.hxx" +#include "registry.hxx" + +//--------------------------------------- +// constants +//--------------------------------------- + +class RegistryKeyImplWin9x : public RegistryKeyImpl +{ +public: + + //############################################ + // Queries + //############################################ + + /** The number of sub values of the key at hand + + @precond IsOpen = true + + @throws + */ + virtual size_t GetSubValueCount() const; + + /** The number of sub-keys of the key at hand + + @precond IsOpen = true + + @throws + */ + virtual size_t GetSubKeyCount() const; + + virtual StringListPtr GetSubKeyNames() const; + + virtual StringListPtr GetSubValueNames() const; + + /** Get the specified registry value + + @precond IsOpen = true + */ + virtual RegistryValue GetValue(const std::wstring& Name) const; + + /** Get the specified registry value, return the given + default value if value not found + + @precond IsOpen = true + */ + virtual RegistryValue GetValue(const std::wstring& Name, const RegistryValue& Default) const; + + //############################################ + // Commands + //############################################ + + /** Open the registry key, has no effect if + the key is already open + + @precond IsOpen = false + + @throws RegistryWriteAccessDenyException + RegistryAccessDenyException + */ + virtual void Open(bool Writeable = true); + + /** Open the specified sub-key of the registry key + at hand + + @precond IsOpen = true + HasSubKey(Name) = true + + @throws RegistryIOException + RegistryKeyNotFoundException + RegistryAccessDeniedException + */ + virtual RegistryKey OpenSubKey(const std::wstring& Name, bool Writeable = true); + + /** Creates a new sub-key below the key at hand + + @precond IsOpen = true + IsWriteable = true + + @throws RegistryIOException + RegistryWriteAccessDenyException + */ + virtual RegistryKey CreateSubKey(const std::wstring& Name); + + /** Deletes a sub-key below the key at hand, the + key must not have sub-keys + + @precond IsOpen = true + IsWriteable = true + + @throws RegistryIOException + RegistryWriteAccessDenyException + */ + virtual void DeleteSubKey(const std::wstring& Name); + + /** Deletes a sub-key below the key at hand with all + its sub-keys + + @precond IsOpen = true + IsWriteable = true; + + @throws RegistryIOException + RegistryWriteAccessDenyException + */ + virtual void DeleteSubKeyTree(const std::wstring& Name); + + /** Delete the specified value + + @precond IsOpen = true + IsWriteable = true + HasValue(Name) = true + + @throws RegistryIOException + RegistryWriteAccessDeniedException + RegistryValueNotFoundException + */ + virtual void DeleteValue(const std::wstring& Name); + + /** Set the specified registry value + + @precond IsOpen = true + IsWriteable = true + + @throws RegistryIOException + RegistryWriteAccessDenyException + */ + virtual void SetValue(const RegistryValue& Value); + + //############################################ + // Creation + // + // only possible through WindowsRegistry class + //############################################ + +protected: + /** Create instance and open the specified Registry key + + @throws RegistryWriteAccessDenyException + RegistryAccessDenyException + RegistryKeyNotFoundException + */ + RegistryKeyImplWin9x(HKEY RootKey, const std::wstring& KeyName); + + /** Create instance and open the specified Registry key + + @throws RegistryWriteAccessDenyException + RegistryAccessDenyException + RegistryKeyNotFoundException + */ + RegistryKeyImplWin9x(HKEY RootKey); + + /** Create an instances of the specified Registry key, + the key is assumed to be already opened. + */ + RegistryKeyImplWin9x(HKEY RootKey, HKEY SubKey, const std::wstring& KeyName, bool Writeable = true); + +// prevent copy/assignment +private: + RegistryKeyImplWin9x(const RegistryKeyImplWin9x&); + RegistryKeyImplWin9x& operator=(const RegistryKeyImplWin9x&); + +//###################################### +// Friend declarations +//###################################### + +friend class WindowsRegistry; +}; + +#endif diff --git a/setup_native/source/win32/customactions/reg4msdoc/registrywnt.cxx b/setup_native/source/win32/customactions/reg4msdoc/registrywnt.cxx new file mode 100644 index 000000000000..361672790630 --- /dev/null +++ b/setup_native/source/win32/customactions/reg4msdoc/registrywnt.cxx @@ -0,0 +1,619 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +//--------------------------------------- +// +//--------------------------------------- + +#ifdef _MSC_VER +#pragma warning(push, 1) /* disable warnings within system headers */ +#endif +#include <windows.h> +#ifdef _MSC_VER +#pragma warning(pop) +#endif + +#include <malloc.h> +#include "registrywnt.hxx" +#include "registryvalueimpl.hxx" +#include "registryexception.hxx" + +#include <assert.h> + +#ifdef _MSC_VER +#pragma warning(disable : 4786 4350) +#endif + +//--------------------------------------- +// +//--------------------------------------- + +const size_t MAX_TMP_BUFF_SIZE = 1024 * sizeof(wchar_t); + + +//############################################ +// Creation +// only possible through WindowsRegistry class +//############################################ + + +//----------------------------------------------------- +/** Create instance and open the specified Registry key +*/ +RegistryKeyImplWinNT::RegistryKeyImplWinNT(HKEY RootKey, const std::wstring& KeyName) : + RegistryKeyImpl(RootKey, KeyName) +{ +} + +//----------------------------------------------------- +/** Create instance and open the specified Registry key +*/ +RegistryKeyImplWinNT::RegistryKeyImplWinNT(HKEY RootKey) : + RegistryKeyImpl(RootKey) +{ +} + +//----------------------------------------------------- +/** Create an instances of the specified Registry key, + the key is assumed to be already opened. +*/ +RegistryKeyImplWinNT::RegistryKeyImplWinNT(HKEY RootKey, HKEY SubKey, const std::wstring& KeyName, bool Writeable) : + RegistryKeyImpl(RootKey, SubKey, KeyName, Writeable) +{ +} + + +//############################################ +// Queries +//############################################ + + +//----------------------------------------------------- +/** The number of sub values of the key at hand + + @precond IsOpen = true + + @throws +*/ +size_t RegistryKeyImplWinNT::GetSubValueCount() const +{ + assert(IsOpen()); + + DWORD nSubValues = 0; + + LONG rc = RegQueryInfoKeyW( + m_hSubKey, + 0, 0, 0, 0, 0, 0, &nSubValues, 0, 0, 0, 0); + + if (ERROR_INVALID_HANDLE == rc) + throw RegistryIOException(rc); + else if (ERROR_SUCCESS != rc) + throw RegistryException(rc); + + return nSubValues; +} + +//----------------------------------------------------- +/** The number of sub-keys of the key at hand + + @precond IsOpen = true + + @throws +*/ +size_t RegistryKeyImplWinNT::GetSubKeyCount() const +{ + assert(IsOpen()); + + DWORD nSubKeys = 0; + + LONG rc = RegQueryInfoKeyA( + m_hSubKey, + 0, 0, 0, &nSubKeys, 0, 0, 0, 0, 0, 0, 0); + + if (ERROR_INVALID_HANDLE == rc) + throw RegistryIOException(rc); + else if (ERROR_SUCCESS != rc) + throw RegistryException(rc); + + return nSubKeys; +} + +//----------------------------------------------------- +/** +*/ +StringListPtr RegistryKeyImplWinNT::GetSubKeyNames() const +{ + assert(IsOpen()); + + wchar_t buff[1024]; + DWORD buff_size = sizeof(buff); + FILETIME ftime; + + StringList* key_names = new StringList(); + + LONG rc = ERROR_SUCCESS; + + for (DWORD i = 0; /* left empty */; i++) + { + rc = RegEnumKeyExW( + m_hSubKey, i, buff, &buff_size, + 0, 0, 0, &ftime); + + if (ERROR_SUCCESS != rc && + ERROR_MORE_DATA != rc) + break; + + buff_size = sizeof(buff); + + key_names->push_back(buff); + } + + if (ERROR_INVALID_HANDLE == rc) + throw RegistryIOException(rc); + else if (ERROR_NO_MORE_ITEMS != rc && ERROR_SUCCESS != rc) + throw RegistryException(rc); + +#if (_MSC_VER < 1300) && !defined(__MINGW32__) + return key_names; +#else + return (StringListPtr) key_names; +#endif +} + +//----------------------------------------------------- +/** +*/ +StringListPtr RegistryKeyImplWinNT::GetSubValueNames() const +{ + assert(IsOpen()); + + wchar_t buff[1024]; + DWORD buff_size = sizeof(buff); + + StringList* value_names = new StringList(); + + LONG rc = ERROR_SUCCESS; + + for (DWORD i = 0; /* left empty */; i++) + { + rc = RegEnumValueW( + m_hSubKey, i, buff, &buff_size, + 0, 0, 0, 0); + + if (ERROR_SUCCESS != rc && + ERROR_MORE_DATA != rc) + break; + + buff_size = sizeof(buff); + + value_names->push_back(buff); + } + + if (ERROR_INVALID_HANDLE == rc) + throw RegistryIOException(rc); + else if (ERROR_NO_MORE_ITEMS != rc && ERROR_SUCCESS != rc) + throw RegistryException(rc); + +#if (_MSC_VER < 1300) && !defined(__MINGW32__) + return value_names; +#else + return (StringListPtr) value_names; +#endif +} + +//----------------------------------------------------- +/** Get the specified registry value + + @precond IsOpen = true +*/ +RegistryValue RegistryKeyImplWinNT::GetValue(const std::wstring& Name) const +{ + assert(IsOpen()); + + DWORD Type; + wchar_t buff[MAX_TMP_BUFF_SIZE]; + DWORD size = sizeof(buff); + + LONG rc = RegQueryValueExW( + m_hSubKey, + Name.c_str(), + 0, + &Type, + reinterpret_cast<LPBYTE>(buff), + &size); + + if (ERROR_FILE_NOT_FOUND == rc) + throw RegistryValueNotFoundException(rc); + else if (ERROR_ACCESS_DENIED == rc) + throw RegistryAccessDeniedException(rc); + else if (ERROR_SUCCESS != rc) + throw RegistryException(rc); + + RegistryValue regval; + + if (REG_DWORD == Type) + { + regval = RegistryValue(new RegistryValueImpl(Name, *(reinterpret_cast<int*>(buff)))); + } + else if (REG_SZ == Type || REG_EXPAND_SZ == Type || REG_MULTI_SZ == Type) + { + if (size > 0) + regval = RegistryValue(new RegistryValueImpl(Name, std::wstring(reinterpret_cast<wchar_t*>(buff)))); + else + regval = RegistryValue(new RegistryValueImpl(Name, std::wstring())); + } + else + { + assert(false); + } + + return regval; +} + +//----------------------------------------------------- +/** Get the specified registry value, return the given + default value if value not found + + @precond IsOpen = true +*/ +RegistryValue RegistryKeyImplWinNT::GetValue(const std::wstring& Name, const RegistryValue& Default) const +{ + assert(IsOpen()); + + DWORD Type; + wchar_t buff[MAX_TMP_BUFF_SIZE]; + DWORD size = sizeof(buff); + + LONG rc = RegQueryValueExW( + m_hSubKey, + Name.c_str(), + 0, + &Type, + reinterpret_cast<LPBYTE>(buff), + &size); + + if (ERROR_FILE_NOT_FOUND == rc) + { + #if (_MSC_VER < 1300) && !defined(__MINGW32__) + return Default; + #else + RegistryValue regval_ptr; + regval_ptr = RegistryValue(new RegistryValueImpl(*Default)); + return regval_ptr; + #endif + } + + if (ERROR_ACCESS_DENIED == rc) + throw RegistryAccessDeniedException(rc); + else if (ERROR_SUCCESS != rc) + throw RegistryException(rc); + + RegistryValue regval; + + if (REG_DWORD == Type) + regval = RegistryValue(new RegistryValueImpl(Name, *reinterpret_cast<int*>(buff))); + else if (REG_SZ == Type || REG_EXPAND_SZ == Type || REG_MULTI_SZ == Type) + regval = RegistryValue(new RegistryValueImpl(Name, std::wstring(reinterpret_cast<wchar_t*>(buff)))); + else + assert(false); + + return regval; +} + + +//############################################ +// Commands +//############################################ + + +//----------------------------------------------------- +/** Open the registry key, has no effect if + the key is already open + + @precond IsOpen = false + + @throws RegistryKeyNotFoundException + RegistryWriteAccessDenyException + RegistryAccessDenyException +*/ +void RegistryKeyImplWinNT::Open(bool Writeable) +{ + assert(!IsOpen()); + + REGSAM regsam = KEY_READ; + + if (Writeable) + regsam |= KEY_WRITE; + + LONG rc = RegOpenKeyExW( + m_hRootKey, + m_KeyName.c_str(), + 0, + regsam, + &m_hSubKey); + + if (ERROR_FILE_NOT_FOUND == rc) + throw RegistryKeyNotFoundException(rc); + else if (ERROR_ACCESS_DENIED == rc) + throw RegistryAccessDeniedException(rc); + else if (ERROR_SUCCESS != rc) + throw RegistryException(rc); + + m_IsWriteable = Writeable; + + assert(IsOpen()); +} + +//----------------------------------------------------- +/** Open the specified sub-key of the registry key + at hand + + @precond IsOpen = true + HasSubKey(Name) = true + + @throws RegistryIOException + RegistryKeyNotFoundException + RegistryAccessDeniedException +*/ +RegistryKey RegistryKeyImplWinNT::OpenSubKey(const std::wstring& Name, bool Writeable) +{ + RegistryKey regkey(new RegistryKeyImplWinNT(m_hSubKey, Name)); + regkey->Open(Writeable); + return regkey; +} + +//----------------------------------------------------- +/** Creates a new sub-key below the key at hand + + @precond IsOpen = true + IsWriteable = true + + @throws RegistryIOException + RegistryWriteAccessDenyException +*/ + +RegistryKey RegistryKeyImplWinNT::CreateSubKey(const std::wstring& Name) +{ + assert(IsOpen()); + assert(IsWriteable()); + + HKEY hRoot = IsRootKey() ? m_hRootKey : m_hSubKey; + + HKEY hKey; + + LONG rc = RegCreateKeyExW( + hRoot, + Name.c_str(), + 0, + 0, + REG_OPTION_NON_VOLATILE, + KEY_READ | KEY_WRITE, + 0, + &hKey, + 0); + + if (ERROR_INVALID_HANDLE == rc) + throw RegistryIOException(rc); + else if (ERROR_ACCESS_DENIED == rc) + throw RegistryAccessDeniedException(rc); + else if (ERROR_SUCCESS != rc) + throw RegistryException(rc); + + return RegistryKey(new RegistryKeyImplWinNT(hRoot, hKey, Name)); +} + +//----------------------------------------------------- +/** Deletes a sub-key below the key at hand, the + key must not have sub-keys + + @precond IsOpen = true + IsWriteable = true + + @throws RegistryIOException + RegistryWriteAccessDenyException +*/ +void RegistryKeyImplWinNT::DeleteSubKey(const std::wstring& Name) +{ + assert(IsOpen()); + assert(IsWriteable()); + assert(HasSubKey(Name)); + + RegistryKey SubKey = OpenSubKey(Name); + + size_t nSubKeyCount = SubKey->GetSubKeyCount(); + + assert(0 == nSubKeyCount); + + if (nSubKeyCount) + throw RegistryInvalidOperationException(ERROR_NOT_SUPPORTED); + + LONG rc = RegDeleteKeyW(m_hSubKey, Name.c_str()); + + if (ERROR_INVALID_HANDLE == rc) + throw RegistryIOException(rc); + else if (ERROR_ACCESS_DENIED == rc) + throw RegistryAccessDeniedException(rc); + else if (ERROR_SUCCESS != rc) + throw RegistryException(rc); +} + +//----------------------------------------------------- +/** Deletes a sub-key below the key at hand with all + its sub-keys + + @precond IsOpen = true + IsWriteable = true; + + @throws RegistryIOException + RegistryWriteAccessDenyException +*/ +void RegistryKeyImplWinNT::DeleteSubKeyTree(const std::wstring& Name) +{ + ImplDeleteSubKeyTree(m_hSubKey, Name); +} + +//----------------------------------------------------- +/** Deletes a sub-key below the key at hand with all + its sub-keys + + @precond IsOpen = true + IsWriteable = true; + + @throws RegistryIOException + RegistryWriteAccessDenyException +*/ +LONG RegistryKeyImplWinNT::ImplDeleteSubKeyTree(HKEY RootKey, const std::wstring& Name) +{ + assert(IsOpen()); + + HKEY hKey; + + LONG rc = RegOpenKeyExW( + RootKey, + Name.c_str(), + 0, + KEY_READ | DELETE, + &hKey); + + if (ERROR_SUCCESS == rc) + { + wchar_t* lpSubKey; + DWORD nMaxSubKeyLen; + + rc = RegQueryInfoKeyW( + hKey, 0, 0, 0, 0, + &nMaxSubKeyLen, + 0, 0, 0, 0, 0, 0); + + nMaxSubKeyLen++; // space for trailing '\0' + + lpSubKey = reinterpret_cast<wchar_t*>( + _alloca(nMaxSubKeyLen*sizeof(wchar_t))); + + while (ERROR_SUCCESS == rc) + { + DWORD nLen = nMaxSubKeyLen; + + rc = RegEnumKeyExW( + hKey, + 0, // always index zero + lpSubKey, + &nLen, + 0, 0, 0, 0); + + if (ERROR_NO_MORE_ITEMS == rc) + { + rc = RegDeleteKeyW(RootKey, Name.c_str()); + break; + } + else if (rc == ERROR_SUCCESS) + { + rc = ImplDeleteSubKeyTree(hKey, lpSubKey); + } + + } // while + + RegCloseKey(hKey); + + } // if + + if (ERROR_INVALID_HANDLE == rc) + throw RegistryIOException(rc); + else if (ERROR_ACCESS_DENIED == rc) + throw RegistryAccessDeniedException(rc); + else if (ERROR_FILE_NOT_FOUND == rc) + throw RegistryKeyNotFoundException(rc); + else if (ERROR_SUCCESS != rc) + throw RegistryException(rc); + + return rc; +} + +//----------------------------------------------------- +/** Delete the specified value + + @precond IsOpen = true + IsWriteable = true + HasValue(Name) = true + + @throws RegistryIOException + RegistryWriteAccessDeniedException + RegistryValueNotFoundException +*/ +void RegistryKeyImplWinNT::DeleteValue(const std::wstring& Name) +{ + assert(IsOpen()); + assert(HasValue(Name)); + assert(IsWriteable()); + + LONG rc = RegDeleteValueW( + m_hSubKey, + Name.c_str()); + + if (ERROR_INVALID_HANDLE == rc) + throw RegistryIOException(rc); + else if (ERROR_ACCESS_DENIED == rc) + throw RegistryNoWriteAccessException(rc); + else if (ERROR_FILE_NOT_FOUND == rc) + throw RegistryValueNotFoundException(rc); + else if (ERROR_SUCCESS != rc) + throw RegistryException(rc); +} + +//----------------------------------------------------- +/** Set the specified registry value + + @precond IsOpen = true + IsWriteable = true + + @throws RegistryIOException + RegistryWriteAccessDenyException +*/ +void RegistryKeyImplWinNT::SetValue(const RegistryValue& Value) +{ + assert(IsOpen()); + assert(IsWriteable()); + + LONG rc = RegSetValueExW( + m_hSubKey, + Value->GetName().c_str(), + 0, + Value->GetType(), + reinterpret_cast<const unsigned char*>(Value->GetDataBuffer()), + static_cast<DWORD>(Value->GetDataSize())); + + if (ERROR_INVALID_HANDLE == rc) + throw RegistryIOException(rc); + else if (ERROR_ACCESS_DENIED == rc) + throw RegistryAccessDeniedException(rc); + else if (ERROR_SUCCESS != rc) + throw RegistryException(rc); +} + + + + diff --git a/setup_native/source/win32/customactions/reg4msdoc/registrywnt.hxx b/setup_native/source/win32/customactions/reg4msdoc/registrywnt.hxx new file mode 100644 index 000000000000..60d625d65a20 --- /dev/null +++ b/setup_native/source/win32/customactions/reg4msdoc/registrywnt.hxx @@ -0,0 +1,202 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#ifndef _REGISTRYWNT_HXX_ +#define _REGISTRYWNT_HXX_ + +#include "registry.hxx" + +//--------------------------------------- +// constants +//--------------------------------------- + +class RegistryKeyImplWinNT : public RegistryKeyImpl +{ +public: + + //############################################ + // Queries + //############################################ + + /** The number of sub values of the key at hand + + @precond IsOpen = true + + @throws + */ + virtual size_t GetSubValueCount() const; + + /** The number of sub-keys of the key at hand + + @precond IsOpen = true + + @throws + */ + virtual size_t GetSubKeyCount() const; + + virtual StringListPtr GetSubKeyNames() const; + + virtual StringListPtr GetSubValueNames() const; + + /** Get the specified registry value + + @precond IsOpen = true + */ + virtual RegistryValue GetValue(const std::wstring& Name) const; + + /** Get the specified registry value, return the given + default value if value not found + + @precond IsOpen = true + */ + virtual RegistryValue GetValue(const std::wstring& Name, const RegistryValue& Default) const; + + //############################################ + // Commands + //############################################ + + /** Open the registry key, has no effect if + the key is already open + + @precond IsOpen = false + + @throws RegistryWriteAccessDenyException + RegistryAccessDenyException + */ + virtual void Open(bool Writeable = true); + + /** Open the specified sub-key of the registry key + at hand + + @precond IsOpen = true + HasSubKey(Name) = true + + @throws RegistryIOException + RegistryKeyNotFoundException + RegistryAccessDeniedException + */ + virtual RegistryKey OpenSubKey(const std::wstring& Name, bool Writeable = true); + + /** Creates a new sub-key below the key at hand + + @precond IsOpen = true + IsWriteable = true + + @throws RegistryIOException + RegistryWriteAccessDenyException + */ + virtual RegistryKey CreateSubKey(const std::wstring& Name); + + /** Deletes a sub-key below the key at hand, the + key must not have sub-keys + + @precond IsOpen = true + IsWriteable = true + + @throws RegistryIOException + RegistryWriteAccessDenyException + */ + virtual void DeleteSubKey(const std::wstring& Name); + + /** Deletes a sub-key below the key at hand with all + its sub-keys + + @precond IsOpen = true + IsWriteable = true; + + @throws RegistryIOException + RegistryWriteAccessDenyException + */ + virtual void DeleteSubKeyTree(const std::wstring& Name); + + /** Delete the specified value + + @precond IsOpen = true + IsWriteable = true + HasValue(Name) = true + + @throws RegistryIOException + RegistryWriteAccessDeniedException + RegistryValueNotFoundException + */ + virtual void DeleteValue(const std::wstring& Name); + + /** Set the specified registry value + + @precond IsOpen = true + IsWriteable = true + + @throws RegistryIOException + RegistryWriteAccessDenyException + */ + virtual void SetValue(const RegistryValue& Value); + + //############################################ + // Creation + // + // only possible through WindowsRegistry class + //############################################ + +protected: + /** Create instance and open the specified Registry key + + @throws RegistryWriteAccessDenyException + RegistryAccessDenyException + RegistryKeyNotFoundException + */ + RegistryKeyImplWinNT(HKEY RootKey, const std::wstring& KeyName); + + /** Create instance and open the specified Registry key + + @throws RegistryWriteAccessDenyException + RegistryAccessDenyException + RegistryKeyNotFoundException + */ + RegistryKeyImplWinNT(HKEY RootKey); + + /** Create an instances of the specified Registry key, + the key is assumed to be already opened. + */ + RegistryKeyImplWinNT(HKEY RootKey, HKEY SubKey, const std::wstring& KeyName, bool Writeable = true); + +private: + + LONG ImplDeleteSubKeyTree(HKEY RootKey, const std::wstring& Name); + +//prevent copy and assignment +private: + RegistryKeyImplWinNT(const RegistryKeyImplWinNT&); + RegistryKeyImplWinNT& operator=(const RegistryKeyImplWinNT&); + +//###################################### +// Friend declarations +//###################################### + +friend class WindowsRegistry; +}; + +#endif diff --git a/setup_native/source/win32/customactions/reg4msdoc/stringconverter.cxx b/setup_native/source/win32/customactions/reg4msdoc/stringconverter.cxx new file mode 100644 index 000000000000..68d0872ad81a --- /dev/null +++ b/setup_native/source/win32/customactions/reg4msdoc/stringconverter.cxx @@ -0,0 +1,70 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#include "stringconverter.hxx" + +#ifdef _MSC_VER +#pragma warning(push, 1) /* disable warnings within system headers */ +#endif +#include <windows.h> +#ifdef _MSC_VER +#pragma warning(pop) +#endif + +#include <malloc.h> + +/** Convert a Unicode string to an ANSI string based on CP_ACP +*/ +std::string UnicodeToAnsiString(const std::wstring& UniString) +{ + int len = WideCharToMultiByte( + CP_ACP, 0, UniString.c_str(), -1, 0, 0, 0, 0); + + char* buff = reinterpret_cast<char*>(_alloca(len)); + + WideCharToMultiByte( + CP_ACP, 0, UniString.c_str(), -1, buff, len, 0, 0); + + return std::string(buff); +} + +/** Convert an ANSI string to unicode based on CP_ACP +*/ +std::wstring AnsiToUnicodeString(const std::string& AnsiString) +{ + int len = MultiByteToWideChar( + CP_ACP, 0, AnsiString.c_str(), -1, 0, 0); + + wchar_t* buff = reinterpret_cast<wchar_t*>(_alloca(len * sizeof(wchar_t))); + + MultiByteToWideChar( + CP_ACP, 0, AnsiString.c_str(), -1, buff, len); + + return std::wstring(buff); +} + + diff --git a/setup_native/source/win32/customactions/reg4msdoc/stringconverter.hxx b/setup_native/source/win32/customactions/reg4msdoc/stringconverter.hxx new file mode 100644 index 000000000000..0764da3f64c3 --- /dev/null +++ b/setup_native/source/win32/customactions/reg4msdoc/stringconverter.hxx @@ -0,0 +1,41 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#ifndef _STRINGCONVERTER_HXX_ +#define _STRINGCONVERTER_HXX_ + +#include <string> + +/** Convert a Unicode string to an ANSI string based on CP_ACP +*/ +std::string UnicodeToAnsiString(const std::wstring& UniString); + +/** Convert an ANSI string to unicode based on CP_ACP +*/ +std::wstring AnsiToUnicodeString(const std::string& AnsiString); + +#endif diff --git a/setup_native/source/win32/customactions/reg4msdoc/userregistrar.cxx b/setup_native/source/win32/customactions/reg4msdoc/userregistrar.cxx new file mode 100644 index 000000000000..68d3a1e2205d --- /dev/null +++ b/setup_native/source/win32/customactions/reg4msdoc/userregistrar.cxx @@ -0,0 +1,136 @@ +// UserRegistrar.cpp: Implementierung der Klasse UserRegistrar. +// +////////////////////////////////////////////////////////////////////// + +#include "userregistrar.hxx" +#include "registryvalueimpl.hxx" +#include "windowsregistry.hxx" +#include "registryexception.hxx" + +#ifdef _MSC_VER +#pragma warning(disable : 4350) +#endif + +//-------------------------------------- +/** +*/ +UserRegistrar::UserRegistrar(const RegistrationContextInformation& RegContext) : + Registrar(RegContext) +{ + RegistryKey RegKey = WindowsRegistry().GetCurrentUserKey(); + m_RootKey = RegKey->OpenSubKey(L"Software\\Classes"); +} + +//################################### +// Command +//################################### + +//-------------------------------------- +/** +*/ +void UserRegistrar::UnregisterAsHtmlEditorForInternetExplorer() const +{ + Registrar::UnregisterAsHtmlEditorForInternetExplorer(); + + DeleteHtmFileAssociationKeys(); + + try + { + RegistryKey RegKey = m_RootKey->OpenSubKey(L"Applications"); + if ((0 == RegKey->GetSubValueCount()) && (0 == RegKey->GetSubKeyCount())) + { + RegKey->Close(); + m_RootKey->DeleteSubKey(L"Applications"); + } + } + catch(RegistryKeyNotFoundException&) + { + } +} + +//-------------------------------------- +/** +*/ +void UserRegistrar::RegisterAsDefaultShellHtmlEditor() const +{ + RegistryKey LocalHtmKey = m_RootKey->CreateSubKey(L".htm"); + + if (!LocalHtmKey->HasValue(DEFAULT_VALUE_NAME)) + { + RegistryKey HKCRKey = WindowsRegistry().GetClassesRootKey(); + + if (HKCRKey->HasSubKey(L".htm")) + { + RegistryKey RootHtmKey = HKCRKey->OpenSubKey(L".htm", false); + + if (RootHtmKey->HasValue(DEFAULT_VALUE_NAME)) + { + RegistryValue RegVal = RootHtmKey->GetValue(DEFAULT_VALUE_NAME); + + std::wstring RootHtmFwdKey = RegVal->GetDataAsUniString(); + + if (HKCRKey->HasSubKey(RootHtmFwdKey)) + { + m_RootKey->CreateSubKey(RootHtmFwdKey); + LocalHtmKey->CopyValue(RootHtmKey, DEFAULT_VALUE_NAME); + } + } + } + } + + // calling base class method + Registrar::RegisterAsDefaultShellHtmlEditor(); +} + +//-------------------------------------- +/** +*/ +void UserRegistrar::UnregisterAsDefaultShellHtmlEditor() const +{ + // calling base class method + Registrar::UnregisterAsDefaultShellHtmlEditor(); + DeleteHtmFileAssociationKeys(); +} + +//-------------------------------------- +/** +*/ +void UserRegistrar::UnregisterForMsOfficeApplication( + const std::wstring& FileExtension) const +{ + /// calling base class method + Registrar::UnregisterForMsOfficeApplication(FileExtension); + + if (m_RootKey->HasSubKey(FileExtension)) + { + RegistryKey RegKey = m_RootKey->OpenSubKey(FileExtension); + + if ((0 == RegKey->GetSubKeyCount()) && (0 == RegKey->GetSubValueCount())) + { + RegKey->Close(); + m_RootKey->DeleteSubKey(FileExtension); + } + } +} + +//-------------------------------------- +/** +*/ +RegistryKey UserRegistrar::GetRootKeyForDefHtmlEditorForIERegistration() const +{ + return WindowsRegistry().GetCurrentUserKey(); +} + +//-------------------------------------- +/** +*/ +void UserRegistrar::DeleteHtmFileAssociationKeys() const +{ + // Later delete the created keys if they are empty and have not changed meanwhile. + // Remeber: if we create a new registry key in the user part of the + // registry, changes to that key via the merged key HKEY_CLASSES_ROOT + // go into the user branch HKEY_CURRENT_USER and are not visible for other users. + // so we must carefully detect if the keys have not changed in order to prevent accidentally + // deleting a key and so destroying existing associations + // See MSDN: "Merged View of HKEY_CLASSES_ROOT" +} diff --git a/setup_native/source/win32/customactions/reg4msdoc/userregistrar.hxx b/setup_native/source/win32/customactions/reg4msdoc/userregistrar.hxx new file mode 100644 index 000000000000..926a873e52db --- /dev/null +++ b/setup_native/source/win32/customactions/reg4msdoc/userregistrar.hxx @@ -0,0 +1,43 @@ +// UserRegistrar.h: Schnittstelle für die Klasse UserRegistrar. +// +////////////////////////////////////////////////////////////////////// + +#ifndef _USERREGISTRAR_HXX_ +#define _USERREGISTRAR_HXX_ + +#include "registrar.hxx" + +class UserRegistrar : public Registrar +{ +public: + + //################################### + // Creation + //################################### + + UserRegistrar(const RegistrationContextInformation& RegContext); + + //################################### + // Command + //################################### + + virtual void UnregisterAsHtmlEditorForInternetExplorer() const; + + virtual void RegisterAsDefaultShellHtmlEditor() const; + virtual void UnregisterAsDefaultShellHtmlEditor() const; + +protected: + virtual void UnregisterForMsOfficeApplication( + const std::wstring& FileExtension) const; + + virtual RegistryKey GetRootKeyForDefHtmlEditorForIERegistration() const; + +private: + + /** Delete the privately created file associations + for htm files if the keys are empty + */ + void DeleteHtmFileAssociationKeys() const; +}; + +#endif diff --git a/setup_native/source/win32/customactions/reg4msdoc/windowsregistry.cxx b/setup_native/source/win32/customactions/reg4msdoc/windowsregistry.cxx new file mode 100644 index 000000000000..1ed544f06806 --- /dev/null +++ b/setup_native/source/win32/customactions/reg4msdoc/windowsregistry.cxx @@ -0,0 +1,79 @@ +// WindowsRegistry.cpp: Implementierung der Klasse WindowsRegistry. +// +////////////////////////////////////////////////////////////////////// + +#include "windowsregistry.hxx" +#include "registrywnt.hxx" +#include "registryw9x.hxx" + +#ifdef _MSC_VER +#pragma warning(disable : 4350) +#endif + +//------------------------------ +// +//------------------------------ + +WindowsRegistry::WindowsRegistry() +{ + OSVERSIONINFOA osverinfo; + ZeroMemory(&osverinfo, sizeof(osverinfo)); + osverinfo.dwOSVersionInfoSize = sizeof(osverinfo); + GetVersionExA(&osverinfo); + + m_IsWinNT = (osverinfo.dwPlatformId == VER_PLATFORM_WIN32_NT); +} + +//------------------------------ +// +//------------------------------ + +RegistryKey WindowsRegistry::GetClassesRootKey(bool Writeable) const +{ + return GetRegistryKey(HKEY_CLASSES_ROOT, Writeable); +} + +//------------------------------ +// +//------------------------------ + +RegistryKey WindowsRegistry::GetCurrentUserKey(bool Writeable) const +{ + return GetRegistryKey(HKEY_CURRENT_USER, Writeable); +} + +//------------------------------ +// +//------------------------------ + +RegistryKey WindowsRegistry::GetLocalMachineKey(bool Writeable) const +{ + return GetRegistryKey(HKEY_LOCAL_MACHINE, Writeable); +} + +//------------------------------ +// +//------------------------------ + +RegistryKey WindowsRegistry::GetUserKey(bool Writeable) const +{ + return GetRegistryKey(HKEY_USERS, Writeable); +} + +//------------------------------ +// +//------------------------------ + +RegistryKey WindowsRegistry::GetRegistryKey(HKEY RootKey, bool Writeable) const +{ + RegistryKey regkey; + + if (m_IsWinNT) + regkey = RegistryKey(new RegistryKeyImplWinNT(RootKey)); + else + regkey = RegistryKey(new RegistryKeyImplWin9x(RootKey)); + + regkey->Open(Writeable); + + return regkey; +} diff --git a/setup_native/source/win32/customactions/reg4msdoc/windowsregistry.hxx b/setup_native/source/win32/customactions/reg4msdoc/windowsregistry.hxx new file mode 100644 index 000000000000..a99259d8f0bd --- /dev/null +++ b/setup_native/source/win32/customactions/reg4msdoc/windowsregistry.hxx @@ -0,0 +1,40 @@ +// WindowsRegistry.h: Schnittstelle für die Klasse WindowsRegistry. +// +////////////////////////////////////////////////////////////////////// + +#ifndef _WINDOWSREGISTRY_HXX_ +#define _WINDOWSREGISTRY_HXX_ + +#ifdef _MSC_VER +#pragma warning(push, 1) /* disable warnings within system headers */ +#endif +#include <windows.h> +#ifdef _MSC_VER +#pragma warning(pop) +#endif + +#include "Registry.hxx" + +/** Basically a factory class +*/ +class WindowsRegistry +{ +public: + WindowsRegistry(); + + RegistryKey GetClassesRootKey(bool Writeable = true) const; + + RegistryKey GetCurrentUserKey(bool Writeable = true) const; + + RegistryKey GetLocalMachineKey(bool Writeable = true) const; + + RegistryKey GetUserKey(bool Writeable = true) const; + +private: + RegistryKey GetRegistryKey(HKEY RootKey, bool Writeable) const; + +private: + bool m_IsWinNT; +}; + +#endif diff --git a/setup_native/source/win32/customactions/reg64/exports.dxp b/setup_native/source/win32/customactions/reg64/exports.dxp new file mode 100755 index 000000000000..3282da1eeac0 --- /dev/null +++ b/setup_native/source/win32/customactions/reg64/exports.dxp @@ -0,0 +1,2 @@ +InstallReg64 +DeinstallReg64 diff --git a/setup_native/source/win32/customactions/reg64/makefile.mk b/setup_native/source/win32/customactions/reg64/makefile.mk new file mode 100644 index 000000000000..04117c10365d --- /dev/null +++ b/setup_native/source/win32/customactions/reg64/makefile.mk @@ -0,0 +1,108 @@ +#************************************************************************* +# +# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. +# +# Copyright 2000, 2010 Oracle and/or its affiliates. +# +# OpenOffice.org - a multi-platform office productivity suite +# +# This file is part of OpenOffice.org. +# +# OpenOffice.org is free software: you can redistribute it and/or modify +# it under the terms of the GNU Lesser General Public License version 3 +# only, as published by the Free Software Foundation. +# +# OpenOffice.org is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU Lesser General Public License version 3 for more details +# (a copy is included in the LICENSE file that accompanied this code). +# +# You should have received a copy of the GNU Lesser General Public License +# version 3 along with OpenOffice.org. If not, see +# <http://www.openoffice.org/license.html> +# for a copy of the LGPLv3 License. +# +#************************************************************************* + +PRJ=..$/..$/..$/.. +PRJNAME=setup_native +TARGET=reg64msi + +# --- Settings ----------------------------------------------------- + +ENABLE_EXCEPTIONS=TRUE +NO_DEFAULT_STL=TRUE +DYNAMIC_CRT= +USE_DEFFILE=TRUE +EXTERNAL_WARNINGS_NOT_ERRORS := TRUE + +.INCLUDE : settings.mk + +.IF "$(USE_SYSTEM_STL)" != "YES" +CFLAGS+=-D_STLP_USE_STATIC_LIB +.ENDIF + +#Disable precompiled header +CDEFS+=-Dnot_used_define_to_disable_pch + +# --- Files -------------------------------------------------------- + +.IF "$(GUI)"=="WNT" + +UWINAPILIB= + +SLOFILES = \ + $(SLO)$/reg64.obj + +STDSHL += \ + $(KERNEL32LIB)\ + $(USER32LIB)\ + $(ADVAPI32LIB)\ + $(SHELL32LIB)\ + $(MSILIB)\ + $(SHLWAPILIB)\ + +# msvcprt.lib + +SHL1TARGET = $(TARGET) +SHL1IMPLIB = i$(TARGET) + +SHL1OBJS=$(SLOFILES) +SHL1DEF = $(MISC)$/$(SHL1TARGET).def +SHL1DEPN = $(SLB)$/$(TARGET).lib +DEF1NAME=$(SHL1TARGET) +DEF1EXPORTFILE=exports.dxp + +.ENDIF + + +# --- mapimailer -------------------------------------------------------- + +#TARGETTYPE=CUI + +#OBJFILES= $(OBJ)$/reg64.obj + +#APP1TARGET=reg64 +#APP1OBJS=$(OBJFILES) +#APP1STDLIBS=$(KERNEL32LIB)\ +# $(ADVAPI32LIB)\ +# $(MSILIB)\ +# $(SHELL32LIB)\ +# msvcprt.lib\ +# $(OLE32LIB)\ +# $(COMCTL32LIB)\ +# $(UUIDLIB) + + +#APP1DEF=$(MISC)$/$(APP1TARGET).def + +# --- Targets -------------------------------------------------------------- + +.INCLUDE : target.mk +INCLUDE!:=$(subst,/stl, $(INCLUDE)) +.EXPORT : INCLUDE + +# ------------------------------------------------------------------------- + + diff --git a/setup_native/source/win32/customactions/reg64/reg64.cxx b/setup_native/source/win32/customactions/reg64/reg64.cxx new file mode 100644 index 000000000000..2264a228030d --- /dev/null +++ b/setup_native/source/win32/customactions/reg64/reg64.cxx @@ -0,0 +1,475 @@ +/************************************************************************* +* + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * +************************************************************************/ + +/* + +*/ + + +#define UNICODE + +#ifdef _MSC_VER +#pragma warning(push, 1) /* disable warnings within system headers */ +#endif +#define WIN32_LEAN_AND_MEAN +#include <windows.h> +#include <msiquery.h> +#ifdef _MSC_VER +#pragma warning(pop) +#endif + +#include <malloc.h> +//#include <string> +//#include <map> +#include <strsafe.h> + +// 10.11.2009 tkr: MinGW doesn't know anything about RegDeleteKeyExW if WINVER < 0x0502. +extern "C" { +WINADVAPI LONG WINAPI RegDeleteKeyExW(HKEY,LPCWSTR,REGSAM,DWORD); +} + +// 06.11.2009 tkr: to provide windows xp as build systems for mingw we need to define KEY_WOW64_64KEY +// in mingw 3.13 KEY_WOW64_64KEY isn't available < Win2003 systems. +// Also defined in setup_native\source\win32\customactions\reg64\reg64.cxx,source\win32\customactions\shellextensions\shellextensions.cxx and +// extensions\source\activex\main\so_activex.cpp +#ifndef KEY_WOW64_64KEY + #define KEY_WOW64_64KEY (0x0100) +#endif + + +#define TABLE_NAME L"Reg64" +#define BASISINSTALLLOCATION L"[BASISINSTALLLOCATION]" + +bool isInstall4AllUsers; +wchar_t * sBasisInstallLocation; + + +enum OPERATION { + SET, + REMOVE +}; + +#ifdef DEBUG +inline void OutputDebugStringFormat( const wchar_t* pFormat, ... ) +{ + wchar_t buffer[1024]; + va_list args; + + va_start( args, pFormat ); + StringCchVPrintf( buffer, sizeof(buffer), pFormat, args ); + OutputDebugString( buffer ); +} +#else +static inline void OutputDebugStringFormat( const wchar_t*, ... ) +{ +} +#endif + +bool WriteRegistry( MSIHANDLE & hMSI, OPERATION op, const wchar_t* componentName) +{ + INSTALLSTATE current_state; + INSTALLSTATE comp_state; + UINT ret = MsiGetComponentState( hMSI, componentName, ¤t_state, &comp_state ); + if ( ERROR_SUCCESS == ret ) + { + if (current_state == INSTALLSTATE_ABSENT) + OutputDebugStringFormat(L"WriteRegistry - current_state: INSTALLSTATE_ABSENT"); + else if (current_state == INSTALLSTATE_DEFAULT) + OutputDebugStringFormat(L"WriteRegistry - current_state: INSTALLSTATE_DEFAULT"); + else if (current_state == INSTALLSTATE_LOCAL) + OutputDebugStringFormat(L"WriteRegistry - current_state: INSTALLSTATE_LOCAL"); + else if (current_state == INSTALLSTATE_REMOVED) + OutputDebugStringFormat(L"WriteRegistry - current_state: INSTALLSTATE_REMOVED"); + else if (current_state == INSTALLSTATE_SOURCE) + OutputDebugStringFormat(L"WriteRegistry - current_state: INSTALLSTATE_SOURCE"); + else if (current_state == INSTALLSTATE_UNKNOWN) + OutputDebugStringFormat(L"WriteRegistry - current_state: INSTALLSTATE_UNKNOWN"); + + if (comp_state == INSTALLSTATE_ABSENT) + OutputDebugStringFormat(L"WriteRegistry - comp_state: INSTALLSTATE_ABSENT"); + else if (comp_state == INSTALLSTATE_DEFAULT) + OutputDebugStringFormat(L"WriteRegistry - comp_state: INSTALLSTATE_DEFAULT"); + else if (comp_state == INSTALLSTATE_LOCAL) + OutputDebugStringFormat(L"WriteRegistry - comp_state: INSTALLSTATE_LOCAL"); + else if (comp_state == INSTALLSTATE_REMOVED) + OutputDebugStringFormat(L"WriteRegistry - comp_state: INSTALLSTATE_REMOVED"); + else if (comp_state == INSTALLSTATE_SOURCE) + OutputDebugStringFormat(L"WriteRegistry - comp_state: INSTALLSTATE_SOURCE"); + else if (comp_state == INSTALLSTATE_UNKNOWN) + OutputDebugStringFormat(L"WriteRegistry - comp_state: INSTALLSTATE_UNKNOWN"); + + switch (op) + { + case SET : + if ( comp_state == INSTALLSTATE_LOCAL || ( current_state == INSTALLSTATE_LOCAL && comp_state == INSTALLSTATE_UNKNOWN ) ) + { + return true; + } + break; + case REMOVE: + OutputDebugStringFormat(L"WriteRegistry - Remove\n" ); + if ( current_state == INSTALLSTATE_LOCAL && (comp_state == INSTALLSTATE_ABSENT || comp_state == INSTALLSTATE_REMOVED) ) + { + OutputDebugStringFormat(L"WriteRegistry - To be removed\n" ); + return true; + } + } + } else + { + if (ERROR_INVALID_HANDLE == ret) OutputDebugStringFormat(L"WriteRegistry - Invalid handle"); + if (ERROR_UNKNOWN_FEATURE == ret) OutputDebugStringFormat(L"WriteRegistry - Unknown feature"); + } + + return false; +} + +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 ) +{ + OutputDebugStringFormat(L"GetMsiProp - START\n" ); + DWORD sz = 0; + UINT ret = MsiGetProperty( hMSI, pPropName, L"", &sz ); + if ( ret == 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 ); + + OutputDebugStringFormat(L"GetMsiProp - Value" ); + OutputDebugStringFormat( buff ); + *ppValue = buff; + + return TRUE; + } else if (ret == ERROR_INVALID_HANDLE) + { + OutputDebugStringFormat(L"GetMsiProp - ERROR_INVALID_HANDLE" ); + } else if (ret == ERROR_INVALID_PARAMETER) + { + OutputDebugStringFormat(L"GetMsiProp - ERROR_INVALID_PARAMETER" ); + } else if (ret == ERROR_SUCCESS) + { + OutputDebugStringFormat(L"GetMsiProp - ERROR_SUCCESS" ); + } + + + OutputDebugStringFormat(L"GetMsiProp - ENDE\n" ); + return FALSE; +} + +bool IsInstallForAllUsers( MSIHANDLE hMSI ) +{ + OutputDebugStringFormat(L"IsInstallForAllUsers - START\n" ); + bool bResult = FALSE; + wchar_t* pVal = NULL; + if ( GetMsiProp( hMSI, L"ALLUSERS", &pVal ) && pVal ) + { + bResult = UnicodeEquals( pVal , L"1" ); + free( pVal ); + } + + OutputDebugStringFormat(L"IsInstallForAllUsers - ENDE\n" ); + return bResult; +} + +wchar_t* GetBasisInstallLocation( MSIHANDLE hMSI ) +{ + OutputDebugStringFormat(L"GetBasisInstallLocation - START\n" ); + bool bResult = FALSE; + wchar_t* pVal = NULL; + GetMsiProp( hMSI, L"BASISINSTALLLOCATION", &pVal); + + OutputDebugStringFormat(L"GetBasisInstallLocation - ENDE\n" ); + return pVal; +} + + +bool QueryReg64Table(MSIHANDLE& rhDatabase, MSIHANDLE& rhView) +{ + OutputDebugStringFormat(L"QueryReg64Table - START\n" ); + int const arraysize = 400; + wchar_t szSelect[arraysize]; + StringCbPrintfW(szSelect, arraysize * sizeof(wchar_t), L"SELECT * FROM %s",TABLE_NAME); + OutputDebugStringFormat( szSelect ); + + UINT ret = MsiDatabaseOpenView(rhDatabase,szSelect,&rhView); + if (ret != ERROR_SUCCESS) + { + if ( ret == ERROR_BAD_QUERY_SYNTAX) + OutputDebugStringFormat(L"QueryReg64Table - MsiDatabaseOpenView - FAILED - ERROR_BAD_QUERY_SYNTAX\n" ); + if ( ret == ERROR_INVALID_HANDLE) + OutputDebugStringFormat(L"QueryReg64Table - MsiDatabaseOpenView - FAILED - ERROR_INVALID_HANDLE\n" ); + return false; + } + // execute query - not a parameter query so second parameter is NULL. + if (MsiViewExecute(rhView,NULL) != ERROR_SUCCESS) + { + OutputDebugStringFormat(L"QueryReg64Table - MsiViewExecute - FAILED\n" ); + return false; + } + + OutputDebugStringFormat(L"QueryReg64Table - ENDE\n" ); + return true; +} + +//--------------------------------------- +bool DeleteRegistryKey(HKEY RootKey, const wchar_t* KeyName) +{ + int rc = RegDeleteKeyExW( + RootKey, KeyName, KEY_WOW64_64KEY, 0); + + return (ERROR_SUCCESS == rc); +} + + + + +//--------------------------------------- +// +//--------------------------------------- + +bool SetRegistryKey(HKEY RootKey, const wchar_t* KeyName, const wchar_t* ValueName, const wchar_t* Value) +{ + HKEY hSubKey; + + // open or create the desired key + int rc = RegCreateKeyEx( + RootKey, KeyName, 0, NULL, REG_OPTION_NON_VOLATILE, KEY_WRITE | KEY_WOW64_64KEY, 0, &hSubKey, 0); + + if (ERROR_SUCCESS == rc) + { + OutputDebugStringFormat(L"SetRegistryKey - Created\n" ); + rc = RegSetValueEx( + hSubKey, ValueName, 0, REG_SZ, reinterpret_cast<const BYTE*>(Value), (wcslen(Value) + 1) * sizeof(wchar_t)); + + RegCloseKey(hSubKey); + } else { + OutputDebugStringFormat(L"SetRegistryKey - FAILED\n" ); + } + + + return (ERROR_SUCCESS == rc); +} + +bool DoRegEntries( MSIHANDLE& rhMSI, OPERATION op, MSIHANDLE& rhView) +{ + OutputDebugStringFormat(L"DoRegEntries - START\n" ); + + MSIHANDLE hRecord; + + long lRoot; + wchar_t szKey[255]; + wchar_t szName[255]; + wchar_t szValue[1024]; + wchar_t szComponent[255]; + + /// read records until there are no more records + while (MsiViewFetch(rhView,&hRecord) == ERROR_SUCCESS) + { + DWORD dwKey = 255; + DWORD dwName = 255; + DWORD dwValue = 1024; + DWORD dwComponent = 255; + + szKey[0] = '\0'; + szName[0] = '\0'; + szValue[0] = '\0'; + szComponent[0] = '\0'; + + lRoot = MsiRecordGetInteger(hRecord,2); + MsiRecordGetString(hRecord,3,szKey,&dwKey); + + if (!MsiRecordIsNull(hRecord, 4)) + MsiRecordGetString(hRecord,4,szName,&dwName); + + if (!MsiRecordIsNull(hRecord, 5)) + { + MsiRecordGetString(hRecord,5,szValue,&dwValue); + + + + wchar_t* nPos = wcsstr(szValue , BASISINSTALLLOCATION); + if ( NULL != nPos) + { + + DWORD nPrefixSize = nPos - szValue; + + DWORD nPropSize = wcslen(sBasisInstallLocation); + DWORD nPostfixSize = dwValue - wcslen( BASISINSTALLLOCATION ); + + DWORD nNewValueBytes = (nPropSize + nPostfixSize + 1) * sizeof( wchar_t ); + wchar_t* newValue = reinterpret_cast<wchar_t*>( malloc( nNewValueBytes ) ); + ZeroMemory( newValue, nNewValueBytes ); + + // prefix + wcsncpy(newValue, szValue, nPrefixSize); + + // basis location + wcsncat(newValue, sBasisInstallLocation, nPropSize * sizeof( wchar_t )); + + // postfix + wcsncat(newValue, nPos + ( wcslen( BASISINSTALLLOCATION ) ), nPropSize * sizeof( wchar_t )); + + wcsncpy(szValue, newValue, nNewValueBytes <=1024? nNewValueBytes: 1024); + + free(newValue); + } + + } + + + MsiRecordGetString(hRecord,6,szComponent,&dwComponent); + + OutputDebugStringFormat(L"****** DoRegEntries *******" ); + OutputDebugStringFormat(L"Root:" ); + HKEY key = HKEY_CURRENT_USER; + switch (lRoot) + { + case(-1): + if (isInstall4AllUsers) + { + key = HKEY_LOCAL_MACHINE; + OutputDebugStringFormat(L"HKEY_LOCAL_MACHINE" ); + } + else + { + key = HKEY_CURRENT_USER; + OutputDebugStringFormat(L"HKEY_CURRENT_USER" ); + } + break; + case(0): + key = HKEY_CLASSES_ROOT; + OutputDebugStringFormat(L"HKEY_CLASSES_ROOT" ); + break; + case(1): + key = HKEY_CURRENT_USER; + OutputDebugStringFormat(L"HKEY_CURRENT_USER" ); + break; + case(2): + key = HKEY_LOCAL_MACHINE; + OutputDebugStringFormat(L"HKEY_LOCAL_MACHINE" ); + break; + case(3): + key = HKEY_USERS; + OutputDebugStringFormat(L"HKEY_USERS" ); + break; + default: + OutputDebugStringFormat(L"Unknown Root!" ); + break; + } + + OutputDebugStringFormat(L"Key:"); + OutputDebugStringFormat( szKey ); + OutputDebugStringFormat(L"Name:"); + OutputDebugStringFormat( szName ); + OutputDebugStringFormat(L"Value:"); + OutputDebugStringFormat( szValue); + OutputDebugStringFormat(L"Component:"); + OutputDebugStringFormat( szComponent ); + OutputDebugStringFormat(L"*******************" ); + switch (op) + { + case SET: + + if (WriteRegistry(rhMSI, SET, szComponent)) + { + OutputDebugStringFormat(L"DoRegEntries - Write\n" ); + SetRegistryKey(key, szKey, szName, szValue); + } + break; + case REMOVE: + OutputDebugStringFormat(L"DoRegEntries - PreRemove\n" ); + if (WriteRegistry(rhMSI, REMOVE, szComponent)) + { + OutputDebugStringFormat(L"DoRegEntries - Remove\n" ); + DeleteRegistryKey(key, szKey); + } + break; + } + } + + MsiCloseHandle(rhView); + + + OutputDebugStringFormat(L"DoRegEntries - ENDE\n" ); + + return true; +} + + +bool Reg64(MSIHANDLE& rhMSI, OPERATION op) +{ + isInstall4AllUsers = IsInstallForAllUsers(rhMSI); + sBasisInstallLocation = GetBasisInstallLocation(rhMSI); + + if (NULL == sBasisInstallLocation) + { + OutputDebugStringFormat(L"BASISINSTALLLOCATION is NULL\n" ); + return false; + } + + MSIHANDLE hView; + MSIHANDLE hDatabase = MsiGetActiveDatabase(rhMSI); + + QueryReg64Table(hDatabase, hView); + OutputDebugStringFormat(L"Do something\n" ); + DoRegEntries( rhMSI, op, hView); + OutputDebugStringFormat(L"Something done\n" ); + + MsiCloseHandle(hView); + MsiCloseHandle(hDatabase); + free(sBasisInstallLocation); + + return true; +} + +extern "C" UINT __stdcall InstallReg64(MSIHANDLE hMSI) +{ + OutputDebugStringFormat(L"InstallReg64\n" ); + Reg64(hMSI, SET); + return ERROR_SUCCESS; +} + +extern "C" UINT __stdcall DeinstallReg64(MSIHANDLE hMSI) +{ + OutputDebugStringFormat(L"DeinstallReg64\n" ); + Reg64(hMSI, REMOVE); + return ERROR_SUCCESS; +}
\ No newline at end of file diff --git a/setup_native/source/win32/customactions/regactivex/exports.dxp b/setup_native/source/win32/customactions/regactivex/exports.dxp new file mode 100644 index 000000000000..0ad8ce403a81 --- /dev/null +++ b/setup_native/source/win32/customactions/regactivex/exports.dxp @@ -0,0 +1,2 @@ +InstallActiveXControl +DeinstallActiveXControl diff --git a/setup_native/source/win32/customactions/regactivex/makefile.mk b/setup_native/source/win32/customactions/regactivex/makefile.mk new file mode 100644 index 000000000000..cc71dc39ada1 --- /dev/null +++ b/setup_native/source/win32/customactions/regactivex/makefile.mk @@ -0,0 +1,70 @@ +#************************************************************************* +# +# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. +# +# Copyright 2000, 2010 Oracle and/or its affiliates. +# +# OpenOffice.org - a multi-platform office productivity suite +# +# This file is part of OpenOffice.org. +# +# OpenOffice.org is free software: you can redistribute it and/or modify +# it under the terms of the GNU Lesser General Public License version 3 +# only, as published by the Free Software Foundation. +# +# OpenOffice.org is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU Lesser General Public License version 3 for more details +# (a copy is included in the LICENSE file that accompanied this code). +# +# You should have received a copy of the GNU Lesser General Public License +# version 3 along with OpenOffice.org. If not, see +# <http://www.openoffice.org/license.html> +# for a copy of the LGPLv3 License. +# +#************************************************************************* + +PRJ=..$/..$/..$/.. +PRJNAME=setup_native +TARGET=regactivex + +# --- Settings ----------------------------------------------------- + +ENABLE_EXCEPTIONS=TRUE +NO_DEFAULT_STL=TRUE +DYNAMIC_CRT= +USE_DEFFILE=TRUE + +.INCLUDE : settings.mk + +# --- Files -------------------------------------------------------- + +.IF "$(GUI)"=="WNT" + +UWINAPILIB= + +SLOFILES = $(SLO)$/regactivex.obj + +STDSHL += \ + $(MSILIB) + +SHL1LIBS = $(SLB)$/$(TARGET).lib + +SHL1TARGET = $(TARGET) +SHL1IMPLIB = i$(TARGET) + +SHL1DEF = $(MISC)$/$(SHL1TARGET).def +SHL1DEPN = $(SLB)$/$(TARGET).lib +SHL1BASE = 0x1c000000 +DEF1NAME=$(SHL1TARGET) +DEF1EXPORTFILE=exports.dxp + +.ENDIF + +# --- Targets -------------------------------------------------------------- + +.INCLUDE : target.mk + +# ------------------------------------------------------------------------- + diff --git a/setup_native/source/win32/customactions/regactivex/regactivex.cxx b/setup_native/source/win32/customactions/regactivex/regactivex.cxx new file mode 100644 index 000000000000..1e91ccbd8599 --- /dev/null +++ b/setup_native/source/win32/customactions/regactivex/regactivex.cxx @@ -0,0 +1,438 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#define UNICODE + +#ifdef _MSC_VER +#pragma warning(push, 1) /* disable warnings within system headers */ +#endif +#include <windows.h> +#include <msiquery.h> +#ifdef _MSC_VER +#pragma warning(pop) +#endif + +#include <string.h> +#include <malloc.h> + +#define CHART_COMPONENT 1 +#define DRAW_COMPONENT 2 +#define IMPRESS_COMPONENT 4 +#define CALC_COMPONENT 8 +#define WRITER_COMPONENT 16 +#define MATH_COMPONENT 32 + +// #define OWN_DEBUG_PRINT + +typedef int ( __stdcall * DllNativeRegProc ) ( int, BOOL, BOOL, const char* ); +typedef int ( __stdcall * DllNativeUnregProc ) ( int, BOOL, BOOL ); + +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 ); +} + +//---------------------------------------------------------- +char* UnicodeToAnsiString( wchar_t* pUniString ) +{ + int len = WideCharToMultiByte( + CP_ACP, 0, pUniString, -1, 0, 0, 0, 0 ); + + char* buff = reinterpret_cast<char*>( malloc( len ) ); + + WideCharToMultiByte( + CP_ACP, 0, pUniString, -1, buff, len, 0, 0 ); + + return buff; +} + +#ifdef OWN_DEBUG_PRINT +void WarningMessageInt( wchar_t* pWarning, unsigned int nValue ) +{ + wchar_t pStr[5] = { nValue%10000/1000 + 48, nValue%1000/100 + 48, nValue%100/10 + 48, nValue%10 + 48, 0 }; + MessageBox(NULL, pStr, pWarning, MB_OK | MB_ICONINFORMATION); +} +#endif + +//---------------------------------------------------------- +void RegisterActiveXNative( const char* pActiveXPath, int nMode, BOOL InstallForAllUser, BOOL InstallFor64Bit ) +{ +#ifdef OWN_DEBUG_PRINT + MessageBoxW(NULL, L"RegisterActiveXNative", L"Information", MB_OK | MB_ICONINFORMATION); + MessageBoxA(NULL, pActiveXPath, "Library Path", MB_OK | MB_ICONINFORMATION); +#endif + + // For Win98/WinME the values should be written to the local machine + OSVERSIONINFO aVerInfo; + aVerInfo.dwOSVersionInfoSize = sizeof( aVerInfo ); + if ( GetVersionEx( &aVerInfo ) && aVerInfo.dwPlatformId != VER_PLATFORM_WIN32_NT ) + InstallForAllUser = TRUE; + + HINSTANCE hModule = LoadLibraryExA( pActiveXPath, NULL, LOAD_WITH_ALTERED_SEARCH_PATH ); + if( !( hModule <= ( HINSTANCE )HINSTANCE_ERROR ) ) + { + DllNativeRegProc pNativeProc = ( DllNativeRegProc )GetProcAddress( hModule, "DllRegisterServerNative" ); + if( pNativeProc!=NULL ) + { +#ifdef OWN_DEBUG_PRINT + MessageBoxA(NULL, pActiveXPath, "Library Path", MB_OK | MB_ICONINFORMATION); +#endif + int nLen = strlen( pActiveXPath ); + int nRemoveLen = strlen( "\\so_activex.dll" ); + if ( nLen > nRemoveLen ) + { + char* pProgramPath = reinterpret_cast<char*>( malloc( nLen - nRemoveLen + 1 ) ); + strncpy( pProgramPath, pActiveXPath, nLen - nRemoveLen ); + pProgramPath[ nLen - nRemoveLen ] = 0; + + ( *pNativeProc )( nMode, InstallForAllUser, InstallFor64Bit, pProgramPath ); + + free( pProgramPath ); + } + } + + FreeLibrary( hModule ); + } +} + +//---------------------------------------------------------- +void UnregisterActiveXNative( const char* pActiveXPath, int nMode, BOOL InstallForAllUser, BOOL InstallFor64Bit ) +{ + // For Win98/WinME the values should be written to the local machine + OSVERSIONINFO aVerInfo; + aVerInfo.dwOSVersionInfoSize = sizeof( aVerInfo ); + if ( GetVersionEx( &aVerInfo ) && aVerInfo.dwPlatformId != VER_PLATFORM_WIN32_NT ) + InstallForAllUser = TRUE; + + HINSTANCE hModule = LoadLibraryExA( pActiveXPath, NULL, LOAD_WITH_ALTERED_SEARCH_PATH ); + if( !( hModule <= ( HINSTANCE )HINSTANCE_ERROR ) ) + { + DllNativeUnregProc pNativeProc = ( DllNativeUnregProc )GetProcAddress( hModule, "DllUnregisterServerNative" ); + if( pNativeProc!=NULL ) + ( *pNativeProc )( nMode, InstallForAllUser, InstallFor64Bit ); + + FreeLibrary( hModule ); + } +} + +//---------------------------------------------------------- +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"OFFICEINSTALLLOCATION", &pProgPath ) && pProgPath ) + { + char* pCharProgPath = UnicodeToAnsiString( pProgPath ); +#ifdef OWN_DEBUG_PRINT + MessageBox(NULL, pProgPath, L"Basis Installation Path", MB_OK | MB_ICONINFORMATION); + MessageBoxA(NULL, pCharProgPath, "Basis Installation Path( char )", MB_OK | MB_ICONINFORMATION); +#endif + + if ( pCharProgPath ) + { + int nLen = strlen( pCharProgPath ); + *ppActiveXPath = reinterpret_cast<char*>( malloc( nLen + 23 ) ); + strncpy( *ppActiveXPath, pCharProgPath, nLen ); + strncpy( (*ppActiveXPath) + nLen, "program\\so_activex.dll", 22 ); + (*ppActiveXPath)[nLen+22] = 0; + + free( pCharProgPath ); + + return TRUE; + } + + free( pProgPath ); + } + + return FALSE; +} + +//---------------------------------------------------------- +BOOL GetDelta( MSIHANDLE hMSI, int& nOldInstallMode, int& nInstallMode, int& nDeinstallMode ) +{ + // for now the chart is always installed + nOldInstallMode = CHART_COMPONENT; + nInstallMode = CHART_COMPONENT; + nDeinstallMode = 0; + + INSTALLSTATE current_state; + INSTALLSTATE future_state; + + if ( ERROR_SUCCESS == MsiGetFeatureState( hMSI, L"gm_p_Wrt_Bin", ¤t_state, &future_state ) ) + { +#ifdef OWN_DEBUG_PRINT + WarningMessageInt( L"writer current_state = ", current_state ); + WarningMessageInt( L"writer future_state = ", future_state ); +#endif + + // analyze writer installation mode + if ( current_state == INSTALLSTATE_LOCAL ) + nOldInstallMode |= WRITER_COMPONENT; + + if ( future_state == INSTALLSTATE_LOCAL + || ( current_state == INSTALLSTATE_LOCAL && future_state == INSTALLSTATE_UNKNOWN ) ) + nInstallMode |= WRITER_COMPONENT; + else if ( current_state == INSTALLSTATE_LOCAL && future_state == INSTALLSTATE_ABSENT ) + nDeinstallMode |= WRITER_COMPONENT; + } + else + { + // assert( FALSE ); + } + + if ( ERROR_SUCCESS == MsiGetFeatureState( hMSI, L"gm_p_Calc_Bin", ¤t_state, &future_state ) ) + { +#ifdef OWN_DEBUG_PRINT + WarningMessageInt( L"calc current_state = ", current_state ); + WarningMessageInt( L"calc future_state = ", future_state ); +#endif + + // analyze calc installation mode + if ( current_state == INSTALLSTATE_LOCAL ) + nOldInstallMode |= CALC_COMPONENT; + + if ( future_state == INSTALLSTATE_LOCAL + || ( current_state == INSTALLSTATE_LOCAL && future_state == INSTALLSTATE_UNKNOWN ) ) + nInstallMode |= CALC_COMPONENT; + else if ( current_state == INSTALLSTATE_LOCAL && future_state == INSTALLSTATE_ABSENT ) + nDeinstallMode |= CALC_COMPONENT; + } + else + { + // assert( FALSE ); + } + + if ( ERROR_SUCCESS == MsiGetFeatureState( hMSI, L"gm_p_Draw_Bin", ¤t_state, &future_state ) ) + { + // analyze draw installation mode + if ( current_state == INSTALLSTATE_LOCAL ) + nOldInstallMode |= DRAW_COMPONENT; + + if ( future_state == INSTALLSTATE_LOCAL + || ( current_state == INSTALLSTATE_LOCAL && future_state == INSTALLSTATE_UNKNOWN ) ) + nInstallMode |= DRAW_COMPONENT; + else if ( current_state == INSTALLSTATE_LOCAL && future_state == INSTALLSTATE_ABSENT ) + nDeinstallMode |= DRAW_COMPONENT; + } + else + { + // assert( FALSE ); + } + + if ( ERROR_SUCCESS == MsiGetFeatureState( hMSI, L"gm_p_Impress_Bin", ¤t_state, &future_state ) ) + { + // analyze impress installation mode + if ( current_state == INSTALLSTATE_LOCAL ) + nOldInstallMode |= IMPRESS_COMPONENT; + + if ( future_state == INSTALLSTATE_LOCAL + || ( current_state == INSTALLSTATE_LOCAL && future_state == INSTALLSTATE_UNKNOWN ) ) + nInstallMode |= IMPRESS_COMPONENT; + else if ( current_state == INSTALLSTATE_LOCAL && future_state == INSTALLSTATE_ABSENT ) + nDeinstallMode |= IMPRESS_COMPONENT; + } + else + { + // assert( FALSE ); + } + + if ( ERROR_SUCCESS == MsiGetFeatureState( hMSI, L"gm_p_Math_Bin", ¤t_state, &future_state ) ) + { + // analyze math installation mode + if ( current_state == INSTALLSTATE_LOCAL ) + nOldInstallMode |= MATH_COMPONENT; + + if ( future_state == INSTALLSTATE_LOCAL + || ( current_state == INSTALLSTATE_LOCAL && future_state == INSTALLSTATE_UNKNOWN ) ) + nInstallMode |= MATH_COMPONENT; + else if ( current_state == INSTALLSTATE_LOCAL && future_state == INSTALLSTATE_ABSENT ) + nDeinstallMode |= MATH_COMPONENT; + } + else + { + // assert( FALSE ); + } + + return TRUE; +} + +//---------------------------------------------------------- +BOOL MakeInstallForAllUsers( MSIHANDLE hMSI ) +{ + BOOL bResult = FALSE; + wchar_t* pVal = NULL; + if ( GetMsiProp( hMSI, L"ALLUSERS", &pVal ) && pVal ) + { + bResult = UnicodeEquals( pVal , L"1" ); + free( pVal ); + } + + return bResult; +} + +//---------------------------------------------------------- +BOOL MakeInstallFor64Bit( MSIHANDLE hMSI ) +{ + BOOL bResult = FALSE; + wchar_t* pVal = NULL; + if ( GetMsiProp( hMSI, L"VersionNT64", &pVal ) && pVal ) + { + bResult = TRUE; + free( pVal ); + } + + return bResult; +} +//---------------------------------------------------------- +extern "C" UINT __stdcall InstallActiveXControl( MSIHANDLE hMSI ) +{ + int nOldInstallMode = 0; + int nInstallMode = 0; + int nDeinstallMode = 0; + +#ifdef OWN_DEBUG_PRINT + MessageBox(NULL, L"InstallActiveXControl", L"Information", MB_OK | MB_ICONINFORMATION); +#endif + + INSTALLSTATE current_state; + INSTALLSTATE future_state; + + if ( ERROR_SUCCESS == MsiGetFeatureState( hMSI, L"gm_o_Activexcontrol", ¤t_state, &future_state ) ) + { +#ifdef OWN_DEBUG_PRINT + MessageBox(NULL, L"InstallActiveXControl Step2", L"Information", MB_OK | MB_ICONINFORMATION); +#endif + + BOOL bInstallForAllUser = MakeInstallForAllUsers( hMSI ); + BOOL bInstallFor64Bit = MakeInstallFor64Bit( hMSI ); + + char* pActiveXPath = NULL; + if ( GetActiveXControlPath( hMSI, &pActiveXPath ) && pActiveXPath + && GetDelta( hMSI, nOldInstallMode, nInstallMode, nDeinstallMode ) ) + { +#ifdef OWN_DEBUG_PRINT + MessageBox(NULL, L"InstallActiveXControl Step3", L"Information", MB_OK | MB_ICONINFORMATION); +#endif + + if ( future_state == INSTALLSTATE_LOCAL + || ( current_state == INSTALLSTATE_LOCAL && future_state == INSTALLSTATE_UNKNOWN ) ) + { +#ifdef OWN_DEBUG_PRINT + MessageBox(NULL, L"InstallActiveXControl, adjusting", L"Information", MB_OK | MB_ICONINFORMATION); + WarningMessageInt( L"nInstallMode = ", nInstallMode ); +#endif + // the control is installed in the new selected configuration + + if ( current_state == INSTALLSTATE_LOCAL && nDeinstallMode ) + UnregisterActiveXNative( pActiveXPath, nDeinstallMode, bInstallForAllUser, bInstallFor64Bit ); + + if ( nInstallMode ) + RegisterActiveXNative( pActiveXPath, nInstallMode, bInstallForAllUser, bInstallFor64Bit ); + } + else if ( current_state == INSTALLSTATE_LOCAL && future_state == INSTALLSTATE_ABSENT ) + { +#ifdef OWN_DEBUG_PRINT + MessageBox(NULL, L"InstallActiveXControl, removing", L"Information", MB_OK | MB_ICONINFORMATION); +#endif + if ( nOldInstallMode ) + UnregisterActiveXNative( pActiveXPath, nOldInstallMode, bInstallForAllUser, bInstallFor64Bit ); + } + } + + if ( pActiveXPath ) + free( pActiveXPath ); + } + else + { + // assert( FALSE ); + } + + return ERROR_SUCCESS; +} + +//---------------------------------------------------------- +extern "C" UINT __stdcall DeinstallActiveXControl( MSIHANDLE hMSI ) +{ + INSTALLSTATE current_state; + INSTALLSTATE future_state; + +#ifdef OWN_DEBUG_PRINT + MessageBox(NULL, L"DeinstallActiveXControl", L"Information", MB_OK | MB_ICONINFORMATION); +#endif + + if ( ERROR_SUCCESS == MsiGetFeatureState( hMSI, L"gm_o_Activexcontrol", ¤t_state, &future_state ) ) + { + char* pActiveXPath = NULL; + if ( current_state == INSTALLSTATE_LOCAL && GetActiveXControlPath( hMSI, &pActiveXPath ) && pActiveXPath ) + { + BOOL bInstallForAllUser = MakeInstallForAllUsers( hMSI ); + BOOL bInstallFor64Bit = MakeInstallFor64Bit( hMSI ); + + { + UnregisterActiveXNative( pActiveXPath, + CHART_COMPONENT + | DRAW_COMPONENT + | IMPRESS_COMPONENT + | CALC_COMPONENT + | WRITER_COMPONENT + | MATH_COMPONENT, + bInstallForAllUser, + bInstallFor64Bit ); + } + + free( pActiveXPath ); + } + } + + return ERROR_SUCCESS; +} diff --git a/setup_native/source/win32/customactions/regpatchactivex/exports.dxp b/setup_native/source/win32/customactions/regpatchactivex/exports.dxp new file mode 100644 index 000000000000..c1d75133584b --- /dev/null +++ b/setup_native/source/win32/customactions/regpatchactivex/exports.dxp @@ -0,0 +1 @@ +PatchActiveXControl diff --git a/setup_native/source/win32/customactions/regpatchactivex/makefile.mk b/setup_native/source/win32/customactions/regpatchactivex/makefile.mk new file mode 100644 index 000000000000..d79593abcc69 --- /dev/null +++ b/setup_native/source/win32/customactions/regpatchactivex/makefile.mk @@ -0,0 +1,93 @@ +#************************************************************************* +# +# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. +# +# Copyright 2000, 2010 Oracle and/or its affiliates. +# +# OpenOffice.org - a multi-platform office productivity suite +# +# This file is part of OpenOffice.org. +# +# OpenOffice.org is free software: you can redistribute it and/or modify +# it under the terms of the GNU Lesser General Public License version 3 +# only, as published by the Free Software Foundation. +# +# OpenOffice.org is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU Lesser General Public License version 3 for more details +# (a copy is included in the LICENSE file that accompanied this code). +# +# You should have received a copy of the GNU Lesser General Public License +# version 3 along with OpenOffice.org. If not, see +# <http://www.openoffice.org/license.html> +# for a copy of the LGPLv3 License. +# +#************************************************************************* + +PRJ=..$/..$/..$/.. +PRJNAME=setup_native +TARGET=regpatchactivex +USE_DEFFILE=TRUE + +.IF "$(GUI)"=="WNT" + +# --- Settings ----------------------------------------------------- + +# NO_DEFAULT_STL=TRUE +ENABLE_EXCEPTIONS=TRUE + +.INCLUDE : settings.mk + +STDSHL= +# SOLARINC!:=$(SOLARINC:s/stl//) + +# --- Files -------------------------------------------------------- + +INCPRE+=.\Include +.DIRCACHE=NO +# CFLAGS+=-E + +SLOFILES = $(SLO)$/regpatchactivex.obj + +.IF "$(COM)"=="GCC" +SHL1STDLIBS += -lstdc++ +.IF "$(MINGW_GCCLIB_EH)"=="YES" +SHL1STDLIBS += -lgcc_eh +.ENDIF +SHL1STDLIBS += -lgcc -lmingw32 -lmoldname -lmsvcrt +.ELSE +SHL1STDLIBS= +.ENDIF + +SHL1STDLIBS+= $(KERNEL32LIB)\ + $(USER32LIB)\ + $(ADVAPI32LIB)\ + $(SHELL32LIB)\ + $(MSILIB) +.IF "$(COM)"!="GCC" +SHL1STDLIBS+= libcmt.lib +.ENDIF + + +SHL1LIBS = $(SLB)$/$(TARGET).lib + +#SHL1TARGET = $(TARGET)$(DLLPOSTFIX) +SHL1TARGET = $(TARGET) +SHL1IMPLIB = i$(TARGET) + +SHL1DEF = $(MISC)$/$(SHL1TARGET).def +SHL1DEPN = $(SLB)$/$(TARGET).lib +SHL1BASE = 0x1c000000 +DEF1NAME=$(SHL1TARGET) +DEF1EXPORTFILE=exports.dxp + +# --- Targets -------------------------------------------------------------- + +.INCLUDE : target.mk + +# ------------------------------------------------------------------------- + + +.ENDIF + diff --git a/setup_native/source/win32/customactions/regpatchactivex/regpatchactivex.cxx b/setup_native/source/win32/customactions/regpatchactivex/regpatchactivex.cxx new file mode 100644 index 000000000000..99efedbb696b --- /dev/null +++ b/setup_native/source/win32/customactions/regpatchactivex/regpatchactivex.cxx @@ -0,0 +1,122 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#define UNICODE + +#ifdef _MSC_VER +#pragma warning(push,1) // disable warnings within system headers +#endif +#include <windows.h> +#include <msiquery.h> +#ifdef _MSC_VER +#pragma warning(pop) +#endif + +#include <string.h> +#include <malloc.h> +#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 ) + { + bResult = UnicodeEquals( pVal , L"1" ); + free( pVal ); + } + + return bResult; +} + +//---------------------------------------------------------- +extern "C" UINT __stdcall PatchActiveXControl( MSIHANDLE hMSI ) +{ + // MessageBox(NULL, L"PatchActiveXControl", L"Information", MB_OK | MB_ICONINFORMATION); + + INSTALLSTATE current_state; + INSTALLSTATE future_state; + + if ( ERROR_SUCCESS == MsiGetFeatureState( hMSI, L"gm_o_Activexcontrol", ¤t_state, &future_state ) ) + { + BOOL bInstallForAllUsers = MakeInstallForAllUsers( hMSI ); + + if ( future_state == INSTALLSTATE_LOCAL + || ( current_state == INSTALLSTATE_LOCAL && future_state == INSTALLSTATE_UNKNOWN ) ) + { + HKEY hkey = NULL; + char* aSubKey = "Software\\Classes\\MIME\\DataBase\\Content Type\\application/vnd.sun.xml.base"; + if ( ERROR_SUCCESS == RegCreateKeyA(bInstallForAllUsers ? HKEY_LOCAL_MACHINE : HKEY_CURRENT_USER, aSubKey, &hkey) ) + { + RegDeleteValueA( hkey, "CLSID" ); + RegCloseKey( hkey ), hkey = NULL; + } + } + } + else + { + // assert( FALSE ); + } + + return ERROR_SUCCESS; +} + + diff --git a/setup_native/source/win32/customactions/relnotes/exports.dxp b/setup_native/source/win32/customactions/relnotes/exports.dxp new file mode 100644 index 000000000000..55a454d3d58f --- /dev/null +++ b/setup_native/source/win32/customactions/relnotes/exports.dxp @@ -0,0 +1,3 @@ +ShowReleaseNotesBefore +ShowReleaseNotesAfter +ShowSurveyAfter diff --git a/setup_native/source/win32/customactions/relnotes/makefile.mk b/setup_native/source/win32/customactions/relnotes/makefile.mk new file mode 100644 index 000000000000..4c29ead8bd6c --- /dev/null +++ b/setup_native/source/win32/customactions/relnotes/makefile.mk @@ -0,0 +1,83 @@ +#************************************************************************* +# +# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. +# +# Copyright 2000, 2010 Oracle and/or its affiliates. +# +# OpenOffice.org - a multi-platform office productivity suite +# +# This file is part of OpenOffice.org. +# +# OpenOffice.org is free software: you can redistribute it and/or modify +# it under the terms of the GNU Lesser General Public License version 3 +# only, as published by the Free Software Foundation. +# +# OpenOffice.org is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU Lesser General Public License version 3 for more details +# (a copy is included in the LICENSE file that accompanied this code). +# +# You should have received a copy of the GNU Lesser General Public License +# version 3 along with OpenOffice.org. If not, see +# <http://www.openoffice.org/license.html> +# for a copy of the LGPLv3 License. +# +#************************************************************************* + +PRJ=..$/..$/..$/.. +PRJNAME=setup_native +TARGET=relnotes + + +# --- Settings ----------------------------------------------------- + +ENABLE_EXCEPTIONS=TRUE +NO_DEFAULT_STL=TRUE +DYNAMIC_CRT= +USE_DEFFILE=TRUE + +.INCLUDE : settings.mk + +CDEFS+=-DUNICODE +.IF "$(USE_SYSTEM_STL)" != "YES" +CDEFS+=-D_STLP_USE_STATIC_LIB +.ENDIF + +UWINAPILIB= + +# --- Files -------------------------------------------------------- + +.IF "$(GUI)"=="WNT" + +SLOFILES = $(SLO)$/relnotes.obj + +STDSHL+= \ + $(ADVAPI32LIB)\ + $(SHELL32LIB)\ + $(MSILIB) + +.IF "$(USE_SYSTEM_STL)" != "YES" +STDSHL+=$(LIBSTLPORTST) +.ENDIF + +SHL1LIBS = $(SLB)$/$(TARGET).lib + +SHL1TARGET = $(TARGET) +SHL1IMPLIB = i$(TARGET) + +SHL1DEF = $(MISC)$/$(SHL1TARGET).def +SHL1DEPN = $(SLB)$/$(TARGET).lib +SHL1BASE = 0x1c000000 +DEF1NAME=$(SHL1TARGET) +DEF1EXPORTFILE=exports.dxp + +.ENDIF + +# --- Targets -------------------------------------------------------------- + +.INCLUDE : target.mk + +# ------------------------------------------------------------------------- + + diff --git a/setup_native/source/win32/customactions/relnotes/relnotes.cxx b/setup_native/source/win32/customactions/relnotes/relnotes.cxx new file mode 100644 index 000000000000..d4dc7d6ecfa6 --- /dev/null +++ b/setup_native/source/win32/customactions/relnotes/relnotes.cxx @@ -0,0 +1,186 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#ifdef _MSC_VER +#pragma warning(push,1) // disable warnings within system headers +#pragma warning(disable: 4917) +#endif +#include <windows.h> +#include <msiquery.h> +#include <shlobj.h> +#ifdef _MSC_VER +#pragma warning(pop) +#endif + +#include <string.h> +#include <malloc.h> +#include <stdio.h> +#include <strsafe.h> +#include <string> + +//---------------------------------------------------------- +#ifdef DEBUG +inline void OutputDebugStringFormat( LPCTSTR pFormat, ... ) +{ + TCHAR buffer[1024]; + va_list args; + + va_start( args, pFormat ); + StringCchVPrintf( buffer, sizeof(buffer), pFormat, args ); + OutputDebugString( buffer ); +} +#else +static inline void OutputDebugStringFormat( LPCTSTR, ... ) +{ +} +#endif + +//---------------------------------------------------------- +inline bool IsValidHandle( HANDLE handle ) +{ + return (NULL != handle) && (INVALID_HANDLE_VALUE != handle); +} + +//---------------------------------------------------------- +static bool GetMsiProp(MSIHANDLE handle, LPCTSTR name, /*out*/std::wstring& value) +{ + DWORD sz = 0; + LPTSTR dummy = TEXT(""); + if (MsiGetProperty(handle, name, dummy, &sz) == ERROR_MORE_DATA) + { + sz++; + DWORD nbytes = sz * sizeof(TCHAR); + LPTSTR buff = reinterpret_cast<LPTSTR>(_alloca(nbytes)); + ZeroMemory(buff, nbytes); + MsiGetProperty(handle, name, buff, &sz); + value = buff; + return true; + } + return false; +} + +//---------------------------------------------------------- +//---------------------------------------------------------- +//---------------------------------------------------------- +UINT ShowReleaseNotes( TCHAR* pFileName, TCHAR* pFilePath ) +{ + TCHAR sFullPath[ MAX_PATH ]; + + if ( FAILED( StringCchCopy( sFullPath, MAX_PATH, pFilePath ) ) ) + { + OutputDebugStringFormat( TEXT("DEBUG: ShowReleaseNotes: Could not copy path [%s]"), pFilePath ); + return ERROR_SUCCESS; + } + + if ( FAILED( StringCchCat( sFullPath, MAX_PATH, pFileName ) ) ) + { + OutputDebugStringFormat( TEXT("DEBUG: ShowReleaseNotes: Could not append filename [%s]"), pFileName ); + return ERROR_SUCCESS; + } + + HANDLE hFile = CreateFile( sFullPath, 0, 0, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL); + + if ( IsValidHandle(hFile) ) + { + CloseHandle( hFile ); + OutputDebugStringFormat( TEXT("DEBUG: ShowReleaseNotes: Found file [%s]"), sFullPath ); + + SHELLEXECUTEINFOW aExecInf; + ZeroMemory( &aExecInf, sizeof( aExecInf ) ); + + aExecInf.cbSize = sizeof( aExecInf ); + aExecInf.fMask = SEE_MASK_FLAG_DDEWAIT | SEE_MASK_FLAG_NO_UI; + aExecInf.lpVerb = TEXT("open"); + aExecInf.lpFile = sFullPath; + aExecInf.lpDirectory = NULL; + aExecInf.nShow = SW_SHOWNORMAL; + + SetLastError( 0 ); + ShellExecuteEx( &aExecInf ); + } + else + { + OutputDebugStringFormat( TEXT("DEBUG: ShowReleaseNotes: File not found [%s]"), sFullPath ); + } + + return ERROR_SUCCESS; +} + +//---------------------------------------------------------- +extern "C" UINT __stdcall ShowReleaseNotesBefore( MSIHANDLE ) +{ + TCHAR szPath[MAX_PATH]; + + if( FAILED( SHGetSpecialFolderPath( NULL, szPath, CSIDL_COMMON_DOCUMENTS, true ) ) ) + return ERROR_SUCCESS; + + OutputDebugString( TEXT("DEBUG: ShowReleaseNotesBefore called") ); + + return ShowReleaseNotes( TEXT("\\sun\\releasenote1.url"), szPath ); +} + +//---------------------------------------------------------- +extern "C" UINT __stdcall ShowReleaseNotesAfter( MSIHANDLE ) +{ + TCHAR szPath[MAX_PATH]; + + if( FAILED( SHGetSpecialFolderPath( NULL, szPath, CSIDL_COMMON_DOCUMENTS, true ) ) ) + return ERROR_SUCCESS; + + OutputDebugString( TEXT("DEBUG: ShowReleaseNotesAfter called") ); + + return ShowReleaseNotes( TEXT("\\sun\\releasenote2.url"), szPath ); +} + +//---------------------------------------------------------- +extern "C" UINT __stdcall ShowSurveyAfter( MSIHANDLE handle ) +{ + std::wstring prodname; + + GetMsiProp( handle, TEXT("ProductName"), prodname ); + std::wstring::size_type nIndex = prodname.find( TEXT( "OpenOffice.org" ) ); + if( std::wstring::npos == nIndex ) + return ERROR_SUCCESS; + + OutputDebugString( TEXT("DEBUG: ShowSurveyAfter called") ); + + SHELLEXECUTEINFOW aExecInf; + ZeroMemory( &aExecInf, sizeof( aExecInf ) ); + + aExecInf.cbSize = sizeof( aExecInf ); + aExecInf.fMask = SEE_MASK_FLAG_DDEWAIT | SEE_MASK_FLAG_NO_UI; + aExecInf.lpVerb = TEXT("open"); + aExecInf.lpFile = TEXT("http://surveys.services.openoffice.org/deinstall"); + aExecInf.lpDirectory = NULL; + aExecInf.nShow = SW_SHOWNORMAL; + + SetLastError( 0 ); + ShellExecuteEx( &aExecInf ); + + return ERROR_SUCCESS; +} + diff --git a/setup_native/source/win32/customactions/shellextensions/checkdirectory.cxx b/setup_native/source/win32/customactions/shellextensions/checkdirectory.cxx new file mode 100755 index 000000000000..ebd9de5e7fbe --- /dev/null +++ b/setup_native/source/win32/customactions/shellextensions/checkdirectory.cxx @@ -0,0 +1,117 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#define _WIN32_WINNT 0x0401 + +#ifdef _MSC_VER +#pragma warning(push, 1) /* disable warnings within system headers */ +#endif +#define WIN32_LEAN_AND_MEAN +#include <windows.h> +#include <msiquery.h> +#ifdef _MSC_VER +#pragma warning(pop) +#endif + +#include <malloc.h> +#include <assert.h> + +#ifdef UNICODE +#define _UNICODE +#define _tstring wstring +#else +#define _tstring string +#endif +#include <tchar.h> +#include <string> +#include <queue> +#include <stdio.h> + +#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")); + + // MessageBox(NULL, sInstallPath.c_str(), "DEBUG", MB_OK); + + // unsetting all properties + + UnsetMsiProperty( handle, TEXT("DIRECTORY_NOT_EMPTY") ); + + // 1. Searching for file setup.ini + + std::_tstring sSetupIniPath = sInstallPath + sOfficeHostnamePath + TEXT("\\program\\setup.ini"); + + WIN32_FIND_DATA data; + HANDLE hdl = FindFirstFile(sSetupIniPath.c_str(), &data); + + // std::_tstring mystr = "Searching for " + sSetupIniPath; + // MessageBox(NULL, mystr.c_str(), "DEBUG", MB_OK); + + if ( IsValidHandle(hdl) ) + { + // setup.ini found -> directory cannot be used for installation. + 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"; + // MessageBox(NULL, notEmptyStr.c_str(), notEmptyTitle.c_str(), MB_OK); + } + + return ERROR_SUCCESS; +} diff --git a/setup_native/source/win32/customactions/shellextensions/checkpatches.cxx b/setup_native/source/win32/customactions/shellextensions/checkpatches.cxx new file mode 100644 index 000000000000..07c84d890316 --- /dev/null +++ b/setup_native/source/win32/customactions/shellextensions/checkpatches.cxx @@ -0,0 +1,113 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#define _WIN32_WINNT 0x0401 + +#ifdef _MSC_VER +#pragma warning(push, 1) /* disable warnings within system headers */ +#endif +#define WIN32_LEAN_AND_MEAN +#include <windows.h> +#include <msiquery.h> +#ifdef _MSC_VER +#pragma warning(pop) +#endif + +#include <malloc.h> +#include <assert.h> + +#ifdef UNICODE +#define _UNICODE +#define _tstring wstring +#else +#define _tstring string +#endif +#include <tchar.h> +#include <string> +#include <queue> +#include <stdio.h> +#include <strsafe.h> + +#include <systools/win32/uwinapi.h> + +//---------------------------------------------------------- +#ifdef DEBUG +inline void OutputDebugStringFormat( LPCSTR pFormat, ... ) +{ + CHAR buffer[1024]; + va_list args; + + va_start( args, pFormat ); + StringCchVPrintfA( buffer, sizeof(buffer), pFormat, args ); + OutputDebugStringA( buffer ); +} +#else +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") ); + + OutputDebugStringFormat( "CheckPatchList called with PATCH=%s and PRQ= %s\n", sPatchList.c_str(), sRequiredPatch.c_str() ); + + if ( ( sPatchList.length() != 0 ) && ( sRequiredPatch.length() != 0 ) ) + { + if ( _tcsstr( sPatchList.c_str(), sRequiredPatch.c_str() ) ) + { + SetMsiProperty( handle, TEXT("IGNOREPREREQUIREDPATCH") ); + OutputDebugStringFormat( "Set Property IgnorePrerequiredPatch!\n" ); + } + } + return ERROR_SUCCESS; +} diff --git a/setup_native/source/win32/customactions/shellextensions/checkrunningoffice.cxx b/setup_native/source/win32/customactions/shellextensions/checkrunningoffice.cxx new file mode 100755 index 000000000000..09f60b7a66d5 --- /dev/null +++ b/setup_native/source/win32/customactions/shellextensions/checkrunningoffice.cxx @@ -0,0 +1,290 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#define _WIN32_WINDOWS 0x0410 + +#ifdef _MSC_VER +#pragma warning(push, 1) /* disable warnings within system headers */ +#endif +#define WIN32_LEAN_AND_MEAN +#include <windows.h> +#include <msiquery.h> +#ifdef _MSC_VER +#pragma warning(pop) +#endif + +#include <malloc.h> +#include <assert.h> + +#ifdef UNICODE +#define _UNICODE +#define _tstring wstring +#else +#define _tstring string +#endif +#include <tchar.h> +#include <string> +#include <queue> +#include <stdio.h> + +#include <systools/win32/uwinapi.h> +#include <../tools/seterror.hxx> + +#define WININIT_FILENAME "wininit.ini" +#define RENAME_SECTION "rename" + +#ifdef DEBUG +inline void OutputDebugStringFormat( LPCTSTR pFormat, ... ) +{ + _TCHAR buffer[1024]; + va_list args; + + va_start( args, pFormat ); + _vsntprintf( buffer, elementsof(buffer), pFormat, args ); + OutputDebugString( buffer ); +} +#else +static inline void OutputDebugStringFormat( LPCTSTR, ... ) +{ +} +#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 inline bool IsSetMsiProperty(MSIHANDLE handle, const std::_tstring& sProperty) +{ + std::_tstring value = GetMsiProperty(handle, sProperty); + return (value.length() > 0); +} + +static inline void UnsetMsiProperty(MSIHANDLE handle, const std::_tstring& sProperty) +{ + MsiSetProperty(handle, sProperty.c_str(), NULL); +} + +static inline void SetMsiProperty(MSIHANDLE handle, const std::_tstring& sProperty) +{ + MsiSetProperty(handle, sProperty.c_str(), TEXT("1")); +} + +static BOOL MoveFileEx9x( LPCSTR lpExistingFileNameA, LPCSTR lpNewFileNameA, DWORD dwFlags ) +{ + BOOL fSuccess = FALSE; // assume failure + + // Windows 9x has a special mechanism to move files after reboot + + if ( dwFlags & MOVEFILE_DELAY_UNTIL_REBOOT ) + { + CHAR szExistingFileNameA[MAX_PATH]; + CHAR szNewFileNameA[MAX_PATH] = "NUL"; + + // Path names in WININIT.INI must be in short path name form + + if ( + GetShortPathNameA( lpExistingFileNameA, szExistingFileNameA, MAX_PATH ) && + (!lpNewFileNameA || GetShortPathNameA( lpNewFileNameA, szNewFileNameA, MAX_PATH )) + ) + { + CHAR szBuffer[32767]; // The buffer size must not exceed 32K + DWORD dwBufLen = GetPrivateProfileSectionA( RENAME_SECTION, szBuffer, elementsof(szBuffer), WININIT_FILENAME ); + + CHAR szRename[MAX_PATH]; // This is enough for at most to times 67 chracters + strcpy( szRename, szNewFileNameA ); + strcat( szRename, "=" ); + strcat( szRename, szExistingFileNameA ); + size_t lnRename = strlen(szRename); + + if ( dwBufLen + lnRename + 2 <= elementsof(szBuffer) ) + { + CopyMemory( &szBuffer[dwBufLen], szRename, lnRename ); + szBuffer[dwBufLen + lnRename ] = 0; + szBuffer[dwBufLen + lnRename + 1 ] = 0; + + fSuccess = WritePrivateProfileSectionA( RENAME_SECTION, szBuffer, WININIT_FILENAME ); + } + else + SetLastError( ERROR_BUFFER_OVERFLOW ); + } + } + else + { + + fSuccess = MoveFileA( lpExistingFileNameA, lpNewFileNameA ); + + if ( !fSuccess && GetLastError() != ERROR_ACCESS_DENIED && + 0 != (dwFlags & (MOVEFILE_COPY_ALLOWED | MOVEFILE_REPLACE_EXISTING)) ) + { + BOOL bFailIfExist = 0 == (dwFlags & MOVEFILE_REPLACE_EXISTING); + + fSuccess = CopyFileA( lpExistingFileNameA, lpNewFileNameA, bFailIfExist ); + + if ( fSuccess ) + fSuccess = DeleteFileA( lpExistingFileNameA ); + } + + } + + return fSuccess; +} + +static BOOL MoveFileExImpl( LPCSTR lpExistingFileNameA, LPCSTR lpNewFileNameA, DWORD dwFlags ) +{ + if ( 0 > ((LONG)GetVersion())) // High order bit indicates Win 9x + return MoveFileEx9x( lpExistingFileNameA, lpNewFileNameA, dwFlags ); + else + return MoveFileExA( lpExistingFileNameA, lpNewFileNameA, dwFlags ); +} + +extern "C" UINT __stdcall IsOfficeRunning( MSIHANDLE handle ) +{ + OSVERSIONINFO osverinfo; + osverinfo.dwOSVersionInfoSize = sizeof(OSVERSIONINFO); + GetVersionEx( &osverinfo ); + + // renaming the vcl resource doesn't work reliable with OS >= Windows Vista + if (osverinfo.dwMajorVersion < 6 ) + { + std::_tstring sInstDir = GetMsiProperty( handle, TEXT("BASISINSTALLLOCATION") ); + // Property empty -> no office installed + if ( sInstDir.length() == 0 ) + return ERROR_SUCCESS; + + std::_tstring sResourceDir = sInstDir + TEXT("program\\resource\\"); + std::_tstring sPattern = sResourceDir + TEXT("vcl*.res"); + +// std::_tstring mystr; +// mystr = "IsOfficeRunning start. Checking file in dir: " + sResourceDir; +// MessageBox( NULL, mystr.c_str(), "IsOfficeRunning", MB_OK ); + + WIN32_FIND_DATA aFindFileData; + HANDLE hFind = FindFirstFile( sPattern.c_str(), &aFindFileData ); + + if ( IsValidHandle(hFind) ) + { + BOOL fSuccess = false; + bool fRenameSucceeded; + + do + { + std::_tstring sResourceFile = sResourceDir + aFindFileData.cFileName; + std::_tstring sIntermediate = sResourceFile + TEXT(".tmp"); + + fRenameSucceeded = MoveFileExImpl( sResourceFile.c_str(), sIntermediate.c_str(), MOVEFILE_REPLACE_EXISTING ); + if ( fRenameSucceeded ) + { + MoveFileExImpl( sIntermediate.c_str(), sResourceFile.c_str(), 0 ); + fSuccess = FindNextFile( hFind, &aFindFileData ); + } + } while ( fSuccess && fRenameSucceeded ); + + if ( !fRenameSucceeded ) + { + MsiSetProperty(handle, TEXT("OFFICERUNS"), TEXT("1")); + SetMsiErrorCode( MSI_ERROR_OFFICE_IS_RUNNING ); + +// mystr = "Office is running"; +// MessageBox( NULL, mystr.c_str(), "IsOfficeRunning", MB_OK ); + } + + FindClose( hFind ); + } +// mystr = "IsOfficeRunning end"; +// MessageBox( NULL, mystr.c_str(), "IsOfficeRunning", MB_OK ); + } + else + { + std::_tstring sOfficeInstallPath = GetMsiProperty(handle, TEXT("OFFICEINSTALLLOCATION")); + // Property empty -> no office installed + if ( sOfficeInstallPath.length() == 0 ) + return ERROR_SUCCESS; + + std::_tstring sRenameSrc = sOfficeInstallPath + TEXT("program"); + std::_tstring sRenameDst = sOfficeInstallPath + TEXT("program_test"); + + bool bSuccess = MoveFile( sRenameSrc.c_str(), sRenameDst.c_str() ); + + if ( bSuccess ) + { + MoveFile( sRenameDst.c_str(), sRenameSrc.c_str() ); + } + else + { + DWORD dwError = GetLastError(); + LPVOID lpMsgBuf; + // When there is no program folder, there could be no running office + if ( dwError == ERROR_FILE_NOT_FOUND ) + return ERROR_SUCCESS; + if ( dwError == ERROR_PATH_NOT_FOUND ) + return ERROR_SUCCESS; + + // The destination folder should never exist, don't know what to do here + if ( dwError == ERROR_ALREADY_EXISTS ) + return ERROR_SUCCESS; + + if ( FormatMessage( + FORMAT_MESSAGE_ALLOCATE_BUFFER | + FORMAT_MESSAGE_FROM_SYSTEM | + FORMAT_MESSAGE_IGNORE_INSERTS, + NULL, + GetLastError(), + MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), // Default language + (LPTSTR) &lpMsgBuf, + 0, + NULL )) + { + OutputDebugStringFormat( TEXT("Error Code %d: %s"), dwError, lpMsgBuf ); + LocalFree( lpMsgBuf ); + } + else + OutputDebugStringFormat( TEXT("Error Code %d: Unknown"), dwError ); + + MsiSetProperty( handle, TEXT("OFFICERUNS"), TEXT("1") ); + SetMsiErrorCode( MSI_ERROR_OFFICE_IS_RUNNING ); + } + } + + return ERROR_SUCCESS; +} + + + diff --git a/setup_native/source/win32/customactions/shellextensions/copyeditiondata.cxx b/setup_native/source/win32/customactions/shellextensions/copyeditiondata.cxx new file mode 100644 index 000000000000..28dfcc0e18b6 --- /dev/null +++ b/setup_native/source/win32/customactions/shellextensions/copyeditiondata.cxx @@ -0,0 +1,130 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#include "sal/config.h" + +#include <cstddef> +#include <new> +#include <string.h> // <cstring> not supported by old MSC versions + +#define WIN32_LEAN_AND_MEAN +#if defined _MSC_VER +#pragma warning(push, 1) +#endif +#include <windows.h> +#include <msiquery.h> +#include <shellapi.h> +#if defined _MSC_VER +#pragma warning(pop) +#endif + +#include "boost/scoped_array.hpp" + +#define LCL_LENGTH0(s) (sizeof (s) / sizeof *(s)) +#define LCL_STRING0(s) (s), LCL_LENGTH0(s) + +namespace { + +enum Status { STATUS_NO, STATUS_YES, STATUS_ERROR }; + +Status fileExists(wchar_t const * path) { + return GetFileAttributesW(path) == INVALID_FILE_ATTRIBUTES + ? GetLastError() == ERROR_FILE_NOT_FOUND ? STATUS_NO : STATUS_ERROR + : STATUS_YES; +} + +wchar_t * getProperty( + MSIHANDLE install, wchar_t const * name, wchar_t const * suffix, + std::size_t suffixLength, wchar_t ** end = NULL) +{ + DWORD n = 0; + UINT err = MsiGetPropertyW(install, name, L"", &n); + if (err != ERROR_SUCCESS && err != ERROR_MORE_DATA) { + return NULL; + } + DWORD n2 = n + suffixLength; //TODO: overflow + wchar_t * data = new(std::nothrow) wchar_t[n2]; + if (data == NULL) { + return NULL; + } + if (MsiGetPropertyW(install, name, data, &n2) != ERROR_SUCCESS || n2 != n) { + delete[] data; + return NULL; + } + memcpy(data + n, suffix, suffixLength * sizeof (wchar_t)); //TODO: overflow + if (end != NULL) { + *end = data + n + suffixLength; + } + return data; +} + +} + +extern "C" UINT __stdcall copyEditionData(MSIHANDLE install) { + boost::scoped_array<wchar_t> from( + getProperty(install, L"SourceDir", LCL_STRING0(L"edition\0"))); + if (!from) { + return ERROR_INSTALL_FAILURE; + } + Status stat = fileExists(from.get()); + if (stat == STATUS_ERROR) { + return ERROR_INSTALL_FAILURE; + } + if (stat == STATUS_NO) { + return ERROR_SUCCESS; + } + wchar_t * end; + boost::scoped_array<wchar_t> to( + getProperty( + install, L"OFFICEINSTALLLOCATION", + LCL_STRING0(L"program\\edition\0"), &end)); + if (!to) { + return ERROR_INSTALL_FAILURE; + } + stat = fileExists(to.get()); + if (stat == STATUS_ERROR) { + return ERROR_INSTALL_FAILURE; + } + if (stat == STATUS_YES) { + SHFILEOPSTRUCTW opDelete = { + NULL, FO_DELETE, to.get(), NULL, FOF_NOCONFIRMATION | FOF_SILENT, + FALSE, NULL, NULL }; //TODO: non-NULL hwnd + if (SHFileOperationW(&opDelete) != 0) { + return ERROR_INSTALL_FAILURE; + } + } + *(end - LCL_LENGTH0(L"\\edition\0")) = L'\0'; + *(end - LCL_LENGTH0(L"\\edition\0") + 1) = L'\0'; + SHFILEOPSTRUCTW opCopy = { + NULL, FO_COPY, from.get(), to.get(), + FOF_NOCONFIRMATION | FOF_NOCONFIRMMKDIR | FOF_SILENT, FALSE, NULL, + NULL }; //TODO: non-NULL hwnd + if (SHFileOperationW(&opCopy) != 0) { + return ERROR_INSTALL_FAILURE; + } + return ERROR_SUCCESS; +} diff --git a/setup_native/source/win32/customactions/shellextensions/copyextensiondata.cxx b/setup_native/source/win32/customactions/shellextensions/copyextensiondata.cxx new file mode 100644 index 000000000000..522c52a9aac9 --- /dev/null +++ b/setup_native/source/win32/customactions/shellextensions/copyextensiondata.cxx @@ -0,0 +1,124 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + + +#undef UNICODE +#undef _UNICODE + +#define _WIN32_WINDOWS 0x0410 + +#ifdef _MSC_VER +#pragma warning(push, 1) /* disable warnings within system headers */ +#define WIN32_LEAN_AND_MEAN +#endif +#include <windows.h> +#include <msiquery.h> +#include <shellapi.h> +#ifdef _MSC_VER +#pragma warning(pop) +#endif + +#include <malloc.h> +#include <assert.h> +#include <string.h> + +#ifdef UNICODE +#define _UNICODE +#define _tstring wstring +#else +#define _tstring string +#endif +#include <tchar.h> +#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 sExtensionDir = sSourceDir + TEXT("extension\\"); + std::_tstring sPattern = sExtensionDir + TEXT("*.oxt"); + // std::_tstring mystr; + + // Finding all oxt files in sExtensionDir + + WIN32_FIND_DATA aFindFileData; + + HANDLE hFindOxt = FindFirstFile( sPattern.c_str(), &aFindFileData ); + + if ( hFindOxt != INVALID_HANDLE_VALUE ) + { + bool fNextFile = false; + bool fSuccess = true; + bool bFailIfExist = true; + + std::_tstring sDestDir = GetMsiProperty( handle, TEXT("OFFICEINSTALLLOCATION") ); + std::_tstring sShareInstallDir = sDestDir + TEXT("share\\extension\\install\\"); + + // creating directories + std::_tstring sShareDir = sDestDir + TEXT("share"); + std::_tstring sExtDir = sShareDir + TEXT("\\extension"); + std::_tstring sExtInstDir = sExtDir + TEXT("\\install"); + bool bDir = CreateDirectory(sShareDir.c_str(), NULL); + bDir = CreateDirectory(sExtDir.c_str(), NULL); + bDir = CreateDirectory(sExtInstDir.c_str(), NULL); + + do + { + std::_tstring sOxtFile = aFindFileData.cFileName; + + std::_tstring sSourceFile = sExtensionDir + sOxtFile; + std::_tstring sDestFile = sShareInstallDir + sOxtFile; + + fSuccess = CopyFile( sSourceFile.c_str(), sDestFile.c_str(), bFailIfExist ); + + fNextFile = FindNextFile( hFindOxt, &aFindFileData ); + + } while ( fNextFile ); + + FindClose( hFindOxt ); + } + + return ERROR_SUCCESS; +} diff --git a/setup_native/source/win32/customactions/shellextensions/dotnetcheck.cxx b/setup_native/source/win32/customactions/shellextensions/dotnetcheck.cxx new file mode 100644 index 000000000000..2b022cfb3b8e --- /dev/null +++ b/setup_native/source/win32/customactions/shellextensions/dotnetcheck.cxx @@ -0,0 +1,193 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#undef UNICODE +#undef _UNICODE + +#define _WIN32_WINDOWS 0x0410 + +#ifdef _MSC_VER +#pragma warning(push, 1) /* disable warnings within system headers */ +#endif +#define WIN32_LEAN_AND_MEAN +#include <windows.h> +#include <msiquery.h> +#ifdef _MSC_VER +#pragma warning(pop) +#endif + +#include <malloc.h> +#include <assert.h> + +#include <tchar.h> +#include <string> +#include <systools/win32/uwinapi.h> + +#include <../tools/seterror.hxx> + +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) { + --i; + if ((*path)[i] == '\\') { + path->erase(i); + } + } + } + +// Copied more or less verbatim from +// desktop/source/deployment/inc/dp_version.hxx:1.5 and +// desktop/source/deployment/misc/dp_version.cxx:1.5: + +enum Order { ORDER_LESS, ORDER_EQUAL, ORDER_GREATER }; + +string getElement(string const & version, string::size_type * index) { + while (*index < version.size() && version[*index] == '0') { + ++*index; + } + string::size_type i = *index; + *index = version.find('.', i); + if (*index == string::npos) { + *index = version.size(); + return string(version, i); + } else { + ++*index; + return string(version, i, *index - 1 - i); + } +} + +Order compareVersions(string const & version1, string const & version2) { + for (string::size_type i1 = 0, i2 = 0; + i1 < version1.size() || i2 < version2.size();) + { + string e1(getElement(version1, &i1)); + string e2(getElement(version2, &i2)); + + // string myText1 = TEXT("e1: ") + e1; + // string myText2 = TEXT("e2: ") + e2; + // MessageBox(NULL, myText1.c_str(), "DEBUG", MB_OK); + // MessageBox(NULL, myText2.c_str(), "DEBUG", MB_OK); + + if (e1.size() < e2.size()) { + return ORDER_LESS; + } else if (e1.size() > e2.size()) { + return ORDER_GREATER; + } else if (e1 < e2) { + return ORDER_LESS; + } else if (e1 > e2) { + return ORDER_GREATER; + } + } + return ORDER_EQUAL; +} + +} // namespace + +extern "C" UINT __stdcall DotNetCheck(MSIHANDLE handle) { + 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); + + SetMsiProperty( + handle, TEXT("DOTNET_SUFFICIENT"), + (present.empty() || compareVersions(present, required) == ORDER_LESS ? + TEXT("0") : TEXT("1"))); + + // string result(GetMsiProperty(handle, TEXT("DOTNET_SUFFICIENT"))); + // string myText3 = TEXT("DOTNET_SUFFICIENT: ") + result; + // MessageBox(NULL, myText3.c_str(), "DEBUG", MB_OK); + + + return ERROR_SUCCESS; +} + +extern "C" UINT __stdcall ShowProperties(MSIHANDLE handle) +{ + string property = GetMsiProperty(handle, TEXT("INSTALLLOCATION")); + string myText = TEXT("INSTALLLOCATION: ") + property; + MessageBox(NULL, myText.c_str(), "INSTALLLOCATION", MB_OK); + + property = GetMsiProperty(handle, TEXT("UREINSTALLLOCATION")); + myText = TEXT("UREINSTALLLOCATION: ") + property; + MessageBox(NULL, myText.c_str(), "UREINSTALLLOCATION", MB_OK); + + property = GetMsiProperty(handle, TEXT("BASISINSTALLLOCATION")); + myText = TEXT("BASISINSTALLLOCATION: ") + property; + MessageBox(NULL, myText.c_str(), "BASISINSTALLLOCATION", MB_OK); + + property = GetMsiProperty(handle, TEXT("OFFICEINSTALLLOCATION")); + myText = TEXT("OFFICEINSTALLLOCATION: ") + property; + MessageBox(NULL, myText.c_str(), "OFFICEINSTALLLOCATION", MB_OK); + + property = GetMsiProperty(handle, TEXT("Installed")); + myText = TEXT("Installed: ") + property; + MessageBox(NULL, myText.c_str(), "Installed", MB_OK); + + property = GetMsiProperty(handle, TEXT("PATCH")); + myText = TEXT("PATCH: ") + property; + MessageBox(NULL, myText.c_str(), "PATCH", MB_OK); + + property = GetMsiProperty(handle, TEXT("REMOVE")); + myText = TEXT("REMOVE: ") + property; + MessageBox(NULL, myText.c_str(), "REMOVE", MB_OK); + + property = GetMsiProperty(handle, TEXT("ALLUSERS")); + myText = TEXT("ALLUSERS: ") + property; + MessageBox(NULL, myText.c_str(), "ALLUSERS", MB_OK); + + return ERROR_SUCCESS; +} diff --git a/setup_native/source/win32/customactions/shellextensions/exports.dxp b/setup_native/source/win32/customactions/shellextensions/exports.dxp new file mode 100644 index 000000000000..cafa011057c9 --- /dev/null +++ b/setup_native/source/win32/customactions/shellextensions/exports.dxp @@ -0,0 +1,23 @@ +InstallExecSequenceEntry +DeinstallExecSequenceEntry +InstallStartmenuFolderIcon +DeinstallStartmenuFolderIcon +SetProductInstallMode +RebuildShellIconCache +ExecutePostUninstallScript +MigrateInstallPath +RegisterExtensions +DeregisterExtensions +RemoveExtensions +CheckInstallDirectory +SetAdminInstallProperty +CreateLayerLinks +RemoveLayerLinks +DotNetCheck +ShowProperties +copyEditionData +RenamePrgFolder +RemovePrgFolder +IsOfficeRunning +CheckPatchList +copyExtensionData diff --git a/setup_native/source/win32/customactions/shellextensions/iconcache.cxx b/setup_native/source/win32/customactions/shellextensions/iconcache.cxx new file mode 100755 index 000000000000..75b5914bafbc --- /dev/null +++ b/setup_native/source/win32/customactions/shellextensions/iconcache.cxx @@ -0,0 +1,110 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#ifdef _MSC_VER +#pragma warning(push, 1) /* disable warnings within system headers */ +#endif +#define WIN32_LEAN_AND_MEAN +#include <windows.h> +#include <msiquery.h> +#ifdef _MSC_VER +#pragma warning(pop) +#endif + +#include <stdlib.h> + +extern "C" UINT __stdcall RebuildShellIconCache(MSIHANDLE) +{ + // Rebuild icon cache on windows OS prior XP + + OSVERSIONINFO osverinfo; + + osverinfo.dwOSVersionInfoSize = sizeof(OSVERSIONINFO); + + if ( + GetVersionEx( &osverinfo ) && + VER_PLATFORM_WIN32_NT == osverinfo.dwPlatformId && + ( + 5 < osverinfo.dwMajorVersion || + 5 == osverinfo.dwMajorVersion && 0 < osverinfo.dwMinorVersion + ) + ) + { + return ERROR_SUCCESS; + } + + HKEY hKey; + DWORD dwDispostion; + LONG lError = RegCreateKeyEx( HKEY_CURRENT_USER, TEXT("Control Panel\\Desktop\\WindowMetrics"), 0, NULL, REG_OPTION_VOLATILE, KEY_SET_VALUE | KEY_QUERY_VALUE, NULL, &hKey, &dwDispostion ); + + if ( ERROR_SUCCESS == lError ) + { + TCHAR szValue[256]; + TCHAR szTempValue[256]; + DWORD cbValue = sizeof(szValue); + DWORD dwType; + int iSize = 0; + + lError = RegQueryValueEx( hKey, TEXT("Shell Icon Size"), 0, &dwType, (LPBYTE)szValue, &cbValue ); + + if ( ERROR_SUCCESS == lError ) + iSize = atoi( szValue ); + + if ( !iSize ) + { + iSize = GetSystemMetrics( SM_CXICON ); + itoa( iSize, szValue, 10 ); + cbValue = strlen( szValue ) + 1; + dwType = REG_SZ; + } + + itoa( iSize + 1, szTempValue, 10 ); + lError = RegSetValueEx( hKey, TEXT("Shell Icon Size"), 0, dwType, (LPBYTE)szTempValue, strlen( szTempValue ) + 1 ); + + LRESULT lResult = SendMessageTimeout( + HWND_BROADCAST, + WM_SETTINGCHANGE, + SPI_SETNONCLIENTMETRICS, + (LPARAM)TEXT("WindowMetrics"), + SMTO_NORMAL|SMTO_ABORTIFHUNG, + 0, NULL); + + lError = RegSetValueEx( hKey, TEXT("Shell Icon Size"), 0, dwType, (LPBYTE)szValue, cbValue ); + + lResult = SendMessageTimeout( + HWND_BROADCAST, + WM_SETTINGCHANGE, + SPI_SETNONCLIENTMETRICS, + (LPARAM)TEXT("WindowMetrics"), + SMTO_NORMAL|SMTO_ABORTIFHUNG, + 0, NULL); + + lError = RegCloseKey( hKey ); + } + + return ERROR_SUCCESS; +} diff --git a/setup_native/source/win32/customactions/shellextensions/layerlinks.cxx b/setup_native/source/win32/customactions/shellextensions/layerlinks.cxx new file mode 100644 index 000000000000..114e24955820 --- /dev/null +++ b/setup_native/source/win32/customactions/shellextensions/layerlinks.cxx @@ -0,0 +1,253 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#undef UNICODE +#undef _UNICODE + +#define _WIN32_WINDOWS 0x0410 + +#ifdef _MSC_VER +#pragma warning(push, 1) /* disable warnings within system headers */ +#endif +#define WIN32_LEAN_AND_MEAN +#include <windows.h> +#include <msiquery.h> +#ifdef _MSC_VER +#pragma warning(pop) +#endif + +#include <malloc.h> +#include <assert.h> + +#include <tchar.h> +#include <string> +#include <systools/win32/uwinapi.h> + +#include <../tools/seterror.hxx> + +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) { + --i; + if ((*path)[i] == '\\') { + path->erase(i); + } + } + } +} // namespace + +extern "C" UINT __stdcall CreateLayerLinks(MSIHANDLE handle) +{ + string sOfficeInstallPath = GetMsiProperty(handle, TEXT("OFFICEINSTALLLOCATION")); + string sBasisInstallPath = GetMsiProperty(handle, TEXT("BASISINSTALLLOCATION")); + string sUreInstallPath = GetMsiProperty(handle, TEXT("UREINSTALLLOCATION")); + + string sBasisLinkPath = sOfficeInstallPath + TEXT("basis-link"); + string sUreLinkPath = sBasisInstallPath + TEXT("ure-link"); + + if ( IsSetMsiProperty(handle, TEXT("ADMININSTALL")) ) + { + sBasisInstallPath = TEXT("Basis"); + sUreInstallPath = TEXT("..\\URE"); + } + + stripFinalBackslash(&sBasisInstallPath); + stripFinalBackslash(&sUreInstallPath); + + // string myText1 = TEXT("Creating Basis-Link: ") + sBasisLinkPath; + // string myText2 = TEXT("Creating Ure-Link: ") + sUreLinkPath; + // MessageBox(NULL, myText1.c_str(), "DEBUG", MB_OK); + // MessageBox(NULL, myText2.c_str(), "DEBUG", MB_OK); + + // creating basis-link in brand layer + + HANDLE h1file = CreateFile( + sBasisLinkPath.c_str(), + GENERIC_WRITE, + 0, + NULL, + CREATE_NEW, + FILE_ATTRIBUTE_NORMAL, + NULL); + + if (IsValidHandle(h1file)) + { + DWORD dummy; + + // Converting string into UTF-8 encoding and writing into file "basis-link" + + int nCharsRequired = MultiByteToWideChar( CP_ACP, 0, sBasisInstallPath.c_str(), -1, NULL, 0 ); + if ( nCharsRequired ) + { + LPWSTR lpPathW = new WCHAR[nCharsRequired]; + if ( MultiByteToWideChar( CP_ACP, 0, sBasisInstallPath.c_str(), -1, lpPathW, nCharsRequired ) ) + { + nCharsRequired = WideCharToMultiByte( CP_UTF8, 0, lpPathW, -1, NULL, 0, NULL, NULL ); + if ( nCharsRequired ) + { + LPSTR lpPathUTF8 = new CHAR[nCharsRequired]; + WideCharToMultiByte( CP_UTF8, 0, lpPathW, -1, lpPathUTF8, nCharsRequired, NULL, NULL ); + + // WriteFile( h1file, sBasisInstallPath.c_str(), sBasisInstallPath.size() ,&dummy, 0 ); + WriteFile( h1file, lpPathUTF8, strlen(lpPathUTF8) ,&dummy, 0 ); + + delete lpPathUTF8; + } + } + + delete lpPathW; + } + + CloseHandle(h1file); + } + + // creating ure-link in basis layer + + HANDLE h2file = CreateFile( + sUreLinkPath.c_str(), + GENERIC_WRITE, + 0, + NULL, + CREATE_NEW, + FILE_ATTRIBUTE_NORMAL, + NULL); + + if (IsValidHandle(h2file)) + { + DWORD dummy; + + // Converting string into UTF-8 encoding and writing into file "basis-link" + + int nCharsRequired = MultiByteToWideChar( CP_ACP, 0, sUreInstallPath.c_str(), -1, NULL, 0 ); + if ( nCharsRequired ) + { + LPWSTR lpPathW = new WCHAR[nCharsRequired]; + if ( MultiByteToWideChar( CP_ACP, 0, sUreInstallPath.c_str(), -1, lpPathW, nCharsRequired ) ) + { + nCharsRequired = WideCharToMultiByte( CP_UTF8, 0, lpPathW, -1, NULL, 0, NULL, NULL ); + if ( nCharsRequired ) + { + LPSTR lpPathUTF8 = new CHAR[nCharsRequired]; + WideCharToMultiByte( CP_UTF8, 0, lpPathW, -1, lpPathUTF8, nCharsRequired, NULL, NULL ); + + // WriteFile( h2file, sUreInstallPath.c_str(), sUreInstallPath.size() ,&dummy, 0 ); + WriteFile( h2file, lpPathUTF8, strlen(lpPathUTF8) ,&dummy, 0 ); + + delete lpPathUTF8; + } + } + + delete lpPathW; + } + + CloseHandle(h2file); + } + + return ERROR_SUCCESS; +} + +extern "C" UINT __stdcall RemoveLayerLinks(MSIHANDLE handle) +{ + string sOfficeInstallPath = GetMsiProperty(handle, TEXT("OFFICEUNINSTALLLOCATION")); + string sBasisInstallPath = GetMsiProperty(handle, TEXT("BASISUNINSTALLLOCATION")); + string sUreInstallPath = GetMsiProperty(handle, TEXT("UREUNINSTALLLOCATION")); + + string sBasisLinkPath = sOfficeInstallPath + TEXT("basis-link"); + string sUreLinkPath = sBasisInstallPath + TEXT("ure-link"); + string sUreDirName = sUreInstallPath + TEXT("bin"); + + // string myText2 = TEXT("Deleting Ure-Link: ") + sUreLinkPath; + // MessageBox(NULL, myText2.c_str(), "DEBUG", MB_OK); + + // Deleting link to basis layer + // string myText1 = TEXT("Deleting Basis-Link: ") + sBasisLinkPath; + // MessageBox(NULL, myText1.c_str(), "DEBUG", MB_OK); + DeleteFile(sBasisLinkPath.c_str()); + + // Check, if URE is still installed + bool ureDirExists = true; + WIN32_FIND_DATA aFindData; + HANDLE hFindContent = FindFirstFile( sUreDirName.c_str(), &aFindData ); + if ( hFindContent == INVALID_HANDLE_VALUE ) { ureDirExists = false; } + FindClose( hFindContent ); + + // if ( ureDirExists ) + // { + // string myText3 = TEXT("URE directory still exists: ") + sUreDirName; + // MessageBox(NULL, myText3.c_str(), "DEBUG", MB_OK); + // string myText4 = TEXT("URE link NOT removed: ") + sUreLinkPath; + // MessageBox(NULL, myText4.c_str(), "DEBUG", MB_OK); + // } + + // Deleting link to URE layer, if URE dir no longer exists + if ( ! ureDirExists ) + { + // string myText5 = TEXT("URE directory does not exist: ") + sUreDirName; + // MessageBox(NULL, myText5.c_str(), "DEBUG", MB_OK); + DeleteFile(sUreLinkPath.c_str()); + // string myText6 = TEXT("URE link removed: ") + sUreLinkPath; + // MessageBox(NULL, myText6.c_str(), "DEBUG", MB_OK); + } + + return ERROR_SUCCESS; +} diff --git a/setup_native/source/win32/customactions/shellextensions/makefile.mk b/setup_native/source/win32/customactions/shellextensions/makefile.mk new file mode 100644 index 000000000000..220ac727b774 --- /dev/null +++ b/setup_native/source/win32/customactions/shellextensions/makefile.mk @@ -0,0 +1,107 @@ +#************************************************************************* +# +# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. +# +# Copyright 2000, 2010 Oracle and/or its affiliates. +# +# OpenOffice.org - a multi-platform office productivity suite +# +# This file is part of OpenOffice.org. +# +# OpenOffice.org is free software: you can redistribute it and/or modify +# it under the terms of the GNU Lesser General Public License version 3 +# only, as published by the Free Software Foundation. +# +# OpenOffice.org is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU Lesser General Public License version 3 for more details +# (a copy is included in the LICENSE file that accompanied this code). +# +# You should have received a copy of the GNU Lesser General Public License +# version 3 along with OpenOffice.org. If not, see +# <http://www.openoffice.org/license.html> +# for a copy of the LGPLv3 License. +# +#************************************************************************* + +PRJ=..$/..$/..$/.. +PRJNAME=setup_native +TARGET=shlxtmsi + +# --- Settings ----------------------------------------------------- + +ENABLE_EXCEPTIONS=TRUE +NO_DEFAULT_STL=TRUE +DYNAMIC_CRT= +USE_DEFFILE=TRUE + +.INCLUDE : settings.mk + +.IF "$(USE_SYSTEM_STL)" != "YES" +CFLAGS+=-D_STLP_USE_STATIC_LIB +.ENDIF + +#Disable precompiled header +CDEFS+=-Dnot_used_define_to_disable_pch + +# --- Files -------------------------------------------------------- + +.IF "$(GUI)"=="WNT" + +UWINAPILIB= + +SLOFILES = \ + $(SLO)$/shellextensions.obj \ + $(SLO)$/startmenuicon.obj \ + $(SLO)$/upgrade.obj \ + $(SLO)$/iconcache.obj \ + $(SLO)$/postuninstall.obj \ + $(SLO)$/migrateinstallpath.obj \ + $(SLO)$/checkdirectory.obj \ + $(SLO)$/setadmininstall.obj \ + $(SLO)$/layerlinks.obj \ + $(SLO)$/dotnetcheck.obj \ + $(SLO)$/registerextensions.obj \ + $(SLO)$/copyeditiondata.obj \ + $(SLO)$/vistaspecial.obj \ + $(SLO)$/checkrunningoffice.obj \ + $(SLO)$/checkpatches.obj \ + $(SLO)$/copyextensiondata.obj + +STDSHL += \ + $(ADVAPI32LIB)\ + $(MSILIB)\ + $(SHELL32LIB) + +.IF "$(USE_SYSTEM_STL)" != "YES" +STDSHL += $(LIBSTLPORTST) +.ENDIF + +.IF "$(COM)"=="GCC" +STDSHL+= \ + $(KERNEL32LIB)\ + -lmsvcrt +.ENDIF + +SHL1OBJS = $(SLOFILES) \ + $(SLO)$/seterror.obj + +SHL1TARGET = $(TARGET) +SHL1IMPLIB = i$(TARGET) + +SHL1DEF = $(MISC)$/$(SHL1TARGET).def +SHL1DEPN = $(SLB)$/$(TARGET).lib +SHL1BASE = 0x1c000000 +DEF1NAME=$(SHL1TARGET) +DEF1EXPORTFILE=exports.dxp + +.ENDIF + +# --- Targets -------------------------------------------------------------- + +.INCLUDE : target.mk + +# ------------------------------------------------------------------------- + + diff --git a/setup_native/source/win32/customactions/shellextensions/migrateinstallpath.cxx b/setup_native/source/win32/customactions/shellextensions/migrateinstallpath.cxx new file mode 100755 index 000000000000..1d3692e456b0 --- /dev/null +++ b/setup_native/source/win32/customactions/shellextensions/migrateinstallpath.cxx @@ -0,0 +1,159 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#define _WIN32_WINDOWS 0x0410 +#ifdef _MSC_VER +#pragma warning(push, 1) /* disable warnings within system headers */ +#endif +#define WIN32_LEAN_AND_MEAN +#include <windows.h> +#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> + +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]; + DWORD nValueSize = sizeof(szValue); + 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 sProductKey = "Software\\" + sManufacturer + "\\" + sDefinedName + + "\\" + sUpdateVersion + "\\" + sUpgradeCode; + + std::_tstring mystr; + mystr = "ProductKey: " + sProductKey; + // MessageBox( NULL, mystr.c_str(), "ProductKey", MB_OK ); + + if ( ERROR_SUCCESS == RegOpenKey( HKEY_CURRENT_USER, sProductKey.c_str(), &hKey ) ) + { + if ( ERROR_SUCCESS == RegQueryValueEx( hKey, TEXT("OFFICEINSTALLLOCATION"), NULL, NULL, (LPBYTE)szValue, &nValueSize ) ) + { + sInstDir = szValue; + MsiSetProperty(handle, TEXT("OFFICEINSTALLLOCATION"), sInstDir.c_str()); + // MessageBox( NULL, sInstDir.c_str(), "Found in HKEY_CURRENT_USER", MB_OK ); + } + + if ( ERROR_SUCCESS == RegQueryValueEx( hKey, TEXT("BASISINSTALLLOCATION"), NULL, NULL, (LPBYTE)szValue, &nValueSize ) ) + { + sInstDir = szValue; + MsiSetProperty(handle, TEXT("BASISINSTALLLOCATION"), sInstDir.c_str()); + // MessageBox( NULL, sInstDir.c_str(), "Found in HKEY_CURRENT_USER", MB_OK ); + } + + if ( ERROR_SUCCESS == RegQueryValueEx( hKey, TEXT("UREINSTALLLOCATION"), NULL, NULL, (LPBYTE)szValue, &nValueSize ) ) + { + sInstDir = szValue; + MsiSetProperty(handle, TEXT("UREINSTALLLOCATION"), sInstDir.c_str()); + // MessageBox( NULL, sInstDir.c_str(), "Found in HKEY_CURRENT_USER", MB_OK ); + } + + if ( ERROR_SUCCESS == RegQueryValueEx( hKey, TEXT("INSTALLLOCATION"), NULL, NULL, (LPBYTE)szValue, &nValueSize ) ) + { + sInstDir = szValue; + MsiSetProperty(handle, TEXT("INSTALLLOCATION"), sInstDir.c_str()); + // MessageBox( NULL, sInstDir.c_str(), "Found in HKEY_CURRENT_USER", MB_OK ); + } + + RegCloseKey( hKey ); + } + else if ( ERROR_SUCCESS == RegOpenKey( HKEY_LOCAL_MACHINE, sProductKey.c_str(), &hKey ) ) + { + if ( ERROR_SUCCESS == RegQueryValueEx( hKey, TEXT("OFFICEINSTALLLOCATION"), NULL, NULL, (LPBYTE)szValue, &nValueSize ) ) + { + sInstDir = szValue; + MsiSetProperty(handle, TEXT("OFFICEINSTALLLOCATION"), sInstDir.c_str()); + // MessageBox( NULL, sInstDir.c_str(), "Found in HKEY_LOCAL_MACHINE", MB_OK ); + } + + if ( ERROR_SUCCESS == RegQueryValueEx( hKey, TEXT("BASISINSTALLLOCATION"), NULL, NULL, (LPBYTE)szValue, &nValueSize ) ) + { + sInstDir = szValue; + MsiSetProperty(handle, TEXT("BASISINSTALLLOCATION"), sInstDir.c_str()); + // MessageBox( NULL, sInstDir.c_str(), "Found in HKEY_LOCAL_MACHINE", MB_OK ); + } + + if ( ERROR_SUCCESS == RegQueryValueEx( hKey, TEXT("UREINSTALLLOCATION"), NULL, NULL, (LPBYTE)szValue, &nValueSize ) ) + { + sInstDir = szValue; + MsiSetProperty(handle, TEXT("UREINSTALLLOCATION"), sInstDir.c_str()); + // MessageBox( NULL, sInstDir.c_str(), "Found in HKEY_LOCAL_MACHINE", MB_OK ); + } + + if ( ERROR_SUCCESS == RegQueryValueEx( hKey, TEXT("INSTALLLOCATION"), NULL, NULL, (LPBYTE)szValue, &nValueSize ) ) + { + sInstDir = szValue; + MsiSetProperty(handle, TEXT("INSTALLLOCATION"), sInstDir.c_str()); + // MessageBox( NULL, sInstDir.c_str(), "Found in HKEY_LOCAL_MACHINE", MB_OK ); + } + + RegCloseKey( hKey ); + } + + return ERROR_SUCCESS; + +} diff --git a/setup_native/source/win32/customactions/shellextensions/postuninstall.cxx b/setup_native/source/win32/customactions/shellextensions/postuninstall.cxx new file mode 100755 index 000000000000..bb339953ff34 --- /dev/null +++ b/setup_native/source/win32/customactions/shellextensions/postuninstall.cxx @@ -0,0 +1,155 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#define _WIN32_WINDOWS 0x0410 +#ifdef _MSC_VER +#pragma warning(push, 1) /* disable warnings within system headers */ +#endif +#define WIN32_LEAN_AND_MEAN +#include <windows.h> +#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> + +#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; + STARTUPINFO si; + PROCESS_INFORMATION pi; + + ZeroMemory( &si, sizeof(si) ); + si.cb = sizeof(si); + + fSuccess = CreateProcess( + NULL, + (LPTSTR)lpCommand, + NULL, + NULL, + FALSE, + 0, + NULL, + NULL, + &si, + &pi + ); + + if ( fSuccess ) + { + if ( bSync ) + WaitForSingleObject( pi.hProcess, INFINITE ); + + CloseHandle( pi.hProcess ); + CloseHandle( pi.hThread ); + } + + return fSuccess; +} + +extern "C" UINT __stdcall ExecutePostUninstallScript( MSIHANDLE handle ) +{ + TCHAR szValue[8192]; + DWORD nValueSize = sizeof(szValue); + HKEY hKey; + std::_tstring sInstDir; + + std::_tstring sProductKey = GetMsiProperty( handle, TEXT("FINDPRODUCT") ); + + // MessageBox( NULL, sProductKey.c_str(), "Titel", MB_OK ); + + if ( ERROR_SUCCESS == RegOpenKey( HKEY_CURRENT_USER, sProductKey.c_str(), &hKey ) ) + { + if ( ERROR_SUCCESS == RegQueryValueEx( hKey, TEXT("OFFICEINSTALLLOCATION"), NULL, NULL, (LPBYTE)szValue, &nValueSize ) ) + { + sInstDir = szValue; + } + RegCloseKey( hKey ); + } + else if ( ERROR_SUCCESS == RegOpenKey( HKEY_LOCAL_MACHINE, sProductKey.c_str(), &hKey ) ) + { + if ( ERROR_SUCCESS == RegQueryValueEx( hKey, TEXT("OFFICEINSTALLLOCATION"), NULL, NULL, (LPBYTE)szValue, &nValueSize ) ) + { + sInstDir = szValue; + } + RegCloseKey( hKey ); + } + else + return ERROR_SUCCESS; + + std::_tstring sInfFile = sInstDir + TEXT("program\\postuninstall.inf"); + std::_tstring sCommand = _T("RUNDLL32.EXE "); + + // MessageBox( NULL, sInfFile.c_str(), "Titel", MB_OK ); + + if ( (LONG)GetVersion() < 0 ) + sCommand += _T("setupx.dll"); + else + sCommand += _T("setupapi.dll"); + + sCommand += _T(",InstallHinfSection PostUninstall 132 "); + sCommand += sInfFile; + + if ( 0 == _taccess( sInfFile.c_str(), 2 ) ) + ExecuteCommand( sCommand.c_str(), TRUE ); + + DeleteFile( sInfFile.c_str() ); + + return ERROR_SUCCESS; +} + diff --git a/setup_native/source/win32/customactions/shellextensions/registerextensions.cxx b/setup_native/source/win32/customactions/shellextensions/registerextensions.cxx new file mode 100644 index 000000000000..191bb5fad393 --- /dev/null +++ b/setup_native/source/win32/customactions/shellextensions/registerextensions.cxx @@ -0,0 +1,573 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#undef UNICODE +#undef _UNICODE + +#define _WIN32_WINDOWS 0x0410 + +#ifdef _MSC_VER +#pragma warning(push, 1) /* disable warnings within system headers */ +#define WIN32_LEAN_AND_MEAN +#endif +#include <windows.h> +#include <msiquery.h> +#include <shellapi.h> +#ifdef _MSC_VER +#pragma warning(pop) +#endif + +#include <malloc.h> +#include <assert.h> +#include <string.h> + +#ifdef UNICODE +#define _UNICODE +#define _tstring wstring +#else +#define _tstring string +#endif +#include <tchar.h> +#include <string> + +/** creates a temporary folder with a unique name. + + The returned string is a file URL. +*/ +static std::_tstring createTempFolder() +{ + BOOL bExist = FALSE; + TCHAR szTempName[MAX_PATH]; + do + { + bExist = FALSE; + // Get the temp path. + TCHAR lpPathBuffer[MAX_PATH]; + DWORD dwRetVal = GetTempPath(MAX_PATH, lpPathBuffer); + if (dwRetVal > MAX_PATH || (dwRetVal == 0)) + { + //fprintf (stderr, "GetTempPath failed with error %d.\n", GetLastError()); + return TEXT(""); + } + // Create a temporary file. + UINT uRetVal = GetTempFileName(lpPathBuffer, // directory for tmp files + "upg", // temp file name prefix + 0, // create unique name + szTempName); // buffer for name + if (uRetVal == 0) + { + //fprintf (stderr, "GetTempFileName failed with error %d.\n", GetLastError()); + return TEXT(""); + } + //Delete the file + BOOL bDel = DeleteFile(szTempName); + if (FALSE == bDel) + { + //fprintf(stderr, "Could not delete temp file. Error %d.\n", GetLastError()); + return TEXT(""); + } + // Create the directory + BOOL bDir = CreateDirectory(szTempName, NULL); + if (FALSE == bDir) + { + DWORD error =GetLastError(); + if (ERROR_ALREADY_EXISTS == error) + { + bExist = TRUE; + } + else + { + //fprintf(stderr, "CreateDirectory failed with error %d.\n", error); + return TEXT(""); + } + } + } while(bExist); + + std::_tstring cur(szTempName); + //make a file URL from the path + std::_tstring ret(TEXT("file:///")); + for (std::_tstring::iterator i = cur.begin(); i != cur.end(); i++) + { + if (*i == '\\') + ret.append(TEXT("/")); + else + ret.push_back(*i); + } +// MessageBox(NULL, ret.c_str(), "createTempFolder", MB_OK); + return ret.c_str(); +} + +/** deletes the temporary folder. + The argument must be a file URL. +*/ +static void deleteTempFolder(const std::_tstring& sTempFolder) +{ + if (sTempFolder.size() == 0) + return; + //convert the file URL to a path + const std::_tstring path(sTempFolder.substr(8)); + std::_tstring path2; +// MessageBox(NULL, path.c_str(), "del1", MB_OK); + for (std::_tstring::const_iterator i = path.begin(); i != path.end(); i++) + { + if (*i == '/') + path2.append(TEXT("\\")); + else + path2.push_back(*i); + } + + //We need a null terminated string with two nulls in the end + //for the SHFILEOPSTRUCT + const TCHAR * szTemp = path2.c_str(); + size_t size = path2.size(); + TCHAR * szTemp2 = new TCHAR[size + 2]; + ZeroMemory(szTemp2, (size + 2) * sizeof(TCHAR)); + memcpy(szTemp2, szTemp, size * sizeof(TCHAR)); + +// MessageBox(NULL, szTemp2, "del3", MB_OK); + SHFILEOPSTRUCT operation = + { + NULL, + FO_DELETE, + szTemp2, + NULL, + FOF_SILENT | FOF_NOCONFIRMATION | FOF_NOERRORUI | FOF_NOCONFIRMMKDIR, + FALSE, + NULL, + NULL + }; + + SHFileOperation( &operation); + delete [] szTemp2; +} + + + +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; +} + +/* creates a child process which is specified in lpCommand. + + out_exitCode is the exit code of the child process + + +**/ +static BOOL ExecuteCommand( LPCTSTR lpCommand, DWORD * out_exitCode) +{ + BOOL fSuccess = FALSE; + STARTUPINFO si; + PROCESS_INFORMATION pi; + + ZeroMemory( &si, sizeof(si) ); + si.cb = sizeof(si); + + fSuccess = CreateProcess( + NULL, + (LPTSTR)lpCommand, + NULL, + NULL, + FALSE, + 0, + NULL, + NULL, + &si, + &pi + ); + + if ( fSuccess ) + { + WaitForSingleObject( pi.hProcess, INFINITE ); + + if (!GetExitCodeProcess( pi.hProcess, out_exitCode)) + fSuccess = FALSE; + + CloseHandle( pi.hProcess ); + CloseHandle( pi.hThread ); + } + + return fSuccess; +} + +static BOOL RemoveCompleteDirectory( std::_tstring sPath ) +{ + bool bDirectoryRemoved = true; + + std::_tstring mystr; + std::_tstring sPattern = sPath + TEXT("\\") + TEXT("*.*"); + WIN32_FIND_DATA aFindData; + + // Finding all content in sPath + + HANDLE hFindContent = FindFirstFile( sPattern.c_str(), &aFindData ); + + if ( hFindContent != INVALID_HANDLE_VALUE ) + { + bool fNextFile = false; + + do + { + std::_tstring sFileName = aFindData.cFileName; + std::_tstring sCurrentDir = TEXT("."); + std::_tstring sParentDir = TEXT(".."); + + mystr = "Current short file: " + sFileName; + // MessageBox(NULL, mystr.c_str(), "Current Content", MB_OK); + + if (( strcmp(sFileName.c_str(),sCurrentDir.c_str()) != 0 ) && + ( strcmp(sFileName.c_str(),sParentDir.c_str()) != 0 )) + { + std::_tstring sCompleteFileName = sPath + TEXT("\\") + sFileName; + + if ( aFindData.dwFileAttributes == FILE_ATTRIBUTE_DIRECTORY ) + { + bool fSuccess = RemoveCompleteDirectory(sCompleteFileName); + if ( fSuccess ) + { + mystr = "Successfully removed content of dir " + sCompleteFileName; + // MessageBox(NULL, mystr.c_str(), "Removed Directory", MB_OK); + } + else + { + mystr = "An error occured during removing content of " + sCompleteFileName; + // MessageBox(NULL, mystr.c_str(), "Error removing directory", MB_OK); + } + } + else + { + bool fSuccess = DeleteFile( sCompleteFileName.c_str() ); + if ( fSuccess ) + { + mystr = "Successfully removed file " + sCompleteFileName; + // MessageBox(NULL, mystr.c_str(), "Removed File", MB_OK); + } + else + { + mystr = "An error occured during removal of file " + sCompleteFileName; + // MessageBox(NULL, mystr.c_str(), "Error removing file", MB_OK); + } + } + } + + fNextFile = FindNextFile( hFindContent, &aFindData ); + + } while ( fNextFile ); + + FindClose( hFindContent ); + + // empty directory can be removed now + // RemoveDirectory is only successful, if the last handle to the directory is closed + // -> first removing content -> closing handle -> remove empty directory + + bool fRemoveDirSuccess = RemoveDirectory(sPath.c_str()); + + if ( fRemoveDirSuccess ) + { + mystr = "Successfully removed dir " + sPath; + // MessageBox(NULL, mystr.c_str(), "Removed Directory", MB_OK); + } + else + { + mystr = "An error occured during removal of empty directory " + sPath; + // MessageBox(NULL, mystr.c_str(), "Error removing directory", MB_OK); + bDirectoryRemoved = false; + } + } + + return bDirectoryRemoved; +} + +extern "C" UINT __stdcall RegisterExtensions(MSIHANDLE handle) +{ + std::_tstring sInstDir = GetMsiProperty( handle, TEXT("OFFICEINSTALLLOCATION") ); + std::_tstring sUnoPkgFile = sInstDir + TEXT("program\\unopkg.exe"); + std::_tstring sShareInstallDir = sInstDir + TEXT("share\\extension\\install\\"); + std::_tstring sPattern = sShareInstallDir + TEXT("*.oxt"); + std::_tstring mystr; + + WIN32_FIND_DATA aFindFileData; + + mystr = "unopkg file: " + sUnoPkgFile; + // MessageBox(NULL, mystr.c_str(), "Command", MB_OK); + + mystr = "oxt file directory: " + sShareInstallDir; + // MessageBox(NULL, mystr.c_str(), "Command", MB_OK); + + // Find unopkg.exe + + HANDLE hFindUnopkg = FindFirstFile( sUnoPkgFile.c_str(), &aFindFileData ); + + if ( hFindUnopkg != INVALID_HANDLE_VALUE ) + { + // unopkg.exe exists in program directory + + // Finding all oxt files in sShareInstallDir + + HANDLE hFindOxt = FindFirstFile( sPattern.c_str(), &aFindFileData ); + + if ( hFindOxt != INVALID_HANDLE_VALUE ) + { + bool fNextFile = false; + + do + { + const std::_tstring sTempFolder(createTempFolder()); + std::_tstring sOxtFile = sShareInstallDir + aFindFileData.cFileName; + std::_tstring sCommandPart1 = sUnoPkgFile + " add --shared --suppress-license --bundled " + "\"" + sOxtFile + "\""; + std::_tstring sCommand = sCommandPart1 + + TEXT(" -env:UNO_JAVA_JFW_INSTALL_DATA=$OOO_BASE_DIR/share/config/javasettingsunopkginstall.xml") + + TEXT(" -env:UserInstallation=") + sTempFolder; + mystr = "Command: " + sCommand; + // MessageBox(NULL, mystr.c_str(), "Command", MB_OK); + + DWORD exitCode = 0; + bool fSuccess = ExecuteCommand( sCommand.c_str(), & exitCode); + // unopkg in OOo 2.2.1 and early had a bug that it failed when receiving + // a bootstrap parameter (-env:...) then it exited with a value != 0. + if (fSuccess && exitCode != 0) + { + std::_tstring sCommand = sCommandPart1; + mystr = "Command: " + sCommand; + // MessageBox(NULL, mystr.c_str(), "Command", MB_OK); + fSuccess = ExecuteCommand( sCommand.c_str(), & exitCode); + } + deleteTempFolder(sTempFolder); + + // 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); + // } + + fNextFile = FindNextFile( hFindOxt, &aFindFileData ); + + } while ( fNextFile ); + + FindClose( hFindOxt ); + } + } + // else + // { + // mystr = "Error: Did not find " + sUnoPkgFile; + // MessageBox(NULL, mystr.c_str(), "Command", MB_OK); + // } + + return ERROR_SUCCESS; +} + +extern "C" UINT __stdcall DeregisterExtensions(MSIHANDLE handle) +{ + std::_tstring mystr; + + // Finding the product with the help of the propery FINDPRODUCT, + // that contains a Windows Registry key, that points to the install location. + + TCHAR szValue[8192]; + DWORD nValueSize = sizeof(szValue); + HKEY hKey; + std::_tstring sInstDir; + + std::_tstring sProductKey = GetMsiProperty( handle, TEXT("FINDPRODUCT") ); + // MessageBox( NULL, sProductKey.c_str(), "Titel", MB_OK ); + + if ( ERROR_SUCCESS == RegOpenKey( HKEY_CURRENT_USER, sProductKey.c_str(), &hKey ) ) + { + if ( ERROR_SUCCESS == RegQueryValueEx( hKey, TEXT("OFFICEINSTALLLOCATION"), NULL, NULL, (LPBYTE)szValue, &nValueSize ) ) + { + sInstDir = szValue; + } + RegCloseKey( hKey ); + } + else if ( ERROR_SUCCESS == RegOpenKey( HKEY_LOCAL_MACHINE, sProductKey.c_str(), &hKey ) ) + { + if ( ERROR_SUCCESS == RegQueryValueEx( hKey, TEXT("OFFICEINSTALLLOCATION"), NULL, NULL, (LPBYTE)szValue, &nValueSize ) ) + { + sInstDir = szValue; + } + RegCloseKey( hKey ); + } + else + { + return ERROR_SUCCESS; + } + + // MessageBox( NULL, sInstDir.c_str(), "install location", MB_OK ); + + // Searching for the unopkg.exe + + std::_tstring sUnoPkgFile = sInstDir + TEXT("program\\unopkg.exe"); + std::_tstring sShareInstallDir = sInstDir + TEXT("share\\extension\\install\\"); + std::_tstring sPattern = sShareInstallDir + TEXT("*.oxt"); + + WIN32_FIND_DATA aFindFileData; + + // Find unopkg.exe + + HANDLE hFindUnopkg = FindFirstFile( sUnoPkgFile.c_str(), &aFindFileData ); + + if ( hFindUnopkg != INVALID_HANDLE_VALUE ) + { + // unopkg.exe exists in program directory + + // Finding all oxt files in sShareInstallDir + + HANDLE hFindOxt = FindFirstFile( sPattern.c_str(), &aFindFileData ); + + if ( hFindOxt != INVALID_HANDLE_VALUE ) + { + bool fNextFile = false; + + do + { + const std::_tstring sTempFolder(createTempFolder()); + // When removing extensions, only the oxt file name is required, without path + // Therefore no quoting is required + // std::_tstring sOxtFile = sShareInstallDir + aFindFileData.cFileName; + std::_tstring sOxtFile = aFindFileData.cFileName; + std::_tstring sCommandPart1 = sUnoPkgFile + " remove --shared --bundled " + "\"" + + sOxtFile + "\""; + std::_tstring sCommand = sCommandPart1 + + TEXT(" -env:UNO_JAVA_JFW_INSTALL_DATA=$OOO_BASE_DIR/share/config/javasettingsunopkginstall.xml") + + TEXT(" -env:UserInstallation=") + sTempFolder; + + mystr = "Command: " + sCommand; + //MessageBox(NULL, mystr.c_str(), "Command", MB_OK); + DWORD exitCode = 0; + bool fSuccess = ExecuteCommand( sCommand.c_str(), & exitCode); + // unopkg in OOo 2.2.1 and early had a bug that it failed when receiving + // a bootstrap parameter (-env:...) then it exited with a value != 0. + if (fSuccess && exitCode != 0) + { + std::_tstring sCommand = sCommandPart1; + mystr = "Command: " + sCommand; + //MessageBox(NULL, mystr.c_str(), "Command", MB_OK); + fSuccess = ExecuteCommand( sCommand.c_str(), & exitCode); + } + + deleteTempFolder(sTempFolder); + + 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); + } + + fNextFile = FindNextFile( hFindOxt, &aFindFileData ); + + } while ( fNextFile ); + + FindClose( hFindOxt ); + } + } + // else + // { + // mystr = "Not found: " + sUnoPkgFile; + // MessageBox(NULL, mystr.c_str(), "Command", MB_OK); + // } + + return ERROR_SUCCESS; +} + +extern "C" UINT __stdcall RemoveExtensions(MSIHANDLE handle) +{ + std::_tstring mystr; + + // Finding the product with the help of the propery FINDPRODUCT, + // that contains a Windows Registry key, that points to the install location. + + TCHAR szValue[8192]; + DWORD nValueSize = sizeof(szValue); + HKEY hKey; + std::_tstring sInstDir; + + std::_tstring sProductKey = GetMsiProperty( handle, TEXT("FINDPRODUCT") ); + // MessageBox( NULL, sProductKey.c_str(), "Titel", MB_OK ); + + if ( ERROR_SUCCESS == RegOpenKey( HKEY_CURRENT_USER, sProductKey.c_str(), &hKey ) ) + { + if ( ERROR_SUCCESS == RegQueryValueEx( hKey, TEXT("OFFICEINSTALLLOCATION"), NULL, NULL, (LPBYTE)szValue, &nValueSize ) ) + { + sInstDir = szValue; + } + RegCloseKey( hKey ); + } + else if ( ERROR_SUCCESS == RegOpenKey( HKEY_LOCAL_MACHINE, sProductKey.c_str(), &hKey ) ) + { + if ( ERROR_SUCCESS == RegQueryValueEx( hKey, TEXT("OFFICEINSTALLLOCATION"), NULL, NULL, (LPBYTE)szValue, &nValueSize ) ) + { + sInstDir = szValue; + } + RegCloseKey( hKey ); + } + else + { + return ERROR_SUCCESS; + } + + // Removing complete directory "share\uno_packages\cache" + + std::_tstring sCacheDir = sInstDir + TEXT("share\\uno_packages\\cache"); + + bool fSuccess = RemoveCompleteDirectory( sCacheDir ); + + if ( fSuccess ) + { + mystr = "Executed successfully!"; + // MessageBox(NULL, mystr.c_str(), "Main methode", MB_OK); + } + else + { + mystr = "An error occured during execution!"; + // MessageBox(NULL, mystr.c_str(), "Main methode", MB_OK); + } + + return ERROR_SUCCESS; +} diff --git a/setup_native/source/win32/customactions/shellextensions/setadmininstall.cxx b/setup_native/source/win32/customactions/shellextensions/setadmininstall.cxx new file mode 100755 index 000000000000..6bd57447f092 --- /dev/null +++ b/setup_native/source/win32/customactions/shellextensions/setadmininstall.cxx @@ -0,0 +1,66 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#define _WIN32_WINNT 0x0401 + +#ifdef _MSC_VER +#pragma warning(push, 1) /* disable warnings within system headers */ +#endif +#define WIN32_LEAN_AND_MEAN +#include <windows.h> +#include <msiquery.h> +#ifdef _MSC_VER +#pragma warning(pop) +#endif + +#include <malloc.h> +#include <assert.h> + +#ifdef UNICODE +#define _UNICODE +#define _tstring wstring +#else +#define _tstring string +#endif +#include <tchar.h> +#include <string> +#include <queue> +#include <stdio.h> + +#include <systools/win32/uwinapi.h> +#include <../tools/seterror.hxx> + +static void SetMsiProperty(MSIHANDLE handle, const std::_tstring& sProperty) +{ + MsiSetProperty(handle, sProperty.c_str(), TEXT("1")); +} + +extern "C" UINT __stdcall SetAdminInstallProperty(MSIHANDLE handle) +{ + SetMsiProperty(handle, TEXT("ADMININSTALL")); + return ERROR_SUCCESS; +} diff --git a/setup_native/source/win32/customactions/shellextensions/shellextensions.cxx b/setup_native/source/win32/customactions/shellextensions/shellextensions.cxx new file mode 100644 index 000000000000..c779e1e5994e --- /dev/null +++ b/setup_native/source/win32/customactions/shellextensions/shellextensions.cxx @@ -0,0 +1,213 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +/* + Windows shell extensions need to be approved in order to be used by the + Windows shell for clarification read the following section from the + Microsoft Developers Network Library (MSDN) see + http://msdn.microsoft.com/library/default.asp?url=/library/en-us/shellcc/platform/shell/programmersguide/shell_int/shell_int_extending/extensionhandlers/shell_ext.asp + + + <MSDN> + Shell extension handlers run in the Shell process. Because it is a system process, + the administrator of a Windows NT system can limit Shell extension handlers to + those on an approved list by setting the EnforceShellExtensionSecurity value of the + HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Policies\Explorer key to 1 + (one). + To place a Shell extension handler on the approved list, create a REG_SZ value whose + name is the string form of the handler's GUID under + HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion\Shell Extensions\Approved. + + The Shell does not use the value that is assigned to the GUID, but it should be set to + make inspecting the registry easier. + + Your setup application can add values to the Approved key only if the person installing + the application has sufficient privileges. If the attempt to add an extension handler + fails, you should inform the user that administrative privileges are required to fully + install the application. If the handler is essential to the application, you should fail + the setup and notify the user to contact an administrator. + + While there is no need to add values to the Approved key on Windows 95 or Windows 98 + systems, there is no harm in doing so. The system will simply ignore them. However, there + is no guarantee that the key will exist on these systems. Your setup program must be able + to handle this case. + </MSDN> + + We add the following entries to the respective registry key + "{C52AF81D-F7A0-4AAB-8E87-F80A60CCD396}"="OpenOffice.org Column Handler" + "{087B3AE3-E237-4467-B8DB-5A38AB959AC9}"="OpenOffice.org Infotip Handler" + "{63542C48-9552-494A-84F7-73AA6A7C99C1}"="OpenOffice.org Property Sheet Handler" + "{3B092F0C-7696-40E3-A80F-68D74DA84210}"="OpenOffice.org Thumbnail Viewer" + + These shell extensions are implemented in the 'shell' project. We ignore registration + failures because of insufficient privileges. The reason is: On systems which restrict the + use of shell extensions by applying the aforementioned policy probably only people with + sufficient privileges are allowed to install applications anyway. On systems where the + use of shell extensions is not restricted registration failures because of insufficient + prviliges have no negative effect because the shell extensions will work anyhow. +*/ + +#ifdef _MSC_VER +#pragma warning(push, 1) /* disable warnings within system headers */ +#endif +#define WIN32_LEAN_AND_MEAN +#include <windows.h> +#include <msiquery.h> +#ifdef _MSC_VER +#pragma warning(pop) +#endif + +#include <malloc.h> + +#ifdef UNICODE +#define _UNICODE +#endif +#include <tchar.h> + +struct RegistryEntry +{ + TCHAR* Key; + TCHAR* Value; +}; + +RegistryEntry ColumnHandler = { TEXT("{C52AF81D-F7A0-4AAB-8E87-F80A60CCD396}"), TEXT("OpenOffice.org Column Handler") }; +RegistryEntry InfotipHandler = { TEXT("{087B3AE3-E237-4467-B8DB-5A38AB959AC9}"), TEXT("OpenOffice.org Infotip Handler") }; +RegistryEntry PropHandler = { TEXT("{63542C48-9552-494A-84F7-73AA6A7C99C1}"), TEXT("OpenOffice.org Property Sheet Handler") }; +RegistryEntry ThumbViewer = { TEXT("{3B092F0C-7696-40E3-A80F-68D74DA84210}"), TEXT("OpenOffice.org Thumbnail Viewer") }; + +BOOL GetMsiProp( MSIHANDLE hMSI, const char* pPropName, char** ppValue ) +{ + DWORD sz = 0; + if ( MsiGetProperty( hMSI, pPropName, 0, &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 TRUE; + } + + return FALSE; +} + +bool IsVersionNT64( MSIHANDLE hMSI ) +{ + char* pVal = NULL; + + if ( GetMsiProp( hMSI, "VersionNT64", &pVal ) && pVal ) + { + free( pVal ); + return true; + } + + return false; +} + + + + +/* + Called during installation when the module "Windows Explorer Extensions" is + selected. +*/ +extern "C" UINT __stdcall InstallExecSequenceEntry(MSIHANDLE hMSI) +{ + //MessageBox(NULL, TEXT("InstallExecSequenceEntry"), TEXT("Pythonmsi"), MB_OK | MB_ICONINFORMATION); + HKEY hKey; + + +// 06.11.2009 tkr: to provide windows xp as build systems for mingw we need to define KEY_WOW64_64KEY +// in mingw 3.13 KEY_WOW64_64KEY isn't available < Win2003 systems. +// Also defined in setup_native\source\win32\customactions\reg64\reg64.cxx,source\win32\customactions\shellextensions\shellextensions.cxx and +// extensions\source\activex\main\so_activex.cpp +#ifndef KEY_WOW64_64KEY + #define KEY_WOW64_64KEY (0x0100) +#endif + + if (IsVersionNT64(hMSI)) + { + // Open Windows 64 Bit Registry + if (RegOpenKeyEx(HKEY_LOCAL_MACHINE, TEXT("Software\\Microsoft\\Windows\\CurrentVersion\\Shell Extensions\\Approved"),0, KEY_WRITE | KEY_WOW64_64KEY, &hKey) == ERROR_SUCCESS) + { + RegSetValueEx(hKey, ColumnHandler.Key, 0, REG_SZ, reinterpret_cast<const BYTE*>(ColumnHandler.Value), _tcslen(ColumnHandler.Value) + 1); + RegSetValueEx(hKey, InfotipHandler.Key, 0, REG_SZ, reinterpret_cast<const BYTE*>(InfotipHandler.Value), _tcslen(InfotipHandler.Value) + 1); + RegSetValueEx(hKey, PropHandler.Key, 0, REG_SZ, reinterpret_cast<const BYTE*>(PropHandler.Value), _tcslen(PropHandler.Value) + 1); + RegSetValueEx(hKey, ThumbViewer.Key, 0, REG_SZ, reinterpret_cast<const BYTE*>(ThumbViewer.Value), _tcslen(ThumbViewer.Value) + 1); + + RegCloseKey(hKey); + } + + // Open Windows 32 Bit Registry on Win64 maschine + + if (RegOpenKeyEx(HKEY_LOCAL_MACHINE, TEXT("Software\\Microsoft\\Windows\\CurrentVersion\\Shell Extensions\\Approved"),0, KEY_WRITE, &hKey ) == ERROR_SUCCESS) + { + RegSetValueEx(hKey, ColumnHandler.Key, 0, REG_SZ, reinterpret_cast<const BYTE*>(ColumnHandler.Value), _tcslen(ColumnHandler.Value) + 1); + RegSetValueEx(hKey, InfotipHandler.Key, 0, REG_SZ, reinterpret_cast<const BYTE*>(InfotipHandler.Value), _tcslen(InfotipHandler.Value) + 1); + RegSetValueEx(hKey, PropHandler.Key, 0, REG_SZ, reinterpret_cast<const BYTE*>(PropHandler.Value), _tcslen(PropHandler.Value) + 1); + RegSetValueEx(hKey, ThumbViewer.Key, 0, REG_SZ, reinterpret_cast<const BYTE*>(ThumbViewer.Value), _tcslen(ThumbViewer.Value) + 1); + + RegCloseKey(hKey); + } + + + } else + { + if (RegOpenKey(HKEY_LOCAL_MACHINE, TEXT("Software\\Microsoft\\Windows\\CurrentVersion\\Shell Extensions\\Approved"), &hKey) == ERROR_SUCCESS) + { + RegSetValueEx(hKey, ColumnHandler.Key, 0, REG_SZ, reinterpret_cast<const BYTE*>(ColumnHandler.Value), _tcslen(ColumnHandler.Value) + 1); + RegSetValueEx(hKey, InfotipHandler.Key, 0, REG_SZ, reinterpret_cast<const BYTE*>(InfotipHandler.Value), _tcslen(InfotipHandler.Value) + 1); + RegSetValueEx(hKey, PropHandler.Key, 0, REG_SZ, reinterpret_cast<const BYTE*>(PropHandler.Value), _tcslen(PropHandler.Value) + 1); + RegSetValueEx(hKey, ThumbViewer.Key, 0, REG_SZ, reinterpret_cast<const BYTE*>(ThumbViewer.Value), _tcslen(ThumbViewer.Value) + 1); + + RegCloseKey(hKey); + } + } + return ERROR_SUCCESS; +} + +/* + Called during deinstallation when the module "Windows Explorer Extensions" has + been installed. +*/ +extern "C" UINT __stdcall DeinstallExecSequenceEntry(MSIHANDLE) +{ + //MessageBox(NULL, TEXT("DeinstallExecSequenceEntry"), TEXT("Pythonmsi"), MB_OK | MB_ICONINFORMATION); + HKEY hKey; + if (RegOpenKey(HKEY_LOCAL_MACHINE, TEXT("Software\\Microsoft\\Windows\\CurrentVersion\\Shell Extensions\\Approved"), &hKey) == ERROR_SUCCESS) + { + RegDeleteValue(hKey, ColumnHandler.Key); + RegDeleteValue(hKey, InfotipHandler.Key); + RegDeleteValue(hKey, PropHandler.Key); + RegDeleteValue(hKey, ThumbViewer.Key); + + RegCloseKey(hKey); + } + return ERROR_SUCCESS; +} diff --git a/setup_native/source/win32/customactions/shellextensions/startmenuicon.cxx b/setup_native/source/win32/customactions/shellextensions/startmenuicon.cxx new file mode 100644 index 000000000000..49d5e50be426 --- /dev/null +++ b/setup_native/source/win32/customactions/shellextensions/startmenuicon.cxx @@ -0,0 +1,142 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#define _WIN32_WINDOWS 0x0410 + +#ifdef _MSC_VER +#pragma warning(push, 1) /* disable warnings within system headers */ +#endif +#define WIN32_LEAN_AND_MEAN +#include <windows.h> +#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::_tstring sOfficeMenuFolder = GetMsiProperty( handle, TEXT("OfficeMenuFolder") ); + std::_tstring sDesktopFile = sOfficeMenuFolder + TEXT("Desktop.ini"); + + // MessageBox(NULL, sDesktopFile.c_str(), TEXT("OfficeMenuFolder"), MB_OK | MB_ICONINFORMATION); + + std::_tstring sIconFile = GetMsiProperty( handle, TEXT("OFFICEINSTALLLOCATION") ) + TEXT("program\\soffice.exe"); + + OSVERSIONINFO osverinfo; + osverinfo.dwOSVersionInfoSize = sizeof(OSVERSIONINFO); + GetVersionEx( &osverinfo ); + + if (osverinfo.dwMajorVersion < 6 /* && osverinfo.dwMinorVersion */ ) + { + // This icon (18) is a Windows folder until XP Version (number is 0 based) + WritePrivateProfileString( + TEXT(".ShellClassInfo"), + TEXT("IconFile"), + sIconFile.c_str(), + sDesktopFile.c_str() ); + + // FYI: in tool 'ResHack' this icon can be found on position '19' (number is 1 based) + WritePrivateProfileString( + TEXT(".ShellClassInfo"), + TEXT("IconIndex"), + TEXT("18"), + sDesktopFile.c_str() ); + } + // else + // { + // // at the moment there exists no Vista Icon, so we use the default folder icon. + // // add the icon into desktop/util/verinfo.rc + // } + + // The value '0' is to avoid a message like "You Are Deleting a System Folder" warning when deleting or moving the folder. + WritePrivateProfileString( + TEXT(".ShellClassInfo"), + TEXT("ConfirmFileOp"), + TEXT("0"), + sDesktopFile.c_str() ); + + /* + WritePrivateProfileString( + TEXT(".ShellClassInfo"), + TEXT("InfoTip"), + TEXT("StarOffice Productivity Suite"), + sDesktopFile.c_str() ); + */ + + SetFileAttributes( sDesktopFile.c_str(), FILE_ATTRIBUTE_HIDDEN ); + SetFileAttributes( sOfficeMenuFolder.c_str(), FILE_ATTRIBUTE_SYSTEM ); + + + return ERROR_SUCCESS; +} + +extern "C" UINT __stdcall DeinstallStartmenuFolderIcon(MSIHANDLE handle) +{ + 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() ); + + SetFileAttributes( sOfficeMenuFolder.c_str(), FILE_ATTRIBUTE_NORMAL ); + + return ERROR_SUCCESS; +} diff --git a/setup_native/source/win32/customactions/shellextensions/upgrade.cxx b/setup_native/source/win32/customactions/shellextensions/upgrade.cxx new file mode 100644 index 000000000000..1fb2972d433a --- /dev/null +++ b/setup_native/source/win32/customactions/shellextensions/upgrade.cxx @@ -0,0 +1,204 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#undef UNICODE +#undef _UNICODE + +#define _WIN32_WINDOWS 0x0410 + +#ifdef _MSC_VER +#pragma warning(push, 1) /* disable warnings within system headers */ +#endif +#define WIN32_LEAN_AND_MEAN +#include <windows.h> +#include <msiquery.h> +#ifdef _MSC_VER +#pragma warning(pop) +#endif + +#include <malloc.h> +#include <assert.h> + +#include <tchar.h> +#include <string> + +using namespace std; + +namespace +{ + // The provided GUID must be without surounding '{}' + string GetGuidPart(const string& guid, int index) + { + assert((guid.length() == 36) && "No GUID or wrong format!"); + assert(((index > -1) && (index < 5)) && "Out of range!"); + + if (index == 0) return string(guid.c_str(), 8); + if (index == 1) return string(guid.c_str() + 9, 4); + if (index == 2) return string(guid.c_str() + 14, 4); + if (index == 3) return string(guid.c_str() + 19, 4); + if (index == 4) return string(guid.c_str() + 24, 12); + + return string(); + } + + void Swap(char* p1, char* p2) + { + char tmp = *p1; + *p1 = *p2; + *p2 = tmp; + } + + string Invert(const string& str) + { + char* buff = reinterpret_cast<char*>(_alloca(str.length())); + strncpy(buff, str.c_str(), str.length()); + + char* front = buff; + char* back = buff + str.length() - 1; + + while (front < back) + Swap(front++, back--); + + return string(buff, str.length()); + } + + // Convert the upgrade code (which is a GUID) according + // to the way the windows installer does when writing it + // to the registry + // The first 8 bytes will be inverted, from the the last + // 8 bytes always the nibbles will be inverted for further + // details look in the MSDN under compressed registry keys + string ConvertGuid(const string& guid) + { + string convertedGuid; + + string part = GetGuidPart(guid, 0); + convertedGuid = Invert(part); + + part = GetGuidPart(guid, 1); + convertedGuid += Invert(part); + + part = GetGuidPart(guid, 2); + convertedGuid += Invert(part); + + part = GetGuidPart(guid, 3); + convertedGuid += Invert(string(part.c_str(), 2)); + convertedGuid += Invert(string(part.c_str() + 2, 2)); + + part = GetGuidPart(guid, 4); + int pos = 0; + for (int i = 0; i < 6; i++) + { + convertedGuid += Invert(string(part.c_str() + pos, 2)); + pos += 2; + } + 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) + { + HKEY hKey; + if (RegOpenKey(hRootKey, regKey.c_str(), &hKey) == ERROR_SUCCESS) + { + DWORD nSubKeys; + DWORD lLongestSubKey; + + if (RegQueryInfoKey( + hKey, NULL, NULL, NULL, &nSubKeys, &lLongestSubKey, NULL, NULL, NULL, NULL, NULL, NULL) == ERROR_SUCCESS) + { + LPTSTR buffer = reinterpret_cast<LPTSTR>(_alloca(lLongestSubKey + 1)); + + for (DWORD i = 0; i < nSubKeys; i++) + { + LONG ret = RegEnumKey(hKey, i, buffer, lLongestSubKey + 1); + if ((ret == ERROR_SUCCESS) && (buffer == upgradeKey)) + return true; + } + } + } + return false; + } +} // namespace + +extern "C" UINT __stdcall SetProductInstallMode(MSIHANDLE handle) +{ + 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); + + if (RegistryKeyHasUpgradeSubKey( + HKEY_CURRENT_USER, + TEXT("Software\\Microsoft\\Installer\\UpgradeCodes"), + upgradeCode) && IsSetMsiProperty(handle, TEXT("ALLUSERS"))) + { + UnsetMsiProperty(handle, TEXT("ALLUSERS")); + //MessageBox(NULL, "ALLUSERS removed", "DEBUG", MB_OK); + } + else if (RegistryKeyHasUpgradeSubKey( + HKEY_LOCAL_MACHINE, + TEXT("Software\\Classes\\Installer\\UpgradeCodes"), + upgradeCode) && !IsSetMsiProperty(handle, TEXT("ALLUSERS"))) + { + 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 new file mode 100644 index 000000000000..d9c271133ac0 --- /dev/null +++ b/setup_native/source/win32/customactions/shellextensions/vistaspecial.cxx @@ -0,0 +1,242 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#define _WIN32_WINNT 0x0401 + +#ifdef _MSC_VER +#pragma warning(push, 1) /* disable warnings within system headers */ +#endif +#define WIN32_LEAN_AND_MEAN +#include <windows.h> +#include <msiquery.h> +#ifdef _MSC_VER +#pragma warning(pop) +#endif + +#include <malloc.h> +#include <assert.h> + +#ifdef UNICODE +#define _UNICODE +#define _tstring wstring +#else +#define _tstring string +#endif +#include <tchar.h> +#include <string> +#include <queue> +#include <stdio.h> +#include <strsafe.h> + +#include <systools/win32/uwinapi.h> +#include <../tools/seterror.hxx> + +//---------------------------------------------------------- +#ifdef DEBUG +inline void OutputDebugStringFormat( LPCSTR pFormat, ... ) +{ + CHAR buffer[1024]; + va_list args; + + va_start( args, pFormat ); + StringCchVPrintfA( buffer, sizeof(buffer), pFormat, args ); + OutputDebugStringA( buffer ); +} +#else +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 ) +{ + bool bDirectoryRemoved = true; + + std::_tstring mystr; + std::_tstring sPattern = sPath + TEXT("\\") + TEXT("*.*"); + WIN32_FIND_DATA aFindData; + + // Finding all content in sPath + + HANDLE hFindContent = FindFirstFile( sPattern.c_str(), &aFindData ); + + if ( hFindContent != INVALID_HANDLE_VALUE ) + { + bool fNextFile = false; + std::_tstring sCurrentDir = TEXT("."); + std::_tstring sParentDir = TEXT(".."); + + do + { + std::_tstring sFileName = aFindData.cFileName; + + mystr = "Current short file: " + sFileName; + // MessageBox(NULL, mystr.c_str(), "Current Content", MB_OK); + + if (( strcmp(sFileName.c_str(),sCurrentDir.c_str()) != 0 ) && + ( strcmp(sFileName.c_str(),sParentDir.c_str()) != 0 )) + { + std::_tstring sCompleteFileName = sPath + TEXT("\\") + sFileName; + + if ( aFindData.dwFileAttributes == FILE_ATTRIBUTE_DIRECTORY ) + { + bool fSuccess = RemoveCompleteDirectory(sCompleteFileName); + if ( fSuccess ) + { + mystr = "Successfully removed content of dir " + sCompleteFileName; + // MessageBox(NULL, mystr.c_str(), "Removed Directory", MB_OK); + } + else + { + mystr = "An error occured during removing content of " + sCompleteFileName; + // MessageBox(NULL, mystr.c_str(), "Error removing directory", MB_OK); + } + } + else + { + bool fSuccess = DeleteFile( sCompleteFileName.c_str() ); + if ( fSuccess ) + { + mystr = "Successfully removed file " + sCompleteFileName; + // MessageBox(NULL, mystr.c_str(), "Removed File", MB_OK); + } + else + { + mystr = "An error occured during removal of file " + sCompleteFileName; + // MessageBox(NULL, mystr.c_str(), "Error removing file", MB_OK); + } + } + } + + fNextFile = FindNextFile( hFindContent, &aFindData ); + + } while ( fNextFile ); + + FindClose( hFindContent ); + + // empty directory can be removed now + // RemoveDirectory is only successful, if the last handle to the directory is closed + // -> first removing content -> closing handle -> remove empty directory + + bool fRemoveDirSuccess = RemoveDirectory(sPath.c_str()); + + if ( fRemoveDirSuccess ) + { + mystr = "Successfully removed dir " + sPath; + // MessageBox(NULL, mystr.c_str(), "Removed Directory", MB_OK); + } + else + { + mystr = "An error occured during removal of empty directory " + sPath; + // MessageBox(NULL, mystr.c_str(), "Error removing directory", MB_OK); + bDirectoryRemoved = false; + } + } + + return bDirectoryRemoved; +} + + + +extern "C" UINT __stdcall RenamePrgFolder( MSIHANDLE handle ) +{ + std::_tstring sOfficeInstallPath = GetMsiProperty(handle, TEXT("OFFICEINSTALLLOCATION")); + + std::_tstring sRenameSrc = sOfficeInstallPath + TEXT("program"); + std::_tstring sRenameDst = sOfficeInstallPath + TEXT("program_old"); + +// MessageBox(NULL, sRenameSrc.c_str(), "OFFICEINSTALLLOCATION", MB_OK); + + bool bSuccess = MoveFile( sRenameSrc.c_str(), sRenameDst.c_str() ); + if ( !bSuccess ) + { + TCHAR sAppend[2] = TEXT("0"); + for ( int i = 0; i < 10; i++ ) + { + sRenameDst = sOfficeInstallPath + TEXT("program_old") + sAppend; + bSuccess = MoveFile( sRenameSrc.c_str(), sRenameDst.c_str() ); + if ( bSuccess ) + break; + sAppend[0] += 1; + } + } + +#if 0 + if ( !bSuccess ) + MessageBox(NULL, "Renaming folder failed", "RenamePrgFolder", MB_OK); + else + MessageBox(NULL, "Renaming folder successful", "RenamePrgFolder", MB_OK); +#endif + + return ERROR_SUCCESS; +} + +extern "C" UINT __stdcall RemovePrgFolder( MSIHANDLE handle ) +{ + std::_tstring sOfficeInstallPath = GetMsiProperty(handle, TEXT("OFFICEINSTALLLOCATION")); + std::_tstring sRemoveDir = sOfficeInstallPath + TEXT("program_old"); + +// MessageBox(NULL, sRemoveDir.c_str(), "REMOVING OLD DIR", MB_OK); + + bool bSuccess = RemoveCompleteDirectory( sRemoveDir ); + + TCHAR sAppend[2] = TEXT("0"); + for ( int i = 0; i < 10; i++ ) + { + sRemoveDir = sOfficeInstallPath + TEXT("program_old") + sAppend; + bSuccess = RemoveCompleteDirectory( sRemoveDir ); + sAppend[0] += 1; + } + +#if 0 + if ( bSuccess ) + MessageBox(NULL, "Removing folder successful", "RemovePrgFolder", MB_OK); + else + MessageBox(NULL, "Removing folder failed", "RemovePrgFolder", MB_OK); +#endif + + return ERROR_SUCCESS; +} diff --git a/setup_native/source/win32/customactions/tools/checkversion.cxx b/setup_native/source/win32/customactions/tools/checkversion.cxx new file mode 100644 index 000000000000..ef30b2f9365f --- /dev/null +++ b/setup_native/source/win32/customactions/tools/checkversion.cxx @@ -0,0 +1,149 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#define UNICODE + +#ifdef _MSC_VER +#pragma warning(push,1) // disable warnings within system headers +#endif +#include <windows.h> +#include <msiquery.h> +#ifdef _MSC_VER +#pragma warning(pop) +#endif + +#include <string.h> +#include <malloc.h> +#include <stdio.h> +#include "strsafe.h" + +#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, ... ) +{ + TCHAR buffer[1024]; + va_list args; + + va_start( args, pFormat ); + StringCchVPrintf( buffer, sizeof(buffer), pFormat, args ); + OutputDebugString( buffer ); +} +#else +static inline void OutputDebugStringFormat( LPCTSTR, ... ) +{ +} +#endif + +//---------------------------------------------------------- +extern "C" UINT __stdcall CheckVersions( MSIHANDLE hMSI ) +{ + // MessageBox(NULL, L"CheckVersions", L"Information", MB_OK | MB_ICONINFORMATION); + + wchar_t* pVal = NULL; + + if ( GetMsiProp( hMSI, L"NEWPRODUCTS", &pVal ) && pVal ) + { + OutputDebugStringFormat( TEXT("DEBUG: NEWPRODUCTS found [%s]"), pVal ); + if ( *pVal != 0 ) + SetMsiErrorCode( MSI_ERROR_NEW_VERSION_FOUND ); + free( pVal ); + } + pVal = NULL; + if ( GetMsiProp( hMSI, L"SAMEPRODUCTS", &pVal ) && pVal ) + { + OutputDebugStringFormat( TEXT("DEBUG: SAMEPRODUCTS found [%s]"), pVal ); + if ( *pVal != 0 ) + SetMsiErrorCode( MSI_ERROR_SAME_VERSION_FOUND ); + free( pVal ); + } + pVal = NULL; + if ( GetMsiProp( hMSI, L"OLDPRODUCTS", &pVal ) && pVal ) + { + OutputDebugStringFormat( TEXT("DEBUG: OLDPRODUCTS found [%s]"), pVal ); + if ( *pVal != 0 ) + SetMsiErrorCode( MSI_ERROR_OLD_VERSION_FOUND ); + free( pVal ); + } + pVal = NULL; + if ( GetMsiProp( hMSI, L"BETAPRODUCTS", &pVal ) && pVal ) + { + OutputDebugStringFormat( TEXT("DEBUG: BETAPRODUCTS found [%s]"), pVal ); + if ( *pVal != 0 ) + SetMsiErrorCode( MSI_ERROR_OLD_VERSION_FOUND ); + free( pVal ); + } + + pVal = NULL; + if ( GetMsiProp( hMSI, L"NEWPRODUCTSPATCH", &pVal ) && pVal ) + { + OutputDebugStringFormat( TEXT("DEBUG: NEWPRODUCTSPATCH found [%s]"), pVal ); + if ( *pVal != 0 ) + SetMsiErrorCode( MSI_ERROR_NEW_PATCH_FOUND ); + free( pVal ); + } + pVal = NULL; + if ( GetMsiProp( hMSI, L"SAMEPRODUCTSPATCH", &pVal ) && pVal ) + { + OutputDebugStringFormat( TEXT("DEBUG: SAMEPRODUCTSPATCH found [%s]"), pVal ); + if ( *pVal != 0 ) + SetMsiErrorCode( MSI_ERROR_SAME_PATCH_FOUND ); + free( pVal ); + } + pVal = NULL; + if ( GetMsiProp( hMSI, L"OLDPRODUCTSPATCH", &pVal ) && pVal ) + { + OutputDebugStringFormat( TEXT("DEBUG: OLDPRODUCTSPATCH found [%s]"), pVal ); + if ( *pVal != 0 ) + SetMsiErrorCode( MSI_ERROR_OLD_PATCH_FOUND ); + free( pVal ); + } + + return ERROR_SUCCESS; +} + + diff --git a/setup_native/source/win32/customactions/tools/exports.dxp b/setup_native/source/win32/customactions/tools/exports.dxp new file mode 100644 index 000000000000..18d82240f49e --- /dev/null +++ b/setup_native/source/win32/customactions/tools/exports.dxp @@ -0,0 +1 @@ +CheckVersions diff --git a/setup_native/source/win32/customactions/tools/makefile.mk b/setup_native/source/win32/customactions/tools/makefile.mk new file mode 100644 index 000000000000..4e8d791eff15 --- /dev/null +++ b/setup_native/source/win32/customactions/tools/makefile.mk @@ -0,0 +1,84 @@ +#************************************************************************* +# +# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. +# +# Copyright 2000, 2010 Oracle and/or its affiliates. +# +# OpenOffice.org - a multi-platform office productivity suite +# +# This file is part of OpenOffice.org. +# +# OpenOffice.org is free software: you can redistribute it and/or modify +# it under the terms of the GNU Lesser General Public License version 3 +# only, as published by the Free Software Foundation. +# +# OpenOffice.org is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU Lesser General Public License version 3 for more details +# (a copy is included in the LICENSE file that accompanied this code). +# +# You should have received a copy of the GNU Lesser General Public License +# version 3 along with OpenOffice.org. If not, see +# <http://www.openoffice.org/license.html> +# for a copy of the LGPLv3 License. +# +#************************************************************************* + +PRJ=..$/..$/..$/.. +PRJNAME=setup_native +TARGET=sn_tools + + +# --- Settings ----------------------------------------------------- + +ENABLE_EXCEPTIONS=TRUE +NO_DEFAULT_STL=TRUE +DYNAMIC_CRT= +USE_DEFFILE=TRUE + +.INCLUDE : settings.mk + +.IF "$(USE_SYSTEM_STL)" != "YES" +CFLAGS+=-D_STLP_USE_STATIC_LIB +.ENDIF + +# --- Files -------------------------------------------------------- + +.IF "$(GUI)"=="WNT" + +UWINAPILIB= + +SLOFILES = $(SLO)$/seterror.obj \ + $(SLO)$/checkversion.obj + +SHL1OBJS = $(SLOFILES) + +STDSHL+= \ + $(ADVAPI32LIB)\ + $(MSILIB) + +.IF "$(USE_SYSTEM_STL)" != "YES" +STDSHL+=$(LIBSTLPORTST) +.ENDIF + +#SHL1LIBS = $(SLB)$/$(TARGET).lib + +SHL1TARGET = $(TARGET) +SHL1IMPLIB = i$(TARGET) + +SHL1DEF = $(MISC)$/$(SHL1TARGET).def +SHL1DEPN = $(SLB)$/$(TARGET).lib +SHL1BASE = 0x1c000000 +DEF1NAME=$(SHL1TARGET) +DEF1EXPORTFILE=exports.dxp + +.ENDIF + +# --- Targets -------------------------------------------------------------- + +.INCLUDE : target.mk + +# ------------------------------------------------------------------------- + + diff --git a/setup_native/source/win32/customactions/tools/seterror.cxx b/setup_native/source/win32/customactions/tools/seterror.cxx new file mode 100644 index 000000000000..6d50120ccc18 --- /dev/null +++ b/setup_native/source/win32/customactions/tools/seterror.cxx @@ -0,0 +1,97 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#define UNICODE + +#ifdef _MSC_VER +#pragma warning(push,1) // disable warnings within system headers +#endif +#include <windows.h> +#ifdef _MSC_VER +#pragma warning(pop) +#endif + +#include <string.h> +#include <malloc.h> +#include <stdio.h> +#include "strsafe.h" + +#include <seterror.hxx> + +//---------------------------------------------------------- +#ifdef DEBUG +inline void OutputDebugStringFormat( LPCTSTR pFormat, ... ) +{ + TCHAR buffer[1024]; + va_list args; + + va_start( args, pFormat ); + StringCchVPrintf( buffer, sizeof(buffer), pFormat, args ); + OutputDebugString( buffer ); +} +#else +static inline void OutputDebugStringFormat( LPCTSTR, ... ) +{ +} +#endif + +//---------------------------------------------------------- +void SetMsiErrorCode( int nErrorCode ) +{ + const TCHAR sMemMapName[] = TEXT( "Global\\MsiErrorObject" ); + + HANDLE hMapFile; + int *pBuf; + + hMapFile = OpenFileMapping( + FILE_MAP_ALL_ACCESS, // read/write access + FALSE, // do not inherit the name + sMemMapName ); // name of mapping object + + if ( hMapFile == NULL ) // can not set error code + { + OutputDebugStringFormat( TEXT("Could not open map file (%d).\n"), GetLastError() ); + return; + } + + pBuf = (int*) MapViewOfFile( hMapFile, // handle to map object + FILE_MAP_ALL_ACCESS, // read/write permission + 0, + 0, + sizeof( int ) ); + if ( pBuf ) + { + *pBuf = nErrorCode; + UnmapViewOfFile( pBuf ); + } + else + OutputDebugStringFormat( TEXT("Could not map view of file (%d).\n"), GetLastError() ); + + CloseHandle( hMapFile ); +} + + diff --git a/setup_native/source/win32/customactions/tools/seterror.hxx b/setup_native/source/win32/customactions/tools/seterror.hxx new file mode 100644 index 000000000000..fad705433aa5 --- /dev/null +++ b/setup_native/source/win32/customactions/tools/seterror.hxx @@ -0,0 +1,54 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#ifndef _SETERROR_HXX_ +#define _SETERROR_HXX_ + +//---------------------------------------------------------- +// list of own error codes + +#define MSI_ERROR_INVALIDDIRECTORY 9001 +#define MSI_ERROR_ISWRONGPRODUCT 9002 +#define MSI_ERROR_PATCHISOLDER 9003 + +#define MSI_ERROR_NEW_VERSION_FOUND 9010 +#define MSI_ERROR_SAME_VERSION_FOUND 9011 +#define MSI_ERROR_OLD_VERSION_FOUND 9012 +#define MSI_ERROR_NEW_PATCH_FOUND 9013 +#define MSI_ERROR_SAME_PATCH_FOUND 9014 +#define MSI_ERROR_OLD_PATCH_FOUND 9015 + +#define MSI_ERROR_OFFICE_IS_RUNNING 9020 + +#define MSI_ERROR_DIRECTORY_NOT_EMPTY 9030 + +//---------------------------------------------------------- + +void SetMsiErrorCode( int nErrorCode ); + +#endif + diff --git a/setup_native/source/win32/desktophelper.txt b/setup_native/source/win32/desktophelper.txt new file mode 100644 index 000000000000..c7540116c671 --- /dev/null +++ b/setup_native/source/win32/desktophelper.txt @@ -0,0 +1 @@ +# File used for desktop link diff --git a/setup_native/source/win32/get_retval.bat b/setup_native/source/win32/get_retval.bat new file mode 100755 index 000000000000..d1a10539be7f --- /dev/null +++ b/setup_native/source/win32/get_retval.bat @@ -0,0 +1,3 @@ +echo off +call %* +echo %1 returned %ERRORLEVEL%
\ No newline at end of file diff --git a/setup_native/source/win32/msi-encodinglist.txt b/setup_native/source/win32/msi-encodinglist.txt new file mode 100644 index 000000000000..81258d61f38b --- /dev/null +++ b/setup_native/source/win32/msi-encodinglist.txt @@ -0,0 +1,140 @@ +# Syntax: language ANSI-Codepage LCID +# comment lines begin with hash +af 1252 1078 # Afrikaans +ar 1256 1025 +ar-SA 1256 1025 +as-IN 0 1101 # Assamese +as 0 1101 # Assamese +ast 1252 1610 +be-BY 1251 1059 # Belarusian +bg 1251 1026 # Bulgarian +bn 0 2117 # Bengali +bn-BD 0 2117 # Bengali Bangladesh +bn-IN 0 1093 # Bengali India +br 1252 1150 # Breton +brx 0 1603 # Bodo (India) +bs 0 5146 # bosnian +bo 0 2121 +ca 1252 1027 # Catalan +cs 1250 1029 # Czech +cy 1252 1106 # Welsh +da 1252 1030 +de 1252 1031 +dgo 0 1604 # Dogri (India) +dz 0 2129 # Dzongkha (same ID as tibetan bhutan (s. i40713)) +el 1253 1032 +en-GB 1252 2057 +en-US 1252 1033 +en-ZA 1252 7177 +eo 0 1553 # Esperanto +es 1252 1034 +et 1257 1061 +eu 1252 1069 # Basque +fa 0 1065 # Farsi +fi 1252 1035 +fo 1252 1080 # Faroese +fr 1252 1036 +fr-CA 1252 3084 +ga 0 2108 # Irish +gd 0 1084 # Gaelic (Scotland) +gl 1252 1110 # Galician +gu 0 1095 # Gujarati +gu-IN 0 1095 # Gujarati +he 1255 1037 +hi 0 1081 +hi-IN 0 1081 # hindi +hr 1250 1050 # Croatian +hu 1250 1038 +hy 0 1067 # Armenian +id 1252 1057 # Indonesian +is 1252 1039 # Icelandic +it 1252 1040 +ja 932 1041 +ka 0 1079 # Georgian +km 0 1107 # Khmer +kn 0 1099 # Kannada +kn-IN 0 1099 # Kannada +ko 949 1042 +kok 0 1111 # Konkani +ks 0 1120 # Kashmiri +ku 0 1574 +kid 1252 1033 # key id pseudo language +ky 0 2100 +lo 0 1108 # Lao +lt 1257 1063 # Lithuanian +lv 1257 1062 # Latvian +mai 0 1605 # Maithili (India) +mk 1251 1071 # Macedonian +ml-IN 0 1100 +ml 0 1100 +mn 0 1104 # Mongolian +mni 0 1112 # Manipuri +mn-TR 0 2128 # Mongolian Classical/traditional +mr 0 1102 # Marathi +mr-IN 0 1102 +ms 0 1086 # Malay (Malaysian) +mt 0 1082 # Maltese +my 0 1109 # Burmese +nb 1252 1044 +ne 0 1121 # Nepali +nl 1252 1043 +nn 1252 2068 +no 1252 1044 +nr 0 1580 # Ndebele South +ns 0 1132 # Northern Sotho (Sepedi) +or 0 1096 # Oriya +oc 1252 1154 # Occitan-lengadocian +or-IN 0 1096 +pa-IN 0 1094 # Punjabi +pap 0 2171 +om 0 2162 +pl 1250 1045 +pt 1252 2070 +pt-BR 1252 1046 +pt-PT 1252 2070 +ps 0 2171 +rm 0 1047 # Raeto-Romance +ro 1250 1048 # Romanian +ru 1251 1049 +rw 0 1569 # Kinyarwanda +sa-IN 0 1103 # Sanskrit +sat 0 1606 # Santali +sb 0 1070 # Sorbian +sc 0 3047 +sd 0 1113 # Sindhi +sh 1250 2074 # Serbian Latin +sk 1250 1051 # Slovak +sl 1250 1060 # Slovenian +sq 1250 1052 # Albanian +sr 1251 3098 # Serbian Cyrillic +sr-SP 1251 3098 # Serbian Cyrillic +ss 0 1579 # Swazi +st 0 1072 # Southern Sotho, Sutu +sv 1252 1053 +sw 1252 1089 # Swahili +sw-TZ 1252 1089 # Swahili +si 0 2133 +ta 0 1097 # Tamil +ta-IN 0 1097 # Tamil +te-IN 0 1098 +te 0 1098 +tg 0 1064 # Tajik +th 874 1054 +ti-ER 0 1139 +tn 0 1074 # Setsuana +tr 1254 1055 # Turkish +ts 0 1073 # Tsonga +tt 1251 1092 # Tatar +uk 1251 1058 # Ukrainian +ur 1256 1056 # Urdu +ur-IN 0 2080 +uz 0 1091 # Uzbek (Latin) +ug 0 2200 +ve 0 1075 # Venda +vi 1258 1066 # Vietnamese +xh 0 1076 # Xhosa +yi 0 1085 # Yiddish +zh-CN 936 2052 +zh-TW 950 1028 +zu 0 1077 # Zulu +kk 0 1087 diff --git a/setup_native/source/win32/nsis/brobanner.bmp b/setup_native/source/win32/nsis/brobanner.bmp Binary files differnew file mode 100644 index 000000000000..37f517176524 --- /dev/null +++ b/setup_native/source/win32/nsis/brobanner.bmp diff --git a/setup_native/source/win32/nsis/brobitmap.bmp b/setup_native/source/win32/nsis/brobitmap.bmp Binary files differnew file mode 100644 index 000000000000..0c5e11da76d5 --- /dev/null +++ b/setup_native/source/win32/nsis/brobitmap.bmp diff --git a/setup_native/source/win32/nsis/brosdkbanner.bmp b/setup_native/source/win32/nsis/brosdkbanner.bmp Binary files differnew file mode 100644 index 000000000000..cbc2704721f8 --- /dev/null +++ b/setup_native/source/win32/nsis/brosdkbanner.bmp diff --git a/setup_native/source/win32/nsis/downloadtemplate.nsi b/setup_native/source/win32/nsis/downloadtemplate.nsi new file mode 100644 index 000000000000..d755dfb5848a --- /dev/null +++ b/setup_native/source/win32/nsis/downloadtemplate.nsi @@ -0,0 +1,432 @@ +!define PRODUCT_NAME "PRODUCTNAMEPLACEHOLDER" +!define PRODUCT_VERSION "PRODUCTVERSIONPLACEHOLDER" +!define PRODUCT_PUBLISHER "PUBLISHERPLACEHOLDER" +!define PRODUCT_WEB_SITE "WEBSITEPLACEHOLDER" + +; SetCompressor lzma +SetCompressor zlib + +; MUI 1.67 compatible ------ +!include "MUI.nsh" + +Function .onInit + + Call GetParameters + Pop $1 + ;MessageBox MB_OK "$1" + + Push $1 + Push "/HELP=" + Call GetOptions + Pop $2 + ;MessageBox MB_OK "HELP: $2" + + StrCmp $2 "ON" showhelp nohelp + showhelp: + MessageBox MB_OK|MB_ICONINFORMATION \ + "DOWNLOADNAMEPLACEHOLDER options: $\n $\n \ + /S : Silent installation $\n \ + /D=<path> : NSIS installation directory (must be the last option!) $\n \ + /EXTRACTONLY=ON : NSIS only extracts the PRODUCTNAMEPLACEHOLDER PRODUCTVERSIONPLACEHOLDER installation set $\n \ + /INSTALLLOCATION=<path> : PRODUCTNAMEPLACEHOLDER PRODUCTVERSIONPLACEHOLDER installation directory $\n \ + /POSTREMOVE=ON : Removes the unpacked installation set after PRODUCTNAMEPLACEHOLDER PRODUCTVERSIONPLACEHOLDER installation $\n \ + /INSTALLJAVA=ON : Installs JRE located in sub directory java, if exists $\n \ + /GUILEVEL=<guilevel> : Setting Windows Installer GUI level: qr, qb, qn, qf, ... $\n \ + /PARAM1=$\"key=value$\" : Flexible parameter 1. Example: /PARAM1=$\"INSTALLLEVEL=70$\" $\n \ + /PARAM2=$\"key=value$\" : Flexible parameter 2. $\n \ + /PARAM3=$\"key=value$\" : Flexible parameter 3. $\n \ + /HELP=ON : Shows this help $\n" + Quit + GoTo onInitDone + + nohelp: + + StrCmp $INSTDIR "" pathnotset pathset + pathnotset: + + IfSilent onInitSilent onInitNoSilent + + onInitSilent: + StrCpy $INSTDIR "$TEMP\PRODUCTPATHPLACEHOLDER Installation Files" + GoTo onInitDone + + onInitNoSilent: + StrCpy $INSTDIR "$DESKTOP\PRODUCTPATHPLACEHOLDER Installation Files" + GoTo onInitDone + + onInitDone: + pathset: + +FunctionEnd + +Function GetParameters + + Push $R0 + Push $R1 + Push $R2 + Push $R3 + + StrCpy $R2 1 + + StrLen $R3 $CMDLINE + + ;Check for quote or space + StrCpy $R0 $CMDLINE $R2 + + StrCmp $R0 '"' 0 +3 + StrCpy $R1 '"' + Goto loop + StrCpy $R1 " " + + loop: + IntOp $R2 $R2 + 1 + StrCpy $R0 $CMDLINE 1 $R2 + StrCmp $R0 $R1 get + StrCmp $R2 $R3 get + Goto loop + + get: + IntOp $R2 $R2 + 1 + StrCpy $R0 $CMDLINE 1 $R2 + StrCmp $R0 " " get + StrCpy $R0 $CMDLINE "" $R2 + + Pop $R3 + Pop $R2 + Pop $R1 + Exch $R0 + +FunctionEnd + +Function GetOptions + + Exch $1 + Exch + Exch $0 + Exch + Push $2 + Push $3 + Push $4 + Push $5 + Push $6 + Push $7 + + StrCpy $2 $1 '' 1 + StrCpy $1 $1 1 + StrLen $3 $2 + StrCpy $7 0 + + begin: + StrCpy $4 -1 + StrCpy $6 '' + + quote: + IntOp $4 $4 + 1 + StrCpy $5 $0 1 $4 + StrCmp $5$7 '0' notfound + StrCmp $5 '' trimright + StrCmp $5 '"' 0 +7 + StrCmp $6 '' 0 +3 + StrCpy $6 '"' + goto quote + StrCmp $6 '"' 0 +3 + StrCpy $6 '' + goto quote + StrCmp $5 `'` 0 +7 + StrCmp $6 `` 0 +3 + StrCpy $6 `'` + goto quote + StrCmp $6 `'` 0 +3 + StrCpy $6 `` + goto quote + StrCmp $5 '`' 0 +7 + StrCmp $6 '' 0 +3 + StrCpy $6 '`' + goto quote + StrCmp $6 '`' 0 +3 + StrCpy $6 '' + goto quote + StrCmp $6 '"' quote + StrCmp $6 `'` quote + StrCmp $6 '`' quote + StrCmp $5 $1 0 quote + StrCmp $7 0 trimleft trimright + + trimleft: + IntOp $4 $4 + 1 + StrCpy $5 $0 $3 $4 + StrCmp $5 '' notfound + StrCmp $5 $2 0 quote + IntOp $4 $4 + $3 + StrCpy $0 $0 '' $4 + StrCpy $4 $0 1 + StrCmp $4 ' ' 0 +3 + StrCpy $0 $0 '' 1 + goto -3 + StrCpy $7 1 + goto begin + + trimright: + StrCpy $0 $0 $4 + StrCpy $4 $0 1 -1 + StrCmp $4 ' ' 0 +3 + StrCpy $0 $0 -1 + goto -3 + StrCpy $3 $0 1 + StrCpy $4 $0 1 -1 + StrCmp $3 $4 0 end + StrCmp $3 '"' +3 + StrCmp $3 `'` +2 + StrCmp $3 '`' 0 end + StrCpy $0 $0 -1 1 + goto end + + notfound: + StrCpy $0 '' + + end: + Pop $7 + Pop $6 + Pop $5 + Pop $4 + Pop $3 + Pop $2 + Pop $1 + Exch $0 + +FunctionEnd + +; MUI Settings +!define MUI_HEADERIMAGE +!define MUI_HEADERIMAGE_RIGHT +!define MUI_HEADERIMAGE_BITMAP_NOSTRETCH +!define MUI_HEADERIMAGE_BITMAP BANNERBMPPLACEHOLDER +!define MUI_WELCOMEFINISHPAGE_BITMAP WELCOMEBMPPLACEHOLDER +!define MUI_WELCOMEFINISHPAGE_BITMAP_NOSTRETCH +!define MUI_WELCOMEPAGE_TITLE_3LINES +!define MUI_ABORTWARNING +!define MUI_ICON "SETUPICOPLACEHOLDER" + +; Welcome page +!insertmacro MUI_PAGE_WELCOME +!insertmacro MUI_PAGE_DIRECTORY +!insertmacro MUI_PAGE_INSTFILES + +#231#!macro MUI_LANGUAGE_PACK LANGUAGE +#231# !verbose push +#231# !verbose ${MUI_VERBOSE} +#231# !insertmacro MUI_INSERT +#231# LoadLanguageFile "NSISPATHPLACEHOLDER\${LANGUAGE}_pack.nlf" +#231# ;Set default language file for MUI and backup user setting +#231# !ifdef LANGFILE_DEFAULT +#231# !define MUI_LANGFILE_DEFAULT_TEMP "${LANGFILE_DEFAULT}" +#231# !undef LANGFILE_DEFAULT +#231# !endif +#231# !define LANGFILE_DEFAULT "${NSISDIR}\Contrib\Language files\English.nsh" +#231# ;Include language file +#231# !insertmacro LANGFILE_INCLUDE "NSISPATHPLACEHOLDER\${LANGUAGE}_pack.nsh" +#231# ;Restore user setting for default language file +#231# !undef LANGFILE_DEFAULT +#231# !ifdef MUI_LANGFILE_DEFAULT_TEMP +#231# !define LANGFILE_DEFAULT "${MUI_LANGFILE_DEFAULT}" +#231# !endif +#231# ;Add language to list of languages for selection dialog +#231# !ifndef MUI_LANGDLL_LANGUAGES +#231# !define MUI_LANGDLL_LANGUAGES "'${LANGFILE_${LANGUAGE}_NAME}' '${LANG_${LANGUAGE}}' " +#231# !define MUI_LANGDLL_LANGUAGES_CP "'${LANGFILE_${LANGUAGE}_NAME}' '${LANG_${LANGUAGE}}' '${LANG_${LANGUAGE}_CP}' " +#231# !else +#231# !ifdef MUI_LANGDLL_LANGUAGES_TEMP +#231# !undef MUI_LANGDLL_LANGUAGES_TEMP +#231# !endif +#231# !define MUI_LANGDLL_LANGUAGES_TEMP "${MUI_LANGDLL_LANGUAGES}" +#231# !undef MUI_LANGDLL_LANGUAGES +#231# !ifdef MUI_LANGDLL_LANGUAGES_CP_TEMP +#231# !undef MUI_LANGDLL_LANGUAGES_CP_TEMP +#231# !endif +#231# !define MUI_LANGDLL_LANGUAGES_CP_TEMP "${MUI_LANGDLL_LANGUAGES_CP}" +#231# !undef MUI_LANGDLL_LANGUAGES_CP +#231# !define MUI_LANGDLL_LANGUAGES "'${LANGFILE_${LANGUAGE}_NAME}' '${LANG_${LANGUAGE}}' ${MUI_LANGDLL_LANGUAGES_TEMP}" +#231# !define MUI_LANGDLL_LANGUAGES_CP "'${LANGFILE_${LANGUAGE}_NAME}' '${LANG_${LANGUAGE}}' '${LANG_${LANGUAGE}_CP}' ${MUI_LANGDLL_LANGUAGES_CP_TEMP}" +#231# !endif +#231# !verbose pop +#231#!macroend + +#204#!macro MUI_LANGUAGE_PACK LANGUAGE +#204# !verbose push +#204# !verbose ${MUI_VERBOSE} +#204# !include "NSISPATHPLACEHOLDER\${LANGUAGE}_pack.nsh" +#204# !verbose pop +#204#!macroend + +#204#!macro MUI_LANGUAGEFILE_PACK_BEGIN LANGUAGE +#204# !ifndef MUI_INSERT +#204# !define MUI_INSERT +#204# !insertmacro MUI_INSERT +#204# !endif +#204# LoadLanguageFile "NSISPATHPLACEHOLDER\${LANGUAGE}_pack.nlf" +#204#!macroend + +; Language files +ALLLANGUAGESPLACEHOLDER + +; Reserve files +;!insertmacro MUI_RESERVEFILE_INSTALLOPTIONS + +; MUI end ------ + +Name "PRODUCTNAMEPLACEHOLDER PRODUCTVERSIONPLACEHOLDER" +OutFile "OUTPUTDIRPLACEHOLDER\DOWNLOADNAMEPLACEHOLDER" +; InstallDir "$DESKTOP\PRODUCTNAMEPLACEHOLDER PRODUCTVERSIONPLACEHOLDER Installation Files" +; ShowInstDetails show + +Section "MainSection" SEC01 +ALLFILESPLACEHOLDER +SectionEnd + +Section -Post + + StrCpy $R9 "false" + + Call GetParameters + Pop $1 + + Push $1 + Push "/EXTRACTONLY=" + Call GetOptions + Pop $2 + ;MessageBox MB_OK "EXTRACTONLY: $2" + + StrCmp $2 "ON" onPostDone callsetup + callsetup: + + Push $1 + Push "/INSTALLLOCATION=" + Call GetOptions + Pop $2 + ;MessageBox MB_OK "INSTALLLOCATION: $2" + + StrCmp $2 "" installnotset installset + installset: + StrCpy $3 'INSTALLLOCATION="$2"' + installnotset: + + Push $1 + Push "/INSTALLJAVA=" + Call GetOptions + Pop $2 + ;MessageBox MB_OK "INSTALLJAVA: $2" + + StrCmp $2 "ON" setinstalljava setdontinstalljava + setinstalljava: + StrCpy $R9 "true" + setdontinstalljava: + + Push $1 + Push "/GUILEVEL=" + Call GetOptions + Pop $2 + + StrCmp $2 "" dontsetguilevel setguilevel + setguilevel: + StrCpy $7 "/" + StrCpy $7 $7$2 + GoTo afterguilevel + dontsetguilevel: + StrCpy $7 "/qr" + afterguilevel: + + ;MessageBox MB_OK "GUILEVEL: $7" + + Push $1 + Push "/PARAM1=" + Call GetOptions + Pop $2 + ;MessageBox MB_OK "PARAM1: $2" + + StrCmp $2 "" param1notset param1set + param1set: + StrCpy $4 "$2" + param1notset: + + + Push $1 + Push "/PARAM2=" + Call GetOptions + Pop $2 + ;MessageBox MB_OK "PARAM2: $2" + + StrCmp $2 "" param2notset param2set + param2set: + StrCpy $5 "$2" + param2notset: + + + Push $1 + Push "/PARAM3=" + Call GetOptions + Pop $2 + ;MessageBox MB_OK "PARAM3: $2" + + StrCmp $2 "" param3notset param3set + param3set: + StrCpy $6 "$2" + param3notset: + + IfSilent onPostSilent onPostNoSilent + + onPostSilent: + Push $1 + Push "/POSTREMOVE=" + Call GetOptions + Pop $2 + ;MessageBox MB_OK "POSTREMOVE: $2" + + StrCmp $2 "ON" postremovesilent nopostremovesilent + nopostremovesilent: + StrCmp $R9 "true" installjava1 dontinstalljava1 + installjava1: + ExecWait '$INSTDIR\java\WINDOWSJAVAFILENAMEPLACEHOLDER /s /v"/qn REBOOT=Suppress"' + dontinstalljava1: + ExecWait "$INSTDIR\setup.exe -lang $LANGUAGE $3 $4 $5 $6 $7 -ignore_running" $0 + SetErrorLevel $0 + Quit + GoTo onPostDone + postremovesilent: + StrCmp $R9 "true" installjava2 dontinstalljava2 + installjava2: + ExecWait '$INSTDIR\java\WINDOWSJAVAFILENAMEPLACEHOLDER /s /v"/qn REBOOT=Suppress"' + dontinstalljava2: + ExecWait "$INSTDIR\setup.exe -lang $LANGUAGE $3 $4 $5 $6 $7 -ignore_running" $0 + RMDir /r $INSTDIR + RMDir $INSTDIR + SetErrorLevel $0 + Quit + GoTo onPostDone + + onPostNoSilent: + Push $1 + Push "/POSTREMOVE=" + Call GetOptions + Pop $2 + ;MessageBox MB_OK "POSTREMOVE: $2" + + StrCmp $2 "ON" postremove nopostremove + nopostremove: + Exec "$INSTDIR\setup.exe -lang $LANGUAGE $3 $4 $5 $6" + Quit + GoTo onPostDone + postremove: + StrCmp $R9 "true" installjava3 dontinstalljava3 + installjava3: + ExecWait '$INSTDIR\java\WINDOWSJAVAFILENAMEPLACEHOLDER /s /v"/qr REBOOT=Suppress"' + dontinstalljava3: + ExecWait "$INSTDIR\setup.exe -lang $LANGUAGE $3 $4 $5 $6" $0 + RMDir /r $INSTDIR + RMDir $INSTDIR + SetErrorLevel $0 + Quit + GoTo onPostDone + + onPostDone: + +SectionEnd diff --git a/setup_native/source/win32/nsis/ooobanner.bmp b/setup_native/source/win32/nsis/ooobanner.bmp Binary files differnew file mode 100644 index 000000000000..ab37b1f587ba --- /dev/null +++ b/setup_native/source/win32/nsis/ooobanner.bmp diff --git a/setup_native/source/win32/nsis/ooobitmap.bmp b/setup_native/source/win32/nsis/ooobitmap.bmp Binary files differnew file mode 100644 index 000000000000..c94c3cf0e857 --- /dev/null +++ b/setup_native/source/win32/nsis/ooobitmap.bmp diff --git a/setup_native/source/win32/nsis/ooosdkbanner.bmp b/setup_native/source/win32/nsis/ooosdkbanner.bmp Binary files differnew file mode 100644 index 000000000000..ab37b1f587ba --- /dev/null +++ b/setup_native/source/win32/nsis/ooosdkbanner.bmp diff --git a/setup_native/source/win32/nsis/ooosdkbitmap.bmp b/setup_native/source/win32/nsis/ooosdkbitmap.bmp Binary files differnew file mode 100644 index 000000000000..86a48d50906a --- /dev/null +++ b/setup_native/source/win32/nsis/ooosdkbitmap.bmp diff --git a/setup_native/source/win32/nsis/ooosetup.ico b/setup_native/source/win32/nsis/ooosetup.ico Binary files differnew file mode 100755 index 000000000000..8a6ee6712814 --- /dev/null +++ b/setup_native/source/win32/nsis/ooosetup.ico diff --git a/setup_native/source/win32/nsis/urebanner.bmp b/setup_native/source/win32/nsis/urebanner.bmp Binary files differnew file mode 100644 index 000000000000..06b8ae0b2a2b --- /dev/null +++ b/setup_native/source/win32/nsis/urebanner.bmp diff --git a/setup_native/source/win32/nsis/urebitmap.bmp b/setup_native/source/win32/nsis/urebitmap.bmp Binary files differnew file mode 100755 index 000000000000..654ad1fccf65 --- /dev/null +++ b/setup_native/source/win32/nsis/urebitmap.bmp diff --git a/setup_native/source/win32/patchlist.txt b/setup_native/source/win32/patchlist.txt new file mode 100644 index 000000000000..e0d5a7e6a358 --- /dev/null +++ b/setup_native/source/win32/patchlist.txt @@ -0,0 +1,2 @@ +# Windows patch file list + diff --git a/setup_native/source/win32/stwrapper/makefile.mk b/setup_native/source/win32/stwrapper/makefile.mk new file mode 100644 index 000000000000..ca035b4a9ad0 --- /dev/null +++ b/setup_native/source/win32/stwrapper/makefile.mk @@ -0,0 +1,50 @@ +PRJ=..$/..$/.. + +PRJNAME=setup_native +TARGET=stclient_wrapper +LIBTARGET=NO +ENABLE_EXCEPTIONS=TRUE +TARGETTYPE=GUI +USE_DEFFILE=TRUE +#DYNAMIC_CRT:= +NO_DEFAULT_STL=TRUE + +# --- Settings ----------------------------------------------------- + +.INCLUDE : settings.mk + +# --- Resources ---------------------------------------------------- + +RCFILES=resource.rc + +# --- Files -------------------------------------------------------- + +OBJFILES=\ + $(OBJ)$/stwrapper.obj + +APP1OBJS=$(OBJ)$/stwrapper.obj + +APP1NOSAL=TRUE + +APP1TARGET=$(TARGET) + +APP1NOSVRES=$(RES)$/$(TARGET).res + +UWINAPILIB:= + +STDLIB1=\ + $(GDI32LIB)\ + $(COMCTL32LIB)\ + $(COMDLG32LIB)\ + $(ADVAPI32LIB)\ + $(SHELL32LIB) + +DLLPRE = + +# --- Targets ------------------------------------------------------ + +.INCLUDE : target.mk + +$(OBJ)$/stwrapper.obj: $(INCCOM)$/_version.h + +#$(RCFILES) : resource.rc diff --git a/setup_native/source/win32/stwrapper/resource.rc b/setup_native/source/win32/stwrapper/resource.rc new file mode 100644 index 000000000000..7951547dcfaf --- /dev/null +++ b/setup_native/source/win32/stwrapper/resource.rc @@ -0,0 +1,125 @@ +#define VERSION 1 +#define SUBVERSION 0 +//#define VERVARIANT 0 +// .0 + VER_CONCEPT +// .100 + VER_ALPHA +// .200 + VER_BETA +// .300 + VER_GAMMA +// .500 + VER_FINAL +//#define VER_CONCEPT 0 +//#define VER_BETA 6 +#define VER_FINAL 0 + +#define VER_DAY 1 +#define VER_MONTH 4 +#define VER_YEAR 09 + + +// Header +#if defined(_MSC_VER) && (_MSC_VER < 1500) +#include "winres.h" +#else +#define WINVER 0x0500 +#include "winresrc.h" +#endif +#include "verinfo.hrc" + +#define VER_FIRSTYEAR 07 + +#if !defined(ENGLISH) +#define LG_D // generate always german version +#endif + +// ----------------------------------------------------------------------- +// language/character set specification table +// ----------------------------------------------------------------------- + +RCD_LANGUAGE rcdata +{ +#ifdef LG_D + "040704B0", // Germany -> Unicode + "040704E4", // Germany -> Windows, Multilingual +#else + "040904B0", // Germany -> Unicode + "040904E4", // USA -> Windows, Multilingual +#endif + "04090000", // USA -> 7-Bit-ASCII + 0 // end of table +} + +// ----------------------------------------------------------------------- +// version information +// ----------------------------------------------------------------------- + +VS_VERSION_INFO versioninfo + fileversion VERSION, SUBVERSION, VERVARIANT, VER_COUNT + productversion VERSION, SUBVERSION, VERVARIANT, VER_COUNT + fileflagsmask 0x3F + fileflags +#if defined(DEBUG) + VS_FF_DEBUG | +#endif +#ifdef VER_PREL + VS_FF_PRERELEASE | +#endif + 0 +#ifndef WIN32 + fileos VOS_DOS_WINDOWS16 +#else + fileos VOS_NT_WINDOWS32 +#endif + filetype VFT_APP + { + block "StringFileInfo" + { +#ifdef LG_D + block "040704E4" + { + // German StringTable + value "CompanyName", "Sun Microsystems, Inc.\0" + value "FileDescription", "Service Tags Wrapper\0" + value "FileVersion", PPS(VER_LEVEL) "\0" + value "ProductVersion", PPS(VER_LEVEL) "\0" + value "OriginalFilename", "STCLIENT_WRAPPER.EXE\0" + value "InternalName", "stclient_wrapper\0" + value "LegalCopyright", S_CRIGHT " Sun Microsystems, Inc.\0" + } +#else + block "040904E4" + { + // International StringTable + value "CompanyName", "Sun Microsystems, Inc.\0" + value "FileDescription", "Service Tags Wrapper\0" + value "FileVersion", PPS(VER_LEVEL) "\0" + value "ProductVersion", PPS(VER_LEVEL) "\0" + value "OriginalFilename", "STCLIENT_WRAPPER.EXE\0" + value "InternalName", "stclient_wrapper\0" + value "LegalCopyright", S_CRIGHT " Sun Microsystems, Inc.\0" + } +#endif + } + + block "VarFileInfo" + { +#ifdef LG_D + value "Translation", 0x0407, 1252 +#else + value "Translation", 0x0409, 1252 +#endif + } + } + +// version binary entry +VS_VERSION_INFO rcdata +{ + 0xF0, "sw", 0x0F, VER_YEAR, VER_MONTH, VER_DAY, + VERSION, SUBVERSION, VERVARIANT, VER_COUNT +}; + + +///////////////////////////////////////////////////////////////////////////// +// +// Manifest section +// +1 24 stwrapper.manifest + diff --git a/setup_native/source/win32/stwrapper/stwrapper.cxx b/setup_native/source/win32/stwrapper/stwrapper.cxx new file mode 100644 index 000000000000..b75e8da4cf79 --- /dev/null +++ b/setup_native/source/win32/stwrapper/stwrapper.cxx @@ -0,0 +1,495 @@ +#define WIN32_LEAN_AND_MEAN + +#ifdef _MSC_VER +#pragma warning(disable:4668 4917) // disable warnings for system headers +#endif + +#include <windows.h> +#include <windowsx.h> +#include <shellapi.h> +#include <shlobj.h> +#include <tchar.h> + +#include <stdio.h> + +#define elementsof(buf) (sizeof(buf) / sizeof(buf[0])) + +enum PathResult +{ + PATHRESULT_OK, + PATHRESULT_API_NOT_SUPPORTED, + PATHRESULT_EXE_NOT_FOUND +}; + +const int MAXCMDLINELEN = 32768; + +static TCHAR g_szSTInstallationPath[MAX_PATH] = TEXT(""); +static TCHAR g_szOperatingSystem[256] = TEXT(""); + +static const TCHAR g_szSTExecutable[256] = TEXT("stclient.exe"); + +//*************************************************************************** + +LONG RegReadValue( HKEY hBaseKey, LPCTSTR lpSubKey, LPCTSTR lpValueName, LPVOID lpData, DWORD cbData ) +{ + HKEY hKey = NULL; + LONG lResult( 0 ); + + lResult = RegOpenKeyEx( hBaseKey, lpSubKey, 0, KEY_QUERY_VALUE, &hKey ); + + if ( ERROR_SUCCESS == lResult ) + { + lResult = RegQueryValueEx( hKey, lpValueName, NULL, NULL, (LPBYTE)lpData, &cbData ); + RegCloseKey( hKey ); + } + + return lResult; +} + +//*************************************************************************** + +static LPTSTR *GetCommandArgs( int *pArgc ) +{ +#ifdef UNICODE + return CommandLineToArgvW( GetCommandLineW(), pArgc ); +#else + *pArgc = __argc; + return __argv; +#endif +} + +//*************************************************************************** + +static bool IsSupportedPlatform() +{ + OSVERSIONINFO aOsVersion; + + ZeroMemory( &aOsVersion, sizeof( OSVERSIONINFO )); + aOsVersion.dwOSVersionInfoSize = sizeof( OSVERSIONINFO ); + + // Try to determine OS version + if ( GetVersionEx( &aOsVersion )) + { + switch ( aOsVersion.dwPlatformId ) + { + case VER_PLATFORM_WIN32_NT: // Windows NT based + return true; + + case VER_PLATFORM_WIN32_WINDOWS: // Windows Me/98/95. + case VER_PLATFORM_WIN32s: // Win32s + return false; + + default: + return false; + } + } + + return false; +} + +//*************************************************************************** + +static LPCTSTR GetOperatingSystemString() +{ + OSVERSIONINFO aOsVersion; + + ZeroMemory( &aOsVersion, sizeof( OSVERSIONINFO )); + aOsVersion.dwOSVersionInfoSize = sizeof( OSVERSIONINFO ); + + _tcscpy( g_szOperatingSystem, TEXT( "Microsoft Windows" )); + + // Try to determine OS version + if ( GetVersionEx( &aOsVersion )) + { + switch ( aOsVersion.dwPlatformId ) + { + // Test for the Windows NT product family. + case VER_PLATFORM_WIN32_NT: + { + if ( aOsVersion.dwMajorVersion == 3 ) + { + _tcscat( g_szOperatingSystem, TEXT( " NT 3." )); + if ( aOsVersion.dwMinorVersion == 0 ) + _tcscat( g_szOperatingSystem, TEXT( "0" )); + else if ( aOsVersion.dwMinorVersion == 5 ) + _tcscat( g_szOperatingSystem, TEXT( "5" )); + else if ( aOsVersion.dwMinorVersion == 51 ) + _tcscat( g_szOperatingSystem, TEXT( "51" )); + } + else if ( aOsVersion.dwMajorVersion == 4 ) + _tcscat( g_szOperatingSystem, TEXT( " NT 4.0" )); + else if ( aOsVersion.dwMajorVersion == 5 ) + { + if ( aOsVersion.dwMinorVersion == 0 ) + _tcscat( g_szOperatingSystem, TEXT( " 2000" )); + else if ( aOsVersion.dwMinorVersion == 1 ) + _tcscat( g_szOperatingSystem, TEXT( " XP" )); + else if ( aOsVersion.dwMinorVersion == 2 ) + _tcscat( g_szOperatingSystem, TEXT( " Server 2003" )); + } + else if ( aOsVersion.dwMajorVersion == 6 ) + { + if ( aOsVersion.dwMinorVersion == 0 ) + _tcscat( g_szOperatingSystem, " Vista" ); + } + } + break; + + // Test for the Windows Me/98/95. + case VER_PLATFORM_WIN32_WINDOWS: + { + if ( aOsVersion.dwMinorVersion == 0 ) + _tcscat( g_szOperatingSystem, TEXT( " 95" )); + else if ( aOsVersion.dwMinorVersion == 10 ) + _tcscat( g_szOperatingSystem, TEXT( " 98" )); + else if ( aOsVersion.dwMinorVersion == 90 ) + _tcscat( g_szOperatingSystem, TEXT( " Me" )); + } + break; + } + } + + return g_szOperatingSystem; +} + +//*************************************************************************** + +static bool FileExists( LPCTSTR lpPathToFile ) +{ + bool bResult = false; + HANDLE hFind; + WIN32_FIND_DATA FindFileData; + + hFind = FindFirstFile( lpPathToFile, &FindFileData ); + + if ( hFind != INVALID_HANDLE_VALUE ) + { + FindClose( hFind ); + bResult = true; + } + + return bResult; +} + +//*************************************************************************** + +static bool GetProgramFilesFolder( LPTSTR strPath ) +{ + bool bRet = false; + HINSTANCE hLibrary; + + if (( hLibrary = LoadLibrary( "shell32.dll" )) != NULL ) + { + BOOL (WINAPI *pSHGetSpecialFolderPathA)( HWND, LPSTR, int, BOOL ); + + pSHGetSpecialFolderPathA = (BOOL (WINAPI *)(HWND, LPSTR, int, BOOL))GetProcAddress( hLibrary, "SHGetSpecialFolderPathA" ); + + if ( pSHGetSpecialFolderPathA ) + { + if ( pSHGetSpecialFolderPathA( NULL, strPath, CSIDL_PROGRAM_FILES, TRUE )) + bRet = true; + } + } + + FreeLibrary( hLibrary ); + + return ( bRet ); +} + +//*************************************************************************** + +static PathResult RetrieveExecutablePath( LPTSTR szExecutablePath ) +{ + PathResult eRet = PATHRESULT_API_NOT_SUPPORTED; + TCHAR szProgramFilesFolder[MAX_PATH]; + + if ( GetProgramFilesFolder( szProgramFilesFolder )) + { + size_t nLen = _tcslen( szProgramFilesFolder ); + if ( nLen > 0 ) + { + _tcscpy( szExecutablePath, szProgramFilesFolder ); + if ( szProgramFilesFolder[nLen-1] != '\\' ) + _tcscat( szExecutablePath, TEXT( "\\" )); + _tcscat( szExecutablePath, TEXT( "Sun\\servicetag\\" )); + _tcscat( szExecutablePath, g_szSTExecutable ); + eRet = FileExists( szExecutablePath ) ? PATHRESULT_OK : PATHRESULT_EXE_NOT_FOUND; + } + } + + return eRet; +} + +//*************************************************************************** + +static void SafeCopy( LPTSTR lpTarget, LPCSTR lpSource, size_t nMaxLen ) +{ + size_t nLen = _tcslen( lpSource ); + size_t nCopy = ( nLen < size_t( nMaxLen-1 )) ? nLen : nMaxLen-1; + _tcsncpy( lpTarget, lpSource, nMaxLen-1 ); + *(lpTarget+nCopy) = 0; +} + +//*************************************************************************** + +int WINAPI _tWinMain( HINSTANCE /*hInstance*/, HINSTANCE, LPTSTR, int ) +{ + const DWORD ERR_NO_RECORDS_FOUND = 225; + const DWORD ERR_DUP_RECORD = 226; + + DWORD dwExitCode = (DWORD)1; + + int nArgs = 0; + LPTSTR* lpArgs = GetCommandArgs( &nArgs ); + + if ( !IsSupportedPlatform() ) + { + // Return 0 for a successful run on not supported platforms + // We don't want that the Office tries to start us forever. + return 0; + } + + if ( nArgs >= 11 ) + { + TCHAR szTargetURN[1024] = {0}; + TCHAR szProductName[1024] = {0}; + TCHAR szProductVersion[1024] = {0}; + TCHAR szParentProductName[1024] = {0}; + TCHAR szProductSource[1024] = {0}; + TCHAR szInstanceURN[1024] = {0}; + +// -i) INSTANCE_URN="$2"; shift;; +// -t) TARGET_URN="$2"; shift;; +// -p) PRODUCT_NAME="$2"; shift;; +// -e) PRODUCT_VERSION="$2"; shift;; +// -P) PARENT_PRODUCT_NAME="$2"; shift;; +// -S) PRODUCT_SOURCE="$2"; shift;; +// "usage: $0 [-i <instance urn>] -p <product name> -e <product version> -t <urn> -S <source> -P <parent product name>" + + int i = 1; + while ( i < nArgs ) + { + LPTSTR lpArg = lpArgs[i]; + if ( _tcslen( lpArg ) >= 2 ) + { + if ( lpArg[0] == '-' ) + { + switch ( lpArg[1] ) + { + case 'i': + { + if ( i < nArgs ) + ++i; + SafeCopy( szInstanceURN, lpArgs[i], elementsof( szInstanceURN )); + break; + } + + case 't': + { + if ( i < nArgs ) + ++i; + SafeCopy( szTargetURN, lpArgs[i], elementsof( szTargetURN )); + break; + } + case 'p': + { + if ( i < nArgs ) + ++i; + SafeCopy( szProductName, lpArgs[i], elementsof( szProductName )); + break; + } + case 'e': + { + if ( i < nArgs ) + ++i; + SafeCopy( szProductVersion, lpArgs[i], elementsof( szProductVersion )); + break; + } + case 'P': + { + if ( i < nArgs ) + ++i; + SafeCopy( szParentProductName, lpArgs[i], elementsof( szParentProductName )); + break; + } + case 'S': + { + if ( i < nArgs ) + ++i; + SafeCopy( szProductSource, lpArgs[i], elementsof( szProductSource )); + break; + } + + default: + break; + } // switch + } + } + + ++i; + } + + if ( RetrieveExecutablePath( g_szSTInstallationPath ) == PATHRESULT_OK ) + { + BOOL bSuccess = TRUE; + BOOL bProcessStarted = FALSE; + + STARTUPINFO aStartupInfo; + PROCESS_INFORMATION aProcessInfo; + LPTSTR lpCommandLine = 0; + + ZeroMemory( &aStartupInfo, sizeof( aStartupInfo )); + aStartupInfo.cb = sizeof( aStartupInfo ); + ZeroMemory( &aProcessInfo, sizeof( aProcessInfo )); + + if ( _tcslen( szInstanceURN ) == 0 ) + { + // TEST=`${STCLIENT} -f -t ${TARGET_URN}` + lpCommandLine = new TCHAR[MAXCMDLINELEN]; + + _tcscpy( lpCommandLine, TEXT( "\"" )); + _tcscat( lpCommandLine, g_szSTInstallationPath ); + _tcscat( lpCommandLine, TEXT( "\"" )); + _tcscat( lpCommandLine, TEXT( " -f" )); + _tcscat( lpCommandLine, TEXT( " -t ")); + _tcscat( lpCommandLine, TEXT( "\"" )); + _tcscat( lpCommandLine, szTargetURN ); + _tcscat( lpCommandLine, TEXT( "\"" )); + + bSuccess = CreateProcess( + NULL, + lpCommandLine, + NULL, + NULL, + TRUE, + CREATE_NO_WINDOW, + NULL, + NULL, + &aStartupInfo, + &aProcessInfo ); + + bProcessStarted = TRUE; + + // wait until process ends to receive exit code + WaitForSingleObject( aProcessInfo.hProcess, INFINITE ); + + delete []lpCommandLine; + } + + if ( bSuccess ) + { + DWORD dwSTClientExitCode( ERR_NO_RECORDS_FOUND ); + if ( bProcessStarted ) + { + GetExitCodeProcess( aProcessInfo.hProcess, &dwSTClientExitCode ); + dwSTClientExitCode &= 0x000000ff; + + CloseHandle( aProcessInfo.hProcess ); + CloseHandle( aProcessInfo.hThread ); + } + + if ( dwSTClientExitCode == ERR_NO_RECORDS_FOUND ) + { + // output=`${STCLIENT} -a [-i "${INSTANCE_URN}"] -p "${PRODUCT_NAME}" -e "${PRODUCT_VERSION}" -t "${TARGET_URN}" -S "${PRODUCT_SOURCE}" -P "${PARENT_PRODUCT_NAME}" -m "Sun Microsystems, Inc." -A ${uname} -z global` + lpCommandLine = new TCHAR[MAXCMDLINELEN]; + + _tcscpy( lpCommandLine, TEXT( "\"" )); + _tcscat( lpCommandLine, g_szSTInstallationPath ); + _tcscat( lpCommandLine, TEXT( "\"" )); + _tcscat( lpCommandLine, TEXT( " -a" )); + if ( _tcslen( szInstanceURN ) > 0 ) + { + _tcscat( lpCommandLine, TEXT( " -i " )); + _tcscat( lpCommandLine, TEXT( "\"" )); + _tcscat( lpCommandLine, szInstanceURN ); + _tcscat( lpCommandLine, TEXT( "\"" )); + } + _tcscat( lpCommandLine, TEXT( " -p " )); + _tcscat( lpCommandLine, TEXT( "\"" )); + _tcscat( lpCommandLine, szProductName ); + _tcscat( lpCommandLine, TEXT( "\"" )); + _tcscat( lpCommandLine, TEXT( " -e " )); + _tcscat( lpCommandLine, TEXT( "\"" )); + _tcscat( lpCommandLine, szProductVersion ); + _tcscat( lpCommandLine, TEXT( "\"" )); + _tcscat( lpCommandLine, TEXT( " -t " )); + _tcscat( lpCommandLine, TEXT( "\"" )); + _tcscat( lpCommandLine, szTargetURN ); + _tcscat( lpCommandLine, TEXT( "\"" )); + _tcscat( lpCommandLine, TEXT( " -S " )); + _tcscat( lpCommandLine, TEXT( "\"" )); + _tcscat( lpCommandLine, szProductSource ); + _tcscat( lpCommandLine, TEXT( "\"" )); + _tcscat( lpCommandLine, TEXT( " -P " )); + _tcscat( lpCommandLine, TEXT( "\"" )); + _tcscat( lpCommandLine, szParentProductName ); + _tcscat( lpCommandLine, TEXT( "\"" )); + _tcscat( lpCommandLine, TEXT( " -m \"Sun Microsystems, Inc.\"" )); + _tcscat( lpCommandLine, TEXT( " -A " )); + _tcscat( lpCommandLine, TEXT( "\"" )); + _tcscat( lpCommandLine, GetOperatingSystemString() ); + _tcscat( lpCommandLine, TEXT( "\"" )); + _tcscat( lpCommandLine, TEXT( " -z global" )); + + ZeroMemory( &aStartupInfo, sizeof( aStartupInfo )); + aStartupInfo.cb = sizeof(aStartupInfo); + ZeroMemory( &aProcessInfo, sizeof( aProcessInfo )); + + bSuccess = CreateProcess( + NULL, + lpCommandLine, + NULL, + NULL, + TRUE, + CREATE_NO_WINDOW, + NULL, + NULL, + &aStartupInfo, + &aProcessInfo ); + + delete []lpCommandLine; + + // wait until process ends to receive exit code + WaitForSingleObject( aProcessInfo.hProcess, INFINITE ); + + dwSTClientExitCode = 0; + GetExitCodeProcess( aProcessInfo.hProcess, &dwSTClientExitCode ); + dwSTClientExitCode &= 0x000000ff; + + CloseHandle( aProcessInfo.hProcess ); + CloseHandle( aProcessInfo.hThread ); + + if ( !bSuccess ) + dwExitCode = 1; // couldn't start stclient process + else + { + if ( _tcslen( szInstanceURN ) > 0 ) + { + // don't register again if we registered in a previous run + // or we called stclient successfully. + if (( dwSTClientExitCode == ERR_DUP_RECORD ) || + ( dwSTClientExitCode == 0 )) + dwExitCode = 0; + else + dwExitCode = 1; // other errors + } + else + dwExitCode = ( dwSTClientExitCode == 0 ) ? 0 : 1; + } + } + else if ( dwSTClientExitCode == 0 ) + dwExitCode = 0; // already registered + else + dwExitCode = 1; // other errors + } + else + dwExitCode = 1; // couldn't start stclient + } + else + dwExitCode = 1; // no executable found + } + else + dwExitCode = 0; // wrong number of arguments + + return dwExitCode; +} diff --git a/setup_native/source/win32/stwrapper/stwrapper.manifest b/setup_native/source/win32/stwrapper/stwrapper.manifest new file mode 100644 index 000000000000..ec639e45cb04 --- /dev/null +++ b/setup_native/source/win32/stwrapper/stwrapper.manifest @@ -0,0 +1,20 @@ +<?xml version="1.0" encoding="utf-8" standalone="yes"?> +<!-- Copyright © 1981-2001 Microsoft Corporation --> +<assembly manifestVersion="1.0" xmlns="urn:schemas-microsoft-com:asm.v1"> + <assemblyIdentity + type="win32" + name="Service Tags Wrapper" + version="1.0.0.0" + processorArchitecture="x86" + /> + <description>OpenOffice.org Installer</description> + <trustInfo xmlns="urn:schemas-microsoft-com:asm.v3"> + <security> + <requestedPrivileges> + <requestedExecutionLevel level="asInvoker" /> + </requestedPrivileges> + </security> + </trustInfo> + <dependency> + </dependency> +</assembly> diff --git a/setup_native/tests/opensolaris/bundledextensions/send_ooo b/setup_native/tests/opensolaris/bundledextensions/send_ooo new file mode 100644 index 000000000000..669e63ceda1b --- /dev/null +++ b/setup_native/tests/opensolaris/bundledextensions/send_ooo @@ -0,0 +1,32 @@ +#! /bin/bash + + +if [ $# = 0 ] +then +echo "usage: send_ooo path_to_pkg_folder + +The files +installed, +ooo_bundled_extension.xml, +svc-ooo_bundled_extension +must be in the current directory. The pkg.depotd or the service +application/pkg/server must listen to port 80" + +exit +fi + + +EXTENSIONPATH=/opt/openoffice.org3/share/extension/install + +eval `pkgsend -s http://localhost:80 open ooo_test@3.2-1` +pkgsend -s http://localhost:80 import $1/openofficeorg-ure +pkgsend -s http://localhost:80 import $1/ooobasis* +pkgsend -s http://localhost:80 import $1/openofficeorg3* + +pkgsend -s http://localhost:80 add file installed mode=644 owner=root group=bin path=${EXTENSIONPATH}/installed restart_fmri=svc:/application/ooo_bundled_extensions:default +pkgsend -s http://localhost:80 add file svc-ooo_bundled_extensions mode=744 owner=root group=bin path=/lib/svc/method/svc-ooo_bundled_extensions +pkgsend -s http://localhost:80 add file ooo_bundled_extensions.xml mode=644 owner=root group=bin path=/var/svc/manifest/application/ooo_bundled_extensions.xml restart_fmri=svc:/system/manifest-import:default + +pkgsend -s http://localhost:80 add set name=description value="OOo 3.2 with dictionaries: en fr es da de" +pkgsend -s http://localhost:80 close + |