Commit 278f806a authored by Juan Lang's avatar Juan Lang Committed by Alexandre Julliard

crypt32: Add test showing only file header is checked for cabinet files.

parent 408f3d96
......@@ -332,7 +332,7 @@ BOOL WINAPI CryptSIPRetrieveSubjectGuid
bRet = TRUE;
goto cleanup1;
}
/* Quick-n-dirty check for a cab file. FIXME: use FDIIsCabinet instead? */
/* Quick-n-dirty check for a cab file. */
if (!memcmp(pMapped, cabHdr, sizeof(cabHdr)))
{
*pgSubject = cabGUID;
......
......@@ -266,6 +266,24 @@ static void test_SIPRetrieveSubjectGUID(void)
/* Clean up */
DeleteFileA(tempfile);
/* Create a file with just the .cab header 'MSCF' */
SetLastError(0xdeadbeef);
file = CreateFileA(tempfile, GENERIC_WRITE, 0, NULL, CREATE_NEW, 0, NULL);
ok(file != INVALID_HANDLE_VALUE, "failed with %u\n", GetLastError());
WriteFile(file, cabFileData, 4, &written, NULL);
CloseHandle(file);
SetLastError(0xdeadbeef);
memset(&subject, 1, sizeof(GUID));
ret = CryptSIPRetrieveSubjectGuid(tempfileW, NULL, &subject);
ok( ret, "CryptSIPRetrieveSubjectGuid failed: %d (0x%08x)\n",
GetLastError(), GetLastError() );
ok ( !memcmp(&subject, &cabGUID, sizeof(GUID)),
"Expected GUID %s for cabinet file, not %s\n", show_guid(&cabGUID, guid1), show_guid(&subject, guid2));
/* Clean up */
DeleteFileA(tempfile);
/* Create a .cab file */
SetLastError(0xdeadbeef);
file = CreateFileA(tempfile, GENERIC_WRITE, 0, NULL, CREATE_NEW, 0, 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