Dear Juan,
Thanks for reviewing!
On Fri, Jun 28, 2013 at 11:31 PM, Juan Lang juan.lang@gmail.com wrote:
It's more in line with most C code to use !memcmp(...) instead of memcmp(...)==0. I find it easier to scan, anyway, as I've gotten used to ! comparisons to check equality in memcmp, strcmp, and variants.
I'm glad to change, but the surrounding code use memcmp(...)==0 already, should I change that as well?
Another minor point: it's customary to set last error prior to testing it when you expect it to have a certain value, e.g.:
bad_data[cTestData[i].buflen - 1] = ~bad_data[cTestData[i].buflen -
1];
result = CryptDecrypt(hKey, 0, TRUE, 0, bad_data, &dwLen);
ok(!result, "CryptDecrypt should failed!\n");
ok(GetLastError() == NTE_BAD_DATA, "%08x\n", GetLastError());
Prior to the result = CryptDecrypt(hKey, ...) line, please add a SetLastError(0xdeadbeef); that will ensure that the following comparison of GetLastError() to NTE_BAD_DATA isn't succeeding due to an earlier failure.
Good point, thanks, will do that.
-- Regards, Qian Hong