diff options
| -rw-r--r-- | src/SBaseFileTable.cpp | 18 | ||||
| -rw-r--r-- | test/StormTest.cpp | 10 | 
2 files changed, 17 insertions, 11 deletions
diff --git a/src/SBaseFileTable.cpp b/src/SBaseFileTable.cpp index 47bbf0e..0b01cd0 100644 --- a/src/SBaseFileTable.cpp +++ b/src/SBaseFileTable.cpp @@ -2154,9 +2154,10 @@ static TMPQHash * LoadHashTable(TMPQArchive * ha)      DWORD dwCmpSize;
      bool bHashTableIsCut = false;
 -    // If the MPQ has no hash table, do nothing
 -    if(pHeader->dwHashTablePos == 0 && pHeader->wHashTablePosHi == 0)
 -        return NULL;
 +    // Note: It is allowed to load hash table if it is at offset 0.
 +    // Example: MPQ_2016_v1_ProtectedMap_HashOffsIsZero.w3x
 +//  if(pHeader->dwHashTablePos == 0 && pHeader->wHashTablePosHi == 0)
 +//      return NULL;
      // If the hash table size is zero, do nothing
      if(pHeader->dwHashTableSize == 0)
 @@ -2214,9 +2215,10 @@ TMPQBlock * LoadBlockTable(TMPQArchive * ha, bool /* bDontFixEntries */)      DWORD dwCmpSize;
      bool bBlockTableIsCut = false;
 -    // Do nothing if the block table position is zero
 -    if(pHeader->dwBlockTablePos == 0 && pHeader->wBlockTablePosHi == 0)
 -        return NULL;
 +    // Note: It is possible that the block table starts at offset 0
 +    // Example: MPQ_2016_v1_ProtectedMap_HashOffsIsZero.w3x
 +//  if(pHeader->dwBlockTablePos == 0 && pHeader->wBlockTablePosHi == 0)
 +//      return NULL;
      // Do nothing if the block table size is zero
      if(pHeader->dwBlockTableSize == 0)
 @@ -2311,8 +2313,8 @@ int LoadAnyHashTable(TMPQArchive * ha)      if(pHeader->HetTablePos64 != 0)
          ha->pHetTable = LoadHetTable(ha);
 -    // Try to load the hash table
 -    if(pHeader->wHashTablePosHi || pHeader->dwHashTablePos)
 +    // Try to load classic hash table
 +    if(pHeader->dwHashTableSize)
          ha->pHashTable = LoadHashTable(ha);
      // At least one of the tables must be present
 diff --git a/test/StormTest.cpp b/test/StormTest.cpp index 2f2b272..3b92fd1 100644 --- a/test/StormTest.cpp +++ b/test/StormTest.cpp @@ -4240,11 +4240,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 the update MPQ from Diablo II (patch 2016)
      if(nError == ERROR_SUCCESS)
          nError = TestOpenFile_OpenByName("MPQ_2016_v1_D2XP_IX86_1xx_114a.mpq", "waitingroombkgd.dc6");
 -/*
 +
      // 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");
 @@ -4343,7 +4343,11 @@ int main(int argc, char * argv[])      // Open another protected map
      if(nError == ERROR_SUCCESS)
          nError = TestOpenArchive("MPQ_2016_v1_ProtectedMap_TableSizeOverflow.w3x");
 -
 +*/
 +    // Open another protected map
 +    if(nError == ERROR_SUCCESS)
 +        nError = TestOpenArchive("MPQ_2016_v1_ProtectedMap_HashOffsIsZero.w3x");
 +/*
      // Open the multi-file archive with wrong prefix to see how StormLib deals with it
      if(nError == ERROR_SUCCESS)
          nError = TestOpenArchive_WillFail("flat-file://streaming/model.MPQ.0");
  | 
