crypt32(7/13): Move memory stores to a separate file
Juan Lang
juan.lang at gmail.com
Wed Aug 15 18:48:10 CDT 2007
--Juan
-------------- next part --------------
From 053365a6d99172772a7640bc4b4b7a929b6aa660 Mon Sep 17 00:00:00 2001
From: Juan Lang <juan.lang at gmail.com>
Date: Wed, 15 Aug 2007 16:34:44 -0700
Subject: [PATCH] Move memory stores to a separate file
---
dlls/crypt32/Makefile.in | 1
dlls/crypt32/crypt32_private.h | 6 ++
dlls/crypt32/store.c | 142 +---------------------------------------
3 files changed, 9 insertions(+), 140 deletions(-)
diff --git a/dlls/crypt32/Makefile.in b/dlls/crypt32/Makefile.in
index e065c40..2b400aa 100644
--- a/dlls/crypt32/Makefile.in
+++ b/dlls/crypt32/Makefile.in
@@ -15,6 +15,7 @@ C_SRCS = \
context.c \
decode.c \
encode.c \
+ memstore.c \
msg.c \
oid.c \
proplist.c \
diff --git a/dlls/crypt32/crypt32_private.h b/dlls/crypt32/crypt32_private.h
index c69cb13..1ef4dd7 100644
--- a/dlls/crypt32/crypt32_private.h
+++ b/dlls/crypt32/crypt32_private.h
@@ -231,6 +231,12 @@ typedef struct WINE_CRYPTCERTSTORE
PCONTEXT_PROPERTY_LIST properties;
} WINECRYPT_CERTSTORE, *PWINECRYPT_CERTSTORE;
+void CRYPT_InitStore(WINECRYPT_CERTSTORE *store, HCRYPTPROV hCryptProv,
+ DWORD dwFlags, CertStoreType type);
+void CRYPT_FreeStore(PWINECRYPT_CERTSTORE store);
+
+WINECRYPT_CERTSTORE *CRYPT_MemOpenStore(HCRYPTPROV hCryptProv, DWORD dwFlags,
+ const void *pvPara);
/* Helper function for store reading functions and
* CertAddSerializedElementToStore. Returns a context of the appropriate type
diff --git a/dlls/crypt32/store.c b/dlls/crypt32/store.c
index ed34c65..256e88e 100644
--- a/dlls/crypt32/store.c
+++ b/dlls/crypt32/store.c
@@ -86,13 +86,6 @@ static const WINE_CONTEXT_INTERFACE gCTL
};
PCWINE_CONTEXT_INTERFACE pCTLInterface = &gCTLInterface;
-typedef struct _WINE_MEMSTORE
-{
- WINECRYPT_CERTSTORE hdr;
- struct ContextList *certs;
- struct ContextList *crls;
-} WINE_MEMSTORE, *PWINE_MEMSTORE;
-
typedef struct _WINE_HASH_TO_DELETE
{
BYTE hash[20];
@@ -157,7 +150,7 @@ typedef struct _WINE_PROVIDERSTORE
PFN_CERT_STORE_PROV_CONTROL provControl;
} WINE_PROVIDERSTORE, *PWINE_PROVIDERSTORE;
-static void CRYPT_InitStore(WINECRYPT_CERTSTORE *store, HCRYPTPROV hCryptProv,
+void CRYPT_InitStore(WINECRYPT_CERTSTORE *store, HCRYPTPROV hCryptProv,
DWORD dwFlags, CertStoreType type)
{
store->ref = 1;
@@ -173,95 +166,13 @@ static void CRYPT_InitStore(WINECRYPT_CE
store->properties = NULL;
}
-static void CRYPT_FreeStore(PWINECRYPT_CERTSTORE store)
+void CRYPT_FreeStore(PWINECRYPT_CERTSTORE store)
{
if (store->properties)
ContextPropertyList_Free(store->properties);
CryptMemFree(store);
}
-static BOOL CRYPT_MemAddCert(PWINECRYPT_CERTSTORE store, void *cert,
- void *toReplace, const void **ppStoreContext)
-{
- WINE_MEMSTORE *ms = (WINE_MEMSTORE *)store;
- PCERT_CONTEXT context;
-
- TRACE("(%p, %p, %p, %p)\n", store, cert, toReplace, ppStoreContext);
-
- context = (PCERT_CONTEXT)ContextList_Add(ms->certs, cert, toReplace);
- if (context)
- {
- context->hCertStore = store;
- if (ppStoreContext)
- *ppStoreContext = CertDuplicateCertificateContext(context);
- }
- return context ? TRUE : FALSE;
-}
-
-static void *CRYPT_MemEnumCert(PWINECRYPT_CERTSTORE store, void *pPrev)
-{
- WINE_MEMSTORE *ms = (WINE_MEMSTORE *)store;
- void *ret;
-
- TRACE("(%p, %p)\n", store, pPrev);
-
- ret = ContextList_Enum(ms->certs, pPrev);
- if (!ret)
- SetLastError(CRYPT_E_NOT_FOUND);
-
- TRACE("returning %p\n", ret);
- return ret;
-}
-
-static BOOL CRYPT_MemDeleteCert(PWINECRYPT_CERTSTORE store, void *pCertContext)
-{
- WINE_MEMSTORE *ms = (WINE_MEMSTORE *)store;
-
- ContextList_Delete(ms->certs, pCertContext);
- return TRUE;
-}
-
-static BOOL CRYPT_MemAddCrl(PWINECRYPT_CERTSTORE store, void *crl,
- void *toReplace, const void **ppStoreContext)
-{
- WINE_MEMSTORE *ms = (WINE_MEMSTORE *)store;
- PCRL_CONTEXT context;
-
- TRACE("(%p, %p, %p, %p)\n", store, crl, toReplace, ppStoreContext);
-
- context = (PCRL_CONTEXT)ContextList_Add(ms->crls, crl, toReplace);
- if (context)
- {
- context->hCertStore = store;
- if (ppStoreContext)
- *ppStoreContext = CertDuplicateCRLContext(context);
- }
- return context ? TRUE : FALSE;
-}
-
-static void *CRYPT_MemEnumCrl(PWINECRYPT_CERTSTORE store, void *pPrev)
-{
- WINE_MEMSTORE *ms = (WINE_MEMSTORE *)store;
- void *ret;
-
- TRACE("(%p, %p)\n", store, pPrev);
-
- ret = ContextList_Enum(ms->crls, pPrev);
- if (!ret)
- SetLastError(CRYPT_E_NOT_FOUND);
-
- TRACE("returning %p\n", ret);
- return ret;
-}
-
-static BOOL CRYPT_MemDeleteCrl(PWINECRYPT_CERTSTORE store, void *pCrlContext)
-{
- WINE_MEMSTORE *ms = (WINE_MEMSTORE *)store;
-
- ContextList_Delete(ms->crls, pCrlContext);
- return TRUE;
-}
-
static void CRYPT_EmptyStore(HCERTSTORE store)
{
PCCERT_CONTEXT cert;
@@ -279,55 +190,6 @@ static void CRYPT_EmptyStore(HCERTSTORE
} while (crl);
}
-static void WINAPI CRYPT_MemCloseStore(HCERTSTORE hCertStore, DWORD dwFlags)
-{
- WINE_MEMSTORE *store = (WINE_MEMSTORE *)hCertStore;
-
- TRACE("(%p, %08x)\n", store, dwFlags);
- if (dwFlags)
- FIXME("Unimplemented flags: %08x\n", dwFlags);
-
- ContextList_Free(store->certs);
- ContextList_Free(store->crls);
- CRYPT_FreeStore((PWINECRYPT_CERTSTORE)store);
-}
-
-static WINECRYPT_CERTSTORE *CRYPT_MemOpenStore(HCRYPTPROV hCryptProv,
- DWORD dwFlags, const void *pvPara)
-{
- PWINE_MEMSTORE store;
-
- TRACE("(%ld, %08x, %p)\n", hCryptProv, dwFlags, pvPara);
-
- if (dwFlags & CERT_STORE_DELETE_FLAG)
- {
- SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
- store = NULL;
- }
- else
- {
- store = CryptMemAlloc(sizeof(WINE_MEMSTORE));
- if (store)
- {
- memset(store, 0, sizeof(WINE_MEMSTORE));
- CRYPT_InitStore(&store->hdr, hCryptProv, dwFlags, StoreTypeMem);
- store->hdr.closeStore = CRYPT_MemCloseStore;
- store->hdr.certs.addContext = CRYPT_MemAddCert;
- store->hdr.certs.enumContext = CRYPT_MemEnumCert;
- store->hdr.certs.deleteContext = CRYPT_MemDeleteCert;
- store->hdr.crls.addContext = CRYPT_MemAddCrl;
- store->hdr.crls.enumContext = CRYPT_MemEnumCrl;
- store->hdr.crls.deleteContext = CRYPT_MemDeleteCrl;
- store->hdr.control = NULL;
- store->certs = ContextList_Create(pCertInterface,
- sizeof(CERT_CONTEXT));
- store->crls = ContextList_Create(pCRLInterface,
- sizeof(CRL_CONTEXT));
- }
- }
- return (PWINECRYPT_CERTSTORE)store;
-}
-
static void WINAPI CRYPT_CollectionCloseStore(HCERTSTORE store, DWORD dwFlags)
{
PWINE_COLLECTIONSTORE cs = (PWINE_COLLECTIONSTORE)store;
--
1.4.1
More information about the wine-patches
mailing list