首页 > 编程语言 > 详细

VC++共享文件夹

时间:2016-08-25 23:29:33      阅读:162      评论:0      收藏:0      [点我收藏+]
 1 BOOL NetShare(char * pShareName,char * pSharePath)
 2 {
 3 USES_CONVERSION;
 4 SHARE_INFO_502 si502; 
 5 NET_API_STATUS nas; 
 6 LPWSTR pwShareName=A2W(pShareName); //转换成unicode 字符串
 7 LPWSTR pwSharePath=A2W(pSharePath);
 8 
 9 si502.shi502_netname = (LPWSTR)pwShareName; 
10 si502.shi502_type = STYPE_DISKTREE; 
11 si502.shi502_remark = NULL; 
12 si502.shi502_permissions = 0; 
13 si502.shi502_max_uses = /*SHI_USES_UNLIMITED*/1; 
14 si502.shi502_current_uses = 0; 
15 si502.shi502_path = (LPWSTR)pwSharePath; 
16 si502.shi502_passwd = NULL; 
17 si502.shi502_reserved = 0; 
18 si502.shi502_security_descriptor = NULL ;
19 
20 nas = NetShareAdd( 
21 NULL, // share is on local machine 
22 502, // info-level 
23 (LPBYTE)&si502, // info-buffer 
24 NULL // don‘t bother with parm 
25 );
26 
27 return (nas==0);
28 }
29 
30 ?1234567BOOL NetShareStop(char * pShareName){ USES_CONVERSION; LPWSTR pwShareName=A2W(pShareName); return NetShareDel( NULL,(LPWSTR)pwShareName,NULL);}

 

VC++共享文件夹

原文:http://www.cnblogs.com/nodegis/p/5808523.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!