我要做控制服务器共享目录,需要用API,函数我知道了。但具体有很多问题,请高手看看

qian_0_wei 2003-03-28 05:43:50


我要通过数据库要求在服务期上自动开共享目录,并控制能使用此目录的人员(通过系统登陆名)或工作组

SetFileSecurity,GetFileSecurity, SECURITY_DESCRIPTOR, SECURITY_INFORMATION, SetKernelObjectSecurity, SetPrivateObjectSecurity, SetUserObjectSecurity 等

具体我用pb来做
资料上
FUNCTION ulong SetFileSecurity(ref string lpFileName,ulong SecurityInformation,ref SECURITY_DESCRIPTOR pSecurityDescriptor) LIBRARY "advapi32.dll" ALIAS FOR "SetFileSecurityA"

问SetFileSecurityA怎么用
问SECURITY_DESCRIPTOR 是什么类型的,pb里怎么定义和使用
资料里是写:typedef PVOID PSECURITY_DESCRIPTOR;

资料如下
http://efplus.com/techref/os/win/api/win32/func/src/f78_21.htm
////////////////////////////////////////////////////////
BOOL SetFileSecurity( LPCTSTR lpFileName,
// address of string for filename
SECURITY_INFORMATION SecurityInformation,
// type of information to set
PSECURITY_DESCRIPTOR pSecurityDescriptor
// address of security descriptor
Parameters
lpFileName
Points to a null-terminated string specifying the file or directory for which security is set.
SecurityInformation
Specifies a SECURITY_INFORMATION structure identifying the contents of the security descriptor pointed to by the pSecurityDescriptor parameter.
pSecurityDescriptor
Points to a SECURITY_DESCRIPTOR structure.
//////////////////////////////////////////////////////////////
高手能写个范例给我没,我处理没什么反映。
...全文
25 1 打赏 收藏 转发到动态 举报
写回复
用AI写文章
1 条回复
切换为时间正序
请发表友善的回复…
发表回复
shahand 2003-03-28
  • 打赏
  • 举报
回复
关键是
typedef struct _SECURITY_DESCRIPTOR {
BYTE Revision;
BYTE Sbz1;
SECURITY_DESCRIPTOR_CONTROL Control;
PSID Owner;
PSID Group;
PACL Sacl;
PACL Dacl;
} SECURITY_DESCRIPTOR, *PISECURITY_DESCRIPTOR;
typedef PVOID PSECURITY_DESCRIPTOR;

680

社区成员

发帖
与我相关
我的任务
社区描述
PowerBuilder API 调用
社区管理员
  • API 调用社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