[PATCH] winedevice: Remove static driver_obj variable

Aric Stewart aric at codeweavers.com
Sun Aug 7 19:18:29 CDT 2016


On 8/5/16 2:36 PM, Sebastian Lackner wrote:
> On 05.08.2016 21:01, Aric Stewart wrote:
>>>> +
>>>> +    str = HeapAlloc( GetProcessHeap(), 0, sizeof(driverW) + strlenW(driver_name)*sizeof(WCHAR) );
>>>> +    lstrcpyW( str, driverW);
>>>> +    lstrcatW( str, driver_name );
>>>> +    RtlInitUnicodeString( &drv_name, str );
>>>> +
>>>> +    if (ObReferenceObjectByName( &drv_name, OBJ_CASE_INSENSITIVE, NULL,
>>>> +        0, NULL, KernelMode, NULL, (void**)&driver_obj ) != STATUS_SUCCESS)
>>>
>>> To avoid putting together the string twice, you could already call this function
>>> immediately after loading.
>>>
>>
>> I dont quite understand what you are meaning here...
>>
>> -aric
> 
> What I mean is that you could move this to create_driver(), where you already have drv_name.
> If something went wrong (and the driver is not tracked correctly) you could abort immediately, then.
> 

And pass out the DRIVER_OBJECT?  It complicates the multiple driver case looking forward but we can solve that problem when we get to if it you feel strongly about that change.

-aric



More information about the wine-devel mailing list