View previous topic :: View next topic |
Author |
Message |
CityOfTheIris Newbie cheater Reputation: 0
Joined: 18 Sep 2016 Posts: 16
|
Posted: Sun Feb 19, 2017 2:29 pm Post subject: [C++] Finding Address from pointer |
|
|
http://imgur.com/a/Ln6xB
Im trying to find a address of pointer, then change its value to 9999, but it just changes other address's value and crashes my game
how do i properly calculate or fix this?
Code: |
#include "stdafx.h"
#include <Windows.h>
BOOL WINAPI DllMain(HINSTANCE hModule, DWORD dwAttached, LPVOID lpvReserved)
{
if (dwAttached == DLL_PROCESS_ATTACH) {
LONG pointer = 0x002231BC;
LONG offset = 0x3C8;
LONG address;
address = (pointer + offset);
*(DWORD*)(address) = 9999;
Sleep(200);
}
return 1;
}
|
|
|
Back to top |
|
|
CityOfTheIris Newbie cheater Reputation: 0
Joined: 18 Sep 2016 Posts: 16
|
Posted: Mon Feb 20, 2017 1:43 pm Post subject: |
|
|
bump |
|
Back to top |
|
|
Viloresi Expert Cheater Reputation: 0
Joined: 02 Feb 2017 Posts: 149
|
Posted: Mon Feb 20, 2017 4:07 pm Post subject: |
|
|
You have to sum the offset to the address pointed by the pointer... In that code you are adding the offset to the pointer which doesn't make sense, please read here.
Code: | http://www.cplusplus.com/doc/tutorial/pointers/ |
|
|
Back to top |
|
|
Dark Byte Site Admin Reputation: 458
Joined: 09 May 2003 Posts: 25295 Location: The netherlands
|
|
Back to top |
|
|
CityOfTheIris Newbie cheater Reputation: 0
Joined: 18 Sep 2016 Posts: 16
|
Posted: Wed Feb 22, 2017 8:18 am Post subject: |
|
|
Viloresi wrote: | You have to sum the offset to the address pointed by the pointer... In that code you are adding the offset to the pointer which doesn't make sense, please read here.
Code: | http://www.cplusplus.com/doc/tutorial/pointers/ |
|
didnt understand anything D: |
|
Back to top |
|
|
atom0s Moderator Reputation: 198
Joined: 25 Jan 2006 Posts: 8517 Location: 127.0.0.1
|
Posted: Thu Mar 02, 2017 3:33 am Post subject: |
|
|
Kewun wrote: | Viloresi wrote: | You have to sum the offset to the address pointed by the pointer... In that code you are adding the offset to the pointer which doesn't make sense, please read here.
Code: | http://www.cplusplus.com/doc/tutorial/pointers/ |
|
didnt understand anything D: |
You are going to have to keep reading and learning the basics of the language if you plan to compile anything and make use of the language at all. Search around for some other similar tutorials on the same topic that may have a better approach to helping you learn such as videos or different visual examples if that is something you learn better from. _________________
- Retired. |
|
Back to top |
|
|
CityOfTheIris Newbie cheater Reputation: 0
Joined: 18 Sep 2016 Posts: 16
|
Posted: Thu Mar 02, 2017 6:40 am Post subject: |
|
|
yeah but im a type of person who learns from examples.. |
|
Back to top |
|
|
Viloresi Expert Cheater Reputation: 0
Joined: 02 Feb 2017 Posts: 149
|
Posted: Thu Mar 02, 2017 8:38 am Post subject: |
|
|
Kewun wrote: | yeah but im a type of person who learns from examples.. |
Code: |
#include "stdafx.h"
#include <Windows.h>
BOOL WINAPI DllMain(HINSTANCE hModule, DWORD dwAttached, LPVOID lpvReserved)
{
if (dwAttached == DLL_PROCESS_ATTACH) {
LONG pointer = 0x002231BC;
LONG offset = 0x3C8;
LONG address;
address = ((DWORD*)(pointer) + offset);
(DWORD*)(address) = 9999;
Sleep(200);
}
return 1;
}
|
I've just corrected your code, remember that this is not optimized (for example the dword cast is pointless) |
|
Back to top |
|
|
|