ReactOS 0.4.16-dev-1946-g52006dd
store.c File Reference
#include <stdio.h>
#include <stdarg.h>
#include <windef.h>
#include <winbase.h>
#include <winuser.h>
#include <shlobj.h>
#include <shlwapi.h>
#include <winreg.h>
#include <winerror.h>
#include <wincrypt.h>
#include "wine/test.h"
Include dependency graph for store.c:

Go to the source code of this file.

Classes

struct  CertPropIDHeader
 
struct  EnumSystemStoreInfo
 

Macros

#define CERT_CERT_PROP_ID   32
 
#define CERT_CRL_PROP_ID   33
 
#define CERT_CTL_PROP_ID   34
 
#define test_store_is_empty(store)   _test_store_is_empty(__LINE__,store)
 

Functions

static void _test_store_is_empty (unsigned line, HCERTSTORE store)
 
static void testMemStore (void)
 
static void compareStore (HCERTSTORE store, LPCSTR name, const BYTE *pb, DWORD cb, BOOL todo)
 
static void testRegStoreSavedCerts (void)
 
static void testStoresInCollection (void)
 
static void testCollectionStore (void)
 
static const struct CertPropIDHeaderfindPropID (const BYTE *buf, DWORD size, DWORD propID)
 
static void testRegStore (void)
 
static void testSystemRegStore (void)
 
static void testSystemStore (void)
 
static void testFileStore (void)
 
static BOOL initFileFromData (LPCWSTR filename, const BYTE *pb, DWORD cb)
 
static void testFileNameStore (void)
 
static void testMessageStore (void)
 
static void testSerializedStore (void)
 
static void testCertOpenSystemStore (void)
 
static void testCertRegisterSystemStore (void)
 
static BOOL CALLBACK enumSystemStoreCB (const void *systemStore, DWORD dwFlags, PCERT_SYSTEM_STORE_INFO pStoreInfo, void *pvReserved, void *pvArg)
 
static void testCertEnumSystemStore (void)
 
static void testStoreProperty (void)
 
static void testAddSerialized (void)
 
static void delete_test_key (void)
 
static void testAddCertificateLink (void)
 
static DWORD countCertsInStore (HCERTSTORE store)
 
static DWORD countCRLsInStore (HCERTSTORE store)
 
static void testEmptyStore (void)
 
static void testCloseStore (void)
 
static void test_I_UpdateStore (void)
 
static void test_PFXImportCertStore (void)
 
static void test_CryptQueryObject (void)
 
 START_TEST (store)
 

Variables

static const BYTE emptyCert [] = { 0x30, 0x00 }
 
static const BYTE bigCert []
 
static const BYTE signedBigCert []
 
static const BYTE serializedCert []
 
static const BYTE signedCRL []
 
static const BYTE bigCert2 []
 
static const BYTE signedCTLWithCTLInnerContent []
 
static const BYTE serializedStoreWithCert []
 
struct {
   HKEY   key
 
   DWORD   cert_store
 
   BOOL   appdata_file
 
   WCHAR   store_name [16]
 
   const WCHAR *   base_reg_path
 
reg_store_saved_certs []
 
static const BYTE serializedStoreWithCertAndCRL []
 
static const BYTE base64SPC []
 
static const WCHAR utf16Base64SPC []
 
static const BYTE signedContent []
 
static const BYTE signedWithCertAndCrlBareContent []
 
static const BYTE hashContent []
 
static const BYTE hashBareContent []
 
struct {
   DWORD   cert_store
 
   BOOL   expected
 
