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

Aric Stewart aric at codeweavers.com
Mon Jun 22 07:14:47 CDT 2015


Thank you very much for the review here.  The Device Driver code was the area I was least confident.

Now, MUCH of the windows kernel level (KEVENT etc...) stuff is not implemented in wine and not really needed.  

On 6/22/15 6:21 AM, Thomas Faber wrote:
> 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.


Thanks for the WINAPI pointer here.  The cast is needed to silence errors as currently DRIVER_EXTENSION->AddDevice is a PVOID in the header.

-aric



More information about the wine-devel mailing list