File tree Expand file tree Collapse file tree 1 file changed +14
-15
lines changed Expand file tree Collapse file tree 1 file changed +14
-15
lines changed Original file line number Diff line number Diff line change 44
55=end
66
7- require 'win32/registry'
8-
97module Win32
108 module Resolv
11- API = Registry ::API
12- Error = Registry ::Error
13-
149 def self . get_hosts_path
1510 path = get_hosts_dir
1611 path = File . expand_path ( 'hosts' , path )
@@ -47,20 +42,24 @@ module Win32
4742# Windows NT
4843#====================================================================
4944 module Resolv
50- module SZ
51- refine Registry do
52- # ad hoc workaround for broken registry
53- def read_s ( key )
54- type , str = read ( key )
55- unless type == Registry ::REG_SZ
56- warn "Broken registry, #{ name } \\ #{ key } was #{ Registry . type2name ( type ) } , ignored"
57- return String . new
45+ begin
46+ require 'win32/registry'
47+ module SZ
48+ refine Registry do
49+ # ad hoc workaround for broken registry
50+ def read_s ( key )
51+ type , str = read ( key )
52+ unless type == Registry ::REG_SZ
53+ warn "Broken registry, #{ name } \\ #{ key } was #{ Registry . type2name ( type ) } , ignored"
54+ return String . new
55+ end
56+ str
5857 end
59- str
6058 end
6159 end
60+ using SZ
61+ rescue LoadError
6262 end
63- using SZ
6463
6564 TCPIP_NT = 'SYSTEM\CurrentControlSet\Services\Tcpip\Parameters'
6665
You can’t perform that action at this time.
0 commit comments