Преглед изворни кода

Upgrade to C++ Builder 11

Comments:
- .res files seem to be linked automatically, so explicit entries in project files caused duplicates
- JCL updated for compatibility with BCB11 (jcld28win32.inc obtained by running JCJ installer [uninstalled afterwards])

Source commit: ec28d10a0bbb346ed2bb3940aed37e777342e663
Martin Prikryl пре 1 година
родитељ
комит
e09e95ee43
61 измењених фајлова са 911 додато и 155 уклоњено
  1. 1 1
      build.bat
  2. 4 0
      libs/mfc/source/strex.cpp
  3. 2 0
      libs/openssl/include/internal/e_os.h
  4. 1 1
      source/Console.cbproj
  5. 1 1
      source/DScpComp.cbproj
  6. 1 1
      source/DragDropP.cbproj
  7. 1 1
      source/DragDropP.cpp
  8. 1 1
      source/DragExt.cbproj
  9. 1 1
      source/DriveDir.cbproj
  10. 2 2
      source/DriveDir.cpp
  11. 2 2
      source/FileZilla.cbproj
  12. 4 2
      source/Jcl.cbproj
  13. 1 1
      source/My.cbproj
  14. 1 1
      source/My.cpp
  15. 1 2
      source/PngComponents.cbproj
  16. 1 1
      source/Putty.cbproj
  17. 1 1
      source/RScpComp.cbproj
  18. 1 1
      source/ScpCore.cbproj
  19. 2 2
      source/ScpForms.cbproj
  20. 1 1
      source/ScpResources.cbproj
  21. 3 3
      source/WinSCP.cbproj
  22. 1 1
      source/WinSCP.cpp
  23. 1 0
      source/components/ThemePageControl.cpp
  24. 1 0
      source/components/UnixDirView.cpp
  25. 1 0
      source/components/UnixDriveView.cpp
  26. 2 2
      source/core/Common.cpp
  27. 1 1
      source/core/S3FileSystem.cpp
  28. 1 1
      source/core/SecureShell.cpp
  29. 2 1
      source/core/Security.cpp
  30. 52 37
      source/dragext/DragExt.cpp
  31. 5 3
      source/dragext/DragExt.h
  32. 2 2
      source/forms/Authenticate.cpp
  33. 1 1
      source/forms/Authenticate.h
  34. 7 6
      source/forms/CustomScpExplorer.cpp
  35. 4 4
      source/forms/CustomScpExplorer.h
  36. 1 0
      source/forms/Glyphs.h
  37. 2 2
      source/forms/Login.cpp
  38. 2 1
      source/forms/Login.h
  39. 3 3
      source/packages/dragndrop/DragDrop.pas
  40. 1 1
      source/packages/filemng/CustomDirView.pas
  41. 2 2
      source/packages/filemng/CustomDriveView.pas
  42. 0 1
      source/packages/filemng/DriveView.pas
  43. 0 6
      source/packages/jcl/JclSysUtils.pas
  44. 743 0
      source/packages/jcl/JclUnitVersioning.pas
  45. 12 12
      source/packages/jcl/jcld28win32.inc
  46. 2 2
      source/packages/my/NortonLikeListView.pas
  47. 15 10
      source/packages/my/PasTools.pas
  48. 0 3
      source/packages/png/PngImageList.pas
  49. 0 1
      source/packages/tb2k/TB2DsgnConverter.pas
  50. 2 2
      source/packages/tb2k/TB2Toolbar.pas
  51. 2 2
      source/packages/tbx/TBXStatusBars.pas
  52. 1 1
      source/tb2k.cbproj
  53. 1 0
      source/tb2k.cpp
  54. 1 1
      source/tbxp.cbproj
  55. 1 1
      source/tbxp.cpp
  56. 2 1
      source/windows/GUITools.cpp
  57. 2 1
      source/windows/Setup.cpp
  58. 1 1
      source/windows/VCLCommon.cpp
  59. 0 14
      source/windows/WinApi.h
  60. 0 1
      source/windows/WinConfiguration.cpp
  61. 1 1
      source/windows/WinMain.cpp

+ 1 - 1
build.bat

@@ -12,7 +12,7 @@ if "%PROCESSOR_ARCHITECTURE%"=="x86" (
   exit
 )
 
-set BDS=%PROGRAMFILES32%\Embarcadero\Studio\14.0
+set BDS=%PROGRAMFILES32%\Embarcadero\Studio\22.0
 
 set VS_PATH_REL=Microsoft Visual Studio\2022
 set MSBUILD_REL=MSBuild\Current\Bin\MSBuild.exe

+ 4 - 0
libs/mfc/source/strex.cpp

@@ -10,6 +10,10 @@
 
 #include "stdafx.h"
 #include <afxtempl.h>
+// WINSCP
+#include <algorithm>
+#define max std::max
+#define min std::min
 
 #ifdef AFX_AUX_SEG
 #pragma code_seg(AFX_AUX_SEG)

+ 2 - 0
libs/openssl/include/internal/e_os.h

@@ -106,6 +106,8 @@
         * it's sufficient to check for specific Winsock2 API availability
         * at run-time [DSO_global_lookup is recommended]...
         */
