[3/5] comctl32: Implement TaskDialogIndirect as a custom dialog box (try 2)

Joachim Priesner joachim.priesner at web.de
Tue Feb 24 08:37:06 CST 2015


Am Dienstag, 24. Februar 2015 schrieb Nikolay Sivov:
> On 23.02.2015 15:42, Joachim Priesner wrote:
> > +    if (IS_INTRESOURCE(text))
> > +    {
> > +        SetLastError(S_OK);
> > +        LoadStringW(instance, LOWORD(text), (LPWSTR)result, 0);
> > +        return HRESULT_FROM_WIN32(GetLastError());
> > +    }
> 
> You don't need SetLastError(), especially not with HRESULT value. And 
> GetLastError() should only be used when LoadStringW() fails.

Thanks for the feedback, again. The rationale behind SetLastError is that the following three cases can occur:
 1) LoadStringW succeeds, string length > 0 => return value > 0
 2) LoadStringW succeeds, string length == 0 => return value 0
 3) LoadStringW fails => return value 0, error code available via GetLastError.

Because LastError is not modified in case 2), I have to set it to S_OK beforehand in order to distinguish between 2) and 3). Does that make sense?



More information about the wine-devel mailing list