Oui Need help
I'm using the combined whits base v2. I'm getting disconnected after about 2 minutes. I've searched around and people have said that it's the outdated hook. I've looked through this (its the detours.cpp) and can't seem to find out what needs to be changed. Anyone able to lend a helping hand?
Code:
#define WIN32_LEAN_AND_MEAN
#include <windows.h>
#include <stdlib.h>
#include "detours.h"
int DetourASMlen(BYTE *src, int minlen)
{
int i,len;
for (len=0; len<minlen; len+=i) {
i=mlde32((void *)src);
if (i<=0) return 0;
src+=i;
}
return len;
}
void *DetourCreate(BYTE *src, const BYTE *dst, int minlen)
{
BYTE *jmp, *org;
DWORD dwBack;
int len;
len=DetourASMlen(src,(minlen<6)?6:minlen);
if (len==0 && minlen>=6) len=minlen;
if (len==0) return 0;
org=jmp = (BYTE*)malloc(len+5+1);
jmp[0]=len;
jmp++;
VirtualProtect(src, len, PAGE_EXECUTE_READWRITE, &dwBack);
memcpy(jmp, src, len);
jmp += len;
jmp[0] = 0xE9;
*(DWORD*)(jmp+1) = (DWORD)(src+len - jmp) - 5;
src[0] = 0x68;
*(DWORD*)(src+1) = (DWORD)(dst);
src[5] = 0xc3;
for (int i=6; i<len; i++) src[i] = 0x90;
VirtualProtect(src, len, dwBack, &dwBack);
return &org[1];
}
// restore == return value of DetourCreate
void DetourRemove(BYTE *src, BYTE *restore, int len)
{
DWORD dwBack;
len=*(BYTE *)(restore-1);
VirtualProtect(src, len, PAGE_EXECUTE_READWRITE, &dwBack);
memcpy(src, restore, len);
restore[0] = 0xE9;
*(DWORD*)(restore+1) = (DWORD)(src - restore) - 5;
VirtualProtect(src, len, dwBack, &dwBack);
DWORD d3dCodeCave = 0x37714562;
}
