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
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
|
#!/usr/bin/env perl
BEGIN {
$^W = 1;
my $Master;
my $me = $0;
$me =~ s!\\!/!g if $^O =~ /^MSWin(32|64)$/i;
if ($me =~ m!/!) {
($Master = $me) =~ s!(.*)/[^/]*$!$1!;
} else {
$Master = ".";
}
$::installerdir = $Master;
unshift (@INC, "$::installerdir/tlpkg");
}
$::opt_verbosity=2;
use TeXLive::TLWinGoo;
Win32::TieRegistry->import( qw( $Registry
));
# REG_SZ REG_EXPAND_SZ KEY_READ KEY_WRITE KEY_ALL_ACCESS
# KEY_ENUMERATE_SUB_KEYS
$Registry->Delimiter('/');
$Registry->ArrayValues(0);
sub print_reg {
my $k = shift;
$kb = $k;
$kb =~ s!/!\\!g;
if (defined($Registry->{"LMachine/$k/"})) {
print "\nHKLM/$k/:\n";
print `reg query HKLM\\$kb /s`;
} else {
print "\nHKLM/$k/: no such entry\n";
}
#print $out;
if (defined($Registry->{"CUser/$k/"})) {
print "\nHKCU/$k/:\n";
print `reg query HKCU\\$kb /s`;
} else {
print "\nHKCU/$k/: no such entry\n";
}
#print $out;
}
$regpath = "Software/Classes/test";
$testkey = {
'/' => "default_value",
'/a' => "another value"
};
TeXLive::TLWinGoo::do_write_regkey(2, $regpath, $testkey);
print_reg($regpath);
# extensions
$regpath = 'Software/Classes/';
$ext = '.tex';
register_extension(0, $ext, 'texfile');
print_reg("$regpath$ext");
register_extension(1, $ext, 'texfile');
print_reg("$regpath$ext");
register_extension(2, $ext, 'TL.TeXworks.edit');
print_reg("$regpath$ext");
register_extension(1, $ext, 'texfile');
print_reg("$regpath$ext");
unregister_extension(0, $ext, 'texfile');
print_reg("$regpath$ext");
unregister_extension(1, $ext, 'TL.TeXworks.edit');
print_reg("$regpath$ext");
unregister_extension(1, $ext, 'texfile');
print_reg("$regpath$ext");
register_extension(1, $ext, 'texfile');
print_reg("$regpath$ext");
unregister_extension(2, $ext, 'TL.TeXworks.edit');
print_reg("$regpath$ext");
# file types
$filetype = 'TL.TeXworks.edit';
register_file_type('TL.TeXworks.edit', "\"$::installerdir/bin/win32/texworks.exe\" \"%1\"");
print_reg("$regpath$filetype");
unregister_file_type('TL.TeXworks.edit');
print_reg("$regpath$filetype");
# applications
$regpath = "Software/Classes/Applications/";
$prog = "texworks.exe";
$path = "$::installerdir/bin/win32/texworks.exe";
$exts = ['.tex','.sty','.cls','.ltx'];
register_application($prog, $path, $exts);
print_reg("$regpath$prog");
unregister_application($prog);
print_reg("$regpath$prog");
$prog = "bitmap2eps.exe";
$path = "$::installerdir/bin/win32/bitmap2eps.exe";
$exts = ['.png','.jpg','.gif','.bmp'];
register_application($prog, $path, $exts);
print_reg("$regpath$prog");
unregister_application($prog);
print_reg("$regpath$prog");
# openwithlist
$regpath = "Software/Classes/";
$ext = ".gif";
$prog = "bitmap2eps.exe";
add_to_openwithlist($ext, $prog);
print_reg("$regpath$ext");
remove_from_openwithlist($ext, $prog);
print_reg("$regpath$ext");
update_assocs();
|