Commit 5e17fe9a authored by Detlef Riekenberg's avatar Detlef Riekenberg Committed by Alexandre Julliard

crypt32/tests: CertAddCertificateLinkToStore is not present on W98.

parent 16047ebc
......@@ -102,6 +102,7 @@ static BOOL (WINAPI *pCertEnumSystemStore)(DWORD,void*,void*,PFN_CERT_ENUM_SYSTE
static BOOL (WINAPI *pCertGetStoreProperty)(HCERTSTORE,DWORD,void*,DWORD*);
static void (WINAPI *pCertRemoveStoreFromCollection)(HCERTSTORE,HCERTSTORE);
static BOOL (WINAPI *pCertSetStoreProperty)(HCERTSTORE,DWORD,DWORD,const void*);
static BOOL (WINAPI *pCertAddCertificateLinkToStore)(HCERTSTORE,PCCERT_CONTEXT,DWORD,PCCERT_CONTEXT*);
static void testMemStore(void)
{
......@@ -633,7 +634,7 @@ static void testCollectionStore(void)
ok(ret, "CertAddEncodedCertificateToStore failed: %08x\n", GetLastError());
CertDeleteCertificateFromStore(context);
CertAddStoreToCollection(collection, store1,
pCertAddStoreToCollection(collection, store1,
CERT_PHYSICAL_STORE_ADD_ENABLE_FLAG, 0);
ret = CertAddEncodedCertificateToStore(collection, X509_ASN_ENCODING,
......@@ -2189,26 +2190,32 @@ static void testAddCertificateLink(void)
WCHAR filename1[MAX_PATH], filename2[MAX_PATH];
HANDLE file;
if (!pCertAddCertificateLinkToStore)
{
win_skip("CertAddCertificateLinkToStore not found\n");
return;
}
if (0)
{
/* Crashes, i.e. the store is dereferenced without checking. */
ret = CertAddCertificateLinkToStore(NULL, NULL, 0, NULL);
ret = pCertAddCertificateLinkToStore(NULL, NULL, 0, NULL);
}
/* Adding a certificate link to a store requires a valid add disposition */
store1 = CertOpenStore(CERT_STORE_PROV_MEMORY, 0, 0,
CERT_STORE_CREATE_NEW_FLAG, NULL);
SetLastError(0xdeadbeef);
ret = CertAddCertificateLinkToStore(store1, NULL, 0, NULL);
ret = pCertAddCertificateLinkToStore(store1, NULL, 0, NULL);
ok(!ret && GetLastError() == E_INVALIDARG,
"expected E_INVALIDARG, got %08x\n", GetLastError());
source = CertCreateCertificateContext(X509_ASN_ENCODING, bigCert,
sizeof(bigCert));
SetLastError(0xdeadbeef);
ret = CertAddCertificateLinkToStore(store1, source, 0, NULL);
ret = pCertAddCertificateLinkToStore(store1, source, 0, NULL);
ok(!ret && GetLastError() == E_INVALIDARG,
"expected E_INVALIDARG, got %08x\n", GetLastError());
ret = CertAddCertificateLinkToStore(store1, source, CERT_STORE_ADD_ALWAYS,
ret = pCertAddCertificateLinkToStore(store1, source, CERT_STORE_ADD_ALWAYS,
NULL);
ok(ret, "CertAddCertificateLinkToStore failed: %08x\n", GetLastError());
if (0)
......@@ -2216,14 +2223,14 @@ static void testAddCertificateLink(void)
/* Crashes, i.e. the source certificate is dereferenced without
* checking when a valid add disposition is given.
*/
ret = CertAddCertificateLinkToStore(store1, NULL, CERT_STORE_ADD_ALWAYS,
ret = pCertAddCertificateLinkToStore(store1, NULL, CERT_STORE_ADD_ALWAYS,
NULL);
}
CertCloseStore(store1, 0);
store1 = CertOpenStore(CERT_STORE_PROV_MEMORY, 0, 0,
CERT_STORE_CREATE_NEW_FLAG, NULL);
ret = CertAddCertificateLinkToStore(store1, source, CERT_STORE_ADD_ALWAYS,
ret = pCertAddCertificateLinkToStore(store1, source, CERT_STORE_ADD_ALWAYS,
&linked);
ok(ret, "CertAddCertificateLinkToStore failed: %08x\n", GetLastError());
if (ret)
......@@ -2295,7 +2302,7 @@ static void testAddCertificateLink(void)
/* Test adding a link to a memory store. */
store2 = CertOpenStore(CERT_STORE_PROV_MEMORY, 0, 0,
CERT_STORE_CREATE_NEW_FLAG, NULL);
ret = CertAddCertificateLinkToStore(store2, source, CERT_STORE_ADD_ALWAYS,
ret = pCertAddCertificateLinkToStore(store2, source, CERT_STORE_ADD_ALWAYS,
&linked);
ok(ret, "CertAddCertificateLinkToStore failed: %08x\n", GetLastError());
if (ret)
......@@ -2355,7 +2362,7 @@ static void testAddCertificateLink(void)
ok(store2 != NULL, "CertOpenStore failed: %08x\n", GetLastError());
CloseHandle(file);
/* Test adding a link to a file store. */
ret = CertAddCertificateLinkToStore(store2, source, CERT_STORE_ADD_ALWAYS,
ret = pCertAddCertificateLinkToStore(store2, source, CERT_STORE_ADD_ALWAYS,
&linked);
ok(ret, "CertAddCertificateLinkToStore failed: %08x\n", GetLastError());
if (ret)
......@@ -2397,7 +2404,7 @@ static void testAddCertificateLink(void)
source = CertCreateCertificateContext(X509_ASN_ENCODING, bigCert,
sizeof(bigCert));
SetLastError(0xdeadbeef);
ret = CertAddCertificateLinkToStore(store1, source, CERT_STORE_ADD_ALWAYS,
ret = pCertAddCertificateLinkToStore(store1, source, CERT_STORE_ADD_ALWAYS,
&linked);
ok(!ret && GetLastError() == E_INVALIDARG,
"expected E_INVALIDARG, got %08x\n", GetLastError());
......@@ -2424,7 +2431,7 @@ static void testAddCertificateLink(void)
ok(store2 != NULL, "CertOpenStore failed: %08x\n", GetLastError());
CloseHandle(file);
ret = CertAddCertificateLinkToStore(store2, source, CERT_STORE_ADD_ALWAYS,
ret = pCertAddCertificateLinkToStore(store2, source, CERT_STORE_ADD_ALWAYS,
&linked);
ok(ret, "CertAddCertificateLinkToStore failed: %08x\n", GetLastError());
if (ret)
......@@ -2447,7 +2454,7 @@ static void testAddCertificateLink(void)
store2 = CertOpenStore(CERT_STORE_PROV_SYSTEM_REGISTRY, 0, 0,
CERT_SYSTEM_STORE_CURRENT_USER, WineTestW);
ok(store2 != NULL, "CertOpenStore failed: %08x\n", GetLastError());
ret = CertAddCertificateLinkToStore(store2, source, CERT_STORE_ADD_ALWAYS,
ret = pCertAddCertificateLinkToStore(store2, source, CERT_STORE_ADD_ALWAYS,
&linked);
ok(ret, "CertAddCertificateLinkToStore failed: %08x\n", GetLastError());
if (ret)
......@@ -2573,6 +2580,7 @@ START_TEST(store)
pCertGetStoreProperty = (void*)GetProcAddress(hdll, "CertGetStoreProperty");
pCertRemoveStoreFromCollection = (void*)GetProcAddress(hdll, "CertRemoveStoreFromCollection");
pCertSetStoreProperty = (void*)GetProcAddress(hdll, "CertSetStoreProperty");
pCertAddCertificateLinkToStore = (void*)GetProcAddress(hdll, "CertAddCertificateLinkToStore");
/* various combinations of CertOpenStore */
testMemStore();
......
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