Skip to content

Commit

Permalink
Use workaround for removed CExoString.CStr function.
Browse files Browse the repository at this point in the history
  • Loading branch information
jhett12321 committed Jan 11, 2025
1 parent b7435b5 commit 5e8dc2b
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions NWNX.NET.Tests/src/main/Tests/Hooks/HookTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ namespace NWNX.NET.Tests.Hooks
public sealed class HookTests
{
private static readonly IntPtr CExoDebugInternalWriteToLogFile = NativeLibrary.GetExport(NativeLibrary.GetMainProgramHandle(), "_ZN17CExoDebugInternal14WriteToLogFileERK10CExoString");
private static readonly unsafe delegate* unmanaged<void*, byte*> CExoStringCStr = (delegate* unmanaged<void*, byte*>)NativeLibrary.GetExport(NativeLibrary.GetMainProgramHandle(), "_ZNK10CExoString4CStrEv");

private const int HookOrder = -2000005;

Expand Down Expand Up @@ -49,7 +48,7 @@ public async Task WriteLogFileDelegateHookTest()
private static unsafe void WriteLogFileDelegateHandler(void* pExoDebugInternal, void* pMessage)
{
callCount++;
logMessage = StringUtils.ReadNullTerminatedString(CExoStringCStr(pMessage));
logMessage = StringUtils.ReadNullTerminatedString(*(byte**)pMessage);
}

[Test]
Expand Down Expand Up @@ -79,7 +78,7 @@ public async Task WriteLogFileUnmanagedHookTest()
private static unsafe void WriteLogFileUnmanagedHandler(void* pExoDebugInternal, void* pMessage)
{
callCount++;
logMessage = StringUtils.ReadNullTerminatedString(CExoStringCStr(pMessage));
logMessage = StringUtils.ReadNullTerminatedString(*(byte**)pMessage);
}

[TearDown]
Expand Down

0 comments on commit 5e8dc2b

Please sign in to comment.