[PATCH 4/6] hidparse.sys: Introduce new driver library.

Rémi Bernon rbernon at codeweavers.com
Mon Aug 16 03:07:51 CDT 2021


Sharing the HidP_* functions with dlls/hid/hidp.c.

Signed-off-by: Rémi Bernon <rbernon at codeweavers.com>
---
 configure.ac                        |  1 +
 dlls/hidparse.sys/Makefile.in       |  8 ++++
 dlls/hidparse.sys/hidparse.sys.spec | 32 +++++++++++++
 dlls/hidparse.sys/main.c            | 49 ++++++++++++++++++++
 include/ddk/hidpddi.h               | 69 +++++++++++++++++++++++++++++
 include/ddk/hidpi.h                 |  2 +
 6 files changed, 161 insertions(+)
 create mode 100644 dlls/hidparse.sys/Makefile.in
 create mode 100644 dlls/hidparse.sys/hidparse.sys.spec
 create mode 100644 dlls/hidparse.sys/main.c
 create mode 100644 include/ddk/hidpddi.h

diff --git a/configure.ac b/configure.ac
index 065b3f231bf..7237289a2ad 100644
--- a/configure.ac
+++ b/configure.ac
@@ -3292,6 +3292,7 @@ WINE_CONFIG_MAKEFILE(dlls/hhctrl.ocx)
 WINE_CONFIG_MAKEFILE(dlls/hid)
 WINE_CONFIG_MAKEFILE(dlls/hid/tests)
 WINE_CONFIG_MAKEFILE(dlls/hidclass.sys)
+WINE_CONFIG_MAKEFILE(dlls/hidparse.sys)
 WINE_CONFIG_MAKEFILE(dlls/hlink)
 WINE_CONFIG_MAKEFILE(dlls/hlink/tests)
 WINE_CONFIG_MAKEFILE(dlls/hnetcfg)
