Ver Fonte

Merge branch 'master' into dev

Source commit: bbfaebada4358bd724bcf0326877917160e923fb
Martin Prikryl há 5 anos atrás
pai
commit
158b0649a5

+ 2 - 2
source/components/UnixDirView.cpp

@@ -814,14 +814,14 @@ bool __fastcall TUnixDirView::TargetHasDropHandler(TListItem * /* Item */, int /
   return false;
   return false;
 }
 }
 //---------------------------------------------------------------------------
 //---------------------------------------------------------------------------
-void __fastcall TUnixDirView::DDChooseEffect(int grfKeyState, int &dwEffect)
+void __fastcall TUnixDirView::DDChooseEffect(int grfKeyState, int &dwEffect, int PreferredEffect)
 {
 {
   if ((grfKeyState & (MK_CONTROL | MK_SHIFT)) == 0)
   if ((grfKeyState & (MK_CONTROL | MK_SHIFT)) == 0)
   {
   {
     dwEffect = DROPEFFECT_COPY;
     dwEffect = DROPEFFECT_COPY;
   }
   }
 
 
-  TCustomDirView::DDChooseEffect(grfKeyState, dwEffect);
+  TCustomDirView::DDChooseEffect(grfKeyState, dwEffect, PreferredEffect);
 }
 }
 //---------------------------------------------------------------------------
 //---------------------------------------------------------------------------
 TDropEffectSet __fastcall TUnixDirView::GetDragSourceEffects()
 TDropEffectSet __fastcall TUnixDirView::GetDragSourceEffects()

+ 1 - 1
source/components/UnixDirView.h

@@ -41,7 +41,7 @@ protected:
   virtual void __fastcall DDDragDetect(int grfKeyState, const TPoint &DetectStart,
   virtual void __fastcall DDDragDetect(int grfKeyState, const TPoint &DetectStart,
     const TPoint &Point, TDragDetectStatus DragStatus);
     const TPoint &Point, TDragDetectStatus DragStatus);
   virtual void __fastcall DDMenuDone(TObject* Sender, HMENU AMenu);
   virtual void __fastcall DDMenuDone(TObject* Sender, HMENU AMenu);
-  virtual void __fastcall DDChooseEffect(int grfKeyState, int &dwEffect);
+  virtual void __fastcall DDChooseEffect(int grfKeyState, int &dwEffect, int PreferredEffect);
   virtual void __fastcall AddToDragFileList(TFileList* FileList, TListItem* Item);
   virtual void __fastcall AddToDragFileList(TFileList* FileList, TListItem* Item);
   void __fastcall DoChangeDirectory(TObject * Sender);
   void __fastcall DoChangeDirectory(TObject * Sender);
   void __fastcall DoReadDirectory(TObject * Sender, bool ReloadOnly);
   void __fastcall DoReadDirectory(TObject * Sender, bool ReloadOnly);

+ 2 - 2
source/components/UnixDriveView.cpp

@@ -579,7 +579,7 @@ void __fastcall TCustomUnixDriveView::PerformDragDropFileOperation(
   }
   }
 }
 }
 //---------------------------------------------------------------------------
 //---------------------------------------------------------------------------
-void __fastcall TCustomUnixDriveView::DDChooseEffect(int KeyState, int & Effect)
+void __fastcall TCustomUnixDriveView::DDChooseEffect(int KeyState, int & Effect, int PreferredEffect)
 {
 {
   // if any drop effect is allowed at all (e.g. no drop to self and drop to parent)
   // if any drop effect is allowed at all (e.g. no drop to self and drop to parent)
   if (Effect != DROPEFFECT_NONE)
   if (Effect != DROPEFFECT_NONE)
@@ -597,7 +597,7 @@ void __fastcall TCustomUnixDriveView::DDChooseEffect(int KeyState, int & Effect)
     }
     }
   }
   }
 
 
-  TCustomDriveView::DDChooseEffect(KeyState, Effect);
+  TCustomDriveView::DDChooseEffect(KeyState, Effect, PreferredEffect);
 }
 }
 //---------------------------------------------------------------------------
 //---------------------------------------------------------------------------
 void __fastcall TCustomUnixDriveView::UpdateDropTarget()
 void __fastcall TCustomUnixDriveView::UpdateDropTarget()

+ 1 - 1
source/components/UnixDriveView.h

@@ -54,7 +54,7 @@ protected:
   void __fastcall SetDirView(TUnixDirView * Value);
   void __fastcall SetDirView(TUnixDirView * Value);
 
 
   virtual void __fastcall PerformDragDropFileOperation(TTreeNode * Node, int Effect);
   virtual void __fastcall PerformDragDropFileOperation(TTreeNode * Node, int Effect);
-  virtual void __fastcall DDChooseEffect(int KeyState, int & Effect);
+  virtual void __fastcall DDChooseEffect(int KeyState, int & Effect, int PreferredEffect);
   virtual bool __fastcall DragCompleteFileList();
   virtual bool __fastcall DragCompleteFileList();
   virtual TDropEffectSet __fastcall DDSourceEffects();
   virtual TDropEffectSet __fastcall DDSourceEffects();
 
 

