Module: Win32::Registry::API
- Extended by:
- DL::Importer
- Defined in:
- win32/lib/win32/registry.rb
Overview
Constant Summary
Constants included
from DL
DL::ALIGN_CHAR, DL::ALIGN_DOUBLE, DL::ALIGN_FLOAT, DL::ALIGN_INT, DL::ALIGN_INTPTR_T, DL::ALIGN_LONG, DL::ALIGN_LONG_LONG, DL::ALIGN_PTRDIFF_T, DL::ALIGN_SHORT, DL::ALIGN_SIZE_T, DL::ALIGN_SSIZE_T, DL::ALIGN_UINTPTR_T, DL::ALIGN_VOIDP, DL::BUILD_RUBY_PLATFORM, DL::BUILD_RUBY_VERSION, DL::CdeclCallbackAddrs, DL::CdeclCallbackProcs, DL::DLSTACK_SIZE, DL::MAX_CALLBACK, DL::NULL, DL::RTLD_GLOBAL, DL::RTLD_LAZY, DL::RTLD_NOW, DL::RUBY_FREE, DL::SEM, DL::SIZEOF_CHAR, DL::SIZEOF_DOUBLE, DL::SIZEOF_FLOAT, DL::SIZEOF_INT, DL::SIZEOF_INTPTR_T, DL::SIZEOF_LONG, DL::SIZEOF_LONG_LONG, DL::SIZEOF_PTRDIFF_T, DL::SIZEOF_SHORT, DL::SIZEOF_SIZE_T, DL::SIZEOF_SSIZE_T, DL::SIZEOF_UINTPTR_T, DL::SIZEOF_VOIDP, DL::StdcallCallbackAddrs, DL::StdcallCallbackProcs, DL::TYPE_CHAR, DL::TYPE_DOUBLE, DL::TYPE_FLOAT, DL::TYPE_INT, DL::TYPE_INTPTR_T, DL::TYPE_LONG, DL::TYPE_LONG_LONG, DL::TYPE_PTRDIFF_T, DL::TYPE_SHORT, DL::TYPE_SIZE_T, DL::TYPE_SSIZE_T, DL::TYPE_UINTPTR_T, DL::TYPE_VOID, DL::TYPE_VOIDP
Class Method Summary
collapse
-
.check(result) ⇒ Object
-
.CloseKey(hkey) ⇒ Object
-
.CreateKey(hkey, name, opt, desired) ⇒ Object
-
.DeleteKey(hkey, name) ⇒ Object
-
.DeleteValue(hkey, name) ⇒ Object
-
.EnumKey(hkey, index) ⇒ Object
-
.EnumValue(hkey, index) ⇒ Object
-
.FlushKey(hkey) ⇒ Object
-
.OpenKey(hkey, name, opt, desired) ⇒ Object
-
.packdw(dw) ⇒ Object
-
.packqw(qw) ⇒ Object
-
.QueryInfoKey(hkey) ⇒ Object
-
.QueryValue(hkey, name) ⇒ Object
-
.SetValue(hkey, name, type, data, size) ⇒ Object
-
.unpackdw(dw) ⇒ Object
-
.unpackqw(qw) ⇒ Object
[], bind, bind_function, create_carried_function, create_temp_function, create_value, dlload, extern, handler, import_function, import_symbol, import_value, sizeof, struct, typealias, union
#parse_ctype, #parse_signature, #parse_struct_signature
Methods included from DL
dlopen, dlunwrap, dlwrap, fiddle?, free, malloc, realloc, #remove_callback_internal, #remove_cdecl_callback, #remove_stdcall_callback, #set_callback_internal, #set_cdecl_callback, #set_stdcall_callback
Class Method Details
.check(result) ⇒ Object
230
231
232
|
# File 'win32/lib/win32/registry.rb', line 230
def check(result)
raise Error, result, caller(2) if result != 0
end
|
.CloseKey(hkey) ⇒ Object
306
307
308
|
# File 'win32/lib/win32/registry.rb', line 306
def CloseKey(hkey)
check RegCloseKey.call(hkey)
end
|
.CreateKey(hkey, name, opt, desired) ⇒ Object
258
259
260
261
262
263
264
|
# File 'win32/lib/win32/registry.rb', line 258
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
|
.DeleteKey(hkey, name) ⇒ Object
298
299
300
|
# File 'win32/lib/win32/registry.rb', line 298
def DeleteKey(hkey, name)
check RegDeleteKey.call(hkey, name)
end
|
.DeleteValue(hkey, name) ⇒ Object
294
295
296
|
# File 'win32/lib/win32/registry.rb', line 294
def DeleteValue(hkey, name)
check RegDeleteValue.call(hkey, name)
end
|
.EnumKey(hkey, index) ⇒ Object
273
274
275
276
277
278
279
|
# File 'win32/lib/win32/registry.rb', line 273
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
|
.EnumValue(hkey, index) ⇒ Object
266
267
268
269
270
271
|
# File 'win32/lib/win32/registry.rb', line 266
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
|
.FlushKey(hkey) ⇒ Object
302
303
304
|
# File 'win32/lib/win32/registry.rb', line 302
def FlushKey(hkey)
check RegFlushKey.call(hkey)
end
|
.OpenKey(hkey, name, opt, desired) ⇒ Object
252
253
254
255
256
|
# File 'win32/lib/win32/registry.rb', line 252
def OpenKey(hkey, name, opt, desired)
result = packdw(0)
check RegOpenKeyExA.call(hkey, name, opt, desired, result)
unpackdw(result)
end
|
.packdw(dw) ⇒ Object
234
235
236
|
# File 'win32/lib/win32/registry.rb', line 234
def packdw(dw)
[dw].pack('V')
end
|
.packqw(qw) ⇒ Object
243
244
245
|
# File 'win32/lib/win32/registry.rb', line 243
def packqw(qw)
[ qw & 0xFFFFFFFF, qw >> 32 ].pack('VV')
end
|
.QueryInfoKey(hkey) ⇒ Object
310
311
312
313
314
315
316
317
318
319
320
321
322
323
|
# File 'win32/lib/win32/registry.rb', line 310
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) ⇒ Object
281
282
283
284
285
286
287
288
|
# File 'win32/lib/win32/registry.rb', line 281
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
|
.SetValue(hkey, name, type, data, size) ⇒ Object
290
291
292
|
# File 'win32/lib/win32/registry.rb', line 290
def SetValue(hkey, name, type, data, size)
check RegSetValueExA.call(hkey, name, 0, type, data, size)
end
|
.unpackdw(dw) ⇒ Object
238
239
240
241
|
# File 'win32/lib/win32/registry.rb', line 238
def unpackdw(dw)
dw += [0].pack('V')
dw.unpack('V')[0]
end
|
.unpackqw(qw) ⇒ Object
247
248
249
250
|
# File 'win32/lib/win32/registry.rb', line 247
def unpackqw(qw)
qw = qw.unpack('VV')
(qw[1] << 32) | qw[0]
end
|