private Method

SecretKeyGenerator.lastWin32ErrorMessage

There's no documentation for this item.

Source Code

# File rails_generator/secret_key_generator.rb, line 107
def lastWin32ErrorMessage
  # Following code is based on David Garamond's GUID library for Ruby.
  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 = "\0" * 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
Comments

Have your say
Please use Textile formatting (click here for a cheat sheet). Use <code/> and <pre/> for code samples.
Click here to login with OpenID to to post comments.