19780544fSAndrew Rist#**************************************************************
29780544fSAndrew Rist#
39780544fSAndrew Rist#  Licensed to the Apache Software Foundation (ASF) under one
49780544fSAndrew Rist#  or more contributor license agreements.  See the NOTICE file
59780544fSAndrew Rist#  distributed with this work for additional information
69780544fSAndrew Rist#  regarding copyright ownership.  The ASF licenses this file
79780544fSAndrew Rist#  to you under the Apache License, Version 2.0 (the
89780544fSAndrew Rist#  "License"); you may not use this file except in compliance
99780544fSAndrew Rist#  with the License.  You may obtain a copy of the License at
109780544fSAndrew Rist#
119780544fSAndrew Rist#    http://www.apache.org/licenses/LICENSE-2.0
129780544fSAndrew Rist#
139780544fSAndrew Rist#  Unless required by applicable law or agreed to in writing,
149780544fSAndrew Rist#  software distributed under the License is distributed on an
159780544fSAndrew Rist#  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
169780544fSAndrew Rist#  KIND, either express or implied.  See the License for the
179780544fSAndrew Rist#  specific language governing permissions and limitations
189780544fSAndrew Rist#  under the License.
199780544fSAndrew Rist#
209780544fSAndrew Rist#**************************************************************
219780544fSAndrew Rist
229780544fSAndrew Rist
23cdf0e10cSrcweir
24cdf0e10cSrcweirpackage installer::windows::selfreg;
25cdf0e10cSrcweir
26cdf0e10cSrcweiruse installer::exiter;
27cdf0e10cSrcweiruse installer::files;
28cdf0e10cSrcweiruse installer::globals;
29cdf0e10cSrcweiruse installer::worker;
30cdf0e10cSrcweiruse installer::windows::idtglobal;
31cdf0e10cSrcweir
32cdf0e10cSrcweir##############################################################
33cdf0e10cSrcweir# Returning the cost for the selfreg table.
34cdf0e10cSrcweir##############################################################
35cdf0e10cSrcweir
36cdf0e10cSrcweirsub get_selfreg_cost
37cdf0e10cSrcweir{
38cdf0e10cSrcweir	my ( $onefile ) = @_;
39cdf0e10cSrcweir
40cdf0e10cSrcweir	return "0";
41cdf0e10cSrcweir}
42cdf0e10cSrcweir
43cdf0e10cSrcweir####################################################################################
44cdf0e10cSrcweir# Creating the file SelfReg.idt dynamically
45cdf0e10cSrcweir# Content:
46cdf0e10cSrcweir# File_ Cost
47cdf0e10cSrcweir# UpgradeCode VersionMin VersionMax Language Attributes Remove ActionProperty
48cdf0e10cSrcweir####################################################################################
49cdf0e10cSrcweir
50cdf0e10cSrcweirsub create_selfreg_table
51cdf0e10cSrcweir{
52cdf0e10cSrcweir	my ($filesref, $basedir) = @_;
53cdf0e10cSrcweir
54cdf0e10cSrcweir	my @selfregtable = ();
55cdf0e10cSrcweir
56cdf0e10cSrcweir	installer::windows::idtglobal::write_idt_header(\@selfregtable, "selfreg");
57cdf0e10cSrcweir
58cdf0e10cSrcweir	# Registering all libraries with flag "SELFREG"
59cdf0e10cSrcweir
60cdf0e10cSrcweir	my $selfregfiles = installer::worker::collect_all_items_with_special_flag($filesref, "SELFREG");
61cdf0e10cSrcweir
62cdf0e10cSrcweir	for ( my $i = 0; $i <= $#{$selfregfiles}; $i++ )
63cdf0e10cSrcweir	{
64cdf0e10cSrcweir		my $onefile = ${$selfregfiles}[$i];
65cdf0e10cSrcweir
66cdf0e10cSrcweir		my %selfreg = ();
67cdf0e10cSrcweir
68cdf0e10cSrcweir		$selfreg{'File_'} = $onefile->{'uniquename'};
69cdf0e10cSrcweir		$selfreg{'Cost'} = get_selfreg_cost($onefile);
70cdf0e10cSrcweir
71cdf0e10cSrcweir		my $oneline = $selfreg{'File_'} . "\t" . $selfreg{'Cost'} . "\n";
72cdf0e10cSrcweir
73cdf0e10cSrcweir		push(@selfregtable, $oneline);
74cdf0e10cSrcweir	}
75cdf0e10cSrcweir
76cdf0e10cSrcweir	# Saving the file
77cdf0e10cSrcweir
78cdf0e10cSrcweir	my $selfregtablename = $basedir . $installer::globals::separator . "SelfReg.idt";
79cdf0e10cSrcweir	installer::files::save_file($selfregtablename ,\@selfregtable);
80*b274bc22SAndre Fischer    $installer::logger::Lang->printf("Created idt file: %s\n", $selfregtablename);
81cdf0e10cSrcweir}
82cdf0e10cSrcweir
83*b274bc22SAndre Fischer1;
84