Juan Lang : crypt32: Add test showing only file header is checked for cabinet files.
Alexandre Julliard
julliard at winehq.org
Tue Jul 29 07:16:38 CDT 2008
Module: wine
Branch: master
Commit: 278f806ab7250338b30fa5ad098d9a7bac7def6d
URL: http://source.winehq.org/git/wine.git/?a=commit;h=278f806ab7250338b30fa5ad098d9a7bac7def6d
Author: Juan Lang <juan.lang at gmail.com>
Date: Mon Jul 28 09:47:38 2008 -0700
crypt32: Add test showing only file header is checked for cabinet files.
---
dlls/crypt32/sip.c | 2 +-
dlls/crypt32/tests/sip.c | 18 ++++++++++++++++++
2 files changed, 19 insertions(+), 1 deletions(-)
diff --git a/dlls/crypt32/sip.c b/dlls/crypt32/sip.c
index f8e8be4..171165a 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 d5d2a50..80a1323 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);
More information about the wine-cvs
mailing list