当前位置: 首页 > wzjs >正文

最好的网站建设公司哪家好网页设计师培训大全

最好的网站建设公司哪家好,网页设计师培训大全,厦工品牌网站设计,无人区高清免费看完整版在Windows编程中,我们通常需要借助通用对话框的力量,今天我们就聊一下“安全属性表”通用对话框的使用心得。 当我们调用EditSecurity函数时: 1.EditSecurity将调用ISecurityInformation中的GetObjectInformation函数 在编写 ISecurityInf…

在Windows编程中,我们通常需要借助通用对话框的力量,今天我们就聊一下“安全属性表”通用对话框的使用心得。

当我们调用EditSecurity函数时:

1.EditSecurity将调用ISecurityInformation中的GetObjectInformation函数

在编写 ISecurityInformation.GetObjectInformation(out SI_OBJECT_INFO pObjectInfo)时

我们需要将结构返还给函数,GetObjectInformation用于初始化属性表的样式

看一下结构:

    public struct SI_OBJECT_INFO
    {
        public uint dwFlags;
        public IntPtr hInstance;
        public string pszServerName;
        public string pszObjectName;
        public string pszPageTitle;
        public Guid guidObjectType;
    }

解释一下:dwFlags为属性表样式的标志SI_OBJECT_INFO 结构

pszObjectName为属性表的标题

pszPageTitle为属性页的标题

2.接着EditSecurity将调用ISecurityInformation中的GetSecurity函数

GetSecurity(uint RequestedInformation, out IntPtr ppSecurityDescriptor, bool fDefault)

其他我们不需要过于处理,专注于“ppSecurityDescriptor”,一个句柄,

例如:

public string _filePath;

            public void GetSecurity(uint RequestedInformation, out IntPtr ppSecurityDescriptor, bool fDefault)
            {
            ppSecurityDescriptor = IntPtr.Zero;

            // 获取文件的安全描述符
            var fileSecurity = File.GetAccessControl(_filePath);
            var rawSecurityDescriptor = fileSecurity.GetSecurityDescriptorBinaryForm();

            // 将安全描述符复制到非托管内存
            ppSecurityDescriptor = Marshal.AllocHGlobal(rawSecurityDescriptor.Length);
            Marshal.Copy(rawSecurityDescriptor, 0, ppSecurityDescriptor, rawSecurityDescriptor.Length);
            }

3.当我们将这两个函数处理好以后基本就可以弹出这个对话框了

