summaryrefslogtreecommitdiff
path: root/Master
diff options
context:
space:
mode:
authorSiep Kroonenberg <siepo@cybercomm.nl>2017-04-26 11:27:52 +0000
committerSiep Kroonenberg <siepo@cybercomm.nl>2017-04-26 11:27:52 +0000
commitf368eec16e2c47896e2b9e94f78bd1b77991774b (patch)
tree637de981326be5b5a9a00cf120fa0f8b3cf1072f /Master
parent0112bf54c4b0a3de4fd75a1d1d52a4684c1a73c6 (diff)
Windows only new filetypes: take other read failures into account
git-svn-id: svn://tug.org/texlive/trunk@44058 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master')
-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);