crypt32(1/4): Correct loading OID functions from the registry
Juan Lang
juan.lang at gmail.com
Thu Aug 9 15:26:29 CDT 2007
--Juan
-------------- next part --------------
From 7a4207f413a5c010ab74aee9f39475a08ea20f43 Mon Sep 17 00:00:00 2001
From: Juan Lang <juan.lang at gmail.com>
Date: Thu, 9 Aug 2007 13:18:05 -0700
Subject: [PATCH] Correct loading OID functions from the registry
---
dlls/crypt32/oid.c | 14 ++++++++------
1 files changed, 8 insertions(+), 6 deletions(-)
diff --git a/dlls/crypt32/oid.c b/dlls/crypt32/oid.c
index 4b51a70..98ced9e 100644
--- a/dlls/crypt32/oid.c
+++ b/dlls/crypt32/oid.c
@@ -177,7 +177,8 @@ static char *CRYPT_GetKeyName(DWORD dwEn
len = sizeof(szEncodingTypeFmt) + lstrlenA(pszFuncName) + lstrlenA(oid);
szKey = CryptMemAlloc(len);
if (szKey)
- sprintf(szKey, szEncodingTypeFmt, dwEncodingType, pszFuncName, oid);
+ sprintf(szKey, szEncodingTypeFmt,
+ GET_CERT_ENCODING_TYPE(dwEncodingType), pszFuncName, oid);
return szKey;
}
@@ -250,7 +251,7 @@ BOOL WINAPI CryptInstallOIDFunctionAddre
func = CryptMemAlloc(sizeof(struct OIDFunction));
if (func)
{
- func->encoding = dwEncodingType;
+ func->encoding = GET_CERT_ENCODING_TYPE(dwEncodingType);
if (HIWORD(rgFuncEntry[i].pszOID))
{
LPSTR oid;
@@ -290,7 +291,7 @@ static BOOL CRYPT_GetFuncFromReg(DWORD d
DWORD type, size = 0;
rc = RegQueryValueExA(key, "FuncName", NULL, &type, NULL, &size);
- if (rc == ERROR_MORE_DATA && type == REG_SZ)
+ if ((!rc || rc == ERROR_MORE_DATA) && type == REG_SZ)
{
funcName = CryptMemAlloc(size);
rc = RegQueryValueExA(key, "FuncName", NULL, &type,
@@ -299,7 +300,7 @@ static BOOL CRYPT_GetFuncFromReg(DWORD d
else
funcName = szFuncName;
rc = RegQueryValueExW(key, DllW, NULL, &type, NULL, &size);
- if (rc == ERROR_MORE_DATA && type == REG_SZ)
+ if ((!rc || rc == ERROR_MORE_DATA) && type == REG_SZ)
{
LPWSTR dllName = CryptMemAlloc(size);
@@ -318,7 +319,7 @@ static BOOL CRYPT_GetFuncFromReg(DWORD d
lib = LoadLibraryW(dllName);
if (lib)
{
- *ppvFuncAddr = GetProcAddress(lib, szFuncName);
+ *ppvFuncAddr = GetProcAddress(lib, funcName);
if (*ppvFuncAddr)
{
*phFuncAddr = (HCRYPTOIDFUNCADDR)lib;
@@ -368,7 +369,7 @@ BOOL WINAPI CryptGetOIDFunctionAddress(H
EnterCriticalSection(&set->cs);
LIST_FOR_EACH_ENTRY(function, &set->functions, struct OIDFunction, next)
{
- if (function->encoding == dwEncodingType)
+ if (function->encoding == GET_CERT_ENCODING_TYPE(dwEncodingType))
{
if (HIWORD(pszOID))
{
@@ -395,6 +396,7 @@ BOOL WINAPI CryptGetOIDFunctionAddress(H
if (!*ppvFuncAddr)
ret = CRYPT_GetFuncFromReg(dwEncodingType, pszOID, set->name,
ppvFuncAddr, phFuncAddr);
+ TRACE("returning %d\n", ret);
return ret;
}
--
1.4.1
More information about the wine-patches
mailing list