Help*(DWORD*) pointers etc

Posts 113 of 13 · Page 1 of 1
*(DWORD*) pointers etc
Hey community!

I saw this in a cf hack and I dont understand why there as example:

if ((*(DWORD*)((*(DWORD*)(CShell+WeaponMgr))+(4*i))) != 0)

are 2 *(DWORD*)

*(DWORD*) is de-referencing that pointer to an actual DWORD value.
and (DWORD*) is a cast to convert a value to a pointer to a DWORD.

But i dont understand why there are 2 from them

Hope you can help me
DWORD CShell = ( DWORD )GetModuleHandleA( "CShell.dll");
DWORD WeaponMgr = *( DWORD *)( CShell + 0x0 );

if( WeaponMgr )
{
for( int i = INT_MAX; i = 0; i++ )
{
DWORD Wep = *( DWORD *)( Wep + ( i * 4 ) );

if( Wep )
{
//hacks
}
}
More clean code than yours, if you want really understand just learn the ASM logic and C++ logic.
Quote Originally Posted by XarutoUsoCrack View Post
More clean code than yours, if you want really understand just learn the ASM logic and C++ logic.
nice answer...
here a example:

Code:
00725430   . DC6A6900       DD execu.00696ADC

*(DWORD *)0x00725430 make a pointer for address 00696ADC
...

00696ADC     80BD4400       DD execu.0044BD80

*(DWORD *)0x00696ADC make a pointer for address 0044BD80

...

0044BD80  /. 55             PUSH EBP
0044BD81  |. 8BEC           MOV EBP,ESP
0044BD83  |. 51             PUSH ECX

then *(DWORD *)*(DWORD *) or **(DWORD **)0x00725430 make a pointer directly to the address 0044BD80
Quote Originally Posted by luizimloko View Post
here a example:

Code:
00725430   . DC6A6900       DD execu.00696ADC

*(DWORD *)0x00725430 make a pointer for address 00696ADC
...

00696ADC     80BD4400       DD execu.0044BD80

*(DWORD *)0x00696ADC make a pointer for address 0044BD80

...

0044BD80  /. 55             PUSH EBP
0044BD81  |. 8BEC           MOV EBP,ESP
0044BD83  |. 51             PUSH ECX

then *(DWORD *)*(DWORD *) or **(DWORD **)0x00725430 make a pointer directly to the address 0044BD80
Nice Tut!
Quote Originally Posted by luizimloko View Post
here a example:

Code:
00725430   . DC6A6900       DD execu.00696ADC

*(DWORD *)0x00725430 make a pointer for address 00696ADC
...

00696ADC     80BD4400       DD execu.0044BD80

*(DWORD *)0x00696ADC make a pointer for address 0044BD80

...

0044BD80  /. 55             PUSH EBP
0044BD81  |. 8BEC           MOV EBP,ESP
0044BD83  |. 51             PUSH ECX

then *(DWORD *)*(DWORD *) or **(DWORD **)0x00725430 make a pointer directly to the address 0044BD80
And whats the advantage of making a direct pointer?
Quote Originally Posted by Nik08154 View Post
And whats the advantage of making a direct pointer?
less code lines.

a other example:

Code:
class CRealFunc
{
public:
	DWORD stuff;
};

class CPointer
{
public:
	union
	{
		DWORD Address;
		CRealFunc *Pointer;
	};
	char _0x0000[4];
	DWORD stuff;
};

class CTest
{
public:
	union
	{
		DWORD Address;
		CPointer *Pointer;
	};
	char _0x0000[4];
	DWORD stuff;
};

	//1)
		CTest *test = (CTest *)0x00725430;

		test->Pointer->stuff = 1;
		test->Pointer->Pointer->stuff = 1;

	//2)
		CTest *test = *(CTest **)0x00725430; //the address for this func will be: 0x00696ADC
Quote Originally Posted by Nik08154 View Post
Hey community!

I saw this in a cf hack and I dont understand why there as example:

if ((*(DWORD*)((*(DWORD*)(CShell+WeaponMgr))+(4*i))) != 0)

are 2 *(DWORD*)

*(DWORD*) is de-referencing that pointer to an actual DWORD value.
and (DWORD*) is a cast to convert a value to a pointer to a DWORD.

But i dont understand why there are 2 from them

Hope you can help me

break that line into steps, starting at the inner-most ( )'s
Code:
*(DWORD*)((*(DWORD*)(CShell+WeaponMgr))+(4*i))
1. add CShell+weaponMgr --> we'll store the answer in (a temporary variable) 'aa'
aa = CShell+WeaponMgr;

2. *(DWORD*)(aa)
--read a DWORD (4 bytes) starting at the addr aa --> these 4 bytes will be a memory address. we'll store in (a temporary variable) 'bb'
bb = *(DWORD*)(aa);

3. + (4*i)
bb += 4*i;

4. *(DWORD*)(bb)
--same as step 2. Read 4 bytes starting at 'bb'. we'll store this in (a temporary variable) 'cc'
cc = *(DWORD*)(bb); // cc could be a memory addr -- or regular Int32 value, representing..something.
5. cc != 0 //last item in the expression.

------------------------
Code:
*(DWORD*)(CShell+WeaponMgr)
If we only did one *(DWORD*)() that would read 4 bytes from CShell+WeaponMgr
it would return an address like 0x11223344.
If we then read a DWORD from (0x11223344 + (4*i)), we get some useful number from the game like gun ammo - or possibly* a pointer to some object in the game.

-----------------------------
Quote Originally Posted by XarutoUsoCrack View Post
DWORD CShell = ( DWORD )GetModuleHandleA( "CShell.dll");
DWORD WeaponMgr = *( DWORD *)( CShell + 0x0 );

if( WeaponMgr )
{
for( int i = INT_MAX; i = 0; i++ )
{
DWORD Wep = *( DWORD *)( Wep + ( i * 4 ) );

if( Wep )
{
//hacks
}
}
More clean code than yours, if you want really understand just learn the ASM logic and C++ logic.
Troll?

DWORD WeaponMgr = *( DWORD *)( CShell + 0x0 ); // +0 means nothing. ?

if( WeaponMgr )
{
for( int i = INT_MAX; i = 0; i++ ) //This loop will never execute its body... Why is i being set =0, not checked against ==0? If the value of a condition is 0, it's == false, the body won't execute.
{

DWORD Wep = *( DWORD *)( Wep + ( i * 4 ) ); 'Wep' used in it's own definition. Wild goose chase, or compiler error?
//Wep + ( i * 4 ); has 'undefined' value.
test:
Code:
#include <climits>
#include <Windows.h>


int main()
{

 for (int i = INT_MAX; i = 0; i++) // error in condition; same as above.
 {
	 MessageBoxA(0,"Annoying yet?","Nope. This code never runs.",0);// never executed
	 bool _breakPoint = false; // never executed
 }

 MessageBoxA(0,"How many times did that loop run?","Zero???",0); // executed
 bool _done = true; // executed
Quote Originally Posted by abuckau907 View Post
break that line into steps, starting at the inner-most ( )'s
Code:
*(DWORD*)((*(DWORD*)(CShell+WeaponMgr))+(4*i))
1. add CShell+weaponMgr --> we'll store the answer in (a temporary variable) 'aa'
aa = CShell+WeaponMgr;

2. *(DWORD*)(aa)
--read a DWORD (4 bytes) starting at the addr aa --> these 4 bytes will be a memory address. we'll store in (a temporary variable) 'bb'
bb = *(DWORD*)(aa);

3. + (4*i)
bb += 4*i;

4. *(DWORD*)(bb)
--same as step 2. Read 4 bytes starting at 'bb'. we'll store this in (a temporary variable) 'cc'
cc = *(DWORD*)(bb); // cc could be a memory addr -- or regular Int32 value, representing..something.
5. cc != 0 //last item in the expression.

------------------------
Code:
*(DWORD*)(CShell+WeaponMgr)
If we only did one *(DWORD*)() that would read 4 bytes from CShell+WeaponMgr
it would return an address like 0x11223344.
If we then read a DWORD from (0x11223344 + (4*i)), we get some useful number from the game like gun ammo - or possibly* a pointer to some object in the game.

-----------------------------


Troll?


test:
Code:
#include <climits>
#include <Windows.h>


int main()
{

 for (int i = INT_MAX; i = 0; i++) // error in condition; same as above.
 {
	 MessageBoxA(0,"Annoying yet?","Nope. This code never runs.",0);// never executed
	 bool _breakPoint = false; // never executed
 }

 MessageBoxA(0,"How many times did that loop run?","Zero???",0); // executed
 bool _done = true; // executed
i just show to him a easy way to create same shit whitout this 2 yo method un-clean, whit my code you can easy understand the code.
Quote Originally Posted by XarutoUsoCrack View Post
i just show to him a easy way to create same shit whitout this 2 yo method un-clean, whit my code you can easy understand the code.
Uh, your code would never run???

Code:
 for (int i = INT_MAX; i = 0; i++)
middle statement is "i = 0" ...not "i == 0".

for (initialize; test; update)

your test condition would always be 0 (ie. false), and therefore never execute its block of code.

?????????????????????????????????????????????????? ??????????????????

And I don't think the line
Code:
DWORD Wep = *( DWORD *)( Wep + ( i * 4 ) );
would even compile?
noob proof protection, just understand dat.

lol bro, just stop being a idiot, i just showed a EXAMPLE to this guy, just a little research in crossfire source section will find a lot of information.
edit: I'm not even sure...this shit is bananas. Thanks for helping : /
Posts 113 of 13 · Page 1 of 1
This thread is closed for replies.

Similar Threads

Tags for this Thread

None

Need help?