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. Reading from and writing to the registry in windows Vista

Reading from and writing to the registry in windows Vista

Scheduled Pinned Locked Moved C / C++ / MFC
questionc++windows-admin
4 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.
  • S Offline
    S Offline
    Sternocera
    wrote on last edited by
    #1

    Hello, I'm maintaining an MFC application that reads and writes from/to the registry. Previously, it used the HKEY_LOCAL_MACHINE key. However, this meant that Vista users needed full OS administrative privileges, (and perhaps non-admin XP users, but there aren't a whole lot of those around) which isn't desirable. So, I changed the key used to HKEY_CURRENT_USER. This just appears to not work at all on Vista as a regular user, though it does work elsewhere. How can I store values in the registry without administrative privileges? Regards, Sternocera

    D B 2 Replies Last reply
    0
    • S Sternocera

      Hello, I'm maintaining an MFC application that reads and writes from/to the registry. Previously, it used the HKEY_LOCAL_MACHINE key. However, this meant that Vista users needed full OS administrative privileges, (and perhaps non-admin XP users, but there aren't a whole lot of those around) which isn't desirable. So, I changed the key used to HKEY_CURRENT_USER. This just appears to not work at all on Vista as a regular user, though it does work elsewhere. How can I store values in the registry without administrative privileges? Regards, Sternocera

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

      Sternocera wrote:

      This just appears to not work at all on Vista as a regular user...

      Do the registry functions fail?

      "Old age is like a bank account. You withdraw later in life what you have deposited along the way." - Unknown

      "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

      1 Reply Last reply
      0
      • S Sternocera

        Hello, I'm maintaining an MFC application that reads and writes from/to the registry. Previously, it used the HKEY_LOCAL_MACHINE key. However, this meant that Vista users needed full OS administrative privileges, (and perhaps non-admin XP users, but there aren't a whole lot of those around) which isn't desirable. So, I changed the key used to HKEY_CURRENT_USER. This just appears to not work at all on Vista as a regular user, though it does work elsewhere. How can I store values in the registry without administrative privileges? Regards, Sternocera

        B Offline
        B Offline
        bob16972
        wrote on last edited by
        #3

        You need to include a security section in your manifest file to prevent Registry and File Virtualization for your application (or have the user turn User Access Control [UAC] off). I would recommend the manifest resource file with the security section since it allows you to use registry and file functions without getting false positives from virtualization. I use "AsInvoker" for user apps. "Windows via C/C++, Fifth Edition" by Richter has some good information on dealing with Vista and using manifests correctly. The Microsoft endorsed way of properly designing an application for UAC is to use a security manifest section in your manifest file/resource. Windows Vista Application Development Requirements for User Account Control Compatibility[^] Create and Embed an application manifest[^] Certified for Logo Test Case[^]

        S 1 Reply Last reply
        0
        • B bob16972

          You need to include a security section in your manifest file to prevent Registry and File Virtualization for your application (or have the user turn User Access Control [UAC] off). I would recommend the manifest resource file with the security section since it allows you to use registry and file functions without getting false positives from virtualization. I use "AsInvoker" for user apps. "Windows via C/C++, Fifth Edition" by Richter has some good information on dealing with Vista and using manifests correctly. The Microsoft endorsed way of properly designing an application for UAC is to use a security manifest section in your manifest file/resource. Windows Vista Application Development Requirements for User Account Control Compatibility[^] Create and Embed an application manifest[^] Certified for Logo Test Case[^]

          S Offline
          S Offline
          Sternocera
          wrote on last edited by
          #4

          Bob, Thanks for that, but all I want to do is stored some key:value pair application settings! Surely there is a simpler way?

          bob16972 wrote:

          You need to include a security section in your manifest file to prevent Registry and File Virtualization for your application (or have the user turn User Access Control [UAC] off).

          Why? I thought that registry and file virtualisation where ways in which Vista supported applications that used the registry. Regards, Sternocera

          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