Commit 8e0f125f authored by Rob Shearman's avatar Rob Shearman Committed by Alexandre Julliard

wintrust: Implement WTHelperGetProvPrivateDataFromChain.

Also fill in pfnAddPrivData2Chain in WintrustLoadFunctionPointers, which is the complement of WTHelperGetProvPrivateDataFromChain.
parent 3f2ea570
......@@ -862,7 +862,7 @@ BOOL WINAPI WintrustLoadFunctionPointers( GUID* pgActionID,
pPfns->pfnAddStore2Chain = WINTRUST_AddStore;
pPfns->pfnAddSgnr2Chain = WINTRUST_AddSgnr;
pPfns->pfnAddCert2Chain = WINTRUST_AddCert;
pPfns->pfnAddPrivData2Chain = NULL;
pPfns->pfnAddPrivData2Chain = WINTRUST_AddPrivData;
pPfns->psUIpfns = NULL;
pPfns->pfnInitialize = (PFN_PROVIDER_INIT_CALL)WINTRUST_ReadProviderFromReg(GuidString, Initialization);
pPfns->pfnObjectTrust = (PFN_PROVIDER_OBJTRUST_CALL)WINTRUST_ReadProviderFromReg(GuidString, Message);
......
......@@ -81,7 +81,7 @@
@ stdcall WTHelperGetFileName(ptr)
@ stub WTHelperGetKnownUsages
@ stdcall WTHelperGetProvCertFromChain(ptr long)
@ stub WTHelperGetProvPrivateDataFromChain
@ stdcall WTHelperGetProvPrivateDataFromChain(ptr ptr)
@ stdcall WTHelperGetProvSignerFromChain(ptr long long long)
@ stub WTHelperIsInRootStore
@ stub WTHelperOpenKnownStores
......
......@@ -425,6 +425,25 @@ CRYPT_PROVIDER_CERT * WINAPI WTHelperGetProvCertFromChain(
return cert;
}
CRYPT_PROVIDER_PRIVDATA *WINAPI WTHelperGetProvPrivateDataFromChain(
CRYPT_PROVIDER_DATA* pProvData,
GUID* pgProviderID)
{
CRYPT_PROVIDER_PRIVDATA *privdata = NULL;
DWORD i;
TRACE("(%p, %s)\n", pProvData, debugstr_guid(pgProviderID));
for (i = 0; i < pProvData->csProvPrivData; i++)
if (IsEqualGUID(pgProviderID, &pProvData->pasProvPrivData[i].gProviderID))
{
privdata = &pProvData->pasProvPrivData[i];
break;
}
return privdata;
}
/***********************************************************************
* WTHelperProvDataFromStateData (WINTRUST.@)
*/
......@@ -649,3 +668,41 @@ BOOL WINAPI WINTRUST_AddCert(CRYPT_PROVIDER_DATA *data, DWORD idxSigner,
SetLastError(ERROR_OUTOFMEMORY);
return ret;
}
BOOL WINAPI WINTRUST_AddPrivData(CRYPT_PROVIDER_DATA *data,
CRYPT_PROVIDER_PRIVDATA *pPrivData2Add)
{
BOOL ret = FALSE;
TRACE("(%p, %p)\n", data, pPrivData2Add);
if (pPrivData2Add->cbStruct > sizeof(CRYPT_PROVIDER_PRIVDATA))
{
SetLastError(ERROR_INVALID_PARAMETER);
WARN("invalid struct size\n");
return FALSE;
}
if (data->csProvPrivData)
data->pasProvPrivData = WINTRUST_ReAlloc(data->pasProvPrivData,
(data->csProvPrivData + 1) * sizeof(CRYPT_PROVIDER_SGNR));
else
{
data->pasProvPrivData = WINTRUST_Alloc(sizeof(CRYPT_PROVIDER_SGNR));
data->csProvPrivData = 0;
}
if (data->pasProvPrivData)
{
DWORD i;
for (i = 0; i < data->csProvPrivData; i++)
if (IsEqualGUID(&pPrivData2Add->gProviderID, &data->pasProvPrivData[i]))
break;
data->pasProvPrivData[i] = *pPrivData2Add;
if (i == data->csProvPrivData)
data->csProvPrivData++;
}
else
SetLastError(ERROR_OUTOFMEMORY);
return ret;
}
......@@ -26,5 +26,7 @@ BOOL WINAPI WINTRUST_AddSgnr(CRYPT_PROVIDER_DATA *data,
BOOL fCounterSigner, DWORD idxSigner, CRYPT_PROVIDER_SGNR *sgnr);
BOOL WINAPI WINTRUST_AddCert(CRYPT_PROVIDER_DATA *data, DWORD idxSigner,
BOOL fCounterSigner, DWORD idxCounterSigner, PCCERT_CONTEXT pCert2Add);
BOOL WINAPI WINTRUST_AddPrivData(CRYPT_PROVIDER_DATA *data,
CRYPT_PROVIDER_PRIVDATA *pPrivData2Add);
#endif /* ndef __WINTRUST_PRIV_H__ */
......@@ -428,6 +428,7 @@ CRYPT_PROVIDER_SGNR * WINAPI WTHelperGetProvSignerFromChain(
CRYPT_PROVIDER_DATA *pProvData, DWORD idxSigner, BOOL fCounterSigner,
DWORD idxCounterSigner);
CRYPT_PROVIDER_DATA * WINAPI WTHelperProvDataFromStateData(HANDLE hStateData);
CRYPT_PROVIDER_PRIVDATA * WINAPI WTHelperGetProvPrivateDataFromChain(CRYPT_PROVIDER_DATA *,GUID *);
#define SPC_INDIRECT_DATA_OBJID "1.3.6.1.4.1.311.2.1.4"
#define SPC_SP_AGENCY_INFO_OBJID "1.3.6.1.4.1.311.2.1.10"
......
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