From 30bf5d9adb55dc0879e47a9790961b4bc3507ad8 Mon Sep 17 00:00:00 2001 From: Juan Lang Date: Mon, 17 Jul 2006 23:02:57 -0700 Subject: [PATCH] crypt32: Fix reading key prov info from serialized data. --- dlls/crypt32/cert.c | 7 +------ dlls/crypt32/crypt32_private.h | 8 ++++++++ dlls/crypt32/serialize.c | 10 ++++++++++ 3 files changed, 19 insertions(+), 6 deletions(-) diff --git a/dlls/crypt32/cert.c b/dlls/crypt32/cert.c index b5d510d8c90..6297e722f0e 100644 --- a/dlls/crypt32/cert.c +++ b/dlls/crypt32/cert.c @@ -244,12 +244,7 @@ static BOOL WINAPI CertContext_GetProperty(void *context, DWORD dwPropId, return ret; } -/* info is assumed to be a CRYPT_KEY_PROV_INFO, followed by its container name, - * provider name, and any provider parameters, in a contiguous buffer, but - * where info's pointers are assumed to be invalid. Upon return, info's - * pointers point to the appropriate memory locations. - */ -static void CRYPT_FixKeyProvInfoPointers(PCRYPT_KEY_PROV_INFO info) +void CRYPT_FixKeyProvInfoPointers(PCRYPT_KEY_PROV_INFO info) { DWORD i, containerLen, provNameLen; LPBYTE data = (LPBYTE)info + sizeof(CRYPT_KEY_PROV_INFO); diff --git a/dlls/crypt32/crypt32_private.h b/dlls/crypt32/crypt32_private.h index 3ef44b4fb90..99c1dfe798b 100644 --- a/dlls/crypt32/crypt32_private.h +++ b/dlls/crypt32/crypt32_private.h @@ -97,6 +97,14 @@ extern PCWINE_CONTEXT_INTERFACE pCTLInterface; const void *CRYPT_ReadSerializedElement(const BYTE *pbElement, DWORD cbElement, DWORD dwContextTypeFlags, DWORD *pdwContentType); +/* Fixes up the the pointers in info, where info is assumed to be a + * CRYPT_KEY_PROV_INFO, followed by its container name, provider name, and any + * provider parameters, in a contiguous buffer, but where info's pointers are + * assumed to be invalid. Upon return, info's pointers point to the + * appropriate memory locations. + */ +void CRYPT_FixKeyProvInfoPointers(PCRYPT_KEY_PROV_INFO info); + DWORD CertStore_GetAccessState(HCERTSTORE hCertStore); /** diff --git a/dlls/crypt32/serialize.c b/dlls/crypt32/serialize.c index b0765a71c98..afcd13f1043 100644 --- a/dlls/crypt32/serialize.c +++ b/dlls/crypt32/serialize.c @@ -363,6 +363,16 @@ const void *CRYPT_ReadSerializedElement(const BYTE *pbElement, DWORD cbElement, ret = contextInterface->setProp(context, hdr->propID, 0, pbElement); break; + case CERT_KEY_PROV_INFO_PROP_ID: + { + PCRYPT_KEY_PROV_INFO info = + (PCRYPT_KEY_PROV_INFO)pbElement; + + CRYPT_FixKeyProvInfoPointers(info); + ret = contextInterface->setProp(context, + hdr->propID, 0, pbElement); + break; + } default: FIXME("prop ID %ld: stub\n", hdr->propID); } -- 2.11.4.GIT