FIX: Don't use UTF8Decode/UTF8Encode functions (issue #245)

(cherry picked from commit 57ba2a297f)
This commit is contained in:
Alexander Koblov 2021-11-08 18:13:48 +03:00
commit 824de51e1a
34 changed files with 188 additions and 181 deletions

View file

@ -68,7 +68,7 @@ implementation
uses
{$IF DEFINED(UNIX)}
iconvenc_dyn
iconvenc_dyn, LazUTF8
{$IF DEFINED(DARWIN)}
, MacOSAll, CocoaAll
{$ELSE}
@ -165,9 +165,11 @@ begin
L:= Length(Source);
if L = 0 then Exit('');
SetLength(Result, L + 1);
L:= Utf8ToUnicode(PUnicodeChar(Result), L + 1, PAnsiChar(Source), L);
if L > 0 then
SetLength(Result, L - 1)
if (ConvertUTF8ToUTF16(PUnicodeChar(Result), L + 1, PAnsiChar(Source), L,
[toInvalidCharToSymbol], L) = trNoError) then
begin
SetLength(Result, L - 1);
end
else begin
SetLength(Result, 0);
end;
@ -194,9 +196,11 @@ begin
L:= Length(Source);
if (L = 0) then Exit('');
SetLength(Result, L * 3);
L:= UnicodeToUtf8(PAnsiChar(Result), Length(Result) + 1, PUnicodeChar(Source), L);
if L > 0 then
SetLength(Result, L - 1)
if (ConvertUTF16ToUTF8(PAnsiChar(Result), Length(Result) + 1, PUnicodeChar(Source), L,
[toInvalidCharToSymbol], L) = trNoError) then
begin
SetLength(Result, L - 1);
end
else begin
SetLength(Result, 0);
end;
@ -282,7 +286,7 @@ var
UnicodeResult: UnicodeString;
begin
if CeTryDecode(Source, CP_OEMCP, UnicodeResult) then
Result:= UTF8Encode(UnicodeResult)
Result:= CeUtf16ToUtf8(UnicodeResult)
else
Result:= Source;
end;
@ -291,7 +295,7 @@ function Utf82Oem(const Source: String): RawByteString;
var
AnsiResult: AnsiString;
begin
if CeTryEncode(UTF8Decode(Source), CP_OEMCP, False, AnsiResult) then
if CeTryEncode(CeUtf8ToUtf16(Source), CP_OEMCP, False, AnsiResult) then
Result:= AnsiResult
else
Result:= Source;

View file

@ -1411,11 +1411,11 @@ end;
function mbCompareFileNames(const FileName1, FileName2: String): Boolean; inline;
{$IF DEFINED(WINDOWS) OR DEFINED(DARWIN)}
begin
Result:= (WideCompareText(UTF8Decode(FileName1), UTF8Decode(FileName2)) = 0);
Result:= (WideCompareText(CeUtf8ToUtf16(FileName1), CeUtf8ToUtf16(FileName2)) = 0);
end;
{$ELSE}
begin
Result:= (WideCompareStr(UTF8Decode(FileName1), UTF8Decode(FileName2)) = 0);
Result:= (WideCompareStr(CeUtf8ToUtf16(FileName1), CeUtf8ToUtf16(FileName2)) = 0);
end;
{$ENDIF}
@ -1531,7 +1531,7 @@ var
wsResult: UnicodeString;
begin
SetLength(wsResult, MaxSmallInt + 1);
dwSize:= ExpandEnvironmentStringsW(PWideChar(UTF8Decode(FileName)), PWideChar(wsResult), MaxSmallInt);
dwSize:= ExpandEnvironmentStringsW(PWideChar(CeUtf8ToUtf16(FileName)), PWideChar(wsResult), MaxSmallInt);
if (dwSize = 0) or (dwSize > MaxSmallInt) then
Result:= FileName
else begin
@ -1569,7 +1569,7 @@ var
dwResult: DWORD;
begin
Result := EmptyStr;
wsName := UTF8Decode(sName);
wsName := CeUtf8ToUtf16(sName);
dwResult := GetEnvironmentVariableW(PWideChar(wsName), @smallBuf[0], Length(smallBuf));
if dwResult > Length(smallBuf) then
begin
@ -1599,8 +1599,8 @@ var
wsName,
wsValue: UnicodeString;
begin
wsName:= UTF8Decode(sName);
wsValue:= UTF8Decode(sValue);
wsName:= CeUtf8ToUtf16(sName);
wsValue:= CeUtf8ToUtf16(sValue);
Result:= SetEnvironmentVariableW(PWideChar(wsName), PWideChar(wsValue));
end;
{$ELSE}
@ -1664,7 +1664,7 @@ begin
//Also, TC switch "CurrentDir" to their directory when loading them. So let's do the same.
sRememberPath:=GetCurrentDir;
SetCurrentDir(ExcludeTrailingPathDelimiter(ExtractFilePath(Name)));
Result:= LoadLibraryW(PWideChar(UTF8Decode(Name)));
Result:= LoadLibraryW(PWideChar(CeUtf8ToUtf16(Name)));
finally
SetCurrentDir(sRememberPath);
end;
@ -1787,7 +1787,7 @@ function CreateSymLink(const Path, LinkName: string) : Boolean;
var
wsPath, wsLinkName: UnicodeString;
begin
wsPath:= UTF8Decode(Path);
wsPath:= CeUtf8ToUtf16(Path);
wsLinkName:= UTF16LongName(LinkName);
Result:= DCNtfsLinks.CreateSymlink(wsPath, wsLinkName);
end;

View file

@ -19,7 +19,7 @@ interface
uses
Classes, SysUtils
{$IF DEFINED(MSWINDOWS)}
, Process, Windows, Pipes
, Process, Windows, Pipes, DCConvertEncoding
{$ELSEIF DEFINED(UNIX)}
, BaseUnix, Process, UTF8Process, DCUnix
{$ENDIF}
@ -174,7 +174,7 @@ var
begin
EnvBlock := '';
for I := 0 to List.Count - 1 do
EnvBlock := EnvBlock + UTF8Decode(List[I]) + #0;
EnvBlock := EnvBlock + CeUtf8ToUtf16(List[I]) + #0;
EnvBlock := EnvBlock + #0;
GetMem(Result, Length(EnvBlock) * SizeOf(Widechar));
CopyMemory(Result, @EnvBlock[1], Length(EnvBlock) * SizeOf(Widechar));
@ -304,20 +304,20 @@ begin
raise EProcess.Create(SNoCommandline);
if (ApplicationName <> '') then
begin
PName := PWideChar(UTF8Decode(ApplicationName));
PCommandLine := PWideChar(UTF8Decode(CommandLine));
PName := PWideChar(CeUtf8ToUtf16(ApplicationName));
PCommandLine := PWideChar(CeUtf8ToUtf16(CommandLine));
end
else if (CommandLine <> '') then
PCommandLine := PWideChar(UTF8Decode(CommandLine))
PCommandLine := PWideChar(CeUtf8ToUtf16(CommandLine))
else if (Executable <> '') then
begin
Cmd := MaybeQuoteIfNotQuoted(Executable);
for I := 0 to Parameters.Count - 1 do
Cmd := Cmd + ' ' + MaybeQuoteIfNotQuoted(Parameters[I]);
PCommandLine := PWideChar(UTF8Decode(Cmd));
PCommandLine := PWideChar(CeUtf8ToUtf16(Cmd));
end;
if CurrentDirectory <> '' then
PDir := PWideChar(UTF8Decode(CurrentDirectory));
PDir := PWideChar(CeUtf8ToUtf16(CurrentDirectory));
if Environment.Count <> 0 then
FEnv := StringsToPWideChars(Environment)
else

View file

@ -27,7 +27,7 @@ unit DCStrUtils;
interface
uses
Classes, SysUtils, DCBasicTypes,LazUtf8;
Classes, SysUtils, DCBasicTypes, LazUtf8;
const
NoQuotesSpecialChars = [' ', '"', '''', '(', ')', ':', '&', '!', '$', '*', '?', '=', '`', '\', '|', ';', #10];
@ -356,7 +356,7 @@ function EscapeNoQuotes(const Str: String): String;
implementation
uses
DCOSUtils, StrUtils;
DCOSUtils, DCConvertEncoding, StrUtils;
function NormalizePathDelimiters(const Path: String): String;
{$IFDEF UNIX}
@ -965,7 +965,7 @@ function mbCompareText(const s1, s2: String): PtrInt; inline;
begin
// From 0.9.31 LazUtils can be used but this package does not exist in 0.9.30.
// Result := LazUTF8.UTF8CompareText(s1, s2);
Result := WideCompareText(UTF8Decode(s1), UTF8Decode(s2));
Result := WideCompareText(CeUtf8ToUtf16(s1), CeUtf8ToUtf16(s2));
end;
function StrNewW(const mbString: String): PWideChar;
@ -974,7 +974,7 @@ var
iLength: PtrInt;
begin
Result:= nil;
wsString:= UTF8Decode(mbString);
wsString:= CeUtf8ToUtf16(mbString);
iLength:= (Length(wsString) * SizeOf(WideChar)) + 1;
Result:= GetMem(iLength);
if Result <> nil then

View file

@ -61,7 +61,7 @@ implementation
uses
SysUtils, JwaAclApi, JwaWinNT, JwaAccCtrl, JwaWinBase, JwaWinType, JwaNative,
JwaNtStatus;
JwaNtStatus, DCConvertEncoding;
var
GetFinalPathNameByHandleW: function(hFile: HANDLE; lpszFilePath: LPWSTR; cchFilePath: DWORD; dwFlags: DWORD): DWORD; stdcall;
@ -72,9 +72,9 @@ var
Temp: PWideChar;
begin
if Pos('\\', FileName) = 0 then
Result := '\\?\' + UTF8Decode(FileName)
Result := '\\?\' + CeUtf8ToUtf16(FileName)
else begin
Result := '\\?\UNC\' + UTF8Decode(Copy(FileName, 3, MaxInt));
Result := '\\?\UNC\' + CeUtf8ToUtf16(Copy(FileName, 3, MaxInt));
end;
Temp := Pointer(Result) + 4;
while Temp^ <> #0 do
@ -131,7 +131,7 @@ begin
CloseHandle(ProcessToken);
end;
end;
Result:= GetNamedSecurityInfoW(PWideChar(UTF8Decode(Source)), SE_FILE_OBJECT, SecurityInfo,
Result:= GetNamedSecurityInfoW(PWideChar(CeUtf8ToUtf16(Source)), SE_FILE_OBJECT, SecurityInfo,
@SidOwner, @SidGroup, @Dacl, @Sacl, SecDescPtr) = ERROR_SUCCESS;
if Result then
begin
@ -149,7 +149,7 @@ begin
else begin
SecurityInfo:= SecurityInfo or UNPROTECTED_SACL_SECURITY_INFORMATION;
end;
Result:= SetNamedSecurityInfoW(PWideChar(UTF8Decode(Target)), SE_FILE_OBJECT,
Result:= SetNamedSecurityInfoW(PWideChar(CeUtf8ToUtf16(Target)), SE_FILE_OBJECT,
SecurityInfo, SidOwner, SidGroup, Dacl, Sacl) = ERROR_SUCCESS;
end;
{$PUSH}{$HINTS OFF}{$WARNINGS OFF}

View file

@ -38,7 +38,7 @@ implementation
{$R *.lfm}
uses
Windows, Math, LCLStrConsts, fMain, uMyWindows, uLng;
Windows, Math, LCLStrConsts, DCConvertEncoding, fMain, uMyWindows, uLng;
function ShowUnlockForm(ProcessInfo: TProcessInfoArray): Boolean;
var
@ -133,7 +133,7 @@ var
begin
if (stgFileHandles.Row > 0) then
begin
if MessageBoxW(Handle, PWideChar(UTF8Decode(rsMsgTerminateProcess)), PWideChar(UTF8Decode(rsMtWarning)), MB_YESNO or MB_ICONWARNING) = IDYES then
if MessageBoxW(Handle, PWideChar(CeUtf8ToUtf16(rsMsgTerminateProcess)), PWideChar(CeUtf8ToUtf16(rsMtWarning)), MB_YESNO or MB_ICONWARNING) = IDYES then
begin
ProcessId:= StrToDWord(stgFileHandles.Cells[1, stgFileHandles.Row]);
if uFileUnlock.TerminateProcess(ProcessId) then

View file

@ -241,7 +241,7 @@ begin
if Result = E_SUCCESS then
begin
if Password <> nil then
StrPLCopyW(Password, UTF8Decode(sPassword), MaxLen);
StrPLCopyW(Password, CeUtf8ToUtf16(sPassword), MaxLen);
end;
end;

View file

@ -413,7 +413,7 @@ begin
if Result then
begin
if ReturnedText <> nil then
StrPLCopyW(ReturnedText, UTF8Decode(sReturnedText), MaxLen);
StrPLCopyW(ReturnedText, CeUtf8ToUtf16(sReturnedText), MaxLen);
end;
end;
@ -489,7 +489,7 @@ begin
if Result = FS_FILE_OK then
begin
if Password <> nil then
StrPLCopyW(Password, UTF8Decode(sPassword), MaxLen);
StrPLCopyW(Password, CeUtf8ToUtf16(sPassword), MaxLen);
end;
end;

View file

@ -38,7 +38,7 @@ type
implementation
uses
Windows, JwaWinNetWk, DCStrUtils, DCOSUtils;
Windows, JwaWinNetWk, DCStrUtils, DCOSUtils, DCConvertEncoding;
constructor TWinNetExecuteOperation.Create(aTargetFileSource: IFileSource;
var aExecutableFile: TFile; aCurrentPath, aVerb: String);
@ -62,7 +62,7 @@ begin
// Workstation/Server
if Pos('\\', FResultString) = 1 then
begin
FileName:= UTF8Decode(FResultString);
FileName:= CeUtf8ToUtf16(FResultString);
with FWinNetFileSource do
try
dwBufferSize:= SizeOf(lpBuffer);

View file

@ -87,7 +87,8 @@ implementation
uses
LazUTF8, uWinNetListOperation, uWinNetExecuteOperation, uMyWindows,
Windows, JwaWinNetWk, uVfsModule, uShowMsg, DCOSUtils, DCStrUtils;
Windows, JwaWinNetWk, uVfsModule, uShowMsg, DCOSUtils, DCStrUtils,
DCConvertEncoding;
function TWinNetFileSource.GetParentDir(sPath: String): String;
var
@ -110,7 +111,7 @@ begin
end;
Exit;
end;
FilePath:= UTF8Decode(ExcludeTrailingPathDelimiter(sPath));
FilePath:= CeUtf8ToUtf16(ExcludeTrailingPathDelimiter(sPath));
FillByte(nFile, SizeOf(TNetResourceW), 0);
with nFile do
begin

View file

@ -33,7 +33,7 @@ implementation
uses
LazUTF8, uFile, Windows, JwaWinNetWk, JwaLmCons, JwaLmShare, JwaLmApiBuf,
StrUtils, DCStrUtils, uShowMsg, DCOSUtils, uOSUtils, uNetworkThread, uMyWindows,
ShlObj, ComObj, uShellFolder, uShlObjAdditional;
ShlObj, ComObj, DCConvertEncoding, uShellFolder, uShlObjAdditional;
function TWinNetListOperation.Linux: Boolean;
var
@ -58,11 +58,11 @@ begin
AbortMethod:= @CheckOperationState;
end;
if FWinNetFileSource.IsNetworkPath(Path) then
ServerPath:= UTF8Decode(ExcludeTrailingPathDelimiter(Path))
ServerPath:= CeUtf8ToUtf16(ExcludeTrailingPathDelimiter(Path))
else begin
dwResult:= NPos(PathDelim, Path, 4);
if dwResult = 0 then dwResult:= MaxInt;
ServerPath:= UTF8Decode(Copy(Path, 1, dwResult - 1));
ServerPath:= CeUtf8ToUtf16(Copy(Path, 1, dwResult - 1));
end;
dwResult:= TNetworkThread.Connect(nil, PWideChar(ServerPath), RESOURCETYPE_ANY, AbortMethod);
if dwResult <> NO_ERROR then
@ -97,7 +97,7 @@ begin
if not IsPathAtRoot(Path) then
begin
FilePath:= ExcludeTrailingPathDelimiter(Path);
FileName:= UTF8Decode(ExcludeFrontPathDelimiter(FilePath));
FileName:= CeUtf8ToUtf16(ExcludeFrontPathDelimiter(FilePath));
nFile.lpRemoteName:= PWideChar(FileName);
end;
@ -147,7 +147,7 @@ var
begin
if not Connect then Exit;
ServerPath:= UTF8Decode(ExcludeTrailingPathDelimiter(Path));
ServerPath:= CeUtf8ToUtf16(ExcludeTrailingPathDelimiter(Path));
BufPtr:= nil;
repeat

View file

@ -380,7 +380,7 @@ uses
fMain, uFileSourceOperation, uOperationsManager, uOSUtils, uDCUtils, uDebug,
DCOSUtils, DCStrUtils, uLng, uGlobs, uSpecialDir, uFileProcs, uShowForm,
fSelectTextRange, fSelectPathRange, uShowMsg, uFileFunctions, dmCommonData,
fMultiRenameWait, fSortAnything;
fMultiRenameWait, fSortAnything, DCConvertEncoding;
type
tMaskHelper = record
@ -788,7 +788,7 @@ end;
procedure TfrmMultiRename.edFindChange(Sender: TObject);
begin
if cbRegExp.Checked then
FRegExp.Expression := UTF8Decode(edFind.Text)
FRegExp.Expression := CeUtf8ToUtf16(edFind.Text)
else
begin
FFindText.DelimitedText := edFind.Text;
@ -2049,7 +2049,7 @@ begin
begin
if cbRegExp.Checked then
try
Result := UTF16ToUTF8(FRegExp.Replace(UTF8Decode(Result), UTF8Decode(edReplace.Text), cbUseSubs.Checked));
Result := UTF16ToUTF8(FRegExp.Replace(CeUtf8ToUtf16(Result), CeUtf8ToUtf16(edReplace.Text), cbUseSubs.Checked));
except
Result := rsMsgErrRegExpSyntax;
bError := True;

View file

@ -244,7 +244,7 @@ begin
{$IF LCL_FULLVERSION >= 093100}
Result := UTF8CompareText(List.Strings[Index1], List.Strings[Index2]);
{$ELSE}
Result := WideCompareText(UTF8Decode(List.Strings[Index1]), UTF8Decode(List.Strings[Index2]));
Result := WideCompareText(CeUtf8ToUtf16(List.Strings[Index1]), CeUtf8ToUtf16(List.Strings[Index2]));
{$ENDIF}
end;

View file

@ -301,9 +301,9 @@ begin
if bFlagKeepGoing then
begin
wFileName:= UTF8Decode(sCmd);
wParams:= UTF8Decode(sParams);
wStartPath:= UTF8Decode(sStartPath);
wFileName:= CeUtf8ToUtf16(sCmd);
wParams:= CeUtf8ToUtf16(sParams);
wStartPath:= CeUtf8ToUtf16(sStartPath);
if (log_commandlineexecution in gLogOptions) then logWrite(rsMsgLogExtCmdLaunch+': '+rsSimpleWordFilename+'='+sCmd+' / '+rsSimpleWordParameter+'='+sParams+' / '+rsSimpleWordWorkDir+'='+sStartPath);
@ -361,13 +361,13 @@ var
wsStartPath: UnicodeString;
begin
SplitCmdLine(sCmd, sFileName, sParams);
wsStartPath:= UTF8Decode(mbGetCurrentDir());
wsStartPath:= CeUtf8ToUtf16(mbGetCurrentDir());
sFileName:= NormalizePathDelimiters(sFileName);
if (log_commandlineexecution in gLogOptions) then
logWrite(rsMsgLogExtCmdLaunch + ': ' + rsSimpleWordFilename + '=' + sCmd + ' / ' + rsSimpleWordParameter + '=' + sParams);
ExecutionResult := ShellExecuteW(0, nil, PWideChar(UTF8Decode(sFileName)), PWideChar(UTF8Decode(sParams)), PWideChar(wsStartPath), SW_SHOW);
ExecutionResult := ShellExecuteW(0, nil, PWideChar(CeUtf8ToUtf16(sFileName)), PWideChar(CeUtf8ToUtf16(sParams)), PWideChar(wsStartPath), SW_SHOW);
if (log_commandlineexecution in gLogOptions) then
begin
@ -386,8 +386,8 @@ var
wsStartPath: UnicodeString;
begin
URL:= NormalizePathDelimiters(URL);
wsFileName:= UTF8Decode(QuoteDouble(URL));
wsStartPath:= UTF8Decode(mbGetCurrentDir());
wsFileName:= CeUtf8ToUtf16(QuoteDouble(URL));
wsStartPath:= CeUtf8ToUtf16(mbGetCurrentDir());
Return:= ShellExecuteW(0, nil, PWideChar(wsFileName), nil, PWideChar(wsStartPath), SW_SHOWNORMAL);
if Return = SE_ERR_NOASSOC then
Result:= ExecCmdFork('rundll32 shell32.dll OpenAs_RunDLL ' + URL)
@ -499,7 +499,7 @@ var
lpFileSystemFlags: DWORD = 0;
begin
Result := High(Int64);
if GetVolumeInformationW(PWideChar(UTF8Decode(ExtractFileDrive(Path)) + PathDelim),
if GetVolumeInformationW(PWideChar(CeUtf8ToUtf16(ExtractFileDrive(Path)) + PathDelim),
lpVolumeNameBuffer, SizeOf(lpVolumeNameBuffer),
nil,
lpMaximumComponentLength,
@ -522,9 +522,9 @@ var
lpTargetFileSystem: array [0..MAX_PATH] of WideChar;
begin
Result:= False;
if GetVolumeInformationW(PWideChar(UTF8Decode(ExtractFileDrive(SourceName)) + PathDelim),
if GetVolumeInformationW(PWideChar(CeUtf8ToUtf16(ExtractFileDrive(SourceName)) + PathDelim),
nil, 0, nil, lpDummy, lpDummy, lpSourceFileSystem, MAX_PATH) and
GetVolumeInformationW(PWideChar(UTF8Decode(ExtractFileDrive(TargetName)) + PathDelim),
GetVolumeInformationW(PWideChar(CeUtf8ToUtf16(ExtractFileDrive(TargetName)) + PathDelim),
nil, 0, nil, lpDummy, lpDummy, lpTargetFileSystem, MAX_PATH) then
begin
Result:= (SameText(lpSourceFileSystem, 'FAT32') and SameText(lpTargetFileSystem, 'NTFS')) or
@ -782,8 +782,8 @@ begin
else if (Drive^.DriveType = dtNetwork) and
TryMount and (not mbDriveReady(Drv)) then
begin
wsLocalName := UTF8Decode(ExtractFileDrive(Drive^.Path));
wsRemoteName := UTF8Decode(Drive^.DriveLabel);
wsLocalName := CeUtf8ToUtf16(ExtractFileDrive(Drive^.Path));
wsRemoteName := CeUtf8ToUtf16(Drive^.DriveLabel);
TNetworkThread.Connect(PWideChar(wsLocalName), PWideChar(wsRemoteName), RESOURCETYPE_DISK);
end
// Try to unlock BitLocker Drive

View file

@ -394,7 +394,7 @@ begin
if Files.Count = 0 then Exit;
if bUnicode then
begin
wsFileList := UTF8Decode(Self.Files[0]) + #0;
wsFileList := CeUtf8ToUtf16(Self.Files[0]) + #0;
Result := MakeHGlobal(PWideChar(wsFileList),
Length(wsFileList) * SizeOf(WideChar));
end
@ -420,7 +420,7 @@ begin
wsUriList := wsUriList
+ fileScheme + '//' { don't put hostname }
+ UTF8Decode(URIEncode(StringReplace(Files[I], '\', '/', [rfReplaceAll] )));
+ CeUtf8ToUtf16(URIEncode(StringReplace(Files[I], '\', '/', [rfReplaceAll] )));
end;
wsUriList := wsUriList + #0;
@ -514,7 +514,7 @@ begin
begin
// Get PIDL for each file (if Desktop is the root, then
// absolute paths are acceptable).
pidl := GetPidlFromPath(ShellDesktop, UTF8Decode(Files[i]));
pidl := GetPidlFromPath(ShellDesktop, CeUtf8ToUtf16(Files[i]));
if pidl <> nil then
begin
@ -611,7 +611,7 @@ begin
if bUnicode then
begin
for I := 0 to Self.Files.Count - 1 do
wsFileList := wsFileList + UTF8Decode(Self.Files[I]) + #0;
wsFileList := wsFileList + CeUtf8ToUtf16(Self.Files[I]) + #0;
wsFileList := wsFileList + #0;
{ Определяем необходимый размер структуры }
RequiredSize := SizeOf(TDropFiles) + Length(wsFileList) * SizeOf(WChar);
@ -1010,7 +1010,7 @@ begin
if Medium.TYMED = TYMED_ISTORAGE then
begin
iStg := IStorage(Medium.pstg);
StgDocFile := UTF8Decode(InnerFilename);
StgDocFile := CeUtf8ToUtf16(InnerFilename);
StgCreateDocfile(PWideChar(StgDocFile), STGM_CREATE Or STGM_READWRITE Or STGM_SHARE_EXCLUSIVE, 0, iFile);
tIID:=nil;
iStg.CopyTo(0, tIID, nil, iFile);

View file

@ -231,7 +231,7 @@ begin
if not SHGetPathFromIDListW(rgpidl^, AName) then
DoDriveAdded(nil)
else begin
ADrive.Path:= UTF8Encode(UnicodeString(AName));
ADrive.Path:= UTF16ToUTF8(UnicodeString(AName));
DoDriveAdded(@ADrive);
end;
end;
@ -240,7 +240,7 @@ begin
if not SHGetPathFromIDListW(rgpidl^, AName) then
DoDriveRemoved(nil)
else begin
ADrive.Path:= UTF8Encode(UnicodeString(AName));
ADrive.Path:= UTF16ToUTF8(UnicodeString(AName));
DoDriveRemoved(@ADrive);
end;
end;

View file

@ -78,7 +78,8 @@ implementation
uses
LCLProc, LazUTF8, uDebug, uExceptions, syncobjs, fgl
{$IF DEFINED(MSWINDOWS)}
, Windows, JwaWinNT, JwaWinBase, DCWindows, DCStrUtils, uGlobs, DCOSUtils
, Windows, JwaWinNT, JwaWinBase, DCWindows, DCStrUtils, uGlobs, DCOSUtils,
DCConvertEncoding
{$ELSEIF DEFINED(LINUX)}
, inotify, BaseUnix, FileUtil, DCConvertEncoding, DCUnix
{$ELSEIF DEFINED(BSD)}
@ -1318,7 +1319,7 @@ begin
if FHandle = INVALID_HANDLE_VALUE then
begin
FHandle := CreateFileW(PWideChar(UTF8Decode(FWatchPath)),
FHandle := CreateFileW(PWideChar(CeUtf8ToUtf16(FWatchPath)),
FILE_LIST_DIRECTORY,
CREATEFILEW_SHAREMODE,
nil,

View file

@ -357,7 +357,7 @@ uses
{$ENDIF}
{$IFDEF MSWINDOWS}
, CommCtrl, ShellAPI, Windows, DCFileAttributes, uBitmap, uGdiPlus,
IntfGraphics, uShlObjAdditional, uShellFolder
IntfGraphics, DCConvertEncoding, uShlObjAdditional, uShellFolder
{$ELSE}
, StrUtils, Types, DCBasicTypes
{$ENDIF}
@ -505,7 +505,7 @@ begin
{$IFDEF MSWINDOWS}
if GetIconResourceIndex(sFileName, IconFileName, iIconIndex) then
begin
if ExtractIconExW(PWChar(UTF8Decode(IconFileName)), iIconIndex, phIconLarge, phIconSmall, 1) = 2 then // if extracted both icons
if ExtractIconExW(PWChar(CeUtf8ToUtf16(IconFileName)), iIconIndex, phIconLarge, phIconSmall, 1) = 2 then // if extracted both icons
begin
// Get system metrics
iIconSmall:= GetSystemMetrics(SM_CXSMICON);
@ -1090,7 +1090,7 @@ begin
if fileIndex >= 0 then
Result:= PtrInt(FPixmapsFileNames.List[fileIndex]^.Data)
else begin
if ExtractIconExW(PWChar(UTF8Decode(AIconName)), 0, phIconLarge, phIconSmall, 1) = 0 then
if ExtractIconExW(PWChar(CeUtf8ToUtf16(AIconName)), 0, phIconLarge, phIconSmall, 1) = 0 then
Result:= ADefaultIcon
else begin
if not ImageList_GetIconSize(FSysImgList, @AIconSize, @AIconSize) then
@ -2054,7 +2054,7 @@ begin
sFileName := Name;
end;
if (SHGetFileInfoW(PWideChar(UTF8Decode(sFileName)),
if (SHGetFileInfoW(PWideChar(CeUtf8ToUtf16(sFileName)),
dwFileAttributes,
FileInfo,
SizeOf(FileInfo),
@ -2215,7 +2215,7 @@ begin
if (not LoadIcon) and (Drive^.DriveType = dtNetwork) and SHGetStockIconInfo(SIID_DRIVENET, uFlags, psii) then
SFI.hIcon:= psii.hIcon
else if (SHGetFileInfoW(PWideChar(UTF8Decode(Drive^.Path)), 0, SFI, SizeOf(SFI), uFlags) = 0) then begin
else if (SHGetFileInfoW(PWideChar(CeUtf8ToUtf16(Drive^.Path)), 0, SFI, SizeOf(SFI), uFlags) = 0) then begin
SFI.hIcon := 0;
end;

View file

@ -45,7 +45,7 @@ implementation
uses
DCOSUtils, DCStrUtils,
{$IF DEFINED(MSWINDOWS)}
Windows, ShellApi, uMyWindows
Windows, ShellApi, DCConvertEncoding, uMyWindows
{$ELSEIF DEFINED(UNIX)}
BaseUnix, uMyUnix, uOSUtils, FileUtil
{$IFDEF DARWIN}
@ -81,7 +81,7 @@ begin
if StrEnds(FileName, ' ') then
Exit(False);
wsFileName:= UTF8Decode(FileName);
wsFileName:= CeUtf8ToUtf16(FileName);
// Windows before Vista cannot move symlink into
// recycle bin correctly, so we return False in this case
if (Win32Platform = VER_PLATFORM_WIN32_NT) and (Win32MajorVersion < 6) then
@ -280,7 +280,7 @@ begin
// Windows Vista/Seven
if (Win32Platform = VER_PLATFORM_WIN32_NT) and (Win32MajorVersion >= 6) then
begin
VolumeName:= GetMountPointVolumeName(UTF8Decode(ExtractFileDrive(sPath)));
VolumeName:= GetMountPointVolumeName(CeUtf8ToUtf16(ExtractFileDrive(sPath)));
VolumeName:= 'Volume' + PathDelim + ExtractVolumeGUID(VolumeName);
if RegOpenKeyExW(HKEY_CURRENT_USER, PWideChar(wsRoot + VolumeName), 0, KEY_READ, Key) = ERROR_SUCCESS then
begin

View file

@ -25,7 +25,8 @@ function GetFileInUseProcessSlow(const FileName: String; LastError: Integer; var
implementation
uses
JwaWinType, JwaNative, JwaNtStatus, JwaPsApi, Windows, DCWindows;
JwaWinType, JwaNative, JwaNtStatus, JwaPsApi, Windows, DCConvertEncoding,
DCWindows;
const
RstrtMgr = 'RstrtMgr.dll';
@ -294,7 +295,7 @@ begin
SetLength(ProcessInfo, Index + 1);
ProcessInfo[Index].ProcessId:= ProcessId;
ProcessInfo[Index].FileHandle:= FileHandle;
ProcessInfo[Index].ExecutablePath:= UTF8Encode(GetProcessFileName(Process));
ProcessInfo[Index].ExecutablePath:= CeUtf16ToUtf8(GetProcessFileName(Process));
end;
procedure GetModuleInUseProcess(const FileName: String; var ProcessInfo: TProcessInfoArray);
@ -308,7 +309,7 @@ var
begin
if EnumProcesses(@dwProcessList[0], SizeOf(dwProcessList), cbNeeded) then
begin
AFileName:= UTF8Decode(FileName);
AFileName:= CeUtf8ToUtf16(FileName);
for I:= 0 to (cbNeeded div SizeOf(DWORD)) do
begin
hProcess:= OpenProcess(PROCESS_QUERY_INFORMATION or PROCESS_VM_READ, False, dwProcessList[I]);
@ -400,7 +401,7 @@ begin
Result:= (RmStartSession(@dwSession, 0, szSessionKey) = ERROR_SUCCESS);
if Result then
try
rgsFileNames:= PWideChar(UTF8Decode(FileName));
rgsFileNames:= PWideChar(CeUtf8ToUtf16(FileName));
Result:= (RmRegisterResources(dwSession, 1, @rgsFileNames, 0, nil, 0, nil) = ERROR_SUCCESS) and
(RmGetList(dwSession, @nProcInfoNeeded, @nProcInfo, rgAffectedApps, @dwReason) = ERROR_SUCCESS);
if Result then
@ -410,7 +411,7 @@ begin
for I:= 0 to nProcInfo - 1 do
begin
ProcessInfo[I].ProcessId:= rgAffectedApps[I].Process.dwProcessId;
ProcessInfo[I].ApplicationName:= UTF8Encode(UnicodeString(rgAffectedApps[I].strAppName));
ProcessInfo[I].ApplicationName:= CeUtf16ToUtf8(UnicodeString(rgAffectedApps[I].strAppName));
hProcess:= OpenProcess(PROCESS_QUERY_LIMITED_INFORMATION, False, rgAffectedApps[I].Process.dwProcessId);
if hProcess <> 0 then
@ -418,7 +419,7 @@ begin
if GetProcessTimes(hProcess, ftCreation, ftDummy, ftDummy, ftDummy) and
(CompareFileTime(@rgAffectedApps[I].Process.ProcessStartTime, @ftCreation) = 0) then
begin
ProcessInfo[I].ExecutablePath:= UTF8Encode(GetProcessFileName(hProcess));
ProcessInfo[I].ExecutablePath:= CeUtf16ToUtf8(GetProcessFileName(hProcess));
end;
finally
CloseHandle(hProcess);

View file

@ -185,7 +185,7 @@ implementation
uses
JwaNtStatus, ShellAPI, MMSystem, JwaWinNetWk, JwaWinUser, JwaVista, LazUTF8,
SysConst, ActiveX, ShlObj, ComObj, DCWindows, uShlObjAdditional;
SysConst, ActiveX, ShlObj, ComObj, DCWindows, DCConvertEncoding, uShlObjAdditional;
var
Wow64DisableWow64FsRedirection: function(OldValue: PPointer): BOOL; stdcall;
@ -374,7 +374,7 @@ var
NotUsed: DWORD;
wsDrv: WideString;
begin
wsDrv:= UTF8Decode(sDrv);
wsDrv:= CeUtf8ToUtf16(sDrv);
Result:= GetVolumeInformationW(PWChar(wsDrv), nil, 0, nil, NotUsed, NotUsed, nil, 0);
end;
@ -389,7 +389,7 @@ var
wsResult: UnicodeString;
begin
Result:= '';
wsDrv:= UTF8Decode(sDrv);
wsDrv:= CeUtf8ToUtf16(sDrv);
WinVer:= LOBYTE(LOWORD(GetVersion));
DriveType:= GetDriveTypeW(PWChar(wsDrv));
@ -418,8 +418,8 @@ var
wsRootPathName,
wsVolumeName: UnicodeString;
begin
wsRootPathName:= UTF8Decode(sRootPathName);
wsVolumeName:= UTF8Decode(sVolumeName);
wsRootPathName:= CeUtf8ToUtf16(sRootPathName);
wsVolumeName:= CeUtf8ToUtf16(sVolumeName);
Result:= SetVolumeLabelW(PWChar(wsRootPathName), PWChar(wsVolumeName));
end;
@ -628,7 +628,7 @@ var
wsDrive: UnicodeString;
lpExecInfo: TShellExecuteInfoW;
begin
wsDrive:= UTF8Decode(sDrv);
wsDrive:= CeUtf8ToUtf16(sDrv);
if not GetDiskFreeSpaceExW(PWideChar(wsDrive), nil, nil, nil) then
begin
LastError:= GetLastError;
@ -669,7 +669,7 @@ var
lpBuffer: PUniversalNameInfoW;
begin
Result:= sLocalName;
wsLocalName:= UTF8Decode(sLocalName);
wsLocalName:= CeUtf8ToUtf16(sLocalName);
lpBufferSize:= SizeOf(TUniversalNameInfoW);
GetMem(lpBuffer, lpBufferSize);
try
@ -732,7 +732,7 @@ begin
hSCManager:= OpenSCManagerW(nil, nil, SC_MANAGER_ENUMERATE_SERVICE);
if (hSCManager = 0) then Exit(0);
try
hService:= OpenServiceW(hSCManager, PWideChar(UTF8Decode(AName)), SERVICE_QUERY_STATUS);
hService:= OpenServiceW(hSCManager, PWideChar(CeUtf8ToUtf16(AName)), SERVICE_QUERY_STATUS);
if (hService = 0) then Exit(0);
if not QueryServiceStatus(hService, {%H-}lpServiceStatus) then
@ -854,7 +854,7 @@ begin
Exit;
try
wsPathName := UTF8Decode(sPath);
wsPathName := CeUtf8ToUtf16(sPath);
// Check if the path is to remote share and get remote machine name.
@ -925,7 +925,7 @@ var
SFI: TSHFileInfoW;
begin
FillChar(SFI, SizeOf(SFI), 0);
if SHGetFileInfoW(PWideChar(UTF8Decode(sPath)), 0, SFI, SizeOf(SFI), SHGFI_TYPENAME) <> 0 then
if SHGetFileInfoW(PWideChar(CeUtf8ToUtf16(sPath)), 0, SFI, SizeOf(SFI), SHGFI_TYPENAME) <> 0 then
Result := UTF16ToUTF8(UnicodeString(SFI.szTypeName))
else
Result := EmptyStr;
@ -938,7 +938,7 @@ var
begin
// Available since Windows XP.
if ((Win32MajorVersion > 5) or ((Win32MajorVersion = 5) and (Win32MinorVersion >= 1))) and
GetVolumeInformationW(PWideChar(UTF8Decode(sRootPath)), nil, 0, nil,
GetVolumeInformationW(PWideChar(CeUtf8ToUtf16(sRootPath)), nil, 0, nil,
NotUsed, NotUsed, Buf, SizeOf(Buf)) then
begin
Result:= UTF16ToUTF8(UnicodeString(Buf));
@ -1102,12 +1102,12 @@ begin
IPFile := IObject as IPersistFile;
ISLink := IObject as IShellLinkW;
OleCheckUTF8(ISLink.SetPath(PWideChar(UTF8Decode(Target))));
OleCheckUTF8(ISLink.SetPath(PWideChar(CeUtf8ToUtf16(Target))));
OleCheckUTF8(ISLink.SetArguments(PWideChar(TargetArguments)));
OleCheckUTF8(ISLink.SetWorkingDirectory(PWideChar(UTF8Decode(ExtractFilePath(Target)))));
OleCheckUTF8(ISLink.SetWorkingDirectory(PWideChar(CeUtf8ToUtf16(ExtractFilePath(Target)))));
{ Get the desktop location }
LinkName := UTF8Decode(Shortcut);
LinkName := CeUtf8ToUtf16(Shortcut);
if LowerCase(ExtractFileExt(LinkName)) <> '.lnk' then
LinkName := LinkName + '.lnk';

View file

@ -152,7 +152,7 @@ begin
if Files[I].Name = EmptyStr then
S := EmptyWideStr
else
S := UTF8Decode(Files[I].Path);
S := CeUtf8ToUtf16(Files[I].Path);
OleCheckUTF8(DeskTopFolder.ParseDisplayName(Handle, nil, PWideChar(S), pchEaten, PathPIDL, dwAttributes));
try
@ -162,9 +162,9 @@ begin
end;
if Files[I].Name = EmptyStr then
S := UTF8Decode(Files[I].Path)
S := CeUtf8ToUtf16(Files[I].Path)
else
S := UTF8Decode(Files[I].Name);
S := CeUtf8ToUtf16(Files[I].Name);
OleCheckUTF8(Folder.ParseDisplayName(Handle, nil, PWideChar(S), pchEaten, tmpPIDL, dwAttributes));
(List + i)^ := tmpPIDL;
@ -198,7 +198,7 @@ begin
if Files.Count > 0 then
begin
wsFileName := UTF8Decode(Files[0].FullPath);
wsFileName := CeUtf8ToUtf16(Files[0].FullPath);
OleCheckUTF8(SHGetDesktopFolder(DesktopFolder));
try
OleCheckUTF8(DesktopFolder.ParseDisplayName(Handle, nil, PWideChar(wsFileName), pchEaten, PathPIDL, dwAttributes));
@ -313,9 +313,9 @@ var
procedure LocalInsertMenuItemExternal(MenuDispatcher: integer; BitmapProvided: TBitmap = nil);
begin
if BitmapProvided = nil then
InsertMenuItemEx(MenuWhereToAdd, 0, PWChar(UTF8Decode(paramExtActionList.ExtActionCommand[MenuDispatcher].ActionName)), iMenuPositionInsertion, MenuDispatcher + USER_CMD_ID, MFT_STRING, paramExtActionList.ExtActionCommand[MenuDispatcher].IconBitmap)
InsertMenuItemEx(MenuWhereToAdd, 0, PWChar(CeUtf8ToUtf16(paramExtActionList.ExtActionCommand[MenuDispatcher].ActionName)), iMenuPositionInsertion, MenuDispatcher + USER_CMD_ID, MFT_STRING, paramExtActionList.ExtActionCommand[MenuDispatcher].IconBitmap)
else
InsertMenuItemEx(MenuWhereToAdd, 0, PWChar(UTF8Decode(paramExtActionList.ExtActionCommand[MenuDispatcher].ActionName)), iMenuPositionInsertion, MenuDispatcher + USER_CMD_ID, MFT_STRING, BitmapProvided);
InsertMenuItemEx(MenuWhereToAdd, 0, PWChar(CeUtf8ToUtf16(paramExtActionList.ExtActionCommand[MenuDispatcher].ActionName)), iMenuPositionInsertion, MenuDispatcher + USER_CMD_ID, MFT_STRING, BitmapProvided);
Inc(iMenuPositionInsertion);
end;
@ -593,37 +593,37 @@ begin
// Add commands to root of context menu
I := InnerExtActionList.Add(TExtActionCommand.Create(FormCommands.GetCommandCaption('cm_Refresh'), 'cm_Refresh', '', ''));
InsertMenuItemEx(FShellMenu, 0, PWideChar(UTF8Decode(InnerExtActionList.ExtActionCommand[I].ActionName)), 0, I + USER_CMD_ID, MFT_STRING);
InsertMenuItemEx(FShellMenu, 0, PWideChar(CeUtf8ToUtf16(InnerExtActionList.ExtActionCommand[I].ActionName)), 0, I + USER_CMD_ID, MFT_STRING);
// Add "Sort by" submenu
hActionsSubMenu := CreatePopupMenu;
I := InnerExtActionList.Add(TExtActionCommand.Create(FormCommands.GetCommandCaption('cm_ReverseOrder'), 'cm_ReverseOrder', '', ''));
InsertMenuItemEx(hActionsSubMenu, 0, PWideChar(UTF8Decode(InnerExtActionList.ExtActionCommand[I].ActionName)), 0, I + USER_CMD_ID, MFT_STRING);
InsertMenuItemEx(hActionsSubMenu, 0, PWideChar(CeUtf8ToUtf16(InnerExtActionList.ExtActionCommand[I].ActionName)), 0, I + USER_CMD_ID, MFT_STRING);
// Add separator
InsertMenuItemEx(hActionsSubMenu, 0, nil, 0, 0, MFT_SEPARATOR);
// Add "Sort by" items
I := InnerExtActionList.Add(TExtActionCommand.Create(FormCommands.GetCommandCaption('cm_SortByAttr'), 'cm_SortByAttr', '', ''));
InsertMenuItemEx(hActionsSubMenu, 0, PWideChar(UTF8Decode(InnerExtActionList.ExtActionCommand[I].ActionName)), 0, I + USER_CMD_ID, MFT_STRING);
InsertMenuItemEx(hActionsSubMenu, 0, PWideChar(CeUtf8ToUtf16(InnerExtActionList.ExtActionCommand[I].ActionName)), 0, I + USER_CMD_ID, MFT_STRING);
I := InnerExtActionList.Add(TExtActionCommand.Create(FormCommands.GetCommandCaption('cm_SortByDate'), 'cm_SortByDate', '', ''));
InsertMenuItemEx(hActionsSubMenu, 0, PWideChar(UTF8Decode(InnerExtActionList.ExtActionCommand[I].ActionName)), 0, I + USER_CMD_ID, MFT_STRING);
InsertMenuItemEx(hActionsSubMenu, 0, PWideChar(CeUtf8ToUtf16(InnerExtActionList.ExtActionCommand[I].ActionName)), 0, I + USER_CMD_ID, MFT_STRING);
I := InnerExtActionList.Add(TExtActionCommand.Create(FormCommands.GetCommandCaption('cm_SortBySize'), 'cm_SortBySize', '', ''));
InsertMenuItemEx(hActionsSubMenu, 0, PWideChar(UTF8Decode(InnerExtActionList.ExtActionCommand[I].ActionName)), 0, I + USER_CMD_ID, MFT_STRING);
InsertMenuItemEx(hActionsSubMenu, 0, PWideChar(CeUtf8ToUtf16(InnerExtActionList.ExtActionCommand[I].ActionName)), 0, I + USER_CMD_ID, MFT_STRING);
I := InnerExtActionList.Add(TExtActionCommand.Create(FormCommands.GetCommandCaption('cm_SortByExt'), 'cm_SortByExt', '', ''));
InsertMenuItemEx(hActionsSubMenu, 0, PWideChar(UTF8Decode(InnerExtActionList.ExtActionCommand[I].ActionName)), 0, I + USER_CMD_ID, MFT_STRING);
InsertMenuItemEx(hActionsSubMenu, 0, PWideChar(CeUtf8ToUtf16(InnerExtActionList.ExtActionCommand[I].ActionName)), 0, I + USER_CMD_ID, MFT_STRING);
I := InnerExtActionList.Add(TExtActionCommand.Create(FormCommands.GetCommandCaption('cm_SortByName'), 'cm_SortByName', '', ''));
InsertMenuItemEx(hActionsSubMenu, 0, PWideChar(UTF8Decode(InnerExtActionList.ExtActionCommand[I].ActionName)), 0, I + USER_CMD_ID, MFT_STRING);
InsertMenuItemEx(hActionsSubMenu, 0, PWideChar(CeUtf8ToUtf16(InnerExtActionList.ExtActionCommand[I].ActionName)), 0, I + USER_CMD_ID, MFT_STRING);
// Add submenu to context menu
InsertMenuItemEx(FShellMenu, hActionsSubMenu, PWideChar(UTF8Decode(rsMnuSortBy)), 1, 333, MFT_STRING);
InsertMenuItemEx(FShellMenu, hActionsSubMenu, PWideChar(CeUtf8ToUtf16(rsMnuSortBy)), 1, 333, MFT_STRING);
// Add menu separator
InsertMenuItemEx(FShellMenu, 0, nil, 2, 0, MFT_SEPARATOR);
// Add commands to root of context menu
I := InnerExtActionList.Add(TExtActionCommand.Create(FormCommands.GetCommandCaption('cm_PasteFromClipboard'), 'cm_PasteFromClipboard', '', ''));
InsertMenuItemEx(FShellMenu, 0, PWideChar(UTF8Decode(InnerExtActionList.ExtActionCommand[I].ActionName)), 3, I + USER_CMD_ID, MFT_STRING);
InsertMenuItemEx(FShellMenu, 0, PWideChar(CeUtf8ToUtf16(InnerExtActionList.ExtActionCommand[I].ActionName)), 3, I + USER_CMD_ID, MFT_STRING);
// Add menu separator
InsertMenuItemEx(FShellMenu, 0, nil, 4, 0, MFT_SEPARATOR);
@ -651,7 +651,7 @@ begin
end;
if FUserWishForContextMenu = uwcmComplete then
InsertMenuItemEx(FShellMenu, hActionsSubMenu, PWideChar(UTF8Decode(rsMnuActions)), I, 333, MFT_STRING);
InsertMenuItemEx(FShellMenu, hActionsSubMenu, PWideChar(CeUtf8ToUtf16(rsMnuActions)), I, 333, MFT_STRING);
end;
{ /Actions submenu }
end;

View file

@ -72,7 +72,7 @@ begin
if StrRetToBufW(@StrRet, PIDL, S, MAX_PATH) <> S_OK then
Result:= EmptyStr
else
Result:= UTF8Encode(UnicodeString(S));
Result:= CeUtf16ToUtf8(UnicodeString(S));
end;
function GetDisplayName(AFolder: IShellFolder; PIDL: PItemIDList;

View file

@ -118,7 +118,7 @@ procedure OleCheckUTF8(Result: HResult);
implementation
uses
SysUtils, JwaShlGuid, ComObj, LazUTF8, DCOSUtils;
SysUtils, JwaShlGuid, ComObj, LazUTF8, DCOSUtils, DCConvertEncoding;
var
SHGetPropertyStoreFromParsingName: function(pszPath: PCWSTR; const pbc: IBindCtx;
@ -195,7 +195,7 @@ begin
@SHChangeIconW := Windows.GetProcAddress(ShellHandle, PAnsiChar(62));
if Assigned(SHChangeIconW) then
begin
FileNameW := UTF8Decode(FileName);
FileNameW := CeUtf8ToUtf16(FileName);
Result := SHChangeIconW(hOwner, FileNameW, SizeOf(FileNameW), IconIndex);
if Result then FileName := UTF16ToUTF8(UnicodeString(FileNameW));
end
@ -207,7 +207,7 @@ var
AValue: Variant;
AStorage: IPropertyStore;
begin
if Succeeded(SHGetPropertyStoreFromParsingName(PWideChar(UTF8Decode(FileName)), nil, GPS_DEFAULT, IPropertyStore, AStorage)) then
if Succeeded(SHGetPropertyStoreFromParsingName(PWideChar(CeUtf8ToUtf16(FileName)), nil, GPS_DEFAULT, IPropertyStore, AStorage)) then
begin
if Succeeded(AStorage.GetValue(@Key, TPROPVARIANT(AValue))) then
Exit(AValue);
@ -230,7 +230,7 @@ begin
if SHGetDesktopFolder(DesktopFolder) = S_OK then
begin
wsTemp:= UTF8Decode(sFilePath);
wsTemp:= CeUtf8ToUtf16(sFilePath);
if DesktopFolder.ParseDisplayName(0, nil, PWideChar(wsTemp), pchEaten, ParentPidl, dwAttributes) = S_OK then
begin
if DesktopFolder.BindToObject(ParentPidl, nil, IID_IShellFolder, Folder) = S_OK then
@ -242,7 +242,7 @@ begin
if Folder.QueryInterface(IID_IShellIconOverlay, IconOverlay) = S_OK then
begin
// Get a pidl for the file.
wsTemp:= UTF8Decode(sFileName);
wsTemp:= CeUtf8ToUtf16(sFileName);
if Folder.ParseDisplayName(0, nil, PWideChar(wsTemp), pchEaten, Pidl, dwAttributes) = S_OK then
begin
// Get the overlay icon index.
@ -278,11 +278,11 @@ begin
Result:= EmptyStr;
if Succeeded(SHGetDesktopFolder(DesktopFolder)) then
try
wsTemp:= UTF8Decode(sFilePath);
wsTemp:= CeUtf8ToUtf16(sFilePath);
if Succeeded(DesktopFolder.ParseDisplayName(0, nil, PWideChar(wsTemp), pchEaten, pidlFolder, dwAttributes)) then
if Succeeded(DesktopFolder.BindToObject(pidlFolder, nil, IID_IShellFolder, Folder)) then
try
wsTemp:= UTF8Decode(sFileName);
wsTemp:= CeUtf8ToUtf16(sFileName);
if Succeeded(Folder.ParseDisplayName(0, nil, PWideChar(wsTemp), pchEaten, pidlFile, dwAttributes)) then
if Succeeded(Folder.GetUIObjectOf(0, 1, pidlFile, IID_IQueryInfo, nil, queryInfo)) then
if Succeeded(queryInfo.GetInfoTip(QITIPF_USESLOWTIP, ppwszTip)) then
@ -315,7 +315,7 @@ begin
Unknown := CreateComObject(CLSID_ShellLink);
ShellLink := Unknown as IShellLinkW;
PersistFile := Unknown as IPersistFile;
if Failed(PersistFile.Load(PWideChar(UTF8Decode(FileName)), OF_READ)) then Exit;
if Failed(PersistFile.Load(PWideChar(CeUtf8ToUtf16(FileName)), OF_READ)) then Exit;
pszFile:= GetMem(MAX_PATH * 2);
try
if Failed(ShellLink.GetPath(pszFile, MAX_PATH, @FindData, 0)) then Exit;

View file

@ -32,7 +32,7 @@ uses
implementation
uses
SysUtils, Forms, Graphics, Windows, ActiveX, ShlObj, uBitmap;
SysUtils, Forms, Graphics, Windows, ActiveX, ShlObj, DCConvertEncoding, uBitmap;
const
SIIGBF_RESIZETOFIT = $00000000;
@ -83,12 +83,12 @@ begin
if SHGetDesktopFolder(DesktopFolder) = S_OK then
begin
wsTemp:= UTF8Decode(ExtractFilePath(aFileName));
wsTemp:= CeUtf8ToUtf16(ExtractFilePath(aFileName));
if DesktopFolder.ParseDisplayName(0, nil, PWideChar(wsTemp), pchEaten, ParentPidl, dwAttributes) = S_OK then
begin
if DesktopFolder.BindToObject(ParentPidl, nil, IID_IShellFolder, Folder) = S_OK then
begin
wsTemp:= UTF8Decode(ExtractFileName(aFileName));
wsTemp:= CeUtf8ToUtf16(ExtractFileName(aFileName));
if Folder.ParseDisplayName(0, nil, PWideChar(wsTemp), pchEaten, Pidl, dwAttributes) = S_OK then
begin
if Succeeded(Folder.GetUIObjectOf(0, 1, Pidl, IID_IExtractImage, nil, Image)) then
@ -115,7 +115,7 @@ function GetThumbnailNew(const aFileName: String; aSize: TSize; out Bitmap: HBIT
var
ShellItemImage: IShellItemImageFactory;
begin
Result:= SHCreateItemFromParsingName(PWideChar(UTF8Decode(aFileName)), nil,
Result:= SHCreateItemFromParsingName(PWideChar(CeUtf8ToUtf16(aFileName)), nil,
IShellItemImageFactory, ShellItemImage);
if Succeeded(Result) then
begin

View file

@ -80,7 +80,7 @@ type
implementation
uses
LazUTF8, JwaWinCon, uOSUtils;
LazUTF8, JwaWinCon, DCConvertEncoding, uOSUtils;
{ TWinTerm }
@ -178,7 +178,7 @@ begin
ZeroMemory(@FProcessInformation, SizeOf(FProcessInformation));
CreateProcessW(nil,
PWideChar(UTF8Decode(Command)), // command line
PWideChar(CeUtf8ToUtf16(Command)), // command line
nil, // process security attributes
nil, // primary thread security attributes
TRUE, // handles are inherited

View file

@ -15,7 +15,7 @@ implementation
uses
SysUtils
{$IF DEFINED(MSWINDOWS)}
, Types, Windows, DCOSUtils, ShellApi, uMyWindows
, Types, Windows, DCOSUtils, ShellApi, DCConvertEncoding, uMyWindows
{$ELSEIF DEFINED(UNIX)}
, Classes, Unix, BaseUnix, DCUnix, Dialogs, SyncObjs, Process, un_process
{$IF DEFINED(DARWIN)}
@ -268,9 +268,9 @@ begin
ZeroMemory(@lpExecInfo, SizeOf(lpExecInfo));
lpExecInfo.cbSize:= SizeOf(lpExecInfo);
lpExecInfo.fMask:= SEE_MASK_NOCLOSEPROCESS;
lpExecInfo.lpFile:= PWideChar(UTF8Decode(Exe));
lpExecInfo.lpDirectory:= PWideChar(UTF8Decode(sStartPath));
lpExecInfo.lpParameters:= PWideChar(UTF8Decode(AParams));
lpExecInfo.lpFile:= PWideChar(CeUtf8ToUtf16(Exe));
lpExecInfo.lpDirectory:= PWideChar(CeUtf8ToUtf16(sStartPath));
lpExecInfo.lpParameters:= PWideChar(CeUtf8ToUtf16(AParams));
lpExecInfo.lpVerb:= 'runas';
if ShellExecuteExW(@lpExecInfo) then

View file

@ -73,7 +73,7 @@ implementation
uses
JwaWinNT, JwaAclApi, JwaAccCtrl, JwaWinBase, Windows, DCOSUtils,
uNamedPipes, uDebug, uProcessInfo;
DCConvertEncoding, uNamedPipes, uDebug, uProcessInfo;
{ TPipeTransport }
@ -211,7 +211,7 @@ end;
constructor TPipeTransport.Create(Address: String);
begin
FAddress:= UTF8Decode(Address);
FAddress:= CeUtf8ToUtf16(Address);
end;
destructor TPipeTransport.Destroy;
@ -268,7 +268,7 @@ var
ExplicitAccess: array [0..1] of TExplicitAccess;
ElevationType: TTokenElevationType absolute TokenInformation;
begin
AName:= UTF8Decode(FOwner.Name);
AName:= CeUtf8ToUtf16(FOwner.Name);
if (FOwner.ProcessId > 0) then
dwWait:= FOwner.ProcessId

View file

@ -111,7 +111,7 @@ type
implementation
uses
LCLProc, LazUtf8, StrUtils, LConvEncoding, DCStrUtils,
LCLProc, LazUtf8, StrUtils, LConvEncoding, DCStrUtils, DCConvertEncoding,
uLng, DCClassesUtf8, uFindMmap, uGlobs, uShowMsg, DCOSUtils, uOSUtils, uHash,
uLog, WcxPlugin, Math, uDCUtils, uConvEncoding, DCDateTimeUtils, uOfficeXML;
@ -203,8 +203,8 @@ begin
with FFileChecks do
begin
if RegExp then begin
FFilesMasksRegExp := TRegExprW.Create(UTF8Decode(FilesMasks));
FExcludeFilesRegExp := TRegExprW.Create(UTF8Decode(ExcludeFiles));
FFilesMasksRegExp := TRegExprW.Create(CeUtf8ToUtf16(FilesMasks));
FExcludeFilesRegExp := TRegExprW.Create(CeUtf8ToUtf16(ExcludeFiles));
end
else begin
FFilesMasks := TMaskList.Create(FilesMasks);
@ -651,7 +651,7 @@ begin
begin
if RegExp then
begin
AFileName := UTF8Decode(FileName);
AFileName := CeUtf8ToUtf16(FileName);
Result := ((FilesMasks = '') or FFilesMasksRegExp.Exec(AFileName)) and
((ExcludeFiles = '') or not FExcludeFilesRegExp.Exec(AFileName));
end

View file

@ -95,7 +95,7 @@ uses
LazUTF8,
//DC
uPinyin, uAccentsUtils;
DCConvertEncoding, uPinyin, uAccentsUtils;
{ MatchesMask }
function MatchesMask(const FileName, Mask: String; const AOptions: TMaskOptions): Boolean;
@ -224,7 +224,7 @@ begin
FMask.MinLength := 0;
FMask.MaxLength := 0;
SkipAnyText := False;
S := UTF8Decode(AValue);
S := CeUtf8ToUtf16(AValue);
I := 1;
while I <= Length(S) do
@ -315,7 +315,7 @@ var
begin
Result := False;
S := UTF8Decode(AFileName);
S := CeUtf8ToUtf16(AFileName);
L := Length(S);
if L = 0 then
begin
@ -341,7 +341,7 @@ var
sInitialMask: UnicodeString;
begin
sInitialMask := UTF8Decode(FTemplate);
sInitialMask := CeUtf8ToUtf16(FTemplate);
if (Length(sInitialMask) > 2) and (RightStr(sInitialMask, 3) = '*.*') then // foo*.*
begin

View file

@ -227,7 +227,7 @@ begin
sArcName:= UTF16ToUTF8(UnicodeString(ArcName));
Result:= ChangeVolProc(sArcName, Mode);
if (Mode = PK_VOL_ASK) and (Result <> 0) then
StrPLCopy(ArcName, UTF8Decode(sArcName), MAX_PATH);
StrPLCopy(ArcName, CeUtf8ToUtf16(sArcName), MAX_PATH);
end;
{ EWcxModuleException }
@ -266,7 +266,7 @@ begin
if Assigned(OpenArchiveW) then
begin
FillChar(ArcFileW, SizeOf(ArcFileW), #0);
WideFileName := UTF8Decode(FileName);
WideFileName := CeUtf8ToUtf16(FileName);
ArcFileW.ArcName := PWideChar(WideFileName); // Pointer to local variable.
ArcFileW.OpenMode := anOpenMode;
Result := OpenArchiveW(ArcFileW);
@ -298,9 +298,9 @@ begin
if Assigned(ProcessFileW) then
begin
if DestPath = EmptyStr then
Result:= ProcessFileW(hArcData, Operation, nil, PWideChar(UTF8Decode(DestName)))
Result:= ProcessFileW(hArcData, Operation, nil, PWideChar(CeUtf8ToUtf16(DestName)))
else
Result:= ProcessFileW(hArcData, Operation, PWideChar(UTF8Decode(DestPath)), PWideChar(UTF8Decode(DestName)));
Result:= ProcessFileW(hArcData, Operation, PWideChar(CeUtf8ToUtf16(DestPath)), PWideChar(CeUtf8ToUtf16(DestName)));
end
else if Assigned(ProcessFile) then
begin
@ -317,11 +317,11 @@ begin
if Assigned(PackFilesW) then
begin
if SubPath = EmptyStr then
Result:= PackFilesW(PWideChar(UTF8Decode(PackedFile)), nil,
PWideChar(UTF8Decode(SrcPath)), PWideChar(UTF8Decode(AddList)), Flags)
Result:= PackFilesW(PWideChar(CeUtf8ToUtf16(PackedFile)), nil,
PWideChar(CeUtf8ToUtf16(SrcPath)), PWideChar(CeUtf8ToUtf16(AddList)), Flags)
else
Result:= PackFilesW(PWideChar(UTF8Decode(PackedFile)), PWideChar(UTF8Decode(SubPath)),
PWideChar(UTF8Decode(SrcPath)), PWideChar(UTF8Decode(AddList)), Flags);
Result:= PackFilesW(PWideChar(CeUtf8ToUtf16(PackedFile)), PWideChar(CeUtf8ToUtf16(SubPath)),
PWideChar(CeUtf8ToUtf16(SrcPath)), PWideChar(CeUtf8ToUtf16(AddList)), Flags);
end
else if Assigned(PackFiles) then
begin
@ -337,7 +337,7 @@ end;
function TWcxModule.WcxDeleteFiles(PackedFile, DeleteList: String): LongInt;
begin
if Assigned(DeleteFilesW) then
Result:= DeleteFilesW(PWideChar(UTF8Decode(PackedFile)), PWideChar(UTF8Decode(DeleteList)))
Result:= DeleteFilesW(PWideChar(CeUtf8ToUtf16(PackedFile)), PWideChar(CeUtf8ToUtf16(DeleteList)))
else if Assigned(DeleteFiles) then
Result:= DeleteFiles(PAnsiChar(CeUtf8ToSys(PackedFile)), PAnsiChar(CeUtf8ToSys(DeleteList)));
end;
@ -345,7 +345,7 @@ end;
function TWcxModule.WcxCanYouHandleThisFile(FileName: String): Boolean;
begin
if Assigned(CanYouHandleThisFileW) then
Result:= CanYouHandleThisFileW(PWideChar(UTF8Decode(FileName)))
Result:= CanYouHandleThisFileW(PWideChar(CeUtf8ToUtf16(FileName)))
else if Assigned(CanYouHandleThisFile) then
Result:= CanYouHandleThisFile(PAnsiChar(CeUtf8ToSys(FileName)))
else
@ -355,7 +355,7 @@ end;
function TWcxModule.WcxStartMemPack(Options: LongInt; FileName: String): TArcHandle;
begin
if Assigned(StartMemPackW) then
Result:= StartMemPackW(Options, PWideChar(UTF8Decode(FileName)))
Result:= StartMemPackW(Options, PWideChar(CeUtf8ToUtf16(FileName)))
else if Assigned(StartMemPack) then
Result:= StartMemPack(Options, PAnsiChar(CeUtf8ToSys(FileName)));
end;

View file

@ -685,7 +685,7 @@ end;
procedure TPluginWDX.CallContentStopGetValue(FileName: String);
begin
if Assigned(ContentStopGetValueW) then
ContentStopGetValueW(PWideChar(UTF8Decode(FileName)))
ContentStopGetValueW(PWideChar(CeUtf8ToUtf16(FileName)))
else if Assigned(ContentStopGetValue) then
ContentStopGetValue(PAnsiChar(CeUtf8ToSys(FileName)));
end;
@ -801,7 +801,7 @@ begin
EnterCriticalSection(FMutex);
try
if Assigned(ContentGetValueW) then
Rez := ContentGetValueW(PWideChar(UTF8Decode(FileName)), FieldIndex, UnitIndex, @Buf, SizeOf(buf), flags)
Rez := ContentGetValueW(PWideChar(CeUtf8ToUtf16(FileName)), FieldIndex, UnitIndex, @Buf, SizeOf(buf), flags)
else if Assigned(ContentGetValue) then
Rez := ContentGetValue(PAnsiChar(mbFileNameToSysEnc(FileName)), FieldIndex, UnitIndex, @Buf, SizeOf(buf), flags);
@ -842,7 +842,7 @@ begin
EnterCriticalSection(FMutex);
try
if Assigned(ContentGetValueW) then
Rez := ContentGetValueW(PWideChar(UTF8Decode(FileName)), FieldIndex, UnitIndex, @Buf, SizeOf(buf), flags)
Rez := ContentGetValueW(PWideChar(CeUtf8ToUtf16(FileName)), FieldIndex, UnitIndex, @Buf, SizeOf(buf), flags)
else if Assigned(ContentGetValue) then
Rez := ContentGetValue(PAnsiChar(mbFileNameToSysEnc(FileName)), FieldIndex, UnitIndex, @Buf, SizeOf(buf), flags);
@ -879,7 +879,7 @@ begin
EnterCriticalSection(FMutex);
try
if Assigned(ContentGetValueW) then
Rez := ContentGetValueW(PWideChar(UTF8Decode(FileName)), FieldIndex, UnitIndex, @Buf, SizeOf(buf), 0)
Rez := ContentGetValueW(PWideChar(CeUtf8ToUtf16(FileName)), FieldIndex, UnitIndex, @Buf, SizeOf(buf), 0)
else if Assigned(ContentGetValue) then
Rez := ContentGetValue(PAnsiChar(mbFileNameToSysEnc(FileName)), FieldIndex, UnitIndex, @Buf, SizeOf(buf), 0);

View file

@ -252,7 +252,7 @@ begin
try
if Assigned(FsFindFirstW) then
begin
Result:= FsFindFirstW(PWideChar(UTF8Decode(Path)), FindData.FindDataW);
Result:= FsFindFirstW(PWideChar(CeUtf8ToUtf16(Path)), FindData.FindDataW);
if Result <> wfxInvalidHandle then ConvertFindData(FindData, False);
end
else if Assigned(FsFindFirst) then
@ -287,7 +287,7 @@ procedure TWFXModule.WfxStatusInfo(RemoteDir: String; InfoStartEnd,
InfoOperation: Integer);
begin
if Assigned(FsStatusInfoW) then
FsStatusInfoW(PWideChar(UTF8Decode(RemoteDir)), InfoStartEnd, InfoOperation)
FsStatusInfoW(PWideChar(CeUtf8ToUtf16(RemoteDir)), InfoStartEnd, InfoOperation)
else if Assigned(FsStatusInfo) then
FsStatusInfo(PAnsiChar(CeUtf8ToSys(RemoteDir)), InfoStartEnd, InfoOperation);
end;
@ -302,8 +302,8 @@ begin
if Assigned(FsExecuteFileW) then
begin
pwcRemoteName:= GetMem(MAX_PATH * SizeOf(WideChar));
StrPCopyW(pwcRemoteName, UTF8Decode(RemoteName));
Result:= FsExecuteFileW(MainWin, pwcRemoteName, PWideChar(UTF8Decode(Verb)));
StrPCopyW(pwcRemoteName, CeUtf8ToUtf16(RemoteName));
Result:= FsExecuteFileW(MainWin, pwcRemoteName, PWideChar(CeUtf8ToUtf16(Verb)));
if Result = FS_EXEC_SYMLINK then
RemoteName:= UTF16ToUTF8(UnicodeString(pwcRemoteName));
FreeMem(pwcRemoteName);
@ -324,7 +324,7 @@ function TWFXModule.WfxRenMovFile(OldName, NewName: String; Move,
begin
Result:= FS_FILE_NOTSUPPORTED;
if Assigned(FsRenMovFileW) then
Result:= FsRenMovFileW(PWideChar(UTF8Decode(OldName)), PWideChar(UTF8Decode(NewName)), Move, OverWrite, RemoteInfo)
Result:= FsRenMovFileW(PWideChar(CeUtf8ToUtf16(OldName)), PWideChar(CeUtf8ToUtf16(NewName)), Move, OverWrite, RemoteInfo)
else if Assigned(FsRenMovFile) then
Result:= FsRenMovFile(PAnsiChar(CeUtf8ToSys(OldName)), PAnsiChar(CeUtf8ToSys(NewName)), Move, OverWrite, RemoteInfo);
end;
@ -334,7 +334,7 @@ function TWFXModule.WfxGetFile(RemoteName, LocalName: String;
begin
Result:= FS_FILE_NOTSUPPORTED;
if Assigned(FsGetFileW) then
Result:= FsGetFileW(PWideChar(UTF8Decode(RemoteName)), PWideChar(UTF8Decode(LocalName)), CopyFlags, RemoteInfo)
Result:= FsGetFileW(PWideChar(CeUtf8ToUtf16(RemoteName)), PWideChar(CeUtf8ToUtf16(LocalName)), CopyFlags, RemoteInfo)
else if Assigned(FsGetFile) then
Result:= FsGetFile(PAnsiChar(CeUtf8ToSys(RemoteName)), PAnsiChar(CeUtf8ToSys(LocalName)), CopyFlags, RemoteInfo);
end;
@ -343,7 +343,7 @@ function TWFXModule.WfxPutFile(LocalName, RemoteName: String; CopyFlags: Integer
begin
Result:= FS_FILE_NOTSUPPORTED;
if Assigned(FsPutFileW) then
Result:= FsPutFileW(PWideChar(UTF8Decode(LocalName)), PWideChar(UTF8Decode(RemoteName)), CopyFlags)
Result:= FsPutFileW(PWideChar(CeUtf8ToUtf16(LocalName)), PWideChar(CeUtf8ToUtf16(RemoteName)), CopyFlags)
else if Assigned(FsPutFile) then
Result:= FsPutFile(PAnsiChar(CeUtf8ToSys(LocalName)), PAnsiChar(CeUtf8ToSys(RemoteName)), CopyFlags);
end;
@ -352,7 +352,7 @@ function TWFXModule.WfxSetAttr(RemoteName: String; NewAttr: LongInt): Boolean;
begin
Result:= False;
if Assigned(FsSetAttrW) then
Result:= FsSetAttrW(PWideChar(UTF8Decode(RemoteName)), NewAttr)
Result:= FsSetAttrW(PWideChar(CeUtf8ToUtf16(RemoteName)), NewAttr)
else if Assigned(FsSetAttr) then
Result:= FsSetAttr(PAnsiChar(CeUtf8ToSys(RemoteName)), NewAttr);
end;
@ -362,7 +362,7 @@ function TWFXModule.WfxSetTime(RemoteName: String; pCreationTime,
begin
Result:= False;
if Assigned(FsSetTimeW) then
Result:= FsSetTimeW(PWideChar(UTF8Decode(RemoteName)), pCreationTime, pLastAccessTime, pLastWriteTime)
Result:= FsSetTimeW(PWideChar(CeUtf8ToUtf16(RemoteName)), pCreationTime, pLastAccessTime, pLastWriteTime)
else if Assigned(FsSetTime) then
Result:= FsSetTime(PAnsiChar(CeUtf8ToSys(RemoteName)), pCreationTime, pLastAccessTime, pLastWriteTime);
end;
@ -373,7 +373,7 @@ begin
if Assigned(FsMkDirW) then
begin
WfxStatusInfo(sBasePath, FS_STATUS_START, FS_STATUS_OP_MKDIR);
if FsMkDirW(PWideChar(UTF8Decode(sDirName))) then
if FsMkDirW(PWideChar(CeUtf8ToUtf16(sDirName))) then
Result:= WFX_SUCCESS
else
Result:= WFX_ERROR;
@ -394,7 +394,7 @@ function TWFXModule.WfxRemoveDir(const sDirName: String): Boolean;
begin
Result:= False;
if Assigned(FsRemoveDirW) then
Result:= FsRemoveDirW(PWideChar(UTF8Decode(sDirName)))
Result:= FsRemoveDirW(PWideChar(CeUtf8ToUtf16(sDirName)))
else if Assigned(FsRemoveDir) then
Result:= FsRemoveDir(PAnsiChar(CeUtf8ToSys(sDirName)));
end;
@ -403,7 +403,7 @@ function TWFXModule.WfxDeleteFile(const sFileName: String): Boolean;
begin
Result:= False;
if Assigned(FsDeleteFileW) then
Result:= FsDeleteFileW(PWideChar(UTF8Decode(sFileName)))
Result:= FsDeleteFileW(PWideChar(CeUtf8ToUtf16(sFileName)))
else if Assigned(FsDeleteFile) then
Result:= FsDeleteFile(PAnsiChar(CeUtf8ToSys(sFileName)));
end;
@ -417,7 +417,7 @@ begin
if Assigned(FsGetLocalNameW) then
begin
pwcRemoteName:= GetMem(MAX_PATH * SizeOf(WideChar));
StrPCopyW(pwcRemoteName, UTF8Decode(sFileName));
StrPCopyW(pwcRemoteName, CeUtf8ToUtf16(sFileName));
Result:= FsGetLocalNameW(pwcRemoteName, MAX_PATH);
if Result = True then
sFileName:= UTF16ToUTF8(UnicodeString(pwcRemoteName));
@ -437,7 +437,7 @@ end;
function TWFXModule.WfxDisconnect(const DisconnectRoot: String): Boolean;
begin
if Assigned(FsDisconnectW) then
Result:= FsDisconnectW(PWideChar(UTF8Decode(DisconnectRoot)))
Result:= FsDisconnectW(PWideChar(CeUtf8ToUtf16(DisconnectRoot)))
else if Assigned(FsDisconnect) then
Result:= FsDisconnect(PAnsiChar(CeUtf8ToSys(DisconnectRoot)))
else

View file

@ -333,7 +333,7 @@ begin
{$ENDIF}
if Assigned(ListLoadW) then
FPluginWindow := ListLoadW(ParentWin, PWideChar(UTF8Decode(FileToLoad)), ShowFlags)
FPluginWindow := ListLoadW(ParentWin, PWideChar(CeUtf8ToUtf16(FileToLoad)), ShowFlags)
else if Assigned(ListLoad) then
FPluginWindow := ListLoad(ParentWin, PAnsiChar(CeUtf8ToSys(FileToLoad)), ShowFlags)
else
@ -370,7 +370,7 @@ begin
{$ENDIF}
if Assigned(ListLoadNextW) then
Result := ListLoadNextW(ParentWin, FPluginWindow, PWideChar(UTF8Decode(FileToLoad)), ShowFlags)
Result := ListLoadNextW(ParentWin, FPluginWindow, PWideChar(CeUtf8ToUtf16(FileToLoad)), ShowFlags)
else if Assigned(ListLoadNext) then
Result := ListLoadNext(ParentWin, FPluginWindow, PAnsiChar(CeUtf8ToSys(FileToLoad)), ShowFlags)
else
@ -416,7 +416,7 @@ end;
function TWlxModule.CallListSearchText(SearchString: String; SearchParameter: Integer): Integer;
begin
if Assigned(ListSearchTextW) then
Result := ListSearchTextW(FPluginWindow, PWideChar(UTF8Decode(SearchString)), SearchParameter)
Result := ListSearchTextW(FPluginWindow, PWideChar(CeUtf8ToUtf16(SearchString)), SearchParameter)
else if Assigned(ListSearchText) then
Result := ListSearchText(FPluginWindow, PAnsiChar(CeUtf8ToSys(SearchString)), SearchParameter)
else
@ -490,8 +490,8 @@ function TWlxModule.CallListPrint(FileToPrint, DefPrinter: String;
PrintFlags: Integer; var Margins: trect): Integer;
begin
if Assigned(ListPrintW) then
Result := ListPrintW(FPluginWindow, PWideChar(UTF8Decode(FileToPrint)),
PWideChar(UTF8Decode(DefPrinter)), PrintFlags, Margins)
Result := ListPrintW(FPluginWindow, PWideChar(CeUtf8ToUtf16(FileToPrint)),
PWideChar(CeUtf8ToUtf16(DefPrinter)), PrintFlags, Margins)
else if Assigned(ListPrint) then
Result := ListPrint(FPluginWindow, PAnsiChar(CeUtf8ToSys(FileToPrint)), PAnsiChar(CeUtf8ToSys(DefPrinter)),
PrintFlags, Margins)
@ -524,7 +524,7 @@ end;
function TWlxModule.CallListGetPreviewBitmap(FileToLoad: String; Width, Height: Integer; ContentBuf: String): HBITMAP;
begin
if Assigned(ListGetPreviewBitmapW) then
Result := ListGetPreviewBitmapW(PWideChar(UTF8Decode(FileToLoad)), Width, Height, PByte(ContentBuf), Length(ContentBuf))
Result := ListGetPreviewBitmapW(PWideChar(CeUtf8ToUtf16(FileToLoad)), Width, Height, PByte(ContentBuf), Length(ContentBuf))
else if Assigned(ListGetPreviewBitmap) then
Result := ListGetPreviewBitmap(PAnsiChar(CeUtf8ToSys(FileToLoad)), Width, Height, PByte(ContentBuf), Length(ContentBuf))
else