Win32:API调用以列出服务器上的可用网络共享吗? [英] Win32: API calls to list available network shares on a server?

查看:165
本文介绍了Win32:API调用以列出服务器上的可用网络共享吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

假设我可以访问IP为1.2.3.4的SMB服务器,如何确定可用共享列表?

Assume I have access to a SMB server at IP 1.2.3.4, how can I determine the list of available shares?

当我输入UNC路径\\ 1.2.3.4 \时Windows资源管理器可以执行此操作-但命令提示符"dir \\ 1.2.3.4 \"失败!

Windows Explorer can do it when I enter a UNC path \\1.2.3.4\ - but command prompt "dir \\1.2.3.4\" fails!

我已经尝试了通常的FindFirstFile/FindNext调用-我成功地使用它来读取每个共享上的文件和目录,但是它们不能直接在服务器根目录上工作.

I've tried the usual FindFirstFile/FindNext calls - which I use successfully to read the files and directories on each share, but they don't work directly on the server root.

理想情况下,我需要适用于XP以后的产品.

Ideally, I need something that works for XP onwards.

编辑:我想以编程方式执行此操作,而不是从命令行执行此操作.重定向并解析"net view 1.2.3.4"的输出是可以的,但理想情况下,我正在寻找用于此工作的API.

I want to do this programatically, rather than from command line. Redirecting and parsing the output from 'net view 1.2.3.4' would work, but I'm ideally looking for an API for this job.

推荐答案

根据文档,其中有一个 WNetEnumResource 函数.

According to the docs there's a NetShareEnum and a WNetEnumResource function.

这篇关于Win32:API调用以列出服务器上的可用网络共享吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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