Hi, i write a dll that is injected on game and return my localplayer and listArrayplayer on server. Ok work fine
code dll project:
__int64 RerturnLocalPlayer() {
__int64 player = GetLocalPlayer_EX(); return player;
}
in my main.h:
extern "C" {
__declspec(dllexport) __int64 RerturnLocalPlayer();
}
in my C# code:
[System.Runtime.InteropServices.DllImportAttribute("my.dll", EntryPoint = "RerturnLocalPlayer",
CallingConvention = System.Runtime.InteropServices.CallingConvention.StdCall)]
public static extern Int64 RerturnLocalPlayer();
Int64 localp = NativeMemory.Read<Int64> (RerturnLocalPlayer());
Console.WriteLine("LocalPlayer " + localp.ToString("X"));
the problem is when i run my c# application my console open and after 3 seconds close and sometimes get error: "
"Attempt to read or write to protected memory. Usually, this is an indication that another memory is damaged.".
"
What I have tried:
__int64 RerturnLocalPlayer() {
__int64 player = GetLocalPlayer_EX(); return player;
}
in my main.h:
extern "C" {
__declspec(dllexport) __int64 RerturnLocalPlayer();
}
[System.Runtime.InteropServices.DllImportAttribute("my.dll", EntryPoint = "RerturnLocalPlayer",
CallingConvention = System.Runtime.InteropServices.CallingConvention.StdCall)]
public static extern Int64 RerturnLocalPlayer();
Int64 localp = NativeMemory.Read<Int64> (RerturnLocalPlayer());
Console.WriteLine("LocalPlayer " + localp.ToString("X"));