[ofw] [PATCH] WV: Fix GetOverlappedResults methods

Fab Tillier ftillier at windows.microsoft.com
Mon Feb 23 11:58:58 PST 2009


The GetOverlappedResults methods are supposed to return an HRESULT, but are returning a BOOL. This makes GetOverlappedResults return WV_SUCCESS when the underlying ::GetOverlappedResults failed.

This patch returns the NTSTATUS results (not the Win32 conversion thereof) so that the WV_STATUS values are returned (since these map to NTSTATUS values.)

Signed-off-by: Fab Tillier <ftillier at microsoft.com>

Index: core/winverbs/user/wv_device.cpp
===================================================================
--- core/winverbs/user/wv_device.cpp    (revision 1978)
+++ core/winverbs/user/wv_device.cpp    (working copy)
@@ -181,8 +181,9 @@ STDMETHODIMP CWVDevice::
 GetOverlappedResult(OVERLAPPED *pOverlapped,
                                        DWORD *pNumberOfBytesTransferred, BOOL bWait)
 {
-       return ::GetOverlappedResult(m_hFile, pOverlapped,
+       ::GetOverlappedResult(m_hFile, pOverlapped,
                                                                 pNumberOfBytesTransferred, bWait);
+       return (HRESULT)pOverlapped->Internal;
 }

 STDMETHODIMP CWVDevice::
Index: core/winverbs/user/wv_cq.cpp
===================================================================
--- core/winverbs/user/wv_cq.cpp        (revision 1978)
+++ core/winverbs/user/wv_cq.cpp        (working copy)
@@ -148,8 +148,9 @@ STDMETHODIMP CWVCompletionQueue::
 GetOverlappedResult(OVERLAPPED *pOverlapped,
                                        DWORD *pNumberOfBytesTransferred, BOOL bWait)
 {
-       return ::GetOverlappedResult(m_hFile, pOverlapped,
+       ::GetOverlappedResult(m_hFile, pOverlapped,
                                                                 pNumberOfBytesTransferred, bWait);
+       return (HRESULT)pOverlapped->Internal;
 }

 STDMETHODIMP CWVCompletionQueue::
Index: core/winverbs/user/wv_ep.cpp
===================================================================
--- core/winverbs/user/wv_ep.cpp        (revision 1978)
+++ core/winverbs/user/wv_ep.cpp        (working copy)
@@ -125,8 +125,9 @@ STDMETHODIMP CWVConnectEndpoint::
 GetOverlappedResult(OVERLAPPED *pOverlapped,
                                        DWORD *pNumberOfBytesTransferred, BOOL bWait)
 {
-       return ::GetOverlappedResult(m_hFile, pOverlapped,
+       ::GetOverlappedResult(m_hFile, pOverlapped,
                                                                 pNumberOfBytesTransferred, bWait);
+       return (HRESULT)pOverlapped->Internal;
 }

 STDMETHODIMP CWVConnectEndpoint::
@@ -473,8 +474,9 @@ STDMETHODIMP CWVDatagramEndpoint::
 GetOverlappedResult(OVERLAPPED *pOverlapped,
                                        DWORD *pNumberOfBytesTransferred, BOOL bWait)
 {
-       return ::GetOverlappedResult(m_hFile, pOverlapped,
+       ::GetOverlappedResult(m_hFile, pOverlapped,
                                                                 pNumberOfBytesTransferred, bWait);
+       return (HRESULT)pOverlapped->Internal;
 }

 STDMETHODIMP CWVDatagramEndpoint::
Index: core/winverbs/user/wv_srq.cpp
===================================================================
--- core/winverbs/user/wv_srq.cpp       (revision 1978)
+++ core/winverbs/user/wv_srq.cpp       (working copy)
@@ -152,8 +152,9 @@ STDMETHODIMP CWVSharedReceiveQueue::
 GetOverlappedResult(OVERLAPPED *pOverlapped,
                                        DWORD *pNumberOfBytesTransferred, BOOL bWait)
 {
-       return ::GetOverlappedResult(m_hFile, pOverlapped,
+       ::GetOverlappedResult(m_hFile, pOverlapped,
                                                                 pNumberOfBytesTransferred, bWait);
+       return (HRESULT)pOverlapped->Internal;
 }

 STDMETHODIMP CWVSharedReceiveQueue::
Index: core/winverbs/user/wv_qp.cpp
===================================================================
--- core/winverbs/user/wv_qp.cpp        (revision 1978)
+++ core/winverbs/user/wv_qp.cpp        (working copy)
@@ -349,8 +349,9 @@ STDMETHODIMP CWVQueuePair::
 GetOverlappedResult(OVERLAPPED *pOverlapped,
                                        DWORD *pNumberOfBytesTransferred, BOOL bWait)
 {
-       return ::GetOverlappedResult(m_hFile, pOverlapped,
+       ::GetOverlappedResult(m_hFile, pOverlapped,
                                                                 pNumberOfBytesTransferred, bWait);
+       return (HRESULT)pOverlapped->Internal;
 }

 STDMETHODIMP CWVQueuePair::
-------------- next part --------------
A non-text attachment was scrubbed...
Name: wv_getovresult.patch
Type: application/octet-stream
Size: 3364 bytes
Desc: wv_getovresult.patch
URL: <http://lists.openfabrics.org/pipermail/ofw/attachments/20090223/1efd48d6/attachment.obj>


More information about the ofw mailing list