summaryrefslogtreecommitdiff
path: root/winpipes.cpp
diff options
context:
space:
mode:
authorJeffrey Walton <noloader@gmail.com>2016-05-03 00:23:05 -0400
committerJeffrey Walton <noloader@gmail.com>2016-05-09 03:07:57 -0400
commitd294b4290b997f174ade322a9638db2f1e15ed41 (patch)
tree9c8faf70d56d2be3c5fb0a7c040ca652e8c69e5a /winpipes.cpp
parent69f7802b53dfbc7ac9aacbaff02b45d6582aad3d (diff)
downloadcryptopp-git-d294b4290b997f174ade322a9638db2f1e15ed41.tar.gz
Add changes for Windows Sotre that went missing with my clumsy Git skills
Diffstat (limited to 'winpipes.cpp')
-rw-r--r--winpipes.cpp26
1 files changed, 19 insertions, 7 deletions
diff --git a/winpipes.cpp b/winpipes.cpp
index 66725a2f..0b4846d0 100644
--- a/winpipes.cpp
+++ b/winpipes.cpp
@@ -1,16 +1,19 @@
// winpipes.cpp - written and placed in the public domain by Wei Dai
#include "pch.h"
-#include "winpipes.h"
+#include "config.h"
-#ifdef WINDOWS_PIPES_AVAILABLE
+#if !defined(NO_OS_DEPENDENCE) && defined(WINDOWS_PIPES_AVAILABLE)
+#include "winpipes.h"
#include "wait.h"
-// Windows 8, Windows Server 2012, and Windows Phone 8.1 need <synchapi.h>
+// Windows 8, Windows Server 2012, and Windows Phone 8.1 need <synchapi.h> and <ioapiset.h>
#if defined(CRYPTOPP_WIN32_AVAILABLE)
-# if defined(_WIN32_WINNT_WIN8) && ((WINVER >= _WIN32_WINNT_WIN8) || (_WIN32_WINNT >= _WIN32_WINNT_WIN8))
+# if ((WINVER >= 0x0602 /*_WIN32_WINNT_WIN8*/) || (_WIN32_WINNT >= 0x0602 /*_WIN32_WINNT_WIN8*/))
# include <synchapi.h>
+# include <ioapiset.h>
+# define USE_WINDOWS8_API
# endif
#endif
@@ -135,8 +138,12 @@ unsigned int WindowsPipeReceiver::GetReceiveResult()
{
if (m_resultPending)
{
- const HANDLE h = GetHandle();
- if (GetOverlappedResult(h, &m_overlapped, &m_lastResult, false))
+#if defined(USE_WINDOWS8_API)
+ BOOL result = GetOverlappedResultEx(GetHandle(), &m_overlapped, &m_lastResult, INFINITE, FALSE);
+#else
+ BOOL result = GetOverlappedResult(GetHandle(), &m_overlapped, &m_lastResult, FALSE);
+#endif
+ if (result)
{
if (m_lastResult == 0)
m_eofReceived = true;
@@ -201,8 +208,13 @@ unsigned int WindowsPipeSender::GetSendResult()
if (m_resultPending)
{
const HANDLE h = GetHandle();
- BOOL result = GetOverlappedResult(h, &m_overlapped, &m_lastResult, false);
+#if defined(USE_WINDOWS8_API)
+ BOOL result = GetOverlappedResultEx(h, &m_overlapped, &m_lastResult, INFINITE, FALSE);
+ CheckAndHandleError("GetOverlappedResultEx", result);
+#else
+ BOOL result = GetOverlappedResult(h, &m_overlapped, &m_lastResult, FALSE);
CheckAndHandleError("GetOverlappedResult", result);
+#endif
m_resultPending = false;
}
return m_lastResult;