Skip to content

Commit

Permalink
update
Browse files Browse the repository at this point in the history
  • Loading branch information
DubbleClick committed Jan 19, 2025
1 parent f20a168 commit 910fb6d
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 4 deletions.
3 changes: 2 additions & 1 deletion GW Launcher/Memory/GWCAMemory.cs
Original file line number Diff line number Diff line change
Expand Up @@ -351,6 +351,7 @@ public enum LoadModuleResult
MEMORY_NOT_ALLOCATED,
PATH_NOT_WRITTEN,
REMOTE_THREAD_NOT_SPAWNED,
REMOTE_THREAD_DID_NOT_START,
REMOTE_THREAD_DID_NOT_FINISH,
MEMORY_NOT_DEALLOCATED
}
Expand Down Expand Up @@ -402,7 +403,7 @@ public LoadModuleResult LoadModule(string modulepath)
var threadResult = WaitForSingleObject(hThread, 5000u);
if (threadResult is 0x102 or 0xFFFFFFFF /* WAIT_FAILED */)
{
return LoadModuleResult.REMOTE_THREAD_DID_NOT_FINISH;
return LoadModuleResult.REMOTE_THREAD_DID_NOT_START;
}

if (GetExitCodeThread(hThread, out _) == 0)
Expand Down
12 changes: 9 additions & 3 deletions GW Launcher/MulticlientPatch.cs
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,7 @@ private static IntPtr GetProcessModuleBase(IntPtr process)
var loadModuleResult = memory.LoadModule(dll);
if (loadModuleResult != GWCAMemory.LoadModuleResult.SUCCESSFUL)
{
err = GetErrorMessage($"memory.LoadModule({dll})", Marshal.GetLastWin32Error());
err = GetErrorMessage($"Result {loadModuleResult}: memory.LoadModule({dll})", Marshal.GetLastWin32Error());
goto cleanup;
}
}
Expand Down Expand Up @@ -177,8 +177,14 @@ private static IntPtr GetProcessModuleBase(IntPtr process)
cleanup:
if (err != null)
{
process?.Kill();
memory = null;
try
{
process?.Kill();
}
finally
{
memory = null;
}
}
// Make sure to restore the modfile.txt file (blank string if in the gwlauncher dir, whatever was there before if in the gw dir)
if (!modfile.IsNullOrEmpty())
Expand Down

0 comments on commit 910fb6d

Please sign in to comment.