简体   繁体   English

以编程方式打开高级安全设置对话框

[英]Programmatically open Advanced Security Settings dialog?

Is there a way to open the Advanced Security Settings dialog for a directory/file programmatically? 有没有办法以编程方式打开目录/文件的高级安全设置对话框? This is the dialog I want to open: 这是我要打开的对话框:

高级安全对话框

You open it by clicking the Advanced button on the Security properties dialog for the directory/file. 通过单击目录/文件的“安全属性”对话框中的“高级”按钮打开它。

安全属性

There is this answer that shows how to open the Security properties tab using ShellExecuteEx , so perhaps there are different parameters that can be used to open the Advanced Security Settings dialog directly, but I don't know where to find documentation (or where to look in the registry) for the verbs/parameters supported. 这个答案显示了如何使用ShellExecuteEx打开安全属性选项卡,因此可能有不同的参数可用于直接打开高级安全设置对话框,但我不知道在哪里可以找到文档(或在哪里查看在注册表中)支持的动词/参数。

There is also the EditSecurityAdvanced API, but it looks like that requires implementing the functionality to get/set the ACL instead of using the functionality built in to the Windows shell. 还有EditSecurityAdvanced API,但看起来需要实现获取/设置ACL的功能,而不是使用内置于Windows shell的功能。

I'm working in VB.NET, but can translate C# or Windows API calls as needed, and pointers for how to do my own research would also be appreciated. 我正在使用VB.NET,但可以根据需要翻译C#或Windows API调用,并且我们也会感激指导如何进行自己的研究。

I couldn't find a direct way of opening it either. 我也找不到打开它的直接方法。 Using automation like the commentator Visual Vincent suggested isn't too hard. 使用Visual Vincent建议的评论员这样的自动化并不太难。 Don't forget to add references to the assemblies and import System.Windows.Automation 不要忘记添加对程序集的引用并导入System.Windows.Automation

Then this code should press the Advanced button for you. 然后此代码应按下“ Advanced按钮。 This way still creates the main properties dialog though. 这种方式仍然会创建主要属性对话框。

Dim FileName As String = "The file name you are viewing the properties of"
Dim AE As AutomationElement = AutomationElement.RootElement.FindFirst(TreeScope.Children, New PropertyCondition(AutomationElement.NameProperty, FileName + " Properties"))
Dim Advancedbtn = AE.FindFirst(TreeScope.Element Or TreeScope.Descendants, New PropertyCondition(AutomationElement.NameProperty, "Advanced"))
TryCast(Advancedbtn.GetCurrentPattern(InvokePattern.Pattern), InvokePattern).Invoke()

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

相关问题 以编程方式打开DPI设置对话框? - Open the DPI settings dialog programatically? 如何在iOS中以编程方式打开设置 - How to open settings programmatically in ios 以编程方式打开“文件夹选项”对话框 - Open “Folder Options” dialog programmatically C#从“高级安全设置”中获取目录的“应用于”信息 - C# Get “Apply To” information from “Advanced Security Settings” for a directory 以编程方式将规则添加到“具有高级安全性的Windows防火墙”管理单元? - Programmatically add rules to “Windows Firewall with Advanced Security snap-in”? 如何通过c#以编程方式更改COM安全设置? - How can I change COM Security settings programmatically by c#? 有没有办法从WinForms应用程序打开Windows日期和时间设置对话框? - Is there a way to open Windows date and time settings dialog from a WinForms application? 如何以编程方式打开自定义设置魅力弹出按钮? - How to keep the custom Settings Charm flyout open programmatically? 如何打开“网络和共享”部分的“高级共享设置”部分 - How can I open the “Advanced Sharing Settings” section of the Network and Sharing section 您可以以编程方式打开“以不同用户身份运行”对话框吗? - Can you programmatically open the "Run as different user" dialog box?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM