Commit 2eeb4eaf authored by Francois Gouget's avatar Francois Gouget Committed by Alexandre Julliard

wintrust: Fix compilation on systems that don't support nameless unions.

parent 4ce6a5fa
...@@ -16,6 +16,9 @@ ...@@ -16,6 +16,9 @@
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
*/ */
#include <stdarg.h> #include <stdarg.h>
#define NONAMELESSUNION
#include "windef.h" #include "windef.h"
#include "winbase.h" #include "winbase.h"
#include "wintrust.h" #include "wintrust.h"
...@@ -37,7 +40,7 @@ HRESULT WINAPI SoftpubInitialize(CRYPT_PROVIDER_DATA *data) ...@@ -37,7 +40,7 @@ HRESULT WINAPI SoftpubInitialize(CRYPT_PROVIDER_DATA *data)
return ret; return ret;
} }
/* Assumes data->pWintrustData->pFile exists. Makes sure a file handle is /* Assumes data->pWintrustData->u.pFile exists. Makes sure a file handle is
* open for the file. * open for the file.
*/ */
static BOOL SOFTPUB_OpenFile(CRYPT_PROVIDER_DATA *data) static BOOL SOFTPUB_OpenFile(CRYPT_PROVIDER_DATA *data)
...@@ -48,13 +51,13 @@ static BOOL SOFTPUB_OpenFile(CRYPT_PROVIDER_DATA *data) ...@@ -48,13 +51,13 @@ static BOOL SOFTPUB_OpenFile(CRYPT_PROVIDER_DATA *data)
* typically have hFile as NULL rather than INVALID_HANDLE_VALUE. Check * typically have hFile as NULL rather than INVALID_HANDLE_VALUE. Check
* for both. * for both.
*/ */
if (!data->pWintrustData->pFile->hFile || if (!data->pWintrustData->u.pFile->hFile ||
data->pWintrustData->pFile->hFile == INVALID_HANDLE_VALUE) data->pWintrustData->u.pFile->hFile == INVALID_HANDLE_VALUE)
{ {
data->pWintrustData->pFile->hFile = data->pWintrustData->u.pFile->hFile =
CreateFileW(data->pWintrustData->pFile->pcwszFilePath, GENERIC_READ, CreateFileW(data->pWintrustData->u.pFile->pcwszFilePath, GENERIC_READ,
FILE_SHARE_READ, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL); FILE_SHARE_READ, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);
if (data->pWintrustData->pFile->hFile != INVALID_HANDLE_VALUE) if (data->pWintrustData->u.pFile->hFile != INVALID_HANDLE_VALUE)
data->fOpenedFile = TRUE; data->fOpenedFile = TRUE;
else else
ret = FALSE; ret = FALSE;
...@@ -63,40 +66,40 @@ static BOOL SOFTPUB_OpenFile(CRYPT_PROVIDER_DATA *data) ...@@ -63,40 +66,40 @@ static BOOL SOFTPUB_OpenFile(CRYPT_PROVIDER_DATA *data)
return ret; return ret;
} }
/* Assumes data->pWintrustData->pFile exists. Sets data->pPDSip->gSubject to /* Assumes data->pWintrustData->u.pFile exists. Sets data->pPDSip->gSubject to
* the file's subject GUID. * the file's subject GUID.
*/ */
static BOOL SOFTPUB_GetFileSubject(CRYPT_PROVIDER_DATA *data) static BOOL SOFTPUB_GetFileSubject(CRYPT_PROVIDER_DATA *data)
{ {
BOOL ret; BOOL ret;
if (!data->pWintrustData->pFile->pgKnownSubject) if (!data->pWintrustData->u.pFile->pgKnownSubject)
{ {
ret = CryptSIPRetrieveSubjectGuid( ret = CryptSIPRetrieveSubjectGuid(
data->pWintrustData->pFile->pcwszFilePath, data->pWintrustData->u.pFile->pcwszFilePath,
data->pWintrustData->pFile->hFile, data->pWintrustData->u.pFile->hFile,
&data->pPDSip->gSubject); &data->u.pPDSip->gSubject);
} }
else else
{ {
memcpy(&data->pPDSip->gSubject, memcpy(&data->u.pPDSip->gSubject,
data->pWintrustData->pFile->pgKnownSubject, sizeof(GUID)); data->pWintrustData->u.pFile->pgKnownSubject, sizeof(GUID));
ret = TRUE; ret = TRUE;
} }
TRACE("returning %d\n", ret); TRACE("returning %d\n", ret);
return ret; return ret;
} }
/* Assumes data->pPDSip exists, and its gSubject member set. /* Assumes data->u.pPDSip exists, and its gSubject member set.
* Allocates data->pPDSip->pSip and loads it, if possible. * Allocates data->u.pPDSip->pSip and loads it, if possible.
*/ */
static BOOL SOFTPUB_GetSIP(CRYPT_PROVIDER_DATA *data) static BOOL SOFTPUB_GetSIP(CRYPT_PROVIDER_DATA *data)
{ {
BOOL ret; BOOL ret;
data->pPDSip->pSip = data->psPfns->pfnAlloc(sizeof(SIP_DISPATCH_INFO)); data->u.pPDSip->pSip = data->psPfns->pfnAlloc(sizeof(SIP_DISPATCH_INFO));
if (data->pPDSip->pSip) if (data->u.pPDSip->pSip)
ret = CryptSIPLoad(&data->pPDSip->gSubject, 0, data->pPDSip->pSip); ret = CryptSIPLoad(&data->u.pPDSip->gSubject, 0, data->u.pPDSip->pSip);
else else
{ {
SetLastError(ERROR_OUTOFMEMORY); SetLastError(ERROR_OUTOFMEMORY);
...@@ -106,8 +109,8 @@ static BOOL SOFTPUB_GetSIP(CRYPT_PROVIDER_DATA *data) ...@@ -106,8 +109,8 @@ static BOOL SOFTPUB_GetSIP(CRYPT_PROVIDER_DATA *data)
return ret; return ret;
} }
/* Assumes data->pPDSip has been loaded, and data->pPDSip->pSip allocated. /* Assumes data->u.pPDSip has been loaded, and data->u.pPDSip->pSip allocated.
* Calls data->pPDSip->pSip->pfGet to construct data->hMsg. * Calls data->u.pPDSip->pSip->pfGet to construct data->hMsg.
*/ */
static BOOL SOFTPUB_GetMessageFromFile(CRYPT_PROVIDER_DATA *data) static BOOL SOFTPUB_GetMessageFromFile(CRYPT_PROVIDER_DATA *data)
{ {
...@@ -115,21 +118,21 @@ static BOOL SOFTPUB_GetMessageFromFile(CRYPT_PROVIDER_DATA *data) ...@@ -115,21 +118,21 @@ static BOOL SOFTPUB_GetMessageFromFile(CRYPT_PROVIDER_DATA *data)
LPBYTE buf = NULL; LPBYTE buf = NULL;
DWORD size = 0; DWORD size = 0;
data->pPDSip->psSipSubjectInfo = data->u.pPDSip->psSipSubjectInfo =
data->psPfns->pfnAlloc(sizeof(SIP_SUBJECTINFO)); data->psPfns->pfnAlloc(sizeof(SIP_SUBJECTINFO));
if (!data->pPDSip->psSipSubjectInfo) if (!data->u.pPDSip->psSipSubjectInfo)
{ {
SetLastError(ERROR_OUTOFMEMORY); SetLastError(ERROR_OUTOFMEMORY);
return FALSE; return FALSE;
} }
data->pPDSip->psSipSubjectInfo->cbSize = sizeof(SIP_SUBJECTINFO); data->u.pPDSip->psSipSubjectInfo->cbSize = sizeof(SIP_SUBJECTINFO);
data->pPDSip->psSipSubjectInfo->pgSubjectType = &data->pPDSip->gSubject; data->u.pPDSip->psSipSubjectInfo->pgSubjectType = &data->u.pPDSip->gSubject;
data->pPDSip->psSipSubjectInfo->hFile = data->pWintrustData->pFile->hFile; data->u.pPDSip->psSipSubjectInfo->hFile = data->pWintrustData->u.pFile->hFile;
data->pPDSip->psSipSubjectInfo->pwsFileName = data->u.pPDSip->psSipSubjectInfo->pwsFileName =
data->pWintrustData->pFile->pcwszFilePath; data->pWintrustData->u.pFile->pcwszFilePath;
data->pPDSip->psSipSubjectInfo->hProv = data->hProv; data->u.pPDSip->psSipSubjectInfo->hProv = data->hProv;
ret = data->pPDSip->pSip->pfGet(data->pPDSip->psSipSubjectInfo, ret = data->u.pPDSip->pSip->pfGet(data->u.pPDSip->psSipSubjectInfo,
&data->dwEncoding, 0, &size, 0); &data->dwEncoding, 0, &size, 0);
if (!ret) if (!ret)
{ {
...@@ -144,7 +147,7 @@ static BOOL SOFTPUB_GetMessageFromFile(CRYPT_PROVIDER_DATA *data) ...@@ -144,7 +147,7 @@ static BOOL SOFTPUB_GetMessageFromFile(CRYPT_PROVIDER_DATA *data)
return FALSE; return FALSE;
} }
ret = data->pPDSip->pSip->pfGet(data->pPDSip->psSipSubjectInfo, ret = data->u.pPDSip->pSip->pfGet(data->u.pPDSip->psSipSubjectInfo,
&data->dwEncoding, 0, &size, buf); &data->dwEncoding, 0, &size, buf);
if (ret) if (ret)
{ {
...@@ -217,8 +220,8 @@ static DWORD SOFTPUB_DecodeInnerContent(CRYPT_PROVIDER_DATA *data) ...@@ -217,8 +220,8 @@ static DWORD SOFTPUB_DecodeInnerContent(CRYPT_PROVIDER_DATA *data)
SPC_INDIRECT_DATA_CONTENT_STRUCT, buf, size, 0, NULL, &size); SPC_INDIRECT_DATA_CONTENT_STRUCT, buf, size, 0, NULL, &size);
if (!ret) if (!ret)
goto error; goto error;
data->pPDSip->psIndirectData = data->psPfns->pfnAlloc(size); data->u.pPDSip->psIndirectData = data->psPfns->pfnAlloc(size);
if (!data->pPDSip->psIndirectData) if (!data->u.pPDSip->psIndirectData)
{ {
SetLastError(ERROR_OUTOFMEMORY); SetLastError(ERROR_OUTOFMEMORY);
ret = FALSE; ret = FALSE;
...@@ -226,7 +229,7 @@ static DWORD SOFTPUB_DecodeInnerContent(CRYPT_PROVIDER_DATA *data) ...@@ -226,7 +229,7 @@ static DWORD SOFTPUB_DecodeInnerContent(CRYPT_PROVIDER_DATA *data)
} }
ret = CryptDecodeObject(data->dwEncoding, ret = CryptDecodeObject(data->dwEncoding,
SPC_INDIRECT_DATA_CONTENT_STRUCT, buf, size, 0, SPC_INDIRECT_DATA_CONTENT_STRUCT, buf, size, 0,
data->pPDSip->psIndirectData, &size); data->u.pPDSip->psIndirectData, &size);
} }
else else
{ {
...@@ -256,7 +259,7 @@ HRESULT WINAPI SoftpubLoadMessage(CRYPT_PROVIDER_DATA *data) ...@@ -256,7 +259,7 @@ HRESULT WINAPI SoftpubLoadMessage(CRYPT_PROVIDER_DATA *data)
ret = TRUE; ret = TRUE;
break; break;
case WTD_CHOICE_FILE: case WTD_CHOICE_FILE:
if (!data->pWintrustData->pFile) if (!data->pWintrustData->u.pFile)
{ {
SetLastError(ERROR_INVALID_PARAMETER); SetLastError(ERROR_INVALID_PARAMETER);
ret = FALSE; ret = FALSE;
......
...@@ -68,7 +68,7 @@ static void test_encodeSPCLink(void) ...@@ -68,7 +68,7 @@ static void test_encodeSPCLink(void)
LocalFree(buf); LocalFree(buf);
} }
/* With an invalid char: */ /* With an invalid char: */
link.pwszUrl = (LPWSTR)nihongoURL; U(link).pwszUrl = (LPWSTR)nihongoURL;
size = 1; size = 1;
SetLastError(0xdeadbeef); SetLastError(0xdeadbeef);
ret = CryptEncodeObjectEx(X509_ASN_ENCODING, SPC_LINK_STRUCT, &link, ret = CryptEncodeObjectEx(X509_ASN_ENCODING, SPC_LINK_STRUCT, &link,
...@@ -79,7 +79,7 @@ static void test_encodeSPCLink(void) ...@@ -79,7 +79,7 @@ static void test_encodeSPCLink(void)
* index of the first invalid character. * index of the first invalid character.
*/ */
ok(size == 0, "Expected size 0, got %d\n", size); ok(size == 0, "Expected size 0, got %d\n", size);
link.pwszUrl = url; U(link).pwszUrl = url;
ret = CryptEncodeObjectEx(X509_ASN_ENCODING, SPC_LINK_STRUCT, &link, ret = CryptEncodeObjectEx(X509_ASN_ENCODING, SPC_LINK_STRUCT, &link,
CRYPT_ENCODE_ALLOC_FLAG, NULL, &buf, &size); CRYPT_ENCODE_ALLOC_FLAG, NULL, &buf, &size);
ok(ret, "CryptEncodeObjectEx failed: %08x\n", GetLastError()); ok(ret, "CryptEncodeObjectEx failed: %08x\n", GetLastError());
...@@ -90,7 +90,7 @@ static void test_encodeSPCLink(void) ...@@ -90,7 +90,7 @@ static void test_encodeSPCLink(void)
LocalFree(buf); LocalFree(buf);
} }
link.dwLinkChoice = SPC_FILE_LINK_CHOICE; link.dwLinkChoice = SPC_FILE_LINK_CHOICE;
link.pwszFile = (LPWSTR)nihongoURL; U(link).pwszFile = (LPWSTR)nihongoURL;
ret = CryptEncodeObjectEx(X509_ASN_ENCODING, SPC_LINK_STRUCT, &link, ret = CryptEncodeObjectEx(X509_ASN_ENCODING, SPC_LINK_STRUCT, &link,
CRYPT_ENCODE_ALLOC_FLAG, NULL, &buf, &size); CRYPT_ENCODE_ALLOC_FLAG, NULL, &buf, &size);
ok(ret, "CryptEncodeObjectEx failed: %08x\n", GetLastError()); ok(ret, "CryptEncodeObjectEx failed: %08x\n", GetLastError());
...@@ -101,7 +101,7 @@ static void test_encodeSPCLink(void) ...@@ -101,7 +101,7 @@ static void test_encodeSPCLink(void)
LocalFree(buf); LocalFree(buf);
} }
link.dwLinkChoice = SPC_MONIKER_LINK_CHOICE; link.dwLinkChoice = SPC_MONIKER_LINK_CHOICE;
memset(&link.Moniker, 0, sizeof(link.Moniker)); memset(&U(link).Moniker, 0, sizeof(U(link).Moniker));
ret = CryptEncodeObjectEx(X509_ASN_ENCODING, SPC_LINK_STRUCT, &link, ret = CryptEncodeObjectEx(X509_ASN_ENCODING, SPC_LINK_STRUCT, &link,
CRYPT_ENCODE_ALLOC_FLAG, NULL, &buf, &size); CRYPT_ENCODE_ALLOC_FLAG, NULL, &buf, &size);
ok(ret, "CryptEncodeObjectEx failed: %08x\n", GetLastError()); ok(ret, "CryptEncodeObjectEx failed: %08x\n", GetLastError());
...@@ -111,9 +111,9 @@ static void test_encodeSPCLink(void) ...@@ -111,9 +111,9 @@ static void test_encodeSPCLink(void)
ok(!memcmp(buf, emptyMonikerSPCLink, size), "Unexpected value\n"); ok(!memcmp(buf, emptyMonikerSPCLink, size), "Unexpected value\n");
LocalFree(buf); LocalFree(buf);
} }
memset(&link.Moniker.ClassId, 0xea, sizeof(link.Moniker.ClassId)); memset(&U(link).Moniker.ClassId, 0xea, sizeof(U(link).Moniker.ClassId));
link.Moniker.SerializedData.pbData = data; U(link).Moniker.SerializedData.pbData = data;
link.Moniker.SerializedData.cbData = sizeof(data); U(link).Moniker.SerializedData.cbData = sizeof(data);
ret = CryptEncodeObjectEx(X509_ASN_ENCODING, SPC_LINK_STRUCT, &link, ret = CryptEncodeObjectEx(X509_ASN_ENCODING, SPC_LINK_STRUCT, &link,
CRYPT_ENCODE_ALLOC_FLAG, NULL, &buf, &size); CRYPT_ENCODE_ALLOC_FLAG, NULL, &buf, &size);
ok(ret, "CryptEncodeObjectEx failed: %08x\n", GetLastError()); ok(ret, "CryptEncodeObjectEx failed: %08x\n", GetLastError());
...@@ -145,7 +145,7 @@ static void test_decodeSPCLink(void) ...@@ -145,7 +145,7 @@ static void test_decodeSPCLink(void)
link = (SPC_LINK *)buf; link = (SPC_LINK *)buf;
ok(link->dwLinkChoice == SPC_URL_LINK_CHOICE, ok(link->dwLinkChoice == SPC_URL_LINK_CHOICE,
"Expected SPC_URL_LINK_CHOICE, got %d\n", link->dwLinkChoice); "Expected SPC_URL_LINK_CHOICE, got %d\n", link->dwLinkChoice);
ok(lstrlenW(link->pwszUrl) == 0, "Expected empty string\n"); ok(lstrlenW(U(*link).pwszUrl) == 0, "Expected empty string\n");
LocalFree(buf); LocalFree(buf);
} }
ret = CryptDecodeObjectEx(X509_ASN_ENCODING, SPC_LINK_STRUCT, ret = CryptDecodeObjectEx(X509_ASN_ENCODING, SPC_LINK_STRUCT,
...@@ -157,7 +157,7 @@ static void test_decodeSPCLink(void) ...@@ -157,7 +157,7 @@ static void test_decodeSPCLink(void)
link = (SPC_LINK *)buf; link = (SPC_LINK *)buf;
ok(link->dwLinkChoice == SPC_URL_LINK_CHOICE, ok(link->dwLinkChoice == SPC_URL_LINK_CHOICE,
"Expected SPC_URL_LINK_CHOICE, got %d\n", link->dwLinkChoice); "Expected SPC_URL_LINK_CHOICE, got %d\n", link->dwLinkChoice);
ok(!lstrcmpW(link->pwszUrl, url), "Unexpected URL\n"); ok(!lstrcmpW(U(*link).pwszUrl, url), "Unexpected URL\n");
LocalFree(buf); LocalFree(buf);
} }
ret = CryptDecodeObjectEx(X509_ASN_ENCODING, SPC_LINK_STRUCT, ret = CryptDecodeObjectEx(X509_ASN_ENCODING, SPC_LINK_STRUCT,
...@@ -169,7 +169,7 @@ static void test_decodeSPCLink(void) ...@@ -169,7 +169,7 @@ static void test_decodeSPCLink(void)
link = (SPC_LINK *)buf; link = (SPC_LINK *)buf;
ok(link->dwLinkChoice == SPC_FILE_LINK_CHOICE, ok(link->dwLinkChoice == SPC_FILE_LINK_CHOICE,
"Expected SPC_FILE_LINK_CHOICE, got %d\n", link->dwLinkChoice); "Expected SPC_FILE_LINK_CHOICE, got %d\n", link->dwLinkChoice);
ok(!lstrcmpW(link->pwszFile, nihongoURL), "Unexpected file\n"); ok(!lstrcmpW(U(*link).pwszFile, nihongoURL), "Unexpected file\n");
LocalFree(buf); LocalFree(buf);
} }
ret = CryptDecodeObjectEx(X509_ASN_ENCODING, SPC_LINK_STRUCT, ret = CryptDecodeObjectEx(X509_ASN_ENCODING, SPC_LINK_STRUCT,
...@@ -183,9 +183,9 @@ static void test_decodeSPCLink(void) ...@@ -183,9 +183,9 @@ static void test_decodeSPCLink(void)
link = (SPC_LINK *)buf; link = (SPC_LINK *)buf;
ok(link->dwLinkChoice == SPC_MONIKER_LINK_CHOICE, ok(link->dwLinkChoice == SPC_MONIKER_LINK_CHOICE,
"Expected SPC_MONIKER_LINK_CHOICE, got %d\n", link->dwLinkChoice); "Expected SPC_MONIKER_LINK_CHOICE, got %d\n", link->dwLinkChoice);
ok(!memcmp(&link->Moniker.ClassId, &emptyMoniker.ClassId, ok(!memcmp(&U(*link).Moniker.ClassId, &emptyMoniker.ClassId,
sizeof(emptyMoniker.ClassId)), "Unexpected value\n"); sizeof(emptyMoniker.ClassId)), "Unexpected value\n");
ok(link->Moniker.SerializedData.cbData == 0, ok(U(*link).Moniker.SerializedData.cbData == 0,
"Expected no serialized data\n"); "Expected no serialized data\n");
LocalFree(buf); LocalFree(buf);
} }
...@@ -201,11 +201,11 @@ static void test_decodeSPCLink(void) ...@@ -201,11 +201,11 @@ static void test_decodeSPCLink(void)
ok(link->dwLinkChoice == SPC_MONIKER_LINK_CHOICE, ok(link->dwLinkChoice == SPC_MONIKER_LINK_CHOICE,
"Expected SPC_MONIKER_LINK_CHOICE, got %d\n", link->dwLinkChoice); "Expected SPC_MONIKER_LINK_CHOICE, got %d\n", link->dwLinkChoice);
memset(&id, 0xea, sizeof(id)); memset(&id, 0xea, sizeof(id));
ok(!memcmp(&link->Moniker.ClassId, &id, sizeof(id)), ok(!memcmp(&U(*link).Moniker.ClassId, &id, sizeof(id)),
"Unexpected value\n"); "Unexpected value\n");
ok(link->Moniker.SerializedData.cbData == sizeof(data), ok(U(*link).Moniker.SerializedData.cbData == sizeof(data),
"Unexpected data size %d\n", link->Moniker.SerializedData.cbData); "Unexpected data size %d\n", U(*link).Moniker.SerializedData.cbData);
ok(!memcmp(link->Moniker.SerializedData.pbData, data, sizeof(data)), ok(!memcmp(U(*link).Moniker.SerializedData.pbData, data, sizeof(data)),
"Unexpected value\n"); "Unexpected value\n");
LocalFree(buf); LocalFree(buf);
} }
...@@ -311,7 +311,7 @@ static void test_encodeSPCPEImage(void) ...@@ -311,7 +311,7 @@ static void test_encodeSPCPEImage(void)
LocalFree(buf); LocalFree(buf);
} }
/* Finally, a non-empty file: */ /* Finally, a non-empty file: */
link.pwszFile = (LPWSTR)nihongoURL; U(link).pwszFile = (LPWSTR)nihongoURL;
ret = CryptEncodeObjectEx(X509_ASN_ENCODING, SPC_PE_IMAGE_DATA_STRUCT, ret = CryptEncodeObjectEx(X509_ASN_ENCODING, SPC_PE_IMAGE_DATA_STRUCT,
&imageData, CRYPT_ENCODE_ALLOC_FLAG, NULL, &buf, &size); &imageData, CRYPT_ENCODE_ALLOC_FLAG, NULL, &buf, &size);
ok(ret, "CryptEncodeObjectEx failed: %08x\n", GetLastError()); ok(ret, "CryptEncodeObjectEx failed: %08x\n", GetLastError());
...@@ -374,7 +374,7 @@ static void test_decodeSPCPEImage(void) ...@@ -374,7 +374,7 @@ static void test_decodeSPCPEImage(void)
ok(imageData->pFile->dwLinkChoice == SPC_FILE_LINK_CHOICE, ok(imageData->pFile->dwLinkChoice == SPC_FILE_LINK_CHOICE,
"Expected SPC_FILE_LINK_CHOICE, got %d\n", "Expected SPC_FILE_LINK_CHOICE, got %d\n",
imageData->pFile->dwLinkChoice); imageData->pFile->dwLinkChoice);
ok(!lstrcmpW(imageData->pFile->pwszFile, emptyString), ok(!lstrcmpW(U(*imageData->pFile).pwszFile, emptyString),
"Unexpected file\n"); "Unexpected file\n");
} }
LocalFree(buf); LocalFree(buf);
...@@ -397,7 +397,7 @@ static void test_decodeSPCPEImage(void) ...@@ -397,7 +397,7 @@ static void test_decodeSPCPEImage(void)
ok(imageData->pFile->dwLinkChoice == SPC_FILE_LINK_CHOICE, ok(imageData->pFile->dwLinkChoice == SPC_FILE_LINK_CHOICE,
"Expected SPC_FILE_LINK_CHOICE, got %d\n", "Expected SPC_FILE_LINK_CHOICE, got %d\n",
imageData->pFile->dwLinkChoice); imageData->pFile->dwLinkChoice);
ok(!lstrcmpW(imageData->pFile->pwszFile, emptyString), ok(!lstrcmpW(U(*imageData->pFile).pwszFile, emptyString),
"Unexpected file\n"); "Unexpected file\n");
} }
LocalFree(buf); LocalFree(buf);
...@@ -420,7 +420,7 @@ static void test_decodeSPCPEImage(void) ...@@ -420,7 +420,7 @@ static void test_decodeSPCPEImage(void)
ok(imageData->pFile->dwLinkChoice == SPC_FILE_LINK_CHOICE, ok(imageData->pFile->dwLinkChoice == SPC_FILE_LINK_CHOICE,
"Expected SPC_FILE_LINK_CHOICE, got %d\n", "Expected SPC_FILE_LINK_CHOICE, got %d\n",
imageData->pFile->dwLinkChoice); imageData->pFile->dwLinkChoice);
ok(!lstrcmpW(imageData->pFile->pwszFile, nihongoURL), ok(!lstrcmpW(U(*imageData->pFile).pwszFile, nihongoURL),
"Unexpected file\n"); "Unexpected file\n");
} }
LocalFree(buf); LocalFree(buf);
......
...@@ -263,7 +263,7 @@ static void testObjTrust(SAFE_PROVIDER_FUNCTIONS *funcs, GUID *actionID) ...@@ -263,7 +263,7 @@ static void testObjTrust(SAFE_PROVIDER_FUNCTIONS *funcs, GUID *actionID)
ERROR_INVALID_PARAMETER, ERROR_INVALID_PARAMETER,
"Expected ERROR_INVALID_PARAMETER, got %08x\n", "Expected ERROR_INVALID_PARAMETER, got %08x\n",
data.padwTrustStepErrors[TRUSTERROR_STEP_FINAL_OBJPROV]); data.padwTrustStepErrors[TRUSTERROR_STEP_FINAL_OBJPROV]);
wintrust_data.pCert = &certInfo; U(wintrust_data).pCert = &certInfo;
wintrust_data.dwUnionChoice = WTD_CHOICE_CERT; wintrust_data.dwUnionChoice = WTD_CHOICE_CERT;
ret = funcs->pfnObjectTrust(&data); ret = funcs->pfnObjectTrust(&data);
ok(ret == S_OK, "Expected S_OK, got %08x\n", ret); ok(ret == S_OK, "Expected S_OK, got %08x\n", ret);
...@@ -274,14 +274,14 @@ static void testObjTrust(SAFE_PROVIDER_FUNCTIONS *funcs, GUID *actionID) ...@@ -274,14 +274,14 @@ static void testObjTrust(SAFE_PROVIDER_FUNCTIONS *funcs, GUID *actionID)
CertFreeCertificateContext(certInfo.psCertContext); CertFreeCertificateContext(certInfo.psCertContext);
certInfo.psCertContext = NULL; certInfo.psCertContext = NULL;
wintrust_data.dwUnionChoice = WTD_CHOICE_FILE; wintrust_data.dwUnionChoice = WTD_CHOICE_FILE;
wintrust_data.pFile = NULL; U(wintrust_data).pFile = NULL;
ret = funcs->pfnObjectTrust(&data); ret = funcs->pfnObjectTrust(&data);
ok(ret == S_FALSE, "Expected S_FALSE, got %08x\n", ret); ok(ret == S_FALSE, "Expected S_FALSE, got %08x\n", ret);
ok(data.padwTrustStepErrors[TRUSTERROR_STEP_FINAL_OBJPROV] == ok(data.padwTrustStepErrors[TRUSTERROR_STEP_FINAL_OBJPROV] ==
ERROR_INVALID_PARAMETER, ERROR_INVALID_PARAMETER,
"Expected ERROR_INVALID_PARAMETER, got %08x\n", "Expected ERROR_INVALID_PARAMETER, got %08x\n",
data.padwTrustStepErrors[TRUSTERROR_STEP_FINAL_OBJPROV]); data.padwTrustStepErrors[TRUSTERROR_STEP_FINAL_OBJPROV]);
wintrust_data.pFile = &fileInfo; U(wintrust_data).pFile = &fileInfo;
/* Crashes /* Crashes
ret = funcs->pfnObjectTrust(&data); ret = funcs->pfnObjectTrust(&data);
*/ */
...@@ -289,7 +289,7 @@ static void testObjTrust(SAFE_PROVIDER_FUNCTIONS *funcs, GUID *actionID) ...@@ -289,7 +289,7 @@ static void testObjTrust(SAFE_PROVIDER_FUNCTIONS *funcs, GUID *actionID)
lstrcatW(notepadPath, notepad); lstrcatW(notepadPath, notepad);
fileInfo.pcwszFilePath = notepadPath; fileInfo.pcwszFilePath = notepadPath;
/* pfnObjectTrust now crashes unless both pPDSip and psPfns are set */ /* pfnObjectTrust now crashes unless both pPDSip and psPfns are set */
data.pPDSip = &provDataSIP; U(data).pPDSip = &provDataSIP;
data.psPfns = (CRYPT_PROVIDER_FUNCTIONS *)funcs; data.psPfns = (CRYPT_PROVIDER_FUNCTIONS *)funcs;
ret = funcs->pfnObjectTrust(&data); ret = funcs->pfnObjectTrust(&data);
ok(ret == S_FALSE, "Expected S_FALSE, got %08x\n", ret); ok(ret == S_FALSE, "Expected S_FALSE, got %08x\n", ret);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment