diff options
author | Ladislav Zezula <zezula@volny.cz> | 2023-06-06 09:54:12 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-06-06 09:54:12 +0200 |
commit | 51ba11c5b78752852023fd6156cd8842c1c3e336 (patch) | |
tree | 161b1c1622d5d43e333bd73272173f83cc6e910e /test | |
parent | 1e436d61fe963d58235af5b898f0e70a18bbb550 (diff) | |
parent | afd304b180607a68edc1613074eeaca5e8805153 (diff) |
Merge pull request #294 from ladislav-zezula/LZ_MemoryCorruption
Fixed loading of corrupt MPQ version 2
Diffstat (limited to 'test')
-rw-r--r-- | test/StormTest.cpp | 27 |
1 files changed, 10 insertions, 17 deletions
diff --git a/test/StormTest.cpp b/test/StormTest.cpp index 2f45e96..82668cf 100644 --- a/test/StormTest.cpp +++ b/test/StormTest.cpp @@ -4183,30 +4183,23 @@ int _tmain(int argc, TCHAR * argv[]) // Initialize storage and mix the random number generator
printf("==== Test Suite for StormLib version %s ====\n", STORMLIB_VERSION_STRING);
dwErrCode = InitializeMpqDirectory(argv, argc);
-/*
+
// Check creation of the MPQ with LZMA compression
- LPCTSTR szArchiveName = _T("E:\\new-mpq.mpq");
+ LPCTSTR szArchiveName = _T("e:\\MemoryCorruption.SC2Replay");
HANDLE hFile = NULL;
HANDLE hMpq = NULL;
-
- DeleteFile(szArchiveName);
- if(SFileCreateArchive(szArchiveName, MPQ_CREATE_ARCHIVE_V2 | MPQ_CREATE_LISTFILE | MPQ_CREATE_ATTRIBUTES, 0x1000, &hMpq))
+/*
+ if(SFileOpenArchive(szArchiveName, 0, 0, &hMpq))
{
- SFileAddFileEx(hMpq, _T("e:\\DlgSearchFile.cpp"), "DlgSearchFile.cpp", MPQ_FILE_SINGLE_UNIT | MPQ_FILE_COMPRESS, MPQ_COMPRESSION_LZMA, MPQ_COMPRESSION_NEXT_SAME);
- SFileCloseArchive(hMpq);
-
- if(SFileOpenArchive(szArchiveName, 0, 0, &hMpq))
+ if(SFileOpenFileEx(hMpq, "DlgSearchFile.cpp", 0, &hFile))
{
- if(SFileOpenFileEx(hMpq, "DlgSearchFile.cpp", 0, &hFile))
- {
- DWORD dwBytesRead = 0;
- BYTE Buffer[0x100];
+ DWORD dwBytesRead = 0;
+ BYTE Buffer[0x100];
- SFileReadFile(hFile, Buffer, sizeof(Buffer), &dwBytesRead, NULL);
- SFileCloseFile(hFile);
- }
- SFileCloseArchive(hMpq);
+ SFileReadFile(hFile, Buffer, sizeof(Buffer), &dwBytesRead, NULL);
+ SFileCloseFile(hFile);
}
+ SFileCloseArchive(hMpq);
}
*/
#ifdef TEST_COMMAND_LINE
|