[Help]Hooking Into PunkBuster
I Read up on PB, and the check function for PB uses strings, and checks them, there are good strings, and bad strings. We want to hook into the check function, and return a good string if there is a bad string.
Thats as far as i know. So i so far made a function to find the strings, so i can work from there. BUT, i cant "open" the detours.h
I downloaded and installed Detours
which is suppose to be the detours. Stuck from there... Tried with LanceVorgins CDetour, adn the DLL just crashes when i try making a detour.
Heres my source code.
Thats as far as i know. So i so far made a function to find the strings, so i can work from there. BUT, i cant "open" the detours.h
I downloaded and installed Detours
which is suppose to be the detours. Stuck from there... Tried with LanceVorgins CDetour, adn the DLL just crashes when i try making a detour.
Heres my source code.
Code:
// WarRock DLL v1.cpp : Defines the entry point for the DLL application.
//
#include "stdafx.h"
#include "Addresses.h"
#include "Detour/CDetour.h"
#include "iostream"
#include <windows.h>
#include <detours.h> // Microsoft’s detour library
void Main();
BOOL APIENTRY DllMain( HANDLE hModule, DWORD ul_reason_for_call, LPVOID lpReserved)
{
DisableThreadLibraryCalls((HMODULE) hModule);
CreateThread(NULL,0,(LPTHREAD_START_ROUTINE)&Main,NULL,0,NULL);
return TRUE;
}
typedef int ( *PBPerformCheck_t )(int iEAX, size_t Count, char *Dest );
PBPerformCheck_t pPBPerformCheck = 0;
int _PBPerformCheck(int iEAX, size_t Count, char *Dest ){
int iReturn = pPBPerformCheck( iEAX , Count, Dest );
FILE * pFile;
pFile = fopen ("C:/WarRock.txt","a");
if (pFile!=NULL)
{
fputs (Dest,pFile);
fputs ("\n",pFile);
fclose (pFile);
}
return iReturn;
}
void Hook( ){
DWORD dwPbclBase = ( DWORD )GetModuleHandle( "pbcl.dll" );
pPBPerformCheck = ( PBPerformCheck_t )DetourFunction( ( BYTE * )( dwPbclBase + 0x55FC5 ), ( BYTE * )_PBPerformCheck);
}
void Main(){
/*
We Must First Find The Strings That PB Uses
1. Detour The Function
2. Log the strings
3. Return The String
*/
while(true){
Beep(2000,200);//To Show That The Thread Is Still Running (Debugging)
if(GetAsyncKeyState(VK_NUMPAD0) &0x8000)Hook();
Sleep(200);
}
}
