Exception: Win32::Registry::Error
- Inherits:
-
StandardError
- Object
- StandardError
- Win32::Registry::Error
- 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
-
#code ⇒ Object
readonly
Returns the value of attribute code.
Instance Method Summary collapse
-
#initialize(code) ⇒ Error
constructor
A new instance of Error.
Constructor Details
#initialize(code) ⇒ Error
Returns a new instance of Error.
175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 |
# File 'lib/win32/registry.rb', line 175 def initialize(code) @code = code buff = WCHAR_NUL * 1024 lang = 0 begin len = FormatMessageW.call(0x1200, 0, code, lang, buff, 1024, 0) msg = buff.byteslice(0, len * WCHAR_SIZE) msg.delete!(WCHAR_CR) msg.chomp! msg.encode!(LOCALE) rescue EncodingError raise unless lang == 0 lang = 0x0409 # en_US retry end super msg end |
Instance Attribute Details
#code ⇒ Object (readonly)
Returns the value of attribute code
192 193 194 |
# File 'lib/win32/registry.rb', line 192 def code @code end |