wintrust(4/5): Test and implement SoftpubLoadMessage (with patch)

Alexandre Julliard julliard at winehq.org
Mon Aug 27 12:38:13 CDT 2007


"Juan Lang" <juan.lang at gmail.com> writes:

> +    ret = data->pPDSip->pSip->pfGet(data->pPDSip->psSipSubjectInfo,
> +     &data->dwEncoding, 0, &size, buf);
> +    if (ret)
> +    {
> +        data->hMsg = CryptMsgOpenToDecode(data->dwEncoding, 0, 0, data->hProv,
> +         NULL, NULL);
> +        if (data->hMsg)
> +            ret = CryptMsgUpdate(data->hMsg, buf, size, TRUE);
> +    }
> +
> +    if (!ret || !data->hMsg)
> +        err = GetLastError();
> +    data->psPfns->pfnFree(buf);
> +    return err;

That style of coding is dangerous, it assumes that all the error paths
of the called functions will set last error properly. It's better to
return a success/failure boolean and fetch the last error only when
the actual error is needed, not as an error indication.

-- 
Alexandre Julliard
julliard at winehq.org



More information about the wine-devel mailing list