On 22 February 2010 13:43, Christian Costa titan.costa@wanadoo.fr wrote:
Sure. Having tests is better but in this case there is no chance for regression. I usually write tests for my personnal pursose or to compare behaviour against real windows or native dll.
You write tests to prove your implementation is correct, and to prevent it from breaking in the future.
The first thing that looks suspicious is that the documentation claims "ppData" and "pSizeInBytes" are allowed to be NULL, while your implementation doesn't allow that. The other thing that looks immediately suspicious is that your return value for "pSizeInBytes" is inconsistent with the size of the returned data. In terms of style, you calculate the comment size twice, while you could just as easily store it in a variable. Casting to LPCVOID is superfluous. "*pSizeInBytes" is unsigned, so should use "%u" in the format string. (I also have some reservations about your naming conventions, but if you can get them past Alexandre they're mostly your own problem.)