1*cdf0e10cSrcweir#************************************************************************* 2*cdf0e10cSrcweir# 3*cdf0e10cSrcweir# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4*cdf0e10cSrcweir# 5*cdf0e10cSrcweir# Copyright 2000, 2010 Oracle and/or its affiliates. 6*cdf0e10cSrcweir# 7*cdf0e10cSrcweir# OpenOffice.org - a multi-platform office productivity suite 8*cdf0e10cSrcweir# 9*cdf0e10cSrcweir# This file is part of OpenOffice.org. 10*cdf0e10cSrcweir# 11*cdf0e10cSrcweir# OpenOffice.org is free software: you can redistribute it and/or modify 12*cdf0e10cSrcweir# it under the terms of the GNU Lesser General Public License version 3 13*cdf0e10cSrcweir# only, as published by the Free Software Foundation. 14*cdf0e10cSrcweir# 15*cdf0e10cSrcweir# OpenOffice.org is distributed in the hope that it will be useful, 16*cdf0e10cSrcweir# but WITHOUT ANY WARRANTY; without even the implied warranty of 17*cdf0e10cSrcweir# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 18*cdf0e10cSrcweir# GNU Lesser General Public License version 3 for more details 19*cdf0e10cSrcweir# (a copy is included in the LICENSE file that accompanied this code). 20*cdf0e10cSrcweir# 21*cdf0e10cSrcweir# You should have received a copy of the GNU Lesser General Public License 22*cdf0e10cSrcweir# version 3 along with OpenOffice.org. If not, see 23*cdf0e10cSrcweir# <http://www.openoffice.org/license.html> 24*cdf0e10cSrcweir# for a copy of the LGPLv3 License. 25*cdf0e10cSrcweir# 26*cdf0e10cSrcweir#************************************************************************* 27*cdf0e10cSrcweir 28*cdf0e10cSrcweirpackage installer::windows::registry; 29*cdf0e10cSrcweir 30*cdf0e10cSrcweiruse installer::files; 31*cdf0e10cSrcweiruse installer::globals; 32*cdf0e10cSrcweiruse installer::worker; 33*cdf0e10cSrcweiruse installer::windows::idtglobal; 34*cdf0e10cSrcweir 35*cdf0e10cSrcweir##################################################### 36*cdf0e10cSrcweir# Generating the component name from a registryitem 37*cdf0e10cSrcweir##################################################### 38*cdf0e10cSrcweir 39*cdf0e10cSrcweirsub get_registry_component_name 40*cdf0e10cSrcweir{ 41*cdf0e10cSrcweir my ($registryref, $allvariables) = @_; 42*cdf0e10cSrcweir 43*cdf0e10cSrcweir # In this function exists the rule to create components from registryitems 44*cdf0e10cSrcweir # Rule: 45*cdf0e10cSrcweir # The componentname can be directly taken from the ModuleID. 46*cdf0e10cSrcweir # All registryitems belonging to one module can get the same component. 47*cdf0e10cSrcweir 48*cdf0e10cSrcweir my $componentname = ""; 49*cdf0e10cSrcweir my $isrootmodule = 0; 50*cdf0e10cSrcweir 51*cdf0e10cSrcweir if ( $registryref->{'ModuleID'} ) { $componentname = $registryref->{'ModuleID'}; } 52*cdf0e10cSrcweir 53*cdf0e10cSrcweir $componentname =~ s/\\/\_/g; 54*cdf0e10cSrcweir $componentname =~ s/\//\_/g; 55*cdf0e10cSrcweir $componentname =~ s/\-/\_/g; 56*cdf0e10cSrcweir $componentname =~ s/\_\s*$//g; 57*cdf0e10cSrcweir 58*cdf0e10cSrcweir $componentname = lc($componentname); # componentnames always lowercase 59*cdf0e10cSrcweir 60*cdf0e10cSrcweir if ( $componentname eq "gid_module_root" ) { $isrootmodule = 1; } 61*cdf0e10cSrcweir 62*cdf0e10cSrcweir # Attention: Maximum length for the componentname is 72 63*cdf0e10cSrcweir 64*cdf0e10cSrcweir # identifying this component as registryitem component 65*cdf0e10cSrcweir $componentname = "registry_" . $componentname; 66*cdf0e10cSrcweir 67*cdf0e10cSrcweir $componentname =~ s/gid_module_/g_m_/g; 68*cdf0e10cSrcweir $componentname =~ s/_optional_/_o_/g; 69*cdf0e10cSrcweir $componentname =~ s/_javafilter_/_jf_/g; 70*cdf0e10cSrcweir 71*cdf0e10cSrcweir # This componentname must be more specific 72*cdf0e10cSrcweir my $addon = "_"; 73*cdf0e10cSrcweir if ( $allvariables->{'PRODUCTNAME'} ) { $addon = $addon . $allvariables->{'PRODUCTNAME'}; } 74*cdf0e10cSrcweir if ( $allvariables->{'PRODUCTVERSION'} ) { $addon = $addon . $allvariables->{'PRODUCTVERSION'}; } 75*cdf0e10cSrcweir $addon = lc($addon); 76*cdf0e10cSrcweir $addon =~ s/ //g; 77*cdf0e10cSrcweir $addon =~ s/-//g; 78*cdf0e10cSrcweir $addon =~ s/\.//g; 79*cdf0e10cSrcweir 80*cdf0e10cSrcweir my $styles = ""; 81*cdf0e10cSrcweir if ( $registryref->{'Styles'} ) { $styles = $registryref->{'Styles'}; } 82*cdf0e10cSrcweir 83*cdf0e10cSrcweir # Layer links must have unique Component GUID for all products. This is necessary, because only the 84*cdf0e10cSrcweir # uninstallation of the last product has to delete registry keys. 85*cdf0e10cSrcweir if ( $styles =~ /\bLAYER_REGISTRY\b/ ) 86*cdf0e10cSrcweir { 87*cdf0e10cSrcweir $componentname = "g_m_root_registry_layer_ooo_reglayer"; 88*cdf0e10cSrcweir # Styles USE_URELAYERVERSION, USE_OOOBASEVERSION 89*cdf0e10cSrcweir if ( $styles =~ /\bUSE_URELAYERVERSION\b/ ) { $addon = "_ure_" . $allvariables->{'URELAYERVERSION'}; } 90*cdf0e10cSrcweir if ( $styles =~ /\bUSE_OOOBASEVERSION\b/ ) { $addon = "_basis_" . $allvariables->{'OOOBASEVERSION'}; } 91*cdf0e10cSrcweir $addon =~ s/\.//g; 92*cdf0e10cSrcweir } 93*cdf0e10cSrcweir 94*cdf0e10cSrcweir $componentname = $componentname . $addon; 95*cdf0e10cSrcweir 96*cdf0e10cSrcweir if (( $styles =~ /\bLANGUAGEPACK\b/ ) && ( $installer::globals::languagepack )) { $componentname = $componentname . "_lang"; } 97*cdf0e10cSrcweir if ( $styles =~ /\bALWAYS_REQUIRED\b/ ) { $componentname = $componentname . "_forced"; } 98*cdf0e10cSrcweir 99*cdf0e10cSrcweir # Attention: Maximum length for the componentname is 72 100*cdf0e10cSrcweir # %installer::globals::allregistrycomponents_in_this_database_ : resetted for each database 101*cdf0e10cSrcweir # %installer::globals::allregistrycomponents_ : not resetted for each database 102*cdf0e10cSrcweir # Component strings must be unique for the complete product, because they are used for 103*cdf0e10cSrcweir # the creation of the globally unique identifier. 104*cdf0e10cSrcweir 105*cdf0e10cSrcweir my $fullname = $componentname; # This can be longer than 72 106*cdf0e10cSrcweir 107*cdf0e10cSrcweir if (( exists($installer::globals::allregistrycomponents_{$fullname}) ) && ( ! exists($installer::globals::allregistrycomponents_in_this_database_{$fullname}) )) 108*cdf0e10cSrcweir { 109*cdf0e10cSrcweir # This is not allowed: One component cannot be installed with different packages. 110*cdf0e10cSrcweir installer::exiter::exit_program("ERROR: Windows registry component \"$fullname\" is already included into another package. This is not allowed.", "get_registry_component_name"); 111*cdf0e10cSrcweir } 112*cdf0e10cSrcweir 113*cdf0e10cSrcweir if ( exists($installer::globals::allregistrycomponents_{$fullname}) ) 114*cdf0e10cSrcweir { 115*cdf0e10cSrcweir $componentname = $installer::globals::allregistrycomponents_{$fullname}; 116*cdf0e10cSrcweir } 117*cdf0e10cSrcweir else 118*cdf0e10cSrcweir { 119*cdf0e10cSrcweir if ( length($componentname) > 60 ) 120*cdf0e10cSrcweir { 121*cdf0e10cSrcweir $componentname = generate_new_short_registrycomponentname($componentname); # This has to be unique for the complete product, not only one package 122*cdf0e10cSrcweir } 123*cdf0e10cSrcweir 124*cdf0e10cSrcweir $installer::globals::allregistrycomponents_{$fullname} = $componentname; 125*cdf0e10cSrcweir $installer::globals::allregistrycomponents_in_this_database_{$fullname} = 1; 126*cdf0e10cSrcweir } 127*cdf0e10cSrcweir 128*cdf0e10cSrcweir if ( $isrootmodule ) { $installer::globals::registryrootcomponent = $componentname; } 129*cdf0e10cSrcweir 130*cdf0e10cSrcweir return $componentname; 131*cdf0e10cSrcweir} 132*cdf0e10cSrcweir 133*cdf0e10cSrcweir######################################################### 134*cdf0e10cSrcweir# Create a shorter version of a long component name, 135*cdf0e10cSrcweir# because maximum length in msi database is 72. 136*cdf0e10cSrcweir# Attention: In multi msi installation sets, the short 137*cdf0e10cSrcweir# names have to be unique over all packages, because 138*cdf0e10cSrcweir# this string is used to create the globally unique id 139*cdf0e10cSrcweir# -> no resetting of 140*cdf0e10cSrcweir# %installer::globals::allshortregistrycomponents 141*cdf0e10cSrcweir# after a package was created. 142*cdf0e10cSrcweir######################################################### 143*cdf0e10cSrcweir 144*cdf0e10cSrcweirsub generate_new_short_registrycomponentname 145*cdf0e10cSrcweir{ 146*cdf0e10cSrcweir my ($componentname) = @_; 147*cdf0e10cSrcweir 148*cdf0e10cSrcweir my $shortcomponentname = ""; 149*cdf0e10cSrcweir my $counter = 1; 150*cdf0e10cSrcweir 151*cdf0e10cSrcweir my $startversion = substr($componentname, 0, 60); # taking only the first 60 characters 152*cdf0e10cSrcweir $startversion = $startversion . "_"; 153*cdf0e10cSrcweir 154*cdf0e10cSrcweir $shortcomponentname = $startversion . $counter; 155*cdf0e10cSrcweir 156*cdf0e10cSrcweir while ( exists($installer::globals::allshortregistrycomponents{$shortcomponentname}) ) 157*cdf0e10cSrcweir { 158*cdf0e10cSrcweir $counter++; 159*cdf0e10cSrcweir $shortcomponentname = $startversion . $counter; 160*cdf0e10cSrcweir } 161*cdf0e10cSrcweir 162*cdf0e10cSrcweir $installer::globals::allshortregistrycomponents{$shortcomponentname} = 1; 163*cdf0e10cSrcweir 164*cdf0e10cSrcweir return $shortcomponentname; 165*cdf0e10cSrcweir} 166*cdf0e10cSrcweir 167*cdf0e10cSrcweir############################################################## 168*cdf0e10cSrcweir# Returning identifier for registry table. 169*cdf0e10cSrcweir############################################################## 170*cdf0e10cSrcweir 171*cdf0e10cSrcweirsub get_registry_identifier 172*cdf0e10cSrcweir{ 173*cdf0e10cSrcweir my ($registry) = @_; 174*cdf0e10cSrcweir 175*cdf0e10cSrcweir my $identifier = ""; 176*cdf0e10cSrcweir 177*cdf0e10cSrcweir if ( $registry->{'gid'} ) { $identifier = $registry->{'gid'}; } 178*cdf0e10cSrcweir 179*cdf0e10cSrcweir $identifier = lc($identifier); # always lower case 180*cdf0e10cSrcweir 181*cdf0e10cSrcweir # Attention: Maximum length is 72 182*cdf0e10cSrcweir 183*cdf0e10cSrcweir $identifier =~ s/gid_regitem_/g_r_/; 184*cdf0e10cSrcweir $identifier =~ s/_soffice_/_s_/; 185*cdf0e10cSrcweir $identifier =~ s/_clsid_/_c_/; 186*cdf0e10cSrcweir $identifier =~ s/_currentversion_/_cv_/; 187*cdf0e10cSrcweir $identifier =~ s/_microsoft_/_ms_/; 188*cdf0e10cSrcweir $identifier =~ s/_manufacturer_/_mf_/; 189*cdf0e10cSrcweir $identifier =~ s/_productname_/_pn_/; 190*cdf0e10cSrcweir $identifier =~ s/_productversion_/_pv_/; 191*cdf0e10cSrcweir $identifier =~ s/_staroffice_/_so_/; 192*cdf0e10cSrcweir $identifier =~ s/_software_/_sw_/; 193*cdf0e10cSrcweir $identifier =~ s/_capabilities_/_cap_/; 194*cdf0e10cSrcweir $identifier =~ s/_classpath_/_cp_/; 195*cdf0e10cSrcweir $identifier =~ s/_extension_/_ex_/; 196*cdf0e10cSrcweir $identifier =~ s/_fileassociations_/_fa_/; 197*cdf0e10cSrcweir $identifier =~ s/_propertysheethandlers_/_psh_/; 198*cdf0e10cSrcweir $identifier =~ s/__/_/g; 199*cdf0e10cSrcweir 200*cdf0e10cSrcweir # Saving this in the registry collector 201*cdf0e10cSrcweir 202*cdf0e10cSrcweir $registry->{'uniquename'} = $identifier; 203*cdf0e10cSrcweir 204*cdf0e10cSrcweir return $identifier; 205*cdf0e10cSrcweir} 206*cdf0e10cSrcweir 207*cdf0e10cSrcweir################################################################## 208*cdf0e10cSrcweir# Returning root value for registry table. 209*cdf0e10cSrcweir################################################################## 210*cdf0e10cSrcweir 211*cdf0e10cSrcweirsub get_registry_root 212*cdf0e10cSrcweir{ 213*cdf0e10cSrcweir my ($registry) = @_; 214*cdf0e10cSrcweir 215*cdf0e10cSrcweir my $rootvalue = 0; # Default: Parent is KKEY_CLASSES_ROOT 216*cdf0e10cSrcweir my $scproot = ""; 217*cdf0e10cSrcweir 218*cdf0e10cSrcweir if ( $registry->{'ParentID'} ) { $scproot = $registry->{'ParentID'}; } 219*cdf0e10cSrcweir 220*cdf0e10cSrcweir if ( $scproot eq "PREDEFINED_HKEY_LOCAL_MACHINE" ) { $rootvalue = -1; } 221*cdf0e10cSrcweir 222*cdf0e10cSrcweir if ( $scproot eq "PREDEFINED_HKEY_CLASSES_ROOT" ) { $rootvalue = 0; } 223*cdf0e10cSrcweir 224*cdf0e10cSrcweir if ( $scproot eq "PREDEFINED_HKEY_CURRENT_USER_ONLY" ) { $rootvalue = 1; } 225*cdf0e10cSrcweir 226*cdf0e10cSrcweir if ( $scproot eq "PREDEFINED_HKEY_LOCAL_MACHINE_ONLY" ) { $rootvalue = 2; } 227*cdf0e10cSrcweir 228*cdf0e10cSrcweir return $rootvalue; 229*cdf0e10cSrcweir} 230*cdf0e10cSrcweir 231*cdf0e10cSrcweir############################################################## 232*cdf0e10cSrcweir# Returning key for registry table. 233*cdf0e10cSrcweir############################################################## 234*cdf0e10cSrcweir 235*cdf0e10cSrcweirsub get_registry_key 236*cdf0e10cSrcweir{ 237*cdf0e10cSrcweir my ($registry, $allvariableshashref) = @_; 238*cdf0e10cSrcweir 239*cdf0e10cSrcweir my $key = ""; 240*cdf0e10cSrcweir 241*cdf0e10cSrcweir if ( $registry->{'Subkey'} ) { $key = $registry->{'Subkey'}; } 242*cdf0e10cSrcweir 243*cdf0e10cSrcweir if ( $key =~ /\%/ ) { $key = installer::worker::replace_variables_in_string($key, $allvariableshashref); } 244*cdf0e10cSrcweir 245*cdf0e10cSrcweir return $key; 246*cdf0e10cSrcweir} 247*cdf0e10cSrcweir 248*cdf0e10cSrcweir############################################################## 249*cdf0e10cSrcweir# Returning name for registry table. 250*cdf0e10cSrcweir############################################################## 251*cdf0e10cSrcweir 252*cdf0e10cSrcweirsub get_registry_name 253*cdf0e10cSrcweir{ 254*cdf0e10cSrcweir my ($registry, $allvariableshashref) = @_; 255*cdf0e10cSrcweir 256*cdf0e10cSrcweir my $name = ""; 257*cdf0e10cSrcweir 258*cdf0e10cSrcweir if ( $registry->{'Name'} ) { $name = $registry->{'Name'}; } 259*cdf0e10cSrcweir 260*cdf0e10cSrcweir if ( $name =~ /\%/ ) { $name = installer::worker::replace_variables_in_string($name, $allvariableshashref); } 261*cdf0e10cSrcweir 262*cdf0e10cSrcweir return $name; 263*cdf0e10cSrcweir} 264*cdf0e10cSrcweir 265*cdf0e10cSrcweir############################################################## 266*cdf0e10cSrcweir# Returning value for registry table. 267*cdf0e10cSrcweir############################################################## 268*cdf0e10cSrcweir 269*cdf0e10cSrcweirsub get_registry_value 270*cdf0e10cSrcweir{ 271*cdf0e10cSrcweir my ($registry, $allvariableshashref) = @_; 272*cdf0e10cSrcweir 273*cdf0e10cSrcweir my $value = ""; 274*cdf0e10cSrcweir 275*cdf0e10cSrcweir if ( $registry->{'Value'} ) { $value = $registry->{'Value'}; } 276*cdf0e10cSrcweir 277*cdf0e10cSrcweir $value =~ s/\\\"/\"/g; # no more masquerading of '"' 278*cdf0e10cSrcweir $value =~ s/\\\\\s*$/\\/g; # making "\\" at end of value to "\" 279*cdf0e10cSrcweir $value =~ s/\<progpath\>/\[INSTALLLOCATION\]/; 280*cdf0e10cSrcweir $value =~ s/\[INSTALLLOCATION\]\\/\[INSTALLLOCATION\]/; # removing "\" after "[INSTALLLOCATION]" 281*cdf0e10cSrcweir 282*cdf0e10cSrcweir if ( $value =~ /\%/ ) { $value = installer::worker::replace_variables_in_string($value, $allvariableshashref); } 283*cdf0e10cSrcweir 284*cdf0e10cSrcweir return $value; 285*cdf0e10cSrcweir} 286*cdf0e10cSrcweir 287*cdf0e10cSrcweir############################################################## 288*cdf0e10cSrcweir# Returning 64 bit value for registry table. 289*cdf0e10cSrcweir############################################################## 290*cdf0e10cSrcweir 291*cdf0e10cSrcweirsub get_registry_val64 292*cdf0e10cSrcweir{ 293*cdf0e10cSrcweir my ($registry, $allvariableshashref) = @_; 294*cdf0e10cSrcweir 295*cdf0e10cSrcweir my $value = ""; 296*cdf0e10cSrcweir 297*cdf0e10cSrcweir if ( $registry->{'Val64'} ) { $value = $registry->{'Val64'}; } 298*cdf0e10cSrcweir 299*cdf0e10cSrcweir $value =~ s/\\\"/\"/g; # no more masquerading of '"' 300*cdf0e10cSrcweir $value =~ s/\\\\\s*$/\\/g; # making "\\" at end of value to "\" 301*cdf0e10cSrcweir $value =~ s/\<progpath\>/\[INSTALLLOCATION\]/; 302*cdf0e10cSrcweir $value =~ s/\[INSTALLLOCATION\]\\/\[INSTALLLOCATION\]/; # removing "\" after "[INSTALLLOCATION]" 303*cdf0e10cSrcweir 304*cdf0e10cSrcweir if ( $value =~ /\%/ ) { $value = installer::worker::replace_variables_in_string($value, $allvariableshashref); } 305*cdf0e10cSrcweir 306*cdf0e10cSrcweir return $value; 307*cdf0e10cSrcweir} 308*cdf0e10cSrcweir 309*cdf0e10cSrcweir############################################################## 310*cdf0e10cSrcweir# Returning component for registry table. 311*cdf0e10cSrcweir############################################################## 312*cdf0e10cSrcweir 313*cdf0e10cSrcweirsub get_registry_component 314*cdf0e10cSrcweir{ 315*cdf0e10cSrcweir my ($registry, $allvariables) = @_; 316*cdf0e10cSrcweir 317*cdf0e10cSrcweir # All registry items belonging to one module can 318*cdf0e10cSrcweir # be included into one component 319*cdf0e10cSrcweir 320*cdf0e10cSrcweir my $componentname = get_registry_component_name($registry, $allvariables); 321*cdf0e10cSrcweir 322*cdf0e10cSrcweir # saving componentname in the registryitem collector 323*cdf0e10cSrcweir 324*cdf0e10cSrcweir $registry->{'componentname'} = $componentname; 325*cdf0e10cSrcweir 326*cdf0e10cSrcweir return $componentname; 327*cdf0e10cSrcweir} 328*cdf0e10cSrcweir 329*cdf0e10cSrcweir###################################################### 330*cdf0e10cSrcweir# Adding the content of 331*cdf0e10cSrcweir# @installer::globals::userregistrycollector 332*cdf0e10cSrcweir# to the registry table. The content was collected 333*cdf0e10cSrcweir# in create_files_table() in file.pm. 334*cdf0e10cSrcweir###################################################### 335*cdf0e10cSrcweir 336*cdf0e10cSrcweirsub add_userregs_to_registry_table 337*cdf0e10cSrcweir{ 338*cdf0e10cSrcweir my ( $registrytable, $allvariables ) = @_; 339*cdf0e10cSrcweir 340*cdf0e10cSrcweir for ( my $i = 0; $i <= $#installer::globals::userregistrycollector; $i++ ) 341*cdf0e10cSrcweir { 342*cdf0e10cSrcweir my $onefile = $installer::globals::userregistrycollector[$i]; 343*cdf0e10cSrcweir 344*cdf0e10cSrcweir my $styles = ""; 345*cdf0e10cSrcweir if ( $onefile->{'Styles'} ) { $styles = $onefile->{'Styles'}; } 346*cdf0e10cSrcweir 347*cdf0e10cSrcweir my %registry = (); 348*cdf0e10cSrcweir 349*cdf0e10cSrcweir $registry{'Registry'} = $onefile->{'userregkeypath'}; 350*cdf0e10cSrcweir $registry{'Root'} = "1"; # always HKCU 351*cdf0e10cSrcweir $registry{'Key'} = "Software\\$allvariables->{'MANUFACTURER'}\\$allvariables->{'PRODUCTNAME'} $allvariables->{'PRODUCTVERSION'}\\"; 352*cdf0e10cSrcweir if ( $onefile->{'needs_user_registry_key'} ) { $registry{'Key'} = $registry{'Key'} . "StartMenu"; } 353*cdf0e10cSrcweir else { $registry{'Key'} = $registry{'Key'} . "ShellNew"; } 354*cdf0e10cSrcweir $registry{'Name'} = $onefile->{'Name'}; 355*cdf0e10cSrcweir $registry{'Value'} = "1"; 356*cdf0e10cSrcweir $registry{'Component_'} = $onefile->{'componentname'}; 357*cdf0e10cSrcweir 358*cdf0e10cSrcweir my $oneline = $registry{'Registry'} . "\t" . $registry{'Root'} . "\t" . $registry{'Key'} . "\t" 359*cdf0e10cSrcweir . $registry{'Name'} . "\t" . $registry{'Value'} . "\t" . $registry{'Component_'} . "\n"; 360*cdf0e10cSrcweir 361*cdf0e10cSrcweir push(@{$registrytable}, $oneline); 362*cdf0e10cSrcweir } 363*cdf0e10cSrcweir} 364*cdf0e10cSrcweir 365*cdf0e10cSrcweir###################################################### 366*cdf0e10cSrcweir# Creating the file Registry.idt dynamically 367*cdf0e10cSrcweir# Content: 368*cdf0e10cSrcweir# Registry Root Key Name Value Component_ 369*cdf0e10cSrcweir###################################################### 370*cdf0e10cSrcweir 371*cdf0e10cSrcweirsub create_registry_table 372*cdf0e10cSrcweir{ 373*cdf0e10cSrcweir my ($registryref, $allregistrycomponentsref, $basedir, $languagesarrayref, $allvariableshashref) = @_; 374*cdf0e10cSrcweir 375*cdf0e10cSrcweir for ( my $m = 0; $m <= $#{$languagesarrayref}; $m++ ) 376*cdf0e10cSrcweir { 377*cdf0e10cSrcweir my $onelanguage = ${$languagesarrayref}[$m]; 378*cdf0e10cSrcweir 379*cdf0e10cSrcweir my @registrytable = (); 380*cdf0e10cSrcweir my @reg64table = (); 381*cdf0e10cSrcweir 382*cdf0e10cSrcweir installer::windows::idtglobal::write_idt_header(\@registrytable, "registry"); 383*cdf0e10cSrcweir installer::windows::idtglobal::write_idt_header(\@reg64table, "reg64"); 384*cdf0e10cSrcweir 385*cdf0e10cSrcweir for ( my $i = 0; $i <= $#{$registryref}; $i++ ) 386*cdf0e10cSrcweir { 387*cdf0e10cSrcweir my $oneregistry = ${$registryref}[$i]; 388*cdf0e10cSrcweir 389*cdf0e10cSrcweir # Controlling the language! 390*cdf0e10cSrcweir # Only language independent folderitems or folderitems with the correct language 391*cdf0e10cSrcweir # will be included into the table 392*cdf0e10cSrcweir 393*cdf0e10cSrcweir if (! (!(( $oneregistry->{'ismultilingual'} )) || ( $oneregistry->{'specificlanguage'} eq $onelanguage )) ) { next; } 394*cdf0e10cSrcweir 395*cdf0e10cSrcweir my %registry = (); 396*cdf0e10cSrcweir 397*cdf0e10cSrcweir $registry{'Registry'} = get_registry_identifier($oneregistry); 398*cdf0e10cSrcweir $registry{'Root'} = get_registry_root($oneregistry); 399*cdf0e10cSrcweir $registry{'Key'} = get_registry_key($oneregistry, $allvariableshashref); 400*cdf0e10cSrcweir $registry{'Name'} = get_registry_name($oneregistry, $allvariableshashref); 401*cdf0e10cSrcweir $registry{'Value'} = get_registry_value($oneregistry, $allvariableshashref); 402*cdf0e10cSrcweir $registry{'Val64'} = get_registry_val64($oneregistry, $allvariableshashref); 403*cdf0e10cSrcweir $registry{'Component_'} = get_registry_component($oneregistry, $allvariableshashref); 404*cdf0e10cSrcweir 405*cdf0e10cSrcweir # Collecting all components 406*cdf0e10cSrcweir if (!(installer::existence::exists_in_array($registry{'Component_'}, $allregistrycomponentsref))) 407*cdf0e10cSrcweir { 408*cdf0e10cSrcweir push(@{$allregistrycomponentsref}, $registry{'Component_'}); 409*cdf0e10cSrcweir } 410*cdf0e10cSrcweir 411*cdf0e10cSrcweir # Collecting all components with DONT_DELETE style 412*cdf0e10cSrcweir my $style = ""; 413*cdf0e10cSrcweir if ( $oneregistry->{'Styles'} ) { $style = $oneregistry->{'Styles'}; } 414*cdf0e10cSrcweir if ( $style =~ /\bDONT_DELETE\b/ ) { $installer::globals::dontdeletecomponents{$registry{'Component_'}} = 1; } 415*cdf0e10cSrcweir 416*cdf0e10cSrcweir # Saving upgradekey to write this into setup.ini for minor upgrades 417*cdf0e10cSrcweir if ( $style =~ /\bUPGRADEKEY\b/ ) { $installer::globals::minorupgradekey = $registry{'Key'}; } 418*cdf0e10cSrcweir 419*cdf0e10cSrcweir # Collecting all registry components with ALWAYS_REQUIRED style 420*cdf0e10cSrcweir if ( ! ( $style =~ /\bALWAYS_REQUIRED\b/ )) 421*cdf0e10cSrcweir { 422*cdf0e10cSrcweir # Setting a component condition for unforced registry components! 423*cdf0e10cSrcweir # Only write into registry, if WRITE_REGISTRY is set. 424*cdf0e10cSrcweir if ( $oneregistry->{'ComponentCondition'} ) { $oneregistry->{'ComponentCondition'} = "(" . $oneregistry->{'ComponentCondition'} . ") AND (WRITE_REGISTRY=1)"; } 425*cdf0e10cSrcweir else { $oneregistry->{'ComponentCondition'} = "WRITE_REGISTRY=1"; } 426*cdf0e10cSrcweir } 427*cdf0e10cSrcweir 428*cdf0e10cSrcweir # Collecting all component conditions 429*cdf0e10cSrcweir if ( $oneregistry->{'ComponentCondition'} ) 430*cdf0e10cSrcweir { 431*cdf0e10cSrcweir if ( ! exists($installer::globals::componentcondition{$registry{'Component_'}})) 432*cdf0e10cSrcweir { 433*cdf0e10cSrcweir $installer::globals::componentcondition{$registry{'Component_'}} = $oneregistry->{'ComponentCondition'}; 434*cdf0e10cSrcweir } 435*cdf0e10cSrcweir } 436*cdf0e10cSrcweir 437*cdf0e10cSrcweir my $oneline = $registry{'Registry'} . "\t" . $registry{'Root'} . "\t" . $registry{'Key'} . "\t" 438*cdf0e10cSrcweir . $registry{'Name'} . "\t" . $registry{'Value'} . "\t" . $registry{'Component_'} . "\n"; 439*cdf0e10cSrcweir 440*cdf0e10cSrcweir my $oneline64 = $registry{'Registry'} . "\t" . $registry{'Root'} . "\t" . $registry{'Key'} . "\t" 441*cdf0e10cSrcweir . $registry{'Name'} . "\t" . $registry{'Val64'} . "\t" . $registry{'Component_'} . "\n"; 442*cdf0e10cSrcweir 443*cdf0e10cSrcweir if ( ! ( $style =~ /\bX64_ONLY\b/ )) { push(@registrytable, $oneline); } # standard registry table for 32 Bit 444*cdf0e10cSrcweir if (( $style =~ /\bX64\b/ ) || ( $style =~ /\bX64_ONLY\b/ )) { push(@reg64table , $oneline64); } 445*cdf0e10cSrcweir } 446*cdf0e10cSrcweir 447*cdf0e10cSrcweir # If there are added user registry keys for files collected in 448*cdf0e10cSrcweir # @installer::globals::userregistrycollector (file.pm), then 449*cdf0e10cSrcweir # this registry keys have to be added now. This is necessary for 450*cdf0e10cSrcweir # files in PREDEFINED_OSSHELLNEWDIR, because their component 451*cdf0e10cSrcweir # needs as KeyPath a RegistryItem in HKCU. 452*cdf0e10cSrcweir 453*cdf0e10cSrcweir if ( $installer::globals::addeduserregitrykeys ) { add_userregs_to_registry_table(\@registrytable, $allvariableshashref); } 454*cdf0e10cSrcweir 455*cdf0e10cSrcweir # Saving the file 456*cdf0e10cSrcweir 457*cdf0e10cSrcweir my $registrytablename = $basedir . $installer::globals::separator . "Registry.idt" . "." . $onelanguage; 458*cdf0e10cSrcweir installer::files::save_file($registrytablename ,\@registrytable); 459*cdf0e10cSrcweir my $infoline = "Created idt file: $registrytablename\n"; 460*cdf0e10cSrcweir push(@installer::globals::logfileinfo, $infoline); 461*cdf0e10cSrcweir 462*cdf0e10cSrcweir $registrytablename = $basedir . $installer::globals::separator . "Reg64.idt" . "." . $onelanguage; 463*cdf0e10cSrcweir installer::files::save_file($registrytablename ,\@reg64table ); 464*cdf0e10cSrcweir $infoline = "Created idt file: $registrytablename\n"; 465*cdf0e10cSrcweir push(@installer::globals::logfileinfo, $infoline); 466*cdf0e10cSrcweir } 467*cdf0e10cSrcweir} 468*cdf0e10cSrcweir 469*cdf0e10cSrcweir1; 470