Skip to content

Commit

Permalink
Update to dotnet 8
Browse files Browse the repository at this point in the history
  • Loading branch information
num0005 committed Nov 28, 2024
1 parent 0b0b0be commit 5376537
Show file tree
Hide file tree
Showing 5 changed files with 17 additions and 12 deletions.
2 changes: 1 addition & 1 deletion Launcher/ToolkitLauncher.csproj
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net6.0-windows</TargetFramework>
<TargetFramework>net8.0-windows7.0</TargetFramework>
<OutputType>WinExe</OutputType>
<AssemblyName>Osoyoos</AssemblyName>
<IsWebBootstrapper>false</IsWebBootstrapper>
Expand Down
18 changes: 12 additions & 6 deletions Launcher/Utility/DLLInjector.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down Expand Up @@ -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()}!");
Expand All @@ -348,7 +351,7 @@ int align(int ptr)

// build shell code
List<byte> shellCode = new();
UIntPtr GetOffsetInStructure(int structureOffset)
UIntPtr GetOffsetInStructure(nuint structureOffset)
{
UIntPtr address;

Expand All @@ -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)
{
Expand Down Expand Up @@ -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());
}

Expand Down Expand Up @@ -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)
Expand Down
2 changes: 1 addition & 1 deletion ManagedBlamHelper/ManagedBlamHelper.csproj
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net6.0</TargetFramework>
<TargetFramework>net8.0</TargetFramework>
<OutputType>Library</OutputType>
<HighEntropyVA>false</HighEntropyVA>
<GenerateAssemblyInfo>True</GenerateAssemblyInfo>
Expand Down
3 changes: 1 addition & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.

Expand Down
4 changes: 2 additions & 2 deletions global.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"sdk": {
"version": "6.0.403",
"version": "8.0.307",
"rollForward": "latestMajor",
"allowPrerelease": true
"allowPrerelease": false
}
}

0 comments on commit 5376537

Please sign in to comment.