473,669 Members | 2,460 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

How to detect the deleting permission for Registry key?

YXQ
How to detect programmaticall y if current user has the deleting permission
to delete a Registry key in VS 2005? thank you very much!

Dec 22 '06 #1
5 1833
Public Function GetAccessContro l As RegistrySecurit y

Dim instance As RegistryKey
Dim returnValue As RegistrySecurit y

returnValue = instance.GetAcc essControl
"YXQ" <ga***@163.comw rote in message
news:%2******** ********@TK2MSF TNGP06.phx.gbl. ..
How to detect programmaticall y if current user has the deleting permission
to delete a Registry key in VS 2005? thank you very much!

Dec 22 '06 #2
YXQ
I am very grateful if you can give full code.

"vbnetdev" <ad***@kjmsolut ions.comдÈëÏûÏ ¢
news:%2******** ********@TK2MSF TNGP04.phx.gbl. ..
Public Function GetAccessContro l As RegistrySecurit y

Dim instance As RegistryKey
Dim returnValue As RegistrySecurit y

returnValue = instance.GetAcc essControl
"YXQ" <ga***@163.comw rote in message
news:%2******** ********@TK2MSF TNGP06.phx.gbl. ..
>How to detect programmaticall y if current user has the deleting
permission to delete a Registry key in VS 2005? thank you very much!

Dec 22 '06 #3
Be careful of the 163.com spam gang & comcast.net who are both using these
newsgroups
"YXQ" <ga***@163.comw rote in message
news:uB******** ******@TK2MSFTN GP02.phx.gbl...
I am very grateful if you can give full code.

"vbnetdev" <ad***@kjmsolut ions.comдÈëÏûÏ ¢
news:%2******** ********@TK2MSF TNGP04.phx.gbl. ..
Public Function GetAccessContro l As RegistrySecurit y

Dim instance As RegistryKey
Dim returnValue As RegistrySecurit y

returnValue = instance.GetAcc essControl
"YXQ" <ga***@163.comw rote in message
news:%2******** ********@TK2MSF TNGP06.phx.gbl. ..
How to detect programmaticall y if current user has the deleting
permission to delete a Registry key in VS 2005? thank you very much!

Dec 22 '06 #4
This will bomb as not accetpable. If you change it to currentuser if you
have admin success it shoudl proceed without problem.

Sub Test3()
Dim regKey As Microsoft.Win32 .RegistryKey =
Microsoft.Win32 .Registry.Local Machine

