Commit 86e2f94e authored by Juan Lang's avatar Juan Lang Committed by Alexandre Julliard

crypt32: Don't claim to have queried an object as a serialized context when reading it has failed.

parent 2b384cb0
......@@ -163,6 +163,7 @@ static BOOL CRYPT_QuerySerializedContextObject(DWORD dwObjectType,
if (!ret)
return FALSE;
ret = FALSE;
context = CRYPT_ReadSerializedElement(blob->pbData, blob->cbData,
CERT_STORE_ALL_CONTEXT_FLAG, &contextType);
if (context)
......@@ -563,6 +564,8 @@ BOOL WINAPI CryptQueryObject(DWORD dwObjectType, const void *pvObject,
dwExpectedContentTypeFlags, pdwMsgAndCertEncodingType, pdwContentType,
phCertStore, phMsg);
}
if (!ret)
SetLastError(CRYPT_E_NO_MATCH);
TRACE("returning %d\n", ret);
return ret;
}
......
......@@ -152,13 +152,13 @@ static void test_query_object(void)
ret = CryptQueryObject(CERT_QUERY_OBJECT_BLOB, &blob,
CERT_QUERY_CONTENT_FLAG_ALL, CERT_QUERY_FORMAT_FLAG_ALL, 0, NULL, NULL,
NULL, NULL, NULL, NULL);
todo_wine
ok(ret, "CryptQueryObject failed: %08x\n", GetLastError());
/* The same base64-encoded cert, restricting the format types */
SetLastError(0xdeadbeef);
ret = CryptQueryObject(CERT_QUERY_OBJECT_BLOB, &blob,
CERT_QUERY_CONTENT_FLAG_ALL, CERT_QUERY_FORMAT_FLAG_BINARY, 0, NULL, NULL,
NULL, NULL, NULL, NULL);
todo_wine
ok(!ret && GetLastError() == CRYPT_E_NO_MATCH,
"expected CRYPT_E_NO_MATCH, got %08x\n", GetLastError());
SetLastError(0xdeadbeef);
......@@ -174,7 +174,6 @@ static void test_query_object(void)
ret = CryptQueryObject(CERT_QUERY_OBJECT_BLOB, &blob,
CERT_QUERY_CONTENT_FLAG_ALL, CERT_QUERY_FORMAT_FLAG_ALL, 0, NULL, NULL,
NULL, NULL, NULL, NULL);
todo_wine
ok(!ret && GetLastError() == CRYPT_E_NO_MATCH,
"expected CRYPT_E_NO_MATCH, got %08x\n", GetLastError());
/* For brevity, not tested here, but tested on Windows: same failure
......@@ -195,6 +194,7 @@ static void test_query_object(void)
ret = CryptQueryObject(CERT_QUERY_OBJECT_BLOB, &blob,
CERT_QUERY_CONTENT_FLAG_ALL, CERT_QUERY_FORMAT_FLAG_ALL, 0, NULL, NULL,
NULL, NULL, NULL, NULL);
todo_wine
ok(ret, "CryptQueryObject failed: %08x\n", GetLastError());
/* A valid signed message, encoded as a wide character base64 string, can
* be queried successfully.
......@@ -205,12 +205,12 @@ static void test_query_object(void)
ret = CryptQueryObject(CERT_QUERY_OBJECT_BLOB, &blob,
CERT_QUERY_CONTENT_FLAG_ALL, CERT_QUERY_FORMAT_FLAG_ALL, 0, NULL, NULL,
NULL, NULL, NULL, NULL);
todo_wine
ok(ret, "CryptQueryObject failed: %08x\n", GetLastError());
SetLastError(0xdeadbeef);
ret = CryptQueryObject(CERT_QUERY_OBJECT_BLOB, &blob,
CERT_QUERY_CONTENT_FLAG_ALL, CERT_QUERY_FORMAT_FLAG_BINARY, 0, NULL, NULL,
NULL, NULL, NULL, NULL);
todo_wine
ok(!ret && GetLastError() == CRYPT_E_NO_MATCH,
"expected CRYPT_E_NO_MATCH, got %08x\n", GetLastError());
SetLastError(0xdeadbeef);
......
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