C# - 如何中检索一个路口或符号连接的目标以标准用户 [英] C# - How to retreive the target of a Junction or Symlink with a standard user
问题描述
我想获得一个路口的目标在我的计划,但我管理的唯一办法做到这一点是:
I am trying to get the target of a junction in my program, but the only way I managed do it is:
- 请求备份特权
- p-调用的CreateFile特殊参数,以获得一个句柄的文件/目录。
- DeviceIoControl调用到获取目标。
第1步将无法正常工作用户帐户,因为他们没有备份的权限,我不希望每次我这样做的时候,以获得UAC用户同意窗口。
The 1st step will not work with normal user accounts, because they have no Backup privileges, and I don't want to get the UAC User Consent window every time I do this.
我认为这是可行的莫名其妙,因为一个正常的DIR / A:L命令解析链接的目标
I think this is doable somehow, because a normal "dir /A:L" command resolves the target of the links.
推荐答案
我觉得这个答案计算器会帮助你?
怎么办我编程方式访问窗口的符号链接的目标路径?
应该有可能包括通过在C#程序DllImport属性的函数的引用。
I think that this answer in stackoverflow would help you? How do I programmatically access the target path of a windows symbolic link? It should be possible to include a reference to the function via DllImport Attribute in a c# program.
所需手柄是从一个的FileStream可获得实例。有点滑稽,它被标记为过时,但也许警告称,你可以做什么。
The required handle is obtainable from the a FileStream instance. Somewhat funny that it is marked as obsolete, but maybe the warning states what else you can do.
这篇关于C# - 如何中检索一个路口或符号连接的目标以标准用户的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!