todo_wine, broken() and a SW anti-pattern

Juan Lang juan.lang at gmail.com
Fri Oct 7 10:55:12 CDT 2011


Hi Joerg,

> hr = IAudioClient_GetService(ac, &IID_IAudioStreamVolume, (void**)&out);
> ok(hr == AUDCLNT_E_NOT_INITIALIZED, "... call returns %08x\n", hr);
> todo_wine ok(broken(out != NULL), "GetService %08x &out pointer %p\n", hr, out);
>
> 1. broken() documents that I consider native's observable behaviour
>   broken because I judge it unsafe not to zero the out pointer in case
>   of failure.  Furthermore, MSDN documents that it should be zeroed.
> http://msdn.microsoft.com/en-us/library/windows/desktop/dd370873%28v=vs.85%29.aspx

I think, philosophically, you're correct.  On the other hand, Wine
isn't meant to be a "philosophically correct" implementation of the
Win32 API.  And, the whole point of regression tests is that MSDN
isn't to be trusted.

So, while Microsoft says that the out pointer must be NULL on failure,
both in this case and more generally for COM (specifically for
QueryInterface), our guide has always been to trust what Microsoft
does more than what it says.

Our guideline for using broken() is to mark as broken the things that
Microsoft has changed.  Older implementations often had bugs that have
subsequently been fixed, so we mark those as broken and conform to the
newer behavior.

On the other hand, if Windows has always had a specific behavior, than
that behavior is, by definition, correct.  broken() isn't appropriate
in this case.  Again, we must do as Microsoft does, not as it says.

So I believe the correct behavior here is not to use broken(),
irrespective of what MSDN says.  A comment stating that MSDN is
incorrect might be in order.
--Juan



More information about the wine-devel mailing list