473,804 Members | 3,460 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

OpenSubKey() Requested registry access is not allowed

Hi group,

i search a way to change permissions of a registry key, where only the
system account have got full rights.
It is not stupid to think that this is possible because i am the owner
(administrator) of the key and it is possible to change it with
regedit32.exe.

The following code fails on OpenSubKey() with
System.Security .SecurityExcept ion: Requested registry access is not allowed

// ----start----
SetPermissions( ){
String^ user = Environment::Us erDomainName + "\\testuser ";
RegistryKey^ openedKey;
RegistrySecurit y regSecurity = gcnew RegistrySecurit y();
regSecurity->AddAccessRule( gcnew RegistryAccessR ule(user,
RegistryRights: :ReadKey,
InheritanceFlag s::ContainerInh erit | InheritanceFlag s::ObjectInheri t,
PropagationFlag s::InheritOnly,
AccessControlTy pe::Allow));
regSecurity->SetAccessRuleP rotection(false ,true);
openedKey =
Registry::Users->OpenSubKey(" S-1-5-18\\software\\t estkey",true);
openedKey->SetAccessContr ol(regSecurity) ;
return 0;
}
// ----end----
Oct 14 '07 #1
0 1965

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
5816
by: Scott Emick | last post by:
In my visual studio (enterprise arch. 2003) when I try to open my projects, or add to a project a component (vb windows project) I get a big red X inside a red frame and the error pops up: The following exception has occured: SecurityException: Requested Registry Access is not allowed. I have already re-installed visual studio (repair mode), that did not fix the problem. I am not sure what registry entry this thing is trying to
2
15076
by: Brian Campbell | last post by:
Gretings... I have written a Windows Service that accesses a Web Service. Both run fine on my development machine.... After installing both the Windows Service and Web Service on my staging server, I get the following error...
2
7887
by: Ray5531 | last post by:
I keep getting this error when my asp.net application tries to write into the registry System.Security.SecurityException: Requested registry access is not allowed. I followed the following article and I still get the error: http://support.microsoft.com/default.aspx?scid=kb;en-us;329291 Any suggestions? Thanks
3
2510
by: bfprog | last post by:
Using IBM iSeries client access OLEDB provider to connect to DB2 on AS/400, but cannot create connection using .NET web app. Using following code: Dim cnTest As New OleDbConnection("Provider=IBMDA400; Data Source=S10324NM; User ID=THEUSER; Password=THESECRET") Works fine in console app, but fails in web app with: System.Security.SecurityException: Requested registry access is not allowed.
5
4674
by: Steve Bottoms | last post by:
Hi, all... Trying to determine how to check the state of OpenSubKey when called. What is the return value if the requested subkey doesn't exist?? I try a GetType on the result but only get a bizarre error, so I'm uncertain what should be returned on both success or failure! Thanks! Jack
1
4337
by: PrettySneaky | last post by:
I currently working on a webservice which calls a DCOM object! The webproject works just fine when i run it in Visual studio 2005. However due to some compability issues with .NET 2.0 and the server which my webservice uses I have to use Visual Studio 2003 and a older .NET framework (.NET 1.1 or something, not important). Now it's impossible to run the webservices and I believe it has to do with something with the security settings of...
6
12931
by: Steve Teeples | last post by:
I have a piece of code (written is Visual Studio 2005) that is only reading the Security EventLog. On Windows XP Professiona/Home this code works just fine. int numberOfEntries = myEventLog.Entries.Count; if (numberOfEntries > 0) ... However, when run under Windows Vista I get the error "Requested registry access is not allowed." This error occurs when the first line of code is executed.
7
12109
by: Peter Ritchie | last post by:
I'm writing a Web Service and I would like to add performance counter data for monitoring performance of the Web Service's operations over time and load. The problem is, I get the "Requested registry access is not allowed." SecurityException when I try and create the performance counter category via PerformanceCounterCategory.Create(). I understand the login used to run the Web Service does not have access to the registry keys...
1
3152
by: UK1967 | last post by:
I wrote a ASP.NET application (Windows 2003 Enterprise Server, IIS, .NET Framework 1.1). This application use the Windows (AD) account and impersonation. Some functions in this application contact, read and change the remote registry (HKLM/Software/...) of some internal server. After installing SP1 on the web server (IIS) all functions with registry access don't run and generate the following error: "Requested registry access is not...
0
9576
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10567
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10323
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10310
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9138
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
5515
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5647
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
3809
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2983
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.