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. Windows API
  4. Moving to Vista

Moving to Vista

Scheduled Pinned Locked Moved Windows API
helpcsharpwindows-admintutorialquestion
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.
  • W Offline
    W Offline
    Winkles
    wrote on last edited by
    #1

    I'm having a bit of trouble getting my c# app to work on Vista. There is some data my app must store that is common to all users of the machine. In the past, I just stuck that information in the registry. In Vista, however, the keys I try to stick in the registry end up in a "virtual store" rather than where I tried to put them. The problem is that while the location I request is under the HKEY_LOCAL_MACHINE root, the virtual store is under the HKEY_CURRENT_USER root, so the data is no longer common to all users. Any advice on how to proceed? I'd prefer a solution that didn't involve popping up a Window begging the user for extra rights, since it's vital that this functions regardless of the way a user might respond in such a popup. Thank you!

    realJSOPR J 2 Replies Last reply
    0
    • W Winkles

      I'm having a bit of trouble getting my c# app to work on Vista. There is some data my app must store that is common to all users of the machine. In the past, I just stuck that information in the registry. In Vista, however, the keys I try to stick in the registry end up in a "virtual store" rather than where I tried to put them. The problem is that while the location I request is under the HKEY_LOCAL_MACHINE root, the virtual store is under the HKEY_CURRENT_USER root, so the data is no longer common to all users. Any advice on how to proceed? I'd prefer a solution that didn't involve popping up a Window begging the user for extra rights, since it's vital that this functions regardless of the way a user might respond in such a popup. Thank you!

      realJSOPR Offline
      realJSOPR Offline
      realJSOP
      wrote on last edited by
      #2

      Vista doesn't allow user apps to store stuff in the registry. The data is stored in the user's app folder. I don't know what hoops you have to go through to make data available to everyone that uses a given machine. Have you tried google? -- modified at 17:35 Thursday 18th October, 2007 This should get you started... http://www.computerperformance.co.uk/vista/vista_appdata.htm[^]

      "Why don't you tie a kerosene-soaked rag around your ankles so the ants won't climb up and eat your candy ass..." - Dale Earnhardt, 1997
      -----
      "...the staggering layers of obscenity in your statement make it a work of art on so many levels." - Jason Jystad, 10/26/2001

      W F 2 Replies Last reply
      0
      • realJSOPR realJSOP

        Vista doesn't allow user apps to store stuff in the registry. The data is stored in the user's app folder. I don't know what hoops you have to go through to make data available to everyone that uses a given machine. Have you tried google? -- modified at 17:35 Thursday 18th October, 2007 This should get you started... http://www.computerperformance.co.uk/vista/vista_appdata.htm[^]

        "Why don't you tie a kerosene-soaked rag around your ankles so the ants won't climb up and eat your candy ass..." - Dale Earnhardt, 1997
        -----
        "...the staggering layers of obscenity in your statement make it a work of art on so many levels." - Jason Jystad, 10/26/2001

        W Offline
        W Offline
        Winkles
        wrote on last edited by
        #3

        Thanks! The folders discussed by that guy are per-user, but it was still a good direction for me to start looking in as you suggested. After poking around more deeply it appears that one can get a common folder to dump data into with the following command: string dataFolder = Environment.GetFolderPath(Environment.SpecialFolder.CommonApplicationData) + Path.DirectorySeparatorChar + myCompanyName; Of course if anyone knows of a better place to dump per-machine data, please let me know! Thanks again!

        L D 2 Replies Last reply
        0
        • W Winkles

          Thanks! The folders discussed by that guy are per-user, but it was still a good direction for me to start looking in as you suggested. After poking around more deeply it appears that one can get a common folder to dump data into with the following command: string dataFolder = Environment.GetFolderPath(Environment.SpecialFolder.CommonApplicationData) + Path.DirectorySeparatorChar + myCompanyName; Of course if anyone knows of a better place to dump per-machine data, please let me know! Thanks again!

          L Offline
          L Offline
          Luc Pattyn
          wrote on last edited by
          #4

          AFAIK that is the right place, not just for Vista, as MSDN describes it: "CommonApplicationData: The directory that serves as a common repository for application- specific data that is used by all users " :)

          Luc Pattyn [Forum Guidelines] [My Articles]


          this months tips: - use PRE tags to preserve formatting when showing multi-line code snippets - before you ask a question here, search CodeProject, then Google


          1 Reply Last reply
          0
          • W Winkles

            I'm having a bit of trouble getting my c# app to work on Vista. There is some data my app must store that is common to all users of the machine. In the past, I just stuck that information in the registry. In Vista, however, the keys I try to stick in the registry end up in a "virtual store" rather than where I tried to put them. The problem is that while the location I request is under the HKEY_LOCAL_MACHINE root, the virtual store is under the HKEY_CURRENT_USER root, so the data is no longer common to all users. Any advice on how to proceed? I'd prefer a solution that didn't involve popping up a Window begging the user for extra rights, since it's vital that this functions regardless of the way a user might respond in such a popup. Thank you!

            J Offline
            J Offline
            Jonathan Darka
            wrote on last edited by
            #5

            Use the SHGetSpecialFolderPath() api call with the nFolder parameter set to either: For per user app data (e.g. C:\Documents and Settings\username\Application Data) CSIDL_APPDATA or for app data common to all users (e.g. C:\Documents and Settings\All Users\Application Data) CSIDL_COMMON_APPDATA regards,


            Jonathan Wilkes Darka[Xanya.net]

            1 Reply Last reply
            0
            • W Winkles

              Thanks! The folders discussed by that guy are per-user, but it was still a good direction for me to start looking in as you suggested. After poking around more deeply it appears that one can get a common folder to dump data into with the following command: string dataFolder = Environment.GetFolderPath(Environment.SpecialFolder.CommonApplicationData) + Path.DirectorySeparatorChar + myCompanyName; Of course if anyone knows of a better place to dump per-machine data, please let me know! Thanks again!

              D Offline
              D Offline
              Dan Neely
              wrote on last edited by
              #6

              Common app data has been the right place to store the data as per MS best practices since XP and IIRC 2k as well.

              -- If you view money as inherently evil, I view it as my duty to assist in making you more virtuous.

              1 Reply Last reply
              0
              • realJSOPR realJSOP

                Vista doesn't allow user apps to store stuff in the registry. The data is stored in the user's app folder. I don't know what hoops you have to go through to make data available to everyone that uses a given machine. Have you tried google? -- modified at 17:35 Thursday 18th October, 2007 This should get you started... http://www.computerperformance.co.uk/vista/vista_appdata.htm[^]

                "Why don't you tie a kerosene-soaked rag around your ankles so the ants won't climb up and eat your candy ass..." - Dale Earnhardt, 1997
                -----
                "...the staggering layers of obscenity in your statement make it a work of art on so many levels." - Jason Jystad, 10/26/2001

                F Offline
                F Offline
                Flynn Arrowstarr Regular Schmoe
                wrote on last edited by
                #7

                John, nice article and site. Thanks. :) Flynn


                If we can't corrupt the youth of today,
                the adults of tomorrow will be no fun...

                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