summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Master/tlpkg/TeXLive/TLWinGoo.pm38
1 files changed, 34 insertions, 4 deletions
diff --git a/Master/tlpkg/TeXLive/TLWinGoo.pm b/Master/tlpkg/TeXLive/TLWinGoo.pm
index 36ae998c70c..53946538912 100644
--- a/Master/tlpkg/TeXLive/TLWinGoo.pm
+++ b/Master/tlpkg/TeXLive/TLWinGoo.pm
@@ -798,20 +798,50 @@ sub do_remove_regkey {
return 1;
}
+#############################
+# not overwriting an existing file association
+
+# read error is sometimes access_denied,
+# therefore we ONLY decide that a value does not exist if
+# an attempt to read it errors out with file_not_found.
+
+# windows error codes
+my $file_not_found = 2; # ERROR_FILE_NOT_FOUND
+my $reg_ok = 0; # ERROR_SUCCESS
+
+# inaccessible value (note. actual filetypes shound not have spaces)
+my $reg_unknown = 'not accessible';
+
# Effective default value of any key under Classes.
# admin: HKLM; user: HKCU or otherwise HKLM
-# Reject if there is no corresponding key under classes
sub current_filetype {
my $extension = shift;
my $filetype;
+ my $regerror;
+
if ($is_admin) {
- $filetype = lm_root()->{"Software/Classes/$extension//"}; # REG_SZ
+ $regerror = $reg_ok;
+ $filetype = lm_root()->{"Software/Classes/$extension//"} # REG_SZ
+ or $regerror = Win32API::Registry::regLastError();
+ if ($regerror != $reg_ok and $regerror != $file_not_found) {
+ return $reg_unknown;
+ }
} else {
# Mysterious failures on w7_64 => merge HKLM/HKCU info explicitly
# rather than checking HKCR
- $filetype = cu_root()->{"Software/Classes/$extension//"};
+ $regerror = $reg_ok;
+ $filetype = cu_root()->{"Software/Classes/$extension//"} or
+ $regerror = Win32API::Registry::regLastError();
+ if ($regerror != $reg_ok and $regerror != $file_not_found) {
+ return $reg_unknown;
+ }
if (!defined($filetype) or ($filetype eq "")) {
- $filetype = lm_root()->{"Software/Classes/$extension//"}
+ $regerror = $reg_ok;
+ $filetype = lm_root()->{"Software/Classes/$extension//"} or
+ $regerror = Win32API::Registry::regLastError();
+ if ($regerror != $reg_ok and $regerror != $file_not_found) {
+ return $reg_unknown;
+ }
};
}
$filetype = "" unless defined($filetype);