From d633aaf23d81244be7ef897f293e69aa803c35b1 Mon Sep 17 00:00:00 2001 From: HelloKitty Date: Tue, 19 Jun 2018 17:49:44 -0500 Subject: [PATCH] Fixed incorrect dwMaxFileCount value for SFileCreateArchive So, took alittle awhile to find out why MPQs had an additional 8mb of garbage data at the end of them compared to Ladik's editor. I thought maybe there was a more siginificant fault related to writing the MPQ. In was just a result of SFileCreateArchive in Stormsharplib always passing int.MaxValue even if you provided your own count. This fix address this. --- src/StormLibSharp/MpqArchive.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/StormLibSharp/MpqArchive.cs b/src/StormLibSharp/MpqArchive.cs index 4585dc5..b8a44b1 100644 --- a/src/StormLibSharp/MpqArchive.cs +++ b/src/StormLibSharp/MpqArchive.cs @@ -72,7 +72,7 @@ private MpqArchive(string filePath, MpqArchiveVersion version, MpqFileStreamAttr //if (!NativeMethods.SFileCreateArchive2(filePath, ref create, out _handle)) // throw new Win32Exception(); - if (!NativeMethods.SFileCreateArchive(filePath, (uint)flags, int.MaxValue, out _handle)) + if (!NativeMethods.SFileCreateArchive(filePath, (uint)flags, (uint)maxFileCount, out _handle)) throw new Win32Exception(); }