+// WORKAROUND to avoid including unneeded wspiapi.h that has code before declaration in WspiapiLoad
+#    define _WSPIAPI_H_
 #    include <winsock2.h>
 #    include <ws2tcpip.h>
        /*

+ 1 - 1
source/Console.cbproj

@@ -1,7 +1,7 @@
 <Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
     <PropertyGroup>
         <ProjectGuid>{838C77E9-8237-4097-964C-EBB952D2E9A8}</ProjectGuid>
-        <ProjectVersion>15.4</ProjectVersion>
+        <ProjectVersion>19.5</ProjectVersion>
         <Config Condition="'$(Config)'==''">Release</Config>
         <FrameworkType>None</FrameworkType>
         <Base>True</Base>

+ 1 - 1
source/DScpComp.cbproj

@@ -1,7 +1,7 @@
 <Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
     <PropertyGroup>
         <ProjectGuid>{EE6BA6C0-E60A-47E4-95EA-87E1EB520276}</ProjectGuid>
-        <ProjectVersion>15.4</ProjectVersion>
+        <ProjectVersion>19.5</ProjectVersion>
         <MainSource>DScpComp.cpp</MainSource>
         <Config Condition="'$(Config)'==''">Release</Config>
         <FrameworkType>VCL</FrameworkType>

+ 1 - 1
source/DragDropP.cbproj

@@ -1,7 +1,7 @@
 <Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
     <PropertyGroup>
         <ProjectGuid>{FC08225B-2B31-4129-939D-B75C1F099FFB}</ProjectGuid>
-        <ProjectVersion>15.4</ProjectVersion>
+        <ProjectVersion>19.5</ProjectVersion>
         <MainSource>DragDropP.cpp</MainSource>
         <Config Condition="'$(Config)'==''">Release</Config>
         <FrameworkType>None</FrameworkType>

+ 1 - 1
source/DragDropP.cpp

@@ -1,5 +1,5 @@
 //---------------------------------------------------------------------------
-
+#pragma warn -pch // WORKAROUND (see My.cpp)
 #include <basepch.h>
 #pragma hdrstop
 #pragma package(smart_init)

+ 1 - 1
source/DragExt.cbproj

@@ -1,7 +1,7 @@
 <Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
     <PropertyGroup>
         <ProjectGuid>{414309A3-9B7C-4261-9989-4BC118D3A1C0}</ProjectGuid>
-        <ProjectVersion>15.4</ProjectVersion>
+        <ProjectVersion>19.5</ProjectVersion>
         <Config Condition="'$(Config)'==''">Release</Config>
         <FrameworkType>None</FrameworkType>
         <Base>True</Base>

+ 1 - 1
source/DriveDir.cbproj

@@ -1,7 +1,7 @@
 <Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
     <PropertyGroup>
         <ProjectGuid>{7AE7C7E2-1A28-4AC5-B8CF-15D1B12AEB41}</ProjectGuid>
-        <ProjectVersion>15.4</ProjectVersion>
+        <ProjectVersion>19.5</ProjectVersion>
         <MainSource>DriveDir.cpp</MainSource>
         <Config Condition="'$(Config)'==''">Release</Config>
         <FrameworkType>VCL</FrameworkType>

+ 2 - 2
source/DriveDir.cpp

@@ -1,6 +1,6 @@
- //---------------------------------------------------------------------------
-#include <vcl.h>
+//---------------------------------------------------------------------------
 #pragma hdrstop
+#include <vcl.h>
 #pragma package(smart_init)
 //---------------------------------------------------------------------------
 

+ 2 - 2
source/FileZilla.cbproj

@@ -1,7 +1,7 @@
 <Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
     <PropertyGroup>
         <ProjectGuid>{152D1B4E-7546-4C2B-80C5-F0D9D5F6D9D7}</ProjectGuid>
-        <ProjectVersion>15.4</ProjectVersion>
+        <ProjectVersion>19.5</ProjectVersion>
         <Config Condition="'$(Config)'==''">Release</Config>
         <FrameworkType>None</FrameworkType>
         <Base>True</Base>
@@ -43,7 +43,7 @@
         <BCC_wrch>false</BCC_wrch>
         <DCC_CBuilderOutput>JPHNE</DCC_CBuilderOutput>
         <DCC_Namespace>System;Xml;Data;Datasnap;Web;Soap;Vcl;$(DCC_Namespace)</DCC_Namespace>
-        <Defines>WINSCP;_WIN32;$(Defines)</Defines>
+        <Defines>WINSCP;WIN32;$(Defines)</Defines>
         <FinalOutputDir>$(INTERM_PATH)\$(Platform)\$(Config)</FinalOutputDir>
         <ILINK_LibraryPath>$(BDS)\lib;$(BDS)\lib\obj;$(BDS)\lib\psdk;$(ILINK_LibraryPath)</ILINK_LibraryPath>
         <IncludePath>filezilla\misc\;filezilla\;resource;core;..\libs\openssl\include;..\libs\mfc\include;$(BDS)\include;$(BDS)\include\windows\vcl;$(IncludePath)</IncludePath>

+ 4 - 2
source/Jcl.cbproj

@@ -1,7 +1,7 @@
 <Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
     <PropertyGroup>
         <ProjectGuid>{BABF1FFA-834C-44BA-8CE2-BA19AAC5C459}</ProjectGuid>
-        <ProjectVersion>15.4</ProjectVersion>
+        <ProjectVersion>19.5</ProjectVersion>
         <FrameworkType>None</FrameworkType>
         <MainSource>Jcl.cpp</MainSource>
         <Base>True</Base>
@@ -136,6 +136,9 @@
         <DelphiCompile Include="packages\jcl\JclTD32.pas">
             <BuildOrder>15</BuildOrder>
         </DelphiCompile>
+        <DelphiCompile Include="packages\jcl\JclUnitVersioning.pas">
+            <BuildOrder>16</BuildOrder>
+        </DelphiCompile>
         <DelphiCompile Include="packages\jcl\JclWin32.pas">
             <BuildOrder>13</BuildOrder>
         </DelphiCompile>
@@ -169,7 +172,6 @@
                     <ProjectProperties Name="IndexFiles">False</ProjectProperties>
                 </ProjectProperties>
             </CPlusPlusBuilder.Personality>
-            <Deployment/>
             <Platforms>
                 <Platform value="Win32">True</Platform>
                 <Platform value="Win64">False</Platform>

+ 1 - 1
source/My.cbproj

@@ -1,7 +1,7 @@
 <Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
     <PropertyGroup>
         <ProjectGuid>{BA755114-5DC2-43F1-88A1-D52A7E4100A8}</ProjectGuid>
-        <ProjectVersion>15.4</ProjectVersion>
+        <ProjectVersion>19.5</ProjectVersion>
         <MainSource>My.cpp</MainSource>
         <Config Condition="'$(Config)'==''">Release</Config>
         <FrameworkType>None</FrameworkType>

+ 1 - 1
source/My.cpp

@@ -1,5 +1,5 @@
 //---------------------------------------------------------------------------
-
+#pragma warn -pch // WORKAROUND (initialized data in header in xlocnum)
 #include <basepch.h>
 #pragma hdrstop
 #pragma package(smart_init)

+ 1 - 2
source/PngComponents.cbproj

@@ -1,7 +1,7 @@
 <Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
     <PropertyGroup>
         <ProjectGuid>{FDCD9EE5-6451-4405-ADEF-8E997ADEE3F0}</ProjectGuid>
-        <ProjectVersion>15.4</ProjectVersion>
+        <ProjectVersion>19.5</ProjectVersion>
         <FrameworkType>VCL</FrameworkType>
         <MainSource>PngComponents.cpp</MainSource>
         <Base>True</Base>
@@ -172,7 +172,6 @@
                     <ProjectProperties Name="IndexFiles">False</ProjectProperties>
                 </ProjectProperties>
             </CPlusPlusBuilder.Personality>
-            <Deployment/>
             <Platforms>
                 <Platform value="Win32">True</Platform>
                 <Platform value="Win64">False</Platform>

+ 1 - 1
source/Putty.cbproj

@@ -1,7 +1,7 @@
 <Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
     <PropertyGroup>
         <ProjectGuid>{E82E93A5-709F-4C7A-918F-811A5F660941}</ProjectGuid>
-        <ProjectVersion>15.4</ProjectVersion>
+        <ProjectVersion>19.5</ProjectVersion>
         <Config Condition="'$(Config)'==''">Release</Config>
         <FrameworkType>None</FrameworkType>
         <Base>True</Base>

+ 1 - 1
source/RScpComp.cbproj

@@ -1,7 +1,7 @@
 <Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
     <PropertyGroup>
         <ProjectGuid>{D87E3096-EFE3-47F7-A35B-04FE6FB138CC}</ProjectGuid>
-        <ProjectVersion>15.4</ProjectVersion>
+        <ProjectVersion>19.5</ProjectVersion>
         <Config Condition="'$(Config)'==''">Release</Config>
         <FrameworkType>None</FrameworkType>
         <Base>True</Base>

+ 1 - 1
source/ScpCore.cbproj

@@ -1,7 +1,7 @@
 <Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
     <PropertyGroup>
         <ProjectGuid>{E0BF1CDA-E75F-4F22-8190-70A30CBE74EE}</ProjectGuid>
-        <ProjectVersion>15.4</ProjectVersion>
+        <ProjectVersion>19.5</ProjectVersion>
         <Config Condition="'$(Config)'==''">Release</Config>
         <FrameworkType>None</FrameworkType>
         <Base>True</Base>

+ 2 - 2
source/ScpForms.cbproj

@@ -1,7 +1,7 @@
 <Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
     <PropertyGroup>
         <ProjectGuid>{58677B04-A1B8-4709-A590-464869E7397E}</ProjectGuid>
-        <ProjectVersion>15.4</ProjectVersion>
+        <ProjectVersion>19.5</ProjectVersion>
         <Config Condition="'$(Config)'==''">Release</Config>
         <FrameworkType>None</FrameworkType>
         <Base>True</Base>
@@ -40,7 +40,7 @@
         <PackageImports>vcl.bpi;rtl.bpi;vclx.bpi;DragDrop.bpi;My.bpi;DriveDir.bpi;$(PackageImports)</PackageImports>
         <ProjectType>CppStaticLibrary</ProjectType>
         <SanitizedProjectName>ScpForms</SanitizedProjectName>
-        <TLIB_PageSize>512</TLIB_PageSize>
+        <TLIB_PageSize>1024</TLIB_PageSize>
         <UsingDelphiRTL>true</UsingDelphiRTL>
         <VerInfo_Keys>CompanyName=;FileDescription=;FileVersion=1.0.0.0;InternalName=;LegalCopyright=;LegalTrademarks=;OriginalFilename=;ProductName=;ProductVersion=1.0.0.0;Comments=</VerInfo_Keys>
         <VerInfo_Locale>1033</VerInfo_Locale>

+ 1 - 1
source/ScpResources.cbproj

@@ -1,7 +1,7 @@
 <Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
     <PropertyGroup>
         <ProjectGuid>{F3609D87-2D06-465B-8878-353EAF3E894F}</ProjectGuid>
-        <ProjectVersion>15.4</ProjectVersion>
+        <ProjectVersion>19.5</ProjectVersion>
         <Config Condition="'$(Config)'==''">Release</Config>
         <FrameworkType>None</FrameworkType>
         <Base>True</Base>

+ 3 - 3
source/WinSCP.cbproj

@@ -1,7 +1,7 @@
 <Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
     <PropertyGroup>
         <ProjectGuid>{0B0C5EC6-5DCB-4F16-9504-1E6D37FFBB77}</ProjectGuid>
-        <ProjectVersion>15.4</ProjectVersion>
+        <ProjectVersion>19.5</ProjectVersion>
         <MainSource>WinSCP.cpp</MainSource>
         <Config Condition="'$(Config)'==''">Release</Config>
         <FrameworkType>VCL</FrameworkType>
@@ -49,7 +49,7 @@
     </PropertyGroup>
     <PropertyGroup Condition="'$(Base)'!=''">
         <_TCHARMapping>wchar_t</_TCHARMapping>
-        <AllPackageLibs>vcl.lib;rtl.lib;vclx.lib;ws2_32.lib;secur32.lib;My.lib;DriveDir.lib;DragDropP.lib;tb2k.lib;tbxp.lib;bcbie.lib;Crypt32.lib;PngComponents.lib;xmlrtl.lib;vclactnband.lib;vclimg.lib;winhttp.lib;jcl.lib;vclie.lib;urlmon.lib;shlwapi.lib;powrprof.lib;soaprtl.lib;fmx.lib;dbrtl.lib;inet.lib;psapi.lib;msi.lib</AllPackageLibs>
+        <AllPackageLibs>vcl.lib;rtl.lib;vclx.lib;ws2_32.lib;secur32.lib;My.lib;DriveDir.lib;DragDropP.lib;tb2k.lib;tbxp.lib;bcbie.lib;Crypt32.lib;PngComponents.lib;xmlrtl.lib;vclactnband.lib;vclimg.lib;winhttp.lib;jcl.lib;vclie.lib;vcledge.lib;urlmon.lib;shlwapi.lib;powrprof.lib;soaprtl.lib;fmx.lib;dbrtl.lib;inet.lib;psapi.lib;msi.lib</AllPackageLibs>
         <BCC_AllWarnings>true</BCC_AllWarnings>
         <BCC_ExtendedErrorInfo>true</BCC_ExtendedErrorInfo>
         <BCC_OptimizeForSpeed>true</BCC_OptimizeForSpeed>
@@ -63,7 +63,7 @@
         <Defines>WINSCP;STRICT;$(Defines)</Defines>
         <FinalOutputDir>$(FINAL_PATH)\$(Platform)\$(Config)</FinalOutputDir>
         <Icon_MainIcon>resource\Application.ico</Icon_MainIcon>
-        <ILINK_GenerateDRC>true</ILINK_GenerateDRC>
+        <ILINK_GenerateDRC>True</ILINK_GenerateDRC>
         <ILINK_LibraryPath>windows\;forms\;packages\filemng;packages\tbx;packages\png;$(ILINK_LibraryPath)</ILINK_LibraryPath>
         <ILINK_MapFileType>DetailedSegments</ILINK_MapFileType>
         <IncludePath>console;windows\;forms\;core;resource;components;dragext;packages\filemng;packages\dragndrop;packages\my;packages\tb2k;packages\tbx;packages\png;packages\jcl;..\libs\mfc\include;$(BDS)\include\windows;$(BDS)\include\windows\sdk;$(BDS)\include\windows\vcl;$(IncludePath)</IncludePath>

+ 1 - 1
source/WinSCP.cpp

@@ -45,7 +45,7 @@ WINAPI wWinMain(HINSTANCE, HINSTANCE, LPWSTR, int)
     AppLogFmt(L"Mouse: %s", (BooleanToEngStr(Mouse->MousePresent)));
     AppLogFmt(L"Mouse wheel: %s, msg: %d, scroll lines: %d", (BooleanToEngStr(Mouse->WheelPresent), int(Mouse->RegWheelMessage), Mouse->WheelScrollLines));
     AppLogFmt(L"ACP: %d", (static_cast<int>(GetACP())));
-    AppLogFmt(L"Win32 platform: %d", (Win32Platform));
+    AppLogFmt(L"Win32 platform: %d", (Win32Platform()));
     DWORD Type;
     if (GetWindowsProductType(Type))
     {

+ 1 - 0
source/components/ThemePageControl.cpp

@@ -1,4 +1,5 @@
 //---------------------------------------------------------------------------
+#pragma warn -pch // WORKAROUND (see My.cpp)
 #include <vcl.h>
 #pragma hdrstop
 

+ 1 - 0
source/components/UnixDirView.cpp

@@ -1,4 +1,5 @@
 //---------------------------------------------------------------------------
+#pragma warn -pch // WORKAROUND (see My.cpp)
 #include <vcl.h>
 #pragma hdrstop
 

+ 1 - 0
source/components/UnixDriveView.cpp

@@ -1,4 +1,5 @@
 //---------------------------------------------------------------------------
+#pragma warn -pch // WORKAROUND (see My.cpp)
 #include <vcl.h>
 #pragma hdrstop
 

+ 2 - 2
source/core/Common.cpp

@@ -3220,7 +3220,7 @@ bool _fastcall GetWindowsProductType(DWORD & Type)
   }
   else
   {
-    GetProductInfo(Win32MajorVersion, Win32MinorVersion, 0, 0, &Type);
+    GetProductInfo(Win32MajorVersion(), Win32MinorVersion(), 0, 0, &Type);
     Result = true;
   }
   return Result;
@@ -3263,7 +3263,7 @@ UnicodeString __fastcall WindowsVersion()
 UnicodeString __fastcall WindowsVersionLong()
 {
   UnicodeString Result = WindowsVersion();
-  AddToList(Result, Win32CSDVersion, L" ");
+  AddToList(Result, Win32CSDVersion(), L" ");
   return Result;
 }
 //---------------------------------------------------------------------------

+ 1 - 1
source/core/S3FileSystem.cpp

@@ -351,7 +351,7 @@ static UnicodeString GetS3ConfigValue(
           S3CredentialsExpiration = ParseExpiration(ExpirationStr);
           AppLogFmt(L"Credentials expiration: %s", (StandardTimestamp(S3CredentialsExpiration)));
 
-          std::unique_ptr<TJSONPairEnumerator> Enumerator(ProfileData->GetEnumerator());
+          std::unique_ptr<TJSONObject::TEnumerator> Enumerator(ProfileData->GetEnumerator());
           UnicodeString Names;
           while (Enumerator->MoveNext())
           {

+ 1 - 1
source/core/SecureShell.cpp

@@ -642,7 +642,7 @@ UnicodeString __fastcall TSecureShell::ConvertFromPutty(const char * Str, int Le
   if ((Length >= BomLength) &&
       (strncmp(Str, WINSCP_BOM, BomLength) == 0))
   {
-    return UTF8ToString(Str + BomLength, Length - BomLength);
+    return UTF8ArrayToString(Str + BomLength, Length - BomLength - 1);
   }
   else
   {

+ 2 - 1
source/core/Security.cpp

@@ -171,8 +171,9 @@ bool WindowsValidateCertificate(const unsigned char * Certificate, size_t Len, U
       reinterpret_cast<const char *>(&ChainConfig);
     // The hExclusiveRoot and hExclusiveTrustedPeople were added in Windows 7.
     // The CertGetCertificateChain fails with E_INVALIDARG when we include them to ChainConfig.cbSize.
+    // The dwExclusiveFlags was added in Windows 8
     DebugAssert(ChainConfigSize == 40);
-    DebugAssert(ChainConfigSize == sizeof(CERT_CHAIN_ENGINE_CONFIG) - sizeof(ChainConfig.hExclusiveRoot) - sizeof(ChainConfig.hExclusiveTrustedPeople));
+    DebugAssert(ChainConfigSize == sizeof(CERT_CHAIN_ENGINE_CONFIG) - sizeof(ChainConfig.hExclusiveRoot) - sizeof(ChainConfig.hExclusiveTrustedPeople) - sizeof(ChainConfig.dwExclusiveFlags));
     ChainConfig.cbSize = ChainConfigSize;
     ChainConfig.hRestrictedRoot = NULL;
     ChainConfig.hRestrictedTrust = NULL;

+ 52 - 37
source/dragext/DragExt.cpp

@@ -34,6 +34,14 @@
 #define THREADING_MODEL L"Apartment"
 #define CLSID_SIZE 39
 //---------------------------------------------------------------------------
+// WORKAROUND
+// While the import is in import32.lib or ole32.lib, the declaration in guiddef.h seems to be for C++,
+// so the symbol does not match
+int __stdcall IsEqualGUID(REFGUID rguid1, REFGUID rguid2)
+{
+  return !memcmp(&rguid1, &rguid2, sizeof(GUID));
+}
+//---------------------------------------------------------------------------
 class CShellExtClassFactory : public IClassFactory
 {
 public:
@@ -87,13 +95,16 @@ protected:
 #pragma clang diagnostic pop
 #endif
 //---------------------------------------------------------------------------
-unsigned int GRefThisDll = 0;
-bool GEnabled = false;
-wchar_t GLogFile[MAX_PATH] = L"";
-bool GLogOn = false;
-FILE* GLogHandle = NULL;
-HANDLE GLogMutex;
-HINSTANCE GInstance;
+#ifndef __clang__
+#define nullptr 0
+#endif
+static unsigned int GRefThisDll = 0;
+static bool GEnabled = false;
+static wchar_t GLogFile[MAX_PATH] = L"";
+static bool GLogOn = false;
+static FILE* GLogHandle = nullptr;
+static HANDLE GLogMutex;
+static HINSTANCE GInstance;
 //---------------------------------------------------------------------------
 static void DoDebug(const char* Func, const wchar_t* Message)
 {
@@ -104,7 +115,7 @@ static void DoDebug(const char* Func, const wchar_t* Message)
     {
       try
       {
-        if (GLogHandle == NULL)
+        if (GLogHandle == nullptr)
         {
           if (wcslen(GLogFile) == 0)
           {
@@ -113,13 +124,13 @@ static void DoDebug(const char* Func, const wchar_t* Message)
           else
           {
             GLogHandle = _wfopen(GLogFile, L"at");
-            if (GLogHandle == NULL)
+            if (GLogHandle == nullptr)
             {
               GLogOn = false;
             }
             else
             {
-              setbuf(GLogHandle, NULL);
+              setbuf(GLogHandle, nullptr);
               fwprintf(GLogHandle, L"----------------------------\n");
             }
           }
@@ -208,7 +219,7 @@ DllMain(HINSTANCE HInstance, DWORD Reason, LPVOID /*Reserved*/)
 
     if (GRefThisDll == 0)
     {
-      GLogMutex = CreateMutex(NULL, false, DRAG_EXT_RUNNING_MUTEX);
+      GLogMutex = CreateMutex(nullptr, false, DRAG_EXT_RUNNING_MUTEX);
 
       for (int Root = 0; Root <= 1; Root++)
       {
@@ -224,7 +235,7 @@ DllMain(HINSTANCE HInstance, DWORD Reason, LPVOID /*Reserved*/)
           wchar_t Buf[MAX_PATH];
 
           Size = sizeof(Value);
-          if ((RegQueryValueEx(Key, L"Enable", NULL, &Type,
+          if ((RegQueryValueEx(Key, L"Enable", nullptr, &Type,
                  reinterpret_cast<unsigned char*>(&Value), &Size) == ERROR_SUCCESS) &&
               (Type == REG_DWORD))
           {
@@ -232,7 +243,7 @@ DllMain(HINSTANCE HInstance, DWORD Reason, LPVOID /*Reserved*/)
           }
 
           Size = sizeof(Buf);
-          if ((RegQueryValueEx(Key, L"LogFile", NULL, &Type,
+          if ((RegQueryValueEx(Key, L"LogFile", nullptr, &Type,
                  reinterpret_cast<unsigned char*>(&Buf), &Size) == ERROR_SUCCESS) &&
               (Type == REG_SZ))
           {
@@ -287,6 +298,10 @@ DllMain(HINSTANCE HInstance, DWORD Reason, LPVOID /*Reserved*/)
   return 1;   // ok
 }
 //---------------------------------------------------------------------------
+#ifdef _WIN64
+#pragma clang diagnostic ignored "-Wdll-attribute-on-redeclaration"
+#endif
+//---------------------------------------------------------------------------
 STDAPI DllCanUnloadNow(void)
 {
   bool CanUnload = (GRefThisDll == 0);
@@ -298,7 +313,7 @@ STDAPI DllGetClassObject(REFCLSID Rclsid, REFIID Riid, LPVOID* PpvOut)
 {
   Debug(L"enter");
 
-  *PpvOut = NULL;
+  *PpvOut = nullptr;
 
   if (IsEqualIID(Rclsid, CLSID_ShellExtension))
   {
@@ -328,8 +343,8 @@ static bool RegisterServer(bool AllUsers)
 
   if ((RegOpenKeyEx(RootKey, L"Software\\Classes", 0, KEY_WRITE, &HKey) ==
          ERROR_SUCCESS) &&
-      (RegCreateKeyEx(HKey, L"CLSID", 0, NULL,
-         REG_OPTION_NON_VOLATILE, KEY_WRITE, NULL, &HKey, &Unused) ==
+      (RegCreateKeyEx(HKey, L"CLSID", 0, nullptr,
+         REG_OPTION_NON_VOLATILE, KEY_WRITE, nullptr, &HKey, &Unused) ==
            ERROR_SUCCESS))
   {
     Debug(L"CLSID created");
@@ -338,7 +353,7 @@ static bool RegisterServer(bool AllUsers)
     {
       Debug(L"class ID created");
 
-      RegSetValueEx(HKey, NULL, 0, REG_SZ,
+      RegSetValueEx(HKey, nullptr, 0, REG_SZ,
         reinterpret_cast<const unsigned char*>(DRAG_EXT_NAME), sizeof(DRAG_EXT_NAME));
 
       if (RegCreateKey(HKey, L"InProcServer32", &HKey) == ERROR_SUCCESS)
@@ -347,7 +362,7 @@ static bool RegisterServer(bool AllUsers)
 
         wchar_t Filename[MAX_PATH];
         GetModuleFileName(GInstance, Filename, LENOF(Filename));
-        RegSetValueEx(HKey, NULL, 0, REG_SZ,
+        RegSetValueEx(HKey, nullptr, 0, REG_SZ,
           reinterpret_cast<unsigned char*>(Filename), (wcslen(Filename) + 1) * sizeof(wchar_t));
 
         RegSetValueEx(HKey, L"ThreadingModel", 0, REG_SZ,
@@ -361,17 +376,17 @@ static bool RegisterServer(bool AllUsers)
            0, KEY_WRITE, &HKey) == ERROR_SUCCESS) &&
         (RegCreateKeyEx(HKey,
            L"directory\\shellex\\CopyHookHandlers\\WinSCPCopyHook",
-           0, NULL, REG_OPTION_NON_VOLATILE, KEY_WRITE, NULL, &HKey,
+           0, nullptr, REG_OPTION_NON_VOLATILE, KEY_WRITE, nullptr, &HKey,
            &Unused) == ERROR_SUCCESS))
     {
       Debug(L"WinSCPCopyHook created");
 
-      RegSetValueEx(HKey, NULL, 0, REG_SZ,
+      RegSetValueEx(HKey, nullptr, 0, REG_SZ,
         reinterpret_cast<unsigned char*>(ClassID), (wcslen(ClassID) + 1) * sizeof(wchar_t));
       RegCloseKey(HKey);
 
       if ((RegCreateKeyEx(RootKey, DRAG_EXT_REG_KEY,
-             0, NULL, REG_OPTION_NON_VOLATILE, KEY_WRITE, NULL, &HKey,
+             0, nullptr, REG_OPTION_NON_VOLATILE, KEY_WRITE, nullptr, &HKey,
              &Unused) == ERROR_SUCCESS))
       {
         Debug(L"drag ext key created");
@@ -385,7 +400,7 @@ static bool RegisterServer(bool AllUsers)
         Result = true;
       }
 
-      SHChangeNotify(SHCNE_ASSOCCHANGED, SHCNF_IDLIST, 0, 0);
+      SHChangeNotify(SHCNE_ASSOCCHANGED, SHCNF_IDLIST, nullptr, nullptr);
     }
   }
 
@@ -477,7 +492,7 @@ static bool UnregisterServer(bool AllUsers)
     Result = true;
   }
 
-  SHChangeNotify(SHCNE_ASSOCCHANGED, SHCNF_IDLIST, 0, 0);
+  SHChangeNotify(SHCNE_ASSOCCHANGED, SHCNF_IDLIST, nullptr, nullptr);
 
   Debug(L"leave");
 
@@ -524,7 +539,7 @@ STDMETHODIMP CShellExtClassFactory::QueryInterface(REFIID Riid, LPVOID FAR* Ppv)
 {
   Debug(L"enter");
 
-  *Ppv = NULL;
+  *Ppv = nullptr;
 
   // Any interface on this object is the object pointer
 
@@ -532,7 +547,7 @@ STDMETHODIMP CShellExtClassFactory::QueryInterface(REFIID Riid, LPVOID FAR* Ppv)
   {
     Debug(L"is IUnknown or IClassFactory");
 
-    *Ppv = (LPCLASSFACTORY)this;
+    *Ppv = static_cast<LPCLASSFACTORY>(this);
 
     AddRef();
 
@@ -567,7 +582,7 @@ STDMETHODIMP CShellExtClassFactory::CreateInstance(LPUNKNOWN UnkOuter,
 {
   Debug(L"enter");
 
-  *PpvObj = NULL;
+  *PpvObj = nullptr;
 
   // Shell extensions typically don't support aggregation (inheritance)
 
@@ -598,9 +613,9 @@ CShellExt::CShellExt()
   Debug(L"enter");
 
   FReferenceCounter = 0L;
-  FDataObj = NULL;
+  FDataObj = nullptr;
 
-  FMutex = CreateMutex(NULL, false, DRAG_EXT_MUTEX);
+  FMutex = CreateMutex(nullptr, false, DRAG_EXT_MUTEX);
   FLastTicks = 0;
 
   GRefThisDll++;
@@ -629,7 +644,7 @@ STDMETHODIMP CShellExt::QueryInterface(REFIID Riid, LPVOID FAR* Ppv)
   Debug(L"enter");
 
   HRESULT Result = E_NOINTERFACE;
-  *Ppv = NULL;
+  *Ppv = nullptr;
 
   if (!GEnabled)
   {
@@ -640,12 +655,12 @@ STDMETHODIMP CShellExt::QueryInterface(REFIID Riid, LPVOID FAR* Ppv)
     if (IsEqualIID(Riid, IID_IShellExtInit) || IsEqualIID(Riid, IID_IUnknown))
     {
       Debug(L"is IShellExtInit or IUnknown");
-      *Ppv = (LPSHELLEXTINIT)this;
+      *Ppv = static_cast<LPSHELLEXTINIT>(this);
     }
     else if (IsEqualIID(Riid, IID_IShellCopyHook))
     {
       Debug(L"is IShellCopyHook");
-      *Ppv = (LPCOPYHOOK)this;
+      *Ppv = static_cast<LPCOPYHOOK>(this);
     }
 
     if (*Ppv)
@@ -686,15 +701,15 @@ STDMETHODIMP CShellExt::Initialize(LPCITEMIDLIST /*IDFolder*/,
 {
   Debug(L"enter");
 
-  if (FDataObj != NULL)
+  if (FDataObj != nullptr)
   {
     FDataObj->Release();
-    FDataObj = NULL;
+    FDataObj = nullptr;
   }
 
   // duplicate the object pointer and registry handle
 
-  if (DataObj != NULL)
+  if (DataObj != nullptr)
   {
     FDataObj = DataObj;
     DataObj->AddRef();
@@ -734,7 +749,7 @@ STDMETHODIMP_(UINT) CShellExt::CopyCallback(HWND /*Hwnd*/, UINT Func, UINT /*Fla
       {
         Debug(L"empty dest file");
       }
-      else if ((BackPtr != NULL) &&
+      else if ((BackPtr != nullptr) &&
           (wcsncmp(BackPtr + 1, DRAG_EXT_DUMMY_DIR_PREFIX,
             DRAG_EXT_DUMMY_DIR_PREFIX_LEN) == 0))
       {
@@ -743,7 +758,7 @@ STDMETHODIMP_(UINT) CShellExt::CopyCallback(HWND /*Hwnd*/, UINT Func, UINT /*Fla
         HANDLE MapFile = OpenFileMapping(FILE_MAP_ALL_ACCESS,
           false, DRAG_EXT_MAPPING);
 
-        if (MapFile != NULL)
+        if (MapFile != nullptr)
         {
           Debug(L"mapfile found");
 
@@ -751,7 +766,7 @@ STDMETHODIMP_(UINT) CShellExt::CopyCallback(HWND /*Hwnd*/, UINT Func, UINT /*Fla
           CommStruct = static_cast<TDragExtCommStruct*>(MapViewOfFile(MapFile,
             FILE_MAP_ALL_ACCESS, 0, 0, 0));
 
-          if (CommStruct != NULL)
+          if (CommStruct != nullptr)
           {
             Debug(L"mapview created");
             unsigned long WaitResult = WaitForSingleObject(FMutex, 1000);

+ 5 - 3
source/dragext/DragExt.h

@@ -8,13 +8,15 @@
 #define DRAG_EXT_DUMMY_DIR_PREFIX L"scp"
 #define DRAG_EXT_DUMMY_DIR_PREFIX_LEN 3
 //---------------------------------------------------------------------------
-DEFINE_GUID(CLSID_ShellExtension, 0xe15e1d68, 0x0d1c, 0x49f7,
-  0xbe, 0xb8, 0x81, 0x2b, 0x1e, 0x00, 0xfa, 0x60 );
-//---------------------------------------------------------------------------
 #ifdef _WIN64
 #pragma clang diagnostic push
 #pragma clang diagnostic ignored "-Wpadded"
+#pragma clang diagnostic ignored "-Wmissing-variable-declarations"
 #endif
+//---------------------------------------------------------------------------
+DEFINE_GUID(CLSID_ShellExtension, 0xe15e1d68, 0x0d1c, 0x49f7,
+  0xbe, 0xb8, 0x81, 0x2b, 0x1e, 0x00, 0xfa, 0x60 );
+//---------------------------------------------------------------------------
 #pragma pack(push, 4)
 //---------------------------------------------------------------------------
 // Note that the change between 0 and 1 was incompatible in both directions.

+ 2 - 2
source/forms/Authenticate.cpp

@@ -623,9 +623,9 @@ void __fastcall TAuthenticateForm::FormResize(TObject * /*Sender*/)
   }
 }
 //---------------------------------------------------------------------------
-void __fastcall TAuthenticateForm::ChangeScale(int M, int D)
+void __fastcall TAuthenticateForm::ChangeScale(int M, int D, bool isDpiChange)
 {
-  TForm::ChangeScale(M, D);
+  TForm::ChangeScale(M, D, isDpiChange);
 
   // Recreate the list to re-measure the items according to the new font
   if (DebugAlwaysTrue(LogView->HandleAllocated()) &&

+ 1 - 1
source/forms/Authenticate.h

@@ -101,7 +101,7 @@ protected:
   int __fastcall LogItemHeight(int Index);
   void __fastcall RedrawLog();
   void __fastcall CMShowingChanged(TMessage & Message);
-  DYNAMIC void __fastcall ChangeScale(int M, int D);
+  HIDESBASE DYNAMIC void __fastcall ChangeScale(int M, int D, bool isDpiChange);
   void __fastcall UpdateBannerFont();
   void __fastcall DoAdjustWindow();
   void __fastcall LabelContextPopup(TObject* Sender, const TPoint & MousePos, bool & Handled);

+ 7 - 6
source/forms/CustomScpExplorer.cpp

@@ -6892,7 +6892,8 @@ void __fastcall TCustomScpExplorerForm::ToolbarGetBaseSize(
     if (DropDownItem != NULL)
     {
       ASize.x -= DropDownItem->EditWidth;
-      ASize.x += ScaleByTextHeight(this, 50) /* minimal combo width */;
+      TControl * Control = this;
+      ASize.x += ScaleByTextHeight(Control, 50) /* minimal combo width */;
     }
   }
 }
@@ -7113,12 +7114,12 @@ void __fastcall TCustomScpExplorerForm::FileControlDDDragLeave(
   FDDTargetControl = NULL;
 }
 //---------------------------------------------------------------------------
-void __fastcall TCustomScpExplorerForm::SessionsDDDragLeave()
+void __fastcall TCustomScpExplorerForm::SessionsDDDragLeave(int)
 {
   FileControlDDDragLeave(SessionsPageControl);
 }
 //---------------------------------------------------------------------------
-void __fastcall TCustomScpExplorerForm::QueueDDDragLeave()
+void __fastcall TCustomScpExplorerForm::QueueDDDragLeave(int)
 {
   FileControlDDDragLeave(QueueView3);
 }
@@ -8999,7 +9000,7 @@ void __fastcall TCustomScpExplorerForm::RemoteFileControlDDDragDetect(
 }
 //---------------------------------------------------------------------------
 void __fastcall TCustomScpExplorerForm::RemoteFileControlDDQueryContinueDrag(
-  TObject * /*Sender*/, BOOL /*FEscapePressed*/, int /*grfKeyState*/,
+  TObject * /*Sender*/, LongBool /*FEscapePressed*/, int /*grfKeyState*/,
   HRESULT & Result)
 {
   if (Result == DRAGDROP_S_DROP)
@@ -11131,9 +11132,9 @@ void __fastcall TCustomScpExplorerForm::PrivateKeyUpload()
   TTerminalManager::Instance()->UploadPublicKey(Terminal, NULL, FileName);
 }
 //---------------------------------------------------------------------------
-void __fastcall TCustomScpExplorerForm::ChangeScale(int M, int D)
+void __fastcall TCustomScpExplorerForm::ChangeScale(int M, int D, bool isDpiChange)
 {
-  TForm::ChangeScale(M, D);
+  TForm::ChangeScale(M, D, isDpiChange);
   int APixelsPerInch = GetControlPixelsPerInch(this);
   GlyphsModule->PixelsPerInch = APixelsPerInch;
 }

+ 4 - 4
source/forms/CustomScpExplorer.h

@@ -159,7 +159,7 @@ __published:
     int grfKeyState, const TPoint & DetectStart, const TPoint & Point,
     TDragDetectStatus DragStatus);
   void __fastcall RemoteFileControlDDQueryContinueDrag(TObject *Sender,
-          BOOL FEscapePressed, int grfKeyState, HRESULT &Result);
+          LongBool FEscapePressed, int grfKeyState, HRESULT &Result);
   void __fastcall RemoteDirViewEnter(TObject *Sender);
   void __fastcall RemoteDriveViewEnter(TObject *Sender);
   void __fastcall DirViewMatchMask(TObject *Sender, UnicodeString FileName,
@@ -353,11 +353,11 @@ private:
     TObject * Sender, int Effect, UnicodeString TargetPath, bool ForceQueue, bool Paste);
   void __fastcall SessionsDDDragEnter(_di_IDataObject DataObj, int KeyState,
     const TPoint & Point, int & Effect, bool & Accept);
-  void __fastcall SessionsDDDragLeave();
+  void __fastcall SessionsDDDragLeave(int);
   void __fastcall QueueDDProcessDropped(TObject * Sender, int KeyState, const TPoint & Point, int Effect);
   void __fastcall QueueDDDragEnter(_di_IDataObject DataObj, int KeyState,
     const TPoint & Point, int & Effect, bool & Accept);
-  void __fastcall QueueDDDragLeave();
+  void __fastcall QueueDDDragLeave(int);
   void __fastcall EnableDDTransferConfirmation(TObject * Sender);
   void __fastcall CollectItemsWithTextDisplayMode(TWinControl * Control);
   void __fastcall CreateHiddenWindow();
@@ -705,7 +705,7 @@ protected:
   bool __fastcall SelectedAllFilesInDirView(TCustomDirView * DView);
   TSessionData * __fastcall SessionDataForCode();
   void __fastcall RefreshPanel(const UnicodeString & Session, const UnicodeString & Path);
-  DYNAMIC void __fastcall ChangeScale(int M, int D);
+  HIDESBASE DYNAMIC void __fastcall ChangeScale(int M, int D, bool isDpiChange);
   virtual void __fastcall UpdateImages();
   void __fastcall UpdatePixelsPerInchMainWindowCounter();
   void __fastcall CopyPopup(TControl * DestControl, TControl * SourceControl);

+ 1 - 0
source/forms/Glyphs.h

@@ -6,6 +6,7 @@
 #include <Controls.hpp>
 #include <ImgList.hpp>
 #include "PngImageList.hpp"
+#include <System.ImageList.hpp>
 //---------------------------------------------------------------------------
 class TGlyphsModule : public TDataModule
 {

+ 2 - 2
source/forms/Login.cpp

@@ -3350,9 +3350,9 @@ void __fastcall TLoginDialog::SearchSiteActionExecute(TObject * /*Sender*/)
   SetSiteSearch(isAll);
 }
 //---------------------------------------------------------------------------
-void __fastcall TLoginDialog::ChangeScale(int M, int D)
+void __fastcall TLoginDialog::ChangeScale(int M, int D, bool isDpiChange)
 {
-  TForm::ChangeScale(M, D);
+  TForm::ChangeScale(M, D, isDpiChange);
   FSiteButtonsPadding = MulDiv(FSiteButtonsPadding, M, D);
   FBasicGroupBaseHeight = MulDiv(FBasicGroupBaseHeight, M, D);
   FNoteGroupOffset = MulDiv(FNoteGroupOffset, M, D);

+ 2 - 1
source/forms/Login.h

@@ -23,6 +23,7 @@
 #include <PasTools.hpp>
 #include <System.Actions.hpp>
 #include <GUITools.h>
+#include <System.ImageList.hpp>
 //----------------------------------------------------------------------------
 class TLoginDialog : public TForm
 {
@@ -444,7 +445,7 @@ protected:
   void __fastcall InitControls();
   void __fastcall EditSession();
   void __fastcall Login();
-  DYNAMIC void __fastcall ChangeScale(int M, int D);
+  HIDESBASE DYNAMIC void __fastcall ChangeScale(int M, int D, bool isDpiChange);
   void SetSiteSearch(TIncrementalSearch SiteSearch);
   __property TSessionData * SelectedSession  = { read=GetSelectedSession };
 

+ 3 - 3
source/packages/dragndrop/DragDrop.pas

@@ -78,7 +78,8 @@ type
 
   TOnDragEnter = procedure(DataObj: IDataObject; grfKeyState: LongInt; pt: TPoint;
      var dwEffect: LongInt; var Accept: Boolean) of object;
-  TOnDragLeave = procedure of object;
+  // WORKAROUND C++ Builder 11.2 cannot compile parameter-less Delphi closures
+  TOnDragLeave = procedure(Dummy: Integer) 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;
   TOnQueryContinueDrag = procedure(fEscapePressed: BOOL; grfKeyState: LongInt; var Result: HResult) of object;
@@ -1315,7 +1316,7 @@ function TDropTarget.DragLeave: HResult;
 // Removes target feedback and releases the data object.
 begin
   TDragDrop(FOwner).FInternalSource := nil;
-  if Assigned(FOwner.OnDragLeave) then FOwner.OnDragLeave;
+  if Assigned(FOwner.OnDragLeave) then FOwner.OnDragLeave(0);
   FOwner.FAvailableDropEffects := 0;
   Result := NOERROR;
   TermScroll(True);
@@ -1952,7 +1953,6 @@ begin
           DropSource._Release;
         end;
       except
-        Result := drInvalid;
         raise;
       end;
     finally

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

@@ -247,7 +247,7 @@ type
     function GetDirOK: Boolean; virtual; abstract;
     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 DDDragLeave;
+    procedure DDDragLeave(Dummy: Integer);
     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);

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

@@ -109,7 +109,7 @@ type
 
     procedure DDDragEnter(DataObj: IDataObject; KeyState: Longint;
       Point: TPoint; var Effect: Longint; var Accept: Boolean);
-    procedure DDDragLeave;
+    procedure DDDragLeave(Dummy: Integer);
     procedure DDDragOver(KeyState: Longint; Point: TPoint; var Effect: Longint; PreferredEffect: LongInt);
     procedure DDDrop(DataObj: IDataObject; KeyState: Longint; Point: TPoint;
       var Effect: Longint);
@@ -467,7 +467,7 @@ begin
     FOnDDDragEnter(Self, DataObj, KeyState, Point, Effect, Accept);
 end; {DDDragEnter}
 
-procedure TCustomDriveView.DDDragLeave;
+procedure TCustomDriveView.DDDragLeave(Dummy: Integer);
 begin
   if Assigned(DropTarget) then
   begin

+ 0 - 1
source/packages/filemng/DriveView.pas

@@ -750,7 +750,6 @@ begin
       try
         if FQueue.Count = 0 then
         begin
-          Schedule := nil; // shut up
           Break;
         end
           else

+ 0 - 6
source/packages/jcl/JclSysUtils.pas

@@ -493,8 +493,6 @@ type
     property PositiveSign: Char read GetPositiveSign write SetPositiveSign;
   end;
 
-{$ENDIF ~WINSCP}
-
 function IntToStrZeroPad(Value, Count: Integer): string;
 
 // Child processes
@@ -642,7 +640,6 @@ type
     property Output: string read GetOutput;
   end;
 
-{$IFNDEF WINSCP}
 // Console Utilities
 function ReadKey: Char;
 {$ENDIF ~WINSCP}
@@ -2764,8 +2761,6 @@ begin
   FSignChars[True] := Value;
 end;
 
-{$ENDIF ~WINSCP}
-
 //=== Child processes ========================================================
 
 const
@@ -3485,7 +3480,6 @@ end;
 
 //=== Console Utilities ======================================================
 
-{$IFNDEF WINSCP}
 function ReadKey: Char;
 {$IFDEF MSWINDOWS}
 { TODO -cHelp : Contributor: Robert Rossmair }

+ 743 - 0
source/packages/jcl/JclUnitVersioning.pas

@@ -0,0 +1,743 @@
+{**************************************************************************************************}
+{                                                                                                  }
+{ Project JEDI Code Library (JCL)                                                                  }
+{                                                                                                  }
+{ The contents of this file are subject to the Mozilla Public License Version 1.1 (the "License"); }
+{ you may not use this file except in compliance with the License. You may obtain a copy of the    }
+{ License at http://www.mozilla.org/MPL/                                                           }
+{                                                                                                  }
+{ Software distributed under the License is distributed on an "AS IS" basis, WITHOUT WARRANTY OF   }
+{ ANY KIND, either express or implied. See the License for the specific language governing rights  }
+{ and limitations under the License.                                                               }
+{                                                                                                  }
+{ The Original Code is JclUnitVersioning.pas.                                                      }
+{                                                                                                  }
+{ The Initial Developer of the Original Code is Andreas Hausladen.                                 }
+{ Portions created by Andreas Hausladen are Copyright (C) Andreas Hausladen. All rights reserved.  }
+{                                                                                                  }
+{ Contributor(s):                                                                                  }
+{   Andreas Hausladen (ahuser)                                                                     }
+{                                                                                                  }
+{**************************************************************************************************}
+{                                                                                                  }
+{ A unit version information system. It collects information from prepared units by each module.   }
+{ It also works with units in DLLs.                                                                }
+{                                                                                                  }
+{**************************************************************************************************}
+{                                                                                                  }
+{ Last modified: $Date::                                                                         $ }
+{ Revision:      $Rev::                                                                          $ }
+{ Author:        $Author::                                                                       $ }
+{                                                                                                  }
+{**************************************************************************************************}
+
+unit JclUnitVersioning;
+
+{$I jcl.inc}
+
+interface
+
+uses
+  {$IFDEF HAS_UNIT_LIBC}
+  Libc,
+  {$ENDIF HAS_UNIT_LIBC}
+  {$IFDEF HAS_UNITSCOPE}
+  {$IFDEF MSWINDOWS}
+  Winapi.Windows,
+  {$ENDIF MSWINDOWS}
+  System.SysUtils, System.Contnrs;
+  {$ELSE ~HAS_UNITSCOPE}
+  {$IFDEF MSWINDOWS}
+  Windows,
+  {$ENDIF MSWINDOWS}
+  SysUtils, Contnrs;
+  {$ENDIF ~HAS_UNITSCOPE}
+
+type
+  PUnitVersionInfo = ^TUnitVersionInfo;
+  TUnitVersionInfo = record
+    RCSfile: PChar;   // $'RCSfile$
+    Revision: PChar;  // $'Revision$
+    Date: PChar;      // $'Date$     in UTC (GMT)
+    LogPath: PChar;   // logical file path
+    Extra: PChar;     // user defined string
+    Data: Pointer;    // user data
+  end;
+
+  TUnitVersion = class(TObject)
+  private
+    FInfo: PUnitVersionInfo;
+  public
+    constructor Create(AInfo: PUnitVersionInfo);
+    function RCSfile: string;
+    function Revision: string;
+    function Date: string;
+    function Extra: string;
+    function LogPath: string;
+    function Data: Pointer;
+    function DateTime: TDateTime;
+    function Summary: string;
+  end;
+
+  TUnitVersioningModule = class(TObject)
+  private
+    FInstance: THandle;
+    FItems: TObjectList;
+
+    function GetItems(Index: Integer): TUnitVersion;
+    function GetCount: Integer;
+
+    procedure Add(Info: PUnitVersionInfo);
+    function IndexOfInfo(Info: PUnitVersionInfo): Integer;
+  public
+    constructor Create(AInstance: THandle);
+    destructor Destroy; override;
+
+    function IndexOf(const RCSfile: string; const LogPath: string = '*'): Integer;
+    function FindUnit(const RCSfile: string; const LogPath: string = '*'): TUnitVersion;
+
+    property Instance: THandle read FInstance;
+    property Count: Integer read GetCount;
+    property Items[Index: Integer]: TUnitVersion read GetItems; default;
+  end;
+
+  TCustomUnitVersioningProvider = class(TObject)
+  public
+    constructor Create; virtual;
+    procedure LoadModuleUnitVersioningInfo(Instance: THandle); virtual;
+    procedure ReleaseModuleUnitVersioningInfo(Instance: THandle); virtual;
+  end;
+
+  TUnitVersioningProviderClass = class of TCustomUnitVersioningProvider;
+
+  TUnitVersioning = class(TObject)
+  private
+    FModules: TObjectList;
+    FProviders: TObjectList;
+
+    function GetItem(Index: Integer): TUnitVersion;
+    function GetCount: Integer;
+    function GetModuleCount: Integer;
+    function GetModule(Index: Integer): TUnitVersioningModule;
+
+    procedure UnregisterModule(Module: TUnitVersioningModule); overload;
+    procedure ValidateModules;
+    // These two methods must be virtual because they can be invoked by a DLL.
+    // Static linking would mean that the DLL's TUnitVersioning methods handle
+    // the call which leads to an access violation.
+    procedure Add(Instance: THandle; Info: PUnitVersionInfo); virtual;
+    procedure UnregisterModule(Instance: THandle); overload; virtual;
+  public
+    constructor Create;
+    destructor Destroy; override;
+
+    procedure RegisterProvider(AProviderClass: TUnitVersioningProviderClass);
+    procedure LoadModuleUnitVersioningInfo(Instance: THandle);
+
+    function IndexOf(const RCSfile: string; const LogPath: string = '*'): Integer;
+    function FindUnit(const RCSfile: string; const LogPath: string = '*'): TUnitVersion;
+
+    // units by modules
+    property ModuleCount: Integer read GetModuleCount;
+    property Modules[Index: Integer]: TUnitVersioningModule read GetModule;
+
+    // all units
+    property Count: Integer read GetCount;
+    property Items[Index: Integer]: TUnitVersion read GetItem; default;
+  end;
+
+procedure RegisterUnitVersion(Instance: THandle; const Info: TUnitVersionInfo);
+procedure UnregisterUnitVersion(Instance: THandle);
+
+function GetUnitVersioning: TUnitVersioning;
+
+procedure ExportUnitVersioningToFile(iFileName : string);
+
+const
+  UnitVersioning: TUnitVersionInfo = (
+    RCSfile: '$URL$';
+    Revision: '$Revision$';
+    Date: '$Date$';
+    LogPath: 'JCL\source\common';
+    Extra: '';
+    Data: nil
+  );
+
+implementation
+
+uses
+  // make TObjectList functions inlined
+  {$IFDEF HAS_UNITSCOPE}
+  System.Types, // inlining of TObjectList.Remove
+  System.Classes,
+  {$ELSE ~HAS_UNITSCOPE}
+  Classes,
+  {$ENDIF ~HAS_UNITSCOPE}
+  JclSysUtils, JclSynch;
+
+// Delphi 5 does not know this function //(usc) D6/7 Per does have StartsWith
+// a fast version of Pos(SubStr, S) = 1
+function StartsWith(const SubStr, S: string): Boolean;
+var
+  I, Len: Integer;
+begin
+  Result := False;
+  Len := Length(SubStr);
+  if Len <= Length(S) then
+  begin
+    for I := 1 to Len do
+      if S[I] <> SubStr[I] then
+        Exit;
+    Result := True;
+  end;
+end;
+
+function CompareFilenames(const Fn1, Fn2: string): Integer;
+begin
+  {$IFDEF MSWINDOWS}
+  Result := CompareText(Fn1, Fn2);
+  {$ENDIF MSWINDOWS}
+  {$IFDEF UNIX}
+  Result := CompareStr(Fn1, Fn2);
+  {$ENDIF UNIX}
+end;
+
+//=== { TUnitVersion } =======================================================
+
+constructor TUnitVersion.Create(AInfo: PUnitVersionInfo);
+begin
+  inherited Create;
+  FInfo := AInfo;
+end;
+
+function TUnitVersion.RCSfile: string;
+var
+  I, P: Integer;
+begin
+  Result := Trim(FInfo.RCSfile);
+  // the + is to have CVS not touch the string
+  if StartsWith('$' + 'RCSfile: ', Result) then // a CVS command
+  begin
+    Delete(Result, 1, 10);
+    Delete(Result, Length(Result) - 1, 2);
+    for I := Length(Result) downto 1 do
+      if Result[I] = ',' then
+      begin
+        Delete(Result, I, MaxInt);
+        Break;
+      end;
+  end;
+  // the + is to have SVN not touch the string
+  if StartsWith('$' + 'URL: ', Result) then // a SVN command
+  begin
+    Delete(Result, 1, 6);
+    Delete(Result, Length(Result) - 1, 2);
+    { TODO -oUSc : Is there any need for a function that returns the URL? }
+    P := Pos('/', Result);
+    while P > 0 do
+    begin
+      Delete(Result, 1, P);
+      P := Pos('/', Result);
+    end;
+  end;
+end;
+
+function TUnitVersion.Revision: string;
+begin
+  Result := Trim(FInfo.Revision);
+  if StartsWith('$' + 'Revision: ', Result) then // a CVS command
+    Result := Copy(Result, 12, Length(Result) - 11 - 2);
+end;
+
+function TUnitVersion.Date: string;
+begin
+  Result := Trim(FInfo.Date);
+  if StartsWith('$' + 'Date: ', Result) then // a CVS command
+  begin
+    Delete(Result, 1, 7);
+    Delete(Result, Length(Result) - 1, 2);
+  end;
+end;
+
+function TUnitVersion.Data: Pointer;
+begin
+  Result := FInfo.Data;
+end;
+
+function TUnitVersion.Extra: string;
+begin
+  Result := Trim(FInfo.Extra);
+end;
+
+function TUnitVersion.LogPath: string;
+begin
+  Result := Trim(FInfo.LogPath);
+end;
+
+function TUnitVersion.DateTime: TDateTime;
+var
+  Ps: Integer;
+  S: string;
+  Error: Integer;
+  Year, Month, Day, Hour, Minute, Second: Word;
+  TimeSep: Char;
+begin
+  Result := 0;
+  S := Date;
+
+  // date:   yyyy/mm/dd | yyyy-mm-dd | mm/dd/yyyy | mm-dd-yyyy | dd.mm.yyyy
+  Ps := Pos('/', S);
+  if Ps = 0 then
+    Ps := Pos('-', S);
+  if Ps <> 0 then
+  begin
+    if Ps = 5 then
+    begin
+      // yyyy/mm/dd  |  yyyy-mm-dd
+      Val(Copy(S, 1, 4), Year, Error);
+      Val(Copy(S, 6, 2), Month, Error);
+      Val(Copy(S, 9, 2), Day, Error);
+    end
+    else
+    begin
+      // mm/dd/yyyy  |  mm-dd-yyyy
+      Val(Copy(S, 1, 2), Month, Error);
+      Val(Copy(S, 4, 2), Day, Error);
+      Val(Copy(S, 7, 4), Year, Error);
+    end;
+  end
+  else
+  begin
+    Ps := Pos('.', S);
+    if Ps <> 0 then
+    begin
+      // dd.mm.yyyy
+      Val(Copy(S, 1, 2), Day, Error);
+      Val(Copy(S, 4, 2), Month, Error);
+      Val(Copy(S, 7, 4), Year, Error);
+    end
+    else
+      Exit;
+  end;
+
+  // time:   hh:mm:ss  |  hh/mm/ss
+  Ps := Pos(' ', S);
+  S := Trim(Copy(S, Ps + 1, MaxInt));
+
+  Ps := Pos(':', S);
+  if Ps <> 0 then
+    TimeSep := ':'
+  else
+  begin
+    Ps := Pos('/', S);
+    TimeSep := '/';
+  end;
+  Val(Copy(S, 1, Ps - 1), Hour, Error);
+  Delete(S, 1, Ps);
+  Ps := Pos(TimeSep, S);
+  Val(Copy(S, 1, Ps - 1), Minute, Error);
+  Delete(S, 1, Ps);
+  Ps := Pos(TimeSep, S);
+  if Ps = 0 then
+    Ps := Length(S) + 1;
+  Val(Copy(S, 1, Ps - 1), Second, Error);
+
+  Result := EncodeDate(Year, Month, Day) + EncodeTime(Hour, Minute, Second, 0);
+end;
+
+function TUnitVersion.Summary: string;
+begin
+  Result := LogPath + #9 + RCSFile + #9 + Revision + #9 + Date;
+  if Extra <> '' then
+    Result := Result + #9 + Extra;
+end;
+
+//=== { TUnitVersioningModule } ==============================================
+
+constructor TUnitVersioningModule.Create(AInstance: THandle);
+begin
+  inherited Create;
+  FInstance := AInstance;
+  FItems := TObjectList.Create;
+end;
+
+destructor TUnitVersioningModule.Destroy;
+begin
+  FItems.Free;
+  inherited Destroy;
+end;
+
+function TUnitVersioningModule.GetCount: Integer;
+begin
+  Result := FItems.Count;
+end;
+
+function TUnitVersioningModule.GetItems(Index: Integer): TUnitVersion;
+begin
+  Result := TUnitVersion(FItems[Index]);
+end;
+
+procedure TUnitVersioningModule.Add(Info: PUnitVersionInfo);
+begin
+  FItems.Add(TUnitVersion.Create(Info));
+end;
+
+function TUnitVersioningModule.IndexOfInfo(Info: PUnitVersionInfo): Integer;
+begin
+  for Result := 0 to FItems.Count - 1 do
+    if Items[Result].FInfo = Info then
+      Exit;
+  Result := -1;
+end;
+
+function TUnitVersioningModule.FindUnit(const RCSfile: string; const LogPath: string): TUnitVersion;
+var
+  Index: Integer;
+begin
+  Index := IndexOf(RCSfile, LogPath);
+  if Index <> -1 then
+    Result := Items[Index]
+  else
+    Result := nil;
+end;
+
+function TUnitVersioningModule.IndexOf(const RCSfile: string; const LogPath: string): Integer;
+var
+  Item: TUnitVersion;
+begin
+  for Result := 0 to FItems.Count - 1 do
+  begin
+    Item := Items[Result];
+    if CompareFilenames(Item.RCSfile, RCSfile) = 0 then
+      if LogPath = '*' then
+        Exit
+      else
+      if CompareFilenames(LogPath, Trim(Item.LogPath)) = 0 then
+        Exit;
+  end;
+  Result := -1;
+end;
+
+//=== { TCustomUnitVersioningProvider } ======================================
+
+constructor TCustomUnitVersioningProvider.Create;
+begin
+  inherited Create;
+end;
+
+procedure TCustomUnitVersioningProvider.LoadModuleUnitVersioningInfo(Instance: THandle);
+begin
+//
+end;
+
+procedure TCustomUnitVersioningProvider.ReleaseModuleUnitVersioningInfo(Instance: THandle);
+begin
+//
+end;
+
+//=== { TUnitVersioning } ====================================================
+
+constructor TUnitVersioning.Create;
+begin
+  inherited Create;
+  FModules := TObjectList.Create;
+  FProviders := TObjectList.Create;
+end;
+
+destructor TUnitVersioning.Destroy;
+begin
+  FProviders.Free;
+  FModules.Free;
+  inherited Destroy;
+end;
+
+procedure TUnitVersioning.Add(Instance: THandle; Info: PUnitVersionInfo);
+var
+  I: Integer;
+  Module: TUnitVersioningModule;
+begin
+  for I := 0 to FModules.Count - 1 do
+  begin
+    Module := Modules[I];
+    if Module.Instance = Instance then
+    begin
+      if Module.IndexOfInfo(Info) = -1 then
+        Module.Add(Info);
+      Exit;
+    end;
+  end;
+  // create a new module entry
+  Module := TUnitVersioningModule.Create(Instance);
+  FModules.Add(Module);
+  Module.Add(Info);
+end;
+
+procedure TUnitVersioning.UnregisterModule(Instance: THandle);
+var
+  I: Integer;
+begin
+  for I := FModules.Count - 1 downto 0 do
+    if Modules[I].Instance = Instance then
+    begin
+      FModules.Delete(I);
+      Break;
+    end;
+  for I := 0 to FProviders.Count -1 do
+    TCustomUnitVersioningProvider(FProviders[I]).ReleaseModuleUnitVersioningInfo(Instance);
+end;
+
+procedure TUnitVersioning.UnregisterModule(Module: TUnitVersioningModule);
+begin
+  FModules.Remove(Module);
+end;
+
+function TUnitVersioning.GetCount: Integer;
+var
+  I: Integer;
+begin
+  Result := 0;
+  ValidateModules;
+  for I := 0 to FModules.Count - 1 do
+    Inc(Result, Modules[I].Count);
+end;
+
+function TUnitVersioning.GetItem(Index: Integer): TUnitVersion;
+var
+  Cnt, I: Integer;
+  Module: TUnitVersioningModule;
+begin
+  Result := nil;
+  ValidateModules;
+  Cnt := 0;
+  for I := 0 to FModules.Count - 1 do
+  begin
+    Module := Modules[I];
+    if Index < Cnt + Module.Count then
+    begin
+      Result := Module.Items[Index - Cnt];
+      Break;
+    end;
+    Inc(Cnt, Module.Count);
+  end;
+end;
+
+function TUnitVersioning.GetModuleCount: Integer;
+begin
+  ValidateModules;
+  Result := FModules.Count;
+end;
+
+function TUnitVersioning.GetModule(Index: Integer): TUnitVersioningModule;
+begin
+  Result := TUnitVersioningModule(FModules[Index]);
+end;
+
+{$UNDEF FPCUNIX}   // Temporary, will move to .inc's in time.
+{$IFDEF FPC}
+ {$IFDEF UNIX}
+ {$DEFIN FPCUNIX}
+{$ENDIF}
+{$ENDIF}
+
+procedure TUnitVersioning.ValidateModules;
+var
+  I: Integer;
+  {$IFNDEF FPCUNIX}
+  Buffer: string;
+  {$ENDIF ~FPCUNIX}
+  Module: TUnitVersioningModule;
+begin
+  {$IFNDEF FPCUNIX}
+  SetLength(Buffer, 1024);
+  {$ENDIF ~FPCUNIX}
+  for I := FModules.Count - 1 downto 0 do
+  begin
+    Module := Modules[I];
+    {$IFDEF FPCUNIX}
+    if dlsym(Pointer(Module.Instance), '_init') = nil then
+    {$ELSE ~FPCUNIX}
+    if GetModuleFileName(Module.Instance, PChar(Buffer), 1024) = 0 then
+    {$ENDIF ~FPCUNIX}
+      // This module is no more in memory but has not unregistered itself so
+      // unregister it here.
+      UnregisterModule(Module);
+  end;
+end;
+
+function TUnitVersioning.FindUnit(const RCSfile: string; const LogPath: string): TUnitVersion;
+var
+  I: Integer;
+begin
+  for I := 0 to FModules.Count - 1 do
+  begin
+    Result := Modules[I].FindUnit(RCSfile, LogPath);
+    if Result <> nil then
+      Exit;
+  end;
+  Result := nil;
+end;
+
+function TUnitVersioning.IndexOf(const RCSfile: string; const LogPath: string): Integer;
+var
+  I, Cnt, Index: Integer;
+  Module: TUnitVersioningModule;
+begin
+  Result := -1;
+  Cnt := 0;
+  for I := 0 to FModules.Count - 1 do
+  begin
+    Module := Modules[I];
+    Index := Module.IndexOf(RCSfile, LogPath);
+    if Index <> -1 then
+    begin
+      Result := Cnt + Index;
+      Break;
+    end;
+    Inc(Cnt, Module.Count);
+  end;
+end;
+
+procedure TUnitVersioning.RegisterProvider(AProviderClass: TUnitVersioningProviderClass);
+var
+  I, Idx: Integer;
+begin
+  Idx := -1;
+  for I := 0 to FProviders.Count - 1 do
+    if TObject(FProviders[I]).ClassType = AProviderClass then
+    begin
+      Idx := I;
+      Break;
+    end;
+  if Idx = -1 then
+    FProviders.Add(AProviderClass.Create);
+end;
+
+procedure TUnitVersioning.LoadModuleUnitVersioningInfo(Instance: THandle);
+var
+  I: Integer;
+begin
+  for I := 0 to FProviders.Count - 1 do
+    TCustomUnitVersioningProvider(FProviders[I]).LoadModuleUnitVersioningInfo(Instance);
+end;
+
+type
+  PUnitVersioning = ^TUnitVersioning;
+
+var
+  UnitVersioningOwner: Boolean = False;
+  GlobalUnitVersioning: TUnitVersioning = nil;
+  UnitVersioningNPA: PUnitVersioning = nil;
+  UnitVersioningMutex: TJclMutex;
+  UnitVersioningFinalized: Boolean = False;
+
+function GetUnitVersioning: TUnitVersioning;
+begin
+  if UnitVersioningFinalized then
+  begin
+    Result := nil;
+    Exit;
+  end;
+
+  if UnitVersioningMutex = nil then
+    UnitVersioningMutex := TJclMutex.Create(nil, False, 'MutexNPA_UnitVersioning_' + IntToStr(GetCurrentProcessId));
+
+  if GlobalUnitVersioning = nil then
+  begin
+    UnitVersioningMutex.WaitFor(INFINITE);
+    try
+      if UnitVersioningNPA = nil then
+        SharedGetMem(UnitVersioningNPA, 'ShmNPA_UnitVersioning_' + IntToStr(GetCurrentProcessId), SizeOf(TUnitVersioning));
+      if UnitVersioningNPA <> nil then
+      begin
+        GlobalUnitVersioning := UnitVersioningNPA^;
+        if GlobalUnitVersioning = nil then
+        begin
+          GlobalUnitVersioning := TUnitVersioning.Create;
+          UnitVersioningNPA^ := GlobalUnitVersioning;
+          UnitVersioningOwner := True;
+        end;
+      end
+      else
+      begin
+        GlobalUnitVersioning := TUnitVersioning.Create;
+        UnitVersioningOwner := True;
+      end;
+    finally
+      UnitVersioningMutex.Release;
+    end;
+  end
+  else
+  if UnitVersioningNPA <> nil then
+  begin
+    UnitVersioningMutex.WaitFor(INFINITE);
+    try
+      GlobalUnitVersioning := UnitVersioningNPA^; // update (maybe the owner has destroyed the instance)
+    finally
+      UnitVersioningMutex.Release;
+    end;
+  end;
+  Result := GlobalUnitVersioning;
+end;
+
+procedure FinalizeUnitVersioning;
+begin
+  UnitVersioningFinalized := True;
+  try
+    if UnitVersioningNPA <> nil then
+      SharedCloseMem(UnitVersioningNPA);
+    if (GlobalUnitVersioning <> nil) and UnitVersioningOwner then
+      FreeAndNil(GlobalUnitVersioning)
+    else
+      GlobalUnitVersioning := nil;
+  except
+    // ignore - should never happen
+  end;
+  FreeAndNil(UnitVersioningMutex);
+end;
+
+procedure RegisterUnitVersion(Instance: THandle; const Info: TUnitVersionInfo);
+var
+  UnitVersioning: TUnitVersioning;
+begin
+  UnitVersioning := GetUnitVersioning;
+  if Assigned(UnitVersioning) then
+    UnitVersioning.Add(Instance, @Info);
+end;
+
+procedure UnregisterUnitVersion(Instance: THandle);
+var
+  UnitVersioning: TUnitVersioning;
+begin
+  UnitVersioning := GetUnitVersioning;
+  if Assigned(UnitVersioning) then
+    UnitVersioning.UnregisterModule(Instance);
+end;
+
+procedure ExportUnitVersioningToFile(iFileName : string);
+var
+  I: Integer;
+  sl: TStringList;
+begin
+  sl := TStringList.Create;
+  try
+    for I := 0 to GetUnitVersioning.Count - 1 do
+      sl.Add(GetUnitVersioning.Items[I].Summary);
+    sl.Sort;
+    sl.SaveToFile(iFileName);
+  finally
+    sl.Free;
+  end;
+end;
+
+initialization
+{$IFDEF UNITVERSIONING}
+  RegisterUnitVersion(HInstance, UnitVersioning);
+{$ENDIF UNITVERSIONING}
+
+finalization
+{$IFDEF UNITVERSIONING}
+  UnregisterUnitVersion(HInstance);
+{$ENDIF UNITVERSIONING}
+  FinalizeUnitVersioning;
+
+end.

+ 12 - 12
source/packages/jcl/jcld20win32.inc → source/packages/jcl/jcld28win32.inc

@@ -40,13 +40,13 @@
 
 // Math precision selection, mutually exclusive
 // FPC does not support EXTENDED when targetting x86_64, MATH_DOUBLE_PRECISION is the default in this situation
-{.$DEFINE MATH_EXTENDED_PRECISION} // default
+{$DEFINE MATH_EXTENDED_PRECISION} // default
 {.$DEFINE MATH_DOUBLE_PRECISION}
 {.$DEFINE MATH_SINGLE_PRECISION}
 
 
 // Math functions takes care of infinites and NaN
-{.$DEFINE MATH_EXT_EXTREMEVALUES}
+{$DEFINE MATH_EXT_EXTREMEVALUES}
 
 
 // JclHookExcept support for hooking exceptions from DLLs
@@ -54,15 +54,15 @@
 
 
 //Threadsafe directive
-{.$DEFINE THREADSAFE}
+{$DEFINE THREADSAFE}
 
 
 // To exclude obsolete code from compilation, remove the point from the line below
-{.$DEFINE DROP_OBSOLETE_CODE}
+{$DEFINE DROP_OBSOLETE_CODE}
 
 
 //Support for JclUnitVersioning.pas, not supported by Delphi 2005 (automatically disabled afterward)
-{.$DEFINE UNITVERSIONING}
+{$DEFINE UNITVERSIONING}
 
 
 // debug sources
@@ -83,7 +83,7 @@
 //   dynamic dll import: PCRE_LINKONREQUEST
 //   RTL's RegularExpressionsAPI: PCRE_RTL
 
-{.$DEFINE PCRE_STATICLINK}
+{$DEFINE PCRE_STATICLINK}
 {.$DEFINE PCRE_LINKDLL}
 {.$DEFINE PCRE_LINKONREQUEST} // default
 {.$DEFINE PCRE_RTL} // DXE and newer
@@ -98,14 +98,14 @@
 
 // BZIP2 options, mutually exclusive
 
-{.$DEFINE BZIP2_STATICLINK} // default
+{$DEFINE BZIP2_STATICLINK} // default
 {.$DEFINE BZIP2_LINKDLL}
 {.$DEFINE BZIP2_LINKONREQUEST}
 
 
 // ZLIB options, mutually exclusive
 
-{.$DEFINE ZLIB_STATICLINK} // default
+{$DEFINE ZLIB_STATICLINK} // default
 {.$DEFINE ZLIB_LINKDLL}
 {.$DEFINE ZLIB_LINKONREQUEST}
 {.$DEFINE ZLIB_RTL} // DXE2 and newer only
@@ -116,10 +116,10 @@
 {.$DEFINE UNICODE_RTL_DATABASE}
 
 // insert a replacement character if sequence is corrupted rather than raising an exception
-{.$DEFINE UNICODE_SILENT_FAILURE}
+{$DEFINE UNICODE_SILENT_FAILURE}
 
 // defines resource compression (uncompressed, compressed with ZLib, compressed with BZip2), mutually exclusive
-{.$DEFINE UNICODE_RAW_DATA} // default
+{$DEFINE UNICODE_RAW_DATA} // default
 {.$DEFINE UNICODE_ZLIB_DATA}
 {.$DEFINE UNICODE_BZIP2_DATA}
 
@@ -128,7 +128,7 @@
 // define mapping of TJclStr* containers to TJclAnsiStr* or TJclWideStr* (mutually exclusive)
 {.$DEFINE CONTAINER_ANSISTR} // default for D2007 and older
 {.$DEFINE CONTAINER_WIDESTR}
-{.$DEFINE CONTAINER_UNICODESTR} // default for D2009 and newer, not supported for Delphi 2007 and older
+{$DEFINE CONTAINER_UNICODESTR} // default for D2009 and newer, not supported for Delphi 2007 and older
 {.$DEFINE CONTAINER_NOSTR}
 
 
@@ -137,4 +137,4 @@
 
 {.$DEFINE 7ZIP_STATICLINK} // not supported yet
 {.$DEFINE 7ZIP_LINKDLL}
-{.$DEFINE 7ZIP_LINKONREQUEST} // default
+{$DEFINE 7ZIP_LINKONREQUEST} // default

+ 2 - 2
source/packages/my/NortonLikeListView.pas

@@ -77,7 +77,7 @@ type
     procedure DDBeforeDrag;
     function CanEdit(Item: TListItem): Boolean; override;
     function GetPopupMenu: TPopupMenu; override;
-    procedure ChangeScale(M, D: Integer); override;
+    procedure ChangeScale(M, D: Integer; isDpiChange: Boolean); override;
     procedure SetItemSelectedByIndex(Index: Integer; Select: Boolean);
     function GetItemSelectedByIndex(Index: Integer): Boolean;
     procedure MakeTopItem(Item: TListItem);
@@ -1113,7 +1113,7 @@ begin
   Item.MakeVisible(False);
 end;
 
-procedure TCustomNortonLikeListView.ChangeScale(M, D: Integer);
+procedure TCustomNortonLikeListView.ChangeScale(M, D: Integer; isDpiChange: Boolean);
 begin
   if M <> D then
   begin

+ 15 - 10
source/packages/my/PasTools.pas

@@ -29,8 +29,6 @@ procedure FilterToFileTypes(Filter: string; FileTypes: TFileTypeItems);
 
 const
   CM_DPICHANGED = WM_USER + $2000 + 10;
-  WM_DPICHANGED_BEFOREPARENT = $02E2;
-  WM_DPICHANGED_AFTERPARENT = $02E3;
 
 function HasSystemParametersInfoForPixelsPerInch: Boolean;
 function SystemParametersInfoForPixelsPerInch(
@@ -408,7 +406,7 @@ type
 
 function TFormHelper.RetrieveTextHeight: Integer;
 begin
-  Result := Self.FTextHeight;
+  Result := Self.GetInternalTextHeight;
 end;
 
 function CalculateTextHeight(Canvas: TCanvas): Integer;
@@ -611,7 +609,8 @@ type
 
 function TListViewHelper.HasMemStream: Boolean;
 begin
-  Result := Assigned(Self.FMemStream);
+  with Self do
+    Result := Assigned(FMemStream);
 end;
 
 type
@@ -622,7 +621,8 @@ type
 
 function TTreeViewHelper.HasMemStream: Boolean;
 begin
-  Result := Assigned(Self.FMemStream);
+  with Self do
+    Result := Assigned(FMemStream);
 end;
 
 type
@@ -633,7 +633,8 @@ type
 
 function TRichEditHelper.HasMemStream: Boolean;
 begin
-  Result := Assigned(Self.FMemStream);
+  with Self do
+    Result := Assigned(FMemStream);
 end;
 
 function ControlHasRecreationPersistenceData(Control: TControl): Boolean;
@@ -657,22 +658,26 @@ type
 
 function TApplicationHelper.IsAppIconic: Boolean;
 begin
-  Result := Self.FAppIconic;
+  with Self do
+    Result := FAppIconic;
 end;
 
 procedure TApplicationHelper.SetAppIconic(Value: Boolean);
 begin
-  Self.FAppIconic := Value;
+  with Self do
+    FAppIconic := Value;
 end;
 
 procedure TApplicationHelper.SetMainForm(Value: TForm);
 begin
-  Self.FMainForm := Value;
+  with Self do
+    FMainForm := Value;
 end;
 
 procedure TApplicationHelper.SetTerminated(Value: Boolean);
 begin
-  Self.FTerminate := Value;
+  with Self do
+    FTerminate := Value;
 end;
 
 function IsAppIconic: Boolean;

+ 0 - 3
source/packages/png/PngImageList.pas

@@ -11,9 +11,6 @@ uses
   {$IF CompilerVersion >= 34.0 Delphi 10.4 }
   System.UITypes,
   {$IFEND}
-  {$IFDEF WINSCP}
-  System.UITypes,
-  {$IFEND}
   PngImage, PngFunctions;
 
 {$IF CompilerVersion < 34.0 Delphi 10.4 }

+ 0 - 1
source/packages/tb2k/TB2DsgnConverter.pas

@@ -136,7 +136,6 @@ var
   C: TComponent;
   Menu: TMenu;
 begin
-  Menu := nil;
   OptionsForm := TTBConvertOptionsForm.Create(Application);
   try
     for I := 0 to Owner.ComponentCount-1 do begin

+ 2 - 2
source/packages/tb2k/TB2Toolbar.pas

@@ -160,7 +160,7 @@ type
     procedure ResizeTrackAccept; override;
     procedure ResizeEnd; override;
     procedure SetChildOrder(Child: TComponent; Order: Integer); override;
-    procedure ChangeScale(M, D: Integer); override;
+    procedure ChangeScale(M, D: Integer; isDpiChange: Boolean); override;
 
     property SystemFont: Boolean read FSystemFont write SetSystemFont default True;
     property OnShortCut: TShortCutEvent read FOnShortCut write FOnShortCut;
@@ -1723,7 +1723,7 @@ begin
     Application.UnhookMainWindow(MainWindowHook);
 end;
 
-procedure TTBCustomToolbar.ChangeScale(M, D: Integer);
+procedure TTBCustomToolbar.ChangeScale(M, D: Integer; isDpiChange: Boolean);
 begin
   inherited;
   Items.ChangeScale(M, D);

+ 2 - 2
source/packages/tbx/TBXStatusBars.pas

@@ -133,7 +133,7 @@ type
     procedure AlignControls(AControl: TControl; var Rect: TRect); override;
     procedure BeginUpdate;
     procedure Change; dynamic;
-    procedure ChangeScale(M, D: Integer); override;
+    procedure ChangeScale(M, D: Integer; isDpiChange: Boolean); override;
     procedure Click; override;
     procedure CreateParams(var Params: TCreateParams); override;
     procedure CreateWnd; override;
@@ -510,7 +510,7 @@ begin
   end;
 end;
 
-procedure TTBXCustomStatusBar.ChangeScale(M, D: Integer);
+procedure TTBXCustomStatusBar.ChangeScale(M, D: Integer; isDpiChange: Boolean);
 var
   I: Integer;
   Panel: TTBXStatusPanel;

+ 1 - 1
source/tb2k.cbproj

@@ -1,7 +1,7 @@
 <Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
     <PropertyGroup>
         <ProjectGuid>{040AEB47-CE64-41D5-8776-BD824E5F3763}</ProjectGuid>
-        <ProjectVersion>15.4</ProjectVersion>
+        <ProjectVersion>19.5</ProjectVersion>
         <MainSource>tb2k.cpp</MainSource>
         <Config Condition="'$(Config)'==''">Release</Config>
         <FrameworkType>VCL</FrameworkType>

+ 1 - 0
source/tb2k.cpp

@@ -1,5 +1,6 @@
 // $jrsoftware: tb2k.cpp,v 1.2 2002/11/14 18:07:19 jr Exp $
 //---------------------------------------------------------------------------
+#pragma warn -pch // WORKAROUND (see My.cpp)
 #include <vcl.h>
 #pragma hdrstop
 #pragma package(smart_init)

+ 1 - 1
source/tbxp.cbproj

@@ -1,7 +1,7 @@
 <Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
     <PropertyGroup>
         <ProjectGuid>{44DD0CE6-BAA9-4655-925A-94E7F438BC93}</ProjectGuid>
-        <ProjectVersion>15.4</ProjectVersion>
+        <ProjectVersion>19.5</ProjectVersion>
         <MainSource>tbxp.cpp</MainSource>
         <Config Condition="'$(Config)'==''">Release</Config>
         <FrameworkType>VCL</FrameworkType>

+ 1 - 1
source/tbxp.cpp

@@ -1,5 +1,5 @@
 //---------------------------------------------------------------------------
-
+#pragma warn -pch // WORKAROUND (see My.cpp)
 #include <vcl.h>
 #pragma hdrstop
 #pragma package(smart_init)

+ 2 - 1
source/windows/GUITools.cpp

@@ -23,7 +23,6 @@
 #include <PasTools.hpp>
 #include <VCLCommon.h>
 #include <WinApi.h>
-#include <Vcl.ScreenTips.hpp>
 #include <HistoryComboBox.hpp>
 #include <vssym32.h>
 #include <DateUtils.hpp>
@@ -2222,6 +2221,8 @@ TRect __fastcall TScreenTipHintWindow::CalcHintRect(int MaxWidth, const UnicodeS
 
   Canvas->Font->Assign(GetFont(HintControl, AHint));
 
+  // from XE6 Vcl.ScreenTips.pas, but absent in 11
+  const cScreenTipTextOnlyWidth = 210;
   const int ScreenTipTextOnlyWidth = ScaleByTextHeight(HintControl, cScreenTipTextOnlyWidth);
 
   int LongHintMargin = 0; // shut up

+ 2 - 1
source/windows/Setup.cpp

@@ -35,6 +35,7 @@
 #include <Web.HTTPApp.hpp>
 #include <System.IOUtils.hpp>
 #include <WinApi.h>
+#include <System.NetEncoding.hpp>
 //---------------------------------------------------------------------------
 #define KEY _T("SYSTEM\\CurrentControlSet\\Control\\") \
             _T("Session Manager\\Environment")
@@ -1677,7 +1678,7 @@ static void __fastcall InsertDonateLink(void * /*Data*/, TObject * Sender)
     UnicodeString StoreUrl = FMTLOAD(STORE_URL, (L"update"));
     UnicodeString StoreLink = FORMAT(L"<a href=\"%s\">%s</a>", (StoreUrl, StoreButton));
 
-    UnicodeString PlainBody = HTMLDecode(DocumentBody);
+    UnicodeString PlainBody = TNetEncoding::HTML->Decode(DocumentBody);
     int P1, P2;
     while (((P1 = PlainBody.Pos(L"<")) > 0) && ((P2 = PlainBody.Pos(L">")) > 0) && (P1 < P2))
     {

+ 1 - 1
source/windows/VCLCommon.cpp

@@ -2553,7 +2553,7 @@ TForm * __fastcall _SafeFormCreate(TMetaClass * FormClass, TComponent * Owner)
 //---------------------------------------------------------------------------
 bool __fastcall SupportsSplitButton()
 {
-  return (Win32MajorVersion >= 6);
+  return (Win32MajorVersion() >= 6);
 }
 //---------------------------------------------------------------------------
 static TButton * __fastcall FindStandardButton(TWinControl * Control, bool Default)

+ 0 - 14
source/windows/WinApi.h

@@ -11,16 +11,6 @@ typedef BOOL WINAPI (* ChangeWindowMessageFilterExProc)(
 typedef BOOL WINAPI (* AddClipboardFormatListenerProc)(HWND hwnd);
 typedef BOOL WINAPI (* RemoveClipboardFormatListenerProc)(HWND hwnd);
 //---------------------------------------------------------------------------
-#define WM_DPICHANGED 0x02E0
-#define WM_GETDPISCALEDSIZE 0x02E4
-//---------------------------------------------------------------------------
-typedef enum _Monitor_DPI_Type {
-  MDT_Effective_DPI  = 0,
-  MDT_Angular_DPI    = 1,
-  MDT_Raw_DPI        = 2,
-  MDT_Default        = MDT_Effective_DPI
-} MONITOR_DPI_TYPE;
-//---------------------------------------------------------------------------
 typedef HRESULT WINAPI (* GetDpiForMonitorProc)(
   HMONITOR hmonitor, MONITOR_DPI_TYPE dpiType, UINT * dpiX, UINT * dpiY);
 //---------------------------------------------------------------------------
@@ -188,10 +178,6 @@ public:
 };
 //---------------------------------------------------------------------------
 //---------------------------------------------------------------------------
-#define EM_SETEDITSTYLEEX (WM_USER + 275)
-#define SES_EX_HANDLEFRIENDLYURL (0x100)
-//---------------------------------------------------------------------------
-//---------------------------------------------------------------------------
 // msi.h (available, but does not compile)
 extern "C"
 {

+ 0 - 1
source/windows/WinConfiguration.cpp

@@ -19,7 +19,6 @@
 #include <DragExt.h>
 #include <Math.hpp>
 #include <StrUtils.hpp>
-#include <Generics.Defaults.hpp>
 #include <OperationWithTimeout.hpp>
 #include "FileInfo.h"
 #include "CoreMain.h"

+ 1 - 1
source/windows/WinMain.cpp

@@ -567,7 +567,7 @@ void __fastcall UpdateStaticUsage()
       {
         unsigned int DpiX;
         unsigned int DpiY;
-        GetDpiForMonitor(Screen->Monitors[Index]->Handle, MDT_Default, &DpiX, &DpiY);
+        GetDpiForMonitor(Screen->Monitors[Index]->Handle, MDT_DEFAULT, &DpiX, &DpiY);
 
         if (DpiX != DpiY)
         {