crypt32: Fix conversion of CRYPT_KEY_PROV_INFO between store and certificate property.

Store uses relative offsets while certificate property uses pointers.

Signed-off-by: Dmitry Timoshkov <dmitry@baikal.ru>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Dmitry Timoshkov 2020-09-15 19:00:11 +03:00 committed by Alexandre Julliard
parent dca38a84fb
commit 7f8f424f38
1 changed files with 4 additions and 2 deletions

View File

@ -566,7 +566,7 @@ void CRYPT_FixKeyProvInfoPointers(PCRYPT_KEY_PROV_INFO buf)
if (store->pwszContainerName)
{
info.pwszContainerName = (LPWSTR)p;
info.pwszContainerName = (LPWSTR)((BYTE *)store + store->pwszContainerName);
p += (lstrlenW(info.pwszContainerName) + 1) * sizeof(WCHAR);
}
else
@ -574,7 +574,7 @@ void CRYPT_FixKeyProvInfoPointers(PCRYPT_KEY_PROV_INFO buf)
if (store->pwszProvName)
{
info.pwszProvName = (LPWSTR)p;
info.pwszProvName = (LPWSTR)((BYTE *)store + store->pwszProvName);
p += (lstrlenW(info.pwszProvName) + 1) * sizeof(WCHAR);
}
else
@ -705,6 +705,7 @@ static void CRYPT_CopyKeyProvInfo(store_CRYPT_KEY_PROV_INFO *to, const CRYPT_KEY
to->dwProvType = from->dwProvType;
to->dwFlags = from->dwFlags;
to->cProvParam = from->cProvParam;
to->rgProvParam = 0;
to->dwKeySpec = from->dwKeySpec;
for (i = 0; i < to->cProvParam; i++)
@ -713,6 +714,7 @@ static void CRYPT_CopyKeyProvInfo(store_CRYPT_KEY_PROV_INFO *to, const CRYPT_KEY
p += sizeof(*param);
param->dwParam = from->rgProvParam[i].dwParam;
param->pbData = 0;
param->cbData = from->rgProvParam[i].cbData;
param->dwFlags = from->rgProvParam[i].dwFlags;
memcpy(p, from->rgProvParam[i].pbData, from->rgProvParam[i].cbData);