Method: QDA::Filters::Win32Process.create_pipe

Defined in:
lib/openc3/win32/win32.rb

.create_pipeObject

returns read and write handle



206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
# File 'lib/openc3/win32/win32.rb', line 206

def create_pipe # returns read and write handle
  params = [
    'P', # pointer to read handle
    'P', # pointer to write handle
    'P', # pointer to security attributes
    'L'
  ] # pipe size

  createPipe = OpenC3::Win32API.new("kernel32", "CreatePipe", params, 'I')

  read_handle, write_handle = [0].pack('I'), [0].pack('I')
  sec_attrs = [SECURITY_ATTRIBUTES_SIZE, 0, 1].pack('III')

  raise_last_win_32_error if createPipe.Call(read_handle,
                                             write_handle, sec_attrs, 0).zero?

  [read_handle.unpack('I')[0], write_handle.unpack('I')[0]]
end