I am injecting a dll in to a process to hook the winsock function connect, i am using microsoft detours 2.1 and this is just a research project
here is the hooked send function, what i want todo is change the ip to where connect is connecting to , does anyone know how todo it?
Code:
int WINAPI Mine_Connect(SOCKET Socket,const struct sockaddr *name,int namelen)
{
static char IP[16];
sprintf(IP,"%d.%d.%d.%d",(BYTE)name->sa_data[2], (BYTE)name->sa_data[3], (BYTE)name->sa_data[4], (BYTE)name->sa_data[5]);
MessageBox(NULL,IP,"hookedconnect",0);
return Real_Connect(Socket,name,namelen);
}