如何使用标准用户检索Junction或Symlink的目标 [英] How to retrieve the target of a Junction or Symlink with a standard user

查看:76
本文介绍了如何使用标准用户检索Junction或Symlink的目标的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试在程序中获取结点的目标,但是我设法做到的唯一方法是:

I am trying to get the target of a junction in my program, but the only way I managed do it is:

  1. 请求备份特权
  2. p调用带有特殊参数的CreateFile以获得文件/目录的句柄.
  3. 调用DeviceIoControl获取目标.

第一步无法使用普通用户帐户,因为它们没有备份权限,并且我不想每次执行此操作时都获得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.

推荐答案

我认为stackoverflow中的此答案对您有帮助吗?如何以编程方式访问Windows符号链接的目标路径?在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.

这篇关于如何使用标准用户检索Junction或Symlink的目标的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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