枚举Windows上低权限的共享文件夹
使用 C++ (VS2008),我需要能够枚举当前计算机上的所有共享文件夹并获取或构造本地和远程名称。
我们一直在使用 NetShareEnum
这相当成功,但遇到了一个问题,我们需要使用低权限的用户帐户运行。
要使用 NetShareEnum 获取本地路径,我们至少需要检索 SHARE_INFO_2
结构 - 但这需要“管理员、高级用户、打印操作员或服务器操作员组成员身份”。
我一直在尝试使用 WNetOpenEnum
和 WNetEnumResource
相反,但我似乎也没有获得共享的本地名称。 AFAICS只是从外部角度列举了股份。
因此,我要么需要有关 WNetEnumResource
出错的地方的帮助,要么需要有关另一种方法的建议。非常感谢任何建议。
Using C++ (VS2008) I need to be able to enumerate all shared folders on the current machine and get or construct the local and remote names.
We've been using NetShareEnum
for this fairly successfully, but have hit a problem where we need to run with a user account with low privileges.
To get the local path using NetShareEnum
we need to retrieve at least SHARE_INFO_2
structures - but that requires "Administrator, Power User, Print Operator, or Server Operator group membership".
I've been trying to use WNetOpenEnum
and WNetEnumResource
instead but I don't seem to be getting the local name back for that for shares either. AFAICS it only enumerates the shares from an external perspective.
So I'd either like help on where I'm going wrong with WNetEnumResource
, or a suggestion as to another way of doing this. Any suggestions are much appreciated.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
如果您知道本地路径是什么,您可以通过测试来暴力破解它:(TODO:将所有内容设为 Unicode)
If you have an idea what the local path would be, you can brute-force it by testing: (TODO: make everything Unicode)
听起来您正在为范围指定
RESOURCE_GLOBALNET
,但是在不查看代码的情况下很难判断出了什么问题。如果不知道你尝试了什么以及你得到了什么,就很难提供帮助。例如,您期望什么本地名称以及返回什么?您是否尝试过将 NetShareEnum 与 SHARE_INFO_503 一起使用?
It sounds like you're specifying
RESOURCE_GLOBALNET
for the scope, but it's hard to tell what's wrong without seeing your code.It's hard to help without knowing what you tried and what you got back. For example, what local name are you expecting and what is getting returned? Did you try NetShareEnum with SHARE_INFO_503?