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. System32 access denied

System32 access denied

Scheduled Pinned Locked Moved Windows API
csharpc++helpworkspace
12 Posts 4 Posters 1 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.
  • I Identity Undisclosed

    I am developing an application in C# and want it to run under Vista environment. I am copying a specific file from a path to Windows/System32 Folder. However, I get access denied error even though I have logged in as administrator. Thanks.

    "C makes it easy to shoot yourself in the foot. C++ makes it harder, but when you do, it blows away your whole leg." - Bjarne Stroustrup

    M Offline
    M Offline
    Michael Dunn
    wrote on last edited by
    #3

    This is the correct behavior, read up on UAC.

    --Mike-- Visual C++ MVP :cool: LINKS~! Ericahist | PimpFish | CP SearchBar v3.0 | C++ Forum FAQ

    J 1 Reply Last reply
    0
    • J Jonathan Darka

      That's the correct behaviour, even an application running as administrator will need elevation if you want to write to any protected part of th file system / registry. You could either ship a manifest with your application, or change the folder location you are trying to write to. regards,


      Jonathan Wilkes Darka[Xanya.net]

      J Offline
      J Offline
      jbalaji84
      wrote on last edited by
      #4

      Hi Jonathan, I am getting similar problem relatd to access denied for Administrator user as follows: I Created a user with admin rights in Vista Business trial version. Account type of the user is 'Administrator'. The following registry access is denied for that user when i tried accessing it through CreateFile() fuction: HKEY_LOCAL_MACHINE\CurrentControlSet\Control\Class\\Properties Even when i tried accessing the above location directly using "REGEDIT", i am getting a pop-up dialog saying "Access restricted". Do we need to do any specific configuration change for resolving this issue? I need to access the above location as a user with Admin rights. How can i gain access to that registry? Any tweaking ???? :)

      1 Reply Last reply
      0
      • J Jonathan Darka

        That's the correct behaviour, even an application running as administrator will need elevation if you want to write to any protected part of th file system / registry. You could either ship a manifest with your application, or change the folder location you are trying to write to. regards,


        Jonathan Wilkes Darka[Xanya.net]

        J Offline
        J Offline
        jbalaji84
        wrote on last edited by
        #5

        Hi Jonathan, I am getting similar problem relatd to access denied for Administrator user as follows: I Created a user with admin rights in Vista Business trial version. Account type of the user is 'Administrator'. The following registry access is denied for that user when i tried accessing it through CreateFile() fuction: HKEY_LOCAL_MACHINE\CurrentControlSet\Control\Class\\Properties Even when i tried accessing the above location directly using "REGEDIT", i am getting a pop-up dialog saying "Access restricted". Do we need to do any specific configuration change for resolving this issue? I need to access the above location as a user with Admin rights. How can i gain access to that registry? Any tweaking ???? :) Balaji.J

        J 1 Reply Last reply
        0
        • M Michael Dunn

          This is the correct behavior, read up on UAC.

          --Mike-- Visual C++ MVP :cool: LINKS~! Ericahist | PimpFish | CP SearchBar v3.0 | C++ Forum FAQ

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

          Hi Jonathan, I am getting similar problem relatd to access denied for Administrator user as follows: I Created a user with admin rights in Vista Business trial version. Account type of the user is 'Administrator'. The following registry access is denied for that user when i tried accessing it through CreateFile() fuction: HKEY_LOCAL_MACHINE\CurrentControlSet\Control\Class\\Properties Even when i tried accessing the above location directly using "REGEDIT", i am getting a pop-up dialog saying "Access restricted". Do we need to do any specific configuration change for resolving this issue? I need to access the above location as a user with Admin rights. How can i gain access to that registry? Any tweaking ???? Balaji.J

          J 1 Reply Last reply
          0
          • J jbalaji84

            Hi Jonathan, I am getting similar problem relatd to access denied for Administrator user as follows: I Created a user with admin rights in Vista Business trial version. Account type of the user is 'Administrator'. The following registry access is denied for that user when i tried accessing it through CreateFile() fuction: HKEY_LOCAL_MACHINE\CurrentControlSet\Control\Class\\Properties Even when i tried accessing the above location directly using "REGEDIT", i am getting a pop-up dialog saying "Access restricted". Do we need to do any specific configuration change for resolving this issue? I need to access the above location as a user with Admin rights. How can i gain access to that registry? Any tweaking ???? :) Balaji.J

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

            Hi, What you are seeing is correct, the issue is that there may be no owner for that registry item, hence you cannot view/change it. What you need to do is this: 1) Open regedit and go to HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Class 2) Right click on the key to want to change and choose Permissions from the menu. 3) Click on the Advanced button and go to the Owner tab 4) Change the owner to the local machine's Administrators group, checking the Replace owner on subcontainers and objects box. 5) Click on the OK buttons until the initial Permissions dialog has disappeared. You should now have permission to view/edit the registry entries. If you are not a member of the Administrators group, you will need to add your user account to the list of accounts who can access that registry key (from first page on permissions dlg) first before you can access them. regards,


            Jonathan Wilkes Darka[Xanya.net]

            J 1 Reply Last reply
            0
            • J jbalaji84

              Hi Jonathan, I am getting similar problem relatd to access denied for Administrator user as follows: I Created a user with admin rights in Vista Business trial version. Account type of the user is 'Administrator'. The following registry access is denied for that user when i tried accessing it through CreateFile() fuction: HKEY_LOCAL_MACHINE\CurrentControlSet\Control\Class\\Properties Even when i tried accessing the above location directly using "REGEDIT", i am getting a pop-up dialog saying "Access restricted". Do we need to do any specific configuration change for resolving this issue? I need to access the above location as a user with Admin rights. How can i gain access to that registry? Any tweaking ???? Balaji.J

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

              See my previous post regards,


              Jonathan Wilkes Darka[Xanya.net]

              1 Reply Last reply
              0
              • J Jonathan Darka

                Hi, What you are seeing is correct, the issue is that there may be no owner for that registry item, hence you cannot view/change it. What you need to do is this: 1) Open regedit and go to HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Class 2) Right click on the key to want to change and choose Permissions from the menu. 3) Click on the Advanced button and go to the Owner tab 4) Change the owner to the local machine's Administrators group, checking the Replace owner on subcontainers and objects box. 5) Click on the OK buttons until the initial Permissions dialog has disappeared. You should now have permission to view/edit the registry entries. If you are not a member of the Administrators group, you will need to add your user account to the list of accounts who can access that registry key (from first page on permissions dlg) first before you can access them. regards,


                Jonathan Wilkes Darka[Xanya.net]

                J Offline
                J Offline
                jbalaji84
                wrote on last edited by
                #9

                Hi, Thanks for the reply. I am not trying to access Registry path using CreateFile(), i was trying to access manually through REGEDIT. Now after giving permission for that Registry path manually, by right clicking that registry and setting the "Permission", i was able to access that Registry manually. The main problem now is, i am trying to access the device path using its GUID valus,Now the code fails in the following CreateFile() function and when i see the reason using GetLastError(), it says "Access is Denied". The following is the piece of code which fails(Remember, this same code works well in XP and 2000. Only in Vista, i am getting this problem): snprintf(device_path, sizeof(device_path), "\\\\.\\%s.tap",device_guid); thandle =CreateFile (device_path, GENERIC_READ | GENERIC_WRITE, 0, 0, OPEN_EXISTING, FILE_ATTRIBUTE_SYSTEM | FILE_FLAG_OVERLAPPED, 0); if ( thandle == INVALID_HANDLE_VALUE) { LOG (stderr,"Error : CreateFile failed on Netdirect device: %s",device_path); exit (1); } Could you tell me why this CreateFile() functin fails in that above case? Thanks in Advance. Balaji.J

                J 1 Reply Last reply
                0
                • J jbalaji84

                  Hi, Thanks for the reply. I am not trying to access Registry path using CreateFile(), i was trying to access manually through REGEDIT. Now after giving permission for that Registry path manually, by right clicking that registry and setting the "Permission", i was able to access that Registry manually. The main problem now is, i am trying to access the device path using its GUID valus,Now the code fails in the following CreateFile() function and when i see the reason using GetLastError(), it says "Access is Denied". The following is the piece of code which fails(Remember, this same code works well in XP and 2000. Only in Vista, i am getting this problem): snprintf(device_path, sizeof(device_path), "\\\\.\\%s.tap",device_guid); thandle =CreateFile (device_path, GENERIC_READ | GENERIC_WRITE, 0, 0, OPEN_EXISTING, FILE_ATTRIBUTE_SYSTEM | FILE_FLAG_OVERLAPPED, 0); if ( thandle == INVALID_HANDLE_VALUE) { LOG (stderr,"Error : CreateFile failed on Netdirect device: %s",device_path); exit (1); } Could you tell me why this CreateFile() functin fails in that above case? Thanks in Advance. Balaji.J

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

                  I never said you were - I think you meant to reply to Mike Dimmick. :-)


                  Jonathan Wilkes Darka[Xanya.net]

                  J 1 Reply Last reply
                  0
                  • J Jonathan Darka

                    I never said you were - I think you meant to reply to Mike Dimmick. :-)


                    Jonathan Wilkes Darka[Xanya.net]

                    J Offline
                    J Offline
                    jbalaji84
                    wrote on last edited by
                    #11

                    ya, u didnt say me :-D But apart from that line, the remaining part of the discussion is for you also...:-O Balaji.J

                    J 1 Reply Last reply
                    0
                    • J jbalaji84

                      ya, u didnt say me :-D But apart from that line, the remaining part of the discussion is for you also...:-O Balaji.J

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

                      :-D Just in case you didn't get notified by CodeProject, see my other reply here[^]


                      Jonathan Wilkes Darka[Xanya.net]

                      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