Exception: Win32::Registry::Error
| Relationships & Source Files | |
| Namespace Children | |
|
Modules:
| |
| Super Chains via Extension / Inclusion / Inheritance | |
|
Class Chain:
self,
StandardError
|
|
|
Instance Chain:
self,
StandardError
|
|
| Inherits: |
StandardError
|
| Defined in: | ext/win32/lib/win32/registry.rb |
Overview
Error
Constant Summary
-
FormatMessageW =
Internal use only
# File 'ext/win32/lib/win32/registry.rb', line 168Kernel32.extern "int FormatMessageW(int, void *, int, int, void *, int, void *)", :stdcall
Class Method Summary
-
.new(code) ⇒ Error
constructor
new(code) -> error object.
Instance Attribute Summary
Constructor Details
.new(code) ⇒ Error
[ GitHub ]
# File 'ext/win32/lib/win32/registry.rb', line 174
def initialize(code) @code = code buff = WCHAR_NUL * 1024 lang = 0 begin len = FormatMessageW.call(0x1200, nil, code, lang, buff, 1024, nil) 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 (readonly)
::Win32 API error code.
# File 'ext/win32/lib/win32/registry.rb', line 193
attr_reader :code