WINED3D: Implement GetCreationParameters

Francois Gouget fgouget at free.fr
Wed Mar 8 18:16:30 CST 2006


On Wed, 8 Mar 2006, Peter Beutner wrote:

> Francois Gouget schrieb:
>>  * or the application does not pass a NULL here because it would cause
>> it to crash on Windows. But if we merely return an error the application
>> will merrily go on, only to crash or report that DirectX does not work a
>> while later. By then the source of the problem will be very hard to find
>> due to all that happened since this function call.
>>    The point is that we need to fix the bug that causes the application
>> to pass a NULL to Wine in the first place. And the best way to spot it,
>> and thus fix it, is if Wine segfaults in the same way as Windows when
>> given a NULL.
> The whole point of my email was that a crash here doesn't help you
> to find the real problem.

And you are wrong there. When an application crashes you have a very 
clear point where you know things went very wrong. This point is very 
clearly identified by the SEH traces and the winedbg backtrace. This 
information makes it *much* easier to find the original bug. And this is 
from experience.

When an application doesn't crash but doesn't do what you want either, 
it's hard to even know which part of the log is relevant to the problem.


> Imo a library is supposed to validate given parameters as much as 
> possible and rather return an error to the caller than to crash.

No. A library can say that a given function must not be caled with a 
NULL parameter in which case it is perfectly valid to crash if that rule 
is violated. There's no point for both the callee and the caller to 
check for NULL parameters.


> Let's just hope the kernel devs don't adopt your 
> "Better-crash-than-return-an-error" strategy :p

The design of kernels, servers, and other pieces of code that have to 
deal with untrusted data (e.g. browsers), is completely different from 
that of general purpose libraries. Trying to apply the rules of one to 
the other will only give bad results.

And, as was pointed out before, Wine is in yet a different situation 
since its number one requirement is compatibility with the Win32 API 
rather than breaking clean with it and 'doing things the right way' 
(whatever that is).


-- 
Francois Gouget <fgouget at free.fr>              http://fgouget.free.fr/
                      Linux: the choice of a GNU generation



More information about the wine-devel mailing list