| View previous topic :: View next topic |
| Author |
Message |
AlbanainRetard Master Cheater
Reputation: 0
Joined: 02 Nov 2008 Posts: 494 Location: Canada eh?
|
Posted: Sun Mar 15, 2009 8:05 pm Post subject: C++ Type Double Pointers |
|
|
I can change a Dword pointer easily but A double pointer is fooling me:
ie.
*(DWORD*)(*(DWORD*)MyBase + 0x30) = 100000;
But when I try to do double I have trouble I have tried:
DOUBLE RealFrogBase = *((DOUBLE*)FrogBase) + 0x8;
*(DWORD*)(*(DWORD*)RealFrogBase + 0x30) = (DOUBLE)100000.0;
INT FrogBaseNext = (*(DWORD*)FrogBase + 0x8); //Add 8
*(DOUBLE*)(*(DWORD*)FrogBaseNext +0x30) = 100000;
Got any suggestions? I also found this, I am reading through the thread:
http://forum.cheatengine.org/viewtopic.php?t=276729&start=0&postdays=0&postorder=asc&highlight=&sid=bdd30896cdc119a553b12e9ca6518699
_________________
|
|
| Back to top |
|
 |
hcavolsdsadgadsg I'm a spammer
Reputation: 26
Joined: 11 Jun 2007 Posts: 5801
|
Posted: Sun Mar 15, 2009 8:52 pm Post subject: |
|
|
or you could just read a book or something and actually learn the subject...
void?
|
|
| Back to top |
|
 |
lurc Grandmaster Cheater Supreme
Reputation: 2
Joined: 13 Nov 2006 Posts: 1900
|
Posted: Sun Mar 15, 2009 9:15 pm Post subject: |
|
|
I agree with slovach.
You and all the other trolls that have just suddenly started pouring yourself in the general programming section.
I suspect you all know who you are .
On-topic:
Read 8 bytes and cast as a double. (memcpy/__movsb)
_________________
|
|
| Back to top |
|
 |
AlbanainRetard Master Cheater
Reputation: 0
Joined: 02 Nov 2008 Posts: 494 Location: Canada eh?
|
Posted: Sun Mar 15, 2009 9:44 pm Post subject: |
|
|
| lurc wrote: | I agree with slovach.
You and all the other trolls that have just suddenly started pouring yourself in the general programming section.
I suspect you all know who you are :roll:.
On-topic:
Read 8 bytes and cast as a double. (memcpy/__movsb) |
would I mem copy to an array? Or memcpy to a double??
memcopy(array or double,Base,8);
_________________
|
|
| Back to top |
|
 |
&Vage Grandmaster Cheater Supreme
Reputation: 0
Joined: 25 Jul 2008 Posts: 1053
|
Posted: Sun Mar 15, 2009 10:06 pm Post subject: |
|
|
| Code: |
double watwat = 0.00;
memcpy( (double)watwat, (void*)addr, 8 );
|
wat.
|
|
| Back to top |
|
 |
AlbanainRetard Master Cheater
Reputation: 0
Joined: 02 Nov 2008 Posts: 494 Location: Canada eh?
|
Posted: Sun Mar 15, 2009 10:09 pm Post subject: |
|
|
| S3NS4 wrote: | | Code: |
double watwat = 0.00;
memcpy( (double)watwat, (void*)addr, 8 );
|
wat. |
Thanks S4NS3
Rep + (if can)
EDIT:
5456 seconds
_________________
|
|
| Back to top |
|
 |
&Vage Grandmaster Cheater Supreme
Reputation: 0
Joined: 25 Jul 2008 Posts: 1053
|
Posted: Sun Mar 15, 2009 10:11 pm Post subject: |
|
|
| AlbanainRetard wrote: | | S3NS4 wrote: | | Code: |
double watwat = 0.00;
memcpy( (double)watwat, (void*)addr, 8 );
|
wat. |
Thanks S4NS3
Rep + (if can)
EDIT:
5456 seconds |
S3NS4.
|
|
| Back to top |
|
 |
