MCPcopy Create free account
hub / github.com/SeleniumHQ/selenium / WriteBufferToPipe

Method WriteBufferToPipe

cpp/iedriver/HookProcessor.cpp:415–449  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

413}
414
415void HookProcessor::WriteBufferToPipe(const int process_id) {
416 std::wstring pipe_name = StringUtilities::Format(PIPE_NAME_TEMPLATE, process_id);
417 HANDLE pipe_handle = INVALID_HANDLE_VALUE;
418
419 // Create the named pipe handle. Retry up until a timeout to give
420 // the driver end of the pipe time to start listening for a connection.
421 BOOL is_pipe_available = ::WaitNamedPipe(pipe_name.c_str(),
422 PIPE_CONNECTION_TIMEOUT_IN_MILLISECONDS);
423 if (is_pipe_available) {
424 pipe_handle = ::CreateFile(pipe_name.c_str(),
425 GENERIC_READ | GENERIC_WRITE,
426 0,
427 NULL,
428 OPEN_EXISTING,
429 0,
430 NULL);
431 }
432
433 // if everything ok set mode to message mode
434 if (INVALID_HANDLE_VALUE != pipe_handle) {
435 DWORD pipe_mode = PIPE_READMODE_MESSAGE;
436 // if this fails bail out
437 if (::SetNamedPipeHandleState(pipe_handle, &pipe_mode, NULL, NULL)) {
438 unsigned long bytes_written = 0;
439 BOOL is_write_successful = ::WriteFile(pipe_handle,
440 GetDataBufferAddress(),
441 GetDataBufferSize(),
442 &bytes_written,
443 NULL);
444 ::FlushFileBuffers(pipe_handle);
445 ClearBuffer();
446 }
447 ::CloseHandle(pipe_handle);
448 }
449}
450
451} // namespace webdriver

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected