So, the original question was "How to test OpenFile16"?
Here's a more complete answer.  First, install OpenWatcom as
previously described.  Then create a text file blah.c containing something like

#include <win/win16.h>

int PASCAL WinMain( HINSTANCE this_inst, HINSTANCE prev_inst, LPSTR cmdline,
                                   int cmdshow )
{
   HFILE h;
   OFSTRUCT of;
   h = OpenFile("foobar.dat", &of, OF_CREATE);
   if (h == HFILE_ERROR)
           MessageBox(NULL, "Failed", "foobar", 0);
   else
           MessageBox(NULL, "OK", "foobar", 0);
}

Then compile it with OpenWatcom like this:

$ wine wcl -Zw blah.c

This seems to produce a simple 16 bit testcase that works.

To verify OpenFile16 is being called, get a +file log:

WINEDEBUG=+file wine blah.exe 2>&1 | grep OpenFile
trace:file:OpenFile16 "Z:\\home\\dank\\blah.exe" OF_READ OF_SHARE_DENY_WRITE
trace:file:OpenFile16 found "Z:\\home\\dank\\blah.exe"
trace:file:OpenFile16 (Z:\home\dank\blah.exe): OK, return = 0x58
trace:file:OpenFile16 "foobar.dat" OF_READ OF_SHARE_COMPAT OF_CREATE
trace:file:OpenFile foobar.dat OF_READ OF_SHARE_COMPAT OF_CREATE
trace:file:OpenFile foobar.dat 1000
trace:file:OpenFile (foobar.dat): OK, return = 0x78
trace:file:OpenFile16 (foobar.dat): OK, return = 0x78

The next step would probably be to figure out how to get Wine's
test harness, or something like it, to work in 16 bits.


Reply via email to