Hey guys,
i injected a dll which i want to use for custom packet sending to my game client. the problem now is how to use it.
the code of the dll is the following:
Code:
#include <Winsock2.h>
#include <Windows.h>
#include <fstream>
#include <detours.h>
#pragma comment(lib, "detours.lib")
#pragma comment(lib, "ws2_32.lib")
using namespace std;
ofstream out("C:\\logW32sock.txt", ios::out | ios::binary);
DETOUR_TRAMPOLINE(int WINAPI Real_send(SOCKET a0, char* a1, int a2, int a3), send);
DETOUR_TRAMPOLINE(int WINAPI Real_recv(SOCKET a0, char* a1, int a2, int a3), recv);
DETOUR_TRAMPOLINE(int WINAPI Real_connect(SOCKET s,const struct sockaddr *name, int namelen), connect);
void WriteLog(char FAR* buf, bool type);
int WINAPI custom_send(SOCKET sock, char* buf, int len, int flags);
int WINAPI custom_recv(SOCKET sock, char FAR* buf, int len, int flags);
int WINAPI custom_connect(SOCKET s,const struct sockaddr *name, int namelen);
char* TextToHex( char *text)
{
if (!text) return 0;
int len = strlen(text);
char *buffer = new char[2*len]+1;
if (!buffer) return 0;
for (int i=0; i<len; i++)
sprintf( buffer+2*i, "%x", (unsigned int) text[i]);
return buffer;
}
void InjNachricht()//der erstellte Thread
{
MessageBox(0, L"Siehe da! Es klappt :P", L" Whohoo", 0);//4. Eine Message Box
}
void InjNachricht2()//der erstellte Thread
{
MessageBox(0, L"Siehe da! Es klappt2 :P", L" Whohoo", 0);//4. Eine Message Box
}
BOOL WINAPI DllMain(HINSTANCE hinst, DWORD reason, LPVOID reserved)
{
if ( reason == DLL_PROCESS_ATTACH )
{
//3.erstelle einen SubProzess, der die übergebene Funktion ausführt
CreateThread(0, 0, (LPTHREAD_START_ROUTINE) InjNachricht, 0, 0, 0);
DetourFunctionWithTrampoline((PBYTE)Real_send,(PBYTE)custom_send);
DetourFunctionWithTrampoline((PBYTE)Real_recv,(PBYTE)custom_recv);
DetourFunctionWithTrampoline((PBYTE)Real_connect, (PBYTE)custom_connect);
}
else if ( reason == DLL_PROCESS_DETACH )
{
DetourRemove((PBYTE)Real_send,(PBYTE)custom_send);
DetourRemove((PBYTE)Real_recv,(PBYTE)custom_recv);
DetourRemove((PBYTE)Real_connect, (PBYTE)custom_connect);
out.close();
}
return true;
}
SOCKET mysock;
int WINAPI custom_send(SOCKET sock, char* buf, int len, int flags)
{
mysock = sock;
WriteLog (buf, true);
return Real_send(sock, buf, len, flags);
}
int WINAPI custom_recv(SOCKET sock, char FAR* buf, int len, int flags)
{
mysock = sock;
WriteLog (buf, false);
return Real_recv(sock, buf, len, flags);
}
int WINAPI custom_connect(SOCKET s, const struct sockaddr *name, int namelen)
{
return Real_connect(s, name, namelen);
}
void WriteLog(char FAR* buf, bool type)
{
if (type == true)
{
out << "SEND:" << TextToHex(buf) << "Socket" << mysock << "\n\n\n\n";
} else
{
out << "RECIEVED: " << TextToHex(buf) << "Socket" << mysock << "\n\n\n\n";
}
}
my problem now is hpw to call a function to inject packets? i just know how to inject the dll but not how to call funtions of the injected dll. Maybe you can help me.
The Language im trying to call the functions from is c#
Fatal error: Call to undefined function mysql_connect() 02/16/2010 - Metin2 Private Server - 3 Replies hi elitepvpers
da ich bei einem problem einfach nicht weiterkomme, hoffe ich hier hilfe zu finden.
Ich habe auf FreeBsd Apache Mysql und Php installiert
nun möchte ich eine page damit online stellen, die z.b. ein registrierungsformular besitzt und diese daten dann in ne mysql datenbank eingibt. ist zum accounts machen für ein game.
wenn ich nun jedoch auf absenden gehe kommt folgender error:
Call Function in Process from another 09/04/2009 - General Coding - 7 Replies Hi,
how the topic says i'm wondering if it's possible to call an function from your application(no dll loaded from a loader) via jmp or call?
example:
i have app1 that has a function which opens a messagebox "Hello!". Now i'm tryin to call that function from another application while the app1 is running.
thanks for your advice
[HELP-CO2] runtime error R6025 - pure virtual function call 05/31/2009 - CO2 Programming - 2 Replies Hey guys,
I know whats going wrong w/ my code, its described on a M$ website which follows.
Description of the R6025 run-time error in Visual C++
And its all well and good to fix that problem in C++... but i'm not using c++ for that function call, i'm using assembly language.
Namely the following...
Call COs jump function in masm? 10/28/2006 - Conquer Online 2 - 0 Replies well i followed the tutorial on how to do this but it didnt give a very good masm example. how would i call the function in masm? does anyone have a good example or code? i have a bunch of other functions to use for hacks but i need to get this done first. im new to masm so i dont really know wat to do. i know how to call functions that dont have variables in other games but no clue when it comes to variables (x and y for jumping.)
thanks, high6.
p.s. here is the jump function location...