[9/11]hidclass.sys: Add Plug-and-play interfaces

Thomas Faber thomas.faber at reactos.org
Mon Jun 22 06:21:12 CDT 2015


On 2015-06-22 03:25, Aric Stewart wrote:
> diff --git a/dlls/hidclass.sys/pnp.c b/dlls/hidclass.sys/pnp.c
> new file mode 100644
> index 0000000..4e51e1a
> --- /dev/null
> +++ b/dlls/hidclass.sys/pnp.c

> +typedef NTSTATUS (*pAddDevice)(DRIVER_OBJECT *DriverObject, DEVICE_OBJECT *PhysicalDeviceObject);

> +HRESULT PNP_AddDevice(DRIVER_OBJECT *driver, LPVOID native)
> +{
> +    DEVICE_OBJECT *device = NULL;
> +    NTSTATUS status;
> +    HID_MINIDRIVER_REGISTRATION *minidriver;
> +    HID_DEVICE_ATTRIBUTES attr;
> +    BASE_DEVICE_EXTENSION *ext = NULL;
> +    DWORD size;
> +    WCHAR serial[256] = {0};
> +    WCHAR interface[256] = {0};
> +    DWORD index = HID_STRING_ID_ISERIALNUMBER;
> +    NATIVE_DEVICE *tracked_device, *ptr;
> +    INT interface_index = 1;
> +    INT i;
> +
> +    static const WCHAR ig_fmtW[] = {'I','G','_','%','i',0};
> +    static const WCHAR im_fmtW[] = {'I','M','_','%','i',0};
> +
> +
> +    TRACE("native add device(%p)\n", native);
> +    minidriver = find_minidriver(driver);
> +
> +    status = HID_CreateDevice(native, minidriver, &device);
> +    if (status != STATUS_SUCCESS)
> +    {
> +        ERR("Failed to create HID object (%x)\n",status);
> +        return status;
> +    }
> +
> +    TRACE("Created device %p\n",device);
> +    status = ((pAddDevice)minidriver->DriverObject->DriverExtension->AddDevice)(minidriver->DriverObject, device);

AddDevice is and has always been NTAPI/WINAPI/__stdcall, this cast
should not be needed.

> [...]
> +}




More information about the wine-devel mailing list