+BOOL WINAPI CryptHashCertificate2(LPCWSTR pwszCNGHashAlgid, DWORD dwFlags, + void *pvReserved, const BYTE *pbEncoded, DWORD cbEncoded, BYTE *pbComputedHash, + DWORD *pcbComputedHash) +{ + BCRYPT_HASH_HANDLE hash = NULL; + BCRYPT_ALG_HANDLE alg = NULL; + NTSTATUS status; + DWORD hash_len; + DWORD hash_len_size; + + TRACE("(%s, %08x, %p, %p, %d, %p, %p)\n", debugstr_w(pwszCNGHashAlgid), + dwFlags, pvReserved, pbEncoded, cbEncoded, pbComputedHash, pcbComputedHash); + + /* Windows does not check for this, causes access violation instead */ + if (0) { + if (!pwszCNGHashAlgid | !pcbComputedHash) + { + status = STATUS_INVALID_PARAMETER; + goto done; + } + }
Please avoid adding dead code. You include the same information in the tests, which is generally a better place to document these things. The patch looks good otherwise.