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. Registry access denied when accessing registry

Registry access denied when accessing registry

Scheduled Pinned Locked Moved Windows API
windows-adminquestion
7 Posts 4 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.
  • _ Offline
    _ Offline
    __DanC__
    wrote on last edited by
    #1

    I have an application which creates various file associations in the registry which works perfectly under XP but causes UnauthorizedAccessExceptions when run on Vista. Is there a way to allow this application (which must be run on Windows startup) access to the registry for normal users?

    J 1 Reply Last reply
    0
    • _ __DanC__

      I have an application which creates various file associations in the registry which works perfectly under XP but causes UnauthorizedAccessExceptions when run on Vista. Is there a way to allow this application (which must be run on Windows startup) access to the registry for normal users?

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

      Add a manifest file to your application, although you should really change your code to avoid writing to protected area's of the registry. regards,


      Jonathan Wilkes Darka[Xanya.net]

      _ 1 Reply Last reply
      0
      • J Jonathan Darka

        Add a manifest file to your application, although you should really change your code to avoid writing to protected area's of the registry. regards,


        Jonathan Wilkes Darka[Xanya.net]

        _ Offline
        _ Offline
        __DanC__
        wrote on last edited by
        #3

        Thanks for the reply. I have added a manifest to the executable which solves the issue but it asks for permission to run each time, is there a way to make it just ask once on first run? Unfortunately, changing the code is not an option as it needs to add file associations to the registry which require access to HKEY_CLASSES_ROOT which is what appears to be causing the issue.

        M 1 Reply Last reply
        0
        • _ __DanC__

          Thanks for the reply. I have added a manifest to the executable which solves the issue but it asks for permission to run each time, is there a way to make it just ask once on first run? Unfortunately, changing the code is not an option as it needs to add file associations to the registry which require access to HKEY_CLASSES_ROOT which is what appears to be causing the issue.

          M Offline
          M Offline
          Mike Dimmick
          wrote on last edited by
          #4

          Your installer should do this and your application should leave the key the hell alone. If you want to write per-user file associations, you can write them to HKEY_CURRENT_USER\Software\Classes.


          DoEvents: Generating unexpected recursion since 1991

          _ 1 Reply Last reply
          0
          • M Mike Dimmick

            Your installer should do this and your application should leave the key the hell alone. If you want to write per-user file associations, you can write them to HKEY_CURRENT_USER\Software\Classes.


            DoEvents: Generating unexpected recursion since 1991

            _ Offline
            _ Offline
            __DanC__
            wrote on last edited by
            #5

            Again, this is not possible as they must be created by the application and are not known at installation time. I am looking into other ways of registering file extensions for Vista.

            D 1 Reply Last reply
            0
            • _ __DanC__

              Again, this is not possible as they must be created by the application and are not known at installation time. I am looking into other ways of registering file extensions for Vista.

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

              Split the registry writer into a second executable. You'll only get a UAC prompt when actually calling it to make a change.

              -- 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
              • D Dan Neely

                Split the registry writer into a second executable. You'll only get a UAC prompt when actually calling it to make a change.

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

                _ Offline
                _ Offline
                __DanC__
                wrote on last edited by
                #7

                Thanks for the suggestions. I found that you can actually add file associations on a per-user basis under the HKCU key which fixed my issues.

                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