PDA

View Full Version : Basic hook change


I Like Chicken
10th September 2004, 16:30
First up I'd like to thank Fux0r for his brillant fmod source, I don't care wtf mage says I know it's Fux0r's.
Anyways, this is just a basic guide on how to change the hook of your hack to get around a d3d8.dll export kick.
To do this you'll need the fmod source which you can grab from here http://www.mpcdownloads.com/_mpc_d0wn_h4x_/AAO/FMOD%20v1.3%20Source%20Code.rar
There are two main files to edit, hookworks.cpp and evilhack.cpp both of which are in the dll section. This guide prosumes you using the bc23 as thats what I use so it might not work for other sources.
Once youv'e got the Fmod source, open up the file called hookworks.cpp Select all the content in that file and copy it to clipboard.
Next, open up your hookworks.cpp (from your bc23 source) Select all the text in it replace it with the text you have on the clipboard.
Just above where it says d3d8.dll hooks add this :

unsigned char *pData;
DWORD OldProtect;
char OriginalCode[8];
DWORD FakeError = 0;
volatile long int bScreenshot = 0;
//*************************** DDRAW Anti Screenshot patch
void UnHookDDrawCreate()
{
VirtualProtect(pData, 8, PAGE_READWRITE, &OldProtect);
memcpy(pData, OriginalCode, 8);
VirtualProtect(pData, 8, OldProtect, NULL);
}

void __stdcall DirectDrawCreateHook()
{
#ifdef TESTMODE
fprintf(GameInfo.m_pLogFile, "PB SCREENSHOT\n");
#endif
DWORD LogoDisplayTime = GetTickCount() - GameInfo.m_LogoStartTime;
if (LogoDisplayTime > 60000)
GameInfo.m_bSpyWareWarn = true;
}

void HookDDrawCreate()
{
char RedirectionCode[] =
"\x50" // push eax
"\xB8\x00\x00\x00\x00" // mov eax, 0x00000000
"\xFF\xE0" // jmp eax
;

goto skip;
_asm
{
jumper:
pushad
call DirectDrawCreateHook
popad
pop eax
mov eax, FakeError
retn
}
skip:

unsigned int pHook;
_asm mov pHook, offset jumper;

RedirectionCode[2] = pHook & 0xFF;
RedirectionCode[3] = (pHook >> 8) & 0xFF;
RedirectionCode[4] = (pHook >> 16) & 0xFF;
RedirectionCode[5] = (pHook >> 24) & 0xFF;

pData = (unsigned char*)GetProcAddress(GetModuleHandle("DDRAW"), "DirectDrawCreate");

VirtualProtect(pData, 8, PAGE_READWRITE, &OldProtect);
memcpy(OriginalCode, pData, 8);
memcpy(pData, RedirectionCode, 8);
VirtualProtect(pData, 8, OldProtect, NULL);

if (FakeError != 0x00)
return;
srand(time(NULL));
int temp = rand() / (RAND_MAX / 6);

DWORD FakeErrorList[] =
{
DDERR_DIRECTDRAWALREADYCREATED,
DDERR_GENERIC,
DDERR_INVALIDDIRECTDRAWGUID,
DDERR_INVALIDPARAMS,
DDERR_NODIRECTDRAWHW,
DDERR_OUTOFMEMORY,
};

FakeError = FakeErrorList[temp];

}



Also, at the top you may have to replace all the include and define fuctions with this:

#define hookworks_cpp

#include "HookWorks.h"

#include <stdlib.h>

#include <stdio.h>

#include <time.h>

#include <ddraw.h>

#undef hookworks_cpp

extern CGameInfo GameInfo;

extern IDirect3DDevice8 *pD3DDevice8; //Original Device pointer

extern NewIDirect3DDevice8 *pMyD3DDevice8; //Wrapped Device pointer

extern IDirect3D8 *pD3D8; //Original Device pointer

extern NewIDirect3D8 *pMyD3D8; //Wrapped Device pointer



extern HHOOK hMessageHook;

extern LRESULT CALLBACK MessageProc(int code, WPARAM wParam, LPARAM lParam);




That's it for hookworks.cpp now it's evilhack.cpp time.

Again, open up the fmod source. Open evilhack.cpp and search for this :
bool CheckForAutoFire()


Copy everything above this to clipboard.
Now open up your bc23 evilhack.cpp, and agin search for bool CheckForAutoFire()
and replace all the code above it with the text you have copied to clipboard.

You'll need to add this to the start where it includes all the files.:
extern void HookDDrawCreate();
extern void UnHookDDrawCreate();


That's pretty much it, you'll need to change your loader to load the new dll you made, which may require a new loader, I suggest replacing the bc23 loader with the 1.6.2 loader. Then all you have to do is search for d3d8.dll (evilhack.dll in 1.6.2 loader) and replace it with your dll name. Happy hacking! :classic:

Oh yeah, don't forget to add fux0r to your credits for his wonderful hook.

gil
10th September 2004, 16:42
Nice guide ! even I understood it ;)
I'll let JohnBLucky too add it to his walkthough&downloads where ever he wants.



Great one.

deegan
10th September 2004, 16:52
holy crap good job man. someone set us up the bomb. all your hooks are belong to us. but really im glad someone actually showed how its done and in a way i can understand and utilize myself thx pal id give ya rep if i could

JohnBLucky
10th September 2004, 17:27
Thanks for the link Gil. Definatly a nice addition to the Walkthroughs and Downloads thread!! Nice info there ILC :)

semesterferien
10th September 2004, 18:10
Thx for this relaise!I like Chicken. :laugh:

DelfinoM
10th September 2004, 18:56
I dont understand :P Just the way it was written :P

Punk.!
10th September 2004, 19:14
nice post ILC.

00kes
10th September 2004, 19:25
thanks for this....
iam getting this error when compiling the config, anyone can help me?
LoaderDlg.cpp(82): error C2660: 'CEvilSettings::WriteSettings' : function does not take 0 arguments

OMFS
10th September 2004, 20:08
Sweet post chicken

sharknaww
11th September 2004, 00:59
Finally. I have been waiting for this for a long time:)

weedb0x
11th September 2004, 01:37
I know you have shark, so have I, but its to late now lol, I quit playing AA for a while.

gugliamo
11th September 2004, 01:55
wow this is excellent fo n00bs like me =)

I Like Chicken
11th September 2004, 03:07
thanks for this....
iam getting this error when compiling the config, anyone can help me?
LoaderDlg.cpp(82): error C2660: 'CEvilSettings::WriteSettings' : function does not take 0 arguments
You'll need to change all entries like that to theApp.m_Settings.WriteSettings(theApp.GetFullDllN ame()); That should do it.

baahl
11th September 2004, 05:31
one question... did you come up with this (HookDDrawCreate) your self or are you leaking someone else's method?

I Like Chicken
11th September 2004, 05:38
Thats just out of bc23 source. Evilhack.cpp has alot of screenshot blocking stuff in it so I just added that to take away some errors.

00kes
11th September 2004, 10:42
You'll need to change all entries like that to theApp.m_Settings.WriteSettings(theApp.GetFullDllN ame()); That should do it.

i tried this before but got error saying cant open detours.lib?????

batata
11th September 2004, 17:30
yo good work bud this waz alot of help that i needed and i got it to work on my first try :) and its undetected very nice work bro.but one thing i will like two ask is who or what do u do two change the fingerprint of the .dll so that i can make it my owen and change the .dll to say what ever i want it to say.and then let out my first public hack for peeps like i that didnt know how to work with c++ but that waz then ;)

howler2345
11th September 2004, 22:59
yo good work bud this waz alot of help that i needed and i got it to work on my first try :) and its undetected very nice work bro.but one thing i will like two ask is who or what do u do two change the fingerprint of the .dll so that i can make it my owen and change the .dll to say what ever i want it to say.and then let out my first public hack for peeps like i that didnt know how to work with c++ but that waz then ;)
Just add in some mods like bright player models for now...that will change the fingerprint. And you can alos change it by putting a code like this in your tweaks.cpp

void changefingerprint();
{
printf("asdasdasdasdasd");
printf("fghfghfghfghfghfgh");
printf("maislfnausjfbgyrjdk");
changefingerprint();
changefingerprint();
}

have fun :)

batata
12th September 2004, 03:17
Just add in some mods like bright player models for now...that will change the fingerprint. And you can alos change it by putting a code like this in your tweaks.cpp

void changefingerprint();
{
printf("asdasdasdasdasd");
printf("fghfghfghfghfghfgh");
printf("maislfnausjfbgyrjdk");
changefingerprint();
changefingerprint();
}

have fun :)





ty for the help this is why i come here and get help cuz every one here replys right away if u need help. so ty for the help

baahl
12th September 2004, 07:19
to avoid a stackoverflow...

void changefingerprint();
{
static int ref=1;
ref++;
printf("asdasdasdasdasd");
printf("fghfghfghfghfghfgh");
printf("maislfnausjfbgyrjdk");
if(ref==0){
changefingerprint();
changefingerprint();
}
ref--;
}

HYT3CKR3DN3CK
15th September 2004, 18:48
baahl.. can u use any letter cobinations u want to inside the perenthesis? In this part
printf("asdasdasdasdasd");
printf("fghfghfghfghfghfgh");
printf("maislfnausjfbgyrjdk");

baahl
15th September 2004, 19:33
yeah you can do whatever you like the has no affect outside of the function. The point of the code is to change the fingerprint, not to actually do anything... don't restrict your self to certain characters or to printf. It is important to note however that changing the code within your fingerprint scrambling function should be more effective than changing the data which it operates on.