应用程序无法访问映射驱动器 [英] Application Cannot Access Mapped Drive

查看:31
本文介绍了应用程序无法访问映射驱动器的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当应用程序以管理员身份运行时,它无法使用 FindFirstFile 在映射的网络驱动器上找到文件.如果可执行文件是在没有以管理员身份运行的情况下运行的.用户是 PC 上的本地管理员.当 FindFirstFile 失败时,错误为 3,ERROR_PATH_NOT_FOUND.是否以管理员身份运行正在更改访问权限或我对映射驱动器的访问权限?

When the application is executed with run as administrator it fails to find files on a mapped network drive using FindFirstFile. If the executable is run without run as administrator is works. The user is a local administrator on the PC. When FindFirstFile fails the error is 3, ERROR_PATH_NOT_FOUND. Is running as an administrator changing access rights or my access to the mapped drive?

我正在 Windows 10 PC 上进行测试,域用户是本地管理员.应用程序是在 Windows 10 PC 上使用 VS 2010 构建的.应用程序是本机 C++ 应用程序.我关了防火墙,还是不行.关闭Windows Defender,仍然失败.重新创建共享和映射,仍然失败.想法?

I'm testing on a Windows 10 PC with a domain user that is a local administrator. Application was built using VS 2010 on the Windows 10 PC. Application is a native c++ app. I've turned off the firewall, still fails. Turned off Windows Defender, still fails. Recreated share and mapping, still fails. Ideas?

推荐答案

网络驱动器按用户映射.如果您以用户身份映射驱动器,但以管理员身份运行应用程序,则不会从应用程序的角度映射网络驱动器.要解决此问题,您可以通过打开管理员命令提示符(右键单击 cmd -> 以管理员身份运行)并运行 net use F:\\path\to\my\share.

Network drives are mapped per-user. If you map a drive as your user, but run your application as Administrator, the network drive won't be mapped from the application's perspective. To get around this, you can map the drive as Administrator by opening an admin command prompt (right-click cmd -> run as Administrator) and run net use F: \\path\to\my\share.

这篇关于应用程序无法访问映射驱动器的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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