[1/3] rsaenh/tests: Make the tests pass in Windows <= NT4

Dmitry Timoshkov dmitry at baikal.ru
Sat Jul 12 21:12:15 CDT 2014


Bruno Jesus <00cpxxx at gmail.com> wrote:

> +    if (!result && GetLastError() == NTE_BAD_FLAGS) /* <= NT4 */
> +    {
> +        ok(broken(1), "Failed to support CRYPT_USERDATA flag\n");
> +        result = CryptHashData(hHash, pbData, sizeof(pbData), 0);
> +    }

Wouldn't it be simpler to create a variable 'crypt_flags' that
includes CRYPT_USERDATA (among others if needed), and clear
CRYPT_USERDATA in the flags once the test detects a failure?
That way the failure handling should be performed only once:

crypt_flags = CRYPT_USERDATA | ...;

result = CryptHashData(hHash, pbData, sizeof(pbData), crypt_flags);
if (!result && GetLastError() == NTE_BAD_FLAGS) /* <= NT4 */
{
    ok(broken(1), "Failed to support CRYPT_USERDATA flag\n");
    crypt_flags &= ~CRYPT_USERDATA;
    result = CryptHashData(hHash, pbData, sizeof(pbData), crypt_flags);
}
ok(result, "%08x\n", GetLastError());

-- 
Dmitry.



More information about the wine-devel mailing list