Anatoly asked:
How can I write a test for this function or build program use it?
I think writing good win16 tests requires a 16 bit linker. Fortunately, OpenWatcom has one, and works on Wine. It's amazingly easy to install it and build one of its demo apps: $ wget http://ftp.openwatcom.org/ftp/open-watcom-c-win32-1.6.exe $ wine open-watcom-c-win32-1.6.exe $ wineboot $ cd .wine/drive_c/WATCOM/samples/win/alarm/win16 $ wine wmake $ wine alarm
This builds an honest-to-goodness win16 binary that works on XP (possibly with one warning dialog you have to ignore).
Unfortuately, Wine doesn't currently run these win16 apps properly; they hang with
err:ntdll:RtlpWaitForCriticalSection section 0x7b91f300 "syslevel.c: Win16Mutex" wait timed out in thread 000b, blocked by 000c, retrying (60 sec)
This is embarassing. These are the "hello, world" of 16 bit windows apps, and current wine (well, wine-0.9.37-g3739b5f) can't run them...
I haven't looked to see if older wine runs these 16 bit demo apps properly.