summaryrefslogtreecommitdiff
path: root/ext/dl/win32/lib
diff options
context:
space:
mode:
Diffstat (limited to 'ext/dl/win32/lib')
-rw-r--r--ext/dl/win32/lib/win32/registry.rb21
1 files changed, 13 insertions, 8 deletions
diff --git a/ext/dl/win32/lib/win32/registry.rb b/ext/dl/win32/lib/win32/registry.rb
index d9ba5519f9f..5be711c0e66 100644
--- a/ext/dl/win32/lib/win32/registry.rb
+++ b/ext/dl/win32/lib/win32/registry.rb
@@ -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)