UPD: Show portable device icons

This commit is contained in:
Alexander Koblov 2023-06-05 20:28:32 +03:00
commit 8ed520c49b
2 changed files with 14 additions and 8 deletions

View file

@ -134,16 +134,20 @@ begin
AFile.SizeProperty.IsValid:= False;
end;
rgfInOut:= SFGAO_FILESYSTEM or SFGAO_FOLDER;
AFolder.GetAttributesOf(1, PIDL, rgfInOut);
AFile.Attributes:= FILE_ATTRIBUTE_DEVICE or FILE_ATTRIBUTE_VIRTUAL;
if (SFGAO_FILESYSTEM and rgfInOut) <> 0 then
rgfInOut:= SFGAO_FILESYSTEM or SFGAO_FOLDER;
if Succeeded(AFolder.GetAttributesOf(1, PIDL, rgfInOut)) then
begin
AFile.Attributes:= FILE_ATTRIBUTE_VIRTUAL or FILE_ATTRIBUTE_REPARSE_POINT;
end
else if (rgfInOut and SFGAO_FOLDER <> 0) then
begin
AFile.Attributes:= FILE_ATTRIBUTE_DIRECTORY
if (SFGAO_FILESYSTEM and rgfInOut) <> 0 then
begin
AFile.Attributes:= AFile.Attributes or FILE_ATTRIBUTE_NORMAL;
end
else if (rgfInOut and SFGAO_FOLDER <> 0) then
begin
AFile.Attributes:= AFile.Attributes or FILE_ATTRIBUTE_DIRECTORY;
end;
end;
FFiles.Add(AFile);

View file

@ -1976,6 +1976,8 @@ var
FileInfo: TSHFileInfoW;
dwFileAttributes: DWORD;
uFlags: UINT;
const
FILE_ATTRIBUTE_SHELL = FILE_ATTRIBUTE_DEVICE or FILE_ATTRIBUTE_VIRTUAL;
{$ENDIF}
begin
Result := -1;
@ -2023,7 +2025,7 @@ begin
Exit;
end
{$IF DEFINED(MSWINDOWS)}
else if (AFile.Attributes = (FILE_ATTRIBUTE_REPARSE_POINT or FILE_ATTRIBUTE_VIRTUAL)) and Assigned(AFile.LinkProperty) then
else if (AFile.Attributes and FILE_ATTRIBUTE_SHELL = FILE_ATTRIBUTE_SHELL) and Assigned(AFile.LinkProperty) then
begin
if not LoadIcon then
Result := -1