THRIFT-2873 Make TPipe and TPipeServer working with unicode on windows
Signed-off-by: Pascal Bach <pascal.bach@siemens.com>
diff --git a/lib/cpp/src/thrift/transport/TPipe.cpp b/lib/cpp/src/thrift/transport/TPipe.cpp
index 15e4845..4f3eca0 100644
--- a/lib/cpp/src/thrift/transport/TPipe.cpp
+++ b/lib/cpp/src/thrift/transport/TPipe.cpp
@@ -262,7 +262,7 @@
TAutoHandle hPipe;
do {
DWORD flags = FILE_FLAG_OVERLAPPED; // async mode, so we can do reads at the same time as writes
- hPipe.reset(CreateFile(pipename_.c_str(),
+ hPipe.reset(CreateFileA(pipename_.c_str(),
GENERIC_READ | GENERIC_WRITE,
0, // no sharing
NULL, // default security attributes
@@ -277,7 +277,7 @@
GlobalOutput.perror("TPipe::open ::CreateFile errored GLE=", ::GetLastError());
throw TTransportException(TTransportException::NOT_OPEN, "Unable to open pipe");
}
- } while (::WaitNamedPipe(pipename_.c_str(), TimeoutSeconds_ * 1000));
+ } while (::WaitNamedPipeA(pipename_.c_str(), TimeoutSeconds_ * 1000));
if (hPipe.h == INVALID_HANDLE_VALUE) {
GlobalOutput.perror("TPipe::open ::CreateFile errored GLE=", ::GetLastError());
diff --git a/lib/cpp/src/thrift/transport/TPipeServer.cpp b/lib/cpp/src/thrift/transport/TPipeServer.cpp
index a8e72d0..9ea5d50 100644
--- a/lib/cpp/src/thrift/transport/TPipeServer.cpp
+++ b/lib/cpp/src/thrift/transport/TPipeServer.cpp
@@ -323,7 +323,7 @@
ea.grfInheritance = NO_INHERITANCE;
ea.Trustee.TrusteeForm = TRUSTEE_IS_SID;
ea.Trustee.TrusteeType = TRUSTEE_IS_WELL_KNOWN_GROUP;
- ea.Trustee.ptstrName = (LPSTR)everyone_sid;
+ ea.Trustee.ptstrName = static_cast<LPTSTR>(everyone_sid);
PACL acl = NULL;
SetEntriesInAcl(1, &ea, NULL, &acl);
@@ -338,7 +338,7 @@
sa.bInheritHandle = FALSE;
// Create an instance of the named pipe
- TAutoHandle hPipe(CreateNamedPipe(pipename_.c_str(), // pipe name
+ TAutoHandle hPipe(CreateNamedPipeA(pipename_.c_str(), // pipe name
PIPE_ACCESS_DUPLEX | // read/write access
FILE_FLAG_OVERLAPPED, // async mode
PIPE_TYPE_BYTE | // byte type pipe