Writing To a Pointer menu

Shout-Out

User Tag List

Results 1 to 5 of 5
  1. #1
    DarkLinux's Avatar Former Staff
    CoreCoins Purchaser Authenticator enabled
    Reputation
    1627
    Join Date
    May 2010
    Posts
    1,846
    Thanks G/R
    193/539
    Trade Feedback
    16 (100%)
    Mentioned
    7 Post(s)
    Tagged
    0 Thread(s)

    Writing To a Pointer


    Hello,
    I am having a small problem with writing to a pointer. I have an offset (example 0x1000) and it’s a pointer (example 0x1010).

    Offset + pointer = real location <-> 0x1000 + 0x10 = 0x1010

    I read the value as an int32 and convert it to a float, works fine. The problem I am having is that I cannot write to that address location (0x1010). I would like to change the value, but I cannot, I can read it but not write to it. It’s a simple thing to do with a live debugger but not with my c# code. I was thinking that I had coded my Kernel privileges wrong so I used Black Magic and got the same problem. I am also running my program as admin. I can write to any other location but a pointer. Also I am writing to the address a float b/c the value is a float...

    I think I am missing some key knowledge to this. I have never really had the need to write to a pointer. It should act the same way as a normal address but it does not. Any help is much appreciated!

    Thanks!


    EDIT---------------------------------------------

    I asked around and someone toled me to make that address writable. How do u make an address writable?
    Last edited by DarkLinux; 05-27-2011 at 08:58 PM.

    Writing To a Pointer
  2. #2
    sitnspinlock's Avatar Elite User CoreCoins Purchaser
    Reputation
    398
    Join Date
    Sep 2010
    Posts
    439
    Thanks G/R
    0/1
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    just going to throw this out there but have you checked the protection level of the memory region you are trying to write to?

    for example it could be set at "PAGE_READONLY" thus you would need to set it to "PAGE_READWRITE" assuming this memory that is not being executed

    edit:

    also, it wouldnt matter if you wrote a float data type to that location, assuming a 4 byte floating point value, the program would still interpret those 4 bytes as whatever datatype it happened to be using for that variable.
    Last edited by sitnspinlock; 05-28-2011 at 09:50 AM.

  3. #3
    DarkLinux's Avatar Former Staff
    CoreCoins Purchaser Authenticator enabled
    Reputation
    1627
    Join Date
    May 2010
    Posts
    1,846
    Thanks G/R
    193/539
    Trade Feedback
    16 (100%)
    Mentioned
    7 Post(s)
    Tagged
    0 Thread(s)
    I have set the protection type before when allocating memory for an ASM hook but I have never done it for just writing to an address. Any tips on how to do that? I am looking at ihook's MakeMemoryWriteable<T> function but I would like to know what its doing. Do I need to use ASM make it to work?

    I could have this wrong
    PAGE_READWRITE = 0x40;

    Also was looking at this, (1) (2) . I could not get my head around it, I should relearn C++ again.

  4. #4
    streppel's Avatar Active Member
    Reputation
    78
    Join Date
    Mar 2007
    Posts
    196
    Thanks G/R
    0/1
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    just a quick hont of mine:
    make sure you are doing a
    WriteInt(ReadUInt(0x1000)+0x10),value);
    and not a
    WriteInt(ReadUInt(ReadUInt(0x1000)+0x10)),value);

    might sound a bit stupid but happened to me when i wasn't very concentrated

    as you said that you couldn't read it using blackmagic either i could imagine that you might did something wrong this way too

  5. #5
    DarkLinux's Avatar Former Staff
    CoreCoins Purchaser Authenticator enabled
    Reputation
    1627
    Join Date
    May 2010
    Posts
    1,846
    Thanks G/R
    193/539
    Trade Feedback
    16 (100%)
    Mentioned
    7 Post(s)
    Tagged
    0 Thread(s)
    My problem is resolved. It was that the memory I was writing to was protected.

    Code:
            [DllImport("kernel32.dll")]
            public static extern bool VirtualProtectEx(
                IntPtr hProcess,
                uint dwAddress,
                int nSize,     
                uint flNewProtect,
                out uint lpflOldProtect);
    
            public enum Protection : uint
            {
                PAGE_NOACCESS = 0x01,
                PAGE_READONLY = 0x02,
                PAGE_READWRITE = 0x04,
                PAGE_WRITECOPY = 0x08,
                PAGE_EXECUTE = 0x10,
                PAGE_EXECUTE_READ = 0x20,
                PAGE_EXECUTE_READWRITE = 0x40,
                PAGE_EXECUTE_WRITECOPY = 0x80,
                PAGE_GUARD = 0x100,
                PAGE_NOCACHE = 0x200,
                PAGE_WRITECOMBINE = 0x400
            }
    Example:
    Code:
    wow.VirtualProtectEx((wow.BaseAddress + (uint)Offset.Jump), 256, (uint)Imports.Protection.PAGE_READWRITE, (uint)Imports.Protection.PAGE_READONLY);
    Not the best example but you should get the idea!
    Last edited by DarkLinux; 06-07-2011 at 08:55 PM.

Similar Threads

  1. Quotes from Steven Write
    By Amedis in forum Community Chat
    Replies: 2
    Last Post: 11-14-2022, 10:26 AM
  2. Unable to write to a multilevel-pointer
    By Amrok in forum WoW Memory Editing
    Replies: 3
    Last Post: 07-17-2011, 01:34 PM
  3. Replies: 1
    Last Post: 07-23-2009, 01:17 PM
  4. Can anyone write guide for lots of money for smaller levels????
    By MARKOMAN in forum World of Warcraft General
    Replies: 1
    Last Post: 07-29-2006, 09:57 AM
  5. Writing Guides: for Dummies
    By Krazzee in forum World of Warcraft Guides
    Replies: 3
    Last Post: 06-11-2006, 01:05 PM
All times are GMT -5. The time now is 08:42 PM. Powered by vBulletin® Version 4.2.3
Copyright © 2025 vBulletin Solutions, Inc. All rights reserved. User Alert System provided by Advanced User Tagging (Pro) - vBulletin Mods & Addons Copyright © 2025 DragonByte Technologies Ltd.
Google Authenticator verification provided by Two-Factor Authentication (Free) - vBulletin Mods & Addons Copyright © 2025 DragonByte Technologies Ltd.
Digital Point modules: Sphinx-based search