}\r
}\r
\r
+static void WvVersionQuery(WDFREQUEST Request)\r
+{\r
+ size_t len = 0;\r
+ UINT64 *version;\r
+ NTSTATUS status;\r
+\r
+ status = WdfRequestRetrieveOutputBuffer(Request, sizeof(UINT64), &version, &len);\r
+ if (NT_SUCCESS(status)) {\r
+ *version = WV_KERNEL_VERSION;\r
+ }\r
+ \r
+ WdfRequestCompleteWithInformation(Request, status, len);\r
+}\r
+\r
static void WvGuidQuery(WDFREQUEST Request)\r
{\r
WV_IO_GUID_LIST *list;\r
\r
// TODO: verify this compiles as a jump table, or use function pointers\r
switch (IoControlCode) {\r
+ case WV_IO_FUNCTION_VERSION_QUERY:\r
+ WvVersionQuery(Request);\r
+ break;\r
case WV_IOCTL_GUID_QUERY:\r
WvGuidQuery(Request);\r
break;\r
{\r
InterlockedIncrement(&WvRef);\r
m_hFile = INVALID_HANDLE_VALUE;\r
+ m_KernelVersion = WV_KERNEL_VERSION;\r
}\r
\r
CWVProvider::~CWVProvider()\r
return m_hFile;\r
}\r
\r
+/*\r
+ * Version query was not supported in initial version 1 release.\r
+ */\r
+void CWVProvider::\r
+SetKernelVersion(void)\r
+{\r
+ DWORD bytes;\r
+\r
+ if (!WvDeviceIoControl(m_hFile, WV_IOCTL_VERSION_QUERY, NULL, 0,\r
+ &m_KernelVersion, sizeof(m_KernelVersion), &bytes, NULL)) {\r
+ m_KernelVersion = 1;\r
+ }\r
+}\r
+\r
STDMETHODIMP CWVProvider::\r
QueryDeviceList(NET64* pGuidList, SIZE_T* pBufferSize)\r
{\r
hr = HRESULT_FROM_WIN32(GetLastError());\r
goto err2;\r
}\r
+ wv->SetKernelVersion();\r
*ppProvider = wv;\r
return WV_SUCCESS;\r
\r
*ppProvider = NULL;\r
return hr;\r
}\r
+\r
+ UINT64 m_KernelVersion;\r
+\r
+private:\r
+ void SetKernelVersion();\r
};\r
\r
#endif // _WV_PROVIDER_H_
\ No newline at end of file
typedef UINT32 NET32;\r
typedef UINT64 NET64;\r
\r
+#define WV_KERNEL_VERSION 1\r
+\r
#define WV_IOCTL(f) CTL_CODE(FILE_DEVICE_INFINIBAND, f, METHOD_BUFFERED,\\r
FILE_READ_DATA | FILE_WRITE_DATA)\r
\r
#define WV_IO_FUNCTION_BASE 0x800\r
\r
enum {\r
- WV_IO_FUNCTION_MIN,\r
+ WV_IO_FUNCTION_VERSION_QUERY,\r
WV_IO_FUNCTION_GUID_QUERY,\r
WV_IO_FUNCTION_LIBRARY_QUERY,\r
WV_IO_FUNCTION_DEVICE_OPEN,\r
WV_IO_FUNCTION_PD_CANCEL\r
};\r
\r
+// none / UINT64 Version\r
+#define WV_IOCTL_VERSION_QUERY WV_IOCTL(WV_IO_FUNCTION_BASE + \\r
+ WV_IO_FUNCTION_VERSION_QUERY)\r
+\r
// none / WV_IO_GUID_LIST\r
#define WV_IOCTL_GUID_QUERY WV_IOCTL(WV_IO_FUNCTION_BASE + \\r
WV_IO_FUNCTION_GUID_QUERY)\r