How can I make a file read-only for a certain process?
First, you'll need to enable the FireAllOpenCloseEvents property. Then, anytime the CreateFile or OpenFile event fires, determine if the request originator is the process for which you want the file to be read-only. If it is, and if it's attempting to create/open the file for writing, deny the request by returning Windows error code ACCESS_DENIED (5) in the ResultCode event parameter.
Important: Do not implement read-only restrictions by canceling the WriteFile event. Doing so can lead to unexpected side-effects for both the originating process, and the system itself. The WriteFile event should only ever be canceled if the actual writing operation has failed.
We appreciate your feedback. If you have any questions, comments, or suggestions about this article please contact our support team at email@example.com.