_SH_DENYWR denies any other attempt to open a file with write permissions (share violation)
_SH_SECURE Sets secure mode (shared read, exclusive write access)
The _SH_SECURE seems to be newer, based on the fact that the docs seem to gloss over it or omit it depending on where you look. There’s almost no info on the ‘net that I could find on it.
How are those any different?
The behavior of
_SH_SECUREdepends on the access requested in themodeargument to_fsopen()/_wfsopen(). If only read access is requested, then_SH_SECUREmaps toFILE_SHARE_READ. Otherwise, it maps to0(exclusive access).Contrast
_SH_DENYWR, which always maps toFILE_SHARE_READ.The relevant part of the CRT source code (lines 269-301 of
open.cin Visual Studio 2010) is as follows: