crypt32: Ex encode/decode functions should call non-Ex versions if no Ex version is available.

This commit is contained in:
Juan Lang 2007-08-10 11:18:33 -07:00 committed by Alexandre Julliard
parent 6aead911fb
commit 038b53c301
2 changed files with 62 additions and 2 deletions

View File

@ -4168,7 +4168,37 @@ BOOL WINAPI CryptDecodeObjectEx(DWORD dwCertEncodingType, LPCSTR lpszStructType,
ret = decodeFunc(dwCertEncodingType, lpszStructType, pbEncoded,
cbEncoded, dwFlags, pDecodePara, pvStructInfo, pcbStructInfo);
else
SetLastError(ERROR_FILE_NOT_FOUND);
{
static HCRYPTOIDFUNCSET decodeObjectSet = NULL;
CryptDecodeObjectFunc pCryptDecodeObject;
/* Try CryptDecodeObject function. Don't call CryptDecodeObject
* directly, as that could cause an infinite loop.
*/
if (!decodeObjectSet)
decodeObjectSet =
CryptInitOIDFunctionSet(CRYPT_OID_DECODE_OBJECT_FUNC, 0);
CryptGetOIDFunctionAddress(decodeObjectSet, dwCertEncodingType,
lpszStructType, 0, (void **)&pCryptDecodeObject, &hFunc);
if (pCryptDecodeObject)
{
if (dwFlags & CRYPT_DECODE_ALLOC_FLAG)
{
ret = pCryptDecodeObject(dwCertEncodingType, lpszStructType,
pbEncoded, cbEncoded, dwFlags, NULL, pcbStructInfo);
if (ret && (ret = CRYPT_DecodeEnsureSpace(dwFlags, pDecodePara,
pvStructInfo, pcbStructInfo, *pcbStructInfo)))
ret = pCryptDecodeObject(dwCertEncodingType, lpszStructType,
pbEncoded, cbEncoded, dwFlags, *(BYTE **)pvStructInfo,
pcbStructInfo);
}
else
ret = pCryptDecodeObject(dwCertEncodingType, lpszStructType,
pbEncoded, cbEncoded, dwFlags, pvStructInfo, pcbStructInfo);
}
else
SetLastError(ERROR_FILE_NOT_FOUND);
}
if (hFunc)
CryptFreeOIDFunctionAddress(hFunc, 0);
return ret;

View File

@ -3513,7 +3513,37 @@ BOOL WINAPI CryptEncodeObjectEx(DWORD dwCertEncodingType, LPCSTR lpszStructType,
ret = encodeFunc(dwCertEncodingType, lpszStructType, pvStructInfo,
dwFlags, pEncodePara, pvEncoded, pcbEncoded);
else
SetLastError(ERROR_FILE_NOT_FOUND);
{
static HCRYPTOIDFUNCSET encodeObjectSet = NULL;
CryptEncodeObjectFunc pCryptEncodeObject;
/* Try CryptEncodeObject function. Don't call CryptEncodeObject
* directly, as that could cause an infinite loop.
*/
if (!encodeObjectSet)
encodeObjectSet =
CryptInitOIDFunctionSet(CRYPT_OID_ENCODE_OBJECT_FUNC, 0);
CryptGetOIDFunctionAddress(encodeObjectSet, dwCertEncodingType,
lpszStructType, 0, (void **)&pCryptEncodeObject, &hFunc);
if (pCryptEncodeObject)
{
if (dwFlags & CRYPT_ENCODE_ALLOC_FLAG)
{
ret = pCryptEncodeObject(dwCertEncodingType, lpszStructType,
pvStructInfo, NULL, pcbEncoded);
if (ret && (ret = CRYPT_EncodeEnsureSpace(dwFlags, pEncodePara,
pvEncoded, pcbEncoded, *pcbEncoded)))
ret = pCryptEncodeObject(dwCertEncodingType,
lpszStructType, pvStructInfo, *(BYTE **)pvEncoded,
pcbEncoded);
}
else
ret = pCryptEncodeObject(dwCertEncodingType, lpszStructType,
pvStructInfo, pvEncoded, pcbEncoded);
}
else
SetLastError(ERROR_FILE_NOT_FOUND);
}
if (hFunc)
CryptFreeOIDFunctionAddress(hFunc, 0);
return ret;