KERNEL: check for NULL in LoadModule16

Alex Villací­s Lasso a_villacis at palosanto.com
Mon Aug 29 13:43:04 CDT 2005


Andreas Mohr wrote:

>Hi,
>
>On Mon, Aug 29, 2005 at 12:37:31PM -0500, Alex Villací­s Lasso wrote:
>  
>
>>An old copy of Print Shop Deluxe Companion manages to supply a NULL as a 
>>name to be loaded by LoadLibrary16 --> LoadModule16 --> SIGSEGV. This 
>>patch adds a check to return ERROR_READ_FAULT instead of crashing.
>>
>>Alex Villacís Lasso
>>
>>Changelog:
>>* Add a NULL check in LoadModule16
>>    
>>
>
>Are you sure that Windows does that thing?
>
>Somehow I really cannot imagine that during all these years this one has gone
>unnoticed...
>
>(and is ERROR_READ_FAULT the correct error to return here?)
>
>Thanks,
>
>Andreas Mohr
>
>  
>
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 
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?

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.

Alex Villacís Lasso




More information about the wine-devel mailing list