   BOOL   todo
 
reg_system_store_test_data []
 
static const BYTE serializedCertWithFriendlyName []
 
static const BYTE serializedStoreWithCertWithFriendlyName []
 
static const BYTE serializedStoreWithCertAndHash []
 
static const BYTE pfxdata []
 

Macro Definition Documentation

◆ CERT_CERT_PROP_ID

#define CERT_CERT_PROP_ID   32

Definition at line 36 of file store.c.

◆ CERT_CRL_PROP_ID

#define CERT_CRL_PROP_ID   33

Definition at line 37 of file store.c.

◆ CERT_CTL_PROP_ID

#define CERT_CTL_PROP_ID   34

Definition at line 38 of file store.c.

◆ test_store_is_empty

#define test_store_is_empty (   store)    _test_store_is_empty(__LINE__,store)

Definition at line 120 of file store.c.

Function Documentation

◆ _test_store_is_empty()

static void _test_store_is_empty ( unsigned  line,
HCERTSTORE  store 
)
static

Definition at line 121 of file store.c.

122{
123 const CERT_CONTEXT *cert;
124
126 ok_(__FILE__,line)(!cert && GetLastError() == CRYPT_E_NOT_FOUND, "store is not empty\n");
127}
#define ok_(x1, x2)
Definition: atltest.h:61
#define NULL
Definition: types.h:112
PCCERT_CONTEXT WINAPI CertEnumCertificatesInStore(HCERTSTORE hCertStore, PCCERT_CONTEXT pPrev)
Definition: store.c:928
static BYTE cert[]
Definition: msg.c:1374
Definition: parser.c:49
DWORD WINAPI GetLastError(void)
Definition: except.c:1042
#define CRYPT_E_NOT_FOUND
Definition: winerror.h:4421

◆ compareStore()

static void compareStore ( HCERTSTORE  store,
LPCSTR  name,
const BYTE pb,
DWORD  cb,
BOOL  todo 
)
static

Definition at line 302 of file store.c.

304{
305 BOOL ret;
306 CRYPT_DATA_BLOB blob = { 0, NULL };
307
310 ok(ret, "CertSaveStore failed: %08lx\n", GetLastError());
312 ok(blob.cbData == cb, "%s: expected size %ld, got %ld\n", name, cb,
313 blob.cbData);
314 blob.pbData = malloc(blob.cbData);
315 if (blob.pbData)
316 {
319 ok(ret, "CertSaveStore failed: %08lx\n", GetLastError());
321 ok(!memcmp(pb, blob.pbData, cb), "%s: unexpected value\n", name);
322 free(blob.pbData);
323 }
324}
int memcmp(void *Buffer1, void *Buffer2, ACPI_SIZE Count)
Definition: utclib.c:112
#define ok(value,...)
Definition: atltest.h:57
#define free
Definition: debug_ros.c:5
#define malloc
Definition: debug_ros.c:4
return ret
Definition: mutex.c:146
unsigned int BOOL
Definition: ntddk_ex.h:94
#define todo_wine_if(is_todo)
Definition: minitest.h:81
BOOL todo
Definition: store.c:2001
static HMODULE MODULEINFO DWORD cb
Definition: module.c:33
BOOL WINAPI CertSaveStore(HCERTSTORE hCertStore, DWORD dwMsgAndCertEncodingType, DWORD dwSaveAs, DWORD dwSaveTo, void *pvSaveToPara, DWORD dwFlags)
Definition: serialize.c:895
Definition: image.c:134
Definition: name.c:39
#define CERT_STORE_SAVE_AS_STORE
Definition: wincrypt.h:2793
#define X509_ASN_ENCODING
Definition: wincrypt.h:2501
#define CERT_STORE_SAVE_TO_MEMORY
Definition: wincrypt.h:2797

Referenced by testAddCertificateLink(), testCollectionStore(), testFileNameStore(), and testFileStore().

◆ countCertsInStore()

static DWORD countCertsInStore ( HCERTSTORE  store)
static

Definition at line 2705 of file store.c.

2706{
2708 DWORD certs = 0;
2709
2710 do {
2712 if (cert)
2713 certs++;
2714 } while (cert);
2715 return certs;
2716}
unsigned long DWORD
Definition: ntddk_ex.h:95

Referenced by test_I_UpdateStore(), and test_PFXImportCertStore().

◆ countCRLsInStore()

static DWORD countCRLsInStore ( HCERTSTORE  store)
static

Definition at line 2718 of file store.c.

2719{
2721 DWORD crls = 0;
2722
2723 do {
2724 crl = CertEnumCRLsInStore(store, crl);
2725 if (crl)
2726 crls++;
2727 } while (crl);
2728 return crls;
2729}
PCCRL_CONTEXT WINAPI CertEnumCRLsInStore(HCERTSTORE hCertStore, PCCRL_CONTEXT pPrev)
Definition: store.c:1101
static const BYTE crl[]
Definition: message.c:817

Referenced by test_I_UpdateStore().

◆ delete_test_key()

static void delete_test_key ( void  )
static

Definition at line 2388 of file store.c.

2389{
2390 HKEY root_key, test_key;
2391 WCHAR subkey_name[32];
2392 DWORD num_subkeys, subkey_name_len;
2393 int idx;
2394
2395 if (RegOpenKeyExW(HKEY_CURRENT_USER, L"Software\\Microsoft\\SystemCertificates", 0, KEY_READ, &root_key))
2396 return;
2397 if (RegOpenKeyExW(root_key, L"WineTest", 0, KEY_READ, &test_key))
2398 {
2399 RegCloseKey(root_key);
2400 return;
2401 }
2402 RegQueryInfoKeyW(test_key, NULL, NULL, NULL, &num_subkeys, NULL, NULL, NULL, NULL, NULL, NULL, NULL);
2403 for (idx = num_subkeys; idx-- > 0;)
2404 {
2405 subkey_name_len = ARRAY_SIZE(subkey_name);
2406 RegEnumKeyExW(test_key, idx, subkey_name, &subkey_name_len, NULL, NULL, NULL, NULL);
2407 RegDeleteKeyW(test_key, subkey_name);
2408 }
2409 RegCloseKey(test_key);
2410 RegDeleteKeyW(root_key, L"WineTest");
2411 RegCloseKey(root_key);
2412}
#define ARRAY_SIZE(A)
Definition: main.h:20
#define RegCloseKey(hKey)
Definition: registry.h:49
unsigned int idx
Definition: utils.c:41
LONG WINAPI RegOpenKeyExW(HKEY hKey, LPCWSTR lpSubKey, DWORD ulOptions, REGSAM samDesired, PHKEY phkResult)
Definition: reg.c:3333
LONG WINAPI RegEnumKeyExW(_In_ HKEY hKey, _In_ DWORD dwIndex, _Out_ LPWSTR lpName, _Inout_ LPDWORD lpcbName, _Reserved_ LPDWORD lpReserved, _Out_opt_ LPWSTR lpClass, _Inout_opt_ LPDWORD lpcbClass, _Out_opt_ PFILETIME lpftLastWriteTime)
Definition: reg.c:2504
LONG WINAPI RegDeleteKeyW(_In_ HKEY hKey, _In_ LPCWSTR lpSubKey)
Definition: reg.c:1239
LONG WINAPI RegQueryInfoKeyW(HKEY hKey, LPWSTR lpClass, LPDWORD lpcClass, LPDWORD lpReserved, LPDWORD lpcSubKeys, LPDWORD lpcMaxSubKeyLen, LPDWORD lpcMaxClassLen, LPDWORD lpcValues, LPDWORD lpcMaxValueNameLen, LPDWORD lpcMaxValueLen, LPDWORD lpcbSecurityDescriptor, PFILETIME lpftLastWriteTime)
Definition: reg.c:3662
#define L(x)
Definition: resources.c:13
#define KEY_READ
Definition: nt_native.h:1026
#define HKEY_CURRENT_USER
Definition: winreg.h:11
__wchar_t WCHAR
Definition: xmlstorage.h:180

Referenced by testAddCertificateLink().

◆ enumSystemStoreCB()

static BOOL CALLBACK enumSystemStoreCB ( const void systemStore,
DWORD  dwFlags,
PCERT_SYSTEM_STORE_INFO  pStoreInfo,
void pvReserved,
void pvArg 
)
static

Definition at line 2078 of file store.c.

2080{
2081 struct EnumSystemStoreInfo *info = pvArg;
2082
2083 info->storeCount++;
2084 return info->goOn;
2085}

Referenced by testCertEnumSystemStore().

◆ findPropID()

static const struct CertPropIDHeader * findPropID ( const BYTE buf,
DWORD  size,
DWORD  propID 
)
static

Definition at line 967 of file store.c.

969{
970 const struct CertPropIDHeader *ret = NULL;
971 BOOL failed = FALSE;
972
973 while (size && !ret && !failed)
974 {
975 if (size < sizeof(struct CertPropIDHeader))
976 failed = TRUE;
977 else
978 {
979 const struct CertPropIDHeader *hdr =
980 (const struct CertPropIDHeader *)buf;
981
982 size -= sizeof(struct CertPropIDHeader);
983 buf += sizeof(struct CertPropIDHeader);
984 if (size < hdr->cb)
985 failed = TRUE;
986 else if (hdr->propID == propID)
987 ret = hdr;
988 else
989 {
990 buf += hdr->cb;
991 size -= hdr->cb;
992 }
993 }
994 }
995 return ret;
996}
#define TRUE
Definition: types.h:120
#define FALSE
Definition: types.h:117
GLsizeiptr size
Definition: glext.h:5919
GLenum GLuint GLenum GLsizei const GLchar * buf
Definition: glext.h:7751
char hdr[14]
Definition: iptest.cpp:33
DWORD propID
Definition: store.c:42

Referenced by testRegStore().

◆ initFileFromData()

static BOOL initFileFromData ( LPCWSTR  filename,
const BYTE pb,
DWORD  cb 
)
static

Definition at line 1540 of file store.c.

1541{
1544 BOOL ret;
1545
1547 {
1548 DWORD written;
1549
1550 ret = WriteFile(file, pb, cb, &written, NULL);
1552 }
1553 else
1554 ret = FALSE;
1555 return ret;
1556}
#define CloseHandle
Definition: compat.h:739
#define INVALID_HANDLE_VALUE
Definition: compat.h:731
#define GENERIC_READ
Definition: compat.h:135
#define CreateFileW
Definition: compat.h:741
#define FILE_ATTRIBUTE_NORMAL
Definition: compat.h:137
BOOL WINAPI WriteFile(IN HANDLE hFile, IN LPCVOID lpBuffer, IN DWORD nNumberOfBytesToWrite OPTIONAL, OUT LPDWORD lpNumberOfBytesWritten, IN LPOVERLAPPED lpOverlapped OPTIONAL)
Definition: rw.c:24
const char * filename
Definition: ioapi.h:137
#define CREATE_ALWAYS
Definition: disk.h:72
#define GENERIC_WRITE
Definition: nt_native.h:90
Definition: fci.c:127

Referenced by testFileNameStore().

◆ START_TEST()

START_TEST ( store  )

Definition at line 3325 of file store.c.

3326{
3327 /* various combinations of CertOpenStore */
3328 testMemStore();
3331
3332 testRegStore();
3334
3337 testFileStore();
3342
3344
3348
3351
3353
3355#ifdef __REACTOS__
3356 if ((GetVersion() & 0xFF) > 5) // test_PFXImportCertStore() crashes on Server 2003
3357#endif
3360}
DWORD WINAPI GetVersion(void)
Definition: version.c:1458
static void testAddSerialized(void)
Definition: store.c:2192
static void test_I_UpdateStore(void)
Definition: store.c:2900
static void testSerializedStore(void)
Definition: store.c:1918
static void testAddCertificateLink(void)
Definition: store.c:2414
static void testCollectionStore(void)
Definition: store.c:607
static void testFileStore(void)
Definition: store.c:1414
static void test_CryptQueryObject(void)
Definition: store.c:3292
static void testMessageStore(void)
Definition: store.c:1806
static void testEmptyStore(void)
Definition: store.c:2731
static void testCertOpenSystemStore(void)
Definition: store.c:1977
static void testStoreProperty(void)
Definition: store.c:2119
static void testCertEnumSystemStore(void)
Definition: store.c:2087
static void testCertRegisterSystemStore(void)
Definition: store.c:2012
static void testRegStoreSavedCerts(void)
Definition: store.c:365
static void testMemStore(void)
Definition: store.c:129
static void testCloseStore(void)
Definition: store.c:2807
static void test_PFXImportCertStore(void)
Definition: store.c:3213
static void testFileNameStore(void)
Definition: store.c:1586
static void testRegStore(void)
Definition: store.c:998
static void testStoresInCollection(void)
Definition: store.c:473
static void testSystemRegStore(void)
Definition: store.c:1267
static void testSystemStore(void)
Definition: store.c:1325

◆ test_CryptQueryObject()

static void test_CryptQueryObject ( void  )
static

Definition at line 3292 of file store.c.

3293{
3294 CRYPT_DATA_BLOB pfx;
3295 DWORD encoding_type, content_type, format_type;
3296 HCERTSTORE store;
3297 HCRYPTMSG msg;
3298 const void *ctx;
3299 BOOL ret;
3300
3301 SetLastError( 0xdeadbeef );
3304 ok( !ret, "success\n" );
3305 ok( GetLastError() == E_INVALIDARG, "got %lu\n", GetLastError() );
3306
3307 pfx.pbData = (BYTE *)pfxdata;
3308 pfx.cbData = sizeof(pfxdata);
3309 encoding_type = content_type = format_type = 0xdeadbeef;
3310 store = (HCERTSTORE *)0xdeadbeef;
3311 msg = (HCRYPTMSG *)0xdeadbeef;
3312 ctx = (void *)0xdeadbeef;
3315 &store, &msg, &ctx );
3316 ok( ret, "got %lu\n", GetLastError() );
3317 ok( encoding_type == X509_ASN_ENCODING, "got %08lx\n", encoding_type );
3318 ok( content_type == CERT_QUERY_CONTENT_PFX, "got %08lx\n", content_type );
3319 ok( format_type == CERT_QUERY_FORMAT_BINARY, "got %08lx\n", format_type );
3320 ok( store == NULL, "got %p\n", store );
3321 ok( msg == NULL, "got %p\n", msg );
3322 ok( ctx == NULL, "got %p\n", ctx );
3323}
#define msg(x)
Definition: auth_time.c:54
format_type
Definition: d3dx9_private.h:49
#define E_INVALIDARG
Definition: ddrawi.h:101
BOOL WINAPI CryptQueryObject(DWORD dwObjectType, const void *pvObject, DWORD dwExpectedContentTypeFlags, DWORD dwExpectedFormatTypeFlags, DWORD dwFlags, DWORD *pdwMsgAndCertEncodingType, DWORD *pdwContentType, DWORD *pdwFormatType, HCERTSTORE *phCertStore, HCRYPTMSG *phMsg, const void **ppvContext)
Definition: object.c:699
#define SetLastError(x)
Definition: compat.h:752
static const BYTE pfxdata[]
Definition: store.c:2971
static BSTR content_type
BYTE * pbData
Definition: wincrypt.h:112
#define CERT_QUERY_CONTENT_FLAG_ALL
Definition: wincrypt.h:3724
#define CERT_QUERY_FORMAT_BINARY
Definition: wincrypt.h:3739
#define CERT_QUERY_OBJECT_BLOB
Definition: wincrypt.h:3687
#define CERT_QUERY_FORMAT_FLAG_BINARY
Definition: wincrypt.h:3743
#define CERT_QUERY_CONTENT_PFX
Definition: wincrypt.h:3700
unsigned char BYTE
Definition: xxhash.c:193

Referenced by START_TEST().

◆ test_I_UpdateStore()

static void test_I_UpdateStore ( void  )
static

Definition at line 2900 of file store.c.

2901{
2902 HMODULE lib = GetModuleHandleA("crypt32");
2903 BOOL (WINAPI *pI_CertUpdatestore)(HCERTSTORE, HCERTSTORE, DWORD, DWORD) =
2904 (void *)GetProcAddress(lib, "I_CertUpdateStore");
2905 BOOL ret;
2906 HCERTSTORE store1, store2;
2908 DWORD certs;
2909
2910 if (!pI_CertUpdatestore)
2911 {
2912 win_skip("No I_CertUpdateStore\n");
2913 return;
2914 }
2919
2920 /* Crash
2921 ret = pI_CertUpdatestore(NULL, NULL, 0, 0);
2922 ret = pI_CertUpdatestore(store1, NULL, 0, 0);
2923 ret = pI_CertUpdatestore(NULL, store2, 0, 0);
2924 */
2925 ret = pI_CertUpdatestore(store1, store2, 0, 0);
2926 ok(ret, "I_CertUpdateStore failed: %08lx\n", GetLastError());
2927
2930 /* I_CertUpdateStore adds the contexts from store2 to store1 */
2931 ret = pI_CertUpdatestore(store1, store2, 0, 0);
2932 ok(ret, "I_CertUpdateStore failed: %08lx\n", GetLastError());
2933 certs = countCertsInStore(store1);
2934 ok(certs == 1, "Expected 1 cert, got %ld\n", certs);
2935 /* Calling it a second time has no effect */
2936 ret = pI_CertUpdatestore(store1, store2, 0, 0);
2937 ok(ret, "I_CertUpdateStore failed: %08lx\n", GetLastError());
2938 certs = countCertsInStore(store1);
2939 ok(certs == 1, "Expected 1 cert, got %ld\n", certs);
2940
2941 /* The last parameters to I_CertUpdateStore appear to be ignored */
2942 ret = pI_CertUpdatestore(store1, store2, 1, 0);
2943 ok(ret, "I_CertUpdateStore failed: %08lx\n", GetLastError());
2944 ret = pI_CertUpdatestore(store1, store2, 0, 1);
2945 ok(ret, "I_CertUpdateStore failed: %08lx\n", GetLastError());
2946
2949
2950 /* I_CertUpdateStore also adds the CRLs from store2 to store1 */
2951 ret = pI_CertUpdatestore(store1, store2, 0, 0);
2952 ok(ret, "I_CertUpdateStore failed: %08lx\n", GetLastError());
2953 certs = countCertsInStore(store1);
2954 ok(certs == 1, "Expected 1 cert, got %ld\n", certs);
2955 certs = countCRLsInStore(store1);
2956 ok(certs == 1, "Expected 1 CRL, got %ld\n", certs);
2957
2959 /* If a context is deleted from store2, I_CertUpdateStore deletes it
2960 * from store1
2961 */
2962 ret = pI_CertUpdatestore(store1, store2, 0, 0);
2963 ok(ret, "I_CertUpdateStore failed: %08lx\n", GetLastError());
2964 certs = countCertsInStore(store1);
2965 ok(certs == 0, "Expected 0 certs, got %ld\n", certs);
2966
2967 CertCloseStore(store1, 0);
2968 CertCloseStore(store2, 0);
2969}
BOOL WINAPI CertAddEncodedCertificateToStore(HCERTSTORE hCertStore, DWORD dwCertEncodingType, const BYTE *pbCertEncoded, DWORD cbCertEncoded, DWORD dwAddDisposition, PCCERT_CONTEXT *ppCertContext)
Definition: cert.c:58
BOOL WINAPI CertAddEncodedCRLToStore(HCERTSTORE hCertStore, DWORD dwCertEncodingType, const BYTE *pbCrlEncoded, DWORD cbCrlEncoded, DWORD dwAddDisposition, PCCRL_CONTEXT *ppCrlContext)
Definition: crl.c:129
HCERTSTORE WINAPI CertOpenStore(LPCSTR lpszStoreProvider, DWORD dwMsgAndCertEncodingType, HCRYPTPROV_LEGACY hCryptProv, DWORD dwFlags, const void *pvPara)
Definition: store.c:815
BOOL WINAPI CertCloseStore(HCERTSTORE hCertStore, DWORD dwFlags)
Definition: store.c:1127
BOOL WINAPI CertDeleteCertificateFromStore(PCCERT_CONTEXT pCertContext)
Definition: store.c:943
#define GetProcAddress(x, y)
Definition: compat.h:753
HMODULE WINAPI DECLSPEC_HOTPATCH GetModuleHandleA(LPCSTR lpModuleName)
Definition: loader.c:812
#define win_skip
Definition: minitest.h:67
static DWORD countCertsInStore(HCERTSTORE store)
Definition: store.c:2705
static const BYTE signedCRL[]
Definition: store.c:83
static const BYTE bigCert[]
Definition: store.c:48
static DWORD countCRLsInStore(HCERTSTORE store)
Definition: store.c:2718
#define BOOL
Definition: nt_native.h:43
#define DWORD
Definition: nt_native.h:44
void * HCERTSTORE
Definition: wincrypt.h:60
#define CERT_STORE_CREATE_NEW_FLAG
Definition: wincrypt.h:2633
#define CERT_STORE_PROV_MEMORY
Definition: wincrypt.h:2455
#define CERT_STORE_ADD_ALWAYS
Definition: wincrypt.h:2654
#define WINAPI
Definition: msvc.h:6

Referenced by START_TEST().

◆ test_PFXImportCertStore()

static void test_PFXImportCertStore ( void  )
static

Definition at line 3213 of file store.c.

3214{
3215 HCERTSTORE store;
3216 CRYPT_DATA_BLOB pfx;
3217 const CERT_CONTEXT *cert;
3219 char buf[512];
3221 CERT_INFO *info;
3222 DWORD count, size;
3223 BOOL ret;
3224
3225 SetLastError( 0xdeadbeef );
3226 store = PFXImportCertStore( NULL, NULL, 0 );
3227 ok( store == NULL, "got %p\n", store );
3228 ok( GetLastError() == ERROR_INVALID_PARAMETER, "got %lu\n", GetLastError() );
3229
3230 pfx.pbData = (BYTE *)pfxdata;
3231 pfx.cbData = sizeof(pfxdata);
3233 ok( store != NULL, "got %lu\n", GetLastError() );
3234 count = countCertsInStore( store );
3235 ok( count == 1, "got %lu\n", count );
3236
3238 ok( cert != NULL, "got %lu\n", GetLastError() );
3239 ok( cert->dwCertEncodingType == X509_ASN_ENCODING, "got %lu\n", cert->dwCertEncodingType );
3240 ok( cert->pbCertEncoded != NULL, "pbCertEncoded not set\n" );
3241 ok( cert->cbCertEncoded == 1123, "got %lu\n", cert->cbCertEncoded );
3242 ok( cert->pCertInfo != NULL, "pCertInfo not set\n" );
3243 ok( cert->hCertStore == store, "got %p\n", cert->hCertStore );
3244
3245 info = cert->pCertInfo;
3246 ok( info->dwVersion == CERT_V1, "got %lu\n", info->dwVersion );
3247 ok( !strcmp(info->SignatureAlgorithm.pszObjId, szOID_RSA_SHA256RSA),
3248 "got \"%s\"\n", info->SignatureAlgorithm.pszObjId );
3249
3250 size = sizeof(key);
3252 ok( ret, "got %08lx\n", GetLastError() );
3253 ok( key.cbSize == sizeof(key), "got %lu\n", key.cbSize );
3254 ok( key.hCryptProv, "hCryptProv not set\n" );
3255 ok( key.dwKeySpec == AT_KEYEXCHANGE, "got %lu\n", key.dwKeySpec );
3256
3257 size = sizeof(buf);
3258 SetLastError( 0xdeadbeef );
3260 ok( !ret && GetLastError() == CRYPT_E_NOT_FOUND, "got %08lx\n", GetLastError() );
3262 CertCloseStore( store, 0 );
3263
3264 /* without PKCS12_NO_PERSIST_KEY */
3266 ok( store != NULL, "got %lu\n", GetLastError() );
3267
3269 ok( cert != NULL, "got %08lx\n", GetLastError() );
3270
3271 size = sizeof(key);
3273 ok( !ret && GetLastError() == CRYPT_E_NOT_FOUND, "got %08lx\n", GetLastError() );
3274
3275 size = sizeof(buf);
3277 ok(ret, "got %lu\n", GetLastError());
3279 CertCloseStore( store, 0 );
3280
3281 /* CRYPT_MACHINE_KEYSET */
3283 ok( store != NULL, "got %lu\n", GetLastError() );
3284
3286 ok( cert != NULL, "got %08lx\n", GetLastError() );
3287
3289 CertCloseStore( store, 0 );
3290}
int strcmp(const char *String1, const char *String2)
Definition: utclib.c:469
HCERTSTORE WINAPI PFXImportCertStore(CRYPT_DATA_BLOB *pPFX, LPCWSTR szPassword, DWORD dwFlags)
Definition: decode.c:6400
BOOL WINAPI CertFreeCertificateContext(PCCERT_CONTEXT pCertContext)
Definition: cert.c:371
PCCERT_CONTEXT WINAPI CertFindCertificateInStore(HCERTSTORE hCertStore, DWORD dwCertEncodingType, DWORD dwFlags, DWORD dwType, const void *pvPara, PCCERT_CONTEXT pPrevCertContext)
Definition: cert.c:1765
BOOL WINAPI CertGetCertificateContextProperty(PCCERT_CONTEXT pCertContext, DWORD dwPropId, void *pvData, DWORD *pcbData)
Definition: cert.c:551
#define ERROR_INVALID_PARAMETER
Definition: compat.h:101
GLuint GLuint GLsizei count
Definition: gl.h:1545
Definition: copy.c:22
#define szOID_RSA_SHA256RSA
Definition: wincrypt.h:3177
#define CERT_KEY_CONTEXT_PROP_ID
Definition: wincrypt.h:2837
#define CRYPT_USER_KEYSET
Definition: wincrypt.h:4320
#define CERT_KEY_PROV_INFO_PROP_ID
Definition: wincrypt.h:2833
#define CERT_V1
Definition: wincrypt.h:2803
#define AT_KEYEXCHANGE
Definition: wincrypt.h:2239
#define PKCS12_NO_PERSIST_KEY
Definition: wincrypt.h:4327
#define CERT_FIND_ANY
Definition: wincrypt.h:3010
#define CRYPT_EXPORTABLE
Definition: wincrypt.h:2410
#define CRYPT_MACHINE_KEYSET
Definition: wincrypt.h:2276

Referenced by START_TEST().

◆ testAddCertificateLink()

static void testAddCertificateLink ( void  )
static

Definition at line 2414 of file store.c.

2415{
2416 BOOL ret;
2417 HCERTSTORE store1, store2;
2418 PCCERT_CONTEXT source, linked;
2419 DWORD size;
2420 LPBYTE buf;
2422 WCHAR filename1[MAX_PATH], filename2[MAX_PATH];
2423 HANDLE file;
2424
2425 if (0)
2426 {
2427 /* Crashes, i.e. the store is dereferenced without checking. */
2429 }
2430
2431 /* Adding a certificate link to a store requires a valid add disposition */
2434 SetLastError(0xdeadbeef);
2437 "expected E_INVALIDARG, got %08lx\n", GetLastError());
2439 sizeof(bigCert));
2440 SetLastError(0xdeadbeef);
2443 "expected E_INVALIDARG, got %08lx\n", GetLastError());
2445 NULL);
2446 ok(ret, "CertAddCertificateLinkToStore failed: %08lx\n", GetLastError());
2447 if (0)
2448 {
2449 /* Crashes, i.e. the source certificate is dereferenced without
2450 * checking when a valid add disposition is given.
2451 */
2453 NULL);
2454 }
2455 CertCloseStore(store1, 0);
2456
2460 &linked);
2461 ok(ret, "CertAddCertificateLinkToStore failed: %08lx\n", GetLastError());
2462 if (ret)
2463 {
2464 ok(linked->hCertStore == store1, "unexpected store\n");
2466 ok(ret, "CertSerializeCertificateStoreElement failed: %08lx\n",
2467 GetLastError());
2468 buf = malloc(size);
2469 if (buf)
2470 {
2472 ok(ret, "CertSerializeCertificateStoreElement failed: %08lx\n",
2473 GetLastError());
2474 /* The serialized linked certificate is identical to the serialized
2475 * original certificate.
2476 */
2477 ok(size == sizeof(serializedCert), "Wrong size %ld\n", size);
2479 "Unexpected serialized cert\n");
2480 free(buf);
2481 }
2482 /* Set a friendly name on the source certificate... */
2483 blob.pbData = (LPBYTE)L"WineTest";
2484 blob.cbData = sizeof(L"WineTest");
2487 ok(ret, "CertSetCertificateContextProperty failed: %08lx\n",
2488 GetLastError());
2489 /* and the linked certificate has the same friendly name. */
2492 ok(ret, "CertGetCertificateContextProperty failed: %08lx\n",
2493 GetLastError());
2494 buf = malloc(size);
2495 if (buf)
2496 {
2499 ok(ret, "CertGetCertificateContextProperty failed: %08lx\n",
2500 GetLastError());
2501 ok(!lstrcmpW((LPCWSTR)buf, L"WineTest"),
2502 "unexpected friendly name\n");
2503 free(buf);
2504 }
2506 }
2508 CertCloseStore(store1, 0);
2509
2510 /* Test adding a cert to a file store, committing the change to the store,
2511 * and creating a link to the resulting cert.
2512 */
2513 if (!GetTempFileNameW(L".", L"cer", 0, filename1))
2514 return;
2515
2516 DeleteFileW(filename1);
2517 file = CreateFileW(filename1, GENERIC_READ | GENERIC_WRITE, 0, NULL,
2520 return;
2521
2522 store1 = CertOpenStore(CERT_STORE_PROV_FILE, 0, 0,
2524 ok(store1 != NULL, "CertOpenStore failed: %08lx\n", GetLastError());
2526
2529 ok(ret, "CertAddEncodedCertificateToStore failed: %08lx\n",
2530 GetLastError());
2531
2532 /* Test adding a link to a memory store. */
2536 &linked);
2537 ok(ret, "CertAddCertificateLinkToStore failed: %08lx\n", GetLastError());
2538 if (ret)
2539 {
2540 ok(linked->hCertStore == store2, "unexpected store\n");
2542 ok(ret, "CertSerializeCertificateStoreElement failed: %08lx\n",
2543 GetLastError());
2544 buf = malloc(size);
2545 if (buf)
2546 {
2548 /* The serialized linked certificate is identical to the serialized
2549 * original certificate.
2550 */
2551 ok(ret, "CertSerializeCertificateStoreElement failed: %08lx\n", GetLastError());
2552 ok(size == sizeof(serializedCert), "Wrong size %ld\n", size);
2554 "Unexpected serialized cert\n");
2555 free(buf);
2556 }
2557 /* Set a friendly name on the source certificate... */
2558 blob.pbData = (LPBYTE)L"WineTest";
2559 blob.cbData = sizeof(L"WineTest");
2562 ok(ret, "CertSetCertificateContextProperty failed: %08lx\n",
2563 GetLastError());
2564 /* and the linked certificate has the same friendly name. */
2567 ok(ret, "CertGetCertificateContextProperty failed: %08lx\n",
2568 GetLastError());
2569 buf = malloc(size);
2570 if (buf)
2571 {
2574 ok(ret, "CertGetCertificateContextProperty failed: %08lx\n", GetLastError());
2575 ok(!lstrcmpW((LPCWSTR)buf, L"WineTest"),
2576 "unexpected friendly name\n");
2577 free(buf);
2578 }
2580 }
2581 CertCloseStore(store2, 0);
2582
2583 if (!GetTempFileNameW(L".", L"cer", 0, filename2))
2584 return;
2585
2590 return;
2591
2592 store2 = CertOpenStore(CERT_STORE_PROV_FILE, 0, 0,
2594 ok(store2 != NULL, "CertOpenStore failed: %08lx\n", GetLastError());
2596 /* Test adding a link to a file store. */
2598 &linked);
2599 ok(ret, "CertAddCertificateLinkToStore failed: %08lx\n", GetLastError());
2600 if (ret)
2601 {
2602 ok(linked->hCertStore == store2, "unexpected store\n");
2604 ok(ret, "CertSerializeCertificateStoreElement failed: %08lx\n",
2605 GetLastError());
2606 buf = malloc(size);
2607 if (buf)
2608 {
2610 ok(ret, "CertSerializeCertificateStoreElement failed: %08lx\n",
2611 GetLastError());
2612 /* The serialized linked certificate now contains the friendly
2613 * name property.
2614 */
2616 "Wrong size %ld\n", size);
2618 "Unexpected serialized cert\n");
2619 free(buf);
2620 }
2622 compareStore(store2, "file store -> file store",
2625 }
2626 CertCloseStore(store2, 0);
2628
2630
2631 CertCloseStore(store1, 0);
2632 DeleteFileW(filename1);
2633
2634 /* Test adding a link to a system store (which is a collection store.) */
2635 store1 = CertOpenSystemStoreA(0, "My");
2637 sizeof(bigCert));
2638 SetLastError(0xdeadbeef);
2640 &linked);
2642 "expected E_INVALIDARG, got %08lx\n", GetLastError());
2644
2645 /* Test adding a link to a file store, where the linked certificate is
2646 * in a system store.
2647 */
2650 ok(ret, "CertAddEncodedCertificateToStore failed: %08lx\n",
2651 GetLastError());
2652 if (!GetTempFileNameW(L".", L"cer", 0, filename1))
2653 return;
2654
2655 DeleteFileW(filename1);
2656 file = CreateFileW(filename1, GENERIC_READ | GENERIC_WRITE, 0, NULL,
2659 return;
2660
2661 store2 = CertOpenStore(CERT_STORE_PROV_FILE, 0, 0,
2663 ok(store2 != NULL, "CertOpenStore failed: %08lx\n", GetLastError());
2665
2667 &linked);
2668 ok(ret, "CertAddCertificateLinkToStore failed: %08lx\n", GetLastError());
2669 if (ret)
2670 {
2671 ok(linked->hCertStore == store2, "unexpected store\n");
2673 ok(ret, "CertControlStore failed: %d\n", ret);
2674 compareStore(store2, "file store -> system store",
2678 }
2679
2680 CertCloseStore(store2, 0);
2681 DeleteFileW(filename1);
2682
2683 /* Test adding a link to a registry store, where the linked certificate is
2684 * in a system store.
2685 */
2688 ok(store2 != NULL, "CertOpenStore failed: %08lx\n", GetLastError());
2690 &linked);
2691 ok(ret, "CertAddCertificateLinkToStore failed: %08lx\n", GetLastError());
2692 if (ret)
2693 {
2694 ok(linked->hCertStore == store2, "unexpected store\n");
2696 }
2697 CertCloseStore(store2, 0);
2698
2700 CertCloseStore(store1, 0);
2701
2703}
PCCERT_CONTEXT WINAPI CertCreateCertificateContext(DWORD dwCertEncodingType, const BYTE *pbCertEncoded, DWORD cbCertEncoded)
Definition: cert.c:316
BOOL WINAPI CertAddCertificateLinkToStore(HCERTSTORE hCertStore, PCCERT_CONTEXT pCertContext, DWORD dwAddDisposition, PCCERT_CONTEXT *ppCertContext)
Definition: cert.c:296
BOOL WINAPI CertSetCertificateContextProperty(PCCERT_CONTEXT pCertContext, DWORD dwPropId, DWORD dwFlags, const void *pvData)
Definition: cert.c:799
BOOL WINAPI CertControlStore(HCERTSTORE hCertStore, DWORD dwFlags, DWORD dwCtrlType, void const *pvCtrlPara)
Definition: store.c:1149
HCERTSTORE WINAPI CertOpenSystemStoreA(HCRYPTPROV_LEGACY hProv, LPCSTR szSubSystemProtocol)
Definition: store.c:904
#define MAX_PATH
Definition: compat.h:34
BOOL WINAPI DeleteFileW(IN LPCWSTR lpFileName)
Definition: delete.c:39
int WINAPI lstrcmpW(LPCWSTR str1, LPCWSTR str2)
Definition: locale.c:4246
UINT WINAPI GetTempFileNameW(IN LPCWSTR lpPathName, IN LPCWSTR lpPrefixString, IN UINT uUnique, OUT LPWSTR lpTempFileName)
Definition: filename.c:84
static char filename2[]
Definition: lzexpand_main.c:51
static void delete_test_key(void)
Definition: store.c:2388
static const BYTE serializedCert[]
Definition: store.c:71
static const BYTE serializedStoreWithCertWithFriendlyName[]
Definition: store.c:2359
static const BYTE serializedStoreWithCertAndHash[]
Definition: store.c:2373
static void compareStore(HCERTSTORE store, LPCSTR name, const BYTE *pb, DWORD cb, BOOL todo)
Definition: store.c:302
static const BYTE serializedCertWithFriendlyName[]
Definition: store.c:2346
BOOL WINAPI CertSerializeCertificateStoreElement(PCCERT_CONTEXT pCertContext, DWORD dwFlags, BYTE *pbElement, DWORD *pcbElement)
Definition: serialize.c:144
HCERTSTORE hCertStore
Definition: wincrypt.h:492
unsigned char * LPBYTE
Definition: typedefs.h:53
#define CERT_FILE_STORE_COMMIT_ENABLE_FLAG
Definition: wincrypt.h:2644
#define CERT_STORE_PROV_FILE
Definition: wincrypt.h:2456
#define CERT_FRIENDLY_NAME_PROP_ID
Definition: wincrypt.h:2844
#define CERT_STORE_PROV_SYSTEM_REGISTRY
Definition: wincrypt.h:2468
#define CERT_STORE_CTRL_COMMIT
Definition: wincrypt.h:2969
#define CERT_SYSTEM_STORE_CURRENT_USER
Definition: wincrypt.h:2528
const WCHAR * LPCWSTR
Definition: xmlstorage.h:185

Referenced by START_TEST().

◆ testAddSerialized()

static void testAddSerialized ( void  )
static

Definition at line 2192 of file store.c.

