Hi,
I discovered a problem of damaged values for global variables when 32-bit app is working under GDB debugger on Windows 10.
This problem doesn't occur in 64-bit app under GDB debugger.
For example, I call ExpandEnvironmentStringsW() to get a value of global variable %LOCALAPPDATA%
For 32-bit app under GDB debugger I get damaged value:
C:\Users\Р?Р?Р?С?С?\AppData\Local
Non-latin symbols are damaged.
Same 32-bit app without GDB, or 64-bit with/or without GDB returns correct value:
C:\Users\Игорь\AppData\Local
You can simulate this problem - add a new global variable in Windows 10 with a path to a folder with non-Latin symbols (Russian, or French, German).
Another example where this problem occurs. My profile name in Windows 10 is "Игорь" (non-Latin symbols). And when I call Open/Save dialog window in my 32-bit app under GDB debugger I always see an error message from in Open/Save dialog that path to Desktop can't be found. See the screenshot.
Lazarus 1.8.4, fpc 3.0.4, Windows 10 64 bit, v1803.
Test app:
{$APPTYPE CONSOLE}
program EnvTest;
function ExpandEnvironmentStringsW(lpSrc: PWideChar; lpDst: PWideChar;
nSize: Cardinal): Cardinal; stdcall; external 'kernel32.dll' name 'ExpandEnvironmentStringsW';
function GetEnv(const Name: WideString): WideString;
var
Len : Cardinal;
begin
Len:=ExpandEnvironmentStringsW( PWideChar(Name), nil, 0);
if Len>0 then begin
SetLength(Result, Len-1);
ExpandEnvironmentStringsW( PWideChar(Name), PWideChar(Result), Len );
end else Result:='';
end;
procedure Test(const Name : WideString);
begin
WriteLn( Name,' = ', GetEnv(Name) );
end;
begin
WriteLn('Sizeof(Pointer) = ',Sizeof(Pointer)*8,' bits');
Test('%LOCALAPPDATA%');
ReadLn;
end.