Using compiler error information to check undocumented prototypes and structures?

Qian Hong fracting at
Thu Mar 5 06:44:11 CST 2015


On Thu, Mar 5, 2015 at 7:27 PM, Piotr Caban <piotr.caban at> wrote:
> I'm expecting it to be quite hard taking in account the functions are not
> documented and that you can't look on the headers while working on it.

Could we use compiler error information to check undocumented
prototypes and structures?

For example, assume we don't know the prototype of CreateWindowExW.
Let's write a test program test.c like below:

#include <windows.h>

void CreateWindowExW();

int main(void)
    return 0;

Then we compile test.c on Windows using:

gcc -sysroot /path/to/MicrosoftSDK/include test.c

Then we will get some error message like:

In file included from /path/to/windows.h:72:0,
                 from test.c:1:
/path/to/winuser.h:1935:26: note: previous declaration of
‘CreateWindowExW’ was here
lpClassName,LPCWSTR lpWindowName,DWORD dwStyle,int X,int Y,int
nWidth,int nHeight,HWND hWndParent,HMENU hMenu,HINSTANCE
hInstance,LPVOID lpParam);

Then we will know the correct prototype.

In theory VC++ and clang should do similar job as well.

Could that be a valid way to detect a function prototype and a data
structure when  re-implementing undocumented API?

If it's valid, we can consider setting up a AppVeyor CI account and
connect to a github account to provide a "MS type and structure query
service". AppVeyor CI provides a free (as beer) Windows environment
and VC++ compiler (third party compilers like gcc and clang can be
installed as well). By tweaking the setting, we can trigger AppVeyor
rebuild by pull request. In that case, whenever we need to query a
undocumented prototype or structure, we can just write a (wrong) test
case and submit a pull request, without reading MS headers by human.

Any thought is appreciated.

Qian Hong


More information about the wine-devel mailing list