Open files in shared mode on windows, so that other tools may read them.

This was the behavior before fopen_s() was used for implementation; unlike fopen(), fopen_s() opens the file in exclusive mode.
This commit is contained in:
madmaxoft 2014-05-02 20:55:50 +02:00
parent 202ce3e737
commit 92c022c140

View File

@ -75,7 +75,7 @@ bool cFile::Open(const AString & iFileName, eMode iMode)
} }
#ifdef _WIN32 #ifdef _WIN32
fopen_s(&m_File, (FILE_IO_PREFIX + iFileName).c_str(), Mode); m_File = _fsopen((FILE_IO_PREFIX + iFileName).c_str(), Mode, _SH_DENYWR);
#else #else
m_File = fopen((FILE_IO_PREFIX + iFileName).c_str(), Mode); m_File = fopen((FILE_IO_PREFIX + iFileName).c_str(), Mode);
#endif // _WIN32 #endif // _WIN32
@ -88,7 +88,7 @@ bool cFile::Open(const AString & iFileName, eMode iMode)
// Simply re-open for read-writing, erasing existing contents: // Simply re-open for read-writing, erasing existing contents:
#ifdef _WIN32 #ifdef _WIN32
fopen_s(&m_File, (FILE_IO_PREFIX + iFileName).c_str(), "wb+"); m_File = _fsopen((FILE_IO_PREFIX + iFileName).c_str(), "wb+", _SH_DENYWR);
#else #else
m_File = fopen((FILE_IO_PREFIX + iFileName).c_str(), "wb+"); m_File = fopen((FILE_IO_PREFIX + iFileName).c_str(), "wb+");
#endif // _WIN32 #endif // _WIN32