Alexander Morozov amorozov@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.