+ 2 - 2
source/forms/CustomScpExplorer.cpp

@@ -9785,8 +9785,8 @@ void __fastcall TCustomScpExplorerForm::SessionsPageControlDragOver(
   }
   }
 }
 }
 //---------------------------------------------------------------------------
 //---------------------------------------------------------------------------
-void __fastcall TCustomScpExplorerForm::SessionsDDDragOver(int /*KeyState*/,
-  const TPoint & Point, int & Effect)
+void __fastcall TCustomScpExplorerForm::SessionsDDDragOver(
+  int DebugUsedArg(KeyState), const TPoint & Point, int & Effect, int DebugUsedArg(PreferredEffect))
 {
 {
   int Index = SessionsPageControl->IndexOfTabAt(Point.X, Point.Y);
   int Index = SessionsPageControl->IndexOfTabAt(Point.X, Point.Y);
   if (Index < 0)
   if (Index < 0)

+ 1 - 1
source/forms/CustomScpExplorer.h

@@ -304,7 +304,7 @@ private:
     const TGUICopyParamType & CopyParam, int Params);
     const TGUICopyParamType & CopyParam, int Params);
   void __fastcall AddQueueItem(TTerminalQueue * Queue, TQueueItem * QueueItem, TManagedTerminal * Terminal);
   void __fastcall AddQueueItem(TTerminalQueue * Queue, TQueueItem * QueueItem, TManagedTerminal * Terminal);
   void __fastcall ClearTransferSourceSelection(TTransferDirection Direction);
   void __fastcall ClearTransferSourceSelection(TTransferDirection Direction);
-  void __fastcall SessionsDDDragOver(int KeyState, const TPoint & Point, int & Effect);
+  void __fastcall SessionsDDDragOver(int KeyState, const TPoint & Point, int & Effect, int PreferredEffect);
   void __fastcall SessionsDDProcessDropped(TObject * Sender, int KeyState, const TPoint & Point, int Effect);
   void __fastcall SessionsDDProcessDropped(TObject * Sender, int KeyState, const TPoint & Point, int Effect);
   void __fastcall RemoteFileControlDragDropFileOperation(
   void __fastcall RemoteFileControlDragDropFileOperation(
     TObject * Sender, int Effect, UnicodeString TargetPath, bool ForceQueue, bool Paste);
     TObject * Sender, int Effect, UnicodeString TargetPath, bool ForceQueue, bool Paste);

+ 2 - 1
source/forms/Editor.cpp

@@ -1397,7 +1397,7 @@ void __fastcall TEditorForm::CheckFileSize()
         TMessageParams Params(mpNeverAskAgainCheck);
         TMessageParams Params(mpNeverAskAgainCheck);
         unsigned int Answer =
         unsigned int Answer =
           MoreMessageDialog(
           MoreMessageDialog(
-            FMTLOAD(INTERNAL_EDITOR_LARGE_FILE, (FormatBytes(Size))), NULL,
+            FMTLOAD(INTERNAL_EDITOR_LARGE_FILE2, (FormatBytes(Size))), NULL,
             qtConfirmation, qaOK | qaCancel, HELP_NONE, &Params);
             qtConfirmation, qaOK | qaCancel, HELP_NONE, &Params);
         switch (Answer)
         switch (Answer)
         {
         {
@@ -1422,6 +1422,7 @@ void __fastcall TEditorForm::CheckFileSize()
       // Those are actually nearly all internal exceptions we ever practically get
       // Those are actually nearly all internal exceptions we ever practically get
       IgnoreException(typeid(EOutOfMemory));
       IgnoreException(typeid(EOutOfMemory));
       IgnoreException(typeid(EAccessViolation));
       IgnoreException(typeid(EAccessViolation));
+      IgnoreException(typeid(EExternalException));
     }
     }
   }
   }
 }
 }

+ 4 - 4
source/forms/SiteAdvanced.dfm

@@ -1420,7 +1420,7 @@ object SiteAdvancedDialog: TSiteAdvancedDialog
             Top = 102
             Top = 102
             Width = 182
             Width = 182
             Height = 21
             Height = 21
-            MaxLength = 50
+            MaxLength = 100
             TabOrder = 5
             TabOrder = 5
             Text = 'ProxyUsernameEdit'
             Text = 'ProxyUsernameEdit'
             OnChange = DataChange
             OnChange = DataChange
@@ -1431,7 +1431,7 @@ object SiteAdvancedDialog: TSiteAdvancedDialog
             Width = 182
             Width = 182
             Height = 21
             Height = 21
             Anchors = [akLeft, akTop, akRight]
             Anchors = [akLeft, akTop, akRight]
-            MaxLength = 50
+            MaxLength = 100
             TabOrder = 6
             TabOrder = 6
             Text = 'ProxyPasswordEdit'
             Text = 'ProxyPasswordEdit'
             OnChange = DataChange
             OnChange = DataChange
@@ -1668,7 +1668,7 @@ object SiteAdvancedDialog: TSiteAdvancedDialog
             Top = 85
             Top = 85
             Width = 182
             Width = 182
             Height = 21
             Height = 21
