msvcrt: Don't write Unicode BOM if file is not empty in _wsopen_dispatch.

Signed-off-by: Piotr Caban <piotr@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Piotr Caban 2020-11-26 15:26:27 +01:00 committed by Alexandre Julliard
parent b485d58293
commit 00a024725e
1 changed files with 6 additions and 1 deletions

View File

@ -2297,9 +2297,14 @@ int CDECL MSVCRT__wsopen_dispatch( const MSVCRT_wchar_t* path, int oflags, int s
if (oflags & (MSVCRT__O_WTEXT|MSVCRT__O_U16TEXT|MSVCRT__O_U8TEXT))
{
LARGE_INTEGER size = {{0}};
if ((access & GENERIC_WRITE) && (creation==OPEN_EXISTING || creation==OPEN_ALWAYS))
GetFileSizeEx(hand, &size);
if ((access & GENERIC_WRITE) && (creation==CREATE_NEW
|| creation==CREATE_ALWAYS || creation==TRUNCATE_EXISTING
|| (creation==OPEN_ALWAYS && GetLastError()==ERROR_ALREADY_EXISTS)))
|| ((creation==OPEN_EXISTING || creation==OPEN_ALWAYS) && !size.QuadPart)))
{
if (oflags & MSVCRT__O_U8TEXT)
{