Method deprecated or moved
This method is deprecated or moved on the latest stable version.
The last existing version (v3.0.9) is shown here.
lastWin32ErrorMessage()
public
Following code is based on David Garamond’s GUID library for Ruby.
# File activesupport/lib/active_support/secure_random.rb, line 186
def self.lastWin32ErrorMessage # :nodoc:
get_last_error = Win32API.new("kernel32", "GetLastError", '', 'L')
format_message = Win32API.new("kernel32", "FormatMessageA", 'LPLLPLPPPPPPPP', 'L')
format_message_ignore_inserts = 0x00000200
format_message_from_system = 0x00001000
code = get_last_error.call
msg = "\00"" * 1024
len = format_message.call(format_message_ignore_inserts + format_message_from_system, 0, code, 0, msg, 1024, nil, nil, nil, nil, nil, nil, nil, nil)
msg[0, len].tr("\r", '').chomp
end