Tracking the source code that produced the exception:
function CopyFile(const SrcFilename, DestFilename: String;
Flags: TCopyFileFlags=[cffOverwriteFile]): Boolean;
...
DestHandle := FileCreateUTF8(DestFileName);
if (THandle(DestHandle)=feInvalidHandle) then
raise EFCreateError.createfmt({SFCreateError}'Unable to create file "%s"',[DestFileName]);
...
On older version FileCreateUTF8 used to be:
function FileCreateUTF8(Const FileName : string) : THandle;
begin
..
Result := CreateFileW(PWideChar(UTF8Decode(FileName)), GENERIC_READ or GENERIC_WRITE,
0, nil, CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, 0);
end;
While now:
function FileCreateUTF8(Const FileName : string) : THandle;
begin
Result := _FileCreateUtf8(FileName, fmShareExclusive, 0);
end;
and _FileCreateUtf8 is a variable gets the value FileCreateWide:
function FileCreateWide(Const FileName : string; ShareMode: Integer; Rights: Integer) : THandle;
begin
Result := CreateFileW(PWideChar(UTF8Decode(FileName)), GENERIC_READ or GENERIC_WRITE,
dword(ShareModes[(ShareMode and $F0) shr 4]), nil, CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, 0);
end;
That boils down to the value passed in the 3rd parameter:
Older version: 0
Newer version: ShareModes[(fmShareExclusive and $F0) shr 4])
maybe it is 0 as well?