View previous topic :: View next topic |
Author |
Message |
DY357LX How do I cheat?
Reputation: 0
Joined: 13 Dec 2009 Posts: 6
|
Posted: Sat Mar 05, 2011 4:32 pm Post subject: Displaying the value from a memory address? |
|
|
Bit of a newbie question here, I'm (slowly) learning from several books, forgive my ignorance but I thought I'd ask here and see if what I'm trying to do is even possible.
Just wondering if it's possible to use cout to display the value held in a pointer/memory address?
For example, Torchlight holds the amount of gold you have in 0x12ED7E3C.
My first thought was to use:
Code: |
#include <iostream>
#include <windows.h>
using namespace std;
int main()
{
int *torchlightGold;
torchlightGold = reinterpret_cast<int*>(0x12ED7E3C);
cout << *torchlightGold << endl;
return 0;
}
|
But obviously that would cout the last part of the memory address and not the value it holds.
Can anyone show me how to cout this info please. My end goal is simply to display this information on the G15 keyboards' LCD display via their SDK.
Any help would be greatly appreciated, as said earlier, I r newb.... but eager to learn.
Thanks. |
|
Back to top |
|
 |
NoMercy Master Cheater
Reputation: 1
Joined: 09 Feb 2009 Posts: 289
|
Posted: Sat Mar 05, 2011 4:55 pm Post subject: |
|
|
There are several ReadPointer() functions out there, google for them.
Further do you need a .dll to read it like this. |
|
Back to top |
|
 |
atom0s Moderator
Reputation: 205
Joined: 25 Jan 2006 Posts: 8585 Location: 127.0.0.1
|
Posted: Sat Mar 05, 2011 6:37 pm Post subject: |
|
|
Casting pointers only works internally of the process using them. Meaning, if you want to read a pointer like that, you will have to create a DLL and inject it to gain access to the memory like that.
If you wish to stay external you will need to use ReadProcessMemory. There is a handful of other API that go along with it and there are plenty of examples on this site and across the net. _________________
- Retired. |
|
Back to top |
|
 |
DY357LX How do I cheat?
Reputation: 0
Joined: 13 Dec 2009 Posts: 6
|
Posted: Sat Mar 05, 2011 6:39 pm Post subject: |
|
|
Thanks for the info guys.
I'll continue messing with this in the morning and see what I can do.
(Google'ing for ReadPointer doesn't return much :-/ ) |
|
Back to top |
|
 |
atom0s Moderator
Reputation: 205
Joined: 25 Jan 2006 Posts: 8585 Location: 127.0.0.1
|
Posted: Sat Mar 05, 2011 7:00 pm Post subject: |
|
|
DY357LX wrote: | Thanks for the info guys.
I'll continue messing with this in the morning and see what I can do.
(Google'ing for ReadPointer doesn't return much :-/ ) |
ReadPointer isn't an API. It will land up being a custom implementation of ReadProcessMemory. (Or direct pointers if it is injected etc.) Just read up on ReadProcessMemory to learn how to read memory of another application if you plan to stay external. _________________
- Retired. |
|
Back to top |
|
 |
NoMercy Master Cheater
Reputation: 1
Joined: 09 Feb 2009 Posts: 289
|
Posted: Sun Mar 06, 2011 3:54 am Post subject: |
|
|
Code: | __inline ULONG_PTR ReadPointer(ULONG_PTR* ulBase, INT nOffset)
{
if (!IsBadReadPtr((void*)ulBase, sizeof(ULONG_PTR)))
{
if (!IsBadReadPtr((void*)((*(ULONG_PTR*)ulBase)+nOffset), sizeof(ULONG_PTR)))
{
return *(ULONG_PTR*)((*(ULONG_PTR*)ulBase)+nOffset);
}
}
return 0;
} |
It's not the best function out there, cause IsBadReadPt() is not something you should use. But it works, if the pointer exist, else it will crash you, make a __try in it.
Like Wiccaan said, it's for a .dll. |
|
Back to top |
|
 |
Slugsnack Grandmaster Cheater Supreme
Reputation: 71
Joined: 24 Jan 2007 Posts: 1857
|
Posted: Sun Mar 06, 2011 7:36 am Post subject: |
|
|
NoMercy wrote: | Code: | __inline ULONG_PTR ReadPointer(ULONG_PTR* ulBase, INT nOffset)
{
if (!IsBadReadPtr((void*)ulBase, sizeof(ULONG_PTR)))
{
if (!IsBadReadPtr((void*)((*(ULONG_PTR*)ulBase)+nOffset), sizeof(ULONG_PTR)))
{
return *(ULONG_PTR*)((*(ULONG_PTR*)ulBase)+nOffset);
}
}
return 0;
} |
It's not the best function out there, cause IsBadReadPt() is not something you should use. But it works, if the pointer exist, else it will crash you, make a __try in it.
Like Wiccaan said, it's for a .dll. |
Not true. The reason you shouldn't use it and the explanation behind why I highlighted what you said is here:
http://blogs.msdn.com/b/oldnewthing/archive/2006/09/27/773741.aspx |
|
Back to top |
|
 |
NoMercy Master Cheater
Reputation: 1
Joined: 09 Feb 2009 Posts: 289
|
Posted: Sun Mar 06, 2011 9:06 am Post subject: |
|
|
Slugsnack wrote: | NoMercy wrote: | Code: | __inline ULONG_PTR ReadPointer(ULONG_PTR* ulBase, INT nOffset)
{
if (!IsBadReadPtr((void*)ulBase, sizeof(ULONG_PTR)))
{
if (!IsBadReadPtr((void*)((*(ULONG_PTR*)ulBase)+nOffset), sizeof(ULONG_PTR)))
{
return *(ULONG_PTR*)((*(ULONG_PTR*)ulBase)+nOffset);
}
}
return 0;
} |
It's not the best function out there, cause IsBadReadPt() is not something you should use. But it works, if the pointer exist, else it will crash you, make a __try in it.
Like Wiccaan said, it's for a .dll. |
Not true. The reason you shouldn't use it and the explanation behind why I highlighted what you said is here:
http://blogs.msdn.com/b/oldnewthing/archive/2006/09/27/773741.aspx |
The highlited sentences, was not ment to be poiting at IsBadReadPt, but at the entire funcition. |
|
Back to top |
|
 |
|