Commit f94d49dc authored by Juan Lang's avatar Juan Lang Committed by Alexandre Julliard

crypt32: Implement CertSerializeCRLStoreElement.

parent 44c3d328
...@@ -30,7 +30,7 @@ ...@@ -30,7 +30,7 @@
@ stdcall CertDuplicateStore(ptr) @ stdcall CertDuplicateStore(ptr)
@ stdcall CertEnumCRLContextProperties(ptr long) @ stdcall CertEnumCRLContextProperties(ptr long)
@ stdcall CertEnumCRLsInStore(ptr ptr) @ stdcall CertEnumCRLsInStore(ptr ptr)
@ stub CertEnumCTLContextProperties @ stdcall CertEnumCTLContextProperties(ptr long)
@ stdcall CertEnumCTLsInStore(ptr ptr) @ stdcall CertEnumCTLsInStore(ptr ptr)
@ stdcall CertEnumCertificateContextProperties(ptr long) @ stdcall CertEnumCertificateContextProperties(ptr long)
@ stdcall CertEnumCertificatesInStore(long ptr) @ stdcall CertEnumCertificatesInStore(long ptr)
......
...@@ -56,6 +56,7 @@ typedef BOOL (WINAPI *AddEncodedContextToStoreFunc)(HCERTSTORE hCertStore, ...@@ -56,6 +56,7 @@ typedef BOOL (WINAPI *AddEncodedContextToStoreFunc)(HCERTSTORE hCertStore,
typedef const void *(WINAPI *DuplicateContextFunc)(const void *context); typedef const void *(WINAPI *DuplicateContextFunc)(const void *context);
typedef const void *(WINAPI *EnumContextsInStoreFunc)(HCERTSTORE hCertStore, typedef const void *(WINAPI *EnumContextsInStoreFunc)(HCERTSTORE hCertStore,
const void *pPrevContext); const void *pPrevContext);
typedef DWORD (WINAPI *EnumPropertiesFunc)(const void *context, DWORD dwPropId);
typedef BOOL (WINAPI *GetContextPropertyFunc)(const void *context, typedef BOOL (WINAPI *GetContextPropertyFunc)(const void *context,
DWORD dwPropID, void *pvData, DWORD *pcbData); DWORD dwPropID, void *pvData, DWORD *pcbData);
typedef BOOL (WINAPI *SetContextPropertyFunc)(const void *context, typedef BOOL (WINAPI *SetContextPropertyFunc)(const void *context,
...@@ -73,6 +74,7 @@ typedef struct _WINE_CONTEXT_INTERFACE ...@@ -73,6 +74,7 @@ typedef struct _WINE_CONTEXT_INTERFACE
AddEncodedContextToStoreFunc addEncodedToStore; AddEncodedContextToStoreFunc addEncodedToStore;
DuplicateContextFunc duplicate; DuplicateContextFunc duplicate;
EnumContextsInStoreFunc enumContextsInStore; EnumContextsInStoreFunc enumContextsInStore;
EnumPropertiesFunc enumProps;
GetContextPropertyFunc getProp; GetContextPropertyFunc getProp;
SetContextPropertyFunc setProp; SetContextPropertyFunc setProp;
SerializeElementFunc serialize; SerializeElementFunc serialize;
......
...@@ -36,45 +36,29 @@ typedef struct _WINE_CERT_PROP_HEADER ...@@ -36,45 +36,29 @@ typedef struct _WINE_CERT_PROP_HEADER
DWORD cb; DWORD cb;
} WINE_CERT_PROP_HEADER, *PWINE_CERT_PROP_HEADER; } WINE_CERT_PROP_HEADER, *PWINE_CERT_PROP_HEADER;
BOOL WINAPI CertSerializeCRLStoreElement(PCCRL_CONTEXT pCrlContext, static BOOL CRYPT_SerializeStoreElement(const void *context,
DWORD dwFlags, BYTE *pbElement, DWORD *pcbElement) const BYTE *encodedContext, DWORD cbEncodedContext, DWORD contextPropID,
{ PCWINE_CONTEXT_INTERFACE contextInterface, DWORD dwFlags, BYTE *pbElement,
FIXME("(%p, %08lx, %p, %p): stub\n", pCrlContext, dwFlags, pbElement, DWORD *pcbElement)
pcbElement);
return FALSE;
}
BOOL WINAPI CertSerializeCTLStoreElement(PCCTL_CONTEXT pCtlContext,
DWORD dwFlags, BYTE *pbElement, DWORD *pcbElement)
{
FIXME("(%p, %08lx, %p, %p): stub\n", pCtlContext, dwFlags, pbElement,
pcbElement);
return FALSE;
}
BOOL WINAPI CertSerializeCertificateStoreElement(PCCERT_CONTEXT pCertContext,
DWORD dwFlags, BYTE *pbElement, DWORD *pcbElement)
{ {
BOOL ret; BOOL ret;
TRACE("(%p, %08lx, %p, %p)\n", pCertContext, dwFlags, pbElement, TRACE("(%p, %p, %08lx, %p, %p)\n", context, contextInterface, dwFlags,
pcbElement); pbElement, pcbElement);
if (pCertContext) if (context)
{ {
DWORD bytesNeeded = sizeof(WINE_CERT_PROP_HEADER) + DWORD bytesNeeded = sizeof(WINE_CERT_PROP_HEADER) + cbEncodedContext;
pCertContext->cbCertEncoded;
DWORD prop = 0; DWORD prop = 0;
ret = TRUE; ret = TRUE;
do { do {
prop = CertEnumCertificateContextProperties(pCertContext, prop); prop = contextInterface->enumProps(context, prop);
if (prop) if (prop)
{ {
DWORD propSize = 0; DWORD propSize = 0;
ret = CertGetCertificateContextProperty(pCertContext, ret = contextInterface->getProp(context, prop, NULL, &propSize);
prop, NULL, &propSize);
if (ret) if (ret)
bytesNeeded += sizeof(WINE_CERT_PROP_HEADER) + propSize; bytesNeeded += sizeof(WINE_CERT_PROP_HEADER) + propSize;
} }
...@@ -99,13 +83,13 @@ BOOL WINAPI CertSerializeCertificateStoreElement(PCCERT_CONTEXT pCertContext, ...@@ -99,13 +83,13 @@ BOOL WINAPI CertSerializeCertificateStoreElement(PCCERT_CONTEXT pCertContext,
prop = 0; prop = 0;
do { do {
prop = CertEnumCertificateContextProperties(pCertContext, prop); prop = contextInterface->enumProps(context, prop);
if (prop) if (prop)
{ {
DWORD propSize = 0; DWORD propSize = 0;
ret = CertGetCertificateContextProperty(pCertContext, ret = contextInterface->getProp(context, prop, NULL,
prop, NULL, &propSize); &propSize);
if (ret) if (ret)
{ {
if (bufSize < propSize) if (bufSize < propSize)
...@@ -118,8 +102,8 @@ BOOL WINAPI CertSerializeCertificateStoreElement(PCCERT_CONTEXT pCertContext, ...@@ -118,8 +102,8 @@ BOOL WINAPI CertSerializeCertificateStoreElement(PCCERT_CONTEXT pCertContext,
} }
if (buf) if (buf)
{ {
ret = CertGetCertificateContextProperty( ret = contextInterface->getProp(context, prop, buf,
pCertContext, prop, buf, &propSize); &propSize);
if (ret) if (ret)
{ {
hdr = (PWINE_CERT_PROP_HEADER)pbElement; hdr = (PWINE_CERT_PROP_HEADER)pbElement;
...@@ -142,11 +126,11 @@ BOOL WINAPI CertSerializeCertificateStoreElement(PCCERT_CONTEXT pCertContext, ...@@ -142,11 +126,11 @@ BOOL WINAPI CertSerializeCertificateStoreElement(PCCERT_CONTEXT pCertContext,
CryptMemFree(buf); CryptMemFree(buf);
hdr = (PWINE_CERT_PROP_HEADER)pbElement; hdr = (PWINE_CERT_PROP_HEADER)pbElement;
hdr->propID = CERT_CERT_PROP_ID; hdr->propID = contextPropID;
hdr->unknown = 1; hdr->unknown = 1;
hdr->cb = pCertContext->cbCertEncoded; hdr->cb = cbEncodedContext;
memcpy(pbElement + sizeof(WINE_CERT_PROP_HEADER), memcpy(pbElement + sizeof(WINE_CERT_PROP_HEADER),
pCertContext->pbCertEncoded, pCertContext->cbCertEncoded); encodedContext, cbEncodedContext);
} }
} }
else else
...@@ -154,6 +138,30 @@ BOOL WINAPI CertSerializeCertificateStoreElement(PCCERT_CONTEXT pCertContext, ...@@ -154,6 +138,30 @@ BOOL WINAPI CertSerializeCertificateStoreElement(PCCERT_CONTEXT pCertContext,
return ret; return ret;
} }
BOOL WINAPI CertSerializeCertificateStoreElement(PCCERT_CONTEXT pCertContext,
DWORD dwFlags, BYTE *pbElement, DWORD *pcbElement)
{
return CRYPT_SerializeStoreElement(pCertContext,
pCertContext->pbCertEncoded, pCertContext->cbCertEncoded,
CERT_CERT_PROP_ID, pCertInterface, dwFlags, pbElement, pcbElement);
}
BOOL WINAPI CertSerializeCRLStoreElement(PCCRL_CONTEXT pCrlContext,
DWORD dwFlags, BYTE *pbElement, DWORD *pcbElement)
{
return CRYPT_SerializeStoreElement(pCrlContext,
pCrlContext->pbCrlEncoded, pCrlContext->cbCrlEncoded,
CERT_CRL_PROP_ID, pCRLInterface, dwFlags, pbElement, pcbElement);
}
BOOL WINAPI CertSerializeCTLStoreElement(PCCTL_CONTEXT pCtlContext,
DWORD dwFlags, BYTE *pbElement, DWORD *pcbElement)
{
return CRYPT_SerializeStoreElement(pCtlContext,
pCtlContext->pbCtlEncoded, pCtlContext->cbCtlEncoded,
CERT_CTL_PROP_ID, pCRLInterface, dwFlags, pbElement, pcbElement);
}
/* Looks for the property with ID propID in the buffer buf. Returns a pointer /* Looks for the property with ID propID in the buffer buf. Returns a pointer
* to its header if a valid header is found, NULL if not. Valid means the * to its header if a valid header is found, NULL if not. Valid means the
* length of thte property won't overrun buf, and the unknown field is 1. * length of thte property won't overrun buf, and the unknown field is 1.
......
...@@ -47,6 +47,7 @@ static const WINE_CONTEXT_INTERFACE gCertInterface = { ...@@ -47,6 +47,7 @@ static const WINE_CONTEXT_INTERFACE gCertInterface = {
(AddEncodedContextToStoreFunc)CertAddEncodedCertificateToStore, (AddEncodedContextToStoreFunc)CertAddEncodedCertificateToStore,
(DuplicateContextFunc)CertDuplicateCertificateContext, (DuplicateContextFunc)CertDuplicateCertificateContext,
(EnumContextsInStoreFunc)CertEnumCertificatesInStore, (EnumContextsInStoreFunc)CertEnumCertificatesInStore,
(EnumPropertiesFunc)CertEnumCertificateContextProperties,
(GetContextPropertyFunc)CertGetCertificateContextProperty, (GetContextPropertyFunc)CertGetCertificateContextProperty,
(SetContextPropertyFunc)CertSetCertificateContextProperty, (SetContextPropertyFunc)CertSetCertificateContextProperty,
(SerializeElementFunc)CertSerializeCertificateStoreElement, (SerializeElementFunc)CertSerializeCertificateStoreElement,
...@@ -61,6 +62,7 @@ static const WINE_CONTEXT_INTERFACE gCRLInterface = { ...@@ -61,6 +62,7 @@ static const WINE_CONTEXT_INTERFACE gCRLInterface = {
(AddEncodedContextToStoreFunc)CertAddEncodedCRLToStore, (AddEncodedContextToStoreFunc)CertAddEncodedCRLToStore,
(DuplicateContextFunc)CertDuplicateCRLContext, (DuplicateContextFunc)CertDuplicateCRLContext,
(EnumContextsInStoreFunc)CertEnumCRLsInStore, (EnumContextsInStoreFunc)CertEnumCRLsInStore,
(EnumPropertiesFunc)CertEnumCRLContextProperties,
(GetContextPropertyFunc)CertGetCRLContextProperty, (GetContextPropertyFunc)CertGetCRLContextProperty,
(SetContextPropertyFunc)CertSetCRLContextProperty, (SetContextPropertyFunc)CertSetCRLContextProperty,
(SerializeElementFunc)CertSerializeCRLStoreElement, (SerializeElementFunc)CertSerializeCRLStoreElement,
...@@ -75,6 +77,7 @@ static const WINE_CONTEXT_INTERFACE gCTLInterface = { ...@@ -75,6 +77,7 @@ static const WINE_CONTEXT_INTERFACE gCTLInterface = {
(AddEncodedContextToStoreFunc)CertAddEncodedCTLToStore, (AddEncodedContextToStoreFunc)CertAddEncodedCTLToStore,
(DuplicateContextFunc)CertDuplicateCTLContext, (DuplicateContextFunc)CertDuplicateCTLContext,
(EnumContextsInStoreFunc)CertEnumCTLsInStore, (EnumContextsInStoreFunc)CertEnumCTLsInStore,
(EnumPropertiesFunc)CertEnumCTLContextProperties,
(GetContextPropertyFunc)CertGetCTLContextProperty, (GetContextPropertyFunc)CertGetCTLContextProperty,
(SetContextPropertyFunc)CertSetCTLContextProperty, (SetContextPropertyFunc)CertSetCTLContextProperty,
(SerializeElementFunc)CertSerializeCTLStoreElement, (SerializeElementFunc)CertSerializeCTLStoreElement,
...@@ -2240,6 +2243,13 @@ BOOL WINAPI CertControlStore(HCERTSTORE hCertStore, DWORD dwFlags, ...@@ -2240,6 +2243,13 @@ BOOL WINAPI CertControlStore(HCERTSTORE hCertStore, DWORD dwFlags,
return ret; return ret;
} }
DWORD WINAPI CertEnumCTLContextProperties(PCCTL_CONTEXT pCTLContext,
DWORD dwPropId)
{
FIXME("(%p, %ld): stub\n", pCTLContext, dwPropId);
return 0;
}
BOOL WINAPI CertGetCTLContextProperty(PCCTL_CONTEXT pCTLContext, BOOL WINAPI CertGetCTLContextProperty(PCCTL_CONTEXT pCTLContext,
DWORD dwPropId, void *pvData, DWORD *pcbData) DWORD dwPropId, void *pvData, DWORD *pcbData)
{ {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment