diff --git a/CHANGELOG.md b/CHANGELOG.md index 6cf1739..bdb6e90 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,13 @@ ## v2.x +### v2.2.0 + +Released on 2021-05-15 + +- Update included wimlib to 1.13.4. +- Fix `UpdateProgress` and `VerifyStreamsProgress` marshalling issue (#2). + ### v2.1.0 Released on 2021-04-10 diff --git a/ManagedWimLib.Tests/UpdateTests.cs b/ManagedWimLib.Tests/UpdateTests.cs index 4227610..543efa9 100644 --- a/ManagedWimLib.Tests/UpdateTests.cs +++ b/ManagedWimLib.Tests/UpdateTests.cs @@ -74,6 +74,7 @@ public static CallbackStatus UpdateProgressCallback(ProgressMsg msg, object info tested.Set(); UpdateCommand cmd = m.Command; + Console.WriteLine($"Commands = {m.CompletedCommands}/{m.TotalCommands}"); switch (cmd.Op) { case UpdateOp.Add: diff --git a/ManagedWimLib.Tests/VerifyTests.cs b/ManagedWimLib.Tests/VerifyTests.cs index c66d75d..67a913e 100644 --- a/ManagedWimLib.Tests/VerifyTests.cs +++ b/ManagedWimLib.Tests/VerifyTests.cs @@ -22,6 +22,7 @@ You should have received a copy of the GNU Lesser General Public License */ using Microsoft.VisualStudio.TestTools.UnitTesting; +using System; using System.IO; using System.Linq; @@ -49,12 +50,13 @@ public void VerifyTemplate(string wimFileName, bool result) _checked[i] = false; CallbackStatus ProgressCallback(ProgressMsg msg, object info, object progctx) { + Console.WriteLine($"Callback msg={msg}"); switch (msg) { case ProgressMsg.BeginVerifyImage: { VerifyImageProgress m = (VerifyImageProgress)info; - Assert.IsNotNull(info); + Assert.IsNotNull(m); _checked[0] = true; } @@ -62,7 +64,7 @@ CallbackStatus ProgressCallback(ProgressMsg msg, object info, object progctx) case ProgressMsg.EndVerifyImage: { VerifyImageProgress m = (VerifyImageProgress)info; - Assert.IsNotNull(info); + Assert.IsNotNull(m); _checked[1] = true; } @@ -70,7 +72,8 @@ CallbackStatus ProgressCallback(ProgressMsg msg, object info, object progctx) case ProgressMsg.VerifyStreams: { VerifyStreamsProgress m = (VerifyStreamsProgress)info; - Assert.IsNotNull(info); + Assert.IsNotNull(m); + Console.WriteLine($"Bytes={m.CurrentBytes}/{m.TotalBytes}, {m.CurrentStreams}/{m.TotalStreams}"); _checked[2] = true; } diff --git a/ManagedWimLib/ManagedWimLib.csproj b/ManagedWimLib/ManagedWimLib.csproj index 52ff6c8..d87e993 100644 --- a/ManagedWimLib/ManagedWimLib.csproj +++ b/ManagedWimLib/ManagedWimLib.csproj @@ -6,7 +6,7 @@ ManagedWimLib latest true - 2.1.0 + 2.2.0 Eric Biggers, Hajin Jang Joveler Native wimlib wrapper library for .NET. @@ -17,8 +17,8 @@ Supports Windows, Linux and macOS. https://github.com/ied206/ManagedWimLib images\Logo.png https://github.com/ied206/ManagedWimLib - - Update inlcuded wimlib to 1.13.3. -- Official support for Windows ARM64. + - Update included wimlib to 1.13.4. +- Fix UpdateProgress and VerifyStreamsProgress marshalling issue. wim wimlib dism imagex archive native pinvoke interop diff --git a/ManagedWimLib/NativeStructs.cs b/ManagedWimLib/NativeStructs.cs index e648c33..3ccd36d 100644 --- a/ManagedWimLib/NativeStructs.cs +++ b/ManagedWimLib/NativeStructs.cs @@ -184,6 +184,7 @@ public enum ProgressMsg /// info param will point to . /// This message may be received many times while the WIM file is being written or appended /// to with , . + /// Since wimlib v1.13.4 it will also be received when a split WIM part is being written by . /// WriteStreams = 12, /// @@ -783,6 +784,11 @@ public enum ExtractFlags : uint /// Ntfs = 0x00000001, /// + /// Since wimlib v1.13.4: Don't consider corrupted files to be an error. + /// Just extract them in whatever form we can. + /// + RecoverData = 0x00000002, + /// /// UNIX-like systems only: /// Extract UNIX-specific metadata captured with . /// @@ -1765,6 +1771,7 @@ public RenameCommand(string wimSourcePath, string wimTargetPath) #region struct UpdateCommand32 /// /// 32bit version of real UpdateCommand struct which is passed to the native wimlib. + /// Must be struct (using class crashes the process) /// /// /// Original C struct (wimlib_update_command) contains a union with three structs: Add, Delete and Rename. @@ -1913,6 +1920,7 @@ public UpdateCommand ToManagedClass() #region struct UpdateCommand64 /// /// 64bit version of real UpdateCommand struct which is passed to the native wimlib. + /// Must be struct (using class crashes the process) /// /// /// Original C struct (wimlib_update_command) contains a union with three structs: Add, Delete and Rename. diff --git a/ManagedWimLib/ProgressCallback.cs b/ManagedWimLib/ProgressCallback.cs index 978d30b..10983f7 100644 --- a/ManagedWimLib/ProgressCallback.cs +++ b/ManagedWimLib/ProgressCallback.cs @@ -157,6 +157,7 @@ public class WriteStreamsProgress /// The number of bytes of file data that have been written so far. /// This starts at 0 and ends at TotalBytes. /// This number is the uncompressed size; the actual size may be lower due to compression. + /// See for the compressed size. /// public ulong CompletedBytes; /// @@ -181,6 +182,10 @@ public class WriteStreamsProgress /// This is currently broken and will always be 0. /// public uint CompletedParts; + /// + /// Since wimlib v1.13.4: Like , but counts the compressed size. + /// + public ulong CompletedCompressedBytes; } #endregion @@ -406,11 +411,13 @@ public class UpdateProgress /// /// Number of update commands that have been completed so far. /// - public uint CompletedCommands; + public ulong CompletedCommands => CompletedCommandsVal.ToUInt64(); + internal UIntPtr CompletedCommandsVal; /// /// Number of update commands that are being executed as part of this call to Wim.UpdateImage(). /// - public uint TotalCommands; + public ulong TotalCommands => TotalCommandsVal.ToUInt64(); + internal UIntPtr TotalCommandsVal; } /// @@ -441,20 +448,19 @@ public UpdateCommand Command /// /// Number of update commands that have been completed so far. /// - public uint CompletedCommands; + public UIntPtr CompletedCommandsVal; /// /// Number of update commands that are being executed as part of this call to Wim.UpdateImage(). /// - public uint TotalCommands; + public UIntPtr TotalCommandsVal; - [SuppressMessage("ReSharper", "ArrangeThisQualifier")] public UpdateProgress ToManaged() { return new UpdateProgress { Command = this.Command, - CompletedCommands = this.CompletedCommands, - TotalCommands = this.TotalCommands, + CompletedCommandsVal = this.CompletedCommandsVal, + TotalCommandsVal = this.TotalCommandsVal, }; } } @@ -647,10 +653,10 @@ public class VerifyStreamsProgress { public string WimFile => Wim.Lib.PtrToStringAuto(_wimFilePtr); private IntPtr _wimFilePtr; - public uint TotalStreams; - public uint TotalBytes; - public uint CurrentStreams; - public uint CurrentBytes; + public ulong TotalStreams; + public ulong TotalBytes; + public ulong CurrentStreams; + public ulong CurrentBytes; } #endregion diff --git a/ManagedWimLib/runtimes/linux-arm/native/libwim.so b/ManagedWimLib/runtimes/linux-arm/native/libwim.so index 7b271d5..64a80c8 100644 Binary files a/ManagedWimLib/runtimes/linux-arm/native/libwim.so and b/ManagedWimLib/runtimes/linux-arm/native/libwim.so differ diff --git a/ManagedWimLib/runtimes/linux-arm64/native/libwim.so b/ManagedWimLib/runtimes/linux-arm64/native/libwim.so index 545301f..c9cf3d0 100644 Binary files a/ManagedWimLib/runtimes/linux-arm64/native/libwim.so and b/ManagedWimLib/runtimes/linux-arm64/native/libwim.so differ diff --git a/ManagedWimLib/runtimes/osx-x64/libwim.dylib b/ManagedWimLib/runtimes/osx-x64/libwim.dylib index 351f3bc..12cb1c7 100755 Binary files a/ManagedWimLib/runtimes/osx-x64/libwim.dylib and b/ManagedWimLib/runtimes/osx-x64/libwim.dylib differ diff --git a/ManagedWimLib/runtimes/win-arm64/native/libwim-15.dll b/ManagedWimLib/runtimes/win-arm64/native/libwim-15.dll index 249293e..655f2d2 100644 Binary files a/ManagedWimLib/runtimes/win-arm64/native/libwim-15.dll and b/ManagedWimLib/runtimes/win-arm64/native/libwim-15.dll differ diff --git a/ManagedWimLib/runtimes/win-arm64/native/libwinpthread-1.dll b/ManagedWimLib/runtimes/win-arm64/native/libwinpthread-1.dll index 1dfc0cf..0880dbd 100644 Binary files a/ManagedWimLib/runtimes/win-arm64/native/libwinpthread-1.dll and b/ManagedWimLib/runtimes/win-arm64/native/libwinpthread-1.dll differ diff --git a/ManagedWimLib/runtimes/win-arm64/native/libxml2-2.dll b/ManagedWimLib/runtimes/win-arm64/native/libxml2-2.dll index dac6e8a..5a0033b 100644 Binary files a/ManagedWimLib/runtimes/win-arm64/native/libxml2-2.dll and b/ManagedWimLib/runtimes/win-arm64/native/libxml2-2.dll differ diff --git a/ManagedWimLib/runtimes/win-x64/native/libwim-15.dll b/ManagedWimLib/runtimes/win-x64/native/libwim-15.dll index 1fa4aed..8a17acb 100644 Binary files a/ManagedWimLib/runtimes/win-x64/native/libwim-15.dll and b/ManagedWimLib/runtimes/win-x64/native/libwim-15.dll differ diff --git a/ManagedWimLib/runtimes/win-x86/native/libwim-15.dll b/ManagedWimLib/runtimes/win-x86/native/libwim-15.dll index 42f848a..c4d35a5 100644 Binary files a/ManagedWimLib/runtimes/win-x86/native/libwim-15.dll and b/ManagedWimLib/runtimes/win-x86/native/libwim-15.dll differ diff --git a/README.md b/README.md index ed8f7e8..8753539 100644 --- a/README.md +++ b/README.md @@ -56,7 +56,7 @@ macOS arm64 should be supported on theory, but I do not have access to an Apple ### Supported wimlib version -- 1.13.3 (Included) +- 1.13.4 (Included) ## Usage diff --git a/USAGE.md b/USAGE.md index d94a79a..b14bdca 100644 --- a/USAGE.md +++ b/USAGE.md @@ -32,7 +32,7 @@ public static void InitNativeLibrary() if (!File.Exists(libPath)) throw new PlatformNotSupportedException($"Unable to find native library [{libPath}]."); - Magic.GlobalInit(libPath); + Wim.GlobalInit(libPath, InitFlags.None); } ``` @@ -79,15 +79,17 @@ public static void InitNativeLibrary() if (!File.Exists(libPath)) throw new PlatformNotSupportedException($"Unable to find native library [{libPath}]."); - Magic.GlobalInit(libPath); + Wim.GlobalInit(libPath, InitFlags.None); } ``` +To configure behaviors of wimlib, pass `InitFlags` to `Wim.GlobalInit()`. + **WARNING**: Caller process and callee library must have the same architecture! ### Embedded binary -ManagedWimLib comes with sets of binaries of `wimlib 1.13.3`. They will be copied into the build directory at build time. +ManagedWimLib comes with sets of binaries of `wimlib 1.13.4`. They will be copied into the build directory at build time. #### For .NET Framework 4.5.1+ @@ -112,7 +114,7 @@ ManagedWimLib comes with sets of binaries of `wimlib 1.13.3`. They will be copie - Linux binaries are not portable. Included binaires may not work on your distribution. - On Linux, wimlib depends on system-installed `libfuse`. -- If you call `Wim.GlobalInit()` without `libPath` parameter on Linux or macOS, `ManagedWimLib` will search for system-installed wimlib. +- If you call `Wim.GlobalInit()` without `libPath` parameter on Linux or macOS, `ManagedWimLib` will search for system-installed wimlib. - POSIX binaries were compiled without NTFS-3G support to make them as LGPLv3-licensed. - If you want NTFS-3G functionality, load the system-installed library and make sure your program is compatible with **GPLv3**. diff --git a/native/windows/patch/wimlib-1.13.3-clang-header.patch b/native/windows/patch/wimlib-clang-header.patch similarity index 100% rename from native/windows/patch/wimlib-1.13.3-clang-header.patch rename to native/windows/patch/wimlib-clang-header.patch