mirror of
https://github.com/reactos/reactos.git
synced 2026-06-03 17:59:48 +08:00
[WINTRUST] Sync to wine-10.0 (#8388)
- Sync wintrust and tests to wine-10.0
This commit is contained in:
@@ -1,4 +1,6 @@
|
||||
|
||||
remove_definitions(-D_CRT_NON_CONFORMING_SWPRINTFS)
|
||||
|
||||
spec2def(wintrust.dll wintrust.spec ADD_IMPORTLIB)
|
||||
|
||||
list(APPEND SOURCE
|
||||
@@ -21,7 +23,7 @@ if(MSVC)
|
||||
endif()
|
||||
|
||||
set_module_type(wintrust win32dll)
|
||||
target_link_libraries(wintrust wine ${PSEH_LIB})
|
||||
target_link_libraries(wintrust wine oldnames ${PSEH_LIB})
|
||||
# FIXME: imagehlp should be delay-imported. See CORE-6504
|
||||
#add_delay_importlibs(wintrust cryptui imagehlp)
|
||||
add_delay_importlibs(wintrust cryptui)
|
||||
|
||||
@@ -21,7 +21,7 @@
|
||||
#include <stdarg.h>
|
||||
#include <stdio.h>
|
||||
#include <assert.h>
|
||||
#define NONAMELESSUNION
|
||||
|
||||
#include "windef.h"
|
||||
#include "winbase.h"
|
||||
#include "winerror.h"
|
||||
@@ -100,7 +100,7 @@ static BOOL WINAPI CRYPT_AsnEncodeOctets(DWORD dwCertEncodingType,
|
||||
const CRYPT_DATA_BLOB *blob = pvStructInfo;
|
||||
DWORD bytesNeeded, lenBytes;
|
||||
|
||||
TRACE("(%d, %p), %p, %d\n", blob->cbData, blob->pbData, pbEncoded,
|
||||
TRACE("(%ld, %p), %p, %ld\n", blob->cbData, blob->pbData, pbEncoded,
|
||||
*pcbEncoded);
|
||||
|
||||
CRYPT_EncodeLen(blob->cbData, NULL, &lenBytes);
|
||||
@@ -131,7 +131,7 @@ BOOL WINAPI WVTAsn1SpcLinkEncode(DWORD dwCertEncodingType,
|
||||
{
|
||||
BOOL ret = FALSE;
|
||||
|
||||
TRACE("(0x%08x, %s, %p, %p, %p)\n", dwCertEncodingType,
|
||||
TRACE("(0x%08lx, %s, %p, %p, %p)\n", dwCertEncodingType,
|
||||
debugstr_a(lpszStructType), pvStructInfo, pbEncoded,
|
||||
pcbEncoded);
|
||||
|
||||
@@ -147,8 +147,8 @@ BOOL WINAPI WVTAsn1SpcLinkEncode(DWORD dwCertEncodingType,
|
||||
DWORD fileNameLen, fileNameLenBytes;
|
||||
LPWSTR ptr;
|
||||
|
||||
fileNameLen = link->u.pwszFile ?
|
||||
lstrlenW(link->u.pwszFile) * sizeof(WCHAR) : 0;
|
||||
fileNameLen = link->pwszFile ?
|
||||
lstrlenW(link->pwszFile) * sizeof(WCHAR) : 0;
|
||||
CRYPT_EncodeLen(fileNameLen, NULL, &fileNameLenBytes);
|
||||
CRYPT_EncodeLen(1 + fileNameLenBytes + fileNameLen, NULL,
|
||||
&lenBytes);
|
||||
@@ -173,7 +173,7 @@ BOOL WINAPI WVTAsn1SpcLinkEncode(DWORD dwCertEncodingType,
|
||||
*pbEncoded++ = ASN_CONTEXT;
|
||||
CRYPT_EncodeLen(fileNameLen, pbEncoded, &fileNameLenBytes);
|
||||
pbEncoded += fileNameLenBytes;
|
||||
for (ptr = link->u.pwszFile; ptr && *ptr; ptr++)
|
||||
for (ptr = link->pwszFile; ptr && *ptr; ptr++)
|
||||
{
|
||||
*(WCHAR *)pbEncoded = hton16(*ptr);
|
||||
pbEncoded += sizeof(WCHAR);
|
||||
@@ -185,14 +185,14 @@ BOOL WINAPI WVTAsn1SpcLinkEncode(DWORD dwCertEncodingType,
|
||||
case SPC_MONIKER_LINK_CHOICE:
|
||||
{
|
||||
DWORD classIdLenBytes, dataLenBytes, dataLen;
|
||||
CRYPT_DATA_BLOB classId = { sizeof(link->u.Moniker.ClassId),
|
||||
(BYTE *)link->u.Moniker.ClassId };
|
||||
CRYPT_DATA_BLOB classId = { sizeof(link->Moniker.ClassId),
|
||||
(BYTE *)link->Moniker.ClassId };
|
||||
|
||||
CRYPT_EncodeLen(classId.cbData, NULL, &classIdLenBytes);
|
||||
CRYPT_EncodeLen(link->u.Moniker.SerializedData.cbData, NULL,
|
||||
CRYPT_EncodeLen(link->Moniker.SerializedData.cbData, NULL,
|
||||
&dataLenBytes);
|
||||
dataLen = 2 + classIdLenBytes + classId.cbData +
|
||||
dataLenBytes + link->u.Moniker.SerializedData.cbData;
|
||||
dataLenBytes + link->Moniker.SerializedData.cbData;
|
||||
CRYPT_EncodeLen(dataLen, NULL, &lenBytes);
|
||||
bytesNeeded = 1 + dataLen + lenBytes;
|
||||
if (!pbEncoded)
|
||||
@@ -217,9 +217,9 @@ BOOL WINAPI WVTAsn1SpcLinkEncode(DWORD dwCertEncodingType,
|
||||
CRYPT_AsnEncodeOctets(X509_ASN_ENCODING, NULL, &classId,
|
||||
pbEncoded, &size);
|
||||
pbEncoded += size;
|
||||
size = 1 + dataLenBytes + link->u.Moniker.SerializedData.cbData;
|
||||
size = 1 + dataLenBytes + link->Moniker.SerializedData.cbData;
|
||||
CRYPT_AsnEncodeOctets(X509_ASN_ENCODING, NULL,
|
||||
&link->u.Moniker.SerializedData, pbEncoded, &size);
|
||||
&link->Moniker.SerializedData, pbEncoded, &size);
|
||||
pbEncoded += size;
|
||||
ret = TRUE;
|
||||
}
|
||||
@@ -233,7 +233,7 @@ BOOL WINAPI WVTAsn1SpcLinkEncode(DWORD dwCertEncodingType,
|
||||
/* Check for invalid characters in URL */
|
||||
ret = TRUE;
|
||||
urlLen = 0;
|
||||
for (ptr = link->u.pwszUrl; ptr && *ptr && ret; ptr++)
|
||||
for (ptr = link->pwszUrl; ptr && *ptr && ret; ptr++)
|
||||
if (*ptr > 0x7f)
|
||||
{
|
||||
*pcbEncoded = 0;
|
||||
@@ -260,7 +260,7 @@ BOOL WINAPI WVTAsn1SpcLinkEncode(DWORD dwCertEncodingType,
|
||||
*pbEncoded++ = ASN_CONTEXT;
|
||||
CRYPT_EncodeLen(urlLen, pbEncoded, &lenBytes);
|
||||
pbEncoded += lenBytes;
|
||||
for (ptr = link->u.pwszUrl; ptr && *ptr; ptr++)
|
||||
for (ptr = link->pwszUrl; ptr && *ptr; ptr++)
|
||||
*pbEncoded++ = (BYTE)*ptr;
|
||||
}
|
||||
}
|
||||
@@ -296,7 +296,7 @@ static BOOL CRYPT_AsnEncodeSequence(DWORD dwCertEncodingType,
|
||||
BOOL ret;
|
||||
DWORD i, dataLen = 0;
|
||||
|
||||
TRACE("%p, %d, %p, %d\n", items, cItem, pbEncoded, *pcbEncoded);
|
||||
TRACE("%p, %ld, %p, %ld\n", items, cItem, pbEncoded, *pcbEncoded);
|
||||
for (i = 0, ret = TRUE; ret && i < cItem; i++)
|
||||
{
|
||||
ret = items[i].encodeFunc(dwCertEncodingType, NULL,
|
||||
@@ -472,7 +472,7 @@ BOOL WINAPI WVTAsn1SpcPeImageDataEncode(DWORD dwCertEncodingType,
|
||||
const SPC_PE_IMAGE_DATA *imageData = pvStructInfo;
|
||||
BOOL ret = FALSE;
|
||||
|
||||
TRACE("(0x%08x, %s, %p, %p, %p)\n", dwCertEncodingType,
|
||||
TRACE("(0x%08lx, %s, %p, %p, %p)\n", dwCertEncodingType,
|
||||
debugstr_a(lpszStructType), pvStructInfo, pbEncoded,
|
||||
pcbEncoded);
|
||||
|
||||
@@ -652,6 +652,7 @@ static BOOL WINAPI CRYPT_CopyEncodedBlob(DWORD dwCertEncodingType,
|
||||
return ret;
|
||||
}
|
||||
|
||||
/* Different from the one in crypt32 */
|
||||
static BOOL WINAPI CRYPT_AsnEncodeAlgorithmIdWithNullParams(
|
||||
DWORD dwCertEncodingType, LPCSTR lpszStructType, const void *pvStructInfo,
|
||||
BYTE *pbEncoded, DWORD *pcbEncoded)
|
||||
@@ -665,12 +666,15 @@ static BOOL WINAPI CRYPT_AsnEncodeAlgorithmIdWithNullParams(
|
||||
{ algo->pszObjId, CRYPT_AsnEncodeOid, 0 },
|
||||
{ NULL, CRYPT_CopyEncodedBlob, 0 },
|
||||
};
|
||||
DWORD cItem = 2;
|
||||
|
||||
if (algo->Parameters.cbData)
|
||||
items[1].pvStructInfo = &algo->Parameters;
|
||||
else
|
||||
else if (algo->pszObjId)
|
||||
items[1].pvStructInfo = &nullBlob;
|
||||
ret = CRYPT_AsnEncodeSequence(dwCertEncodingType, items, ARRAY_SIZE(items),
|
||||
else
|
||||
cItem -= 1;
|
||||
ret = CRYPT_AsnEncodeSequence(dwCertEncodingType, items, cItem,
|
||||
pbEncoded, pcbEncoded);
|
||||
return ret;
|
||||
}
|
||||
@@ -681,7 +685,7 @@ static BOOL WINAPI CRYPT_AsnEncodeAttributeTypeValue(DWORD dwCertEncodingType,
|
||||
{
|
||||
const CRYPT_ATTRIBUTE_TYPE_VALUE *typeValue = pvStructInfo;
|
||||
struct AsnEncodeSequenceItem items[] = {
|
||||
{ &typeValue->pszObjId, CRYPT_AsnEncodeOid, 0 },
|
||||
{ typeValue->pszObjId, CRYPT_AsnEncodeOid, 0 },
|
||||
{ &typeValue->Value, CRYPT_CopyEncodedBlob, 0 },
|
||||
};
|
||||
|
||||
@@ -702,7 +706,7 @@ static BOOL WINAPI CRYPT_AsnEncodeSPCDigest(DWORD dwCertEncodingType,
|
||||
const struct SPCDigest *digest = pvStructInfo;
|
||||
struct AsnEncodeSequenceItem items[] = {
|
||||
{ &digest->DigestAlgorithm, CRYPT_AsnEncodeAlgorithmIdWithNullParams, 0 },
|
||||
{ &digest->Digest, CRYPT_CopyEncodedBlob, 0 },
|
||||
{ &digest->Digest, CRYPT_AsnEncodeOctets, 0 },
|
||||
};
|
||||
|
||||
return CRYPT_AsnEncodeSequence(X509_ASN_ENCODING, items, ARRAY_SIZE(items),
|
||||
@@ -715,7 +719,7 @@ BOOL WINAPI WVTAsn1SpcIndirectDataContentEncode(DWORD dwCertEncodingType,
|
||||
{
|
||||
BOOL ret = FALSE;
|
||||
|
||||
TRACE("(0x%08x, %s, %p, %p, %p)\n", dwCertEncodingType,
|
||||
TRACE("(0x%08lx, %s, %p, %p, %p)\n", dwCertEncodingType,
|
||||
debugstr_a(lpszStructType), pvStructInfo, pbEncoded, pcbEncoded);
|
||||
|
||||
__TRY
|
||||
@@ -807,7 +811,7 @@ BOOL WINAPI WVTAsn1SpcSpOpusInfoEncode(DWORD dwCertEncodingType,
|
||||
{
|
||||
BOOL ret = FALSE;
|
||||
|
||||
TRACE("(0x%08x, %s, %p, %p, %p)\n", dwCertEncodingType,
|
||||
TRACE("(0x%08lx, %s, %p, %p, %p)\n", dwCertEncodingType,
|
||||
debugstr_a(lpszStructType), pvStructInfo, pbEncoded, pcbEncoded);
|
||||
|
||||
__TRY
|
||||
@@ -982,7 +986,7 @@ BOOL WINAPI WVTAsn1CatMemberInfoEncode(DWORD dwCertEncodingType,
|
||||
{
|
||||
BOOL ret = FALSE;
|
||||
|
||||
TRACE("(0x%08x, %s, %p, %p, %p)\n", dwCertEncodingType,
|
||||
TRACE("(0x%08lx, %s, %p, %p, %p)\n", dwCertEncodingType,
|
||||
debugstr_a(lpszStructType), pvStructInfo, pbEncoded, pcbEncoded);
|
||||
|
||||
__TRY
|
||||
@@ -1010,7 +1014,7 @@ BOOL WINAPI WVTAsn1CatNameValueEncode(DWORD dwCertEncodingType,
|
||||
{
|
||||
BOOL ret = FALSE;
|
||||
|
||||
TRACE("(0x%08x, %s, %p, %p, %p)\n", dwCertEncodingType,
|
||||
TRACE("(0x%08lx, %s, %p, %p, %p)\n", dwCertEncodingType,
|
||||
debugstr_a(lpszStructType), pvStructInfo, pbEncoded, pcbEncoded);
|
||||
|
||||
__TRY
|
||||
@@ -1060,7 +1064,7 @@ static BOOL WINAPI CRYPT_AsnEncodeBool(DWORD dwCertEncodingType,
|
||||
*pbEncoded++ = val ? 0xff : 0;
|
||||
ret = TRUE;
|
||||
}
|
||||
TRACE("returning %d (%08x)\n", ret, GetLastError());
|
||||
TRACE("returning %d (%08lx)\n", ret, GetLastError());
|
||||
return ret;
|
||||
}
|
||||
|
||||
@@ -1070,7 +1074,7 @@ BOOL WINAPI WVTAsn1SpcFinancialCriteriaInfoEncode(DWORD dwCertEncodingType,
|
||||
{
|
||||
BOOL ret = FALSE;
|
||||
|
||||
TRACE("(0x%08x, %s, %p, %p, %p)\n", dwCertEncodingType,
|
||||
TRACE("(0x%08lx, %s, %p, %p, %p)\n", dwCertEncodingType,
|
||||
debugstr_a(lpszStructType), pvStructInfo, pbEncoded, pcbEncoded);
|
||||
|
||||
__TRY
|
||||
@@ -1174,7 +1178,7 @@ static BOOL WINAPI CRYPT_AsnDecodeOctets(DWORD dwCertEncodingType,
|
||||
BOOL ret;
|
||||
DWORD bytesNeeded, dataLen;
|
||||
|
||||
TRACE("%p, %d, %08x, %p, %d\n", pbEncoded, cbEncoded, dwFlags,
|
||||
TRACE("%p, %ld, %08lx, %p, %ld\n", pbEncoded, cbEncoded, dwFlags,
|
||||
pvStructInfo, *pcbStructInfo);
|
||||
|
||||
if (!cbEncoded)
|
||||
@@ -1229,7 +1233,7 @@ static BOOL CRYPT_AsnDecodeSPCLinkInternal(DWORD dwCertEncodingType,
|
||||
BOOL ret = FALSE;
|
||||
DWORD bytesNeeded = sizeof(SPC_LINK), dataLen;
|
||||
|
||||
TRACE("%p, %d, %08x, %p, %d\n", pbEncoded, cbEncoded, dwFlags,
|
||||
TRACE("%p, %ld, %08lx, %p, %ld\n", pbEncoded, cbEncoded, dwFlags,
|
||||
pvStructInfo, *pcbStructInfo);
|
||||
|
||||
if ((ret = CRYPT_GetLen(pbEncoded, cbEncoded, &dataLen)))
|
||||
@@ -1256,10 +1260,10 @@ static BOOL CRYPT_AsnDecodeSPCLinkInternal(DWORD dwCertEncodingType,
|
||||
|
||||
link->dwLinkChoice = SPC_URL_LINK_CHOICE;
|
||||
for (i = 0; i < dataLen; i++)
|
||||
link->u.pwszUrl[i] =
|
||||
link->pwszUrl[i] =
|
||||
*(pbEncoded + 1 + lenBytes + i);
|
||||
link->u.pwszUrl[i] = '\0';
|
||||
TRACE("returning url %s\n", debugstr_w(link->u.pwszUrl));
|
||||
link->pwszUrl[i] = '\0';
|
||||
TRACE("returning url %s\n", debugstr_w(link->pwszUrl));
|
||||
}
|
||||
break;
|
||||
case ASN_CONSTRUCTOR | ASN_CONTEXT | 1:
|
||||
@@ -1306,13 +1310,13 @@ static BOOL CRYPT_AsnDecodeSPCLinkInternal(DWORD dwCertEncodingType,
|
||||
/* pwszFile pointer was set by caller, copy it
|
||||
* before overwriting it
|
||||
*/
|
||||
link->u.Moniker.SerializedData.pbData =
|
||||
(BYTE *)link->u.pwszFile;
|
||||
memcpy(link->u.Moniker.ClassId, classId.pbData,
|
||||
link->Moniker.SerializedData.pbData =
|
||||
(BYTE *)link->pwszFile;
|
||||
memcpy(link->Moniker.ClassId, classId.pbData,
|
||||
classId.cbData);
|
||||
memcpy(link->u.Moniker.SerializedData.pbData,
|
||||
memcpy(link->Moniker.SerializedData.pbData,
|
||||
data.pbData, data.cbData);
|
||||
link->u.Moniker.SerializedData.cbData = data.cbData;
|
||||
link->Moniker.SerializedData.cbData = data.cbData;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1344,10 +1348,10 @@ static BOOL CRYPT_AsnDecodeSPCLinkInternal(DWORD dwCertEncodingType,
|
||||
|
||||
link->dwLinkChoice = SPC_FILE_LINK_CHOICE;
|
||||
for (i = 0; i < dataLen / sizeof(WCHAR); i++)
|
||||
link->u.pwszFile[i] =
|
||||
link->pwszFile[i] =
|
||||
hton16(*(const WORD *)(ptr + i * sizeof(WCHAR)));
|
||||
link->u.pwszFile[realDataLen / sizeof(WCHAR)] = '\0';
|
||||
TRACE("returning file %s\n", debugstr_w(link->u.pwszFile));
|
||||
link->pwszFile[realDataLen / sizeof(WCHAR)] = '\0';
|
||||
TRACE("returning file %s\n", debugstr_w(link->pwszFile));
|
||||
}
|
||||
}
|
||||
else
|
||||
@@ -1366,7 +1370,7 @@ static BOOL CRYPT_AsnDecodeSPCLinkInternal(DWORD dwCertEncodingType,
|
||||
PSPC_LINK link = pvStructInfo;
|
||||
|
||||
link->dwLinkChoice = SPC_FILE_LINK_CHOICE;
|
||||
link->u.pwszFile[0] = '\0';
|
||||
link->pwszFile[0] = '\0';
|
||||
ret = TRUE;
|
||||
}
|
||||
}
|
||||
@@ -1385,7 +1389,7 @@ BOOL WINAPI WVTAsn1SpcLinkDecode(DWORD dwCertEncodingType,
|
||||
{
|
||||
BOOL ret = FALSE;
|
||||
|
||||
TRACE("%p, %d, %08x, %p, %d\n", pbEncoded, cbEncoded, dwFlags,
|
||||
TRACE("%p, %ld, %08lx, %p, %ld\n", pbEncoded, cbEncoded, dwFlags,
|
||||
pvStructInfo, *pcbStructInfo);
|
||||
|
||||
__TRY
|
||||
@@ -1408,7 +1412,7 @@ BOOL WINAPI WVTAsn1SpcLinkDecode(DWORD dwCertEncodingType,
|
||||
{
|
||||
SPC_LINK *link = pvStructInfo;
|
||||
|
||||
link->u.pwszFile =
|
||||
link->pwszFile =
|
||||
(LPWSTR)((BYTE *)pvStructInfo + sizeof(SPC_LINK));
|
||||
ret = CRYPT_AsnDecodeSPCLinkInternal(dwCertEncodingType,
|
||||
lpszStructType, pbEncoded, cbEncoded, dwFlags, pvStructInfo,
|
||||
@@ -1486,7 +1490,7 @@ static BOOL CRYPT_AsnDecodeSequenceItems(DWORD dwCertEncodingType,
|
||||
DWORD i, decoded = 0;
|
||||
const BYTE *ptr = pbEncoded;
|
||||
|
||||
TRACE("%p, %d, %p, %d, %08x, %p, %p, %p\n", items, cItem, pbEncoded,
|
||||
TRACE("%p, %ld, %p, %ld, %08lx, %p, %p, %p\n", items, cItem, pbEncoded,
|
||||
cbEncoded, dwFlags, pvStructInfo, nextData, cbDecoded);
|
||||
|
||||
for (i = 0, ret = TRUE; ret && i < cItem; i++)
|
||||
@@ -1512,9 +1516,9 @@ static BOOL CRYPT_AsnDecodeSequenceItems(DWORD dwCertEncodingType,
|
||||
if (items[i].decodeFunc)
|
||||
{
|
||||
if (pvStructInfo)
|
||||
TRACE("decoding item %d\n", i);
|
||||
TRACE("decoding item %ld\n", i);
|
||||
else
|
||||
TRACE("sizing item %d\n", i);
|
||||
TRACE("sizing item %ld\n", i);
|
||||
ret = items[i].decodeFunc(dwCertEncodingType,
|
||||
NULL, ptr, 1 + nextItemLenBytes + nextItemLen,
|
||||
dwFlags & ~CRYPT_DECODE_ALLOC_FLAG,
|
||||
@@ -1529,30 +1533,30 @@ static BOOL CRYPT_AsnDecodeSequenceItems(DWORD dwCertEncodingType,
|
||||
/* Account for alignment padding */
|
||||
items[i].size = ALIGN_DWORD_PTR(items[i].size);
|
||||
}
|
||||
TRACE("item %d size: %d\n", i, items[i].size);
|
||||
TRACE("item %ld size: %ld\n", i, items[i].size);
|
||||
if (nextData && items[i].hasPointer &&
|
||||
items[i].size > items[i].minSize)
|
||||
nextData += items[i].size - items[i].minSize;
|
||||
ptr += 1 + nextItemLenBytes + nextItemLen;
|
||||
decoded += 1 + nextItemLenBytes + nextItemLen;
|
||||
TRACE("item %d: decoded %d bytes\n", i,
|
||||
TRACE("item %ld: decoded %ld bytes\n", i,
|
||||
1 + nextItemLenBytes + nextItemLen);
|
||||
}
|
||||
else if (items[i].optional &&
|
||||
GetLastError() == CRYPT_E_ASN1_BADTAG)
|
||||
{
|
||||
TRACE("skipping optional item %d\n", i);
|
||||
TRACE("skipping optional item %ld\n", i);
|
||||
items[i].size = items[i].minSize;
|
||||
SetLastError(NOERROR);
|
||||
ret = TRUE;
|
||||
}
|
||||
else
|
||||
TRACE("item %d failed: %08x\n", i,
|
||||
TRACE("item %ld failed: %08lx\n", i,
|
||||
GetLastError());
|
||||
}
|
||||
else
|
||||
{
|
||||
TRACE("item %d: decoded %d bytes\n", i,
|
||||
TRACE("item %ld: decoded %ld bytes\n", i,
|
||||
1 + nextItemLenBytes + nextItemLen);
|
||||
ptr += 1 + nextItemLenBytes + nextItemLen;
|
||||
decoded += 1 + nextItemLenBytes + nextItemLen;
|
||||
@@ -1561,12 +1565,12 @@ static BOOL CRYPT_AsnDecodeSequenceItems(DWORD dwCertEncodingType,
|
||||
}
|
||||
else if (items[i].optional)
|
||||
{
|
||||
TRACE("skipping optional item %d\n", i);
|
||||
TRACE("skipping optional item %ld\n", i);
|
||||
items[i].size = items[i].minSize;
|
||||
}
|
||||
else
|
||||
{
|
||||
TRACE("item %d: tag %02x doesn't match expected %02x\n",
|
||||
TRACE("item %ld: tag %02x doesn't match expected %02x\n",
|
||||
i, ptr[0], items[i].tag);
|
||||
SetLastError(CRYPT_E_ASN1_BADTAG);
|
||||
ret = FALSE;
|
||||
@@ -1575,12 +1579,12 @@ static BOOL CRYPT_AsnDecodeSequenceItems(DWORD dwCertEncodingType,
|
||||
}
|
||||
else if (items[i].optional)
|
||||
{
|
||||
TRACE("missing optional item %d, skipping\n", i);
|
||||
TRACE("missing optional item %ld, skipping\n", i);
|
||||
items[i].size = items[i].minSize;
|
||||
}
|
||||
else
|
||||
{
|
||||
TRACE("not enough bytes for item %d, failing\n", i);
|
||||
TRACE("not enough bytes for item %ld, failing\n", i);
|
||||
SetLastError(CRYPT_E_ASN1_CORRUPT);
|
||||
ret = FALSE;
|
||||
}
|
||||
@@ -1605,7 +1609,7 @@ static BOOL CRYPT_AsnDecodeSequence(DWORD dwCertEncodingType,
|
||||
{
|
||||
BOOL ret;
|
||||
|
||||
TRACE("%p, %d, %p, %d, %08x, %p, %d, %p\n", items, cItem, pbEncoded,
|
||||
TRACE("%p, %ld, %p, %ld, %08lx, %p, %ld, %p\n", items, cItem, pbEncoded,
|
||||
cbEncoded, dwFlags, pvStructInfo, *pcbStructInfo, startingPointer);
|
||||
|
||||
if (pbEncoded[0] == ASN_SEQUENCE)
|
||||
@@ -1620,7 +1624,7 @@ static BOOL CRYPT_AsnDecodeSequence(DWORD dwCertEncodingType,
|
||||
cbEncoded -= 1 + lenBytes;
|
||||
if (cbEncoded < dataLen)
|
||||
{
|
||||
TRACE("dataLen %d exceeds cbEncoded %d, failing\n", dataLen,
|
||||
TRACE("dataLen %ld exceeds cbEncoded %ld, failing\n", dataLen,
|
||||
cbEncoded);
|
||||
SetLastError(CRYPT_E_ASN1_CORRUPT);
|
||||
ret = FALSE;
|
||||
@@ -1630,7 +1634,7 @@ static BOOL CRYPT_AsnDecodeSequence(DWORD dwCertEncodingType,
|
||||
cbEncoded, dwFlags, NULL, NULL, &cbDecoded);
|
||||
if (ret && cbDecoded != dataLen)
|
||||
{
|
||||
TRACE("expected %d decoded, got %d, failing\n", dataLen,
|
||||
TRACE("expected %ld decoded, got %ld, failing\n", dataLen,
|
||||
cbDecoded);
|
||||
SetLastError(CRYPT_E_ASN1_CORRUPT);
|
||||
ret = FALSE;
|
||||
@@ -1674,7 +1678,7 @@ static BOOL CRYPT_AsnDecodeSequence(DWORD dwCertEncodingType,
|
||||
SetLastError(CRYPT_E_ASN1_BADTAG);
|
||||
ret = FALSE;
|
||||
}
|
||||
TRACE("returning %d (%08x)\n", ret, GetLastError());
|
||||
TRACE("returning %d (%08lx)\n", ret, GetLastError());
|
||||
return ret;
|
||||
}
|
||||
|
||||
@@ -1684,7 +1688,7 @@ static BOOL WINAPI CRYPT_AsnDecodeBitsInternal(DWORD dwCertEncodingType,
|
||||
{
|
||||
BOOL ret;
|
||||
|
||||
TRACE("(%p, %d, 0x%08x, %p, %d)\n", pbEncoded, cbEncoded, dwFlags,
|
||||
TRACE("(%p, %ld, 0x%08lx, %p, %ld)\n", pbEncoded, cbEncoded, dwFlags,
|
||||
pvStructInfo, *pcbStructInfo);
|
||||
|
||||
if (pbEncoded[0] == ASN_BITSTRING)
|
||||
@@ -1738,7 +1742,7 @@ static BOOL WINAPI CRYPT_AsnDecodeBitsInternal(DWORD dwCertEncodingType,
|
||||
SetLastError(CRYPT_E_ASN1_BADTAG);
|
||||
ret = FALSE;
|
||||
}
|
||||
TRACE("returning %d (%08x)\n", ret, GetLastError());
|
||||
TRACE("returning %d (%08lx)\n", ret, GetLastError());
|
||||
return ret;
|
||||
}
|
||||
|
||||
@@ -1773,7 +1777,7 @@ static BOOL WINAPI CRYPT_AsnDecodeSPCLinkPointer(DWORD dwCertEncodingType,
|
||||
/* Set imageData's pointer if necessary */
|
||||
if (size > sizeof(SPC_LINK))
|
||||
{
|
||||
(*pLink)->u.pwszUrl =
|
||||
(*pLink)->pwszUrl =
|
||||
(LPWSTR)((BYTE *)*pLink + sizeof(SPC_LINK));
|
||||
}
|
||||
ret = CRYPT_AsnDecodeSPCLinkInternal(dwCertEncodingType,
|
||||
@@ -1791,7 +1795,7 @@ BOOL WINAPI WVTAsn1SpcPeImageDataDecode(DWORD dwCertEncodingType,
|
||||
{
|
||||
BOOL ret = FALSE;
|
||||
|
||||
TRACE("%p, %d, %08x, %p, %d\n", pbEncoded, cbEncoded, dwFlags,
|
||||
TRACE("%p, %ld, %08lx, %p, %ld\n", pbEncoded, cbEncoded, dwFlags,
|
||||
pvStructInfo, *pcbStructInfo);
|
||||
|
||||
__TRY
|
||||
@@ -1824,7 +1828,7 @@ static BOOL WINAPI CRYPT_AsnDecodeOidIgnoreTag(DWORD dwCertEncodingType,
|
||||
BOOL ret = TRUE;
|
||||
DWORD dataLen;
|
||||
|
||||
TRACE("%p, %d, %08x, %p, %d\n", pbEncoded, cbEncoded, dwFlags,
|
||||
TRACE("%p, %ld, %08lx, %p, %ld\n", pbEncoded, cbEncoded, dwFlags,
|
||||
pvStructInfo, *pcbStructInfo);
|
||||
|
||||
if ((ret = CRYPT_GetLen(pbEncoded, cbEncoded, &dataLen)))
|
||||
@@ -1874,6 +1878,8 @@ static BOOL WINAPI CRYPT_AsnDecodeOidIgnoreTag(DWORD dwCertEncodingType,
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
bytesNeeded += 1;
|
||||
if (!pvStructInfo)
|
||||
*pcbStructInfo = bytesNeeded;
|
||||
else if (*pcbStructInfo < bytesNeeded)
|
||||
@@ -1884,12 +1890,13 @@ static BOOL WINAPI CRYPT_AsnDecodeOidIgnoreTag(DWORD dwCertEncodingType,
|
||||
}
|
||||
else
|
||||
{
|
||||
LPSTR pszObjId = *(LPSTR *)pvStructInfo;
|
||||
|
||||
*pszObjId = 0;
|
||||
if (dataLen)
|
||||
{
|
||||
const BYTE *ptr;
|
||||
LPSTR pszObjId = *(LPSTR *)pvStructInfo;
|
||||
|
||||
*pszObjId = 0;
|
||||
pszObjId += sprintf(pszObjId, "%d.%d", pbEncoded[1 + lenBytes] / 40,
|
||||
pbEncoded[1 + lenBytes] - (pbEncoded[1 + lenBytes] /
|
||||
40) * 40);
|
||||
@@ -1910,8 +1917,6 @@ static BOOL WINAPI CRYPT_AsnDecodeOidIgnoreTag(DWORD dwCertEncodingType,
|
||||
pszObjId += sprintf(pszObjId, ".%d", val);
|
||||
}
|
||||
}
|
||||
else
|
||||
*(LPSTR *)pvStructInfo = NULL;
|
||||
*pcbStructInfo = bytesNeeded;
|
||||
}
|
||||
}
|
||||
@@ -1924,7 +1929,7 @@ static BOOL WINAPI CRYPT_AsnDecodeOid(DWORD dwCertEncodingType,
|
||||
{
|
||||
BOOL ret = FALSE;
|
||||
|
||||
TRACE("%p, %d, %08x, %p, %d\n", pbEncoded, cbEncoded, dwFlags,
|
||||
TRACE("%p, %ld, %08lx, %p, %ld\n", pbEncoded, cbEncoded, dwFlags,
|
||||
pvStructInfo, *pcbStructInfo);
|
||||
|
||||
if (!cbEncoded)
|
||||
@@ -1944,7 +1949,7 @@ static BOOL WINAPI CRYPT_AsnDecodeCopyBytes(DWORD dwCertEncodingType,
|
||||
BOOL ret = TRUE;
|
||||
DWORD bytesNeeded = sizeof(CRYPT_OBJID_BLOB);
|
||||
|
||||
TRACE("%p, %d, %08x, %p, %d\n", pbEncoded, cbEncoded, dwFlags,
|
||||
TRACE("%p, %ld, %08lx, %p, %ld\n", pbEncoded, cbEncoded, dwFlags,
|
||||
pvStructInfo, *pcbStructInfo);
|
||||
|
||||
if (!(dwFlags & CRYPT_DECODE_NOCOPY_FLAG))
|
||||
@@ -1988,7 +1993,7 @@ static BOOL WINAPI CRYPT_AsnDecodeAttributeTypeValue(DWORD dwCertEncodingType,
|
||||
offsetof(CRYPT_ATTRIBUTE_TYPE_VALUE, Value.pbData), 0 },
|
||||
};
|
||||
|
||||
TRACE("%p, %d, %08x, %p, %d\n", pbEncoded, cbEncoded, dwFlags,
|
||||
TRACE("%p, %ld, %08lx, %p, %ld\n", pbEncoded, cbEncoded, dwFlags,
|
||||
pvStructInfo, *pcbStructInfo);
|
||||
|
||||
return CRYPT_AsnDecodeSequence(dwCertEncodingType, items, ARRAY_SIZE(items),
|
||||
@@ -2011,7 +2016,7 @@ static BOOL WINAPI CRYPT_AsnDecodeAlgorithmId(DWORD dwCertEncodingType,
|
||||
offsetof(CRYPT_ALGORITHM_IDENTIFIER, Parameters.pbData), 0 },
|
||||
};
|
||||
|
||||
TRACE("%p, %d, %08x, %p, %d\n", pbEncoded, cbEncoded, dwFlags,
|
||||
TRACE("%p, %ld, %08lx, %p, %ld\n", pbEncoded, cbEncoded, dwFlags,
|
||||
pvStructInfo, *pcbStructInfo);
|
||||
|
||||
ret = CRYPT_AsnDecodeSequence(dwCertEncodingType, items, ARRAY_SIZE(items),
|
||||
@@ -2039,7 +2044,7 @@ static BOOL WINAPI CRYPT_AsnDecodeSPCDigest(DWORD dwCertEncodingType,
|
||||
FALSE, TRUE, offsetof(struct SPCDigest, Digest.pbData), 0 },
|
||||
};
|
||||
|
||||
TRACE("%p, %d, %08x, %p, %d\n", pbEncoded, cbEncoded, dwFlags,
|
||||
TRACE("%p, %ld, %08lx, %p, %ld\n", pbEncoded, cbEncoded, dwFlags,
|
||||
pvStructInfo, *pcbStructInfo);
|
||||
|
||||
return CRYPT_AsnDecodeSequence(dwCertEncodingType, items, ARRAY_SIZE(items),
|
||||
@@ -2053,7 +2058,7 @@ BOOL WINAPI WVTAsn1SpcIndirectDataContentDecode(DWORD dwCertEncodingType,
|
||||
{
|
||||
BOOL ret = FALSE;
|
||||
|
||||
TRACE("%p, %d, %08x, %p, %d\n", pbEncoded, cbEncoded, dwFlags,
|
||||
TRACE("%p, %ld, %08lx, %p, %ld\n", pbEncoded, cbEncoded, dwFlags,
|
||||
pvStructInfo, *pcbStructInfo);
|
||||
|
||||
__TRY
|
||||
@@ -2126,7 +2131,7 @@ static BOOL WINAPI CRYPT_AsnDecodeProgramName(DWORD dwCertEncodingType,
|
||||
BOOL ret = FALSE;
|
||||
DWORD dataLen;
|
||||
|
||||
TRACE("(%p, %d, %08x, %p, %d)\n", pbEncoded, cbEncoded, dwFlags,
|
||||
TRACE("(%p, %ld, %08lx, %p, %ld)\n", pbEncoded, cbEncoded, dwFlags,
|
||||
pvStructInfo, pvStructInfo ? *pcbStructInfo : 0);
|
||||
|
||||
if ((ret = CRYPT_GetLen(pbEncoded, cbEncoded, &dataLen)))
|
||||
@@ -2146,7 +2151,7 @@ BOOL WINAPI WVTAsn1SpcSpOpusInfoDecode(DWORD dwCertEncodingType,
|
||||
{
|
||||
BOOL ret = FALSE;
|
||||
|
||||
TRACE("%p, %d, %08x, %p, %d\n", pbEncoded, cbEncoded, dwFlags,
|
||||
TRACE("%p, %ld, %08lx, %p, %ld\n", pbEncoded, cbEncoded, dwFlags,
|
||||
pvStructInfo, *pcbStructInfo);
|
||||
|
||||
__TRY
|
||||
@@ -2233,7 +2238,7 @@ BOOL WINAPI WVTAsn1CatMemberInfoDecode(DWORD dwCertEncodingType,
|
||||
{
|
||||
BOOL ret = FALSE;
|
||||
|
||||
TRACE("%p, %d, %08x, %p, %d\n", pbEncoded, cbEncoded, dwFlags,
|
||||
TRACE("%p, %ld, %08lx, %p, %ld\n", pbEncoded, cbEncoded, dwFlags,
|
||||
pvStructInfo, *pcbStructInfo);
|
||||
|
||||
__TRY
|
||||
@@ -2265,7 +2270,7 @@ BOOL WINAPI WVTAsn1CatNameValueDecode(DWORD dwCertEncodingType,
|
||||
{
|
||||
BOOL ret = FALSE;
|
||||
|
||||
TRACE("%p, %d, %08x, %p, %d\n", pbEncoded, cbEncoded, dwFlags,
|
||||
TRACE("%p, %ld, %08lx, %p, %ld\n", pbEncoded, cbEncoded, dwFlags,
|
||||
pvStructInfo, *pcbStructInfo);
|
||||
|
||||
__TRY
|
||||
@@ -2332,7 +2337,7 @@ static BOOL WINAPI CRYPT_AsnDecodeBool(DWORD dwCertEncodingType,
|
||||
*(BOOL *)pvStructInfo = pbEncoded[2] != 0;
|
||||
ret = TRUE;
|
||||
}
|
||||
TRACE("returning %d (%08x)\n", ret, GetLastError());
|
||||
TRACE("returning %d (%08lx)\n", ret, GetLastError());
|
||||
return ret;
|
||||
}
|
||||
|
||||
@@ -2342,7 +2347,7 @@ BOOL WINAPI WVTAsn1SpcFinancialCriteriaInfoDecode(DWORD dwCertEncodingType,
|
||||
{
|
||||
BOOL ret = FALSE;
|
||||
|
||||
TRACE("(%p, %d, %08x, %p, %d)\n", pbEncoded, cbEncoded, dwFlags,
|
||||
TRACE("(%p, %ld, %08lx, %p, %ld)\n", pbEncoded, cbEncoded, dwFlags,
|
||||
pvStructInfo, *pcbStructInfo);
|
||||
|
||||
__TRY
|
||||
|
||||
@@ -27,6 +27,7 @@
|
||||
#include "windef.h"
|
||||
#include "winbase.h"
|
||||
#include "wintrust.h"
|
||||
#include "winver.h"
|
||||
#include "mscat.h"
|
||||
#include "mssip.h"
|
||||
#include "imagehlp.h"
|
||||
@@ -57,6 +58,9 @@ struct catadmin
|
||||
DWORD magic;
|
||||
WCHAR path[MAX_PATH];
|
||||
HANDLE find;
|
||||
ALG_ID alg;
|
||||
const WCHAR *providerName;
|
||||
DWORD providerType;
|
||||
};
|
||||
|
||||
struct catinfo
|
||||
@@ -69,7 +73,7 @@ static HCATINFO create_catinfo(const WCHAR *filename)
|
||||
{
|
||||
struct catinfo *ci;
|
||||
|
||||
if (!(ci = HeapAlloc(GetProcessHeap(), 0, sizeof(*ci))))
|
||||
if (!(ci = malloc(sizeof(*ci))))
|
||||
{
|
||||
SetLastError(ERROR_OUTOFMEMORY);
|
||||
return INVALID_HANDLE_VALUE;
|
||||
@@ -96,6 +100,29 @@ static HCATINFO create_catinfo(const WCHAR *filename)
|
||||
*/
|
||||
BOOL WINAPI CryptCATAdminAcquireContext(HCATADMIN *catAdmin,
|
||||
const GUID *sys, DWORD dwFlags)
|
||||
{
|
||||
TRACE("%p %s %lx\n", catAdmin, debugstr_guid(sys), dwFlags);
|
||||
return CryptCATAdminAcquireContext2(catAdmin, sys, NULL, NULL, dwFlags);
|
||||
}
|
||||
|
||||
/***********************************************************************
|
||||
* CryptCATAdminAcquireContext2 (WINTRUST.@)
|
||||
* Get a catalog administrator context handle.
|
||||
*
|
||||
* PARAMS
|
||||
* catAdmin [O] Pointer to the context handle.
|
||||
* sys [I] Pointer to a GUID for the needed subsystem.
|
||||
* algorithm [I] String of hashing algorithm to use for catalog (SHA1/SHA256).
|
||||
* policy [I] Pointer to policy structure for checking strong signatures.
|
||||
* dwFlags [I] Reserved.
|
||||
*
|
||||
* RETURNS
|
||||
* Success: TRUE. catAdmin contains the context handle.
|
||||
* Failure: FALSE.
|
||||
*
|
||||
*/
|
||||
BOOL WINAPI CryptCATAdminAcquireContext2(HCATADMIN *catAdmin, const GUID *sys, const WCHAR *algorithm,
|
||||
const CERT_STRONG_SIGN_PARA *policy, DWORD dwFlags)
|
||||
{
|
||||
static const WCHAR catroot[] =
|
||||
{'\\','c','a','t','r','o','o','t',0};
|
||||
@@ -109,20 +136,49 @@ BOOL WINAPI CryptCATAdminAcquireContext(HCATADMIN *catAdmin,
|
||||
|
||||
WCHAR catroot_dir[MAX_PATH];
|
||||
struct catadmin *ca;
|
||||
ALG_ID alg;
|
||||
const WCHAR *providerName;
|
||||
DWORD providerType;
|
||||
|
||||
TRACE("%p %s %x\n", catAdmin, debugstr_guid(sys), dwFlags);
|
||||
TRACE("%p %s %s %p %lx\n", catAdmin, debugstr_guid(sys), debugstr_w(algorithm), policy, dwFlags);
|
||||
|
||||
if (!catAdmin || dwFlags)
|
||||
{
|
||||
SetLastError(ERROR_INVALID_PARAMETER);
|
||||
return FALSE;
|
||||
}
|
||||
if (!(ca = HeapAlloc(GetProcessHeap(), 0, sizeof(*ca))))
|
||||
|
||||
if (policy != NULL)
|
||||
FIXME("strong policy parameter is unimplemented\n");
|
||||
|
||||
if (algorithm == NULL || wcscmp(algorithm, BCRYPT_SHA1_ALGORITHM) == 0)
|
||||
{
|
||||
alg = CALG_SHA1;
|
||||
providerName = MS_DEF_PROV_W;
|
||||
providerType = PROV_RSA_FULL;
|
||||
}
|
||||
else if (wcscmp(algorithm, BCRYPT_SHA256_ALGORITHM) == 0)
|
||||
{
|
||||
alg = CALG_SHA_256;
|
||||
providerName = MS_ENH_RSA_AES_PROV_W;
|
||||
providerType = PROV_RSA_AES;
|
||||
}
|
||||
else
|
||||
{
|
||||
SetLastError(NTE_BAD_ALGID);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
if (!(ca = malloc(sizeof(*ca))))
|
||||
{
|
||||
SetLastError(ERROR_OUTOFMEMORY);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
ca->alg = alg;
|
||||
ca->providerName = providerName;
|
||||
ca->providerType = providerType;
|
||||
|
||||
GetSystemDirectoryW(catroot_dir, MAX_PATH);
|
||||
lstrcatW(catroot_dir, catroot);
|
||||
|
||||
@@ -130,7 +186,7 @@ BOOL WINAPI CryptCATAdminAcquireContext(HCATADMIN *catAdmin,
|
||||
CreateDirectoryW(catroot_dir, NULL);
|
||||
|
||||
if (!sys) sys = &defsys;
|
||||
swprintf(ca->path, fmt, catroot_dir, sys->Data1, sys->Data2,
|
||||
swprintf(ca->path, ARRAY_SIZE(ca->path), fmt, catroot_dir, sys->Data1, sys->Data2,
|
||||
sys->Data3, sys->Data4[0], sys->Data4[1], sys->Data4[2],
|
||||
sys->Data4[3], sys->Data4[4], sys->Data4[5], sys->Data4[6],
|
||||
sys->Data4[7]);
|
||||
@@ -145,17 +201,6 @@ BOOL WINAPI CryptCATAdminAcquireContext(HCATADMIN *catAdmin,
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
/***********************************************************************
|
||||
* CryptCATAdminAcquireContext2 (WINTRUST.@)
|
||||
*/
|
||||
BOOL WINAPI CryptCATAdminAcquireContext2(HCATADMIN *catAdmin, const GUID *sys, const WCHAR *algorithm,
|
||||
const CERT_STRONG_SIGN_PARA *policy, DWORD flags)
|
||||
{
|
||||
FIXME("%p %s %s %p %x stub\n", catAdmin, debugstr_guid(sys), debugstr_w(algorithm), policy, flags);
|
||||
SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
/***********************************************************************
|
||||
* CryptCATAdminAddCatalog (WINTRUST.@)
|
||||
*/
|
||||
@@ -168,7 +213,7 @@ HCATINFO WINAPI CryptCATAdminAddCatalog(HCATADMIN catAdmin, PWSTR catalogFile,
|
||||
WCHAR *target;
|
||||
DWORD len;
|
||||
|
||||
TRACE("%p %s %s %d\n", catAdmin, debugstr_w(catalogFile),
|
||||
TRACE("%p %s %s %ld\n", catAdmin, debugstr_w(catalogFile),
|
||||
debugstr_w(selectBaseName), flags);
|
||||
|
||||
if (!selectBaseName)
|
||||
@@ -184,7 +229,7 @@ HCATINFO WINAPI CryptCATAdminAddCatalog(HCATADMIN catAdmin, PWSTR catalogFile,
|
||||
}
|
||||
|
||||
len = lstrlenW(ca->path) + lstrlenW(selectBaseName) + 2;
|
||||
if (!(target = HeapAlloc(GetProcessHeap(), 0, len * sizeof(WCHAR))))
|
||||
if (!(target = malloc(len * sizeof(WCHAR))))
|
||||
{
|
||||
SetLastError(ERROR_OUTOFMEMORY);
|
||||
return NULL;
|
||||
@@ -195,47 +240,142 @@ HCATINFO WINAPI CryptCATAdminAddCatalog(HCATADMIN catAdmin, PWSTR catalogFile,
|
||||
|
||||
if (!CopyFileW(catalogFile, target, FALSE))
|
||||
{
|
||||
HeapFree(GetProcessHeap(), 0, target);
|
||||
free(target);
|
||||
return NULL;
|
||||
}
|
||||
SetFileAttributesW(target, FILE_ATTRIBUTE_SYSTEM);
|
||||
|
||||
if (!(ci = HeapAlloc(GetProcessHeap(), 0, sizeof(*ci))))
|
||||
if (!(ci = malloc(sizeof(*ci))))
|
||||
{
|
||||
HeapFree(GetProcessHeap(), 0, target);
|
||||
free(target);
|
||||
SetLastError(ERROR_OUTOFMEMORY);
|
||||
return NULL;
|
||||
}
|
||||
ci->magic = CATINFO_MAGIC;
|
||||
lstrcpyW(ci->file, target);
|
||||
|
||||
HeapFree(GetProcessHeap(), 0, target);
|
||||
free(target);
|
||||
return ci;
|
||||
}
|
||||
|
||||
/***********************************************************************
|
||||
* CryptCATAdminCalcHashFromFileHandle (WINTRUST.@)
|
||||
*/
|
||||
BOOL WINAPI CryptCATAdminCalcHashFromFileHandle(HANDLE hFile, DWORD* pcbHash,
|
||||
BYTE* pbHash, DWORD dwFlags )
|
||||
static BOOL pe_image_hash( HANDLE file, HCRYPTHASH hash )
|
||||
{
|
||||
UINT32 size, offset, file_size, sig_pos;
|
||||
HANDLE mapping;
|
||||
BYTE *view;
|
||||
IMAGE_NT_HEADERS *nt;
|
||||
BOOL ret = FALSE;
|
||||
|
||||
TRACE("%p %p %p %x\n", hFile, pcbHash, pbHash, dwFlags);
|
||||
if ((file_size = GetFileSize( file, NULL )) == INVALID_FILE_SIZE) return FALSE;
|
||||
|
||||
if ((mapping = CreateFileMappingW( file, NULL, PAGE_READONLY, 0, 0, NULL )) == INVALID_HANDLE_VALUE)
|
||||
return FALSE;
|
||||
|
||||
if (!(view = MapViewOfFile( mapping, FILE_MAP_READ, 0, 0, 0 )) || !(nt = ImageNtHeader( view ))) goto done;
|
||||
|
||||
if (nt->OptionalHeader.Magic == IMAGE_NT_OPTIONAL_HDR64_MAGIC)
|
||||
{
|
||||
const IMAGE_NT_HEADERS64 *nt64 = (const IMAGE_NT_HEADERS64 *)nt;
|
||||
|
||||
/* offset from start of file to checksum */
|
||||
offset = (BYTE *)&nt64->OptionalHeader.CheckSum - view;
|
||||
|
||||
/* area between checksum and security directory entry */
|
||||
size = FIELD_OFFSET( IMAGE_OPTIONAL_HEADER64, DataDirectory[IMAGE_DIRECTORY_ENTRY_SECURITY] ) -
|
||||
FIELD_OFFSET( IMAGE_OPTIONAL_HEADER64, Subsystem );
|
||||
|
||||
if (nt64->OptionalHeader.NumberOfRvaAndSizes < IMAGE_FILE_SECURITY_DIRECTORY + 1) goto done;
|
||||
sig_pos = nt64->OptionalHeader.DataDirectory[IMAGE_FILE_SECURITY_DIRECTORY].VirtualAddress;
|
||||
}
|
||||
else if (nt->OptionalHeader.Magic == IMAGE_NT_OPTIONAL_HDR32_MAGIC)
|
||||
{
|
||||
const IMAGE_NT_HEADERS32 *nt32 = (const IMAGE_NT_HEADERS32 *)nt;
|
||||
|
||||
/* offset from start of file to checksum */
|
||||
offset = (BYTE *)&nt32->OptionalHeader.CheckSum - view;
|
||||
|
||||
/* area between checksum and security directory entry */
|
||||
size = FIELD_OFFSET( IMAGE_OPTIONAL_HEADER32, DataDirectory[IMAGE_DIRECTORY_ENTRY_SECURITY] ) -
|
||||
FIELD_OFFSET( IMAGE_OPTIONAL_HEADER32, Subsystem );
|
||||
|
||||
if (nt32->OptionalHeader.NumberOfRvaAndSizes < IMAGE_FILE_SECURITY_DIRECTORY + 1) goto done;
|
||||
sig_pos = nt32->OptionalHeader.DataDirectory[IMAGE_FILE_SECURITY_DIRECTORY].VirtualAddress;
|
||||
}
|
||||
else goto done;
|
||||
|
||||
if (!CryptHashData( hash, view, offset, 0 )) goto done;
|
||||
offset += sizeof(DWORD); /* skip checksum */
|
||||
if (!CryptHashData( hash, view + offset, size, 0 )) goto done;
|
||||
|
||||
offset += size + sizeof(IMAGE_DATA_DIRECTORY); /* skip security entry */
|
||||
if (offset > file_size) goto done;
|
||||
if (sig_pos)
|
||||
{
|
||||
if (sig_pos < offset) goto done;
|
||||
if (sig_pos > file_size) goto done;
|
||||
size = sig_pos - offset; /* exclude signature */
|
||||
}
|
||||
else size = file_size - offset;
|
||||
|
||||
if (!CryptHashData( hash, view + offset, size, 0 )) goto done;
|
||||
ret = TRUE;
|
||||
|
||||
if (!sig_pos && (size = file_size % 8))
|
||||
{
|
||||
static const BYTE pad[7];
|
||||
ret = CryptHashData( hash, pad, 8 - size, 0 );
|
||||
}
|
||||
|
||||
done:
|
||||
UnmapViewOfFile( view );
|
||||
CloseHandle( mapping );
|
||||
return ret;
|
||||
}
|
||||
|
||||
static BOOL catadmin_calc_hash_from_filehandle(HCATADMIN catAdmin, HANDLE hFile, DWORD *pcbHash,
|
||||
BYTE *pbHash, DWORD dwFlags)
|
||||
{
|
||||
BOOL ret = FALSE;
|
||||
struct catadmin *ca = catAdmin;
|
||||
ALG_ID alg = CALG_SHA1;
|
||||
const WCHAR *providerName = MS_DEF_PROV_W;
|
||||
DWORD providerType = PROV_RSA_FULL;
|
||||
DWORD hashLength;
|
||||
|
||||
if (!hFile || !pcbHash || dwFlags)
|
||||
{
|
||||
SetLastError(ERROR_INVALID_PARAMETER);
|
||||
return FALSE;
|
||||
}
|
||||
if (*pcbHash < 20)
|
||||
|
||||
if (ca)
|
||||
{
|
||||
*pcbHash = 20;
|
||||
alg = ca->alg;
|
||||
providerName = ca->providerName;
|
||||
providerType = ca->providerType;
|
||||
}
|
||||
|
||||
switch (alg)
|
||||
{
|
||||
case CALG_SHA1:
|
||||
hashLength = 20;
|
||||
break;
|
||||
case CALG_SHA_256:
|
||||
hashLength = 32;
|
||||
break;
|
||||
default:
|
||||
FIXME("unsupported algorithm %x\n", alg);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
if (*pcbHash < hashLength)
|
||||
{
|
||||
*pcbHash = hashLength;
|
||||
SetLastError(ERROR_INSUFFICIENT_BUFFER);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
*pcbHash = 20;
|
||||
*pcbHash = hashLength;
|
||||
if (pbHash)
|
||||
{
|
||||
HCRYPTPROV prov;
|
||||
@@ -243,37 +383,83 @@ BOOL WINAPI CryptCATAdminCalcHashFromFileHandle(HANDLE hFile, DWORD* pcbHash,
|
||||
DWORD bytes_read;
|
||||
BYTE *buffer;
|
||||
|
||||
if (!(buffer = HeapAlloc(GetProcessHeap(), 0, 4096)))
|
||||
if (!(buffer = malloc(4096)))
|
||||
{
|
||||
SetLastError(ERROR_OUTOFMEMORY);
|
||||
return FALSE;
|
||||
}
|
||||
ret = CryptAcquireContextW(&prov, NULL, MS_DEF_PROV_W, PROV_RSA_FULL, CRYPT_VERIFYCONTEXT);
|
||||
ret = CryptAcquireContextW(&prov, NULL, providerName, providerType, CRYPT_VERIFYCONTEXT);
|
||||
if (!ret)
|
||||
{
|
||||
HeapFree(GetProcessHeap(), 0, buffer);
|
||||
free(buffer);
|
||||
return FALSE;
|
||||
}
|
||||
ret = CryptCreateHash(prov, CALG_SHA1, 0, 0, &hash);
|
||||
ret = CryptCreateHash(prov, alg, 0, 0, &hash);
|
||||
if (!ret)
|
||||
{
|
||||
HeapFree(GetProcessHeap(), 0, buffer);
|
||||
free(buffer);
|
||||
CryptReleaseContext(prov, 0);
|
||||
return FALSE;
|
||||
}
|
||||
while ((ret = ReadFile(hFile, buffer, 4096, &bytes_read, NULL)) && bytes_read)
|
||||
|
||||
if (!(ret = pe_image_hash(hFile, hash)))
|
||||
{
|
||||
CryptHashData(hash, buffer, bytes_read, 0);
|
||||
while ((ret = ReadFile(hFile, buffer, 4096, &bytes_read, NULL)) && bytes_read)
|
||||
{
|
||||
CryptHashData(hash, buffer, bytes_read, 0);
|
||||
}
|
||||
}
|
||||
if (ret) ret = CryptGetHashParam(hash, HP_HASHVAL, pbHash, pcbHash, 0);
|
||||
|
||||
HeapFree(GetProcessHeap(), 0, buffer);
|
||||
free(buffer);
|
||||
CryptDestroyHash(hash);
|
||||
CryptReleaseContext(prov, 0);
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
/***********************************************************************
|
||||
* CryptCATAdminCalcHashFromFileHandle (WINTRUST.@)
|
||||
*/
|
||||
BOOL WINAPI CryptCATAdminCalcHashFromFileHandle(HANDLE hFile, DWORD *pcbHash, BYTE *pbHash, DWORD dwFlags)
|
||||
{
|
||||
TRACE("%p %p %p %lx\n", hFile, pcbHash, pbHash, dwFlags);
|
||||
return catadmin_calc_hash_from_filehandle(NULL, hFile, pcbHash, pbHash, dwFlags);
|
||||
}
|
||||
|
||||
/***********************************************************************
|
||||
* CryptCATAdminCalcHashFromFileHandle2 (WINTRUST.@)
|
||||
*
|
||||
* Calculate hash for a specific file using a catalog administrator context.
|
||||
*
|
||||
* PARAMS
|
||||
* catAdmin [I] Catalog administrator context handle.
|
||||
* hFile [I] Handle for the file to hash.
|
||||
* pcbHash [I] Pointer to the length of the hash.
|
||||
* pbHash [O] Pointer to the buffer that will store that hash
|
||||
* dwFlags [I] Reserved.
|
||||
*
|
||||
* RETURNS
|
||||
* Success: TRUE. If pcbHash is too small, LastError will be set to ERROR_INSUFFICIENT_BUFFER.
|
||||
* pbHash contains the computed hash, if supplied.
|
||||
* Failure: FALSE.
|
||||
*
|
||||
*/
|
||||
BOOL WINAPI CryptCATAdminCalcHashFromFileHandle2(HCATADMIN catAdmin, HANDLE hFile, DWORD *pcbHash,
|
||||
BYTE *pbHash, DWORD dwFlags)
|
||||
{
|
||||
TRACE("%p %p %p %p %lx\n", catAdmin, hFile, pcbHash, pbHash, dwFlags);
|
||||
|
||||
if (!catAdmin || ((struct catadmin *)catAdmin)->magic != CATADMIN_MAGIC)
|
||||
{
|
||||
SetLastError(ERROR_INVALID_PARAMETER);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
return catadmin_calc_hash_from_filehandle(catAdmin, hFile, pcbHash, pbHash, dwFlags);
|
||||
}
|
||||
|
||||
|
||||
/***********************************************************************
|
||||
* CryptCATAdminEnumCatalogFromHash (WINTRUST.@)
|
||||
*/
|
||||
@@ -291,7 +477,7 @@ HCATINFO WINAPI CryptCATAdminEnumCatalogFromHash(HCATADMIN hCatAdmin, BYTE* pbHa
|
||||
DWORD size;
|
||||
BOOL ret;
|
||||
|
||||
TRACE("%p %p %d %x %p\n", hCatAdmin, pbHash, cbHash, dwFlags, phPrevCatInfo);
|
||||
TRACE("%p %p %ld %lx %p\n", hCatAdmin, pbHash, cbHash, dwFlags, phPrevCatInfo);
|
||||
|
||||
if (!ca || ca->magic != CATADMIN_MAGIC || !pbHash || cbHash != 20 || dwFlags)
|
||||
{
|
||||
@@ -308,7 +494,7 @@ HCATINFO WINAPI CryptCATAdminEnumCatalogFromHash(HCATADMIN hCatAdmin, BYTE* pbHa
|
||||
WCHAR *path;
|
||||
|
||||
size = lstrlenW(ca->path) * sizeof(WCHAR) + sizeof(globW);
|
||||
if (!(path = HeapAlloc(GetProcessHeap(), 0, size)))
|
||||
if (!(path = malloc(size)))
|
||||
{
|
||||
CryptReleaseContext(prov, 0);
|
||||
SetLastError(ERROR_OUTOFMEMORY);
|
||||
@@ -320,7 +506,7 @@ HCATINFO WINAPI CryptCATAdminEnumCatalogFromHash(HCATADMIN hCatAdmin, BYTE* pbHa
|
||||
FindClose(ca->find);
|
||||
ca->find = FindFirstFileW(path, &data);
|
||||
|
||||
HeapFree(GetProcessHeap(), 0, path);
|
||||
free(path);
|
||||
if (ca->find == INVALID_HANDLE_VALUE)
|
||||
{
|
||||
CryptReleaseContext(prov, 0);
|
||||
@@ -342,7 +528,7 @@ HCATINFO WINAPI CryptCATAdminEnumCatalogFromHash(HCATADMIN hCatAdmin, BYTE* pbHa
|
||||
HANDLE hcat;
|
||||
|
||||
size = (lstrlenW(ca->path) + lstrlenW(data.cFileName) + 2) * sizeof(WCHAR);
|
||||
if (!(filename = HeapAlloc(GetProcessHeap(), 0, size)))
|
||||
if (!(filename = malloc(size)))
|
||||
{
|
||||
SetLastError(ERROR_OUTOFMEMORY);
|
||||
return NULL;
|
||||
@@ -354,14 +540,14 @@ HCATINFO WINAPI CryptCATAdminEnumCatalogFromHash(HCATADMIN hCatAdmin, BYTE* pbHa
|
||||
hcat = CryptCATOpen(filename, CRYPTCAT_OPEN_EXISTING, prov, 0, 0);
|
||||
if (hcat == INVALID_HANDLE_VALUE)
|
||||
{
|
||||
WARN("couldn't open %s (%u)\n", debugstr_w(filename), GetLastError());
|
||||
WARN("couldn't open %s (%lu)\n", debugstr_w(filename), GetLastError());
|
||||
continue;
|
||||
}
|
||||
while ((member = CryptCATEnumerateMember(hcat, member)))
|
||||
{
|
||||
if (member->pIndirectData->Digest.cbData != cbHash)
|
||||
{
|
||||
WARN("amount of hash bytes differs: %u/%u\n", member->pIndirectData->Digest.cbData, cbHash);
|
||||
WARN("amount of hash bytes differs: %lu/%lu\n", member->pIndirectData->Digest.cbData, cbHash);
|
||||
continue;
|
||||
}
|
||||
if (!memcmp(member->pIndirectData->Digest.pbData, pbHash, cbHash))
|
||||
@@ -376,12 +562,12 @@ HCATINFO WINAPI CryptCATAdminEnumCatalogFromHash(HCATADMIN hCatAdmin, BYTE* pbHa
|
||||
ca->find = INVALID_HANDLE_VALUE;
|
||||
}
|
||||
ci = create_catinfo(filename);
|
||||
HeapFree(GetProcessHeap(), 0, filename);
|
||||
free(filename);
|
||||
return ci;
|
||||
}
|
||||
}
|
||||
CryptCATClose(hcat);
|
||||
HeapFree(GetProcessHeap(), 0, filename);
|
||||
free(filename);
|
||||
|
||||
if (!FindNextFileW(ca->find, &data))
|
||||
{
|
||||
@@ -416,15 +602,17 @@ BOOL WINAPI CryptCATAdminReleaseCatalogContext(HCATADMIN hCatAdmin,
|
||||
struct catinfo *ci = hCatInfo;
|
||||
struct catadmin *ca = hCatAdmin;
|
||||
|
||||
TRACE("%p %p %x\n", hCatAdmin, hCatInfo, dwFlags);
|
||||
TRACE("%p %p %lx\n", hCatAdmin, hCatInfo, dwFlags);
|
||||
|
||||
if (!ca || ca->magic != CATADMIN_MAGIC || !ci || ci->magic != CATINFO_MAGIC)
|
||||
{
|
||||
SetLastError(ERROR_INVALID_PARAMETER);
|
||||
return FALSE;
|
||||
}
|
||||
ci->magic = 0;
|
||||
return HeapFree(GetProcessHeap(), 0, ci);
|
||||
/* Ensure compiler doesn't optimize out the assignment with 0. */
|
||||
SecureZeroMemory(&ci->magic, sizeof(ci->magic));
|
||||
free(ci);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
/***********************************************************************
|
||||
@@ -445,7 +633,7 @@ BOOL WINAPI CryptCATAdminReleaseContext(HCATADMIN hCatAdmin, DWORD dwFlags )
|
||||
{
|
||||
struct catadmin *ca = hCatAdmin;
|
||||
|
||||
TRACE("%p %x\n", hCatAdmin, dwFlags);
|
||||
TRACE("%p %lx\n", hCatAdmin, dwFlags);
|
||||
|
||||
if (!ca || ca->magic != CATADMIN_MAGIC)
|
||||
{
|
||||
@@ -453,8 +641,10 @@ BOOL WINAPI CryptCATAdminReleaseContext(HCATADMIN hCatAdmin, DWORD dwFlags )
|
||||
return FALSE;
|
||||
}
|
||||
if (ca->find != INVALID_HANDLE_VALUE) FindClose(ca->find);
|
||||
ca->magic = 0;
|
||||
return HeapFree(GetProcessHeap(), 0, ca);
|
||||
/* Ensure compiler doesn't optimize out the assignment with 0. */
|
||||
SecureZeroMemory(&ca->magic, sizeof(ca->magic));
|
||||
free(ca);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
/***********************************************************************
|
||||
@@ -476,7 +666,7 @@ BOOL WINAPI CryptCATAdminRemoveCatalog(HCATADMIN hCatAdmin, LPCWSTR pwszCatalogF
|
||||
{
|
||||
struct catadmin *ca = hCatAdmin;
|
||||
|
||||
TRACE("%p %s %x\n", hCatAdmin, debugstr_w(pwszCatalogFile), dwFlags);
|
||||
TRACE("%p %s %lx\n", hCatAdmin, debugstr_w(pwszCatalogFile), dwFlags);
|
||||
|
||||
if (!ca || ca->magic != CATADMIN_MAGIC)
|
||||
{
|
||||
@@ -494,7 +684,7 @@ BOOL WINAPI CryptCATAdminRemoveCatalog(HCATADMIN hCatAdmin, LPCWSTR pwszCatalogF
|
||||
DWORD len;
|
||||
|
||||
len = lstrlenW(ca->path) + lstrlenW(pwszCatalogFile) + 2;
|
||||
if (!(target = HeapAlloc(GetProcessHeap(), 0, len * sizeof(WCHAR))))
|
||||
if (!(target = malloc(len * sizeof(WCHAR))))
|
||||
{
|
||||
SetLastError(ERROR_OUTOFMEMORY);
|
||||
return FALSE;
|
||||
@@ -505,7 +695,7 @@ BOOL WINAPI CryptCATAdminRemoveCatalog(HCATADMIN hCatAdmin, LPCWSTR pwszCatalogF
|
||||
|
||||
DeleteFileW(target);
|
||||
|
||||
HeapFree(GetProcessHeap(), 0, target);
|
||||
free(target);
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
@@ -520,7 +710,7 @@ BOOL WINAPI CryptCATAdminResolveCatalogPath(HCATADMIN hcatadmin, WCHAR *catalog_
|
||||
static const WCHAR slashW[] = {'\\',0};
|
||||
struct catadmin *ca = hcatadmin;
|
||||
|
||||
TRACE("%p %s %p %x\n", hcatadmin, debugstr_w(catalog_file), info, flags);
|
||||
TRACE("%p %s %p %lx\n", hcatadmin, debugstr_w(catalog_file), info, flags);
|
||||
|
||||
if (!ca || ca->magic != CATADMIN_MAGIC || !info || info->cbStruct != sizeof(*info) || flags)
|
||||
{
|
||||
@@ -548,12 +738,13 @@ BOOL WINAPI CryptCATClose(HANDLE hCatalog)
|
||||
SetLastError(ERROR_INVALID_PARAMETER);
|
||||
return FALSE;
|
||||
}
|
||||
HeapFree(GetProcessHeap(), 0, cc->attr);
|
||||
HeapFree(GetProcessHeap(), 0, cc->inner);
|
||||
free(cc->attr);
|
||||
free(cc->inner);
|
||||
CryptMsgClose(cc->msg);
|
||||
|
||||
cc->magic = 0;
|
||||
HeapFree(GetProcessHeap(), 0, cc);
|
||||
/* Ensure compiler doesn't optimize out the assignment with 0. */
|
||||
SecureZeroMemory(&cc->magic, sizeof(cc->magic));
|
||||
free(cc);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
@@ -665,7 +856,7 @@ CRYPTCATMEMBER * WINAPI CryptCATEnumerateMember(HANDLE hCatalog, CRYPTCATMEMBER
|
||||
/* dumping the contents makes me think that dwReserved is the iteration number */
|
||||
if (!member)
|
||||
{
|
||||
if (!(member = HeapAlloc(GetProcessHeap(), 0, sizeof(*member))))
|
||||
if (!(member = malloc(sizeof(*member))))
|
||||
{
|
||||
SetLastError(ERROR_OUTOFMEMORY);
|
||||
return NULL;
|
||||
@@ -692,7 +883,7 @@ CRYPTCATMEMBER * WINAPI CryptCATEnumerateMember(HANDLE hCatalog, CRYPTCATMEMBER
|
||||
|
||||
member->sEncodedIndirectData.cbData = member->sEncodedMemberInfo.cbData = 0;
|
||||
member->sEncodedIndirectData.pbData = member->sEncodedMemberInfo.pbData = NULL;
|
||||
HeapFree(GetProcessHeap(), 0, member->pIndirectData);
|
||||
free(member->pIndirectData);
|
||||
member->pIndirectData = NULL;
|
||||
|
||||
for (i = 0; i < entry->cAttribute; i++)
|
||||
@@ -701,7 +892,7 @@ CRYPTCATMEMBER * WINAPI CryptCATEnumerateMember(HANDLE hCatalog, CRYPTCATMEMBER
|
||||
|
||||
if (attr->cValue != 1)
|
||||
{
|
||||
ERR("Can't handle attr->cValue of %u\n", attr->cValue);
|
||||
ERR("Can't handle attr->cValue of %lu\n", attr->cValue);
|
||||
continue;
|
||||
}
|
||||
if (!strcmp(attr->pszObjId, CAT_MEMBERINFO_OBJID))
|
||||
@@ -714,7 +905,7 @@ CRYPTCATMEMBER * WINAPI CryptCATEnumerateMember(HANDLE hCatalog, CRYPTCATMEMBER
|
||||
|
||||
CryptDecodeObject(cc->encoding, CAT_MEMBERINFO_OBJID, attr->rgValue->pbData, attr->rgValue->cbData, 0, NULL, &size);
|
||||
|
||||
if (!(mi = HeapAlloc(GetProcessHeap(), 0, size)))
|
||||
if (!(mi = malloc(size)))
|
||||
{
|
||||
SetLastError(ERROR_OUTOFMEMORY);
|
||||
goto error;
|
||||
@@ -728,11 +919,11 @@ CRYPTCATMEMBER * WINAPI CryptCATEnumerateMember(HANDLE hCatalog, CRYPTCATMEMBER
|
||||
RtlInitUnicodeString(&guid, mi->pwszSubjGuid);
|
||||
if (RtlGUIDFromString(&guid, &member->gSubjectType))
|
||||
{
|
||||
HeapFree(GetProcessHeap(), 0, mi);
|
||||
free(mi);
|
||||
goto error;
|
||||
}
|
||||
}
|
||||
HeapFree(GetProcessHeap(), 0, mi);
|
||||
free(mi);
|
||||
if (!ret) goto error;
|
||||
}
|
||||
else if (!strcmp(attr->pszObjId, SPC_INDIRECT_DATA_OBJID))
|
||||
@@ -744,7 +935,7 @@ CRYPTCATMEMBER * WINAPI CryptCATEnumerateMember(HANDLE hCatalog, CRYPTCATMEMBER
|
||||
|
||||
CryptDecodeObject(cc->encoding, SPC_INDIRECT_DATA_OBJID, attr->rgValue->pbData, attr->rgValue->cbData, 0, NULL, &size);
|
||||
|
||||
if (!(member->pIndirectData = HeapAlloc(GetProcessHeap(), 0, size)))
|
||||
if (!(member->pIndirectData = malloc(size)))
|
||||
{
|
||||
SetLastError(ERROR_OUTOFMEMORY);
|
||||
goto error;
|
||||
@@ -763,10 +954,7 @@ CRYPTCATMEMBER * WINAPI CryptCATEnumerateMember(HANDLE hCatalog, CRYPTCATMEMBER
|
||||
goto error;
|
||||
}
|
||||
size = (2 * member->pIndirectData->Digest.cbData + 1) * sizeof(WCHAR);
|
||||
if (member->pwszReferenceTag)
|
||||
member->pwszReferenceTag = HeapReAlloc(GetProcessHeap(), 0, member->pwszReferenceTag, size);
|
||||
else
|
||||
member->pwszReferenceTag = HeapAlloc(GetProcessHeap(), 0, size);
|
||||
member->pwszReferenceTag = realloc(member->pwszReferenceTag, size);
|
||||
|
||||
if (!member->pwszReferenceTag)
|
||||
{
|
||||
@@ -787,9 +975,9 @@ CRYPTCATMEMBER * WINAPI CryptCATEnumerateMember(HANDLE hCatalog, CRYPTCATMEMBER
|
||||
return member;
|
||||
|
||||
error:
|
||||
HeapFree(GetProcessHeap(), 0, member->pIndirectData);
|
||||
HeapFree(GetProcessHeap(), 0, member->pwszReferenceTag);
|
||||
HeapFree(GetProcessHeap(), 0, member);
|
||||
free(member->pIndirectData);
|
||||
free(member->pwszReferenceTag);
|
||||
free(member);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
@@ -801,21 +989,21 @@ static CTL_INFO *decode_inner_content(HANDLE hmsg, DWORD encoding, DWORD *len)
|
||||
CTL_INFO *inner = NULL;
|
||||
|
||||
if (!CryptMsgGetParam(hmsg, CMSG_INNER_CONTENT_TYPE_PARAM, 0, NULL, &size)) return NULL;
|
||||
if (!(oid = HeapAlloc(GetProcessHeap(), 0, size)))
|
||||
if (!(oid = malloc(size)))
|
||||
{
|
||||
SetLastError(ERROR_OUTOFMEMORY);
|
||||
return NULL;
|
||||
}
|
||||
if (!CryptMsgGetParam(hmsg, CMSG_INNER_CONTENT_TYPE_PARAM, 0, oid, &size)) goto out;
|
||||
if (!CryptMsgGetParam(hmsg, CMSG_CONTENT_PARAM, 0, NULL, &size)) goto out;
|
||||
if (!(buffer = HeapAlloc(GetProcessHeap(), 0, size)))
|
||||
if (!(buffer = malloc(size)))
|
||||
{
|
||||
SetLastError(ERROR_OUTOFMEMORY);
|
||||
goto out;
|
||||
}
|
||||
if (!CryptMsgGetParam(hmsg, CMSG_CONTENT_PARAM, 0, buffer, &size)) goto out;
|
||||
if (!CryptDecodeObject(encoding, oid, buffer, size, 0, NULL, &size)) goto out;
|
||||
if (!(inner = HeapAlloc(GetProcessHeap(), 0, size)))
|
||||
if (!(inner = malloc(size)))
|
||||
{
|
||||
SetLastError(ERROR_OUTOFMEMORY);
|
||||
goto out;
|
||||
@@ -824,8 +1012,8 @@ static CTL_INFO *decode_inner_content(HANDLE hmsg, DWORD encoding, DWORD *len)
|
||||
*len = size;
|
||||
|
||||
out:
|
||||
HeapFree(GetProcessHeap(), 0, oid);
|
||||
HeapFree(GetProcessHeap(), 0, buffer);
|
||||
free(oid);
|
||||
free(buffer);
|
||||
return inner;
|
||||
}
|
||||
|
||||
@@ -836,7 +1024,7 @@ BOOL WINAPI CryptCATCatalogInfoFromContext(HCATINFO hcatinfo, CATALOG_INFO *info
|
||||
{
|
||||
struct catinfo *ci = hcatinfo;
|
||||
|
||||
TRACE("%p, %p, %x\n", hcatinfo, info, flags);
|
||||
TRACE("%p, %p, %lx\n", hcatinfo, info, flags);
|
||||
|
||||
if (!hcatinfo || hcatinfo == INVALID_HANDLE_VALUE || ci->magic != CATINFO_MAGIC ||
|
||||
flags || !info || info->cbStruct != sizeof(*info))
|
||||
@@ -848,21 +1036,72 @@ BOOL WINAPI CryptCATCatalogInfoFromContext(HCATINFO hcatinfo, CATALOG_INFO *info
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
/***********************************************************************
|
||||
* CryptCATPutAttrInfo (WINTRUST.@)
|
||||
*/
|
||||
CRYPTCATATTRIBUTE * WINAPI CryptCATPutAttrInfo(HANDLE catalog, CRYPTCATMEMBER *member,
|
||||
WCHAR *name, DWORD flags, DWORD size, BYTE *data)
|
||||
{
|
||||
FIXME("catalog %p, member %p, name %s, flags %#lx, size %lu, data %p, stub!\n",
|
||||
catalog, member, debugstr_w(name), flags, size, data);
|
||||
|
||||
SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/***********************************************************************
|
||||
* CryptCATPutCatAttrInfo (WINTRUST.@)
|
||||
*/
|
||||
CRYPTCATATTRIBUTE * WINAPI CryptCATPutCatAttrInfo(HANDLE catalog,
|
||||
WCHAR *name, DWORD flags, DWORD size, BYTE *data)
|
||||
{
|
||||
FIXME("catalog %p, name %s, flags %#lx, size %lu, data %p, stub!\n",
|
||||
catalog, debugstr_w(name), flags, size, data);
|
||||
|
||||
SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/***********************************************************************
|
||||
* CryptCATPutMemberInfo (WINTRUST.@)
|
||||
*/
|
||||
CRYPTCATMEMBER * WINAPI CryptCATPutMemberInfo(HANDLE catalog, WCHAR *filename,
|
||||
WCHAR *member, GUID *subject, DWORD version, DWORD size, BYTE *data)
|
||||
{
|
||||
FIXME("catalog %p, filename %s, member %s, subject %s, version %lu, size %lu, data %p, stub!\n",
|
||||
catalog, debugstr_w(filename), debugstr_w(member), debugstr_guid(subject), version, size, data);
|
||||
|
||||
SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/***********************************************************************
|
||||
* CryptCATPersistStore (WINTRUST.@)
|
||||
*/
|
||||
BOOL WINAPI CryptCATPersistStore(HANDLE catalog)
|
||||
{
|
||||
FIXME("catalog %p, stub!\n", catalog);
|
||||
|
||||
SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
/***********************************************************************
|
||||
* CryptCATOpen (WINTRUST.@)
|
||||
*/
|
||||
HANDLE WINAPI CryptCATOpen(LPWSTR pwszFileName, DWORD fdwOpenFlags, HCRYPTPROV hProv,
|
||||
HANDLE WINAPI CryptCATOpen(WCHAR *filename, DWORD flags, HCRYPTPROV hProv,
|
||||
DWORD dwPublicVersion, DWORD dwEncodingType)
|
||||
{
|
||||
HANDLE file, hmsg;
|
||||
BYTE *buffer = NULL;
|
||||
DWORD size, flags = OPEN_EXISTING;
|
||||
DWORD size, open_mode = OPEN_ALWAYS;
|
||||
struct cryptcat *cc;
|
||||
BOOL valid;
|
||||
|
||||
TRACE("%s, %x, %lx, %x, %x\n", debugstr_w(pwszFileName), fdwOpenFlags,
|
||||
hProv, dwPublicVersion, dwEncodingType);
|
||||
TRACE("filename %s, flags %#lx, provider %#Ix, version %#lx, type %#lx\n",
|
||||
debugstr_w(filename), flags, hProv, dwPublicVersion, dwEncodingType);
|
||||
|
||||
if (!pwszFileName)
|
||||
if (!filename)
|
||||
{
|
||||
SetLastError(ERROR_INVALID_PARAMETER);
|
||||
return INVALID_HANDLE_VALUE;
|
||||
@@ -870,14 +1109,16 @@ HANDLE WINAPI CryptCATOpen(LPWSTR pwszFileName, DWORD fdwOpenFlags, HCRYPTPROV h
|
||||
|
||||
if (!dwEncodingType) dwEncodingType = X509_ASN_ENCODING | PKCS_7_ASN_ENCODING;
|
||||
|
||||
if (fdwOpenFlags & CRYPTCAT_OPEN_ALWAYS) flags |= OPEN_ALWAYS;
|
||||
if (fdwOpenFlags & CRYPTCAT_OPEN_CREATENEW) flags |= CREATE_NEW;
|
||||
if (flags == CRYPTCAT_OPEN_EXISTING)
|
||||
open_mode = OPEN_EXISTING;
|
||||
if (flags & CRYPTCAT_OPEN_CREATENEW)
|
||||
open_mode = CREATE_ALWAYS;
|
||||
|
||||
file = CreateFileW(pwszFileName, GENERIC_READ, FILE_SHARE_READ, NULL, flags, 0, NULL);
|
||||
file = CreateFileW(filename, GENERIC_READ, FILE_SHARE_READ, NULL, open_mode, 0, NULL);
|
||||
if (file == INVALID_HANDLE_VALUE) return INVALID_HANDLE_VALUE;
|
||||
|
||||
size = GetFileSize(file, NULL);
|
||||
if (!(buffer = HeapAlloc(GetProcessHeap(), 0, size)))
|
||||
if (!(buffer = malloc(size)))
|
||||
{
|
||||
CloseHandle(file);
|
||||
SetLastError(ERROR_OUTOFMEMORY);
|
||||
@@ -886,21 +1127,23 @@ HANDLE WINAPI CryptCATOpen(LPWSTR pwszFileName, DWORD fdwOpenFlags, HCRYPTPROV h
|
||||
if (!(hmsg = CryptMsgOpenToDecode(dwEncodingType, 0, 0, hProv, NULL, NULL)))
|
||||
{
|
||||
CloseHandle(file);
|
||||
HeapFree(GetProcessHeap(), 0, buffer);
|
||||
free(buffer);
|
||||
return INVALID_HANDLE_VALUE;
|
||||
}
|
||||
if (!ReadFile(file, buffer, size, &size, NULL) || !CryptMsgUpdate(hmsg, buffer, size, TRUE))
|
||||
if (!size) valid = FALSE;
|
||||
else if (!ReadFile(file, buffer, size, &size, NULL))
|
||||
{
|
||||
CloseHandle(file);
|
||||
HeapFree(GetProcessHeap(), 0, buffer);
|
||||
free(buffer);
|
||||
CryptMsgClose(hmsg);
|
||||
return INVALID_HANDLE_VALUE;
|
||||
}
|
||||
HeapFree(GetProcessHeap(), 0, buffer);
|
||||
else valid = CryptMsgUpdate(hmsg, buffer, size, TRUE);
|
||||
free(buffer);
|
||||
CloseHandle(file);
|
||||
|
||||
size = sizeof(DWORD);
|
||||
if (!(cc = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*cc))))
|
||||
if (!(cc = calloc(1, sizeof(*cc))))
|
||||
{
|
||||
CryptMsgClose(hmsg);
|
||||
SetLastError(ERROR_OUTOFMEMORY);
|
||||
@@ -909,7 +1152,13 @@ HANDLE WINAPI CryptCATOpen(LPWSTR pwszFileName, DWORD fdwOpenFlags, HCRYPTPROV h
|
||||
|
||||
cc->msg = hmsg;
|
||||
cc->encoding = dwEncodingType;
|
||||
if (CryptMsgGetParam(hmsg, CMSG_ATTR_CERT_COUNT_PARAM, 0, &cc->attr_count, &size))
|
||||
if (!valid)
|
||||
{
|
||||
cc->magic = CRYPTCAT_MAGIC;
|
||||
SetLastError(ERROR_SUCCESS);
|
||||
return cc;
|
||||
}
|
||||
else if (CryptMsgGetParam(hmsg, CMSG_ATTR_CERT_COUNT_PARAM, 0, &cc->attr_count, &size))
|
||||
{
|
||||
DWORD i, sum = 0;
|
||||
BYTE *p;
|
||||
@@ -919,15 +1168,15 @@ HANDLE WINAPI CryptCATOpen(LPWSTR pwszFileName, DWORD fdwOpenFlags, HCRYPTPROV h
|
||||
if (!CryptMsgGetParam(hmsg, CMSG_ATTR_CERT_PARAM, i, NULL, &size))
|
||||
{
|
||||
CryptMsgClose(hmsg);
|
||||
HeapFree(GetProcessHeap(), 0, cc);
|
||||
free(cc);
|
||||
return INVALID_HANDLE_VALUE;
|
||||
}
|
||||
sum += size;
|
||||
}
|
||||
if (!(cc->attr = HeapAlloc(GetProcessHeap(), 0, sizeof(*cc->attr) * cc->attr_count + sum)))
|
||||
if (!(cc->attr = malloc(sizeof(*cc->attr) * cc->attr_count + sum)))
|
||||
{
|
||||
CryptMsgClose(hmsg);
|
||||
HeapFree(GetProcessHeap(), 0, cc);
|
||||
free(cc);
|
||||
SetLastError(ERROR_OUTOFMEMORY);
|
||||
return INVALID_HANDLE_VALUE;
|
||||
}
|
||||
@@ -937,32 +1186,33 @@ HANDLE WINAPI CryptCATOpen(LPWSTR pwszFileName, DWORD fdwOpenFlags, HCRYPTPROV h
|
||||
if (!CryptMsgGetParam(hmsg, CMSG_ATTR_CERT_PARAM, i, NULL, &size))
|
||||
{
|
||||
CryptMsgClose(hmsg);
|
||||
HeapFree(GetProcessHeap(), 0, cc->attr);
|
||||
HeapFree(GetProcessHeap(), 0, cc);
|
||||
free(cc->attr);
|
||||
free(cc);
|
||||
return INVALID_HANDLE_VALUE;
|
||||
}
|
||||
if (!CryptMsgGetParam(hmsg, CMSG_ATTR_CERT_PARAM, i, p, &size))
|
||||
{
|
||||
CryptMsgClose(hmsg);
|
||||
HeapFree(GetProcessHeap(), 0, cc->attr);
|
||||
HeapFree(GetProcessHeap(), 0, cc);
|
||||
free(cc->attr);
|
||||
free(cc);
|
||||
return INVALID_HANDLE_VALUE;
|
||||
}
|
||||
p += size;
|
||||
}
|
||||
cc->inner = decode_inner_content(hmsg, dwEncodingType, &cc->inner_len);
|
||||
if (!cc->inner || !CryptSIPRetrieveSubjectGuid(pwszFileName, NULL, &cc->subject))
|
||||
if (!cc->inner || !CryptSIPRetrieveSubjectGuid(filename, NULL, &cc->subject))
|
||||
{
|
||||
CryptMsgClose(hmsg);
|
||||
HeapFree(GetProcessHeap(), 0, cc->attr);
|
||||
HeapFree(GetProcessHeap(), 0, cc->inner);
|
||||
HeapFree(GetProcessHeap(), 0, cc);
|
||||
free(cc->attr);
|
||||
free(cc->inner);
|
||||
free(cc);
|
||||
return INVALID_HANDLE_VALUE;
|
||||
}
|
||||
cc->magic = CRYPTCAT_MAGIC;
|
||||
SetLastError(ERROR_SUCCESS);
|
||||
return cc;
|
||||
}
|
||||
HeapFree(GetProcessHeap(), 0, cc);
|
||||
free(cc);
|
||||
return INVALID_HANDLE_VALUE;
|
||||
}
|
||||
|
||||
@@ -1033,7 +1283,7 @@ static BOOL WINTRUST_GetSignedMsgFromPEFile(SIP_SUBJECTINFO *pSubjectInfo,
|
||||
WIN_CERTIFICATE *pCert = NULL;
|
||||
HANDLE file;
|
||||
|
||||
TRACE("(%p %p %d %p %p)\n", pSubjectInfo, pdwEncodingType, dwIndex,
|
||||
TRACE("(%p %p %ld %p %p)\n", pSubjectInfo, pdwEncodingType, dwIndex,
|
||||
pcbSignedDataMsg, pbSignedDataMsg);
|
||||
|
||||
if(pSubjectInfo->hFile && pSubjectInfo->hFile!=INVALID_HANDLE_VALUE)
|
||||
@@ -1073,7 +1323,7 @@ static BOOL WINTRUST_GetSignedMsgFromPEFile(SIP_SUBJECTINFO *pSubjectInfo,
|
||||
ret = ImageGetCertificateData(file, dwIndex, NULL, &len);
|
||||
if (GetLastError() != ERROR_INSUFFICIENT_BUFFER)
|
||||
goto error;
|
||||
pCert = HeapAlloc(GetProcessHeap(), 0, len);
|
||||
pCert = malloc(len);
|
||||
if (!pCert)
|
||||
{
|
||||
ret = FALSE;
|
||||
@@ -1112,7 +1362,7 @@ static BOOL WINTRUST_GetSignedMsgFromPEFile(SIP_SUBJECTINFO *pSubjectInfo,
|
||||
error:
|
||||
if(pSubjectInfo->hFile != file)
|
||||
CloseHandle(file);
|
||||
HeapFree(GetProcessHeap(), 0, pCert);
|
||||
free(pCert);
|
||||
return ret;
|
||||
}
|
||||
|
||||
@@ -1136,7 +1386,7 @@ static BOOL WINTRUST_PutSignedMsgToPEFile(SIP_SUBJECTINFO* pSubjectInfo, DWORD p
|
||||
|
||||
/* int aligned WIN_CERTIFICATE structure with cbSignedDataMsg+1 bytes of data */
|
||||
size = FIELD_OFFSET(WIN_CERTIFICATE, bCertificate[cbSignedDataMsg+4]) & (~3);
|
||||
cert = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, size);
|
||||
cert = calloc(1, size);
|
||||
if(!cert)
|
||||
return FALSE;
|
||||
|
||||
@@ -1146,7 +1396,7 @@ static BOOL WINTRUST_PutSignedMsgToPEFile(SIP_SUBJECTINFO* pSubjectInfo, DWORD p
|
||||
memcpy(cert->bCertificate, pbSignedDataMsg, cbSignedDataMsg);
|
||||
ret = ImageAddCertificate(file, cert, pdwIndex);
|
||||
|
||||
HeapFree(GetProcessHeap(), 0, cert);
|
||||
free(cert);
|
||||
if(file != pSubjectInfo->hFile)
|
||||
CloseHandle(file);
|
||||
return ret;
|
||||
@@ -1194,7 +1444,7 @@ static BOOL WINTRUST_GetSignedMsgFromCabFile(SIP_SUBJECTINFO *pSubjectInfo,
|
||||
BYTE buf[64];
|
||||
DWORD cert_offset, cert_size, dwRead;
|
||||
|
||||
TRACE("(%p %p %d %p %p)\n", pSubjectInfo, pdwEncodingType, dwIndex,
|
||||
TRACE("(%p %p %ld %p %p)\n", pSubjectInfo, pdwEncodingType, dwIndex,
|
||||
pcbSignedDataMsg, pbSignedDataMsg);
|
||||
|
||||
/* get basic offset & size info */
|
||||
@@ -1280,9 +1530,9 @@ static BOOL WINTRUST_GetSignedMsgFromCabFile(SIP_SUBJECTINFO *pSubjectInfo,
|
||||
}
|
||||
|
||||
cert_offset = EndGetI32(buf+cfsigninfo_CertOffset);
|
||||
TRACE("cert_offset: %d\n", cert_offset);
|
||||
TRACE("cert_offset: %ld\n", cert_offset);
|
||||
cert_size = EndGetI32(buf+cfsigninfo_CertSize);
|
||||
TRACE("cert_size: %d\n", cert_size);
|
||||
TRACE("cert_size: %ld\n", cert_size);
|
||||
|
||||
/* The redundant checks are to avoid wraparound */
|
||||
if (cert_offset > cabsize || cert_size > cabsize ||
|
||||
@@ -1332,7 +1582,7 @@ static BOOL WINTRUST_GetSignedMsgFromCatFile(SIP_SUBJECTINFO *pSubjectInfo,
|
||||
{
|
||||
BOOL ret;
|
||||
|
||||
TRACE("(%p %p %d %p %p)\n", pSubjectInfo, pdwEncodingType, dwIndex,
|
||||
TRACE("(%p %p %ld %p %p)\n", pSubjectInfo, pdwEncodingType, dwIndex,
|
||||
pcbSignedDataMsg, pbSignedDataMsg);
|
||||
|
||||
if (!pbSignedDataMsg)
|
||||
@@ -1377,7 +1627,7 @@ BOOL WINAPI CryptSIPGetSignedDataMsg(SIP_SUBJECTINFO* pSubjectInfo, DWORD* pdwEn
|
||||
{
|
||||
BOOL ret;
|
||||
|
||||
TRACE("(%p %p %d %p %p)\n", pSubjectInfo, pdwEncodingType, dwIndex,
|
||||
TRACE("(%p %p %ld %p %p)\n", pSubjectInfo, pdwEncodingType, dwIndex,
|
||||
pcbSignedDataMsg, pbSignedDataMsg);
|
||||
|
||||
if(!pSubjectInfo)
|
||||
@@ -1412,7 +1662,7 @@ BOOL WINAPI CryptSIPGetSignedDataMsg(SIP_SUBJECTINFO* pSubjectInfo, DWORD* pdwEn
|
||||
BOOL WINAPI CryptSIPPutSignedDataMsg(SIP_SUBJECTINFO* pSubjectInfo, DWORD pdwEncodingType,
|
||||
DWORD* pdwIndex, DWORD cbSignedDataMsg, BYTE* pbSignedDataMsg)
|
||||
{
|
||||
TRACE("(%p %d %p %d %p)\n", pSubjectInfo, pdwEncodingType, pdwIndex,
|
||||
TRACE("(%p %ld %p %ld %p)\n", pSubjectInfo, pdwEncodingType, pdwIndex,
|
||||
cbSignedDataMsg, pbSignedDataMsg);
|
||||
|
||||
if(!pSubjectInfo) {
|
||||
@@ -1436,7 +1686,7 @@ BOOL WINAPI CryptSIPPutSignedDataMsg(SIP_SUBJECTINFO* pSubjectInfo, DWORD pdwEnc
|
||||
BOOL WINAPI CryptSIPRemoveSignedDataMsg(SIP_SUBJECTINFO* pSubjectInfo,
|
||||
DWORD dwIndex)
|
||||
{
|
||||
FIXME("(%p %d) stub\n", pSubjectInfo, dwIndex);
|
||||
FIXME("(%p %ld) stub\n", pSubjectInfo, dwIndex);
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
@@ -7,8 +7,6 @@
|
||||
#define _INC_WINDOWS
|
||||
#define COM_NO_WINDOWS_H
|
||||
|
||||
#define NONAMELESSUNION
|
||||
|
||||
#include <windef.h>
|
||||
#include <winbase.h>
|
||||
#include <winuser.h>
|
||||
|
||||
@@ -92,10 +92,8 @@ static void WINTRUST_InitRegStructs(void)
|
||||
{
|
||||
#define WINTRUST_INITREGENTRY( action, dllname, functionname ) \
|
||||
action.cbStruct = sizeof(CRYPT_TRUST_REG_ENTRY); \
|
||||
action.pwszDLLName = WINTRUST_Alloc(sizeof(dllname)); \
|
||||
lstrcpyW(action.pwszDLLName, dllname); \
|
||||
action.pwszFunctionName = WINTRUST_Alloc(sizeof(functionname)); \
|
||||
lstrcpyW(action.pwszFunctionName, functionname);
|
||||
action.pwszDLLName = wcsdup(dllname); \
|
||||
action.pwszFunctionName = wcsdup(functionname);
|
||||
|
||||
WINTRUST_INITREGENTRY(SoftpubInitialization, SP_POLICY_PROVIDER_DLL_NAME, SP_INIT_FUNCTION)
|
||||
WINTRUST_INITREGENTRY(SoftpubMessage, SP_POLICY_PROVIDER_DLL_NAME, SP_OBJTRUST_FUNCTION)
|
||||
@@ -128,8 +126,8 @@ static void WINTRUST_InitRegStructs(void)
|
||||
static void WINTRUST_FreeRegStructs(void)
|
||||
{
|
||||
#define WINTRUST_FREEREGENTRY( action ) \
|
||||
WINTRUST_Free(action.pwszDLLName); \
|
||||
WINTRUST_Free(action.pwszFunctionName);
|
||||
free(action.pwszDLLName); \
|
||||
free(action.pwszFunctionName);
|
||||
|
||||
WINTRUST_FREEREGENTRY(SoftpubInitialization);
|
||||
WINTRUST_FREEREGENTRY(SoftpubMessage);
|
||||
@@ -242,7 +240,7 @@ BOOL WINAPI WintrustAddActionID( GUID* pgActionID, DWORD fdwFlags,
|
||||
LONG Res;
|
||||
LONG WriteActionError = ERROR_SUCCESS;
|
||||
|
||||
TRACE("%s %x %p\n", debugstr_guid(pgActionID), fdwFlags, psProvInfo);
|
||||
TRACE("%s %lx %p\n", debugstr_guid(pgActionID), fdwFlags, psProvInfo);
|
||||
|
||||
/* Some sanity checks.
|
||||
* We use the W2K3 last error as it makes more sense (W2K leaves the last error
|
||||
@@ -383,11 +381,11 @@ static LONG WINTRUST_WriteSingleUsageEntry(LPCSTR OID,
|
||||
|
||||
/* Turn OID into a wide-character string */
|
||||
Len = MultiByteToWideChar( CP_ACP, 0, OID, -1, NULL, 0 );
|
||||
OIDW = WINTRUST_Alloc( Len * sizeof(WCHAR) );
|
||||
OIDW = malloc( Len * sizeof(WCHAR) );
|
||||
MultiByteToWideChar( CP_ACP, 0, OID, -1, OIDW, Len );
|
||||
|
||||
/* Allocate the needed space for UsageKey */
|
||||
UsageKey = WINTRUST_Alloc((lstrlenW(Trust) + lstrlenW(Usages) + Len) * sizeof(WCHAR));
|
||||
UsageKey = malloc((wcslen(Trust) + wcslen(Usages) + Len) * sizeof(WCHAR));
|
||||
/* Create the key string */
|
||||
lstrcpyW(UsageKey, Trust);
|
||||
lstrcatW(UsageKey, Usages);
|
||||
@@ -402,8 +400,8 @@ static LONG WINTRUST_WriteSingleUsageEntry(LPCSTR OID,
|
||||
}
|
||||
RegCloseKey(Key);
|
||||
|
||||
WINTRUST_Free(OIDW);
|
||||
WINTRUST_Free(UsageKey);
|
||||
free(OIDW);
|
||||
free(UsageKey);
|
||||
|
||||
return Res;
|
||||
}
|
||||
@@ -601,8 +599,7 @@ static BOOL WINTRUST_RegisterHttpsProv(void)
|
||||
ProvInfo.sTestPolicyProvider = NullCTRE; /* No diagnostic policy */
|
||||
ProvInfo.sCleanupProvider = SoftpubCleanup;
|
||||
|
||||
DefUsage.pwszDllName = WINTRUST_Alloc(sizeof(SP_POLICY_PROVIDER_DLL_NAME));
|
||||
lstrcpyW(DefUsage.pwszDllName, SP_POLICY_PROVIDER_DLL_NAME);
|
||||
DefUsage.pwszDllName = wcsdup(SP_POLICY_PROVIDER_DLL_NAME);
|
||||
|
||||
if (!WintrustAddDefaultForUsage(szOID_PKIX_KP_SERVER_AUTH, &DefUsage))
|
||||
RegisteredOK = FALSE;
|
||||
@@ -613,7 +610,7 @@ static BOOL WINTRUST_RegisterHttpsProv(void)
|
||||
if (!WintrustAddDefaultForUsage(szOID_SGC_NETSCAPE, &DefUsage))
|
||||
RegisteredOK = FALSE;
|
||||
|
||||
WINTRUST_Free(DefUsage.pwszDllName);
|
||||
free(DefUsage.pwszDllName);
|
||||
|
||||
if (!WintrustAddActionID(&ProvGUID, 0, &ProvInfo))
|
||||
RegisteredOK = FALSE;
|
||||
@@ -762,26 +759,26 @@ BOOL WINAPI WintrustAddDefaultForUsage(const char *pszUsageOID,
|
||||
WCHAR* CallbackW;
|
||||
|
||||
Len = MultiByteToWideChar( CP_ACP, 0, psDefUsage->pwszLoadCallbackDataFunctionName, -1, NULL, 0 );
|
||||
CallbackW = WINTRUST_Alloc( Len * sizeof(WCHAR) );
|
||||
CallbackW = malloc( Len * sizeof(WCHAR) );
|
||||
MultiByteToWideChar( CP_ACP, 0, psDefUsage->pwszLoadCallbackDataFunctionName, -1, CallbackW, Len );
|
||||
|
||||
Res = WINTRUST_WriteSingleUsageEntry(pszUsageOID, CBAlloc, CallbackW);
|
||||
if (Res != ERROR_SUCCESS) WriteUsageError = Res;
|
||||
|
||||
WINTRUST_Free(CallbackW);
|
||||
free(CallbackW);
|
||||
}
|
||||
if (psDefUsage->pwszFreeCallbackDataFunctionName)
|
||||
{
|
||||
WCHAR* CallbackW;
|
||||
|
||||
Len = MultiByteToWideChar( CP_ACP, 0, psDefUsage->pwszFreeCallbackDataFunctionName, -1, NULL, 0 );
|
||||
CallbackW = WINTRUST_Alloc( Len * sizeof(WCHAR) );
|
||||
CallbackW = malloc( Len * sizeof(WCHAR) );
|
||||
MultiByteToWideChar( CP_ACP, 0, psDefUsage->pwszFreeCallbackDataFunctionName, -1, CallbackW, Len );
|
||||
|
||||
Res = WINTRUST_WriteSingleUsageEntry(pszUsageOID, CBFree, CallbackW);
|
||||
if (Res != ERROR_SUCCESS) WriteUsageError = Res;
|
||||
|
||||
WINTRUST_Free(CallbackW);
|
||||
free(CallbackW);
|
||||
}
|
||||
|
||||
WINTRUST_Guid2Wstr(psDefUsage->pgActionID, GuidString);
|
||||
@@ -835,6 +832,33 @@ error_close_key:
|
||||
return Func;
|
||||
}
|
||||
|
||||
static CRITICAL_SECTION cache_cs;
|
||||
static CRITICAL_SECTION_DEBUG cache_cs_debug =
|
||||
{
|
||||
0, 0, &cache_cs,
|
||||
{ &cache_cs_debug.ProcessLocksList, &cache_cs_debug.ProcessLocksList },
|
||||
0, 0, { (DWORD_PTR)(__FILE__ ": cache_cs") }
|
||||
};
|
||||
static CRITICAL_SECTION cache_cs = { &cache_cs_debug, -1, 0, 0, 0, 0 };
|
||||
|
||||
static struct provider_cache_entry
|
||||
{
|
||||
GUID guid;
|
||||
CRYPT_PROVIDER_FUNCTIONS provider_functions;
|
||||
}
|
||||
*provider_cache;
|
||||
static unsigned int provider_cache_size;
|
||||
|
||||
static void * WINAPI WINTRUST_Alloc(DWORD cb)
|
||||
{
|
||||
return calloc(1, cb);
|
||||
}
|
||||
|
||||
static void WINAPI WINTRUST_Free(void *p)
|
||||
{
|
||||
free(p);
|
||||
}
|
||||
|
||||
/***********************************************************************
|
||||
* WintrustLoadFunctionPointers (WINTRUST.@)
|
||||
*/
|
||||
@@ -842,6 +866,8 @@ BOOL WINAPI WintrustLoadFunctionPointers( GUID* pgActionID,
|
||||
CRYPT_PROVIDER_FUNCTIONS* pPfns )
|
||||
{
|
||||
WCHAR GuidString[39];
|
||||
BOOL cached = FALSE;
|
||||
unsigned int i;
|
||||
|
||||
TRACE("(%s %p)\n", debugstr_guid(pgActionID), pPfns);
|
||||
|
||||
@@ -853,6 +879,20 @@ BOOL WINAPI WintrustLoadFunctionPointers( GUID* pgActionID,
|
||||
}
|
||||
if (pPfns->cbStruct != sizeof(CRYPT_PROVIDER_FUNCTIONS)) return FALSE;
|
||||
|
||||
EnterCriticalSection( &cache_cs );
|
||||
for (i = 0; i < provider_cache_size; ++i)
|
||||
{
|
||||
if (IsEqualGUID( &provider_cache[i].guid, pgActionID ))
|
||||
{
|
||||
TRACE( "Using cached data.\n" );
|
||||
*pPfns = provider_cache[i].provider_functions;
|
||||
cached = TRUE;
|
||||
break;
|
||||
}
|
||||
}
|
||||
LeaveCriticalSection( &cache_cs );
|
||||
if (cached) return TRUE;
|
||||
|
||||
/* Create this string only once, instead of in the helper function */
|
||||
WINTRUST_Guid2Wstr( pgActionID, GuidString);
|
||||
|
||||
@@ -873,6 +913,25 @@ BOOL WINAPI WintrustLoadFunctionPointers( GUID* pgActionID,
|
||||
pPfns->pfnTestFinalPolicy = (PFN_PROVIDER_TESTFINALPOLICY_CALL)WINTRUST_ReadProviderFromReg(GuidString, DiagnosticPolicy);
|
||||
pPfns->pfnCleanupPolicy = (PFN_PROVIDER_CLEANUP_CALL)WINTRUST_ReadProviderFromReg(GuidString, Cleanup);
|
||||
|
||||
EnterCriticalSection( &cache_cs );
|
||||
for (i = 0; i < provider_cache_size; ++i)
|
||||
if (IsEqualGUID( &provider_cache[i].guid, pgActionID )) break;
|
||||
|
||||
if (i == provider_cache_size)
|
||||
{
|
||||
struct provider_cache_entry *new;
|
||||
|
||||
new = realloc( provider_cache, (provider_cache_size + 1) * sizeof(*new) );
|
||||
if (new)
|
||||
{
|
||||
provider_cache = new;
|
||||
provider_cache[provider_cache_size].guid = *pgActionID;
|
||||
provider_cache[provider_cache_size].provider_functions = *pPfns;
|
||||
++provider_cache_size;
|
||||
}
|
||||
}
|
||||
LeaveCriticalSection( &cache_cs );
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
@@ -899,10 +958,9 @@ static BOOL WINTRUST_SIPPAddProvider(GUID* Subject, WCHAR* MagicNumber)
|
||||
/* Clear and initialize the structure */
|
||||
memset(&NewProv, 0, sizeof(SIP_ADD_NEWPROVIDER));
|
||||
NewProv.cbStruct = sizeof(SIP_ADD_NEWPROVIDER);
|
||||
NewProv.pwszDLLFileName = WINTRUST_Alloc(sizeof(SP_POLICY_PROVIDER_DLL_NAME));
|
||||
NewProv.pwszDLLFileName = wcsdup(SP_POLICY_PROVIDER_DLL_NAME);
|
||||
/* Fill the structure */
|
||||
NewProv.pgSubject = Subject;
|
||||
lstrcpyW(NewProv.pwszDLLFileName, SP_POLICY_PROVIDER_DLL_NAME);
|
||||
NewProv.pwszMagicNumber = MagicNumber;
|
||||
NewProv.pwszIsFunctionName = NULL;
|
||||
NewProv.pwszGetFuncName = CryptSIPGetSignedDataMsg;
|
||||
@@ -915,8 +973,8 @@ static BOOL WINTRUST_SIPPAddProvider(GUID* Subject, WCHAR* MagicNumber)
|
||||
|
||||
Ret = CryptSIPAddProvider(&NewProv);
|
||||
|
||||
WINTRUST_Free(NewProv.pwszDLLFileName);
|
||||
|
||||
free(NewProv.pwszDLLFileName);
|
||||
|
||||
return Ret;
|
||||
}
|
||||
|
||||
@@ -1082,7 +1140,7 @@ add_trust_providers:
|
||||
/* Create a dummy context to force creation of the MachineGuid registry key. */
|
||||
ret = CryptAcquireContextW(&crypt_provider, NULL, NULL, PROV_RSA_FULL, CRYPT_VERIFYCONTEXT);
|
||||
if (ret) CryptReleaseContext(crypt_provider, 0);
|
||||
else ERR("Failed to acquire cryptographic context: %u\n", GetLastError());
|
||||
else ERR("Failed to acquire cryptographic context: %lu\n", GetLastError());
|
||||
|
||||
/* If CryptRegisterRes is not S_OK it will always overrule the return value. */
|
||||
if (CryptRegisterRes != S_OK)
|
||||
|
||||
@@ -16,9 +16,8 @@
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
|
||||
*/
|
||||
#include <stdarg.h>
|
||||
|
||||
#define NONAMELESSUNION
|
||||
#include <stdarg.h>
|
||||
|
||||
#include "windef.h"
|
||||
#include "winbase.h"
|
||||
@@ -40,7 +39,7 @@ HRESULT WINAPI SoftpubDefCertInit(CRYPT_PROVIDER_DATA *data)
|
||||
if (data->padwTrustStepErrors &&
|
||||
!data->padwTrustStepErrors[TRUSTERROR_STEP_FINAL_WVTINIT])
|
||||
ret = S_OK;
|
||||
TRACE("returning %08x\n", ret);
|
||||
TRACE("returning %08lx\n", ret);
|
||||
return ret;
|
||||
}
|
||||
|
||||
@@ -53,7 +52,7 @@ HRESULT WINAPI SoftpubInitialize(CRYPT_PROVIDER_DATA *data)
|
||||
if (data->padwTrustStepErrors &&
|
||||
!data->padwTrustStepErrors[TRUSTERROR_STEP_FINAL_WVTINIT])
|
||||
ret = S_OK;
|
||||
TRACE("returning %08x\n", ret);
|
||||
TRACE("returning %08lx\n", ret);
|
||||
return ret;
|
||||
}
|
||||
|
||||
@@ -86,25 +85,25 @@ static DWORD SOFTPUB_OpenFile(CRYPT_PROVIDER_DATA *data)
|
||||
* typically have hFile as NULL rather than INVALID_HANDLE_VALUE. Check
|
||||
* for both.
|
||||
*/
|
||||
if (!data->pWintrustData->u.pFile->hFile ||
|
||||
data->pWintrustData->u.pFile->hFile == INVALID_HANDLE_VALUE)
|
||||
if (!data->pWintrustData->pFile->hFile ||
|
||||
data->pWintrustData->pFile->hFile == INVALID_HANDLE_VALUE)
|
||||
{
|
||||
data->pWintrustData->u.pFile->hFile =
|
||||
CreateFileW(data->pWintrustData->u.pFile->pcwszFilePath, GENERIC_READ,
|
||||
data->pWintrustData->pFile->hFile =
|
||||
CreateFileW(data->pWintrustData->pFile->pcwszFilePath, GENERIC_READ,
|
||||
FILE_SHARE_READ, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);
|
||||
if (data->pWintrustData->u.pFile->hFile != INVALID_HANDLE_VALUE)
|
||||
if (data->pWintrustData->pFile->hFile != INVALID_HANDLE_VALUE)
|
||||
data->fOpenedFile = TRUE;
|
||||
else
|
||||
err = GetLastError();
|
||||
}
|
||||
if (!err)
|
||||
GetFileTime(data->pWintrustData->u.pFile->hFile, &data->sftSystemTime,
|
||||
GetFileTime(data->pWintrustData->pFile->hFile, &data->sftSystemTime,
|
||||
NULL, NULL);
|
||||
TRACE("returning %d\n", err);
|
||||
TRACE("returning %ld\n", err);
|
||||
return err;
|
||||
}
|
||||
|
||||
/* Assumes data->pWintrustData->u.pFile exists. Sets data->pPDSip->gSubject to
|
||||
/* Assumes data->pWintrustData->pFile exists. Sets data->pPDSip->gSubject to
|
||||
* the file's subject GUID.
|
||||
*/
|
||||
static DWORD SOFTPUB_GetFileSubject(CRYPT_PROVIDER_DATA *data)
|
||||
@@ -112,13 +111,13 @@ static DWORD SOFTPUB_GetFileSubject(CRYPT_PROVIDER_DATA *data)
|
||||
DWORD err = ERROR_SUCCESS;
|
||||
|
||||
if (!WVT_ISINSTRUCT(WINTRUST_FILE_INFO,
|
||||
data->pWintrustData->u.pFile->cbStruct, pgKnownSubject) ||
|
||||
!data->pWintrustData->u.pFile->pgKnownSubject)
|
||||
data->pWintrustData->pFile->cbStruct, pgKnownSubject) ||
|
||||
!data->pWintrustData->pFile->pgKnownSubject)
|
||||
{
|
||||
if (!CryptSIPRetrieveSubjectGuid(
|
||||
data->pWintrustData->u.pFile->pcwszFilePath,
|
||||
data->pWintrustData->u.pFile->hFile,
|
||||
&data->u.pPDSip->gSubject))
|
||||
data->pWintrustData->pFile->pcwszFilePath,
|
||||
data->pWintrustData->pFile->hFile,
|
||||
&data->pPDSip->gSubject))
|
||||
{
|
||||
LARGE_INTEGER fileSize;
|
||||
DWORD sipError = GetLastError();
|
||||
@@ -127,7 +126,7 @@ static DWORD SOFTPUB_GetFileSubject(CRYPT_PROVIDER_DATA *data)
|
||||
* TRUST_E_SUBJECT_FORM_UNKNOWN, rather than whatever
|
||||
* CryptSIPRetrieveSubjectGuid returns.
|
||||
*/
|
||||
if (GetFileSizeEx(data->pWintrustData->u.pFile->hFile, &fileSize)
|
||||
if (GetFileSizeEx(data->pWintrustData->pFile->hFile, &fileSize)
|
||||
&& !fileSize.QuadPart)
|
||||
err = TRUST_E_SUBJECT_FORM_UNKNOWN;
|
||||
else
|
||||
@@ -135,32 +134,32 @@ static DWORD SOFTPUB_GetFileSubject(CRYPT_PROVIDER_DATA *data)
|
||||
}
|
||||
}
|
||||
else
|
||||
data->u.pPDSip->gSubject = *data->pWintrustData->u.pFile->pgKnownSubject;
|
||||
TRACE("returning %d\n", err);
|
||||
data->pPDSip->gSubject = *data->pWintrustData->pFile->pgKnownSubject;
|
||||
TRACE("returning %ld\n", err);
|
||||
return err;
|
||||
}
|
||||
|
||||
/* Assumes data->u.pPDSip exists, and its gSubject member set.
|
||||
* Allocates data->u.pPDSip->pSip and loads it, if possible.
|
||||
/* Assumes data->pPDSip exists, and its gSubject member set.
|
||||
* Allocates data->pPDSip->pSip and loads it, if possible.
|
||||
*/
|
||||
static DWORD SOFTPUB_GetSIP(CRYPT_PROVIDER_DATA *data)
|
||||
{
|
||||
DWORD err = ERROR_SUCCESS;
|
||||
|
||||
data->u.pPDSip->pSip = data->psPfns->pfnAlloc(sizeof(SIP_DISPATCH_INFO));
|
||||
if (data->u.pPDSip->pSip)
|
||||
data->pPDSip->pSip = data->psPfns->pfnAlloc(sizeof(SIP_DISPATCH_INFO));
|
||||
if (data->pPDSip->pSip)
|
||||
{
|
||||
if (!CryptSIPLoad(&data->u.pPDSip->gSubject, 0, data->u.pPDSip->pSip))
|
||||
if (!CryptSIPLoad(&data->pPDSip->gSubject, 0, data->pPDSip->pSip))
|
||||
err = GetLastError();
|
||||
}
|
||||
else
|
||||
err = ERROR_OUTOFMEMORY;
|
||||
TRACE("returning %d\n", err);
|
||||
TRACE("returning %ld\n", err);
|
||||
return err;
|
||||
}
|
||||
|
||||
/* Assumes data->u.pPDSip has been loaded, and data->u.pPDSip->pSip allocated.
|
||||
* Calls data->u.pPDSip->pSip->pfGet to construct data->hMsg.
|
||||
/* Assumes data->pPDSip has been loaded, and data->pPDSip->pSip allocated.
|
||||
* Calls data->pPDSip->pSip->pfGet to construct data->hMsg.
|
||||
*/
|
||||
static DWORD SOFTPUB_GetMessageFromFile(CRYPT_PROVIDER_DATA *data, HANDLE file,
|
||||
LPCWSTR filePath)
|
||||
@@ -170,17 +169,17 @@ static DWORD SOFTPUB_GetMessageFromFile(CRYPT_PROVIDER_DATA *data, HANDLE file,
|
||||
LPBYTE buf = NULL;
|
||||
DWORD size = 0;
|
||||
|
||||
data->u.pPDSip->psSipSubjectInfo =
|
||||
data->pPDSip->psSipSubjectInfo =
|
||||
data->psPfns->pfnAlloc(sizeof(SIP_SUBJECTINFO));
|
||||
if (!data->u.pPDSip->psSipSubjectInfo)
|
||||
if (!data->pPDSip->psSipSubjectInfo)
|
||||
return ERROR_OUTOFMEMORY;
|
||||
|
||||
data->u.pPDSip->psSipSubjectInfo->cbSize = sizeof(SIP_SUBJECTINFO);
|
||||
data->u.pPDSip->psSipSubjectInfo->pgSubjectType = &data->u.pPDSip->gSubject;
|
||||
data->u.pPDSip->psSipSubjectInfo->hFile = file;
|
||||
data->u.pPDSip->psSipSubjectInfo->pwsFileName = filePath;
|
||||
data->u.pPDSip->psSipSubjectInfo->hProv = data->hProv;
|
||||
ret = data->u.pPDSip->pSip->pfGet(data->u.pPDSip->psSipSubjectInfo,
|
||||
data->pPDSip->psSipSubjectInfo->cbSize = sizeof(SIP_SUBJECTINFO);
|
||||
data->pPDSip->psSipSubjectInfo->pgSubjectType = &data->pPDSip->gSubject;
|
||||
data->pPDSip->psSipSubjectInfo->hFile = file;
|
||||
data->pPDSip->psSipSubjectInfo->pwsFileName = filePath;
|
||||
data->pPDSip->psSipSubjectInfo->hProv = data->hProv;
|
||||
ret = data->pPDSip->pSip->pfGet(data->pPDSip->psSipSubjectInfo,
|
||||
&data->dwEncoding, 0, &size, 0);
|
||||
if (!ret)
|
||||
return TRUST_E_NOSIGNATURE;
|
||||
@@ -189,7 +188,7 @@ static DWORD SOFTPUB_GetMessageFromFile(CRYPT_PROVIDER_DATA *data, HANDLE file,
|
||||
if (!buf)
|
||||
return ERROR_OUTOFMEMORY;
|
||||
|
||||
ret = data->u.pPDSip->pSip->pfGet(data->u.pPDSip->psSipSubjectInfo,
|
||||
ret = data->pPDSip->pSip->pfGet(data->pPDSip->psSipSubjectInfo,
|
||||
&data->dwEncoding, 0, &size, buf);
|
||||
if (ret)
|
||||
{
|
||||
@@ -206,7 +205,7 @@ static DWORD SOFTPUB_GetMessageFromFile(CRYPT_PROVIDER_DATA *data, HANDLE file,
|
||||
err = GetLastError();
|
||||
|
||||
data->psPfns->pfnFree(buf);
|
||||
TRACE("returning %d\n", err);
|
||||
TRACE("returning %ld\n", err);
|
||||
return err;
|
||||
}
|
||||
|
||||
@@ -214,7 +213,7 @@ static BOOL hash_file_data( HANDLE file, DWORD start, DWORD end, HCRYPTHASH hash
|
||||
{
|
||||
DWORD bytes_read, size = end - start;
|
||||
DWORD buffer_size = min( size, 1024*1024 );
|
||||
BYTE *buffer = HeapAlloc( GetProcessHeap(), 0, buffer_size );
|
||||
BYTE *buffer = malloc( buffer_size );
|
||||
|
||||
if (!buffer) return FALSE;
|
||||
SetFilePointer( file, start, NULL, FILE_BEGIN );
|
||||
@@ -225,7 +224,7 @@ static BOOL hash_file_data( HANDLE file, DWORD start, DWORD end, HCRYPTHASH hash
|
||||
if (!CryptHashData( hash, buffer, bytes_read, 0 )) break;
|
||||
size -= bytes_read;
|
||||
}
|
||||
HeapFree( GetProcessHeap(), 0, buffer );
|
||||
free( buffer );
|
||||
return !size;
|
||||
}
|
||||
|
||||
@@ -308,7 +307,7 @@ static BOOL SOFTPUB_HashPEFile(HANDLE file, HCRYPTHASH hash)
|
||||
|
||||
static DWORD SOFTPUB_VerifyImageHash(CRYPT_PROVIDER_DATA *data, HANDLE file)
|
||||
{
|
||||
SPC_INDIRECT_DATA_CONTENT *indirect = (SPC_INDIRECT_DATA_CONTENT *)data->u.pPDSip->psIndirectData;
|
||||
SPC_INDIRECT_DATA_CONTENT *indirect = (SPC_INDIRECT_DATA_CONTENT *)data->pPDSip->psIndirectData;
|
||||
DWORD err, hash_size, length;
|
||||
BYTE *hash_data;
|
||||
BOOL release_prov = FALSE;
|
||||
@@ -393,7 +392,7 @@ static DWORD SOFTPUB_CreateStoreFromMessage(CRYPT_PROVIDER_DATA *data)
|
||||
}
|
||||
else
|
||||
err = GetLastError();
|
||||
TRACE("returning %d\n", err);
|
||||
TRACE("returning %ld\n", err);
|
||||
return err;
|
||||
}
|
||||
|
||||
@@ -448,19 +447,19 @@ static DWORD SOFTPUB_DecodeInnerContent(CRYPT_PROVIDER_DATA *data)
|
||||
err = GetLastError();
|
||||
goto error;
|
||||
}
|
||||
data->u.pPDSip->psIndirectData = data->psPfns->pfnAlloc(size);
|
||||
if (!data->u.pPDSip->psIndirectData)
|
||||
data->pPDSip->psIndirectData = data->psPfns->pfnAlloc(size);
|
||||
if (!data->pPDSip->psIndirectData)
|
||||
{
|
||||
err = ERROR_OUTOFMEMORY;
|
||||
goto error;
|
||||
}
|
||||
ret = CryptDecodeObject(data->dwEncoding, oid, buf, size, 0,
|
||||
data->u.pPDSip->psIndirectData, &size);
|
||||
data->pPDSip->psIndirectData, &size);
|
||||
if (!ret)
|
||||
err = GetLastError();
|
||||
|
||||
error:
|
||||
TRACE("returning %d\n", err);
|
||||
TRACE("returning %ld\n", err);
|
||||
data->psPfns->pfnFree(oid);
|
||||
data->psPfns->pfnFree(buf);
|
||||
return err;
|
||||
@@ -470,9 +469,9 @@ static DWORD SOFTPUB_LoadCertMessage(CRYPT_PROVIDER_DATA *data)
|
||||
{
|
||||
DWORD err = ERROR_SUCCESS;
|
||||
|
||||
if (data->pWintrustData->u.pCert &&
|
||||
if (data->pWintrustData->pCert &&
|
||||
WVT_IS_CBSTRUCT_GT_MEMBEROFFSET(WINTRUST_CERT_INFO,
|
||||
data->pWintrustData->u.pCert->cbStruct, psCertContext))
|
||||
data->pWintrustData->pCert->cbStruct, psCertContext))
|
||||
{
|
||||
if (data->psPfns)
|
||||
{
|
||||
@@ -484,8 +483,8 @@ static DWORD SOFTPUB_LoadCertMessage(CRYPT_PROVIDER_DATA *data)
|
||||
* add a cert to it
|
||||
*/
|
||||
if (WVT_ISINSTRUCT(WINTRUST_CERT_INFO,
|
||||
data->pWintrustData->u.pCert->cbStruct, psftVerifyAsOf) &&
|
||||
data->pWintrustData->u.pCert->psftVerifyAsOf)
|
||||
data->pWintrustData->pCert->cbStruct, psftVerifyAsOf) &&
|
||||
data->pWintrustData->pCert->psftVerifyAsOf)
|
||||
data->sftSystemTime = signer.sftVerifyAsOf;
|
||||
else
|
||||
{
|
||||
@@ -498,13 +497,13 @@ static DWORD SOFTPUB_LoadCertMessage(CRYPT_PROVIDER_DATA *data)
|
||||
if (ret)
|
||||
{
|
||||
ret = data->psPfns->pfnAddCert2Chain(data, 0, FALSE, 0,
|
||||
data->pWintrustData->u.pCert->psCertContext);
|
||||
data->pWintrustData->pCert->psCertContext);
|
||||
if (WVT_ISINSTRUCT(WINTRUST_CERT_INFO,
|
||||
data->pWintrustData->u.pCert->cbStruct, pahStores))
|
||||
data->pWintrustData->pCert->cbStruct, pahStores))
|
||||
for (i = 0;
|
||||
ret && i < data->pWintrustData->u.pCert->chStores; i++)
|
||||
ret && i < data->pWintrustData->pCert->chStores; i++)
|
||||
ret = data->psPfns->pfnAddStore2Chain(data,
|
||||
data->pWintrustData->u.pCert->pahStores[i]);
|
||||
data->pWintrustData->pCert->pahStores[i]);
|
||||
}
|
||||
if (!ret)
|
||||
err = GetLastError();
|
||||
@@ -519,7 +518,7 @@ static DWORD SOFTPUB_LoadFileMessage(CRYPT_PROVIDER_DATA *data)
|
||||
{
|
||||
DWORD err = ERROR_SUCCESS;
|
||||
|
||||
if (!data->pWintrustData->u.pFile)
|
||||
if (!data->pWintrustData->pFile)
|
||||
{
|
||||
err = ERROR_INVALID_PARAMETER;
|
||||
goto error;
|
||||
@@ -533,8 +532,8 @@ static DWORD SOFTPUB_LoadFileMessage(CRYPT_PROVIDER_DATA *data)
|
||||
err = SOFTPUB_GetSIP(data);
|
||||
if (err)
|
||||
goto error;
|
||||
err = SOFTPUB_GetMessageFromFile(data, data->pWintrustData->u.pFile->hFile,
|
||||
data->pWintrustData->u.pFile->pcwszFilePath);
|
||||
err = SOFTPUB_GetMessageFromFile(data, data->pWintrustData->pFile->hFile,
|
||||
data->pWintrustData->pFile->pcwszFilePath);
|
||||
if (err)
|
||||
goto error;
|
||||
err = SOFTPUB_CreateStoreFromMessage(data);
|
||||
@@ -543,15 +542,15 @@ static DWORD SOFTPUB_LoadFileMessage(CRYPT_PROVIDER_DATA *data)
|
||||
err = SOFTPUB_DecodeInnerContent(data);
|
||||
if (err)
|
||||
goto error;
|
||||
err = SOFTPUB_VerifyImageHash(data, data->pWintrustData->u.pFile->hFile);
|
||||
err = SOFTPUB_VerifyImageHash(data, data->pWintrustData->pFile->hFile);
|
||||
|
||||
error:
|
||||
if (err && data->fOpenedFile && data->pWintrustData->u.pFile)
|
||||
if (err && data->fOpenedFile && data->pWintrustData->pFile)
|
||||
{
|
||||
/* The caller won't expect the file to be open on failure, so close it.
|
||||
*/
|
||||
CloseHandle(data->pWintrustData->u.pFile->hFile);
|
||||
data->pWintrustData->u.pFile->hFile = INVALID_HANDLE_VALUE;
|
||||
CloseHandle(data->pWintrustData->pFile->hFile);
|
||||
data->pWintrustData->pFile->hFile = INVALID_HANDLE_VALUE;
|
||||
data->fOpenedFile = FALSE;
|
||||
}
|
||||
return err;
|
||||
@@ -562,19 +561,19 @@ static DWORD SOFTPUB_LoadCatalogMessage(CRYPT_PROVIDER_DATA *data)
|
||||
DWORD err;
|
||||
HANDLE catalog = INVALID_HANDLE_VALUE;
|
||||
|
||||
if (!data->pWintrustData->u.pCatalog)
|
||||
if (!data->pWintrustData->pCatalog)
|
||||
{
|
||||
SetLastError(ERROR_INVALID_PARAMETER);
|
||||
return FALSE;
|
||||
}
|
||||
catalog = CreateFileW(data->pWintrustData->u.pCatalog->pcwszCatalogFilePath,
|
||||
catalog = CreateFileW(data->pWintrustData->pCatalog->pcwszCatalogFilePath,
|
||||
GENERIC_READ, FILE_SHARE_READ, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL,
|
||||
NULL);
|
||||
if (catalog == INVALID_HANDLE_VALUE)
|
||||
return GetLastError();
|
||||
if (!CryptSIPRetrieveSubjectGuid(
|
||||
data->pWintrustData->u.pCatalog->pcwszCatalogFilePath, catalog,
|
||||
&data->u.pPDSip->gSubject))
|
||||
data->pWintrustData->pCatalog->pcwszCatalogFilePath, catalog,
|
||||
&data->pPDSip->gSubject))
|
||||
{
|
||||
err = GetLastError();
|
||||
goto error;
|
||||
@@ -583,7 +582,7 @@ static DWORD SOFTPUB_LoadCatalogMessage(CRYPT_PROVIDER_DATA *data)
|
||||
if (err)
|
||||
goto error;
|
||||
err = SOFTPUB_GetMessageFromFile(data, catalog,
|
||||
data->pWintrustData->u.pCatalog->pcwszCatalogFilePath);
|
||||
data->pWintrustData->pCatalog->pcwszCatalogFilePath);
|
||||
if (err)
|
||||
goto error;
|
||||
err = SOFTPUB_CreateStoreFromMessage(data);
|
||||
@@ -617,13 +616,13 @@ HRESULT WINAPI SoftpubLoadMessage(CRYPT_PROVIDER_DATA *data)
|
||||
err = SOFTPUB_LoadCatalogMessage(data);
|
||||
break;
|
||||
default:
|
||||
FIXME("unimplemented for %d\n", data->pWintrustData->dwUnionChoice);
|
||||
FIXME("unimplemented for %ld\n", data->pWintrustData->dwUnionChoice);
|
||||
err = ERROR_INVALID_PARAMETER;
|
||||
}
|
||||
|
||||
if (err)
|
||||
data->padwTrustStepErrors[TRUSTERROR_STEP_FINAL_OBJPROV] = err;
|
||||
TRACE("returning %d (%08x)\n", !err ? S_OK : S_FALSE,
|
||||
TRACE("returning %ld (%08lx)\n", !err ? S_OK : S_FALSE,
|
||||
data->padwTrustStepErrors[TRUSTERROR_STEP_FINAL_OBJPROV]);
|
||||
return !err ? S_OK : S_FALSE;
|
||||
}
|
||||
@@ -830,16 +829,93 @@ static DWORD WINTRUST_VerifySigner(CRYPT_PROVIDER_DATA *data, DWORD signerIdx)
|
||||
return err;
|
||||
}
|
||||
|
||||
static void load_secondary_signatures(CRYPT_PROVIDER_DATA *data, HCRYPTMSG msg)
|
||||
{
|
||||
CRYPT_PROVIDER_SIGSTATE *s = data->pSigState;
|
||||
CRYPT_ATTRIBUTES *attrs;
|
||||
unsigned int i, j;
|
||||
DWORD size;
|
||||
|
||||
if (!CryptMsgGetParam(msg, CMSG_SIGNER_UNAUTH_ATTR_PARAM, 0, NULL, &size))
|
||||
return;
|
||||
|
||||
if (!(attrs = data->psPfns->pfnAlloc(size)))
|
||||
{
|
||||
ERR("No memory.\n");
|
||||
return;
|
||||
}
|
||||
if (!CryptMsgGetParam(msg, CMSG_SIGNER_UNAUTH_ATTR_PARAM, 0, attrs, &size))
|
||||
goto done;
|
||||
|
||||
for (i = 0; i < attrs->cAttr; ++i)
|
||||
{
|
||||
if (strcmp(attrs->rgAttr[i].pszObjId, szOID_NESTED_SIGNATURE))
|
||||
continue;
|
||||
|
||||
if (!(s->rhSecondarySigs = data->psPfns->pfnAlloc(attrs->rgAttr[i].cValue * sizeof(*s->rhSecondarySigs))))
|
||||
{
|
||||
ERR("No memory.\n");
|
||||
goto done;
|
||||
}
|
||||
s->cSecondarySigs = 0;
|
||||
for (j = 0; j < attrs->rgAttr[i].cValue; ++j)
|
||||
{
|
||||
if (!(msg = CryptMsgOpenToDecode(X509_ASN_ENCODING | PKCS_7_ASN_ENCODING, 0, 0, 0, NULL, NULL)))
|
||||
{
|
||||
ERR("Could not create crypt message.\n");
|
||||
goto done;
|
||||
}
|
||||
if (!CryptMsgUpdate(msg, attrs->rgAttr[i].rgValue[j].pbData, attrs->rgAttr[i].rgValue[j].cbData, TRUE))
|
||||
{
|
||||
ERR("Could not update crypt message, err %lu.\n", GetLastError());
|
||||
CryptMsgClose(msg);
|
||||
goto done;
|
||||
}
|
||||
s->rhSecondarySigs[j] = msg;
|
||||
++s->cSecondarySigs;
|
||||
}
|
||||
break;
|
||||
}
|
||||
done:
|
||||
data->psPfns->pfnFree(attrs);
|
||||
}
|
||||
|
||||
HRESULT WINAPI SoftpubLoadSignature(CRYPT_PROVIDER_DATA *data)
|
||||
{
|
||||
DWORD err;
|
||||
DWORD err = ERROR_SUCCESS;
|
||||
|
||||
TRACE("(%p)\n", data);
|
||||
|
||||
if (!data->padwTrustStepErrors)
|
||||
return S_FALSE;
|
||||
|
||||
if (data->hMsg)
|
||||
if (data->pSigState)
|
||||
{
|
||||
/* We did not initialize this, probably an unsupported usage. */
|
||||
FIXME("pSigState %p already initialized.\n", data->pSigState);
|
||||
}
|
||||
if (!(data->pSigState = data->psPfns->pfnAlloc(sizeof(*data->pSigState))))
|
||||
{
|
||||
err = ERROR_OUTOFMEMORY;
|
||||
}
|
||||
else
|
||||
{
|
||||
data->pSigState->cbStruct = sizeof(*data->pSigState);
|
||||
data->pSigState->fSupportMultiSig = TRUE;
|
||||
data->pSigState->dwCryptoPolicySupport = WSS_SIGTRUST_SUPPORT | WSS_OBJTRUST_SUPPORT | WSS_CERTTRUST_SUPPORT;
|
||||
if (data->hMsg)
|
||||
{
|
||||
data->pSigState->hPrimarySig = CryptMsgDuplicate(data->hMsg);
|
||||
load_secondary_signatures(data, data->pSigState->hPrimarySig);
|
||||
}
|
||||
if (data->pSigSettings)
|
||||
{
|
||||
if (data->pSigSettings->dwFlags & WSS_GET_SECONDARY_SIG_COUNT)
|
||||
data->pSigSettings->cSecondarySigs = data->pSigState->cSecondarySigs;
|
||||
}
|
||||
}
|
||||
|
||||
if (!err && data->hMsg)
|
||||
{
|
||||
DWORD signerCount, size;
|
||||
|
||||
@@ -859,8 +935,7 @@ HRESULT WINAPI SoftpubLoadSignature(CRYPT_PROVIDER_DATA *data)
|
||||
else
|
||||
err = TRUST_E_NOSIGNATURE;
|
||||
}
|
||||
else
|
||||
err = ERROR_SUCCESS;
|
||||
|
||||
if (err)
|
||||
data->padwTrustStepErrors[TRUSTERROR_STEP_FINAL_SIGPROV] = err;
|
||||
return !err ? S_OK : S_FALSE;
|
||||
@@ -885,7 +960,7 @@ BOOL WINAPI SoftpubCheckCert(CRYPT_PROVIDER_DATA *data, DWORD idxSigner,
|
||||
{
|
||||
BOOL ret;
|
||||
|
||||
TRACE("(%p, %d, %d, %d)\n", data, idxSigner, fCounterSignerChain,
|
||||
TRACE("(%p, %ld, %d, %ld)\n", data, idxSigner, fCounterSignerChain,
|
||||
idxCounterSigner);
|
||||
|
||||
if (fCounterSignerChain)
|
||||
@@ -958,7 +1033,7 @@ static DWORD WINTRUST_TrustStatusToError(DWORD errorStatus)
|
||||
error = CERT_E_INVALID_POLICY;
|
||||
else if (errorStatus)
|
||||
{
|
||||
FIXME("unknown error status %08x\n", errorStatus);
|
||||
FIXME("unknown error status %08lx\n", errorStatus);
|
||||
error = TRUST_E_SYSTEM_ERROR;
|
||||
}
|
||||
else
|
||||
@@ -1011,7 +1086,7 @@ static void WINTRUST_CreateChainPolicyCreateInfo(
|
||||
chainPara->RequestedUsage.dwType = 0;
|
||||
chainPara->RequestedUsage.Usage.cUsageIdentifier = 0;
|
||||
}
|
||||
info->u.cbSize = sizeof(WTD_GENERIC_CHAIN_POLICY_CREATE_INFO);
|
||||
info->cbSize = sizeof(WTD_GENERIC_CHAIN_POLICY_CREATE_INFO);
|
||||
info->hChainEngine = NULL;
|
||||
info->pChainPara = chainPara;
|
||||
if (data->dwProvFlags & CPD_REVOCATION_CHECK_END_CERT)
|
||||
@@ -1115,7 +1190,7 @@ HRESULT WINAPI WintrustCertificateTrust(CRYPT_PROVIDER_DATA *data)
|
||||
}
|
||||
if (err)
|
||||
data->padwTrustStepErrors[TRUSTERROR_STEP_FINAL_CERTPROV] = err;
|
||||
TRACE("returning %d (%08x)\n", !err ? S_OK : S_FALSE,
|
||||
TRACE("returning %ld (%08lx)\n", !err ? S_OK : S_FALSE,
|
||||
data->padwTrustStepErrors[TRUSTERROR_STEP_FINAL_CERTPROV]);
|
||||
return !err ? S_OK : S_FALSE;
|
||||
}
|
||||
@@ -1128,7 +1203,7 @@ HRESULT WINAPI GenericChainCertificateTrust(CRYPT_PROVIDER_DATA *data)
|
||||
|
||||
TRACE("(%p)\n", data);
|
||||
|
||||
if (policyData && policyData->u.cbSize !=
|
||||
if (policyData && policyData->cbSize !=
|
||||
sizeof(WTD_GENERIC_CHAIN_POLICY_CREATE_INFO))
|
||||
{
|
||||
err = ERROR_INVALID_PARAMETER;
|
||||
@@ -1162,7 +1237,7 @@ HRESULT WINAPI GenericChainCertificateTrust(CRYPT_PROVIDER_DATA *data)
|
||||
end:
|
||||
if (err)
|
||||
data->padwTrustStepErrors[TRUSTERROR_STEP_FINAL_CERTPROV] = err;
|
||||
TRACE("returning %d (%08x)\n", !err ? S_OK : S_FALSE,
|
||||
TRACE("returning %ld (%08lx)\n", !err ? S_OK : S_FALSE,
|
||||
data->padwTrustStepErrors[TRUSTERROR_STEP_FINAL_CERTPROV]);
|
||||
return !err ? S_OK : S_FALSE;
|
||||
}
|
||||
@@ -1175,7 +1250,7 @@ HRESULT WINAPI SoftpubAuthenticode(CRYPT_PROVIDER_DATA *data)
|
||||
TRACE("(%p)\n", data);
|
||||
|
||||
if (data->pWintrustData->dwUIChoice != WTD_UI_NONE)
|
||||
FIXME("unimplemented for UI choice %d\n",
|
||||
FIXME("unimplemented for UI choice %ld\n",
|
||||
data->pWintrustData->dwUIChoice);
|
||||
if (!data->csSigners)
|
||||
{
|
||||
@@ -1248,7 +1323,7 @@ HRESULT WINAPI SoftpubAuthenticode(CRYPT_PROVIDER_DATA *data)
|
||||
if (!ret)
|
||||
data->padwTrustStepErrors[TRUSTERROR_STEP_FINAL_POLICYPROV] =
|
||||
policyStatus.dwError;
|
||||
TRACE("returning %d (%08x)\n", ret ? S_OK : S_FALSE,
|
||||
TRACE("returning %ld (%08lx)\n", ret ? S_OK : S_FALSE,
|
||||
data->padwTrustStepErrors[TRUSTERROR_STEP_FINAL_POLICYPROV]);
|
||||
return ret ? S_OK : S_FALSE;
|
||||
}
|
||||
@@ -1290,7 +1365,7 @@ HRESULT WINAPI GenericChainFinalProv(CRYPT_PROVIDER_DATA *data)
|
||||
TRACE("(%p)\n", data);
|
||||
|
||||
if (data->pWintrustData->dwUIChoice != WTD_UI_NONE)
|
||||
FIXME("unimplemented for UI choice %d\n",
|
||||
FIXME("unimplemented for UI choice %ld\n",
|
||||
data->pWintrustData->dwUIChoice);
|
||||
if (!data->csSigners)
|
||||
err = TRUST_E_NOSIGNATURE;
|
||||
@@ -1320,7 +1395,7 @@ HRESULT WINAPI GenericChainFinalProv(CRYPT_PROVIDER_DATA *data)
|
||||
{
|
||||
for (i = 0; i < data->csSigners; i++)
|
||||
{
|
||||
signers[i].u.cbSize =
|
||||
signers[i].cbSize =
|
||||
sizeof(WTD_GENERIC_CHAIN_POLICY_SIGNER_INFO);
|
||||
signers[i].pChainContext =
|
||||
data->pasSigners[i].pChainContext;
|
||||
@@ -1343,7 +1418,7 @@ HRESULT WINAPI GenericChainFinalProv(CRYPT_PROVIDER_DATA *data)
|
||||
}
|
||||
if (err != NO_ERROR)
|
||||
data->padwTrustStepErrors[TRUSTERROR_STEP_FINAL_POLICYPROV] = err;
|
||||
TRACE("returning %d (%08x)\n", err == NO_ERROR ? S_OK : S_FALSE,
|
||||
TRACE("returning %ld (%08lx)\n", err == NO_ERROR ? S_OK : S_FALSE,
|
||||
data->padwTrustStepErrors[TRUSTERROR_STEP_FINAL_POLICYPROV]);
|
||||
return err == NO_ERROR ? S_OK : S_FALSE;
|
||||
}
|
||||
@@ -1366,23 +1441,30 @@ HRESULT WINAPI SoftpubCleanup(CRYPT_PROVIDER_DATA *data)
|
||||
CertCloseStore(data->pahStores[i], 0);
|
||||
data->psPfns->pfnFree(data->pahStores);
|
||||
|
||||
if (data->u.pPDSip)
|
||||
if (data->pPDSip)
|
||||
{
|
||||
data->psPfns->pfnFree(data->u.pPDSip->pSip);
|
||||
data->psPfns->pfnFree(data->u.pPDSip->pCATSip);
|
||||
data->psPfns->pfnFree(data->u.pPDSip->psSipSubjectInfo);
|
||||
data->psPfns->pfnFree(data->u.pPDSip->psSipCATSubjectInfo);
|
||||
data->psPfns->pfnFree(data->u.pPDSip->psIndirectData);
|
||||
data->psPfns->pfnFree(data->pPDSip->pSip);
|
||||
data->psPfns->pfnFree(data->pPDSip->pCATSip);
|
||||
data->psPfns->pfnFree(data->pPDSip->psSipSubjectInfo);
|
||||
data->psPfns->pfnFree(data->pPDSip->psSipCATSubjectInfo);
|
||||
data->psPfns->pfnFree(data->pPDSip->psIndirectData);
|
||||
}
|
||||
|
||||
if (WVT_ISINSTRUCT(CRYPT_PROVIDER_DATA, data->cbStruct, pSigState) && data->pSigState)
|
||||
{
|
||||
CryptMsgClose(data->pSigState->hPrimarySig);
|
||||
for (i = 0; i < data->pSigState->cSecondarySigs; ++i)
|
||||
CryptMsgClose(data->pSigState->rhSecondarySigs[i]);
|
||||
data->psPfns->pfnFree(data->pSigState);
|
||||
}
|
||||
CryptMsgClose(data->hMsg);
|
||||
|
||||
if (data->fOpenedFile &&
|
||||
data->pWintrustData->dwUnionChoice == WTD_CHOICE_FILE &&
|
||||
data->pWintrustData->u.pFile)
|
||||
data->pWintrustData->pFile)
|
||||
{
|
||||
CloseHandle(data->pWintrustData->u.pFile->hFile);
|
||||
data->pWintrustData->u.pFile->hFile = INVALID_HANDLE_VALUE;
|
||||
CloseHandle(data->pWintrustData->pFile->hFile);
|
||||
data->pWintrustData->pFile->hFile = INVALID_HANDLE_VALUE;
|
||||
data->fOpenedFile = FALSE;
|
||||
}
|
||||
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
@ stdcall CryptCATAdminAcquireContext2(ptr ptr wstr ptr long)
|
||||
@ stdcall CryptCATAdminAddCatalog(long wstr wstr long)
|
||||
@ stdcall CryptCATAdminCalcHashFromFileHandle(long ptr ptr long)
|
||||
#@ stub CryptCATAdminCalcHashFromFileHandle2
|
||||
@ stdcall CryptCATAdminCalcHashFromFileHandle2(ptr ptr ptr ptr long)
|
||||
@ stdcall CryptCATAdminEnumCatalogFromHash(long ptr long long ptr)
|
||||
@ stub CryptCATAdminPauseServiceForBackup
|
||||
@ stdcall CryptCATAdminReleaseCatalogContext(long long long)
|
||||
@@ -34,10 +34,10 @@
|
||||
@ stdcall CryptCATGetMemberInfo(ptr wstr)
|
||||
@ stub CryptCATHandleFromStore
|
||||
@ stdcall CryptCATOpen(wstr long long long long)
|
||||
@ stub CryptCATPersistStore
|
||||
@ stub CryptCATPutAttrInfo
|
||||
@ stub CryptCATPutCatAttrInfo
|
||||
@ stub CryptCATPutMemberInfo
|
||||
@ stdcall CryptCATPersistStore(ptr)
|
||||
@ stdcall CryptCATPutAttrInfo(ptr ptr wstr long long ptr)
|
||||
@ stdcall CryptCATPutCatAttrInfo(ptr wstr long long ptr)
|
||||
@ stdcall CryptCATPutMemberInfo(ptr wstr wstr ptr long long ptr)
|
||||
@ stub CryptCATStoreFromHandle
|
||||
@ stub CryptCATVerifyMember
|
||||
@ stdcall CryptSIPCreateIndirectData(ptr ptr ptr)
|
||||
@@ -94,7 +94,7 @@
|
||||
@ stub WTHelperCheckCertUsage
|
||||
@ stub WTHelperGetAgencyInfo
|
||||
@ stdcall WTHelperGetFileHandle(ptr)
|
||||
@ stub WTHelperGetFileHash
|
||||
#@ stub WTHelperGetFileHash
|
||||
@ stdcall WTHelperGetFileName(ptr)
|
||||
@ stdcall WTHelperGetKnownUsages(long ptr)
|
||||
@ stdcall WTHelperGetProvCertFromChain(ptr long)
|
||||
@@ -142,7 +142,7 @@
|
||||
@ stdcall WinVerifyTrust(long ptr ptr)
|
||||
@ stdcall WinVerifyTrustEx(long ptr ptr)
|
||||
@ stdcall WintrustAddActionID(ptr long ptr)
|
||||
@ stdcall WintrustAddDefaultForUsage(ptr ptr)
|
||||
@ stdcall WintrustAddDefaultForUsage(str ptr)
|
||||
@ stdcall WintrustCertificateTrust(ptr)
|
||||
@ stub WintrustGetDefaultForUsage
|
||||
@ stdcall WintrustGetRegPolicyFlags(ptr)
|
||||
|
||||
@@ -19,8 +19,6 @@
|
||||
|
||||
#include <stdarg.h>
|
||||
|
||||
#define NONAMELESSUNION
|
||||
|
||||
#include "windef.h"
|
||||
#include "winbase.h"
|
||||
#include "winerror.h"
|
||||
@@ -38,24 +36,6 @@
|
||||
|
||||
WINE_DEFAULT_DEBUG_CHANNEL(wintrust);
|
||||
|
||||
|
||||
/* Utility functions */
|
||||
void * WINAPI WINTRUST_Alloc(DWORD cb)
|
||||
{
|
||||
return HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, cb);
|
||||
}
|
||||
|
||||
static void* WINTRUST_ReAlloc(void *ptr, DWORD cb) __WINE_ALLOC_SIZE(2);
|
||||
static void* WINTRUST_ReAlloc(void *ptr, DWORD cb)
|
||||
{
|
||||
return HeapReAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, ptr, cb);
|
||||
}
|
||||
|
||||
void WINAPI WINTRUST_Free(void *p)
|
||||
{
|
||||
HeapFree(GetProcessHeap(), 0, p);
|
||||
}
|
||||
|
||||
/***********************************************************************
|
||||
* TrustIsCertificateSelfSigned (WINTRUST.@)
|
||||
*/
|
||||
@@ -92,7 +72,7 @@ BOOL WINAPI TrustIsCertificateSelfSigned( PCCERT_CONTEXT cert )
|
||||
if (directoryName)
|
||||
{
|
||||
ret = CertCompareCertificateName(cert->dwCertEncodingType,
|
||||
&directoryName->u.DirectoryName, &cert->pCertInfo->Issuer)
|
||||
&directoryName->DirectoryName, &cert->pCertInfo->Issuer)
|
||||
&& CertCompareIntegerBlob(&info->AuthorityCertSerialNumber,
|
||||
&cert->pCertInfo->SerialNumber);
|
||||
}
|
||||
@@ -202,23 +182,22 @@ static CRYPT_PROVIDER_DATA *WINTRUST_AllocateProviderData(void)
|
||||
{
|
||||
CRYPT_PROVIDER_DATA *provData;
|
||||
|
||||
provData = WINTRUST_Alloc(sizeof(CRYPT_PROVIDER_DATA));
|
||||
provData = calloc(1, sizeof(CRYPT_PROVIDER_DATA));
|
||||
if (!provData)
|
||||
goto oom;
|
||||
provData->cbStruct = sizeof(CRYPT_PROVIDER_DATA);
|
||||
|
||||
provData->padwTrustStepErrors =
|
||||
WINTRUST_Alloc(TRUSTERROR_MAX_STEPS * sizeof(DWORD));
|
||||
provData->padwTrustStepErrors = calloc(TRUSTERROR_MAX_STEPS, sizeof(DWORD));
|
||||
if (!provData->padwTrustStepErrors)
|
||||
goto oom;
|
||||
provData->cdwTrustStepErrors = TRUSTERROR_MAX_STEPS;
|
||||
|
||||
provData->u.pPDSip = WINTRUST_Alloc(sizeof(PROVDATA_SIP));
|
||||
if (!provData->u.pPDSip)
|
||||
provData->pPDSip = calloc(1, sizeof(PROVDATA_SIP));
|
||||
if (!provData->pPDSip)
|
||||
goto oom;
|
||||
provData->u.pPDSip->cbStruct = sizeof(PROVDATA_SIP);
|
||||
provData->pPDSip->cbStruct = sizeof(PROVDATA_SIP);
|
||||
|
||||
provData->psPfns = WINTRUST_Alloc(sizeof(CRYPT_PROVIDER_FUNCTIONS));
|
||||
provData->psPfns = calloc(1, sizeof(CRYPT_PROVIDER_FUNCTIONS));
|
||||
if (!provData->psPfns)
|
||||
goto oom;
|
||||
provData->psPfns->cbStruct = sizeof(CRYPT_PROVIDER_FUNCTIONS);
|
||||
@@ -227,10 +206,10 @@ static CRYPT_PROVIDER_DATA *WINTRUST_AllocateProviderData(void)
|
||||
oom:
|
||||
if (provData)
|
||||
{
|
||||
WINTRUST_Free(provData->padwTrustStepErrors);
|
||||
WINTRUST_Free(provData->u.pPDSip);
|
||||
WINTRUST_Free(provData->psPfns);
|
||||
WINTRUST_Free(provData);
|
||||
free(provData->padwTrustStepErrors);
|
||||
free(provData->pPDSip);
|
||||
free(provData->psPfns);
|
||||
free(provData);
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
@@ -294,6 +273,10 @@ static LONG WINTRUST_DefaultVerify(HWND hwnd, GUID *actionID,
|
||||
|
||||
data->hWVTStateData = provData;
|
||||
provData->pWintrustData = data;
|
||||
|
||||
if (WVT_ISINSTRUCT(WINTRUST_DATA, data->cbStruct, pSignatureSettings))
|
||||
provData->pSigSettings = data->pSignatureSettings;
|
||||
|
||||
if (hwnd == INVALID_HANDLE_VALUE)
|
||||
provData->hWndParent = GetDesktopWindow();
|
||||
else
|
||||
@@ -307,13 +290,13 @@ static LONG WINTRUST_DefaultVerify(HWND hwnd, GUID *actionID,
|
||||
goto done;
|
||||
|
||||
error:
|
||||
WINTRUST_Free(provData->padwTrustStepErrors);
|
||||
WINTRUST_Free(provData->u.pPDSip);
|
||||
WINTRUST_Free(provData->psPfns);
|
||||
WINTRUST_Free(provData);
|
||||
free(provData->padwTrustStepErrors);
|
||||
free(provData->pPDSip);
|
||||
free(provData->psPfns);
|
||||
free(provData);
|
||||
|
||||
done:
|
||||
TRACE("returning %08x\n", err);
|
||||
TRACE("returning %08lx\n", err);
|
||||
return err;
|
||||
}
|
||||
|
||||
@@ -330,13 +313,13 @@ static LONG WINTRUST_DefaultClose(HWND hwnd, GUID *actionID,
|
||||
if (provData->psPfns->pfnCleanupPolicy)
|
||||
err = provData->psPfns->pfnCleanupPolicy(provData);
|
||||
|
||||
WINTRUST_Free(provData->padwTrustStepErrors);
|
||||
WINTRUST_Free(provData->u.pPDSip);
|
||||
WINTRUST_Free(provData->psPfns);
|
||||
WINTRUST_Free(provData);
|
||||
free(provData->padwTrustStepErrors);
|
||||
free(provData->pPDSip);
|
||||
free(provData->psPfns);
|
||||
free(provData);
|
||||
data->hWVTStateData = NULL;
|
||||
}
|
||||
TRACE("returning %08x\n", err);
|
||||
TRACE("returning %08lx\n", err);
|
||||
return err;
|
||||
}
|
||||
|
||||
@@ -349,7 +332,7 @@ static LONG WINTRUST_DefaultVerifyAndClose(HWND hwnd, GUID *actionID,
|
||||
|
||||
err = WINTRUST_DefaultVerify(hwnd, actionID, data);
|
||||
WINTRUST_DefaultClose(hwnd, actionID, data);
|
||||
TRACE("returning %08x\n", err);
|
||||
TRACE("returning %08lx\n", err);
|
||||
return err;
|
||||
}
|
||||
|
||||
@@ -367,7 +350,7 @@ static LONG WINTRUST_PublishedSoftware(HWND hwnd, GUID *actionID,
|
||||
TRACE("subjectFile->lpPath: %s\n", debugstr_w(subjectFile->lpPath));
|
||||
fileInfo.pcwszFilePath = subjectFile->lpPath;
|
||||
fileInfo.hFile = subjectFile->hFile;
|
||||
wintrust_data.u.pFile = &fileInfo;
|
||||
wintrust_data.pFile = &fileInfo;
|
||||
wintrust_data.dwUnionChoice = WTD_CHOICE_FILE;
|
||||
wintrust_data.dwUIChoice = WTD_UI_NONE;
|
||||
|
||||
@@ -391,16 +374,16 @@ static HRESULT WINAPI WINTRUST_CertVerifyObjTrust(CRYPT_PROVIDER_DATA *data)
|
||||
switch (data->pWintrustData->dwUnionChoice)
|
||||
{
|
||||
case WTD_CHOICE_BLOB:
|
||||
if (data->pWintrustData->u.pBlob &&
|
||||
if (data->pWintrustData->pBlob &&
|
||||
WVT_IS_CBSTRUCT_GT_MEMBEROFFSET(WINTRUST_BLOB_INFO,
|
||||
data->pWintrustData->u.pBlob->cbStruct, pbMemObject) &&
|
||||
data->pWintrustData->u.pBlob->cbMemObject ==
|
||||
data->pWintrustData->pBlob->cbStruct, pbMemObject) &&
|
||||
data->pWintrustData->pBlob->cbMemObject ==
|
||||
sizeof(CERT_VERIFY_CERTIFICATE_TRUST) &&
|
||||
data->pWintrustData->u.pBlob->pbMemObject)
|
||||
data->pWintrustData->pBlob->pbMemObject)
|
||||
{
|
||||
CERT_VERIFY_CERTIFICATE_TRUST *pCert =
|
||||
(CERT_VERIFY_CERTIFICATE_TRUST *)
|
||||
data->pWintrustData->u.pBlob->pbMemObject;
|
||||
data->pWintrustData->pBlob->pbMemObject;
|
||||
|
||||
if (pCert->cbSize == sizeof(CERT_VERIFY_CERTIFICATE_TRUST) &&
|
||||
pCert->pccert)
|
||||
@@ -444,7 +427,7 @@ static HRESULT WINAPI WINTRUST_CertVerifyObjTrust(CRYPT_PROVIDER_DATA *data)
|
||||
}
|
||||
break;
|
||||
default:
|
||||
FIXME("unimplemented for %d\n", data->pWintrustData->dwUnionChoice);
|
||||
FIXME("unimplemented for %ld\n", data->pWintrustData->dwUnionChoice);
|
||||
SetLastError(ERROR_INVALID_PARAMETER);
|
||||
ret = FALSE;
|
||||
}
|
||||
@@ -453,7 +436,7 @@ error:
|
||||
if (!ret)
|
||||
data->padwTrustStepErrors[TRUSTERROR_STEP_FINAL_OBJPROV] =
|
||||
GetLastError();
|
||||
TRACE("returning %d (%08x)\n", ret ? S_OK : S_FALSE,
|
||||
TRACE("returning %ld (%08lx)\n", ret ? S_OK : S_FALSE,
|
||||
data->padwTrustStepErrors[TRUSTERROR_STEP_FINAL_OBJPROV]);
|
||||
return ret ? S_OK : S_FALSE;
|
||||
}
|
||||
@@ -498,13 +481,13 @@ static LONG WINTRUST_CertVerify(HWND hwnd, GUID *actionID,
|
||||
goto done;
|
||||
|
||||
error:
|
||||
WINTRUST_Free(provData->padwTrustStepErrors);
|
||||
WINTRUST_Free(provData->u.pPDSip);
|
||||
WINTRUST_Free(provData->psPfns);
|
||||
WINTRUST_Free(provData);
|
||||
free(provData->padwTrustStepErrors);
|
||||
free(provData->pPDSip);
|
||||
free(provData->psPfns);
|
||||
free(provData);
|
||||
|
||||
done:
|
||||
TRACE("returning %08x\n", err);
|
||||
TRACE("returning %08lx\n", err);
|
||||
return err;
|
||||
}
|
||||
|
||||
@@ -517,7 +500,7 @@ static LONG WINTRUST_CertVerifyAndClose(HWND hwnd, GUID *actionID,
|
||||
|
||||
err = WINTRUST_CertVerify(hwnd, actionID, data);
|
||||
WINTRUST_DefaultClose(hwnd, actionID, data);
|
||||
TRACE("returning %08x\n", err);
|
||||
TRACE("returning %08lx\n", err);
|
||||
return err;
|
||||
}
|
||||
|
||||
@@ -546,7 +529,7 @@ static LONG WINTRUST_CertActionVerify(HWND hwnd, GUID *actionID,
|
||||
err = WINTRUST_DefaultClose(hwnd, actionID, data);
|
||||
break;
|
||||
default:
|
||||
FIXME("unimplemented for %d\n", data->dwStateAction);
|
||||
FIXME("unimplemented for %ld\n", data->dwStateAction);
|
||||
}
|
||||
return err;
|
||||
}
|
||||
@@ -556,7 +539,7 @@ static void dump_file_info(WINTRUST_FILE_INFO *pFile)
|
||||
TRACE("%p\n", pFile);
|
||||
if (pFile)
|
||||
{
|
||||
TRACE("cbStruct: %d\n", pFile->cbStruct);
|
||||
TRACE("cbStruct: %ld\n", pFile->cbStruct);
|
||||
TRACE("pcwszFilePath: %s\n", debugstr_w(pFile->pcwszFilePath));
|
||||
TRACE("hFile: %p\n", pFile->hFile);
|
||||
TRACE("pgKnownSubject: %s\n", debugstr_guid(pFile->pgKnownSubject));
|
||||
@@ -568,8 +551,8 @@ static void dump_catalog_info(WINTRUST_CATALOG_INFO *catalog)
|
||||
TRACE("%p\n", catalog);
|
||||
if (catalog)
|
||||
{
|
||||
TRACE("cbStruct: %d\n", catalog->cbStruct);
|
||||
TRACE("dwCatalogVersion: %d\n", catalog->dwCatalogVersion);
|
||||
TRACE("cbStruct: %ld\n", catalog->cbStruct);
|
||||
TRACE("dwCatalogVersion: %ld\n", catalog->dwCatalogVersion);
|
||||
TRACE("pcwszCatalogFilePath: %s\n",
|
||||
debugstr_w(catalog->pcwszCatalogFilePath));
|
||||
TRACE("pcwszMemberTag: %s\n", debugstr_w(catalog->pcwszMemberTag));
|
||||
@@ -577,7 +560,7 @@ static void dump_catalog_info(WINTRUST_CATALOG_INFO *catalog)
|
||||
debugstr_w(catalog->pcwszMemberFilePath));
|
||||
TRACE("hMemberFile: %p\n", catalog->hMemberFile);
|
||||
TRACE("pbCalculatedFileHash: %p\n", catalog->pbCalculatedFileHash);
|
||||
TRACE("cbCalculatedFileHash: %d\n", catalog->cbCalculatedFileHash);
|
||||
TRACE("cbCalculatedFileHash: %ld\n", catalog->cbCalculatedFileHash);
|
||||
TRACE("pcCatalogContext: %p\n", catalog->pcCatalogContext);
|
||||
}
|
||||
}
|
||||
@@ -587,12 +570,12 @@ static void dump_blob_info(WINTRUST_BLOB_INFO *blob)
|
||||
TRACE("%p\n", blob);
|
||||
if (blob)
|
||||
{
|
||||
TRACE("cbStruct: %d\n", blob->cbStruct);
|
||||
TRACE("cbStruct: %ld\n", blob->cbStruct);
|
||||
TRACE("gSubject: %s\n", debugstr_guid(&blob->gSubject));
|
||||
TRACE("pcwszDisplayName: %s\n", debugstr_w(blob->pcwszDisplayName));
|
||||
TRACE("cbMemObject: %d\n", blob->cbMemObject);
|
||||
TRACE("cbMemObject: %ld\n", blob->cbMemObject);
|
||||
TRACE("pbMemObject: %p\n", blob->pbMemObject);
|
||||
TRACE("cbMemSignedMsg: %d\n", blob->cbMemSignedMsg);
|
||||
TRACE("cbMemSignedMsg: %ld\n", blob->cbMemSignedMsg);
|
||||
TRACE("pbMemSignedMsg: %p\n", blob->pbMemSignedMsg);
|
||||
}
|
||||
}
|
||||
@@ -602,10 +585,10 @@ static void dump_sgnr_info(WINTRUST_SGNR_INFO *sgnr)
|
||||
TRACE("%p\n", sgnr);
|
||||
if (sgnr)
|
||||
{
|
||||
TRACE("cbStruct: %d\n", sgnr->cbStruct);
|
||||
TRACE("cbStruct: %ld\n", sgnr->cbStruct);
|
||||
TRACE("pcwszDisplayName: %s\n", debugstr_w(sgnr->pcwszDisplayName));
|
||||
TRACE("psSignerInfo: %p\n", sgnr->psSignerInfo);
|
||||
TRACE("chStores: %d\n", sgnr->chStores);
|
||||
TRACE("chStores: %ld\n", sgnr->chStores);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -614,11 +597,11 @@ static void dump_cert_info(WINTRUST_CERT_INFO *cert)
|
||||
TRACE("%p\n", cert);
|
||||
if (cert)
|
||||
{
|
||||
TRACE("cbStruct: %d\n", cert->cbStruct);
|
||||
TRACE("cbStruct: %ld\n", cert->cbStruct);
|
||||
TRACE("pcwszDisplayName: %s\n", debugstr_w(cert->pcwszDisplayName));
|
||||
TRACE("psCertContext: %p\n", cert->psCertContext);
|
||||
TRACE("chStores: %d\n", cert->chStores);
|
||||
TRACE("dwFlags: %08x\n", cert->dwFlags);
|
||||
TRACE("chStores: %ld\n", cert->chStores);
|
||||
TRACE("dwFlags: %08lx\n", cert->dwFlags);
|
||||
TRACE("psftVerifyAsOf: %p\n", cert->psftVerifyAsOf);
|
||||
}
|
||||
}
|
||||
@@ -628,35 +611,35 @@ static void dump_wintrust_data(WINTRUST_DATA *data)
|
||||
TRACE("%p\n", data);
|
||||
if (data)
|
||||
{
|
||||
TRACE("cbStruct: %d\n", data->cbStruct);
|
||||
TRACE("cbStruct: %ld\n", data->cbStruct);
|
||||
TRACE("pPolicyCallbackData: %p\n", data->pPolicyCallbackData);
|
||||
TRACE("pSIPClientData: %p\n", data->pSIPClientData);
|
||||
TRACE("dwUIChoice: %d\n", data->dwUIChoice);
|
||||
TRACE("fdwRevocationChecks: %08x\n", data->fdwRevocationChecks);
|
||||
TRACE("dwUnionChoice: %d\n", data->dwUnionChoice);
|
||||
TRACE("dwUIChoice: %ld\n", data->dwUIChoice);
|
||||
TRACE("fdwRevocationChecks: %08lx\n", data->fdwRevocationChecks);
|
||||
TRACE("dwUnionChoice: %ld\n", data->dwUnionChoice);
|
||||
switch (data->dwUnionChoice)
|
||||
{
|
||||
case WTD_CHOICE_FILE:
|
||||
dump_file_info(data->u.pFile);
|
||||
dump_file_info(data->pFile);
|
||||
break;
|
||||
case WTD_CHOICE_CATALOG:
|
||||
dump_catalog_info(data->u.pCatalog);
|
||||
dump_catalog_info(data->pCatalog);
|
||||
break;
|
||||
case WTD_CHOICE_BLOB:
|
||||
dump_blob_info(data->u.pBlob);
|
||||
dump_blob_info(data->pBlob);
|
||||
break;
|
||||
case WTD_CHOICE_SIGNER:
|
||||
dump_sgnr_info(data->u.pSgnr);
|
||||
dump_sgnr_info(data->pSgnr);
|
||||
break;
|
||||
case WTD_CHOICE_CERT:
|
||||
dump_cert_info(data->u.pCert);
|
||||
dump_cert_info(data->pCert);
|
||||
break;
|
||||
}
|
||||
TRACE("dwStateAction: %d\n", data->dwStateAction);
|
||||
TRACE("dwStateAction: %ld\n", data->dwStateAction);
|
||||
TRACE("hWVTStateData: %p\n", data->hWVTStateData);
|
||||
TRACE("pwszURLReference: %s\n", debugstr_w(data->pwszURLReference));
|
||||
TRACE("dwProvFlags: %08x\n", data->dwProvFlags);
|
||||
TRACE("dwUIContext: %d\n", data->dwUIContext);
|
||||
TRACE("dwProvFlags: %08lx\n", data->dwProvFlags);
|
||||
TRACE("dwUIContext: %ld\n", data->dwUIContext);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -728,11 +711,12 @@ LONG WINAPI WinVerifyTrust( HWND hwnd, GUID *ActionID, LPVOID ActionData )
|
||||
err = WINTRUST_DefaultClose(hwnd, ActionID, ActionData);
|
||||
break;
|
||||
default:
|
||||
FIXME("unimplemented for %d\n", actionData->dwStateAction);
|
||||
FIXME("unimplemented for %ld\n", actionData->dwStateAction);
|
||||
}
|
||||
}
|
||||
|
||||
TRACE("returning %08x\n", err);
|
||||
if (err) SetLastError(err);
|
||||
TRACE("returning %08lx\n", err);
|
||||
return err;
|
||||
}
|
||||
|
||||
@@ -754,7 +738,7 @@ CRYPT_PROVIDER_SGNR * WINAPI WTHelperGetProvSignerFromChain(
|
||||
{
|
||||
CRYPT_PROVIDER_SGNR *sgnr;
|
||||
|
||||
TRACE("(%p %d %d %d)\n", pProvData, idxSigner, fCounterSigner,
|
||||
TRACE("(%p %ld %d %ld)\n", pProvData, idxSigner, fCounterSigner,
|
||||
idxCounterSigner);
|
||||
|
||||
if (idxSigner >= pProvData->csSigners || !pProvData->pasSigners)
|
||||
@@ -779,9 +763,9 @@ CRYPT_PROVIDER_CERT * WINAPI WTHelperGetProvCertFromChain(
|
||||
{
|
||||
CRYPT_PROVIDER_CERT *cert;
|
||||
|
||||
TRACE("(%p %d)\n", pSgnr, idxCert);
|
||||
TRACE("(%p %ld)\n", pSgnr, idxCert);
|
||||
|
||||
if (!pSgnr || idxCert >= pSgnr->csCertChain || !pSgnr->pasCertChain)
|
||||
if (idxCert >= pSgnr->csCertChain || !pSgnr->pasCertChain)
|
||||
return NULL;
|
||||
cert = &pSgnr->pasCertChain[idxCert];
|
||||
TRACE("returning %p\n", cert);
|
||||
@@ -823,7 +807,7 @@ LPCWSTR WINAPI WTHelperGetFileName(WINTRUST_DATA *data)
|
||||
{
|
||||
TRACE("%p\n",data);
|
||||
if (data->dwUnionChoice == WTD_CHOICE_FILE)
|
||||
return data->u.pFile->pcwszFilePath;
|
||||
return data->pFile->pcwszFilePath;
|
||||
else
|
||||
return NULL;
|
||||
}
|
||||
@@ -835,7 +819,7 @@ HANDLE WINAPI WTHelperGetFileHandle(WINTRUST_DATA *data)
|
||||
{
|
||||
TRACE("%p\n",data);
|
||||
if (data->dwUnionChoice == WTD_CHOICE_FILE)
|
||||
return data->u.pFile->hFile;
|
||||
return data->pFile->hFile;
|
||||
else
|
||||
return INVALID_HANDLE_VALUE;
|
||||
}
|
||||
@@ -849,7 +833,7 @@ static BOOL WINAPI WINTRUST_enumUsages(PCCRYPT_OID_INFO pInfo, void *pvArg)
|
||||
if (!*usages)
|
||||
{
|
||||
cUsages = 0;
|
||||
*usages = WINTRUST_Alloc(2 * sizeof(PCCRYPT_OID_INFO));
|
||||
*usages = malloc(2 * sizeof(PCCRYPT_OID_INFO));
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -860,8 +844,7 @@ static BOOL WINAPI WINTRUST_enumUsages(PCCRYPT_OID_INFO pInfo, void *pvArg)
|
||||
*/
|
||||
for (cUsages = 0, ptr = *usages; *ptr; ptr++, cUsages++)
|
||||
;
|
||||
*usages = WINTRUST_ReAlloc(*usages,
|
||||
(cUsages + 2) * sizeof(PCCRYPT_OID_INFO));
|
||||
*usages = realloc(*usages, (cUsages + 2) * sizeof(PCCRYPT_OID_INFO));
|
||||
}
|
||||
if (*usages)
|
||||
{
|
||||
@@ -897,7 +880,7 @@ BOOL WINAPI WTHelperGetKnownUsages(DWORD action, PCCRYPT_OID_INFO **usages)
|
||||
{
|
||||
BOOL ret;
|
||||
|
||||
TRACE("(%d, %p)\n", action, usages);
|
||||
TRACE("(%ld, %p)\n", action, usages);
|
||||
|
||||
if (!usages)
|
||||
{
|
||||
@@ -913,13 +896,13 @@ BOOL WINAPI WTHelperGetKnownUsages(DWORD action, PCCRYPT_OID_INFO **usages)
|
||||
}
|
||||
else if (action == 2)
|
||||
{
|
||||
WINTRUST_Free(*usages);
|
||||
free(*usages);
|
||||
*usages = NULL;
|
||||
ret = TRUE;
|
||||
}
|
||||
else
|
||||
{
|
||||
WARN("unknown action %d\n", action);
|
||||
WARN("unknown action %ld\n", action);
|
||||
SetLastError(ERROR_INVALID_PARAMETER);
|
||||
ret = FALSE;
|
||||
}
|
||||
@@ -978,7 +961,7 @@ BOOL WINAPI WintrustSetRegPolicyFlags( DWORD dwPolicyFlags)
|
||||
HKEY key;
|
||||
LONG r;
|
||||
|
||||
TRACE("%x\n", dwPolicyFlags);
|
||||
TRACE("%lx\n", dwPolicyFlags);
|
||||
|
||||
r = RegCreateKeyExW(HKEY_CURRENT_USER, Software_Publishing, 0,
|
||||
NULL, 0, KEY_WRITE, NULL, &key, NULL);
|
||||
@@ -1000,14 +983,7 @@ BOOL WINAPI WINTRUST_AddStore(CRYPT_PROVIDER_DATA *data, HCERTSTORE store)
|
||||
|
||||
TRACE("(%p, %p)\n", data, store);
|
||||
|
||||
if (data->chStores)
|
||||
data->pahStores = WINTRUST_ReAlloc(data->pahStores,
|
||||
(data->chStores + 1) * sizeof(HCERTSTORE));
|
||||
else
|
||||
{
|
||||
data->pahStores = WINTRUST_Alloc(sizeof(HCERTSTORE));
|
||||
data->chStores = 0;
|
||||
}
|
||||
data->pahStores = realloc(data->pahStores, (data->chStores + 1) * sizeof(HCERTSTORE));
|
||||
if (data->pahStores)
|
||||
{
|
||||
data->pahStores[data->chStores++] = CertDuplicateStore(store);
|
||||
@@ -1023,7 +999,7 @@ BOOL WINAPI WINTRUST_AddSgnr(CRYPT_PROVIDER_DATA *data,
|
||||
{
|
||||
BOOL ret = FALSE;
|
||||
|
||||
TRACE("(%p, %d, %d, %p)\n", data, fCounterSigner, idxSigner, sgnr);
|
||||
TRACE("(%p, %d, %ld, %p)\n", data, fCounterSigner, idxSigner, sgnr);
|
||||
|
||||
if (sgnr->cbStruct > sizeof(CRYPT_PROVIDER_SGNR))
|
||||
{
|
||||
@@ -1036,14 +1012,8 @@ BOOL WINAPI WINTRUST_AddSgnr(CRYPT_PROVIDER_DATA *data,
|
||||
SetLastError(ERROR_INVALID_PARAMETER);
|
||||
return FALSE;
|
||||
}
|
||||
if (data->csSigners)
|
||||
data->pasSigners = WINTRUST_ReAlloc(data->pasSigners,
|
||||
(data->csSigners + 1) * sizeof(CRYPT_PROVIDER_SGNR));
|
||||
else
|
||||
{
|
||||
data->pasSigners = WINTRUST_Alloc(sizeof(CRYPT_PROVIDER_SGNR));
|
||||
data->csSigners = 0;
|
||||
}
|
||||
data->pasSigners = realloc(data->pasSigners,
|
||||
(data->csSigners + 1) * sizeof(CRYPT_PROVIDER_SGNR));
|
||||
if (data->pasSigners)
|
||||
{
|
||||
if (idxSigner < data->csSigners)
|
||||
@@ -1076,7 +1046,7 @@ BOOL WINAPI WINTRUST_AddCert(CRYPT_PROVIDER_DATA *data, DWORD idxSigner,
|
||||
{
|
||||
BOOL ret = FALSE;
|
||||
|
||||
TRACE("(%p, %d, %d, %d, %p)\n", data, idxSigner, fCounterSigner,
|
||||
TRACE("(%p, %ld, %d, %ld, %p)\n", data, idxSigner, fCounterSigner,
|
||||
idxSigner, pCert2Add);
|
||||
|
||||
if (fCounterSigner)
|
||||
@@ -1085,17 +1055,10 @@ BOOL WINAPI WINTRUST_AddCert(CRYPT_PROVIDER_DATA *data, DWORD idxSigner,
|
||||
SetLastError(ERROR_INVALID_PARAMETER);
|
||||
return FALSE;
|
||||
}
|
||||
if (data->pasSigners[idxSigner].csCertChain)
|
||||
data->pasSigners[idxSigner].pasCertChain =
|
||||
WINTRUST_ReAlloc(data->pasSigners[idxSigner].pasCertChain,
|
||||
(data->pasSigners[idxSigner].csCertChain + 1) *
|
||||
sizeof(CRYPT_PROVIDER_CERT));
|
||||
else
|
||||
{
|
||||
data->pasSigners[idxSigner].pasCertChain =
|
||||
WINTRUST_Alloc(sizeof(CRYPT_PROVIDER_CERT));
|
||||
data->pasSigners[idxSigner].csCertChain = 0;
|
||||
}
|
||||
data->pasSigners[idxSigner].pasCertChain =
|
||||
realloc(data->pasSigners[idxSigner].pasCertChain,
|
||||
(data->pasSigners[idxSigner].csCertChain + 1) *
|
||||
sizeof(CRYPT_PROVIDER_CERT));
|
||||
if (data->pasSigners[idxSigner].pasCertChain)
|
||||
{
|
||||
CRYPT_PROVIDER_CERT *cert = &data->pasSigners[idxSigner].pasCertChain[
|
||||
@@ -1124,14 +1087,8 @@ BOOL WINAPI WINTRUST_AddPrivData(CRYPT_PROVIDER_DATA *data,
|
||||
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;
|
||||
}
|
||||
data->pasProvPrivData = realloc(data->pasProvPrivData,
|
||||
(data->csProvPrivData + 1) * sizeof(*data->pasProvPrivData));
|
||||
if (data->pasProvPrivData)
|
||||
{
|
||||
DWORD i;
|
||||
@@ -1204,7 +1161,7 @@ HRESULT WINAPI FindCertsByIssuer(PCERT_CHAIN pCertChains, DWORD *pcbCertChains,
|
||||
DWORD *pcCertChains, BYTE* pbEncodedIssuerName, DWORD cbEncodedIssuerName,
|
||||
LPCWSTR pwszPurpose, DWORD dwKeySpec)
|
||||
{
|
||||
FIXME("(%p, %p, %p, %p, %d, %s, %d): stub\n", pCertChains, pcbCertChains,
|
||||
FIXME("(%p, %p, %p, %p, %ld, %s, %ld): stub\n", pCertChains, pcbCertChains,
|
||||
pcCertChains, pbEncodedIssuerName, cbEncodedIssuerName,
|
||||
debugstr_w(pwszPurpose), dwKeySpec);
|
||||
return E_FAIL;
|
||||
|
||||
@@ -18,14 +18,11 @@
|
||||
#ifndef __WINTRUST_PRIV_H__
|
||||
#define __WINTRUST_PRIV_H__
|
||||
|
||||
void * WINAPI WINTRUST_Alloc(DWORD cb) __WINE_ALLOC_SIZE(1) DECLSPEC_HIDDEN;
|
||||
void WINAPI WINTRUST_Free(void *p) DECLSPEC_HIDDEN;
|
||||
BOOL WINAPI WINTRUST_AddStore(CRYPT_PROVIDER_DATA *data, HCERTSTORE store) DECLSPEC_HIDDEN;
|
||||
BOOL WINAPI WINTRUST_AddStore(CRYPT_PROVIDER_DATA *data, HCERTSTORE store);
|
||||
BOOL WINAPI WINTRUST_AddSgnr(CRYPT_PROVIDER_DATA *data,
|
||||
BOOL fCounterSigner, DWORD idxSigner, CRYPT_PROVIDER_SGNR *sgnr) DECLSPEC_HIDDEN;
|
||||
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) DECLSPEC_HIDDEN;
|
||||
BOOL WINAPI WINTRUST_AddPrivData(CRYPT_PROVIDER_DATA *data,
|
||||
CRYPT_PROVIDER_PRIVDATA *pPrivData2Add) DECLSPEC_HIDDEN;
|
||||
BOOL fCounterSigner, DWORD idxCounterSigner, PCCERT_CONTEXT pCert2Add);
|
||||
BOOL WINAPI WINTRUST_AddPrivData(CRYPT_PROVIDER_DATA *data, CRYPT_PROVIDER_PRIVDATA *pPrivData2Add);
|
||||
|
||||
#endif /* ndef __WINTRUST_PRIV_H__ */
|
||||
|
||||
@@ -217,7 +217,7 @@ dll/win32/winmm # Forked at Wine-20050628
|
||||
dll/win32/winmm/midimap # Forked at Wine-20050628
|
||||
dll/win32/winmm/wavemap # Forked at Wine-20050628
|
||||
dll/win32/winscard # Synced to WineStaging-4.18
|
||||
dll/win32/wintrust # Synced to WineStaging-4.18
|
||||
dll/win32/wintrust # Synced to Wine-10.0
|
||||
dll/win32/wldap32 # Synced to WineStaging-4.18
|
||||
dll/win32/wmi # Synced to WineStaging-2.9
|
||||
dll/win32/wmiutils # Synced to WineStaging-4.18
|
||||
|
||||
@@ -46,20 +46,20 @@ static void test_encodeSPCFinancialCriteria(void)
|
||||
}
|
||||
ret = pCryptEncodeObjectEx(X509_ASN_ENCODING, SPC_FINANCIAL_CRITERIA_STRUCT,
|
||||
&criteria, CRYPT_ENCODE_ALLOC_FLAG, NULL, &buf, &size);
|
||||
ok(ret, "CryptEncodeObjectEx failed: %08x\n", GetLastError());
|
||||
ok(ret, "CryptEncodeObjectEx failed: %08lx\n", GetLastError());
|
||||
if (ret)
|
||||
{
|
||||
ok(size == sizeof(falseCriteria), "Unexpected size %d\n", size);
|
||||
ok(size == sizeof(falseCriteria), "Unexpected size %ld\n", size);
|
||||
ok(!memcmp(buf, falseCriteria, size), "Unexpected value\n");
|
||||
LocalFree(buf);
|
||||
}
|
||||
criteria.fFinancialInfoAvailable = criteria.fMeetsCriteria = TRUE;
|
||||
ret = pCryptEncodeObjectEx(X509_ASN_ENCODING, SPC_FINANCIAL_CRITERIA_STRUCT,
|
||||
&criteria, CRYPT_ENCODE_ALLOC_FLAG, NULL, &buf, &size);
|
||||
ok(ret, "CryptEncodeObjectEx failed: %08x\n", GetLastError());
|
||||
ok(ret, "CryptEncodeObjectEx failed: %08lx\n", GetLastError());
|
||||
if (ret)
|
||||
{
|
||||
ok(size == sizeof(trueCriteria), "Unexpected size %d\n", size);
|
||||
ok(size == sizeof(trueCriteria), "Unexpected size %ld\n", size);
|
||||
ok(!memcmp(buf, trueCriteria, size), "Unexpected value\n");
|
||||
LocalFree(buf);
|
||||
}
|
||||
@@ -79,7 +79,7 @@ static void test_decodeSPCFinancialCriteria(void)
|
||||
|
||||
ret = pCryptDecodeObjectEx(X509_ASN_ENCODING, SPC_FINANCIAL_CRITERIA_STRUCT,
|
||||
falseCriteria, sizeof(falseCriteria), 0, NULL, &criteria, &size);
|
||||
ok(ret, "CryptDecodeObjectEx failed: %08x\n", GetLastError());
|
||||
ok(ret, "CryptDecodeObjectEx failed: %08lx\n", GetLastError());
|
||||
if (ret)
|
||||
{
|
||||
ok(!criteria.fFinancialInfoAvailable, "expected FALSE\n");
|
||||
@@ -87,7 +87,7 @@ static void test_decodeSPCFinancialCriteria(void)
|
||||
}
|
||||
ret = pCryptDecodeObjectEx(X509_ASN_ENCODING, SPC_FINANCIAL_CRITERIA_STRUCT,
|
||||
trueCriteria, sizeof(trueCriteria), 0, NULL, &criteria, &size);
|
||||
ok(ret, "CryptDecodeObjectEx failed: %08x\n", GetLastError());
|
||||
ok(ret, "CryptDecodeObjectEx failed: %08lx\n", GetLastError());
|
||||
if (ret)
|
||||
{
|
||||
ok(criteria.fFinancialInfoAvailable, "expected TRUE\n");
|
||||
@@ -131,19 +131,19 @@ static void test_encodeSPCLink(void)
|
||||
ret = pCryptEncodeObjectEx(X509_ASN_ENCODING, SPC_LINK_STRUCT, &link,
|
||||
CRYPT_ENCODE_ALLOC_FLAG, NULL, &buf, &size);
|
||||
ok(!ret && GetLastError() == E_INVALIDARG,
|
||||
"Expected E_INVALIDARG, got %08x\n", GetLastError());
|
||||
"Expected E_INVALIDARG, got %08lx\n", GetLastError());
|
||||
link.dwLinkChoice = SPC_URL_LINK_CHOICE;
|
||||
ret = pCryptEncodeObjectEx(X509_ASN_ENCODING, SPC_LINK_STRUCT, &link,
|
||||
CRYPT_ENCODE_ALLOC_FLAG, NULL, &buf, &size);
|
||||
ok(ret, "CryptEncodeObjectEx failed: %08x\n", GetLastError());
|
||||
ok(ret, "CryptEncodeObjectEx failed: %08lx\n", GetLastError());
|
||||
if (ret)
|
||||
{
|
||||
ok(size == sizeof(emptyURLSPCLink), "Unexpected size %d\n", size);
|
||||
ok(size == sizeof(emptyURLSPCLink), "Unexpected size %ld\n", size);
|
||||
ok(!memcmp(buf, emptyURLSPCLink, size), "Unexpected value\n");
|
||||
LocalFree(buf);
|
||||
}
|
||||
/* With an invalid char: */
|
||||
U(link).pwszUrl = (LPWSTR)nihongoURL;
|
||||
link.pwszUrl = (LPWSTR)nihongoURL;
|
||||
size = 1;
|
||||
SetLastError(0xdeadbeef);
|
||||
ret = pCryptEncodeObjectEx(X509_ASN_ENCODING, SPC_LINK_STRUCT, &link,
|
||||
@@ -151,52 +151,52 @@ static void test_encodeSPCLink(void)
|
||||
ok(!ret &&
|
||||
(GetLastError() == CRYPT_E_INVALID_IA5_STRING ||
|
||||
GetLastError() == OSS_BAD_PTR /* WinNT */),
|
||||
"Expected CRYPT_E_INVALID_IA5_STRING, got %08x\n", GetLastError());
|
||||
"Expected CRYPT_E_INVALID_IA5_STRING, got %08lx\n", GetLastError());
|
||||
/* Unlike the crypt32 string encoding routines, size is not set to the
|
||||
* index of the first invalid character.
|
||||
*/
|
||||
ok(size == 0, "Expected size 0, got %d\n", size);
|
||||
U(link).pwszUrl = url;
|
||||
ok(size == 0, "Expected size 0, got %ld\n", size);
|
||||
link.pwszUrl = url;
|
||||
ret = pCryptEncodeObjectEx(X509_ASN_ENCODING, SPC_LINK_STRUCT, &link,
|
||||
CRYPT_ENCODE_ALLOC_FLAG, NULL, &buf, &size);
|
||||
ok(ret, "CryptEncodeObjectEx failed: %08x\n", GetLastError());
|
||||
ok(ret, "CryptEncodeObjectEx failed: %08lx\n", GetLastError());
|
||||
if (ret)
|
||||
{
|
||||
ok(size == sizeof(urlSPCLink), "Unexpected size %d\n", size);
|
||||
ok(size == sizeof(urlSPCLink), "Unexpected size %ld\n", size);
|
||||
ok(!memcmp(buf, urlSPCLink, size), "Unexpected value\n");
|
||||
LocalFree(buf);
|
||||
}
|
||||
link.dwLinkChoice = SPC_FILE_LINK_CHOICE;
|
||||
U(link).pwszFile = (LPWSTR)nihongoURL;
|
||||
link.pwszFile = (LPWSTR)nihongoURL;
|
||||
ret = pCryptEncodeObjectEx(X509_ASN_ENCODING, SPC_LINK_STRUCT, &link,
|
||||
CRYPT_ENCODE_ALLOC_FLAG, NULL, &buf, &size);
|
||||
ok(ret, "CryptEncodeObjectEx failed: %08x\n", GetLastError());
|
||||
ok(ret, "CryptEncodeObjectEx failed: %08lx\n", GetLastError());
|
||||
if (ret)
|
||||
{
|
||||
ok(size == sizeof(fileSPCLink), "Unexpected size %d\n", size);
|
||||
ok(size == sizeof(fileSPCLink), "Unexpected size %ld\n", size);
|
||||
ok(!memcmp(buf, fileSPCLink, size), "Unexpected value\n");
|
||||
LocalFree(buf);
|
||||
}
|
||||
link.dwLinkChoice = SPC_MONIKER_LINK_CHOICE;
|
||||
memset(&U(link).Moniker, 0, sizeof(U(link).Moniker));
|
||||
memset(&link.Moniker, 0, sizeof(link.Moniker));
|
||||
ret = pCryptEncodeObjectEx(X509_ASN_ENCODING, SPC_LINK_STRUCT, &link,
|
||||
CRYPT_ENCODE_ALLOC_FLAG, NULL, &buf, &size);
|
||||
ok(ret, "CryptEncodeObjectEx failed: %08x\n", GetLastError());
|
||||
ok(ret, "CryptEncodeObjectEx failed: %08lx\n", GetLastError());
|
||||
if (ret)
|
||||
{
|
||||
ok(size == sizeof(emptyMonikerSPCLink), "Unexpected size %d\n", size);
|
||||
ok(size == sizeof(emptyMonikerSPCLink), "Unexpected size %ld\n", size);
|
||||
ok(!memcmp(buf, emptyMonikerSPCLink, size), "Unexpected value\n");
|
||||
LocalFree(buf);
|
||||
}
|
||||
memset(&U(link).Moniker.ClassId, 0xea, sizeof(U(link).Moniker.ClassId));
|
||||
U(link).Moniker.SerializedData.pbData = data;
|
||||
U(link).Moniker.SerializedData.cbData = sizeof(data);
|
||||
memset(&link.Moniker.ClassId, 0xea, sizeof(link.Moniker.ClassId));
|
||||
link.Moniker.SerializedData.pbData = data;
|
||||
link.Moniker.SerializedData.cbData = sizeof(data);
|
||||
ret = pCryptEncodeObjectEx(X509_ASN_ENCODING, SPC_LINK_STRUCT, &link,
|
||||
CRYPT_ENCODE_ALLOC_FLAG, NULL, &buf, &size);
|
||||
ok(ret, "CryptEncodeObjectEx failed: %08x\n", GetLastError());
|
||||
ok(ret, "CryptEncodeObjectEx failed: %08lx\n", GetLastError());
|
||||
if (ret)
|
||||
{
|
||||
ok(size == sizeof(monikerSPCLink), "Unexpected size %d\n", size);
|
||||
ok(size == sizeof(monikerSPCLink), "Unexpected size %ld\n", size);
|
||||
ok(!memcmp(buf, monikerSPCLink, size), "Unexpected value\n");
|
||||
LocalFree(buf);
|
||||
}
|
||||
@@ -222,73 +222,73 @@ static void test_decodeSPCLink(void)
|
||||
ret = pCryptDecodeObjectEx(X509_ASN_ENCODING, SPC_LINK_STRUCT,
|
||||
emptyURLSPCLink, sizeof(emptyURLSPCLink), CRYPT_DECODE_ALLOC_FLAG, NULL,
|
||||
&buf, &size);
|
||||
ok(ret, "CryptDecodeObjectEx failed: %08x\n", GetLastError());
|
||||
ok(ret, "CryptDecodeObjectEx failed: %08lx\n", GetLastError());
|
||||
if (ret)
|
||||
{
|
||||
link = (SPC_LINK *)buf;
|
||||
ok(link->dwLinkChoice == SPC_URL_LINK_CHOICE,
|
||||
"Expected SPC_URL_LINK_CHOICE, got %d\n", link->dwLinkChoice);
|
||||
ok(lstrlenW(U(*link).pwszUrl) == 0, "Expected empty string\n");
|
||||
"Expected SPC_URL_LINK_CHOICE, got %ld\n", link->dwLinkChoice);
|
||||
ok(lstrlenW(link->pwszUrl) == 0, "Expected empty string\n");
|
||||
LocalFree(buf);
|
||||
}
|
||||
ret = pCryptDecodeObjectEx(X509_ASN_ENCODING, SPC_LINK_STRUCT,
|
||||
urlSPCLink, sizeof(urlSPCLink), CRYPT_DECODE_ALLOC_FLAG, NULL,
|
||||
&buf, &size);
|
||||
ok(ret, "CryptDecodeObjectEx failed: %08x\n", GetLastError());
|
||||
ok(ret, "CryptDecodeObjectEx failed: %08lx\n", GetLastError());
|
||||
if (ret)
|
||||
{
|
||||
link = (SPC_LINK *)buf;
|
||||
ok(link->dwLinkChoice == SPC_URL_LINK_CHOICE,
|
||||
"Expected SPC_URL_LINK_CHOICE, got %d\n", link->dwLinkChoice);
|
||||
ok(!lstrcmpW(U(*link).pwszUrl, url), "Unexpected URL\n");
|
||||
"Expected SPC_URL_LINK_CHOICE, got %ld\n", link->dwLinkChoice);
|
||||
ok(!lstrcmpW(link->pwszUrl, url), "Unexpected URL\n");
|
||||
LocalFree(buf);
|
||||
}
|
||||
ret = pCryptDecodeObjectEx(X509_ASN_ENCODING, SPC_LINK_STRUCT,
|
||||
fileSPCLink, sizeof(fileSPCLink), CRYPT_DECODE_ALLOC_FLAG, NULL,
|
||||
&buf, &size);
|
||||
ok(ret, "CryptDecodeObjectEx failed: %08x\n", GetLastError());
|
||||
ok(ret, "CryptDecodeObjectEx failed: %08lx\n", GetLastError());
|
||||
if (ret)
|
||||
{
|
||||
link = (SPC_LINK *)buf;
|
||||
ok(link->dwLinkChoice == SPC_FILE_LINK_CHOICE,
|
||||
"Expected SPC_FILE_LINK_CHOICE, got %d\n", link->dwLinkChoice);
|
||||
ok(!lstrcmpW(U(*link).pwszFile, nihongoURL), "Unexpected file\n");
|
||||
"Expected SPC_FILE_LINK_CHOICE, got %ld\n", link->dwLinkChoice);
|
||||
ok(!lstrcmpW(link->pwszFile, nihongoURL), "Unexpected file\n");
|
||||
LocalFree(buf);
|
||||
}
|
||||
ret = pCryptDecodeObjectEx(X509_ASN_ENCODING, SPC_LINK_STRUCT,
|
||||
emptyMonikerSPCLink, sizeof(emptyMonikerSPCLink), CRYPT_DECODE_ALLOC_FLAG,
|
||||
NULL, &buf, &size);
|
||||
ok(ret, "CryptDecodeObjectEx failed: %08x\n", GetLastError());
|
||||
ok(ret, "CryptDecodeObjectEx failed: %08lx\n", GetLastError());
|
||||
if (ret)
|
||||
{
|
||||
SPC_SERIALIZED_OBJECT emptyMoniker = { { 0 } };
|
||||
|
||||
link = (SPC_LINK *)buf;
|
||||
ok(link->dwLinkChoice == SPC_MONIKER_LINK_CHOICE,
|
||||
"Expected SPC_MONIKER_LINK_CHOICE, got %d\n", link->dwLinkChoice);
|
||||
ok(!memcmp(&U(*link).Moniker.ClassId, &emptyMoniker.ClassId,
|
||||
"Expected SPC_MONIKER_LINK_CHOICE, got %ld\n", link->dwLinkChoice);
|
||||
ok(!memcmp(&link->Moniker.ClassId, &emptyMoniker.ClassId,
|
||||
sizeof(emptyMoniker.ClassId)), "Unexpected value\n");
|
||||
ok(U(*link).Moniker.SerializedData.cbData == 0,
|
||||
ok(link->Moniker.SerializedData.cbData == 0,
|
||||
"Expected no serialized data\n");
|
||||
LocalFree(buf);
|
||||
}
|
||||
ret = pCryptDecodeObjectEx(X509_ASN_ENCODING, SPC_LINK_STRUCT,
|
||||
monikerSPCLink, sizeof(monikerSPCLink), CRYPT_DECODE_ALLOC_FLAG, NULL,
|
||||
&buf, &size);
|
||||
ok(ret, "CryptDecodeObjectEx failed: %08x\n", GetLastError());
|
||||
ok(ret, "CryptDecodeObjectEx failed: %08lx\n", GetLastError());
|
||||
if (ret)
|
||||
{
|
||||
SPC_UUID id;
|
||||
|
||||
link = (SPC_LINK *)buf;
|
||||
ok(link->dwLinkChoice == SPC_MONIKER_LINK_CHOICE,
|
||||
"Expected SPC_MONIKER_LINK_CHOICE, got %d\n", link->dwLinkChoice);
|
||||
"Expected SPC_MONIKER_LINK_CHOICE, got %ld\n", link->dwLinkChoice);
|
||||
memset(&id, 0xea, sizeof(id));
|
||||
ok(!memcmp(&U(*link).Moniker.ClassId, &id, sizeof(id)),
|
||||
ok(!memcmp(&link->Moniker.ClassId, &id, sizeof(id)),
|
||||
"Unexpected value\n");
|
||||
ok(U(*link).Moniker.SerializedData.cbData == sizeof(data),
|
||||
"Unexpected data size %d\n", U(*link).Moniker.SerializedData.cbData);
|
||||
ok(!memcmp(U(*link).Moniker.SerializedData.pbData, data, sizeof(data)),
|
||||
ok(link->Moniker.SerializedData.cbData == sizeof(data),
|
||||
"Unexpected data size %ld\n", link->Moniker.SerializedData.cbData);
|
||||
ok(!memcmp(link->Moniker.SerializedData.pbData, data, sizeof(data)),
|
||||
"Unexpected value\n");
|
||||
LocalFree(buf);
|
||||
}
|
||||
@@ -299,7 +299,7 @@ static void test_decodeSPCLink(void)
|
||||
ok(!ret &&
|
||||
(GetLastError() == CRYPT_E_BAD_ENCODE ||
|
||||
GetLastError() == OSS_DATA_ERROR /* WinNT */),
|
||||
"Expected CRYPT_E_BAD_ENCODE, got %08x\n", GetLastError());
|
||||
"Expected CRYPT_E_BAD_ENCODE, got %08lx\n", GetLastError());
|
||||
}
|
||||
|
||||
static const BYTE emptySequence[] = { 0x30,0x00 };
|
||||
@@ -329,10 +329,10 @@ static void test_encodeSPCPEImage(void)
|
||||
|
||||
ret = pCryptEncodeObjectEx(X509_ASN_ENCODING, SPC_PE_IMAGE_DATA_STRUCT,
|
||||
&imageData, CRYPT_ENCODE_ALLOC_FLAG, NULL, &buf, &size);
|
||||
ok(ret, "CryptEncodeObjectEx failed: %08x\n", GetLastError());
|
||||
ok(ret, "CryptEncodeObjectEx failed: %08lx\n", GetLastError());
|
||||
if (ret)
|
||||
{
|
||||
ok(size == sizeof(emptySequence), "Unexpected size %d\n", size);
|
||||
ok(size == sizeof(emptySequence), "Unexpected size %ld\n", size);
|
||||
ok(!memcmp(buf, emptySequence, sizeof(emptySequence)),
|
||||
"Unexpected value\n");
|
||||
LocalFree(buf);
|
||||
@@ -343,16 +343,16 @@ static void test_encodeSPCPEImage(void)
|
||||
ret = pCryptEncodeObjectEx(X509_ASN_ENCODING, SPC_PE_IMAGE_DATA_STRUCT,
|
||||
&imageData, CRYPT_ENCODE_ALLOC_FLAG, NULL, &buf, &size);
|
||||
ok(!ret && GetLastError () == E_INVALIDARG,
|
||||
"Expected E_INVALIDARG, got %08x\n", GetLastError());
|
||||
"Expected E_INVALIDARG, got %08lx\n", GetLastError());
|
||||
/* With just unused bits field set: */
|
||||
imageData.pFile = NULL;
|
||||
imageData.Flags.cUnusedBits = 1;
|
||||
ret = pCryptEncodeObjectEx(X509_ASN_ENCODING, SPC_PE_IMAGE_DATA_STRUCT,
|
||||
&imageData, CRYPT_ENCODE_ALLOC_FLAG, NULL, &buf, &size);
|
||||
ok(ret, "CryptEncodeObjectEx failed: %08x\n", GetLastError());
|
||||
ok(ret, "CryptEncodeObjectEx failed: %08lx\n", GetLastError());
|
||||
if (ret)
|
||||
{
|
||||
ok(size == sizeof(emptySequence), "Unexpected size %d\n", size);
|
||||
ok(size == sizeof(emptySequence), "Unexpected size %ld\n", size);
|
||||
ok(!memcmp(buf, emptySequence, sizeof(emptySequence)),
|
||||
"Unexpected value\n");
|
||||
LocalFree(buf);
|
||||
@@ -368,10 +368,10 @@ static void test_encodeSPCPEImage(void)
|
||||
skip("SPC_PE_IMAGE_DATA_STRUCT not supported\n");
|
||||
return;
|
||||
}
|
||||
ok(ret, "CryptEncodeObjectEx failed: %08x\n", GetLastError());
|
||||
ok(ret, "CryptEncodeObjectEx failed: %08lx\n", GetLastError());
|
||||
if (ret)
|
||||
{
|
||||
ok(size == sizeof(onlyFlagsPEImage), "Unexpected size %d\n", size);
|
||||
ok(size == sizeof(onlyFlagsPEImage), "Unexpected size %ld\n", size);
|
||||
ok(!memcmp(buf, onlyFlagsPEImage, sizeof(onlyFlagsPEImage)),
|
||||
"Unexpected value\n");
|
||||
LocalFree(buf);
|
||||
@@ -382,10 +382,10 @@ static void test_encodeSPCPEImage(void)
|
||||
imageData.pFile = &link;
|
||||
ret = pCryptEncodeObjectEx(X509_ASN_ENCODING, SPC_PE_IMAGE_DATA_STRUCT,
|
||||
&imageData, CRYPT_ENCODE_ALLOC_FLAG, NULL, &buf, &size);
|
||||
ok(ret, "CryptEncodeObjectEx failed: %08x\n", GetLastError());
|
||||
ok(ret, "CryptEncodeObjectEx failed: %08lx\n", GetLastError());
|
||||
if (ret)
|
||||
{
|
||||
ok(size == sizeof(onlyEmptyFilePEImage), "Unexpected size %d\n", size);
|
||||
ok(size == sizeof(onlyEmptyFilePEImage), "Unexpected size %ld\n", size);
|
||||
ok(!memcmp(buf, onlyEmptyFilePEImage, sizeof(onlyEmptyFilePEImage)),
|
||||
"Unexpected value\n");
|
||||
LocalFree(buf);
|
||||
@@ -395,23 +395,23 @@ static void test_encodeSPCPEImage(void)
|
||||
imageData.Flags.cbData = sizeof(flags);
|
||||
ret = pCryptEncodeObjectEx(X509_ASN_ENCODING, SPC_PE_IMAGE_DATA_STRUCT,
|
||||
&imageData, CRYPT_ENCODE_ALLOC_FLAG, NULL, &buf, &size);
|
||||
ok(ret, "CryptEncodeObjectEx failed: %08x\n", GetLastError());
|
||||
ok(ret, "CryptEncodeObjectEx failed: %08lx\n", GetLastError());
|
||||
if (ret)
|
||||
{
|
||||
ok(size == sizeof(flagsAndEmptyFilePEImage), "Unexpected size %d\n",
|
||||
ok(size == sizeof(flagsAndEmptyFilePEImage), "Unexpected size %ld\n",
|
||||
size);
|
||||
ok(!memcmp(buf, flagsAndEmptyFilePEImage,
|
||||
sizeof(flagsAndEmptyFilePEImage)), "Unexpected value\n");
|
||||
LocalFree(buf);
|
||||
}
|
||||
/* Finally, a non-empty file: */
|
||||
U(link).pwszFile = (LPWSTR)nihongoURL;
|
||||
link.pwszFile = (LPWSTR)nihongoURL;
|
||||
ret = pCryptEncodeObjectEx(X509_ASN_ENCODING, SPC_PE_IMAGE_DATA_STRUCT,
|
||||
&imageData, CRYPT_ENCODE_ALLOC_FLAG, NULL, &buf, &size);
|
||||
ok(ret, "CryptEncodeObjectEx failed: %08x\n", GetLastError());
|
||||
ok(ret, "CryptEncodeObjectEx failed: %08lx\n", GetLastError());
|
||||
if (ret)
|
||||
{
|
||||
ok(size == sizeof(flagsAndFilePEImage), "Unexpected size %d\n", size);
|
||||
ok(size == sizeof(flagsAndFilePEImage), "Unexpected size %ld\n", size);
|
||||
ok(!memcmp(buf, flagsAndFilePEImage, sizeof(flagsAndFilePEImage)),
|
||||
"Unexpected value\n");
|
||||
LocalFree(buf);
|
||||
@@ -435,11 +435,11 @@ static void test_decodeSPCPEImage(void)
|
||||
ret = pCryptDecodeObjectEx(X509_ASN_ENCODING, SPC_PE_IMAGE_DATA_STRUCT,
|
||||
emptySequence, sizeof(emptySequence),
|
||||
CRYPT_DECODE_ALLOC_FLAG, NULL, &buf, &size);
|
||||
ok(ret, "CryptDecodeObjectEx failed: %08x\n", GetLastError());
|
||||
ok(ret, "CryptDecodeObjectEx failed: %08lx\n", GetLastError());
|
||||
if (ret)
|
||||
{
|
||||
imageData = (SPC_PE_IMAGE_DATA *)buf;
|
||||
ok(imageData->Flags.cbData == 0, "Expected empty flags, got %d\n",
|
||||
ok(imageData->Flags.cbData == 0, "Expected empty flags, got %ld\n",
|
||||
imageData->Flags.cbData);
|
||||
ok(imageData->pFile == NULL, "Expected no file\n");
|
||||
LocalFree(buf);
|
||||
@@ -447,12 +447,12 @@ static void test_decodeSPCPEImage(void)
|
||||
ret = pCryptDecodeObjectEx(X509_ASN_ENCODING, SPC_PE_IMAGE_DATA_STRUCT,
|
||||
onlyFlagsPEImage, sizeof(onlyFlagsPEImage),
|
||||
CRYPT_DECODE_ALLOC_FLAG, NULL, &buf, &size);
|
||||
ok(ret, "CryptDecodeObjectEx failed: %08x\n", GetLastError());
|
||||
ok(ret, "CryptDecodeObjectEx failed: %08lx\n", GetLastError());
|
||||
if (ret)
|
||||
{
|
||||
imageData = (SPC_PE_IMAGE_DATA *)buf;
|
||||
ok(imageData->Flags.cbData == sizeof(flags),
|
||||
"Unexpected flags size %d\n", imageData->Flags.cbData);
|
||||
"Unexpected flags size %ld\n", imageData->Flags.cbData);
|
||||
if (imageData->Flags.cbData)
|
||||
ok(!memcmp(imageData->Flags.pbData, flags, sizeof(flags)),
|
||||
"Unexpected flags\n");
|
||||
@@ -462,19 +462,19 @@ static void test_decodeSPCPEImage(void)
|
||||
ret = pCryptDecodeObjectEx(X509_ASN_ENCODING, SPC_PE_IMAGE_DATA_STRUCT,
|
||||
onlyEmptyFilePEImage, sizeof(onlyEmptyFilePEImage),
|
||||
CRYPT_DECODE_ALLOC_FLAG, NULL, &buf, &size);
|
||||
ok(ret, "CryptDecodeObjectEx failed: %08x\n", GetLastError());
|
||||
ok(ret, "CryptDecodeObjectEx failed: %08lx\n", GetLastError());
|
||||
if (ret)
|
||||
{
|
||||
imageData = (SPC_PE_IMAGE_DATA *)buf;
|
||||
ok(imageData->Flags.cbData == 0, "Expected empty flags, got %d\n",
|
||||
ok(imageData->Flags.cbData == 0, "Expected empty flags, got %ld\n",
|
||||
imageData->Flags.cbData);
|
||||
ok(imageData->pFile != NULL, "Expected a file\n");
|
||||
if (imageData->pFile)
|
||||
{
|
||||
ok(imageData->pFile->dwLinkChoice == SPC_FILE_LINK_CHOICE,
|
||||
"Expected SPC_FILE_LINK_CHOICE, got %d\n",
|
||||
"Expected SPC_FILE_LINK_CHOICE, got %ld\n",
|
||||
imageData->pFile->dwLinkChoice);
|
||||
ok(!lstrcmpW(U(*imageData->pFile).pwszFile, emptyString),
|
||||
ok(!lstrcmpW(imageData->pFile->pwszFile, emptyString),
|
||||
"Unexpected file\n");
|
||||
}
|
||||
LocalFree(buf);
|
||||
@@ -482,12 +482,12 @@ static void test_decodeSPCPEImage(void)
|
||||
ret = pCryptDecodeObjectEx(X509_ASN_ENCODING, SPC_PE_IMAGE_DATA_STRUCT,
|
||||
flagsAndEmptyFilePEImage, sizeof(flagsAndEmptyFilePEImage),
|
||||
CRYPT_DECODE_ALLOC_FLAG, NULL, &buf, &size);
|
||||
ok(ret, "CryptDecodeObjectEx failed: %08x\n", GetLastError());
|
||||
ok(ret, "CryptDecodeObjectEx failed: %08lx\n", GetLastError());
|
||||
if (ret)
|
||||
{
|
||||
imageData = (SPC_PE_IMAGE_DATA *)buf;
|
||||
ok(imageData->Flags.cbData == sizeof(flags),
|
||||
"Unexpected flags size %d\n", imageData->Flags.cbData);
|
||||
"Unexpected flags size %ld\n", imageData->Flags.cbData);
|
||||
if (imageData->Flags.cbData)
|
||||
ok(!memcmp(imageData->Flags.pbData, flags, sizeof(flags)),
|
||||
"Unexpected flags\n");
|
||||
@@ -495,9 +495,9 @@ static void test_decodeSPCPEImage(void)
|
||||
if (imageData->pFile)
|
||||
{
|
||||
ok(imageData->pFile->dwLinkChoice == SPC_FILE_LINK_CHOICE,
|
||||
"Expected SPC_FILE_LINK_CHOICE, got %d\n",
|
||||
"Expected SPC_FILE_LINK_CHOICE, got %ld\n",
|
||||
imageData->pFile->dwLinkChoice);
|
||||
ok(!lstrcmpW(U(*imageData->pFile).pwszFile, emptyString),
|
||||
ok(!lstrcmpW(imageData->pFile->pwszFile, emptyString),
|
||||
"Unexpected file\n");
|
||||
}
|
||||
LocalFree(buf);
|
||||
@@ -505,12 +505,12 @@ static void test_decodeSPCPEImage(void)
|
||||
ret = pCryptDecodeObjectEx(X509_ASN_ENCODING, SPC_PE_IMAGE_DATA_STRUCT,
|
||||
flagsAndFilePEImage, sizeof(flagsAndFilePEImage),
|
||||
CRYPT_DECODE_ALLOC_FLAG, NULL, &buf, &size);
|
||||
ok(ret, "CryptDecodeObjectEx failed: %08x\n", GetLastError());
|
||||
ok(ret, "CryptDecodeObjectEx failed: %08lx\n", GetLastError());
|
||||
if (ret)
|
||||
{
|
||||
imageData = (SPC_PE_IMAGE_DATA *)buf;
|
||||
ok(imageData->Flags.cbData == sizeof(flags),
|
||||
"Unexpected flags size %d\n", imageData->Flags.cbData);
|
||||
"Unexpected flags size %ld\n", imageData->Flags.cbData);
|
||||
if (imageData->Flags.cbData)
|
||||
ok(!memcmp(imageData->Flags.pbData, flags, sizeof(flags)),
|
||||
"Unexpected flags\n");
|
||||
@@ -518,15 +518,254 @@ static void test_decodeSPCPEImage(void)
|
||||
if (imageData->pFile)
|
||||
{
|
||||
ok(imageData->pFile->dwLinkChoice == SPC_FILE_LINK_CHOICE,
|
||||
"Expected SPC_FILE_LINK_CHOICE, got %d\n",
|
||||
"Expected SPC_FILE_LINK_CHOICE, got %ld\n",
|
||||
imageData->pFile->dwLinkChoice);
|
||||
ok(!lstrcmpW(U(*imageData->pFile).pwszFile, nihongoURL),
|
||||
ok(!lstrcmpW(imageData->pFile->pwszFile, nihongoURL),
|
||||
"Unexpected file\n");
|
||||
}
|
||||
LocalFree(buf);
|
||||
}
|
||||
}
|
||||
|
||||
static const BYTE emptyIndirectData[] = {
|
||||
0x30,0x0c,0x30,0x02,0x06,0x00,0x30,0x06,0x30,0x02,0x06,0x00,0x04,0x00 };
|
||||
static const BYTE spcidcWithOnlyDigest[] = {
|
||||
0x30,0x20,0x30,0x02,0x06,0x00,0x30,0x1a,0x30,0x02,0x06,0x00,0x04,0x14,0x01,0x02,
|
||||
0x03,0x04,0x05,0x06,0x07,0x08,0x09,0x0a,0x0b,0x0c,0x0d,0x0e,0x0f,0x10,0x11,0x12,
|
||||
0x13,0x14 };
|
||||
static const BYTE spcidcWithDigestAndAlgorithm[] = {
|
||||
0x30,0x27,0x30,0x02,0x06,0x00,0x30,0x21,0x30,0x09,0x06,0x05,0x2b,0x0e,0x03,0x02,
|
||||
0x1a,0x05,0x00,0x04,0x14,0x01,0x02,0x03,0x04,0x05,0x06,0x07,0x08,0x09,0x0a,0x0b,
|
||||
0x0c,0x0d,0x0e,0x0f,0x10,0x11,0x12,0x13,0x14 };
|
||||
static const BYTE spcidcWithDigestAndAlgorithmParams[] = {
|
||||
0x30,0x29,0x30,0x02,0x06,0x00,0x30,0x23,0x30,0x0b,0x06,0x05,0x2b,0x0e,0x03,0x02,
|
||||
0x1a,0x74,0x65,0x73,0x74,0x04,0x14,0x01,0x02,0x03,0x04,0x05,0x06,0x07,0x08,0x09,
|
||||
0x0a,0x0b,0x0c,0x0d,0x0e,0x0f,0x10,0x11,0x12,0x13,0x14 };
|
||||
static const BYTE spcidcWithEverythingExceptDataValue[] = {
|
||||
0x30,0x33,0x30,0x0c,0x06,0x0a,0x2b,0x06,0x01,0x04,0x01,0x82,0x37,0x02,0x01,0x0f,
|
||||
0x30,0x23,0x30,0x0b,0x06,0x05,0x2b,0x0e,0x03,0x02,0x1a,0x74,0x65,0x73,0x74,0x04,
|
||||
0x14,0x01,0x02,0x03,0x04,0x05,0x06,0x07,0x08,0x09,0x0a,0x0b,0x0c,0x0d,0x0e,0x0f,
|
||||
0x10,0x11,0x12,0x13,0x14 };
|
||||
static const BYTE spcidcWithEverything[] = {
|
||||
0x30,0x35,0x30,0x0e,0x06,0x0a,0x2b,0x06,0x01,0x04,0x01,0x82,0x37,0x02,0x01,0x0f,
|
||||
0x30,0x00,0x30,0x23,0x30,0x0b,0x06,0x05,0x2b,0x0e,0x03,0x02,0x1a,0x74,0x65,0x73,
|
||||
0x74,0x04,0x14,0x01,0x02,0x03,0x04,0x05,0x06,0x07,0x08,0x09,0x0a,0x0b,0x0c,0x0d,
|
||||
0x0e,0x0f,0x10,0x11,0x12,0x13,0x14 };
|
||||
|
||||
static BYTE fakeDigest[] = {
|
||||
0x01,0x02,0x03,0x04,0x05,0x06,0x07,0x08,0x09,0x0a,0x0b,0x0c,0x0d,0x0e,0x0f,0x10,
|
||||
0x11,0x12,0x13,0x14 };
|
||||
static BYTE parameters[] = { 't','e','s','t' };
|
||||
|
||||
static void test_encodeSPCIndirectDataContent(void)
|
||||
{
|
||||
static char SPC_PE_IMAGE_DATA_OBJID_[] = SPC_PE_IMAGE_DATA_OBJID;
|
||||
static char szOID_OIWSEC_sha1_[] = szOID_OIWSEC_sha1;
|
||||
|
||||
SPC_INDIRECT_DATA_CONTENT indirectData = { { 0 } };
|
||||
DWORD size = 0;
|
||||
LPBYTE buf;
|
||||
BOOL ret;
|
||||
|
||||
if (!pCryptEncodeObjectEx)
|
||||
{
|
||||
win_skip("CryptEncodeObjectEx() is not available. Skipping the encodeSPCIndirectDataContent tests\n");
|
||||
return;
|
||||
}
|
||||
|
||||
ret = pCryptEncodeObjectEx(X509_ASN_ENCODING, SPC_INDIRECT_DATA_CONTENT_STRUCT,
|
||||
&indirectData, CRYPT_ENCODE_ALLOC_FLAG, NULL, &buf, &size);
|
||||
ok(ret, "CryptEncodeObjectEx failed: %08lx\n", GetLastError());
|
||||
if (ret)
|
||||
{
|
||||
ok(size == sizeof(emptyIndirectData), "Unexpected size %ld\n", size);
|
||||
if (size == sizeof(emptyIndirectData))
|
||||
ok(!memcmp(buf, emptyIndirectData, sizeof(emptyIndirectData)),
|
||||
"Unexpected value\n");
|
||||
LocalFree(buf);
|
||||
}
|
||||
/* With only digest */
|
||||
indirectData.Digest.cbData = sizeof(fakeDigest);
|
||||
indirectData.Digest.pbData = fakeDigest;
|
||||
ret = pCryptEncodeObjectEx(X509_ASN_ENCODING, SPC_INDIRECT_DATA_CONTENT_STRUCT,
|
||||
&indirectData, CRYPT_ENCODE_ALLOC_FLAG, NULL, &buf, &size);
|
||||
ok(ret, "CryptEncodeObjectEx failed: %08lx\n", GetLastError());
|
||||
if (ret)
|
||||
{
|
||||
ok(size == sizeof(spcidcWithOnlyDigest), "Unexpected size %ld\n", size);
|
||||
if (size == sizeof(spcidcWithOnlyDigest))
|
||||
ok(!memcmp(buf, spcidcWithOnlyDigest, sizeof(spcidcWithOnlyDigest)),
|
||||
"Unexpected value\n");
|
||||
LocalFree(buf);
|
||||
}
|
||||
/* With digest and digest algorithm */
|
||||
indirectData.DigestAlgorithm.pszObjId = szOID_OIWSEC_sha1_;
|
||||
ret = pCryptEncodeObjectEx(X509_ASN_ENCODING, SPC_INDIRECT_DATA_CONTENT_STRUCT,
|
||||
&indirectData, CRYPT_ENCODE_ALLOC_FLAG, NULL, &buf, &size);
|
||||
ok(ret, "CryptEncodeObjectEx failed: %08lx\n", GetLastError());
|
||||
if (ret)
|
||||
{
|
||||
ok(size == sizeof(spcidcWithDigestAndAlgorithm), "Unexpected size %ld\n",
|
||||
size);
|
||||
if (size == sizeof(spcidcWithDigestAndAlgorithm))
|
||||
ok(!memcmp(buf, spcidcWithDigestAndAlgorithm,
|
||||
sizeof(spcidcWithDigestAndAlgorithm)),
|
||||
"Unexpected value\n");
|
||||
LocalFree(buf);
|
||||
}
|
||||
/* With digest algorithm parameters */
|
||||
indirectData.DigestAlgorithm.Parameters.cbData = sizeof(parameters);
|
||||
indirectData.DigestAlgorithm.Parameters.pbData = parameters;
|
||||
ret = pCryptEncodeObjectEx(X509_ASN_ENCODING, SPC_INDIRECT_DATA_CONTENT_STRUCT,
|
||||
&indirectData, CRYPT_ENCODE_ALLOC_FLAG, NULL, &buf, &size);
|
||||
ok(ret, "CryptEncodeObjectEx failed: %08lx\n", GetLastError());
|
||||
if (ret)
|
||||
{
|
||||
ok(size == sizeof(spcidcWithDigestAndAlgorithmParams),
|
||||
"Unexpected size %ld\n", size);
|
||||
if (size == sizeof(spcidcWithDigestAndAlgorithmParams))
|
||||
ok(!memcmp(buf, spcidcWithDigestAndAlgorithmParams,
|
||||
sizeof(spcidcWithDigestAndAlgorithmParams)),
|
||||
"Unexpected value\n");
|
||||
LocalFree(buf);
|
||||
}
|
||||
/* With everything except Data.Value */
|
||||
indirectData.Data.pszObjId = SPC_PE_IMAGE_DATA_OBJID_;
|
||||
ret = pCryptEncodeObjectEx(X509_ASN_ENCODING, SPC_INDIRECT_DATA_CONTENT_STRUCT,
|
||||
&indirectData, CRYPT_ENCODE_ALLOC_FLAG, NULL, &buf, &size);
|
||||
ok(ret, "CryptEncodeObjectEx failed: %08lx\n", GetLastError());
|
||||
if (ret)
|
||||
{
|
||||
ok(size == sizeof(spcidcWithEverythingExceptDataValue),
|
||||
"Unexpected size %ld\n", size);
|
||||
if (size == sizeof(spcidcWithEverythingExceptDataValue))
|
||||
ok(!memcmp(buf, spcidcWithEverythingExceptDataValue,
|
||||
sizeof(spcidcWithEverythingExceptDataValue)),
|
||||
"Unexpected value\n");
|
||||
LocalFree(buf);
|
||||
}
|
||||
/* With everything */
|
||||
indirectData.Data.Value.cbData = sizeof(emptySequence);
|
||||
indirectData.Data.Value.pbData = (void*)emptySequence;
|
||||
ret = pCryptEncodeObjectEx(X509_ASN_ENCODING, SPC_INDIRECT_DATA_CONTENT_STRUCT,
|
||||
&indirectData, CRYPT_ENCODE_ALLOC_FLAG, NULL, &buf, &size);
|
||||
ok(ret, "CryptEncodeObjectEx failed: %08lx\n", GetLastError());
|
||||
if (ret)
|
||||
{
|
||||
ok(size == sizeof(spcidcWithEverything), "Unexpected size %ld\n", size);
|
||||
if (size == sizeof(spcidcWithEverything))
|
||||
ok(!memcmp(buf, spcidcWithEverything, sizeof(spcidcWithEverything)),
|
||||
"Unexpected value\n");
|
||||
LocalFree(buf);
|
||||
}
|
||||
}
|
||||
|
||||
static void test_decodeSPCIndirectDataContent(void)
|
||||
{
|
||||
static const BYTE asn1Null[] = { 0x05,0x00 };
|
||||
|
||||
BOOL ret;
|
||||
LPBYTE buf = NULL;
|
||||
DWORD size = 0;
|
||||
SPC_INDIRECT_DATA_CONTENT *indirectData;
|
||||
|
||||
if (!pCryptDecodeObjectEx)
|
||||
{
|
||||
win_skip("CryptDecodeObjectEx() is not available. Skipping the decodeSPCIndirectDataContent tests\n");
|
||||
return;
|
||||
}
|
||||
|
||||
ret = pCryptDecodeObjectEx(X509_ASN_ENCODING, SPC_INDIRECT_DATA_CONTENT_STRUCT,
|
||||
emptyIndirectData, sizeof(emptyIndirectData),
|
||||
CRYPT_DECODE_ALLOC_FLAG, NULL, &buf, &size);
|
||||
ok(ret, "CryptDecodeObjectEx failed: %08lx\n", GetLastError());
|
||||
if (ret)
|
||||
{
|
||||
indirectData = (SPC_INDIRECT_DATA_CONTENT *)buf;
|
||||
ok(indirectData->Data.pszObjId != NULL, "Expected non-NULL data objid\n");
|
||||
if (indirectData->Data.pszObjId)
|
||||
ok(!strcmp(indirectData->Data.pszObjId, ""),
|
||||
"Expected empty data objid\n");
|
||||
ok(indirectData->Data.Value.cbData == 0, "Expected no data value\n");
|
||||
ok(indirectData->DigestAlgorithm.pszObjId != NULL,
|
||||
"Expected non-NULL digest algorithm objid\n");
|
||||
if (indirectData->DigestAlgorithm.pszObjId)
|
||||
ok(!strcmp(indirectData->DigestAlgorithm.pszObjId, ""),
|
||||
"Expected empty digest algorithm objid\n");
|
||||
ok(indirectData->DigestAlgorithm.Parameters.cbData == 0,
|
||||
"Expected no digest algorithm parameters\n");
|
||||
ok(indirectData->Digest.cbData == 0, "Expected no digest\n");
|
||||
LocalFree(buf);
|
||||
}
|
||||
ret = pCryptDecodeObjectEx(X509_ASN_ENCODING, SPC_INDIRECT_DATA_CONTENT_STRUCT,
|
||||
spcidcWithOnlyDigest, sizeof(spcidcWithOnlyDigest),
|
||||
CRYPT_DECODE_ALLOC_FLAG, NULL, &buf, &size);
|
||||
ok(ret, "CryptDecodeObjectEx failed: %08lx\n", GetLastError());
|
||||
if (ret)
|
||||
{
|
||||
indirectData = (SPC_INDIRECT_DATA_CONTENT *)buf;
|
||||
ok(indirectData->Digest.cbData == sizeof(fakeDigest),
|
||||
"Unexpected digest size %ld\n", indirectData->Digest.cbData);
|
||||
if (indirectData->Digest.cbData == sizeof(fakeDigest))
|
||||
ok(!memcmp(indirectData->Digest.pbData, fakeDigest,
|
||||
sizeof(fakeDigest)),
|
||||
"Unexpected flags\n");
|
||||
LocalFree(buf);
|
||||
}
|
||||
ret = pCryptDecodeObjectEx(X509_ASN_ENCODING, SPC_INDIRECT_DATA_CONTENT_STRUCT,
|
||||
spcidcWithDigestAndAlgorithm, sizeof(spcidcWithDigestAndAlgorithm),
|
||||
CRYPT_DECODE_ALLOC_FLAG, NULL, &buf, &size);
|
||||
ok(ret, "CryptDecodeObjectEx failed: %08lx\n", GetLastError());
|
||||
if (ret)
|
||||
{
|
||||
indirectData = (SPC_INDIRECT_DATA_CONTENT *)buf;
|
||||
ok(indirectData->DigestAlgorithm.pszObjId != NULL,
|
||||
"Expected non-NULL digest algorithm objid\n");
|
||||
if (indirectData->DigestAlgorithm.pszObjId)
|
||||
ok(!strcmp(indirectData->DigestAlgorithm.pszObjId, szOID_OIWSEC_sha1),
|
||||
"Expected szOID_OIWSEC_sha1, got \"%s\"\n",
|
||||
indirectData->DigestAlgorithm.pszObjId);
|
||||
ok(indirectData->DigestAlgorithm.Parameters.cbData == sizeof(asn1Null),
|
||||
"Unexpected digest algorithm parameters size %ld\n",
|
||||
indirectData->DigestAlgorithm.Parameters.cbData);
|
||||
if (indirectData->DigestAlgorithm.Parameters.cbData == sizeof(asn1Null))
|
||||
ok(!memcmp(indirectData->DigestAlgorithm.Parameters.pbData,
|
||||
asn1Null, sizeof(asn1Null)),
|
||||
"Unexpected digest algorithm parameters\n");
|
||||
ok(indirectData->Digest.cbData == sizeof(fakeDigest),
|
||||
"Unexpected digest size %ld\n", indirectData->Digest.cbData);
|
||||
if (indirectData->Digest.cbData == sizeof(fakeDigest))
|
||||
ok(!memcmp(indirectData->Digest.pbData, fakeDigest,
|
||||
sizeof(fakeDigest)),
|
||||
"Unexpected flags\n");
|
||||
LocalFree(buf);
|
||||
}
|
||||
ret = pCryptDecodeObjectEx(X509_ASN_ENCODING, SPC_INDIRECT_DATA_CONTENT_STRUCT,
|
||||
spcidcWithDigestAndAlgorithmParams, sizeof(spcidcWithDigestAndAlgorithmParams),
|
||||
CRYPT_DECODE_ALLOC_FLAG, NULL, &buf, &size);
|
||||
/* what? */
|
||||
ok(!ret && GetLastError () == CRYPT_E_ASN1_EOD,
|
||||
"Expected CRYPT_E_ASN1_EOD, got %08lx\n", GetLastError());
|
||||
if (ret)
|
||||
LocalFree(buf);
|
||||
ret = pCryptDecodeObjectEx(X509_ASN_ENCODING, SPC_INDIRECT_DATA_CONTENT_STRUCT,
|
||||
spcidcWithEverythingExceptDataValue, sizeof(spcidcWithEverythingExceptDataValue),
|
||||
CRYPT_DECODE_ALLOC_FLAG, NULL, &buf, &size);
|
||||
/* huh??? */
|
||||
ok(!ret && GetLastError () == CRYPT_E_ASN1_EOD,
|
||||
"Expected CRYPT_E_ASN1_EOD, got %08lx\n", GetLastError());
|
||||
if (ret)
|
||||
LocalFree(buf);
|
||||
ret = pCryptDecodeObjectEx(X509_ASN_ENCODING, SPC_INDIRECT_DATA_CONTENT_STRUCT,
|
||||
spcidcWithEverything, sizeof(spcidcWithEverything),
|
||||
CRYPT_DECODE_ALLOC_FLAG, NULL, &buf, &size);
|
||||
/* ?????? */
|
||||
ok(!ret && GetLastError () == CRYPT_E_ASN1_EOD,
|
||||
"Expected CRYPT_E_ASN1_EOD, got %08lx\n", GetLastError());
|
||||
if (ret)
|
||||
LocalFree(buf);
|
||||
}
|
||||
|
||||
static WCHAR foo[] = { 'f','o','o',0 };
|
||||
static WCHAR guidStr[] = { '{','8','b','c','9','6','b','0','0','-',
|
||||
'8','d','a','1','-','1','1','c','f','-','8','7','3','6','-','0','0',
|
||||
@@ -560,10 +799,10 @@ static void test_encodeCatMemberInfo(void)
|
||||
|
||||
ret = pCryptEncodeObjectEx(X509_ASN_ENCODING, CAT_MEMBERINFO_STRUCT,
|
||||
&info, CRYPT_ENCODE_ALLOC_FLAG, NULL, &buf, &size);
|
||||
ok(ret, "CryptEncodeObjectEx failed: %08x\n", GetLastError());
|
||||
ok(ret, "CryptEncodeObjectEx failed: %08lx\n", GetLastError());
|
||||
if (ret)
|
||||
{
|
||||
ok(size == sizeof(emptyCatMemberInfo), "Unexpected size %d\n", size);
|
||||
ok(size == sizeof(emptyCatMemberInfo), "Unexpected size %ld\n", size);
|
||||
ok(!memcmp(buf, emptyCatMemberInfo, sizeof(emptyCatMemberInfo)),
|
||||
"Unexpected value\n");
|
||||
LocalFree(buf);
|
||||
@@ -571,10 +810,10 @@ static void test_encodeCatMemberInfo(void)
|
||||
info.pwszSubjGuid = foo;
|
||||
ret = pCryptEncodeObjectEx(X509_ASN_ENCODING, CAT_MEMBERINFO_STRUCT,
|
||||
&info, CRYPT_ENCODE_ALLOC_FLAG, NULL, &buf, &size);
|
||||
ok(ret, "CryptEncodeObjectEx failed: %08x\n", GetLastError());
|
||||
ok(ret, "CryptEncodeObjectEx failed: %08lx\n", GetLastError());
|
||||
if (ret)
|
||||
{
|
||||
ok(size == sizeof(catMemberInfoWithSillyGuid), "Unexpected size %d\n",
|
||||
ok(size == sizeof(catMemberInfoWithSillyGuid), "Unexpected size %ld\n",
|
||||
size);
|
||||
ok(!memcmp(buf, catMemberInfoWithSillyGuid,
|
||||
sizeof(catMemberInfoWithSillyGuid)), "Unexpected value\n");
|
||||
@@ -583,10 +822,10 @@ static void test_encodeCatMemberInfo(void)
|
||||
info.pwszSubjGuid = guidStr;
|
||||
ret = pCryptEncodeObjectEx(X509_ASN_ENCODING, CAT_MEMBERINFO_STRUCT,
|
||||
&info, CRYPT_ENCODE_ALLOC_FLAG, NULL, &buf, &size);
|
||||
ok(ret, "CryptEncodeObjectEx failed: %08x\n", GetLastError());
|
||||
ok(ret, "CryptEncodeObjectEx failed: %08lx\n", GetLastError());
|
||||
if (ret)
|
||||
{
|
||||
ok(size == sizeof(catMemberInfoWithGuid), "Unexpected size %d\n",
|
||||
ok(size == sizeof(catMemberInfoWithGuid), "Unexpected size %ld\n",
|
||||
size);
|
||||
ok(!memcmp(buf, catMemberInfoWithGuid, sizeof(catMemberInfoWithGuid)),
|
||||
"Unexpected value\n");
|
||||
@@ -610,39 +849,39 @@ static void test_decodeCatMemberInfo(void)
|
||||
ret = pCryptDecodeObjectEx(X509_ASN_ENCODING, CAT_MEMBERINFO_STRUCT,
|
||||
emptyCatMemberInfo, sizeof(emptyCatMemberInfo),
|
||||
CRYPT_DECODE_ALLOC_FLAG, NULL, &buf, &size);
|
||||
ok(ret, "CryptDecodeObjectEx failed: %08x\n", GetLastError());
|
||||
ok(ret, "CryptDecodeObjectEx failed: %08lx\n", GetLastError());
|
||||
if (ret)
|
||||
{
|
||||
info = (CAT_MEMBERINFO *)buf;
|
||||
ok(!info->pwszSubjGuid || !info->pwszSubjGuid[0],
|
||||
"expected empty pwszSubjGuid\n");
|
||||
ok(info->dwCertVersion == 0, "expected dwCertVersion == 0, got %d\n",
|
||||
ok(info->dwCertVersion == 0, "expected dwCertVersion == 0, got %ld\n",
|
||||
info->dwCertVersion);
|
||||
LocalFree(buf);
|
||||
}
|
||||
ret = pCryptDecodeObjectEx(X509_ASN_ENCODING, CAT_MEMBERINFO_STRUCT,
|
||||
catMemberInfoWithSillyGuid, sizeof(catMemberInfoWithSillyGuid),
|
||||
CRYPT_DECODE_ALLOC_FLAG, NULL, &buf, &size);
|
||||
ok(ret, "CryptDecodeObjectEx failed: %08x\n", GetLastError());
|
||||
ok(ret, "CryptDecodeObjectEx failed: %08lx\n", GetLastError());
|
||||
if (ret)
|
||||
{
|
||||
info = (CAT_MEMBERINFO *)buf;
|
||||
ok(info->pwszSubjGuid && !lstrcmpW(info->pwszSubjGuid, foo),
|
||||
"unexpected pwszSubjGuid\n");
|
||||
ok(info->dwCertVersion == 0, "expected dwCertVersion == 0, got %d\n",
|
||||
ok(info->dwCertVersion == 0, "expected dwCertVersion == 0, got %ld\n",
|
||||
info->dwCertVersion);
|
||||
LocalFree(buf);
|
||||
}
|
||||
ret = pCryptDecodeObjectEx(X509_ASN_ENCODING, CAT_MEMBERINFO_STRUCT,
|
||||
catMemberInfoWithGuid, sizeof(catMemberInfoWithGuid),
|
||||
CRYPT_DECODE_ALLOC_FLAG, NULL, &buf, &size);
|
||||
ok(ret, "CryptDecodeObjectEx failed: %08x\n", GetLastError());
|
||||
ok(ret, "CryptDecodeObjectEx failed: %08lx\n", GetLastError());
|
||||
if (ret)
|
||||
{
|
||||
info = (CAT_MEMBERINFO *)buf;
|
||||
ok(info->pwszSubjGuid && !lstrcmpW(info->pwszSubjGuid, guidStr),
|
||||
"unexpected pwszSubjGuid\n");
|
||||
ok(info->dwCertVersion == 0, "expected dwCertVersion == 0, got %d\n",
|
||||
ok(info->dwCertVersion == 0, "expected dwCertVersion == 0, got %ld\n",
|
||||
info->dwCertVersion);
|
||||
LocalFree(buf);
|
||||
}
|
||||
@@ -670,10 +909,10 @@ static void test_encodeCatNameValue(void)
|
||||
memset(&value, 0, sizeof(value));
|
||||
ret = pCryptEncodeObjectEx(X509_ASN_ENCODING, CAT_NAMEVALUE_STRUCT,
|
||||
&value, CRYPT_ENCODE_ALLOC_FLAG, NULL, &buf, &size);
|
||||
ok(ret, "CryptEncodeObjectEx failed: %08x\n", GetLastError());
|
||||
ok(ret, "CryptEncodeObjectEx failed: %08lx\n", GetLastError());
|
||||
if (ret)
|
||||
{
|
||||
ok(size == sizeof(emptyCatNameValue), "Unexpected size %d\n", size);
|
||||
ok(size == sizeof(emptyCatNameValue), "Unexpected size %ld\n", size);
|
||||
ok(!memcmp(buf, emptyCatNameValue, sizeof(emptyCatNameValue)),
|
||||
"Unexpected value\n");
|
||||
LocalFree(buf);
|
||||
@@ -681,10 +920,10 @@ static void test_encodeCatNameValue(void)
|
||||
value.pwszTag = foo;
|
||||
ret = pCryptEncodeObjectEx(X509_ASN_ENCODING, CAT_NAMEVALUE_STRUCT,
|
||||
&value, CRYPT_ENCODE_ALLOC_FLAG, NULL, &buf, &size);
|
||||
ok(ret, "CryptEncodeObjectEx failed: %08x\n", GetLastError());
|
||||
ok(ret, "CryptEncodeObjectEx failed: %08lx\n", GetLastError());
|
||||
if (ret)
|
||||
{
|
||||
ok(size == sizeof(catNameValueWithTag), "Unexpected size %d\n", size);
|
||||
ok(size == sizeof(catNameValueWithTag), "Unexpected size %ld\n", size);
|
||||
ok(!memcmp(buf, catNameValueWithTag, sizeof(catNameValueWithTag)),
|
||||
"Unexpected value\n");
|
||||
LocalFree(buf);
|
||||
@@ -693,10 +932,10 @@ static void test_encodeCatNameValue(void)
|
||||
value.fdwFlags = 0xf00dd00d;
|
||||
ret = pCryptEncodeObjectEx(X509_ASN_ENCODING, CAT_NAMEVALUE_STRUCT,
|
||||
&value, CRYPT_ENCODE_ALLOC_FLAG, NULL, &buf, &size);
|
||||
ok(ret, "CryptEncodeObjectEx failed: %08x\n", GetLastError());
|
||||
ok(ret, "CryptEncodeObjectEx failed: %08lx\n", GetLastError());
|
||||
if (ret)
|
||||
{
|
||||
ok(size == sizeof(catNameValueWithFlags), "Unexpected size %d\n", size);
|
||||
ok(size == sizeof(catNameValueWithFlags), "Unexpected size %ld\n", size);
|
||||
ok(!memcmp(buf, catNameValueWithFlags, sizeof(catNameValueWithFlags)),
|
||||
"Unexpected value\n");
|
||||
LocalFree(buf);
|
||||
@@ -706,10 +945,10 @@ static void test_encodeCatNameValue(void)
|
||||
value.Value.pbData = aVal;
|
||||
ret = pCryptEncodeObjectEx(X509_ASN_ENCODING, CAT_NAMEVALUE_STRUCT,
|
||||
&value, CRYPT_ENCODE_ALLOC_FLAG, NULL, &buf, &size);
|
||||
ok(ret, "CryptEncodeObjectEx failed: %08x\n", GetLastError());
|
||||
ok(ret, "CryptEncodeObjectEx failed: %08lx\n", GetLastError());
|
||||
if (ret)
|
||||
{
|
||||
ok(size == sizeof(catNameValueWithValue), "Unexpected size %d\n", size);
|
||||
ok(size == sizeof(catNameValueWithValue), "Unexpected size %ld\n", size);
|
||||
ok(!memcmp(buf, catNameValueWithValue, sizeof(catNameValueWithValue)),
|
||||
"Unexpected value\n");
|
||||
LocalFree(buf);
|
||||
@@ -727,14 +966,14 @@ static void test_decodeCatNameValue(void)
|
||||
ret = pCryptDecodeObjectEx(X509_ASN_ENCODING, CAT_NAMEVALUE_STRUCT,
|
||||
emptyCatNameValue, sizeof(emptyCatNameValue),
|
||||
CRYPT_DECODE_ALLOC_FLAG, NULL, &buf, &size);
|
||||
ok(ret, "CryptDecodeObjectEx failed: %08x\n", GetLastError());
|
||||
ok(ret, "CryptDecodeObjectEx failed: %08lx\n", GetLastError());
|
||||
if (ret)
|
||||
{
|
||||
value = (CAT_NAMEVALUE *)buf;
|
||||
ok(!value->pwszTag || !value->pwszTag[0], "expected empty pwszTag\n");
|
||||
ok(value->fdwFlags == 0, "expected fdwFlags == 0, got %08x\n",
|
||||
ok(value->fdwFlags == 0, "expected fdwFlags == 0, got %08lx\n",
|
||||
value->fdwFlags);
|
||||
ok(value->Value.cbData == 0, "expected 0-length value, got %d\n",
|
||||
ok(value->Value.cbData == 0, "expected 0-length value, got %ld\n",
|
||||
value->Value.cbData);
|
||||
LocalFree(buf);
|
||||
}
|
||||
@@ -742,15 +981,15 @@ static void test_decodeCatNameValue(void)
|
||||
ret = pCryptDecodeObjectEx(X509_ASN_ENCODING, CAT_NAMEVALUE_STRUCT,
|
||||
catNameValueWithTag, sizeof(catNameValueWithTag),
|
||||
CRYPT_DECODE_ALLOC_FLAG, NULL, &buf, &size);
|
||||
ok(ret, "CryptDecodeObjectEx failed: %08x\n", GetLastError());
|
||||
ok(ret, "CryptDecodeObjectEx failed: %08lx\n", GetLastError());
|
||||
if (ret)
|
||||
{
|
||||
value = (CAT_NAMEVALUE *)buf;
|
||||
ok(value->pwszTag && !lstrcmpW(value->pwszTag, foo),
|
||||
"unexpected pwszTag\n");
|
||||
ok(value->fdwFlags == 0, "expected fdwFlags == 0, got %08x\n",
|
||||
ok(value->fdwFlags == 0, "expected fdwFlags == 0, got %08lx\n",
|
||||
value->fdwFlags);
|
||||
ok(value->Value.cbData == 0, "expected 0-length value, got %d\n",
|
||||
ok(value->Value.cbData == 0, "expected 0-length value, got %ld\n",
|
||||
value->Value.cbData);
|
||||
LocalFree(buf);
|
||||
}
|
||||
@@ -758,14 +997,14 @@ static void test_decodeCatNameValue(void)
|
||||
ret = pCryptDecodeObjectEx(X509_ASN_ENCODING, CAT_NAMEVALUE_STRUCT,
|
||||
catNameValueWithFlags, sizeof(catNameValueWithFlags),
|
||||
CRYPT_DECODE_ALLOC_FLAG, NULL, &buf, &size);
|
||||
ok(ret, "CryptDecodeObjectEx failed: %08x\n", GetLastError());
|
||||
ok(ret, "CryptDecodeObjectEx failed: %08lx\n", GetLastError());
|
||||
if (ret)
|
||||
{
|
||||
value = (CAT_NAMEVALUE *)buf;
|
||||
ok(!value->pwszTag || !value->pwszTag[0], "expected empty pwszTag\n");
|
||||
ok(value->fdwFlags == 0xf00dd00d,
|
||||
"expected fdwFlags == 0xf00dd00d, got %08x\n", value->fdwFlags);
|
||||
ok(value->Value.cbData == 0, "expected 0-length value, got %d\n",
|
||||
"expected fdwFlags == 0xf00dd00d, got %08lx\n", value->fdwFlags);
|
||||
ok(value->Value.cbData == 0, "expected 0-length value, got %ld\n",
|
||||
value->Value.cbData);
|
||||
LocalFree(buf);
|
||||
}
|
||||
@@ -773,14 +1012,14 @@ static void test_decodeCatNameValue(void)
|
||||
ret = pCryptDecodeObjectEx(X509_ASN_ENCODING, CAT_NAMEVALUE_STRUCT,
|
||||
catNameValueWithValue, sizeof(catNameValueWithValue),
|
||||
CRYPT_DECODE_ALLOC_FLAG, NULL, &buf, &size);
|
||||
ok(ret, "CryptDecodeObjectEx failed: %08x\n", GetLastError());
|
||||
ok(ret, "CryptDecodeObjectEx failed: %08lx\n", GetLastError());
|
||||
if (ret)
|
||||
{
|
||||
value = (CAT_NAMEVALUE *)buf;
|
||||
ok(!value->pwszTag || !value->pwszTag[0], "expected empty pwszTag\n");
|
||||
ok(value->fdwFlags == 0, "expected fdwFlags == 0, got %08x\n",
|
||||
ok(value->fdwFlags == 0, "expected fdwFlags == 0, got %08lx\n",
|
||||
value->fdwFlags);
|
||||
ok(value->Value.cbData == sizeof(aVal), "unexpected size %d\n",
|
||||
ok(value->Value.cbData == sizeof(aVal), "unexpected size %ld\n",
|
||||
value->Value.cbData);
|
||||
ok(!memcmp(value->Value.pbData, aVal, value->Value.cbData),
|
||||
"unexpected value\n");
|
||||
@@ -812,20 +1051,20 @@ static void test_encodeSpOpusInfo(void)
|
||||
memset(&info, 0, sizeof(info));
|
||||
ret = pCryptEncodeObjectEx(X509_ASN_ENCODING, SPC_SP_OPUS_INFO_STRUCT,
|
||||
&info, CRYPT_ENCODE_ALLOC_FLAG, NULL, &buf, &size);
|
||||
ok(ret, "CryptEncodeObjectEx failed: %08x\n", GetLastError());
|
||||
ok(ret, "CryptEncodeObjectEx failed: %08lx\n", GetLastError());
|
||||
if (ret)
|
||||
{
|
||||
ok(size == sizeof(emptySequence), "unexpected size %d\n", size);
|
||||
ok(size == sizeof(emptySequence), "unexpected size %ld\n", size);
|
||||
ok(!memcmp(buf, emptySequence, size), "unexpected value\n");
|
||||
LocalFree(buf);
|
||||
}
|
||||
info.pwszProgramName = progName;
|
||||
ret = pCryptEncodeObjectEx(X509_ASN_ENCODING, SPC_SP_OPUS_INFO_STRUCT,
|
||||
&info, CRYPT_ENCODE_ALLOC_FLAG, NULL, &buf, &size);
|
||||
ok(ret, "CryptEncodeObjectEx failed: %08x\n", GetLastError());
|
||||
ok(ret, "CryptEncodeObjectEx failed: %08lx\n", GetLastError());
|
||||
if (ret)
|
||||
{
|
||||
ok(size == sizeof(spOpusInfoWithProgramName), "unexpected size %d\n",
|
||||
ok(size == sizeof(spOpusInfoWithProgramName), "unexpected size %ld\n",
|
||||
size);
|
||||
ok(!memcmp(buf, spOpusInfoWithProgramName, size),
|
||||
"unexpected value\n");
|
||||
@@ -838,16 +1077,16 @@ static void test_encodeSpOpusInfo(void)
|
||||
ret = pCryptEncodeObjectEx(X509_ASN_ENCODING, SPC_SP_OPUS_INFO_STRUCT,
|
||||
&info, CRYPT_ENCODE_ALLOC_FLAG, NULL, &buf, &size);
|
||||
ok(!ret && GetLastError() == E_INVALIDARG,
|
||||
"expected E_INVALIDARG, got %08x\n", GetLastError());
|
||||
"expected E_INVALIDARG, got %08lx\n", GetLastError());
|
||||
moreInfo.dwLinkChoice = SPC_URL_LINK_CHOICE;
|
||||
U(moreInfo).pwszUrl = winehq;
|
||||
moreInfo.pwszUrl = winehq;
|
||||
ret = pCryptEncodeObjectEx(X509_ASN_ENCODING, SPC_SP_OPUS_INFO_STRUCT,
|
||||
&info, CRYPT_ENCODE_ALLOC_FLAG, NULL, &buf, &size);
|
||||
ok(ret, "CryptEncodeObjectEx failed: %08x\n", GetLastError());
|
||||
ok(ret, "CryptEncodeObjectEx failed: %08lx\n", GetLastError());
|
||||
if (ret)
|
||||
{
|
||||
ok(size == sizeof(spOpusInfoWithMoreInfo),
|
||||
"unexpected size %d\n", size);
|
||||
"unexpected size %ld\n", size);
|
||||
ok(!memcmp(buf, spOpusInfoWithMoreInfo, size),
|
||||
"unexpected value\n");
|
||||
LocalFree(buf);
|
||||
@@ -856,11 +1095,11 @@ static void test_encodeSpOpusInfo(void)
|
||||
info.pPublisherInfo = &moreInfo;
|
||||
ret = pCryptEncodeObjectEx(X509_ASN_ENCODING, SPC_SP_OPUS_INFO_STRUCT,
|
||||
&info, CRYPT_ENCODE_ALLOC_FLAG, NULL, &buf, &size);
|
||||
ok(ret, "CryptEncodeObjectEx failed: %08x\n", GetLastError());
|
||||
ok(ret, "CryptEncodeObjectEx failed: %08lx\n", GetLastError());
|
||||
if (ret)
|
||||
{
|
||||
ok(size == sizeof(spOpusInfoWithPublisherInfo),
|
||||
"unexpected size %d\n", size);
|
||||
"unexpected size %ld\n", size);
|
||||
ok(!memcmp(buf, spOpusInfoWithPublisherInfo, size),
|
||||
"unexpected value\n");
|
||||
LocalFree(buf);
|
||||
@@ -876,7 +1115,7 @@ static void test_decodeSpOpusInfo(void)
|
||||
ret = pCryptDecodeObjectEx(X509_ASN_ENCODING, SPC_SP_OPUS_INFO_STRUCT,
|
||||
emptySequence, sizeof(emptySequence), CRYPT_DECODE_ALLOC_FLAG, NULL,
|
||||
&info, &size);
|
||||
ok(ret, "CryptDecodeObjectEx failed: %08x\n", GetLastError());
|
||||
ok(ret, "CryptDecodeObjectEx failed: %08lx\n", GetLastError());
|
||||
if (ret)
|
||||
{
|
||||
ok(!info->pwszProgramName, "expected NULL\n");
|
||||
@@ -887,7 +1126,7 @@ static void test_decodeSpOpusInfo(void)
|
||||
ret = pCryptDecodeObjectEx(X509_ASN_ENCODING, SPC_SP_OPUS_INFO_STRUCT,
|
||||
spOpusInfoWithProgramName, sizeof(spOpusInfoWithProgramName),
|
||||
CRYPT_DECODE_ALLOC_FLAG, NULL, &info, &size);
|
||||
ok(ret, "CryptDecodeObjectEx failed: %08x\n", GetLastError());
|
||||
ok(ret, "CryptDecodeObjectEx failed: %08lx\n", GetLastError());
|
||||
if (ret)
|
||||
{
|
||||
ok(info->pwszProgramName && !lstrcmpW(info->pwszProgramName,
|
||||
@@ -899,7 +1138,7 @@ static void test_decodeSpOpusInfo(void)
|
||||
ret = pCryptDecodeObjectEx(X509_ASN_ENCODING, SPC_SP_OPUS_INFO_STRUCT,
|
||||
spOpusInfoWithMoreInfo, sizeof(spOpusInfoWithMoreInfo),
|
||||
CRYPT_DECODE_ALLOC_FLAG, NULL, &info, &size);
|
||||
ok(ret, "CryptDecodeObjectEx failed: %08x\n", GetLastError());
|
||||
ok(ret, "CryptDecodeObjectEx failed: %08lx\n", GetLastError());
|
||||
if (ret)
|
||||
{
|
||||
ok(!info->pwszProgramName, "expected NULL\n");
|
||||
@@ -907,8 +1146,8 @@ static void test_decodeSpOpusInfo(void)
|
||||
if (info->pMoreInfo)
|
||||
{
|
||||
ok(info->pMoreInfo->dwLinkChoice == SPC_URL_LINK_CHOICE,
|
||||
"unexpected link choice %d\n", info->pMoreInfo->dwLinkChoice);
|
||||
ok(!lstrcmpW(U(*info->pMoreInfo).pwszUrl, winehq),
|
||||
"unexpected link choice %ld\n", info->pMoreInfo->dwLinkChoice);
|
||||
ok(!lstrcmpW(info->pMoreInfo->pwszUrl, winehq),
|
||||
"unexpected link value\n");
|
||||
}
|
||||
ok(!info->pPublisherInfo, "expected NULL\n");
|
||||
@@ -917,7 +1156,7 @@ static void test_decodeSpOpusInfo(void)
|
||||
ret = pCryptDecodeObjectEx(X509_ASN_ENCODING, SPC_SP_OPUS_INFO_STRUCT,
|
||||
spOpusInfoWithPublisherInfo, sizeof(spOpusInfoWithPublisherInfo),
|
||||
CRYPT_DECODE_ALLOC_FLAG, NULL, &info, &size);
|
||||
ok(ret, "CryptDecodeObjectEx failed: %08x\n", GetLastError());
|
||||
ok(ret, "CryptDecodeObjectEx failed: %08lx\n", GetLastError());
|
||||
if (ret)
|
||||
{
|
||||
ok(!info->pwszProgramName, "expected NULL\n");
|
||||
@@ -927,9 +1166,9 @@ static void test_decodeSpOpusInfo(void)
|
||||
if (info->pPublisherInfo)
|
||||
{
|
||||
ok(info->pPublisherInfo->dwLinkChoice == SPC_URL_LINK_CHOICE,
|
||||
"unexpected link choice %d\n",
|
||||
"unexpected link choice %ld\n",
|
||||
info->pPublisherInfo->dwLinkChoice);
|
||||
ok(!lstrcmpW(U(*info->pPublisherInfo).pwszUrl, winehq),
|
||||
ok(!lstrcmpW(info->pPublisherInfo->pwszUrl, winehq),
|
||||
"unexpected link value\n");
|
||||
}
|
||||
LocalFree(info);
|
||||
@@ -948,6 +1187,8 @@ START_TEST(asn)
|
||||
test_decodeSPCLink();
|
||||
test_encodeSPCPEImage();
|
||||
test_decodeSPCPEImage();
|
||||
test_encodeSPCIndirectDataContent();
|
||||
test_decodeSPCIndirectDataContent();
|
||||
test_encodeCatMemberInfo();
|
||||
test_decodeCatMemberInfo();
|
||||
test_encodeCatNameValue();
|
||||
|
||||
@@ -99,8 +99,10 @@ static const BYTE test_catalog[] = {
|
||||
};
|
||||
|
||||
static BOOL (WINAPI * pCryptCATAdminAcquireContext)(HCATADMIN*, const GUID*, DWORD);
|
||||
static BOOL (WINAPI * pCryptCATAdminAcquireContext2)(HCATADMIN*, const GUID*, const WCHAR *, const CERT_STRONG_SIGN_PARA *, DWORD);
|
||||
static BOOL (WINAPI * pCryptCATAdminReleaseContext)(HCATADMIN, DWORD);
|
||||
static BOOL (WINAPI * pCryptCATAdminCalcHashFromFileHandle)(HANDLE hFile, DWORD*, BYTE*, DWORD);
|
||||
static BOOL (WINAPI * pCryptCATAdminCalcHashFromFileHandle2)(HCATADMIN, HANDLE hFile, DWORD*, BYTE*, DWORD);
|
||||
static HCATINFO (WINAPI * pCryptCATAdminAddCatalog)(HCATADMIN, PWSTR, PWSTR, DWORD);
|
||||
static BOOL (WINAPI * pCryptCATAdminRemoveCatalog)(HCATADMIN, LPCWSTR, DWORD);
|
||||
static BOOL (WINAPI * pCryptCATAdminReleaseCatalogContext)(HCATADMIN, HCATINFO, DWORD);
|
||||
@@ -130,8 +132,10 @@ static void InitFunctionPtrs(void)
|
||||
}
|
||||
|
||||
WINTRUST_GET_PROC(CryptCATAdminAcquireContext)
|
||||
WINTRUST_GET_PROC(CryptCATAdminAcquireContext2)
|
||||
WINTRUST_GET_PROC(CryptCATAdminReleaseContext)
|
||||
WINTRUST_GET_PROC(CryptCATAdminCalcHashFromFileHandle)
|
||||
WINTRUST_GET_PROC(CryptCATAdminCalcHashFromFileHandle2)
|
||||
WINTRUST_GET_PROC(CryptCATAdminAddCatalog)
|
||||
WINTRUST_GET_PROC(CryptCATAdminRemoveCatalog)
|
||||
WINTRUST_GET_PROC(CryptCATAdminReleaseCatalogContext)
|
||||
@@ -164,6 +168,7 @@ static void test_context(void)
|
||||
BOOL ret;
|
||||
HCATADMIN hca;
|
||||
static GUID unknown = { 0xC689AABA, 0x8E78, 0x11D0, { 0x8C,0x47,0x00,0xC0,0x4F,0xC2,0x95,0xEE }}; /* WINTRUST.DLL */
|
||||
static const WCHAR unknown_alg[] = {'A', 'L', 'G', '-', 'U', 'N', 'K', 'N', 'O', 'W', 'N', '\0'};
|
||||
CHAR dummydir[MAX_PATH];
|
||||
DWORD attrs;
|
||||
|
||||
@@ -200,25 +205,25 @@ static void test_context(void)
|
||||
ret = pCryptCATAdminAcquireContext(NULL, NULL, 0);
|
||||
ok(!ret, "Expected failure\n");
|
||||
ok(GetLastError() == ERROR_INVALID_PARAMETER,
|
||||
"Expected ERROR_INVALID_PARAMETER, got %d\n", GetLastError());
|
||||
"Expected ERROR_INVALID_PARAMETER, got %ld\n", GetLastError());
|
||||
|
||||
/* NULL GUID */
|
||||
if (0) { /* crashes on 64-bit win10 */
|
||||
ret = pCryptCATAdminAcquireContext(&hca, NULL, 0);
|
||||
ok(ret, "Expected success, got FALSE with %d\n", GetLastError());
|
||||
ok(ret, "Expected success, got FALSE with %ld\n", GetLastError());
|
||||
ok(hca != NULL, "Expected a context handle, got NULL\n");
|
||||
|
||||
/* Proper release */
|
||||
SetLastError(0xdeadbeef);
|
||||
ret = pCryptCATAdminReleaseContext(hca, 0);
|
||||
ok(ret, "Expected success, got FALSE with %d\n", GetLastError());
|
||||
ok(ret, "Expected success, got FALSE with %ld\n", GetLastError());
|
||||
|
||||
/* Try to release a second time */
|
||||
SetLastError(0xdeadbeef);
|
||||
ret = pCryptCATAdminReleaseContext(hca, 0);
|
||||
ok(!ret, "Expected failure\n");
|
||||
ok(GetLastError() == ERROR_INVALID_PARAMETER,
|
||||
"Expected ERROR_INVALID_PARAMETER, got %d\n", GetLastError());
|
||||
"Expected ERROR_INVALID_PARAMETER, got %ld\n", GetLastError());
|
||||
}
|
||||
|
||||
/* All NULL */
|
||||
@@ -226,14 +231,14 @@ static void test_context(void)
|
||||
ret = pCryptCATAdminReleaseContext(NULL, 0);
|
||||
ok(!ret, "Expected failure\n");
|
||||
ok(GetLastError() == ERROR_INVALID_PARAMETER,
|
||||
"Expected ERROR_INVALID_PARAMETER, got %d\n", GetLastError());
|
||||
"Expected ERROR_INVALID_PARAMETER, got %ld\n", GetLastError());
|
||||
|
||||
/* NULL context handle and dummy GUID */
|
||||
SetLastError(0xdeadbeef);
|
||||
ret = pCryptCATAdminAcquireContext(NULL, &dummy, 0);
|
||||
ok(!ret, "Expected failure\n");
|
||||
ok(GetLastError() == ERROR_INVALID_PARAMETER,
|
||||
"Expected ERROR_INVALID_PARAMETER, got %d\n", GetLastError());
|
||||
"Expected ERROR_INVALID_PARAMETER, got %ld\n", GetLastError());
|
||||
|
||||
/* Correct context handle and dummy GUID
|
||||
*
|
||||
@@ -246,7 +251,7 @@ static void test_context(void)
|
||||
*/
|
||||
|
||||
ret = pCryptCATAdminAcquireContext(&hca, &dummy, 0);
|
||||
ok(ret || GetLastError() == ERROR_ACCESS_DENIED, "CryptCATAdminAcquireContext failed %u\n", GetLastError());
|
||||
ok(ret || GetLastError() == ERROR_ACCESS_DENIED, "CryptCATAdminAcquireContext failed %lu\n", GetLastError());
|
||||
if (!ret && GetLastError() == ERROR_ACCESS_DENIED)
|
||||
{
|
||||
win_skip("Not running as administrator\n");
|
||||
@@ -276,15 +281,15 @@ static void test_context(void)
|
||||
}
|
||||
|
||||
ret = pCryptCATAdminReleaseContext(hca, 0);
|
||||
ok(ret, "Expected success, got FALSE with %d\n", GetLastError());
|
||||
ok(ret, "Expected success, got FALSE with %ld\n", GetLastError());
|
||||
|
||||
/* Correct context handle and GUID */
|
||||
ret = pCryptCATAdminAcquireContext(&hca, &unknown, 0);
|
||||
ok(ret, "Expected success, got FALSE with %d\n", GetLastError());
|
||||
ok(ret, "Expected success, got FALSE with %ld\n", GetLastError());
|
||||
ok(hca != NULL, "Expected a context handle, got NULL\n");
|
||||
|
||||
ret = pCryptCATAdminReleaseContext(hca, 0);
|
||||
ok(ret, "Expected success, got FALSE with %d\n", GetLastError());
|
||||
ok(ret, "Expected success, got FALSE with %ld\n", GetLastError());
|
||||
|
||||
hca = (void *) 0xdeadbeef;
|
||||
SetLastError(0xdeadbeef);
|
||||
@@ -292,25 +297,49 @@ static void test_context(void)
|
||||
ret = pCryptCATAdminAcquireContext(&hca, &unknown, 1);
|
||||
ok((!ret && (GetLastError() == ERROR_INVALID_PARAMETER) && (hca == (void *) 0xdeadbeef)) ||
|
||||
broken(ret && hca != NULL && hca != (void *) 0xdeadbeef),
|
||||
"Expected FALSE and ERROR_INVALID_PARAMETER with untouched handle, got %d and %u with %p\n",
|
||||
"Expected FALSE and ERROR_INVALID_PARAMETER with untouched handle, got %d and %lu with %p\n",
|
||||
ret, GetLastError(), hca);
|
||||
|
||||
if (ret && hca)
|
||||
{
|
||||
SetLastError(0xdeadbeef);
|
||||
ret = pCryptCATAdminReleaseContext(hca, 0);
|
||||
ok(ret, "Expected success, got FALSE with %d\n", GetLastError());
|
||||
ok(ret, "Expected success, got FALSE with %ld\n", GetLastError());
|
||||
}
|
||||
|
||||
/* Specify SHA-1 algorithm */
|
||||
ret = pCryptCATAdminAcquireContext2(&hca, &unknown, BCRYPT_SHA1_ALGORITHM, NULL, 0);
|
||||
ok(ret, "Expected success, got FALSE with %ld\n", GetLastError());
|
||||
ok(hca != NULL, "Expected a context handle, got NULL\n");
|
||||
|
||||
ret = pCryptCATAdminReleaseContext(hca, 0);
|
||||
ok(ret, "Expected success, got FALSE with %ld\n", GetLastError());
|
||||
|
||||
/* Specify SHA-256 algorithm */
|
||||
ret = pCryptCATAdminAcquireContext2(&hca, &unknown, BCRYPT_SHA256_ALGORITHM, NULL, 0);
|
||||
ok(ret, "Expected success, got FALSE with %ld\n", GetLastError());
|
||||
ok(hca != NULL, "Expected a context handle, got NULL\n");
|
||||
|
||||
ret = pCryptCATAdminReleaseContext(hca, 0);
|
||||
ok(ret, "Expected success, got FALSE with %ld\n", GetLastError());
|
||||
|
||||
/* Set unknown algorithm - should return failure */
|
||||
ret = pCryptCATAdminAcquireContext2(&hca, &unknown, unknown_alg, NULL, 0);
|
||||
ok(!ret, "Expected failure\n");
|
||||
ok(GetLastError() == NTE_BAD_ALGID, "Expected NTE_BAD_ALGID, got %ld\n", GetLastError());
|
||||
|
||||
}
|
||||
|
||||
/* TODO: Check whether SHA-1 is the algorithm that's always used */
|
||||
static void test_calchash(void)
|
||||
{
|
||||
BOOL ret;
|
||||
HCATADMIN hca_sha1, hca_sha256;
|
||||
HANDLE file;
|
||||
DWORD hashsize = 0;
|
||||
BYTE* hash;
|
||||
BYTE expectedhash[20] = {0x3a,0xa1,0x19,0x08,0xec,0xa6,0x0d,0x2e,0x7e,0xcc,0x7a,0xca,0xf5,0xb8,0x2e,0x62,0x6a,0xda,0xf0,0x19};
|
||||
BYTE expectedhash_sha256[32] = { 0x8a, 0xfd, 0x8c, 0xec, 0xdd, 0xe3, 0x0b, 0xaa, 0x2f, 0x1c, 0x3f, 0x61, 0xaf, 0xdf, 0x24, 0x84, 0x99, 0x8b, 0xe3, 0xcf, 0xda, 0xff, 0x0c, 0x5e, 0xa8, 0x68, 0xe8, 0xea, 0x94, 0x1e, 0x90, 0xe2};
|
||||
CHAR temp[MAX_PATH];
|
||||
DWORD written;
|
||||
|
||||
@@ -319,14 +348,14 @@ static void test_calchash(void)
|
||||
ret = pCryptCATAdminCalcHashFromFileHandle(NULL, NULL, NULL, 0);
|
||||
ok(!ret, "Expected failure\n");
|
||||
ok(GetLastError() == ERROR_INVALID_PARAMETER,
|
||||
"Expected ERROR_INVALID_PARAMETER, got %d\n", GetLastError());
|
||||
"Expected ERROR_INVALID_PARAMETER, got %ld\n", GetLastError());
|
||||
|
||||
/* NULL filehandle, rest is legal */
|
||||
SetLastError(0xdeadbeef);
|
||||
ret = pCryptCATAdminCalcHashFromFileHandle(NULL, &hashsize, NULL, 0);
|
||||
ok(!ret, "Expected failure\n");
|
||||
ok(GetLastError() == ERROR_INVALID_PARAMETER,
|
||||
"Expected ERROR_INVALID_PARAMETER, got %d\n", GetLastError());
|
||||
"Expected ERROR_INVALID_PARAMETER, got %ld\n", GetLastError());
|
||||
|
||||
/* Correct filehandle, rest is NULL */
|
||||
file = CreateFileA(selfname, GENERIC_READ, 0, NULL, OPEN_EXISTING, 0, NULL);
|
||||
@@ -334,27 +363,36 @@ static void test_calchash(void)
|
||||
ret = pCryptCATAdminCalcHashFromFileHandle(file, NULL, NULL, 0);
|
||||
ok(!ret, "Expected failure\n");
|
||||
ok(GetLastError() == ERROR_INVALID_PARAMETER,
|
||||
"Expected ERROR_INVALID_PARAMETER, got %d\n", GetLastError());
|
||||
"Expected ERROR_INVALID_PARAMETER, got %ld\n", GetLastError());
|
||||
CloseHandle(file);
|
||||
|
||||
/* Correct catadmin, rest is NULL */
|
||||
ret = pCryptCATAdminAcquireContext2(&hca_sha1, NULL, BCRYPT_SHA1_ALGORITHM, NULL, 0);
|
||||
ok(ret, "Expected success, got FALSE with %ld\n", GetLastError());
|
||||
|
||||
ret = pCryptCATAdminCalcHashFromFileHandle2(hca_sha1, NULL, NULL, NULL, 0);
|
||||
ok(!ret, "Expected failure\n");
|
||||
ok(GetLastError() == ERROR_INVALID_PARAMETER,
|
||||
"Expected ERROR_INVALID_PARAMETER, got %ld\n", GetLastError());
|
||||
|
||||
/* All OK, but dwFlags set to 1 */
|
||||
file = CreateFileA(selfname, GENERIC_READ, 0, NULL, OPEN_EXISTING, 0, NULL);
|
||||
SetLastError(0xdeadbeef);
|
||||
ret = pCryptCATAdminCalcHashFromFileHandle(file, &hashsize, NULL, 1);
|
||||
ok(!ret, "Expected failure\n");
|
||||
ok(GetLastError() == ERROR_INVALID_PARAMETER,
|
||||
"Expected ERROR_INVALID_PARAMETER, got %d\n", GetLastError());
|
||||
"Expected ERROR_INVALID_PARAMETER, got %ld\n", GetLastError());
|
||||
CloseHandle(file);
|
||||
|
||||
/* All OK, requesting the size of the hash */
|
||||
file = CreateFileA(selfname, GENERIC_READ, FILE_SHARE_READ, NULL, OPEN_EXISTING, 0, NULL);
|
||||
ok(file != INVALID_HANDLE_VALUE, "CreateFile failed %u\n", GetLastError());
|
||||
ok(file != INVALID_HANDLE_VALUE, "CreateFile failed %lu\n", GetLastError());
|
||||
SetLastError(0xdeadbeef);
|
||||
ret = pCryptCATAdminCalcHashFromFileHandle(file, &hashsize, NULL, 0);
|
||||
ok(ret, "Expected success, got FALSE with %d\n", GetLastError());
|
||||
ok(hashsize == 20," Expected a hash size of 20, got %d\n", hashsize);
|
||||
ok(ret, "Expected success, got FALSE with %ld\n", GetLastError());
|
||||
ok(hashsize == 20," Expected a hash size of 20, got %ld\n", hashsize);
|
||||
ok(GetLastError() == ERROR_INSUFFICIENT_BUFFER,
|
||||
"Expected ERROR_INSUFFICIENT_BUFFER, got %d\n", GetLastError());
|
||||
"Expected ERROR_INSUFFICIENT_BUFFER, got %ld\n", GetLastError());
|
||||
CloseHandle(file);
|
||||
|
||||
/* All OK, retrieve the hash
|
||||
@@ -365,10 +403,10 @@ static void test_calchash(void)
|
||||
hash = HeapAlloc(GetProcessHeap(), 0, hashsize);
|
||||
SetLastError(0xdeadbeef);
|
||||
ret = pCryptCATAdminCalcHashFromFileHandle(file, &hashsize, hash, 0);
|
||||
ok(ret, "Expected success, got FALSE with %d\n", GetLastError());
|
||||
ok(hashsize == 20," Expected a hash size of 20, got %d\n", hashsize);
|
||||
ok(ret, "Expected success, got FALSE with %ld\n", GetLastError());
|
||||
ok(hashsize == 20," Expected a hash size of 20, got %ld\n", hashsize);
|
||||
ok(GetLastError() == ERROR_SUCCESS,
|
||||
"Expected ERROR_SUCCESS, got %d\n", GetLastError());
|
||||
"Expected ERROR_SUCCESS, got %ld\n", GetLastError());
|
||||
CloseHandle(file);
|
||||
HeapFree(GetProcessHeap(), 0, hash);
|
||||
|
||||
@@ -387,47 +425,152 @@ static void test_calchash(void)
|
||||
hash = HeapAlloc(GetProcessHeap(), 0, hashsize);
|
||||
SetLastError(0xdeadbeef);
|
||||
ret = pCryptCATAdminCalcHashFromFileHandle(file, &hashsize, hash, 0);
|
||||
ok(ret, "Expected success, got FALSE with %d\n", GetLastError());
|
||||
ok(ret, "Expected success, got FALSE with %ld\n", GetLastError());
|
||||
ok(GetLastError() == ERROR_SUCCESS,
|
||||
"Expected ERROR_SUCCESS, got %d\n", GetLastError());
|
||||
"Expected ERROR_SUCCESS, got %ld\n", GetLastError());
|
||||
ok(hashsize == sizeof(expectedhash) &&
|
||||
!memcmp(hash, expectedhash, sizeof(expectedhash)),
|
||||
"Hashes didn't match\n");
|
||||
CloseHandle(file);
|
||||
|
||||
HeapFree(GetProcessHeap(), 0, hash);
|
||||
|
||||
/* Calculate hash with SHA-1 specified as algorithm */
|
||||
file = CreateFileA(selfname, GENERIC_READ, FILE_SHARE_READ, NULL, OPEN_EXISTING, 0, NULL);
|
||||
SetLastError(0xdeadbeef);
|
||||
hashsize = 0;
|
||||
ret = pCryptCATAdminCalcHashFromFileHandle2(hca_sha1, file, &hashsize, NULL, 0);
|
||||
ok(ret, "Expected success, got FALSE with %ld\n", GetLastError());
|
||||
ok(hashsize == 20," Expected a hash size of 20, got %ld\n", hashsize);
|
||||
ok(GetLastError() == ERROR_INSUFFICIENT_BUFFER,
|
||||
"Expected ERROR_INSUFFICIENT_BUFFER, got %ld\n", GetLastError());
|
||||
hash = HeapAlloc(GetProcessHeap(), 0, hashsize);
|
||||
SetLastError(0xdeadbeef);
|
||||
ret = pCryptCATAdminCalcHashFromFileHandle2(hca_sha1, file, &hashsize, hash, 0);
|
||||
ok(ret, "Expected success, got FALSE with %ld\n", GetLastError());
|
||||
ok(hashsize == 20," Expected a hash size of 20, got %ld\n", hashsize);
|
||||
ok(GetLastError() == ERROR_SUCCESS,
|
||||
"Expected ERROR_SUCCESS, got %ld\n", GetLastError());
|
||||
CloseHandle(file);
|
||||
HeapFree(GetProcessHeap(), 0, hash);
|
||||
|
||||
/* Check SHA1-hash for file with known hash */
|
||||
file = CreateFileA(temp, GENERIC_READ, 0, NULL, OPEN_EXISTING, 0, NULL);
|
||||
hashsize = 0;
|
||||
pCryptCATAdminCalcHashFromFileHandle2(hca_sha1, file, &hashsize, NULL, 0);
|
||||
hash = HeapAlloc(GetProcessHeap(), 0, hashsize);
|
||||
SetLastError(0xdeadbeef);
|
||||
ret = pCryptCATAdminCalcHashFromFileHandle2(hca_sha1, file, &hashsize, hash, 0);
|
||||
ok(ret, "Expected success, got FALSE with %ld\n", GetLastError());
|
||||
ok(GetLastError() == ERROR_SUCCESS,
|
||||
"Expected ERROR_SUCCESS, got %ld\n", GetLastError());
|
||||
ok(hashsize == sizeof(expectedhash) &&
|
||||
!memcmp(hash, expectedhash, sizeof(expectedhash)),
|
||||
"Hashes didn't match\n");
|
||||
CloseHandle(file);
|
||||
HeapFree(GetProcessHeap(), 0, hash);
|
||||
pCryptCATAdminReleaseContext(hca_sha1, 0);
|
||||
|
||||
/* Calculate hash with SHA-256 specified as algorithm */
|
||||
ret = pCryptCATAdminAcquireContext2(&hca_sha256, NULL, BCRYPT_SHA256_ALGORITHM, NULL, 0);
|
||||
ok(ret, "Expected success, got FALSE with %ld\n", GetLastError());
|
||||
file = CreateFileA(selfname, GENERIC_READ, FILE_SHARE_READ, NULL, OPEN_EXISTING, 0, NULL);
|
||||
hashsize = 0;
|
||||
ret = pCryptCATAdminCalcHashFromFileHandle2(hca_sha256, file, &hashsize, NULL, 0);
|
||||
ok(ret, "Expected success, got FALSE with %ld\n", GetLastError());
|
||||
ok(hashsize == 32," Expected a hash size of 32, got %ld\n", hashsize);
|
||||
ok(GetLastError() == ERROR_INSUFFICIENT_BUFFER,
|
||||
"Expected ERROR_INSUFFICIENT_BUFFER, got %ld\n", GetLastError());
|
||||
hash = HeapAlloc(GetProcessHeap(), 0, hashsize);
|
||||
SetLastError(0xdeadbeef);
|
||||
ret = pCryptCATAdminCalcHashFromFileHandle2(hca_sha256, file, &hashsize, hash, 0);
|
||||
ok(ret, "Expected success, got FALSE with %ld\n", GetLastError());
|
||||
ok(hashsize == 32," Expected a hash size of 32, got %ld\n", hashsize);
|
||||
ok(GetLastError() == ERROR_SUCCESS,
|
||||
"Expected ERROR_SUCCESS, got %ld\n", GetLastError());
|
||||
CloseHandle(file);
|
||||
HeapFree(GetProcessHeap(), 0, hash);
|
||||
|
||||
/* All OK, first request the size and then retrieve the SHA256 hash */
|
||||
/* Check SHA256-hash for file with known hash */
|
||||
file = CreateFileA(temp, GENERIC_READ, 0, NULL, OPEN_EXISTING, 0, NULL);
|
||||
hashsize = 0;
|
||||
ret = pCryptCATAdminCalcHashFromFileHandle2(hca_sha256, file, &hashsize, NULL, 0);
|
||||
ok(ret, "Expected success, got FALSE with %ld\n", GetLastError());
|
||||
hash = HeapAlloc(GetProcessHeap(), 0, hashsize);
|
||||
SetLastError(0xdeadbeef);
|
||||
ret = pCryptCATAdminCalcHashFromFileHandle2(hca_sha256, file, &hashsize, hash, 0);
|
||||
ok(ret, "Expected success, got FALSE with %ld\n", GetLastError());
|
||||
ok(GetLastError() == ERROR_SUCCESS,
|
||||
"Expected ERROR_SUCCESS, got %ld\n", GetLastError());
|
||||
ok(hashsize == sizeof(expectedhash_sha256) &&
|
||||
!memcmp(hash, expectedhash_sha256, sizeof(expectedhash_sha256)),
|
||||
"Hashes didn't match\n");
|
||||
CloseHandle(file);
|
||||
HeapFree(GetProcessHeap(), 0, hash);
|
||||
pCryptCATAdminReleaseContext(hca_sha256, 0);
|
||||
DeleteFileA(temp);
|
||||
}
|
||||
|
||||
static void test_CryptCATOpen(void)
|
||||
{
|
||||
HANDLE hcat;
|
||||
char empty[MAX_PATH];
|
||||
WCHAR emptyW[MAX_PATH];
|
||||
HANDLE file;
|
||||
WCHAR filename[MAX_PATH], temp_path[MAX_PATH];
|
||||
HANDLE cat;
|
||||
DWORD flags;
|
||||
BOOL ret;
|
||||
FILE *file;
|
||||
char buffer[10];
|
||||
|
||||
GetTempPathW(ARRAY_SIZE(temp_path), temp_path);
|
||||
GetTempFileNameW(temp_path, L"cat", 0, filename);
|
||||
|
||||
SetLastError(0xdeadbeef);
|
||||
hcat = pCryptCATOpen(NULL, 0, 0, 0, 0);
|
||||
ok(hcat == INVALID_HANDLE_VALUE, "CryptCATOpen succeeded\n");
|
||||
ok(GetLastError() == ERROR_INVALID_PARAMETER,
|
||||
"Expected ERROR_INVALID_PARAMETER, got %08x\n", GetLastError());
|
||||
cat = pCryptCATOpen(NULL, 0, 0, 0, 0);
|
||||
ok(cat == INVALID_HANDLE_VALUE, "expected failure\n");
|
||||
ok(GetLastError() == ERROR_INVALID_PARAMETER, "got error %lu\n", GetLastError());
|
||||
|
||||
if (!GetTempFileNameA(CURR_DIR, "cat", 0, empty)) return;
|
||||
for (flags = 0; flags < 8; ++flags)
|
||||
{
|
||||
SetLastError(0xdeadbeef);
|
||||
cat = pCryptCATOpen(filename, flags, 0, 0, 0);
|
||||
if (flags == CRYPTCAT_OPEN_EXISTING)
|
||||
{
|
||||
ok(cat == INVALID_HANDLE_VALUE, "flags %#lx: expected failure\n", flags);
|
||||
ok(GetLastError() == ERROR_FILE_NOT_FOUND, "flags %#lx: got error %lu\n", flags, GetLastError());
|
||||
ret = DeleteFileW(filename);
|
||||
ok(!ret, "flags %#lx: expected failure\n", flags);
|
||||
}
|
||||
else
|
||||
{
|
||||
ok(cat != INVALID_HANDLE_VALUE, "flags %#lx: expected success\n", flags);
|
||||
ok(!GetLastError(), "flags %#lx: got error %lu\n", flags, GetLastError());
|
||||
ret = pCryptCATClose(cat);
|
||||
ok(ret, "flags %#lx: failed to close file\n", flags);
|
||||
ret = DeleteFileW(filename);
|
||||
ok(ret, "flags %#lx: failed to delete file, error %lu\n", flags, GetLastError());
|
||||
}
|
||||
|
||||
file = CreateFileA(empty, GENERIC_WRITE, 0, NULL, OPEN_EXISTING, 0, NULL);
|
||||
ok(file != INVALID_HANDLE_VALUE, "CreateFileA failed %u\n", GetLastError());
|
||||
CloseHandle(file);
|
||||
MultiByteToWideChar(CP_ACP, 0, empty, -1, emptyW, MAX_PATH);
|
||||
file = _wfopen(filename, L"w");
|
||||
fputs("test text", file);
|
||||
fclose(file);
|
||||
|
||||
hcat = pCryptCATOpen(emptyW, 0, 0, 0, 0);
|
||||
todo_wine
|
||||
ok(hcat != INVALID_HANDLE_VALUE, "Expected a correct handle\n");
|
||||
SetLastError(0xdeadbeef);
|
||||
cat = pCryptCATOpen(filename, flags, 0, 0, 0);
|
||||
ok(cat != INVALID_HANDLE_VALUE, "flags %#lx: expected success\n", flags);
|
||||
ok(!GetLastError(), "flags %#lx: got error %lu\n", flags, GetLastError());
|
||||
ret = pCryptCATClose(cat);
|
||||
ok(ret, "flags %#lx: failed to close file\n", flags);
|
||||
|
||||
ret = pCryptCATClose(hcat);
|
||||
todo_wine
|
||||
ok(ret, "CryptCATClose failed\n");
|
||||
DeleteFileA(empty);
|
||||
file = _wfopen(filename, L"r");
|
||||
ret = fread(buffer, 1, sizeof(buffer), file);
|
||||
if (flags & CRYPTCAT_OPEN_CREATENEW)
|
||||
ok(!ret, "flags %#lx: got %s\n", flags, debugstr_an(buffer, ret));
|
||||
else
|
||||
ok(ret == 9 && !strncmp(buffer, "test text", ret), "flags %#lx: got %s\n", flags, debugstr_an(buffer, ret));
|
||||
fclose(file);
|
||||
|
||||
ret = DeleteFileW(filename);
|
||||
ok(ret, "flags %#lx: failed to delete file, error %lu\n", flags, GetLastError());
|
||||
}
|
||||
}
|
||||
|
||||
static DWORD error_area;
|
||||
@@ -435,7 +578,7 @@ static DWORD local_error;
|
||||
|
||||
static void WINAPI cdf_callback(DWORD area, DWORD error, WCHAR* line)
|
||||
{
|
||||
ok(error_area != -2, "Didn't expect cdf_callback() to be called (%08x, %08x)\n",
|
||||
ok(error_area != -2, "Didn't expect cdf_callback() to be called (%08lx, %08lx)\n",
|
||||
area, error);
|
||||
|
||||
error_area = area;
|
||||
@@ -458,33 +601,33 @@ static void test_CryptCATCDF_params(void)
|
||||
catcdf = pCryptCATCDFOpen(NULL, NULL);
|
||||
ok(catcdf == NULL, "CryptCATCDFOpen succeeded\n");
|
||||
todo_wine
|
||||
ok(GetLastError() == ERROR_INVALID_PARAMETER, "Expected ERROR_INVALID_PARAMETER, got %d\n", GetLastError());
|
||||
ok(GetLastError() == ERROR_INVALID_PARAMETER, "Expected ERROR_INVALID_PARAMETER, got %ld\n", GetLastError());
|
||||
|
||||
SetLastError(0xdeadbeef);
|
||||
catcdf = pCryptCATCDFOpen(NULL, cdf_callback);
|
||||
ok(catcdf == NULL, "CryptCATCDFOpen succeeded\n");
|
||||
todo_wine
|
||||
ok(GetLastError() == ERROR_INVALID_PARAMETER, "Expected ERROR_INVALID_PARAMETER, got %d\n", GetLastError());
|
||||
ok(GetLastError() == ERROR_INVALID_PARAMETER, "Expected ERROR_INVALID_PARAMETER, got %ld\n", GetLastError());
|
||||
|
||||
/* File doesn't exist */
|
||||
SetLastError(0xdeadbeef);
|
||||
catcdf = pCryptCATCDFOpen(nonexistent, cdf_callback);
|
||||
ok(catcdf == NULL, "CryptCATCDFOpen succeeded\n");
|
||||
todo_wine
|
||||
ok(GetLastError() == ERROR_FILE_NOT_FOUND, "Expected ERROR_FILE_NOT_FOUND, got %d\n", GetLastError());
|
||||
ok(GetLastError() == ERROR_FILE_NOT_FOUND, "Expected ERROR_FILE_NOT_FOUND, got %ld\n", GetLastError());
|
||||
|
||||
SetLastError(0xdeadbeef);
|
||||
ret = pCryptCATCDFClose(NULL);
|
||||
ok(!ret, "Expected failure\n");
|
||||
todo_wine
|
||||
ok(GetLastError() == ERROR_INVALID_PARAMETER, "Expected ERROR_INVALID_PARAMETER, got %d\n", GetLastError());
|
||||
ok(GetLastError() == ERROR_INVALID_PARAMETER, "Expected ERROR_INVALID_PARAMETER, got %ld\n", GetLastError());
|
||||
|
||||
catcdf = NULL;
|
||||
SetLastError(0xdeadbeef);
|
||||
ret = pCryptCATCDFClose(catcdf);
|
||||
ok(!ret, "Expected failure\n");
|
||||
todo_wine
|
||||
ok(GetLastError() == ERROR_INVALID_PARAMETER, "Expected ERROR_INVALID_PARAMETER, got %d\n", GetLastError());
|
||||
ok(GetLastError() == ERROR_INVALID_PARAMETER, "Expected ERROR_INVALID_PARAMETER, got %ld\n", GetLastError());
|
||||
}
|
||||
|
||||
/* FIXME: Once Wine can create catalog files we should use the created catalog file in this test */
|
||||
@@ -514,11 +657,11 @@ static void test_CryptCATAdminAddRemoveCatalog(void)
|
||||
if (!GetTempFileNameA(CURR_DIR, "cat", 0, tmpfile)) return;
|
||||
DeleteFileA(tmpfile);
|
||||
file = CreateFileA(tmpfile, GENERIC_WRITE, 0, NULL, CREATE_NEW, 0, NULL);
|
||||
ok(file != INVALID_HANDLE_VALUE, "CreateFileA failed %u\n", GetLastError());
|
||||
ok(file != INVALID_HANDLE_VALUE, "CreateFileA failed %lu\n", GetLastError());
|
||||
CloseHandle(file);
|
||||
|
||||
ret = pCryptCATAdminAcquireContext(&hcatadmin, &dummy, 0);
|
||||
ok(ret || GetLastError() == ERROR_ACCESS_DENIED, "CryptCATAdminAcquireContext failed %u\n", GetLastError());
|
||||
ok(ret || GetLastError() == ERROR_ACCESS_DENIED, "CryptCATAdminAcquireContext failed %lu\n", GetLastError());
|
||||
if (!ret && GetLastError() == ERROR_ACCESS_DENIED)
|
||||
{
|
||||
win_skip("Not running as administrator\n");
|
||||
@@ -529,13 +672,13 @@ static void test_CryptCATAdminAddRemoveCatalog(void)
|
||||
hcatinfo = pCryptCATAdminAddCatalog(NULL, NULL, NULL, 0);
|
||||
error = GetLastError();
|
||||
ok(hcatinfo == NULL, "CryptCATAdminAddCatalog succeeded\n");
|
||||
ok(error == ERROR_INVALID_PARAMETER, "got %u expected ERROR_INVALID_PARAMETER\n", GetLastError());
|
||||
ok(error == ERROR_INVALID_PARAMETER, "got %lu expected ERROR_INVALID_PARAMETER\n", GetLastError());
|
||||
|
||||
SetLastError(0xdeadbeef);
|
||||
hcatinfo = pCryptCATAdminAddCatalog(hcatadmin, NULL, NULL, 0);
|
||||
error = GetLastError();
|
||||
ok(hcatinfo == NULL, "CryptCATAdminAddCatalog succeeded\n");
|
||||
ok(error == ERROR_INVALID_PARAMETER, "got %u expected ERROR_INVALID_PARAMETER\n", GetLastError());
|
||||
ok(error == ERROR_INVALID_PARAMETER, "got %lu expected ERROR_INVALID_PARAMETER\n", GetLastError());
|
||||
|
||||
MultiByteToWideChar(CP_ACP, 0, tmpfile, -1, tmpfileW, MAX_PATH);
|
||||
|
||||
@@ -544,7 +687,7 @@ static void test_CryptCATAdminAddRemoveCatalog(void)
|
||||
error = GetLastError();
|
||||
todo_wine {
|
||||
ok(hcatinfo == NULL, "CryptCATAdminAddCatalog succeeded\n");
|
||||
ok(error == ERROR_BAD_FORMAT, "got %u expected ERROR_BAD_FORMAT\n", GetLastError());
|
||||
ok(error == ERROR_BAD_FORMAT, "got %lu expected ERROR_BAD_FORMAT\n", GetLastError());
|
||||
}
|
||||
if (hcatinfo != NULL)
|
||||
pCryptCATAdminReleaseCatalogContext(hcatadmin, hcatinfo, 0);
|
||||
@@ -555,17 +698,17 @@ static void test_CryptCATAdminAddRemoveCatalog(void)
|
||||
ok(hcatinfo == NULL, "CryptCATAdminAddCatalog succeeded\n");
|
||||
ok(error == ERROR_INVALID_PARAMETER ||
|
||||
error == ERROR_BAD_FORMAT, /* win 8 */
|
||||
"got %u\n", GetLastError());
|
||||
"got %lu\n", GetLastError());
|
||||
|
||||
SetLastError(0xdeadbeef);
|
||||
hcatinfo = pCryptCATAdminAddCatalog(hcatadmin, tmpfileW, NULL, 0);
|
||||
error = GetLastError();
|
||||
ok(hcatinfo == NULL, "CryptCATAdminAddCatalog succeeded\n");
|
||||
todo_wine ok(error == ERROR_BAD_FORMAT, "got %u expected ERROR_BAD_FORMAT\n", GetLastError());
|
||||
todo_wine ok(error == ERROR_BAD_FORMAT, "got %lu expected ERROR_BAD_FORMAT\n", GetLastError());
|
||||
|
||||
DeleteFileA(tmpfile);
|
||||
file = CreateFileA(tmpfile, GENERIC_WRITE, 0, NULL, CREATE_NEW, 0, NULL);
|
||||
ok(file != INVALID_HANDLE_VALUE, "CreateFileA failed %u\n", GetLastError());
|
||||
ok(file != INVALID_HANDLE_VALUE, "CreateFileA failed %lu\n", GetLastError());
|
||||
WriteFile(file, test_catalog, sizeof(test_catalog), &written, NULL);
|
||||
CloseHandle(file);
|
||||
|
||||
@@ -576,14 +719,14 @@ static void test_CryptCATAdminAddRemoveCatalog(void)
|
||||
win_skip("Not enough rights\n");
|
||||
goto cleanup;
|
||||
}
|
||||
todo_wine ok(hcatinfo != NULL, "CryptCATAdminAddCatalog failed %u\n", GetLastError());
|
||||
todo_wine ok(hcatinfo != NULL, "CryptCATAdminAddCatalog failed %lu\n", GetLastError());
|
||||
|
||||
info.cbStruct = sizeof(info);
|
||||
info.wszCatalogFile[0] = 0;
|
||||
ret = pCryptCATCatalogInfoFromContext(hcatinfo, &info, 0);
|
||||
todo_wine
|
||||
{
|
||||
ok(ret, "CryptCATCatalogInfoFromContext failed %u\n", GetLastError());
|
||||
ok(ret, "CryptCATCatalogInfoFromContext failed %lu\n", GetLastError());
|
||||
ok(info.wszCatalogFile[0] != 0, "Expected a filename\n");
|
||||
}
|
||||
WideCharToMultiByte(CP_ACP, 0, info.wszCatalogFile, -1, catfile, MAX_PATH, NULL, NULL);
|
||||
@@ -594,11 +737,11 @@ static void test_CryptCATAdminAddRemoveCatalog(void)
|
||||
/* Set the file attributes so we can check what happens with them during the 'copy' */
|
||||
attrs = FILE_ATTRIBUTE_READONLY;
|
||||
ret = SetFileAttributesA(tmpfile, attrs);
|
||||
ok(ret, "SetFileAttributesA failed : %u\n", GetLastError());
|
||||
ok(ret, "SetFileAttributesA failed : %lu\n", GetLastError());
|
||||
|
||||
/* winetest.cat will be created */
|
||||
hcatinfo = pCryptCATAdminAddCatalog(hcatadmin, tmpfileW, basenameW, 0);
|
||||
ok(hcatinfo != NULL, "CryptCATAdminAddCatalog failed %u\n", GetLastError());
|
||||
ok(hcatinfo != NULL, "CryptCATAdminAddCatalog failed %lu\n", GetLastError());
|
||||
|
||||
lstrcpyA(catfilepath, catroot);
|
||||
lstrcatA(catfilepath, "\\{DEADBEEF-DEAD-BEEF-DEAD-BEEFDEADBEEF}\\winetest.cat");
|
||||
@@ -607,45 +750,45 @@ static void test_CryptCATAdminAddRemoveCatalog(void)
|
||||
todo_wine
|
||||
ok(attrs == FILE_ATTRIBUTE_SYSTEM ||
|
||||
attrs == (FILE_ATTRIBUTE_NOT_CONTENT_INDEXED | FILE_ATTRIBUTE_SYSTEM), /* Vista */
|
||||
"File has wrong attributes : %08x\n", attrs);
|
||||
"File has wrong attributes : %08lx\n", attrs);
|
||||
|
||||
info.cbStruct = sizeof(info);
|
||||
info.wszCatalogFile[0] = 0;
|
||||
ret = pCryptCATCatalogInfoFromContext(hcatinfo, &info, 0);
|
||||
ok(ret, "CryptCATCatalogInfoFromContext failed %u\n", GetLastError());
|
||||
ok(ret, "CryptCATCatalogInfoFromContext failed %lu\n", GetLastError());
|
||||
ok(info.wszCatalogFile[0] != 0, "Expected a filename\n");
|
||||
WideCharToMultiByte(CP_ACP, 0, info.wszCatalogFile, -1, catfile, MAX_PATH, NULL, NULL);
|
||||
if ((p = strrchr(catfile, '\\'))) p++;
|
||||
ok(!lstrcmpA(basename, p), "Expected %s, got %s\n", basename, p);
|
||||
|
||||
ret = pCryptCATAdminReleaseCatalogContext(hcatadmin, hcatinfo, 0);
|
||||
ok(ret, "CryptCATAdminReleaseCatalogContext failed %u\n", GetLastError());
|
||||
ok(ret, "CryptCATAdminReleaseCatalogContext failed %lu\n", GetLastError());
|
||||
|
||||
/* Remove the catalog file with the unique name */
|
||||
ret = pCryptCATAdminRemoveCatalog(hcatadmin, catfileW, 0);
|
||||
ok(ret, "CryptCATAdminRemoveCatalog failed %u\n", GetLastError());
|
||||
ok(ret, "CryptCATAdminRemoveCatalog failed %lu\n", GetLastError());
|
||||
|
||||
/* Remove the winetest.cat catalog file, first with the full path. This should not succeed
|
||||
* according to MSDN */
|
||||
ret = pCryptCATAdminRemoveCatalog(hcatadmin, info.wszCatalogFile, 0);
|
||||
ok(ret, "CryptCATAdminRemoveCatalog failed %u\n", GetLastError());
|
||||
ok(ret, "CryptCATAdminRemoveCatalog failed %lu\n", GetLastError());
|
||||
/* The call succeeded with the full path but the file is not removed */
|
||||
attrs = GetFileAttributesA(catfilepath);
|
||||
ok(attrs != INVALID_FILE_ATTRIBUTES, "Expected %s to exist\n", catfilepath);
|
||||
/* Given only the filename the file is removed */
|
||||
ret = pCryptCATAdminRemoveCatalog(hcatadmin, basenameW, 0);
|
||||
ok(ret, "CryptCATAdminRemoveCatalog failed %u\n", GetLastError());
|
||||
ok(ret, "CryptCATAdminRemoveCatalog failed %lu\n", GetLastError());
|
||||
attrs = GetFileAttributesA(catfilepath);
|
||||
ok(attrs == INVALID_FILE_ATTRIBUTES, "Expected %s to be removed\n", catfilepath);
|
||||
|
||||
cleanup:
|
||||
ret = pCryptCATAdminReleaseContext(hcatadmin, 0);
|
||||
ok(ret, "CryptCATAdminReleaseContext failed %u\n", GetLastError());
|
||||
ok(ret, "CryptCATAdminReleaseContext failed %lu\n", GetLastError());
|
||||
|
||||
/* Set the attributes so we can delete the file */
|
||||
attrs = FILE_ATTRIBUTE_NORMAL;
|
||||
ret = SetFileAttributesA(tmpfile, attrs);
|
||||
ok(ret, "SetFileAttributesA failed %u\n", GetLastError());
|
||||
ok(ret, "SetFileAttributesA failed %lu\n", GetLastError());
|
||||
DeleteFileA(tmpfile);
|
||||
}
|
||||
|
||||
@@ -674,7 +817,7 @@ static void test_catalog_properties(const char *catfile, int attributes, int mem
|
||||
trace("Creating the catalog file\n");
|
||||
if (!GetTempFileNameA(CURR_DIR, "cat", 0, catalog)) return;
|
||||
file = CreateFileA(catalog, GENERIC_WRITE, 0, NULL, OPEN_EXISTING, 0, NULL);
|
||||
ok(file != INVALID_HANDLE_VALUE, "CreateFileA failed %u\n", GetLastError());
|
||||
ok(file != INVALID_HANDLE_VALUE, "CreateFileA failed %lu\n", GetLastError());
|
||||
WriteFile(file, test_catalog, sizeof(test_catalog), &written, NULL);
|
||||
CloseHandle(file);
|
||||
|
||||
@@ -694,7 +837,7 @@ static void test_catalog_properties(const char *catfile, int attributes, int mem
|
||||
win_skip("CryptCATOpen on W2K can't handle catalog files with no members\n");
|
||||
return;
|
||||
}
|
||||
ok(hcat != INVALID_HANDLE_VALUE, "CryptCATOpen failed %u\n", GetLastError());
|
||||
ok(hcat != INVALID_HANDLE_VALUE, "CryptCATOpen failed %lu\n", GetLastError());
|
||||
|
||||
m = pCryptCATEnumerateMember(NULL, NULL);
|
||||
ok(m == NULL, "CryptCATEnumerateMember succeeded\n");
|
||||
@@ -702,12 +845,12 @@ static void test_catalog_properties(const char *catfile, int attributes, int mem
|
||||
m = NULL;
|
||||
while ((m = pCryptCATEnumerateMember(hcat, m)))
|
||||
{
|
||||
ok(m->cbStruct == sizeof(CRYPTCATMEMBER), "unexpected size %u\n", m->cbStruct);
|
||||
ok(m->cbStruct == sizeof(CRYPTCATMEMBER), "unexpected size %lu\n", m->cbStruct);
|
||||
todo_wine ok(!lstrcmpW(m->pwszReferenceTag, hashmeW), "unexpected tag\n");
|
||||
ok(!memcmp(&m->gSubjectType, &subject, sizeof(subject)), "guid differs\n");
|
||||
ok(!m->fdwMemberFlags, "got %x expected 0\n", m->fdwMemberFlags);
|
||||
ok(m->dwCertVersion == 0x200, "got %x expected 0x200\n", m->dwCertVersion);
|
||||
ok(!m->dwReserved, "got %x expected 0\n", m->dwReserved);
|
||||
ok(!m->fdwMemberFlags, "got %lx expected 0\n", m->fdwMemberFlags);
|
||||
ok(m->dwCertVersion == 0x200, "got %lx expected 0x200\n", m->dwCertVersion);
|
||||
ok(!m->dwReserved, "got %lx expected 0\n", m->dwReserved);
|
||||
ok(m->hReserved == NULL, "got %p expected NULL\n", m->hReserved);
|
||||
|
||||
attr = pCryptCATEnumerateAttr(hcat, m, NULL);
|
||||
@@ -762,7 +905,7 @@ static void test_create_catalog_file(void)
|
||||
|
||||
/* Create the cdf file */
|
||||
file = CreateFileA(cdffileA, GENERIC_WRITE, 0, NULL, CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL);
|
||||
ok(file != INVALID_HANDLE_VALUE, "CreateFileA failed %u\n", GetLastError());
|
||||
ok(file != INVALID_HANDLE_VALUE, "CreateFileA failed %lu\n", GetLastError());
|
||||
WriteFile(file, test_cdf, sizeof(test_cdf) - 1, &written, NULL);
|
||||
CloseHandle(file);
|
||||
|
||||
@@ -773,14 +916,14 @@ static void test_create_catalog_file(void)
|
||||
todo_wine
|
||||
{
|
||||
ok(catcdf != NULL, "CryptCATCDFOpen failed\n");
|
||||
ok(GetLastError() == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", GetLastError());
|
||||
ok(GetLastError() == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %ld\n", GetLastError());
|
||||
}
|
||||
|
||||
ret = pCryptCATCDFClose(catcdf);
|
||||
todo_wine
|
||||
{
|
||||
ok(ret, "Expected success, got FALSE with %d\n", GetLastError());
|
||||
ok(GetLastError() == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", GetLastError());
|
||||
ok(ret, "Expected success, got FALSE with %ld\n", GetLastError());
|
||||
ok(GetLastError() == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %ld\n", GetLastError());
|
||||
}
|
||||
|
||||
attrs = GetFileAttributesA(catfileA);
|
||||
@@ -862,15 +1005,15 @@ static void create_cdf_file(const CHAR *filename, const CHAR *contents)
|
||||
DWORD written;
|
||||
|
||||
file = CreateFileA(filename, GENERIC_WRITE, 0, NULL, CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL);
|
||||
ok(file != INVALID_HANDLE_VALUE, "CreateFileA failed %u\n", GetLastError());
|
||||
ok(file != INVALID_HANDLE_VALUE, "CreateFileA failed %lu\n", GetLastError());
|
||||
WriteFile(file, contents, lstrlenA(contents), &written, NULL);
|
||||
CloseHandle(file);
|
||||
}
|
||||
|
||||
#define CHECK_EXPECT(a, b) \
|
||||
do { \
|
||||
ok(a == error_area, "Expected %08x, got %08x\n", a, error_area); \
|
||||
ok(b == local_error, "Expected %08x, got %08x\n", b, local_error); \
|
||||
ok(a == error_area, "Expected %08x, got %08lx\n", a, error_area); \
|
||||
ok(b == local_error, "Expected %08x, got %08lx\n", b, local_error); \
|
||||
} while (0)
|
||||
|
||||
/* Clear the variables (can't use 0) */
|
||||
@@ -909,7 +1052,7 @@ static void test_cdf_parsing(void)
|
||||
CHECK_EXPECT(CRYPTCAT_E_AREA_HEADER, CRYPTCAT_E_CDF_TAGNOTFOUND);
|
||||
ok(catcdf == NULL, "CryptCATCDFOpen succeeded\n");
|
||||
todo_wine
|
||||
ok(GetLastError() == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", GetLastError());
|
||||
ok(GetLastError() == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %ld\n", GetLastError());
|
||||
DeleteFileA(cdffileA);
|
||||
ok(!DeleteFileA(catfileA), "Didn't expect a catalog file to be created\n");
|
||||
|
||||
@@ -923,7 +1066,7 @@ static void test_cdf_parsing(void)
|
||||
ok(catcdf == NULL, "CryptCATCDFOpen succeeded\n");
|
||||
todo_wine
|
||||
ok(GetLastError() == ERROR_SHARING_VIOLATION,
|
||||
"Expected ERROR_SHARING_VIOLATION, got %d\n", GetLastError());
|
||||
"Expected ERROR_SHARING_VIOLATION, got %ld\n", GetLastError());
|
||||
DeleteFileA(cdffileA);
|
||||
|
||||
/* Header and member only */
|
||||
@@ -938,7 +1081,7 @@ static void test_cdf_parsing(void)
|
||||
ok(catcdf == NULL, "CryptCATCDFOpen succeeded\n");
|
||||
todo_wine
|
||||
ok(GetLastError() == ERROR_SHARING_VIOLATION,
|
||||
"Expected ERROR_SHARING_VIOLATION, got %d\n", GetLastError());
|
||||
"Expected ERROR_SHARING_VIOLATION, got %ld\n", GetLastError());
|
||||
DeleteFileA(cdffileA);
|
||||
ok(!DeleteFileA(catfileA), "Didn't expect a catalog file to be created\n");
|
||||
|
||||
@@ -953,7 +1096,7 @@ static void test_cdf_parsing(void)
|
||||
ok(catcdf == NULL, "CryptCATCDFOpen succeeded\n");
|
||||
todo_wine
|
||||
ok(GetLastError() == ERROR_SHARING_VIOLATION,
|
||||
"Expected ERROR_SHARING_VIOLATION, got %d\n", GetLastError());
|
||||
"Expected ERROR_SHARING_VIOLATION, got %ld\n", GetLastError());
|
||||
DeleteFileA(cdffileA);
|
||||
ok(!DeleteFileA(catfileA), "Didn't expect a catalog file to be created\n");
|
||||
|
||||
@@ -968,7 +1111,7 @@ static void test_cdf_parsing(void)
|
||||
todo_wine
|
||||
{
|
||||
ok(catcdf != NULL, "CryptCATCDFOpen failed\n");
|
||||
ok(GetLastError() == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", GetLastError());
|
||||
ok(GetLastError() == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %ld\n", GetLastError());
|
||||
}
|
||||
pCryptCATCDFClose(catcdf);
|
||||
DeleteFileA(cdffileA);
|
||||
@@ -988,7 +1131,7 @@ static void test_cdf_parsing(void)
|
||||
todo_wine
|
||||
{
|
||||
ok(catcdf != NULL, "CryptCATCDFOpen failed\n");
|
||||
ok(GetLastError() == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", GetLastError());
|
||||
ok(GetLastError() == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %ld\n", GetLastError());
|
||||
}
|
||||
/* Loop through the members */
|
||||
CLEAR_EXPECT;
|
||||
@@ -1015,7 +1158,7 @@ static void test_cdf_parsing(void)
|
||||
todo_wine
|
||||
{
|
||||
ok(catcdf != NULL, "CryptCATCDFOpen failed\n");
|
||||
ok(GetLastError() == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", GetLastError());
|
||||
ok(GetLastError() == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %ld\n", GetLastError());
|
||||
}
|
||||
/* Loop through the members */
|
||||
CLEAR_EXPECT;
|
||||
@@ -1023,9 +1166,9 @@ static void test_cdf_parsing(void)
|
||||
catmembertag = NULL;
|
||||
while ((catmembertag = pCryptCATCDFEnumMembersByCDFTagEx(catcdf, catmembertag, cdf_callback, &catmember, FALSE, NULL))) ;
|
||||
ok(error_area == 0xffffffff || broken(error_area == CRYPTCAT_E_AREA_MEMBER) /* < win81 */,
|
||||
"Expected area 0xffffffff, got %08x\n", error_area);
|
||||
"Expected area 0xffffffff, got %08lx\n", error_area);
|
||||
ok(local_error == 0xffffffff || broken(local_error == CRYPTCAT_E_CDF_MEMBER_FILE_PATH) /* < win81 */,
|
||||
"Expected error 0xffffffff, got %08x\n", local_error);
|
||||
"Expected error 0xffffffff, got %08lx\n", local_error);
|
||||
|
||||
pCryptCATCDFClose(catcdf);
|
||||
DeleteFileA(cdffileA);
|
||||
@@ -1046,7 +1189,7 @@ static void test_cdf_parsing(void)
|
||||
todo_wine
|
||||
{
|
||||
ok(catcdf != NULL, "CryptCATCDFOpen failed\n");
|
||||
ok(GetLastError() == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", GetLastError());
|
||||
ok(GetLastError() == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %ld\n", GetLastError());
|
||||
}
|
||||
/* Loop through the members */
|
||||
SET_UNEXPECTED;
|
||||
@@ -1071,7 +1214,7 @@ static void test_cdf_parsing(void)
|
||||
todo_wine
|
||||
{
|
||||
ok(catcdf != NULL, "CryptCATCDFOpen failed\n");
|
||||
ok(GetLastError() == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", GetLastError());
|
||||
ok(GetLastError() == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %ld\n", GetLastError());
|
||||
}
|
||||
/* Loop through the attributes */
|
||||
CLEAR_EXPECT;
|
||||
@@ -1099,7 +1242,7 @@ static void test_cdf_parsing(void)
|
||||
todo_wine
|
||||
{
|
||||
ok(catcdf != NULL, "CryptCATCDFOpen failed\n");
|
||||
ok(GetLastError() == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", GetLastError());
|
||||
ok(GetLastError() == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %ld\n", GetLastError());
|
||||
}
|
||||
/* Loop through the members */
|
||||
SET_UNEXPECTED;
|
||||
@@ -1131,7 +1274,7 @@ static void test_cdf_parsing(void)
|
||||
todo_wine
|
||||
{
|
||||
ok(catcdf != NULL, "CryptCATCDFOpen failed\n");
|
||||
ok(GetLastError() == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", GetLastError());
|
||||
ok(GetLastError() == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %ld\n", GetLastError());
|
||||
}
|
||||
/* Loop through the members */
|
||||
SET_UNEXPECTED;
|
||||
@@ -1235,26 +1378,26 @@ static void test_sip(void)
|
||||
info.cbSize = sizeof(SIP_SUBJECTINFO);
|
||||
info.pgSubjectType = &guid;
|
||||
ret = CryptSIPRetrieveSubjectGuid(NULL, file, info.pgSubjectType);
|
||||
ok(ret, "CryptSIPRetrieveSubjectGuid failed (%x)\n", GetLastError());
|
||||
ok(ret, "CryptSIPRetrieveSubjectGuid failed (%lx)\n", GetLastError());
|
||||
|
||||
ret = pPutSignedDataMsg(&info, X509_ASN_ENCODING, &index, 4, (BYTE*)"test");
|
||||
ok(!ret, "CryptSIPPutSignedDataMsg succeeded\n");
|
||||
index = GetLastError();
|
||||
ok(index == ERROR_PATH_NOT_FOUND, "GetLastError returned %x\n", index);
|
||||
ok(index == ERROR_PATH_NOT_FOUND, "GetLastError returned %lx\n", index);
|
||||
|
||||
info.hFile = file;
|
||||
info.pwsFileName = nameW;
|
||||
ret = pPutSignedDataMsg(&info, X509_ASN_ENCODING, &index, 4, (BYTE*)"test");
|
||||
ok(!ret, "CryptSIPPutSignedDataMsg succeeded\n");
|
||||
index = GetLastError();
|
||||
todo_wine ok(index == ERROR_INVALID_PARAMETER, "GetLastError returned %x\n", index);
|
||||
todo_wine ok(index == ERROR_INVALID_PARAMETER, "GetLastError returned %lx\n", index);
|
||||
|
||||
info.hFile = INVALID_HANDLE_VALUE;
|
||||
info.pwsFileName = nameW;
|
||||
ret = pPutSignedDataMsg(&info, X509_ASN_ENCODING, &index, 4, (BYTE*)"test");
|
||||
ok(!ret, "CryptSIPPutSignedDataMsg succeeded\n");
|
||||
index = GetLastError();
|
||||
ok(index == ERROR_SHARING_VIOLATION, "GetLastError returned %x\n", index);
|
||||
ok(index == ERROR_SHARING_VIOLATION, "GetLastError returned %lx\n", index);
|
||||
|
||||
CloseHandle(file);
|
||||
file= CreateFileW(nameW, GENERIC_READ|GENERIC_WRITE, FILE_SHARE_READ|FILE_SHARE_WRITE, NULL, OPEN_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL);
|
||||
@@ -1262,8 +1405,8 @@ static void test_sip(void)
|
||||
info.hFile = file;
|
||||
info.pwsFileName = (void*)0xdeadbeef;
|
||||
ret = pPutSignedDataMsg(&info, X509_ASN_ENCODING, &index, 4, (BYTE*)"test");
|
||||
ok(ret, "CryptSIPPutSignedDataMsg failed (%x)\n", GetLastError());
|
||||
ok(index == 0, "index = %x\n", index);
|
||||
ok(ret, "CryptSIPPutSignedDataMsg failed (%lx)\n", GetLastError());
|
||||
ok(index == 0, "index = %lx\n", index);
|
||||
|
||||
CloseHandle(file);
|
||||
file= CreateFileW(nameW, GENERIC_READ, FILE_SHARE_READ|FILE_SHARE_WRITE, NULL, OPEN_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL);
|
||||
@@ -1271,33 +1414,33 @@ static void test_sip(void)
|
||||
info.hFile = INVALID_HANDLE_VALUE;
|
||||
info.pwsFileName = nameW;
|
||||
ret = pPutSignedDataMsg(&info, X509_ASN_ENCODING, &index, 14, (BYTE*)"longer message");
|
||||
ok(ret, "CryptSIPPutSignedDataMsg failed (%x)\n", GetLastError());
|
||||
ok(index == 1, "index = %x\n", index);
|
||||
ok(ret, "CryptSIPPutSignedDataMsg failed (%lx)\n", GetLastError());
|
||||
ok(index == 1, "index = %lx\n", index);
|
||||
|
||||
size = 0;
|
||||
encoding = 0xdeadbeef;
|
||||
ret = pGetSignedDataMsg(&info, &encoding, 0, &size, NULL);
|
||||
ok(ret, "CryptSIPGetSignedDataMsg failed (%x)\n", GetLastError());
|
||||
ok(encoding == 0xdeadbeef, "encoding = %x\n", encoding);
|
||||
ok(size == 16, "size = %d\n", size);
|
||||
ok(ret, "CryptSIPGetSignedDataMsg failed (%lx)\n", GetLastError());
|
||||
ok(encoding == 0xdeadbeef, "encoding = %lx\n", encoding);
|
||||
ok(size == 16, "size = %ld\n", size);
|
||||
|
||||
ret = pGetSignedDataMsg(&info, &encoding, 0, &size, (BYTE*)buf);
|
||||
ok(ret, "CryptSIPGetSignedDataMsg failed (%x)\n", GetLastError());
|
||||
ok(encoding == (X509_ASN_ENCODING|PKCS_7_ASN_ENCODING), "encoding = %x\n", encoding);
|
||||
ok(size == 8, "size = %d\n", size);
|
||||
ok(ret, "CryptSIPGetSignedDataMsg failed (%lx)\n", GetLastError());
|
||||
ok(encoding == (X509_ASN_ENCODING|PKCS_7_ASN_ENCODING), "encoding = %lx\n", encoding);
|
||||
ok(size == 8, "size = %ld\n", size);
|
||||
ok(!memcmp(buf, "test\0\0\0\0", 8), "buf = %s\n", buf);
|
||||
|
||||
size = 0;
|
||||
encoding = 0xdeadbeef;
|
||||
ret = pGetSignedDataMsg(&info, &encoding, 1, &size, NULL);
|
||||
ok(ret, "CryptSIPGetSignedDataMsg failed (%x)\n", GetLastError());
|
||||
ok(encoding == 0xdeadbeef, "encoding = %x\n", encoding);
|
||||
ok(size == 24, "size = %d\n", size);
|
||||
ok(ret, "CryptSIPGetSignedDataMsg failed (%lx)\n", GetLastError());
|
||||
ok(encoding == 0xdeadbeef, "encoding = %lx\n", encoding);
|
||||
ok(size == 24, "size = %ld\n", size);
|
||||
|
||||
ret = pGetSignedDataMsg(&info, &encoding, 1, &size, (BYTE*)buf);
|
||||
ok(ret, "CryptSIPGetSignedDataMsg failed (%x)\n", GetLastError());
|
||||
ok(encoding == (X509_ASN_ENCODING|PKCS_7_ASN_ENCODING), "encoding = %x\n", encoding);
|
||||
ok(size == 16, "size = %d\n", size);
|
||||
ok(ret, "CryptSIPGetSignedDataMsg failed (%lx)\n", GetLastError());
|
||||
ok(encoding == (X509_ASN_ENCODING|PKCS_7_ASN_ENCODING), "encoding = %lx\n", encoding);
|
||||
ok(size == 16, "size = %ld\n", size);
|
||||
ok(!strcmp(buf, "longer message"), "buf = %s\n", buf);
|
||||
|
||||
CryptReleaseContext(info.hProv, 0);
|
||||
|
||||
@@ -76,7 +76,7 @@ static void test_AddRem_ActionID(void)
|
||||
ok (!ret, "Expected WintrustAddActionID to fail.\n");
|
||||
ok (GetLastError() == ERROR_INVALID_PARAMETER /* XP/W2K3 */ ||
|
||||
GetLastError() == 0xdeadbeef /* Win98/NT4/W2K */,
|
||||
"Expected ERROR_INVALID_PARAMETER(W2K3) or 0xdeadbeef(Win98/NT4/W2K), got %u.\n", GetLastError());
|
||||
"Expected ERROR_INVALID_PARAMETER(W2K3) or 0xdeadbeef(Win98/NT4/W2K), got %lu.\n", GetLastError());
|
||||
|
||||
/* NULL functions */
|
||||
SetLastError(0xdeadbeef);
|
||||
@@ -84,7 +84,7 @@ static void test_AddRem_ActionID(void)
|
||||
ok (!ret, "Expected WintrustAddActionID to fail.\n");
|
||||
ok (GetLastError() == ERROR_INVALID_PARAMETER /* XP/W2K3 */ ||
|
||||
GetLastError() == 0xdeadbeef /* Win98/NT4/W2K */,
|
||||
"Expected ERROR_INVALID_PARAMETER(W2K3) or 0xdeadbeef(Win98/NT4/W2K), got %u.\n", GetLastError());
|
||||
"Expected ERROR_INVALID_PARAMETER(W2K3) or 0xdeadbeef(Win98/NT4/W2K), got %lu.\n", GetLastError());
|
||||
|
||||
/* All OK (although no functions defined), except cbStruct is not set in ActionIDFunctions */
|
||||
SetLastError(0xdeadbeef);
|
||||
@@ -93,7 +93,7 @@ static void test_AddRem_ActionID(void)
|
||||
ok (!ret, "Expected WintrustAddActionID to fail.\n");
|
||||
ok (GetLastError() == ERROR_INVALID_PARAMETER /* XP/W2K3 */ ||
|
||||
GetLastError() == 0xdeadbeef /* Win98/NT4/W2K */,
|
||||
"Expected ERROR_INVALID_PARAMETER(W2K3) or 0xdeadbeef(Win98/NT4/W2K), got %u.\n", GetLastError());
|
||||
"Expected ERROR_INVALID_PARAMETER(W2K3) or 0xdeadbeef(Win98/NT4/W2K), got %lu.\n", GetLastError());
|
||||
|
||||
/* All OK (although no functions defined) and cbStruct is set now */
|
||||
SetLastError(0xdeadbeef);
|
||||
@@ -102,7 +102,7 @@ static void test_AddRem_ActionID(void)
|
||||
ret = pWintrustAddActionID(&ActionID, 0, &ActionIDFunctions);
|
||||
ok (ret, "Expected WintrustAddActionID to succeed.\n");
|
||||
ok (GetLastError() == ERROR_INVALID_PARAMETER,
|
||||
"Expected ERROR_INVALID_PARAMETER, got %u.\n", GetLastError());
|
||||
"Expected ERROR_INVALID_PARAMETER, got %lu.\n", GetLastError());
|
||||
|
||||
/* All OK and all (but 1) functions are correctly defined. The DLL and entrypoints
|
||||
* are not present.
|
||||
@@ -122,7 +122,7 @@ static void test_AddRem_ActionID(void)
|
||||
ok (ret, "Expected WintrustAddActionID to succeed.\n");
|
||||
ok (GetLastError() == ERROR_INVALID_PARAMETER ||
|
||||
GetLastError() == ERROR_ACCESS_DENIED,
|
||||
"Expected ERROR_INVALID_PARAMETER or ERROR_ACCESS_DENIED, got %u.\n",
|
||||
"Expected ERROR_INVALID_PARAMETER or ERROR_ACCESS_DENIED, got %lu.\n",
|
||||
GetLastError());
|
||||
|
||||
/* All OK and all functions are correctly defined. The DLL and entrypoints
|
||||
@@ -142,27 +142,27 @@ static void test_AddRem_ActionID(void)
|
||||
ret = pWintrustAddActionID(&ActionID, 0, &ActionIDFunctions);
|
||||
ok (ret, "Expected WintrustAddActionID to succeed.\n");
|
||||
ok (GetLastError() == 0xdeadbeef || GetLastError() == ERROR_ACCESS_DENIED,
|
||||
"Expected 0xdeadbeef or ERROR_ACCESS_DENIED, got %u.\n",
|
||||
"Expected 0xdeadbeef or ERROR_ACCESS_DENIED, got %lu.\n",
|
||||
GetLastError());
|
||||
|
||||
SetLastError(0xdeadbeef);
|
||||
ret = pWintrustRemoveActionID(&ActionID);
|
||||
ok ( ret, "WintrustRemoveActionID failed : %d\n", GetLastError());
|
||||
ok ( GetLastError() == 0xdeadbeef, "Last error should not have been changed: %u\n", GetLastError());
|
||||
ok ( ret, "WintrustRemoveActionID failed : %ld\n", GetLastError());
|
||||
ok ( GetLastError() == 0xdeadbeef, "Last error should not have been changed: %lu\n", GetLastError());
|
||||
|
||||
/* NULL input */
|
||||
SetLastError(0xdeadbeef);
|
||||
ret = pWintrustRemoveActionID(NULL);
|
||||
ok (ret, "Expected WintrustRemoveActionID to succeed.\n");
|
||||
ok (GetLastError() == ERROR_INVALID_PARAMETER,
|
||||
"Expected ERROR_INVALID_PARAMETER, got %u.\n", GetLastError());
|
||||
"Expected ERROR_INVALID_PARAMETER, got %lu.\n", GetLastError());
|
||||
|
||||
/* The passed GUID is removed by a previous call, so it's basically a test with a nonexistent Trust provider */
|
||||
SetLastError(0xdeadbeef);
|
||||
ret = pWintrustRemoveActionID(&ActionID);
|
||||
ok (ret, "Expected WintrustRemoveActionID to succeed.\n");
|
||||
ok (GetLastError() == 0xdeadbeef,
|
||||
"Expected 0xdeadbeef, got %u.\n", GetLastError());
|
||||
"Expected 0xdeadbeef, got %lu.\n", GetLastError());
|
||||
}
|
||||
|
||||
static void test_AddDefaultForUsage(void)
|
||||
@@ -185,14 +185,14 @@ static void test_AddDefaultForUsage(void)
|
||||
ret = pWintrustAddDefaultForUsage(NULL, NULL);
|
||||
ok (!ret, "Expected WintrustAddDefaultForUsage to fail.\n");
|
||||
ok (GetLastError() == ERROR_INVALID_PARAMETER,
|
||||
"Expected ERROR_INVALID_PARAMETER, got %u.\n", GetLastError());
|
||||
"Expected ERROR_INVALID_PARAMETER, got %lu.\n", GetLastError());
|
||||
|
||||
/* NULL defusage */
|
||||
SetLastError(0xdeadbeef);
|
||||
ret = pWintrustAddDefaultForUsage(oid, NULL);
|
||||
ok (!ret, "Expected WintrustAddDefaultForUsage to fail.\n");
|
||||
ok (GetLastError() == ERROR_INVALID_PARAMETER,
|
||||
"Expected ERROR_INVALID_PARAMETER, got %u.\n", GetLastError());
|
||||
"Expected ERROR_INVALID_PARAMETER, got %lu.\n", GetLastError());
|
||||
|
||||
/* NULL oid and proper defusage */
|
||||
memset(&DefUsage, 0 , sizeof(CRYPT_PROVIDER_REGDEFUSAGE));
|
||||
@@ -205,7 +205,7 @@ static void test_AddDefaultForUsage(void)
|
||||
ret = pWintrustAddDefaultForUsage(NULL, &DefUsage);
|
||||
ok (!ret, "Expected WintrustAddDefaultForUsage to fail.\n");
|
||||
ok (GetLastError() == ERROR_INVALID_PARAMETER,
|
||||
"Expected ERROR_INVALID_PARAMETER, got %u.\n", GetLastError());
|
||||
"Expected ERROR_INVALID_PARAMETER, got %lu.\n", GetLastError());
|
||||
|
||||
/* cbStruct set to 0 */
|
||||
memset(&DefUsage, 0 , sizeof(CRYPT_PROVIDER_REGDEFUSAGE));
|
||||
@@ -218,7 +218,7 @@ static void test_AddDefaultForUsage(void)
|
||||
ret = pWintrustAddDefaultForUsage(oid, &DefUsage);
|
||||
ok (!ret, "Expected WintrustAddDefaultForUsage to fail.\n");
|
||||
ok (GetLastError() == ERROR_INVALID_PARAMETER,
|
||||
"Expected ERROR_INVALID_PARAMETER, got %u.\n", GetLastError());
|
||||
"Expected ERROR_INVALID_PARAMETER, got %lu.\n", GetLastError());
|
||||
}
|
||||
|
||||
static void test_LoadFunctionPointers(void)
|
||||
@@ -244,7 +244,7 @@ static void test_LoadFunctionPointers(void)
|
||||
ok(!ret, "WintrustLoadFunctionPointers succeeded\n");
|
||||
ok(GetLastError() == ERROR_INVALID_PARAMETER ||
|
||||
GetLastError() == 0xdeadbeef /* W2K and XP-SP1 */,
|
||||
"Expected ERROR_INVALID_PARAMETER or 0xdeadbeef, got %d\n", GetLastError());
|
||||
"Expected ERROR_INVALID_PARAMETER or 0xdeadbeef, got %ld\n", GetLastError());
|
||||
|
||||
SetLastError(0xdeadbeef);
|
||||
funcs.cbStruct = 0;
|
||||
@@ -253,7 +253,7 @@ static void test_LoadFunctionPointers(void)
|
||||
SetLastError(0xdeadbeef);
|
||||
funcs.cbStruct = sizeof(funcs);
|
||||
ret = pWintrustLoadFunctionPointers(&action, &funcs);
|
||||
ok(ret, "WintrustLoadFunctionPointers failed: %d\n", GetLastError());
|
||||
ok(ret, "WintrustLoadFunctionPointers failed: %ld\n", GetLastError());
|
||||
ok(funcs.pfnAlloc != NULL, "Expected a pointer\n");
|
||||
ok(funcs.pfnFree != NULL, "Expected a pointer\n");
|
||||
}
|
||||
@@ -286,21 +286,21 @@ static void test_RegPolicyFlags(void)
|
||||
|
||||
r = RegOpenKeyExA(HKEY_CURRENT_USER, Software_Publishing, 0, KEY_ALL_ACCESS,
|
||||
&key);
|
||||
ok(!r, "RegOpenKeyEx failed: %d\n", r);
|
||||
ok(!r, "RegOpenKeyEx failed: %ld\n", r);
|
||||
|
||||
size = sizeof(flags1);
|
||||
r = RegQueryValueExA(key, State, NULL, NULL, (LPBYTE)&flags1, &size);
|
||||
ok(!r || r == ERROR_FILE_NOT_FOUND, "RegQueryValueEx failed: %d\n", r);
|
||||
ok(!r || r == ERROR_FILE_NOT_FOUND, "RegQueryValueEx failed: %ld\n", r);
|
||||
if (!r)
|
||||
ok(flags1 == flags2, "Got %08x flags instead of %08x\n", flags1, flags2);
|
||||
ok(flags1 == flags2, "Got %08lx flags instead of %08lx\n", flags1, flags2);
|
||||
|
||||
flags3 = flags2 | 1;
|
||||
ret = pWintrustSetRegPolicyFlags(flags3);
|
||||
ok(ret, "WintrustSetRegPolicyFlags failed: %d\n", GetLastError());
|
||||
ok(ret, "WintrustSetRegPolicyFlags failed: %ld\n", GetLastError());
|
||||
size = sizeof(flags1);
|
||||
r = RegQueryValueExA(key, State, NULL, NULL, (LPBYTE)&flags1, &size);
|
||||
ok(!r, "RegQueryValueEx failed: %d\n", r);
|
||||
ok(flags1 == flags3, "Got %08x flags instead of %08x\n", flags1, flags3);
|
||||
ok(!r, "RegQueryValueEx failed: %ld\n", r);
|
||||
ok(flags1 == flags3, "Got %08lx flags instead of %08lx\n", flags1, flags3);
|
||||
|
||||
pWintrustSetRegPolicyFlags(flags2);
|
||||
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -28,6 +28,15 @@ typedef HANDLE HCATINFO;
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#define CRYPTCAT_ATTR_NAMEASCII 0x00000001
|
||||
#define CRYPTCAT_ATTR_NAMEOBJID 0x00000002
|
||||
#define CRYPTCAT_ATTR_DATAASCII 0x00010000
|
||||
#define CRYPTCAT_ATTR_DATAOBJID 0x00020000
|
||||
#define CRYPTCAT_ATTR_DATAREPLACE 0x00040000
|
||||
#define CRYPTCAT_ATTR_NO_AUTO_COMPAT_ENTRY 0x01000000
|
||||
#define CRYPTCAT_ATTR_AUTHENTICATED 0x10000000
|
||||
#define CRYPTCAT_ATTR_UNAUTHENTICATED 0x20000000
|
||||
|
||||
#define CRYPTCAT_OPEN_CREATENEW 0x00000001
|
||||
#define CRYPTCAT_OPEN_ALWAYS 0x00000002
|
||||
#define CRYPTCAT_OPEN_EXISTING 0x00000004
|
||||
@@ -54,6 +63,9 @@ extern "C" {
|
||||
#define CRYPTCAT_E_CDF_ATTR_TOOFEWVALUES 0x00020002
|
||||
#define CRYPTCAT_E_CDF_ATTR_TYPECOMBO 0x00020004
|
||||
|
||||
#define CRYPTCAT_VERSION_1 0x100
|
||||
#define CRYPTCAT_VERSION_2 0x200
|
||||
|
||||
#include <pshpack8.h>
|
||||
|
||||
typedef struct CRYPTCATATTRIBUTE_
|
||||
@@ -103,8 +115,10 @@ typedef struct CRYPTCATCDF_
|
||||
typedef void (WINAPI *PFN_CDF_PARSE_ERROR_CALLBACK)(DWORD, DWORD, WCHAR *);
|
||||
|
||||
BOOL WINAPI CryptCATAdminAcquireContext(HCATADMIN*,const GUID*,DWORD);
|
||||
BOOL WINAPI CryptCATAdminAcquireContext2(HCATADMIN*,const GUID*,const WCHAR*,const CERT_STRONG_SIGN_PARA*,DWORD);
|
||||
HCATINFO WINAPI CryptCATAdminAddCatalog(HCATADMIN,PWSTR,PWSTR,DWORD);
|
||||
BOOL WINAPI CryptCATAdminCalcHashFromFileHandle(HANDLE,DWORD*,BYTE*,DWORD);
|
||||
BOOL WINAPI CryptCATAdminCalcHashFromFileHandle2(HCATADMIN,HANDLE,DWORD*,BYTE*,DWORD);
|
||||
HCATINFO WINAPI CryptCATAdminEnumCatalogFromHash(HCATADMIN,BYTE*,DWORD,DWORD,HCATINFO*);
|
||||
BOOL WINAPI CryptCATAdminReleaseCatalogContext(HCATADMIN,HCATINFO,DWORD);
|
||||
BOOL WINAPI CryptCATAdminReleaseContext(HCATADMIN,DWORD);
|
||||
@@ -126,6 +140,10 @@ CRYPTCATATTRIBUTE * WINAPI CryptCATGetAttrInfo(HANDLE, CRYPTCATMEMBER *, LPWSTR)
|
||||
CRYPTCATATTRIBUTE * WINAPI CryptCATGetCatAttrInfo(HANDLE, LPWSTR);
|
||||
CRYPTCATMEMBER * WINAPI CryptCATGetMemberInfo(HANDLE, LPWSTR);
|
||||
HANDLE WINAPI CryptCATOpen(LPWSTR,DWORD,HCRYPTPROV,DWORD,DWORD);
|
||||
BOOL WINAPI CryptCATPersistStore(HANDLE catalog);
|
||||
CRYPTCATATTRIBUTE * WINAPI CryptCATPutAttrInfo(HANDLE catalog, CRYPTCATMEMBER *member, WCHAR *name, DWORD flags, DWORD size, BYTE *data);
|
||||
CRYPTCATATTRIBUTE * WINAPI CryptCATPutCatAttrInfo(HANDLE catalog, WCHAR *name, DWORD flags, DWORD size, BYTE *data);
|
||||
CRYPTCATMEMBER * WINAPI CryptCATPutMemberInfo(HANDLE catalog, WCHAR *filename, WCHAR *member, GUID *subject, DWORD version, DWORD size, BYTE *data);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
|
||||
@@ -420,7 +420,7 @@ typedef BOOL (*PFN_PROVUI_CALL)(HWND hWndSecurityDialog,
|
||||
|
||||
typedef struct _CRYPT_PROVUI_FUNCS {
|
||||
DWORD cbStruct;
|
||||
CRYPT_PROVUI_DATA psUIData;
|
||||
CRYPT_PROVUI_DATA *psUIData;
|
||||
PFN_PROVUI_CALL pfnOnMoreInfoClick;
|
||||
PFN_PROVUI_CALL pfnOnMoreInfoClickDefault;
|
||||
PFN_PROVUI_CALL pfnOnAdvancedClick;
|
||||
@@ -429,7 +429,7 @@ typedef struct _CRYPT_PROVUI_FUNCS {
|
||||
|
||||
#include <poppack.h>
|
||||
|
||||
#define WVT_OFFSETOF(t,f) ((ULONG)((ULONG_PTR)(&((t*)0)->f)))
|
||||
#define WVT_OFFSETOF(t,f) ((ULONG)(offsetof(t, f)))
|
||||
#define WVT_ISINSTRUCT(t,s,f) (WVT_OFFSETOF(t,f) + sizeof(((t*)0)->f) <= (s))
|
||||
#define WVT_IS_CBSTRUCT_GT_MEMBEROFFSET(t,s,f) WVT_ISINSTRUCT(t,s,f)
|
||||
|
||||
@@ -451,10 +451,7 @@ typedef struct _CRYPT_PROVUI_FUNCS {
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#if defined(__GNUC__)
|
||||
#define WT_PROVIDER_CERTTRUST_FUNCTION (const WCHAR []) \
|
||||
{'W','i','n','t','r','u','s','t','C','e','r','t','i','f','i','c','a','t','e','T','r','u','s','t', 0}
|
||||
#elif defined(_MSC_VER)
|
||||
#if defined(_MSC_VER) || defined(__MINGW32__)
|
||||
#define WT_PROVIDER_CERTTRUST_FUNCTION L"WintrustCertificateTrust"
|
||||
#else
|
||||
static const WCHAR WT_PROVIDER_CERTTRUST_FUNCTION[] =
|
||||
@@ -478,6 +475,8 @@ CRYPT_PROVIDER_SGNR * WINAPI WTHelperGetProvSignerFromChain(
|
||||
CRYPT_PROVIDER_DATA * WINAPI WTHelperProvDataFromStateData(HANDLE hStateData);
|
||||
CRYPT_PROVIDER_PRIVDATA * WINAPI WTHelperGetProvPrivateDataFromChain(CRYPT_PROVIDER_DATA *,GUID *);
|
||||
|
||||
#define szOID_NESTED_SIGNATURE "1.3.6.1.4.1.311.2.4.1"
|
||||
|
||||
#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"
|
||||
#define SPC_STATEMENT_TYPE_OBJID "1.3.6.1.4.1.311.2.1.11"
|
||||
|
||||
8
sdk/tools/winesync/wintrust.cfg
Normal file
8
sdk/tools/winesync/wintrust.cfg
Normal file
@@ -0,0 +1,8 @@
|
||||
directories:
|
||||
dlls/wintrust: dll/win32/wintrust
|
||||
dlls/wintrust/tests: modules/rostests/winetests/wintrust
|
||||
files:
|
||||
include/mscat.h: sdk/include/psdk/mscat.h
|
||||
include/wintrust.h: sdk/include/psdk/wintrust.h
|
||||
tags:
|
||||
wine: wine-10.0
|
||||
Reference in New Issue
Block a user