pAdapter->AddRef();\r
m_pAdapter = pAdapter;\r
RtlZeroMemory(&m_Keys, sizeof(m_Keys));\r
+ m_pOverlapped = NULL;\r
}\r
\r
CNDMemoryRegion::~CNDMemoryRegion()\r
return CNDBase::Release();\r
}\r
\r
+STDMETHODIMP CNDMemoryRegion::\r
+CancelOverlappedRequests(void)\r
+{\r
+ if (m_pOverlapped != NULL) {\r
+ CancelIoEx(m_pAdapter->GetFileHandle(), m_pOverlapped);\r
+ }\r
+\r
+ return ND_SUCCESS;\r
+}\r
+\r
+STDMETHODIMP CNDMemoryRegion::\r
+GetOverlappedResult(OVERLAPPED *pOverlapped, BOOL bWait)\r
+{\r
+ DWORD bytes;\r
+ HRESULT hr;\r
+\r
+ hr = NDConvertWVStatus(m_pAdapter->m_pWvPd->\r
+ GetOverlappedResult(pOverlapped, &bytes, bWait));\r
+ if (hr != ND_PENDING) {\r
+ m_pOverlapped = NULL;\r
+ }\r
+\r
+ return hr;\r
+}\r
+\r
DWORD ConvertAccessFlags(DWORD Flags)\r
{\r
DWORD opts = 0;\r
{\r
HRESULT hr;\r
\r
+ m_pOverlapped = pOverlapped;\r
hr = m_pAdapter->m_pWvPd->RegisterMemory(pBuffer, cbBuffer, ConvertAccessFlags(flags),\r
pOverlapped, &m_Keys);\r
return NDConvertWVStatus(hr);\r
{\r
HRESULT hr;\r
\r
- //??? if the lkey is not unique, we need to change this\r
+ m_pOverlapped = pOverlapped;\r
hr = m_pAdapter->m_pWvPd->DeregisterMemory(m_Keys.Lkey, pOverlapped);\r
return NDConvertWVStatus(hr);\r
}\r
STDMETHODIMP_(ULONG) AddRef();\r
STDMETHODIMP_(ULONG) Release();\r
\r
+ // INDOverlapped methods\r
+ STDMETHODIMP CancelOverlappedRequests();\r
+ STDMETHODIMP GetOverlappedResult(OVERLAPPED *pOverlapped, BOOL bWait);\r
+\r
// INDMemoryRegion methods\r
STDMETHODIMP Register(const VOID* pBuffer, SIZE_T cbBuffer, DWORD flags,\r
OVERLAPPED* pOverlapped);\r
\r
protected:\r
CNDAdapter *m_pAdapter;\r
+ OVERLAPPED *m_pOverlapped;\r
};\r
\r
\r