Commit 49f0331c authored by Paul Gofman's avatar Paul Gofman Committed by Alexandre Julliard

crypt32: Use CERT_STORE_ADD_ALWAYS when reading certs from registry.

parent 3d38e859
...@@ -56,8 +56,7 @@ static void CRYPT_HashToStr(const BYTE *hash, LPWSTR asciiHash) ...@@ -56,8 +56,7 @@ static void CRYPT_HashToStr(const BYTE *hash, LPWSTR asciiHash)
wsprintfW(asciiHash + i * 2, L"%02X", hash[i]); wsprintfW(asciiHash + i * 2, L"%02X", hash[i]);
} }
static void CRYPT_RegReadSerializedFromReg(HKEY key, DWORD contextType, static void CRYPT_RegReadSerializedFromReg(HKEY key, DWORD contextType, HCERTSTORE store, DWORD disposition)
HCERTSTORE store)
{ {
LONG rc; LONG rc;
DWORD index = 0; DWORD index = 0;
...@@ -130,7 +129,7 @@ static void CRYPT_RegReadSerializedFromReg(HKEY key, DWORD contextType, ...@@ -130,7 +129,7 @@ static void CRYPT_RegReadSerializedFromReg(HKEY key, DWORD contextType,
TRACE("hash matches, adding\n"); TRACE("hash matches, adding\n");
contextInterface->addContextToStore( contextInterface->addContextToStore(
store, context, store, context,
CERT_STORE_ADD_REPLACE_EXISTING, NULL); disposition, NULL);
} }
else else
TRACE("hash doesn't match, ignoring\n"); TRACE("hash doesn't match, ignoring\n");
...@@ -149,7 +148,7 @@ static void CRYPT_RegReadSerializedFromReg(HKEY key, DWORD contextType, ...@@ -149,7 +148,7 @@ static void CRYPT_RegReadSerializedFromReg(HKEY key, DWORD contextType,
} while (!rc); } while (!rc);
} }
static void CRYPT_RegReadFromReg(HKEY key, HCERTSTORE store) static void CRYPT_RegReadFromReg(HKEY key, HCERTSTORE store, DWORD disposition)
{ {
static const WCHAR * const subKeys[] = { L"Certificates", L"CRLs", L"CTLs" }; static const WCHAR * const subKeys[] = { L"Certificates", L"CRLs", L"CTLs" };
static const DWORD contextFlags[] = { CERT_STORE_CERTIFICATE_CONTEXT_FLAG, static const DWORD contextFlags[] = { CERT_STORE_CERTIFICATE_CONTEXT_FLAG,
...@@ -165,7 +164,7 @@ static void CRYPT_RegReadFromReg(HKEY key, HCERTSTORE store) ...@@ -165,7 +164,7 @@ static void CRYPT_RegReadFromReg(HKEY key, HCERTSTORE store)
&hKey, NULL); &hKey, NULL);
if (!rc) if (!rc)
{ {
CRYPT_RegReadSerializedFromReg(hKey, contextFlags[i], store); CRYPT_RegReadSerializedFromReg(hKey, contextFlags[i], store, disposition);
RegCloseKey(hKey); RegCloseKey(hKey);
} }
} }
...@@ -463,7 +462,7 @@ static BOOL WINAPI CRYPT_RegControl(HCERTSTORE hCertStore, DWORD dwFlags, ...@@ -463,7 +462,7 @@ static BOOL WINAPI CRYPT_RegControl(HCERTSTORE hCertStore, DWORD dwFlags,
CERT_STORE_CREATE_NEW_FLAG, NULL); CERT_STORE_CREATE_NEW_FLAG, NULL);
CRYPT_RegFlushStore(store, FALSE); CRYPT_RegFlushStore(store, FALSE);
CRYPT_RegReadFromReg(store->key, memStore); CRYPT_RegReadFromReg(store->key, memStore, CERT_STORE_ADD_REPLACE_EXISTING);
I_CertUpdateStore(store->memStore, memStore, 0, 0); I_CertUpdateStore(store->memStore, memStore, 0, 0);
CertCloseStore(memStore, 0); CertCloseStore(memStore, 0);
break; break;
...@@ -551,7 +550,7 @@ WINECRYPT_CERTSTORE *CRYPT_RegOpenStore(HCRYPTPROV hCryptProv, DWORD dwFlags, ...@@ -551,7 +550,7 @@ WINECRYPT_CERTSTORE *CRYPT_RegOpenStore(HCRYPTPROV hCryptProv, DWORD dwFlags,
list_init(&regInfo->certsToDelete); list_init(&regInfo->certsToDelete);
list_init(&regInfo->crlsToDelete); list_init(&regInfo->crlsToDelete);
list_init(&regInfo->ctlsToDelete); list_init(&regInfo->ctlsToDelete);
CRYPT_RegReadFromReg(regInfo->key, regInfo->memStore); CRYPT_RegReadFromReg(regInfo->key, regInfo->memStore, CERT_STORE_ADD_ALWAYS);
regInfo->dirty = FALSE; regInfo->dirty = FALSE;
provInfo.cbSize = sizeof(provInfo); provInfo.cbSize = sizeof(provInfo);
provInfo.cStoreProvFunc = ARRAY_SIZE(regProvFuncs); provInfo.cStoreProvFunc = ARRAY_SIZE(regProvFuncs);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment