[Help] DLLs and complex addresses?

Technical Discussions not Related Directly to MHS. For Example, Coding, Hex Editing, General Hacking, Etc.

Moderators: g3nuin3, SpeedWing, WhiteHat

[Help] DLLs and complex addresses?

Postby Fouf » Wed Dec 22, 2010 10:44 pm

_
Last edited by Fouf on Thu Nov 28, 2019 9:27 pm, edited 1 time in total.
Fouf
I Have A Few Questions
 
Posts: 3
Joined: Tue Dec 21, 2010 9:33 pm

Re: [Help] DLLs and complex addresses?

Postby L. Spiro » Thu Dec 23, 2010 1:34 am

First off:
viewtopic.php?f=30&t=5519
Stop using DWORD and definitely stop using 4.
Code: Select all
memcpy( (LPVOID)&Bombs, (LPCVOID)&buffer, sizeof( UINT_PTR ) ); // Bombs is in the wrong position and sizeof() should be used instead of hardcoding numbers.  NEVER HARDCODE NUMBERS.



Secondly:
[] brackets in Complex Addresses replicate the dereference (*) operator in C/C++.
Whether you are working remotely or locally (remotely using ReadProcessMemory() or locally with an injected DLL), you need to create a function called DeRef() to make things easier.

If you are working remotely:
Code: Select all
UINT_PTR DeRef( UINT_PTR _uiptrPointer ) {
     UINT_PTR uiptrRet;

     if ( !::ReadProcessMemory( hProcess, reinterpret_cast<LPVOID>(_uiptrPointer), &uiptrRet, sizeof( uiptrRet ), NULL ) ) { return 0UL; }
     return uiptrRet;
}


If you are working locally inside the target process via an injected DLL:
Code: Select all
UINT_PTR DeRef( UINT_PTR _uiptrPointer ) {
     return (*reinterpret_cast<UINT_PTR *>(_uiptrPointer));
}



With your helper function working, simply replace “[” with “DeRef( ” and “]” with “ )”.

Code: Select all
[[0x00570074+0x0]+0x0]+0x8C

becomes:
Code: Select all
DefRef( DefRef( 0x00570074+0x0 )+0x0 )+0x8C


And since this resolves to a pointer to a DWORD, your code becomes:
Code: Select all
DWORD * pdwFinal = reinterpret_cast<DWORD *>(DefRef( DefRef( 0x00570074+0x0 )+0x0 )+0x8C);
(*pdwFinal) = 90;  // Modify the value.



L. Spiro
Our songs remind you of songs you’ve never heard.
User avatar
L. Spiro
L. Spiro
 
Posts: 3129
Joined: Mon Jul 17, 2006 10:14 pm
Location: Tokyo, Japan

Re: [Help] DLLs and complex addresses?

Postby Fouf » Thu Dec 23, 2010 4:42 am

_
Last edited by Fouf on Thu Nov 28, 2019 9:26 pm, edited 1 time in total.
Fouf
I Have A Few Questions
 
Posts: 3
Joined: Tue Dec 21, 2010 9:33 pm

Re: [Help] DLLs and complex addresses?

Postby L. Spiro » Thu Dec 23, 2010 4:55 am

If it only crashes while your threads are running then the answer is obvious: Close the threads before uninjecting.

Otherwise use a stable uninjector, such as the one in MHS.

If you are sure the injector is working, undo modifications to the game code that you may have made.


L. Spiro
Our songs remind you of songs you’ve never heard.
User avatar
L. Spiro
L. Spiro
 
Posts: 3129
Joined: Mon Jul 17, 2006 10:14 pm
Location: Tokyo, Japan


Return to Technical Unrelated

Who is online

Users browsing this forum: No registered users and 0 guests

cron