Remove data pipe names from winpty_open

This commit is contained in:
Peter Sunde 2012-12-17 13:33:32 +01:00
parent 5363fb6c21
commit 747a5401e8
2 changed files with 6 additions and 9 deletions

View File

@ -47,7 +47,7 @@ typedef struct winpty_s winpty_t;
* *
* This function creates a new agent process and connects to it. * This function creates a new agent process and connects to it.
*/ */
WINPTY_API winpty_t *winpty_open(int cols, int rows, const char *controlPipe, const char *dataPipe); WINPTY_API winpty_t *winpty_open(int cols, int rows);
/* /*
* Start a child process. Either (but not both) of appname and cmdline may * Start a child process. Either (but not both) of appname and cmdline may

View File

@ -253,8 +253,7 @@ static void startAgentProcess(const BackgroundDesktop &desktop,
CloseHandle(pi.hThread); CloseHandle(pi.hThread);
} }
WINPTY_API winpty_t *winpty_open(int cols, int rows, std::wstring &controlPipeName, WINPTY_API winpty_t *winpty_open(int cols, int rows)
std::wstring &dataPipeName)
{ {
winpty_t *pc = new winpty_t; winpty_t *pc = new winpty_t;
@ -262,12 +261,10 @@ WINPTY_API winpty_t *winpty_open(int cols, int rows, std::wstring &controlPipeNa
std::wstringstream pipeName; std::wstringstream pipeName;
// Allow custom pipe names. // Allow custom pipe names.
if(controlPipeName.empty() && dataPipeName.empty()) { pipeName << L"\\\\.\\pipe\\winpty-" << GetCurrentProcessId()
pipeName << L"\\\\.\\pipe\\winpty-" << GetCurrentProcessId() << L"-" << InterlockedIncrement(&consoleCounter);
<< L"-" << InterlockedIncrement(&consoleCounter); std::wstring controlPipeName = pipeName.str() + L"-control";
std::wstring controlPipeName = pipeName.str() + L"-control"; std::wstring dataPipeName = pipeName.str() + L"-data";
std::wstring dataPipeName = pipeName.str() + L"-data";
}
pc->controlPipe = createNamedPipe(controlPipeName, false); pc->controlPipe = createNamedPipe(controlPipeName, false);
if (pc->controlPipe == INVALID_HANDLE_VALUE) { if (pc->controlPipe == INVALID_HANDLE_VALUE) {