The SetFileSecurity function sets the security of a file or directory object.
This function is obsolete. Use the SetNamedSecurityInfo function instead.
BOOL SetFileSecurityA( LPCSTR lpFileName, SECURITY_INFORMATION SecurityInformation, PSECURITY_DESCRIPTOR pSecurityDescriptor );
A pointer to a null-terminated string that specifies the file or directory for which security is set. Note that security applied to a directory is not inherited by its children.
A pointer to a SECURITY_DESCRIPTOR structure.
If the function succeeds, the function returns nonzero.
If the function fails, it returns zero. To get extended error information, call GetLastError.
The SetFileSecurity function is successful only if the following conditions are met:
- If the owner of the object is being set, the calling process must have either WRITE_OWNER permission or be the owner of the object.
- If the discretionary access control list (DACL) of the object is being set, the calling process must have either WRITE_DAC permission or be the owner of the object.
- If the system access control list (SACL) of the object is being set, the SE_SECURITY_NAME privilege must be enabled for the calling process.
|Minimum supported client||Windows XP [desktop apps only]|
|Minimum supported server||Windows Server 2003 [desktop apps only]|
|Header||winbase.h (include Windows.h)|