2193{
2194 BOOL ret;
2195 HCERTSTORE store;
2196 BYTE buf[sizeof(struct CertPropIDHeader) * 2 + 20 + sizeof(bigCert)] =
2197 { 0 };
2198 BYTE hash[20];
2199 struct CertPropIDHeader *hdr;
2201
2202 ret = CertAddSerializedElementToStore(0, NULL, 0, 0, 0, 0, NULL, NULL);
2204 "Expected ERROR_END_OF_MEDIA, got %08lx\n", GetLastError());
2205
2208 ok(store != 0, "CertOpenStore failed: %08lx\n", GetLastError());
2209
2210 ret = CertAddSerializedElementToStore(store, NULL, 0, 0, 0, 0, NULL, NULL);
2212 "Expected ERROR_END_OF_MEDIA, got %08lx\n", GetLastError());
2213
2214 /* Test with an empty property */
2215 hdr = (struct CertPropIDHeader *)buf;
2216 hdr->propID = CERT_CERT_PROP_ID;
2217 hdr->unknown1 = 1;
2218 hdr->cb = 0;
2219 ret = CertAddSerializedElementToStore(store, buf, sizeof(buf), 0, 0, 0,
2220 NULL, NULL);
2222 "Expected E_INVALIDARG, got %08lx\n", GetLastError());
2223 /* Test with a bad size in property header */
2224 hdr->cb = sizeof(bigCert) - 1;
2225 memcpy(buf + sizeof(struct CertPropIDHeader), bigCert, sizeof(bigCert));
2226 ret = CertAddSerializedElementToStore(store, buf, sizeof(buf), 0, 0, 0,
2227 NULL, NULL);
2229 "Expected E_INVALIDARG, got %08lx\n", GetLastError());
2231 sizeof(struct CertPropIDHeader) + sizeof(bigCert), 0, 0, 0, NULL,
2232 NULL);
2234 "Expected E_INVALIDARG, got %08lx\n", GetLastError());
2236 sizeof(struct CertPropIDHeader) + sizeof(bigCert), CERT_STORE_ADD_NEW,
2237 0, 0, NULL, NULL);
2239 "Expected E_INVALIDARG, got %08lx\n", GetLastError());
2240 /* Kosher size in property header, but no context type */
2241 hdr->cb = sizeof(bigCert);
2242 ret = CertAddSerializedElementToStore(store, buf, sizeof(buf), 0, 0, 0,
2243 NULL, NULL);
2245 "Expected E_INVALIDARG, got %08lx\n", GetLastError());
2247 sizeof(struct CertPropIDHeader) + sizeof(bigCert), 0, 0, 0, NULL,
2248 NULL);
2250 "Expected E_INVALIDARG, got %08lx\n", GetLastError());
2252 sizeof(struct CertPropIDHeader) + sizeof(bigCert), CERT_STORE_ADD_NEW,
2253 0, 0, NULL, NULL);
2255 "Expected E_INVALIDARG, got %08lx\n", GetLastError());
2256 /* With a bad context type */
2257 ret = CertAddSerializedElementToStore(store, buf, sizeof(buf), 0, 0,
2260 "Expected E_INVALIDARG, got %08lx\n", GetLastError());
2262 sizeof(struct CertPropIDHeader) + sizeof(bigCert), 0, 0,
2265 "Expected E_INVALIDARG, got %08lx\n", GetLastError());
2267 sizeof(struct CertPropIDHeader) + sizeof(bigCert), CERT_STORE_ADD_NEW,
2270 "Expected E_INVALIDARG, got %08lx\n", GetLastError());
2271 /* Bad unknown field, good type */
2272 hdr->unknown1 = 2;
2273 ret = CertAddSerializedElementToStore(store, buf, sizeof(buf), 0, 0,
2276 "Expected ERROR_FILE_NOT_FOUND got %08lx\n", GetLastError());
2278 sizeof(struct CertPropIDHeader) + sizeof(bigCert), 0, 0,
2281 "Expected ERROR_FILE_NOT_FOUND got %08lx\n", GetLastError());
2283 sizeof(struct CertPropIDHeader) + sizeof(bigCert), CERT_STORE_ADD_NEW,
2286 "Expected ERROR_FILE_NOT_FOUND got %08lx\n", GetLastError());
2287 /* Most everything okay, but bad add disposition */
2288 hdr->unknown1 = 1;
2289 /* This crashes
2290 ret = CertAddSerializedElementToStore(store, buf, sizeof(buf), 0, 0,
2291 CERT_STORE_CERTIFICATE_CONTEXT_FLAG, NULL, NULL);
2292 * as does this
2293 ret = CertAddSerializedElementToStore(store, buf,
2294 sizeof(struct CertPropIDHeader) + sizeof(bigCert), 0, 0,
2295 CERT_STORE_CERTIFICATE_CONTEXT_FLAG, NULL, NULL);
2296 */
2297 /* Everything okay, but buffer's too big */
2298 ret = CertAddSerializedElementToStore(store, buf, sizeof(buf),
2300 ok(ret, "CertAddSerializedElementToStore failed: %08lx\n", GetLastError());
2301 /* Everything okay, check it's not re-added */
2303 sizeof(struct CertPropIDHeader) + sizeof(bigCert), CERT_STORE_ADD_NEW,
2306 "Expected CRYPT_E_EXISTS, got %08lx\n", GetLastError());
2307
2309 ok(context != NULL, "Expected a cert\n");
2310 if (context)
2312
2313 /* Try adding with a bogus hash. Oddly enough, it succeeds, and the hash,
2314 * when queried, is the real hash rather than the bogus hash.
2315 */
2316 hdr = (struct CertPropIDHeader *)(buf + sizeof(struct CertPropIDHeader) +
2317 sizeof(bigCert));
2318 hdr->propID = CERT_HASH_PROP_ID;
2319 hdr->unknown1 = 1;
2320 hdr->cb = sizeof(hash);
2321 memset(hash, 0xc, sizeof(hash));
2322 memcpy((LPBYTE)hdr + sizeof(struct CertPropIDHeader), hash, sizeof(hash));
2323 ret = CertAddSerializedElementToStore(store, buf, sizeof(buf),
2325 (const void **)&context);
2326 ok(ret, "CertAddSerializedElementToStore failed: %08lx\n", GetLastError());
2327 if (context)
2328 {
2329 BYTE hashVal[20], realHash[20];
2330 DWORD size = sizeof(hashVal);
2331
2332 ret = CryptHashCertificate(0, 0, 0, bigCert, sizeof(bigCert),
2333 realHash, &size);
2334 ok(ret, "CryptHashCertificate failed: %08lx\n", GetLastError());
2336 hashVal, &size);
2337 ok(ret, "CertGetCertificateContextProperty failed: %08lx\n",
2338 GetLastError());
2339 ok(!memcmp(hashVal, realHash, size), "Unexpected hash\n");
2341 }
2342
2343 CertCloseStore(store, 0);
2344}
BOOL WINAPI CryptHashCertificate(HCRYPTPROV_LEGACY hCryptProv, ALG_ID Algid, DWORD dwFlags, const BYTE *pbEncoded, DWORD cbEncoded, BYTE *pbComputedHash, DWORD *pcbComputedHash)
Definition: cert.c:2187
#define memcpy(s1, s2, n)
Definition: mkisofs.h:878
#define ERROR_FILE_NOT_FOUND
Definition: disk.h:79
static const BYTE hashVal[]
Definition: message.c:603
#define CERT_CERT_PROP_ID
Definition: store.c:36
#define memset(x, y, z)
Definition: compat.h:39
BOOL WINAPI CertAddSerializedElementToStore(HCERTSTORE hCertStore, const BYTE *pbElement, DWORD cbElement, DWORD dwAddDisposition, DWORD dwFlags, DWORD dwContextTypeFlags, DWORD *pdwContentType, const void **ppvContext)
Definition: serialize.c:953
Definition: http.c:7252
Definition: _hash_fun.h:40
#define CERT_STORE_CRL_CONTEXT_FLAG
Definition: wincrypt.h:3127
#define CERT_STORE_ADD_NEW
Definition: wincrypt.h:2651
#define CERT_HASH_PROP_ID
Definition: wincrypt.h:2835
#define CERT_STORE_CERTIFICATE_CONTEXT_FLAG
Definition: wincrypt.h:3125
#define CRYPT_E_EXISTS
Definition: winerror.h:4422
#define ERROR_END_OF_MEDIA
Definition: winerror.h:960

Referenced by START_TEST().

◆ testCertEnumSystemStore()

static void testCertEnumSystemStore ( void  )
static

Definition at line 2087 of file store.c.

2088{
2089 BOOL ret;
2090 struct EnumSystemStoreInfo info = { FALSE, 0 };
2091
2092 SetLastError(0xdeadbeef);
2095 "Expected ERROR_FILE_NOT_FOUND, got %08lx\n", GetLastError());
2096 /* Crashes
2097 ret = CertEnumSystemStore(CERT_SYSTEM_STORE_LOCAL_MACHINE, NULL, NULL,
2098 NULL);
2099 */
2100
2101 SetLastError(0xdeadbeef);
2104 /* Callback returning FALSE stops enumeration */
2105 ok(!ret, "Expected CertEnumSystemStore to stop\n");
2106 ok(info.storeCount == 0 || info.storeCount == 1,
2107 "Expected 0 or 1 stores\n");
2108
2109 info.goOn = TRUE;
2110 info.storeCount = 0;
2113 ok(ret, "CertEnumSystemStore failed: %08lx\n", GetLastError());
2114 /* There should always be at least My, Root, and CA stores */
2115 ok(info.storeCount == 0 || info.storeCount >= 3,
2116 "Expected at least 3 stores\n");
2117}
BOOL WINAPI CertEnumSystemStore(DWORD dwFlags, void *pvSystemStoreLocationPara, void *pvArg, PFN_CERT_ENUM_SYSTEM_STORE pfnEnum)
Definition: store.c:1321
static BOOL CALLBACK enumSystemStoreCB(const void *systemStore, DWORD dwFlags, PCERT_SYSTEM_STORE_INFO pStoreInfo, void *pvReserved, void *pvArg)
Definition: store.c:2078
#define CERT_SYSTEM_STORE_LOCAL_MACHINE
Definition: wincrypt.h:2530

Referenced by START_TEST().

◆ testCertOpenSystemStore()

static void testCertOpenSystemStore ( void  )
static

Definition at line 1977 of file store.c.

1978{
1979 HCERTSTORE store;
1980
1981 store = CertOpenSystemStoreW(0, NULL);
1982 ok(!store && GetLastError() == E_INVALIDARG,
1983 "Expected E_INVALIDARG, got %08lx\n", GetLastError());
1984 /* This succeeds, and on WinXP at least, the Bogus key is created under
1985 * HKCU (but not under HKLM, even when run as an administrator.)
1986 */
1987 store = CertOpenSystemStoreW(0, L"Bogus");
1988 ok(store != 0, "CertOpenSystemStore failed: %08lx\n", GetLastError());
1989 if (store)
1990 CertCloseStore(store, 0);
1991 /* Delete it so other tests succeed next time around */
1994 RegDeleteKeyW(HKEY_CURRENT_USER, L"Software\\Microsoft\\SystemCertificates\\Bogus");
1995}
HCERTSTORE WINAPI CertOpenSystemStoreW(HCRYPTPROV_LEGACY hProv, LPCWSTR szSubSystemProtocol)
Definition: store.c:916
#define CERT_STORE_PROV_SYSTEM
Definition: wincrypt.h:2464
#define CERT_STORE_DELETE_FLAG
Definition: wincrypt.h:2624

Referenced by START_TEST().

◆ testCertRegisterSystemStore()

static void testCertRegisterSystemStore ( void  )
static

Definition at line 2012 of file store.c.

2013{
2014 BOOL ret, cur_flag;
2015 DWORD err = 0;
2016 HCERTSTORE hstore;
2017 const CERT_CONTEXT *cert, *cert2;
2018 unsigned int i;
2019
2020 for (i = 0; i < ARRAY_SIZE(reg_system_store_test_data); i++) {
2021 cur_flag = reg_system_store_test_data[i].cert_store;
2022 ret = CertRegisterSystemStore(L"WineTest", cur_flag, NULL, NULL);
2023 if (!ret)
2024 {
2025 err = GetLastError();
2026 if (err == ERROR_ACCESS_DENIED)
2027 {
2028 win_skip("Insufficient privileges for the flag %08x test\n", cur_flag);
2029 continue;
2030 }
2031 }
2034 "Store registration (dwFlags=%08x) failed, last error %lx\n", cur_flag, err);
2035 if (!ret)
2036 {
2037 skip("Nothing to test without registered store at %08x\n", cur_flag);
2038 continue;
2039 }
2040
2041 hstore = CertOpenStore(CERT_STORE_PROV_SYSTEM_W, 0, 0, CERT_STORE_OPEN_EXISTING_FLAG | cur_flag, L"WineTest");
2042 ok (hstore != NULL, "Opening just registered store at %08x failed, last error %lx\n", cur_flag, GetLastError());
2043
2045 ok (cert != NULL, "Failed creating cert at %08x, last error: %lx\n", cur_flag, GetLastError());
2046 if (cert)
2047 {
2049 ok (ret, "Failed to add cert at %08x, last error: %lx\n", cur_flag, GetLastError());
2050
2052 ok (cert2 != NULL && cert2->cbCertEncoded == cert->cbCertEncoded,
2053 "Unexpected cert encoded size at %08x, last error: %lx\n", cur_flag, GetLastError());
2054
2056 ok (ret, "Failed to delete certificate from the new store at %08x, last error: %lx\n", cur_flag, GetLastError());
2057
2059 }
2060
2061 ret = CertCloseStore(hstore, 0);
2062 ok (ret, "CertCloseStore failed at %08x, last error %lx\n", cur_flag, GetLastError());
2063
2064 ret = CertUnregisterSystemStore(L"WineTest", cur_flag );
2067 "Unregistering failed at %08x, last error %ld\n", cur_flag, GetLastError());
2068 }
2069
2070}
#define skip(...)
Definition: atltest.h:64
BOOL WINAPI CertAddCertificateContextToStore(HCERTSTORE hCertStore, PCCERT_CONTEXT pCertContext, DWORD dwAddDisposition, PCCERT_CONTEXT *ppStoreContext)
Definition: cert.c:286
BOOL WINAPI CertRegisterSystemStore(const void *pvSystemStore, DWORD dwFlags, PCERT_SYSTEM_STORE_INFO pStoreInfo, void *pvReserved)
Definition: store.c:1448
BOOL WINAPI CertUnregisterSystemStore(const void *pvSystemStore, DWORD dwFlags)
Definition: store.c:1471
#define ERROR_ACCESS_DENIED
Definition: compat.h:97
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
static const BYTE cert2[]
Definition: message.c:797
static const struct @1784 reg_system_store_test_data[]
BOOL expected
Definition: store.c:2000
#define err(...)
#define CERT_STORE_OPEN_EXISTING_FLAG
Definition: wincrypt.h:2634
#define CERT_STORE_PROV_SYSTEM_W
Definition: wincrypt.h:2463

Referenced by START_TEST().

◆ testCloseStore()

static void testCloseStore ( void  )
static

Definition at line 2807 of file store.c.

2808{
2809 const CERT_CONTEXT *cert;
2810 const CRL_CONTEXT *crl;
2811 const CTL_CONTEXT *ctl;
2812 HCERTSTORE store, store2;
2813 BOOL res;
2814
2816 ok(store != NULL, "CertOpenStore failed\n");
2817
2819 ok(res, "CertCloseStore failed\n");
2820
2822 ok(store != NULL, "CertOpenStore failed\n");
2823
2824 store2 = CertDuplicateStore(store);
2825 ok(store2 != NULL, "CertCloneStore failed\n");
2826 ok(store2 == store, "unexpected store2\n");
2827
2829 ok(!res && GetLastError() == CRYPT_E_PENDING_CLOSE, "CertCloseStore failed\n");
2830
2832 ok(res, "CertCloseStore failed\n");
2833
2835 ok(store != NULL, "CertOpenStore failed\n");
2836
2839 ok(res, "CertAddEncodedCertificateToStore failed\n");
2840
2841 /* There is still a reference from cert */
2843 ok(!res && GetLastError() == CRYPT_E_PENDING_CLOSE, "CertCloseStore failed\n");
2844
2846 ok(res, "CertFreeCertificateContext failed\n");
2847
2849 ok(store != NULL, "CertOpenStore failed\n");
2850
2853 ok(res, "CertAddEncodedCRLToStore failed\n");
2854
2855 /* There is still a reference from CRL */
2857 ok(!res && GetLastError() == CRYPT_E_PENDING_CLOSE, "CertCloseStore failed\n");
2858
2860 ok(res, "CertFreeCRLContext failed\n");
2861
2863 ok(store != NULL, "CertOpenStore failed\n");
2864
2867 ok(res, "CertAddEncodedCTLToStore failed\n");
2868
2869 /* There is still a reference from CTL */
2871 ok(!res && GetLastError() == CRYPT_E_PENDING_CLOSE, "CertCloseStore returned: %x(%lu)\n", res, GetLastError());
2872
2873 res = CertFreeCTLContext(ctl);
2874 ok(res, "CertFreeCTLContext failed\n");
2875
2876 /* Add all kinds of contexts, then release external references and make sure that store is properly closed. */
2878 ok(store != NULL, "CertOpenStore failed\n");
2879
2882 ok(res, "CertAddEncodedCertificateToStore failed\n");
2883
2886 ok(res, "CertAddEncodedCRLToStore failed\n");
2887
2890 ok(res, "CertAddEncodedCTLToStore failed\n");
2891
2894 CertFreeCTLContext(ctl);
2895
2897 ok(res, "CertCloseStore failed\n");
2898}
BOOL WINAPI CertFreeCRLContext(PCCRL_CONTEXT pCrlContext)
Definition: crl.c:386
BOOL WINAPI CertFreeCTLContext(PCCTL_CONTEXT pCTLContext)
Definition: ctl.c:499
BOOL WINAPI CertAddEncodedCTLToStore(HCERTSTORE hCertStore, DWORD dwMsgAndCertEncodingType, const BYTE *pbCtlEncoded, DWORD cbCtlEncoded, DWORD dwAddDisposition, PCCTL_CONTEXT *ppCtlContext)
Definition: ctl.c:177
HCERTSTORE WINAPI CertDuplicateStore(HCERTSTORE hCertStore)
Definition: store.c:1116
GLuint res
Definition: glext.h:9613
static const BYTE signedCTLWithCTLInnerContent[]
Definition: store.c:99
#define CERT_CLOSE_STORE_CHECK_FLAG
Definition: wincrypt.h:2648
#define CRYPT_E_PENDING_CLOSE
Definition: winerror.h:4432

Referenced by START_TEST().

◆ testCollectionStore()

static void testCollectionStore ( void  )
static

Definition at line 607 of file store.c.