-            MaxLength = 50
+            MaxLength = 100
             TabOrder = 2
             TabOrder = 2
             Text = 'TunnelUserNameEdit'
             Text = 'TunnelUserNameEdit'
             OnChange = DataChange
             OnChange = DataChange
@@ -1679,7 +1679,7 @@ object SiteAdvancedDialog: TSiteAdvancedDialog
             Width = 182
             Width = 182
             Height = 21
             Height = 21
             Anchors = [akLeft, akTop, akRight]
             Anchors = [akLeft, akTop, akRight]
-            MaxLength = 50
+            MaxLength = 100
             TabOrder = 3
             TabOrder = 3
             Text = 'TunnelPasswordEdit'
             Text = 'TunnelPasswordEdit'
             OnChange = DataChange
             OnChange = DataChange

+ 42 - 5
source/packages/dragndrop/DragDrop.pas

@@ -79,7 +79,7 @@ type
   TOnDragEnter = procedure(DataObj: IDataObject; grfKeyState: LongInt; pt: TPoint;
   TOnDragEnter = procedure(DataObj: IDataObject; grfKeyState: LongInt; pt: TPoint;
      var dwEffect: LongInt; var Accept: Boolean) of object;
      var dwEffect: LongInt; var Accept: Boolean) of object;
   TOnDragLeave = procedure of object;
   TOnDragLeave = procedure of object;
-  TOnDragOver = procedure(grfKeyState: LongInt; pt: TPoint; var dwEffect: LongInt) of object;
+  TOnDragOver = procedure(grfKeyState: LongInt; pt: TPoint; var dwEffect: LongInt; PreferredEffect: LongInt) of object;
   TOnDrop = procedure(DataObj: IDataObject; grfKeyState: LongInt;  pt: TPoint; var dwEffect: LongInt) of object;
   TOnDrop = procedure(DataObj: IDataObject; grfKeyState: LongInt;  pt: TPoint; var dwEffect: LongInt) of object;
   TOnQueryContinueDrag = procedure(fEscapePressed: BOOL; grfKeyState: LongInt; var Result: HResult) of object;
   TOnQueryContinueDrag = procedure(fEscapePressed: BOOL; grfKeyState: LongInt; var Result: HResult) of object;
   TOnGiveFeedback = procedure(dwEffect: LongInt; var Result: HResult) of object;
   TOnGiveFeedback = procedure(dwEffect: LongInt; var Result: HResult) of object;
@@ -180,6 +180,7 @@ type
     VertScrollTimer: TTimer;
     VertScrollTimer: TTimer;
     FVScrollCode: Integer;
     FVScrollCode: Integer;
     FHScrollCode: Integer;
     FHScrollCode: Integer;
+    FPreferredEffect: LongInt;
     procedure InitScroll(VerticalScroll: Boolean; ScrollCode: Integer);
     procedure InitScroll(VerticalScroll: Boolean; ScrollCode: Integer);
     procedure TermScroll(VerticalScroll: Boolean);
     procedure TermScroll(VerticalScroll: Boolean);
     procedure DetermineScrollDir(VertScrolling: Boolean; var ScrollCode: Integer);
     procedure DetermineScrollDir(VertScrolling: Boolean; var ScrollCode: Integer);
@@ -387,6 +388,9 @@ resourcestring
 
 
 implementation
 implementation
 
 
+uses
+  PIDL;
+
 const
 const
   CmdAbort = 0;
   CmdAbort = 0;
   CmdMove = 1;
   CmdMove = 1;
@@ -1172,10 +1176,12 @@ procedure TDropTarget.SuggestDropEffect(grfKeyState: LongInt; var dwEffect: Long
 begin
 begin
   if (not FOwner.FAcceptOwnDnD) and FOwner.FOwnerIsSource then dwEffect := DROPEFFECT_NONE
   if (not FOwner.FAcceptOwnDnD) and FOwner.FOwnerIsSource then dwEffect := DROPEFFECT_NONE
     else
     else
-  if (grfKeyState and MK_CONTROL = 0) and (grfKeyState and MK_SHIFT <> 0) and
+  if (((grfKeyState and MK_CONTROL = 0) and (grfKeyState and MK_SHIFT <> 0)) or
+      (FPreferredEffect and DROPEFFECT_MOVE <> 0)) and
      (FOwner.FTargetEffects and DROPEFFECT_MOVE <> 0) then dwEffect := DROPEFFECT_MOVE
      (FOwner.FTargetEffects and DROPEFFECT_MOVE <> 0) then dwEffect := DROPEFFECT_MOVE
     else
     else
-  if (grfKeyState and MK_CONTROL <> 0) and (grfKeyState and MK_SHIFT <> 0) and
+  if (((grfKeyState and MK_CONTROL <> 0) and (grfKeyState and MK_SHIFT <> 0)) or
+      (FPreferredEffect and DROPEFFECT_LINK <> 0)) and
      (FOwner.FTargetEffects and DROPEFFECT_LINK <> 0) then dwEffect := DROPEFFECT_LINK
      (FOwner.FTargetEffects and DROPEFFECT_LINK <> 0) then dwEffect := DROPEFFECT_LINK
     else
     else
   if (deCopy in FOwner.FTargetEffectsSet) and (dwEffect and DROPEFFECT_COPY <> 0) then dwEffect := DROPEFFECT_COPY
   if (deCopy in FOwner.FTargetEffectsSet) and (dwEffect and DROPEFFECT_COPY <> 0) then dwEffect := DROPEFFECT_COPY
@@ -1197,6 +1203,10 @@ function TDropTarget.DragEnter(
   const dataObj: IDataObject; grfKeyState: LongInt; pt: TPoint; var dwEffect: LongInt): HResult;
   const dataObj: IDataObject; grfKeyState: LongInt; pt: TPoint; var dwEffect: LongInt): HResult;
 // Is called if the d&d-mouse cursor moves ON (one call only) the TargeTWinControl. Here,
 // Is called if the d&d-mouse cursor moves ON (one call only) the TargeTWinControl. Here,
 // you influence if a drop can be accepted and the drop's effect if accepted.
 // you influence if a drop can be accepted and the drop's effect if accepted.
