Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C / C++ / MFC
  4. Debugging...

Debugging...

Scheduled Pinned Locked Moved C / C++ / MFC
c++debuggingperformancehelptutorial
4 Posts 3 Posters 1 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • X Offline
    X Offline
    x87Bliss
    wrote on last edited by
    #1

    I am trying to make a very simple debugger. In fact, it always has to do the following: Open a program and pause the execution right away. // Like starting the debugger in VC++ with "Step Into" Then it needs to write some data into memory, I know how to use WriteProcessMemory() for that Then it needs to resume execution, and if possible have the debugger close without closing the new process. I'm not very familiar with the debugging functions, only Read and WriteProcessMemory, so if someone could provide sample code to do the above, or at least explain how I can open a process and have it paused right away, and how to resume the execution and close the debugger without closing the process. Thanks for any help! :-D

    M A 2 Replies Last reply
    0
    • X x87Bliss

      I am trying to make a very simple debugger. In fact, it always has to do the following: Open a program and pause the execution right away. // Like starting the debugger in VC++ with "Step Into" Then it needs to write some data into memory, I know how to use WriteProcessMemory() for that Then it needs to resume execution, and if possible have the debugger close without closing the new process. I'm not very familiar with the debugging functions, only Read and WriteProcessMemory, so if someone could provide sample code to do the above, or at least explain how I can open a process and have it paused right away, and how to resume the execution and close the debugger without closing the process. Thanks for any help! :-D

      M Offline
      M Offline
      Monty2
      wrote on last edited by
      #2

      You can use CreateProcess to execute the exe with CREATE_SUSPENDED style this will start and pause the exe at the begining, you can later resume the process.


      C makes it easy to shoot yourself in the foot; C++ makes it harder, but when you do, it blows away your whole leg

      X 1 Reply Last reply
      0
      • X x87Bliss

        I am trying to make a very simple debugger. In fact, it always has to do the following: Open a program and pause the execution right away. // Like starting the debugger in VC++ with "Step Into" Then it needs to write some data into memory, I know how to use WriteProcessMemory() for that Then it needs to resume execution, and if possible have the debugger close without closing the new process. I'm not very familiar with the debugging functions, only Read and WriteProcessMemory, so if someone could provide sample code to do the above, or at least explain how I can open a process and have it paused right away, and how to resume the execution and close the debugger without closing the process. Thanks for any help! :-D

        A Offline
        A Offline
        Anthony_Yio
        wrote on last edited by
        #3

        Get the Debugging Applications - Ms Press by John Robin. The book does show on how to develop one simple debugger with some sample codes. Sonork 100.41263:Anthony_Yio

        1 Reply Last reply
        0
        • M Monty2

          You can use CreateProcess to execute the exe with CREATE_SUSPENDED style this will start and pause the exe at the begining, you can later resume the process.


          C makes it easy to shoot yourself in the foot; C++ makes it harder, but when you do, it blows away your whole leg

          X Offline
          X Offline
          x87Bliss
          wrote on last edited by
          #4

          Thanks. I got it working, but there is one thing that would make it a lot easier... Is there a way to get the address of the Entry point of the program after using CreateProcess with CREATE_SUSPENDED. I know it stops it at the Entry point, but I don't know how to get the address of it. Thanks again.

          1 Reply Last reply
          0
          Reply
          • Reply as topic
          Log in to reply
          • Oldest to Newest
          • Newest to Oldest
          • Most Votes


          • Login

          • Don't have an account? Register

          • Login or register to search.
          • First post
            Last post
          0
          • Categories
          • Recent
          • Tags
          • Popular
          • World
          • Users
          • Groups