[PATCH 2/2] crypt32/tests: Add tests for CryptHashCertificate2

Hans Leidekker hans at codeweavers.com
Mon Jan 28 03:01:48 CST 2019


On Fri, 2019-01-25 at 21:12 +0300, Orhan 'aib' Kavrakoğlu wrote:
> +    /* Test invalid algorithm */
> +    hashLen = sizeof(hash);
> +    ret = pCryptHashCertificate2(invalidAlgorithm, 0, NULL, toHash, sizeof(toHash), hash, &hashLen);
> +    ok(!ret && GetLastError() == STATUS_NOT_FOUND,
> +     "Expected STATUS_NOT_FOUND (0x%08x), got 0x%08x\n", STATUS_NOT_FOUND, GetLastError());

You should set last error to a known value (0xdeadbeef) right before
calling the function. This way we are certain it's this function call
that sets it.

> +    /* Test hash buffer too small */
> +    hashLen = sizeof(hash) / 2;
> +    ret = pCryptHashCertificate2(SHA1, 0, NULL, toHash, sizeof(toHash), hash, &hashLen);
> +    ok(!ret && GetLastError() == ERROR_MORE_DATA,
> +     "Expected ERROR_MORE_DATA (%d), got %d\n", ERROR_MORE_DATA, GetLastError());

Same here.




More information about the wine-devel mailing list