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. SHGetSpecialFolderPath(NULL, dir, CSIDL_LOCAL_APPDATA, FALSE) special path

SHGetSpecialFolderPath(NULL, dir, CSIDL_LOCAL_APPDATA, FALSE) special path

Scheduled Pinned Locked Moved C / C++ / MFC
csharpasp-netquestion
8 Posts 3 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.
  • C Offline
    C Offline
    Chesnokov Yuriy
    wrote on last edited by
    #1

    I've got DLL which invokes SHGetSpecialFolderPath() function with CSIDL_LOCAL_APPDATA parameter in DLL load handler. When the DLL is loaded from windows application, ASP.NET application, or windows service and queried that special folder, it returns different locations for that special folder. Moreover in XP and Vista those locations are different. Is there a way to find out these locations with some specific function when invoked from windows application?

    Чесноков

    R 1 Reply Last reply
    0
    • C Chesnokov Yuriy

      I've got DLL which invokes SHGetSpecialFolderPath() function with CSIDL_LOCAL_APPDATA parameter in DLL load handler. When the DLL is loaded from windows application, ASP.NET application, or windows service and queried that special folder, it returns different locations for that special folder. Moreover in XP and Vista those locations are different. Is there a way to find out these locations with some specific function when invoked from windows application?

      Чесноков

      R Offline
      R Offline
      Rozis
      wrote on last edited by
      #2

      Correct me if im wrong but SHGetSpecialFolderPath() returns a userrelated folder. The organization of users is different on XP then under Vista. This is the reason you will get different folders. But what is your problem with that? Rozis

      C 1 Reply Last reply
      0
      • R Rozis

        Correct me if im wrong but SHGetSpecialFolderPath() returns a userrelated folder. The organization of users is different on XP then under Vista. This is the reason you will get different folders. But what is your problem with that? Rozis

        C Offline
        C Offline
        Chesnokov Yuriy
        wrote on last edited by
        #3

        yes, user related folder, I know it is different. >>Is there a way to find out these 3 locations with some specific function when invoked from windows application?

        Чесноков

        2 1 Reply Last reply
        0
        • C Chesnokov Yuriy

          yes, user related folder, I know it is different. >>Is there a way to find out these 3 locations with some specific function when invoked from windows application?

          Чесноков

          2 Offline
          2 Offline
          224917
          wrote on last edited by
          #4

          Chesnokov Yuriy wrote:

          >>Is there a way to find out these 3 locations with some specific function when invoked from windows application?

          No function may be available to do this. Because you are trying to access a different user's profile directory, what if the user is an Active Directory user account, and user profile's directory is on a network drive? What are you trying to implement? there should be some better solution than accessing another user's profile directory.

          -Suhredayan

          C 1 Reply Last reply
          0
          • 2 224917

            Chesnokov Yuriy wrote:

            >>Is there a way to find out these 3 locations with some specific function when invoked from windows application?

            No function may be available to do this. Because you are trying to access a different user's profile directory, what if the user is an Active Directory user account, and user profile's directory is on a network drive? What are you trying to implement? there should be some better solution than accessing another user's profile directory.

            -Suhredayan

            C Offline
            C Offline
            Chesnokov Yuriy
            wrote on last edited by
            #5

            I need a special folder that already has r/w access for particular user on that computer (either ASP.NET user, service application user, windows application user)

            Чесноков

            2 1 Reply Last reply
            0
            • C Chesnokov Yuriy

              I need a special folder that already has r/w access for particular user on that computer (either ASP.NET user, service application user, windows application user)

              Чесноков

              2 Offline
              2 Offline
              224917
              wrote on last edited by
              #6

              Chesnokov Yuriy wrote:

              I need a special folder that already has r/w access for particular user on that computer (either ASP.NET user, service application user, windows application user)

              Do you mean a user_profile directory where all the three users have read/write access? if then use: CSIDL_COMMON_APPDATA with SHGetSpecialFolderPath()

              -Suhredayan

              C 1 Reply Last reply
              0
              • 2 224917

                Chesnokov Yuriy wrote:

                I need a special folder that already has r/w access for particular user on that computer (either ASP.NET user, service application user, windows application user)

                Do you mean a user_profile directory where all the three users have read/write access? if then use: CSIDL_COMMON_APPDATA with SHGetSpecialFolderPath()

                -Suhredayan

                C Offline
                C Offline
                Chesnokov Yuriy
                wrote on last edited by
                #7

                in Vista it points to c:\ProgramData and it is not write access enabled :)

                Чесноков

                2 1 Reply Last reply
                0
                • C Chesnokov Yuriy

                  in Vista it points to c:\ProgramData and it is not write access enabled :)

                  Чесноков

                  2 Offline
                  2 Offline
                  224917
                  wrote on last edited by
                  #8

                  Chesnokov Yuriy wrote:

                  in Vista it points to c:\ProgramData and it is not write access enabled Smile

                  My bad, I assumed it being all user's profile folder, every user may have read/write permission to it. But on a second thought if that was true - then it would introduces security issues - imagine if a non-admin user logs in to the machine and installs an .exe into all_user's_startup folder. Next time administrator logs-in, the same .exe would run under administrator's security privilege. This might be one reason the default location/name of this folder is changed in Vista, to make more sense. :) It seems you may need to create/identify a folder, and have the permission set during the installation - either through your program, or as instruction to the person installing your app. That is the best I can think of - I know that might be something you may already have in your mind as a last option.

                  -Suhredayan

                  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