Skip to content

Commit

Permalink
Need using Fiddler on Ruby 2.1 and must using, other will break due to
Browse files Browse the repository at this point in the history
  • Loading branch information
Eric-Guo committed Aug 4, 2015
1 parent 0fe4e0f commit 182ebdf
Showing 1 changed file with 12 additions and 12 deletions.
24 changes: 12 additions & 12 deletions lib/net/ssh/authentication/pageant.rb
@@ -1,7 +1,7 @@
if RUBY_VERSION < "1.9"
require 'dl/import'
require 'dl/struct'
elsif RUBY_VERSION < "2.2"
elsif RUBY_VERSION < "2.1"
require 'dl/import'
require 'dl/types'
require 'dl'
Expand Down Expand Up @@ -46,7 +46,7 @@ module Win
dlload 'advapi32'

SIZEOF_DWORD = DL.sizeof('L')
elsif RUBY_VERSION < "2.2"
elsif RUBY_VERSION < "2.1"
extend DL::Importer
dlload 'user32','kernel32', 'advapi32'
include DL::Win32Types
Expand Down Expand Up @@ -88,7 +88,7 @@ module Win
extern 'HANDLE CreateFileMapping(HANDLE, void *, DWORD, ' +
'DWORD, DWORD, LPCTSTR)'

# args: hFileMappingObject, dwDesiredAccess, dwFileOffsetHigh,
# args: hFileMappingObject, dwDesiredAccess, dwFileOffsetHigh,
# dwfileOffsetLow, dwNumberOfBytesToMap
extern 'LPVOID MapViewOfFile(HANDLE, DWORD, DWORD, DWORD, DWORD)'

Expand All @@ -101,7 +101,7 @@ module Win
# args: hWnd, Msg, wParam, lParam, fuFlags, uTimeout, lpdwResult
extern 'LRESULT SendMessageTimeout(HWND, UINT, WPARAM, LPARAM, ' +
'UINT, UINT, PDWORD_PTR)'

# args: none
extern 'DWORD GetLastError()'

Expand All @@ -127,8 +127,8 @@ module Win
extern 'BOOL IsValidSecurityDescriptor(LPVOID)'

# Constants needed for security attribute retrieval.
# Specifies the access mask corresponding to the desired access
# rights.
# Specifies the access mask corresponding to the desired access
# rights.
TOKEN_QUERY = 0x8

# The value of TOKEN_USER from the TOKEN_INFORMATION_CLASS enum.
Expand Down Expand Up @@ -295,7 +295,7 @@ def self.open(location=nil)
new
end

# Create a new instance that communicates with the running pageant
# Create a new instance that communicates with the running pageant
# instance. If no such instance is running, this will cause an error.
def initialize
@win = Win.FindWindow("Pageant", "Pageant")
Expand All @@ -313,20 +313,20 @@ def initialize
# the first.
def send(data, *args)
@input_buffer.append(data)

ret = data.length

while true
return ret if @input_buffer.length < 4
msg_length = @input_buffer.read_long + 4
@input_buffer.reset!

return ret if @input_buffer.length < msg_length
msg = @input_buffer.read!(msg_length)
@output_buffer.append(send_query(msg))
end
end

# Reads +n+ bytes from the cached result of the last query. If +n+
# is +nil+, returns all remaining data from the last query.
def read(n = nil)
Expand Down Expand Up @@ -358,7 +358,7 @@ def send_query(query)
"Creation of file mapping failed with error: #{Win.GetLastError}"
end

ptr = Win.MapViewOfFile(filemap, Win::FILE_MAP_WRITE, 0, 0,
ptr = Win.MapViewOfFile(filemap, Win::FILE_MAP_WRITE, 0, 0,
0)

if ptr.nil? || ptr.null?
Expand Down

0 comments on commit 182ebdf

Please sign in to comment.