From 53765377f0396f23ace5cb09a411f7d091249046 Mon Sep 17 00:00:00 2001 From: num0005 Date: Thu, 28 Nov 2024 10:47:26 +0000 Subject: [PATCH] Update to dotnet 8 --- Launcher/ToolkitLauncher.csproj | 2 +- Launcher/Utility/DLLInjector.cs | 18 ++++++++++++------ ManagedBlamHelper/ManagedBlamHelper.csproj | 2 +- README.md | 3 +-- global.json | 4 ++-- 5 files changed, 17 insertions(+), 12 deletions(-) diff --git a/Launcher/ToolkitLauncher.csproj b/Launcher/ToolkitLauncher.csproj index 2198679..c737064 100644 --- a/Launcher/ToolkitLauncher.csproj +++ b/Launcher/ToolkitLauncher.csproj @@ -1,6 +1,6 @@  - net6.0-windows + net8.0-windows7.0 WinExe Osoyoos false diff --git a/Launcher/Utility/DLLInjector.cs b/Launcher/Utility/DLLInjector.cs index cc8df6d..90d3ebd 100644 --- a/Launcher/Utility/DLLInjector.cs +++ b/Launcher/Utility/DLLInjector.cs @@ -294,6 +294,9 @@ int align(int ptr) int dllNamePtrOffset = align(dllNameOffset + 4); int dllNameContents = dllNamePtrOffset + ptrSize; + Debug.Assert(dllNameContents >= 0); + Debug.Assert(dllNamePtrOffset >= 0); + Debug.Assert(dllNamePtrOffset > dllNameContents); int paramtersLengthTotal = dllNameContents + Encoding.Unicode.GetByteCount(dllName) + 2; @@ -332,11 +335,11 @@ int align(int ptr) } shell_code_arguments_addr = new UIntPtr(shell_code_arguments_ptr); - UIntPtr dll_name_process_addr = shell_code_arguments_addr + dllNameContents; + UIntPtr dll_name_process_addr = shell_code_arguments_addr + (nuint)dllNameContents; byte[] dll_name_process_addr_bytes = isWOW64 ? BitConverter.GetBytes(dll_name_process_addr.ToUInt32()) : BitConverter.GetBytes(dll_name_process_addr.ToUInt64()); - if (!WriteProcessMemory((HANDLE)process.Handle, (shell_code_arguments_addr + dllNamePtrOffset).ToPointer(), dll_name_process_addr_bytes, (nuint)dll_name_process_addr_bytes.Length)) + if (!WriteProcessMemory((HANDLE)process.Handle, (shell_code_arguments_addr + (nuint)dllNamePtrOffset).ToPointer(), dll_name_process_addr_bytes, (nuint)dll_name_process_addr_bytes.Length)) { PInvoke.VirtualFreeEx((HANDLE)process.Handle, shell_code_arguments_ptr, 0, VIRTUAL_FREE_TYPE.MEM_RELEASE); Trace.WriteLine($"Failed to write string pointer into remote process - {Marshal.GetLastWin32Error()}!"); @@ -348,7 +351,7 @@ int align(int ptr) // build shell code List shellCode = new(); - UIntPtr GetOffsetInStructure(int structureOffset) + UIntPtr GetOffsetInStructure(nuint structureOffset) { UIntPtr address; @@ -362,7 +365,9 @@ UIntPtr GetOffsetInStructure(int structureOffset) // write a push index into the arguments structure void WritePushSturcture(int structureOffset) { - UIntPtr address = GetOffsetInStructure(structureOffset); + Debug.Assert(structureOffset >= 0); + + UIntPtr address = GetOffsetInStructure((nuint)structureOffset); if (!amd64Bytecode) { @@ -466,7 +471,8 @@ void Amd64SetArgument(int index, UInt64 argument) void Amd64SetArgumentOffset(int index, int structureOffset) { - UIntPtr address = GetOffsetInStructure(structureOffset); + Debug.Assert(structureOffset >= 0); + UIntPtr address = GetOffsetInStructure((nuint)structureOffset); Amd64SetArgument(index, address.ToUInt64()); } @@ -568,7 +574,7 @@ void Amd64SetArgumentOffset(int index, int structureOffset) bool readSuccess; unsafe { fixed (byte* HandleBytesPtr = HandleBytes) - readSuccess = PInvoke.ReadProcessMemory((HANDLE)process.Handle, (shell_code_arguments_addr + returnHandleOffset).ToPointer(), HandleBytesPtr, (nuint)HandleBytes.Length); + readSuccess = PInvoke.ReadProcessMemory((HANDLE)process.Handle, (shell_code_arguments_addr + (nuint)returnHandleOffset).ToPointer(), HandleBytesPtr, (nuint)HandleBytes.Length); } if (!readSuccess) diff --git a/ManagedBlamHelper/ManagedBlamHelper.csproj b/ManagedBlamHelper/ManagedBlamHelper.csproj index 70a8866..982c55e 100644 --- a/ManagedBlamHelper/ManagedBlamHelper.csproj +++ b/ManagedBlamHelper/ManagedBlamHelper.csproj @@ -1,6 +1,6 @@  - net6.0 + net8.0 Library false True diff --git a/README.md b/README.md index 03466fb..97dd0af 100644 --- a/README.md +++ b/README.md @@ -38,8 +38,7 @@ Launcher can do the following: ## Usage -0. Download and install the [.NET 6 Desktop Runtime x64](https://dotnet.microsoft.com/download/dotnet/6.0/runtime). It is *very* important that you download the **64-bit** **Desktop** runtime, otherwise the launcher won't start correctly. For convenience you can use the [direct download link]( https://dotnet.microsoft.com/en-us/download/dotnet/thank-you/runtime-6.0.36-windows-x64-installer) but it might point to an older version as this readme is not regularly revised. - +0. Download and install the latest [.NET 8 Desktop Runtime x64](https://aka.ms/dotnet/8.0/windowsdesktop-runtime-win-x64.exe"). 1. Download and run the launcher executable [from Github releases](https://github.com/num0005/Osoyoos-Launcher/releases). 2. Use the setup dialog and/or profile wizard to setup the paths for all toolkits you wish to use. diff --git a/global.json b/global.json index e6dff98..9149bf7 100644 --- a/global.json +++ b/global.json @@ -1,7 +1,7 @@ { "sdk": { - "version": "6.0.403", + "version": "8.0.307", "rollForward": "latestMajor", - "allowPrerelease": true + "allowPrerelease": false } } \ No newline at end of file