Commit 00a02472 authored by Piotr Caban's avatar Piotr Caban Committed by Alexandre Julliard

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

parent b485d582
......@@ -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)
{
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment