![]() |
| | #1 |
| Kevin Join Date: Nov 2006
Posts: 192
| Memory Address Code:
ofstream file("file.txt");
int Address;
int TheAddress;
file << &Address;
How could i make that TheAddress is Equal to 0029F93C? I'm trying to retreive it from the file, but it retreives an integer. Can anyone give me a hand? Thank you .
__________________ ~kevinawad~ |
| kevinawad is offline | |
| | #2 |
| and the Hat of Guessing Join Date: Nov 2007
Posts: 8,740
| And 0029F93C is also an integer, so that's handy. If you mean "how do I read an integer that's written in hex", then you need to set the ios::hex flag. |
| tabstop is offline | |
| | #3 |
| Kevin Join Date: Nov 2006
Posts: 192
| Is it possible to set the flag directly while getting the string from the file?
__________________ ~kevinawad~ |
| kevinawad is offline | |
| | #4 |
| Kevin Join Date: Nov 2006
Posts: 192
| Here's the deal... 001FF92C = 66952. 001FF92C >> Wads; Now Wads = 66952. ReadProcessMemory(client, (int*)Wads, &WadsBuffer, sizeof(int), 0); It won't read the Wads address...because of it's value. How could it be possible to make it work?
__________________ ~kevinawad~ |
| kevinawad is offline | |
| | #5 |
| and the Hat of Guessing Join Date: Nov 2007
Posts: 8,740
| 0x001FF92C equals 2095404, not 66952. |
| tabstop is offline | |
| | #6 |
| Kevin Join Date: Nov 2006
Posts: 192
| Hmmm, when i read it from the file...it gives me this value... Hmmm... That's a big problem im having...
__________________ ~kevinawad~ |
| kevinawad is offline | |
| | #7 |
| and the Hat of Guessing Join Date: Nov 2007
Posts: 8,740
| Reading in hex is not that hard. Code: #include <iostream>
#include <iomanip>
#include <fstream>
int main() {
std::ifstream hexin("hex.txt");
int wads;
hexin.flags(std::ios::hex); //or hexin << std::hex
hexin >> wads;
std::cout << wads << std::endl;
return 0;
}
Last edited by tabstop; 10-18-2008 at 08:46 PM. Reason: Lie |
| tabstop is offline | |
| | #8 |
| Registered User Join Date: Apr 2006 Location: United States
Posts: 3,202
| Why do you have a file of memory addresses?
__________________ Os iusti meditabitur sapientiam Et lingua eius loquetur indicium "There is nothing either good or bad, but thinking makes it so." (Shakespeare, Hamlet, Act II scene ii) http://www.myspace.com/whiteflags99 |
| whiteflags is offline | |
| | #9 |
| Kevin Join Date: Nov 2006
Posts: 192
| Code: file.open(filename.c_str()); file.flags(ios::hex); file >> Wads; cout <<Wads; When printing wads. Im getting 66952 Still having some problems. Hmm... I'm working on a localhost - kind of server. It will be a debug console. it will access the memory location for the variables in the client. I'm actually working on a Text Role playing Game.
__________________ ~kevinawad~ Last edited by kevinawad; 10-18-2008 at 08:53 PM. |
| kevinawad is offline | |
| | #10 |
| and the Hat of Guessing Join Date: Nov 2007
Posts: 8,740
| Check that you're reading the right file, I guess. 66952 is 0x10588, so maybe look for that pattern. |
| tabstop is offline | |
| | #11 |
| Kevin Join Date: Nov 2006
Posts: 192
| I am reading the right one :P...Hmmm...Did you try it? does it work for you?
__________________ ~kevinawad~ |
| kevinawad is offline | |
| | #12 |
| and the Hat of Guessing Join Date: Nov 2007
Posts: 8,740
| |
| tabstop is offline | |
| | #13 |
| Kevin Join Date: Nov 2006
Posts: 192
| Your right, i just remade a new program. And it worked...I think im reading the wrong file.
__________________ ~kevinawad~ |
| kevinawad is offline | |
| | #14 | |
| Registered User Join Date: Apr 2006 Location: United States
Posts: 3,202
| Quote:
__________________ Os iusti meditabitur sapientiam Et lingua eius loquetur indicium "There is nothing either good or bad, but thinking makes it so." (Shakespeare, Hamlet, Act II scene ii) http://www.myspace.com/whiteflags99 | |
| whiteflags is offline | |
| | #15 |
| Kevin Join Date: Nov 2006
Posts: 192
| Wow...I just found out about the problem...But im not sure what causes it? Code: file.open(filename.c_str()); file >> processid; file.flags(ios::hex); file >> Attack; file >> MagicAttack; file >> Defense; file >> Speed; file >> Health; file >> MaxHealth; file >> Mana; file >> MaxMana; file >> AbilityPoint; file >> Strength; file >> Intelligence; file >> Dexterity; file >> Ritual; file >> SkillPoint; file >> MasterSkillPoint; file >> UniqueSkillPoint; file >> Name; file >> Wads; My text file: Code: 41612 0019F9B8 0019F9BC 0019F9C0 0019F9C4 0019F9C8 0019F9CC 0019F9D0 0019F9D4 0019F9D8 0019F9DC 0019F9E0 0019F9E4 0019F9E8 0019F9EC 0019F9F0 0019F9F4 0019F9F8 0019FA14 Doing this works: Code: #include <iostream>
#include <fstream>
using namespace std;
int main()
{
int Address;
ifstream file("file.add");
file.flags(ios::hex);
file >> Address;
cout <<Address;
return 0;
}
Code: file.open(filename.c_str()); file >> processid; file.flags(ios::hex); file >> Attack; file >> MagicAttack; file >> Defense; file >> Speed; file >> Health; file >> MaxHealth; file >> Mana; file >> MaxMana; file >> AbilityPoint; file >> Strength; file >> Intelligence; file >> Dexterity; file >> Ritual; file >> SkillPoint; file >> MasterSkillPoint; file >> UniqueSkillPoint; file >> Name; file >> Wads;
__________________ ~kevinawad~ |
| kevinawad is offline | |
![]() |
| Thread Tools | |
| Display Modes | |
|
Similar Threads | ||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| tools for finding memory leaks | stanlvw | C++ Programming | 4 | 04-03-2009 11:41 AM |
| Pointer to specific memory address | elnerdo | C++ Programming | 10 | 05-19-2006 07:35 AM |
| Memory Address | Stack Overflow | C Programming | 5 | 05-25-2004 11:43 AM |
| Memory address? | Munkey01 | C++ Programming | 4 | 02-01-2003 09:04 PM |
| Manipulating the Windows Clipboard | Johno | Windows Programming | 2 | 10-01-2002 09:37 AM |