如何将某文件夹设置为共享即NetShareAdd问题
我的编译环境是VC6.0 以下是我写的代码
MyPathToNetShare(CString strPath)
{
NET_API_STATUS res;
SHARE_INFO_502 Distory;//共享文件夹属性结构体
DWORD parm_err = 0;
CString strNetName = strPath.Mid(0, 1);
strNetName += "_CourtRecord";
char* pNetName = new char[255];
memset(pNetName, 0, 255);
strcpy(pNetName, (LPCSTR)strNetName);
Distory.shi502_netname = pNetName
Distory.shi502_type = STYPE_DISKTREE; // disk drive
Distory.shi502_remark = NULL;
Distory.shi502_permissions = ACCESS_ALL;
Distory.shi502_max_uses = 200;
Distory.shi502_current_uses = 0;
Distory.shi502_passwd = NULL; // no password
Distory.shi502_reserved = NULL;
Distory.shi502_security_descriptor = NULL;
CString path = strPath.Mid(0, 1);
path += ":\\CourtRecord";
char* pFilePath = new char[512];
memset(pFilePath, 0, 512);
strcpy(pFilePath, (LPCSTR)path);
Distory.shi502_path = pFilePath;
res = NetShareAdd(NULL, 502, (LPBYTE) &Distory, &parm_err);
delete []pNetName;
pNetName = NULL;
delete []pFilePath;
pFilePath = NULL;
}
其中 strPath = "D:\CourtRecord\";
程序编译没有ERROR 但是DEBUG调试后发现总是返回错误123即文件夹路径不对 请各位高手能帮我指正下 谢谢