608{
609 HCERTSTORE store1, store2, collection, collection2;
611 BOOL ret;
613 HANDLE file;
614
617
618 /* Try adding a cert to any empty collection */
622 "Expected E_ACCESSDENIED, got %08lx\n", GetLastError());
623
624 /* Create and add a cert to a memory store */
629 ok(ret, "CertAddEncodedCertificateToStore failed: %08lx\n", GetLastError());
630 /* Add the memory store to the collection, without allowing adding */
631 ret = CertAddStoreToCollection(collection, store1, 0, 0);
632 ok(ret, "CertAddStoreToCollection failed: %08lx\n", GetLastError());
633 /* Verify the cert is in the collection */
635 ok(context != NULL, "Expected a valid context\n");
636 if (context)
637 {
638 ok(context->hCertStore == collection, "Unexpected store\n");
640 }
641 /* Check that adding to the collection isn't allowed */
645 "Expected E_ACCESSDENIED, got %08lx\n", GetLastError());
646
647 /* Create a new memory store */
650 /* Try adding a store to a non-collection store */
651 ret = CertAddStoreToCollection(store1, store2,
654 "Expected E_INVALIDARG, got %08lx\n", GetLastError());
655 /* Try adding some bogus stores */
656 /* This crashes in Windows
657 ret = pCertAddStoreToCollection(0, store2,
658 CERT_PHYSICAL_STORE_ADD_ENABLE_FLAG, 0);
659 */
660 /* This "succeeds"... */
663 ok(ret, "CertAddStoreToCollection failed: %08lx\n", GetLastError());
664 /* while this crashes.
665 ret = pCertAddStoreToCollection(collection, 1,
666 CERT_PHYSICAL_STORE_ADD_ENABLE_FLAG, 0);
667 */
668
669 /* Add it to the collection, this time allowing adding */
672 ok(ret, "CertAddStoreToCollection failed: %08lx\n", GetLastError());
673 /* Check that adding to the collection is allowed */
676 ok(ret, "CertAddEncodedCertificateToStore failed: %08lx\n", GetLastError());
677 /* Now check that it was actually added to store2 */
679 ok(context != NULL, "Expected a valid context\n");
680 if (context)
681 {
682 ok(context->hCertStore == store2, "Unexpected store\n");
684 }
685 /* Check that the collection has both bigCert and bigCert2. bigCert comes
686 * first because store1 was added first.
687 */
689 ok(context != NULL, "Expected a valid context\n");
690 if (context)
691 {
692 ok(context->hCertStore == collection, "Unexpected store\n");
693 ok(context->cbCertEncoded == sizeof(bigCert),
694 "Wrong size %ld\n", context->cbCertEncoded);
695 ok(!memcmp(context->pbCertEncoded, bigCert, context->cbCertEncoded),
696 "Unexpected cert\n");
698 ok(context != NULL, "Expected a valid context\n");
699 if (context)
700 {
701 ok(context->hCertStore == collection, "Unexpected store\n");
702 ok(context->cbCertEncoded == sizeof(bigCert2),
703 "Wrong size %ld\n", context->cbCertEncoded);
704 ok(!memcmp(context->pbCertEncoded, bigCert2,
705 context->cbCertEncoded), "Unexpected cert\n");
707 ok(!context, "Unexpected cert\n");
708 }
709 }
710 /* close store2, and check that the collection is unmodified */
711 CertCloseStore(store2, 0);
713 ok(context != NULL, "Expected a valid context\n");
714 if (context)
715 {
716 ok(context->hCertStore == collection, "Unexpected store\n");
717 ok(context->cbCertEncoded == sizeof(bigCert),
718 "Wrong size %ld\n", context->cbCertEncoded);
719 ok(!memcmp(context->pbCertEncoded, bigCert, context->cbCertEncoded),
720 "Unexpected cert\n");
722 ok(context != NULL, "Expected a valid context\n");
723 if (context)
724 {
725 ok(context->hCertStore == collection, "Unexpected store\n");
726 ok(context->cbCertEncoded == sizeof(bigCert2),
727 "Wrong size %ld\n", context->cbCertEncoded);
728 ok(!memcmp(context->pbCertEncoded, bigCert2,
729 context->cbCertEncoded), "Unexpected cert\n");
731 ok(!context, "Unexpected cert\n");
732 }
733 }
734
735 /* Adding a collection to a collection is legal */
736 collection2 = CertOpenStore(CERT_STORE_PROV_COLLECTION, 0, 0,
740 ok(ret, "CertAddStoreToCollection failed: %08lx\n", GetLastError());
741 /* check the contents of collection2 */
743 ok(context != NULL, "Expected a valid context\n");
744 if (context)
745 {
746 ok(context->hCertStore == collection2, "Unexpected store\n");
747 ok(context->cbCertEncoded == sizeof(bigCert),
748 "Wrong size %ld\n", context->cbCertEncoded);
749 ok(!memcmp(context->pbCertEncoded, bigCert, context->cbCertEncoded),
750 "Unexpected cert\n");
752 ok(context != NULL, "Expected a valid context\n");
753 if (context)
754 {
755 ok(context->hCertStore == collection2, "Unexpected store\n");
756 ok(context->cbCertEncoded == sizeof(bigCert2),
757 "Wrong size %ld\n", context->cbCertEncoded);
758 ok(!memcmp(context->pbCertEncoded, bigCert2,
759 context->cbCertEncoded), "Unexpected cert\n");
761 ok(!context, "Unexpected cert\n");
762 }
763 }
764
765 /* I'd like to test closing the collection in the middle of enumeration,
766 * but my tests have been inconsistent. The first time calling
767 * CertEnumCertificatesInStore on a closed collection succeeded, while the
768 * second crashed. So anything appears to be fair game.
769 * I'd also like to test removing a store from a collection in the middle
770 * of an enumeration, but my tests in Windows have been inconclusive.
771 * In one scenario it worked. In another scenario, about a third of the
772 * time this leads to "random" crashes elsewhere in the code. This
773 * probably means this is not allowed.
774 */
775
776 CertCloseStore(store1, 0);
778 CertCloseStore(collection2, 0);
779
780 /* Add the same cert to two memory stores, then put them in a collection */
783 ok(store1 != 0, "CertOpenStore failed: %08lx\n", GetLastError());
786 ok(store2 != 0, "CertOpenStore failed: %08lx\n", GetLastError());
787
790 ok(ret, "CertAddEncodedCertificateToStore failed: %08lx\n", GetLastError());
793 ok(ret, "CertAddEncodedCertificateToStore failed: %08lx\n", GetLastError());
796 ok(collection != 0, "CertOpenStore failed: %08lx\n", GetLastError());
797
799 ok(ret, "CertAddStoreToCollection failed: %08lx\n", GetLastError());
801 ok(ret, "CertAddStoreToCollection failed: %08lx\n", GetLastError());
802
803 /* Check that the collection has two copies of the same cert */
805 ok(context != NULL, "Expected a valid context\n");
806 if (context)
807 {
808 ok(context->hCertStore == collection, "Unexpected store\n");
809 ok(context->cbCertEncoded == sizeof(bigCert),
810 "Wrong size %ld\n", context->cbCertEncoded);
811 ok(!memcmp(context->pbCertEncoded, bigCert, context->cbCertEncoded),
812 "Unexpected cert\n");
814 ok(context != NULL, "Expected a valid context\n");
815 if (context)
816 {
817 ok(context->hCertStore == collection, "Unexpected store\n");
818 ok(context->cbCertEncoded == sizeof(bigCert),
819 "Wrong size %ld\n", context->cbCertEncoded);
820 ok(!memcmp(context->pbCertEncoded, bigCert, context->cbCertEncoded),
821 "Unexpected cert\n");
823 ok(context == NULL, "Unexpected cert\n");
824 }
825 }
826
827 /* The following would check whether I can delete an identical cert, rather
828 * than one enumerated from the store. It crashes, so that means I must
829 * only call CertDeleteCertificateFromStore with contexts enumerated from
830 * the store.
831 context = CertCreateCertificateContext(X509_ASN_ENCODING, bigCert,
832 sizeof(bigCert));
833 ok(context != NULL, "CertCreateCertificateContext failed: %08x\n",
834 GetLastError());
835 if (context)
836 {
837 ret = CertDeleteCertificateFromStore(collection, context);
838 printf("ret is %d, GetLastError is %08x\n", ret, GetLastError());
839 CertFreeCertificateContext(context);
840 }
841 */
842
843 /* Now check deleting from the collection. */
845 ok(context != NULL, "Expected a valid context\n");
846 if (context)
847 {
849 /* store1 should now be empty */
851 ok(!context, "Unexpected cert\n");
852 /* and there should be one certificate in the collection */
854 ok(context != NULL, "Expected a valid cert\n");
855 if (context)
856 {
857 ok(context->hCertStore == collection, "Unexpected store\n");
858 ok(context->cbCertEncoded == sizeof(bigCert),
859 "Wrong size %ld\n", context->cbCertEncoded);
860 ok(!memcmp(context->pbCertEncoded, bigCert, context->cbCertEncoded),
861 "Unexpected cert\n");
862 }
864 ok(context == NULL, "Unexpected cert\n");
865 }
866
867 /* Finally, test removing stores from the collection. No return
868 * value, so it's a bit funny to test.
869 */
870 /* This crashes
871 * CertRemoveStoreFromCollection(NULL, NULL);
872 */
873 /* This "succeeds," no crash, no last error set */
874 SetLastError(0xdeadbeef);
876 ok(GetLastError() == 0xdeadbeef,
877 "Didn't expect an error to be set: %08lx\n", GetLastError());
878
879 /* After removing store2, the collection should be empty */
880 SetLastError(0xdeadbeef);
882 ok(GetLastError() == 0xdeadbeef,
883 "Didn't expect an error to be set: %08lx\n", GetLastError());
885 ok(!context, "Unexpected cert\n");
886
888 CertCloseStore(store2, 0);
889 CertCloseStore(store1, 0);
890
891 /* Test adding certificates to and deleting certificates from collections.
892 */
893 store1 = CertOpenSystemStoreA(0, "My");
896
899 ok(ret, "CertAddEncodedCertificateToStore failed: %08lx\n", GetLastError());
901
903
906 ok(ret, "CertAddEncodedCertificateToStore failed: %08lx\n", GetLastError());
908
910 CertCloseStore(store1, 0);
911
912 /* Test whether a collection store can be committed */
915
916 SetLastError(0xdeadbeef);
918 ok(ret, "CertControlStore failed: %08lx\n", GetLastError());
919
920 /* Adding a mem store that can't be committed prevents a successful commit.
921 */
925 SetLastError(0xdeadbeef);
928 "expected ERROR_CALL_NOT_IMPLEMENTED, got %ld\n", GetLastError());
930 CertCloseStore(store1, 0);
931
932 /* Test adding a cert to a collection with a file store, committing the
933 * change to the collection, and comparing the resulting file.
934 */
935 if (!GetTempFileNameW(L".", L"cer", 0, filename))
936 return;
937
942 return;
943
944 store1 = CertOpenStore(CERT_STORE_PROV_FILE, 0, 0,
946 ok(store1 != NULL, "CertOpenStore failed: %08lx\n", GetLastError());
949 CertCloseStore(store1, 0);
950
953 ok(ret, "CertAddEncodedCertificateToStore failed: %08lx\n",
954 GetLastError());
956 ok(ret, "CertControlStore failed: %d\n", ret);
957 compareStore(collection, "serialized store with cert",
960
962}
BOOL WINAPI CertAddStoreToCollection(HCERTSTORE hCollectionStore, HCERTSTORE hSiblingStore, DWORD dwUpdateFlags, DWORD dwPriority)
void WINAPI CertRemoveStoreFromCollection(HCERTSTORE hCollectionStore, HCERTSTORE hSiblingStore)
#define ERROR_CALL_NOT_IMPLEMENTED
Definition: compat.h:102
static const BYTE serializedStoreWithCert[]
Definition: store.c:326
static const BYTE bigCert2[]
Definition: store.c:89
static ICollection collection
Definition: typelib.c:184
#define CERT_STORE_PROV_COLLECTION
Definition: wincrypt.h:2465
#define CERT_PHYSICAL_STORE_ADD_ENABLE_FLAG
Definition: wincrypt.h:2743
#define E_ACCESSDENIED
Definition: winerror.h:4116

Referenced by START_TEST().

◆ testEmptyStore()

static void testEmptyStore ( void  )
static

Definition at line 2731 of file store.c.

2732{
2733 const CERT_CONTEXT *cert, *cert2, *cert3;
2734 const CRL_CONTEXT *crl;
2735 const CTL_CONTEXT *ctl;
2736 HCERTSTORE store;
2737 BOOL res;
2738
2740 ok(cert != NULL, "CertCreateCertificateContext failed\n");
2741 ok(cert->hCertStore != NULL, "cert->hCertStore == NULL\n");
2742 if(!cert->hCertStore) {
2744 return;
2745 }
2746
2747 test_store_is_empty(cert->hCertStore);
2748
2750 ok(cert2 != NULL, "CertCreateCertificateContext failed\n");
2751 ok(cert2->hCertStore == cert->hCertStore, "Unexpected hCertStore\n");
2752
2753 test_store_is_empty(cert2->hCertStore);
2754
2756 ok(res, "CertAddCertificateContextToStore failed\n");
2757 todo_wine
2758 ok(cert3 && cert3 != cert2, "Unexpected cert3\n");
2759 ok(cert3->hCertStore == cert->hCertStore, "Unexpected hCertStore\n");
2760
2761 test_store_is_empty(cert->hCertStore);
2762
2764 ok(res, "CertDeleteCertificateContextFromStore failed\n");
2765 ok(cert3->hCertStore == cert->hCertStore, "Unexpected hCertStore\n");
2766
2768
2770 ok(store != NULL, "CertOpenStore failed\n");
2771
2773 ok(res, "CertAddCertificateContextToStore failed\n");
2774 ok(cert3 && cert3 != cert2, "Unexpected cert3\n");
2775 ok(cert3->hCertStore == store, "Unexpected hCertStore\n");
2776
2778 ok(res, "CertDeleteCertificateContextFromStore failed\n");
2779 ok(cert3->hCertStore == store, "Unexpected hCertStore\n");
2780
2781 CertCloseStore(store, 0);
2783
2785 ok(!res && GetLastError() == E_UNEXPECTED, "CertCloseStore returned: %x(%lx)\n", res, GetLastError());
2786
2787 res = CertCloseStore(cert->hCertStore, 0);
2788 ok(!res && GetLastError() == E_UNEXPECTED, "CertCloseStore returned: %x(%lx)\n", res, GetLastError());
2789
2791
2793 ok(crl != NULL, "CertCreateCRLContext failed\n");
2794 ok(crl->hCertStore == cert->hCertStore, "unexpected hCertStore\n");
2795
2797
2799 ok(ctl != NULL, "CertCreateCTLContext failed\n");
2800 ok(ctl->hCertStore == cert->hCertStore, "unexpected hCertStore\n");
2801
2802 CertFreeCTLContext(ctl);
2803
2805}
PCCRL_CONTEXT WINAPI CertCreateCRLContext(DWORD dwCertEncodingType, const BYTE *pbCrlEncoded, DWORD cbCrlEncoded)
Definition: crl.c:85
PCCTL_CONTEXT WINAPI CertCreateCTLContext(DWORD dwMsgAndCertEncodingType, const BYTE *pbCtlEncoded, DWORD cbCtlEncoded)
Definition: ctl.c:363
#define todo_wine
Definition: minitest.h:80
#define test_store_is_empty(store)
Definition: store.c:120
HCERTSTORE hCertStore
Definition: wincrypt.h:860
#define E_UNEXPECTED
Definition: winerror.h:3528

Referenced by START_TEST().

◆ testFileNameStore()

static void testFileNameStore ( void  )
static

Definition at line 1586 of file store.c.

1587{
1589 HCERTSTORE store;
1590 BOOL ret;
1591 DWORD GLE;
1592
1594 GLE = GetLastError();
1596 "Expected ERROR_PATH_NOT_FOUND or ERROR_INVALID_PARAMETER, got %08lx\n",
1597 GLE);
1598
1599 if (!GetTempFileNameW(L".", L"cer", 0, filename))
1600 return;
1602
1603 /* The two flags are mutually exclusive */
1606 ok(!store && GetLastError() == E_INVALIDARG,
1607 "Expected E_INVALIDARG, got %08lx\n", GetLastError());
1608
1609 /* In all of the following tests, the encoding type seems to be ignored */
1611 {
1614
1617 ok(store != NULL, "CertOpenStore failed: %08lx\n", GetLastError());
1618
1620 ok(cert != NULL, "CertEnumCertificatesInStore failed: %08lx\n",
1621 GetLastError());
1623 ok(!cert, "Expected only one cert\n");
1624 crl = CertEnumCRLsInStore(store, NULL);
1625 ok(!crl, "Expected no CRLs\n");
1626
1627 CertCloseStore(store, 0);
1629 }
1631 sizeof(serializedStoreWithCert)))
1632 {
1635
1638 ok(store != NULL, "CertOpenStore failed: %08lx\n", GetLastError());
1639
1641 ok(cert != NULL, "CertEnumCertificatesInStore failed: %08lx\n",
1642 GetLastError());
1644 ok(!cert, "Expected only one cert\n");
1645 crl = CertEnumCRLsInStore(store, NULL);
1646 ok(!crl, "Expected no CRLs\n");
1647
1648 CertCloseStore(store, 0);
1650 }
1653 {
1656
1659 ok(store != NULL, "CertOpenStore failed: %08lx\n", GetLastError());
1660
1662 ok(cert != NULL, "CertEnumCertificatesInStore failed: %08lx\n",
1663 GetLastError());
1665 ok(!cert, "Expected only one cert\n");
1666 crl = CertEnumCRLsInStore(store, NULL);
1667 ok(crl != NULL, "CertEnumCRLsInStore failed: %08lx\n", GetLastError());
1668 crl = CertEnumCRLsInStore(store, crl);
1669 ok(!crl, "Expected only one CRL\n");
1670
1671 CertCloseStore(store, 0);
1672 /* Don't delete it this time, the next test uses it */
1673 }
1674 /* Now that the file exists, we can open it read-only */
1677 ok(store != NULL, "CertOpenStore failed: %08lx\n", GetLastError());
1678 CertCloseStore(store, 0);
1680
1683 ok(store != NULL, "CertOpenStore failed: %08lx\n", GetLastError());
1684 if (store)
1685 {
1688 ok(ret, "CertAddEncodedCertificateToStore failed: %08lx\n",
1689 GetLastError());
1690 compareStore(store, "serialized store with cert",
1692 CertCloseStore(store, 0);
1693 }
1696 ok(store != NULL, "CertOpenStore failed: %08lx\n", GetLastError());
1697 if (store)
1698 {
1701 ok(ret, "CertAddEncodedCRLToStore failed: %08lx\n", GetLastError());
1702 compareStore(store, "serialized store with cert and CRL",
1704 FALSE);
1705 CertCloseStore(store, 0);
1706 }
1708
1709 if (!GetTempFileNameW(L".", L"spc", 0, filename))
1710 return;
1712
1714 {
1717
1720 ok(store != NULL, "CertOpenStore failed: %08lx\n", GetLastError());
1721
1723 ok(cert != NULL, "CertEnumCertificatesInStore failed: %08lx\n",
1724 GetLastError());
1726 ok(!cert, "Expected only one cert\n");
1727 crl = CertEnumCRLsInStore(store, NULL);
1728 ok(!crl, "Expected no CRLs\n");
1729
1730 CertCloseStore(store, 0);
1732 }
1734 sizeof(utf16Base64SPC)))
1735 {
1738
1741 ok(store != NULL, "CertOpenStore failed: %08lx\n", GetLastError());
1742
1744 ok(cert != NULL, "CertEnumCertificatesInStore failed: %08lx\n",
1745 GetLastError());
1747 ok(!cert, "Expected only one cert\n");
1748 crl = CertEnumCRLsInStore(store, NULL);
1749 ok(!crl, "Expected no CRLs\n");
1750
1751 CertCloseStore(store, 0);
1753 }
1754}
static DWORD GLE
Definition: registry.c:38
static const BYTE serializedStoreWithCertAndCRL[]
Definition: store.c:1396
static const WCHAR utf16Base64SPC[]
Definition: store.c:1572
static BOOL initFileFromData(LPCWSTR filename, const BYTE *pb, DWORD cb)
Definition: store.c:1540
static const BYTE base64SPC[]
Definition: store.c:1558
#define CERT_STORE_PROV_FILENAME_W
Definition: wincrypt.h:2461
#define CERT_STORE_READONLY_FLAG
Definition: wincrypt.h:2635
#define ERROR_PATH_NOT_FOUND
Definition: winerror.h:228

Referenced by START_TEST().

◆ testFileStore()

static void testFileStore ( void  )
static

Definition at line 1414 of file store.c.

1415{
1417 HCERTSTORE store;
1418 BOOL ret;
1420 HANDLE file;
1421
1422 store = CertOpenStore(CERT_STORE_PROV_FILE, 0, 0, 0, NULL);
1423 ok(!store && GetLastError() == ERROR_INVALID_HANDLE,
1424 "Expected ERROR_INVALID_HANDLE, got %08lx\n", GetLastError());
1425
1426 if (!GetTempFileNameW(L".", L"cer", 0, filename))
1427 return;
1428
1433 return;
1434
1436 file);
1437 ok(!store && GetLastError() == E_INVALIDARG,
1438 "Expected E_INVALIDARG, got %08lx\n", GetLastError());
1439 store = CertOpenStore(CERT_STORE_PROV_FILE, 0, 0,
1441 ok(!store && GetLastError() == E_INVALIDARG,
1442 "Expected E_INVALIDARG, got %08lx\n", GetLastError());
1443
1444 /* A "read-only" file store.. */
1445 store = CertOpenStore(CERT_STORE_PROV_FILE, 0, 0,
1447 ok(store != NULL, "CertOpenStore failed: %08lx\n", GetLastError());
1448 if (store)
1449 {
1450 DWORD size;
1451
1454 /* apparently allows adding certificates.. */
1455 ok(ret, "CertAddEncodedCertificateToStore failed: %d\n", ret);
1456 /* but not commits.. */
1459 "Expected ERROR_CALL_NOT_IMPLEMENTED, got %08lx\n", GetLastError());
1460 /* It still has certs in memory.. */
1462 ok(cert != NULL, "CertEnumCertificatesInStore failed: %08lx\n",
1463 GetLastError());
1465 /* but the file size is still 0. */
1467 ok(size == 0, "Expected size 0, got %ld\n", size);
1468 CertCloseStore(store, 0);
1469 }
1470
1471 /* The create new flag is allowed.. */
1472 store = CertOpenStore(CERT_STORE_PROV_FILE, 0, 0,
1474 ok(store != NULL, "CertOpenStore failed: %08lx\n", GetLastError());
1475 if (store)
1476 {
1477 /* but without the commit enable flag, commits don't happen. */
1480 ok(ret, "CertAddEncodedCertificateToStore failed: %d\n", ret);
1483 "Expected ERROR_CALL_NOT_IMPLEMENTED, got %08lx\n", GetLastError());
1484 CertCloseStore(store, 0);
1485 }
1486 /* as is the open existing flag. */
1487 store = CertOpenStore(CERT_STORE_PROV_FILE, 0, 0,
1489 ok(store != NULL, "CertOpenStore failed: %08lx\n", GetLastError());
1490 if (store)
1491 {
1492 /* but without the commit enable flag, commits don't happen. */
1495 ok(ret, "CertAddEncodedCertificateToStore failed: %d\n", ret);
1498 "Expected ERROR_CALL_NOT_IMPLEMENTED, got %08lx\n", GetLastError());
1499 CertCloseStore(store, 0);
1500 }
1501 store = CertOpenStore(CERT_STORE_PROV_FILE, 0, 0,
1503 ok(store != NULL, "CertOpenStore failed: %08lx\n", GetLastError());
1504 if (store)
1505 {
1509 ok(ret, "CertAddEncodedCertificateToStore failed: %08lx\n",
1510 GetLastError());
1511 /* with commits enabled, commit is allowed */
1513 ok(ret, "CertControlStore failed: %d\n", ret);
1514 compareStore(store, "serialized store with cert",
1516 CertCloseStore(store, 0);
1517 }
1521 return;
1522 store = CertOpenStore(CERT_STORE_PROV_FILE, 0, 0,
1524 ok(store != NULL, "CertOpenStore failed: %08lx\n", GetLastError());
1525 if (store)
1526 {
1530 ok(ret, "CertAddEncodedCRLToStore failed: %08lx\n", GetLastError());
1531 compareStore(store, "serialized store with cert and CRL",
1533 FALSE);
1534 CertCloseStore(store, 0);
1535 }
1536
1538}
#define OPEN_EXISTING
Definition: compat.h:775
#define ERROR_INVALID_HANDLE
Definition: compat.h:98
DWORD WINAPI GetFileSize(HANDLE hFile, LPDWORD lpFileSizeHigh)
Definition: fileinfo.c:331

Referenced by START_TEST().

◆ testMemStore()

static void testMemStore ( void  )
static

Definition at line 129 of file store.c.

130{
131 HCERTSTORE store1, store2;
133 BOOL ret;
134 DWORD GLE;
135
136 /* NULL provider */
137 store1 = CertOpenStore(0, 0, 0, 0, NULL);
138 ok(!store1 && GetLastError() == ERROR_FILE_NOT_FOUND,
139 "Expected ERROR_FILE_NOT_FOUND, got %ld\n", GetLastError());
140 /* weird flags */
144 "Expected ERROR_CALL_NOT_IMPLEMENTED, got %ld\n", GetLastError());
145
146 /* normal */
149 ok(store1 != NULL, "CertOpenStore failed: %ld\n", GetLastError());
150 /* open existing doesn't */
153 ok(store2 != NULL, "CertOpenStore failed: %ld\n", GetLastError());
154 ok(store1 != store2, "Expected different stores\n");
155
156 /* add a bogus (empty) cert */
157 context = NULL;
160 /* Windows returns CRYPT_E_ASN1_EOD, but accept
161 * CRYPT_E_ASN1_CORRUPT as well (because matching errors is tough in this
162 * case)
163 */
164 GLE = GetLastError();
166 "Expected CRYPT_E_ASN1_EOD or CRYPT_E_ASN1_CORRUPT, got %08lx\n",
167 GLE);
168 /* add a "signed" cert--the signature isn't a real signature, so this adds
169 * without any check of the signature's validity
170 */
173 ok(ret, "CertAddEncodedCertificateToStore failed: %08lx\n", GetLastError());
174 ok(context != NULL, "Expected a valid cert context\n");
175 if (context)
176 {
177 ok(context->cbCertEncoded == sizeof(signedBigCert),
178 "Wrong cert size %ld\n", context->cbCertEncoded);
179 ok(!memcmp(context->pbCertEncoded, signedBigCert,
180 sizeof(signedBigCert)), "Unexpected encoded cert in context\n");
181 /* remove it, the rest of the tests will work on an unsigned cert */
183 ok(ret, "CertDeleteCertificateFromStore failed: %08lx\n",
184 GetLastError());
185 }
186 /* try adding a "signed" CRL as a cert */
189 GLE = GetLastError();
191 "Expected CRYPT_E_ASN1_BADTAG or CRYPT_E_ASN1_CORRUPT, got %08lx\n",
192 GLE);
193 /* add a cert to store1 */
196 ok(ret, "CertAddEncodedCertificateToStore failed: %08lx\n", GetLastError());
197 ok(context != NULL, "Expected a valid cert context\n");
198 if (context)
199 {
200 DWORD size;
201 BYTE *buf;
202
203 ok(context->cbCertEncoded == sizeof(bigCert),
204 "Wrong cert size %ld\n", context->cbCertEncoded);
205 ok(!memcmp(context->pbCertEncoded, bigCert, sizeof(bigCert)),
206 "Unexpected encoded cert in context\n");
207 ok(context->hCertStore == store1, "Unexpected store\n");
208
209 /* check serializing this element */
210 /* These crash
211 ret = CertSerializeCertificateStoreElement(NULL, 0, NULL, NULL);
212 ret = CertSerializeCertificateStoreElement(context, 0, NULL, NULL);
213 ret = CertSerializeCertificateStoreElement(NULL, 0, NULL, &size);
214 */
215 /* apparently flags are ignored */
217 ok(ret, "CertSerializeCertificateStoreElement failed: %08lx\n",
218 GetLastError());
219 buf = malloc(size);
220 if (buf)
221 {
223 ok(ret, "CertSerializeCertificateStoreElement failed: %08lx\n", GetLastError());
224 ok(size == sizeof(serializedCert), "Wrong size %ld\n", size);
226 "Unexpected serialized cert\n");
227 free(buf);
228 }
229
231 ok(ret, "CertFreeCertificateContext failed: %08lx\n", GetLastError());
232 }
233 /* verify the cert's in store1 */
235 ok(context != NULL, "Expected a valid context\n");
238 "Expected CRYPT_E_NOT_FOUND, got %08lx\n", GetLastError());
239 /* verify store2 (the "open existing" mem store) is still empty */
241 ok(!context, "Expected an empty store\n");
242 /* delete the cert from store1, and check it's empty */
244 if (context)
245 {
246 /* Deleting a bitwise copy crashes with an access to an uninitialized
247 * pointer, so a cert context has some special data out there in memory
248 * someplace
249 CERT_CONTEXT copy;
250 memcpy(&copy, context, sizeof(copy));
251 ret = CertDeleteCertificateFromStore(&copy);
252 */
254
255 ok(copy != NULL, "CertDuplicateCertificateContext failed: %08lx\n",
256 GetLastError());
258 ok(ret, "CertDeleteCertificateFromStore failed: %08lx\n",
259 GetLastError());
260 /* try deleting a copy */
262 ok(ret, "CertDeleteCertificateFromStore failed: %08lx\n",
263 GetLastError());
264 /* check that the store is empty */
266 ok(!context, "Expected an empty store\n");
267 }
268
269 /* close an empty store */
270 ret = CertCloseStore(NULL, 0);
271 ok(ret, "CertCloseStore failed: %ld\n", GetLastError());
272 ret = CertCloseStore(store1, 0);
273 ok(ret, "CertCloseStore failed: %ld\n", GetLastError());
274 ret = CertCloseStore(store2, 0);
275 ok(ret, "CertCloseStore failed: %ld\n", GetLastError());
276
277 /* This seems nonsensical, but you can open a read-only mem store, only
278 * it isn't read-only
279 */
282 ok(store1 != NULL, "CertOpenStore failed: %ld\n", GetLastError());
283 /* yep, this succeeds */
286 ok(ret, "CertAddEncodedCertificateToStore failed: %08lx\n", GetLastError());
287 ok(context != NULL, "Expected a valid cert context\n");
288 if (context)
289 {
290 ok(context->cbCertEncoded == sizeof(bigCert),
291 "Wrong cert size %ld\n", context->cbCertEncoded);
292 ok(!memcmp(context->pbCertEncoded, bigCert, sizeof(bigCert)),
293 "Unexpected encoded cert in context\n");
294 ok(context->hCertStore == store1, "Unexpected store\n");
296 ok(ret, "CertDeleteCertificateFromStore failed: %08lx\n",
297 GetLastError());
298 }
299 CertCloseStore(store1, 0);
300}
INT copy(TCHAR source[MAX_PATH], TCHAR dest[MAX_PATH], INT append, DWORD lpdwFlags, BOOL bTouch)
Definition: copy.c:51
PCCERT_CONTEXT WINAPI CertDuplicateCertificateContext(PCCERT_CONTEXT pCertContext)
Definition: cert.c:360
static const BYTE emptyCert[]
Definition: store.c:47
static const BYTE signedBigCert[]
Definition: store.c:58
#define CRYPT_E_ASN1_CORRUPT
Definition: winerror.h:4502
#define CRYPT_E_ASN1_EOD
Definition: winerror.h:4501
#define CRYPT_E_ASN1_BADTAG
Definition: winerror.h:4510

