Exception: Win32::Registry::Error

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

Overview

Error

Defined Under Namespace

Modules: Kernel32

Constant Summary collapse

FormatMessageA =
Kernel32.extern "int FormatMessageA(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.



168
169
170
171
172
173
174
# File 'win32/lib/win32/registry.rb', line 168

def initialize(code)
  @code = code
  msg = "\0".force_encoding(Encoding::ASCII_8BIT) * 1024
  len = FormatMessageA.call(0x1200, 0, code, 0, msg, 1024, 0)
  msg = msg[0, len].force_encoding(Encoding.find(Encoding.locale_charmap))
  super msg.tr("\r", '').chomp
end

Instance Attribute Details

#codeObject (readonly)

Returns the value of attribute code



175
176
177
# File 'win32/lib/win32/registry.rb', line 175

def code
  @code
end