+var
+  FormatEtc: TFormatEtc;
+  StgMedium: TStgMedium;
+  Ptr: Pointer;
 begin
 begin
   TDragDrop(FOwner).FInternalSource := GInternalSource;
   TDragDrop(FOwner).FInternalSource := GInternalSource;
   FOwner.FAvailableDropEffects := dwEffect;
   FOwner.FAvailableDropEffects := dwEffect;
@@ -1206,6 +1216,33 @@ begin
   begin
   begin
     RenderDropped(DataObj, grfKeyState, pt, dwEffect);
     RenderDropped(DataObj, grfKeyState, pt, dwEffect);
   end;
   end;
+
+  FPreferredEffect := 0;
+  with FormatEtc do
+  begin
+    cfFormat := CF_PREFERREDDROPEFFECT;
+    ptd := nil;
+    dwAspect := DVASPECT_CONTENT;
+    lindex := -1;
+    tymed := TYMED_HGLOBAL;
+  end;
+  if dataObj.GetData(FormatEtc, StgMedium) = S_OK then
+  begin
+    try
+      if GlobalSize(StgMedium.HGlobal) = SizeOf(FPreferredEffect) then
+      begin
+        Ptr := GlobalLock(StgMedium.HGlobal);
+        try
+          FPreferredEffect := PLongInt(Ptr)^;
+        finally
+          GlobalUnLock(StgMedium.HGlobal);
+        end;
+      end;
+    finally
+      ReleaseStgMedium(StgMedium);
+    end;
+  end;
+
   SuggestDropEffect(grfKeyState, dwEffect);
   SuggestDropEffect(grfKeyState, dwEffect);
   AcceptDataObject(DataObj, FAccept);
   AcceptDataObject(DataObj, FAccept);
   if Assigned(FOwner.OnDragEnter) then
   if Assigned(FOwner.OnDragEnter) then
@@ -1264,7 +1301,7 @@ begin
   SuggestDropEffect(grfKeyState, dwEffect);
   SuggestDropEffect(grfKeyState, dwEffect);
   if Assigned(FOwner.OnDragOver) then
   if Assigned(FOwner.OnDragOver) then
   begin
   begin
-    FOwner.OnDragOver(grfKeyState, FOwner.FDragDropControl.ScreenToClient(pt), dwEffect);
+    FOwner.OnDragOver(grfKeyState, FOwner.FDragDropControl.ScreenToClient(pt), dwEffect, FPreferredEffect);
   end;
   end;
   if ((not FOwner.FAcceptOwnDnD) and FOwner.FOwnerIsSource) or
   if ((not FOwner.FAcceptOwnDnD) and FOwner.FOwnerIsSource) or
      (not FAccept) then
      (not FAccept) then
@@ -1320,7 +1357,7 @@ begin
     else dwEffect := DROPEFFECT_NONE;
     else dwEffect := DROPEFFECT_NONE;
   if Assigned(FOwner.OnDragOver) then
   if Assigned(FOwner.OnDragOver) then
   begin
   begin
-    FOwner.OnDragOver(KeyState, FOwner.FDragDropControl.ScreenToClient(pt), dwEffect);
+    FOwner.OnDragOver(KeyState, FOwner.FDragDropControl.ScreenToClient(pt), dwEffect, FPreferredEffect);
   end;
   end;
   if ((not FOwner.FAcceptOwnDnD) and FOwner.FOwnerIsSource) or (not FAccept) then dwEffect := DROPEFFECT_NONE;
   if ((not FOwner.FAcceptOwnDnD) and FOwner.FOwnerIsSource) or (not FAccept) then dwEffect := DROPEFFECT_NONE;
   TermScroll(True);
   TermScroll(True);

+ 5 - 5
source/packages/filemng/CustomDirView.pas

@@ -230,8 +230,8 @@ type
     procedure DDDragDetect(grfKeyState: Longint; DetectStart, Point: TPoint; DragStatus: TDragDetectStatus); virtual;
     procedure DDDragDetect(grfKeyState: Longint; DetectStart, Point: TPoint; DragStatus: TDragDetectStatus); virtual;
     procedure DDDragEnter(DataObj: IDataObject; grfKeyState: Longint; Point: TPoint; var dwEffect: longint; var Accept: Boolean);
     procedure DDDragEnter(DataObj: IDataObject; grfKeyState: Longint; Point: TPoint; var dwEffect: longint; var Accept: Boolean);
     procedure DDDragLeave;
     procedure DDDragLeave;
