SetFileAttributes Method
Sets the attributes of a vault item.
Syntax
ANSI (Cross Platform) int SetFileAttributes(const char* lpszFileName, int iAttributes); Unicode (Windows) INT SetFileAttributes(LPCWSTR lpszFileName, INT iAttributes);
- (void)setFileAttributes:(NSString*)fileName :(int)attributes;
#define MID_CBDRIVE_SETFILEATTRIBUTES 76 CBFSSTORAGE_EXTERNAL int CBFSSTORAGE_CALL CBFSStorage_CBDrive_Do(void *lpObj, int methid, int cparam, void *param[], int cbparam[], int64 *lpllVal);
Remarks
This method sets the attributes of the vault item (file, directory, symbolic link, or alternate stream) specified by FileName.
The value passed for FileName must be a vault-local absolute path.
The Attributes parameter specifies the new attributes for the vault item, which should be constructed by OR'ing together one or more of the following values:
CBFSSTORAGE_FATTR_FILE | 0x00000001 | The entry is a file. |
CBFSSTORAGE_FATTR_DIRECTORY | 0x00000002 | The entry is a directory. |
CBFSSTORAGE_FATTR_DATA_STREAM | 0x00000004 | The entry is an alternate data stream. |
CBFSSTORAGE_FATTR_COMPRESSED | 0x00000008 | The file or stream is compressed. |
CBFSSTORAGE_FATTR_ENCRYPTED | 0x00000010 | The file or stream is encrypted. |
CBFSSTORAGE_FATTR_SYMLINK | 0x00000020 | The entry is a symbolic link. |
CBFSSTORAGE_FATTR_READONLY | 0x00000040 | The file is read-only.
This attribute is not used by CBFS Storage, but it can be set and retrieved. |
CBFSSTORAGE_FATTR_ARCHIVE | 0x00000080 | The file requires archiving.
This attribute is not used by CBFS Storage, but it can be set and retrieved. |
CBFSSTORAGE_FATTR_HIDDEN | 0x00000100 | The file is hidden.
This attribute is not used by CBFS Storage, but it can be set and retrieved. |
CBFSSTORAGE_FATTR_SYSTEM | 0x00000200 | The file is a system file.
This attribute is not used by CBFS Storage, but it can be set and retrieved. |
CBFSSTORAGE_FATTR_TEMPORARY | 0x00000400 | The file is temporary.
This attribute is not used by CBFS Storage, but it can be set and retrieved. |
CBFSSTORAGE_FATTR_DELETE_ON_CLOSE | 0x00000800 | The file should be deleted when the last handle to the file is closed.
This attribute is currently not supported by CBFS Storage. |
CBFSSTORAGE_FATTR_RESERVED_0 | 0x00001000 | Reserved. |
CBFSSTORAGE_FATTR_RESERVED_1 | 0x00002000 | Reserved. |
CBFSSTORAGE_FATTR_RESERVED_2 | 0x00004000 | Reserved. |
CBFSSTORAGE_FATTR_RESERVED_3 | 0x00008000 | Reserved. |
CBFSSTORAGE_FATTR_NO_USER_CHANGE | 0x0000F03F | A mask which includes all attributes that cannot be changed.
Applications cannot use the SetFileAttributes method to directly change any of the following attributes: FILE, DIRECTORY, DATA_STREAM, COMPRESSED, ENCRYPTED, SYMLINK, RESERVED_0, RESERVED_1, RESERVED_2, RESERVED_3. |
CBFSSTORAGE_FATTR_USER_DEFINED | 0x7FF00000 | A mask for application-defined attributes.
Applications can use the SetFileAttributes method to set custom attributes, so long as their values are covered by this mask. |
CBFSSTORAGE_FATTR_ANY_FILE | 0x7FFFFFFF | A mask which includes any and all attributes. |
Note: This method can only be called when Active is true, and cannot be called within events.
Error Handling (C++)
This method returns a result code; 0 indicates success, while a non-zero error code indicates that this method encountered an error during its execution. If an error occurs, the GetLastError() method can be called to retrieve the associated error message. (Note: This method's result code can also be obtained by calling the GetLastErrorCode() method after it returns.)