Win32 APIs
# File dl/win32/lib/win32/registry.rb, line 473
def CloseKey(hkey)
check RegCloseKey.call(hkey)
end
# File dl/win32/lib/win32/registry.rb, line 425
def CreateKey(hkey, name, opt, desired)
result = packdw(0)
disp = packdw(0)
check RegCreateKeyExA.call(hkey, name, 0, 0, opt, desired,
0, result, disp)
[ unpackdw(result), unpackdw(disp) ]
end
# File dl/win32/lib/win32/registry.rb, line 465
def DeleteKey(hkey, name)
check RegDeleteKey.call(hkey, name)
end
# File dl/win32/lib/win32/registry.rb, line 461
def DeleteValue(hkey, name)
check RegDeleteValue.call(hkey, name)
end
# File dl/win32/lib/win32/registry.rb, line 440
def EnumKey(hkey, index)
name = ' ' * Constants::MAX_KEY_LENGTH
size = packdw(Constants::MAX_KEY_LENGTH)
wtime = ' ' * 8
check RegEnumKeyExA.call(hkey, index, name, size, 0, 0, 0, wtime)
[ name[0, unpackdw(size)], unpackqw(wtime) ]
end
# File dl/win32/lib/win32/registry.rb, line 433
def EnumValue(hkey, index)
name = ' ' * Constants::MAX_KEY_LENGTH
size = packdw(Constants::MAX_KEY_LENGTH)
check RegEnumValueA.call(hkey, index, name, size, 0, 0, 0, 0)
name[0, unpackdw(size)]
end
# File dl/win32/lib/win32/registry.rb, line 469
def FlushKey(hkey)
check RegFlushKey.call(hkey)
end
# File dl/win32/lib/win32/registry.rb, line 419
def OpenKey(hkey, name, opt, desired)
result = packdw(0)
check RegOpenKeyExA.call(hkey, name, opt, desired, result)
unpackdw(result)
end
# File dl/win32/lib/win32/registry.rb, line 477
def QueryInfoKey(hkey)
subkeys = packdw(0)
maxsubkeylen = packdw(0)
values = packdw(0)
maxvaluenamelen = packdw(0)
maxvaluelen = packdw(0)
secdescs = packdw(0)
wtime = ' ' * 8
check RegQueryInfoKey.call(hkey, 0, 0, 0, subkeys, maxsubkeylen, 0,
values, maxvaluenamelen, maxvaluelen, secdescs, wtime)
[ unpackdw(subkeys), unpackdw(maxsubkeylen), unpackdw(values),
unpackdw(maxvaluenamelen), unpackdw(maxvaluelen),
unpackdw(secdescs), unpackqw(wtime) ]
end
# File dl/win32/lib/win32/registry.rb, line 448
def QueryValue(hkey, name)
type = packdw(0)
size = packdw(0)
check RegQueryValueExA.call(hkey, name, 0, type, 0, size)
data = ' ' * unpackdw(size)
check RegQueryValueExA.call(hkey, name, 0, type, data, size)
[ unpackdw(type), data[0, unpackdw(size)] ]
end
# File dl/win32/lib/win32/registry.rb, line 457
def SetValue(hkey, name, type, data, size)
check RegSetValueExA.call(hkey, name, 0, type, data, size)
end
# File dl/win32/lib/win32/registry.rb, line 397
def check(result)
raise Error, result, caller(2) if result != 0
end
# File dl/win32/lib/win32/registry.rb, line 401
def packdw(dw)
[dw].pack('V')
end
# File dl/win32/lib/win32/registry.rb, line 410
def packqw(qw)
[ qw & 0xFFFFFFFF, qw >> 32 ].pack('VV')
end
Commenting is here to help enhance the documentation. For example, code samples, or clarification of the documentation.
If you have questions about Ruby or the documentation, please post to one of the Ruby mailing lists. You will get better, faster, help that way.
If you wish to post a correction of the docs, please do so, but also file bug report so that it can be corrected for the next release. Thank you.
If you want to help improve the Ruby documentation, please see Improve the docs, or visit Documenting-ruby.org.