Page 1 of 2 12 LastLast
Results 1 to 15 of 20
  1. #1
    x2Sorcer's Avatar
    Join Date
    Oct 2012
    Gender
    male
    Posts
    55
    Reputation
    10
    Thanks
    334
    My Mood
    Bored

    Converting a String containing a Memory Address to Integer

    Hey guys,

    im starting to freak out about this problem. All i want is to write a simple c# program that lets you enter a memory address in a textbox and then displays it value. But the problem is that the address has to be an Integer, but i just can't convert a string from a textbox like 1DBD448 (or 0x1DBD448) to an Integer using int.Parse or Convert.ToInt32, that just gives me an error.

    Any idea on how to do this?

    Many thanks in advance!
    Sorcer

  2. #2
    inmate's Avatar
    Join Date
    Jul 2009
    Gender
    male
    Location
    Bottrop, NRW, Germany
    Posts
    131
    Reputation
    10
    Thanks
    193
    My Mood
    Amazed


    Soo, if i understand your problem right, you try to output a value of an adress in a textbox ?

    I remember that there is a C# function int32.tostring or something like this. Not sure if thats the answer you´re looking for....


    cheers =)
    Last edited by inmate; 11-16-2012 at 01:28 PM.

  3. #3
    Kenshin13's Avatar
    Join Date
    May 2011
    Gender
    male
    Location
    Cloud 9
    Posts
    3,473
    Reputation
    564
    Thanks
    5,876
    My Mood
    Psychedelic
    This is why I hate C#...so damn complicated....
    Code:
    printf("Value @ 0xFFEFFE00 is %i", *(int*)0xFFEFFE00);

  4. #4
    x2Sorcer's Avatar
    Join Date
    Oct 2012
    Gender
    male
    Posts
    55
    Reputation
    10
    Thanks
    334
    My Mood
    Bored
    No, I just want to create a program where i can enter an address in a textfield and then it gives me the value of that address. It is nearly completed, but all I need is a working method to convert the string to an integer. As i already said, int.Parse and Convert.ToInt32 don't work because the address contains letters...

  5. The Following User Says Thank You to x2Sorcer For This Useful Post:

    Skinksteek (11-16-2012)

  6. #5
    Violence begets violence, so why give it back?
    MPGH Member
    Skinksteek's Avatar
    Join Date
    Aug 2012
    Gender
    male
    Location
    In a Care Package
    Posts
    497
    Reputation
    30
    Thanks
    585
    My Mood
    Angelic
    Quote Originally Posted by x2Sorcer View Post
    No, I just want to create a program where i can enter an address in a textfield and then it gives me the value of that address. It is nearly completed, but all I need is a working method to convert the string to an integer. As i already said, int.Parse and Convert.ToInt32 don't work because the address contains letters...
    That sounds as an good program!
    Made by @Jorndel




    Leecher: 0 []
    Choob: 25 []
    Newbie: 50 []
    Member: 100 []
    Advanced Member: 150 []
    Dual-Keyboard Member: 250 []
    Expert Member: 500 []
    Bobo's Trainer: 750 [X]
    MPGH Expert: 1000 [X]
    Synthetic Hacker: 1250 [X]
    Blackhat Hacker: 1500 [X]
    Whitehat Hacker: 2000 [X]
    Bobo's Guardian: 2500 [X]
    Upcoming MPGHiean: 3000 [X]
    MPGH Addict: 3500 [X]
    MPGHiean: 4000 [X]
    MPGH Knight: 4500 [X]
    MPGH Lord: 5000 [X]
    MPGH Champion: 5500 [X]
    MPGH King: 6000 [X]
    "Wish me a good luck."

  7. #6
    Geometrical's Avatar
    Join Date
    Jul 2012
    Gender
    male
    Location
    In the middle of nowhere.
    Posts
    1,036
    Reputation
    331
    Thanks
    10,028
    My Mood
    Chatty
    Quote Originally Posted by x2Sorcer View Post
    No, I just want to create a program where i can enter an address in a textfield and then it gives me the value of that address. It is nearly completed, but all I need is a working method to convert the string to an integer. As i already said, int.Parse and Convert.ToInt32 don't work because the address contains letters...
    Your making your own Cheat Engine??

  8. #7
    Kenshin13's Avatar
    Join Date
    May 2011
    Gender
    male
    Location
    Cloud 9
    Posts
    3,473
    Reputation
    564
    Thanks
    5,876
    My Mood
    Psychedelic
    You could try this and see if it works:
    Code:
    string S = "1384"
    
    int Value = *(int*)&S;

  9. #8
    x2Sorcer's Avatar
    Join Date
    Oct 2012
    Gender
    male
    Posts
    55
    Reputation
    10
    Thanks
    334
    My Mood
    Bored
    Nope, gives me two errors. Other ideas?

  10. #9
    Kenshin13's Avatar
    Join Date
    May 2011
    Gender
    male
    Location
    Cloud 9
    Posts
    3,473
    Reputation
    564
    Thanks
    5,876
    My Mood
    Psychedelic
    Quote Originally Posted by x2Sorcer View Post
    Nope, gives me two errors. Other ideas?
    What errors? Because It compiles for me...
    Last edited by Kenshin13; 11-16-2012 at 03:10 PM.

  11. #10
    x2Sorcer's Avatar
    Join Date
    Oct 2012
    Gender
    male
    Posts
    55
    Reputation
    10
    Thanks
    334
    My Mood
    Bored
    Quote Originally Posted by Kenshin13 View Post
    What errors? Because It compiles for me...
    Im translating them now because im using a non-english interface:

    1. It's not possible to declare a cursor for the executed type ("string") or to fetch its address or size.
    2. Cursor and Buffer with fixed size can only be used in a unsafe context.

    I think the "&S" in your code should be only "S", and if I change that, the first errors disappers, but instead I get:

    Converting from "string" to "int*" is not possible.

    Any ideas?
    Last edited by x2Sorcer; 11-16-2012 at 03:25 PM.

  12. #11
    Kenshin13's Avatar
    Join Date
    May 2011
    Gender
    male
    Location
    Cloud 9
    Posts
    3,473
    Reputation
    564
    Thanks
    5,876
    My Mood
    Psychedelic
    Well I know in c++ you could do thisWorks perfectly)
    Code:
    std::string MyString = "1945";
    printf("Value of MyString to Integer-> %d \n", atoi(MyString.c_str());
    getchar();
    And the output is:
    Code:
    Value of MyString to Integer-> 1945
    Try DllImport with the atoi function.

    Also post the part that's giving errors for you. int.Parse() is supposed to work... Have you tried BitConverter.GetBytes()?
    Last edited by Kenshin13; 11-16-2012 at 03:32 PM.

  13. #12
    x2Sorcer's Avatar
    Join Date
    Oct 2012
    Gender
    male
    Posts
    55
    Reputation
    10
    Thanks
    334
    My Mood
    Bored
    Why should GetBytes help here? It just converts booleans to the Bytes, doesn't it?
    The part that gives errors is this line: int Value = *(int*)&S;.

    And can you explain the atoi-thingy? Never used that before...

    Thanks

  14. #13
    Kenshin13's Avatar
    Join Date
    May 2011
    Gender
    male
    Location
    Cloud 9
    Posts
    3,473
    Reputation
    564
    Thanks
    5,876
    My Mood
    Psychedelic
    atoi converts a string to an integer, just like atol converts it to a long value.
    And the GetBytes will read the string and convert it to bytes...Booleans only have 1 or 0 so what you said didn't make sense...
    You can convert an integer in a string to bytes then the bytes back to an integer if the int.Parse never worked.

  15. #14
    Jorndel's Avatar
    Join Date
    Jul 2010
    Gender
    male
    Location
    Norway
    Posts
    8,674
    Reputation
    905
    Thanks
    18,537
    My Mood
    Angelic
    Google is so good.
    And even more when you know what you are to do

    Code:
     int MyHex = int.Parse("012ABC", System.Globalization.NumberStyles.HexNumber);

     
    Contributor 01.27.2012 - N/A
    Donator 07-17-2012 - Current
    Editor/Manager 12-16-12 - N/A
    Minion 01-10-2013 - 07.17.13
    Former Staff 09-20-2012 - 01-10-2013 / 07-17-2013 - Current
    Cocksucker 20-04-2013 - N/A

  16. The Following User Says Thank You to Jorndel For This Useful Post:

    Kenshin13 (11-16-2012)

  17. #15
    x2Sorcer's Avatar
    Join Date
    Oct 2012
    Gender
    male
    Posts
    55
    Reputation
    10
    Thanks
    334
    My Mood
    Bored
    Oh thank you so much. Was trying to solve that problem the whole day and even googled for over an hour but couldn't find something helpful

    ---------- Post added at 12:44 AM ---------- Previous post was at 12:25 AM ----------

    Edit: This works perfect for reading values from MW3, but I don't get it how to do it with bytes. I'm using your memory class at the moment so i can care about the other things, so you might could help me

    For Integer the code is, of course: Convert.ToString(ReadInteger(address));
    Now I want to read a bytelist using Convert.ToString(ReadBytes(addresse, bytelength)); - but that just gives me "System.Byte[]", doesnt matter which bytelength i enter - any idea why or how to fix it?

    Thanks

Page 1 of 2 12 LastLast

Similar Threads

  1. Memory Addresses
    By Butcher1993 in forum Combat Arms Hacks & Cheats
    Replies: 11
    Last Post: 09-03-2008, 09:33 PM
  2. Memory address question
    By crazyfool in forum Combat Arms Hacks & Cheats
    Replies: 5
    Last Post: 08-18-2008, 11:29 AM
  3. Guild War Memory Addresses
    By rlange in forum Hack Requests
    Replies: 0
    Last Post: 08-29-2007, 09:56 AM
  4. Replies: 3
    Last Post: 01-04-2006, 10:52 PM
  5. Direct Memory Access (DMA) to Static Memory Addresses
    By Dave84311 in forum Game Hacking Tutorials
    Replies: 0
    Last Post: 12-31-2005, 09:18 PM