Looking at it again, I think the "real" issue is that we have double storage of the file name in TShellTreeNode: first in the Text property of the node, second in the FileInfo.Name (FileInfo is the SearchRec obtained by FindFirst/FindNext). That's always a source of trouble...
Since the FileInfo is not directly accessible by user, only by methods ShortFileName and LongFileName, we could simply ignore the FileInfo.Name and use the Node.Text for construction of the short and long filenames:
function TShellTreeNode.ShortFilename: String;
begin
Result := Text;
end;
function TShellTreeNode.FullFilename: String;
begin
if (FBasePath <> '') then
Result := AppendPathDelim(FBasePath) + Text
else
//root nodes
Result := Text;
{$if defined(windows) and not defined(wince)}
if (Length(Result) = 2) and (Result[2] = DriveSeparator) then
Result := Result + PathDelim;
{$endif}
end;
After having done these changes in unit ShellCtrls, GetMem's sample project runs without crashing.