diff options
author | Ladislav Zezula <ladislav.zezula@avast.com> | 2023-02-02 00:22:24 +0100 |
---|---|---|
committer | Ladislav Zezula <ladislav.zezula@avast.com> | 2023-02-02 00:22:24 +0100 |
commit | 999ee276cfd7420abaf7566932b591677aff184f (patch) | |
tree | 438a470babc8dc50ce5d18cc38151165b6131e89 /src/SFileVerify.cpp | |
parent | 50f811e59056488ebf153b86ea8cba1d339246e4 (diff) |
Fixed bugs
Diffstat (limited to 'src/SFileVerify.cpp')
-rw-r--r-- | src/SFileVerify.cpp | 17 |
1 files changed, 12 insertions, 5 deletions
diff --git a/src/SFileVerify.cpp b/src/SFileVerify.cpp index 4c8c181..3748918 100644 --- a/src/SFileVerify.cpp +++ b/src/SFileVerify.cpp @@ -801,11 +801,11 @@ DWORD SSignFileCreate(TMPQArchive * ha) // Create the (signature) file file in the MPQ
// Note that the file must not be compressed or encrypted
dwErrCode = SFileAddFile_Init(ha, SIGNATURE_NAME,
- 0,
- sizeof(EmptySignature),
- LANG_NEUTRAL,
- ha->dwFileFlags3 | MPQ_FILE_REPLACEEXISTING,
- &hf);
+ 0,
+ sizeof(EmptySignature),
+ LANG_NEUTRAL,
+ ha->dwFileFlags3 | MPQ_FILE_REPLACEEXISTING,
+ &hf);
// Write the empty signature file to the archive
if(dwErrCode == ERROR_SUCCESS)
@@ -813,6 +813,13 @@ DWORD SSignFileCreate(TMPQArchive * ha) // Write the empty zeroed file to the MPQ
memset(EmptySignature, 0, sizeof(EmptySignature));
dwErrCode = SFileAddFile_Write(hf, EmptySignature, (DWORD)sizeof(EmptySignature), 0);
+ }
+
+ // Finalize the signature
+ if(dwErrCode == ERROR_SUCCESS)
+ {
+ // Clear the CRC as it will not be valid
+ hf->pFileEntry->dwCrc32 = hf->dwCrc32 = 0;
SFileAddFile_Finish(hf);
// Clear the invalid mark
|