how to change administrator user rights
-
Hi, 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 we acheive that? Balaji.J
-
Hi, 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 we acheive that? Balaji.J
-
Hi, 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 we acheive that? Balaji.J
I'm not surprised, you cannot pass registry paths to
CreateFile
because they are not files. Perhaps you should tryRegCreateKeyEx
instead?Stability. What an interesting concept. -- Chris Maunder
-
I'm not surprised, you cannot pass registry paths to
CreateFile
because they are not files. Perhaps you should tryRegCreateKeyEx
instead?Stability. What an interesting concept. -- Chris Maunder
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.JHave you tried running your application "As an administrator" so that it is elevated ?
Jonathan Wilkes Darka[Xanya.net]
-
Have you tried running your application "As an administrator" so that it is elevated ?
Jonathan Wilkes Darka[Xanya.net]
I tried running the application by logging into the "Administrator" user. In that case, there was no problem and everything works fine. But when i log-in in to the user account which is of "Administrator" type in Vista, and tried running my application, it fails in that CreateFile() function call with "Access is Denied" error value. Balaji.J
-
I tried running the application by logging into the "Administrator" user. In that case, there was no problem and everything works fine. But when i log-in in to the user account which is of "Administrator" type in Vista, and tried running my application, it fails in that CreateFile() function call with "Access is Denied" error value. Balaji.J
jbalaji84 wrote:
But when i log-in in to the user account which is of "Administrator" type in Vista, and tried running my application, it fails in that CreateFile() function call with "Access is Denied" error value.
Try this, from this second account. In explorer, right click on the .exe and select "Run as administrator" from the context menu. If this works, then you need to add a manifest file to your application. regards,
Jonathan Wilkes Darka[Xanya.net]
-
jbalaji84 wrote:
But when i log-in in to the user account which is of "Administrator" type in Vista, and tried running my application, it fails in that CreateFile() function call with "Access is Denied" error value.
Try this, from this second account. In explorer, right click on the .exe and select "Run as administrator" from the context menu. If this works, then you need to add a manifest file to your application. regards,
Jonathan Wilkes Darka[Xanya.net]
Unfortunately, my application is automatically invoked by CreateProcess() for that. So i cant right click that exe and do so? Is there any other way? OR can u provide the info about how to include manifest file in my code so that i can try that directly??? Balaji.J
-
Unfortunately, my application is automatically invoked by CreateProcess() for that. So i cant right click that exe and do so? Is there any other way? OR can u provide the info about how to include manifest file in my code so that i can try that directly??? Balaji.J
Sure thing,
<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0">
<assemblyIdentity version="1.0.0.0"
processorArchitecture="X86"
name="MyExe.exe"
type="win32"/>
<description>MyExe Description</description><!-- Identify the application security requirements. -->
<trustInfo xmlns="urn:schemas-microsoft-com:asm.v3">
<security>
<requestedPrivileges>
<requestedExecutionLevel
level="asInvoker"
uiAccess="false"/>
</requestedPrivileges>
</security>
</trustInfo>
</assembly>For a simple test, save this manifest into a text file with the same name as your .exe, but with a
.manifest
file extension, and put it in the same folder as the .exe you are running, Vista should pick it up automatically. So, if your exe is:Myexe.exe
your manifest needs to be called:
Myexe.exe.manifest
If all this works, you can later embed the manifest into your .exe so you don't need to ship a seperate file. regards,
Jonathan Wilkes Darka[Xanya.net]
-
Sure thing,
<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0">
<assemblyIdentity version="1.0.0.0"
processorArchitecture="X86"
name="MyExe.exe"
type="win32"/>
<description>MyExe Description</description><!-- Identify the application security requirements. -->
<trustInfo xmlns="urn:schemas-microsoft-com:asm.v3">
<security>
<requestedPrivileges>
<requestedExecutionLevel
level="asInvoker"
uiAccess="false"/>
</requestedPrivileges>
</security>
</trustInfo>
</assembly>For a simple test, save this manifest into a text file with the same name as your .exe, but with a
.manifest
file extension, and put it in the same folder as the .exe you are running, Vista should pick it up automatically. So, if your exe is:Myexe.exe
your manifest needs to be called:
Myexe.exe.manifest
If all this works, you can later embed the manifest into your .exe so you don't need to ship a seperate file. regards,
Jonathan Wilkes Darka[Xanya.net]