ADVAPI32: preserve the last error value set by the CSP in CryptAcquireContext
Mike McCormack
mike at codeweavers.com
Sat Sep 4 11:59:35 CDT 2004
Robert Shearman wrote:
>> error:
>> + /* must preserve the last error returned by the CSP here */
>> + r = GetLastError();
>> if (pProv)
>> {
>> FreeLibrary(pProv->hModule);
>> @@ -486,6 +488,7 @@
>> CRYPT_Free(provname);
>> CRYPT_Free(temp);
>> CRYPT_Free(imagepath);
>> + SetLastError( r );
>> return FALSE;
>> }
>>
>>
> This seems wrong. Which function is calling SetLastError? I believe
> there was a problem a while ago with freeing bad pointers. I can't
> remember whether a fix went in for that.
>
> Rob
Yeah, well, something there is calling SetLastError(). We can muck round
trying to fix it by finding which pointer is bad, but the problem can
easily rear it's head again unless there's a comment or specific code in
there to point out the problem.
A better fix would be to convert it to using RtlHeapAlloc() and
RtlHeapFree() so that the last error isn't touched, and perhaps use
LdrFreeLibrary too.
Mike
More information about the wine-devel
mailing list