fix finding module

This commit is contained in:
DismissedLight
2024-07-17 10:49:57 +08:00
parent 6863cbb113
commit 6b67811bae
2 changed files with 1 additions and 13 deletions

View File

@@ -1,10 +1,6 @@
// Copyright (c) DGP Studio. All rights reserved.
// Licensed under the MIT license.
using Snap.Hutao.Core.ExceptionService;
using Snap.Hutao.Win32.Foundation;
using static Snap.Hutao.Win32.Kernel32;
namespace Snap.Hutao.Service.Game.Unlocker;
/// <summary>
@@ -62,12 +58,4 @@ internal static class GameFpsAddress
ReadOnlySpan<byte> part = [0xB9, 0x3C, 0x00, 0x00, 0x00, 0xE8];
return span.IndexOf(part);
}
private static unsafe bool UnsafeReadProcessMemory(HANDLE hProcess, nuint baseAddress, out nuint value)
{
value = 0;
bool result = ReadProcessMemory(hProcess, (void*)baseAddress, ref value, out _);
HutaoException.ThrowIfNot(result, SH.ServiceGameUnlockerReadProcessMemoryPointerAddressFailed);
return result;
}
}

View File

@@ -86,7 +86,7 @@ internal static class GameProcessModule
fixed (char* lpBaseName = baseName)
{
ReadOnlySpan<char> baseNameSpan = MemoryMarshal.CreateReadOnlySpanFromNullTerminated(lpBaseName);
if (!moduleName1.SequenceEqual(baseNameSpan) || !moduleName2.SequenceEqual(baseNameSpan))
if (!(moduleName1.SequenceEqual(baseNameSpan) || moduleName2.SequenceEqual(baseNameSpan)))
{
continue;
}