msvcp90: Fix __cdecl functions definitions that returns structures

Alexandre Julliard julliard at
Mon Jul 2 09:52:34 CDT 2012

Piotr Caban <piotr.caban at> writes:

> I'm not sure how to write tests for these functions. I see two
> possibilities in case of functions returning "big" structures
> (e.g. _Getctype). Should I write a test that calls the function in a
> loop to make sure the tests are crashing if it corrupts the stack? Or
> maybe it's better to write a test in assembler that checks %esp value
> before and after calling the function?

The %esp issue is probably hard to test in our test suite, but a simple
test checking that the structure contents are valid would already be a
good thing.

> In case of _Getcoll (and _Getcvt) the structure should be returned in
> %eax and %edx registers. Current implementation tries to pass hidden
> argument. Is it acceptable to test this case by passing inaccessible
> memory pointer so the test crashes if implementation tries to write to
> it? Do you have any other idea of testing it?

You can simply declare the function as returning ULONGLONG in the test
and make sure you get sane values. You could also explicitly pass a
broken first argument but that's probably not even necessary.

Alexandre Julliard
julliard at

More information about the wine-devel mailing list