summaryrefslogtreecommitdiffstatshomepage
path: root/src/osd/modules/file/winptty.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/osd/modules/file/winptty.cpp')
-rw-r--r--src/osd/modules/file/winptty.cpp13
1 files changed, 11 insertions, 2 deletions
diff --git a/src/osd/modules/file/winptty.cpp b/src/osd/modules/file/winptty.cpp
index ab0efae37ff..943f1fbaa52 100644
--- a/src/osd/modules/file/winptty.cpp
+++ b/src/osd/modules/file/winptty.cpp
@@ -88,10 +88,19 @@ osd_file::error win_open_ptty(std::string const &path, std::uint32_t openflags,
{
osd::text::tstring t_name = osd::text::to_tstring(path);
- HANDLE pipe = CreateNamedPipe(t_name.c_str(), PIPE_ACCESS_DUPLEX, PIPE_TYPE_BYTE | PIPE_READMODE_BYTE | PIPE_NOWAIT, 1, 32, 32, 0, nullptr);
+ HANDLE pipe = CreateFileW(t_name.c_str(), GENERIC_READ | GENERIC_WRITE, 0, nullptr, OPEN_EXISTING, 0, nullptr);
if (INVALID_HANDLE_VALUE == pipe)
- return osd_file::error::ACCESS_DENIED;
+ {
+ pipe = CreateNamedPipe(t_name.c_str(), PIPE_ACCESS_DUPLEX, PIPE_TYPE_BYTE | PIPE_READMODE_BYTE | PIPE_NOWAIT, 1, 32, 32, 0, nullptr);
+ if (INVALID_HANDLE_VALUE == pipe)
+ return osd_file::error::ACCESS_DENIED;
+ }
+ else
+ {
+ DWORD state = PIPE_NOWAIT;
+ SetNamedPipeHandleState(pipe, &state, NULL, NULL);
+ }
try
{