diff --git a/dll/win32/wintrust/CMakeLists.txt b/dll/win32/wintrust/CMakeLists.txt index b5de35526d1..63c74eadab5 100644 --- a/dll/win32/wintrust/CMakeLists.txt +++ b/dll/win32/wintrust/CMakeLists.txt @@ -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) diff --git a/dll/win32/wintrust/asn.c b/dll/win32/wintrust/asn.c index 72536e8b5b0..f6c4086b508 100644 --- a/dll/win32/wintrust/asn.c +++ b/dll/win32/wintrust/asn.c @@ -21,7 +21,7 @@ #include #include #include -#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 diff --git a/dll/win32/wintrust/crypt.c b/dll/win32/wintrust/crypt.c index 404bebc428f..3666127ed5b 100644 --- a/dll/win32/wintrust/crypt.c +++ b/dll/win32/wintrust/crypt.c @@ -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; } diff --git a/dll/win32/wintrust/precomp.h b/dll/win32/wintrust/precomp.h index 7d0b2db93d5..c47d2c08572 100644 --- a/dll/win32/wintrust/precomp.h +++ b/dll/win32/wintrust/precomp.h @@ -7,8 +7,6 @@ #define _INC_WINDOWS #define COM_NO_WINDOWS_H -#define NONAMELESSUNION - #include #include #include diff --git a/dll/win32/wintrust/register.c b/dll/win32/wintrust/register.c index effe9d18f20..49b8ce06175 100644 --- a/dll/win32/wintrust/register.c +++ b/dll/win32/wintrust/register.c @@ -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) diff --git a/dll/win32/wintrust/softpub.c b/dll/win32/wintrust/softpub.c index 475f55a7507..609d240a738 100644 --- a/dll/win32/wintrust/softpub.c +++ b/dll/win32/wintrust/softpub.c @@ -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 -#define NONAMELESSUNION +#include #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; } diff --git a/dll/win32/wintrust/wintrust.spec b/dll/win32/wintrust/wintrust.spec index 4fb5ac94ffa..79e9bd32a75 100644 --- a/dll/win32/wintrust/wintrust.spec +++ b/dll/win32/wintrust/wintrust.spec @@ -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) diff --git a/dll/win32/wintrust/wintrust_main.c b/dll/win32/wintrust/wintrust_main.c index 34ce4fea555..29f2f9c7a4f 100644 --- a/dll/win32/wintrust/wintrust_main.c +++ b/dll/win32/wintrust/wintrust_main.c @@ -19,8 +19,6 @@ #include -#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; diff --git a/dll/win32/wintrust/wintrust_priv.h b/dll/win32/wintrust/wintrust_priv.h index 66c925ade5f..1e2e7a701f2 100644 --- a/dll/win32/wintrust/wintrust_priv.h +++ b/dll/win32/wintrust/wintrust_priv.h @@ -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__ */ diff --git a/media/doc/WINESYNC.txt b/media/doc/WINESYNC.txt index 26eae9e2d3a..f6a62f2f45e 100644 --- a/media/doc/WINESYNC.txt +++ b/media/doc/WINESYNC.txt @@ -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 diff --git a/modules/rostests/winetests/wintrust/asn.c b/modules/rostests/winetests/wintrust/asn.c index 82feac61bfe..5f75ec3298e 100644 --- a/modules/rostests/winetests/wintrust/asn.c +++ b/modules/rostests/winetests/wintrust/asn.c @@ -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(); diff --git a/modules/rostests/winetests/wintrust/crypt.c b/modules/rostests/winetests/wintrust/crypt.c index 5a4344bc931..84675dae8b7 100644 --- a/modules/rostests/winetests/wintrust/crypt.c +++ b/modules/rostests/winetests/wintrust/crypt.c @@ -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); diff --git a/modules/rostests/winetests/wintrust/register.c b/modules/rostests/winetests/wintrust/register.c index 32c87827491..bf4746d9284 100644 --- a/modules/rostests/winetests/wintrust/register.c +++ b/modules/rostests/winetests/wintrust/register.c @@ -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); diff --git a/modules/rostests/winetests/wintrust/softpub.c b/modules/rostests/winetests/wintrust/softpub.c index e19492347e5..9654c296a78 100644 --- a/modules/rostests/winetests/wintrust/softpub.c +++ b/modules/rostests/winetests/wintrust/softpub.c @@ -138,8 +138,8 @@ static void test_utils(SAFE_PROVIDER_FUNCTIONS *funcs) if (store) { ret = funcs->pfnAddStore2Chain(&data, store); - ok(ret, "pfnAddStore2Chain failed: %08x\n", GetLastError()); - ok(data.chStores == 1, "Expected 1 store, got %d\n", data.chStores); + ok(ret, "pfnAddStore2Chain failed: %08lx\n", GetLastError()); + ok(data.chStores == 1, "Expected 1 store, got %ld\n", data.chStores); ok(data.pahStores != NULL, "Expected pahStores to be allocated\n"); if (data.pahStores) { @@ -153,15 +153,15 @@ static void test_utils(SAFE_PROVIDER_FUNCTIONS *funcs) } } else - skip("CertOpenStore failed: %08x\n", GetLastError()); + skip("CertOpenStore failed: %08lx\n", GetLastError()); /* Crash ret = funcs->pfnAddSgnr2Chain(NULL, FALSE, 0, NULL); ret = funcs->pfnAddSgnr2Chain(&data, FALSE, 0, NULL); */ ret = funcs->pfnAddSgnr2Chain(&data, FALSE, 0, &sgnr); - ok(ret, "pfnAddSgnr2Chain failed: %08x\n", GetLastError()); - ok(data.csSigners == 1, "Expected 1 signer, got %d\n", data.csSigners); + ok(ret, "pfnAddSgnr2Chain failed: %08lx\n", GetLastError()); + ok(data.csSigners == 1, "Expected 1 signer, got %ld\n", data.csSigners); ok(data.pasSigners != NULL, "Expected pasSigners to be allocated\n"); if (data.pasSigners) { @@ -173,15 +173,15 @@ static void test_utils(SAFE_PROVIDER_FUNCTIONS *funcs) sgnr.cbStruct = sizeof(CRYPT_PROVIDER_SGNR); sgnr.sftVerifyAsOf.dwLowDateTime = 0xdeadbeef; ret = funcs->pfnAddSgnr2Chain(&data, FALSE, 1, &sgnr); - ok(ret, "pfnAddSgnr2Chain failed: %08x\n", GetLastError()); - ok(data.csSigners == 2, "Expected 2 signers, got %d\n", data.csSigners); + ok(ret, "pfnAddSgnr2Chain failed: %08lx\n", GetLastError()); + ok(data.csSigners == 2, "Expected 2 signers, got %ld\n", data.csSigners); ok(!memcmp(&data.pasSigners[1], &sgnr, sizeof(sgnr)), "Unexpected data in signer\n"); /* This also adds, but the index is ignored */ sgnr.cbStruct = sizeof(DWORD); ret = funcs->pfnAddSgnr2Chain(&data, FALSE, 0, &sgnr); - ok(ret, "pfnAddSgnr2Chain failed: %08x\n", GetLastError()); - ok(data.csSigners == 3, "Expected 3 signers, got %d\n", data.csSigners); + ok(ret, "pfnAddSgnr2Chain failed: %08lx\n", GetLastError()); + ok(data.csSigners == 3, "Expected 3 signers, got %ld\n", data.csSigners); sgnr.sftVerifyAsOf.dwLowDateTime = 0; todo_wine ok(!memcmp(&data.pasSigners[2], &sgnr, sizeof(sgnr)), @@ -191,7 +191,7 @@ static void test_utils(SAFE_PROVIDER_FUNCTIONS *funcs) SetLastError(0xdeadbeef); ret = funcs->pfnAddSgnr2Chain(&data, FALSE, 0, &sgnr); ok(!ret && GetLastError() == ERROR_INVALID_PARAMETER, - "Expected ERROR_INVALID_PARAMETER, got %d\n", GetLastError()); + "Expected ERROR_INVALID_PARAMETER, got %ld\n", GetLastError()); /* Crash ret = funcs->pfnAddCert2Chain(NULL, 0, FALSE, 0, NULL); @@ -206,8 +206,8 @@ static void test_utils(SAFE_PROVIDER_FUNCTIONS *funcs) * 2. An invalid signer index isn't checked. */ ret = funcs->pfnAddCert2Chain(&data, 0, FALSE, 0, cert); - ok(ret, "pfnAddCert2Chain failed: %08x\n", GetLastError()); - ok(data.pasSigners[0].csCertChain == 1, "Expected 1 cert, got %d\n", + ok(ret, "pfnAddCert2Chain failed: %08lx\n", GetLastError()); + ok(data.pasSigners[0].csCertChain == 1, "Expected 1 cert, got %ld\n", data.pasSigners[0].csCertChain); ok(data.pasSigners[0].pasCertChain != NULL, "Expected pasCertChain to be allocated\n"); @@ -221,7 +221,7 @@ static void test_utils(SAFE_PROVIDER_FUNCTIONS *funcs) CertFreeCertificateContext(cert); } else - skip("CertCreateCertificateContext failed: %08x\n", GetLastError()); + skip("CertCreateCertificateContext failed: %08lx\n", GetLastError()); funcs->pfnFree(data.pasSigners); } } @@ -243,7 +243,7 @@ static void testInitialize(SAFE_PROVIDER_FUNCTIONS *funcs, GUID *actionID) */ memset(&data, 0, sizeof(data)); ret = funcs->pfnInitialize(&data); - ok(ret == S_FALSE, "Expected S_FALSE, got %08x\n", ret); + ok(ret == S_FALSE, "Expected S_FALSE, got %08lx\n", ret); data.padwTrustStepErrors = funcs->pfnAlloc(TRUSTERROR_MAX_STEPS * sizeof(DWORD)); /* Without wintrust data set, crashes when padwTrustStepErrors is set */ @@ -254,17 +254,17 @@ static void testInitialize(SAFE_PROVIDER_FUNCTIONS *funcs, GUID *actionID) memset(data.padwTrustStepErrors, 0, TRUSTERROR_MAX_STEPS * sizeof(DWORD)); ret = funcs->pfnInitialize(&data); - ok(ret == S_OK, "Expected S_OK, got %08x\n", ret); + ok(ret == S_OK, "Expected S_OK, got %08lx\n", ret); data.cdwTrustStepErrors = 1; ret = funcs->pfnInitialize(&data); - ok(ret == S_OK, "Expected S_OK, got %08x\n", ret); + ok(ret == S_OK, "Expected S_OK, got %08lx\n", ret); memset(data.padwTrustStepErrors, 0xba, TRUSTERROR_MAX_STEPS * sizeof(DWORD)); ret = funcs->pfnInitialize(&data); - ok(ret == S_FALSE, "Expected S_FALSE, got %08x\n", ret); + ok(ret == S_FALSE, "Expected S_FALSE, got %08lx\n", ret); data.padwTrustStepErrors[TRUSTERROR_STEP_FINAL_WVTINIT] = 0; ret = funcs->pfnInitialize(&data); - ok(ret == S_OK, "Expected S_OK, got %08x\n", ret); + ok(ret == S_OK, "Expected S_OK, got %08lx\n", ret); funcs->pfnFree(data.padwTrustStepErrors); } } @@ -317,6 +317,8 @@ static void testObjTrust(SAFE_PROVIDER_FUNCTIONS *funcs, GUID *actionID) /* Crashes ret = funcs->pfnObjectTrust(NULL); */ + + data.cbStruct = sizeof(data); data.pSigState = &sig_state; data.pWintrustData = &wintrust_data; data.padwTrustStepErrors = @@ -331,52 +333,52 @@ static void testObjTrust(SAFE_PROVIDER_FUNCTIONS *funcs, GUID *actionID) 0x00,0x00,0x00,0x00,0x00 } }; ret = funcs->pfnObjectTrust(&data); - ok(ret == S_FALSE, "Expected S_FALSE, got %08x\n", ret); + ok(ret == S_FALSE, "Expected S_FALSE, got %08lx\n", ret); ok(data.padwTrustStepErrors[TRUSTERROR_STEP_FINAL_OBJPROV] == ERROR_INVALID_PARAMETER, - "Expected ERROR_INVALID_PARAMETER, got %08x\n", + "Expected ERROR_INVALID_PARAMETER, got %08lx\n", data.padwTrustStepErrors[TRUSTERROR_STEP_FINAL_OBJPROV]); - U(wintrust_data).pCert = &certInfo; + wintrust_data.pCert = &certInfo; wintrust_data.dwUnionChoice = WTD_CHOICE_CERT; ret = funcs->pfnObjectTrust(&data); - ok(ret == S_OK, "Expected S_OK, got %08x\n", ret); + ok(ret == S_OK, "Expected S_OK, got %08lx\n", ret); certInfo.psCertContext = (PCERT_CONTEXT)CertCreateCertificateContext( X509_ASN_ENCODING, v1CertWithPubKey, sizeof(v1CertWithPubKey)); ret = funcs->pfnObjectTrust(&data); - ok(ret == S_OK, "Expected S_OK, got %08x\n", ret); + ok(ret == S_OK, "Expected S_OK, got %08lx\n", ret); CertFreeCertificateContext(certInfo.psCertContext); certInfo.psCertContext = NULL; wintrust_data.dwUnionChoice = WTD_CHOICE_FILE; - U(wintrust_data).pFile = NULL; + wintrust_data.pFile = NULL; ret = funcs->pfnObjectTrust(&data); - ok(ret == S_FALSE, "Expected S_FALSE, got %08x\n", ret); + ok(ret == S_FALSE, "Expected S_FALSE, got %08lx\n", ret); ok(data.padwTrustStepErrors[TRUSTERROR_STEP_FINAL_OBJPROV] == ERROR_INVALID_PARAMETER, - "Expected ERROR_INVALID_PARAMETER, got %08x\n", + "Expected ERROR_INVALID_PARAMETER, got %08lx\n", data.padwTrustStepErrors[TRUSTERROR_STEP_FINAL_OBJPROV]); - U(wintrust_data).pFile = &fileInfo; + wintrust_data.pFile = &fileInfo; /* Crashes ret = funcs->pfnObjectTrust(&data); */ /* Create and test with an empty file */ fileInfo.hFile = create_temp_file(pathW); /* pfnObjectTrust now crashes unless both pPDSip and psPfns are set */ - U(data).pPDSip = &provDataSIP; + data.pPDSip = &provDataSIP; data.psPfns = (CRYPT_PROVIDER_FUNCTIONS *)funcs; ret = funcs->pfnObjectTrust(&data); - ok(ret == S_FALSE, "Expected S_FALSE, got %08x\n", ret); + ok(ret == S_FALSE, "Expected S_FALSE, got %08lx\n", ret); ok(data.padwTrustStepErrors[TRUSTERROR_STEP_FINAL_OBJPROV] == TRUST_E_SUBJECT_FORM_UNKNOWN, - "expected TRUST_E_SUBJECT_FORM_UNKNOWN, got %08x\n", + "expected TRUST_E_SUBJECT_FORM_UNKNOWN, got %08lx\n", data.padwTrustStepErrors[TRUSTERROR_STEP_FINAL_OBJPROV]); CloseHandle(fileInfo.hFile); fileInfo.hFile = NULL; fileInfo.pcwszFilePath = pathW; ret = funcs->pfnObjectTrust(&data); - ok(ret == S_FALSE, "Expected S_FALSE, got %08x\n", ret); + ok(ret == S_FALSE, "Expected S_FALSE, got %08lx\n", ret); ok(data.padwTrustStepErrors[TRUSTERROR_STEP_FINAL_OBJPROV] == TRUST_E_SUBJECT_FORM_UNKNOWN, - "expected TRUST_E_SUBJECT_FORM_UNKNOWN, got %08x\n", + "expected TRUST_E_SUBJECT_FORM_UNKNOWN, got %08lx\n", data.padwTrustStepErrors[TRUSTERROR_STEP_FINAL_OBJPROV]); DeleteFileW(pathW); /* Test again with a file we expect to exist, and to contain no @@ -384,12 +386,12 @@ static void testObjTrust(SAFE_PROVIDER_FUNCTIONS *funcs, GUID *actionID) */ getNotepadPath(pathW, MAX_PATH); ret = funcs->pfnObjectTrust(&data); - ok(ret == S_FALSE, "Expected S_FALSE, got %08x\n", ret); + ok(ret == S_FALSE, "Expected S_FALSE, got %08lx\n", ret); ok(data.padwTrustStepErrors[TRUSTERROR_STEP_FINAL_OBJPROV] == TRUST_E_NOSIGNATURE || data.padwTrustStepErrors[TRUSTERROR_STEP_FINAL_OBJPROV] == TRUST_E_SUBJECT_FORM_UNKNOWN, - "Expected TRUST_E_NOSIGNATURE or TRUST_E_SUBJECT_FORM_UNKNOWN, got %08x\n", + "Expected TRUST_E_NOSIGNATURE or TRUST_E_SUBJECT_FORM_UNKNOWN, got %08lx\n", data.padwTrustStepErrors[TRUSTERROR_STEP_FINAL_OBJPROV]); if (data.padwTrustStepErrors[TRUSTERROR_STEP_FINAL_OBJPROV] == TRUST_E_NOSIGNATURE) @@ -403,14 +405,14 @@ static void testObjTrust(SAFE_PROVIDER_FUNCTIONS *funcs, GUID *actionID) /* Specifying the GUID results in that GUID being the subject GUID */ fileInfo.pgKnownSubject = &bogusGuid; ret = funcs->pfnObjectTrust(&data); - ok(ret == S_FALSE, "Expected S_FALSE, got %08x\n", ret); + ok(ret == S_FALSE, "Expected S_FALSE, got %08lx\n", ret); ok(data.padwTrustStepErrors[TRUSTERROR_STEP_FINAL_OBJPROV] == TRUST_E_NOSIGNATURE || data.padwTrustStepErrors[TRUSTERROR_STEP_FINAL_OBJPROV] == TRUST_E_SUBJECT_FORM_UNKNOWN || data.padwTrustStepErrors[TRUSTERROR_STEP_FINAL_OBJPROV] == TRUST_E_PROVIDER_UNKNOWN, - "Expected TRUST_E_NOSIGNATURE or TRUST_E_SUBJECT_FORM_UNKNOWN or TRUST_E_PROVIDER_UNKNOWN, got %08x\n", + "Expected TRUST_E_NOSIGNATURE or TRUST_E_SUBJECT_FORM_UNKNOWN or TRUST_E_PROVIDER_UNKNOWN, got %08lx\n", data.padwTrustStepErrors[TRUSTERROR_STEP_FINAL_OBJPROV]); if (data.padwTrustStepErrors[TRUSTERROR_STEP_FINAL_OBJPROV] == TRUST_E_NOSIGNATURE) @@ -423,7 +425,7 @@ static void testObjTrust(SAFE_PROVIDER_FUNCTIONS *funcs, GUID *actionID) { fileInfo.pgKnownSubject = (GUID *)0xdeadbeef; ret = funcs->pfnObjectTrust(&data); - ok(ret == S_FALSE, "Expected S_FALSE, got %08x\n", ret); + ok(ret == S_FALSE, "Expected S_FALSE, got %08lx\n", ret); } funcs->pfnFree(data.padwTrustStepErrors); } @@ -566,9 +568,9 @@ static void testCertTrust(SAFE_PROVIDER_FUNCTIONS *funcs, GUID *actionID) return; } ret = funcs->pfnCertificateTrust(&data); - ok(ret == S_FALSE, "Expected S_FALSE, got %08x\n", ret); + ok(ret == S_FALSE, "Expected S_FALSE, got %08lx\n", ret); ok(data.padwTrustStepErrors[TRUSTERROR_STEP_FINAL_CERTPROV] == - TRUST_E_NOSIGNATURE, "Expected TRUST_E_NOSIGNATURE, got %08x\n", + TRUST_E_NOSIGNATURE, "Expected TRUST_E_NOSIGNATURE, got %08lx\n", data.padwTrustStepErrors[TRUSTERROR_STEP_FINAL_CERTPROV]); b = funcs->pfnAddSgnr2Chain(&data, FALSE, 0, &sgnr); if (b) @@ -577,7 +579,7 @@ static void testCertTrust(SAFE_PROVIDER_FUNCTIONS *funcs, GUID *actionID) /* An empty signer "succeeds," even though there's no cert */ ret = funcs->pfnCertificateTrust(&data); - ok(ret == S_OK, "Expected S_OK, got %08x\n", ret); + ok(ret == S_OK, "Expected S_OK, got %08lx\n", ret); cert = CertCreateCertificateContext(X509_ASN_ENCODING, selfSignedCert, sizeof(selfSignedCert)); if (cert) @@ -596,13 +598,13 @@ static void testCertTrust(SAFE_PROVIDER_FUNCTIONS *funcs, GUID *actionID) */ data.psPfns = (CRYPT_PROVIDER_FUNCTIONS *)funcs; ret = funcs->pfnCertificateTrust(&data); - ok(ret == S_OK, "Expected S_OK, got %08x\n", ret); - ok(data.csSigners == 1, "Unexpected number of signers %d\n", + ok(ret == S_OK, "Expected S_OK, got %08lx\n", ret); + ok(data.csSigners == 1, "Unexpected number of signers %ld\n", data.csSigners); ok(data.pasSigners[0].pChainContext != NULL, "Expected a certificate chain\n"); ok(data.pasSigners[0].csCertChain == 1, - "Unexpected number of chain elements %d\n", + "Unexpected number of chain elements %ld\n", data.pasSigners[0].csCertChain); /* pasSigners and pasSigners[0].pasCertChain are guaranteed to be * initialized, see tests for pfnAddSgnr2Chain and pfnAddCert2Chain @@ -613,7 +615,7 @@ static void testCertTrust(SAFE_PROVIDER_FUNCTIONS *funcs, GUID *actionID) "Expected cert to be self-signed\n"); ok(data.pasSigners[0].pasCertChain[0].dwConfidence == (CERT_CONFIDENCE_SIG | CERT_CONFIDENCE_TIMENEST), - "Expected CERT_CONFIDENCE_SIG | CERT_CONFIDENCE_TIMENEST, got %08x\n", + "Expected CERT_CONFIDENCE_SIG | CERT_CONFIDENCE_TIMENEST, got %08lx\n", data.pasSigners[0].pasCertChain[0].dwConfidence); CertFreeCertificateContext( data.pasSigners[0].pasCertChain[0].pCert); @@ -754,16 +756,16 @@ static void test_sip_create_indirect_data(void) SetLastError(0xdeadbeef); ret = CryptSIPCreateIndirectData_p(NULL, NULL, NULL); ok(!ret && GetLastError() == ERROR_INVALID_PARAMETER, - "expected ERROR_INVALID_PARAMETER, got %d\n", GetLastError()); + "expected ERROR_INVALID_PARAMETER, got %ld\n", GetLastError()); SetLastError(0xdeadbeef); ret = CryptSIPCreateIndirectData_p(&subjinfo, NULL, NULL); ok(!ret && GetLastError() == ERROR_INVALID_PARAMETER, - "expected ERROR_INVALID_PARAMETER, got %d\n", GetLastError()); + "expected ERROR_INVALID_PARAMETER, got %ld\n", GetLastError()); subjinfo.cbSize = sizeof(subjinfo); SetLastError(0xdeadbeef); ret = CryptSIPCreateIndirectData_p(&subjinfo, NULL, NULL); ok(!ret && GetLastError() == ERROR_INVALID_PARAMETER, - "expected ERROR_INVALID_PARAMETER, got %d\n", GetLastError()); + "expected ERROR_INVALID_PARAMETER, got %ld\n", GetLastError()); file = create_temp_file(temp_file); if (file == INVALID_HANDLE_VALUE) { @@ -777,17 +779,17 @@ static void test_sip_create_indirect_data(void) SetLastError(0xdeadbeef); ret = CryptSIPCreateIndirectData_p(&subjinfo, NULL, NULL); ok(!ret && GetLastError() == ERROR_INVALID_PARAMETER, - "expected ERROR_INVALID_PARAMETER, got %d\n", GetLastError()); + "expected ERROR_INVALID_PARAMETER, got %ld\n", GetLastError()); subjinfo.pgSubjectType = &unknown; SetLastError(0xdeadbeef); ret = CryptSIPCreateIndirectData_p(&subjinfo, NULL, NULL); ok(!ret && GetLastError() == ERROR_INVALID_PARAMETER, - "expected ERROR_INVALID_PARAMETER, got %d\n", GetLastError()); + "expected ERROR_INVALID_PARAMETER, got %ld\n", GetLastError()); subjinfo.DigestAlgorithm.pszObjId = oid_sha1; count = 0xdeadbeef; ret = CryptSIPCreateIndirectData_p(&subjinfo, &count, NULL); todo_wine - ok(ret, "CryptSIPCreateIndirectData failed: %d\n", GetLastError()); + ok(ret, "CryptSIPCreateIndirectData failed: %ld\n", GetLastError()); ok(count, "expected a positive count\n"); if (ret) { @@ -795,16 +797,16 @@ static void test_sip_create_indirect_data(void) count = 256; ret = CryptSIPCreateIndirectData_p(&subjinfo, &count, indirect); - ok(ret, "CryptSIPCreateIndirectData failed: %d\n", GetLastError()); + ok(ret, "CryptSIPCreateIndirectData failed: %ld\n", GetLastError()); /* If the count is larger than needed, it's unmodified */ - ok(count == 256, "unexpected count %d\n", count); + ok(count == 256, "unexpected count %ld\n", count); ok(!strcmp(indirect->Data.pszObjId, SPC_PE_IMAGE_DATA_OBJID), "unexpected data oid %s\n", indirect->Data.pszObjId); ok(!strcmp(indirect->DigestAlgorithm.pszObjId, oid_sha1), "unexpected digest algorithm oid %s\n", indirect->DigestAlgorithm.pszObjId); - ok(indirect->Digest.cbData == 20, "unexpected hash size %d\n", + ok(indirect->Digest.cbData == 20, "unexpected hash size %ld\n", indirect->Digest.cbData); if (indirect->Digest.cbData == 20) { @@ -836,34 +838,44 @@ static void test_wintrust(void) wtd.dwUIChoice = WTD_UI_NONE; wtd.fdwRevocationChecks = WTD_REVOKE_WHOLECHAIN; wtd.dwUnionChoice = WTD_CHOICE_FILE; - U(wtd).pFile = &file; + wtd.pFile = &file; wtd.dwStateAction = WTD_STATEACTION_VERIFY; memset(&file, 0, sizeof(file)); file.cbStruct = sizeof(file); file.pcwszFilePath = pathW; /* Test with an empty file */ file.hFile = create_temp_file(pathW); + SetLastError(0xdeadbeef); r = WinVerifyTrust(INVALID_HANDLE_VALUE, &generic_action_v2, &wtd); + ok(r == GetLastError(), "expected %08lx, got %08lx\n", GetLastError(), r); ok(r == TRUST_E_SUBJECT_FORM_UNKNOWN, - "expected TRUST_E_SUBJECT_FORM_UNKNOWN, got %08x\n", r); + "expected TRUST_E_SUBJECT_FORM_UNKNOWN, got %08lx\n", r); CloseHandle(file.hFile); DeleteFileW(pathW); file.hFile = NULL; /* Test with a known file path, which we expect not have a signature */ getNotepadPath(pathW, MAX_PATH); + SetLastError(0xdeadbeef); r = WinVerifyTrust(INVALID_HANDLE_VALUE, &generic_action_v2, &wtd); + ok(r == GetLastError(), "expected %08lx, got %08lx\n", GetLastError(), r); ok(r == TRUST_E_NOSIGNATURE || r == CRYPT_E_FILE_ERROR, - "expected TRUST_E_NOSIGNATURE or CRYPT_E_FILE_ERROR, got %08x\n", r); + "expected TRUST_E_NOSIGNATURE or CRYPT_E_FILE_ERROR, got %08lx\n", r); wtd.dwStateAction = WTD_STATEACTION_CLOSE; + SetLastError(0xdeadbeef); r = WinVerifyTrust(INVALID_HANDLE_VALUE, &generic_action_v2, &wtd); - ok(r == S_OK, "WinVerifyTrust failed: %08x\n", r); + ok(GetLastError() == 0xdeadbeef, "expected 0xdeadbeef, got %08lx\n", GetLastError()); + ok(r == S_OK, "WinVerifyTrust failed: %08lx\n", r); wtd.dwStateAction = WTD_STATEACTION_VERIFY; + SetLastError(0xdeadbeef); hr = WinVerifyTrustEx(INVALID_HANDLE_VALUE, &generic_action_v2, &wtd); + ok(hr == GetLastError(), "expected %08lx, got %08lx\n", GetLastError(), hr); ok(hr == TRUST_E_NOSIGNATURE || hr == CRYPT_E_FILE_ERROR, - "expected TRUST_E_NOSIGNATURE or CRYPT_E_FILE_ERROR, got %08x\n", hr); + "expected TRUST_E_NOSIGNATURE or CRYPT_E_FILE_ERROR, got %08lx\n", hr); wtd.dwStateAction = WTD_STATEACTION_CLOSE; + SetLastError(0xdeadbeef); r = WinVerifyTrust(INVALID_HANDLE_VALUE, &generic_action_v2, &wtd); - ok(r == S_OK, "WinVerifyTrust failed: %08x\n", r); + ok(GetLastError() == 0xdeadbeef, "expected 0xdeadbeef, got %08lx\n", GetLastError()); + ok(r == S_OK, "WinVerifyTrust failed: %08lx\n", r); } /* Self-signed .exe, built with tcc, signed with signtool @@ -1111,6 +1123,476 @@ static const BYTE SelfSignedFile64[] = 0x9C,0x68,0x1A,0x5D,0x92,0xCD,0xD0,0x5F,0x02,0xA1,0x2C,0xD9,0x56,0x20,0x00,0x00 }; +/* Self-signed 32 bit .exe, built with mingw-gcc, stripped, signed with signtool + * (certificates generated with a self-signed CA). + * + * small.c: + * int _start() + * { + * return 0; + * } + * + * i686-w64-mingw32-gcc -s -nodefaultlibs -fno-PIC ./small.c -o sign_3certs.exe + * strip -R .idata -R .rdata -R .edata -R .eh_fram ./sign_3certs.exe + * signtool.exe sign /v /f cert1.pfx /fd SHA256 /t http://timestamp.digicert.com sign_3certs.exe + * signtool.exe sign /v /f cert2.pfx /as /fd SHA256 sign_3certs.exe + * signtool.exe sign /v /f cert3.pfx /as /fd SHA256 sign_3certs.exe */ + +static const BYTE self_signed_3certs[] = +{ + 0x4d,0x5a,0x90,0x00,0x03,0x00,0x00,0x00,0x04,0x00,0x00,0x00,0xff,0xff,0x00,0x00,0xb8,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x40,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x80,0x00,0x00,0x00,0x0e,0x1f,0xba,0x0e,0x00,0xb4,0x09,0xcd, + 0x21,0xb8,0x01,0x4c,0xcd,0x21,0x54,0x68,0x69,0x73,0x20,0x70,0x72,0x6f,0x67,0x72,0x61,0x6d,0x20,0x63,0x61,0x6e,0x6e,0x6f, + 0x74,0x20,0x62,0x65,0x20,0x72,0x75,0x6e,0x20,0x69,0x6e,0x20,0x44,0x4f,0x53,0x20,0x6d,0x6f,0x64,0x65,0x2e,0x0d,0x0d,0x0a, + 0x24,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x50,0x45,0x00,0x00,0x4c,0x01,0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0xe0,0x00,0x0e,0x03,0x0b,0x01,0x02,0x25,0x00,0x02,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x10,0x00,0x00,0x00,0x10,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x40,0x00,0x00,0x10,0x00,0x00,0x00,0x02,0x00,0x00, + 0x04,0x00,0x00,0x00,0x01,0x00,0x00,0x00,0x04,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x20,0x00,0x00,0x00,0x02,0x00,0x00, + 0x76,0x3e,0x00,0x00,0x03,0x00,0x40,0x01,0x00,0x00,0x20,0x00,0x00,0x10,0x00,0x00,0x00,0x00,0x10,0x00,0x00,0x10,0x00,0x00, + 0x00,0x00,0x00,0x00,0x10,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x40,0x00,0x00,0x14,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x04,0x00,0x00,0x48,0x26,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x2e,0x74,0x65,0x78,0x74,0x00,0x00,0x00, + 0x1c,0x00,0x00,0x00,0x00,0x10,0x00,0x00,0x00,0x02,0x00,0x00,0x00,0x02,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x20,0x00,0x00,0x60,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x55,0x89,0xe5,0xb8,0x00,0x00,0x00,0x00,0x5d,0xc3,0x90,0x90,0xff,0xff,0xff,0xff, + 0x00,0x00,0x00,0x00,0xff,0xff,0xff,0xff,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x48,0x26,0x00,0x00,0x00,0x02,0x02,0x00, + 0x30,0x82,0x26,0x36,0x06,0x09,0x2a,0x86,0x48,0x86,0xf7,0x0d,0x01,0x07,0x02,0xa0,0x82,0x26,0x27,0x30,0x82,0x26,0x23,0x02, + 0x01,0x01,0x31,0x0f,0x30,0x0d,0x06,0x09,0x60,0x86,0x48,0x01,0x65,0x03,0x04,0x02,0x01,0x05,0x00,0x30,0x5c,0x06,0x0a,0x2b, + 0x06,0x01,0x04,0x01,0x82,0x37,0x02,0x01,0x04,0xa0,0x4e,0x30,0x4c,0x30,0x17,0x06,0x0a,0x2b,0x06,0x01,0x04,0x01,0x82,0x37, + 0x02,0x01,0x0f,0x30,0x09,0x03,0x01,0x00,0xa0,0x04,0xa2,0x02,0x80,0x00,0x30,0x31,0x30,0x0d,0x06,0x09,0x60,0x86,0x48,0x01, + 0x65,0x03,0x04,0x02,0x01,0x05,0x00,0x04,0x20,0xdd,0x8b,0xd7,0x29,0x3b,0xae,0x16,0xec,0xbb,0x81,0x80,0x55,0x15,0xd8,0x87, + 0xa5,0x3e,0xeb,0x0b,0x74,0x59,0xb6,0x56,0xf1,0x0b,0x2e,0xe1,0xb4,0x42,0x4d,0x8b,0x18,0xa0,0x82,0x16,0x0c,0x30,0x82,0x03, + 0x01,0x30,0x82,0x01,0xe9,0xa0,0x03,0x02,0x01,0x02,0x02,0x10,0xd1,0x73,0x97,0xaa,0xa7,0x3a,0x31,0xa2,0x44,0xc0,0x4b,0x40, + 0x69,0x40,0x4b,0xfa,0x30,0x0d,0x06,0x09,0x2a,0x86,0x48,0x86,0xf7,0x0d,0x01,0x01,0x0b,0x05,0x00,0x30,0x12,0x31,0x10,0x30, + 0x0e,0x06,0x03,0x55,0x04,0x03,0x13,0x07,0x54,0x65,0x73,0x74,0x20,0x43,0x41,0x30,0x1e,0x17,0x0d,0x32,0x32,0x30,0x39,0x33, + 0x30,0x31,0x37,0x31,0x39,0x33,0x32,0x5a,0x17,0x0d,0x33,0x39,0x31,0x32,0x33,0x31,0x32,0x33,0x35,0x39,0x35,0x39,0x5a,0x30, + 0x10,0x31,0x0e,0x30,0x0c,0x06,0x03,0x55,0x04,0x03,0x13,0x05,0x63,0x65,0x72,0x74,0x31,0x30,0x82,0x01,0x22,0x30,0x0d,0x06, + 0x09,0x2a,0x86,0x48,0x86,0xf7,0x0d,0x01,0x01,0x01,0x05,0x00,0x03,0x82,0x01,0x0f,0x00,0x30,0x82,0x01,0x0a,0x02,0x82,0x01, + 0x01,0x00,0xca,0x9c,0xd9,0xd4,0x25,0xb6,0x45,0x61,0x22,0x8d,0xdf,0xe9,0x11,0x0f,0xa1,0x7e,0x45,0xc5,0x0b,0xd0,0x42,0xfc, + 0x1f,0x3e,0xce,0x20,0xfc,0x1b,0x37,0xe4,0x0d,0x06,0x83,0x1c,0x3a,0x71,0x0f,0x75,0xf5,0xe5,0x06,0x33,0x01,0x77,0xda,0xc5, + 0xe9,0x2e,0xe3,0x37,0x1e,0x51,0x6e,0x08,0xe2,0x02,0xa1,0x8c,0x11,0xc6,0xfc,0x43,0xa2,0xf5,0x7d,0x74,0x5d,0x5a,0xcc,0x85, + 0x27,0x38,0xd4,0xfa,0xad,0xd7,0xf9,0x77,0xe4,0xef,0xdd,0xb0,0xb1,0x3e,0xdc,0xf5,0x5d,0x7e,0x62,0xdf,0x16,0x01,0x88,0xcd, + 0xb0,0xfa,0x06,0x24,0xd7,0xce,0xdc,0xe2,0x27,0xab,0xc3,0x0e,0x44,0x59,0x39,0x38,0xae,0x0a,0x5a,0xbd,0x5c,0xfd,0x11,0xed, + 0x5e,0xb8,0xd3,0x09,0x9c,0x84,0x80,0x6f,0x38,0xdf,0xd2,0xed,0x12,0x33,0xc9,0x66,0x3e,0x77,0x95,0x40,0xca,0xbb,0x63,0xd8, + 0x44,0x62,0x1d,0x60,0xc1,0x0d,0x92,0x18,0x68,0x4c,0xc7,0x26,0x83,0x5b,0x38,0x45,0xda,0x8d,0xe6,0x11,0xd0,0x08,0x79,0x0c, + 0x13,0xb8,0xe0,0xab,0xf5,0x78,0xe2,0x45,0xfd,0x42,0x7f,0x33,0xab,0x6d,0x53,0x10,0xa3,0x02,0x3c,0xd3,0x6f,0xaf,0x50,0x2f, + 0x20,0xfc,0x92,0xd1,0xab,0x68,0xe8,0x00,0xa0,0x1c,0x4b,0x6f,0x02,0x5a,0xf4,0x1a,0xf1,0x06,0x79,0xa1,0x34,0x8d,0x04,0x5c, + 0x0d,0xfe,0x2d,0x3c,0x53,0xb6,0xae,0x80,0x7d,0x98,0xb9,0x02,0x60,0x15,0x2c,0xb2,0xe5,0xc7,0x9b,0xcf,0x78,0x53,0x37,0xd9, + 0xbf,0x84,0x04,0xb0,0x61,0x1c,0xea,0x24,0x7b,0xf7,0xcd,0x71,0x45,0x1a,0x00,0x22,0x21,0xa9,0x02,0x03,0x01,0x00,0x01,0xa3, + 0x55,0x30,0x53,0x30,0x0c,0x06,0x03,0x55,0x1d,0x13,0x01,0x01,0xff,0x04,0x02,0x30,0x00,0x30,0x43,0x06,0x03,0x55,0x1d,0x01, + 0x04,0x3c,0x30,0x3a,0x80,0x10,0x88,0x17,0xf7,0x38,0x65,0x8b,0x78,0x78,0xf6,0x77,0xe3,0x25,0x47,0x54,0x33,0x4c,0xa1,0x14, + 0x30,0x12,0x31,0x10,0x30,0x0e,0x06,0x03,0x55,0x04,0x03,0x13,0x07,0x54,0x65,0x73,0x74,0x20,0x43,0x41,0x82,0x10,0x2b,0x59, + 0xb4,0xc7,0xe2,0xce,0x08,0x97,0x46,0x48,0x32,0x17,0x0f,0x97,0xc5,0x08,0x30,0x0d,0x06,0x09,0x2a,0x86,0x48,0x86,0xf7,0x0d, + 0x01,0x01,0x0b,0x05,0x00,0x03,0x82,0x01,0x01,0x00,0x9d,0x05,0x0e,0xc5,0xa0,0x5e,0x47,0x18,0x31,0x60,0xf2,0x1b,0x37,0xa4, + 0x89,0xf7,0x05,0x3e,0xea,0xc2,0x00,0x9f,0xcb,0xdd,0x28,0xba,0xc9,0x1f,0xfa,0x7a,0x9b,0x24,0x3d,0xb6,0x47,0x80,0xc1,0xa6, + 0x67,0x4d,0x48,0x3d,0xe0,0x0b,0x32,0x6a,0xa7,0x93,0xf3,0x40,0x20,0x8a,0xff,0x0f,0x9a,0xe2,0x00,0x95,0xa3,0xb3,0x57,0xc7, + 0x11,0xe1,0x28,0xc5,0x63,0x01,0xdf,0x4a,0xd2,0x37,0xb2,0x53,0x09,0x5c,0x4e,0x50,0x4e,0x14,0xb8,0x3e,0xb4,0x52,0xfe,0xa5, + 0x5d,0x14,0x3f,0x07,0x4f,0xda,0x9a,0xb9,0xbe,0x40,0xc5,0x3b,0x90,0x54,0x03,0x2e,0x79,0x0e,0x9b,0xf7,0xa9,0x74,0xeb,0x7c, + 0x6b,0x71,0x12,0xf2,0xce,0x9f,0xc0,0x3e,0x8a,0x09,0xa4,0x91,0x91,0x93,0x64,0x11,0xcc,0x96,0x7b,0xf9,0xac,0x65,0x6b,0xc3, + 0x02,0x1d,0xf8,0x0c,0x82,0x72,0x04,0x19,0x05,0x06,0x33,0x44,0x48,0x4f,0x34,0x13,0x04,0x1e,0x6c,0x11,0xc0,0x7b,0x63,0x32, + 0x1e,0xb3,0x4f,0x79,0xfe,0x9d,0xe6,0x3a,0xbe,0x8e,0xa7,0x5f,0x67,0x1d,0xae,0xad,0x58,0x0e,0x53,0xb8,0x15,0xe3,0x85,0x6e, + 0x91,0xfe,0x2d,0x81,0x84,0xb9,0xc3,0x23,0x13,0xa0,0x3f,0x72,0xb7,0xb3,0x26,0xda,0x08,0xcf,0x10,0x65,0x1e,0xd5,0x3b,0xf4, + 0x8f,0x18,0xe0,0xab,0xe7,0x5e,0xfc,0x62,0x9e,0x7e,0x54,0xf9,0x35,0x5a,0xf8,0xfa,0x1f,0x10,0x6f,0x63,0x3d,0xa2,0xe9,0x8a, + 0xd6,0x49,0xc0,0x40,0x0b,0xa1,0x5e,0x83,0xb0,0x01,0xb6,0x03,0x66,0xa5,0x8a,0xb4,0x29,0x06,0xea,0x27,0x0c,0x28,0x88,0xf3, + 0x38,0x5e,0x30,0x82,0x05,0x8d,0x30,0x82,0x04,0x75,0xa0,0x03,0x02,0x01,0x02,0x02,0x10,0x0e,0x9b,0x18,0x8e,0xf9,0xd0,0x2d, + 0xe7,0xef,0xdb,0x50,0xe2,0x08,0x40,0x18,0x5a,0x30,0x0d,0x06,0x09,0x2a,0x86,0x48,0x86,0xf7,0x0d,0x01,0x01,0x0c,0x05,0x00, + 0x30,0x65,0x31,0x0b,0x30,0x09,0x06,0x03,0x55,0x04,0x06,0x13,0x02,0x55,0x53,0x31,0x15,0x30,0x13,0x06,0x03,0x55,0x04,0x0a, + 0x13,0x0c,0x44,0x69,0x67,0x69,0x43,0x65,0x72,0x74,0x20,0x49,0x6e,0x63,0x31,0x19,0x30,0x17,0x06,0x03,0x55,0x04,0x0b,0x13, + 0x10,0x77,0x77,0x77,0x2e,0x64,0x69,0x67,0x69,0x63,0x65,0x72,0x74,0x2e,0x63,0x6f,0x6d,0x31,0x24,0x30,0x22,0x06,0x03,0x55, + 0x04,0x03,0x13,0x1b,0x44,0x69,0x67,0x69,0x43,0x65,0x72,0x74,0x20,0x41,0x73,0x73,0x75,0x72,0x65,0x64,0x20,0x49,0x44,0x20, + 0x52,0x6f,0x6f,0x74,0x20,0x43,0x41,0x30,0x1e,0x17,0x0d,0x32,0x32,0x30,0x38,0x30,0x31,0x30,0x30,0x30,0x30,0x30,0x30,0x5a, + 0x17,0x0d,0x33,0x31,0x31,0x31,0x30,0x39,0x32,0x33,0x35,0x39,0x35,0x39,0x5a,0x30,0x62,0x31,0x0b,0x30,0x09,0x06,0x03,0x55, + 0x04,0x06,0x13,0x02,0x55,0x53,0x31,0x15,0x30,0x13,0x06,0x03,0x55,0x04,0x0a,0x13,0x0c,0x44,0x69,0x67,0x69,0x43,0x65,0x72, + 0x74,0x20,0x49,0x6e,0x63,0x31,0x19,0x30,0x17,0x06,0x03,0x55,0x04,0x0b,0x13,0x10,0x77,0x77,0x77,0x2e,0x64,0x69,0x67,0x69, + 0x63,0x65,0x72,0x74,0x2e,0x63,0x6f,0x6d,0x31,0x21,0x30,0x1f,0x06,0x03,0x55,0x04,0x03,0x13,0x18,0x44,0x69,0x67,0x69,0x43, + 0x65,0x72,0x74,0x20,0x54,0x72,0x75,0x73,0x74,0x65,0x64,0x20,0x52,0x6f,0x6f,0x74,0x20,0x47,0x34,0x30,0x82,0x02,0x22,0x30, + 0x0d,0x06,0x09,0x2a,0x86,0x48,0x86,0xf7,0x0d,0x01,0x01,0x01,0x05,0x00,0x03,0x82,0x02,0x0f,0x00,0x30,0x82,0x02,0x0a,0x02, + 0x82,0x02,0x01,0x00,0xbf,0xe6,0x90,0x73,0x68,0xde,0xbb,0xe4,0x5d,0x4a,0x3c,0x30,0x22,0x30,0x69,0x33,0xec,0xc2,0xa7,0x25, + 0x2e,0xc9,0x21,0x3d,0xf2,0x8a,0xd8,0x59,0xc2,0xe1,0x29,0xa7,0x3d,0x58,0xab,0x76,0x9a,0xcd,0xae,0x7b,0x1b,0x84,0x0d,0xc4, + 0x30,0x1f,0xf3,0x1b,0xa4,0x38,0x16,0xeb,0x56,0xc6,0x97,0x6d,0x1d,0xab,0xb2,0x79,0xf2,0xca,0x11,0xd2,0xe4,0x5f,0xd6,0x05, + 0x3c,0x52,0x0f,0x52,0x1f,0xc6,0x9e,0x15,0xa5,0x7e,0xbe,0x9f,0xa9,0x57,0x16,0x59,0x55,0x72,0xaf,0x68,0x93,0x70,0xc2,0xb2, + 0xba,0x75,0x99,0x6a,0x73,0x32,0x94,0xd1,0x10,0x44,0x10,0x2e,0xdf,0x82,0xf3,0x07,0x84,0xe6,0x74,0x3b,0x6d,0x71,0xe2,0x2d, + 0x0c,0x1b,0xee,0x20,0xd5,0xc9,0x20,0x1d,0x63,0x29,0x2d,0xce,0xec,0x5e,0x4e,0xc8,0x93,0xf8,0x21,0x61,0x9b,0x34,0xeb,0x05, + 0xc6,0x5e,0xec,0x5b,0x1a,0xbc,0xeb,0xc9,0xcf,0xcd,0xac,0x34,0x40,0x5f,0xb1,0x7a,0x66,0xee,0x77,0xc8,0x48,0xa8,0x66,0x57, + 0x57,0x9f,0x54,0x58,0x8e,0x0c,0x2b,0xb7,0x4f,0xa7,0x30,0xd9,0x56,0xee,0xca,0x7b,0x5d,0xe3,0xad,0xc9,0x4f,0x5e,0xe5,0x35, + 0xe7,0x31,0xcb,0xda,0x93,0x5e,0xdc,0x8e,0x8f,0x80,0xda,0xb6,0x91,0x98,0x40,0x90,0x79,0xc3,0x78,0xc7,0xb6,0xb1,0xc4,0xb5, + 0x6a,0x18,0x38,0x03,0x10,0x8d,0xd8,0xd4,0x37,0xa4,0x2e,0x05,0x7d,0x88,0xf5,0x82,0x3e,0x10,0x91,0x70,0xab,0x55,0x82,0x41, + 0x32,0xd7,0xdb,0x04,0x73,0x2a,0x6e,0x91,0x01,0x7c,0x21,0x4c,0xd4,0xbc,0xae,0x1b,0x03,0x75,0x5d,0x78,0x66,0xd9,0x3a,0x31, + 0x44,0x9a,0x33,0x40,0xbf,0x08,0xd7,0x5a,0x49,0xa4,0xc2,0xe6,0xa9,0xa0,0x67,0xdd,0xa4,0x27,0xbc,0xa1,0x4f,0x39,0xb5,0x11, + 0x58,0x17,0xf7,0x24,0x5c,0x46,0x8f,0x64,0xf7,0xc1,0x69,0x88,0x76,0x98,0x76,0x3d,0x59,0x5d,0x42,0x76,0x87,0x89,0x97,0x69, + 0x7a,0x48,0xf0,0xe0,0xa2,0x12,0x1b,0x66,0x9a,0x74,0xca,0xde,0x4b,0x1e,0xe7,0x0e,0x63,0xae,0xe6,0xd4,0xef,0x92,0x92,0x3a, + 0x9e,0x3d,0xdc,0x00,0xe4,0x45,0x25,0x89,0xb6,0x9a,0x44,0x19,0x2b,0x7e,0xc0,0x94,0xb4,0xd2,0x61,0x6d,0xeb,0x33,0xd9,0xc5, + 0xdf,0x4b,0x04,0x00,0xcc,0x7d,0x1c,0x95,0xc3,0x8f,0xf7,0x21,0xb2,0xb2,0x11,0xb7,0xbb,0x7f,0xf2,0xd5,0x8c,0x70,0x2c,0x41, + 0x60,0xaa,0xb1,0x63,0x18,0x44,0x95,0x1a,0x76,0x62,0x7e,0xf6,0x80,0xb0,0xfb,0xe8,0x64,0xa6,0x33,0xd1,0x89,0x07,0xe1,0xbd, + 0xb7,0xe6,0x43,0xa4,0x18,0xb8,0xa6,0x77,0x01,0xe1,0x0f,0x94,0x0c,0x21,0x1d,0xb2,0x54,0x29,0x25,0x89,0x6c,0xe5,0x0e,0x52, + 0x51,0x47,0x74,0xbe,0x26,0xac,0xb6,0x41,0x75,0xde,0x7a,0xac,0x5f,0x8d,0x3f,0xc9,0xbc,0xd3,0x41,0x11,0x12,0x5b,0xe5,0x10, + 0x50,0xeb,0x31,0xc5,0xca,0x72,0x16,0x22,0x09,0xdf,0x7c,0x4c,0x75,0x3f,0x63,0xec,0x21,0x5f,0xc4,0x20,0x51,0x6b,0x6f,0xb1, + 0xab,0x86,0x8b,0x4f,0xc2,0xd6,0x45,0x5f,0x9d,0x20,0xfc,0xa1,0x1e,0xc5,0xc0,0x8f,0xa2,0xb1,0x7e,0x0a,0x26,0x99,0xf5,0xe4, + 0x69,0x2f,0x98,0x1d,0x2d,0xf5,0xd9,0xa9,0xb2,0x1d,0xe5,0x1b,0x02,0x03,0x01,0x00,0x01,0xa3,0x82,0x01,0x3a,0x30,0x82,0x01, + 0x36,0x30,0x0f,0x06,0x03,0x55,0x1d,0x13,0x01,0x01,0xff,0x04,0x05,0x30,0x03,0x01,0x01,0xff,0x30,0x1d,0x06,0x03,0x55,0x1d, + 0x0e,0x04,0x16,0x04,0x14,0xec,0xd7,0xe3,0x82,0xd2,0x71,0x5d,0x64,0x4c,0xdf,0x2e,0x67,0x3f,0xe7,0xba,0x98,0xae,0x1c,0x0f, + 0x4f,0x30,0x1f,0x06,0x03,0x55,0x1d,0x23,0x04,0x18,0x30,0x16,0x80,0x14,0x45,0xeb,0xa2,0xaf,0xf4,0x92,0xcb,0x82,0x31,0x2d, + 0x51,0x8b,0xa7,0xa7,0x21,0x9d,0xf3,0x6d,0xc8,0x0f,0x30,0x0e,0x06,0x03,0x55,0x1d,0x0f,0x01,0x01,0xff,0x04,0x04,0x03,0x02, + 0x01,0x86,0x30,0x79,0x06,0x08,0x2b,0x06,0x01,0x05,0x05,0x07,0x01,0x01,0x04,0x6d,0x30,0x6b,0x30,0x24,0x06,0x08,0x2b,0x06, + 0x01,0x05,0x05,0x07,0x30,0x01,0x86,0x18,0x68,0x74,0x74,0x70,0x3a,0x2f,0x2f,0x6f,0x63,0x73,0x70,0x2e,0x64,0x69,0x67,0x69, + 0x63,0x65,0x72,0x74,0x2e,0x63,0x6f,0x6d,0x30,0x43,0x06,0x08,0x2b,0x06,0x01,0x05,0x05,0x07,0x30,0x02,0x86,0x37,0x68,0x74, + 0x74,0x70,0x3a,0x2f,0x2f,0x63,0x61,0x63,0x65,0x72,0x74,0x73,0x2e,0x64,0x69,0x67,0x69,0x63,0x65,0x72,0x74,0x2e,0x63,0x6f, + 0x6d,0x2f,0x44,0x69,0x67,0x69,0x43,0x65,0x72,0x74,0x41,0x73,0x73,0x75,0x72,0x65,0x64,0x49,0x44,0x52,0x6f,0x6f,0x74,0x43, + 0x41,0x2e,0x63,0x72,0x74,0x30,0x45,0x06,0x03,0x55,0x1d,0x1f,0x04,0x3e,0x30,0x3c,0x30,0x3a,0xa0,0x38,0xa0,0x36,0x86,0x34, + 0x68,0x74,0x74,0x70,0x3a,0x2f,0x2f,0x63,0x72,0x6c,0x33,0x2e,0x64,0x69,0x67,0x69,0x63,0x65,0x72,0x74,0x2e,0x63,0x6f,0x6d, + 0x2f,0x44,0x69,0x67,0x69,0x43,0x65,0x72,0x74,0x41,0x73,0x73,0x75,0x72,0x65,0x64,0x49,0x44,0x52,0x6f,0x6f,0x74,0x43,0x41, + 0x2e,0x63,0x72,0x6c,0x30,0x11,0x06,0x03,0x55,0x1d,0x20,0x04,0x0a,0x30,0x08,0x30,0x06,0x06,0x04,0x55,0x1d,0x20,0x00,0x30, + 0x0d,0x06,0x09,0x2a,0x86,0x48,0x86,0xf7,0x0d,0x01,0x01,0x0c,0x05,0x00,0x03,0x82,0x01,0x01,0x00,0x70,0xa0,0xbf,0x43,0x5c, + 0x55,0xe7,0x38,0x5f,0xa0,0xa3,0x74,0x1b,0x3d,0xb6,0x16,0xd7,0xf7,0xbf,0x57,0x07,0xbd,0x9a,0xac,0xa1,0x87,0x2c,0xec,0x85, + 0x5e,0xa9,0x1a,0xbb,0x22,0xf8,0x87,0x1a,0x69,0x54,0x22,0xed,0xa4,0x88,0x77,0x6d,0xbd,0x1a,0x14,0xf4,0x13,0x4a,0x7a,0x2f, + 0x2d,0xb7,0x38,0xef,0xf4,0xff,0x80,0xb9,0xf8,0xa1,0xf7,0xf2,0x72,0xde,0x24,0xbc,0x52,0x03,0xc8,0x4e,0xd0,0x2a,0xde,0xfa, + 0x2d,0x56,0xcf,0xf9,0xf4,0xf7,0xac,0x30,0x7a,0x9a,0x8b,0xb2,0x5e,0xd4,0xcf,0xd1,0x43,0x44,0x9b,0x43,0x21,0xeb,0x96,0x72, + 0xa1,0x48,0xb4,0x99,0xcb,0x9d,0x4f,0xa7,0x06,0x03,0x13,0x77,0x27,0x44,0xd4,0xe7,0x7f,0xe8,0x59,0xa8,0xf0,0xbf,0x2f,0x0b, + 0xa6,0xe9,0xf2,0x34,0x3c,0xec,0xf7,0x03,0xc7,0x87,0xa8,0xd2,0x4c,0x40,0x19,0x35,0x46,0x6a,0x69,0x54,0xb0,0xb8,0xa1,0x56, + 0x8e,0xec,0xa4,0xd5,0x3d,0xe8,0xb1,0xdc,0xfd,0x1c,0xd8,0xf4,0x77,0x5a,0x5c,0x54,0x8c,0x6f,0xef,0xa1,0x50,0x3d,0xfc,0x76, + 0x09,0x68,0x84,0x9f,0x6f,0xca,0xdb,0x20,0x8d,0x35,0x60,0x1c,0x02,0x03,0xcb,0x20,0xb0,0xac,0x58,0xa0,0x0e,0x40,0x63,0xc5, + 0x98,0x22,0xc1,0xb2,0x59,0xf5,0x55,0x6b,0xcf,0x27,0xab,0x6c,0x76,0xce,0x6f,0x23,0x2d,0xf4,0x7e,0x71,0x6a,0x23,0x6b,0x22, + 0xff,0x12,0xb8,0x54,0x2d,0x27,0x7e,0xd8,0x3a,0xd9,0xf0,0xb6,0x87,0x96,0xfd,0x5b,0xd1,0x5c,0xac,0x18,0xc3,0x4d,0x9f,0x73, + 0xb7,0x01,0xa9,0x9f,0x57,0xaa,0x5e,0x28,0xe2,0xb9,0x94,0x30,0x82,0x06,0xae,0x30,0x82,0x04,0x96,0xa0,0x03,0x02,0x01,0x02, + 0x02,0x10,0x07,0x36,0x37,0xb7,0x24,0x54,0x7c,0xd8,0x47,0xac,0xfd,0x28,0x66,0x2a,0x5e,0x5b,0x30,0x0d,0x06,0x09,0x2a,0x86, + 0x48,0x86,0xf7,0x0d,0x01,0x01,0x0b,0x05,0x00,0x30,0x62,0x31,0x0b,0x30,0x09,0x06,0x03,0x55,0x04,0x06,0x13,0x02,0x55,0x53, + 0x31,0x15,0x30,0x13,0x06,0x03,0x55,0x04,0x0a,0x13,0x0c,0x44,0x69,0x67,0x69,0x43,0x65,0x72,0x74,0x20,0x49,0x6e,0x63,0x31, + 0x19,0x30,0x17,0x06,0x03,0x55,0x04,0x0b,0x13,0x10,0x77,0x77,0x77,0x2e,0x64,0x69,0x67,0x69,0x63,0x65,0x72,0x74,0x2e,0x63, + 0x6f,0x6d,0x31,0x21,0x30,0x1f,0x06,0x03,0x55,0x04,0x03,0x13,0x18,0x44,0x69,0x67,0x69,0x43,0x65,0x72,0x74,0x20,0x54,0x72, + 0x75,0x73,0x74,0x65,0x64,0x20,0x52,0x6f,0x6f,0x74,0x20,0x47,0x34,0x30,0x1e,0x17,0x0d,0x32,0x32,0x30,0x33,0x32,0x33,0x30, + 0x30,0x30,0x30,0x30,0x30,0x5a,0x17,0x0d,0x33,0x37,0x30,0x33,0x32,0x32,0x32,0x33,0x35,0x39,0x35,0x39,0x5a,0x30,0x63,0x31, + 0x0b,0x30,0x09,0x06,0x03,0x55,0x04,0x06,0x13,0x02,0x55,0x53,0x31,0x17,0x30,0x15,0x06,0x03,0x55,0x04,0x0a,0x13,0x0e,0x44, + 0x69,0x67,0x69,0x43,0x65,0x72,0x74,0x2c,0x20,0x49,0x6e,0x63,0x2e,0x31,0x3b,0x30,0x39,0x06,0x03,0x55,0x04,0x03,0x13,0x32, + 0x44,0x69,0x67,0x69,0x43,0x65,0x72,0x74,0x20,0x54,0x72,0x75,0x73,0x74,0x65,0x64,0x20,0x47,0x34,0x20,0x52,0x53,0x41,0x34, + 0x30,0x39,0x36,0x20,0x53,0x48,0x41,0x32,0x35,0x36,0x20,0x54,0x69,0x6d,0x65,0x53,0x74,0x61,0x6d,0x70,0x69,0x6e,0x67,0x20, + 0x43,0x41,0x30,0x82,0x02,0x22,0x30,0x0d,0x06,0x09,0x2a,0x86,0x48,0x86,0xf7,0x0d,0x01,0x01,0x01,0x05,0x00,0x03,0x82,0x02, + 0x0f,0x00,0x30,0x82,0x02,0x0a,0x02,0x82,0x02,0x01,0x00,0xc6,0x86,0x35,0x06,0x49,0xb3,0xc1,0x3d,0x72,0x49,0x51,0x55,0xc7, + 0x25,0x03,0xc4,0xf2,0x91,0x37,0xa9,0x97,0x51,0xa1,0xd6,0xd2,0x83,0xd1,0x9e,0x4c,0xa2,0x6d,0xa0,0xb0,0xcc,0x83,0xf9,0x5a, + 0xf6,0x11,0xa1,0x44,0x15,0x42,0x5f,0xa4,0x88,0xf3,0x68,0xfa,0x7d,0xf3,0x9c,0x89,0x0b,0x7f,0x9d,0x1f,0x9e,0x0f,0x33,0x1f, + 0x50,0x13,0x0b,0x26,0x73,0x96,0x6d,0xf8,0x57,0xa8,0x02,0x7d,0xfd,0x43,0xb4,0x84,0xda,0x11,0xf1,0x73,0xb1,0xb3,0xee,0x2b, + 0x80,0x84,0x8a,0x22,0x18,0xdf,0xeb,0xda,0x3d,0xc4,0x17,0x7f,0xab,0x19,0x2b,0x3e,0x42,0xdc,0x67,0x8e,0xea,0x51,0x3d,0xf0, + 0xd6,0x56,0xd4,0xe7,0x28,0x2d,0xeb,0xd3,0xb1,0xb5,0x75,0xe7,0x1f,0x06,0x65,0x8d,0x94,0x29,0xd3,0xd9,0xec,0x69,0xdf,0xd9, + 0x90,0x87,0x46,0x00,0x7b,0xdb,0x44,0x41,0x89,0xdc,0x7c,0x6a,0x57,0x7a,0xf0,0x37,0x79,0x9f,0x5d,0xac,0xcb,0xe8,0x84,0x64, + 0xb4,0x52,0xf2,0x76,0x47,0xf7,0x61,0x83,0x19,0xdd,0x5f,0xb4,0x54,0x0b,0x21,0x68,0x6e,0x37,0x21,0xbb,0x40,0xac,0x5f,0xb2, + 0xde,0x4a,0x7d,0xce,0xf5,0x39,0x12,0x67,0xef,0x0e,0xa5,0x63,0x6c,0xe4,0xa6,0xc5,0x1d,0xcd,0x36,0x0d,0x5c,0xd5,0xe6,0x1b, + 0xa8,0xc1,0x64,0x74,0x40,0xa7,0xc0,0x72,0xc5,0xba,0x4e,0x1f,0xb1,0xb5,0x58,0x4d,0x79,0xfe,0xd7,0x8f,0x73,0x93,0xac,0x2c, + 0x39,0xe2,0xa5,0x48,0xd6,0xf0,0xb0,0x31,0x13,0xa9,0x57,0x29,0x96,0x27,0x2e,0xf5,0x87,0xa6,0x8f,0x4e,0x76,0x15,0x55,0x26, + 0x70,0x98,0x26,0x7f,0xa0,0x1a,0x47,0x20,0x43,0xe3,0x43,0x63,0x80,0x7b,0x75,0x6e,0x27,0x25,0x90,0x98,0x3a,0x38,0x11,0xb3, + 0xf6,0xf6,0x9e,0xe6,0x3b,0x5b,0xec,0x81,0xde,0x22,0x14,0xd9,0x82,0x2a,0xc7,0x92,0xbf,0xa0,0xde,0xe3,0x3e,0xa2,0x73,0xfa, + 0xe7,0x1f,0x5a,0x6c,0x94,0xf2,0x52,0x95,0x11,0x2b,0x58,0x74,0x40,0x28,0xab,0x73,0x43,0xce,0xdf,0x4a,0xa1,0x1c,0x6b,0x38, + 0xc5,0x29,0xf3,0xca,0xaa,0x96,0x73,0x42,0x68,0x9f,0xb6,0x46,0xb3,0x9d,0x3a,0xa3,0xd5,0x03,0xe0,0xbf,0xf0,0xa2,0x3c,0xca, + 0x42,0xdc,0x18,0x48,0x7f,0x14,0x34,0xcf,0xd2,0x4c,0xab,0xef,0x9b,0x3d,0xfe,0x0e,0xb8,0x64,0x2a,0xfa,0x75,0x28,0x24,0x41, + 0xed,0x42,0xbf,0x05,0x9c,0x66,0x49,0x52,0x50,0xf4,0x51,0xf3,0x36,0x49,0x4d,0x8b,0x20,0xd2,0x2c,0x57,0x35,0x79,0x2b,0xa8, + 0xf3,0x45,0x60,0xbc,0x23,0x8d,0x58,0xf7,0xdc,0x61,0xde,0x93,0xfe,0x39,0xc0,0xf9,0xb2,0x30,0xa5,0x4c,0xd7,0xe9,0x98,0x4a, + 0x58,0x3e,0xd3,0x03,0x88,0xfe,0xb3,0x8f,0xd3,0x5e,0x4b,0x76,0x12,0x51,0x93,0xc9,0x8c,0x0c,0x3b,0x5b,0x8a,0x22,0xa8,0xc1, + 0x26,0x08,0xf9,0x14,0x10,0x12,0x03,0x7d,0x5f,0x23,0xbb,0x64,0xe3,0x63,0xe0,0xa6,0xe1,0x3e,0xf6,0xc2,0x74,0xb2,0x3f,0x1e, + 0x09,0x76,0xec,0xab,0x5d,0x46,0x75,0xe2,0x60,0xa3,0x58,0x09,0x01,0x28,0x00,0x0e,0x84,0x54,0xee,0xce,0xe9,0x5d,0xc8,0x5e, + 0x30,0x12,0xbd,0x46,0x9e,0xb5,0xd3,0x76,0xb9,0xd2,0x0e,0x6b,0x99,0x0c,0xd2,0x33,0xb4,0xcd,0xb1,0x02,0x03,0x01,0x00,0x01, + 0xa3,0x82,0x01,0x5d,0x30,0x82,0x01,0x59,0x30,0x12,0x06,0x03,0x55,0x1d,0x13,0x01,0x01,0xff,0x04,0x08,0x30,0x06,0x01,0x01, + 0xff,0x02,0x01,0x00,0x30,0x1d,0x06,0x03,0x55,0x1d,0x0e,0x04,0x16,0x04,0x14,0xba,0x16,0xd9,0x6d,0x4d,0x85,0x2f,0x73,0x29, + 0x76,0x9a,0x2f,0x75,0x8c,0x6a,0x20,0x8f,0x9e,0xc8,0x6f,0x30,0x1f,0x06,0x03,0x55,0x1d,0x23,0x04,0x18,0x30,0x16,0x80,0x14, + 0xec,0xd7,0xe3,0x82,0xd2,0x71,0x5d,0x64,0x4c,0xdf,0x2e,0x67,0x3f,0xe7,0xba,0x98,0xae,0x1c,0x0f,0x4f,0x30,0x0e,0x06,0x03, + 0x55,0x1d,0x0f,0x01,0x01,0xff,0x04,0x04,0x03,0x02,0x01,0x86,0x30,0x13,0x06,0x03,0x55,0x1d,0x25,0x04,0x0c,0x30,0x0a,0x06, + 0x08,0x2b,0x06,0x01,0x05,0x05,0x07,0x03,0x08,0x30,0x77,0x06,0x08,0x2b,0x06,0x01,0x05,0x05,0x07,0x01,0x01,0x04,0x6b,0x30, + 0x69,0x30,0x24,0x06,0x08,0x2b,0x06,0x01,0x05,0x05,0x07,0x30,0x01,0x86,0x18,0x68,0x74,0x74,0x70,0x3a,0x2f,0x2f,0x6f,0x63, + 0x73,0x70,0x2e,0x64,0x69,0x67,0x69,0x63,0x65,0x72,0x74,0x2e,0x63,0x6f,0x6d,0x30,0x41,0x06,0x08,0x2b,0x06,0x01,0x05,0x05, + 0x07,0x30,0x02,0x86,0x35,0x68,0x74,0x74,0x70,0x3a,0x2f,0x2f,0x63,0x61,0x63,0x65,0x72,0x74,0x73,0x2e,0x64,0x69,0x67,0x69, + 0x63,0x65,0x72,0x74,0x2e,0x63,0x6f,0x6d,0x2f,0x44,0x69,0x67,0x69,0x43,0x65,0x72,0x74,0x54,0x72,0x75,0x73,0x74,0x65,0x64, + 0x52,0x6f,0x6f,0x74,0x47,0x34,0x2e,0x63,0x72,0x74,0x30,0x43,0x06,0x03,0x55,0x1d,0x1f,0x04,0x3c,0x30,0x3a,0x30,0x38,0xa0, + 0x36,0xa0,0x34,0x86,0x32,0x68,0x74,0x74,0x70,0x3a,0x2f,0x2f,0x63,0x72,0x6c,0x33,0x2e,0x64,0x69,0x67,0x69,0x63,0x65,0x72, + 0x74,0x2e,0x63,0x6f,0x6d,0x2f,0x44,0x69,0x67,0x69,0x43,0x65,0x72,0x74,0x54,0x72,0x75,0x73,0x74,0x65,0x64,0x52,0x6f,0x6f, + 0x74,0x47,0x34,0x2e,0x63,0x72,0x6c,0x30,0x20,0x06,0x03,0x55,0x1d,0x20,0x04,0x19,0x30,0x17,0x30,0x08,0x06,0x06,0x67,0x81, + 0x0c,0x01,0x04,0x02,0x30,0x0b,0x06,0x09,0x60,0x86,0x48,0x01,0x86,0xfd,0x6c,0x07,0x01,0x30,0x0d,0x06,0x09,0x2a,0x86,0x48, + 0x86,0xf7,0x0d,0x01,0x01,0x0b,0x05,0x00,0x03,0x82,0x02,0x01,0x00,0x7d,0x59,0x8e,0xc0,0x93,0xb6,0x6f,0x98,0xa9,0x44,0x22, + 0x01,0x7e,0x66,0xd6,0xd8,0x21,0x42,0xe1,0xb0,0x18,0x2e,0x10,0x4d,0x13,0xcf,0x30,0x53,0xce,0xbf,0x18,0xfb,0xc7,0x50,0x5d, + 0xe2,0x4b,0x29,0xfb,0x70,0x8a,0x0d,0xaa,0x29,0x69,0xfc,0x69,0xc1,0xcf,0x1d,0x07,0xe9,0x3e,0x60,0xc8,0xd8,0x0b,0xe5,0x5c, + 0x5b,0xd7,0x6d,0x87,0xfa,0x84,0x20,0x25,0x34,0x31,0x67,0xcd,0xb6,0x12,0x96,0x6f,0xc4,0x50,0x4c,0x62,0x1d,0x0c,0x08,0x82, + 0xa8,0x16,0xbd,0xa9,0x56,0xcf,0x15,0x73,0x8d,0x01,0x22,0x25,0xce,0x95,0x69,0x3f,0x47,0x77,0xfb,0x72,0x74,0x14,0xd7,0xff, + 0xab,0x4f,0x8a,0x2c,0x7a,0xab,0x85,0xcd,0x43,0x5f,0xed,0x60,0xb6,0xaa,0x4f,0x91,0x66,0x9e,0x2c,0x9e,0xe0,0x8a,0xac,0xe5, + 0xfd,0x8c,0xbc,0x64,0x26,0x87,0x6c,0x92,0xbd,0x9d,0x7c,0xd0,0x70,0x0a,0x7c,0xef,0xa8,0xbc,0x75,0x4f,0xba,0x5a,0xf7,0xa9, + 0x10,0xb2,0x5d,0xe9,0xff,0x28,0x54,0x89,0xf0,0xd5,0x8a,0x71,0x76,0x65,0xda,0xcc,0xf0,0x72,0xa3,0x23,0xfa,0xc0,0x27,0x82, + 0x44,0xae,0x99,0x27,0x1b,0xab,0x24,0x1e,0x26,0xc1,0xb7,0xde,0x2a,0xeb,0xf6,0x9e,0xb1,0x79,0x99,0x81,0xa3,0x56,0x86,0xab, + 0x0a,0x45,0xc9,0xdf,0xc4,0x8d,0xa0,0xe7,0x98,0xfb,0xfb,0xa6,0x9d,0x72,0xaf,0xc4,0xc7,0xc1,0xc1,0x6a,0x71,0xd9,0xc6,0x13, + 0x80,0x09,0xc4,0xb6,0x9f,0xcd,0x87,0x87,0x24,0xbb,0x4f,0xa3,0x49,0xb9,0x77,0x66,0x91,0xf1,0x72,0x9c,0xe9,0x4b,0x02,0x52, + 0xa7,0x37,0x7e,0x93,0x53,0xac,0x3b,0x1d,0x08,0x49,0x0f,0x94,0xcd,0x39,0x7a,0xdd,0xff,0x25,0x63,0x99,0x27,0x2c,0x3d,0x3f, + 0x6b,0xa7,0xf1,0x66,0xc3,0x41,0xcd,0x4f,0xb6,0x40,0x9b,0x21,0x21,0x40,0xd0,0xb7,0x13,0x24,0xcd,0xdc,0x1d,0x78,0x3a,0xe4, + 0x9e,0xad,0xe5,0x34,0x71,0x92,0xd7,0x26,0x6b,0xe4,0x38,0x73,0xab,0xa6,0x01,0x4f,0xbd,0x3f,0x3b,0x78,0xad,0x4c,0xad,0xfb, + 0xc4,0x95,0x7b,0xed,0x0a,0x5f,0x33,0x39,0x87,0x41,0x78,0x7a,0x38,0xe9,0x9c,0xe1,0xdd,0x23,0xfd,0x1d,0x28,0xd3,0xc7,0xf9, + 0xe8,0xf1,0x98,0x5f,0xfb,0x2b,0xd8,0x7e,0xf2,0x46,0x9d,0x75,0x2c,0x1e,0x27,0x2c,0x26,0xdb,0x6f,0x15,0x7b,0x1e,0x19,0x8b, + 0x36,0xb8,0x93,0xd4,0xe6,0xf2,0x17,0x99,0x59,0xca,0x70,0xf0,0x37,0xbf,0x98,0x00,0xdf,0x20,0x16,0x4f,0x27,0xfb,0x60,0x67, + 0x16,0xa1,0x66,0xba,0xdd,0x55,0xc0,0x3a,0x29,0x86,0xb0,0x98,0xa0,0x2b,0xed,0x95,0x41,0xb7,0x3a,0xd5,0x15,0x98,0x31,0xb4, + 0x62,0x09,0x0f,0x0a,0xbd,0x81,0xd9,0x13,0xfe,0xbf,0xa4,0xd1,0xf3,0x57,0xd9,0xbc,0x04,0xfa,0x82,0xde,0x32,0xdf,0x04,0x89, + 0xf0,0x00,0xcd,0x5d,0xc2,0xf9,0xd0,0x23,0x7f,0x00,0x0b,0xe4,0x76,0x02,0x26,0xd9,0xf0,0x65,0x76,0x42,0xa6,0x29,0x87,0x09, + 0x47,0x2b,0xe6,0x7f,0x1a,0xa4,0x85,0x0f,0xfc,0x98,0x96,0xf6,0x55,0x54,0x2b,0x1f,0x80,0xfa,0xc0,0xf2,0x0e,0x2b,0xe5,0xd6, + 0xfb,0xa9,0x2f,0x44,0x15,0x4a,0xe7,0x13,0x0e,0x1d,0xdb,0x37,0x38,0x1a,0xa1,0x2b,0xf6,0xed,0xd6,0x7c,0xfc,0x30,0x82,0x06, + 0xc0,0x30,0x82,0x04,0xa8,0xa0,0x03,0x02,0x01,0x02,0x02,0x10,0x0c,0x4d,0x69,0x72,0x4b,0x94,0xfa,0x3c,0x2a,0x4a,0x3d,0x29, + 0x07,0x80,0x3d,0x5a,0x30,0x0d,0x06,0x09,0x2a,0x86,0x48,0x86,0xf7,0x0d,0x01,0x01,0x0b,0x05,0x00,0x30,0x63,0x31,0x0b,0x30, + 0x09,0x06,0x03,0x55,0x04,0x06,0x13,0x02,0x55,0x53,0x31,0x17,0x30,0x15,0x06,0x03,0x55,0x04,0x0a,0x13,0x0e,0x44,0x69,0x67, + 0x69,0x43,0x65,0x72,0x74,0x2c,0x20,0x49,0x6e,0x63,0x2e,0x31,0x3b,0x30,0x39,0x06,0x03,0x55,0x04,0x03,0x13,0x32,0x44,0x69, + 0x67,0x69,0x43,0x65,0x72,0x74,0x20,0x54,0x72,0x75,0x73,0x74,0x65,0x64,0x20,0x47,0x34,0x20,0x52,0x53,0x41,0x34,0x30,0x39, + 0x36,0x20,0x53,0x48,0x41,0x32,0x35,0x36,0x20,0x54,0x69,0x6d,0x65,0x53,0x74,0x61,0x6d,0x70,0x69,0x6e,0x67,0x20,0x43,0x41, + 0x30,0x1e,0x17,0x0d,0x32,0x32,0x30,0x39,0x32,0x31,0x30,0x30,0x30,0x30,0x30,0x30,0x5a,0x17,0x0d,0x33,0x33,0x31,0x31,0x32, + 0x31,0x32,0x33,0x35,0x39,0x35,0x39,0x5a,0x30,0x46,0x31,0x0b,0x30,0x09,0x06,0x03,0x55,0x04,0x06,0x13,0x02,0x55,0x53,0x31, + 0x11,0x30,0x0f,0x06,0x03,0x55,0x04,0x0a,0x13,0x08,0x44,0x69,0x67,0x69,0x43,0x65,0x72,0x74,0x31,0x24,0x30,0x22,0x06,0x03, + 0x55,0x04,0x03,0x13,0x1b,0x44,0x69,0x67,0x69,0x43,0x65,0x72,0x74,0x20,0x54,0x69,0x6d,0x65,0x73,0x74,0x61,0x6d,0x70,0x20, + 0x32,0x30,0x32,0x32,0x20,0x2d,0x20,0x32,0x30,0x82,0x02,0x22,0x30,0x0d,0x06,0x09,0x2a,0x86,0x48,0x86,0xf7,0x0d,0x01,0x01, + 0x01,0x05,0x00,0x03,0x82,0x02,0x0f,0x00,0x30,0x82,0x02,0x0a,0x02,0x82,0x02,0x01,0x00,0xcf,0xec,0xa5,0x26,0x3a,0xc6,0xa9, + 0xf2,0x6b,0xbb,0x8d,0xc1,0x0d,0x9a,0xdb,0xa1,0xe8,0x14,0x85,0x74,0x33,0x1a,0x26,0xac,0xd0,0x1c,0x55,0x1e,0x1e,0x36,0x6d, + 0xbc,0x92,0x55,0x0c,0x61,0xf4,0x9d,0x09,0x77,0x3d,0x15,0x96,0x08,0x2f,0x6b,0x64,0xa4,0xfd,0x06,0x83,0x16,0xd7,0x91,0x92, + 0x38,0x1c,0x31,0x02,0x96,0xfb,0x72,0xb1,0x97,0x3a,0x55,0xaf,0x33,0xec,0x61,0x8a,0xe9,0xa6,0x28,0xdb,0x90,0x63,0x5c,0xbd, + 0x89,0x53,0xe0,0x3a,0x2d,0x8c,0x87,0x42,0xae,0x26,0xa4,0xe4,0xbb,0x78,0x78,0xb9,0x7a,0x16,0xe1,0x56,0xc6,0xc0,0xba,0x64, + 0x53,0xbb,0x2a,0x16,0xe7,0x50,0x48,0xbb,0x88,0x69,0x0c,0x88,0xc6,0xf1,0xbe,0xe0,0x2f,0x7d,0x3b,0xb1,0xca,0x53,0x8d,0x40, + 0x83,0x1e,0xe7,0xcb,0x72,0x49,0x28,0x1e,0x4c,0x80,0x1e,0x85,0x56,0xe7,0x85,0xed,0xf2,0x61,0xbc,0xaa,0x3a,0x07,0x7d,0xf6, + 0xab,0x6e,0xe5,0x66,0xdd,0xe2,0x5c,0xf5,0x2f,0xed,0x8d,0xd4,0x4d,0x95,0x84,0x68,0xe3,0x80,0xcb,0x6a,0x79,0xd1,0xd2,0x10, + 0x91,0x46,0x29,0xeb,0x3e,0x26,0xf2,0xb4,0x8c,0xcd,0x4c,0xb9,0x66,0xc8,0xbb,0xaa,0x50,0x38,0x0d,0xe5,0x8c,0x94,0x5d,0x19, + 0x5a,0xbf,0xf5,0x7b,0x40,0x6e,0x6f,0x16,0xa8,0x9a,0x9c,0x95,0x47,0x86,0x85,0x79,0x3e,0x0c,0x5e,0x66,0x8c,0x1a,0x0a,0x24, + 0xbe,0x9c,0xaa,0xd2,0x9c,0xb6,0xf7,0x4f,0x6e,0x78,0xc4,0x28,0x3f,0xa3,0x1c,0x0f,0x50,0x06,0x37,0xba,0x08,0xd9,0x35,0xa6, + 0xb5,0x1e,0xda,0x78,0x58,0x1d,0x39,0xe8,0xf8,0x4c,0x91,0x10,0x96,0x7e,0x4d,0xe1,0xdd,0xc2,0xad,0xa5,0x7e,0xf8,0x2d,0x1b, + 0x1f,0xec,0x2b,0x46,0x18,0xa3,0x19,0xf6,0x39,0xf7,0xf5,0xc1,0x4f,0x71,0x2e,0x89,0x03,0x11,0xa2,0x4b,0xbb,0x98,0xbf,0xfa, + 0x4f,0xe4,0x7b,0x36,0xef,0x06,0x44,0xe4,0x55,0xff,0x36,0xea,0xe5,0x7c,0x31,0xe7,0xf3,0xc2,0x52,0xc4,0xe6,0x16,0x7b,0x5a, + 0x7e,0xa5,0x25,0x73,0xdb,0xc0,0x6a,0x99,0x21,0x2d,0x63,0xe5,0x59,0xf5,0x4d,0x2f,0x90,0x1f,0x27,0xb7,0xd2,0xab,0x14,0xe5, + 0x38,0x66,0x87,0x51,0x08,0x6b,0xfb,0x53,0x43,0x39,0xd0,0x64,0xfa,0x56,0xcf,0xe0,0xf4,0x0a,0xe6,0x14,0x6d,0x64,0x78,0xbb, + 0x98,0xfd,0x94,0xc3,0x73,0x21,0xf3,0x2f,0xc2,0x2e,0x20,0xd7,0x81,0xac,0xd3,0xf1,0x07,0xd4,0xe1,0xbd,0xd9,0x5d,0x4b,0x6e, + 0x31,0x94,0x29,0x8b,0xe6,0x41,0xa4,0x65,0x94,0xc0,0x58,0xe5,0xe5,0x2e,0x29,0x90,0xa6,0xb7,0x61,0x64,0xfa,0xd9,0x20,0x6c, + 0x18,0x51,0x60,0xba,0xa6,0x81,0x0f,0x09,0x25,0x53,0xf1,0xbf,0x3b,0xe9,0xab,0x07,0x0e,0x6a,0x07,0x39,0x62,0x19,0xc9,0xd6, + 0x85,0x7f,0x13,0xd9,0x8d,0x79,0xcf,0x62,0xc5,0xec,0xe1,0x7b,0xb9,0xcc,0x67,0x13,0x07,0x9a,0xc1,0x78,0xed,0xc6,0x88,0xc8, + 0xb0,0x6e,0x32,0x79,0xc7,0x0b,0x59,0x83,0x8d,0xc6,0xee,0xf5,0x2c,0x7c,0x7b,0x8e,0xcb,0x64,0x89,0xf1,0xb1,0xc4,0xb8,0xe7, + 0x53,0x5e,0x5f,0x55,0xd2,0x7d,0x19,0x29,0x59,0x03,0x4e,0xfa,0x5d,0xea,0x45,0x73,0x1c,0x84,0x7e,0xd7,0xce,0xe2,0xd4,0x3a, + 0x77,0x02,0x03,0x01,0x00,0x01,0xa3,0x82,0x01,0x8b,0x30,0x82,0x01,0x87,0x30,0x0e,0x06,0x03,0x55,0x1d,0x0f,0x01,0x01,0xff, + 0x04,0x04,0x03,0x02,0x07,0x80,0x30,0x0c,0x06,0x03,0x55,0x1d,0x13,0x01,0x01,0xff,0x04,0x02,0x30,0x00,0x30,0x16,0x06,0x03, + 0x55,0x1d,0x25,0x01,0x01,0xff,0x04,0x0c,0x30,0x0a,0x06,0x08,0x2b,0x06,0x01,0x05,0x05,0x07,0x03,0x08,0x30,0x20,0x06,0x03, + 0x55,0x1d,0x20,0x04,0x19,0x30,0x17,0x30,0x08,0x06,0x06,0x67,0x81,0x0c,0x01,0x04,0x02,0x30,0x0b,0x06,0x09,0x60,0x86,0x48, + 0x01,0x86,0xfd,0x6c,0x07,0x01,0x30,0x1f,0x06,0x03,0x55,0x1d,0x23,0x04,0x18,0x30,0x16,0x80,0x14,0xba,0x16,0xd9,0x6d,0x4d, + 0x85,0x2f,0x73,0x29,0x76,0x9a,0x2f,0x75,0x8c,0x6a,0x20,0x8f,0x9e,0xc8,0x6f,0x30,0x1d,0x06,0x03,0x55,0x1d,0x0e,0x04,0x16, + 0x04,0x14,0x62,0x8a,0xde,0xd0,0x61,0xfc,0x8f,0x31,0x14,0xed,0x97,0x0b,0xcd,0x3d,0x2a,0x94,0x14,0xdf,0x52,0x9c,0x30,0x5a, + 0x06,0x03,0x55,0x1d,0x1f,0x04,0x53,0x30,0x51,0x30,0x4f,0xa0,0x4d,0xa0,0x4b,0x86,0x49,0x68,0x74,0x74,0x70,0x3a,0x2f,0x2f, + 0x63,0x72,0x6c,0x33,0x2e,0x64,0x69,0x67,0x69,0x63,0x65,0x72,0x74,0x2e,0x63,0x6f,0x6d,0x2f,0x44,0x69,0x67,0x69,0x43,0x65, + 0x72,0x74,0x54,0x72,0x75,0x73,0x74,0x65,0x64,0x47,0x34,0x52,0x53,0x41,0x34,0x30,0x39,0x36,0x53,0x48,0x41,0x32,0x35,0x36, + 0x54,0x69,0x6d,0x65,0x53,0x74,0x61,0x6d,0x70,0x69,0x6e,0x67,0x43,0x41,0x2e,0x63,0x72,0x6c,0x30,0x81,0x90,0x06,0x08,0x2b, + 0x06,0x01,0x05,0x05,0x07,0x01,0x01,0x04,0x81,0x83,0x30,0x81,0x80,0x30,0x24,0x06,0x08,0x2b,0x06,0x01,0x05,0x05,0x07,0x30, + 0x01,0x86,0x18,0x68,0x74,0x74,0x70,0x3a,0x2f,0x2f,0x6f,0x63,0x73,0x70,0x2e,0x64,0x69,0x67,0x69,0x63,0x65,0x72,0x74,0x2e, + 0x63,0x6f,0x6d,0x30,0x58,0x06,0x08,0x2b,0x06,0x01,0x05,0x05,0x07,0x30,0x02,0x86,0x4c,0x68,0x74,0x74,0x70,0x3a,0x2f,0x2f, + 0x63,0x61,0x63,0x65,0x72,0x74,0x73,0x2e,0x64,0x69,0x67,0x69,0x63,0x65,0x72,0x74,0x2e,0x63,0x6f,0x6d,0x2f,0x44,0x69,0x67, + 0x69,0x43,0x65,0x72,0x74,0x54,0x72,0x75,0x73,0x74,0x65,0x64,0x47,0x34,0x52,0x53,0x41,0x34,0x30,0x39,0x36,0x53,0x48,0x41, + 0x32,0x35,0x36,0x54,0x69,0x6d,0x65,0x53,0x74,0x61,0x6d,0x70,0x69,0x6e,0x67,0x43,0x41,0x2e,0x63,0x72,0x74,0x30,0x0d,0x06, + 0x09,0x2a,0x86,0x48,0x86,0xf7,0x0d,0x01,0x01,0x0b,0x05,0x00,0x03,0x82,0x02,0x01,0x00,0x55,0xaa,0x2a,0x1a,0xf3,0x46,0xf3, + 0x78,0x57,0x37,0x30,0xfc,0x75,0xe3,0x4f,0xd6,0x85,0x23,0xf1,0xfc,0xf9,0x95,0x39,0x9b,0x25,0xe6,0xf7,0x72,0x8a,0x98,0xc3, + 0x77,0xd4,0x64,0xfc,0x15,0xfb,0x36,0xc2,0x49,0x51,0x2c,0x78,0x88,0x63,0x55,0x09,0x46,0x39,0x00,0xfc,0x69,0xd4,0xca,0x9b, + 0x29,0xfb,0xa3,0x3f,0xc0,0xc9,0x00,0x9b,0x13,0x1d,0xb0,0x98,0x89,0xdc,0x78,0xf2,0xcd,0x7c,0x85,0xcd,0x53,0x9d,0xaf,0x62, + 0xe2,0x61,0x66,0xa3,0x14,0x2a,0x45,0x87,0x4a,0x98,0x42,0x2b,0x50,0xfc,0x1b,0xb5,0x9e,0x08,0x30,0x09,0xfa,0xe4,0x2d,0xd7, + 0x09,0x89,0x79,0xf9,0x09,0xe6,0x88,0xce,0x7d,0x1b,0xb8,0x6a,0xa2,0x9b,0xc1,0x53,0x60,0x09,0xe8,0xa3,0xb8,0x9d,0xd7,0xad, + 0x1f,0x1c,0xb8,0xec,0x98,0x41,0xf0,0xf6,0x0e,0x80,0xfb,0xe4,0xff,0xdf,0x9d,0x10,0xa7,0xeb,0x00,0xba,0x5f,0x4a,0x8f,0x1a, + 0x3a,0x52,0xb4,0xea,0xbf,0x09,0x49,0x15,0x35,0x36,0x59,0x9a,0x0f,0x54,0xd2,0xb2,0x1b,0x7f,0x7e,0x5e,0x09,0xad,0x76,0x54, + 0x8a,0x74,0x6d,0xca,0xd2,0x05,0x67,0x2b,0x76,0xeb,0xff,0x98,0xb2,0x26,0x95,0x38,0x19,0x88,0x44,0x14,0xe5,0x0a,0x59,0xa2, + 0x6b,0xe7,0x22,0x3e,0x44,0x21,0xd2,0x3f,0x1c,0xc0,0x9b,0xed,0x7c,0x48,0xb2,0xd8,0x92,0x0c,0x91,0x4f,0x3c,0x66,0x94,0xaf, + 0x5d,0x02,0x53,0xeb,0x9e,0xe2,0x9e,0xe4,0xd3,0x1f,0x86,0x01,0x64,0x9c,0x00,0xc2,0xe9,0x5a,0x74,0x75,0x0d,0x3d,0xe1,0x79, + 0x88,0xbf,0x1c,0x01,0x97,0xc9,0x19,0x23,0x80,0xd7,0x36,0x5a,0x5f,0x96,0x16,0xb1,0x63,0x0c,0xc6,0x46,0x40,0x3b,0xce,0x5d, + 0x35,0xd4,0x59,0x3e,0x43,0x9a,0x18,0xae,0xc3,0xc9,0xcb,0xc3,0xfb,0x9b,0x13,0x5f,0x6a,0xb5,0xc7,0xe0,0xf3,0x05,0xc3,0x59, + 0xdf,0x27,0x62,0x2b,0xde,0x41,0xc9,0x53,0xb9,0xff,0x34,0x10,0x67,0xf6,0x26,0x32,0x98,0x7b,0xfe,0x5c,0x42,0x94,0x81,0x94, + 0x82,0x9d,0xac,0x0a,0x8b,0xc6,0x4b,0x15,0x4a,0xd3,0x98,0x90,0x45,0x60,0x33,0x80,0xe0,0x23,0xde,0xf8,0x03,0xa4,0xf6,0x45, + 0x47,0xe5,0xce,0xb8,0x03,0x42,0x47,0xe8,0x41,0x36,0x71,0x77,0xad,0xfd,0xa2,0xe8,0x97,0x74,0x4e,0x2e,0xda,0x1e,0x1d,0x8c, + 0x5a,0xc8,0x1e,0x9a,0xd5,0xc2,0xf0,0xc6,0x22,0xa8,0x4f,0x9b,0xbd,0xd8,0x1c,0x9a,0x51,0xc4,0x2f,0x9a,0xf6,0x5f,0xa7,0x27, + 0x97,0xba,0x96,0x2e,0x85,0x57,0xc0,0x60,0xe7,0x78,0x56,0x7f,0x6a,0xef,0xc2,0x95,0x9a,0x4b,0x11,0x02,0xc8,0x82,0x9c,0xc9, + 0x1a,0x05,0x7c,0xba,0x71,0xb5,0x4e,0x7a,0x99,0x6c,0xf4,0xe8,0x9e,0xd4,0x5a,0x98,0xc8,0x9f,0xbf,0x8d,0xbb,0x18,0x5c,0x43, + 0xf5,0xd0,0x2a,0xe8,0xe2,0x62,0xee,0x78,0x04,0xdb,0xbd,0xd1,0xfb,0x5b,0x0a,0xa8,0x70,0x7e,0xf0,0x97,0x84,0x78,0xe3,0x08, + 0x03,0x5d,0x47,0x2c,0x63,0xa8,0x25,0x38,0x97,0x01,0xd2,0x3f,0x3a,0xda,0xe5,0xe5,0xf6,0xe6,0x9b,0xdc,0x7e,0x2c,0xcc,0xff, + 0x17,0x4c,0x4d,0x00,0xa2,0xd8,0xd6,0x01,0x0e,0xb8,0x8b,0xee,0xe6,0xe0,0x72,0x55,0x89,0x2c,0x27,0x19,0x61,0xf6,0x77,0x01, + 0x8c,0x31,0x82,0x0f,0x9d,0x30,0x82,0x0f,0x99,0x02,0x01,0x01,0x30,0x26,0x30,0x12,0x31,0x10,0x30,0x0e,0x06,0x03,0x55,0x04, + 0x03,0x13,0x07,0x54,0x65,0x73,0x74,0x20,0x43,0x41,0x02,0x10,0xd1,0x73,0x97,0xaa,0xa7,0x3a,0x31,0xa2,0x44,0xc0,0x4b,0x40, + 0x69,0x40,0x4b,0xfa,0x30,0x0d,0x06,0x09,0x60,0x86,0x48,0x01,0x65,0x03,0x04,0x02,0x01,0x05,0x00,0xa0,0x5e,0x30,0x10,0x06, + 0x0a,0x2b,0x06,0x01,0x04,0x01,0x82,0x37,0x02,0x01,0x0c,0x31,0x02,0x30,0x00,0x30,0x19,0x06,0x09,0x2a,0x86,0x48,0x86,0xf7, + 0x0d,0x01,0x09,0x03,0x31,0x0c,0x06,0x0a,0x2b,0x06,0x01,0x04,0x01,0x82,0x37,0x02,0x01,0x04,0x30,0x2f,0x06,0x09,0x2a,0x86, + 0x48,0x86,0xf7,0x0d,0x01,0x09,0x04,0x31,0x22,0x04,0x20,0xcb,0xa1,0x2f,0x7b,0x0f,0x6a,0x14,0x06,0x26,0x77,0x7b,0xee,0xd1, + 0x90,0x34,0x1c,0xa7,0xcd,0x94,0x65,0xe0,0xe4,0x24,0x12,0x0c,0x4e,0xa2,0x89,0xeb,0x2d,0xe5,0xbb,0x30,0x0d,0x06,0x09,0x2a, + 0x86,0x48,0x86,0xf7,0x0d,0x01,0x01,0x01,0x05,0x00,0x04,0x82,0x01,0x00,0x73,0xb7,0xdf,0xb4,0xd2,0x60,0x31,0x2d,0x14,0x63, + 0x71,0x87,0x5b,0xd9,0xee,0x66,0x85,0x88,0xbe,0x1e,0xc3,0x5e,0x30,0x25,0x62,0x05,0x66,0x6e,0x9b,0x51,0xaa,0x5b,0xee,0xed, + 0xe4,0x4c,0x83,0x19,0x7e,0x7b,0x78,0xe0,0x04,0xb5,0xdb,0xb3,0x48,0xba,0xa3,0xa4,0x54,0xb2,0x3e,0xe4,0x99,0xf1,0xb2,0x6e, + 0xb7,0x7a,0x44,0x76,0x11,0xb4,0x51,0xae,0xe3,0xec,0xc2,0x43,0x65,0xf5,0x95,0x1c,0x57,0x9e,0x4d,0x49,0x4d,0x4c,0xee,0x09, + 0xdd,0xdb,0xab,0xf3,0x14,0x89,0xec,0x6e,0x94,0xd2,0xac,0xd8,0xed,0xe3,0xbb,0x8a,0xf0,0x05,0x9d,0x1d,0xbe,0x8b,0x7f,0x34, + 0x63,0xe7,0x87,0x04,0x25,0x5a,0xff,0xc9,0xca,0xa9,0xab,0xd5,0xf2,0x16,0xf6,0x26,0x5d,0xf9,0xf9,0xbf,0xb4,0xce,0x86,0x55, + 0xd4,0x95,0x91,0x1e,0x12,0x25,0x36,0x43,0x37,0x6e,0x93,0x14,0xf0,0x86,0xad,0xc6,0x7d,0x07,0x86,0xe5,0x18,0x4f,0x3d,0xe3, + 0x92,0x67,0x7b,0x74,0xbf,0xa9,0x71,0x5a,0x49,0xcf,0xf5,0x60,0xf4,0x09,0x65,0x38,0xfd,0x13,0xe2,0x03,0x8a,0x84,0x17,0xc7, + 0x83,0x7a,0xd5,0x42,0x95,0x47,0xd8,0x9d,0x76,0x52,0xb5,0xbc,0x11,0x63,0x78,0x53,0x66,0x0e,0x95,0xc8,0xd4,0xfa,0x6e,0x3d, + 0x3b,0x1b,0x56,0xf2,0x98,0xc3,0x4c,0xc8,0xdc,0x1f,0x7e,0xa3,0x8b,0x1a,0x3b,0xa6,0x4d,0xed,0x70,0x75,0x55,0xcd,0x0c,0xf9, + 0x4e,0xfb,0xa6,0x84,0xcb,0xbc,0xf5,0x28,0x89,0x2e,0x30,0x07,0x8f,0x1d,0x8d,0x10,0x03,0x20,0xe9,0xb0,0x56,0x53,0x9d,0xf9, + 0x43,0xfb,0xba,0xb7,0x25,0x5d,0xa1,0x82,0x0d,0xe8,0x30,0x82,0x03,0x1c,0x06,0x09,0x2a,0x86,0x48,0x86,0xf7,0x0d,0x01,0x09, + 0x06,0x31,0x82,0x03,0x0d,0x30,0x82,0x03,0x09,0x02,0x01,0x01,0x30,0x77,0x30,0x63,0x31,0x0b,0x30,0x09,0x06,0x03,0x55,0x04, + 0x06,0x13,0x02,0x55,0x53,0x31,0x17,0x30,0x15,0x06,0x03,0x55,0x04,0x0a,0x13,0x0e,0x44,0x69,0x67,0x69,0x43,0x65,0x72,0x74, + 0x2c,0x20,0x49,0x6e,0x63,0x2e,0x31,0x3b,0x30,0x39,0x06,0x03,0x55,0x04,0x03,0x13,0x32,0x44,0x69,0x67,0x69,0x43,0x65,0x72, + 0x74,0x20,0x54,0x72,0x75,0x73,0x74,0x65,0x64,0x20,0x47,0x34,0x20,0x52,0x53,0x41,0x34,0x30,0x39,0x36,0x20,0x53,0x48,0x41, + 0x32,0x35,0x36,0x20,0x54,0x69,0x6d,0x65,0x53,0x74,0x61,0x6d,0x70,0x69,0x6e,0x67,0x20,0x43,0x41,0x02,0x10,0x0c,0x4d,0x69, + 0x72,0x4b,0x94,0xfa,0x3c,0x2a,0x4a,0x3d,0x29,0x07,0x80,0x3d,0x5a,0x30,0x0d,0x06,0x09,0x60,0x86,0x48,0x01,0x65,0x03,0x04, + 0x02,0x01,0x05,0x00,0xa0,0x69,0x30,0x18,0x06,0x09,0x2a,0x86,0x48,0x86,0xf7,0x0d,0x01,0x09,0x03,0x31,0x0b,0x06,0x09,0x2a, + 0x86,0x48,0x86,0xf7,0x0d,0x01,0x07,0x01,0x30,0x1c,0x06,0x09,0x2a,0x86,0x48,0x86,0xf7,0x0d,0x01,0x09,0x05,0x31,0x0f,0x17, + 0x0d,0x32,0x32,0x30,0x39,0x33,0x30,0x31,0x37,0x35,0x33,0x34,0x33,0x5a,0x30,0x2f,0x06,0x09,0x2a,0x86,0x48,0x86,0xf7,0x0d, + 0x01,0x09,0x04,0x31,0x22,0x04,0x20,0xbf,0x5c,0x03,0xc6,0x50,0xb0,0xde,0xd1,0x96,0x6d,0x74,0x64,0xa4,0xda,0x0f,0x51,0x71, + 0x0f,0x5a,0x87,0x97,0x78,0x2e,0x17,0x99,0xc6,0xa2,0x7b,0xa7,0x9b,0x75,0xeb,0x30,0x0d,0x06,0x09,0x2a,0x86,0x48,0x86,0xf7, + 0x0d,0x01,0x01,0x01,0x05,0x00,0x04,0x82,0x02,0x00,0x0e,0xb2,0xbf,0xf0,0xf2,0x35,0x55,0xc7,0x9d,0x49,0xce,0x0a,0xac,0x3a, + 0x6a,0xd8,0x85,0xa0,0x2b,0x81,0x97,0x85,0xc2,0x16,0x4d,0x6d,0x77,0x72,0xdf,0x2e,0x0a,0x6b,0x2e,0xbd,0xd6,0xb4,0x66,0x22, + 0x7b,0x43,0x1b,0x7e,0x7a,0x1b,0xdb,0x72,0xfb,0x1d,0xd5,0xe9,0x84,0x01,0xe1,0x64,0x15,0x05,0x0d,0xb5,0x85,0x1d,0x93,0xf0, + 0xcf,0x72,0x77,0x07,0x30,0x82,0xa9,0x6e,0x9c,0x5d,0xc9,0x39,0xda,0x19,0x9b,0xca,0x34,0x05,0xf0,0xe4,0xd7,0x02,0xbe,0x8a, + 0x5f,0x74,0x39,0xe6,0xe9,0xb4,0xdf,0x00,0x4a,0xeb,0xb4,0x0d,0xf6,0xb2,0x5b,0x7f,0x10,0xb1,0xef,0x05,0x53,0xfc,0x74,0x41, + 0x5b,0x83,0xeb,0xf9,0x37,0x9f,0x03,0xc2,0x1a,0x98,0x13,0xc9,0x6c,0x1c,0xd8,0x82,0xd8,0xd7,0xbf,0x13,0x07,0x20,0xf9,0xf2, + 0xea,0x96,0x46,0xb7,0x2d,0x51,0x2f,0xc3,0x40,0x12,0x3f,0x35,0xeb,0x88,0xfa,0x3c,0x66,0x30,0xd9,0x16,0xe2,0x4b,0x05,0x14, + 0x11,0x07,0x9a,0x64,0xc5,0x92,0x01,0xec,0xdb,0x5d,0x01,0x91,0x08,0x4f,0x1e,0xec,0x12,0xdd,0x7d,0xa0,0x32,0x5a,0x84,0x2a, + 0x7c,0xb9,0x25,0x34,0x57,0x12,0x0c,0x86,0x2d,0xcd,0x01,0x26,0x85,0x17,0x8c,0x7d,0x07,0x3f,0x2c,0x08,0xb6,0xac,0xc3,0xca, + 0x72,0x17,0xfe,0x4c,0xef,0xbb,0x69,0x20,0x11,0x33,0x63,0xf8,0xca,0x0a,0xe1,0x8c,0xf5,0x31,0x4e,0x83,0x87,0xfb,0xa9,0xd2, + 0x29,0x4b,0x82,0x84,0x27,0xfa,0x01,0x31,0x48,0xc1,0x25,0xe5,0x51,0x49,0xf5,0x52,0x60,0xdb,0x64,0x08,0x36,0xd2,0x2f,0x4e, + 0x7a,0x5d,0x92,0xee,0x06,0xec,0xe4,0x3b,0x5d,0xdc,0xc3,0x49,0xa1,0x8e,0x96,0xa6,0x17,0x00,0x2d,0x0d,0xee,0x6e,0x88,0x16, + 0x1e,0xea,0x9c,0x9b,0x55,0x9d,0xea,0x4a,0xa5,0xbb,0x54,0x33,0xaa,0x72,0x8c,0x5f,0xb7,0xe6,0x22,0xe9,0x1d,0xca,0xbc,0x6d, + 0xdf,0x7b,0x68,0xb5,0x71,0x3b,0x9f,0xfd,0x2b,0x53,0x35,0xa6,0xbb,0x78,0xf2,0x5a,0x41,0x69,0x52,0x5c,0x47,0xdc,0xf0,0x3e, + 0x06,0xef,0x60,0xb6,0xd3,0xb1,0x30,0xda,0x41,0xee,0x5a,0x2e,0x8e,0x24,0x0e,0x1e,0xcd,0x6c,0xa6,0x2e,0x9b,0x3c,0x77,0x02, + 0x21,0x86,0x16,0x68,0xfc,0xd6,0x64,0x84,0x46,0x1e,0xd1,0xe6,0x86,0x6f,0xee,0x5f,0x5c,0xca,0xb6,0xc9,0x9b,0xb8,0x03,0x46, + 0x1b,0x67,0x52,0x48,0x48,0x1c,0x07,0xad,0xbd,0x3c,0x2f,0x1b,0xd1,0xe3,0xb5,0xba,0x21,0x20,0x3b,0x6d,0xfb,0x30,0xa6,0x6d, + 0x2d,0xd7,0xb0,0x67,0xa4,0x19,0x0f,0x38,0xff,0xb0,0xad,0xf0,0xc3,0xb3,0xd7,0x7c,0x92,0xa0,0xe8,0x9c,0x22,0x60,0x0f,0x88, + 0x08,0xa7,0xf0,0xfa,0x90,0x45,0x2c,0x26,0xa6,0x88,0x25,0x24,0x7b,0x69,0x23,0x0b,0x20,0x04,0x89,0xd4,0x66,0x89,0x7d,0xb6, + 0x50,0x0e,0xb3,0xfe,0xf9,0xd0,0x91,0x2b,0x1d,0x17,0x62,0x6d,0xad,0x8e,0xf9,0x52,0x63,0x8f,0xe9,0x93,0xe6,0xea,0xb8,0xe6, + 0xce,0x0c,0x69,0xc9,0x47,0xd7,0x7e,0xb4,0x0d,0x49,0xbe,0xcb,0x05,0xe4,0xac,0x0b,0xd4,0xa1,0x6b,0x66,0x0f,0xff,0xe7,0x01, + 0x5a,0x91,0x05,0xa8,0xc0,0x2b,0xda,0xe9,0x5c,0x18,0xfb,0xe3,0x4d,0x60,0x0f,0x34,0x19,0x68,0x30,0x82,0x0a,0xc4,0x06,0x0a, + 0x2b,0x06,0x01,0x04,0x01,0x82,0x37,0x02,0x04,0x01,0x31,0x82,0x0a,0xb4,0x30,0x82,0x05,0x56,0x06,0x09,0x2a,0x86,0x48,0x86, + 0xf7,0x0d,0x01,0x07,0x02,0xa0,0x82,0x05,0x47,0x30,0x82,0x05,0x43,0x02,0x01,0x01,0x31,0x0f,0x30,0x0d,0x06,0x09,0x60,0x86, + 0x48,0x01,0x65,0x03,0x04,0x02,0x01,0x05,0x00,0x30,0x5c,0x06,0x0a,0x2b,0x06,0x01,0x04,0x01,0x82,0x37,0x02,0x01,0x04,0xa0, + 0x4e,0x30,0x4c,0x30,0x17,0x06,0x0a,0x2b,0x06,0x01,0x04,0x01,0x82,0x37,0x02,0x01,0x0f,0x30,0x09,0x03,0x01,0x00,0xa0,0x04, + 0xa2,0x02,0x80,0x00,0x30,0x31,0x30,0x0d,0x06,0x09,0x60,0x86,0x48,0x01,0x65,0x03,0x04,0x02,0x01,0x05,0x00,0x04,0x20,0xdd, + 0x8b,0xd7,0x29,0x3b,0xae,0x16,0xec,0xbb,0x81,0x80,0x55,0x15,0xd8,0x87,0xa5,0x3e,0xeb,0x0b,0x74,0x59,0xb6,0x56,0xf1,0x0b, + 0x2e,0xe1,0xb4,0x42,0x4d,0x8b,0x18,0xa0,0x82,0x03,0x05,0x30,0x82,0x03,0x01,0x30,0x82,0x01,0xe9,0xa0,0x03,0x02,0x01,0x02, + 0x02,0x10,0x8d,0x01,0xec,0xa9,0x68,0x41,0x93,0x8f,0x40,0x42,0x93,0x4a,0x72,0x6b,0x03,0xcc,0x30,0x0d,0x06,0x09,0x2a,0x86, + 0x48,0x86,0xf7,0x0d,0x01,0x01,0x0b,0x05,0x00,0x30,0x12,0x31,0x10,0x30,0x0e,0x06,0x03,0x55,0x04,0x03,0x13,0x07,0x54,0x65, + 0x73,0x74,0x20,0x43,0x41,0x30,0x1e,0x17,0x0d,0x32,0x32,0x30,0x39,0x33,0x30,0x31,0x37,0x32,0x34,0x31,0x39,0x5a,0x17,0x0d, + 0x33,0x39,0x31,0x32,0x33,0x31,0x32,0x33,0x35,0x39,0x35,0x39,0x5a,0x30,0x10,0x31,0x0e,0x30,0x0c,0x06,0x03,0x55,0x04,0x03, + 0x13,0x05,0x63,0x65,0x72,0x74,0x33,0x30,0x82,0x01,0x22,0x30,0x0d,0x06,0x09,0x2a,0x86,0x48,0x86,0xf7,0x0d,0x01,0x01,0x01, + 0x05,0x00,0x03,0x82,0x01,0x0f,0x00,0x30,0x82,0x01,0x0a,0x02,0x82,0x01,0x01,0x00,0xf4,0x21,0x90,0xec,0x4a,0x19,0xca,0xa7, + 0x1f,0x25,0x80,0x0b,0x92,0x21,0x2d,0x53,0xb4,0x25,0xa3,0x37,0x40,0xae,0xce,0xf1,0x46,0xf6,0xda,0x21,0xd3,0x54,0x8e,0x02, + 0x95,0xfe,0x37,0x3a,0xff,0xb9,0x36,0x88,0x70,0xf2,0x33,0x0c,0x5c,0x60,0x36,0xbf,0x8d,0x51,0xef,0x18,0x5d,0x47,0x68,0xbc, + 0xda,0xd8,0xf8,0x94,0xaf,0xcf,0xa6,0x48,0x61,0x78,0x04,0xcd,0x73,0x03,0xa0,0x6c,0xdb,0x24,0x94,0x20,0x54,0xbb,0x19,0xf2, + 0xb6,0xf9,0x0d,0xf4,0x31,0xbd,0x79,0xb5,0x98,0x12,0xc4,0x62,0x06,0xfb,0x16,0x08,0x51,0xa2,0xbf,0x12,0xcf,0x88,0xf4,0x4c, + 0x26,0xec,0x80,0xc7,0xa7,0xeb,0x89,0x24,0x6a,0xe4,0x1e,0x3a,0x1d,0x4a,0x7c,0x42,0xaa,0x03,0x5e,0x47,0xde,0x21,0xc4,0x06, + 0x86,0x57,0x0d,0xce,0xe0,0x27,0xf2,0x43,0x56,0x2a,0x60,0x1b,0x18,0xf5,0x03,0x91,0xa4,0xda,0x86,0x1c,0xcb,0x2c,0x2d,0x21, + 0x54,0xc5,0xd8,0xe2,0xe2,0x02,0x19,0xb0,0x73,0xe0,0xf8,0x95,0x5c,0x4f,0x1d,0x8f,0xd2,0xe0,0x4a,0x7c,0x20,0x9e,0x29,0xec, + 0x05,0x34,0xb0,0x4c,0x1a,0xaf,0x2a,0x01,0xf1,0x0f,0x26,0xdc,0x38,0x68,0x85,0xbd,0xc0,0x73,0xec,0x10,0x17,0x3a,0xd8,0x6d, + 0x33,0x3b,0xab,0xd3,0x79,0x61,0x2c,0xac,0x11,0xe1,0x09,0x5e,0xe0,0x7b,0xd3,0xc0,0xb8,0xf8,0xb5,0x9a,0x20,0x68,0xa7,0xf0, + 0x66,0x9b,0xc2,0xe8,0x83,0x14,0x7d,0x3c,0x7f,0x7a,0x85,0x95,0xc9,0x05,0x74,0xf4,0xee,0xa9,0x83,0x6a,0x55,0xa5,0x78,0xa8, + 0xa8,0xb4,0x6d,0xb1,0xab,0x49,0x50,0xd1,0x02,0x03,0x01,0x00,0x01,0xa3,0x55,0x30,0x53,0x30,0x0c,0x06,0x03,0x55,0x1d,0x13, + 0x01,0x01,0xff,0x04,0x02,0x30,0x00,0x30,0x43,0x06,0x03,0x55,0x1d,0x01,0x04,0x3c,0x30,0x3a,0x80,0x10,0x88,0x17,0xf7,0x38, + 0x65,0x8b,0x78,0x78,0xf6,0x77,0xe3,0x25,0x47,0x54,0x33,0x4c,0xa1,0x14,0x30,0x12,0x31,0x10,0x30,0x0e,0x06,0x03,0x55,0x04, + 0x03,0x13,0x07,0x54,0x65,0x73,0x74,0x20,0x43,0x41,0x82,0x10,0x2b,0x59,0xb4,0xc7,0xe2,0xce,0x08,0x97,0x46,0x48,0x32,0x17, + 0x0f,0x97,0xc5,0x08,0x30,0x0d,0x06,0x09,0x2a,0x86,0x48,0x86,0xf7,0x0d,0x01,0x01,0x0b,0x05,0x00,0x03,0x82,0x01,0x01,0x00, + 0x8e,0xe0,0xc9,0x58,0x24,0x1b,0x16,0x6a,0x8a,0x4f,0x67,0xac,0xd7,0x75,0x62,0x53,0x94,0xfc,0xeb,0x8b,0x36,0x2a,0x9f,0x9c, + 0x8b,0x8f,0x60,0x42,0xdd,0x37,0x13,0x10,0x5f,0x5a,0x52,0xc8,0xee,0x51,0x92,0x18,0xaf,0x84,0x18,0x5f,0x27,0x69,0xf4,0xde, + 0x22,0x4b,0x9c,0xaa,0x18,0x9e,0xde,0x04,0xc0,0xc4,0xfd,0x74,0x08,0x25,0x43,0xbf,0x00,0x1d,0xc2,0xd6,0xb2,0x4e,0xa4,0x4a, + 0x73,0xa1,0xff,0x71,0x3d,0xa5,0xf1,0x21,0xcf,0x4d,0xb4,0x5c,0x55,0x54,0x6f,0x94,0x50,0x21,0xbb,0x85,0xcb,0x54,0xeb,0x07, + 0xaf,0x74,0x62,0x21,0xf5,0x89,0x43,0xcb,0x10,0x62,0xd6,0xbe,0xc0,0x3a,0xb3,0x6b,0x9f,0x80,0xde,0xe0,0xc0,0x6e,0x8a,0x0a, + 0xe7,0x1f,0x08,0x9b,0x89,0x38,0xc2,0x30,0xfa,0xd9,0xc2,0x8c,0xf7,0xbd,0xbd,0xd4,0x6b,0x99,0xbd,0x5f,0x0e,0xb1,0x76,0xd6, + 0x5b,0x1f,0x1a,0xd7,0x27,0x5d,0x5b,0x19,0x1c,0x6d,0x5a,0x91,0x81,0x06,0x83,0x82,0x6d,0xaf,0x48,0x70,0x72,0x8b,0x7c,0x8e, + 0x57,0xcd,0x35,0x5d,0x7d,0x96,0xe5,0x2d,0x31,0xd2,0xa9,0xf8,0xad,0x9d,0x13,0xb4,0x89,0x75,0x7e,0xbc,0x39,0x11,0x27,0x9d, + 0xc3,0x7b,0xf1,0x40,0x2a,0x23,0xed,0x50,0xee,0x10,0x1b,0x97,0x13,0x71,0x1c,0x5a,0x7f,0x06,0xab,0x9b,0x51,0x2b,0x1f,0x85, + 0x27,0x99,0x11,0x18,0x62,0x97,0xcb,0x08,0x24,0x6d,0xf5,0x08,0x56,0xb5,0x36,0x00,0xf3,0x6b,0x3d,0xa9,0x13,0xd3,0xcf,0x0c, + 0x94,0x6f,0x9e,0x05,0x62,0xeb,0x9c,0x52,0x9d,0x0c,0x15,0x81,0x4d,0x7d,0xe3,0x2f,0x31,0x82,0x01,0xc4,0x30,0x82,0x01,0xc0, + 0x02,0x01,0x01,0x30,0x26,0x30,0x12,0x31,0x10,0x30,0x0e,0x06,0x03,0x55,0x04,0x03,0x13,0x07,0x54,0x65,0x73,0x74,0x20,0x43, + 0x41,0x02,0x10,0x8d,0x01,0xec,0xa9,0x68,0x41,0x93,0x8f,0x40,0x42,0x93,0x4a,0x72,0x6b,0x03,0xcc,0x30,0x0d,0x06,0x09,0x60, + 0x86,0x48,0x01,0x65,0x03,0x04,0x02,0x01,0x05,0x00,0xa0,0x71,0x30,0x10,0x06,0x0a,0x2b,0x06,0x01,0x04,0x01,0x82,0x37,0x02, + 0x01,0x0c,0x31,0x02,0x30,0x00,0x30,0x11,0x06,0x0a,0x2a,0x86,0x48,0x86,0xf7,0x0d,0x01,0x09,0x19,0x04,0x31,0x03,0x02,0x01, + 0x02,0x30,0x19,0x06,0x09,0x2a,0x86,0x48,0x86,0xf7,0x0d,0x01,0x09,0x03,0x31,0x0c,0x06,0x0a,0x2b,0x06,0x01,0x04,0x01,0x82, + 0x37,0x02,0x01,0x04,0x30,0x2f,0x06,0x09,0x2a,0x86,0x48,0x86,0xf7,0x0d,0x01,0x09,0x04,0x31,0x22,0x04,0x20,0xcb,0xa1,0x2f, + 0x7b,0x0f,0x6a,0x14,0x06,0x26,0x77,0x7b,0xee,0xd1,0x90,0x34,0x1c,0xa7,0xcd,0x94,0x65,0xe0,0xe4,0x24,0x12,0x0c,0x4e,0xa2, + 0x89,0xeb,0x2d,0xe5,0xbb,0x30,0x0d,0x06,0x09,0x2a,0x86,0x48,0x86,0xf7,0x0d,0x01,0x01,0x01,0x05,0x00,0x04,0x82,0x01,0x00, + 0x68,0xfc,0x34,0xac,0x24,0xe1,0x93,0x00,0xec,0x8d,0x29,0xe1,0x32,0x03,0xe6,0x8a,0xd6,0x39,0x79,0x07,0x85,0x97,0xf4,0xb8, + 0x0c,0xf1,0x24,0xa0,0x16,0x09,0x0c,0xf8,0x02,0x40,0x94,0xdb,0x19,0x7a,0x6f,0x91,0xee,0x24,0x36,0x77,0x32,0x02,0xb5,0xd1, + 0xf9,0xe0,0xa2,0xdd,0xe0,0xe1,0x14,0x30,0x11,0xe1,0x25,0x02,0x0a,0x7c,0x10,0xdb,0xbd,0xb0,0x4e,0xbb,0x36,0xef,0x87,0xf0, + 0x17,0x49,0x77,0x45,0xa0,0x9e,0x47,0x70,0x1a,0xe2,0x87,0x39,0x41,0x24,0x1c,0xe0,0x09,0xb0,0xe0,0xfa,0xc5,0xf3,0xba,0xba, + 0x03,0x65,0x64,0xf9,0xa8,0x7d,0xe5,0x0e,0x84,0xc8,0xd1,0xe2,0xf5,0x44,0xa4,0x6f,0x33,0xac,0xbb,0x15,0x3b,0x0a,0x1a,0x04, + 0x6e,0xc2,0x54,0xa7,0x78,0x77,0x7d,0x32,0x21,0x4d,0x0c,0x3f,0x7b,0x0a,0x61,0x18,0x58,0xdb,0x59,0x02,0x3f,0xcf,0xb2,0xd0, + 0x5c,0xa5,0xea,0x96,0xd4,0x5c,0xd2,0x09,0xd3,0x18,0x61,0x73,0x6e,0x9f,0xdf,0xcb,0x17,0x4f,0xd1,0xc0,0xa2,0x2d,0x8b,0xf5, + 0x46,0xdf,0xf8,0xb8,0x4f,0x47,0x98,0xf4,0x44,0xa6,0xa1,0x5b,0xcb,0xfa,0xc1,0x31,0x4e,0xc4,0x03,0xea,0x06,0x1b,0x9b,0x94, + 0xa6,0xc8,0x1c,0x7a,0x69,0x3b,0x8d,0x8d,0x83,0x20,0x56,0x18,0xf1,0xe0,0xd2,0xfb,0xbc,0xaf,0xf7,0xdc,0x17,0x3b,0xcd,0xac, + 0x2b,0x07,0x86,0xc6,0x7f,0x25,0xc3,0xa2,0x6c,0x7c,0x49,0xa9,0xc1,0xe2,0x5e,0x40,0x05,0xfb,0x2f,0xab,0xd5,0x98,0x3a,0x69, + 0xbb,0x83,0x1c,0xbd,0xde,0x55,0xc0,0x74,0x71,0x8d,0xdb,0xc7,0x95,0xf4,0xf5,0xca,0x30,0x82,0x05,0x56,0x06,0x09,0x2a,0x86, + 0x48,0x86,0xf7,0x0d,0x01,0x07,0x02,0xa0,0x82,0x05,0x47,0x30,0x82,0x05,0x43,0x02,0x01,0x01,0x31,0x0f,0x30,0x0d,0x06,0x09, + 0x60,0x86,0x48,0x01,0x65,0x03,0x04,0x02,0x01,0x05,0x00,0x30,0x5c,0x06,0x0a,0x2b,0x06,0x01,0x04,0x01,0x82,0x37,0x02,0x01, + 0x04,0xa0,0x4e,0x30,0x4c,0x30,0x17,0x06,0x0a,0x2b,0x06,0x01,0x04,0x01,0x82,0x37,0x02,0x01,0x0f,0x30,0x09,0x03,0x01,0x00, + 0xa0,0x04,0xa2,0x02,0x80,0x00,0x30,0x31,0x30,0x0d,0x06,0x09,0x60,0x86,0x48,0x01,0x65,0x03,0x04,0x02,0x01,0x05,0x00,0x04, + 0x20,0xdd,0x8b,0xd7,0x29,0x3b,0xae,0x16,0xec,0xbb,0x81,0x80,0x55,0x15,0xd8,0x87,0xa5,0x3e,0xeb,0x0b,0x74,0x59,0xb6,0x56, + 0xf1,0x0b,0x2e,0xe1,0xb4,0x42,0x4d,0x8b,0x18,0xa0,0x82,0x03,0x05,0x30,0x82,0x03,0x01,0x30,0x82,0x01,0xe9,0xa0,0x03,0x02, + 0x01,0x02,0x02,0x10,0xae,0xfb,0x3e,0x08,0x15,0xa4,0xe3,0xa7,0x4d,0x91,0x6a,0x85,0x68,0x5b,0x58,0xa1,0x30,0x0d,0x06,0x09, + 0x2a,0x86,0x48,0x86,0xf7,0x0d,0x01,0x01,0x0b,0x05,0x00,0x30,0x12,0x31,0x10,0x30,0x0e,0x06,0x03,0x55,0x04,0x03,0x13,0x07, + 0x54,0x65,0x73,0x74,0x20,0x43,0x41,0x30,0x1e,0x17,0x0d,0x32,0x32,0x30,0x39,0x33,0x30,0x31,0x37,0x32,0x33,0x30,0x33,0x5a, + 0x17,0x0d,0x33,0x39,0x31,0x32,0x33,0x31,0x32,0x33,0x35,0x39,0x35,0x39,0x5a,0x30,0x10,0x31,0x0e,0x30,0x0c,0x06,0x03,0x55, + 0x04,0x03,0x13,0x05,0x63,0x65,0x72,0x74,0x32,0x30,0x82,0x01,0x22,0x30,0x0d,0x06,0x09,0x2a,0x86,0x48,0x86,0xf7,0x0d,0x01, + 0x01,0x01,0x05,0x00,0x03,0x82,0x01,0x0f,0x00,0x30,0x82,0x01,0x0a,0x02,0x82,0x01,0x01,0x00,0xca,0x01,0x2f,0x98,0x69,0x71, + 0x64,0x63,0x56,0x38,0xd7,0xc4,0xad,0x64,0x02,0x34,0xd4,0x31,0xc2,0x27,0x5d,0xd7,0x8f,0x72,0xd0,0x70,0x95,0xd9,0x75,0x65, + 0x2e,0x8c,0x5b,0x76,0xcd,0x54,0x3f,0xd9,0x0a,0xcc,0x3f,0x03,0x8f,0x74,0x2b,0x8c,0x3d,0x3d,0x4c,0xd3,0xaa,0x3c,0x97,0xf1, + 0x44,0x46,0x57,0x92,0xa9,0xdd,0xd9,0xf0,0xc7,0x8b,0x39,0xf5,0x8d,0x28,0x41,0x18,0xaf,0xca,0x99,0xd1,0xf1,0xe4,0xab,0x93, + 0x0a,0xb6,0xd4,0xad,0x2b,0x9f,0x60,0x27,0x4c,0xf2,0xc9,0x14,0xde,0xf2,0xc6,0xbe,0x82,0x14,0x83,0x65,0x13,0x9f,0x9c,0x8d, + 0xfa,0xac,0x95,0x12,0x00,0xd0,0xa4,0x36,0x4d,0xf0,0x8f,0xfc,0x1a,0x43,0x47,0xc3,0xff,0xce,0x1b,0x24,0xd6,0xcf,0x63,0xd1, + 0x41,0x23,0xb8,0x62,0x5f,0x31,0x4e,0x30,0x3f,0x63,0x64,0xff,0x72,0xb5,0x9d,0xe5,0xaa,0x22,0xbc,0x1d,0xb3,0x23,0xc9,0x16, + 0x49,0x10,0xed,0x51,0x02,0xd2,0x90,0xc6,0x86,0x47,0x40,0x7e,0xf1,0xcf,0xc1,0x17,0xa0,0x72,0xaf,0x40,0xb1,0x23,0x3d,0x5a, + 0xa1,0xf9,0xed,0xc8,0xb6,0x66,0xa7,0x94,0x39,0x09,0x03,0x6d,0x16,0x4e,0xc4,0x2a,0x4b,0x1f,0x5b,0x22,0x39,0xf7,0x60,0x1c, + 0x71,0x65,0x4c,0x11,0x29,0x59,0x96,0x5e,0x9e,0xfe,0xaf,0x23,0xd1,0xe3,0x2c,0xce,0xd2,0x31,0x8c,0x80,0x29,0x6c,0x82,0x99, + 0xe8,0x68,0xbd,0x7e,0x66,0xaa,0x35,0x0c,0xae,0x61,0xde,0x59,0x7d,0x5b,0x16,0x09,0x07,0x52,0x6a,0x14,0x26,0x3c,0x48,0x3e, + 0x03,0xdb,0xd4,0x8a,0xea,0x0e,0x46,0x1a,0x24,0xbd,0x02,0x03,0x01,0x00,0x01,0xa3,0x55,0x30,0x53,0x30,0x0c,0x06,0x03,0x55, + 0x1d,0x13,0x01,0x01,0xff,0x04,0x02,0x30,0x00,0x30,0x43,0x06,0x03,0x55,0x1d,0x01,0x04,0x3c,0x30,0x3a,0x80,0x10,0x88,0x17, + 0xf7,0x38,0x65,0x8b,0x78,0x78,0xf6,0x77,0xe3,0x25,0x47,0x54,0x33,0x4c,0xa1,0x14,0x30,0x12,0x31,0x10,0x30,0x0e,0x06,0x03, + 0x55,0x04,0x03,0x13,0x07,0x54,0x65,0x73,0x74,0x20,0x43,0x41,0x82,0x10,0x2b,0x59,0xb4,0xc7,0xe2,0xce,0x08,0x97,0x46,0x48, + 0x32,0x17,0x0f,0x97,0xc5,0x08,0x30,0x0d,0x06,0x09,0x2a,0x86,0x48,0x86,0xf7,0x0d,0x01,0x01,0x0b,0x05,0x00,0x03,0x82,0x01, + 0x01,0x00,0xd1,0x0d,0xdd,0x83,0x0c,0xd8,0xf9,0x0c,0x71,0xe3,0x2f,0x7c,0xc9,0xd7,0x8e,0x33,0x27,0xb6,0x6b,0x34,0x3c,0x41, + 0xf0,0x13,0x03,0xd6,0x5a,0xe2,0x55,0x12,0x42,0x06,0x20,0x03,0xb1,0x74,0xc7,0xc0,0x08,0x00,0x21,0xbe,0x90,0xe7,0xfd,0xac, + 0xe0,0x67,0x42,0xe7,0x53,0x86,0xcf,0x53,0x55,0x40,0xf1,0xbc,0xfc,0x87,0xab,0x67,0xb6,0x09,0xe1,0xf1,0xa2,0xce,0xf6,0xbf, + 0xe6,0x1d,0x43,0x4f,0x41,0xf0,0xf5,0xc0,0xfa,0xc5,0xd2,0x14,0x2d,0xd9,0x23,0x8e,0x9c,0xeb,0x68,0xff,0x3c,0x5f,0x18,0xca, + 0x4b,0x09,0xad,0xcd,0xbd,0x23,0x62,0x33,0x4e,0x02,0x10,0xf9,0xe3,0x68,0x6f,0x22,0xb0,0x86,0x0b,0x5a,0xbe,0xd3,0xee,0x8a, + 0x0b,0x4c,0x92,0x9e,0x06,0x31,0x1f,0x95,0x4f,0xbf,0x27,0x7f,0x1f,0xcd,0xcc,0x9c,0x70,0xa1,0x51,0x07,0x7a,0x09,0x36,0x3f, + 0x0a,0x2f,0x16,0x77,0x26,0x9b,0xb4,0xc9,0x1e,0x86,0xe3,0xb3,0xb7,0xc3,0xcc,0xf1,0x44,0x6e,0x2e,0xf4,0xc9,0x5b,0x23,0x08, + 0x0a,0xc0,0xdb,0xc1,0x1a,0x37,0xb3,0xb1,0x91,0xce,0x24,0x26,0x56,0x7f,0x26,0x37,0x88,0xa0,0x02,0x37,0x6e,0x9c,0xca,0xc1, + 0x8c,0x19,0x99,0xca,0x6c,0x9a,0x98,0x75,0x89,0xfc,0x6d,0x92,0xfc,0xb5,0x12,0x5b,0x29,0xb1,0x88,0x68,0x3b,0xef,0xf0,0xc0, + 0x8f,0x82,0x5e,0x33,0xf9,0x67,0x6b,0xe8,0x60,0x1b,0x14,0xec,0x9c,0xdf,0x21,0x38,0xbb,0x0d,0x3f,0xd9,0xbc,0xd2,0x01,0x2a, + 0x92,0x0c,0xc2,0x97,0x2e,0x12,0x22,0x54,0x76,0xeb,0x80,0x51,0x99,0x9d,0x0f,0x26,0x12,0xb7,0x31,0x82,0x01,0xc4,0x30,0x82, + 0x01,0xc0,0x02,0x01,0x01,0x30,0x26,0x30,0x12,0x31,0x10,0x30,0x0e,0x06,0x03,0x55,0x04,0x03,0x13,0x07,0x54,0x65,0x73,0x74, + 0x20,0x43,0x41,0x02,0x10,0xae,0xfb,0x3e,0x08,0x15,0xa4,0xe3,0xa7,0x4d,0x91,0x6a,0x85,0x68,0x5b,0x58,0xa1,0x30,0x0d,0x06, + 0x09,0x60,0x86,0x48,0x01,0x65,0x03,0x04,0x02,0x01,0x05,0x00,0xa0,0x71,0x30,0x10,0x06,0x0a,0x2b,0x06,0x01,0x04,0x01,0x82, + 0x37,0x02,0x01,0x0c,0x31,0x02,0x30,0x00,0x30,0x11,0x06,0x0a,0x2a,0x86,0x48,0x86,0xf7,0x0d,0x01,0x09,0x19,0x04,0x31,0x03, + 0x02,0x01,0x01,0x30,0x19,0x06,0x09,0x2a,0x86,0x48,0x86,0xf7,0x0d,0x01,0x09,0x03,0x31,0x0c,0x06,0x0a,0x2b,0x06,0x01,0x04, + 0x01,0x82,0x37,0x02,0x01,0x04,0x30,0x2f,0x06,0x09,0x2a,0x86,0x48,0x86,0xf7,0x0d,0x01,0x09,0x04,0x31,0x22,0x04,0x20,0xcb, + 0xa1,0x2f,0x7b,0x0f,0x6a,0x14,0x06,0x26,0x77,0x7b,0xee,0xd1,0x90,0x34,0x1c,0xa7,0xcd,0x94,0x65,0xe0,0xe4,0x24,0x12,0x0c, + 0x4e,0xa2,0x89,0xeb,0x2d,0xe5,0xbb,0x30,0x0d,0x06,0x09,0x2a,0x86,0x48,0x86,0xf7,0x0d,0x01,0x01,0x01,0x05,0x00,0x04,0x82, + 0x01,0x00,0x26,0x76,0xb3,0xf2,0xc9,0xb1,0x73,0x13,0xb5,0xd2,0xc5,0xb7,0x01,0x5c,0xc6,0x94,0x38,0x9f,0xc7,0x57,0x56,0x95, + 0xb0,0xf4,0x6d,0xc2,0xd4,0x6a,0xf1,0x4d,0x09,0xa1,0x51,0xa6,0x91,0xf0,0x0e,0x84,0xc0,0x2c,0x74,0xa3,0x97,0x1f,0x41,0xe0, + 0x4a,0xfa,0x1a,0x78,0xa9,0xd5,0x3c,0x85,0x29,0x2b,0xaf,0xbb,0xc3,0x61,0x0d,0x50,0x20,0x20,0xf5,0x80,0x0d,0x6a,0x15,0x4b, + 0x38,0x6c,0x55,0xd9,0xf9,0xd0,0x44,0x22,0x46,0x98,0xe6,0x07,0xd4,0xba,0x3d,0x9d,0x50,0xa7,0x8e,0x1f,0xa8,0x82,0x25,0x7e, + 0x39,0xda,0xe1,0x49,0xc7,0x24,0x3f,0x31,0xfb,0x4b,0xba,0x75,0xdb,0x10,0x0a,0xbe,0xc5,0xad,0x3e,0x30,0x16,0x9b,0x15,0xbb, + 0xc0,0x59,0xf2,0xf5,0x4f,0xf5,0x56,0xc6,0x28,0xd0,0x1e,0x7d,0x8f,0x2e,0x2b,0xb6,0x76,0x94,0x52,0x87,0x99,0xa3,0x66,0x3d, + 0x94,0x0d,0x73,0xb0,0xd5,0xd4,0x76,0x5b,0x69,0x95,0x0a,0x16,0x4f,0x5c,0xf4,0x95,0x5b,0x42,0x45,0x04,0x5c,0x53,0xb7,0x1a, + 0x61,0x6c,0x82,0xdc,0x95,0x94,0x38,0x64,0x34,0x01,0x98,0x2e,0xf8,0xcf,0xf8,0x66,0xae,0xba,0xf8,0x70,0x9e,0x9e,0xde,0xa2, + 0x7f,0x56,0x8d,0xd9,0x6a,0x7b,0x41,0x02,0x46,0x05,0x5c,0xba,0xed,0x43,0x98,0x56,0x39,0x52,0xc0,0x0b,0x3c,0xe1,0x7d,0x1b, + 0xf5,0xac,0x03,0x5b,0xbb,0x7a,0x65,0x80,0x4b,0xcb,0xb7,0x51,0xa7,0x19,0x8a,0x38,0x75,0x76,0x75,0xc2,0x1f,0x12,0xc4,0x68, + 0x96,0xe0,0x89,0x9f,0x37,0x3d,0xab,0xfd,0x6b,0x03,0xb3,0xa1,0x51,0xf8,0x69,0x17,0xea,0xff,0x00,0x00,0x00,0x00,0x00,0x00, +}; + static void call_winverify(WCHAR *pathW, LONG *status, BOOL hash_only) { static GUID WVTPolicyGUID = WINTRUST_ACTION_GENERIC_VERIFY_V2; @@ -1130,7 +1612,7 @@ static void call_winverify(WCHAR *pathW, LONG *status, BOOL hash_only) data.dwStateAction = WTD_STATEACTION_CLOSE; ret = WinVerifyTrust(NULL, &WVTPolicyGUID, &data); - ok(ret == S_OK, "WinVerifyTrust failed: %08x\n", ret); + ok(ret == S_OK, "WinVerifyTrust failed: %08lx\n", ret); } static void test_wintrust_digest(void) @@ -1219,18 +1701,18 @@ static void test_wintrust_digest(void) for (j = 0; tests[i].blocks[j].data; j++) { ret = WriteFile(file, tests[i].blocks[j].data, tests[i].blocks[j].length, &written, NULL); - ok(ret && written == tests[i].blocks[j].length, "WriteFile failed with %u\n", GetLastError()); + ok(ret && written == tests[i].blocks[j].length, "WriteFile failed with %lu\n", GetLastError()); } CloseHandle(file); call_winverify(pathW, &status, FALSE); todo_wine_if(tests[i].t1.todo) - ok(status == tests[i].t1.status, "test %d/1: expected %08x, got %08x\n", i, tests[i].t1.status, status); + ok(status == tests[i].t1.status, "test %d/1: expected %08lx, got %08lx\n", i, tests[i].t1.status, status); call_winverify(pathW, &status, TRUE); todo_wine_if(tests[i].t2.todo) - ok(status == tests[i].t2.status, "test %d/2: expected %08x, got %08x\n", i, tests[i].t2.status, status); + ok(status == tests[i].t2.status, "test %d/2: expected %08lx, got %08lx\n", i, tests[i].t2.status, status); DeleteFileW(pathW); } @@ -1249,22 +1731,22 @@ static void test_get_known_usages(void) SetLastError(0xdeadbeef); ret = pWTHelperGetKnownUsages(0, NULL); ok(!ret && GetLastError() == ERROR_INVALID_PARAMETER, - "expected ERROR_INVALID_PARAMETER, got %d\n", GetLastError()); + "expected ERROR_INVALID_PARAMETER, got %ld\n", GetLastError()); SetLastError(0xdeadbeef); ret = pWTHelperGetKnownUsages(1, NULL); ok(!ret && GetLastError() == ERROR_INVALID_PARAMETER, - "expected ERROR_INVALID_PARAMETER, got %d\n", GetLastError()); + "expected ERROR_INVALID_PARAMETER, got %ld\n", GetLastError()); SetLastError(0xdeadbeef); ret = pWTHelperGetKnownUsages(0, &usages); ok(!ret && GetLastError() == ERROR_INVALID_PARAMETER, - "expected ERROR_INVALID_PARAMETER, got %d\n", GetLastError()); + "expected ERROR_INVALID_PARAMETER, got %ld\n", GetLastError()); /* A value of 1 for the first parameter seems to imply the value is * allocated */ SetLastError(0xdeadbeef); usages = NULL; ret = pWTHelperGetKnownUsages(1, &usages); - ok(ret, "WTHelperGetKnownUsages failed: %d\n", GetLastError()); + ok(ret, "WTHelperGetKnownUsages failed: %ld\n", GetLastError()); ok(usages != NULL, "expected a pointer\n"); if (ret && usages) { @@ -1277,10 +1759,10 @@ static void test_get_known_usages(void) { ok((*ptr)->cbSize == sizeof(CRYPT_OID_INFO) || (*ptr)->cbSize == (sizeof(CRYPT_OID_INFO) + 2 * sizeof(LPCWSTR)), /* Vista */ - "unexpected size %d\n", (*ptr)->cbSize); + "unexpected size %ld\n", (*ptr)->cbSize); /* Each returned usage is in the CRYPT_ENHKEY_USAGE_OID_GROUP_ID group */ ok((*ptr)->dwGroupId == CRYPT_ENHKEY_USAGE_OID_GROUP_ID, - "expected group CRYPT_ENHKEY_USAGE_OID_GROUP_ID, got %d\n", + "expected group CRYPT_ENHKEY_USAGE_OID_GROUP_ID, got %ld\n", (*ptr)->dwGroupId); } } @@ -1288,24 +1770,159 @@ static void test_get_known_usages(void) */ SetLastError(0xdeadbeef); ret = pWTHelperGetKnownUsages(2, &usages); - ok(ret, "WTHelperGetKnownUsages failed: %d\n", GetLastError()); + ok(ret, "WTHelperGetKnownUsages failed: %ld\n", GetLastError()); ok(usages == NULL, "expected pointer to be cleared\n"); SetLastError(0xdeadbeef); usages = NULL; ret = pWTHelperGetKnownUsages(2, &usages); - ok(ret, "WTHelperGetKnownUsages failed: %d\n", GetLastError()); + ok(ret, "WTHelperGetKnownUsages failed: %ld\n", GetLastError()); SetLastError(0xdeadbeef); ret = pWTHelperGetKnownUsages(2, NULL); ok(!ret && GetLastError() == ERROR_INVALID_PARAMETER, - "expected ERROR_INVALID_PARAMETER, got %d\n", GetLastError()); + "expected ERROR_INVALID_PARAMETER, got %ld\n", GetLastError()); } -static void test_WTHelperGetProvCertFromChain(void) +static void test_multiple_signatures(void) { - CRYPT_PROVIDER_CERT *cert; + static const BYTE serials[][16] = + { + { 0xfa, 0x4b, 0x40, 0x69, 0x40, 0x4b, 0xc0, 0x44, 0xa2, 0x31, 0x3a, 0xa7, 0xaa, 0x97, 0x73, 0xd1, }, + { 0xcc, 0x03, 0x6b, 0x72, 0x4a, 0x93, 0x42, 0x40, 0x8f, 0x93, 0x41, 0x68, 0xa9, 0xec, 0x01, 0x8d, }, + { 0xa1, 0x58, 0x5b, 0x68, 0x85, 0x6a, 0x91, 0x4d, 0xa7, 0xe3, 0xa4, 0x15, 0x08, 0x3e, 0xfb, 0xae, }, + }; + static GUID WVTPolicyGUID = WINTRUST_ACTION_GENERIC_VERIFY_V2; + WINTRUST_SIGNATURE_SETTINGS settings = { sizeof(settings) }; + WINTRUST_FILE_INFO file_info = { sizeof(file_info) }; + WINTRUST_DATA data = { sizeof(data) }; + CRYPT_PROVIDER_DATA *prov; + WCHAR pathW[MAX_PATH]; + CERT_INFO *cert_info; + unsigned int i; + BYTE buf[4096]; + DWORD written; + LONG status; + HANDLE file; + DWORD size; + BOOL bret; - cert = WTHelperGetProvCertFromChain(NULL, 0); - ok(!cert, "got certificate\n"); + file = create_temp_file(pathW); + ok(file != INVALID_HANDLE_VALUE, "Failed to create temporary file.\n"); + bret = WriteFile(file, self_signed_3certs, sizeof(self_signed_3certs), &written, NULL); + ok(bret, "Failed, err %lu.\n", GetLastError()); + CloseHandle(file); + + file_info.pcwszFilePath = pathW; + data.dwUIChoice = WTD_UI_NONE; + data.fdwRevocationChecks = WTD_REVOKE_NONE; + data.dwUnionChoice = WTD_CHOICE_FILE; + data.pFile = &file_info; + data.dwStateAction = WTD_STATEACTION_VERIFY; + data.dwProvFlags = 0; + data.pSignatureSettings = &settings; + + settings.cSecondarySigs = 0xcccccccc; + settings.dwVerifiedSigIndex = 0xcccccccc; + status = WinVerifyTrust(NULL, &WVTPolicyGUID, &data); + todo_wine ok(status == CERT_E_UNTRUSTEDROOT || status == CERT_E_CHAINING, "Failed, ret %#lx\n", status); + ok(settings.cSecondarySigs == 0xcccccccc, "Got %lu.\n", settings.cSecondarySigs); + todo_wine ok(settings.dwVerifiedSigIndex == 2, "Got %lu.\n", settings.dwVerifiedSigIndex); + + prov = (CRYPT_PROVIDER_DATA *)data.hWVTStateData; + ok(prov->cbStruct == sizeof(*prov), "Got size %lu.\n", prov->cbStruct); + ok(prov->csSigners == 1, "Got %lu.\n", prov->csSigners); + ok(prov->pSigSettings == &settings, "Got %p, expected %p.\n", prov->pSigSettings, &settings); + ok(!!prov->pSigState, "Got %p, expected %p.\n", prov->pSigSettings, &settings); + if (prov->cbStruct == sizeof(*prov) && prov->pSigState) + { + ok(prov->pSigState->cbStruct == sizeof(*prov->pSigState) + || broken(prov->pSigState->cbStruct == offsetof(CRYPT_PROVIDER_SIGSTATE, iAttemptCount)) /* Win7 */, + "Got %lu.\n", prov->pSigState->cbStruct); + ok(prov->pSigState->fSupportMultiSig, "Got %d.\n", prov->pSigState->fSupportMultiSig); + ok(prov->pSigState->dwCryptoPolicySupport == (WSS_SIGTRUST_SUPPORT | WSS_OBJTRUST_SUPPORT + | WSS_CERTTRUST_SUPPORT), "Got %#lx.\n", prov->pSigState->dwCryptoPolicySupport); + ok(prov->pSigState->cSecondarySigs == 2, "Got %lu.\n", prov->pSigState->cSecondarySigs); + + size = sizeof(buf); + bret = CryptMsgGetParam(prov->pSigState->hPrimarySig, CMSG_SIGNER_CERT_INFO_PARAM, 0, buf, &size); + ok(bret, "Failed, err %#lx.\n", GetLastError()); + cert_info = (CERT_INFO *)buf; + ok(cert_info->SerialNumber.cbData == sizeof(serials[0]), "Got %lu.\n", cert_info->SerialNumber.cbData); + ok(!memcmp(cert_info->SerialNumber.pbData, serials[0], sizeof(serials[0])), "Data does not match.\n"); + for (i = 0; i < prov->pSigState->cSecondarySigs; ++i) + { + bret = CryptMsgGetParam(prov->pSigState->rhSecondarySigs[i], CMSG_SIGNER_CERT_INFO_PARAM, 0, buf, &size); + ok(bret, "Failed, err %#lx.\n", GetLastError()); + ok(cert_info->SerialNumber.cbData == sizeof(serials[0]), "Got %lu.\n", cert_info->SerialNumber.cbData); + ok(!memcmp(cert_info->SerialNumber.pbData, serials[i + 1], sizeof(serials[0])), "Data does not match.\n"); + } + } + + data.dwStateAction = WTD_STATEACTION_CLOSE; + status = WinVerifyTrust(NULL, &WVTPolicyGUID, &data); + ok(status == S_OK, "Failed, ret %#lx\n", status); + + data.dwStateAction = WTD_STATEACTION_VERIFY; + settings.dwFlags = WSS_GET_SECONDARY_SIG_COUNT; + settings.cSecondarySigs = 0xcccccccc; + settings.dwVerifiedSigIndex = 0xcccccccc; + status = WinVerifyTrust(NULL, &WVTPolicyGUID, &data); + todo_wine ok(status == CERT_E_UNTRUSTEDROOT || status == CERT_E_CHAINING, "Failed, ret %#lx\n", status); + ok(settings.cSecondarySigs == 2, "Got %lu.\n", settings.cSecondarySigs); + todo_wine ok(settings.dwVerifiedSigIndex == 2, "Got %lu.\n", settings.dwVerifiedSigIndex); + + data.dwStateAction = WTD_STATEACTION_CLOSE; + status = WinVerifyTrust(NULL, &WVTPolicyGUID, &data); + ok(status == S_OK, "Failed, ret %#lx\n", status); + + data.dwStateAction = WTD_STATEACTION_VERIFY; + settings.dwFlags = WSS_VERIFY_SPECIFIC | WSS_GET_SECONDARY_SIG_COUNT; + settings.cSecondarySigs = 0xcccccccc; + settings.dwVerifiedSigIndex = 0xcccccccc; + settings.dwIndex = 1; + status = WinVerifyTrust(NULL, &WVTPolicyGUID, &data); + todo_wine ok(status == CERT_E_UNTRUSTEDROOT || status == CERT_E_CHAINING, "Failed, ret %#lx\n", status); + ok(settings.cSecondarySigs == 2, "Got %lu.\n", settings.cSecondarySigs); + todo_wine ok(settings.dwVerifiedSigIndex == 1, "Got %lu.\n", settings.dwVerifiedSigIndex); + settings.dwIndex = 0; + + data.dwStateAction = WTD_STATEACTION_CLOSE; + status = WinVerifyTrust(NULL, &WVTPolicyGUID, &data); + ok(status == S_OK, "Failed, ret %#lx\n", status); + + DeleteFileW(pathW); +} + +static BOOL (WINAPI *pCryptCATAdminCalcHashFromFileHandle)(HANDLE,DWORD*,BYTE*,DWORD); + +static void test_pe_image_hash(void) +{ + static const char expected[] = + {0x8a,0xd5,0x45,0x53,0x3d,0x67,0xdf,0x2f,0x78,0xe0,0x55,0x0a,0xe0,0xd9,0x7a,0x28,0x3e,0xbf,0x45,0x2b}; + WCHAR path[MAX_PATH]; + HANDLE file; + BYTE sha1[20]; + DWORD size, count; + HMODULE wintrust = GetModuleHandleA("wintrust.dll"); + BOOL ret; + + pCryptCATAdminCalcHashFromFileHandle = (void *)GetProcAddress(wintrust, "CryptCATAdminCalcHashFromFileHandle"); + if (!pCryptCATAdminCalcHashFromFileHandle) + { + win_skip("hash function missing\n"); + return; + } + + file = create_temp_file(path); + WriteFile(file, &bin, sizeof(bin), &count, NULL); + + size = sizeof(sha1); + memset(sha1, 0, sizeof(sha1)); + ret = pCryptCATAdminCalcHashFromFileHandle(file, &size, sha1, 0); + ok(ret, "got %lu\n", GetLastError()); + ok(!memcmp(sha1, expected, sizeof(sha1)), "wrong hash\n"); + + CloseHandle(file); + DeleteFileW(path); } START_TEST(softpub) @@ -1316,5 +1933,6 @@ START_TEST(softpub) test_wintrust(); test_wintrust_digest(); test_get_known_usages(); - test_WTHelperGetProvCertFromChain(); + test_multiple_signatures(); + test_pe_image_hash(); } diff --git a/sdk/include/psdk/mscat.h b/sdk/include/psdk/mscat.h index 7c5c86b71b0..366dbbb0d1e 100644 --- a/sdk/include/psdk/mscat.h +++ b/sdk/include/psdk/mscat.h @@ -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 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 } diff --git a/sdk/include/psdk/wintrust.h b/sdk/include/psdk/wintrust.h index 5da3720142d..eeb149822b4 100644 --- a/sdk/include/psdk/wintrust.h +++ b/sdk/include/psdk/wintrust.h @@ -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 -#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" diff --git a/sdk/tools/winesync/wintrust.cfg b/sdk/tools/winesync/wintrust.cfg new file mode 100644 index 00000000000..b0644d02a81 --- /dev/null +++ b/sdk/tools/winesync/wintrust.cfg @@ -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