Commit 7e9ba76d authored by Juan Lang's avatar Juan Lang Committed by Alexandre Julliard

crypt32: Use the HRESULT synonyms for converted Win32 error codes.

parent 746bf215
...@@ -266,7 +266,7 @@ BOOL WINAPI CryptVerifyCertificateSignatureEx(HCRYPTPROV hCryptProv, ...@@ -266,7 +266,7 @@ BOOL WINAPI CryptVerifyCertificateSignatureEx(HCRYPTPROV hCryptProv,
break; break;
} }
default: default:
SetLastError(HRESULT_FROM_WIN32(ERROR_INVALID_PARAMETER)); SetLastError(E_INVALIDARG);
ret = FALSE; ret = FALSE;
} }
...@@ -301,18 +301,18 @@ BOOL WINAPI CryptVerifyCertificateSignatureEx(HCRYPTPROV hCryptProv, ...@@ -301,18 +301,18 @@ BOOL WINAPI CryptVerifyCertificateSignatureEx(HCRYPTPROV hCryptProv,
case CRYPT_VERIFY_CERT_SIGN_ISSUER_NULL: case CRYPT_VERIFY_CERT_SIGN_ISSUER_NULL:
if (pvIssuer) if (pvIssuer)
{ {
SetLastError(HRESULT_FROM_WIN32(ERROR_INVALID_PARAMETER)); SetLastError(E_INVALIDARG);
ret = FALSE; ret = FALSE;
} }
else else
{ {
FIXME("unimplemented for NULL signer\n"); FIXME("unimplemented for NULL signer\n");
SetLastError(HRESULT_FROM_WIN32(ERROR_INVALID_PARAMETER)); SetLastError(E_INVALIDARG);
ret = FALSE; ret = FALSE;
} }
break; break;
default: default:
SetLastError(HRESULT_FROM_WIN32(ERROR_INVALID_PARAMETER)); SetLastError(E_INVALIDARG);
ret = FALSE; ret = FALSE;
} }
LocalFree(signedCert); LocalFree(signedCert);
......
...@@ -1010,7 +1010,7 @@ static BOOL WINAPI CRYPT_AsnEncodeNameValue(DWORD dwCertEncodingType, ...@@ -1010,7 +1010,7 @@ static BOOL WINAPI CRYPT_AsnEncodeNameValue(DWORD dwCertEncodingType,
break; break;
case CERT_RDN_ANY_TYPE: case CERT_RDN_ANY_TYPE:
/* explicitly disallowed */ /* explicitly disallowed */
SetLastError(HRESULT_FROM_WIN32(ERROR_INVALID_PARAMETER)); SetLastError(E_INVALIDARG);
return FALSE; return FALSE;
default: default:
FIXME("String type %ld unimplemented\n", value->dwValueType); FIXME("String type %ld unimplemented\n", value->dwValueType);
...@@ -1325,7 +1325,7 @@ static BOOL CRYPT_AsnEncodeAltNameEntry(const CERT_ALT_NAME_ENTRY *entry, ...@@ -1325,7 +1325,7 @@ static BOOL CRYPT_AsnEncodeAltNameEntry(const CERT_ALT_NAME_ENTRY *entry,
FIXME("name type %ld unimplemented\n", entry->dwAltNameChoice); FIXME("name type %ld unimplemented\n", entry->dwAltNameChoice);
return FALSE; return FALSE;
default: default:
SetLastError(HRESULT_FROM_WIN32(ERROR_INVALID_PARAMETER)); SetLastError(E_INVALIDARG);
return FALSE; return FALSE;
} }
if (ret) if (ret)
...@@ -1539,7 +1539,7 @@ static BOOL WINAPI CRYPT_AsnEncodeRsaPubKey(DWORD dwCertEncodingType, ...@@ -1539,7 +1539,7 @@ static BOOL WINAPI CRYPT_AsnEncodeRsaPubKey(DWORD dwCertEncodingType,
if (hdr->bType != PUBLICKEYBLOB) if (hdr->bType != PUBLICKEYBLOB)
{ {
SetLastError(HRESULT_FROM_WIN32(ERROR_INVALID_PARAMETER)); SetLastError(E_INVALIDARG);
ret = FALSE; ret = FALSE;
} }
else else
...@@ -2171,7 +2171,7 @@ static BOOL WINAPI CRYPT_AsnEncodeCRLDistPoints(DWORD dwCertEncodingType, ...@@ -2171,7 +2171,7 @@ static BOOL WINAPI CRYPT_AsnEncodeCRLDistPoints(DWORD dwCertEncodingType,
if (!info->cDistPoint) if (!info->cDistPoint)
{ {
SetLastError(HRESULT_FROM_WIN32(ERROR_INVALID_PARAMETER)); SetLastError(E_INVALIDARG);
ret = FALSE; ret = FALSE;
} }
else else
......
...@@ -453,7 +453,7 @@ BOOL WINAPI CryptRegisterOIDFunction(DWORD dwEncodingType, LPCSTR pszFuncName, ...@@ -453,7 +453,7 @@ BOOL WINAPI CryptRegisterOIDFunction(DWORD dwEncodingType, LPCSTR pszFuncName,
*/ */
if (!pszFuncName || !pszOID) if (!pszFuncName || !pszOID)
{ {
SetLastError(HRESULT_FROM_WIN32(ERROR_INVALID_PARAMETER)); SetLastError(E_INVALIDARG);
return FALSE; return FALSE;
} }
......
...@@ -251,7 +251,7 @@ static const WINE_CERT_PROP_HEADER *CRYPT_findPropID(const BYTE *buf, ...@@ -251,7 +251,7 @@ static const WINE_CERT_PROP_HEADER *CRYPT_findPropID(const BYTE *buf,
buf += sizeof(WINE_CERT_PROP_HEADER); buf += sizeof(WINE_CERT_PROP_HEADER);
if (size < hdr->cb) if (size < hdr->cb)
{ {
SetLastError(HRESULT_FROM_WIN32(ERROR_INVALID_PARAMETER)); SetLastError(E_INVALIDARG);
done = TRUE; done = TRUE;
} }
else if (!hdr->propID) else if (!hdr->propID)
...@@ -348,7 +348,7 @@ const void *CRYPT_ReadSerializedElement(const BYTE *pbElement, DWORD cbElement, ...@@ -348,7 +348,7 @@ const void *CRYPT_ReadSerializedElement(const BYTE *pbElement, DWORD cbElement,
contextInterface = &gCTLInterface; contextInterface = &gCTLInterface;
break; break;
default: default:
SetLastError(HRESULT_FROM_WIN32(ERROR_INVALID_PARAMETER)); SetLastError(E_INVALIDARG);
ret = FALSE; ret = FALSE;
} }
if (!hdr) if (!hdr)
...@@ -375,8 +375,7 @@ const void *CRYPT_ReadSerializedElement(const BYTE *pbElement, DWORD cbElement, ...@@ -375,8 +375,7 @@ const void *CRYPT_ReadSerializedElement(const BYTE *pbElement, DWORD cbElement,
pbElement += sizeof(WINE_CERT_PROP_HEADER); pbElement += sizeof(WINE_CERT_PROP_HEADER);
if (cbElement < hdr->cb) if (cbElement < hdr->cb)
{ {
SetLastError(HRESULT_FROM_WIN32( SetLastError(E_INVALIDARG);
ERROR_INVALID_PARAMETER));
ret = FALSE; ret = FALSE;
} }
else if (!hdr->propID) else if (!hdr->propID)
...@@ -492,7 +491,7 @@ BOOL WINAPI CertAddSerializedElementToStore(HCERTSTORE hCertStore, ...@@ -492,7 +491,7 @@ BOOL WINAPI CertAddSerializedElementToStore(HCERTSTORE hCertStore,
contextInterface = &gCTLInterface; contextInterface = &gCTLInterface;
break; break;
default: default:
SetLastError(HRESULT_FROM_WIN32(ERROR_INVALID_PARAMETER)); SetLastError(E_INVALIDARG);
} }
if (contextInterface) if (contextInterface)
{ {
......
...@@ -525,7 +525,7 @@ static BOOL CRYPT_CollectionAddCert(PWINECRYPT_CERTSTORE store, ...@@ -525,7 +525,7 @@ static BOOL CRYPT_CollectionAddCert(PWINECRYPT_CERTSTORE store,
} }
LeaveCriticalSection(&cs->cs); LeaveCriticalSection(&cs->cs);
if (!storeEntry) if (!storeEntry)
SetLastError(HRESULT_FROM_WIN32(ERROR_ACCESS_DENIED)); SetLastError(E_ACCESSDENIED);
} }
if (ppStoreContext && childContext) if (ppStoreContext && childContext)
{ {
...@@ -1410,7 +1410,7 @@ static PWINECRYPT_CERTSTORE CRYPT_SysRegOpenStoreW(HCRYPTPROV hCryptProv, ...@@ -1410,7 +1410,7 @@ static PWINECRYPT_CERTSTORE CRYPT_SysRegOpenStoreW(HCRYPTPROV hCryptProv,
if (!pvPara) if (!pvPara)
{ {
SetLastError(HRESULT_FROM_WIN32(ERROR_INVALID_PARAMETER)); SetLastError(E_INVALIDARG);
return NULL; return NULL;
} }
...@@ -1458,7 +1458,7 @@ static PWINECRYPT_CERTSTORE CRYPT_SysRegOpenStoreW(HCRYPTPROV hCryptProv, ...@@ -1458,7 +1458,7 @@ static PWINECRYPT_CERTSTORE CRYPT_SysRegOpenStoreW(HCRYPTPROV hCryptProv,
debugstr_w(storeName)); debugstr_w(storeName));
return NULL; return NULL;
default: default:
SetLastError(HRESULT_FROM_WIN32(ERROR_INVALID_PARAMETER)); SetLastError(E_INVALIDARG);
return NULL; return NULL;
} }
...@@ -1693,7 +1693,7 @@ HCERTSTORE WINAPI CertOpenSystemStoreA(HCRYPTPROV hProv, ...@@ -1693,7 +1693,7 @@ HCERTSTORE WINAPI CertOpenSystemStoreA(HCRYPTPROV hProv,
{ {
if (!szSubSystemProtocol) if (!szSubSystemProtocol)
{ {
SetLastError(HRESULT_FROM_WIN32(ERROR_INVALID_PARAMETER)); SetLastError(E_INVALIDARG);
return 0; return 0;
} }
return CertOpenStore(CERT_STORE_PROV_SYSTEM_A, 0, hProv, return CertOpenStore(CERT_STORE_PROV_SYSTEM_A, 0, hProv,
...@@ -1705,7 +1705,7 @@ HCERTSTORE WINAPI CertOpenSystemStoreW(HCRYPTPROV hProv, ...@@ -1705,7 +1705,7 @@ HCERTSTORE WINAPI CertOpenSystemStoreW(HCRYPTPROV hProv,
{ {
if (!szSubSystemProtocol) if (!szSubSystemProtocol)
{ {
SetLastError(HRESULT_FROM_WIN32(ERROR_INVALID_PARAMETER)); SetLastError(E_INVALIDARG);
return 0; return 0;
} }
return CertOpenStore(CERT_STORE_PROV_SYSTEM_W, 0, hProv, return CertOpenStore(CERT_STORE_PROV_SYSTEM_W, 0, hProv,
...@@ -1985,7 +1985,7 @@ BOOL WINAPI CertGetCertificateContextProperty(PCCERT_CONTEXT pCertContext, ...@@ -1985,7 +1985,7 @@ BOOL WINAPI CertGetCertificateContextProperty(PCCERT_CONTEXT pCertContext,
case CERT_CERT_PROP_ID: case CERT_CERT_PROP_ID:
case CERT_CRL_PROP_ID: case CERT_CRL_PROP_ID:
case CERT_CTL_PROP_ID: case CERT_CTL_PROP_ID:
SetLastError(HRESULT_FROM_WIN32(ERROR_INVALID_PARAMETER)); SetLastError(E_INVALIDARG);
ret = FALSE; ret = FALSE;
break; break;
case CERT_ACCESS_STATE_PROP_ID: case CERT_ACCESS_STATE_PROP_ID:
...@@ -2172,7 +2172,7 @@ BOOL WINAPI CertSetCertificateContextProperty(PCCERT_CONTEXT pCertContext, ...@@ -2172,7 +2172,7 @@ BOOL WINAPI CertSetCertificateContextProperty(PCCERT_CONTEXT pCertContext,
case CERT_CERT_PROP_ID: case CERT_CERT_PROP_ID:
case CERT_CRL_PROP_ID: case CERT_CRL_PROP_ID:
case CERT_CTL_PROP_ID: case CERT_CTL_PROP_ID:
SetLastError(HRESULT_FROM_WIN32(ERROR_INVALID_PARAMETER)); SetLastError(E_INVALIDARG);
return FALSE; return FALSE;
} }
ret = CertContext_SetProperty((PWINE_CERT_CONTEXT)pCertContext, dwPropId, ret = CertContext_SetProperty((PWINE_CERT_CONTEXT)pCertContext, dwPropId,
...@@ -2716,7 +2716,7 @@ PCCERT_CONTEXT WINAPI CertGetSubjectCertificateFromStore(HCERTSTORE hCertStore, ...@@ -2716,7 +2716,7 @@ PCCERT_CONTEXT WINAPI CertGetSubjectCertificateFromStore(HCERTSTORE hCertStore,
if (!pCertId) if (!pCertId)
{ {
SetLastError(HRESULT_FROM_WIN32(ERROR_INVALID_PARAMETER)); SetLastError(E_INVALIDARG);
return NULL; return NULL;
} }
return CertFindCertificateInStore(hCertStore, dwCertEncodingType, 0, return CertFindCertificateInStore(hCertStore, dwCertEncodingType, 0,
...@@ -2782,17 +2782,17 @@ BOOL WINAPI CertAddStoreToCollection(HCERTSTORE hCollectionStore, ...@@ -2782,17 +2782,17 @@ BOOL WINAPI CertAddStoreToCollection(HCERTSTORE hCollectionStore,
return TRUE; return TRUE;
if (collection->hdr.dwMagic != WINE_CRYPTCERTSTORE_MAGIC) if (collection->hdr.dwMagic != WINE_CRYPTCERTSTORE_MAGIC)
{ {
SetLastError(HRESULT_FROM_WIN32(ERROR_INVALID_PARAMETER)); SetLastError(E_INVALIDARG);
return FALSE; return FALSE;
} }
if (collection->hdr.type != StoreTypeCollection) if (collection->hdr.type != StoreTypeCollection)
{ {
SetLastError(HRESULT_FROM_WIN32(ERROR_INVALID_PARAMETER)); SetLastError(E_INVALIDARG);
return FALSE; return FALSE;
} }
if (sibling->dwMagic != WINE_CRYPTCERTSTORE_MAGIC) if (sibling->dwMagic != WINE_CRYPTCERTSTORE_MAGIC)
{ {
SetLastError(HRESULT_FROM_WIN32(ERROR_INVALID_PARAMETER)); SetLastError(E_INVALIDARG);
return FALSE; return FALSE;
} }
...@@ -2848,14 +2848,14 @@ void WINAPI CertRemoveStoreFromCollection(HCERTSTORE hCollectionStore, ...@@ -2848,14 +2848,14 @@ void WINAPI CertRemoveStoreFromCollection(HCERTSTORE hCollectionStore,
return; return;
if (collection->hdr.dwMagic != WINE_CRYPTCERTSTORE_MAGIC) if (collection->hdr.dwMagic != WINE_CRYPTCERTSTORE_MAGIC)
{ {
SetLastError(HRESULT_FROM_WIN32(ERROR_INVALID_PARAMETER)); SetLastError(E_INVALIDARG);
return; return;
} }
if (collection->hdr.type != StoreTypeCollection) if (collection->hdr.type != StoreTypeCollection)
return; return;
if (sibling->dwMagic != WINE_CRYPTCERTSTORE_MAGIC) if (sibling->dwMagic != WINE_CRYPTCERTSTORE_MAGIC)
{ {
SetLastError(HRESULT_FROM_WIN32(ERROR_INVALID_PARAMETER)); SetLastError(E_INVALIDARG);
return; return;
} }
EnterCriticalSection(&collection->cs); EnterCriticalSection(&collection->cs);
......
...@@ -187,18 +187,15 @@ static void testVerifyCertSig(HCRYPTPROV csp, const CRYPT_DATA_BLOB *toBeSigned, ...@@ -187,18 +187,15 @@ static void testVerifyCertSig(HCRYPTPROV csp, const CRYPT_DATA_BLOB *toBeSigned,
if(pCryptVerifyCertificateSignatureEx) { if(pCryptVerifyCertificateSignatureEx) {
ret = pCryptVerifyCertificateSignatureEx(0, 0, 0, NULL, 0, NULL, 0, NULL); ret = pCryptVerifyCertificateSignatureEx(0, 0, 0, NULL, 0, NULL, 0, NULL);
ok(!ret && GetLastError() == HRESULT_FROM_WIN32(ERROR_INVALID_PARAMETER), ok(!ret && GetLastError() == E_INVALIDARG,
"Expected HRESULT_FROM_WIN32(ERROR_INVALID_PARAMETER), got %08lx\n", "Expected E_INVALIDARG, got %08lx\n", GetLastError());
GetLastError());
ret = pCryptVerifyCertificateSignatureEx(csp, 0, 0, NULL, 0, NULL, 0, NULL); ret = pCryptVerifyCertificateSignatureEx(csp, 0, 0, NULL, 0, NULL, 0, NULL);
ok(!ret && GetLastError() == HRESULT_FROM_WIN32(ERROR_INVALID_PARAMETER), ok(!ret && GetLastError() == E_INVALIDARG,
"Expected HRESULT_FROM_WIN32(ERROR_INVALID_PARAMETER), got %08lx\n", "Expected E_INVALIDARG, got %08lx\n", GetLastError());
GetLastError());
ret = pCryptVerifyCertificateSignatureEx(csp, X509_ASN_ENCODING, 0, NULL, 0, ret = pCryptVerifyCertificateSignatureEx(csp, X509_ASN_ENCODING, 0, NULL, 0,
NULL, 0, NULL); NULL, 0, NULL);
ok(!ret && GetLastError() == HRESULT_FROM_WIN32(ERROR_INVALID_PARAMETER), ok(!ret && GetLastError() == E_INVALIDARG,
"Expected HRESULT_FROM_WIN32(ERROR_INVALID_PARAMETER), got %08lx\n", "Expected E_INVALIDARG, got %08lx\n", GetLastError());
GetLastError());
/* This crashes /* This crashes
ret = pCryptVerifyCertificateSignatureEx(csp, X509_ASN_ENCODING, ret = pCryptVerifyCertificateSignatureEx(csp, X509_ASN_ENCODING,
CRYPT_VERIFY_CERT_SIGN_SUBJECT_BLOB, NULL, 0, NULL, 0, NULL); CRYPT_VERIFY_CERT_SIGN_SUBJECT_BLOB, NULL, 0, NULL, 0, NULL);
...@@ -234,17 +231,13 @@ static void testVerifyCertSig(HCRYPTPROV csp, const CRYPT_DATA_BLOB *toBeSigned, ...@@ -234,17 +231,13 @@ static void testVerifyCertSig(HCRYPTPROV csp, const CRYPT_DATA_BLOB *toBeSigned,
certBlob.pbData = cert; certBlob.pbData = cert;
ret = pCryptVerifyCertificateSignatureEx(csp, X509_ASN_ENCODING, ret = pCryptVerifyCertificateSignatureEx(csp, X509_ASN_ENCODING,
CRYPT_VERIFY_CERT_SIGN_SUBJECT_BLOB, &certBlob, 0, NULL, 0, NULL); CRYPT_VERIFY_CERT_SIGN_SUBJECT_BLOB, &certBlob, 0, NULL, 0, NULL);
ok(!ret && GetLastError() == ok(!ret && GetLastError() == E_INVALIDARG,
HRESULT_FROM_WIN32(ERROR_INVALID_PARAMETER), "Expected E_INVALIDARG, got %08lx\n", GetLastError());
"Expected HRESULT_FROM_WIN32(ERROR_INVALID_PARAMETER), got %08lx\n",
GetLastError());
ret = pCryptVerifyCertificateSignatureEx(csp, X509_ASN_ENCODING, ret = pCryptVerifyCertificateSignatureEx(csp, X509_ASN_ENCODING,
CRYPT_VERIFY_CERT_SIGN_SUBJECT_BLOB, &certBlob, CRYPT_VERIFY_CERT_SIGN_SUBJECT_BLOB, &certBlob,
CRYPT_VERIFY_CERT_SIGN_ISSUER_NULL, NULL, 0, NULL); CRYPT_VERIFY_CERT_SIGN_ISSUER_NULL, NULL, 0, NULL);
ok(!ret && GetLastError() == ok(!ret && GetLastError() == E_INVALIDARG,
HRESULT_FROM_WIN32(ERROR_INVALID_PARAMETER), "Expected E_INVALIDARG, got %08lx\n", GetLastError());
"Expected HRESULT_FROM_WIN32(ERROR_INVALID_PARAMETER), got %08lx\n",
GetLastError());
/* This crashes /* This crashes
ret = pCryptVerifyCertificateSignatureEx(csp, X509_ASN_ENCODING, ret = pCryptVerifyCertificateSignatureEx(csp, X509_ASN_ENCODING,
CRYPT_VERIFY_CERT_SIGN_SUBJECT_BLOB, &certBlob, CRYPT_VERIFY_CERT_SIGN_SUBJECT_BLOB, &certBlob,
......
...@@ -800,8 +800,8 @@ static void test_encodeName(DWORD dwEncoding) ...@@ -800,8 +800,8 @@ static void test_encodeName(DWORD dwEncoding)
attrs[0].dwValueType = CERT_RDN_ANY_TYPE; attrs[0].dwValueType = CERT_RDN_ANY_TYPE;
ret = CryptEncodeObjectEx(dwEncoding, X509_NAME, &info, ret = CryptEncodeObjectEx(dwEncoding, X509_NAME, &info,
CRYPT_ENCODE_ALLOC_FLAG, NULL, (BYTE *)&buf, &size); CRYPT_ENCODE_ALLOC_FLAG, NULL, (BYTE *)&buf, &size);
ok(!ret && GetLastError() == HRESULT_FROM_WIN32(ERROR_INVALID_PARAMETER), ok(!ret && GetLastError() == E_INVALIDARG,
"Expected ERROR_INVALID_PARAMETER, got %08lx\n", GetLastError()); "Expected E_INVALIDARG, got %08lx\n", GetLastError());
for (i = 0; i < sizeof(names) / sizeof(names[0]); i++) for (i = 0; i < sizeof(names) / sizeof(names[0]); i++)
{ {
rdn.cRDNAttr = 1; rdn.cRDNAttr = 1;
...@@ -1028,9 +1028,8 @@ static void test_encodeAltName(DWORD dwEncoding) ...@@ -1028,9 +1028,8 @@ static void test_encodeAltName(DWORD dwEncoding)
info.rgAltEntry = &entry; info.rgAltEntry = &entry;
ret = CryptEncodeObjectEx(dwEncoding, X509_ALTERNATE_NAME, &info, ret = CryptEncodeObjectEx(dwEncoding, X509_ALTERNATE_NAME, &info,
CRYPT_ENCODE_ALLOC_FLAG, NULL, (BYTE *)&buf, &size); CRYPT_ENCODE_ALLOC_FLAG, NULL, (BYTE *)&buf, &size);
ok(!ret && GetLastError() == HRESULT_FROM_WIN32(ERROR_INVALID_PARAMETER), ok(!ret && GetLastError() == E_INVALIDARG,
"Expected HRESULT_FROM_WIN32(ERROR_INVALID_PARAMETER), got %08lx\n", "Expected E_INVALIDARG, got %08lx\n", GetLastError());
GetLastError());
/* Test with an empty pointer */ /* Test with an empty pointer */
entry.dwAltNameChoice = CERT_ALT_NAME_URL; entry.dwAltNameChoice = CERT_ALT_NAME_URL;
ret = CryptEncodeObjectEx(dwEncoding, X509_ALTERNATE_NAME, &info, ret = CryptEncodeObjectEx(dwEncoding, X509_ALTERNATE_NAME, &info,
...@@ -1637,9 +1636,8 @@ static void test_encodeRsaPublicKey(DWORD dwEncoding) ...@@ -1637,9 +1636,8 @@ static void test_encodeRsaPublicKey(DWORD dwEncoding)
ret = CryptEncodeObjectEx(dwEncoding, RSA_CSP_PUBLICKEYBLOB, ret = CryptEncodeObjectEx(dwEncoding, RSA_CSP_PUBLICKEYBLOB,
toEncode, CRYPT_ENCODE_ALLOC_FLAG, NULL, (BYTE *)&buf, toEncode, CRYPT_ENCODE_ALLOC_FLAG, NULL, (BYTE *)&buf,
&bufSize); &bufSize);
ok(!ret && GetLastError() == HRESULT_FROM_WIN32(ERROR_INVALID_PARAMETER), ok(!ret && GetLastError() == E_INVALIDARG,
"Expected HRESULT_FROM_WIN32(ERROR_INVALID_PARAMETER), got %08lx\n", "Expected E_INVALIDARG, got %08lx\n", GetLastError());
GetLastError());
/* Now with a bogus reserved field */ /* Now with a bogus reserved field */
hdr->bType = PUBLICKEYBLOB; hdr->bType = PUBLICKEYBLOB;
hdr->reserved = 1; hdr->reserved = 1;
...@@ -2421,9 +2419,8 @@ static void test_encodeCRLDistPoints(DWORD dwEncoding) ...@@ -2421,9 +2419,8 @@ static void test_encodeCRLDistPoints(DWORD dwEncoding)
/* Test with an empty info */ /* Test with an empty info */
ret = CryptEncodeObjectEx(dwEncoding, X509_CRL_DIST_POINTS, &info, ret = CryptEncodeObjectEx(dwEncoding, X509_CRL_DIST_POINTS, &info,
CRYPT_ENCODE_ALLOC_FLAG, NULL, (BYTE *)&buf, &size); CRYPT_ENCODE_ALLOC_FLAG, NULL, (BYTE *)&buf, &size);
ok(!ret && GetLastError() == HRESULT_FROM_WIN32(ERROR_INVALID_PARAMETER), ok(!ret && GetLastError() == E_INVALIDARG,
"Expected HRESULT_FROM_WIN32(ERROR_INVALID_PARAMETER), got %08lx\n", "Expected E_INVALIDARG, got %08lx\n", GetLastError());
GetLastError());
/* Test with one empty dist point */ /* Test with one empty dist point */
info.cDistPoint = 1; info.cDistPoint = 1;
info.rgDistPoint = &point; info.rgDistPoint = &point;
......
...@@ -244,10 +244,8 @@ static void test_cryptTls(void) ...@@ -244,10 +244,8 @@ static void test_cryptTls(void)
/* Not sure if this fails because TlsFree should fail, so leave as /* Not sure if this fails because TlsFree should fail, so leave as
* todo for now. * todo for now.
*/ */
todo_wine ok(!ret && GetLastError() == todo_wine ok(!ret && GetLastError() == E_INVALIDARG,
HRESULT_FROM_WIN32(ERROR_INVALID_PARAMETER), "Expected E_INVALIDARG, got %08lx\n", GetLastError());
"Expected HRESULT_FROM_WIN32(ERROR_INVALID_PARAMETER), got %08lx\n",
GetLastError());
} }
/* Similar pass, check I_CryptDetachTls */ /* Similar pass, check I_CryptDetachTls */
index = pI_CryptAllocTls(); index = pI_CryptAllocTls();
......
...@@ -273,12 +273,12 @@ static void test_registerOIDFunction(void) ...@@ -273,12 +273,12 @@ static void test_registerOIDFunction(void)
"1.2.3.4.5.6.7.8.9.10", bogusDll, NULL); "1.2.3.4.5.6.7.8.9.10", bogusDll, NULL);
*/ */
/* On windows XP, GetLastError is incorrectly being set with an HRESULT, /* On windows XP, GetLastError is incorrectly being set with an HRESULT,
* HRESULT_FROM_WIN32(ERROR_INVALID_PARAMETER) * E_INVALIDARG
*/ */
ret = CryptRegisterOIDFunction(X509_ASN_ENCODING, "foo", NULL, bogusDll, ret = CryptRegisterOIDFunction(X509_ASN_ENCODING, "foo", NULL, bogusDll,
NULL); NULL);
ok(!ret && GetLastError() == HRESULT_FROM_WIN32(ERROR_INVALID_PARAMETER), ok(!ret && GetLastError() == E_INVALIDARG,
"Expected ERROR_INVALID_PARAMETER: %ld\n", GetLastError()); "Expected E_INVALIDARG: %ld\n", GetLastError());
/* This has no effect, but "succeeds" on XP */ /* This has no effect, but "succeeds" on XP */
ret = CryptRegisterOIDFunction(X509_ASN_ENCODING, "foo", ret = CryptRegisterOIDFunction(X509_ASN_ENCODING, "foo",
"1.2.3.4.5.6.7.8.9.10", NULL, NULL); "1.2.3.4.5.6.7.8.9.10", NULL, NULL);
......
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