This method is deprecated or moved on the latest stable version.
The last existing version (v1_9_3_392) is shown here.
read(name, *rtype)
public
Read a registry value named name
and return array of [ type, data ]. When name is nil, the `default’ value is
read. type is value type. (see Win32::Registry::Constants
module) data is value data, its class is: :REG_SZ, REG_EXPAND_SZ
When rtype is specified, the value type must be included by rtype array, or
TypeError is raised.
# File ext/dl/win32/lib/win32/registry.rb, line 586
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)"
end
case type
when REG_SZ, REG_EXPAND_SZ
[ type, data.chop ]
when REG_MULTI_SZ
[ type, data.split(/\00//) ]
when REG_BINARY
[ type, data ]
when REG_DWORD
[ type, API.unpackdw(data) ]
when REG_DWORD_BIG_ENDIAN
[ type, data.unpack('N')[0] ]
when REG_QWORD
[ type, API.unpackqw(data) ]
else
raise TypeError, "Type #{type} is not supported."
end
end