Try
regKey.OpenSubK ey("console",
Microsoft.Win32 .RegistryKeyPer missionCheck.Re adWriteSubTree,
System.Security .AccessControl. RegistryRights. Delete).ToStrin g()
Catch ex As Exception
MessageBox.Show ("The specified access to the key was not
possible")
End Try

End Sub
"YXQ" <ga***@163.comw rote in message
news:uB******** ******@TK2MSFTN GP02.phx.gbl...
>I am very grateful if you can give full code.

"vbnetdev" <ad***@kjmsolut ions.comдÈëÏûÏ ¢
news:%2******** ********@TK2MSF TNGP04.phx.gbl. ..
>Public Function GetAccessContro l As RegistrySecurit y

Dim instance As RegistryKey
Dim returnValue As RegistrySecurit y

returnValue = instance.GetAcc essControl
"YXQ" <ga***@163.comw rote in message
news:%2******* *********@TK2MS FTNGP06.phx.gbl ...
>>How to detect programmaticall y if current user has the deleting
permission to delete a Registry key in VS 2005? thank you very much!


Dec 22 '06 #5
yxq
Thank you.

"vbnetdev" <ad***@kjmsolut ions.comдÈëÏûÏ ¢ÐÂÎÅ:uj******* *******@TK2MSFT NGP03.phx.gbl.. .
This will bomb as not accetpable. If you change it to currentuser if you
have admin success it shoudl proceed without problem.

Sub Test3()
Dim regKey As Microsoft.Win32 .RegistryKey =
Microsoft.Win32 .Registry.Local Machine

Try
regKey.OpenSubK ey("console",
Microsoft.Win32 .RegistryKeyPer missionCheck.Re adWriteSubTree,
System.Security .AccessControl. RegistryRights. Delete).ToStrin g()
Catch ex As Exception
MessageBox.Show ("The specified access to the key was not
possible")
End Try

End Sub
"YXQ" <ga***@163.comw rote in message
news:uB******** ******@TK2MSFTN GP02.phx.gbl...
>>I am very grateful if you can give full code.

"vbnetdev" <ad***@kjmsolut ions.comдÈëÏûÏ ¢
news:%2******* *********@TK2MS FTNGP04.phx.gbl ...
>>Public Function GetAccessContro l As RegistrySecurit y

Dim instance As RegistryKey
Dim returnValue As RegistrySecurit y

returnValue = instance.GetAcc essControl
"YXQ" <ga***@163.comw rote in message
news:%2****** **********@TK2M SFTNGP06.phx.gb l...
How to detect programmaticall y if current user has the deleting
permission to delete a Registry key in VS 2005? thank you very much!



Dec 24 '06 #6

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

Similar topics

3
19155
by: Yitzhak | last post by:
I am having "Permission denied" error while calling LogEvent method of WScript.Shell component. Basically, ASP page calls Windows Script Host Shell component to log events to the OS Application Event log. My environment: Windows Server 2003, IIS 6, WSH, Classic ASP, Vbscript Below is the code and the error: Code:
13
9511
by: Bob Darlington | last post by:
I have a repair and backup database routine which runs when a user closes down my application. It works fine in my development machine, but breaks on a client's at the following line: If Dir(strLDB) <> "" Then Kill (strLDB) where strLDB is the path to the ldb file. The client advises that the ldb doesn't lurk after the program closes. Any ideas?
7
14825
by: Bob | last post by:
I'm working on a Windows app that needs to write to the Registry HKLM. I keep getting a "System.UnauthorizedAccessException: Cannot write to the registry key." error when running the app. I'm logged in as an Administrator and it's a Windows app. What permission does it need? Here's the code. private void ChangeReg() { string regPath = "SOFTWARE\\Microsoft\\.NETFramework\\AssemblyFolders"; RegistryKey thisKey = Registry.LocalMachine;
2
3240
by: Sachin | last post by:
Hi All, I am using aspnet_setreg.exe to encrypt the username and password and store them in Web.Config file for impersonation. I have given ASPNET and Impersonation account to read the registry key. However, while running the application it fails saying that can't read the password for Registrty.
2
1791
by: Harry Barker | last post by:
Hi Group I Have to complete a small project and i need you guys help in doing it. I have to create a Tool that will automatically delete a file from the Harddrive and also deleting a SubKey from the registry. Before doing the same, the tool have to check the version of Windows. Ex: For Example if you guys could suggest me a coding where i can delete
7
1831
by: eSolTec, Inc. 501(c)(3) | last post by:
Thank you in advance for any and all assistance. I have an application that pulls files, folders and registry keys of installed programs. I'm wanting to with a context menu selection of "Delete Selected", delete "ALL" of the checked selected files, folders, registry keys. Can someone show me some code to do this please?
5
2102
by: Sandeep Singh Sekhon | last post by:
I am Developing a Web Application with ASP.NET 1.1 I have one project Folder which is virtual directory of IIS. In this directory, I have one Folder named Photos in which I used to Store Photos. On my Web Page, I have a button named delete which I used to delete photo in the folder. But when I click the button and apply the logic to delete the file, it raises an Exception that the access to the file is denied. I am using following code to...
7
1198
by: Austin Myers | last post by:
I need to be able to programmincally set (USER) permissions on a registry key. I've read the Knowledge Base articles and they all point to a couple of articles that seem to have been pulled form the knowledge base. (What's up with that?) I've so tried numerous samples from various forums, none of them work. To be specific, my code will be installed by the admin (assuming the admin has the machine locked down) and at this time I want...
4
3225
by: yxq | last post by:
Hello, I want to get the registry key permission information whether current user has the permission to delete the registry key using RegistryRights, how to do? thank you.
0
8465
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8895
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
8809
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
8588
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
8658
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
7407
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
5682
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
1
2797
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
1788
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.