Although I don’t have any exact answers, I may be able to provide a few hints to help you. I spent a couple minutes messing around calling some of the menu commands from a script…
There are 2 “read only” flags you need to keep in mind. There is one that is associated with the Windows operating system (meaning Windows will not allow the file to be overwritten, etc). There is also a “read only” flag within Notepad++, meaning that the file can be overwritten on the actual hard drive, but Notepad++ won’t allow it to be edited in the editor. (See SCI_SETREADONLY for reference.) I’m not sure which flags (maybe both?) get set when calling IDM_EDIT_CLEARREADONLY and IDM_EDIT_SETREADONLY.
It looks like using IDM_EDIT_SETREADONLY toggles the read only flag (again not sure exactly which flag).
I’m not 100% sure what IDM_EDIT_CLEARREADONLY does.
There might a problem setting the read only status during the NPPN_FILEOPENED notification. Notepad++ might mess with the read only flag after it has sent your plugin this notification.