cAddressTable
Under MIT Licensee
If there are any tutorials someone wants me to write, please notify me about them. I am open to all ideas, as long as they're not towards specific games. As my computer isn't much of a gaming computer and developing hacks for any game would take years on this piece of crap.
Because I just wrote a huge ass tutorial on cBreakpoint(which no one read), I'm not doing much for this one. The methods are pretty self explanatory. I'll write on it in an hour or so..
cAddressTable is a class that enables you to search the IAT, and EAT for exports and imports, or replace them. This hasn't undergone any extensive testing, and if the PE Header of the targeted module is wiped at runtime, this class will not work. Unless you're willing to manually set the table's Import\Export table addresses. This will also not work if the application is encrypted or packed. Unless, like said, you define base addresses yourself.
unsigned long SearchEATForAddress(char* expSymbolName, AddressTable* adrTable)
int RestoreAddress(ATHook* hookData);
AddressTable* GetAddressTable(unsigned long module, short type);
If there are any tutorials someone wants me to write, please notify me about them. I am open to all ideas, as long as they're not towards specific games. As my computer isn't much of a gaming computer and developing hacks for any game would take years on this piece of crap.
Because I just wrote a huge ass tutorial on cBreakpoint(which no one read), I'm not doing much for this one. The methods are pretty self explanatory. I'll write on it in an hour or so..
cAddressTable is a class that enables you to search the IAT, and EAT for exports and imports, or replace them. This hasn't undergone any extensive testing, and if the PE Header of the targeted module is wiped at runtime, this class will not work. Unless you're willing to manually set the table's Import\Export table addresses. This will also not work if the application is encrypted or packed. Unless, like said, you define base addresses yourself.
Defining Base Addresses yourself
There are times when your target will completely wipe the PE header, which will prevent cAddressTable::GetAddressTable from returning valid data. Thus you will be required to locate the IAT or EAT manually. There are several REing techniques, and if your target is encrypted or packed, the unpacking stub will have to manage the imports and setting up the IAT itself. Even when the target has been unpacked by the unpacking stub, there is a high chance your target's code, or the unpacking stub will clear the PE header, and thus searching for the IAT using the PE header proves rather difficult. What you can do, is setup the AddressTable struct manually. You do this as done below :
[php]
AddressTable* adrTable = new AddressTable();
adrTable->moduleBase = GetModuleHandle(0);
adrTable->tableOffset = OFFSET_FROM_MODULE_BASE_IAT;
adrTable->size = 25; //In bytes.
adrTable->type = IAT;
[/php]Then pass that struct pointer to SearchIATForAddress, or whichever method you wish to use. All those members should explain themselfs pretty well. tableOffset is the offset from the base, which when added to the base results in the IAT.
[php]
AddressTable* adrTable = new AddressTable();
adrTable->moduleBase = GetModuleHandle(0);
adrTable->tableOffset = OFFSET_FROM_MODULE_BASE_IAT;
adrTable->size = 25; //In bytes.
adrTable->type = IAT;
[/php]Then pass that struct pointer to SearchIATForAddress, or whichever method you wish to use. All those members should explain themselfs pretty well. tableOffset is the offset from the base, which when added to the base results in the IAT.
Searching for an IAT\EAT
If your target isn't encrypted, or doesn't have a damaged PE header, you're good to go, and you can simply use the method GetAddressTable. How to use the methods is defined below.
unsigned long SearchIATForAddress(unsigned long impAddress, AddressTable* adrTable = 0)
Public Methods
int SetTable(AddressTable* addrTable)Sets the default address table. The first parameter is a pointer to the new default AddressTable. The data in this struct is copied to the class's local private member, m_addrTable.
Returns:
unsigned long HookAddress(unsigned long tgtAddr, unsigned long writeAddr, ATHook* hookData)Returns:
1 - Success
Else - Fail
Else - Fail
Replaces a DWORD of the memory located at
the address defined in tgtAddr param with the memory defined in writeAddr param. hookData param takes a pointer to a ATHook struct. This function will set the passed struct accordingly. After this struct has been set by this function. It should NOT be altered before the calling of RestoreAddress
Returns:
the address defined in tgtAddr param with the memory defined in writeAddr param. hookData param takes a pointer to a ATHook struct. This function will set the passed struct accordingly. After this struct has been set by this function. It should NOT be altered before the calling of RestoreAddress
Returns:
1 - Success
Else - Fail
Else - Fail
Searches the IAT for a defined address and returns where it's located in the IAT. This is not a relative address. The first param is the address to look for, the second in the address table to look in. If this param isn't given, it uses the default address table, set by SetTable.
Returns:
Returns:
Absolute address where address is located in IAT - Success
0 - Fail
0 - Fail
unsigned long SearchEATForAddress(char* expSymbolName, AddressTable* adrTable)
First param is the name of the exported symbol to look for, the second is the address table to look in. Returns either the absolute address where the export is located, or 0, which means it failed to locate it.
int RestoreAddress(ATHook* hookData);
Restores a breakpoint..
AddressTable* GetAddressTable(unsigned long module, short type);
Searches the PE header for the address table. Type can either be IAT, or EAT. Module must be a pointer to the modules base. Use GetModuelHandle to locate the base address of a module. Returns a pointer to a newly created, and set AddressTable struct, with all the members defined accordingly.
Source code.rar