如下(Powershell+C#):

Add-Type -TypeDefinition @"
using System;
using System.IO;
using System.Runtime.InteropServices;
// 定义必要的结构和接口
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]public struct SI_OBJECT_INFO{public uint dwFlags;public IntPtr hInstance;public string pszServerName;public string pszObjectName;public string pszPageTitle;public Guid guidObjectType;}[ComImport, Guid("965FC360-16FF-11d0-91CB-00AA00BBB723"), InterfaceType(ComInterfaceType.InterfaceIsIUnknown)]public interface ISecurityInformation{void GetObjectInformation(out SI_OBJECT_INFO pObjectInfo);void GetSecurity(uint RequestedInformation, out IntPtr ppSecurityDescriptor, [MarshalAs(UnmanagedType.Bool)] bool fDefault);void SetSecurity(uint SecurityInformation, IntPtr pSecurityDescriptor);void GetAccessRights(ref Guid pguidObjectType, uint dwFlags, out IntPtr ppAccess, out uint pcAccesses, out uint piDefaultAccess);void MapGeneric(ref Guid pguidObjectType, ref byte pAceFlags, ref uint pMask);void GetInheritTypes(out IntPtr ppInheritTypes, out uint pcInheritTypes);void PropertySheetPageCallback(IntPtr hwnd, uint uMsg, uint uPage);}public class FileSecurityInfo : ISecurityInformation{public FileSecurityInfo(){}public const uint SI_PAGE_TITLE = 0x00000800;public const uint SI_EDIT_ALL = 0x00000003;// 实现接口方法public void GetObjectInformation(out SI_OBJECT_INFO pObjectInfo){pObjectInfo = new SI_OBJECT_INFO(){dwFlags = Flags,  // SI_EDIT_PERMSpszObjectName = ObjectName,pszServerName = null,pszPageTitle = PageTitle,guidObjectType = Guid.Empty};}public string PageTitle;public string ObjectName;public string _filePath;public uint Flags = SI_PAGE_TITLE | SI_EDIT_ALL;public void GetSecurity(uint RequestedInformation, out IntPtr ppSecurityDescriptor, bool fDefault){ppSecurityDescriptor = IntPtr.Zero;// 获取文件的安全描述符var fileSecurity = File.GetAccessControl(_filePath);var rawSecurityDescriptor = fileSecurity.GetSecurityDescriptorBinaryForm();// 将安全描述符复制到非托管内存ppSecurityDescriptor = Marshal.AllocHGlobal(rawSecurityDescriptor.Length);Marshal.Copy(rawSecurityDescriptor, 0, ppSecurityDescriptor, rawSecurityDescriptor.Length);}public void SetSecurity(uint SecurityInformation, IntPtr pSecurityDescriptor){//if (!SetFileSecurity(_filePath, SecurityInformation, pSecurityDescriptor))//{//    throw new System.ComponentModel.Win32Exception(Marshal.GetLastWin32Error());//}}// 其他接口方法留空(需根据需求实现)public void GetAccessRights(ref Guid pguidObjectType, uint dwFlags, out IntPtr ppAccess, out uint pcAccesses, out uint piDefaultAccess){ppAccess = IntPtr.Zero;pcAccesses = 0;piDefaultAccess = 0;}public void MapGeneric(ref Guid pguidObjectType, ref byte pAceFlags, ref uint pMask) { }public void GetInheritTypes(out IntPtr ppInheritTypes, out uint pcInheritTypes){ppInheritTypes = IntPtr.Zero;pcInheritTypes = 0;}public void PropertySheetPageCallback(IntPtr hwnd, uint uMsg, uint uPage) { }[DllImport("aclui.dll")][return: MarshalAs(UnmanagedType.Bool)]public static extern bool EditSecurity(IntPtr hwndOwner, ISecurityInformation psi);}"@ # 使用示例# 创建安全信息对象
$securityInfo = New-Object FileSecurityInfo
$securityInfo.PageTitle = "于子轩的安全属性对话框"
$securityInfo.Flags = 0x00000010L  #高级选项
$securityInfo.Flags += 0x00000080L  #高级选项
$securityInfo.Flags += 0x00000001l  #高级选项-所有者
$securityInfo.Flags += 0x00000800L  #PageTitle属性作为标题
#$securityInfo.Flags += 0x00000008l  #禁止修改
$securityInfo.Flags += 0x00000020L  #高级选项-还原默认所有者
$securityInfo.Flags += 0x00040000L  #高级选项-还原默认值按钮
$securityInfo.Flags += 0x08000000L  #高级选项-还原默认值按钮
$securityInfo.ObjectName =  "AclUI.h";
#$securityInfo.Flags += 0x00200000l  #隐藏“高级安全设置”页面上的“特殊权限”选项卡#$securityInfo.Flags = 0x02000000L  #所有者
$securityInfo._filePath = "C:\\Program Files (x86)\\Windows Kits\\10\\Include\\10.0.22621.0\\um\\AclUI.h";[FileSecurityInfo]::EditSecurity([IntPtr]::Zero, $securityInfo)


文章转载自:

http://qapMZaQn.cwgfq.cn
http://sk1iNo69.cwgfq.cn
http://YMfvg43s.cwgfq.cn
http://gMxL9MJB.cwgfq.cn
http://iivuBAzx.cwgfq.cn
http://sMNZ7tlL.cwgfq.cn
http://0XslhN9f.cwgfq.cn
http://1189RlJz.cwgfq.cn
http://mwfv6Mdf.cwgfq.cn
http://kc7KMgVO.cwgfq.cn
http://O7NAQG2o.cwgfq.cn
http://La7RCkTG.cwgfq.cn
http://5osRhX9e.cwgfq.cn
http://TevGeeVn.cwgfq.cn
http://fBo4dRny.cwgfq.cn
http://lgtDv1Qb.cwgfq.cn
http://L4NsHvhB.cwgfq.cn
http://v3YCFEGn.cwgfq.cn
http://g7h4Xni0.cwgfq.cn
http://Pkn4l4oH.cwgfq.cn
http://7PfzE4pI.cwgfq.cn
http://i2JDkFym.cwgfq.cn
http://Tk16syoU.cwgfq.cn
http://HZVS8UB1.cwgfq.cn
http://1NDQafzt.cwgfq.cn
http://JiqRRX19.cwgfq.cn
http://E1MnN9Gm.cwgfq.cn
http://HfeQLJZe.cwgfq.cn
http://UHApiIyJ.cwgfq.cn
http://ozrvfO04.cwgfq.cn
http://www.dtcms.com/wzjs/665557.html

相关文章:

  • 福州建设注册中心网站网站建设公司高端
  • 怎样设计网站静态页面网页设计与制作属于什么专业
  • 江都网络建站企业外包
  • 网站开发服务计入什么科目网站更换程序
  • 密云做网站的网络营销价格策略有哪些
  • 成都私人做网站建设的公司建设银行集团网站
  • 青岛网站建设工作室织梦模板wordpress建站多少钱
  • 企业网站建设变相收取等级保护费电商网站建设精英
  • 伊春市住房和城乡建设局网站山东省交通厅建设网站
  • 力软框架做网站我要推广
  • 重庆网站建设公司价钱网站公司图片
  • 长春服务好的网站建设庆阳门户网站
  • 深圳建设工程招投标网站定制开发软件系统开发
  • mui 网站开发南京做网站建设有哪些
  • 台州做网站优化做网站的准备什么
  • 网站建设方案书 模板斗门区住房和城乡建设网站
  • vue.js网站开发用例phpstudy 搭建wordpress
  • 软件下载网站如何履行安全管理义务上海网安备案网站
  • 网站制作评价指标网站运营技巧
  • 网站系统建设费用知识库搭建工具
  • 阿里巴巴国际站运营工作内容上海大学生兼职做网站
  • dede 网站源码邢台移动端网站建设
  • 网站公司推荐软件技术属于什么专业大类
  • 湖南株洲建设局网站wordpress主页修改主页
  • 建设民政局网站需要多少钱什么是网站名
  • 上海网站开发毕业生渑池县建设局网站
  • 高校网站建设花费品牌型网站设计推荐
  • 网站图片360度旋转怎么做的优化公司流程制度
  • 网站建设部署与发布试题广西壮族自治区成立时间
  • 网站开发的费用嘉兴网站建设品牌升级