Access to process memory from external programm

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • TIM

    #1

    Access to process memory from external programm

    for example i have one simple programm

    int main()
    {
    int test = NULL;
    while(1){
    printf("%d\n",t est);
    getch();
    test++;
    }
    return 0;
    }

    After compiling and running it, i want to access to its memory adress
    location(under windows) from other programm(which i want to write, but
    dont know how or better say, from to start :-)) and find this "test"
    variable and change its value during programm run-time. How i can do it
    from external programm written in C++? Any help would be appreciated. THX.
  • Joona I Palaste

    #2
    Re: Access to process memory from external programm

    TIM <dslest@hot.e e> scribbled the following:[color=blue]
    > for example i have one simple programm[/color]
    [color=blue]
    > int main()
    > {
    > int test = NULL;
    > while(1){
    > printf("%d\n",t est);
    > getch();
    > test++;
    > }
    > return 0;
    > }[/color]
    [color=blue]
    > After compiling and running it, i want to access to its memory adress
    > location(under windows) from other programm(which i want to write, but
    > dont know how or better say, from to start :-)) and find this "test"
    > variable and change its value during programm run-time. How i can do it
    > from external programm written in C++? Any help would be appreciated. THX.[/color]

    From the viewpoint of the C standard: You can't. C has no concept of
    other processes in the first place.
    From a looser viewpoint: Usually processes can't write to each other's
    memory space, so you're still out of luck. Some OSes provide the concept
    of "shared memory" which might help, but that'd be off-topic here.
    YR WLCM.

    --
    /-- Joona Palaste (palaste@cc.hel sinki.fi) ------------- Finland --------\
    \-- http://www.helsinki.fi/~palaste --------------------- rules! --------/
    "As a boy, I often dreamed of being a baseball, but now we must go forward, not
    backward, upward, not forward, and always whirling, whirling towards freedom!"
    - Kang

    Comment

    • TIM

      #3
      Re: Access to process memory from external programm

      Joona I Palaste wrote:
      [color=blue]
      > TIM <dslest@hot.e e> scribbled the following:
      >[color=green]
      >>for example i have one simple programm[/color]
      >
      >[color=green]
      >>int main()
      >>{
      >> int test = NULL;
      >> while(1){
      >> printf("%d\n",t est);
      >> getch();
      >> test++;
      >> }
      >> return 0;
      >>}[/color]
      >
      >[color=green]
      >>After compiling and running it, i want to access to its memory adress
      >>location(unde r windows) from other programm(which i want to write, but
      >>dont know how or better say, from to start :-)) and find this "test"
      >>variable and change its value during programm run-time. How i can do it
      >>from external programm written in C++? Any help would be appreciated. THX.[/color]
      >
      >
      > From the viewpoint of the C standard: You can't. C has no concept of
      > other processes in the first place.
      > From a looser viewpoint: Usually processes can't write to each other's
      > memory space, so you're still out of luck. Some OSes provide the concept
      > of "shared memory" which might help, but that'd be off-topic here.
      > YR WLCM.
      >[/color]
      LoL how is then written programm such as ARTMONEY? If C doesnt have
      concepts of other processes, maybe C++ does? or i must better do it with
      ASM?
      thx.

      Comment

      • Joona I Palaste

        #4
        Re: Access to process memory from external programm

        TIM <dslest@hot.e e> scribbled the following:[color=blue]
        > Joona I Palaste wrote:[color=green]
        >> TIM <dslest@hot.e e> scribbled the following:[color=darkred]
        >>>for example i have one simple programm[/color]
        >>[color=darkred]
        >>>int main()
        >>>{
        >>> int test = NULL;
        >>> while(1){
        >>> printf("%d\n",t est);
        >>> getch();
        >>> test++;
        >>> }
        >>> return 0;
        >>>}[/color]
        >>
        >>[color=darkred]
        >>>After compiling and running it, i want to access to its memory adress
        >>>location(und er windows) from other programm(which i want to write, but
        >>>dont know how or better say, from to start :-)) and find this "test"
        >>>variable and change its value during programm run-time. How i can do it
        >>>from external programm written in C++? Any help would be appreciated. THX.[/color]
        >>
        >>
        >> From the viewpoint of the C standard: You can't. C has no concept of
        >> other processes in the first place.
        >> From a looser viewpoint: Usually processes can't write to each other's
        >> memory space, so you're still out of luck. Some OSes provide the concept
        >> of "shared memory" which might help, but that'd be off-topic here.
        >> YR WLCM.
        >>[/color]
        > LoL how is then written programm such as ARTMONEY? If C doesnt have
        > concepts of other processes, maybe C++ does? or i must better do it with
        > ASM?
        > thx.[/color]

        Read what I wrote. "Some OSes provide the concept of 'shared memory'
        which might help, but that'd be off-topic here." C, as such, doesn't
        have the concept of other processes, but OS-specific extensions to C do.
        The same is true for C++: C++ doesn't have the concept of other
        processes, but OS-specific extensions to C++ do.
        You can either do it with ASM, or find a C- or C++- compatible library
        where someone has already done it with ASM for you.

        --
        /-- Joona Palaste (palaste@cc.hel sinki.fi) ------------- Finland --------\
        \-- http://www.helsinki.fi/~palaste --------------------- rules! --------/
        "It's time, it's time, it's time to dump the slime!"
        - Dr. Dante

        Comment

        • TIM

          #5
          Re: Access to process memory from external programm

          Joona I Palaste wrote:[color=blue]
          > TIM <dslest@hot.e e> scribbled the following:
          >[color=green]
          >>Joona I Palaste wrote:
          >>[color=darkred]
          >>>TIM <dslest@hot.e e> scribbled the following:
          >>>
          >>>>for example i have one simple programm
          >>>
          >>>>int main()
          >>>>{
          >>>> int test = NULL;
          >>>> while(1){
          >>>> printf("%d\n",t est);
          >>>> getch();
          >>>> test++;
          >>>> }
          >>>> return 0;
          >>>>}
          >>>
          >>>
          >>>>After compiling and running it, i want to access to its memory adress
          >>>>location(un der windows) from other programm(which i want to write, but
          >>>>dont know how or better say, from to start :-)) and find this "test"
          >>>>variable and change its value during programm run-time. How i can do it
          >>>
          >>>>from external programm written in C++? Any help would be appreciated. THX.
          >>>
          >>>
          >>>From the viewpoint of the C standard: You can't. C has no concept of
          >>>other processes in the first place.
          >>>From a looser viewpoint: Usually processes can't write to each other's
          >>>memory space, so you're still out of luck. Some OSes provide the concept
          >>>of "shared memory" which might help, but that'd be off-topic here.
          >>>YR WLCM.
          >>>[/color]
          >>
          >>LoL how is then written programm such as ARTMONEY? If C doesnt have
          >>concepts of other processes, maybe C++ does? or i must better do it with
          >>ASM?
          >>thx.[/color]
          >
          >
          > Read what I wrote. "Some OSes provide the concept of 'shared memory'
          > which might help, but that'd be off-topic here." C, as such, doesn't
          > have the concept of other processes, but OS-specific extensions to C do.
          > The same is true for C++: C++ doesn't have the concept of other
          > processes, but OS-specific extensions to C++ do.
          > You can either do it with ASM, or find a C- or C++- compatible library
          > where someone has already done it with ASM for you.
          >[/color]
          Thx for help, but i dont like to use someone else work, i like to make
          things by myself and learn to new things, only then you get full
          control...so i will make it.

          Comment

          • Joona I Palaste

            #6
            Re: Access to process memory from external programm

            TIM <dslest@hot.e e> scribbled the following:[color=blue]
            > Joona I Palaste wrote:[color=green]
            >> TIM <dslest@hot.e e> scribbled the following:[color=darkred]
            >>>LoL how is then written programm such as ARTMONEY? If C doesnt have
            >>>concepts of other processes, maybe C++ does? or i must better do it with
            >>>ASM?
            >>>thx.[/color]
            >>
            >> Read what I wrote. "Some OSes provide the concept of 'shared memory'
            >> which might help, but that'd be off-topic here." C, as such, doesn't
            >> have the concept of other processes, but OS-specific extensions to C do.
            >> The same is true for C++: C++ doesn't have the concept of other
            >> processes, but OS-specific extensions to C++ do.
            >> You can either do it with ASM, or find a C- or C++- compatible library
            >> where someone has already done it with ASM for you.
            >>[/color]
            > Thx for help, but i dont like to use someone else work, i like to make
            > things by myself and learn to new things, only then you get full
            > control...so i will make it.[/color]

            Here, "someone else's work" includes any system core libraries your OS
            might have. Depending on your OS, "making things yourself" might even
            require implementing your own multi-tasking kernel. This is a very
            great deal of work, and overkill just to be able to use shared memory.
            Therefore I suggest you first check your own OS's core libraries,
            whether they support shared memory. If they do, fine. Otherwise you can
            make things yourself or try to find a third-party solution.

            --
            /-- Joona Palaste (palaste@cc.hel sinki.fi) ------------- Finland --------\
            \-- http://www.helsinki.fi/~palaste --------------------- rules! --------/
            "I am looking for myself. Have you seen me somewhere?"
            - Anon

            Comment

            • Christopher Benson-Manica

              #7
              Re: Access to process memory from external programm

              TIM <dslest@hot.e e> spoke thus:
              [color=blue]
              > After compiling and running it, i want to access to its memory adress
              > location(under windows) from other programm(which i want to write, but
              > dont know how or better say, from to start :-)) and find this "test"
              > variable and change its value during programm run-time. How i can do it
              > from external programm written in C++? Any help would be appreciated. THX.[/color]

              I think Joona meant to post these URL's (didn't you, Joona? ;)):





              --
              Christopher Benson-Manica | I *should* know what I'm talking about - if I
              ataru(at)cybers pace.org | don't, I need to know. Flames welcome.

              Comment

              Working...