diff options
Diffstat (limited to 'src')
| -rw-r--r-- | src/SBaseCommon.cpp | 26 | ||||
| -rw-r--r-- | src/SFileFindFile.cpp | 2 | ||||
| -rw-r--r-- | src/SFileOpenFileEx.cpp | 8 | ||||
| -rw-r--r-- | src/StormCommon.h | 8 | ||||
| -rw-r--r-- | src/StormLib.h | 7 | 
5 files changed, 48 insertions, 3 deletions
diff --git a/src/SBaseCommon.cpp b/src/SBaseCommon.cpp index 3f95ded..7f2aa8c 100644 --- a/src/SBaseCommon.cpp +++ b/src/SBaseCommon.cpp @@ -1968,3 +1968,29 @@ void ConvertTMPQHeader(void *header, uint16_t version)  }
  #endif  // STORMLIB_LITTLE_ENDIAN
 +
 +//-----------------------------------------------------------------------------
 +// Debug support
 +
 +/*
 +#include <strsafe.h>
 +
 +#if defined(STORMLIB_WINDOWS) && defined(_DEBUG)
 +void SFileLog(const char * format, ...)
 +{
 +    va_list argList;
 +    char * szBuffer;
 +    size_t nLength = 0x1000;
 +
 +    if((szBuffer = STORM_ALLOC(char, 0x1000)) != NULL)
 +    {
 +        va_start(argList, format);
 +        StringCchVPrintfA(szBuffer, nLength, format, argList);
 +        va_end(argList);
 +
 +        OutputDebugStringA(szBuffer);
 +        STORM_FREE(szBuffer);
 +    }
 +}
 +#endif
 +*/
\ No newline at end of file diff --git a/src/SFileFindFile.cpp b/src/SFileFindFile.cpp index b741e5f..8f4849f 100644 --- a/src/SFileFindFile.cpp +++ b/src/SFileFindFile.cpp @@ -352,7 +352,9 @@ static DWORD DoMPQSearch(TMPQSearch * hs, SFILE_FIND_DATA * lpFindFileData)          dwErrCode = (ha->pHashTable != NULL) ? DoMPQSearch_HashTable(hs, lpFindFileData, ha)
                                               : DoMPQSearch_FileTable(hs, lpFindFileData, ha);
          if(dwErrCode == ERROR_SUCCESS)
 +        {
              return dwErrCode;
 +        }
          // If there is no more patches in the chain, stop it.
          // This also keeps hs->ha non-NULL, which is required
 diff --git a/src/SFileOpenFileEx.cpp b/src/SFileOpenFileEx.cpp index 90c7fab..2954669 100644 --- a/src/SFileOpenFileEx.cpp +++ b/src/SFileOpenFileEx.cpp @@ -155,6 +155,14 @@ bool OpenPatchedFile(HANDLE hMpq, const char * szFileName, HANDLE * PtrFile)                      hf = hfPatch;                  }              } + +            // If the opened file has the delete marker, we don't open the file +            if(hfBase && hf && hf->pFileEntry->dwFlags & MPQ_FILE_DELETE_MARKER) +            { +                SFileCloseFile((HANDLE)(hfBase)); +                SetLastError(ERROR_FILE_DELETED); +                hfBase = NULL; +            }          }      }      else diff --git a/src/StormCommon.h b/src/StormCommon.h index 1e67a27..bf82039 100644 --- a/src/StormCommon.h +++ b/src/StormCommon.h @@ -513,5 +513,13 @@ void DumpFileTable(TFileEntry * pFileTable, DWORD dwFileTableSize);  #endif
 +/*
 +#ifdef _DEBUG
 +void SFileLog(const char * format, ...);
 +#else
 +inline void SFileLog(...) {}
 +#endif
 +*/
 +
  #endif // __STORMCOMMON_H__
 diff --git a/src/StormLib.h b/src/StormLib.h index bf884c5..c4542d9 100644 --- a/src/StormLib.h +++ b/src/StormLib.h @@ -102,11 +102,11 @@ extern "C" {  //  Z - S for static-linked CRT library, D for multithreaded DLL CRT library  // -#if defined(__STORMLIB_SELF__) && !defined(STORMLIB_NO_AUTO_LINK) -#define STORMLIB_NO_AUTO_LINK // Define this if you don't want to link using pragmas when using msvc +#if defined(__STORMLIB_SELF__) && !defined(__STORMLIB_NO_STATIC_LINK__) +#define __STORMLIB_NO_STATIC_LINK__ // Define this if you don't want to link using pragmas when using msvc  #endif -#if defined(_MSC_VER) && !defined(STORMLIB_NO_AUTO_LINK) +#if defined(_MSC_VER) && !defined(__STORMLIB_NO_STATIC_LINK__)    #ifndef WDK_BUILD      #ifdef _DEBUG                                 // DEBUG VERSIONS        #ifndef _UNICODE @@ -163,6 +163,7 @@ extern "C" {  #define ERROR_UNKNOWN_FILE_NAMES         10007  // A name of at least one file is unknown  #define ERROR_CANT_FIND_PATCH_PREFIX     10008  // StormLib was unable to find patch prefix for the patches  #define ERROR_FAKE_MPQ_HEADER            10009  // The header at this position is fake header +#define ERROR_FILE_DELETED               10010  // The file is present but contains delete marker  // Values for SFileCreateArchive  #define HASH_TABLE_SIZE_MIN         0x00000004  // Verified: If there is 1 file, hash table size is 4  | 
