class Net::SSH::Authentication::Pageant::Socket19
the DL module as well as other pointer transformations
Functionality is the same as Ruby 1.8 but it includes the new calls to
Socket changes for Ruby 1.9
def send_query(query)
process via the Windows messaging subsystem. The result is
Packages the given query string and sends it to the pageant
def send_query(query) res = nil filemap = 0 ptr = nil id = DL.malloc(DL::SIZEOF_LONG) mapname = "PageantRequest%08x\000" % Win.GetCurrentThreadId() filemap = Win.CreateFileMapping(Win::INVALID_HANDLE_VALUE, Win::NULL, Win::PAGE_READWRITE, 0, AGENT_MAX_MSGLEN, mapname) if filemap == 0 || filemap == Win::INVALID_HANDLE_VALUE raise Net::SSH::Exception, "Creation of file mapping failed" end ptr = Win.MapViewOfFile(filemap, Win::FILE_MAP_WRITE, 0, 0, 0) if ptr.nil? || ptr.null? raise Net::SSH::Exception, "Mapping of file failed" end DL::CPtr.new(ptr)[0,query.size]=query cds = DL::CPtr.to_ptr [AGENT_COPYDATA_ID, mapname.size + 1, mapname]. pack("LLp") succ = Win.SendMessageTimeout(@win, Win::WM_COPYDATA, Win::NULL, cds, Win::SMTO_NORMAL, 5000, id) if succ > 0 retlen = 4 + ptr.to_s(4).unpack("N")[0] res = ptr.to_s(retlen) end return res ensure Win.UnmapViewOfFile(ptr) unless ptr.nil? || ptr.null? Win.CloseHandle(filemap) if filemap != 0 end