Merged revision(s) part of 63978 from trunk:

FpDebug: fix opening files with utf8 name on windows. Issue #37884
........

git-svn-id: branches/fixes_2_0@63979 -
This commit is contained in:
martin 2020-10-08 21:05:17 +00:00
parent 8e84940d5c
commit d7ef338ff6

View File

@ -188,14 +188,23 @@ end;
{ TDbgFileLoader }
{$ifdef USE_WIN_FILE_MAPPING}
function CreateFileW(lpFileName:LPCWSTR; dwDesiredAccess:DWORD; dwShareMode:DWORD; lpSecurityAttributes:LPSECURITY_ATTRIBUTES; dwCreationDisposition:DWORD;dwFlagsAndAttributes:DWORD; hTemplateFile:HANDLE):HANDLE; external 'kernel32' name 'CreateFileW';
{$ENDIF}
constructor TDbgFileLoader.Create(AFileName: String);
{$IFDEF MacOS}
var
s: String;
{$ENDIF}
{$ifdef USE_WIN_FILE_MAPPING}
var
s: UnicodeString;
{$ENDIF}
begin
{$ifdef USE_WIN_FILE_MAPPING}
FFileHandle := CreateFile(PChar(AFileName), GENERIC_READ, FILE_SHARE_READ, nil, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, 0);
s := UTF8Decode(AFileName);
FFileHandle := CreateFileW(PWideChar(s), GENERIC_READ, FILE_SHARE_READ, nil, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, 0);
Create(FFileHandle);
{$else}
FList := TList.Create;