Platform SDK: Access Control |
The SetFileSecurity function sets the security of a file or directory object.
Windows NT 4.0 and later: You can use the SetNamedSecurityInfo function.
BOOL SetFileSecurity( LPCTSTR lpFileName, // file name SECURITY_INFORMATION SecurityInformation, // contents PSECURITY_DESCRIPTOR pSecurityDescriptor // SD );
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.
The SetFileSecurity function is successful only if the following conditions are met:
Windows NT/2000: Requires Windows NT 3.1 or later.
Header: Declared in Winbase.h; include Windows.h.
Library: Use Advapi32.lib.
Unicode: Implemented as Unicode and ANSI versions on Windows NT/2000.
Low-Level Access-Control Overview, Low-Level Access Control Functions, GetFileSecurity, SECURITY_DESCRIPTOR, SECURITY_INFORMATION, SetKernelObjectSecurity, SetPrivateObjectSecurity, SetUserObjectSecurity