From 0d31856af86ac47801ade118ea93092eab62a101 Mon Sep 17 00:00:00 2001 From: Ladislav Zezula Date: Mon, 6 Feb 2023 18:30:15 +0100 Subject: Fixed bug in the LZMA compression --- test/StormTest.cpp | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) (limited to 'test') diff --git a/test/StormTest.cpp b/test/StormTest.cpp index e8a52dc..916eed0 100644 --- a/test/StormTest.cpp +++ b/test/StormTest.cpp @@ -4184,6 +4184,33 @@ int _tmain(int argc, TCHAR * argv[]) 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"); + HANDLE hFile = NULL; + HANDLE hMpq = NULL; + + DeleteFile(szArchiveName); + if(SFileCreateArchive(szArchiveName, MPQ_CREATE_ARCHIVE_V2 | MPQ_CREATE_LISTFILE | MPQ_CREATE_ATTRIBUTES, 0x1000, &hMpq)) + { + SFileAddFileEx(hMpq, _T("e:\\DlgSetFileAssoc.cpp"), "DlgSetFileAssoc.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, "DlgSetFileAssoc.cpp", 0, &hFile)) + { + DWORD dwBytesRead = 0; + BYTE Buffer[0x100]; + + SFileReadFile(hFile, Buffer, sizeof(Buffer), &dwBytesRead, NULL); + SFileCloseFile(hFile); + } + SFileCloseArchive(hMpq); + } + } +*/ + #ifdef TEST_COMMAND_LINE // Test-open MPQs from the command line. They must be plain name // and must be placed in the Test-MPQs folder -- cgit v1.2.3