Referenced by START_TEST().

◆ testMessageStore()

static void testMessageStore ( void  )
static

Definition at line 1806 of file store.c.

1807{
1808 HCERTSTORE store;
1810 NULL);
1813 DWORD count, size;
1814 BOOL ret;
1815
1816 /* Crashes
1817 store = CertOpenStore(CERT_STORE_PROV_MSG, 0, 0, 0, NULL);
1818 */
1819 SetLastError(0xdeadbeef);
1820 store = CertOpenStore(CERT_STORE_PROV_MSG, 0, 0, 0, msg);
1822 "Expected CRYPT_E_INVALID_MSG_TYPE, got %08lx\n", GetLastError());
1824 store = CertOpenStore(CERT_STORE_PROV_MSG, 0, 0, 0, msg);
1825 ok(store != NULL, "CertOpenStore failed: %08lx\n", GetLastError());
1826 if (store)
1827 {
1830
1831 count = 0;
1832 do {
1834 if (cert)
1835 count++;
1836 } while (cert);
1837 ok(count == 0, "Expected 0 certificates, got %ld\n", count);
1838
1839 count = 0;
1840 do {
1841 crl = CertEnumCRLsInStore(store, crl);
1842 if (crl)
1843 count++;
1844 } while (crl);
1845 ok(count == 0, "Expected 0 CRLs, got %ld\n", count);
1846
1847 /* Can add certs to a message store */
1850 ok(ret, "CertAddEncodedCertificateToStore failed: %08lx\n",
1851 GetLastError());
1852 count = 0;
1853 do {
1855 if (cert)
1856 count++;
1857 } while (cert);
1858 ok(count == 1, "Expected 1 certificate, got %ld\n", count);
1859
1860 CertCloseStore(store, 0);
1861 }
1862 /* but the added certs weren't actually added to the message */
1863 size = sizeof(count);
1865 ok(ret, "CryptMsgGetParam failed: %08lx\n", GetLastError());
1866 ok(count == 0, "Expected 0 certificates, got %ld\n", count);
1868
1869 /* Crashes
1870 store = CertOpenStore(CERT_STORE_PROV_PKCS7, 0, 0, 0, NULL);
1871 */
1872 store = CertOpenStore(CERT_STORE_PROV_PKCS7, 0, 0, 0, &blob);
1873 ok(store != NULL, "CertOpenStore failed: %08lx\n", GetLastError());
1874 if (store)
1875 {
1876 DWORD count = 0;
1879
1880 do {
1882 if (cert)
1883 count++;
1884 } while (cert);
1885 ok(count == 1, "Expected 1 certificate, got %ld\n", count);
1886
1887 count = 0;
1888 do {
1889 crl = CertEnumCRLsInStore(store, crl);
1890 if (crl)
1891 count++;
1892 } while (crl);
1893 ok(count == 1, "Expected 1 CRL, got %ld\n", count);
1894
1895 CertCloseStore(store, 0);
1896 }
1897 /* Encoding appears to be ignored */
1899 &blob);
1900 ok(store != NULL, "CertOpenStore failed: %08lx\n", GetLastError());
1901 if (store)
1902 CertCloseStore(store, 0);
1903 /* Messages other than signed messages aren't allowed */
1904 blob.cbData = sizeof(hashContent);
1905 blob.pbData = (LPBYTE)hashContent;
1906 SetLastError(0xdeadbeef);
1907 store = CertOpenStore(CERT_STORE_PROV_PKCS7, 0, 0, 0, &blob);
1909 "Expected CRYPT_E_INVALID_MSG_TYPE, got %08lx\n", GetLastError());
1910 blob.cbData = sizeof(hashBareContent);
1911 blob.pbData = (LPBYTE)hashBareContent;
1912 SetLastError(0xdeadbeef);
1913 store = CertOpenStore(CERT_STORE_PROV_PKCS7, 0, 0, 0, &blob);
1914 ok(!store && GetLastError() == CRYPT_E_ASN1_BADTAG,
1915 "Expected CRYPT_E_ASN1_BADTAG, got %08lx\n", GetLastError());
1916}
HCRYPTMSG WINAPI CryptMsgOpenToDecode(DWORD dwMsgEncodingType, DWORD dwFlags, DWORD dwMsgType, HCRYPTPROV_LEGACY hCryptProv, PCERT_INFO pRecipientInfo, PCMSG_STREAM_INFO pStreamInfo)
Definition: msg.c:3552
BOOL WINAPI CryptMsgGetParam(HCRYPTMSG hCryptMsg, DWORD dwParamType, DWORD dwIndex, void *pvData, DWORD *pcbData)
Definition: msg.c:3626
BOOL WINAPI CryptMsgUpdate(HCRYPTMSG hCryptMsg, const BYTE *pbData, DWORD cbData, BOOL fFinal)
Definition: msg.c:3616
BOOL WINAPI CryptMsgClose(HCRYPTMSG hCryptMsg)
Definition: msg.c:3597
static const BYTE hashContent[]
Definition: store.c:1794
static const BYTE signedWithCertAndCrlBareContent[]
Definition: store.c:1770
static const BYTE signedContent[]
Definition: store.c:1756
static const BYTE hashBareContent[]
Definition: store.c:1800
#define CERT_STORE_PROV_PKCS7
Definition: wincrypt.h:2458
#define CERT_STORE_PROV_MSG
Definition: wincrypt.h:2454
#define PKCS_7_ASN_ENCODING
Definition: wincrypt.h:2503
#define CMSG_CERT_COUNT_PARAM
Definition: wincrypt.h:4100
#define CRYPT_E_INVALID_MSG_TYPE
Definition: winerror.h:4402

Referenced by START_TEST().

◆ testRegStore()

static void testRegStore ( void  )
static

Definition at line 998 of file store.c.

999{
1000 static const char tempKey[] = "Software\\Wine\\CryptTemp";
1001 HCERTSTORE store;
1002 LONG rc;
1003 HKEY key = NULL;
1004 DWORD disp, GLE;
1005
1006 store = CertOpenStore(CERT_STORE_PROV_REG, 0, 0, 0, NULL);
1007 GLE = GetLastError();
1008 ok(!store && (GLE == ERROR_INVALID_HANDLE || GLE == ERROR_BADKEY),
1009 "Expected ERROR_INVALID_HANDLE or ERROR_BADKEY, got %ld\n", GLE);
1010 store = CertOpenStore(CERT_STORE_PROV_REG, 0, 0, 0, key);
1011 GLE = GetLastError();
1012 ok(!store && (GLE == ERROR_INVALID_HANDLE || GLE == ERROR_BADKEY),
1013 "Expected ERROR_INVALID_HANDLE or ERROR_BADKEY, got %ld\n", GLE);
1014
1015 /* Opening up any old key works.. */
1017 store = CertOpenStore(CERT_STORE_PROV_REG, 0, 0, 0, key);
1018 /* Not sure if this is a bug in DuplicateHandle, marking todo_wine for now
1019 */
1020 todo_wine ok(store != 0, "CertOpenStore failed: %08lx\n", GetLastError());
1021 CertCloseStore(store, 0);
1022
1024 NULL, &key, NULL);
1025 ok(!rc, "RegCreateKeyExA failed: %ld\n", rc);
1026 if (key)
1027 {
1028 BOOL ret;
1029 BYTE hash[20];
1030 DWORD size, i;
1031 static const char certificates[] = "Certificates\\";
1032 char subKeyName[sizeof(certificates) + 20 * 2 + 1], *ptr;
1033 HKEY subKey;
1035
1036 store = CertOpenStore(CERT_STORE_PROV_REG, 0, 0, 0, key);
1037 ok(store != 0, "CertOpenStore failed: %08lx\n", GetLastError());
1038 /* Add a certificate. It isn't persisted right away, since it's only
1039 * added to the cache..
1040 */
1043 ok(ret, "CertAddEncodedCertificateToStore failed: %08lx\n",
1044 GetLastError());
1045 /* so flush the cache to force a commit.. */
1047 ok(ret, "CertControlStore failed: %08lx\n", GetLastError());
1048 /* and check that the expected subkey was written. */
1049 size = sizeof(hash);
1050 ret = CryptHashCertificate(0, 0, 0, bigCert2, sizeof(bigCert2),
1051 hash, &size);
1052 ok(ret, "CryptHashCertificate failed: %ld\n", GetLastError());
1053 strcpy(subKeyName, certificates);
1054 for (i = 0, ptr = subKeyName + sizeof(certificates) - 1; i < size;
1055 i++, ptr += 2)
1056 sprintf(ptr, "%02X", hash[i]);
1057 rc = RegCreateKeyExA(key, subKeyName, 0, NULL, 0, KEY_ALL_ACCESS, NULL,
1058 &subKey, NULL);
1059 ok(!rc, "RegCreateKeyExA failed: %ld\n", rc);
1060 if (subKey)
1061 {
1062 LPBYTE buf;
1063
1064 size = 0;
1065 RegQueryValueExA(subKey, "Blob", NULL, NULL, NULL, &size);
1066 buf = malloc(size);
1067 if (buf)
1068 {
1069 rc = RegQueryValueExA(subKey, "Blob", NULL, NULL, buf, &size);
1070 ok(!rc, "RegQueryValueExA failed: %ld\n", rc);
1071 if (!rc)
1072 {
1073 const struct CertPropIDHeader *hdr;
1074
1075 /* Both the hash and the cert should be present */
1077 ok(hdr != NULL, "Expected to find a cert property\n");
1078 if (hdr)
1079 {
1080 ok(hdr->cb == sizeof(bigCert2),
1081 "Wrong size %ld of cert property\n", hdr->cb);
1082 ok(!memcmp((const BYTE *)hdr + sizeof(*hdr), bigCert2,
1083 hdr->cb), "Unexpected cert in cert property\n");
1084 }
1086 ok(hdr != NULL, "Expected to find a hash property\n");
1087 if (hdr)
1088 {
1089 ok(hdr->cb == sizeof(hash),
1090 "Wrong size %ld of hash property\n", hdr->cb);
1091 ok(!memcmp((const BYTE *)hdr + sizeof(*hdr), hash,
1092 hdr->cb), "Unexpected hash in cert property\n");
1093 }
1094 }
1095 free(buf);
1096 }
1097 RegCloseKey(subKey);
1098 }
1099
1100 /* Remove the existing context */
1102 ok(context != NULL, "Expected a cert context\n");
1103 if (context)
1106 ok(ret, "CertControlStore failed: %08lx\n", GetLastError());
1107
1108 /* Add a serialized cert with a bogus hash directly to the registry */
1109 memset(hash, 0, sizeof(hash));
1110 strcpy(subKeyName, certificates);
1111 for (i = 0, ptr = subKeyName + sizeof(certificates) - 1;
1112 i < sizeof(hash); i++, ptr += 2)
1113 sprintf(ptr, "%02X", hash[i]);
1114 rc = RegCreateKeyExA(key, subKeyName, 0, NULL, 0, KEY_ALL_ACCESS, NULL,
1115 &subKey, NULL);
1116 ok(!rc, "RegCreateKeyExA failed: %ld\n", rc);
1117 if (subKey)
1118 {
1119 BYTE buf[sizeof(struct CertPropIDHeader) * 2 + sizeof(hash) +
1120 sizeof(bigCert)], *ptr;
1121 DWORD certCount = 0;
1122 struct CertPropIDHeader *hdr;
1123
1124 hdr = (struct CertPropIDHeader *)buf;
1125 hdr->propID = CERT_HASH_PROP_ID;
1126 hdr->unknown1 = 1;
1127 hdr->cb = sizeof(hash);
1128 ptr = buf + sizeof(*hdr);
1129 memcpy(ptr, hash, sizeof(hash));
1130 ptr += sizeof(hash);
1131 hdr = (struct CertPropIDHeader *)ptr;
1132 hdr->propID = CERT_CERT_PROP_ID;
1133 hdr->unknown1 = 1;
1134 hdr->cb = sizeof(bigCert);
1135 ptr += sizeof(*hdr);
1136 memcpy(ptr, bigCert, sizeof(bigCert));
1137
1138 rc = RegSetValueExA(subKey, "Blob", 0, REG_BINARY, buf,
1139 sizeof(buf));
1140 ok(!rc, "RegSetValueExA failed: %ld\n", rc);
1141
1143 ok(ret, "CertControlStore failed: %08lx\n", GetLastError());
1144
1145 /* Make sure the bogus hash cert gets loaded. */
1146 certCount = 0;
1147 context = NULL;
1148 do {
1150 if (context)
1151 certCount++;
1152 } while (context != NULL);
1153 ok(certCount == 1, "Expected 1 certificates, got %ld\n", certCount);
1154
1155 RegCloseKey(subKey);
1156 }
1157
1158 /* Add another serialized cert directly to the registry, this time
1159 * under the correct key name (named with the correct hash value).
1160 */
1161 size = sizeof(hash);
1163 sizeof(bigCert2), hash, &size);
1164 ok(ret, "CryptHashCertificate failed: %ld\n", GetLastError());
1165 strcpy(subKeyName, certificates);
1166 for (i = 0, ptr = subKeyName + sizeof(certificates) - 1;
1167 i < sizeof(hash); i++, ptr += 2)
1168 sprintf(ptr, "%02X", hash[i]);
1169 rc = RegCreateKeyExA(key, subKeyName, 0, NULL, 0, KEY_ALL_ACCESS, NULL,
1170 &subKey, NULL);
1171 ok(!rc, "RegCreateKeyExA failed: %ld\n", rc);
1172 if (subKey)
1173 {
1174 BYTE buf[sizeof(struct CertPropIDHeader) * 2 + sizeof(hash) +
1175 sizeof(bigCert2)], *ptr;
1176 DWORD certCount = 0;
1178 struct CertPropIDHeader *hdr;
1179
1180 /* First try with a bogus hash... */
1181 hdr = (struct CertPropIDHeader *)buf;
1182 hdr->propID = CERT_HASH_PROP_ID;
1183 hdr->unknown1 = 1;
1184 hdr->cb = sizeof(hash);
1185 ptr = buf + sizeof(*hdr);
1186 memset(ptr, 0, sizeof(hash));
1187 ptr += sizeof(hash);
1188 hdr = (struct CertPropIDHeader *)ptr;
1189 hdr->propID = CERT_CERT_PROP_ID;
1190 hdr->unknown1 = 1;
1191 hdr->cb = sizeof(bigCert2);
1192 ptr += sizeof(*hdr);
1193 memcpy(ptr, bigCert2, sizeof(bigCert2));
1194
1195 rc = RegSetValueExA(subKey, "Blob", 0, REG_BINARY, buf,
1196 sizeof(buf));
1197 ok(!rc, "RegSetValueExA failed: %ld\n", rc);
1198
1200 ok(ret, "CertControlStore failed: %08lx\n", GetLastError());
1201
1202 /* and make sure just one cert still gets loaded. */
1203 certCount = 0;
1204 context = NULL;
1205 do {
1207 if (context)
1208 certCount++;
1209 } while (context != NULL);
1210 ok(certCount == 1, "Expected 1 certificate, got %ld\n", certCount);
1211
1212 /* Try again with the correct hash... */
1213 ptr = buf + sizeof(*hdr);
1214 memcpy(ptr, hash, sizeof(hash));
1215
1216 rc = RegSetValueExA(subKey, "Blob", 0, REG_BINARY, buf,
1217 sizeof(buf));
1218 ok(!rc, "RegSetValueExA failed: %ld\n", rc);
1219
1221 ok(ret, "CertControlStore failed: %08lx\n", GetLastError());
1222
1223 /* and make sure two certs get loaded. */
1224 certCount = 0;
1225 context = NULL;
1226 do {
1228 if (context)
1229 certCount++;
1230 } while (context != NULL);
1231 ok(certCount == 2, "Expected 2 certificates, got %ld\n", certCount);
1232
1233 RegCloseKey(subKey);
1234 }
1235 CertCloseStore(store, 0);
1236 /* Is delete allowed on a reg store? */
1237 store = CertOpenStore(CERT_STORE_PROV_REG, 0, 0,
1239 ok(store == NULL, "Expected NULL return from CERT_STORE_DELETE_FLAG\n");
1240 ok(GetLastError() == 0, "CertOpenStore failed: %08lx\n",
1241 GetLastError());
1242
1244 }
1245 /* The CertOpenStore with CERT_STORE_DELETE_FLAG above will delete the
1246 * contents of the key, but not the key itself.
1247 */
1249 NULL, &key, &disp);
1250 ok(!rc, "RegCreateKeyExA failed: %ld\n", rc);
1252 "Expected REG_OPENED_EXISTING_KEY, got %ld\n", disp);
1253 if (!rc)
1254 {
1256 rc = RegDeleteKeyA(HKEY_CURRENT_USER, tempKey);
1257 if (rc)
1258 {
1259 /* Use shlwapi's SHDeleteKeyA to _really_ blow away the key,
1260 * otherwise subsequent tests will fail.
1261 */
1263 }
1264 }
1265}
LONG WINAPI RegSetValueExA(HKEY hKey, LPCSTR lpValueName, DWORD Reserved, DWORD dwType, CONST BYTE *lpData, DWORD cbData)
Definition: reg.c:4799
LONG WINAPI RegQueryValueExA(_In_ HKEY hkeyorg, _In_ LPCSTR name, _In_ LPDWORD reserved, _Out_opt_ LPDWORD type, _Out_opt_ LPBYTE data, _Inout_opt_ LPDWORD count)
Definition: reg.c:4009
LONG WINAPI RegCreateKeyExA(_In_ HKEY hKey, _In_ LPCSTR lpSubKey, _In_ DWORD Reserved, _In_ LPSTR lpClass, _In_ DWORD dwOptions, _In_ REGSAM samDesired, _In_ LPSECURITY_ATTRIBUTES lpSecurityAttributes, _Out_ PHKEY phkResult, _Out_ LPDWORD lpdwDisposition)
Definition: reg.c:1034
LONG WINAPI RegDeleteKeyA(_In_ HKEY hKey, _In_ LPCSTR lpSubKey)
Definition: reg.c:1224
DWORD WINAPI SHDeleteKeyA(HKEY hKey, LPCSTR lpszSubKey)
Definition: reg.c:1533
static PVOID ptr
Definition: dispmode.c:27
#define sprintf
Definition: sprintf.c:45
static const struct CertPropIDHeader * findPropID(const BYTE *buf, DWORD size, DWORD propID)
Definition: store.c:967
#define REG_BINARY
Definition: nt_native.h:1499
#define KEY_ALL_ACCESS
Definition: nt_native.h:1044
#define REG_OPENED_EXISTING_KEY
Definition: nt_native.h:1088
long LONG
Definition: pedump.c:60
strcpy
Definition: string.h:131
#define CERT_STORE_CTRL_RESYNC
Definition: wincrypt.h:2967
#define CERT_STORE_PROV_REG
Definition: wincrypt.h:2457
#define ERROR_BADKEY
Definition: winerror.h:913