diff --git a/dlls/hidparse.sys/Makefile.in b/dlls/hidparse.sys/Makefile.in
new file mode 100644
index 00000000000..3bebabb9878
--- /dev/null
+++ b/dlls/hidparse.sys/Makefile.in
@@ -0,0 +1,8 @@
+MODULE = hidparse.sys
+IMPORTLIB = hidparse
+EXTRADLLFLAGS = -mno-cygwin
+PARENTSRC = ../hid
+
+C_SRCS = \
+	hidp.c \
+	main.c
diff --git a/dlls/hidparse.sys/hidparse.sys.spec b/dlls/hidparse.sys/hidparse.sys.spec
new file mode 100644
index 00000000000..c723b51bed5
--- /dev/null
+++ b/dlls/hidparse.sys/hidparse.sys.spec
@@ -0,0 +1,32 @@
+@ stub DllInitialize
+@ stub DllUnload
+@ stdcall HidP_FreeCollectionDescription(ptr)
+@ stdcall HidP_GetButtonCaps(long ptr ptr ptr)
+@ stdcall HidP_GetCaps(ptr ptr)
+@ stdcall HidP_GetCollectionDescription(ptr long long ptr)
+@ stdcall HidP_GetData(long ptr ptr ptr ptr long)
+@ stub HidP_GetExtendedAttributes
+@ stdcall HidP_GetLinkCollectionNodes(ptr ptr ptr)
+@ stdcall HidP_GetScaledUsageValue(long long long long ptr ptr ptr long)
+@ stdcall HidP_GetSpecificButtonCaps(long long long long ptr ptr ptr)
+@ stdcall HidP_GetSpecificValueCaps(long long long long ptr ptr ptr)
+@ stdcall HidP_GetUsages(long long long ptr ptr ptr ptr long)
+@ stdcall HidP_GetUsagesEx(long long ptr ptr ptr ptr long)
+@ stdcall HidP_GetUsageValue(long long long long ptr ptr ptr long)
+@ stdcall HidP_GetUsageValueArray(long long long long ptr long ptr ptr long)
+@ stdcall HidP_GetValueCaps(long ptr ptr ptr)
+@ stdcall HidP_InitializeReportForID(long long ptr ptr long)
+@ stdcall HidP_MaxDataListLength(long ptr)
+@ stdcall HidP_MaxUsageListLength(long long ptr)
+@ stub HidP_SetData
+@ stub HidP_SetScaledUsageValue
+@ stdcall HidP_SetUsages(long long long ptr ptr ptr ptr long)
+@ stdcall HidP_SetUsageValue(long long long long long ptr ptr long)
+@ stdcall HidP_SetUsageValueArray(long long long long ptr long ptr ptr long)
+@ stub HidP_SysPowerCaps
+@ stub HidP_SysPowerEvent
+@ stub HidP_TranslateUsageAndPagesToI8042ScanCodes
+@ stdcall HidP_TranslateUsagesToI8042ScanCodes(ptr long long ptr ptr ptr)
+@ stub HidP_UnsetUsages
+@ stub HidP_UsageAndPageListDifference
+@ stub HidP_UsageListDifference
diff --git a/dlls/hidparse.sys/main.c b/dlls/hidparse.sys/main.c
new file mode 100644
index 00000000000..b8edc3e1f6a
--- /dev/null
+++ b/dlls/hidparse.sys/main.c
@@ -0,0 +1,49 @@
+/*
+ * HID parsing library
+ *
+ * Copyright 2021 Rémi Bernon for CodeWeavers
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
+ */
+
+#include <stdarg.h>
+
+#include "ntstatus.h"
+#define WIN32_NO_STATUS
+#include "windef.h"
+#include "winbase.h"
+#include "winternl.h"
+#include "winioctl.h"
+
+#include <ddk/wdm.h>
+#include <ddk/hidpddi.h>
+
+#include "wine/debug.h"
+
+WINE_DEFAULT_DEBUG_CHANNEL(hidp);
+
+NTSTATUS WINAPI HidP_GetCollectionDescription( PHIDP_REPORT_DESCRIPTOR report_desc, ULONG report_desc_len,
+                                               POOL_TYPE pool_type, HIDP_DEVICE_DESC *device_desc )
+{
+    FIXME( "report_desc %p, report_desc_len %u, pool_type %u, device_desc %p stub!\n",
+           report_desc, report_desc_len, pool_type, device_desc );
+
+    return STATUS_NOT_IMPLEMENTED;
+}
+
+void WINAPI HidP_FreeCollectionDescription( HIDP_DEVICE_DESC *device_desc )
+{
+    FIXME( "device_desc %p stub!\n", device_desc );
+}
diff --git a/include/ddk/hidpddi.h b/include/ddk/hidpddi.h
new file mode 100644
index 00000000000..87e68e31869
--- /dev/null
+++ b/include/ddk/hidpddi.h
@@ -0,0 +1,69 @@
+/*
+ * Copyright (C) the Wine project
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
+ */
+
+#ifndef __WINE_HIDPDDI_H
+#define __WINE_HIDPDDI_H
+
+#include <hidusage.h>
+#include <ddk/hidpi.h>
+
+typedef struct _HIDP_COLLECTION_DESC
+{
+    USAGE UsagePage;
+    USAGE Usage;
+    UCHAR CollectionNumber;
+    UCHAR Reserved[15];
+    USHORT InputLength;
+    USHORT OutputLength;
+    USHORT FeatureLength;
+    USHORT PreparsedDataLength;
+    PHIDP_PREPARSED_DATA PreparsedData;
+} HIDP_COLLECTION_DESC, *PHIDP_COLLECTION_DESC;
+
+typedef struct _HIDP_REPORT_IDS
+{
+    UCHAR ReportID;
+    UCHAR CollectionNumber;
+    USHORT InputLength;
+    USHORT OutputLength;
+    USHORT FeatureLength;
+} HIDP_REPORT_IDS, *PHIDP_REPORT_IDS;
+
+typedef struct _HIDP_GETCOLDESC_DBG
+{
+    ULONG BreakOffset;
+    ULONG ErrorCode;
+    ULONG Args[6];
+} HIDP_GETCOLDESC_DBG, *PHIDP_GETCOLDESC_DBG;
+
+typedef struct _HIDP_DEVICE_DESC
+{
+    HIDP_COLLECTION_DESC *CollectionDesc;
+    ULONG CollectionDescLength;
+
+    HIDP_REPORT_IDS *ReportIDs;
+    ULONG ReportIDsLength;
+
+    HIDP_GETCOLDESC_DBG Dbg;
+} HIDP_DEVICE_DESC, *PHIDP_DEVICE_DESC;
+
+NTSTATUS WINAPI HidP_GetCollectionDescription(PHIDP_REPORT_DESCRIPTOR report_desc, ULONG report_desc_len,
+                                              POOL_TYPE pool_type, HIDP_DEVICE_DESC *device_desc);
+void WINAPI HidP_FreeCollectionDescription(HIDP_DEVICE_DESC *device_desc);
+
+#endif  /* __WINE_HIDPDDI_H */
diff --git a/include/ddk/hidpi.h b/include/ddk/hidpi.h
index 8c970673ec1..6dfe5919b4f 100644
--- a/include/ddk/hidpi.h
+++ b/include/ddk/hidpi.h
@@ -19,6 +19,8 @@
 #ifndef __HIDPI_H__
 #define __HIDPI_H__
 
+typedef UCHAR *PHIDP_REPORT_DESCRIPTOR;
+
 typedef enum _HIDP_REPORT_TYPE
 {
     HidP_Input,
-- 
2.32.0




More information about the wine-devel mailing list