FSCreateFileAndOpenForkUnicode

Last Revision:
Version 1.0, 2005-06-01
Demonstartes the use of FSCreateFileAndOpenForkUnicode to create a file with restricted access on disk and a read/write access path.
Build Requirements:
Tiger
Runtime Requirements:
Tiger

This sample is a tool which shows the use of FSCreateFileAndOpenForkUnicode to create a file on disk with restricted access from the outset while allowing the creating process to have a read/write access path to the item. The sample creates the file with a POSIX mode of 000 (no access) and an access control list with a single access control entry which grants the current user read access to the file data. It then writes out some data to the file on the fsRdWrPerm access path it requested. The target volume needs to have extended security enabled since the sample depends on ACLs (the tool checks for this support). FSCreateFileAndOpenForkUnicode enables the creation of files with restricted access on disk while allowing the creator to have less restricted access (a file can be created with no access or read only access and the fork opened with read/write access. Once the inital write path is closed, a subsequent attempt to open the file for writing would fail).