diff --git a/rtl/nativent/sysutils.pp b/rtl/nativent/sysutils.pp index c0e074e523..ac8668e2cd 100644 --- a/rtl/nativent/sysutils.pp +++ b/rtl/nativent/sysutils.pp @@ -49,8 +49,8 @@ implementation {$DEFINE FPC_NOGENERICANSIROUTINES} -{ used OS file system APIs use ansistring } -{$define SYSUTILS_HAS_ANSISTR_FILEUTIL_IMPL} +{ used OS file system APIs use unicodestring } +{$define SYSUTILS_HAS_UNICODESTR_FILEUTIL_IMPL} { Include platform independent implementation part } {$i sysutils.inc} @@ -59,7 +59,7 @@ implementation File Functions ****************************************************************************} -function FileOpen(const FileName : rawbytestring; Mode : Integer) : THandle; +function FileOpen(const FileName : UnicodeString; Mode : Integer) : THandle; const AccessMode: array[0..2] of ACCESS_MASK = ( GENERIC_READ, @@ -76,7 +76,7 @@ var objattr: OBJECT_ATTRIBUTES; iostatus: IO_STATUS_BLOCK; begin - AnsiStrToNtStr(ToSingleByteFileSystemEncodedFileName(FileName), ntstr); + UnicodeStrToNtStr(FileName, ntstr); InitializeObjectAttributes(objattr, @ntstr, 0, 0, Nil); NtCreateFile(@Result, AccessMode[Mode and 3] or NT_SYNCHRONIZE, @objattr, @iostatus, Nil, FILE_ATTRIBUTE_NORMAL, ShareMode[(Mode and $F0) shr 4], @@ -85,19 +85,19 @@ begin end; -function FileCreate(const FileName : RawByteString) : THandle; +function FileCreate(const FileName : UnicodeString) : THandle; begin FileCreate := FileCreate(FileName, fmShareDenyNone, 0); end; -function FileCreate(const FileName : RawByteString; Rights: longint) : THandle; +function FileCreate(const FileName : UnicodeString; Rights: longint) : THandle; begin FileCreate := FileCreate(FileName, fmShareDenyNone, Rights); end; -function FileCreate(const FileName : RawByteString; ShareMode : longint; Rights: longint) : THandle; +function FileCreate(const FileName : UnicodeString; ShareMode : longint; Rights: longint) : THandle; const ShareModeFlags: array[0..4] of ULONG = ( 0, @@ -111,7 +111,7 @@ var iostatus: IO_STATUS_BLOCK; res: NTSTATUS; begin - AnsiStrToNTStr(ToSingleByteFileSystemEncodedFileName(FileName), ntstr); + UnicodeStrToNtStr(FileName, ntstr); InitializeObjectAttributes(objattr, @ntstr, 0, 0, Nil); NtCreateFile(@Result, GENERIC_READ or GENERIC_WRITE or NT_SYNCHRONIZE, @objattr, @iostatus, Nil, FILE_ATTRIBUTE_NORMAL,