summaryrefslogtreecommitdiffstats
path: root/src/corelib/io
diff options
context:
space:
mode:
authorJoerg Bornemann <joerg.bornemann@nokia.com>2012-02-20 12:31:37 +0100
committerQt by Nokia <qt-info@nokia.com>2012-02-20 13:28:34 +0100
commitf8d6a164deeee500556b78a72f744ac5bce2226f (patch)
tree73d3e269ea132e3ea7ae641ca847015c0155f270 /src/corelib/io
parent4816c42115af62c500ff9825f8b5ea1d1515792f (diff)
fix QProcess for Windows XP
CreateNamedPipe supports the flag PIPE_REJECT_REMOTE_CLIENTS since Windows Vista. On earlier Windows versions the system call would fail with ERROR_INVALID_PARAMETER. This does not open a security hole on Windows XP as there can be only one pipe instance. Change-Id: I5a1c7fdf756678009857317c7b563c884afeef2c Reviewed-by: Friedemann Kleint <Friedemann.Kleint@nokia.com>
Diffstat (limited to 'src/corelib/io')
-rw-r--r--src/corelib/io/qprocess_win.cpp5
1 files changed, 4 insertions, 1 deletions
diff --git a/src/corelib/io/qprocess_win.cpp b/src/corelib/io/qprocess_win.cpp
index 51f34a61a6..a52fd46c97 100644
--- a/src/corelib/io/qprocess_win.cpp
+++ b/src/corelib/io/qprocess_win.cpp
@@ -85,10 +85,13 @@ static void qt_create_pipe(Q_PIPE *pipe, bool isInputPipe)
// ### Replace the call to qrand() with a secure version, once we have it in Qt.
swprintf(pipeName, L"\\\\.\\pipe\\qt-%X", qrand());
+ DWORD dwPipeFlags = PIPE_TYPE_BYTE | PIPE_WAIT;
+ if (QSysInfo::windowsVersion() >= QSysInfo::WV_VISTA)
+ dwPipeFlags |= PIPE_REJECT_REMOTE_CLIENTS;
const DWORD dwPipeBufferSize = 1024 * 1024;
hRead = CreateNamedPipe(pipeName,
PIPE_ACCESS_INBOUND | FILE_FLAG_OVERLAPPED,
- PIPE_TYPE_BYTE | PIPE_WAIT | PIPE_REJECT_REMOTE_CLIENTS,
+ dwPipeFlags,
1, // only one pipe instance
0, // output buffer size
dwPipeBufferSize, // input buffer size