diff --git a/dlls/crypt32/sip.c b/dlls/crypt32/sip.c index f8e8be45612..171165a6c6d 100644 --- a/dlls/crypt32/sip.c +++ b/dlls/crypt32/sip.c @@ -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; diff --git a/dlls/crypt32/tests/sip.c b/dlls/crypt32/tests/sip.c index d5d2a507449..80a1323b039 100644 --- a/dlls/crypt32/tests/sip.c +++ b/dlls/crypt32/tests/sip.c @@ -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);