<div dir="ltr">Hi Qian,<div><br></div><div class="gmail_extra">On Fri, Jun 28, 2013 at 3:44 AM, Qian Hong <span dir="ltr"><<a href="mailto:fracting@gmail.com" target="_blank">fracting@gmail.com</a>></span> wrote:<br>
<div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">Hi Daniel, new patches sent with improving from your hints, would you<br>

mind have a look? Thanks in advance!<br></blockquote><div><br></div><div>nice work! These look fine to me, but a stylistic nit:<br></div>+ � � �ok(memcmp(pbData,cTestData[i].decstr,cTestData[1].enclen)==0,"decryption incorrect %d\n",i);<br>
<br>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.<div><br>
</div><div>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.:</div>+ � � �bad_data[cTestData[i].buflen - 1] = ~bad_data[cTestData[i].buflen - 1];<br>
+ � � �result = CryptDecrypt(hKey, 0, TRUE, 0, bad_data, &dwLen);<br>+ � � �ok(!result, "CryptDecrypt should failed!\n");<br>+ � � �ok(GetLastError() == NTE_BAD_DATA, "%08x\n", GetLastError());<br>
<br><div>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.</div>
<div>--Juan</div></div></div></div>