Hi Qian,
On Fri, Jun 28, 2013 at 3:44 AM, Qian Hong fracting@gmail.com wrote:
Hi Daniel, new patches sent with improving from your hints, would you mind have a look? Thanks in advance!
nice work! These look fine to me, but a stylistic nit: + ok(memcmp(pbData,cTestData[i].decstr,cTestData[1].enclen)==0,"decryption incorrect %d\n",i);
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.
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. --Juan