aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--StormLib_v08.sln2
-rw-r--r--StormLib_v08.vcproj (renamed from StormLib.vcproj)0
-rw-r--r--src/SFileOpenArchive.cpp2
-rw-r--r--src/StormLib.h5
-rw-r--r--test/StormTest.cpp27
5 files changed, 26 insertions, 10 deletions
diff --git a/StormLib_v08.sln b/StormLib_v08.sln
index 66937b5..71be9d2 100644
--- a/StormLib_v08.sln
+++ b/StormLib_v08.sln
@@ -1,6 +1,6 @@
Microsoft Visual Studio Solution File, Format Version 10.00
# Visual Studio 2008
-Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "StormLib", "StormLib.vcproj", "{78424708-1F6E-4D4B-920C-FB6D26847055}"
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "StormLib", "StormLib_v08.vcproj", "{78424708-1F6E-4D4B-920C-FB6D26847055}"
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "StormLib_dll", "StormLib_dll.vcproj", "{CB385198-50B1-4CF4-883B-11F042DED6AA}"
EndProject
diff --git a/StormLib.vcproj b/StormLib_v08.vcproj
index db947a7..db947a7 100644
--- a/StormLib.vcproj
+++ b/StormLib_v08.vcproj
diff --git a/src/SFileOpenArchive.cpp b/src/SFileOpenArchive.cpp
index 9ed74b4..a951d39 100644
--- a/src/SFileOpenArchive.cpp
+++ b/src/SFileOpenArchive.cpp
@@ -428,7 +428,7 @@ bool WINAPI SFileOpenArchive(
if(pFileEntry != NULL)
{
// Just remember that the archive is weak-signed
- assert(pFileEntry->dwFlags == MPQ_FILE_EXISTS);
+ assert((pFileEntry->dwFlags & MPQ_FILE_EXISTS) != 0);
ha->dwFileFlags3 = pFileEntry->dwFlags;
}
diff --git a/src/StormLib.h b/src/StormLib.h
index 0f0f2a5..8c3f6f9 100644
--- a/src/StormLib.h
+++ b/src/StormLib.h
@@ -213,11 +213,11 @@ extern "C" {
#define MPQ_FILE_DELETE_MARKER 0x02000000 // File is a deletion marker. Used in MPQ patches, indicating that the file no longer exists.
#define MPQ_FILE_SECTOR_CRC 0x04000000 // File has checksums for each sector.
// Ignored if file is not compressed or imploded.
-
-#define MPQ_FILE_COMPRESS_MASK 0x0000FF00 // Mask for a file being compressed
+#define MPQ_FILE_SIGNATURE 0x10000000 // Present on STANDARD.SNP\(signature). The only occurence ever observed
#define MPQ_FILE_EXISTS 0x80000000 // Set if file exists, reset when the file was deleted
#define MPQ_FILE_REPLACEEXISTING 0x80000000 // Replace when the file exist (SFileAddFile)
+#define MPQ_FILE_COMPRESS_MASK 0x0000FF00 // Mask for a file being compressed
#define MPQ_FILE_EXISTS_MASK 0xF00000FF // These must be either zero or MPQ_FILE_EXISTS
#define MPQ_FILE_VALID_FLAGS (MPQ_FILE_IMPLODE | \
@@ -228,6 +228,7 @@ extern "C" {
MPQ_FILE_SINGLE_UNIT | \
MPQ_FILE_DELETE_MARKER | \
MPQ_FILE_SECTOR_CRC | \
+ MPQ_FILE_SIGNATURE | \
MPQ_FILE_EXISTS)
// Compression types for multiple compressions
diff --git a/test/StormTest.cpp b/test/StormTest.cpp
index 685e7de..f2ead09 100644
--- a/test/StormTest.cpp
+++ b/test/StormTest.cpp
@@ -2441,7 +2441,7 @@ static int TestOpenArchive(const char * szPlainName, const char * szListFile = N
Logger.PrintMessage("Failed to add the listfile to the MPQ");
}
- // Attempt to open the listfile and attributes
+ // Attempt to open the (listfile)
if(SFileHasFile(hMpq, LISTFILE_NAME))
{
pFileData = LoadMpqFile(&Logger, hMpq, LISTFILE_NAME);
@@ -2449,7 +2449,7 @@ static int TestOpenArchive(const char * szPlainName, const char * szListFile = N
STORM_FREE(pFileData);
}
- // Attempt to open the listfile and attributes
+ // Attempt to open the (attributes)
if(SFileHasFile(hMpq, ATTRIBUTES_NAME))
{
pFileData = LoadMpqFile(&Logger, hMpq, ATTRIBUTES_NAME);
@@ -2457,6 +2457,14 @@ static int TestOpenArchive(const char * szPlainName, const char * szListFile = N
STORM_FREE(pFileData);
}
+ // Attempt to open the (signature)
+ if(SFileHasFile(hMpq, SIGNATURE_NAME))
+ {
+ pFileData = LoadMpqFile(&Logger, hMpq, SIGNATURE_NAME);
+ if(pFileData != NULL)
+ STORM_FREE(pFileData);
+ }
+
// Search the archive and load every file
dwTestFlags = bIsPartialMpq ? 0 : TEST_FLAG_LOAD_FILES;
nError = SearchArchive(&Logger, hMpq, dwTestFlags, &dwFileCount);
@@ -4176,7 +4184,11 @@ int main(int argc, char * argv[])
// Test working with an archive that has no listfile
if(nError == ERROR_SUCCESS)
nError = TestOpenFile_OpenById("MPQ_1997_v1_Diablo1_DIABDAT.MPQ");
-
+*/
+ // Open a file whose archive's (signature) file has flags = 0x90000000
+ if(nError == ERROR_SUCCESS)
+ nError = TestOpenArchive("MPQ_1997_v1_Diablo1_STANDARD.SNP", "ListFile_Blizzard.txt");
+/*
// Open an empty archive (found in WoW cache - it's just a header)
if(nError == ERROR_SUCCESS)
nError = TestOpenArchive("MPQ_2012_v2_EmptyMpq.MPQ");
@@ -4303,11 +4315,11 @@ int main(int argc, char * argv[])
// Open a patched archive with new format of BSDIFF patch
if(nError == ERROR_SUCCESS)
nError = TestOpenArchive_Patched(PatchList_SC2_34644_Maps, "Maps\\Campaign\\THorner03.SC2Map\\BankList.xml", 3);
-*/
+
// Open a patched archive
if(nError == ERROR_SUCCESS)
nError = TestOpenArchive_Patched(PatchList_SC2_32283_enGB, "LocalizedData\\GameHotkeys.txt", 0, true);
-/*
+
// Open a patched archive where the "StreamingBuckets.txt" is not a patch file
if(nError == ERROR_SUCCESS)
nError = TestOpenArchive_Patched(PatchList_SC2_36281_enGB, "LocalizedData\\GameHotkeys.txt", 6);
@@ -4335,9 +4347,12 @@ int main(int argc, char * argv[])
// Downloadable MPQ archive
if(nError == ERROR_SUCCESS)
nError = TestOpenArchive_MasterMirror("MPQ_2013_v4_alternate-downloaded.MPQ", "MPQ_2013_v4_alternate-original.MPQ", "alternate\\DUNGEONS\\TEXTURES\\ICECROWN\\GATE\\jlo_IceC_Floor_Thrown.blp", false);
-
+*/
// Check archive signature
if(nError == ERROR_SUCCESS)
+ nError = TestOpenArchive_VerifySignature("MPQ_1997_v1_Diablo1_STANDARD.SNP", "STANDARD.SNP");
+/*
+ if(nError == ERROR_SUCCESS)
nError = TestOpenArchive_VerifySignature("MPQ_1999_v1_WeakSignature.exe", "War2Patch_202.exe");
if(nError == ERROR_SUCCESS)