1
0
mirror of https://github.com/winscp/winscp.git synced 2026-10-24 02:28:55 +03:00

1062 Commits

Author SHA1 Message Date
Eduardo C.
a8fc40bd0e Portability: let core build with clang on Linux and Windows (#79)
* Cast between closure types with a functional cast, not reinterpret_cast

A Borland __closure is a built-in (code, data) pair, so reinterpret_cast
between two closure types is allowed. Under standard C++ a closure is a
class, and reinterpret_cast cannot convert one class object into another.
The functional cast is the old C-style cast this line had before
"Refactoring old-style casts" (e5efed895), so C++Builder compiles it as it
did then, and a compiler implementing closures as classes can give it the
same meaning.

* Read the knocked FTP port's IPv4 address as 32 bits

The address is read through an unsigned long pointer. That is 32 bits on
Windows (LLP64), so it reads exactly the four address bytes there; on LP64
targets unsigned long is 64 bits, and the read runs four bytes past the
address into whatever follows it in gethostbyname's buffer. The assignment
to the 32-bit s_addr then keeps the right bytes on little-endian machines,
which is why it goes unnoticed, but the over-read is undefined. ULONG is 32
bits on every Windows compiler, as Windows API layers for POSIX define it
too.

* Compile the synchronize checklist's Explorer file operation on Windows only

TSynchronizeChecklistFileOperation carries out a synchronization checklist
through Explorer's IFileOperation (a Shell COM object), so that local
deletions go to the recycle bin with Explorer's progress and undo. Only
WinSCP's Windows GUI uses it (CustomScpExplorer.cpp). Elsewhere neither the
object nor the interfaces exist, and declaring them only to compile would
pretend to a facility that is not there; a frontend on another platform
implements the operation its own way. The class and its implementation are
guarded with _WIN32, which C++Builder defines, so the Windows build is
unchanged.

* Declare the SIOCATMARK result as ULONG, the type p_ioctlsocket takes

network.c declares ioctlsocket as taking ULONG * (its DECL_WINDOWS_FUNCTION)
but passes a u_long. Both are 32 bits on Windows, so the two agree there. On
an LP64 platform u_long is 64 bits and ULONG 32, so the pointer types differ
and the callee would write half the variable. ULONG is what the declaration
says, and is the same type on Windows.

* Pick aes-ni.c's _mm_setr_epi8 for any GCC-compatible compiler

MM_SETR_EPI8 uses _mm_setr_epi8 only under _WIN64, falling back to a brace
initialiser that is correct for MSVC's __m128i (a byte union) but fills
clang's and GCC's (a two-lane vector) wrongly; the _WIN64 condition fixed
that for Win64 builds only. Any compiler defining __GNUC__ (clang does) now
takes the intrinsic.

* Compile WinSCP's Windows-only additions to neon on Windows only

WinSCP builds neon for Win32 alone, and three of its additions assume it:
ne_openssl.c includes <windows.h> (it uses nothing from it), timed_connect
switches the socket to non-blocking mode with Winsock's ioctlsocket instead
of upstream's fcntl, and ne_sock_sspi_init calls into SSPI unconditionally.
On POSIX neon uses BSD sockets directly, so the include is guarded with
_WIN32, the two ioctlsocket branches are taken only on _WIN32 (upstream's
fcntl code beside them is used otherwise), and ne_sock_sspi_init calls SSPI
under HAVE_SSPI, as ne_sock_init's own call does, reporting failure (-1)
without it -- which WebDAVFileSystem.cpp already handles as SSPI being
unavailable. C++Builder defines _WIN32 and neon's Win32 config.h defines
HAVE_SSPI, so the Windows build is unchanged.

* Use in_addr's s_addr in FileZilla's proxy layer

AsyncProxySocketLayer.cpp reaches the IPv4 address through Winsock's union,
sin_addr.S_un.S_addr. Winsock also defines s_addr as exactly that member
(#define s_addr S_un.S_addr), and s_addr is the name BSD sockets and POSIX
give the field; a POSIX in_addr has no S_un. Same field, so the Windows
build is unchanged.

* Pass FileZilla's two tool strings as UnicodeString, not std::wstring

CFileZillaTools::GetClientString and CustomReason return std::wstring; the
rest of the interface between core and FileZilla, and both sides' own code,
use UnicodeString or wchar_t pointers. Built with a 2-byte wchar_t on a
platform whose C++ library assumes 4 (clang's -fshort-wchar on Linux),
std::wstring is unusable: libstdc++ provides basic_string<wchar_t> as a
precompiled extern template for its own wchar_t, and char_traits<wchar_t>
calls the C library's 4-byte wcslen and wmemcpy: a Linux build of
FtpFileSystem.cpp imported wcslen through it. The values are only built from
UnicodeString, compared with empty() and read with c_str(), so UnicodeString
is a direct replacement (IsEmpty for empty). On Windows, where wchar_t is 2
bytes throughout, behaviour is unchanged.

* Build storage key paths with backslashes on every platform

THierarchicalStorage joins registry and INI key paths (Sessions\My site)
through its IncludeTrailingBackslash and ExcludeTrailingBackslash members,
which defer to the RTL functions of those names. The RTL's add and strip the
platform's path delimiter: a backslash on Windows, a slash on POSIX, where
these functions also build local file paths. Keys are not file paths: their
separator is a backslash everywhere, and the INI file's sections say so. The
members now add and strip a backslash themselves; on Windows that is what
the RTL did, so the behaviour there is unchanged. Without this, on POSIX the
current key became "Sessions/", matched no section, and no stored site
loaded.

* Hand neon a copy of the TLS-init closure, not its two pointers

SetNeonTlsInit stores the closure in the neon session by reinterpreting it
as a TMethod and saving its code and data pointers, and ne_init_ssl_session
rebuilds it with MakeMethod. That relies on a closure being exactly those
two pointers, which only Borland's __closure is; with any other closure type
the saved words are its internals, read from a by-value parameter that is
gone by the time neon calls back, and the rebuilt closure is garbage (a
clang build's first WebDAV-over-TLS connection crashed there). The session
now holds a heap copy of the closure, freed by neon's destroy-session hook
-- which also covers the sessions libs3 creates and destroys itself -- and
ne_init_ssl_session calls that copy. On C++Builder the behaviour is the
same, at the cost of one small allocation per session.

* Take CString's search results as const wchar_t *

CString::Find, ReverseFind and FindOneOf search the const string c_str()
returns and keep the result in a wchar_t *. ISO C++ declares wcschr,
wcsrchr, wcsstr and wcspbrk on a const string as returning const wchar_t *,
as MSVC's and newer mingw-w64 headers (llvm-mingw's) do, so the
initialisation does not compile there. The pointers are only compared and
subtracted: const is all they need.

* Index the string a string-list property returns, not the property

GetLocales takes a character of Exts->Strings[Index]. Under clang the
__declspec(property) standing for TStrings::Strings' __property reads a
second subscript as the property's own second index, so the expression is a
two-argument call to the getter and does not compile (parentheses do not
change that). Read into a UnicodeString first, the second subscript indexes
the string the property returns, as under C++Builder.

---------

Co-authored-by: Eduardo Correia <ecorreia@apliant.com.br>
2026-10-20 16:01:54 +02:00
Martin Prikryl
1ffd65ce61 Avoid compiler warning
Source commit: dc224a69378f5503c29b494282f4e222fab0f446
2026-10-17 00:34:31 +02:00
Martin Prikryl
53f8213112 Moving abnormal program termination handling to reduce interface
Source commit: 528cf0238d2af829fcc8481bd2452e1ba2ef7832
2026-10-16 11:08:10 +02:00
Martin Prikryl
05616dc742 Fixing stacktrace collection for abnormal program termination for 64-bit build
Source commit: d211d0525413d5b9a06ea25c788fa3d1377c68f3
2026-10-13 00:35:57 +02:00
Martin Prikryl
aaae9dcb51 Allowing to report abnormal program terminations + Handling all types of exceptions
Source commit: 469bb8038a53cf2510d92222e66351ba3c6c4a66
2026-10-10 00:36:12 +02:00
Martin Prikryl
8526f3abad Bug fix: System context menus always show in dark mode
Source commit: 1a3891cbab7a71c19b9d8ebdea444f5972abe15a
2026-09-30 00:35:13 +02:00
Martin Prikryl
018c4f46c9 Issue 2462 – Fix crashes or unexpected behaviour when user saves a site and a workspace with the same name
https://winscp.net/tracker/2462

Source commit: 3a22f95c30ceef8713a7b992eb2b8fc49c72444a
2026-09-25 00:36:08 +02:00
Martin Prikryl
7e0360edc3 Issue 2457 – When selecting a site to perform a command-line operation with, it was possible to select a workspace or a folder, resulting in unexpected behaviour or failure (2nd after c595d52f, now for download URLs)
https://winscp.net/tracker/2457

Source commit: 9621a1cd439031b65a328a81cbfc1cfd49956c6f
2026-09-24 00:48:03 +02:00
Martin Prikryl
e42c1ba59f Fixing assertion and updating comment obsoleted by 777aa221
Source commit: b0ab32a91690074c2c034520c9a93dfc954e4f07
2026-09-12 07:41:05 +02:00
Martin Prikryl
777aa22159 Improving placement of widows, particularly those opened, while the main window is not visible (notably during command-line operations)
Source commit: 307d5b671223917e4a9d7a31aaefd5987c173c1b
2026-09-12 00:36:44 +02:00
Martin Prikryl
a9cb6dae98 Issue 2458 – After opening session in PuTTY, WinSCP process is never closed
https://winscp.net/tracker/2458

Source commit: 4149590f72e208c8d14dd424fb6a387d0cf7f963
2026-09-09 00:36:19 +02:00
Martin Prikryl
d2189bd4d4 Issue 2459 – Optionally default to keeping Login dialog open after opening session in PuTTY
https://winscp.net/tracker/2459

Source commit: 35d501ac3a022a0f28b1968b49131d12d45c6559
2026-09-09 00:35:31 +02:00
Martin Prikryl
c595d52fb8 Issue 2457 – When selecting a site to perform a command-line operation with, it was possible to select a workspace or a folder, resulting in unexpected behaviour or failure
https://winscp.net/tracker/2457

Source commit: 4ba24fc7f915728e77c9ec86acceae1932dd58fd
2026-09-08 00:39:39 +02:00
Martin Prikryl
0e7cea84e5 Loading package API (from 648b6c0a) dynamically to restore Windows 7 compatibility
Source commit: 8014fd3d5ddf35292cf1a0f6c0cfb4f07a563048
2026-09-03 00:34:41 +02:00
Martin Prikryl
d47792f01c Issue 2455 – Some strings use incorrect translation in 64-bit version
https://winscp.net/tracker/2455

Some related refactoring:
Refactoring php release script includes
Reusing complete_translations in copy_complete_translations.php
Removing obsolete maketran.bat hack

Source commit: 07476ec822e4bd7b8b1c65ceb9783b6d92f20489
2026-09-01 12:53:54 +02:00
Martin Prikryl
af008086c7 Empty line
Source commit: d501e61140d4c41382648f65064e274d78737764
2026-08-26 00:42:27 +02:00
Martin Prikryl
7221bf08e3 Bug fix: 64-bit build did not identify its system to be 64-bit, what among other prevented it from identifying 64-bit COM registrations
Source commit: dd523846faab989b5bc6d69066da6cde6daa5dbb
2026-08-21 16:10:16 +02:00
Martin Prikryl
1f8dc7a31e Some parts of GUI (panel headers, scrollbars, buttons, checkboxes) show in dark theme even when system-wide app theme is light + On Windows 11, using system dark tab theme, that uses different shades for active and disabled/disconnected tabs (Issue 2452)
https://winscp.net/tracker/2452

Source commit: ac0cd81a2b667fb01888cd9df7ff85232d39c489
2026-08-21 01:31:30 +02:00
Martin Prikryl
12afd2dca4 Switching to SHGetKnownFolderPath API
Source commit: 238a0941721e97531504513efaeb74dae9b23584
2026-08-02 13:17:22 +02:00
Martin Prikryl
648b6c0a97 Resolving version of pwsh installed with MSIX
Source commit: c40566cc3ef7398359718b7a2cd50d709e844544
2026-07-24 17:20:41 +02:00
Martin Prikryl
4e322475f1 Bug fix: No error is shown when connection fails
Caused by Issue 2360 (4057c84b)

Source commit: 9457f3d6a205a1df42bcecdbbea18354be6e1a60
2026-06-26 01:00:40 +02:00
Martin Prikryl
1636165e08 Warning when pasting a session URL with unsafe settings
Source commit: a6a8ab80fab4384666d8f4835e7f5fefb91c4aa9
2026-06-10 16:10:38 +02:00
Martin Prikryl
3a2f4913c6 Merging DefaultsOnly and ProtocolDefined parameters
Source commit: 0d19541f3856ea463616237e3df15d99c721ad5d
2026-06-10 01:40:13 +02:00
Martin Prikryl
5d5dd888a4 Issue 2443 – Message boxes from secondary windows (like the internal editor) caused application to move to the background when when the main window was minimized
https://winscp.net/tracker/2443

Source commit: 7e4d41de3b099802ec2f4b64d7d7e9dc7d71af6b
2026-06-10 01:31:36 +02:00
Martin Prikryl
4057c84bfa Issue 2360 – Optionally do not show error message when connection is lost while idle
https://winscp.net/tracker/2360

Source commit: f4e51fcf1f07202811e4c5f9d2c5f3e777f71e33
2026-05-29 00:58:33 +02:00
Martin Prikryl
941ce4e50e Issue 2440 – When opening session in PuTTY to a host for which WinSCP has multiple hostkeys cached, use the last key or the key that PuTTY has cached
https://winscp.net/tracker/2440

Source commit: 7a596711a8c49cb70687679fe72aec92159ddf6e
2026-05-19 00:59:46 +02:00
Martin Prikryl
b46020f057 Platform counter
Source commit: fa619664d58dfdc27f54c31cb7dd97650457f2dd
2026-05-14 01:04:53 +02:00
Martin Prikryl
327d867495 Issue 2437 – Configurable warning when opening large file in an internal editor
https://winscp.net/tracker/2437

Source commit: 74bdbd0d32c1416c24f384dfc02cc257cc68da14
2026-05-13 01:11:17 +02:00
Martin Prikryl
36b9c3c902 Issue 2439 – Informing that when preserving directory timestamps is enabled, using multiple connections for transfer is not possible
https://winscp.net/tracker/2439

Source commit: e035ac9aaa1873ebf834b022b3a8cce8fcea668f
2026-05-13 01:08:14 +02:00
Martin Prikryl
d725f98ec4 Issue 618 – Experimental 64-bit version of WinSCP
https://winscp.net/tracker/618

Source commit: 329fb51d696db6c1d37d5c5240ff253af0df941b
2026-05-11 18:39:51 +02:00
Martin Prikryl
4e67ea8211 Not calling JclHookExceptions + Reusing thread handle
JclHookExceptions: It's not needed and on 64-bit it fails and prevents the rest of the exception handling from initializing

Source commit: 64bf493e8e4d9565e1930048c41b97599993d32a
2026-04-29 00:58:48 +02:00
Martin Prikryl
d1bb298c70 Merge branch 'master' into dev
# Conflicts:
#	source/core/Common.cpp
#	source/core/Http.cpp
#	source/core/PuttyIntf.cpp

Source commit: 1ebaa60a257791f90bbc04243bd8a6a7696546de
2026-04-28 07:06:11 +02:00
Martin Prikryl
7c12dd55b9 Link update
Source commit: a8802c55f52745f136a4f28c6d23555d13bb52a1
2026-04-28 07:03:23 +02:00
Martin Prikryl
a1589d1d56 Reading all system settings from 64-bit registry and explicitly using 32-bit registry for own settings for forward compatibility with future 64-bit build
https://winscp.net/tracker/618

Source commit: 752a9de02690c8b6444bea0eb333bab8a3051ee0
2026-04-25 11:43:53 +02:00
Martin Prikryl
74794abfcb Types and casts safe in respect to handle size for forward 64-bit compatibility (3rd after bdc1aefa)
https://winscp.net/tracker/618

Source commit: eee90f0247240b68ff48d15ff5dfd3fc851efb2b
2026-04-24 10:12:22 +02:00
Martin Prikryl
d843cab082 Adding more startup sequence counter steps (Y, Q, V, Z, a) around F
(previous steps added in aee26917)

Source commit: b93e0f99f5dfce22f9bb9e1451ba11040ad05355
2026-04-04 01:24:19 +02:00
Martin Prikryl
bdc1aefa86 Types and casts safe in respect to pointer size for forward 64-bit compatibility (2nd after a2119a7e)
https://winscp.net/tracker/618

Source commit: c34c42432b77f29fc4e5f6824021c9d282a19525
2026-03-28 01:12:40 +01:00
Martin Prikryl
3aeab26186 Bug fix: Master password dialog was missing Help button
Caused by 1413e93a

Source commit: 2d66178b23d7e0c33d91023ae86d590cb9c48ae6
2026-03-06 01:13:16 +01:00
Martin Prikryl
c3b66b79c7 Unused variable
Source commit: 6ee7054ce95c10b7b226bfe50bcffaad9c0e59cc
2026-02-28 01:12:35 +01:00
Martin Prikryl
4136d3e545 Bug fix: Protocol additional information scrolling was broken
Caused by 3a887624

Implementing handy functions for managing internal components

Source commit: 701335de9b626f7f96daa34a4dc4f2dff10461f9
2026-02-27 01:19:15 +01:00
Martin Prikryl
ce7ddcbe68 Issue 1026 – Optionally connect all workspace/folder sessions immediately + Bug fix: Failure when switching to a session that is being reconnected
https://winscp.net/tracker/1026

Source commit: 2f0f402b0866803d9e5d9edc22912c0c4257ddfb
2026-02-12 07:37:36 +01:00
Martin Prikryl
8b438ccd30 Refactoring
Source commit: ccadcd5e989d237f44bf93203541a0cc0b7f3019
2026-02-04 19:42:06 +01:00
Martin Prikryl
a2119a7eac Types and casts safe in respect to pointer size for forward 64-bit compatibility
Also GetWindowLongPtr and GWLP_USERDATA

https://winscp.net/tracker/618

Source commit: c85fdf15e50ce8a6f35b1c4d2a0125a0b9c4f1f0
2026-01-22 14:51:13 +01:00
Martin Prikryl
efe94d6c08 Using actual types and functions instead of WinAPI and Unicode/Ansi macros
Source commit: b7fec4d069296b58bb43e7a4a97dd85d558212b7
2025-12-21 01:34:21 +01:00
Martin Prikryl
63a9eb579a Getting rid of MFC string loading code
Source commit: 3c7399548535aeb9ebb738e2fdde52431d0ba83f
2025-12-19 07:35:02 +01:00
Martin Prikryl
e5efed8955 Refactoring old-style casts
Source commit: 3c37b3a958525c595ad44b081b2e0f3b288b8eb0
2025-12-18 01:20:33 +01:00
Martin Prikryl
a5dcb5f03c Using std::size instead of custom macro
Source commit: 1a89c80dd42426351f261526b617534bab664208
2025-12-07 01:17:54 +01:00
Martin Prikryl
c9ac0c1915 Removed obsolete "Preserve remote timestamp" session settings and other XP compatibility code
Source commit: 7cd7f54aae69fd36ea89a8d9ed043fc509bca5e3
2025-12-05 01:33:47 +01:00
Martin Prikryl
86b35a6a39 Introduced C++ shell around some heavy Pascal classes to allow their gradual reimplementation to C++
UNICODE define added everywhere (except Putty, which in Ansi code) to make sure A/W suffixes are added consistently across the code

CreateDirectory renamed to avoid problems with being interpreted as CreateDirectoryW in C++ code and CreateDirectory in Pascal code (being also a function in WinAPI)

Source commit: b8d27b5097829c42f853b629e57aebaaab066b9e
2025-12-05 01:29:29 +01:00
Martin Prikryl
9bf5c52653 Issue 2413 – Message box texts and some control labels are not visible to screen readers + Improving order in which Windows Narrator reads window controls
https://winscp.net/tracker/2413

Source commit: 3d48f7f62c1879f32c0fe2df0f023f17f3847949
2025-11-28 11:15:42 +01:00