Method: Spider::SecureRandom.lastWin32ErrorMessage
- Defined in:
- lib/spiderfw/utils/secure_random.rb
.lastWin32ErrorMessage ⇒ Object
Following code is based on David Garamond’s GUID library for Ruby.
210 211 212 213 214 215 216 217 218 219 220 |
# File 'lib/spiderfw/utils/secure_random.rb', line 210 def self.lastWin32ErrorMessage # :nodoc: get_last_error = Win32API.new("kernel32", "GetLastError", '', 'L') = Win32API.new("kernel32", "FormatMessageA", 'LPLLPLPPPPPPPP', 'L') = 0x00000200 = 0x00001000 code = get_last_error.call msg = "\0" * 1024 len = .call( + , 0, code, 0, msg, 1024, nil, nil, nil, nil, nil, nil, nil, nil) msg[0, len].tr("\r", '').chomp end |