System32 access denied
-
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
-
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
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]
-
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
This is the correct behavior, read up on UAC.
--Mike-- Visual C++ MVP :cool: LINKS~! Ericahist | PimpFish | CP SearchBar v3.0 | C++ Forum FAQ
-
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]
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 ???? :)
-
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]
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
-
This is the correct behavior, read up on UAC.
--Mike-- Visual C++ MVP :cool: LINKS~! Ericahist | PimpFish | CP SearchBar v3.0 | C++ Forum FAQ
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
-
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
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 choosePermissions
from the menu. 3) Click on theAdvanced
button and go to theOwner
tab 4) Change the owner to the local machine'sAdministrators
group, checking theReplace owner on subcontainers and objects
box. 5) Click on theOK
buttons until the initialPermissions
dialog has disappeared. You should now have permission to view/edit the registry entries. If you are not a member of theAdministrators
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]
-
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
-
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 choosePermissions
from the menu. 3) Click on theAdvanced
button and go to theOwner
tab 4) Change the owner to the local machine'sAdministrators
group, checking theReplace owner on subcontainers and objects
box. 5) Click on theOK
buttons until the initialPermissions
dialog has disappeared. You should now have permission to view/edit the registry entries. If you are not a member of theAdministrators
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]
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 -
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.JI never said you were - I think you meant to reply to Mike Dimmick. :-)
Jonathan Wilkes Darka[Xanya.net]
-
I never said you were - I think you meant to reply to Mike Dimmick. :-)
Jonathan Wilkes Darka[Xanya.net]
-
ya, u didnt say me :-D But apart from that line, the remaining part of the discussion is for you also...:-O Balaji.J