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. Problem Reading/Writing Registry in Windows 7?

Problem Reading/Writing Registry in Windows 7?

Scheduled Pinned Locked Moved C / C++ / MFC
questionwindows-adminsaleshelp
9 Posts 6 Posters 13 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.
  • U Offline
    U Offline
    User 9153669
    wrote on last edited by
    #1

    This may be in the wrong forum – but here goes. I have a 32-bit application that I've been maintaining for about 12 years and it runs on every Windows platform up to Windows 7. In all that time I've been using CWinApp::GetProfileXxxx() and CWinApp::WriteProfileXxxx() calls to read and write my program settings (about 70 settings) in the Registry. The settings are read from the Registry at start-up and written to the Registry when the program closes. There is also a method for the user to read and write the program settings to an INI file using the same code as the Registry access. On my Windows 7 system the Registry read/write works just like it always has on all previous Windows versions. However, on some customer's Windows 7 machines there appears to be a problem with the Registry access. The program settings are either not being read from the Registry or are not being written to the Registry. I think the settings are not being written – but I don't know that. When the user uses the INI file the settings appear to be read and written. The customer has complained a bit (I'd complain too) but doesn't have the time or doesn't want to take the time to run some simple tests for me to find out what's going on with his Windows 7 system. So here is my question: Are there any user account settings or permissions that can block the program's access to the Registry? He claims he is an Administrator but I can't even get him to verify that. Thanks, Mike

    D J 2 Replies Last reply
    0
    • U User 9153669

      This may be in the wrong forum – but here goes. I have a 32-bit application that I've been maintaining for about 12 years and it runs on every Windows platform up to Windows 7. In all that time I've been using CWinApp::GetProfileXxxx() and CWinApp::WriteProfileXxxx() calls to read and write my program settings (about 70 settings) in the Registry. The settings are read from the Registry at start-up and written to the Registry when the program closes. There is also a method for the user to read and write the program settings to an INI file using the same code as the Registry access. On my Windows 7 system the Registry read/write works just like it always has on all previous Windows versions. However, on some customer's Windows 7 machines there appears to be a problem with the Registry access. The program settings are either not being read from the Registry or are not being written to the Registry. I think the settings are not being written – but I don't know that. When the user uses the INI file the settings appear to be read and written. The customer has complained a bit (I'd complain too) but doesn't have the time or doesn't want to take the time to run some simple tests for me to find out what's going on with his Windows 7 system. So here is my question: Are there any user account settings or permissions that can block the program's access to the Registry? He claims he is an Administrator but I can't even get him to verify that. Thanks, Mike

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

      Member 9199754 wrote:

      So here is my question:   Are there any user account settings or permissions that can block the program's access to the Registry?

      Yes, UAC can. It was introduced with Vista but changed somewhat with Win7. Turn it off and see if that makes a difference.

      "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

      "Show me a community that obeys the Ten Commandments and I'll show you a less crowded prison system." - Anonymous

      U 1 Reply Last reply
      0
      • D David Crow

        Member 9199754 wrote:

        So here is my question:   Are there any user account settings or permissions that can block the program's access to the Registry?

        Yes, UAC can. It was introduced with Vista but changed somewhat with Win7. Turn it off and see if that makes a difference.

        "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

        "Show me a community that obeys the Ten Commandments and I'll show you a less crowded prison system." - Anonymous

        U Offline
        U Offline
        User 9153669
        wrote on last edited by
        #3

        I don't think UAC is the answer. I looked at my UAC settings and didn't see anything other than how to set the warning levels. Mine is set to: "Default: Notify me only when programs try to make changes to my compputer". Even with this setting my program never causes the UAC to display the notification. I think the problem lies in the Registry p0ermission settings, but I don't know yet.

        P 1 Reply Last reply
        0
        • U User 9153669

          I don't think UAC is the answer. I looked at my UAC settings and didn't see anything other than how to set the warning levels. Mine is set to: "Default: Notify me only when programs try to make changes to my compputer". Even with this setting my program never causes the UAC to display the notification. I think the problem lies in the Registry p0ermission settings, but I don't know yet.

          P Offline
          P Offline
          Peter_in_2780
          wrote on last edited by
          #4

          You should be looking at the customer's settings, not your own. That's where the problem is. Cheers, Peter

          Software rusts. Simon Stephenson, ca 1994. So does this signature. me, 2012

          U 1 Reply Last reply
          0
          • P Peter_in_2780

            You should be looking at the customer's settings, not your own. That's where the problem is. Cheers, Peter

            Software rusts. Simon Stephenson, ca 1994. So does this signature. me, 2012

            U Offline
            U Offline
            User 9153669
            wrote on last edited by
            #5

            I KNOW I sould be looking at the customer's setting. The problem is that I'm not getting any support from him. So, I need to understand the settings on my computer so I can run some tests and make suggestions to him. My problem is that I'm not very well versed in "security" settings in Windows 7. I still think it is a user permission setting in Registrey - but I'm not sure where to look yet.

            1 Reply Last reply
            0
            • U User 9153669

              This may be in the wrong forum – but here goes. I have a 32-bit application that I've been maintaining for about 12 years and it runs on every Windows platform up to Windows 7. In all that time I've been using CWinApp::GetProfileXxxx() and CWinApp::WriteProfileXxxx() calls to read and write my program settings (about 70 settings) in the Registry. The settings are read from the Registry at start-up and written to the Registry when the program closes. There is also a method for the user to read and write the program settings to an INI file using the same code as the Registry access. On my Windows 7 system the Registry read/write works just like it always has on all previous Windows versions. However, on some customer's Windows 7 machines there appears to be a problem with the Registry access. The program settings are either not being read from the Registry or are not being written to the Registry. I think the settings are not being written – but I don't know that. When the user uses the INI file the settings appear to be read and written. The customer has complained a bit (I'd complain too) but doesn't have the time or doesn't want to take the time to run some simple tests for me to find out what's going on with his Windows 7 system. So here is my question: Are there any user account settings or permissions that can block the program's access to the Registry? He claims he is an Administrator but I can't even get him to verify that. Thanks, Mike

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

              Member 9199754 wrote:

              Are there any user account settings or permissions that can block the program's access to the Registry?

              Yes.

              Member 9199754 wrote:

              The program settings are either not being read from the Registry or are not being written to the Registry.   I think the settings are not being written – but I don't know that

              You should look into logging, just as a general programming idiom. With logging you would know, rather than attempting to guess, what was happening.

              J U 2 Replies Last reply
              0
              • J jschell

                Member 9199754 wrote:

                Are there any user account settings or permissions that can block the program's access to the Registry?

                Yes.

                Member 9199754 wrote:

                The program settings are either not being read from the Registry or are not being written to the Registry.   I think the settings are not being written – but I don't know that

                You should look into logging, just as a general programming idiom. With logging you would know, rather than attempting to guess, what was happening.

                J Online
                J Online
                jeron1
                wrote on last edited by
                #7

                jschell wrote:

                With logging you would know, rather than attempting to guess, what was happening

                Wise words indeed.:thumbsup:

                1 Reply Last reply
                0
                • J jschell

                  Member 9199754 wrote:

                  Are there any user account settings or permissions that can block the program's access to the Registry?

                  Yes.

                  Member 9199754 wrote:

                  The program settings are either not being read from the Registry or are not being written to the Registry.   I think the settings are not being written – but I don't know that

                  You should look into logging, just as a general programming idiom. With logging you would know, rather than attempting to guess, what was happening.

                  U Offline
                  U Offline
                  User 9153669
                  wrote on last edited by
                  #8

                  Well, this is what I have found so far. The Registry key permission setting does indeed stop my program from writing to its Registry key. On my two WinXP and my Win7 systems the Registry key permissions are set to "full control". Registry editor does not allow me to manually change the "full control" permission to "Read". The "full control" permission is checked but disabled (dimmed) so I can't change it and I don't know why. I had to find a utility that changed the permission outside of registry editor. When the key permission was changed to "read" then writing to the Registry failed. CWinApp:WriteProfileInt() fails with a "read" permision but there is no error code associated with the failure (i.e. GetLastError() doesn't return an error code). I think the only thing I can do is detect the Registry write failure, report it to the user, and use an INI file instead of the Registry. I don't particularily like it but I think that's my only choice.

                  S 1 Reply Last reply
                  0
                  • U User 9153669

                    Well, this is what I have found so far. The Registry key permission setting does indeed stop my program from writing to its Registry key. On my two WinXP and my Win7 systems the Registry key permissions are set to "full control". Registry editor does not allow me to manually change the "full control" permission to "Read". The "full control" permission is checked but disabled (dimmed) so I can't change it and I don't know why. I had to find a utility that changed the permission outside of registry editor. When the key permission was changed to "read" then writing to the Registry failed. CWinApp:WriteProfileInt() fails with a "read" permision but there is no error code associated with the failure (i.e. GetLastError() doesn't return an error code). I think the only thing I can do is detect the Registry write failure, report it to the user, and use an INI file instead of the Registry. I don't particularily like it but I think that's my only choice.

                    S Offline
                    S Offline
                    Shaheed Legion
                    wrote on last edited by
                    #9

                    When changing permissions on registry keys using regedit, make sure you select your user name to see which permissions you have. Programmatic changes to the registry are done using either your user account or the system user account, or some similar named account on the system. My bet is that the read or write permission is not set for all the accounts on your system. This is easy to check, open your regedit, navigate to the key in question, right click the key, select permissions. This should show a registry permissions dialog. Select each user account on the top section of the dialog and watch how the related permissions change for the different accounts. When you find the account with the missing permission, you will have your culprit. Hope this helps.

                    For awesome websites or just to chat check out my blog for more info. . .

                    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