Defining a pointer in C++

Need Help With an Existing Feature in Memory Hacking Software? Ask Here

Moderators: g3nuin3, SpeedWing, WhiteHat, mezzo

Defining a pointer in C++

Postby Sychotix » Tue Jul 15, 2008 9:53 pm

Sorry if this is the right section as it said for MHS, but it is a Help section.

I am not the best coder, but after talking with a bunch of my friends... this is what was came up with as to defining a pointer.

char *pointer = (char *)((DWORD *)0xe8aa38 + 0xbf8);

Now the dll compiles correctly but when i press alt+z (thats my hotkey...) my character does not move up in the air (its changing the z coord to 500 which should be way up)

I am guessing that it was improperly defined as it was meant to be...

[00E8AA38]+0xbf8 was how it was inside of MHS. How would I fix this code? or even a better way to define the pointer?
Sychotix
Been Around
 
Posts: 239
Joined: Wed Mar 05, 2008 4:28 am

Postby L. Spiro » Tue Jul 15, 2008 10:28 pm

I assume you are running in the context of the target process.

Code: Select all
#define BRACK( ADDR ) (*(PDWORD)(ADDR))
// Now it is easy to  convert [00E8AA38]+0xbf8.  Just replace [ with BRACK( and ] with ).
PDWORD pdwValue = (PDWORD)(BRACK( 0x00E8AA38 ) + 0xBF8);
// We have a DWORD pointer that points to the converted address.  Use the * operator to change the value at that address.
(*pdwValue) = 500;

// Or maybe it was supposed to be a FLOAT.
PFLOAT pfValue = (PFLOAT)(BRACK( 0x00E8AA38 ) + 0xBF8);
(*pfValue) = 500.0f;



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

Postby Felheart » Tue Jul 15, 2008 10:51 pm

[] means pointer to pointer...

You need to ReadProcessMemory 3times

1: 0xe8aa38
2: the value you got from step 1 + 0xbf8
3: the value you got from step 2


Also:

char *pointer = (char *)((DWORD *)0xe8aa38 + 0xbf8);

wtf ?
why char when you value if far over 255/128 ??


DWORD *pointer = NULL;
and then use it like

pointer = ReadProcessMemory(); ....

Again [] is a POINTER TO A POINTER and so on...
[] does not represent a "L"(eft) or "W"(rite) value!



edit: oh lol, i worte so long, spiro wrote a answer befrore me
Felheart
Acker
 
Posts: 89
Joined: Sun Apr 27, 2008 3:05 am
Location: Germany

Postby Sychotix » Tue Jul 15, 2008 10:58 pm

yes, it was meant to be a float value.

Thanks for helping but I'm getting an error with it.

I changed the define (guessing thats what was needed as well to change what you put to float) to
#define BRACK( ADDR ) (*(PFLOAT)(ADDR))

On this line
PFLOAT pfValue = (PFLOAT)(BRACK( 0x00E8AA38 ) + 0xBF8);

i get "error C2440: 'type cast' : cannot convert from 'FLOAT' to 'PFLOAT'"
Sychotix
Been Around
 
Posts: 239
Joined: Wed Mar 05, 2008 4:28 am

Postby L. Spiro » Tue Jul 15, 2008 11:09 pm

Do not change the definition of BRACK.


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

Postby Sychotix » Wed Jul 16, 2008 12:02 am

Thanks... aparently it seems WoW LITERALLY JUST patched dll's since when i inject, i do not get my MessageBox (0, "Alt+Z to go up.!\nCreated by sychotix", "WoW Coordinator v1.0", MB_ICONINFORMATION); and i cant go up by pressing alt+z.

I inject the same DLL into WolfTeam and i see the popup so i know itsn ot the dll -.-

EDIT: or not. it was the injector. MHS's injector pwned it =D
Sychotix
Been Around
 
Posts: 239
Joined: Wed Mar 05, 2008 4:28 am

Postby Noname » Sat Jul 19, 2008 4:50 am

L. Spiro wrote:I assume you are running in the context of the target process.

Code: Select all
#define BRACK( ADDR ) (*(PDWORD)(ADDR))
// Now it is easy to  convert [00E8AA38]+0xbf8.  Just replace [ with BRACK( and ] with ).
PDWORD pdwValue = (PDWORD)(BRACK( 0x00E8AA38 ) + 0xBF8);
// We have a DWORD pointer that points to the converted address.  Use the * operator to change the value at that address.
(*pdwValue) = 500;

// Or maybe it was supposed to be a FLOAT.
PFLOAT pfValue = (PFLOAT)(BRACK( 0x00E8AA38 ) + 0xBF8);
(*pfValue) = 500.0f;




PFloat is a pointer to a float? That is a type-cast right?

L. Spiro
Noname
Hackleberry Fin
 
Posts: 22
Joined: Sun Jul 13, 2008 4:24 am

Postby Sychotix » Sat Jul 19, 2008 5:02 am

um... why did you just quote him and say nothing?
Sychotix
Been Around
 
Posts: 239
Joined: Wed Mar 05, 2008 4:28 am

Postby L. Spiro » Sat Jul 19, 2008 11:49 am

Noname wrote:PFloat is a pointer to a float? That is a type-cast right?

PFLOAT is:
Code: Select all
typedef float * PFLOAT;



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

Postby Noname » Mon Jul 21, 2008 7:03 am

Sychotix wrote:um... why did you just quote him and say nothing?


Because I'm human and make mistakes.


Thanks for the Reply L.
Noname
Hackleberry Fin
 
Posts: 22
Joined: Sun Jul 13, 2008 4:24 am

Postby Sychotix » Mon Jul 21, 2008 8:27 am

Sorry, I did not see that you had put what you wanted to say inside of the quote.
Image
Sychotix
Been Around
 
Posts: 239
Joined: Wed Mar 05, 2008 4:28 am

Postby Noname » Tue Jul 22, 2008 8:09 am

Sychotix wrote:Sorry, I did not see that you had put what you wanted to say inside of the quote.


NP man, It happens. I am noob though.
Noname
Hackleberry Fin
 
Posts: 22
Joined: Sun Jul 13, 2008 4:24 am


Return to Help

Who is online

Users browsing this forum: No registered users and 0 guests