Bruno Jesus 00cpxxx@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());