Skip to content

Headers

The headers are the ones of the Windows 3.1 SDK, written for clang-dos from the published API (AGPL-3.0-only, like the rest of this repository; none of Microsoft's text is used):

Header For
windows.h KERNEL, USER, GDI, KEYBOARD, SOUND, comm ports, installable drivers
windowsx.h macro APIs, message crackers (HANDLE_MSG, HANDLE_WM_*, FORWARD_WM_*) and control macros (Edit_*, ListBox_*, ...)
commdlg.h, cderr.h, dlgs.h the common dialogs (COMMDLG)
shellapi.h SHELL: the registration database (Reg*), drag and drop, ShellExecute
mmsystem.h MMSYSTEM: sound, waveform audio, MIDI, timers, joysticks, mmio, MCI
toolhelp.h TOOLHELP: heaps, modules, tasks, stack traces, notifications
ver.h VER: version information, VS_VERSION_INFO (include it in .rc files too)
lzexpand.h LZEXPAND: compressed files
dde.h, ddeml.h DDE messages, and the DDE Management Library (DDEML)
print.h printer driver settings (DM_*, DC_*) and the spooler
stress.h STRESS: using up resources, for testing
gdidefs.h, dibeng.h display drivers: the GDI driver interface and the Windows 95 DIB engine (DIBENG)
winsock.h Windows Sockets 1.1 (WINSOCK.DLL, which comes with the network software)
  • STRICT makes each kind of handle a distinct type (a near pointer to a structure of its own), and the callback types prototypes, so the compiler catches a mixed-up handle. Without it, handles are UINTs as in the Windows 3.0 SDK. HHOOK, HKEY and the DDEML handles are 32 bits.
  • The structures are packed (#pragma pack(1)) as Windows lays them out.
  • Functions are declared only for the Windows versions that have them (see below). Those of the DLLs that came with Windows 3.1 (COMMDLG, SHELL, MMSYSTEM, TOOLHELP, VER, LZEXPAND, DDEML, STRESS) and WINSOCK are declared for 3.10, the version they need.
  • With RC_INVOKED (in a resource script) the headers define only the constants.

tools/check-headers.py checks them:

python3 tools/check-headers.py --clang ~/llvm-build/bin/clang \
    --wine <wine-src>/dlls --mingw-sysroot <win32 sysroot>

It compiles every header for 1.01, 2.03, 3.00 and 3.10 and checks each function against Wine's .spec files (the DLL that exports it, Pascal or C, the size of each argument and of the result) and against that version's import list, reports a function that an older version has but the headers do not declare for it, and compares each integer constant with mingw-w64's headers (an i686 sysroot, such as clang-dos/win32-sdk's), except the ones Win32 changed. tests/win16/sizes.c checks the size of each structure.