summaryrefslogtreecommitdiff
path: root/ext/win32/lib
diff options
context:
space:
mode:
authorHiroshi SHIBATA <[email protected]>2025-02-04 17:03:22 +0900
committerHiroshi SHIBATA <[email protected]>2025-02-05 07:36:59 +0900
commit02a9c05e3ecc5b4a382ca9c7ca3e4adb79844bc2 ()
treef2ac198b9a8742e363893f46f456fa8c944459bf /ext/win32/lib
parent62b87921090b09416a7846c865f23e2a19a448aa (diff)
Handle failing case to load win32/registry
Notes: Merged: https://.com/ruby/ruby/pull/12616
-rw-r--r--ext/win32/lib/win32/resolv.rb29
1 files changed, 14 insertions, 15 deletions
@@ -4,13 +4,8 @@
=end
-require 'win32/registry'
-
module Win32
module Resolv
- API = Registry::API
- Error = Registry::Error
-
def self.get_hosts_path
path = get_hosts_dir
path = File.expand_path('hosts', path)
@@ -47,20 +42,24 @@ module Win32
# Windows NT
#====================================================================
module Resolv
- module SZ
- refine Registry do
- # ad hoc workaround for broken registry
- def read_s(key)
- type, str = read(key)
- unless type == Registry::REG_SZ
- warn "Broken registry, #{name}\\#{key} was #{Registry.type2name(type)}, ignored"
- return String.new
end
- str
end
end
end
- using SZ
TCPIP_NT = 'SYSTEM\CurrentControlSet\Services\Tcpip\Parameters'