RunMsdev.pl
1.86 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
use Win32::Registry;
my %RegType = (
0 => 'REG_0',
1 => 'REG_SZ',
2 => 'REG_EXPAND_SZ',
3 => 'REG_BINARY',
4 => 'REG_DWORD',
5 => 'REG_DWORD_BIG_ENDIAN',
6 => 'REG_LINK',
7 => 'REG_MULTI_SZ',
8 => 'REG_RESOURCE_LIST',
9 => 'REG_FULL_RESOURCE_DESCRIPTION',
10 => 'REG_RESSOURCE_REQUIREMENT_MAP');
my $Register_ID1 = "Software\\MICROSOFT\\Devstudio\\6.0\\Tools";
# "Software\\MICROSOFT\\Devstudio\\6.0\\Build System\\Components\\Platforms\\Win32 (x86)\\Directories";
my $Register_Dir = "Software\\MICROSOFT\\Devstudio\\6.0\\Build System\\Components\\Platforms\\Win32 (x86)\\Directories";
my $RegType, $RegValue, $RegKey, $value;
my %values;
my ($hkey, @key_list, $key);
$HKEY_CURRENT_USER->Open($Register_Dir,$hkey) ;
if ( $hkey eq "" )
{
} else
{
exit 0;
}
$HKEY_CURRENT_USER->Open($Register_ID1,$hkey) ;
if ( $hkey eq "" )
{
print "Microsoft Visual C++ 6.0 not found !\n";
exit 0;
}
$hkey->GetKeys(\@key_list);
#print "$Register_ID1 keys: \n";
foreach $key(@key_list)
{
print " $key \n";
}
$hkey->GetValues(\%values);
my $tmp="999";
my $tmp2="999";
my $res=999;
foreach $value (keys(%values))
{
$RegType = $values{$value}->[1];
$RegValue = $values{$value}->[2];
$RegKey = $values{$value}->[0];
if (( $value =~ /InitialDirectory#/ )&& (-d $RegValue ))
{
$tmp = $RegValue;
$tmp =~ /([:\w\s\\]+)\\Tools[\w\s\\]*/;
$tmp2 = $1;
if ( $tmp2 eq "")
{
next;
}
if (-d $tmp)
{
$tmp2="$tmp2"."\\MSDev98\\Bin\\MSDev\.com";
if ( -f "$tmp2")
{
$res = 999;
$res = system($tmp2);
if ($res eq 0)
{
last;
}
print " res == $res \n";
} else
{
print " not -f $tmp2 \n";
}
} else
{
print " not -d $tmp2 \n";
}
} else { next; }
}
$hkey->Close();