+#ifdef __WIN32__
+// ----------------------------------------------------------------------------
+// wxPipeStreams
+// ----------------------------------------------------------------------------
+
+class wxPipeInputStream: public wxInputStream {
+public:
+ wxPipeInputStream(HANDLE hInput);
+ ~wxPipeInputStream();
+
+protected:
+ size_t OnSysRead(void *buffer, size_t len);
+
+protected:
+ HANDLE m_hInput;
+};
+
+class wxPipeOutputStream: public wxOutputStream {
+public:
+ wxPipeOutputStream(HANDLE hOutput);
+ ~wxPipeOutputStream();
+
+protected:
+ size_t OnSysWrite(const void *buffer, size_t len);
+
+protected:
+ HANDLE m_hOutput;
+};
+
+// ==================
+// wxPipeInputStream
+// ==================
+
+wxPipeInputStream::wxPipeInputStream(HANDLE hInput)
+{
+ m_hInput = hInput;
+}
+
+wxPipeInputStream::~wxPipeInputStream()
+{
+ ::CloseHandle(m_hInput);
+}
+
+size_t wxPipeInputStream::OnSysRead(void *buffer, size_t len)
+{
+ DWORD bytesRead;
+
+ m_lasterror = wxSTREAM_NOERROR;
+ if (! ::ReadFile(m_hInput, buffer, len, &bytesRead, NULL) ) {
+ if (GetLastError() == ERROR_BROKEN_PIPE)
+ m_lasterror = wxSTREAM_EOF;
+ else
+ m_lasterror = wxSTREAM_READ_ERROR;
+ }
+ return bytesRead;
+}
+
+// ==================
+// wxPipeOutputStream
+// ==================
+
+wxPipeOutputStream::wxPipeOutputStream(HANDLE hOutput)
+{
+ m_hOutput = hOutput;
+}
+
+wxPipeOutputStream::~wxPipeOutputStream()
+{
+ ::CloseHandle(m_hOutput);
+}
+
+size_t wxPipeOutputStream::OnSysWrite(const void *buffer, size_t len)
+{
+ DWORD bytesRead;
+
+ m_lasterror = wxSTREAM_NOERROR;
+ if (! ::WriteFile(m_hOutput, buffer, len, &bytesRead, NULL) ) {
+ if (GetLastError() == ERROR_BROKEN_PIPE)
+ m_lasterror = wxSTREAM_EOF;
+ else
+ m_lasterror = wxSTREAM_READ_ERROR;
+ }
+ return bytesRead;
+}
+
+#endif // __WIN32__
+
+// ============================================================================
+// implementation
+// ============================================================================
+