AlbanainRetard Master Cheater
Reputation: 0
Joined: 02 Nov 2008 Posts: 494 Location: Canada eh?
|
Posted: Sun Mar 15, 2009 10:24 pm Post subject: |
|
|
| S3NS4 wrote: | | AlbanainRetard wrote: | | S3NS4 wrote: | | Code: |
double watwat = 0.00;
memcpy( (double)watwat, (void*)addr, 8 );
|
wat. |
Thanks S4NS3
Rep + (if can)
EDIT:
5456 seconds |
S3NS4. |
1>c:\users\mike williams\desktop\my\code\hacks\albanain\main.cpp(2 : error C2440: 'type cast' : cannot convert from 'DOUBLE' to 'void *'
1>c:\users\mike williams\desktop\my\code\hacks\albanain\main.cpp(2 : error C2664: 'memcpy' : cannot convert parameter 1 from 'double' to 'void *'
DOUBLE FrogBase = 0x00994658;
double FrogDouble = 0.0;
memcpy( (double)FrogDouble, (void*)(FrogBase+0x8), 8 );
_________________
|
|
| Back to top |
|
 |
&Vage Grandmaster Cheater Supreme
Reputation: 0
Joined: 25 Jul 2008 Posts: 1053
|
Posted: Sun Mar 15, 2009 10:42 pm Post subject: |
|
|
| oops try replacing double with void*. I never messed with doubles before.
|
|
| Back to top |
|
 |
AlbanainRetard Master Cheater
Reputation: 0
Joined: 02 Nov 2008 Posts: 494 Location: Canada eh?
|
Posted: Mon Mar 16, 2009 12:57 am Post subject: |
|
|
| S3NS4 wrote: | | oops try replacing double with void*. I never messed with doubles before. |
Two:
1. This compiles
| Code: |
DOUBLE FrogBase = ;//Removed for reasons
DOUBLE FrogNew1 = *((DOUBLE*)&FrogBase) + 0x8;
DOUBLE FrogNew2 = *((DOUBLE*)&FrogNew1) + 0x30;
DOUBLE FrogValue = 100000.0;
memcpy((void *)&FrogValue,(void *)&FrogNew2,8);
|
But doesn't that get the value of that pointer, ie: 1000.
2. So this would be to set it?
memcpy((void *)&FrogNew2, (void *)&FrogValue, 8 );
But the desired effect does not work.
_________________
|
|
| Back to top |
|
 |
Jani Grandmaster Cheater
Reputation: 2
Joined: 29 Dec 2006 Posts: 804
|
Posted: Mon Mar 16, 2009 3:38 am Post subject: |
|
|
Do you have any idea how are you casting your pointers and why? I'd break down the very first DWORD pointer thing and study how it works. Then do the same for doubles. Memcpy is a little useless if you just fixed your pointers and their offsets. By breaking it down I mean something like this: | Code: | double *base = addy;
double value = 0;
base += offset;
value = *base; | Then after analyzing the stuff you actually do, you could try doing it with pure casting. Besides, I think Irwin wrote a ReadPtr function and posted it here. You could try it, but I think it was limited to 4 bytes -> Just do it twice, but add 4 bytes to your addy on the second time :)
The code which comples, fails at pointers too (I'd guess, no idea how's your struct, but I bet it's not like you write the code.)
S3NS4 seems to have no idea about pointers either. Double is just an another type, there's no difference to int when it comes to pointers.
|
|
| Back to top |
|
 |
kitterz Grandmaster Cheater Supreme
Reputation: 0
Joined: 24 Dec 2007 Posts: 1268
|
Posted: Mon Mar 16, 2009 8:29 am Post subject: |
|
|
| Code: | | *(DWORD*)(*(DWORD*)MyBase + 0x30) = 100000; |
>>
| Code: | | *(double*)(*(double*)MyBase + 0x30) = 100000.00; |
O.O ?
_________________
|
|
| Back to top |
|
 |
AlbanainRetard Master Cheater
Reputation: 0
Joined: 02 Nov 2008 Posts: 494 Location: Canada eh?
|
Posted: Mon Mar 16, 2009 11:42 am Post subject: |
|
|
| kitterz wrote: | | Code: | | *(DWORD*)(*(DWORD*)MyBase + 0x30) = 100000; |
>>
| Code: | | *(double*)(*(double*)MyBase + 0x30) = 100000.00; |
O.O ? |
Already tried that: error C2440: 'type cast' : cannot convert from 'double' to 'double *'
and with "DOUBLE" it says wrong type.
_________________
|
|
| Back to top |
|
 |
BanMe Master Cheater
Reputation: 0
Joined: 29 Nov 2005 Posts: 375 Location: Farmington NH, USA
|
Posted: Mon Mar 16, 2009 2:37 pm Post subject: |
|
|
iono...
| Code: |
DWORD MyBase;
*(double*)((DWORD)(MyBase+0x30)) = 100000.00;
|
regards BanMe
|
|
| Back to top |
|
 |
samuri25404 Grandmaster Cheater
Reputation: 7
Joined: 04 May 2007 Posts: 955 Location: Why do you care?
|
Posted: Mon Mar 16, 2009 3:12 pm Post subject: |
|
|
| Code: |
*(double*)(*(DWORD*)MyBase + 0x30) = 100000.00
|
_________________
|
|
| Back to top |
|
 |
|