| Previous | Next |
| ERROR_NOT_EXPORT_FORMAT | ERROR_DIR_EFS_DISALLOWED |
ERROR_FILE_READ_ONLY
EFS must modify the file, so a read-only target is rejected
Both EncryptFile and DecryptFile document this exact error when the target file has the read-only attribute. Changing EFS state updates file data and metadata; a successful read of the file does not imply that the caller can perform that transformation.
Distinguish the DOS read-only attribute from an ACL denial, a read-only volume, immutable storage, or media write protection. Clearing the attribute is appropriate only when the application owns the workflow and the underlying storage is writable. Restore the intended attribute after the operation if it is part of the file's semantics.
What to inspect
- The file attributes immediately before the EFS call and any race that restores read-only state.
- Volume, share, and storage writeability in addition to NTFS permissions.
- Whether another component intentionally marks the file read-only as a policy or deployment control.
References
- Microsoft: EncryptFileW
- Microsoft: DecryptFileW
- Microsoft: Handling Encrypted Files and Directories
- Microsoft Open Specifications: FileBasicInformation
Looking for a different code? Search another status or error code.