Module: Windows::Functions

Extended by:
FFI::Library
Included in:
Win32::ChangeNotify, Win32::ChangeNotify
Defined in:
lib/win32/changenotify/functions.rb

Class Method Summary collapse

Class Method Details

.raise_windows_error(function, err = FFI.errno) ⇒ Object

Shortcut for win_error with raise builtin

Raises:

  • (SystemCallError)


53
54
55
# File 'lib/win32/changenotify/functions.rb', line 53

def raise_windows_error(function, err=FFI.errno)
  raise SystemCallError.new(win_error(function, err), err)
end

.win_error(function, err = FFI.errno) ⇒ Object

Returns a nicer Windows error message



43
44
45
46
47
48
49
50
# File 'lib/win32/changenotify/functions.rb', line 43

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