#!/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();