Sha256: b0dce485de6d04fbffe9f3bcf7c44a1b04feb48e7543cd1ea9b3bf368a0af726
Contents?: true
Size: 724 Bytes
Versions: 1
Compression:
Stored size: 724 Bytes
Contents
require 'ffi' module Windows module Helper extend FFI::Library ffi_lib :kernel32 attach_function :FormatMessage, :FormatMessageA, [:ulong, :pointer, :ulong, :ulong, :pointer, :ulong, :pointer], :ulong def win_error(function, err=FFI.errno) flags = 0x00001000 | 0x00000200 buf = FFI::MemoryPointer.new(:char, 1024) FormatMessage(flags, nil, err , 0x0409, buf, 1024, nil) function + ': ' + buf.read_string.strip end def ole_error(function, err) regex = /OLE error code:(.*?)\sin/ match = regex.match(err.to_s) if match error = match.captures.first.hex win_error(function, error) else msg end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
win32-taskscheduler-0.3.0 | lib/win32/windows/helper.rb |