Hello again.
I have some errors with SHFileOperation windows function. uses windows;
var
SH: TSHFileOpStruct;
shpFrom_C67,shpTo_C67:pointer;
path0,path1:string;
begin
sh.hwnd:=0;
sh.wFunc:=2;
GetMem( sh.pFrom, $200 );FillChar(sh.pFrom^, $200, 0);
GetMem( sh.pTo , $200 );FillChar(sh.pTo^ , $200, 0);
sh.pFrom:=pchar(Utf8ToAnsi(path0));
sh.pTo:=pchar(Utf8ToAnsi(path1));
sh.fFlags:=$251;
sh.fAnyOperationsAborted:=longbool(0);
sh.hNameMappings:=nil;
sh.lpszProgressTitle:=nil;
SHFileOperation(sh);
system.assign(f2,Utf8ToAnsi(path0));
end;
Problem is that I must make pFrom & pToare double-null terminated. How to do that? When I debugging I see that
before line sh.pFrom:=pchar(Utf8ToAnsi(path0));
pFrom has an one address, and afrer line sh.pFrom:=pchar(Utf8ToAnsi(path0));
pFrom has another memory address (and of course new-address^-data is NOT double-null terminated). Why? Is there a way to write some data into sh.pFrom^ whithout for-loop and whithout address changing.
I need that pFrom's GetMem address will be kept because I have $200 null-characters on that address. So even if first bytes will be some path, path automatically will be double(actually more then double, but [$200-length(path)>=$100]) null-terminated. Such solution as
for i:=1 to length(Utf8ToAnsi(path0)) do
sh.pFrom^[i-1]:=Utf8ToAnsi(path0)[i];
Such solution as above is stupid!!!
I got added evidence that I was right, it's much better if there would be some easy mechanism convert ''pointer-->address'' and ''pointer<--address''.