View previous topic :: View next topic |
Author |
Message |
NullBy7e Cheater
Reputation: 0
Joined: 23 Jul 2014 Posts: 47
|
Posted: Fri Jan 23, 2015 10:13 pm Post subject: 0x0 offset |
|
|
Why does an offset of 0x0 add *10* to a value in CE?
I'm trying to write to an pointer with C++ but when I add 0x0 it does not increment the value of the address by 10 like it does in CE.
CE
70 => [hollow_visual]
0 => ......
"DARKSOULS.EXE"+0xEDF9E8
C++ (doesn't work)
Code: |
int *pPlayer = (int*)((int*)(dwBase + 0xEDF9E8)) + 0x0;
int *pHollowVisual = pPlayer + 0x70;
|
I've been at it for hours, it's driving me mad!
|
|
Back to top |
|
 |
Krampus Cheater
Reputation: 0
Joined: 22 Nov 2014 Posts: 41
|
Posted: Sat Jan 24, 2015 12:08 am Post subject: Re: 0x0 offset |
|
|
NullBy7e wrote: | Why does an offset of 0x0 add *10* to a value in CE?
I'm trying to write to an pointer with C++ but when I add 0x0 it does not increment the value of the address by 10 like it does in CE.
CE
70 => [hollow_visual]
0 => ......
"DARKSOULS.EXE"+0xEDF9E8
C++ (doesn't work)
Code: |
int *pPlayer = (int*)((int*)(dwBase + 0xEDF9E8)) + 0x0;
int *pHollowVisual = pPlayer + 0x70;
|
I've been at it for hours, it's driving me mad! |
You can do it like this, but it's iffy and subject to crashes.
Code: | DWORD Address;
int * pHollowVisual;
Address = dwBase + 0xEDF9E8;
Address = *(DWORD*)Address + 0x0;
Address = *(DWORD*)Address + 0x70;
pHollowVisual = (int*)Address; |
It should work, though I'm not too sure since I'm rather new to this method of reading and writing.
_________________
There is no spoon. |
|
Back to top |
|
 |
STN I post too much
Reputation: 43
Joined: 09 Nov 2005 Posts: 2676
|
Posted: Sat Jan 24, 2015 7:59 am Post subject: |
|
|
0x0 is equal to 0
CE doesn't add 10 to the value but it simply fetches the value pointed at the offset 0.
In c++ all you have to do is get the value that is present at the address. There is no need for offset 0.
I haven't touched c++ for months now and don't have access to a compiler so this may not work but you should get the idea
int *pPlayer = (int*)((int*)(dwBase + 0xEDF9E8)) ;
int *pHollowVisual = pPlayer + 0x70;
int *pfetch = pPlayer; // This is equal to typing pPlayer + 0x0. Add this either above or below the pHollowVisual
_________________
|
|
Back to top |
|
 |
NullBy7e Cheater
Reputation: 0
Joined: 23 Jul 2014 Posts: 47
|
Posted: Sat Jan 24, 2015 9:24 am Post subject: |
|
|
Code: |
int *pPlayer = (int*)((int*)(dwBase + 0xEDF9E8)) + 0x0;
int *pHollowState = pPlayer + 0x74;
int *pHollowVisual = pPlayer + 0x70;
|
In CE the offsets are: 0x0 -> 0xC -> 0x0 -> 0x70.
Why do I need to add 0x0 to it, if its 0 anyway?
It won't do anything?
Edit:
I checked the values my program gets with CE and they differ alot:
CE: http://i.gyazo.com/5ae62e63152a2789007f2b79da42f630.png
Code: |
//85610240 = 51A 4F 00
int *pPlayer = (int*)((int*)(dwBase + 0xEDF9E8)) + 0x0;
int pH = *pPlayer + 0x74; //85610356 = 51A 4F 74
int pV = *pPlayer + 0x70; //85610352 = 51A 4F 70 -
CE: 51A 4F 00 + 0 = [b]542 1D 30[/b] + 0x70 = 542 1D A0
|
|
|
Back to top |
|
 |
STN I post too much
Reputation: 43
Joined: 09 Nov 2005 Posts: 2676
|
Posted: Sat Jan 24, 2015 10:42 am Post subject: |
|
|
The 0 tells CE that you do NOT have an offset and to ignore it/fetch the value that is at the address.
You must be accessing wrong address/offsets if your values differ. I don't see you adding the C offset in your code so make sure you are accessing the same pointer path as CE.
_________________
|
|
Back to top |
|
 |
NullBy7e Cheater
Reputation: 0
Joined: 23 Jul 2014 Posts: 47
|
Posted: Sat Jan 24, 2015 10:53 am Post subject: |
|
|
STN wrote: | The 0 tells CE that you do NOT have an offset and to ignore it/fetch the value that is at the address.
You must be accessing wrong address/offsets if your values differ. I don't see you adding the C offset in your code so make sure you are accessing the same pointer path as CE. |
Do I have to add 0xC? All it does is jump back to the previous address
This is what I do:
1. add static addres to dwbase
2. reference it, dereference it for the value
3. add 0x0
4. reference it, dereference it for the value
5. add 0xC to the value of pPlayer
6. reference it, dereference it for the value
7. add 0x0
8. reference it, dereference it for the value
Code: |
int *pPlayer = (int*)(int*)(((int*)((int*)(dwBase + 0xEDF9E8))) + 0x0);
pPlayer = (int*)(int*)(((int*)((int*)(pPlayer + 0xC))) + 0x0);
int *pHollowState = pPlayer + 0x74;
int *pHollowVisual = pPlayer + 0x70;
|
And to for example set the value of pHollowVisual:
Code: |
*pHollowVisual = 1;
|
I'm so confused, lost, tired, I don't get it.
|
|
Back to top |
|
 |
Pingo Grandmaster Cheater
Reputation: 8
Joined: 12 Jul 2007 Posts: 571
|
Posted: Sat Jan 24, 2015 12:42 pm Post subject: |
|
|
Heres a little pointer function I made a few years back when I wanted to try C++. Might be what you need.
Code: | DWORD mPointer(DWORD Base, INT* Offsets)
{
DWORD Addy = *(DWORD*)(Base);
for(INT i = 0; i < sizeof(Offsets); i++)
Addy = i != (sizeof(Offsets) - 1) ? *(int*)(Addy + Offsets[i]) : Addy += Offsets[i];
return Addy;
}
void WriteInteger(DWORD Address, int Value)
{
*(int *)Address = Value;
} |
Code: | DWORD pHollowVisual = mPointer((DWORD)(dwBase + 0xEDF9E8),(INT*)"\x0\xC\x0\x70");
DWORD pHollowState = mPointer((DWORD)(dwBase + 0xEDF9E8),(INT*)"\x0\xC\x0\x74"); |
or
Code: | DWORD pHollowVisual = mPointer((DWORD)(GetModuleHandle(NULL) + 0xEDF9E8),(INT*)"\x0\xC\x0\x70");
DWORD pHollowState = mPointer((DWORD)(GetModuleHandle(NULL) + 0xEDF9E8),(INT*)"\x0\xC\x0\x74"); |
That should return the pointer address, then you can write the value.
Worked fine for me when I needed it.
Code: | WriteInteger(pHollowVisual,0); |
_________________
|
|
Back to top |
|
 |
NullBy7e Cheater
Reputation: 0
Joined: 23 Jul 2014 Posts: 47
|
Posted: Sat Jan 24, 2015 2:00 pm Post subject: |
|
|
Pingo wrote: | Heres a little pointer function I made a few years back when I wanted to try C++. Might be what you need.
Code: | DWORD mPointer(DWORD Base, INT* Offsets)
{
DWORD Addy = *(DWORD*)(Base);
for(INT i = 0; i < sizeof(Offsets); i++)
Addy = i != (sizeof(Offsets) - 1) ? *(int*)(Addy + Offsets[i]) : Addy += Offsets[i];
return Addy;
}
void WriteInteger(DWORD Address, int Value)
{
*(int *)Address = Value;
} |
Code: | DWORD pHollowVisual = mPointer((DWORD)(dwBase + 0xEDF9E8),(INT*)"\x0\xC\x0\x70");
DWORD pHollowState = mPointer((DWORD)(dwBase + 0xEDF9E8),(INT*)"\x0\xC\x0\x74"); |
or
Code: | DWORD pHollowVisual = mPointer((DWORD)(GetModuleHandle(NULL) + 0xEDF9E8),(INT*)"\x0\xC\x0\x70");
DWORD pHollowState = mPointer((DWORD)(GetModuleHandle(NULL) + 0xEDF9E8),(INT*)"\x0\xC\x0\x74"); |
That should return the pointer address, then you can write the value.
Worked fine for me when I needed it.
Code: | WriteInteger(pHollowVisual,0); |
|
Much appreciated! But I would really love to know why my code is not working, it's making me curious, I must be missing something.
|
|
Back to top |
|
 |
|