Referenced by START_TEST().

◆ testRegStoreSavedCerts()

static void testRegStoreSavedCerts ( void  )
static

Definition at line 365 of file store.c.

366{
368 HCERTSTORE store;
369 HANDLE cert_file;
370 HRESULT pathres;
371 WCHAR key_name[MAX_PATH], appdata_path[MAX_PATH];
372 HKEY key;
373 BOOL ret;
374 DWORD res,i;
375
376 for (i = 0; i < ARRAY_SIZE(reg_store_saved_certs); i++)
377 {
378 DWORD err;
379
382
383 err = GetLastError();
384 if (!store)
385 {
386 ok (err == ERROR_ACCESS_DENIED, "Failed to create store at %ld (%08lx)\n", i, err);
387 skip("Insufficient privileges for the test %ld\n", i);
388 continue;
389 }
390 ok (store!=NULL, "Failed to open the store at %ld, %lx\n", i, GetLastError());
392 ok (cert1 != NULL, "Create cert context failed at %ld, %lx\n", i, GetLastError());
394 /* Additional skip per Win7, it allows opening HKLM store, but disallows adding certs */
395 err = GetLastError();
396 if (!ret)
397 {
398 ok (err == ERROR_ACCESS_DENIED, "Failed to add certificate to store at %ld (%08lx)\n", i, err);
399 skip("Insufficient privileges for the test %ld\n", i);
400 continue;
401 }
402 ok (ret, "Adding to the store failed at %ld, %lx\n", i, err);
404 CertCloseStore(store, 0);
405
407 reg_store_saved_certs[i].store_name, L"Certificates", L"6E3090715FD92356EBAE2540E622DA192602A608");
408
410 {
412 ok (!res, "The cert hasn't been saved at %ld, %lx\n", i, GetLastError());
413 if (!res) RegCloseKey(key);
414 } else
415 {
416 pathres = SHGetFolderPathW(NULL, CSIDL_APPDATA, NULL, 0, appdata_path);
417 ok (pathres == S_OK,
418 "Failed to get app data path at %ld (%lx)\n", pathres, GetLastError());
419 if (pathres == S_OK)
420 {
421 PathAppendW(appdata_path, L"Microsoft\\SystemCertificates");
423 PathAppendW(appdata_path, L"Certificates");
424 PathAppendW(appdata_path, L"6E3090715FD92356EBAE2540E622DA192602A608");
425
426 cert_file = CreateFileW(appdata_path, GENERIC_READ, 0, NULL,
428 todo_wine ok (cert_file != INVALID_HANDLE_VALUE,
429 "Cert was not saved in AppData at %ld (%lx)\n", i, GetLastError());
430 CloseHandle(cert_file);
431 }
432 }
433
434 /* deleting cert from store */
437 ok (store!=NULL, "Failed to open the store at %ld, %lx\n", i, GetLastError());
438
440 ok (cert1 != NULL, "Create cert context failed at %ld, %lx\n", i, GetLastError());
441
444 ok (cert2 != NULL, "Failed to find cert in the store at %ld, %lx\n", i, GetLastError());
445
447 ok (ret, "Failed to delete certificate from store at %ld, %lx\n", i, GetLastError());
448
451 CertCloseStore(store, 0);
452
454 ok (res, "The cert's registry entry should be absent at %li, %lx\n", i, GetLastError());
455 if (!res) RegCloseKey(key);
456
458 {
459 cert_file = CreateFileW(appdata_path, GENERIC_READ, 0, NULL,
461 ok (cert_file == INVALID_HANDLE_VALUE,
462 "Cert should have been absent in AppData %ld\n", i);
463
464 CloseHandle(cert_file);
465 }
466 }
467}
HRESULT WINAPI SHGetFolderPathW(HWND hwndOwner, int nFolder, HANDLE hToken, DWORD dwFlags, LPWSTR pszPath)
Definition: shellpath.c:2716
#define S_OK
Definition: intsafe.h:52
static const BYTE cert1[]
Definition: message.c:781
const WCHAR * base_reg_path
Definition: store.c:345
static const struct @1783 reg_store_saved_certs[]
BOOL appdata_file
Definition: store.c:343
DWORD cert_store
Definition: store.c:342
WCHAR store_name[16]
Definition: store.c:344
#define PathAppendW
Definition: pathcch.h:310
#define CSIDL_APPDATA
Definition: shlobj.h:2204
#define CERT_STORE_ADD_REPLACE_EXISTING
Definition: wincrypt.h:2653
#define CERT_STORE_PROV_SYSTEM_REGISTRY_W
Definition: wincrypt.h:2467
#define CERT_FIND_EXISTING
Definition: wincrypt.h:3052
int WINAPIV wsprintfW(_Out_ LPWSTR, _In_ _Printf_format_string_ LPCWSTR,...)

Referenced by START_TEST().

◆ testSerializedStore()

static void testSerializedStore ( void  )
static

Definition at line 1918 of file store.c.

1919{
1920 HCERTSTORE store;
1922
1923 if (0)
1924 {
1925 /* Crash */
1929 }
1930 blob.cbData = sizeof(serializedStoreWithCert);
1931 blob.pbData = (BYTE *)serializedStoreWithCert;
1935 "Expected ERROR_CALL_NOT_IMPLEMENTED, got %08lx\n", GetLastError());
1936 store = CertOpenStore(CERT_STORE_PROV_SERIALIZED, 0, 0, 0, &blob);
1937 ok(store != NULL, "CertOpenStore failed: %08lx\n", GetLastError());
1938 if (store)
1939 {
1942
1944 ok(cert != NULL, "CertEnumCertificatesInStore failed: %08lx\n",
1945 GetLastError());
1947 ok(!cert, "Expected only one cert\n");
1948 crl = CertEnumCRLsInStore(store, NULL);
1949 ok(!crl, "Expected no CRLs\n");
1950
1951 CertCloseStore(store, 0);
1952 }
1953 blob.cbData = sizeof(serializedStoreWithCertAndCRL);
1955 store = CertOpenStore(CERT_STORE_PROV_SERIALIZED, 0, 0, 0, &blob);
1956 ok(store != NULL, "CertOpenStore failed: %08lx\n", GetLastError());
1957 if (store)
1958 {
1961
1963 ok(cert != NULL, "CertEnumCertificatesInStore failed: %08lx\n",
1964 GetLastError());
1966 ok(!cert, "Expected only one cert\n");
1967 crl = CertEnumCRLsInStore(store, NULL);
1968 ok(crl != NULL, "CertEnumCRLsInStore failed: %08lx\n",
1969 GetLastError());
1970 crl = CertEnumCRLsInStore(store, crl);
1971 ok(!crl, "Expected only one CRL\n");
1972
1973 CertCloseStore(store, 0);
1974 }
1975}
#define CERT_STORE_PROV_SERIALIZED
Definition: wincrypt.h:2459

Referenced by START_TEST().

◆ testStoreProperty()

static void testStoreProperty ( void  )
static

Definition at line 2119 of file store.c.

2120{
2121 HCERTSTORE store;
2122 BOOL ret;
2123 DWORD propID, size = 0, state;
2125
2126 /* Crash
2127 ret = CertGetStoreProperty(NULL, 0, NULL, NULL);
2128 ret = CertGetStoreProperty(NULL, 0, NULL, &size);
2129 ret = CertGetStoreProperty(store, 0, NULL, NULL);
2130 */
2131
2134 /* Check a missing prop ID */
2135 SetLastError(0xdeadbeef);
2136 ret = CertGetStoreProperty(store, 0, NULL, &size);
2138 "Expected CRYPT_E_NOT_FOUND, got %08lx\n", GetLastError());
2139 /* Contrary to MSDN, CERT_ACCESS_STATE_PROP_ID is supported for stores.. */
2140 size = sizeof(state);
2142 ok(ret, "CertGetStoreProperty failed for CERT_ACCESS_STATE_PROP_ID: %08lx\n",
2143 GetLastError());
2144 ok(!state, "Expected a non-persisted store\n");
2145 /* and CERT_STORE_LOCALIZED_NAME_PROP_ID isn't supported by default. */
2146 size = 0;
2148 &size);
2150 "Expected CRYPT_E_NOT_FOUND, got %08lx\n", GetLastError());
2151 /* Delete an arbitrary property on a store */
2153 ok(ret, "CertSetStoreProperty failed: %08lx\n", GetLastError());
2154 /* Set an arbitrary property on a store */
2155 blob.pbData = (LPBYTE)&state;
2156 blob.cbData = sizeof(state);
2158 ok(ret, "CertSetStoreProperty failed: %08lx\n", GetLastError());
2159 /* Get an arbitrary property that's been set */
2161 ok(ret, "CertGetStoreProperty failed: %08lx\n", GetLastError());
2162 ok(size == sizeof(state), "Unexpected data size %ld\n", size);
2164 ok(ret, "CertGetStoreProperty failed: %08lx\n", GetLastError());
2165 ok(propID == state, "CertGetStoreProperty got the wrong value\n");
2166 /* Delete it again */
2168 ok(ret, "CertSetStoreProperty failed: %08lx\n", GetLastError());
2169 /* And check that it's missing */
2170 SetLastError(0xdeadbeef);
2173 "Expected CRYPT_E_NOT_FOUND, got %08lx\n", GetLastError());
2174 CertCloseStore(store, 0);
2175
2176 /* Recheck on the My store.. */
2177 store = CertOpenSystemStoreW(0, L"My");
2178 size = sizeof(state);
2180 ok(ret, "CertGetStoreProperty failed for CERT_ACCESS_STATE_PROP_ID: %08lx\n",
2181 GetLastError());
2182 ok(state, "Expected a persisted store\n");
2183 SetLastError(0xdeadbeef);
2184 size = 0;
2186 &size);
2188 "Expected CRYPT_E_NOT_FOUND, got %08lx\n", GetLastError());
2189 CertCloseStore(store, 0);
2190}
static int state
Definition: maze.c:121
BOOL WINAPI CertSetStoreProperty(HCERTSTORE hCertStore, DWORD dwPropId, DWORD dwFlags, const void *pvData)
Definition: store.c:1236
BOOL WINAPI CertGetStoreProperty(HCERTSTORE hCertStore, DWORD dwPropId, void *pvData, DWORD *pcbData)
Definition: store.c:1172
#define CERT_STORE_LOCALIZED_NAME_PROP_ID
Definition: wincrypt.h:2977
#define CERT_FIRST_USER_PROP_ID
Definition: wincrypt.h:2895
#define CERT_ACCESS_STATE_PROP_ID
Definition: wincrypt.h:2847

Referenced by START_TEST().

◆ testStoresInCollection()

static void testStoresInCollection ( void  )
static

This test checks that certificate falls into correct store of a collection depending on the access flags and priorities.

Adding certificate to collection should fall into rw store, even though prioirty of the ro_store is higher

adding one more rw store with higher priority

checking certificates in the stores

checking certificates in the collection

Definition at line 473 of file store.c.

474{
475 PCCERT_CONTEXT cert1, cert2, tcert1;
476 HCERTSTORE collection, ro_store, rw_store, rw_store_2, tstore;
477 BOOL ret;
478
481 ok(collection != NULL, "Failed to init collection store, last error %lx\n", GetLastError());
482 /* Add read-only store to collection with very high priority*/
484 CERT_SYSTEM_STORE_CURRENT_USER, L"WineTest_RO");
485 ok(ro_store != NULL, "Failed to init ro store %lx\n", GetLastError());
486
487 ret = CertAddStoreToCollection(collection, ro_store, 0, 1000);
488 ok (ret, "Failed to add read-only store to collection %lx\n", GetLastError());
489
491 ok (cert1 != NULL, "Create cert context failed %lx\n", GetLastError());
493 ok (!ret, "Added cert to collection with single read-only store %lx\n", GetLastError());
494
495 /* Add read-write store to collection with the lowest priority*/
497 CERT_SYSTEM_STORE_CURRENT_USER, L"WineTest_RW");
498 ok (rw_store != NULL, "Failed to open rw store %lx\n", GetLastError());
500 ok (ret, "Failed to add rw store to collection %lx\n", GetLastError());
504 ok (ret, "Failed to add cert to the collection %lx\n", GetLastError());
505
506 tcert1 = CertEnumCertificatesInStore(ro_store, NULL);
507 ok (!tcert1, "Read-only ro_store contains cert\n");
508
509 tcert1 = CertEnumCertificatesInStore(rw_store, NULL);
510 ok (cert1 && tcert1->cbCertEncoded == cert1->cbCertEncoded,
511 "Unexpected cert in the rw store\n");
513
515 ok (tcert1 && tcert1->cbCertEncoded == cert1->cbCertEncoded,
516 "Unexpected cert in the collection\n");
518
521 CERT_SYSTEM_STORE_CURRENT_USER, L"WineTest_RW2");
522 ok (rw_store_2 != NULL, "Failed to init second rw store %lx\n", GetLastError());
524 ok (ret, "Failed to add rw_store_2 to collection %lx\n",GetLastError());
525
527 ok (cert2 != NULL, "Failed to create cert context %lx\n", GetLastError());
529 ok (ret, "Failed to add cert2 to the store %lx\n",GetLastError());
530
532 tcert1 = CertEnumCertificatesInStore(ro_store, 0);
533 ok (tcert1 == NULL, "Read-only store not empty\n");
534
535 tcert1 = CertEnumCertificatesInStore(rw_store, NULL);
536 ok (tcert1 && tcert1->cbCertEncoded == cert1->cbCertEncoded,
537 "Unexpected cert in the rw_store\n");
539
540 tcert1 = CertEnumCertificatesInStore(rw_store_2, NULL);
541 ok (tcert1 && tcert1->cbCertEncoded == cert2->cbCertEncoded,
542 "Unexpected cert in the rw_store_2\n");
544
547 ok (tcert1 && tcert1->cbCertEncoded == cert2->cbCertEncoded,
548 "cert2 expected in the collection got %p, %lx\n",tcert1, GetLastError());
549 tcert1 = CertEnumCertificatesInStore(collection, tcert1);
550 ok (tcert1 && tcert1->cbCertEncoded == cert1->cbCertEncoded,
551 "cert1 expected in the collection got %p, %lx\n",tcert1, GetLastError());
552 tcert1 = CertEnumCertificatesInStore(collection, tcert1);
553 ok (tcert1==NULL,"Unexpected cert in the collection %p %lx\n",tcert1, GetLastError());
554
555 /* checking whether certs had been saved */
558 ok (tstore!=NULL, "Failed to open existing rw store\n");
559 tcert1 = CertEnumCertificatesInStore(tstore, NULL);
561 ok(tcert1 && tcert1->cbCertEncoded == cert1->cbCertEncoded, "cert1 wasn't saved\n");
563 CertCloseStore(tstore,0);
564
567 ok (tstore!=NULL, "Failed to open existing rw2 store\n");
568 tcert1 = CertEnumCertificatesInStore(tstore, NULL);
570 ok (tcert1 && tcert1->cbCertEncoded == cert2->cbCertEncoded, "cert2 wasn't saved\n");
572 CertCloseStore(tstore,0);
573
575 CertCloseStore(ro_store,0);
576 CertCloseStore(rw_store,0);
577 CertCloseStore(rw_store_2,0);
578
579 /* reopening registry stores to check whether certs had been saved */
581 CERT_SYSTEM_STORE_CURRENT_USER, L"WineTest_RW");
582 tcert1 = CertEnumCertificatesInStore(rw_store, NULL);
583 ok (tcert1 && tcert1->cbCertEncoded == cert1->cbCertEncoded,
584 "Unexpected cert in store %p\n", tcert1);
586 CertCloseStore(rw_store,0);
587
589 CERT_SYSTEM_STORE_CURRENT_USER, L"WineTest_RW2");
590 tcert1 = CertEnumCertificatesInStore(rw_store_2, NULL);
591 ok (tcert1 && tcert1->cbCertEncoded == cert2->cbCertEncoded,
592 "Unexpected cert in store %p\n", tcert1);
594 CertCloseStore(rw_store_2,0);
595
604
605}
DWORD cbCertEncoded
Definition: wincrypt.h:490

Referenced by START_TEST().

◆ testSystemRegStore()

static void testSystemRegStore ( void  )
static

Definition at line 1267 of file store.c.

