[1/3] setupapi: Add a test for SetupDiGetDeviceRegistryProperty and SetupDiSetDeviceRegistryProperty

Alexandre Julliard julliard at winehq.org
Fri Apr 11 06:02:27 CDT 2008


Alexander Morozov <amorozov at etersoft.ru> writes:

> +    if (wide)
> +    {
> +        pSetupDiGetClassDevs = (void *)pSetupDiGetClassDevsW;
> +        pSetupDiSetDeviceRegistryProperty = (void *)pSetupDiSetDeviceRegistryPropertyW;
> +        pSetupDiGetDeviceRegistryProperty = (void *)pSetupDiGetDeviceRegistryPropertyW;
> +        pSetupDiCreateDeviceInfo = (void *)pSetupDiCreateDeviceInfoW;
> +        devName = (void *)devNameW;
> +        friendlyName = (void *)friendlyNameW;
> +        buflen = 6 * sizeof(WCHAR);
> +        buf = (void *)bufW;
> +    }
> +    else
> +    {
> +        pSetupDiGetClassDevs = (void *)pSetupDiGetClassDevsA;
> +        pSetupDiSetDeviceRegistryProperty = (void *)pSetupDiSetDeviceRegistryPropertyA;
> +        pSetupDiGetDeviceRegistryProperty = (void *)pSetupDiGetDeviceRegistryPropertyA;
> +        pSetupDiCreateDeviceInfo = (void *)pSetupDiCreateDeviceInfoA;
> +        devName = (void *)devNameA;
> +        friendlyName = (void *)friendlyNameA;
> +        buflen = 6;
> +        buf = (void *)bufA;
> +    }

That's ugly, it's bypassing all type checking. There's no reason to test
everything twice, in most cases the A function calls the W one, so
testing the A one automatically tests both. If there are differences you
really need to test, please do that explicitly by duplicating the test.

-- 
Alexandre Julliard
julliard at winehq.org



More information about the wine-devel mailing list