Files
UnrealEngineUWP/Engine/Source/Developer/Windows/LiveCoding/Private/External/LC_DuplexPipeClient.cpp
Rolando Caloca 532adaa65c DR - Merging //UE4/Dev-Main@5531558 to Dev-Rendering (//UE4/Dev-Rendering)
#rb none
#rnx

[CL 5591014 by Rolando Caloca in Dev-Rendering branch]
2019-03-27 11:33:31 -04:00

36 lines
749 B
C++

// Copyright 2011-2019 Molecular Matters GmbH, all rights reserved.
#include "LC_DuplexPipeClient.h"
#include "LC_Logging.h"
bool DuplexPipeClient::Connect(const wchar_t* name)
{
m_pipe = ::CreateFile(
name,
GENERIC_READ | GENERIC_WRITE,
0,
NULL,
OPEN_EXISTING,
0,
NULL);
if (m_pipe == INVALID_HANDLE_VALUE)
{
const DWORD error = ::GetLastError();
LC_ERROR_USER("Error 0x%X while trying to connect to named pipe", error);
return false;
}
DWORD mode = PIPE_READMODE_MESSAGE;
const BOOL success = ::SetNamedPipeHandleState(m_pipe, &mode, NULL, NULL);
if (!success)
{
const DWORD error = ::GetLastError();
LC_ERROR_USER("Error 0x%X while trying to set named pipe state", error);
return false;
}
return true;
}