1268{
1269 HCERTSTORE store, memStore;
1270
1271 /* Check with a UNICODE name */
1274 /* Not all OSes support CERT_STORE_PROV_SYSTEM_REGISTRY, so don't continue
1275 * testing if they don't.
1276 */
1277 if (!store)
1278 return;
1279
1280 /* Check that it isn't a collection store */
1281 memStore = CertOpenStore(CERT_STORE_PROV_MEMORY, 0, 0,
1283 if (memStore)
1284 {
1285 BOOL ret = CertAddStoreToCollection(store, memStore, 0, 0);
1286 ok(!ret && GetLastError() == E_INVALIDARG, "Expected E_INVALIDARG, got %08lx\n", GetLastError());
1287 CertCloseStore(memStore, 0);
1288 }
1289 CertCloseStore(store, 0);
1290
1291 /* Check opening a bogus store */
1294 ok(!store && GetLastError() == ERROR_FILE_NOT_FOUND,
1295 "Expected ERROR_FILE_NOT_FOUND, got %08lx\n", GetLastError());
1298 ok(store != 0, "CertOpenStore failed: %08lx\n", GetLastError());
1299 if (store)
1300 CertCloseStore(store, 0);
1301 /* Now check whether deleting is allowed */
1304 ok(!store, "CertOpenStore failed: %08lx\n", GetLastError());
1305 RegDeleteKeyW(HKEY_CURRENT_USER, L"Software\\Microsoft\\SystemCertificates\\Bogus");
1306
1308 ok(!store && GetLastError() == E_INVALIDARG,
1309 "Expected E_INVALIDARG, got %08lx\n", GetLastError());
1312 ok(!store && GetLastError() == E_INVALIDARG,
1313 "Expected E_INVALIDARG, got %08lx\n", GetLastError());
1316 ok(!store && GetLastError() == E_INVALIDARG,
1317 "Expected E_INVALIDARG, got %08lx\n", GetLastError());
1318 /* The name is expected to be UNICODE, check with an ASCII name */
1321 ok(!store && GetLastError() == ERROR_FILE_NOT_FOUND,
1322 "Expected ERROR_FILE_NOT_FOUND, got %08lx\n", GetLastError());
1323}

Referenced by START_TEST().

◆ testSystemStore()

static void testSystemStore ( void  )
static

Definition at line 1325 of file store.c.

1326{
1327 HCERTSTORE store;
1328 WCHAR keyName[MAX_PATH];
1329 HKEY key;
1330 LONG rc;
1331
1332 store = CertOpenStore(CERT_STORE_PROV_SYSTEM, 0, 0, 0, NULL);
1333 ok(!store && GetLastError() == ERROR_FILE_NOT_FOUND,
1334 "Expected ERROR_FILE_NOT_FOUND, got %08lx\n", GetLastError());
1337 ok(!store && GetLastError() == ERROR_FILE_NOT_FOUND,
1338 "Expected ERROR_FILE_NOT_FOUND, got %08lx\n", GetLastError());
1341 ok(!store && GetLastError() == ERROR_FILE_NOT_FOUND,
1342 "Expected ERROR_FILE_NOT_FOUND, got %08lx\n", GetLastError());
1343 /* The name is expected to be UNICODE, first check with an ASCII name */
1346 ok(!store && GetLastError() == ERROR_FILE_NOT_FOUND,
1347 "Expected ERROR_FILE_NOT_FOUND, got %08lx\n", GetLastError());
1348 /* Create the expected key */
1350 lstrcatW(keyName, L"\\My");
1351 rc = RegCreateKeyExW(HKEY_CURRENT_USER, keyName, 0, NULL, 0, KEY_READ,
1352 NULL, &key, NULL);
1353 ok(!rc, "RegCreateKeyEx failed: %ld\n", rc);
1354 if (!rc)
1356 /* Check opening with a UNICODE name, specifying the create new flag */
1359 ok(!store && GetLastError() == ERROR_FILE_EXISTS,
1360 "Expected ERROR_FILE_EXISTS, got %08lx\n", GetLastError());
1361 /* Now check opening with a UNICODE name, this time opening existing */
1364 ok(store != 0, "CertOpenStore failed: %08lx\n", GetLastError());
1365 if (store)
1366 {
1369
1370 /* Check that it's a collection store */
1371 if (memStore)
1372 {
1373 BOOL ret = CertAddStoreToCollection(store, memStore, 0, 0);
1374 ok(ret, "CertAddStoreToCollection failed: %08lx\n", GetLastError());
1375 CertCloseStore(memStore, 0);
1376 }
1377 CertCloseStore(store, 0);
1378 }
1379
1380 /* Check opening a bogus store */
1383 ok(!store, "Expected ERROR_FILE_NOT_FOUND, got %08lx\n", GetLastError());
1386 ok(store != 0, "CertOpenStore failed: %08lx\n", GetLastError());
1387 if (store)
1388 CertCloseStore(store, 0);
1389 /* Now check whether deleting is allowed */
1392 ok(!store, "Didn't expect a store to be returned when deleting\n");
1393 RegDeleteKeyW(HKEY_CURRENT_USER, L"Software\\Microsoft\\SystemCertificates\\Bogus");
1394}
LONG WINAPI RegCreateKeyExW(_In_ HKEY hKey, _In_ LPCWSTR lpSubKey, _In_ DWORD Reserved, _In_opt_ LPWSTR lpClass, _In_ DWORD dwOptions, _In_ REGSAM samDesired, _In_opt_ LPSECURITY_ATTRIBUTES lpSecurityAttributes, _Out_ PHKEY phkResult, _Out_opt_ LPDWORD lpdwDisposition)
Definition: reg.c:1096
#define lstrcpyW
Definition: compat.h:749
LPWSTR WINAPI lstrcatW(LPWSTR lpString1, LPCWSTR lpString2)
Definition: lstring.c:274
static const WCHAR CERT_LOCAL_MACHINE_SYSTEM_STORE_REGPATH[]
Definition: wincrypt.h:2551
#define ERROR_FILE_EXISTS
Definition: winerror.h:287

Referenced by START_TEST().

Variable Documentation

◆ appdata_file

BOOL appdata_file

Definition at line 343 of file store.c.

Referenced by testRegStoreSavedCerts().

◆ base64SPC

const BYTE base64SPC[]
static
Initial value:
=
"MIICJQYJKoZIhvcNAQcCoIICFjCCAhICAQExADALBgkqhkiG9w0BBwGgggH6MIIB"
"9jCCAV+gAwIBAgIQnP8+EF4opr9OxH7h4uBPWTANBgkqhkiG9w0BAQQFADAUMRIw"
"EAYDVQQDEwlKdWFuIExhbmcwHhcNMDgxMjEyMTcxMDE0WhcNMzkxMjMxMjM1OTU5"
"WjAUMRIwEAYDVQQDEwlKdWFuIExhbmcwgZ8wDQYJKoZIhvcNAQEBBQADgY0AMIGJ"
"AoGBALCgNjyNvOic0FOfjxvi43HbM+D5joDkhiGSXe+gbZlf8f16k07kkObFEunz"
"mdB5coscmA7gyqiWNN4ZUyr2cA3lCbnpGPA/0IblyyOcuGIFmmCzeZaVa5ZG6xZP"
"K7L7o+73Qo6jXVbGhBGnMZ7Q9sAn6s2933olnStnejnqwV0NAgMBAAGjSTBHMEUG"
"A1UdAQQ+MDyAEFKbKEdXYyx+CWKcV6vxM6ShFjAUMRIwEAYDVQQDEwlKdWFuIExh"
"bmeCEJz/PhBeKKa/TsR+4eLgT1kwDQYJKoZIhvcNAQEEBQADgYEALpkgLgW3mEaK"
"idPQ3iPJYLG0Ub1wraqEl9bd42hrhzIdcDzlQgxnm8/5cHYVxIF/C20x/HJplb1R"
"G6U1ipFe/q8byWD/9JpiBKMGPi9YlUTgXHfS9d4S/QWO1h9Z7KeipBYhoslQpHXu"
"y9bUr8Adqi6SzgHpCnMu53dxgxUD1r4xAA=="

Definition at line 1558 of file store.c.

Referenced by testFileNameStore().

◆ base_reg_path

const WCHAR* base_reg_path

Definition at line 345 of file store.c.

Referenced by testRegStoreSavedCerts().

◆ bigCert

const BYTE bigCert[]
static
Initial value:
= { 0x30, 0x7a, 0x02, 0x01, 0x01, 0x30, 0x02, 0x06,
0x00, 0x30, 0x15, 0x31, 0x13, 0x30, 0x11, 0x06, 0x03, 0x55, 0x04, 0x03, 0x13,
0x0a, 0x4a, 0x75, 0x61, 0x6e, 0x20, 0x4c, 0x61, 0x6e, 0x67, 0x00, 0x30, 0x22,
0x18, 0x0f, 0x31, 0x36, 0x30, 0x31, 0x30, 0x31, 0x30, 0x31, 0x30, 0x30, 0x30,
0x30, 0x30, 0x30, 0x5a, 0x18, 0x0f, 0x31, 0x36, 0x30, 0x31, 0x30, 0x31, 0x30,
0x31, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x5a, 0x30, 0x15, 0x31, 0x13, 0x30,
0x11, 0x06, 0x03, 0x55, 0x04, 0x03, 0x13, 0x0a, 0x4a, 0x75, 0x61, 0x6e, 0x20,
0x4c, 0x61, 0x6e, 0x67, 0x00, 0x30, 0x07, 0x30, 0x02, 0x06, 0x00, 0x03, 0x01,
0x00, 0xa3, 0x16, 0x30, 0x14, 0x30, 0x12, 0x06, 0x03, 0x55, 0x1d, 0x13, 0x01,
0x01, 0xff, 0x04, 0x08, 0x30, 0x06, 0x01, 0x01, 0xff, 0x02, 0x01, 0x01 }

Definition at line 48 of file store.c.

Referenced by test_I_UpdateStore(), testAddCertificateLink(), testAddSerialized(), testCertRegisterSystemStore(), testCloseStore(), testCollectionStore(), testEmptyStore(), testFileNameStore(), testFileStore(), testMemStore(), testMessageStore(), testRegStore(), testRegStoreSavedCerts(), and testStoresInCollection().

◆ bigCert2

const BYTE bigCert2[]
static
Initial value:
= { 0x30, 0x7a, 0x02, 0x01, 0x01, 0x30, 0x02, 0x06,
0x00, 0x30, 0x15, 0x31, 0x13, 0x30, 0x11, 0x06, 0x03, 0x55, 0x04, 0x03, 0x13,
0x0a, 0x41, 0x6c, 0x65, 0x78, 0x20, 0x4c, 0x61, 0x6e, 0x67, 0x00, 0x30, 0x22,
0x18, 0x0f, 0x31, 0x36, 0x30, 0x31, 0x30, 0x31, 0x30, 0x31, 0x30, 0x30, 0x30,
0x30, 0x30, 0x30, 0x5a, 0x18, 0x0f, 0x31, 0x36, 0x30, 0x31, 0x30, 0x31, 0x30,
0x31, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x5a, 0x30, 0x15, 0x31, 0x13, 0x30,
0x11, 0x06, 0x03, 0x55, 0x04, 0x03, 0x13, 0x0a, 0x41, 0x6c, 0x65, 0x78, 0x20,
0x4c, 0x61, 0x6e, 0x67, 0x00, 0x30, 0x07, 0x30, 0x02, 0x06, 0x00, 0x03, 0x01,
0x00, 0xa3, 0x16, 0x30, 0x14, 0x30, 0x12, 0x06, 0x03, 0x55, 0x1d, 0x13, 0x01,
0x01, 0xff, 0x04, 0x08, 0x30, 0x06, 0x01, 0x01, 0xff, 0x02, 0x01, 0x01 }

Definition at line 89 of file store.c.

Referenced by testCollectionStore(), testEmptyStore(), and testRegStore().

◆ cert_store

◆ emptyCert

const BYTE emptyCert[] = { 0x30, 0x00 }
static

Definition at line 47 of file store.c.

Referenced by testMemStore().

◆ expected

BOOL expected

Definition at line 2000 of file store.c.

Referenced by _clipboard_range_contains(), _test_attr_expando(), _test_attr_specified(), _test_IObjectSafety_set(), check_address(), check_BitBlt_pixel(), check_colorvalue_(), check_dirid(), check_emfplus(), check_error(), check_file_size(), check_generated_adjacency_(), check_generated_effects_(), check_halftone_palette(), check_ImageList_DrawIndirect(), check_ImageList_DrawIndirect_broken(), check_ImageList_DrawIndirect_fState(), check_ImageList_DrawIndirect_fStyle(), check_ImageList_DrawIndirect_ILD_ROP(), check_ini_file_attr(), check_materials_(), check_metafile(), check_orderarray(), check_output(), check_output_raw(), check_param(), check_record(), check_reg_dword(), check_reg_str(), check_StretchBlt_pixel(), check_StretchBlt_stretch(), check_StretchDIBits_pixel(), check_StretchDIBits_stretch(), check_style_wnd_proc(), check_updates(), checkElementStatus(), color_match(), ColorTest(), compare_and_check(), compare_attributes(), compare_bitmap_bits_(), compare_cms_signer_info(), compare_export_(), compare_icons_imp(), compare_imp(), compare_mesh(), compare_query_(), compare_signer_info(), compare_text_outline_mesh(), compareAltNameEntry(), compareAltNameInfo(), compareAuthorityInfoAccess(), compareCRLIssuingDistPoints(), compareCTLInfo(), compareDistPointName(), compareNames(), compareNameValues(), comparePublicKeyInfo(), compareRDNAttrs(), compareRDNs(), compareSMimeCapabilities(), compareTime(), compareUrlArray(), D3DXColorTest(), D3DXMatrixTest(), D3DXPlaneTest(), decodeAndCompareBase64_A(), decodeBase64WithFmt(), decodeBase64WithLen(), decodeBase64WithLenBroken(), decodeBase64WithLenFmt(), DoEntry(), drop_window_proc(), dump_sequence(), encode_compare_base64_W(), encodeAndCompareBase64_A(), enum_type_callback(), ExceptionFilter(), expect_bool_imp(), expect_color_(), expect_guid(), expect_HWND_(), expect_indexA_imp(), expect_matrix_(), expect_plane_(), expect_quaternion_(), expect_rawformat(), expect_vec2_(), expect_vec3_(), expect_vec4_(), expect_vec4_array_(), fdi_mem_notify(), fdi_mem_open(), fdi_mem_write(), HeaderTestWndProc(), init_decoder(), is_expected_variant(), ok_iids_(), ok_path(), ok_sequence(), ok_sequence_(), ok_trace_(), okChildInt_(), okChildIntBroken_(), okChildPath_(), okChildString_(), play_metafile(), receive_data(), registerset_compare(), registerset_compare_all(), relative_error(), set_expected_seq(), start_pass(), start_pass_huff_decoder(), START_TEST(), test__atodbl(), test__mbbtype(), test__mbbtype_l(), Test_acos_approx(), Test_acosf_approx(), test_appsearch_complocator(), test_appsearch_drlocator(), test_appsearch_inilocator(), test_appsearch_reglocator(), Test_asin_approx(), Test_asinf_approx(), Test_atan_approx(), Test_atanf_approx(), test_authentication(), test_BasicCases(), test_BCryptGetFipsAlgorithmMode(), test_BcryptHash(), test_bufferrawformat(), test_CertGetNameString_value_(), test_CharToOem_OemToChar(), test_child_heap(), test_CoInternetCombineIUri(), test_CoInternetCombineUrlEx(), test_complocator(), test_constant_table(), test_ConvertLengthToIpv4Mask(), Test_cos_approx(), Test_cosf_approx(), test_CPoint(), test_crc2_imp(), test_crc_imp(), test_CreateUri_InvalidFlags(), test_CreateUriWithFragment_InvalidFlags(), test_CredIsMarshaledCredentialA(), test_CryptStringToBinary(), test_D3DKMTCreateDCFromMemory(), test_D3DXCheckCubeTextureRequirements(), test_D3DXCheckTextureRequirements(), test_D3DXCheckVolumeTextureRequirements(), test_D3DXCreateRenderToEnvMap(), test_D3DXFillCubeTexture(), test_D3DXFillTexture(), test_D3DXFillVolumeTexture(), test_D3DXSHDot(), test_D3DXSHEvalConeLight(), test_D3DXSHEvalDirection(), test_D3DXSHEvalDirectionalLight(), test_D3DXSHEvalHemisphereLight(), test_D3DXSHEvalSphericalLight(), test_D3DXSHMultiply2(), test_D3DXSHMultiply3(), test_D3DXSHMultiply4(), test_D3DXSHRotate(), test_D3DXSHRotateZ(), test_D3DXSHScale(), test_dds_header_handling(), test_decodeNameValue(), test_def_itoa(), test_device_input(), test_dik_codes(), test_dirid(), test_effect_preshader_relative_addressing(), test_EM_POSFROMCHAR(), test_encodeOCSPRequestInfo(), test_enter(), Test_exp_approx(), Test_expf_approx(), test_format_rect(), test_formatrecord_tables(), test_get_shader_size(), test_GetFullPathNameA(), test_GetLocaleInfoA(), test_GetRfc1766FromLcid(), test_group_equal(), test_hash_value(), test_HashData(), test_inffilelist(), test_inffilelistA(), test_InternetErrorDlg(), test_IUriBuilder_GetFragment(), test_IUriBuilder_GetHost(), test_IUriBuilder_GetPassword(), test_IUriBuilder_GetPath(), test_IUriBuilder_GetPort(), test_IUriBuilder_GetQuery(), test_IUriBuilder_GetSchemeName(), test_IUriBuilder_GetUserName(), test_j0(), test_j1(), test_LcidToRfc1766(), test_LoadStringA(), Test_log10_approx(), Test_log10f_approx(), Test_log_approx(), Test_logf_approx(), test_long_value_name(), test_LZOpenFileA(), test_LZOpenFileA_existing_compressed(), test_LZOpenFileA_nonexisting_compressed(), test_LZOpenFileW(), test_LZOpenFileW_existing_compressed(), test_LZOpenFileW_nonexisting_compressed(), test_marshal_LPSAFEARRAY(), test_marshal_VARIANT(), test_md4hashfunc(), test_md5(), test_message_from_64bit_number(), test_midiStream(), test_Mod(), test_module(), test_msiexport(), test_MsiGetFileVersion(), test_NameToStrConversionA_(), test_NameToStrConversionW_(), test_nodeTypedValue(), test_notify(), test_NtQueryValueKey(), test_owner_equal(), test_PathRemoveBlanks(), test_printf_format(), test_query_cache(), test_queryconfig2(), test_read_state(), test_reg_query_value(), test_Render(), test_Round(), test_RtlIpv6StringToAddress(), test_RtlUnicodeToUTF8N(), test_RtlUniform(), test_RtlUTF8ToUnicodeN(), RopeTest::test_saved_rope_iterators(), test_saxstr(), test_scalb(), test_SetSite(), test_sha1(), test_sha256(), test_sha384(), test_sha512(), test_SHGetObjectCompatFlags(), Test_sin_approx(), Test_sinf_approx(), test_snprintf(), Test_sqrt_approx(), Test_sqrtf_approx(), Test_SrcMono(), Test_SrcMono1(), test_StretchBlt(), test_StretchBlt_stretch(), test_StretchBlt_TopDownOptions(), test_StretchDIBits(), test_synthesized(), test_SystemFunction001(), test_SystemFunction002(), test_SystemFunction007(), test_SystemFunction008(), test_SystemFunction009(), test_SystemFunction032(), Test_tan_approx(), Test_tanf_approx(), test_tcp_tx_full_window_lost(), test_texture_shader(), test_UrlUnescape(), test_utf7_decoding(), test_utf7_encoding(), test_var_call1(), test_var_call2(), test_VarCat(), test_with_compat(), test_WM_GETDLGCODE(), test_y0(), test_y1(), testAuth(), testCertRegisterSystemStore(), TestInitDialogHandleProc(), TIFFReadCustomDirectory(), ulp_error_dbl(), ulp_error_flt(), ulp_error_precise(), unexpected_op(), validate_signature(), verify_str_imp(), verify_str_imp2(), WorkerThread(), and ZSTD_decompressContinue().

◆ hashBareContent

const BYTE hashBareContent[]
static
Initial value:
= {
0x30,0x38,0x02,0x01,0x00,0x30,0x0c,0x06,0x08,0x2a,0x86,0x48,0x86,0xf7,0x0d,
0x02,0x05,0x05,0x00,0x30,0x13,0x06,0x09,0x2a,0x86,0x48,0x86,0xf7,0x0d,0x01,
0x07,0x01,0xa0,0x06,0x04,0x04,0x01,0x02,0x03,0x04,0x04,0x10,0x08,0xd6,0xc0,
0x5a,0x21,0x51,0x2a,0x79,0xa1,0xdf,0xeb,0x9d,0x2a,0x8f,0x26,0x2f }

Definition at line 1800 of file store.c.

Referenced by testMessageStore().

◆ hashContent

const BYTE hashContent[]
static
Initial value:
= {
0x30,0x47,0x06,0x09,0x2a,0x86,0x48,0x86,0xf7,0x0d,0x01,0x07,0x05,0xa0,0x3a,
0x30,0x38,0x02,0x01,0x00,0x30,0x0c,0x06,0x08,0x2a,0x86,0x48,0x86,0xf7,0x0d,
0x02,0x05,0x05,0x00,0x30,0x13,0x06,0x09,0x2a,0x86,0x48,0x86,0xf7,0x0d,0x01,
0x07,0x01,0xa0,0x06,0x04,0x04,0x01,0x02,0x03,0x04,0x04,0x10,0x08,0xd6,0xc0,
0x5a,0x21,0x51,0x2a,0x79,0xa1,0xdf,0xeb,0x9d,0x2a,0x8f,0x26,0x2f }

Definition at line 1794 of file store.c.

Referenced by testMessageStore().

◆ key

Definition at line 341 of file store.c.

Referenced by test_PFXImportCertStore(), and testSystemStore().

◆ pfxdata

const BYTE pfxdata[]
static

Definition at line 2971 of file store.c.

Referenced by test_CryptQueryObject(), and test_PFXImportCertStore().

◆ 

◆ 

const struct { ... } reg_system_store_test_data[]
Initial value:

Referenced by testCertRegisterSystemStore().

◆ serializedCert

const BYTE serializedCert[]
static
Initial value:
= { 0x20, 0x00, 0x00, 0x00,
0x01, 0x00, 0x00, 0x00, 0x7c, 0x00, 0x00, 0x00, 0x30, 0x7a, 0x02, 0x01, 0x01,
0x30, 0x02, 0x06, 0x00, 0x30, 0x15, 0x31, 0x13, 0x30, 0x11, 0x06, 0x03, 0x55,
0x04, 0x03, 0x13, 0x0a, 0x4a, 0x75, 0x61, 0x6e, 0x20, 0x4c, 0x61, 0x6e, 0x67,
0x00, 0x30, 0x22, 0x18, 0x0f, 0x31, 0x36, 0x30, 0x31, 0x30, 0x31, 0x30, 0x31,
0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x5a, 0x18, 0x0f, 0x31, 0x36, 0x30, 0x31,
0x30, 0x31, 0x30, 0x31, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x5a, 0x30, 0x15,
0x31, 0x13, 0x30, 0x11, 0x06, 0x03, 0x55, 0x04, 0x03, 0x13, 0x0a, 0x4a, 0x75,
0x61, 0x6e, 0x20, 0x4c, 0x61, 0x6e, 0x67, 0x00, 0x30, 0x07, 0x30, 0x02, 0x06,
0x00, 0x03, 0x01, 0x00, 0xa3, 0x16, 0x30, 0x14, 0x30, 0x12, 0x06, 0x03, 0x55,
0x1d, 0x13, 0x01, 0x01, 0xff, 0x04, 0x08, 0x30, 0x06, 0x01, 0x01, 0xff, 0x02,
0x01, 0x01 }

Definition at line 71 of file store.c.

Referenced by testAddCertificateLink(), and testMemStore().

◆ serializedCertWithFriendlyName

const BYTE serializedCertWithFriendlyName[]
static
Initial value:
= {
0x0b,0x00,0x00,0x00,0x01,0x00,0x00,0x00,0x12,0x00,0x00,0x00,0x57,0x00,0x69,
0x00,0x6e,0x00,0x65,0x00,0x54,0x00,0x65,0x00,0x73,0x00,0x74,0x00,0x00,0x00,
0x20,0x00,0x00,0x00,0x01,0x00,0x00,0x00,0x7c,0x00,0x00,0x00,0x30,0x7a,0x02,
0x01,0x01,0x30,0x02,0x06,0x00,0x30,0x15,0x31,0x13,0x30,0x11,0x06,0x03,0x55,
0x04,0x03,0x13,0x0a,0x4a,0x75,0x61,0x6e,0x20,0x4c,0x61,0x6e,0x67,0x00,0x30,
0x22,0x18,0x0f,0x31,0x36,0x30,0x31,0x30,0x31,0x30,0x31,0x30,0x30,0x30,0x30,
0x30,0x30,0x5a,0x18,0x0f,0x31,0x36,0x30,0x31,0x30,0x31,0x30,0x31,0x30,0x30,
0x30,0x30,0x30,0x30,0x5a,0x30,0x15,0x31,0x13,0x30,0x11,0x06,0x03,0x55,0x04,
0x03,0x13,0x0a,0x4a,0x75,0x61,0x6e,0x20,0x4c,0x61,0x6e,0x67,0x00,0x30,0x07,
0x30,0x02,0x06,0x00,0x03,0x01,0x00,0xa3,0x16,0x30,0x14,0x30,0x12,0x06,0x03,
0x55,0x1d,0x13,0x01,0x01,0xff,0x04,0x08,0x30,0x06,0x01,0x01,0xff,0x02,0x01,
0x01 }

Definition at line 2346 of file store.c.

Referenced by testAddCertificateLink().

◆ serializedStoreWithCert

const BYTE serializedStoreWithCert[]
static
Initial value:
= {
0x00,0x00,0x00,0x00,0x43,0x45,0x52,0x54,0x20,0x00,0x00,0x00,0x01,0x00,0x00,
0x00,0x7c,0x00,0x00,0x00,0x30,0x7a,0x02,0x01,0x01,0x30,0x02,0x06,0x00,0x30,
0x15,0x31,0x13,0x30,0x11,0x06,0x03,0x55,0x04,0x03,0x13,0x0a,0x4a,0x75,0x61,
0x6e,0x20,0x4c,0x61,0x6e,0x67,0x00,0x30,0x22,0x18,0x0f,0x31,0x36,0x30,0x31,
0x30,0x31,0x30,0x31,0x30,0x30,0x30,0x30,0x30,0x30,0x5a,0x18,0x0f,0x31,0x36,
0x30,0x31,0x30,0x31,0x30,0x31,0x30,0x30,0x30,0x30,0x30,0x30,0x5a,0x30,0x15,
0x31,0x13,0x30,0x11,0x06,0x03,0x55,0x04,0x03,0x13,0x0a,0x4a,0x75,0x61,0x6e,
0x20,0x4c,0x61,0x6e,0x67,0x00,0x30,0x07,0x30,0x02,0x06,0x00,0x03,0x01,0x00,
0xa3,0x16,0x30,0x14,0x30,0x12,0x06,0x03,0x55,0x1d,0x13,0x01,0x01,0xff,0x04,
0x08,0x30,0x06,0x01,0x01,0xff,0x02,0x01,0x01,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00 }

Definition at line 326 of file store.c.

Referenced by testCollectionStore(), testFileNameStore(), testFileStore(), and testSerializedStore().

◆ serializedStoreWithCertAndCRL

const BYTE serializedStoreWithCertAndCRL[]
static
Initial value:
= {
0x00,0x00,0x00,0x00,0x43,0x45,0x52,0x54,0x20,0x00,0x00,0x00,0x01,0x00,0x00,
0x00,0x7c,0x00,0x00,0x00,0x30,0x7a,0x02,0x01,0x01,0x30,0x02,0x06,0x00,0x30,
0x15,0x31,0x13,0x30,0x11,0x06,0x03,0x55,0x04,0x03,0x13,0x0a,0x4a,0x75,0x61,
0x6e,0x20,0x4c,0x61,0x6e,0x67,0x00,0x30,0x22,0x18,0x0f,0x31,0x36,0x30,0x31,
0x30,0x31,0x30,0x31,0x30,0x30,0x30,0x30,0x30,0x30,0x5a,0x18,0x0f,0x31,0x36,
0x30,0x31,0x30,0x31,0x30,0x31,0x30,0x30,0x30,0x30,0x30,0x30,0x5a,0x30,0x15,
0x31,0x13,0x30,0x11,0x06,0x03,0x55,0x04,0x03,0x13,0x0a,0x4a,0x75,0x61,0x6e,
0x20,0x4c,0x61,0x6e,0x67,0x00,0x30,0x07,0x30,0x02,0x06,0x00,0x03,0x01,0x00,
0xa3,0x16,0x30,0x14,0x30,0x12,0x06,0x03,0x55,0x1d,0x13,0x01,0x01,0xff,0x04,
0x08,0x30,0x06,0x01,0x01,0xff,0x02,0x01,0x01,0x21,0x00,0x00,0x00,0x01,0x00,
0x00,0x00,0x47,0x00,0x00,0x00,0x30,0x45,0x30,0x2c,0x30,0x02,0x06,0x00,0x30,
0x15,0x31,0x13,0x30,0x11,0x06,0x03,0x55,0x04,0x03,0x13,0x0a,0x4a,0x75,0x61,
0x6e,0x20,0x4c,0x61,0x6e,0x67,0x00,0x18,0x0f,0x31,0x36,0x30,0x31,0x30,0x31,
0x30,0x31,0x30,0x30,0x30,0x30,0x30,0x30,0x5a,0x30,0x02,0x06,0x00,0x03,0x11,
0x00,0x0f,0x0e,0x0d,0x0c,0x0b,0x0a,0x09,0x08,0x07,0x06,0x05,0x04,0x03,0x02,
0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00 }

Definition at line 1396 of file store.c.

Referenced by testFileNameStore(), testFileStore(), and testSerializedStore().

◆ serializedStoreWithCertAndHash

const BYTE serializedStoreWithCertAndHash[]
static
Initial value:
= {
0x00,0x00,0x00,0x00,0x43,0x45,0x52,0x54,0x03,0x00,0x00,0x00,0x01,0x00,0x00,
0x00,0x14,0x00,0x00,0x00,0x6e,0x30,0x90,0x71,0x5f,0xd9,0x23,0x56,0xeb,0xae,
0x25,0x40,0xe6,0x22,0xda,0x19,0x26,0x02,0xa6,0x08,0x20,0x00,0x00,0x00,0x01,
0x00,0x00,0x00,0x7c,0x00,0x00,0x00,0x30,0x7a,0x02,0x01,0x01,0x30,0x02,0x06,
0x00,0x30,0x15,0x31,0x13,0x30,0x11,0x06,0x03,0x55,0x04,0x03,0x13,0x0a,0x4a,
0x75,0x61,0x6e,0x20,0x4c,0x61,0x6e,0x67,0x00,0x30,0x22,0x18,0x0f,0x31,0x36,
0x30,0x31,0x30,0x31,0x30,0x31,0x30,0x30,0x30,0x30,0x30,0x30,0x5a,0x18,0x0f,
0x31,0x36,0x30,0x31,0x30,0x31,0x30,0x31,0x30,0x30,0x30,0x30,0x30,0x30,0x5a,
0x30,0x15,0x31,0x13,0x30,0x11,0x06,0x03,0x55,0x04,0x03,0x13,0x0a,0x4a,0x75,
0x61,0x6e,0x20,0x4c,0x61,0x6e,0x67,0x00,0x30,0x07,0x30,0x02,0x06,0x00,0x03,
0x01,0x00,0xa3,0x16,0x30,0x14,0x30,0x12,0x06,0x03,0x55,0x1d,0x13,0x01,0x01,
0xff,0x04,0x08,0x30,0x06,0x01,0x01,0xff,0x02,0x01,0x01,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00 }

Definition at line 2373 of file store.c.

Referenced by testAddCertificateLink().

◆ serializedStoreWithCertWithFriendlyName

const BYTE serializedStoreWithCertWithFriendlyName[]
static
Initial value:
= {
0x00,0x00,0x00,0x00,0x43,0x45,0x52,0x54,0x0b,0x00,0x00,0x00,0x01,0x00,0x00,
0x00,0x12,0x00,0x00,0x00,0x57,0x00,0x69,0x00,0x6e,0x00,0x65,0x00,0x54,0x00,
0x65,0x00,0x73,0x00,0x74,0x00,0x00,0x00,0x20,0x00,0x00,0x00,0x01,0x00,0x00,
0x00,0x7c,0x00,0x00,0x00,0x30,0x7a,0x02,0x01,0x01,0x30,0x02,0x06,0x00,0x30,
0x15,0x31,0x13,0x30,0x11,0x06,0x03,0x55,0x04,0x03,0x13,0x0a,0x4a,0x75,0x61,
0x6e,0x20,0x4c,0x61,0x6e,0x67,0x00,0x30,0x22,0x18,0x0f,0x31,0x36,0x30,0x31,
0x30,0x31,0x30,0x31,0x30,0x30,0x30,0x30,0x30,0x30,0x5a,0x18,0x0f,0x31,0x36,
0x30,0x31,0x30,0x31,0x30,0x31,0x30,0x30,0x30,0x30,0x30,0x30,0x5a,0x30,0x15,
0x31,0x13,0x30,0x11,0x06,0x03,0x55,0x04,0x03,0x13,0x0a,0x4a,0x75,0x61,0x6e,
0x20,0x4c,0x61,0x6e,0x67,0x00,0x30,0x07,0x30,0x02,0x06,0x00,0x03,0x01,0x00,
0xa3,0x16,0x30,0x14,0x30,0x12,0x06,0x03,0x55,0x1d,0x13,0x01,0x01,0xff,0x04,
0x08,0x30,0x06,0x01,0x01,0xff,0x02,0x01,0x01,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00 }

Definition at line 2359 of file store.c.

Referenced by testAddCertificateLink().

◆ signedBigCert

const BYTE signedBigCert[]
static
Initial value:
= {
0x30, 0x81, 0x93, 0x30, 0x7a, 0x02, 0x01, 0x01, 0x30, 0x02, 0x06, 0x00, 0x30,
0x15, 0x31, 0x13, 0x30, 0x11, 0x06, 0x03, 0x55, 0x04, 0x03, 0x13, 0x0a, 0x4a,
0x75, 0x61, 0x6e, 0x20, 0x4c, 0x61, 0x6e, 0x67, 0x00, 0x30, 0x22, 0x18, 0x0f,
0x31, 0x36, 0x30, 0x31, 0x30, 0x31, 0x30, 0x31, 0x30, 0x30, 0x30, 0x30, 0x30,
0x30, 0x5a, 0x18, 0x0f, 0x31, 0x36, 0x30, 0x31, 0x30, 0x31, 0x30, 0x31, 0x30,
0x30, 0x30, 0x30, 0x30, 0x30, 0x5a, 0x30, 0x15, 0x31, 0x13, 0x30, 0x11, 0x06,
0x03, 0x55, 0x04, 0x03, 0x13, 0x0a, 0x4a, 0x75, 0x61, 0x6e, 0x20, 0x4c, 0x61,
0x6e, 0x67, 0x00, 0x30, 0x07, 0x30, 0x02, 0x06, 0x00, 0x03, 0x01, 0x00, 0xa3,
0x16, 0x30, 0x14, 0x30, 0x12, 0x06, 0x03, 0x55, 0x1d, 0x13, 0x01, 0x01, 0xff,
0x04, 0x08, 0x30, 0x06, 0x01, 0x01, 0xff, 0x02, 0x01, 0x01, 0x30, 0x02, 0x06,
0x00, 0x03, 0x11, 0x00, 0x0f, 0x0e, 0x0d, 0x0c, 0x0b, 0x0a, 0x09, 0x08, 0x07,
0x06, 0x05, 0x04, 0x03, 0x02, 0x01, 0x00 }

Definition at line 58 of file store.c.

Referenced by testMemStore(), and testStoresInCollection().

◆ signedContent

const BYTE signedContent[]
static
Initial value:
= {
0x30,0x81,0xb2,0x06,0x09,0x2a,0x86,0x48,0x86,0xf7,0x0d,0x01,0x07,0x02,0xa0,
0x81,0xa4,0x30,0x81,0xa1,0x02,0x01,0x01,0x31,0x0e,0x30,0x0c,0x06,0x08,0x2a,
0x86,0x48,0x86,0xf7,0x0d,0x02,0x05,0x05,0x00,0x30,0x13,0x06,0x09,0x2a,0x86,
0x48,0x86,0xf7,0x0d,0x01,0x07,0x01,0xa0,0x06,0x04,0x04,0x01,0x02,0x03,0x04,
0x31,0x77,0x30,0x75,0x02,0x01,0x01,0x30,0x1a,0x30,0x15,0x31,0x13,0x30,0x11,
0x06,0x03,0x55,0x04,0x03,0x13,0x0a,0x4a,0x75,0x61,0x6e,0x20,0x4c,0x61,0x6e,
0x67,0x00,0x02,0x01,0x01,0x30,0x0c,0x06,0x08,0x2a,0x86,0x48,0x86,0xf7,0x0d,
0x02,0x05,0x05,0x00,0x30,0x04,0x06,0x00,0x05,0x00,0x04,0x40,0x81,0xa6,0x70,
0xb3,0xef,0x59,0xd1,0x66,0xd1,0x9b,0xc0,0x9a,0xb6,0x9a,0x5e,0x6d,0x6f,0x6d,
0x0d,0x59,0xa9,0xaa,0x6e,0xe9,0x2c,0xa0,0x1e,0xee,0xc2,0x60,0xbc,0x59,0xbe,
0x3f,0x63,0x06,0x8d,0xc9,0x11,0x1d,0x23,0x64,0x92,0xef,0x2e,0xfc,0x57,0x29,
0xa4,0xaf,0xe0,0xee,0x93,0x19,0x39,0x51,0xe4,0x44,0xb8,0x0b,0x28,0xf4,0xa8,
0x0d }

Definition at line 1756 of file store.c.

Referenced by testMessageStore().

◆ signedCRL

const BYTE signedCRL[]
static
Initial value:
= { 0x30, 0x45, 0x30, 0x2c, 0x30, 0x02, 0x06,
0x00, 0x30, 0x15, 0x31, 0x13, 0x30, 0x11, 0x06, 0x03, 0x55, 0x04, 0x03, 0x13,
0x0a, 0x4a, 0x75, 0x61, 0x6e, 0x20, 0x4c, 0x61, 0x6e, 0x67, 0x00, 0x18, 0x0f,
0x31, 0x36, 0x30, 0x31, 0x30, 0x31, 0x30, 0x31, 0x30, 0x30, 0x30, 0x30, 0x30,
0x30, 0x5a, 0x30, 0x02, 0x06, 0x00, 0x03, 0x11, 0x00, 0x0f, 0x0e, 0x0d, 0x0c,
0x0b, 0x0a, 0x09, 0x08, 0x07, 0x06, 0x05, 0x04, 0x03, 0x02, 0x01, 0x00 }

Definition at line 83 of file store.c.

Referenced by test_I_UpdateStore(), testCloseStore(), testEmptyStore(), testFileNameStore(), testFileStore(), and testMemStore().

◆ signedCTLWithCTLInnerContent

const BYTE signedCTLWithCTLInnerContent[]
static
Initial value:
= {
0x30,0x82,0x01,0x0f,0x06,0x09,0x2a,0x86,0x48,0x86,0xf7,0x0d,0x01,0x07,0x02,
0xa0,0x82,0x01,0x00,0x30,0x81,0xfd,0x02,0x01,0x01,0x31,0x0e,0x30,0x0c,0x06,
0x08,0x2a,0x86,0x48,0x86,0xf7,0x0d,0x02,0x05,0x05,0x00,0x30,0x30,0x06,0x09,
0x2b,0x06,0x01,0x04,0x01,0x82,0x37,0x0a,0x01,0xa0,0x23,0x30,0x21,0x30,0x00,
0x18,0x0f,0x31,0x36,0x30,0x31,0x30,0x31,0x30,0x31,0x30,0x30,0x30,0x30,0x30,
0x30,0x5a,0x30,0x0c,0x06,0x08,0x2a,0x86,0x48,0x86,0xf7,0x0d,0x02,0x05,0x05,
0x00,0x31,0x81,0xb5,0x30,0x81,0xb2,0x02,0x01,0x01,0x30,0x1a,0x30,0x15,0x31,
0x13,0x30,0x11,0x06,0x03,0x55,0x04,0x03,0x13,0x0a,0x4a,0x75,0x61,0x6e,0x20,
0x4c,0x61,0x6e,0x67,0x00,0x02,0x01,0x01,0x30,0x0c,0x06,0x08,0x2a,0x86,0x48,
0x86,0xf7,0x0d,0x02,0x05,0x05,0x00,0xa0,0x3b,0x30,0x18,0x06,0x09,0x2a,0x86,
0x48,0x86,0xf7,0x0d,0x01,0x09,0x03,0x31,0x0b,0x06,0x09,0x2b,0x06,0x01,0x04,
0x01,0x82,0x37,0x0a,0x01,0x30,0x1f,0x06,0x09,0x2a,0x86,0x48,0x86,0xf7,0x0d,
0x01,0x09,0x04,0x31,0x12,0x04,0x10,0x54,0x71,0xbc,0xe1,0x56,0x31,0xa2,0xf9,
0x65,0x70,0x34,0xf8,0xe2,0xe9,0xb4,0xf4,0x30,0x04,0x06,0x00,0x05,0x00,0x04,
0x40,0x2f,0x1b,0x9f,0x5a,0x4a,0x15,0x73,0xfa,0xb1,0x93,0x3d,0x09,0x52,0xdf,
0x6b,0x98,0x4b,0x13,0x5e,0xe7,0xbf,0x65,0xf4,0x9c,0xc2,0xb1,0x77,0x09,0xb1,
0x66,0x4d,0x72,0x0d,0xb1,0x1a,0x50,0x20,0xe0,0x57,0xa2,0x39,0xc7,0xcd,0x7f,
0x8e,0xe7,0x5f,0x76,0x2b,0xd1,0x6a,0x82,0xb3,0x30,0x25,0x61,0xf6,0x25,0x23,
0x57,0x6c,0x0b,0x47,0xb8 }

Definition at line 99 of file store.c.

Referenced by testCloseStore(), and testEmptyStore().

◆ signedWithCertAndCrlBareContent

const BYTE signedWithCertAndCrlBareContent[]
static
Initial value:
= {
0x30,0x82,0x01,0x4f,0x02,0x01,0x01,0x31,0x0e,0x30,0x0c,0x06,0x08,0x2a,0x86,
0x48,0x86,0xf7,0x0d,0x02,0x05,0x05,0x00,0x30,0x13,0x06,0x09,0x2a,0x86,0x48,
0x86,0xf7,0x0d,0x01,0x07,0x01,0xa0,0x06,0x04,0x04,0x01,0x02,0x03,0x04,0xa0,
0x7c,0x30,0x7a,0x02,0x01,0x01,0x30,0x02,0x06,0x00,0x30,0x15,0x31,0x13,0x30,
0x11,0x06,0x03,0x55,0x04,0x03,0x13,0x0a,0x4a,0x75,0x61,0x6e,0x20,0x4c,0x61,
0x6e,0x67,0x00,0x30,0x22,0x18,0x0f,0x31,0x36,0x30,0x31,0x30,0x31,0x30,0x31,
0x30,0x30,0x30,0x30,0x30,0x30,0x5a,0x18,0x0f,0x31,0x36,0x30,0x31,0x30,0x31,
0x30,0x31,0x30,0x30,0x30,0x30,0x30,0x30,0x5a,0x30,0x15,0x31,0x13,0x30,0x11,
0x06,0x03,0x55,0x04,0x03,0x13,0x0a,0x4a,0x75,0x61,0x6e,0x20,0x4c,0x61,0x6e,
0x67,0x00,0x30,0x07,0x30,0x02,0x06,0x00,0x03,0x01,0x00,0xa3,0x16,0x30,0x14,
0x30,0x12,0x06,0x03,0x55,0x1d,0x13,0x01,0x01,0xff,0x04,0x08,0x30,0x06,0x01,
0x01,0xff,0x02,0x01,0x01,0xa1,0x2e,0x30,0x2c,0x30,0x02,0x06,0x00,0x30,0x15,
0x31,0x13,0x30,0x11,0x06,0x03,0x55,0x04,0x03,0x13,0x0a,0x4a,0x75,0x61,0x6e,
0x20,0x4c,0x61,0x6e,0x67,0x00,0x18,0x0f,0x31,0x36,0x30,0x31,0x30,0x31,0x30,
0x31,0x30,0x30,0x30,0x30,0x30,0x30,0x5a,0x31,0x77,0x30,0x75,0x02,0x01,0x01,
0x30,0x1a,0x30,0x15,0x31,0x13,0x30,0x11,0x06,0x03,0x55,0x04,0x03,0x13,0x0a,
0x4a,0x75,0x61,0x6e,0x20,0x4c,0x61,0x6e,0x67,0x00,0x02,0x01,0x01,0x30,0x0c,
0x06,0x08,0x2a,0x86,0x48,0x86,0xf7,0x0d,0x02,0x05,0x05,0x00,0x30,0x04,0x06,
0x00,0x05,0x00,0x04,0x40,0x81,0xa6,0x70,0xb3,0xef,0x59,0xd1,0x66,0xd1,0x9b,
0xc0,0x9a,0xb6,0x9a,0x5e,0x6d,0x6f,0x6d,0x0d,0x59,0xa9,0xaa,0x6e,0xe9,0x2c,
0xa0,0x1e,0xee,0xc2,0x60,0xbc,0x59,0xbe,0x3f,0x63,0x06,0x8d,0xc9,0x11,0x1d,
0x23,0x64,0x92,0xef,0x2e,0xfc,0x57,0x29,0xa4,0xaf,0xe0,0xee,0x93,0x19,0x39,
0x51,0xe4,0x44,0xb8,0x0b,0x28,0xf4,0xa8,0x0d }

Definition at line 1770 of file store.c.

Referenced by testMessageStore().

◆ store_name

WCHAR store_name[16]

Definition at line 344 of file store.c.

Referenced by testRegStoreSavedCerts().

◆ todo

BOOL todo

Definition at line 2001 of file store.c.

Referenced by compareStore(), and testCertRegisterSystemStore().

◆ utf16Base64SPC

const WCHAR utf16Base64SPC[]
static
Initial value:
=
L"MIICJQYJKoZIhvcNAQcCoIICFjCCAhICAQExADALBgkqhkiG9w0BBwGgggH6MIIB"
"9jCCAV+gAwIBAgIQnP8+EF4opr9OxH7h4uBPWTANBgkqhkiG9w0BAQQFADAUMRIw"
"EAYDVQQDEwlKdWFuIExhbmcwHhcNMDgxMjEyMTcxMDE0WhcNMzkxMjMxMjM1OTU5"
"WjAUMRIwEAYDVQQDEwlKdWFuIExhbmcwgZ8wDQYJKoZIhvcNAQEBBQADgY0AMIGJ"
"AoGBALCgNjyNvOic0FOfjxvi43HbM+D5joDkhiGSXe+gbZlf8f16k07kkObFEunz"
"mdB5coscmA7gyqiWNN4ZUyr2cA3lCbnpGPA/0IblyyOcuGIFmmCzeZaVa5ZG6xZP"
"K7L7o+73Qo6jXVbGhBGnMZ7Q9sAn6s2933olnStnejnqwV0NAgMBAAGjSTBHMEUG"
"A1UdAQQ+MDyAEFKbKEdXYyx+CWKcV6vxM6ShFjAUMRIwEAYDVQQDEwlKdWFuIExh"
"bmeCEJz/PhBeKKa/TsR+4eLgT1kwDQYJKoZIhvcNAQEEBQADgYEALpkgLgW3mEaK"
"idPQ3iPJYLG0Ub1wraqEl9bd42hrhzIdcDzlQgxnm8/5cHYVxIF/C20x/HJplb1R"
"G6U1ipFe/q8byWD/9JpiBKMGPi9YlUTgXHfS9d4S/QWO1h9Z7KeipBYhoslQpHXu"
"y9bUr8Adqi6SzgHpCnMu53dxgxUD1r4xAA=="

Definition at line 1572 of file store.c.

Referenced by testFileNameStore().