-
-
Notifications
You must be signed in to change notification settings - Fork 208
Using Named Pipes
erfg12 edited this page Dec 5, 2017
·
5 revisions
Both the C# form application, and the C++ injected DLL will share a named pipe to communicate back and forth. This will let us trigger internal functions within the game whenever we want via our C# application functions.
First, make your C++ DLL with a named pipe called EQTpipe.
Then, we use our C# code to send the "warp" command through the named pipe to trigger our game's internal function. This example uses the button named "teleportBtn" with the click action "teleportBtn_Click". Don't forget to inject your DLL prior to calling any named pipe functions.
C# Code
public void NewThreadStartClient(string func)
{
using (NamedPipeClientStream pipeStream = new NamedPipeClientStream("EQTPipe"))
{
if (!pipeStream.IsConnected)
pipeStream.Connect();
//Debug.Write("[Client] Pipe connection established");
using (StreamWriter sw = new StreamWriter(pipeStream))
{
if (sw.AutoFlush == false)
sw.AutoFlush = true;
sw.WriteLine(func);
}
}
}
private void injectDLLBtn_Click(object sender, EventArgs e) {
MemLib.InjectDLL("my.dll");
}
private void teleportBtn_Click(object sender, EventArgs e) {
Thread ClientThread = new Thread(() => NewThreadStartClient("warp"));
ClientThread.Start();
}
If you prefer a more safe temporary DLL injection method, read this wiki article.