The debugserver also needs FILE_FLAG_FIRST_PIPE_INSTANCE now.

This commit is contained in:
Ryan Prichard 2016-01-17 17:01:15 -06:00
parent 413f17a81e
commit 834195074a
5 changed files with 12 additions and 15 deletions

View File

@ -43,12 +43,6 @@
#include "Terminal.h"
#include "Win32Console.h"
// Work around a bug with mingw-gcc-g++. mingw-w64 is unaffected. See
// GitHub issue 27.
#ifndef FILE_FLAG_FIRST_PIPE_INSTANCE
#define FILE_FLAG_FIRST_PIPE_INSTANCE 0x00080000
#endif
const int SC_CONSOLE_MARK = 0xFFF2;
const int SC_CONSOLE_SELECT_ALL = 0xFFF5;
@ -255,7 +249,7 @@ NamedPipe *Agent::makeDataPipe(bool write)
<< m_genRandom.uniqueName()).str_moved();
const DWORD openMode =
(write ? PIPE_ACCESS_OUTBOUND : PIPE_ACCESS_INBOUND)
| FILE_FLAG_FIRST_PIPE_INSTANCE
| kFILE_FLAG_FIRST_PIPE_INSTANCE
| FILE_FLAG_OVERLAPPED;
const auto sd = createPipeSecurityDescriptorOwnerFullControl();
ASSERT(sd && "error creating data pipe SECURITY_DESCRIPTOR");

View File

@ -77,7 +77,7 @@ int main(int argc, char *argv[]) {
HANDLE serverPipe = CreateNamedPipeW(
kPipeName,
/*dwOpenMode=*/PIPE_ACCESS_DUPLEX | FILE_FLAG_FIRST_PIPE_INSTANCE,
/*dwOpenMode=*/PIPE_ACCESS_DUPLEX | kFILE_FLAG_FIRST_PIPE_INSTANCE,
/*dwPipeMode=*/PIPE_TYPE_MESSAGE | PIPE_READMODE_MESSAGE |
rejectRemoteClientsPipeFlag(),
/*nMaxInstances=*/1,

View File

@ -47,12 +47,6 @@
using namespace libwinpty;
using namespace winpty_shared;
// Work around a bug with mingw-gcc-g++. mingw-w64 is unaffected. See
// GitHub issue 27.
#ifndef FILE_FLAG_FIRST_PIPE_INSTANCE
#define FILE_FLAG_FIRST_PIPE_INSTANCE 0x00080000
#endif
#define AGENT_EXE L"winpty-agent.exe"
@ -327,7 +321,7 @@ static OwnedHandle createControlPipe(const std::wstring &name) {
HANDLE ret = CreateNamedPipeW(name.c_str(),
/*dwOpenMode=*/
PIPE_ACCESS_DUPLEX |
FILE_FLAG_FIRST_PIPE_INSTANCE |
kFILE_FLAG_FIRST_PIPE_INSTANCE |
FILE_FLAG_OVERLAPPED,
/*dwPipeMode=*/rejectRemoteClientsPipeFlag(),
/*nMaxInstances=*/1,

View File

@ -31,6 +31,13 @@
namespace winpty_shared {
// Work around a bug with mingw-gcc-g++. mingw-w64 is unaffected. See
// GitHub issue 27. There was a typo in the MinGW's headers that was fixed
// on 2013-09-18 [1]. As of January 2016, the fix has *still* not made it
// into Cygwin's MinGW toolchain.
// [1] http://sourceforge.net/p/mingw/bugs/2050/
const DWORD kFILE_FLAG_FIRST_PIPE_INSTANCE = 0x00080000;
struct LocalFreer {
void operator()(void *ptr) {
if (ptr != nullptr) {

View File

@ -54,7 +54,9 @@
#define WINPTY_SNPRINTF_H
#include <stdarg.h>
#include <stdio.h>
#include <stdlib.h>
#include <wchar.h>
// 64-bit format strings.