更改组件服务中的访问权限> COM 安全性与脚本/API?
是否有一个 api 可以更改 COM 安全性的访问权限?我需要将新值写入“编辑限制...”和“编辑默认值...”。这些是普通的注册表设置吗?找不到如何设置这些条目。
is there an api to change the Access Permissions for the COM Security? i need to write new values to "Edit Limits..." and "Edit Default...". are these plain registry settings? can't find how to set these entries.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
快速回答是“是”,它们是注册表设置,长答案是“否”,它们不是简单注册表设置。这些值是二进制的并指向 ACL 结构。为了更改这些,您需要加载、更新和保存 ACL(这需要大量代码)。 Windows SDK 中的 DCOMPerm 示例 是一个不错的选择首先,我将它用作我在工作中用来处理此问题的一组类的基础(不幸的是,我无法将该代码发布到公共领域)
您可以查看 MSDN 文档,了解 DCOM 密钥结构 - 涵盖计算机范围的设置。 COM 应用程序特定的设置存储在注册表中其 APPID 下的 AccessPermission 和 LaunchPermission 值中。
请记住,如果操作不当,修改计算机范围设置的 ACL 可能会很快导致您的计算机无法使用。如果我没记错的话,您可以简单地删除这些值(通过 RegEdit),操作系统将恢复默认值以恢复您的计算机...但我不再 100% 确定这一点。
编辑:二进制数据实际上是一个安全描述符,但最终它是需要处理的包含的 ACL - SD 只是在解包/打包时添加了一层代码。
The quick answer is Yes they are registry settings, the long answer is No they are not simple registry settings. The values are binary and point to an ACL structure. In order to change these you need to load, update, and save the ACL (which requires a fair amount of code). The DCOMPerm sample in the windows SDK is a decent place to start, i have used it as a basis for a set of classes i use at work to handle this problem (Unfortunately, i am not able to release that code into the public domain)
You can review the MSDN Documentation for the DCOM key structure - that covers computer wide settings. COM application specific settings are stored under its APPID in the registry in the AccessPermission and LaunchPermission values.
Keep in mind that modifying the ACLs for the machine wide settings can quickly render your machine unusable if you do it incorrectly. If i remember correctly, you can simply delete the values (via RegEdit) and the OS will restore defaults to bring your machine back... but i'm not 100% certain on that anymore.
EDIT: The binary data is actually a Security Descriptor, but ultimately its the contained ACL that needs to dealt with - the SD just adds one more layer of code when unpacking/packing it.