-    procedure DDDragOver(grfKeyState: Longint; Point: TPoint; var dwEffect: Longint);
-    procedure DDChooseEffect(grfKeyState: Integer; var dwEffect: Integer); virtual;
+    procedure DDDragOver(grfKeyState: Longint; Point: TPoint; var dwEffect: Longint; PreferredEffect: LongInt);
+    procedure DDChooseEffect(grfKeyState: Integer; var dwEffect: Integer; PreferredEffect: Integer); virtual;
     procedure DDDrop(DataObj: IDataObject; grfKeyState: LongInt; Point: TPoint; var dwEffect: Longint);
     procedure DDDrop(DataObj: IDataObject; grfKeyState: LongInt; Point: TPoint; var dwEffect: Longint);
     procedure DDDropHandlerSucceeded(Sender: TObject; grfKeyState: Longint; Point: TPoint; dwEffect: Longint); virtual;
     procedure DDDropHandlerSucceeded(Sender: TObject; grfKeyState: Longint; Point: TPoint; dwEffect: Longint); virtual;
     procedure DDGiveFeedback(dwEffect: Longint; var Result: HResult); virtual;
     procedure DDGiveFeedback(dwEffect: Longint; var Result: HResult); virtual;
@@ -2190,7 +2190,7 @@ begin
 end;
 end;
 
 
 procedure TCustomDirView.DDDragOver(grfKeyState: Integer; Point: TPoint;
 procedure TCustomDirView.DDDragOver(grfKeyState: Integer; Point: TPoint;
-  var dwEffect: Integer);
+  var dwEffect: Integer; PreferredEffect: Integer);
 var
 var
   DropItem: TListItem;
   DropItem: TListItem;
   CanDrop: Boolean;
   CanDrop: Boolean;
@@ -2235,7 +2235,7 @@ begin
   {Set dropeffect:}
   {Set dropeffect:}
   if (not HasDropHandler) and (not Loading) then
   if (not HasDropHandler) and (not Loading) then
   begin
   begin
-    DDChooseEffect(grfKeyState, dwEffect);
+    DDChooseEffect(grfKeyState, dwEffect, PreferredEffect);
 
 
     if Assigned(FOnDDDragOver) then
     if Assigned(FOnDDDragOver) then
       FOnDDDragOver(Self, grfKeyState, Point, dwEffect);
       FOnDDDragOver(Self, grfKeyState, Point, dwEffect);
@@ -2442,7 +2442,7 @@ begin
   DropTarget := nil;
   DropTarget := nil;
 end;
 end;
 
 
-procedure TCustomDirView.DDChooseEffect(grfKeyState: Integer; var dwEffect: Integer);
+procedure TCustomDirView.DDChooseEffect(grfKeyState: Integer; var dwEffect: Integer; PreferredEffect: Integer);
 begin
 begin
   if Assigned(FOnDDChooseEffect) then
   if Assigned(FOnDDChooseEffect) then
     FOnDDChooseEffect(Self, grfKeyState, dwEffect);
     FOnDDChooseEffect(Self, grfKeyState, dwEffect);

+ 5 - 5
source/packages/filemng/CustomDriveView.pas

@@ -109,7 +109,7 @@ type
     procedure DDDragEnter(DataObj: IDataObject; KeyState: Longint;
     procedure DDDragEnter(DataObj: IDataObject; KeyState: Longint;
       Point: TPoint; var Effect: Longint; var Accept: Boolean);
       Point: TPoint; var Effect: Longint; var Accept: Boolean);
     procedure DDDragLeave;
     procedure DDDragLeave;
-    procedure DDDragOver(KeyState: Longint; Point: TPoint; var Effect: Longint);
+    procedure DDDragOver(KeyState: Longint; Point: TPoint; var Effect: Longint; PreferredEffect: LongInt);
     procedure DDDrop(DataObj: IDataObject; KeyState: Longint; Point: TPoint;
     procedure DDDrop(DataObj: IDataObject; KeyState: Longint; Point: TPoint;
       var Effect: Longint);
       var Effect: Longint);
     procedure DDQueryContinueDrag(EscapePressed: BOOL; KeyState: Longint;
     procedure DDQueryContinueDrag(EscapePressed: BOOL; KeyState: Longint;
@@ -126,7 +126,7 @@ type
       DragStatus: TDragDetectStatus); virtual;
       DragStatus: TDragDetectStatus); virtual;
     procedure PerformDragDropFileOperation(Node: TTreeNode; Effect: Integer); virtual; abstract;
     procedure PerformDragDropFileOperation(Node: TTreeNode; Effect: Integer); virtual; abstract;
 
 
-    procedure DDChooseEffect(KeyState: Integer; var Effect: Integer); virtual;
+    procedure DDChooseEffect(KeyState: Integer; var Effect: Integer; PreferredEffect: Integer); virtual;
     function DragCompleteFileList: Boolean; virtual; abstract;
     function DragCompleteFileList: Boolean; virtual; abstract;
     function DDExecute: TDragResult; virtual;
     function DDExecute: TDragResult; virtual;
     function DDSourceEffects: TDropEffectSet; virtual; abstract;
     function DDSourceEffects: TDropEffectSet; virtual; abstract;
@@ -469,7 +469,7 @@ begin
     FOnDDDragLeave(Self);
     FOnDDDragLeave(Self);
 end; {DragLeave}
 end; {DragLeave}
 
 
-procedure TCustomDriveView.DDDragOver(KeyState: Longint; Point: TPoint; var Effect: Longint);
+procedure TCustomDriveView.DDDragOver(KeyState: Longint; Point: TPoint; var Effect: Longint; PreferredEffect: Longint);
 var
 var
   Node: TTreeNode;
   Node: TTreeNode;
   Rect1: TRect;
   Rect1: TRect;
@@ -530,7 +530,7 @@ begin
     end;
     end;
   end;
   end;
 
 
-  DDChooseEffect(KeyState, Effect);
+  DDChooseEffect(KeyState, Effect, PreferredEffect);
 
 
   if Assigned(FOnDDDragOver) then
   if Assigned(FOnDDDragOver) then
     FOnDDDragOver(Self, KeyState, Point, Effect);
     FOnDDDragOver(Self, KeyState, Point, Effect);
@@ -608,7 +608,7 @@ begin
   DropTarget := nil;
   DropTarget := nil;
 end;
 end;
 
 
-procedure TCustomDriveView.DDChooseEffect(KeyState: Integer; var Effect: Integer);
+procedure TCustomDriveView.DDChooseEffect(KeyState: Integer; var Effect: Integer; PreferredEffect: Integer);
 begin
 begin
   if Assigned(FOnDDChooseEffect) then
   if Assigned(FOnDDChooseEffect) then
     FOnDDChooseEffect(Self, KeyState, Effect);
     FOnDDChooseEffect(Self, KeyState, Effect);

+ 3 - 4
source/packages/filemng/DirView.pas

@@ -197,7 +197,7 @@ type
     procedure DDMenuDone(Sender: TObject; AMenu: HMenu); override;
     procedure DDMenuDone(Sender: TObject; AMenu: HMenu); override;
     procedure DDDropHandlerSucceeded(Sender: TObject; grfKeyState: Longint;
     procedure DDDropHandlerSucceeded(Sender: TObject; grfKeyState: Longint;
       Point: TPoint; dwEffect: Longint); override;
       Point: TPoint; dwEffect: Longint); override;
-    procedure DDChooseEffect(grfKeyState: Integer; var dwEffect: Integer); override;
+    procedure DDChooseEffect(grfKeyState: Integer; var dwEffect: Integer; PreferredEffect: Integer); override;
 
 
     function GetPathName: string; override;
     function GetPathName: string; override;
     procedure SetChangeInterval(Value: Cardinal); virtual;
     procedure SetChangeInterval(Value: Cardinal); virtual;
@@ -3103,8 +3103,7 @@ begin
   end;
   end;
 end; {DDDragDetect}
 end; {DDDragDetect}
 
 
-procedure TDirView.DDChooseEffect(grfKeyState: Integer;
-  var dwEffect: Integer);
+procedure TDirView.DDChooseEffect(grfKeyState: Integer; var dwEffect: Integer; PreferredEffect: Integer);
 begin
 begin
   if DragDropFilesEx.OwnerIsSource and
   if DragDropFilesEx.OwnerIsSource and
      (dwEffect = DROPEFFECT_COPY) and (not Assigned(DropTarget)) then
      (dwEffect = DROPEFFECT_COPY) and (not Assigned(DropTarget)) then
@@ -3112,7 +3111,7 @@ begin
     dwEffect := DROPEFFECT_NONE
     dwEffect := DROPEFFECT_NONE
   end
   end
     else
     else
-  if (grfKeyState and (MK_CONTROL or MK_SHIFT) = 0) then
+  if (grfKeyState and (MK_CONTROL or MK_SHIFT) = 0) and (PreferredEffect = 0) then
   begin
   begin
     if FDragDrive <> '' then
     if FDragDrive <> '' then
     begin
     begin

+ 3 - 3
source/packages/filemng/DriveView.pas

@@ -211,7 +211,7 @@ type
     function CreateNode: TTreeNode; override;
     function CreateNode: TTreeNode; override;
 
 
     function DDSourceEffects: TDropEffectSet; override;
     function DDSourceEffects: TDropEffectSet; override;
-    procedure DDChooseEffect(KeyState: Integer; var Effect: Integer); override;
+    procedure DDChooseEffect(KeyState: Integer; var Effect: Integer; PreferredEffect: Integer); override;
     function DragCompleteFileList: Boolean; override;
     function DragCompleteFileList: Boolean; override;
     function DDExecute: TDragResult; override;
     function DDExecute: TDragResult; override;
 
 
@@ -2448,11 +2448,11 @@ begin
     Result := [deLink, deCopy, deMove];
     Result := [deLink, deCopy, deMove];
 end;
 end;
 
 
-procedure TDriveView.DDChooseEffect(KeyState: Integer; var Effect: Integer);
+procedure TDriveView.DDChooseEffect(KeyState: Integer; var Effect: Integer; PreferredEffect: Integer);
 begin
 begin
   if DropTarget = nil then Effect := DROPEFFECT_NONE
   if DropTarget = nil then Effect := DROPEFFECT_NONE
     else
     else
-  if (KeyState and (MK_CONTROL or MK_SHIFT) = 0) then
+  if (KeyState and (MK_CONTROL or MK_SHIFT) = 0) and (PreferredEffect = 0) then
   begin
   begin
     if FDragDrive <> '' then
     if FDragDrive <> '' then
     begin
     begin

+ 2 - 1
source/putty/ssh2connection-client.c

@@ -319,7 +319,8 @@ SshChannel *ssh2_serverside_agent_open(ConnectionLayer *cl, Channel *chan)
 static void ssh2_channel_response(
 static void ssh2_channel_response(
     struct ssh2_channel *c, PktIn *pkt, void *ctx)
     struct ssh2_channel *c, PktIn *pkt, void *ctx)
 {
 {
-    chan_request_response(c->chan, pkt->type == SSH2_MSG_CHANNEL_SUCCESS);
+    chan_request_response(c->chan,
+                          pkt && pkt->type == SSH2_MSG_CHANNEL_SUCCESS);
 }
 }
 
 
 void ssh2channel_start_shell(SshChannel *sc, bool want_reply)
 void ssh2channel_start_shell(SshChannel *sc, bool want_reply)

+ 1 - 1
source/resource/TextsWin.h

@@ -150,7 +150,7 @@
 #define MASTER_PASSWORD_OTHER_INSTANCE 1362
 #define MASTER_PASSWORD_OTHER_INSTANCE 1362
 #define EDIT_SESSION_REATTACH   1363
 #define EDIT_SESSION_REATTACH   1363
 #define CONFIRM_UNREGISTER_URL  1364
 #define CONFIRM_UNREGISTER_URL  1364
-#define INTERNAL_EDITOR_LARGE_FILE 1365
+#define INTERNAL_EDITOR_LARGE_FILE2 1365
 #define CLOSE_BUTTON            1366
 #define CLOSE_BUTTON            1366
 #define EXTENSION_UNTRUSTED     1367
 #define EXTENSION_UNTRUSTED     1367
 #define EXTENSION_NOT_LATEST    1368
 #define EXTENSION_NOT_LATEST    1368

+ 1 - 1
source/resource/TextsWin1.rc

@@ -154,7 +154,7 @@ BEGIN
         MASTER_PASSWORD_OTHER_INSTANCE, "There is other instance of WinSCP running.\n\nSetting or clearing master password, while another instance of WinSCP is running, can cause loss of your stored passwords.\n\nPlease quit other instances of WinSCP before continuing."
         MASTER_PASSWORD_OTHER_INSTANCE, "There is other instance of WinSCP running.\n\nSetting or clearing master password, while another instance of WinSCP is running, can cause loss of your stored passwords.\n\nPlease quit other instances of WinSCP before continuing."
         EDIT_SESSION_REATTACH, "**Do you want to attach edited file '%s' to session '%s'?**\n\nOriginal session used to download file '%s' to editor was closed already."
         EDIT_SESSION_REATTACH, "**Do you want to attach edited file '%s' to session '%s'?**\n\nOriginal session used to download file '%s' to editor was closed already."
         CONFIRM_UNREGISTER_URL, "Do you want to unregister WinSCP from handling all URL addresses?"
         CONFIRM_UNREGISTER_URL, "Do you want to unregister WinSCP from handling all URL addresses?"
-        INTERNAL_EDITOR_LARGE_FILE, "**Try to open large file?**\n\nThe file you are trying to open in an internal editor is too large (%s). WinSCP internal editor is not designed for editing large files. Consider using an external editor capable of editing large files.\n\nYou may try to open the file anyway, but you may run out of memory."
+        INTERNAL_EDITOR_LARGE_FILE2, "**Try to open large file?**\n\nThe file you are trying to open in an internal editor is too large (%s). WinSCP internal editor is not designed for editing large files. Consider using an external editor capable of editing large files.\n\nYou may try to open the file anyway, but WinSCP may fail."
         CLOSE_BUTTON, "Close"
         CLOSE_BUTTON, "Close"
         EXTENSION_UNTRUSTED, "The extension does not come from a trusted source. Are you sure you want to install it?"
         EXTENSION_UNTRUSTED, "The extension does not come from a trusted source. Are you sure you want to install it?"
         EXTENSION_NOT_LATEST, "**Using the last compatible and trusted version of the extension.**\n\nThe latest version of the extension is either not reviewed yet or is not compatible with this version of WinSCP."
         EXTENSION_NOT_LATEST, "**Using the last compatible and trusted version of the extension.**\n\nThe latest version of the extension is either not reviewed yet or is not compatible with this version of WinSCP."

+ 52 - 54
source/windows/Tools.cpp

