請問有得知目錄是否可以存取的function 嗎? |
尚未結案
|
Snooze
一般會員 發表:18 回覆:21 積分:7 註冊:2002-06-03 發送簡訊給我 |
|
Chance36
版主 發表:31 回覆:1033 積分:792 註冊:2002-12-31 發送簡訊給我 |
Snooze 你好 以下是從Win32 Developer's Referencese中找到的
==================================
The GetFileSecurity function obtains specified information about the security of a file or directory. The information obtained is constrained by the caller's access rights and privileges. BOOL GetFileSecurity( LPCTSTR lpFileName, // address of string for file name
SECURITY_INFORMATION RequestedInformation, // requested information
PSECURITY_DESCRIPTOR pSecurityDescriptor, // address of security descriptor
DWORD nLength, // size of security descriptor buffer
LPDWORD lpnLengthNeeded // address of required size of buffer
);
Parameters lpFileName Points to a null-terminated string specifying the file or directory for which security information is retrieved. RequestedInformation Specifies a SECURITY_INFORMATION structure that identifies the security information being requested. pSecurityDescriptor Points to a buffer that receives a copy of the security descriptor of the object specified by the lpFileName parameter. The calling process must have the right to view the specified aspects of the object's security status. The SECURITY_DESCRIPTOR structure is returned in self-relative format. nLength Specifies the size, in bytes, of the buffer pointed to by the pSecurityDescriptor parameter. lpnLengthNeeded Points to a variable the function sets to zero if the file descriptor is copied successfully. If the buffer is too small for the security descriptor, this variable receives the number of bytes required. If this variable's value is greater than that of the nLength parameter when the function returns, none of the security descriptor is copied to the buffer. Return Values If the function succeeds, the return value is nonzero.
If the function fails, the return value is zero. To get extended error information, call GetLastError. Remarks To read the security descriptor of a file or directory, the calling process must have READ_CONTROL access or be the owner of the file or directory.
To read the system access-control list (SACL) of a file or directory, the SE_SECURITY_NAME privilege must be enabled for the calling process. ====================================================================
The SECURITY_INFORMATION structure identifies the object-related security information being set or queried. This security information includes: ?The owner of an object
?The primary group of an object
?The discretionary access-control list (ACL) of an object
?The system ACL of an object typedef DWORD SECURITY_INFORMATION;
Each item of security information is designated by a bit flag. The following values specify the bits: Value Meaning
OWNER_SECURITY_INFORMATION Indicates the owner identifier of the object is being referenced.
GROUP_SECURITY_INFORMATION Indicates the primary group identifier of the object is being referenced.
DACL_SECURITY_INFORMATION Indicates the discretionary ACL of the object is being referenced.
SACL_SECURITY_INFORMATION Indicates the system ACL of the object is being referenced.
======================================================================
The SECURITY_DESCRIPTOR structure contains the security information associated with an object. Applications use this structure to set and query an object's security status. Applications are not to modify the SECURITY_DESCRIPTOR structure directly. For creating and manipulating a security descriptor, use the functions listed in the See Also section. typedef PVOID PSECURITY_DESCRIPTOR;
Remarks A security descriptor includes information that specifies the following components of an object's security: ?An owner (SID)
?A primary group (SID)
?A discretionary ACL
?A system ACL
?Qualifiers for the preceding items Security descriptors use access-control lists (ACLs) and security identifiers (SIDs) to specify the information in this list.
A security descriptor can be in absolute or self-relative form. In self-relative form, all members of the structure are located contiguously in memory. In absolute form, the structure only contains pointers to the members. _______________________________________
深藍的魚,祝您好運..........連.連
|
本站聲明 |
1. 本論壇為無營利行為之開放平台,所有文章都是由網友自行張貼,如牽涉到法律糾紛一切與本站無關。 2. 假如網友發表之內容涉及侵權,而損及您的利益,請立即通知版主刪除。 3. 請勿批評中華民國元首及政府或批評各政黨,是藍是綠本站無權干涉,但這裡不是政治性論壇! |