send_query (Net::SSH::Authentication::Pageant::Socket)

         # File lib/net/ssh/authentication/pageant.rb, line 111
    111:       def send_query(query)
    112:         res = nil
    113:         filemap = 0
    114:         ptr = nil
    115:         id = DL::PtrData.malloc(DL.sizeof("L"))
    116:
    117:         mapname = "PageantRequest%08x\000" % Win.getCurrentThreadId()
    118:         filemap = Win.createFileMapping(Win::INVALID_HANDLE_VALUE,
    119:                                         Win::NULL,
    120:                                         Win::PAGE_READWRITE, 0,
    121:                                         AGENT_MAX_MSGLEN, mapname)
    122:         if filemap == 0
    123:           raise Net::SSH::Exception,
    124:             "Creation of file mapping failed"
    125:         end
    126:
    127:         ptr = Win.mapViewOfFile(filemap, Win::FILE_MAP_WRITE, 0, 0,
    128:                                 AGENT_MAX_MSGLEN)
    129:
    130:         if ptr.nil? || ptr.null?
    131:           raise Net::SSH::Exception, "Mapping of file failed"
    132:         end
    133:
    134:         ptr[0] = query
    135:
    136:         cds = [AGENT_COPYDATA_ID, mapname.size + 1, mapname].
    137:           pack("LLp").to_ptr
    138:         succ = Win.sendMessageTimeout(@win, Win::WM_COPYDATA, Win::NULL,
    139:           cds, Win::SMTO_NORMAL, 5000, id)
    140:
    141:         if succ > 0
    142:           retlen = 4 + ptr.to_s(4).unpack("N")[0]
    143:           res = ptr.to_s(retlen)
    144:         end
    145:
    146:         return res
    147:       ensure
    148:         Win.unmapViewOfFile(ptr) unless ptr.nil? || ptr.null?
    149:         Win.closeHandle(filemap) if filemap != 0
    150:       end