KERNEL: check for NULL in LoadModule16

Andreas Mohr andi at rhlx01.fht-esslingen.de
Mon Aug 29 15:33:56 CDT 2005


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.
> 
> Even if Windows does not check for NULL in this function, I do not think 
> that the bug-for-bug compatibility should extend to the point where Wine 
> crashes on the same invalid parameters as Windows does. This only leaves 

That's what you think, but we will DEFINITELY want bug-for-bug compatibility
(well, except for fringe cases, which that one isn't, IMHO).
(no criticism)

We really want that, even if it's only used to be sure that an error is an error
(in order to realize immediately that something is badly wrong since the program
shouldn't behave that way).
Simply returning an *illegal* return code instead of crashing (like Windows!)
is NOT an option.

All that assuming that Windows LoadModule16 does crash, of course...

> the exact value of the return value - I don't have the tools to generate 
> a 16-bit executable under Windows, or else I don't know of any freely 
> available ones, so I could only check the 32-bit LoadLibrary. Maybe 
> somebody could point me to an URL to download a 16-bit compiler for 
> Windows?

You want OpenWatcom, believe me. You want it. Badly! :)

(I have an old NonopenWatcom installation here, so I'll write a short test,
but maybe you'll even beat me to it)

> The specific value of ERROR_READ_FAULT was chosen because a) it is less 
> than 31, as the MSDN documents, b) it is the closest description of what 
> happens when the function attempts to use the parameter without checking.

Wine cannot choose or guess. Wine has to know. Even a single bit can be different
and cause as much harm as making a whole Windows program fail...
(which is why so many people say that "Wine is crap, it doesn't work": one single
"completely irrelevant" difference can cause a terrible amount of trouble, no matter
how absolutely incredibly perfect all the remaining parts of Wine are)

Andreas



More information about the wine-devel mailing list