Delphi and Win95
Borland Delphi (aka Borland Developer Studio, Turbo Delphi, etc.) cannot generate native Windows executables compatible with Windows 95 any more, since Borland has stopped support for those. Completely unnecessarily in my opinion, since it seems to be only about two statically linked functions that are not available in Windows 95. Now if Borland would support smart-linking like FreePascal does, applications that do not make use of the code that uses this functions would still run under Windows 95 - but Delphi doesn't support this.
While looking for workarounds, I came across Wine, the Open Source implementation of the Windows APIs to allow Windows applications to run under Linux and other OS, and ReactOS, the Operating System based on Wine and aiming to be compatible with Windows XP. ReactOS included the libraries missing in Windows 95 (we can't just take some from another Microsoft Windows version for licensing issues), but sadly, just taking two or three libraries out there and putting them into Windows 95 didn't work completely.
So if we can't get Windows 95 compatibility back using newer libraries, we need to get inside the Borland units. It was soon clear that the problematic functions were MsgWaitForMultipleObjectsEx and GradientFill. GradientFill is using only for gradients in some modern controls; if we just create those gradients on newer OS versions, no harm will be done, but the code will still run on Windows 95. For that, I went ahead and patched Windows.pas to dynamically load GradientFill instead. Next, the units using GradientFill, or better GradientFillCanvas which is the only place that uses GradientFill, need to be updated. A quick patch for me was to use GetVersionEx in the constructor of TToolbar in ComCtrls.pas to set a boolean, which would then be included in the conditions used to determine whether GradientFillCanvas should be used. An even better method would probably be to implement a Win95-compatible drawing routine inside GradientFillCanvas, because that would automatically support the other controls as well, but this was a quick fix near a release, there's time for improvements in future updates.
Two patches that do the described changes are available as
Delphi2006-WindowsPas-Win95compat.patch and
Delphi2006-ComCtrlsPas-Win95compat.patch. Please note that you need to remove the compiled versions of these two units, otherwise Delphi will never notice they have been changed! Making a copy of the original is also recommended of course.
