Module: Win32::Registry::API
Relationships & Source Files | |
Super Chains via Extension / Inclusion / Inheritance | |
Class Chain:
self,
Importer
|
|
Instance Chain:
self,
Constants
|
|
Defined in: | ext/win32/lib/win32/registry.rb |
Overview
::Win32 APIs
Constant Summary
Constants - Included
HKEY_CLASSES_ROOT, HKEY_CURRENT_CONFIG, HKEY_CURRENT_USER, HKEY_DYN_DATA, HKEY_LOCAL_MACHINE, HKEY_PERFORMANCE_DATA, HKEY_PERFORMANCE_NLSTEXT, HKEY_PERFORMANCE_TEXT, HKEY_USERS, KEY_ALL_ACCESS, KEY_CREATE_LINK, KEY_CREATE_SUB_KEY, KEY_ENUMERATE_SUB_KEYS, KEY_EXECUTE, KEY_NOTIFY, KEY_QUERY_VALUE, KEY_READ, KEY_SET_VALUE, KEY_WRITE, MAX_KEY_LENGTH, MAX_VALUE_LENGTH, REG_BINARY, REG_CREATED_NEW_KEY, REG_DWORD, REG_DWORD_BIG_ENDIAN, REG_DWORD_LITTLE_ENDIAN, REG_EXPAND_SZ, REG_FORCE_RESTORE, REG_FULL_RESOURCE_DESCRIPTOR, REG_LEGAL_OPTION, REG_LINK, REG_MULTI_SZ, REG_NONE, REG_NO_LAZY_FLUSH, REG_OPENED_EXISTING_KEY, REG_OPTION_BACKUP_RESTORE, REG_OPTION_CREATE_LINK, REG_OPTION_NON_VOLATILE, REG_OPTION_OPEN_LINK, REG_OPTION_RESERVED, REG_OPTION_VOLATILE, REG_QWORD, REG_QWORD_LITTLE_ENDIAN, REG_REFRESH_HIVE, REG_RESOURCE_LIST, REG_RESOURCE_REQUIREMENTS_LIST, REG_SZ, REG_WHOLE_HIVE_VOLATILE, STANDARD_RIGHTS_READ, STANDARD_RIGHTS_WRITE
Class Attribute Summary
- .win64? ⇒ Boolean readonly mod_func
Class Method Summary
- .check(result) mod_func
- CloseKey(hkey) mod_func
- CreateKey(hkey, name, opt, desired) mod_func
- DeleteKey(hkey, name) mod_func
- DeleteValue(hkey, name) mod_func
- EnumKey(hkey, index) mod_func
- EnumValue(hkey, index) mod_func
- FlushKey(hkey) mod_func
- .make_wstr(str) mod_func
- OpenKey(hkey, name, opt, desired) mod_func
- .packdw(dw) mod_func
- .packhandle(h) mod_func
- .packqw(qw) mod_func
- QueryInfoKey(hkey) mod_func
- QueryValue(hkey, name) mod_func
- SetValue(hkey, name, type, data, size) mod_func
- .unpackdw(dw) mod_func
- .unpackhandle(h) mod_func
- .unpackqw(qw) mod_func
Class Attribute Details
.win64? ⇒ Boolean
(readonly, mod_func)
[ GitHub ]
# File 'ext/win32/lib/win32/registry.rb', line 252
def win64? /^(?:x64|x86_64)/ =~ RUBY_PLATFORM end
Class Method Details
.check(result) (mod_func)
# File 'ext/win32/lib/win32/registry.rb', line 248
def check(result) raise Error, result, caller(1) if result != 0 end
CloseKey(hkey) (mod_func)
[ GitHub ]CreateKey(hkey, name, opt, desired) (mod_func)
[ GitHub ]# File 'ext/win32/lib/win32/registry.rb', line 292
def CreateKey(hkey, name, opt, desired) result = packhandle(0) disp = packdw(0) check RegCreateKeyExW.call(hkey, make_wstr(name), 0, 0, opt, desired, 0, result, disp) [ unpackhandle(result), unpackdw(disp) ] end
DeleteKey(hkey, name) (mod_func)
[ GitHub ]DeleteValue(hkey, name) (mod_func)
[ GitHub ]EnumKey(hkey, index) (mod_func)
[ GitHub ]# File 'ext/win32/lib/win32/registry.rb', line 307
def EnumKey(hkey, index) name = WCHAR_NUL * Constants::MAX_KEY_LENGTH size = packdw(Constants::MAX_KEY_LENGTH) wtime = ' ' * 8 check RegEnumKeyExW.call(hkey, index, name, size, 0, 0, 0, wtime) [ name.byteslice(0, unpackdw(size) * WCHAR_SIZE), unpackqw(wtime) ] end
EnumValue(hkey, index) (mod_func)
[ GitHub ]# File 'ext/win32/lib/win32/registry.rb', line 300
def EnumValue(hkey, index) name = WCHAR_NUL * Constants::MAX_KEY_LENGTH size = packdw(Constants::MAX_KEY_LENGTH) check RegEnumValueW.call(hkey, index, name, size, 0, 0, 0, 0) name.byteslice(0, unpackdw(size) * WCHAR_SIZE) end
FlushKey(hkey) (mod_func)
[ GitHub ].make_wstr(str) (mod_func)
[ GitHub ]# File 'ext/win32/lib/win32/registry.rb', line 282
def make_wstr(str) str.encode(WCHAR) end
OpenKey(hkey, name, opt, desired) (mod_func)
[ GitHub ]# File 'ext/win32/lib/win32/registry.rb', line 286
def OpenKey(hkey, name, opt, desired) result = packhandle(0) check RegOpenKeyExW.call(hkey, make_wstr(name), opt, desired, result) unpackhandle(result) end
.packdw(dw) (mod_func)
[ GitHub ]# File 'ext/win32/lib/win32/registry.rb', line 264
def packdw(dw) [dw].pack('V') end
.packhandle(h) (mod_func)
[ GitHub ].packqw(qw) (mod_func)
[ GitHub ]# File 'ext/win32/lib/win32/registry.rb', line 273
def packqw(qw) [ qw & 0xFFFFFFFF, qw >> 32 ].pack('VV') end
QueryInfoKey(hkey) (mod_func)
[ GitHub ]# File 'ext/win32/lib/win32/registry.rb', line 350
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
QueryValue(hkey, name) (mod_func)
[ GitHub ]# File 'ext/win32/lib/win32/registry.rb', line 315
def QueryValue(hkey, name) type = packdw(0) size = packdw(0) name = make_wstr(name) check RegQueryValueExW.call(hkey, name, 0, type, 0, size) data = "\0".force_encoding('ASCII-8BIT') * unpackdw(size) check RegQueryValueExW.call(hkey, name, 0, type, data, size) [ unpackdw(type), data[0, unpackdw(size)] ] end
SetValue(hkey, name, type, data, size) (mod_func)
[ GitHub ]# File 'ext/win32/lib/win32/registry.rb', line 325
def SetValue(hkey, name, type, data, size) case type when REG_SZ, REG_EXPAND_SZ, REG_MULTI_SZ data = data.encode(WCHAR) size ||= data.bytesize + WCHAR_SIZE end check RegSetValueExW.call(hkey, make_wstr(name), 0, type, data, size) end
.unpackdw(dw) (mod_func)
[ GitHub ]# File 'ext/win32/lib/win32/registry.rb', line 268
def unpackdw(dw) dw += [0].pack('V') dw.unpack('V')[0] end
.unpackhandle(h) (mod_func)
[ GitHub ].unpackqw(qw) (mod_func)
[ GitHub ]# File 'ext/win32/lib/win32/registry.rb', line 277
def unpackqw(qw) qw = qw.unpack('VV') (qw[1] << 32) | qw[0] end