From d1bf5e1c71af432ccc24371a3611dc33edb7361f Mon Sep 17 00:00:00 2001 From: Ladislav Zezula Date: Wed, 4 Dec 2024 09:16:28 +0100 Subject: Changed behavior of patched files with MPQ_FLAG_DELETE_MARKER --- src/SFileOpenFileEx.cpp | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'src/SFileOpenFileEx.cpp') 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 -- cgit v1.2.3