Skip to content

Commit

Permalink
修复了在 Steam Proton 中无法使用的问题
Browse files Browse the repository at this point in the history
  • Loading branch information
LanbingIce committed Dec 24, 2023
1 parent a047603 commit 4e3bc1a
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 2 deletions.
11 changes: 10 additions & 1 deletion IsaacSocket/Main.cs
Original file line number Diff line number Diff line change
Expand Up @@ -342,6 +342,15 @@ private async Task UpdateTask(CancellationToken cancellationToken)

if (sendAddress != 0 && receiveAddress != 0)
{
try
{
using (MemoryMappedFile.OpenExisting("IsaacSocketSharedMemory")) { }
}
catch (FileNotFoundException)
{
callback.Invoke(CallbackType.MESSAGE, $"注入dll{(InjectCode(isaacProcessHandle) ? "成功" : "失败")} ");
}

try
{
using MemoryMappedFile mmf = MemoryMappedFile.OpenExisting("IsaacSocketSharedMemory");
Expand All @@ -354,7 +363,7 @@ private async Task UpdateTask(CancellationToken cancellationToken)
}
catch (FileNotFoundException)
{
callback.Invoke(CallbackType.MESSAGE, $"注入dll{(InjectCode(isaacProcessHandle) ? "成功" : "失败")} ");
callback.Invoke(CallbackType.MESSAGE, "打开共享内存失败 ");
}
}
else
Expand Down
2 changes: 1 addition & 1 deletion IsaacSocket/Utils/ProcessUtil.cs
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ internal static IntPtr OpenProcess(uint processId)
{


IntPtr processHandle = WinAPIUtil.OpenProcess(WinAPIUtil.ProcessAccessFlags.VMRead | WinAPIUtil.ProcessAccessFlags.VMWrite | WinAPIUtil.ProcessAccessFlags.VMOperation | WinAPIUtil.ProcessAccessFlags.QueryInformation, false, processId);
IntPtr processHandle = WinAPIUtil.OpenProcess(WinAPIUtil.ProcessAccessFlags.VMRead | WinAPIUtil.ProcessAccessFlags.VMWrite | WinAPIUtil.ProcessAccessFlags.VMOperation | WinAPIUtil.ProcessAccessFlags.QueryInformation | WinAPIUtil.ProcessAccessFlags.CreateThread, false, processId);
return processHandle;
}
internal static void CloseProcessHandle(IntPtr processHandle)
Expand Down

0 comments on commit 4e3bc1a

Please sign in to comment.