KERNEL: check for NULL in LoadModule16
andi at rhlx01.fht-esslingen.de
Tue Aug 30 02:57:46 CDT 2005
On Mon, Aug 29, 2005 at 01:43:04PM -0500, Alex Villacís Lasso wrote:
> I could not find any MSDN reference on any documented behavior for
> LoadLibrary16 or LoadModule16 when libname == NULL.
I've checked it now (Watcom, Win98 SE):
(forgot to zero LOADPARAMS, sorry! But it hopefully didn't matter...)
a) NULL, &lp 0 "system out of mem/executable corrupt/relocs invalid"
b) "kernel", NULL kernel handle
c) NULL, NULL 0
d) (char *)0x1, &lp 2 "file not found"
e) (char *)0x1256, NULL 2
f) NULL, (void *)0x1257 0
NO CRASHES whatsoever, IOW it fully intercepts any invalid pointers.
a), c), f) vs. d) indicates that it does an explicit check against a NULL name,
since probably otherwise LoadModule16 will continue due to the non-NULL
name (0x1) and notice somewhat later (in some file API) that file name 0x1
So yes, you were right after all - but only semi-right, since the return code
IMHO this incident strongly indicates that we should add a Win16 source
to the Wine tree which can be compiled with Watcom and run similar to the Wine
test suite. I don't think such a glaring omission could have happened with
Win32 API due to our test suite (well, sure, somewhere it can happen, but
the chances are much lower).
There probably is no good way to do Win16 calls in Win32 programs with
thunking, so we should just have a separate Win16 source instead, to be
tested as time permits, since it needs a Watcom compile.
What about a directory dlls/kernel/tests/win16/ ?
(and adding a README mentioning OpenWatcom)
Or should it be dlls/kernel/tests16/ instead?
I've got lots of Win16 tests in a Watcom file on my system, I should
reorganize it into a common format and add them to CVS, I guess...
More information about the wine-devel