"Juan Lang" juan.lang@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.