[2/2] winehid.sys: Register as a HID minidriver. (v2)

Aric Stewart aric at codeweavers.com
Wed Oct 12 23:26:44 CDT 2016


Signed-off-by: Aric Stewart <aric at codeweavers.com>

On 10/12/16 5:46 PM, Sebastian Lackner wrote:
> From: Aric Stewart <aric at codeweavers.com>
> 
> Signed-off-by: Aric Stewart <aric at codeweavers.com>
> Signed-off-by: Sebastian Lackner <sebastian at fds-team.de>
> ---
> 
> Changes in v2:
> * TRACE arguments of add_device.
> * Declare HID_MINIDRIVER_REGISTRATION directly in DriverEntry (it does
>   not seem to be used anywhere else, so why static?)
> * Pass through NTSTATUS from HidRegisterMinidriver.
> 
>  dlls/winehid.sys/Makefile.in |    1 +
>  dlls/winehid.sys/main.c      |   19 ++++++++++++++++++-
>  2 files changed, 19 insertions(+), 1 deletion(-)
> 
> diff --git a/dlls/winehid.sys/Makefile.in b/dlls/winehid.sys/Makefile.in
> index d4ca3dd..ad7881e 100644
> --- a/dlls/winehid.sys/Makefile.in
> +++ b/dlls/winehid.sys/Makefile.in
> @@ -1,4 +1,5 @@
>  MODULE    = winehid.sys
> +IMPORTS   = hidclass
>  EXTRADLLFLAGS = -Wb,--subsystem,native
>  
>  C_SRCS = \
> diff --git a/dlls/winehid.sys/main.c b/dlls/winehid.sys/main.c
> index 7ab9267..cdef3c5 100644
> --- a/dlls/winehid.sys/main.c
> +++ b/dlls/winehid.sys/main.c
> @@ -26,13 +26,30 @@
>  #include "winbase.h"
>  #include "winternl.h"
>  #include "ddk/wdm.h"
> +#include "ddk/hidport.h"
>  #include "wine/debug.h"
>  
>  WINE_DEFAULT_DEBUG_CHANNEL(hid);
>  
> +static NTSTATUS WINAPI add_device(DRIVER_OBJECT *driver, DEVICE_OBJECT *device)
> +{
> +    TRACE("(%p, %p)\n", driver, device);
> +    return STATUS_SUCCESS;
> +}
> +
>  NTSTATUS WINAPI DriverEntry(DRIVER_OBJECT *driver, UNICODE_STRING *path)
>  {
> +    HID_MINIDRIVER_REGISTRATION registration;
> +
>      TRACE("(%p, %s)\n", driver, debugstr_w(path->Buffer));
>  
> -    return STATUS_SUCCESS;
> +    driver->DriverExtension->AddDevice = add_device;
> +
> +    memset(&registration, 0, sizeof(registration));
> +    registration.DriverObject = driver;
> +    registration.RegistryPath = path;
> +    registration.DeviceExtensionSize = sizeof(HID_DEVICE_EXTENSION);
> +    registration.DevicesArePolled = FALSE;
> +
> +    return HidRegisterMinidriver(&registration);
>  }
> 



More information about the wine-patches mailing list