From b5b9acbaf081034e148f41af28a59ca5e29af282 Mon Sep 17 00:00:00 2001 From: Ladislav Zezula Date: Sun, 13 Mar 2016 16:17:00 +0100 Subject: + Updates --- src/SBaseFileTable.cpp | 6 +++--- src/SFileGetFileInfo.cpp | 11 +++++++++++ src/StormLib.h | 1 + 3 files changed, 15 insertions(+), 3 deletions(-) (limited to 'src') diff --git a/src/SBaseFileTable.cpp b/src/SBaseFileTable.cpp index d822dc7..47bbf0e 100644 --- a/src/SBaseFileTable.cpp +++ b/src/SBaseFileTable.cpp @@ -771,9 +771,6 @@ static int BuildFileTableFromBlockTable( pHashTableEnd = ha->pHashTable + pHeader->dwHashTableSize; for(pHash = ha->pHashTable; pHash < pHashTableEnd; pHash++) { - DWORD dwBlockIndex = pHash->dwBlockIndex; - DWORD dwNewIndex = pHash->dwBlockIndex; - // We need to mask out the upper 4 bits of the block table index. // This is because it gets shifted out when calculating block table offset // BlockTableOffset = pHash->dwBlockIndex * 0x10 @@ -792,6 +789,9 @@ static int BuildFileTableFromBlockTable( if(IsValidHashEntry1(ha, pHash, pBlockTable)) { + DWORD dwBlockIndex = pHash->dwBlockIndex; + DWORD dwNewIndex = pHash->dwBlockIndex; + // Determine the new block index if(DefragmentTable != NULL) { diff --git a/src/SFileGetFileInfo.cpp b/src/SFileGetFileInfo.cpp index 9874793..365dce5 100644 --- a/src/SFileGetFileInfo.cpp +++ b/src/SFileGetFileInfo.cpp @@ -773,6 +773,17 @@ bool WINAPI SFileGetFileInfo( } break; + case SFileInfoCRC32: + hf = IsValidFileHandle(hMpqOrFile); + if(hf != NULL && hf->pFileEntry != NULL) + { + dwInt32Value = hf->pFileEntry->dwCrc32; + pvSrcFileInfo = &dwInt32Value; + cbSrcFileInfo = sizeof(DWORD); + nInfoType = SFILE_INFO_TYPE_DIRECT_POINTER; + } + break; + default: // Invalid info class SetLastError(ERROR_INVALID_PARAMETER); return false; diff --git a/src/StormLib.h b/src/StormLib.h index 8c3f6f9..22658bd 100644 --- a/src/StormLib.h +++ b/src/StormLib.h @@ -435,6 +435,7 @@ typedef enum _SFileInfoClass SFileInfoFlags, // File flags from (DWORD) SFileInfoEncryptionKey, // File encryption key SFileInfoEncryptionKeyRaw, // Unfixed value of the file key + SFileInfoCRC32, // CRC32 of the file } SFileInfoClass; //----------------------------------------------------------------------------- -- cgit v1.2.3