Passing Security Information to SetFileSecurity()

Last reviewed: November 2, 1995
Article ID: Q102100
The information in this article applies to:
  • Microsoft Win32 Application Programming Interface (API) included with:

        - Microsoft Windows NT version 3.1
    

The SetFileSecurity() Win32 application programming interface (API) takes a pointer to a Security Descriptor. This is because SetFileSecurity() can set any of the following security information for a file:

   The owner identifier of the file
   The primary group identifier of the file
   The discretionary access-control list (DACL) of the file
   The system access-control list (SACL) of the file

When you pass the SD and SECURITY_INFORMATION structure to SetFileSecurity(), the SECURITY_INFORMATION structure identifies which security information is to be set. The SECURITY_INFORMATION structure is a DWORD that can be one of the following values:

   OWNER_SECURITY_INFORMATION
   GROUP_SECURITY_INFORMATION
   DACL_SECURITY_INFORMATION
   SACL_SECURITY_INFORMATION

Each of these values represents one of the security items listed above. The SD that is passed to SetFileSecurity() is simply a container for the security information being set for the specified file. SetFileSecurity() examines the value in the SECURITY_INFORMATION structure, extracts the appropriate information from the provided SD, and applies it to the specified file's SD.


Additional reference words: 3.10
KBCategory: kbprg
KBSubcategory: BseSecurity


THE INFORMATION PROVIDED IN THE MICROSOFT KNOWLEDGE BASE IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND. MICROSOFT DISCLAIMS ALL WARRANTIES, EITHER EXPRESS OR IMPLIED, INCLUDING THE WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL MICROSOFT CORPORATION OR ITS SUPPLIERS BE LIABLE FOR ANY DAMAGES WHATSOEVER INCLUDING DIRECT, INDIRECT, INCIDENTAL, CONSEQUENTIAL, LOSS OF BUSINESS PROFITS OR SPECIAL DAMAGES, EVEN IF MICROSOFT CORPORATION OR ITS SUPPLIERS HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. SOME STATES DO NOT ALLOW THE EXCLUSION OR LIMITATION OF LIABILITY FOR CONSEQUENTIAL OR INCIDENTAL DAMAGES SO THE FOREGOING LIMITATION MAY NOT APPLY.

Last reviewed: November 2, 1995
© 1998 Microsoft Corporation. All rights reserved. Terms of Use.