FileSecurity修订版号. [英] FileSecurity revision number.

查看:112
本文介绍了FileSecurity修订版号.的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要用dota填充指向SECURITY_DESCRIPTOR的指针,该指针将表示某些文件和文件夹的描述符.我使用FileSecurity对象设置一些属性,然后使用GetSecurityDescriptorBinaryForm.另一方面,当应该读取我的描述符时,会收到一个错误,指出修订号不是1无效.如何在FileSecurity或Binaryform中设置该数字?
在此先谢谢您.

I need to fill pointer to SECURITY_DESCRIPTOR with dota that will represent descriptors of certain files and folders. I use FileSecurity object set some properties and then use GetSecurityDescriptorBinaryForm. On the other end of that when my descriptor should be read it gets an error that revision number other than 1 is invalid. How to set that number either in FileSecurity or binaryform?
Thanks in advance.

推荐答案

尝试类似的方法:

Try something like this:

SECURITY_ATTRIBUTES lpSecurityAttributes = new SECURITY_ATTRIBUTES();
DirectorySecurity security = new DirectorySecurity();
lpSecurityAttributes.nLength = Marshal.SizeOf(lpSecurityAttributes);
byte[] src = security.GetSecurityDescriptorBinaryForm();
IntPtr dest = Marshal.AllocHGlobal(src.Length);
Marshal.Copy(src, 0, dest, src.Length);
lpSecurityAttributes.lpSecurityDescriptor = dest;



在文章在.NET中操作NTFS交接点中找到了代码 [



Found the code in the article Manipulating NTFS Junction Points in .NET[^] Its a good read and may just do the trick for you.

Hogan


这篇关于FileSecurity修订版号.的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