crypt32: Update definition of CERT_CHAIN_ENGINE_CONFIG.

This commit is contained in:
Juan Lang 2010-05-19 18:06:54 -07:00 committed by Alexandre Julliard
parent f38336d82a
commit d3db308853
3 changed files with 40 additions and 9 deletions

View File

@ -152,6 +152,20 @@ HCERTCHAINENGINE CRYPT_CreateChainEngine(HCERTSTORE root,
return engine; return engine;
} }
typedef struct _CERT_CHAIN_ENGINE_CONFIG_NO_EXCLUSIVE_ROOT
{
DWORD cbSize;
HCERTSTORE hRestrictedRoot;
HCERTSTORE hRestrictedTrust;
HCERTSTORE hRestrictedOther;
DWORD cAdditionalStore;
HCERTSTORE *rghAdditionalStore;
DWORD dwFlags;
DWORD dwUrlRetrievalTimeout;
DWORD MaximumCachedCertificates;
DWORD CycleDetectionModulus;
} CERT_CHAIN_ENGINE_CONFIG_NO_EXCLUSIVE_ROOT;
BOOL WINAPI CertCreateCertificateChainEngine(PCERT_CHAIN_ENGINE_CONFIG pConfig, BOOL WINAPI CertCreateCertificateChainEngine(PCERT_CHAIN_ENGINE_CONFIG pConfig,
HCERTCHAINENGINE *phChainEngine) HCERTCHAINENGINE *phChainEngine)
{ {
@ -159,7 +173,8 @@ BOOL WINAPI CertCreateCertificateChainEngine(PCERT_CHAIN_ENGINE_CONFIG pConfig,
TRACE("(%p, %p)\n", pConfig, phChainEngine); TRACE("(%p, %p)\n", pConfig, phChainEngine);
if (pConfig->cbSize != sizeof(*pConfig)) if (pConfig->cbSize != sizeof(CERT_CHAIN_ENGINE_CONFIG_NO_EXCLUSIVE_ROOT)
&& pConfig->cbSize != sizeof(CERT_CHAIN_ENGINE_CONFIG))
{ {
SetLastError(E_INVALIDARG); SetLastError(E_INVALIDARG);
return FALSE; return FALSE;

View File

@ -60,11 +60,25 @@ static BOOL (WINAPI *pCertVerifyCertificateChainPolicy)(LPCSTR,PCCERT_CHAIN_CONT
#define IS_INTOID(x) (((ULONG_PTR)(x) >> 16) == 0) #define IS_INTOID(x) (((ULONG_PTR)(x) >> 16) == 0)
typedef struct _CERT_CHAIN_ENGINE_CONFIG_NO_EXCLUSIVE_ROOT
{
DWORD cbSize;
HCERTSTORE hRestrictedRoot;
HCERTSTORE hRestrictedTrust;
HCERTSTORE hRestrictedOther;
DWORD cAdditionalStore;
HCERTSTORE *rghAdditionalStore;
DWORD dwFlags;
DWORD dwUrlRetrievalTimeout;
DWORD MaximumCachedCertificates;
DWORD CycleDetectionModulus;
} CERT_CHAIN_ENGINE_CONFIG_NO_EXCLUSIVE_ROOT;
static void testCreateCertChainEngine(void) static void testCreateCertChainEngine(void)
{ {
BOOL ret; BOOL ret;
CERT_CHAIN_ENGINE_CONFIG config = { 0 }; CERT_CHAIN_ENGINE_CONFIG_NO_EXCLUSIVE_ROOT config = { 0 };
CERT_CHAIN_ENGINE_CONFIG *pConfig = (CERT_CHAIN_ENGINE_CONFIG *)&config;
HCERTCHAINENGINE engine; HCERTCHAINENGINE engine;
HCERTSTORE store; HCERTSTORE store;
@ -77,21 +91,21 @@ static void testCreateCertChainEngine(void)
/* Crash /* Crash
ret = pCertCreateCertificateChainEngine(NULL, NULL); ret = pCertCreateCertificateChainEngine(NULL, NULL);
ret = pCertCreateCertificateChainEngine(NULL, &engine); ret = pCertCreateCertificateChainEngine(NULL, &engine);
ret = pCertCreateCertificateChainEngine(&config, NULL); ret = pCertCreateCertificateChainEngine(pConfig, NULL);
*/ */
ret = pCertCreateCertificateChainEngine(&config, &engine); ret = pCertCreateCertificateChainEngine(pConfig, &engine);
ok(!ret && GetLastError() == E_INVALIDARG, ok(!ret && GetLastError() == E_INVALIDARG,
"Expected E_INVALIDARG, got %08x\n", GetLastError()); "Expected E_INVALIDARG, got %08x\n", GetLastError());
/* Crashes /* Crashes
config.cbSize = sizeof(config); config.cbSize = sizeof(config);
ret = pCertCreateCertificateChainEngine(&config, NULL); ret = pCertCreateCertificateChainEngine(pConfig, NULL);
*/ */
config.cbSize = sizeof(config); config.cbSize = sizeof(config);
ret = pCertCreateCertificateChainEngine(&config, &engine); ret = pCertCreateCertificateChainEngine(pConfig, &engine);
ok(ret, "CertCreateCertificateChainEngine failed: %08x\n", GetLastError()); ok(ret, "CertCreateCertificateChainEngine failed: %08x\n", GetLastError());
pCertFreeCertificateChainEngine(engine); pCertFreeCertificateChainEngine(engine);
config.dwFlags = 0xff000000; config.dwFlags = 0xff000000;
ret = pCertCreateCertificateChainEngine(&config, &engine); ret = pCertCreateCertificateChainEngine(pConfig, &engine);
ok(ret, "CertCreateCertificateChainEngine failed: %08x\n", GetLastError()); ok(ret, "CertCreateCertificateChainEngine failed: %08x\n", GetLastError());
pCertFreeCertificateChainEngine(engine); pCertFreeCertificateChainEngine(engine);
@ -99,7 +113,7 @@ static void testCreateCertChainEngine(void)
store = CertOpenStore(CERT_STORE_PROV_MEMORY, 0, 0, store = CertOpenStore(CERT_STORE_PROV_MEMORY, 0, 0,
CERT_STORE_CREATE_NEW_FLAG, NULL); CERT_STORE_CREATE_NEW_FLAG, NULL);
config.hRestrictedRoot = store; config.hRestrictedRoot = store;
ret = pCertCreateCertificateChainEngine(&config, &engine); ret = pCertCreateCertificateChainEngine(pConfig, &engine);
ok(ret, "CertCreateCertificateChainEngine failed: %08x\n", GetLastError()); ok(ret, "CertCreateCertificateChainEngine failed: %08x\n", GetLastError());
pCertFreeCertificateChainEngine(engine); pCertFreeCertificateChainEngine(engine);
@ -108,7 +122,7 @@ static void testCreateCertChainEngine(void)
*/ */
CertAddEncodedCertificateToStore(store, X509_ASN_ENCODING, selfSignedCert, CertAddEncodedCertificateToStore(store, X509_ASN_ENCODING, selfSignedCert,
sizeof(selfSignedCert), CERT_STORE_ADD_ALWAYS, NULL); sizeof(selfSignedCert), CERT_STORE_ADD_ALWAYS, NULL);
ret = pCertCreateCertificateChainEngine(&config, &engine); ret = pCertCreateCertificateChainEngine(pConfig, &engine);
ok(!ret && GetLastError() == CRYPT_E_NOT_FOUND, ok(!ret && GetLastError() == CRYPT_E_NOT_FOUND,
"Expected CRYPT_E_NOT_FOUND, got %08x\n", GetLastError()); "Expected CRYPT_E_NOT_FOUND, got %08x\n", GetLastError());

View File

@ -3389,6 +3389,8 @@ typedef struct _CERT_CHAIN_ENGINE_CONFIG
DWORD dwUrlRetrievalTimeout; DWORD dwUrlRetrievalTimeout;
DWORD MaximumCachedCertificates; DWORD MaximumCachedCertificates;
DWORD CycleDetectionModulus; DWORD CycleDetectionModulus;
HCERTSTORE hExclusiveRoot;
HCERTSTORE hExclusiveRootTrustedPeople;
} CERT_CHAIN_ENGINE_CONFIG, *PCERT_CHAIN_ENGINE_CONFIG; } CERT_CHAIN_ENGINE_CONFIG, *PCERT_CHAIN_ENGINE_CONFIG;
/* message-related definitions */ /* message-related definitions */