Results 1 to 4 of 4

Thread: Application program memory area

  1. #1

    Thread Starter
    Member
    Join Date
    Jun 2003
    Posts
    43

    Smile Application program memory area

    Hi friends,

    One query. every program is loaded into memory for execution. Considering only those programs loaded in RAM, is there any way to determine where in my RAM my application program is ruuning ? I mean is my program running in STACK, HEAP, CODE SEGMENT, DATA SEGMENT ?

    Any help ?

  2. #2
    Kitten CornedBee's Avatar
    Join Date
    Aug 2001
    Location
    In a microchip!
    Posts
    11,594
    Basically, there's no way to know where in physical RAM your app resides.
    However, to answer this:
    I mean is my program running in STACK, HEAP, CODE SEGMENT, DATA SEGMENT ?
    Your program is running in memory. The code was loaded from the code (.text) segment of your exe, the static data was loaded from the data (.data) segment of your exe. The function locals and return addresses are on the stack and whatever you allocated is on the heap.
    Segments in this case are parts of an exe file, not of memory. Stack and Heap are two concepts of memory usage, not areas in memory.
    All the buzzt
    CornedBee

    "Writing specifications is like writing a novel. Writing code is like writing poetry."
    - Anonymous, published by Raymond Chen

    Don't PM me with your problems, I scan most of the forums daily. If you do PM me, I will not answer your question.

  3. #3
    Hyperactive Member
    Join Date
    Aug 2002
    Posts
    416
    You can use GetModuleHandle to return the memory address of a module. (module meaning the application exe itself, or any .dll's its using)

    Most applications start at address 0x400000. You can use ReadProcessMemory and WriteProcessMemory to read/write to the memory.

  4. #4
    Kitten CornedBee's Avatar
    Join Date
    Aug 2001
    Location
    In a microchip!
    Posts
    11,594
    That's not the address in memory.

    Make 5 different apps, load them all and let every one call GetModuleHandle. Very likely all will return 0x400000.

    It actually is the address in the process' address space, that is, an address mapped to some physical memory address which you'll never find out.
    All the buzzt
    CornedBee

    "Writing specifications is like writing a novel. Writing code is like writing poetry."
    - Anonymous, published by Raymond Chen

    Don't PM me with your problems, I scan most of the forums daily. If you do PM me, I will not answer your question.

Posting Permissions

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



Click Here to Expand Forum to Full Width