mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-08-26 21:10:29 +02:00
* converted nativent sysutils routines to accept unicodestring instead
of rawbytestring and indicate that this platform now uses a two-byte file system API for the sysutils unit git-svn-id: branches/cpstrrtl@25074 -
This commit is contained in:
parent
c604e5af17
commit
00ce3c1f52
@ -49,8 +49,8 @@ implementation
|
|||||||
|
|
||||||
{$DEFINE FPC_NOGENERICANSIROUTINES}
|
{$DEFINE FPC_NOGENERICANSIROUTINES}
|
||||||
|
|
||||||
{ used OS file system APIs use ansistring }
|
{ used OS file system APIs use unicodestring }
|
||||||
{$define SYSUTILS_HAS_ANSISTR_FILEUTIL_IMPL}
|
{$define SYSUTILS_HAS_UNICODESTR_FILEUTIL_IMPL}
|
||||||
|
|
||||||
{ Include platform independent implementation part }
|
{ Include platform independent implementation part }
|
||||||
{$i sysutils.inc}
|
{$i sysutils.inc}
|
||||||
@ -59,7 +59,7 @@ implementation
|
|||||||
File Functions
|
File Functions
|
||||||
****************************************************************************}
|
****************************************************************************}
|
||||||
|
|
||||||
function FileOpen(const FileName : rawbytestring; Mode : Integer) : THandle;
|
function FileOpen(const FileName : UnicodeString; Mode : Integer) : THandle;
|
||||||
const
|
const
|
||||||
AccessMode: array[0..2] of ACCESS_MASK = (
|
AccessMode: array[0..2] of ACCESS_MASK = (
|
||||||
GENERIC_READ,
|
GENERIC_READ,
|
||||||
@ -76,7 +76,7 @@ var
|
|||||||
objattr: OBJECT_ATTRIBUTES;
|
objattr: OBJECT_ATTRIBUTES;
|
||||||
iostatus: IO_STATUS_BLOCK;
|
iostatus: IO_STATUS_BLOCK;
|
||||||
begin
|
begin
|
||||||
AnsiStrToNtStr(ToSingleByteFileSystemEncodedFileName(FileName), ntstr);
|
UnicodeStrToNtStr(FileName, ntstr);
|
||||||
InitializeObjectAttributes(objattr, @ntstr, 0, 0, Nil);
|
InitializeObjectAttributes(objattr, @ntstr, 0, 0, Nil);
|
||||||
NtCreateFile(@Result, AccessMode[Mode and 3] or NT_SYNCHRONIZE, @objattr,
|
NtCreateFile(@Result, AccessMode[Mode and 3] or NT_SYNCHRONIZE, @objattr,
|
||||||
@iostatus, Nil, FILE_ATTRIBUTE_NORMAL, ShareMode[(Mode and $F0) shr 4],
|
@iostatus, Nil, FILE_ATTRIBUTE_NORMAL, ShareMode[(Mode and $F0) shr 4],
|
||||||
@ -85,19 +85,19 @@ begin
|
|||||||
end;
|
end;
|
||||||
|
|
||||||
|
|
||||||
function FileCreate(const FileName : RawByteString) : THandle;
|
function FileCreate(const FileName : UnicodeString) : THandle;
|
||||||
begin
|
begin
|
||||||
FileCreate := FileCreate(FileName, fmShareDenyNone, 0);
|
FileCreate := FileCreate(FileName, fmShareDenyNone, 0);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
|
||||||
function FileCreate(const FileName : RawByteString; Rights: longint) : THandle;
|
function FileCreate(const FileName : UnicodeString; Rights: longint) : THandle;
|
||||||
begin
|
begin
|
||||||
FileCreate := FileCreate(FileName, fmShareDenyNone, Rights);
|
FileCreate := FileCreate(FileName, fmShareDenyNone, Rights);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
|
||||||
function FileCreate(const FileName : RawByteString; ShareMode : longint; Rights: longint) : THandle;
|
function FileCreate(const FileName : UnicodeString; ShareMode : longint; Rights: longint) : THandle;
|
||||||
const
|
const
|
||||||
ShareModeFlags: array[0..4] of ULONG = (
|
ShareModeFlags: array[0..4] of ULONG = (
|
||||||
0,
|
0,
|
||||||
@ -111,7 +111,7 @@ var
|
|||||||
iostatus: IO_STATUS_BLOCK;
|
iostatus: IO_STATUS_BLOCK;
|
||||||
res: NTSTATUS;
|
res: NTSTATUS;
|
||||||
begin
|
begin
|
||||||
AnsiStrToNTStr(ToSingleByteFileSystemEncodedFileName(FileName), ntstr);
|
UnicodeStrToNtStr(FileName, ntstr);
|
||||||
InitializeObjectAttributes(objattr, @ntstr, 0, 0, Nil);
|
InitializeObjectAttributes(objattr, @ntstr, 0, 0, Nil);
|
||||||
NtCreateFile(@Result, GENERIC_READ or GENERIC_WRITE or NT_SYNCHRONIZE,
|
NtCreateFile(@Result, GENERIC_READ or GENERIC_WRITE or NT_SYNCHRONIZE,
|
||||||
@objattr, @iostatus, Nil, FILE_ATTRIBUTE_NORMAL,
|
@objattr, @iostatus, Nil, FILE_ATTRIBUTE_NORMAL,
|
||||||
|
Loading…
Reference in New Issue
Block a user