Page 2 of 2 FirstFirst 12
Results 11 to 16 of 16

Thread: C/C++ question

  1. #11
    and why not use assembly? and I only mean that it's faster and more direct.
    Because he is trying to learn C/C++, not assembly.

    i'm not sure why u would need to do that but it has been my exp. that c/c++ has no way to write data to a exat mem adderss because the os loads the program and then a var are offset to the start of the program
    We already did it. See the above posts.

    becuase im sure that there are other good reasons for accessing memory directly with a program in c++,like cleaning it same thing that reg edit does..
    Like learning? Like understanding C/C++ on a deeper level? Like curiosity? Like it being part of the basic tutorial of C/C++ usage?


  2. #12
    AO Curmudgeon rcgreen's Avatar
    Join Date
    Nov 2001
    Posts
    2,716
    Depends on what you mean by an exact memory address.
    AFAIK, the OS only allocates virtual addresses to user progs.
    It manages the physical locations itself. Basic multitasking
    OS design. You gotta go back to DOS to be able to manage
    physical mem addresses yourself.

    Or learn to write device drivers. They run at a higher priviledge
    level i think.
    I came in to the world with nothing. I still have most of it.

  3. #13
    Senior Member
    Join Date
    Jun 2003
    Posts
    772
    Yeah, VxD's, they run in ring0 (kernel priveleges) I think. I didn't know an OS allocated virtual adresses, I thought that was only the case with shared memory.

    yes, pooh sun tzu, this is purely out of curiosity. I just want to manipulate another program directly.

    EDIT: I found out that this is Virtual Memory at its best. It is impossible to manipulate memory that is allocated to another process from within another normal userprocess.
    This is also not possible in assembly!
    The only way seems to be to code a ring0 process.
    The above sentences are produced by the propaganda and indoctrination of people manipulating my mind since 1987, hence, I cannot be held responsible for this post\'s content - me

    www.elhalf.com

  4. #14
    Antionline Herpetologist
    Join Date
    Aug 2001
    Posts
    1,165
    It is impossible to manipulate memory that is allocated to another process from within another normal userprocess.
    This is because each program has a stack, where it stores all its data. The stack of another program can only be written to by a kernel level process (under Windows, it'd probably have to run as System). Otherwise, arbitary code/data could be written to any program's stack, making it a security nightmare. This is precisely what buffer overflows do. They allow writing to the stack of another program (usually the kernel, for the exploits with shellcode).

    Cheers,
    cgkanchi
    Buy the Snakes of India book, support research and education (sorry the website has been discontinued)
    My blog: http://biology000.blogspot.com

  5. #15
    Senior Member
    Join Date
    Jun 2003
    Posts
    772
    Otherwise, arbitary code/data could be written to any program's stack, making it a security nightmare
    That's what I was trying to do, but the easy way. I wanted to overwrite the returnadress of a program by explictly writing stuff to that place.

    I know each program has an individual stack but I just thought you could simply write in another process's stack if you explicitly mentioned an adress.
    Would have been too easy, screw virtual memory managment
    The above sentences are produced by the propaganda and indoctrination of people manipulating my mind since 1987, hence, I cannot be held responsible for this post\'s content - me

    www.elhalf.com

  6. #16
    very well said, I didnt mean anything by my comments just didnt understand what your main mission was,thought that assembly was the way you may have wanted togo.
    cheers...

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •