Method: Win32Open4::Kernel32.raise_last_error!

Defined in:
lib/procreate/win32/open4.rb

.raise_last_error!Object



130
131
132
133
134
135
136
137
138
139
140
141
# File 'lib/procreate/win32/open4.rb', line 130

def raise_last_error!
  errorCode = GetLastError()
  if errorCode != ERROR_SUCCESS
    msg = ' ' * 255
    msgLength = FormatMessageA(FORMAT_MESSAGE_FROM_SYSTEM | FORMAT_MESSAGE_ARGUMENT_ARRAY, '', errorCode, 0, msg, 255, '')
    msg.delete! 0.chr
    msg.strip!
    raise Kernel32Error, msg
  else
    raise Kernel32Error, 'GetLastError returned ERROR_SUCCESS'
  end
end