码迷,mamicode.com
首页 > 其他好文 > 详细

VC共享文件夹

时间:2015-01-21 22:05:56      阅读:226      评论: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 }
BOOL  NetShareStop(char * pShareName)
{
	USES_CONVERSION;
	LPWSTR pwShareName=A2W(pShareName);

	return NetShareDel( NULL,(LPWSTR)pwShareName,NULL);
}

 

 

VC共享文件夹

标签:

原文地址:http://www.cnblogs.com/liuxupiaoshi/p/4239958.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!