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. Debug Application from Service

Debug Application from Service

Scheduled Pinned Locked Moved C / C++ / MFC
debuggingquestion
5 Posts 4 Posters 2 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.
  • Richard Andrew x64R Offline
    Richard Andrew x64R Offline
    Richard Andrew x64
    wrote on last edited by
    #1

    Does anyone know if it's possible to debug a user application from a Windows service, or if there is something that prevents this? I suppose I could find out by just trying it, but I'd rather not waste time creating and installing a skeleton service just to see that it's not possible. I'm hoping someone might know one way or the other.

    The difficult we do right away... ...the impossible takes slightly longer.

    D L J 3 Replies Last reply
    0
    • Richard Andrew x64R Richard Andrew x64

      Does anyone know if it's possible to debug a user application from a Windows service, or if there is something that prevents this? I suppose I could find out by just trying it, but I'd rather not waste time creating and installing a skeleton service just to see that it's not possible. I'm hoping someone might know one way or the other.

      The difficult we do right away... ...the impossible takes slightly longer.

      D Offline
      D Offline
      Daniel Pfeffer
      wrote on last edited by
      #2

      Services run, by default, under the LocalService account, which is an extremely limited account. You can set your service to run as one of the predefined LocalService, NetworkService, or LocalSystem accounts, OR you can create your own account, assign privileges to it, and run your service under that account. Note that use of LocalSystem is not recommended, as it essentially gives your service access to anything on the platform! If you are running a debugger under a service, you may wish to allow the service to interact with the user. [Service User Accounts - Win32 apps | Microsoft Docs](https://docs.microsoft.com/en-us/windows/win32/services/service-user-accounts) [LocalService Account - Win32 apps | Microsoft Docs](https://docs.microsoft.com/en-us/windows/win32/services/localservice-account) [LocalSystem Account - Win32 apps | Microsoft Docs](https://docs.microsoft.com/en-us/windows/win32/services/localsystem-account) [NetworkService Account - Win32 apps | Microsoft Docs](https://docs.microsoft.com/en-us/windows/win32/services/networkservice-account) [Interactive Services - Win32 apps | Microsoft Docs](https://docs.microsoft.com/en-us/windows/win32/services/interactive-services)

      Freedom is the freedom to say that two plus two make four. If that is granted, all else follows. -- 6079 Smith W.

      1 Reply Last reply
      0
      • Richard Andrew x64R Richard Andrew x64

        Does anyone know if it's possible to debug a user application from a Windows service, or if there is something that prevents this? I suppose I could find out by just trying it, but I'd rather not waste time creating and installing a skeleton service just to see that it's not possible. I'm hoping someone might know one way or the other.

        The difficult we do right away... ...the impossible takes slightly longer.

        L Offline
        L Offline
        Lost User
        wrote on last edited by
        #3

        It rather depends on what you mean, and how you think a service could attach itself to a user application, and what information it could collect.

        1 Reply Last reply
        0
        • Richard Andrew x64R Richard Andrew x64

          Does anyone know if it's possible to debug a user application from a Windows service, or if there is something that prevents this? I suppose I could find out by just trying it, but I'd rather not waste time creating and installing a skeleton service just to see that it's not possible. I'm hoping someone might know one way or the other.

          The difficult we do right away... ...the impossible takes slightly longer.

          J Offline
          J Offline
          Joe Woodbury
          wrote on last edited by
          #4

          When writing a service, I always add a way to pass a command line parameter to run the app in debug mode as a console app. Many examples do the same thing. In other circumstances, you can attach to the service. Without the proper architecture, this can run into timeout issues.

          Richard Andrew x64R 1 Reply Last reply
          0
          • J Joe Woodbury

            When writing a service, I always add a way to pass a command line parameter to run the app in debug mode as a console app. Many examples do the same thing. In other circumstances, you can attach to the service. Without the proper architecture, this can run into timeout issues.

            Richard Andrew x64R Offline
            Richard Andrew x64R Offline
            Richard Andrew x64
            wrote on last edited by
            #5

            Thanks for your response. I was asking more about using the service as a debugger and having it attach to a user process.

            The difficult we do right away... ...the impossible takes slightly longer.

            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