1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

* ext/{dl,fiddle}/win32/lib/win32/registry.rb (Win32::Regstry#check):

should report the position of the error.

* ext/{dl,fiddle}/win32/lib/win32/registry.rb
  (Win32::Regstry#QueryValue): workaround for test-all crash.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@41849 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
usa 2013-07-09 02:06:13 +00:00
parent a189f7f6c8
commit b35c6a429e
3 changed files with 34 additions and 16 deletions

View file

@ -1,3 +1,11 @@
Tue Jul 9 11:04:35 2013 NAKAMURA Usaku <usa@ruby-lang.org>
* ext/{dl,fiddle}/win32/lib/win32/registry.rb (Win32::Regstry#check):
should report the position of the error.
* ext/{dl,fiddle}/win32/lib/win32/registry.rb
(Win32::Regstry#QueryValue): workaround for test-all crash.
Tue Jul 9 10:27:56 2013 NAKAMURA Usaku <usa@ruby-lang.org>
* ext/{dl,fiddle}/win32/lib/win32/registry.rb

View file

@ -232,7 +232,7 @@ For detail, see the MSDN[http://msdn.microsoft.com/library/en-us/sysinfo/base/pr
module_function
def check(result)
raise Error, result, caller(2) if result != 0
raise Error, result, caller(1) if result != 0
end
def packdw(dw)
@ -283,13 +283,18 @@ For detail, see the MSDN[http://msdn.microsoft.com/library/en-us/sysinfo/base/pr
end
def QueryValue(hkey, name)
type = packdw(0)
size = packdw(0)
name = name.encode(WCHAR)
check RegQueryValueExW.call(hkey, name, 0, type, 0, size)
data = WCHAR_SPACE * unpackdw(size)
check RegQueryValueExW.call(hkey, name, 0, type, data, size)
[ unpackdw(type), data[0, unpackdw(size)].encode ]
prev_gc = GC.disable
begin
type = packdw(0)
size = packdw(0)
name = name.encode(WCHAR)
check RegQueryValueExW.call(hkey, name, 0, type, 0, size)
data = WCHAR_SPACE * unpackdw(size)
check RegQueryValueExW.call(hkey, name, 0, type, data, size)
[ unpackdw(type), data[0, unpackdw(size)].encode ]
ensure
GC.enable if prev_gc
end
end
def SetValue(hkey, name, type, data, size)

View file

@ -232,7 +232,7 @@ For detail, see the MSDN[http://msdn.microsoft.com/library/en-us/sysinfo/base/pr
module_function
def check(result)
raise Error, result, caller(2) if result != 0
raise Error, result, caller(1) if result != 0
end
def packdw(dw)
@ -283,13 +283,18 @@ For detail, see the MSDN[http://msdn.microsoft.com/library/en-us/sysinfo/base/pr
end
def QueryValue(hkey, name)
type = packdw(0)
size = packdw(0)
name = name.encode(WCHAR)
check RegQueryValueExW.call(hkey, name, 0, type, 0, size)
data = WCHAR_SPACE * unpackdw(size)
check RegQueryValueExW.call(hkey, name, 0, type, data, size)
[ unpackdw(type), data[0, unpackdw(size)].encode ]
prev_gc = GC.disable
begin
type = packdw(0)
size = packdw(0)
name = name.encode(WCHAR)
check RegQueryValueExW.call(hkey, name, 0, type, 0, size)
data = WCHAR_SPACE * unpackdw(size)
check RegQueryValueExW.call(hkey, name, 0, type, data, size)
[ unpackdw(type), data[0, unpackdw(size)].encode ]
ensure
GC.enable if prev_gc
end
end
def SetValue(hkey, name, type, data, size)