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. current user

current user

Scheduled Pinned Locked Moved C / C++ / MFC
question
7 Posts 6 Posters 0 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.
  • J Offline
    J Offline
    john5632
    wrote on last edited by
    #1

    Hi, I have created a system level service which needs APPDATA folder path which is different for each user. Is there anyway through which I can get the logged in user APPDATA folder path?

    J V J D 4 Replies Last reply
    0
    • J john5632

      Hi, I have created a system level service which needs APPDATA folder path which is different for each user. Is there anyway through which I can get the logged in user APPDATA folder path?

      J Offline
      J Offline
      Jochen Arndt
      wrote on last edited by
      #2

      It is possible to get the name of logged in users from a service (you have already asked that and got an answer). Using that you can guess the the user directory path and verify it by checking if the pathe exists. But a service should not modify user data and usually does not need to read user data. You have not told us why you need access to user directories. Maybe there is a better solution for your problem.

      1 Reply Last reply
      0
      • J john5632

        Hi, I have created a system level service which needs APPDATA folder path which is different for each user. Is there anyway through which I can get the logged in user APPDATA folder path?

        V Offline
        V Offline
        Victor Nijegorodov
        wrote on last edited by
        #3

        Just a guess, since I never did it yet: - enumerate currently logged i user using NetUserEnum or/and NetWkstaUserEnum functions to get the SID for every user; - use these SIDs to get info for every user from registry (HKEY_USERS\\Software\Microsoft\Windows\CurrentVersion\Explorer\Shell Folders) - ... Hope, it helps (at least to move you in some potentially useful direction).

        1 Reply Last reply
        0
        • J john5632

          Hi, I have created a system level service which needs APPDATA folder path which is different for each user. Is there anyway through which I can get the logged in user APPDATA folder path?

          J Offline
          J Offline
          jschell
          wrote on last edited by
          #4

          There is an environment variable named 'APPDATA' which has a full path. You can get any environment variable. So would that not be sufficient?

          L 1 Reply Last reply
          0
          • J john5632

            Hi, I have created a system level service which needs APPDATA folder path which is different for each user. Is there anyway through which I can get the logged in user APPDATA folder path?

            D Offline
            D Offline
            David Crow
            wrote on last edited by
            #5

            john5632 wrote:

            Is there anyway through which I can get the logged in user...

            Multiple users can be logged in at once.

            "One man's wage rise is another man's price increase." - Harold Wilson

            "Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons

            "You can easily judge the character of a man by how he treats those who can do nothing for him." - James D. Miles

            1 Reply Last reply
            0
            • J jschell

              There is an environment variable named 'APPDATA' which has a full path. You can get any environment variable. So would that not be sufficient?

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

              That is local to the user, not available to a service.

              J 1 Reply Last reply
              0
              • L Lost User

                That is local to the user, not available to a service.

                J Offline
                J Offline
                jschell
                wrote on last edited by
                #7

                I see - that makes it clear.

                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