summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorusa <usa@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2017-03-25 18:22:34 +0000
committerusa <usa@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2017-03-25 18:22:34 +0000
commit1bd1e84388f0cb133891d366563bef72796593f8 (patch)
treeca3418bb06519ef7636ed8627814fa8e45c2550b
parentcc938265eb0905093ea4b5ce2e318160086bbfee (diff)
merge revision(s) 57265,57266: [Backport #13081]
win32/resolv.rb: ad hoc workaround * ext/win32/lib/win32/resolv.rb (Win32::Resolv::SZ): an ad hoc workaround for broken registry. SearchList and other registry values must be REG_SZ, or Windows ignores anything in those values otherwise. [ruby-dev:49924] [Bug #13081] https://github.com/rubygems/rubygems/issues/1700 win32/registry.rb: registry type names * ext/win32/lib/win32/registry.rb (Win32::Registry#read): show registry type names instead of numeric values. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_2_2@58119 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
-rw-r--r--ext/win32/lib/win32/registry.rb10
-rw-r--r--ext/win32/lib/win32/resolv.rb15
-rw-r--r--version.h2
3 files changed, 22 insertions, 5 deletions
diff --git a/ext/win32/lib/win32/registry.rb b/ext/win32/lib/win32/registry.rb
index 7fbeb5c649..0269218ae0 100644
--- a/ext/win32/lib/win32/registry.rb
+++ b/ext/win32/lib/win32/registry.rb
@@ -641,7 +641,9 @@ For detail, see the MSDN[http://msdn.microsoft.com/library/en-us/sysinfo/base/pr
def read(name, *rtype)
type, data = API.QueryValue(@hkey, name)
unless rtype.empty? or rtype.include?(type)
- raise TypeError, "Type mismatch (expect #{rtype.inspect} but #{type} present)"
+ raise TypeError, "Type mismatch (expect [#{
+ rtype.map{|t|Registry.type2name(t)}.join(', ')}] but #{
+ Registry.type2name(type)} present)"
end
case type
when REG_SZ, REG_EXPAND_SZ
@@ -657,7 +659,7 @@ For detail, see the MSDN[http://msdn.microsoft.com/library/en-us/sysinfo/base/pr
when REG_QWORD
[ type, API.unpackqw(data) ]
else
- raise TypeError, "Type #{type} is not supported."
+ raise TypeError, "Type #{Registry.type2name(type)} is not supported."
end
end
@@ -680,7 +682,7 @@ For detail, see the MSDN[http://msdn.microsoft.com/library/en-us/sysinfo/base/pr
when REG_EXPAND_SZ
Registry.expand_environ(data)
else
- raise TypeError, "Type #{type} is not supported."
+ raise TypeError, "Type #{Registry.type2name(type)} is not supported."
end
end
@@ -753,7 +755,7 @@ For detail, see the MSDN[http://msdn.microsoft.com/library/en-us/sysinfo/base/pr
when REG_QWORD
data = API.packqw(data.to_i)
else
- raise TypeError, "Unsupported type #{type}"
+ raise TypeError, "Unsupported type #{Registry.type2name(type)}"
end
API.SetValue(@hkey, name, type, data, data.bytesize + termsize)
end
diff --git a/ext/win32/lib/win32/resolv.rb b/ext/win32/lib/win32/resolv.rb
index b5c11bf878..443dd684a3 100644
--- a/ext/win32/lib/win32/resolv.rb
+++ b/ext/win32/lib/win32/resolv.rb
@@ -45,6 +45,21 @@ if info.unpack('V5')[4] == 2 # VER_PLATFORM_WIN32_NT
# Windows NT
#====================================================================
module_eval <<-'__EOS__', __FILE__, __LINE__+1
+ 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'
class << self
diff --git a/version.h b/version.h
index a26eb39922..f84b120601 100644
--- a/version.h
+++ b/version.h
@@ -1,6 +1,6 @@
#define RUBY_VERSION "2.2.7"
#define RUBY_RELEASE_DATE "2017-03-26"
-#define RUBY_PATCHLEVEL 451
+#define RUBY_PATCHLEVEL 452
#define RUBY_RELEASE_YEAR 2017
#define RUBY_RELEASE_MONTH 3