aboutsummaryrefslogtreecommitdiff
path: root/src/SFileVerify.cpp
diff options
context:
space:
mode:
authorunknown <E:\Ladik\Mail>2015-03-13 17:06:51 +0100
committerunknown <E:\Ladik\Mail>2015-03-13 17:06:51 +0100
commitc2261d51033088429ba960879dd4d9731e6f9bc1 (patch)
tree3b4d2e12b505721b3957879430b02e42e12ab1f7 /src/SFileVerify.cpp
parent13c889a84d51692ea3f42e19f04c394bd2caf35d (diff)
+ Support for MPQ.KangTooJee map protector
+ Compacting optimized
Diffstat (limited to 'src/SFileVerify.cpp')
-rw-r--r--src/SFileVerify.cpp17
1 files changed, 6 insertions, 11 deletions
diff --git a/src/SFileVerify.cpp b/src/SFileVerify.cpp
index 8cf138a..cff2a81 100644
--- a/src/SFileVerify.cpp
+++ b/src/SFileVerify.cpp
@@ -787,6 +787,7 @@ int SSignFileCreate(TMPQArchive * ha)
{
// The (signature) file must be non-encrypted and non-compressed
assert(ha->dwFileFlags3 == MPQ_FILE_EXISTS);
+ assert(ha->dwReservedFiles > 0);
// Create the (signature) file file in the MPQ
// Note that the file must not be compressed or encrypted
@@ -800,21 +801,15 @@ int SSignFileCreate(TMPQArchive * ha)
// Write the empty signature file to the archive
if(nError == ERROR_SUCCESS)
{
- // Write the empty zeroed fiel to the MPQ
+ // Write the empty zeroed file to the MPQ
memset(EmptySignature, 0, sizeof(EmptySignature));
nError = SFileAddFile_Write(hf, EmptySignature, (DWORD)sizeof(EmptySignature), 0);
+ SFileAddFile_Finish(hf);
}
- // If the save process succeeded, we clear the MPQ_FLAG_ATTRIBUTE_INVALID flag
- if(nError == ERROR_SUCCESS)
- {
- ha->dwFlags &= ~MPQ_FLAG_SIGNATURE_INVALID;
- ha->dwReservedFiles--;
- }
-
- // Free the file
- if(hf != NULL)
- SFileAddFile_Finish(hf);
+ // Clear the invalid mark
+ ha->dwFlags &= ~MPQ_FLAG_SIGNATURE_INVALID;
+ ha->dwReservedFiles--;
}
return nError;