Exception: Win32::Registry::Error

Inherits:
StandardError
  • Object
show all
Defined in:
lib/win32/registry.rb

Overview

Error

Defined Under Namespace

Modules: Kernel32

Constant Summary collapse

FormatMessageW =
Kernel32.extern "int FormatMessageW(int, void *, int, int, void *, int, void *)", :stdcall

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(code) ⇒ Error

Returns a new instance of Error



174
175
176
177
178
179
180
# File 'lib/win32/registry.rb', line 174

def initialize(code)
  @code = code
  msg = WCHAR_NUL * 1024
  len = FormatMessageW.call(0x1200, 0, code, 0, msg, 1024, 0)
  msg = msg[0, len].encode(LOCALE)
  super msg.tr("\r".encode(msg.encoding), '').chomp
end

Instance Attribute Details

#codeObject (readonly)

Returns the value of attribute code



181
182
183
# File 'lib/win32/registry.rb', line 181

def code
  @code
end