Copy Function Beta [For PTC]
Well I just put this together is about 3 mins so it might got a few logical errors in it.
I DID NOT TEST THIS CODE.
But the way i wanted it to work is to Copy the whole function into a place in memory. Then return the addy to the space in memory, Stop like the bottom half of Some detours. So I Copy the whole function and you can use that function anytime you want to.
I have one that i am 100% that will work but i dont want to post it, it is built for profection :O
So in other words
Credits to topblast
ONLY TOPBLAST
I DID NOT TEST THIS CODE.
But the way i wanted it to work is to Copy the whole function into a place in memory. Then return the addy to the space in memory, Stop like the bottom half of Some detours. So I Copy the whole function and you can use that function anytime you want to.
I have one that i am 100% that will work but i dont want to post it, it is built for profection :O
So in other words
- CopyFunction(ENGINE_LTC_FOR_PTC);
- Copy PTC Function into memory
- Return the Address of that function and store into your Typedef function lets say
PTC = CopyFunction(ENGINE_LTC_FOR_PTC); - PTC("ShowFPS 1");
- and it SHOULD work
Credits to topblast
ONLY TOPBLAST
Code:
void* CopyFunction(DWORD addy)
{
if (addy == NULL) return NULL;
int len = 0;
PBYTE func;
DWORD dwProtect;
LPVOID ret;
func = PBYTE(addy);
while(func[len] != 0xC3 || func[len] != 0xC2
|| func[len] != 0xCA || func[len] != 0xCB)
{
len++;
}
ret = VirtualAlloc(0, len, (MEM_COMMIT | MEM_RESERVE), PAGE_EXECUTE_READWRITE);
if (ret != NULL &&
VirtualProtect(LPVOID(addy), len, PAGE_EXECUTE_READWRITE, &dwProtect) == TRUE) return NULL;
{
memcpy(ret,LPVOID(addy),len);
VirtualProtect(LPVOID(addy), len, dwProtect, &dwProtect);
return ret;
}
ret = NULL;
func = NULL;
return NULL;
}

thanks


