NetShareGetInfo not returning permission
I have shared a directory with permissions (OSSMBSHAREHARE_ISPARISISS_ATRIB | OSSMBSHARE_PERMISSIONS_EXEC | OSSMBSHARE_PERMISSIONS_READ), but when I call NetShareGetInfo on a share, the permissions are 0 (while all other fields are correct).
code:
/* Initialize the share info structure */
tShareInfo.shi2_netname = pwstrNetName;
tShareInfo.shi2_type = STYPE_DISKTREE;
tShareInfo.shi2_remark = L"";
tShareInfo.shi2_permissions = OSSMBSHARE_PERMISSIONS_ATRIB | OSSMBSHARE_PERMISSIONS_EXEC | OSSMBSHARE_PERMISSIONS_READ;
tShareInfo.shi2_max_uses = (DWORD)-1;
tShareInfo.shi2_current_uses = 0;
tShareInfo.shi2_path = pwstrPath;
tShareInfo.shi2_passwd = NULL;
/* Add the share */
eResult = NetShareAdd(NULL, 2, (LPBYTE)&tShareInfo, &dwError);
if (NERR_Success != eResult)
{
printf("Failed sharing\n");
goto lbl_cleanup;
}
eResult = NetShareGetInfo(NULL, pwstrNetName, 2, (LPBYTE *)&ptShareInfo);
if (NERR_Success == eResult)
{
printf("Path: %s\n", ptShareInfo->shi2_path);
printf("Permissions: %d\n", ptShareInfo->shi2_permissions);
}
What could be the problem?
+3
source to share
No one has answered this question yet
Check out similar questions: