获得本地共享目录列表
来源:互联网 发布:腾讯云搭建java 编辑:程序博客网 时间:2024/04/30 11:01
#include <windows.h>
#include <stdio.h>
#include <lm.h>
#pragma comment(lib,"Netapi32.lib")
void main( int argc, TCHAR *lpszArgv[ ])
{
PSHARE_INFO_502 BufPtr,p;
NET_API_STATUS res;
LPTSTR lpszServer = NULL;
DWORD er=0,tr=0,resume=0, i;
//
// Print a report header.
//
printf("Share: Local Path: Uses: Descriptor:/n");
printf("---------------------------------------------------------------------/n");
//
// Call the NetShareEnum function; specify level 502.
//
do // begin do
{
res = NetShareEnum (lpszServer, 502, (LPBYTE *) &BufPtr, -1, &er, &tr, &resume);
//
// If the call succeeds,
//
if(res == ERROR_SUCCESS || res == ERROR_MORE_DATA)
{
p=BufPtr;
//
// Loop through the entries;
// print retrieved data.
//
for(i=1;i<=er;i++)
{
printf("%-20S%-30S%-8u",p->shi502_netname, p->shi502_path, p->shi502_current_uses);
//
// Validate the value of the
// shi502_security_descriptor member.
//
if (IsValidSecurityDescriptor(p->shi502_security_descriptor))
printf("Yes/n");
else
printf("No/n");
p++;
}
//
// Free the allocated buffer.
//
NetApiBufferFree(BufPtr);
}
else
printf("Error: %ld/n",res);
}
// Continue to call NetShareEnum while
// there are more entries.
//
while (res==ERROR_MORE_DATA); // end do
return;
}
- 获得本地共享目录列表
- SVN新增本地目录共享
- PHP获得目录列表和文件列表
- SQL-DMO获得本地服务器列表
- perl 获得目录列表(globbing,句柄)
- Samba:服务器与本地目录共享
- virtualbox实现虚拟机中共享本地目录
- Sodility配置本地IDE和共享目录
- 演示如何使用WMI获得本地机器的进程列表
- 如何获得某一个目录下的文件列表?
- JAVA功能代码《10》----Java获得目录列表
- joomla如何通过目录的id获得文章列表
- C#访问共享目录 得到共享目录文件列表和修改里面的文件
- 如何把网络共享目录映射为本地驱动器
- 把其它地址的共享目录映射到本地
- 使用 NetShareEnum 遍历本地共享目录需要注意的问题
- 通过virtualbox实现虚拟机中共享本地目录
- Linux下 挂载 Samba共享目录 到本地
- 模板引擎SMARTY
- 扑克游戏架构及其实现(三)
- 2005-04-11 告别第二故乡启程去南京了
- 今天星期一
- 分页显示详解
- 获得本地共享目录列表
- 怎样使MySQL安全以对抗解密高手
- 关于恋爱的迷茫
- The Story of Creating Enterprises
- 当stringFormat碰上{和}
- 工作中的疏忽
- [转贴]学编程的人不能不看的好文章
- 李开复解密微软成功之道 盖茨鲍尔默好搭档(zz)
- JS控件:表单验证