Selaa lähdekoodia

Bug 1717: Failure when starting GUI

https://winscp.net/tracker/1717

Retrieving CSIDL_DRIVES fails on some systems. And as we have found in f03f0e10e6 already, we do not need it actually.

Source commit: 059c9dfac2ff6ac7fb3b5222f441b89a8a942223
Martin Prikryl 6 vuotta sitten
vanhempi
sitoutus
f1c43e2bfc
1 muutettua tiedostoa jossa 2 lisäystä ja 15 poistoa
  1. 2 15
      source/packages/filemng/DriveView.pas

+ 2 - 15
source/packages/filemng/DriveView.pas

@@ -137,7 +137,6 @@ type
     FChangeTimerSuspended: Integer;
 
     FDesktop: IShellFolder;
-    FWorkPlace: IShellFolder;
 
     {Additional events:}
     FOnDisplayContextMenu: TNotifyEvent;
@@ -226,8 +225,6 @@ type
     property Items stored False;
     property Selected Write SetSelected stored False;
 
-    property WorkPlace: IShellFolder read FWorkPlace;
-
     property DragImageList: TDragImageList read FDragImageList;
 
     property CanUndoCopyMove: Boolean read GetCanUndoCopyMove;
@@ -658,7 +655,6 @@ end;
 
 procedure TDriveView.CreateWnd;
 var
-  PIDLWorkPlace: PItemIDList;
   DriveStatus: TDriveStatus;
 begin
   inherited;
@@ -667,9 +663,6 @@ begin
     PopupMenu.Autopopup := False;
 
   OLECheck(SHGetDesktopFolder(FDesktop));
-  OLECheck(SHGetSpecialFolderLocation(Self.Handle, CSIDL_DRIVES, PIDLWorkPlace));
-  FDesktop.BindToObject(PIDLWorkPlace, nil, IID_IShellFolder, Pointer(FWorkPlace));
-  FreePIDL(PIDLWorkPlace);
 
   FDragDropFilesEx.SourceEffects := [deCopy, deMove, deLink];
   FDragDropFilesEx.TargetEffects := [deCopy, deMove, deLink];
@@ -1340,7 +1333,7 @@ begin
               if DriveInfo.IsFixedDrive(Drive) and (DriveType <> DRIVE_REMOVABLE) and
                  ((DriveType <> DRIVE_REMOTE) or GetNetWorkConnected(Drive)) then
               begin
-                GetNodeShellAttr(FWorkPlace, NodeData, NodeData.DirName);
+                GetNodeShellAttr(FDesktop, NodeData, NodeData.DirName);
               end;
 
               if Assigned(NextDriveNode) then
@@ -1443,13 +1436,7 @@ begin
   { if tree view is not visible anyway }
   if not Assigned(TNodeData(ParentNode.Data).ShellFolder) then
   begin
-    GetNodeShellAttr(FWorkPlace, TNodeData(ParentNode.Data), NodePathName(ParentNode), Visible);
-    { Particularly with UNC paths, "workplace" does not work, but "desktop" does. Maybe we should use "desktop" }
-    { for evetything, as we do that already in TDriveInfo.ReadDriveStatus. }
-    if not Assigned(NodeData.PIDL) then
-    begin
-      GetNodeShellAttr(FDesktop, TNodeData(ParentNode.Data), NodePathName(ParentNode), Visible);
-    end;
+    GetNodeShellAttr(FDesktop, TNodeData(ParentNode.Data), NodePathName(ParentNode), Visible);
   end;
 
   GetNodeShellAttr(TNodeData(ParentNode.Data).ShellFolder, NodeData, SRec.Name, Visible);