Skip to content

Commit 40983b5

Browse files
committed
Fixed: Error if Steam Stub bypass ptrs are generated outside 2GB range.
1 parent a822262 commit 40983b5

File tree

3 files changed

+8
-6
lines changed

3 files changed

+8
-6
lines changed

source/Reloaded.Mod.Launcher/Reloaded.Mod.Launcher.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
<UseWPF>true</UseWPF>
88
<AssemblyName>Reloaded-II</AssemblyName>
99
<RootNamespace>Reloaded.Mod.Launcher</RootNamespace>
10-
<Version>1.23.9</Version>
10+
<Version>1.23.10</Version>
1111
<Copyright>Sewer56 ~ $([System.DateTime]::UtcNow.ToString("s")) | $(Version)</Copyright>
1212
<AppendTargetFrameworkToOutputPath>false</AppendTargetFrameworkToOutputPath>
1313
<ApplicationIcon>appicon.ico</ApplicationIcon>

source/Reloaded.Mod.Loader/Reloaded.Mod.Loader.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
1212
<TreatWarningsAsErrors>false</TreatWarningsAsErrors>
1313
<NoWarn>$(NoWarn);NU1605;NU1701</NoWarn>
14-
<Version>1.23.9</Version>
14+
<Version>1.23.10</Version>
1515
<Platforms>x86;x64</Platforms>
1616
<GenerateDepsJson>false</GenerateDepsJson>
1717

source/Reloaded.Mod.Loader/Utilities/DelayInjector.cs

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -22,11 +22,14 @@ public DelayInjector(IReloadedHooks hooks, Action action, Logger logger)
2222

2323
// Allocate space for code to identify entry point from hooks.
2424
// DO NOT CHANGE, UNLESS ALSO CHANGING ASSEMBLY BELOW
25-
_asmEntryDllOrdinal = (int*)NativeMemory.Alloc(sizeof(int) * 2);
26-
_asmEntryFunctionOrdinal = _asmEntryDllOrdinal + 1;
25+
var utils = hooks.Utilities;
26+
27+
// An implementation detail is this will allocate in 0-2GB range needed for our ASM to work.
28+
_asmEntryDllOrdinal = (int*)utils.WritePointer(0);
29+
_asmEntryFunctionOrdinal = (int*)utils.WritePointer(0);
2730

2831
var assemblyFolder = Path.GetDirectoryName(typeof(DelayInjector).Assembly.Location);
29-
var predefinedDllPath = Path.Combine(assemblyFolder, "DelayInjectHooks.json");
32+
var predefinedDllPath = Path.Combine(assemblyFolder!, "DelayInjectHooks.json");
3033

3134
_method = action;
3235
_dlls = JsonSerializer.Deserialize<List<DllEntry>>(File.ReadAllText(predefinedDllPath));
@@ -106,7 +109,6 @@ private void Dispose()
106109
hook.Disable();
107110

108111
_wrappers.Clear();
109-
NativeMemory.Free(_asmEntryDllOrdinal);
110112
}
111113

112114
private struct DllEntry

0 commit comments

Comments
 (0)