简体   繁体   English

在VB.NET中获得注册表项所有权的简单方法?

[英]Easy way to take ownership of a Registry key in VB.NET?

I am creating a VB.NET application and I want that application to be able to take ownership of few Registry keys. 我正在创建一个VB.NET应用程序,我希望该应用程序能够拥有几个注册表项的所有权。

There doesn't seem to be an easy way to do this. 似乎没有简单的方法可以做到这一点。 Someone suggested to me a complex procedure that requires about 300 lines of code. 有人向我建议了一个复杂的过程,需要大约300行代码。 It seems to me that is too much effort for what is conceptually an easy task. 在我看来,从概念上讲这是一件容易的事,这需要太多的努力。

So, is there a straightforward way to change or take ownership of a Registry key? 因此,是否有直接的方法来更改或获取注册表项的所有权?

Assuming the current user has the necessary rights to take ownership: 假设当前用户拥有获取所有权的必要权利:

(I suspect the 300 lines of code was using P/Invoke from the days before the .NET framework had support for reading and manipulating ACLs.) (我怀疑从.NET框架支持读取和操纵ACL的那几天开始,这300行代码就在使用P / Invoke。)

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM