From 17a7c90245ccd45b6e32d8bbe01a1a3eddeeae4d Mon Sep 17 00:00:00 2001 From: Wither OrNot Date: Thu, 3 Apr 2025 18:22:33 -0400 Subject: [PATCH] miscellaneous fixes --- LibTSforge/Activators/AVMA4K.cs | 2 +- LibTSforge/Common.cs | 9 ++++++--- LibTSforge/SPP/SPPUtils.cs | 4 ++-- LibTSforge/TokenStore/TokenStoreModern.cs | 1 + TSforgeCLI/Program.cs | 2 ++ 5 files changed, 12 insertions(+), 6 deletions(-) diff --git a/LibTSforge/Activators/AVMA4K.cs b/LibTSforge/Activators/AVMA4K.cs index ec09daf..2127652 100644 --- a/LibTSforge/Activators/AVMA4K.cs +++ b/LibTSforge/Activators/AVMA4K.cs @@ -8,7 +8,7 @@ namespace LibTSforge.Activators { public static void Activate(PSVersion version, bool production, Guid actId) { - if (version != PSVersion.WinModern) + if (version != PSVersion.WinModern && version != PSVersion.WinBlue) { throw new NotSupportedException("AVMA licenses are not available for this product."); } diff --git a/LibTSforge/Common.cs b/LibTSforge/Common.cs index b9c274a..4d61770 100644 --- a/LibTSforge/Common.cs +++ b/LibTSforge/Common.cs @@ -183,6 +183,12 @@ namespace LibTSforge public static class Utils { + [DllImport("kernel32.dll")] + public static extern uint GetSystemDefaultLCID(); + + [DllImport("kernel32.dll")] + public static extern bool Wow64EnableWow64FsRedirection(bool Wow64FsEnableRedirection); + public static string DecodeString(byte[] data) { return Encoding.Unicode.GetString(data).Trim('\0'); @@ -193,9 +199,6 @@ namespace LibTSforge return Encoding.Unicode.GetBytes(str + '\0'); } - [DllImport("kernel32.dll")] - public static extern uint GetSystemDefaultLCID(); - public static uint CRC32(byte[] data) { const uint polynomial = 0x04C11DB7; diff --git a/LibTSforge/SPP/SPPUtils.cs b/LibTSforge/SPP/SPPUtils.cs index 1a6ef62..5621305 100644 --- a/LibTSforge/SPP/SPPUtils.cs +++ b/LibTSforge/SPP/SPPUtils.cs @@ -33,7 +33,7 @@ namespace LibTSforge.SPP bool stopped = false; - for (int i = 0; stopped == false && i < 360; i++) + for (int i = 0; stopped == false && i < 1080; i++) { try { @@ -48,7 +48,7 @@ namespace LibTSforge.SPP } catch (InvalidOperationException ex) { - Logger.WriteLine("Warning: Stopping sppsvc failed, retrying. Details:" + ex.Message); + Logger.WriteLine("Warning: Stopping sppsvc failed, retrying. Details: " + ex.Message); System.Threading.Thread.Sleep(500); continue; } diff --git a/LibTSforge/TokenStore/TokenStoreModern.cs b/LibTSforge/TokenStore/TokenStoreModern.cs index cfb35d0..ee51e7a 100644 --- a/LibTSforge/TokenStore/TokenStoreModern.cs +++ b/LibTSforge/TokenStore/TokenStoreModern.cs @@ -30,6 +30,7 @@ namespace LibTSforge.TokenStore BinaryReader reader = new BinaryReader(TokensFile); do { + reader.ReadUInt32(); nextBlock = reader.ReadUInt32(); for (int i = 0; i < ENTRIES_PER_BLOCK; i++) diff --git a/TSforgeCLI/Program.cs b/TSforgeCLI/Program.cs index 865e51d..86945d5 100644 --- a/TSforgeCLI/Program.cs +++ b/TSforgeCLI/Program.cs @@ -35,6 +35,8 @@ namespace TSforgeCLI { Logger.WriteLine("TSforge (c) MASSGRAVE 2025"); + Utils.Wow64EnableWow64FsRedirection(false); + try { if (args.Length == 0)