From b47bb8b1909e35e086cff00b64e1b0b60d68156f Mon Sep 17 00:00:00 2001 From: Ladislav Zezula Date: Sun, 21 Apr 2024 21:24:48 +0200 Subject: Regression tests complete --- src/SBaseFileTable.cpp | 2 +- test/StormTest.cpp | 36 +++++++++++++++++++++++++++++------- 2 files changed, 30 insertions(+), 8 deletions(-) diff --git a/src/SBaseFileTable.cpp b/src/SBaseFileTable.cpp index 1ed8140..0461be2 100644 --- a/src/SBaseFileTable.cpp +++ b/src/SBaseFileTable.cpp @@ -574,7 +574,7 @@ DWORD ConvertMpqHeaderToFormat4( // Fill the rest of the header with zeros memset((LPBYTE)pHeader + MPQ_HEADER_SIZE_V2, 0, sizeof(TMPQHeader) - MPQ_HEADER_SIZE_V2); - // Check position of the Hi-block table + // Check position of the hi-block table if(pHeader->HiBlockTablePos64 > FileSize) return ERROR_FILE_CORRUPT; diff --git a/test/StormTest.cpp b/test/StormTest.cpp index 3c8051e..fc84589 100755 --- a/test/StormTest.cpp +++ b/test/StormTest.cpp @@ -3785,14 +3785,36 @@ static DWORD TestReplaceFile(LPCTSTR szMpqPlainName, LPCTSTR szFilePlainName, LP return dwErrCode; } +typedef uint8_t u8; +typedef uint16_t u16; +typedef uint32_t u32; +typedef ULONGLONG u64; +typedef unsigned int usize; +typedef char i8; +typedef short i16; +typedef int i32; +typedef LONGLONG i64; +typedef int isize; +typedef float f32; +typedef double f64; + static void Test_PlayingSpace() { - HANDLE hMpq = NULL; - - if(SFileOpenArchive(_T("e:\\poc24"), 0, 0, &hMpq)) - { - SFileCloseArchive(hMpq); - } +/* + i8 v0_tmp[] = {3, 31, -86, 93, 105, -118, -9, -9, 65, 31, 111, 123, -36, 45, -4, -113, 70, 111, -118, 65, 31, 122, 127, 6, -97, 36, 69, 117, 67, 106, -37, 64, 41, 64, -18, 120, -48, -61, -121, 43, 66, 31, 37, -6, -33, 40, 93, -98, 38, 106, 62, -71, 44, -110, 122, 37, 37, -50, -65, 98, 80, 12, 89, 74, -89, 21, -42, -99, -24, 112, 89, 83, 87, -30, 65, 103, -46, -118, 64, 96, 89, -1, -77, 4, 63, 102, -69, -120, -40, 66, -64, 16, 12, 29, -18, -121, 98, -41, 47, 68, 28, -28, 116, -79, 113, -77, -35, -54, -25, -5, 19, -2, 15, 62, 55, -59, -21, -28, -96, -94, -118, 19, 125, 102, 54, 20, 70, 0,}; // pvOutBuffer + i8 * v0 = (i8 *)HeapAlloc(GetProcessHeap(), 0, sizeof(v0_tmp)); + memcpy(v0, v0_tmp, sizeof v0_tmp); + i8 * v1 = v0; // pvOutBuffer + i32 v2_tmp[] = {129, 0,}; // pcbOutBuffer + i32 * v2 = (i32 *)HeapAlloc(GetProcessHeap(), 0, sizeof(v2_tmp)); + memcpy(v2, v2_tmp, sizeof v2_tmp); + i32 * v3 = v2; // pcbOutBuffer + i8 v4_tmp[] = {38, 17, 14, -64, 78, 79, -10, 115, 120, 103, 94, 9, 6, 21, 25, 43, 127, -17, -115, 118, 53, 76, 13, -105, 39, -11, -12, -35, -74, -114, -112, 75, 54, -100, -44, 68, 61, 7, 85, 96, 103, 103, 106, -95, -85, -113, -78, -78, 43, -39, 59, -58, -15, 35, -63, 125, -5, -13, 110, -66, -39, -97, -23, 37, -25, -105, -57, -128, 77, 7, 54, 95, 116, -128, -114, 13, -54, -17, 12, 126, -102, -83, 101, -103, -17, 78, 40, -103, -75, -55, -86, 23, 24, 87, -73, -123, 107, 112, -30, -77, -16, 93, -49, 84, -109, 78, 106, 62, -68, -61, 4, -121, 112, 94, 36, -39, 9, -59, 123, -49, -91, -111, -2, 32, 117, 30, 23, 0, 0,}; // pvInBuffer + i8 * v4 = (i8 *)HeapAlloc(GetProcessHeap(), 0, sizeof(v4_tmp)); + memcpy(v4, v4_tmp, sizeof v4_tmp); + + SCompCompress(v1, v3, v4, 128, 8, 122, 57); // $target +*/ } //----------------------------------------------------------------------------- @@ -4036,7 +4058,7 @@ static const TEST_INFO1 Test_OpenMpqs[] = {_T("MPQ_2023_v1_BroodWarMap.scx"), NULL, "dd3afa3c2f5e562ce3ca91c0c605a71f", 3}, // Brood War map from StarCraft: Brood War 1.16 {_T("MPQ_2023_v1_Volcanis.scm"), NULL, "522c89ca96d6736427b01f7c80dd626f", 3}, // Map modified with unusual file compression: ZLIB+Huffman {_T("MPQ_2023_v4_UTF8.s2ma"), NULL, "97b7a686650f3307d135e1d1b017a36a", 67}, // Map contaning files with Chinese names (UTF8-encoded) - {_T("MPQ_2023_v1_GreenTD.w3x"), NULL, "477af4ddf11eead1412d7c87cb81b530", 2004}, // Corrupt sector checksum table in file #A0 + {_T("MPQ_2023_v1_GreenTD.w3x"), NULL, "a8d91fc4e52d7c21ff7feb498c74781a", 2004}, // Corrupt sector checksum table in file #A0 {_T("MPQ_2023_v4_1F644C5A.SC2Replay"), NULL, "b225828ffbf5037553e6a1290187caab", 17}, // Corrupt patch info of the "(attributes)" file {_T(""), NULL, "67faeffd0c0aece205ac8b7282d8ad8e", 4697, &MpqUtf8}, // Chinese name of the MPQ -- cgit v1.2.3