mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-08-15 00:50:49 +02:00
* converted Windows FileCreate/FileOpen to use unicode interface instead of
ansistring git-svn-id: branches/cpstrrtl@24969 -
This commit is contained in:
parent
ff87431565
commit
b0613d9ec5
@ -154,7 +154,7 @@ function GetFileVersion(const AFileName:string):Cardinal;
|
|||||||
{$DEFINE FPC_FEXPAND_DRIVES} (* Full paths begin with drive specification *)
|
{$DEFINE FPC_FEXPAND_DRIVES} (* Full paths begin with drive specification *)
|
||||||
|
|
||||||
{ used OS file system APIs use ansistring }
|
{ used OS file system APIs use ansistring }
|
||||||
{$define SYSUTILS_HAS_ANSISTR_FILEUTIL_IMPL}
|
{$define SYSUTILS_HAS_UNICODESTR_FILEUTIL_IMPL}
|
||||||
|
|
||||||
function ConvertEraYearString(Count ,Year,Month,Day : integer) : string; forward;
|
function ConvertEraYearString(Count ,Year,Month,Day : integer) : string; forward;
|
||||||
function ConvertEraString(Count ,Year,Month,Day : integer) : string; forward;
|
function ConvertEraString(Count ,Year,Month,Day : integer) : string; forward;
|
||||||
@ -229,33 +229,28 @@ const
|
|||||||
FILE_SHARE_WRITE,
|
FILE_SHARE_WRITE,
|
||||||
FILE_SHARE_READ or FILE_SHARE_WRITE);
|
FILE_SHARE_READ or FILE_SHARE_WRITE);
|
||||||
|
|
||||||
Function FileOpen (Const FileName : rawbytestring; Mode : Integer) : THandle;
|
|
||||||
Var
|
Function FileOpen (Const FileName : unicodestring; Mode : Integer) : THandle;
|
||||||
SystemFileName: RawByteString;
|
|
||||||
begin
|
begin
|
||||||
SystemFileName := ToSingleByteFileSystemEncodedFileName(FileName);
|
result := CreateFileW(PWideChar(FileName), dword(AccessMode[Mode and 3]),
|
||||||
result := CreateFile(PChar(SystemFileName), dword(AccessMode[Mode and 3]),
|
|
||||||
dword(ShareModes[(Mode and $F0) shr 4]), nil, OPEN_EXISTING,
|
dword(ShareModes[(Mode and $F0) shr 4]), nil, OPEN_EXISTING,
|
||||||
FILE_ATTRIBUTE_NORMAL, 0);
|
FILE_ATTRIBUTE_NORMAL, 0);
|
||||||
//if fail api return feInvalidHandle (INVALIDE_HANDLE=feInvalidHandle=-1)
|
//if fail api return feInvalidHandle (INVALIDE_HANDLE=feInvalidHandle=-1)
|
||||||
end;
|
end;
|
||||||
|
|
||||||
Function FileCreate (Const FileName : RawByteString) : THandle;
|
Function FileCreate (Const FileName : UnicodeString) : THandle;
|
||||||
begin
|
begin
|
||||||
FileCreate:=FileCreate(FileName, fmShareExclusive, 0);
|
FileCreate:=FileCreate(FileName, fmShareExclusive, 0);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
Function FileCreate (Const FileName : RawByteString; Rights:longint) : THandle;
|
Function FileCreate (Const FileName : UnicodeString; Rights:longint) : THandle;
|
||||||
begin
|
begin
|
||||||
FileCreate:=FileCreate(FileName, fmShareExclusive, Rights);
|
FileCreate:=FileCreate(FileName, fmShareExclusive, Rights);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
Function FileCreate (Const FileName : RawByteString; ShareMode : Integer; Rights : Integer) : THandle;
|
Function FileCreate (Const FileName : UnicodeString; ShareMode : Integer; Rights : Integer) : THandle;
|
||||||
Var
|
|
||||||
SystemFileName: RawByteString;
|
|
||||||
begin
|
begin
|
||||||
SystemFileName := ToSingleByteFileSystemEncodedFileName(FileName);
|
Result := CreateFileW(PwideChar(FileName), GENERIC_READ or GENERIC_WRITE,
|
||||||
Result := CreateFile(PChar(SystemFileName), GENERIC_READ or GENERIC_WRITE,
|
|
||||||
dword(ShareModes[(ShareMode and $F0) shr 4]), nil, CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, 0);
|
dword(ShareModes[(ShareMode and $F0) shr 4]), nil, CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, 0);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user