@@ -518,78 +518,76 @@ IShellLink * __fastcall CreateDesktopShortCut(const UnicodeString & Name,
 
 
   try
   try
   {
   {
-    if (SUCCEEDED(CoCreateInstance(CLSID_ShellLink, NULL, CLSCTX_INPROC_SERVER,
-         IID_IShellLink, (void **) &pLink)))
+    OleCheck(CoCreateInstance(CLSID_ShellLink, NULL, CLSCTX_INPROC_SERVER, IID_IShellLink, (void **) &pLink));
+
+    try
     {
     {
-      try
+      pLink->SetPath(File.c_str());
+      pLink->SetDescription(Description.c_str());
+      pLink->SetArguments(Params.c_str());
+      pLink->SetShowCmd(SW_SHOW);
+      // Explicitly setting icon file,
+      // without this icons are not shown at least in Windows 7 jumplist
+      pLink->SetIconLocation(File.c_str(), IconIndex);
+
+      IPersistFile* pPersistFile;
+      if (!Return &&
+          SUCCEEDED(pLink->QueryInterface(IID_IPersistFile, (void **)&pPersistFile)))
       {
       {
-        pLink->SetPath(File.c_str());
-        pLink->SetDescription(Description.c_str());
-        pLink->SetArguments(Params.c_str());
-        pLink->SetShowCmd(SW_SHOW);
-        // Explicitly setting icon file,
-        // without this icons are not shown at least in Windows 7 jumplist
-        pLink->SetIconLocation(File.c_str(), IconIndex);
-
-        IPersistFile* pPersistFile;
-        if (!Return &&
-            SUCCEEDED(pLink->QueryInterface(IID_IPersistFile, (void **)&pPersistFile)))
+        try
         {
         {
-          try
-          {
-            LPMALLOC      ShellMalloc;
-            LPITEMIDLIST  DesktopPidl;
-            wchar_t DesktopDir[MAX_PATH];
+          LPMALLOC      ShellMalloc;
+          LPITEMIDLIST  DesktopPidl;
+          wchar_t DesktopDir[MAX_PATH];
 
 
-            OleCheck(SHGetMalloc(&ShellMalloc));
+          OleCheck(SHGetMalloc(&ShellMalloc));
 
 
-            try
-            {
-              OleCheck(SHGetSpecialFolderLocation(NULL, SpecialFolder, &DesktopPidl));
-
-              OleCheck(SHGetPathFromIDList(DesktopPidl, DesktopDir));
-            }
-            __finally
-            {
-              ShellMalloc->Free(DesktopPidl);
-              ShellMalloc->Release();
-            }
+          try
+          {
+            OleCheck(SHGetSpecialFolderLocation(NULL, SpecialFolder, &DesktopPidl));
 
 
-            WideString strShortCutLocation(DesktopDir);
-            // Name can contain even path (e.g. to create quick launch icon)
-            strShortCutLocation += UnicodeString(L"\\") + Name + L".lnk";
-            OleCheck(pPersistFile->Save(strShortCutLocation.c_bstr(), TRUE));
+            OleCheck(SHGetPathFromIDList(DesktopPidl, DesktopDir));
           }
           }
           __finally
           __finally
           {
           {
-            pPersistFile->Release();
+            ShellMalloc->Free(DesktopPidl);
+            ShellMalloc->Release();
           }
           }
-        }
 
 
-        // this is necessary for Windows 7 taskbar jump list links
-        IPropertyStore * PropertyStore;
-        if (SUCCEEDED(pLink->QueryInterface(IID_IPropertyStore, (void**)&PropertyStore)))
+          WideString strShortCutLocation(DesktopDir);
+          // Name can contain even path (e.g. to create quick launch icon)
+          strShortCutLocation += UnicodeString(L"\\") + Name + L".lnk";
+          OleCheck(pPersistFile->Save(strShortCutLocation.c_bstr(), TRUE));
+        }
+        __finally
         {
         {
-          PROPVARIANT Prop;
-          Prop.vt = VT_LPWSTR;
-          Prop.pwszVal = Name.c_str();
-          PropertyStore->SetValue(PKEY_Title, Prop);
-          PropertyStore->Commit();
-          PropertyStore->Release();
+          pPersistFile->Release();
         }
         }
       }
       }
-      catch(...)
-      {
-        pLink->Release();
-        throw;
-      }
 
 
-      if (!Return)
+      // this is necessary for Windows 7 taskbar jump list links
+      IPropertyStore * PropertyStore;
+      if (SUCCEEDED(pLink->QueryInterface(IID_IPropertyStore, (void**)&PropertyStore)))
       {
       {
-        pLink->Release();
-        pLink = NULL;
+        PROPVARIANT Prop;
+        Prop.vt = VT_LPWSTR;
+        Prop.pwszVal = Name.c_str();
+        PropertyStore->SetValue(PKEY_Title, Prop);
+        PropertyStore->Commit();
+        PropertyStore->Release();
       }
       }
     }
     }
+    catch(...)
+    {
+      pLink->Release();
+      throw;
+    }
+
+    if (!Return)
+    {
+      pLink->Release();
+      pLink = NULL;
+    }
   }
   }
   catch(Exception & E)
   catch(Exception & E)
   {
   {