Andreas Mohr wrote:
Hi,
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 is invalid.
The attached patch should implement the observed behavior in Win98SE.
Alex Villacís Lasso
Changelog: - Add NULL and exception handler to LoadModule16 to check against NULL or invalid libname