The VCL Fix Pack is a Delphi unit that fixes VCL and RTL bugs at runtime by patching the original functions. If you want all IDE Fix Pack fixes in your application this unit is what you are looking for. Adding the unit to your project (Delphi and C++Builder) automatically installs the patches that are available for your Delphi/C++Builder version.
Here is the list of runtime-patches that the VCLFixPack.pas unit applies depending on the Delphi version you use.
- QC #74646: Buffer overflow in TCustomClientDataSet.DataConvert with ftWideString (2006-2009)
- QC #7393: App with no main form showing a form with hints freezes (6-2009)
- QC #68647: Infinite loop in Forms.GetNonToolWindowPopupParent (2006-2009 1.2)
- QC #68740: Lost focus after TOpenDialog when MainFormOnTaskBar is set (2007-2009 1.2)
- QC #59963: Closing non-modal forms after a task switch can deactivate the application (2005-2009)
- QC #66892: Closing forms deactivates the application (missing “stdcall”) (2009 1.2)
- Control resize bugfix for kernel stack overflow due to WH_CALLWNDPROC hook (6-2007)
- QC #59654: TActionList access already released FActions field (6-2007)
- QC #54286 : Parent-PopupMenu overrides standard context menu (edit, memo, combobox, …) (6-2007)
- QC #50097: ObjAuto access violation on XEON (Data Execution Prevention bug) (2006-2007)
- Classes.MakeObjectInstance memory leak fix (for usage in a DLL) (6-2009)
- QC #58938: MainForm Minimize minimizes in the background (2007)
- QC #64484: SysUtils.Abort can raise an AccessViolation (6-2009 1.2)
- QC #58939: No taskbar button when starting from ShellLink with Show=Minimized (2007)
- QC #35001: MDIChild’s active control focus is not set correctly (6-2009 .12)
- QC #56252: TPageControl flickers a lot with active theming (7-2009)
- QC #68730: TLabel is not painted on a themed, double-buffered TTabSheet in Vista (7-2009)
- TLabels on TTabSheet are not painted (themes) if a TWinControl like TMemo is on the TTabSheet (TWinControl.PaintWindow bug) (7-2009)
- Grid flickers with active theming (DBGrid, StringGrid and DrawGrid only, no derived classes) (7-2009)
- QC #69112: TSpeedButton is painted as a black rectangle on a double buffered panel on a sheet of glass. (2009)
- QC #69294: TProgressBar fails with PBS_MARQUEE and disabled Themes (Vista)
- Workaround for Windows Vista CompareString bug (Workaround is disabled by default, define “VistaCompareStringFix” to activate it) (Vista)
- QC #69294: TProgressBar fails with PBS_MARQUEE and disabled Themes (Vista)
- QC #52439: DbNavigator paints incorrectly when flat=true in themed mode (2007-2009)
- QC #70441: ToUpper and ToLower modify a Const argument (2009 1.2)
- QC #69752: ToUpper and ToLower with NullString (2009 .12)
- QC #67564, QC #69875: StringBuilder.Replace is incorrect (2009)
Usage:
Add the VCLFixPack.pas unit to your Delphi or C++Project project. C++Builder will automatically call the Delphi compiler for the unit.
License:
Mozilla Public License Version 1.1
Download:
Name | IDE Version | File | Size | Downloads | Added |
---|---|---|---|---|---|
VCL Fix Pack 1.2 | 6-2009 | VCLFixPack12.zip | 19.89 KB | 6043 times | 2009-03-03 |
VCL Fix Pack 1.3 | 2009.3 | VCLFixPack13.zip | 21.11 KB | 2701 times | 2009-05-30 |
VCL Fix Pack 1.4 | 6-2009.3 | VCLFixPack14.zip | 21.7 KB | 16376 times | 2009-09-03 |
Fix for QC 90511 (Atom leak) | 6-XE | ControlsAtomFix1.7z | 3.78 KB | 3752 times | 2014-04-18 |
Changelog from 1.3 to 1.4:
- Added: QC #74646: Buffer overflow in TCustomClientDataSet.DataConvert with ftWideString
- Fixed: TTabSheet looked strange if used with SilverThemes
Changelog from 1.2 to 1.3:
- Changed: Disabled all patches that are fixed by Delphi 2009 Update 3
- Added: QC #7393: App with no main form showing a form with hints freezes
Changelog from 1.1 to 1.2:
- Fixed: Rewritten patch for QC #59963 (AppDeActivateZOrderFix) to fix the cause instead of the symptom
- Added: QC #52439: DbNavigator paints incorrectly when flat=true in themed mode
- Added: QC #70441: ToUpper and ToLower modify a Const argument
- Added: QC #69752: ToUpper and ToLower with NullString
- Added: QC #69875, #67564: StringBuilder.Replace is incorrect + a much faster implementation
Changelog from 1.0 to 1.1:
- Fixed: DBGrid ScrollBar gab wasn’t painted correctly in BiDiMode <> bdLeftToRight
- Fixed: TTabSheet could throw an access violation if no PageControl was assigned to it
- Changed: Rewritten TaskModalDialog bugfix
- Added: QC #69294: TProgressBar fails with PBS_MARQUEE and disabled Themes (Vista)
The VCL Fix Pack superseeds the following CodeCentral items
- TaskModalDialog focus bug fix unit (Delphi/C++Builder 2007 and 2009)
- Control resize bugfix unit for the WH_CALLWNDPROC issue (fixed in Delphi 2009)
- MakeObjectInstance memory leak fix (Delphi/C++Builder 5-2009)
- Fix for ObjAuto DEP issue (fixed in Delphi 2009)
- Context menu popup delay bug fix unit (fixed in Delphi 2009)
Hello Andreas,
with VCLFixPack, is there any need for TaskModalBugFix and AppDeActivateZOrderFix ? For Delphi 2007, do we need any longer ContextMenuBugFix and ControlResizeBugFix and MkObjInstLeakFix and RTLVCLOptimize ? For Delphi 2009, do we need HideStackTrashingFix ?
Were all of these Fixes included in VCLFixPack ?
VCL Fix Pack contains all those units, except the RTLVCLOptimize unit which is not a bugfix unit.
Wow! Excellent! This is especially useful for users who are using the old versions of Delphi that will not be updated anymore.
Edwin.
Hi Andreas,
Thank you very much for this great work. I don’t understand why CodeGear/Embarcadero has not yet implemented these code fix… It will stay a mystery.
CodeGear should give you a big big reward!
Hi Andreas,
could you please post the roadmap of it?
I have made some patches for VCL as well.
http://stanleyxu2005.blogspot.com/search/label/vcl%20patches
Stanley
A roadmap? I don’t know if a roadmap for such a project makes sense because there is no aim to reach.
Hi Andreas,
I habe some additional fixes for your unit. The source can be found in QC!
//http://qc.codegear.com/wc/qcmain.aspx?d=3199
//http://qc.codegear.com/wc/qcmain.aspx?d=34049
//http://qc.codegear.com/wc/qcmain.aspx?d=34089
CodeRedirect(GetActualAddr(Getllmulo), @__llmulo);
//http://qc.codegear.com/wc/qcmain.aspx?d=34058
CodeRedirect(GetActualAddr(Getllushr), @__llushr);
//http://qc.codegear.com/wc/qcmain.aspx?d=34057
//CodeRedirect(GetActualAddr(Getllshr), @__llshr);
//http://qc.codegear.com/wc/qcmain.aspx?d=34056
CodeRedirect(GetActualAddr(Getllshl), @__llshl);
//http://qc.codegear.com/wc/qcmain.aspx?d=34055
CodeRedirect(GetActualAddr(Getllumod), @__llumod);
//http://qc.codegear.com/wc/qcmain.aspx?d=34050
CodeRedirect(GetActualAddr(Getlldiv), @__lldiv);
//http://qc.codegear.com/wc/qcmain.aspx?d=34048
CodeRedirect(GetActualAddr(Getllmul), @__llmul);
//http://qc.codegear.com/wc/qcmain.aspx?d=34054
//__llmodo replaced by __llmod
CodeRedirect(GetActualAddr(Getllmodo), GetActualAddr(Getllmod));
//http://qc.codegear.com/wc/qcmain.aspx?d=41866
CodeRedirect(@StrUtils.StuffString, @StuffString);
//http://qc.codegear.com/wc/qcmain.aspx?d=41553
CodeRedirect(@StrUtils.DupeString, @DupeString);
//http://qc.codegear.com/wc/qcmain.aspx?d=41288
CodeRedirect(@SysUtils.DecodeDateFully, @DecodeDateFully);
//http://qc.codegear.com/wc/qcmain.aspx?d=40715
CodeRedirect(@SysUtils.IsLeapYear, @IsLeapYear);
//http://qc.codegear.com/wc/qcmain.aspx?d=30231
CodeRedirect(@Math.ArcCscH, @ArcCscH);
What about a new name scheme?
Fixes:
IDE Fix Pack
VCL Fix Pack
Optimizations:
IDE Speed Pack (a.k.a. DelphiSpeedUp)
VCL Speed Pack (a.k.a. RtlVclOptimize)
Amazing work Andreas!!!
I wonder if this bug might be a good candidate for the next VCL Fix Pack:
“LowerCase() and UpperCase() functions in AnsiStrings unit do not set proper codepage”
http://qc.codegear.com/wc/qcmain.aspx?d=67686
I just got rid of a hard-to-find bug by not using UpperCase() in Delphi 2009 + BlackFish SQL–funny thing, I was using Unicode (the bug report is for AnsiString). Maybe the same problem exists for both AnsiString and Unicode.
Andy, do you can fix the bug DbNavigator paints incorrectly when flat=true in themed mode?
http://qc.codegear.com/wc/qcmain.aspx?d=52439
Hello Andreas,
Thank you for your great work. But when I write programs with your VCL-Fix Pack, my programs became about 300k bigger than before. Why not providing the pas directly to fix it?
I provide the *.pas file. Or do you mean that I should violate the license and publish the fixed RTL and VCL units? This would also cause problems with future Delphi/C++Builder updates where the update tool will revert the update or doesn’t allow to install the update because the installed files do not match the CRC of the installed files.
Hello Andreas,
Thank you very much for this great work, please get a job at CodeGear !.
@Seefall
I had the same increase here.
Disabled the following two defines what fixed this major increase in my case:
{.$DEFINE VCLFIXPACK_DB_SUPPORT}
{.$DEFINE GridFlickerFix}
Works superb now!
Hi Andreas again,
Your patch unit looks great.
I (maybe other guys) would be glad to contribute something to fix VCL issues as well.
Could you please write some technical articles about Delphi Patching?
Best regards and happy new year ^^)
stanley
Hi Andreas,
Thank you for making this available! This solved a problem in my code related to the control resizing bug that only seemed to happen in Vista 64. Great job!! Have a safe and happy New Year!
-Mark
Cool
The fix for “WH_CALLWNDPROC hook (6-2007)” have a problem with the DevExpress Bars Ribbons.
When you minimize a maximized Application – with Ribbon on MDIForm and a maximized MDIChildrn – and restore it,
the aligment doesn’t work correct. Without your patch, everything is Ok.
Any ideas?
Ronald
I don’t have the DevExpress components so I can’t test this. But if a control is based on the assumption that an endless resizing recursion fixes the alignment, it will be broken because the new align control code aborts the (now) endless loop that isn’t catched by the kernel stack overflow.
Delphi 2009 also uses the this code (even my comments are in the Controls.pas).
Hi Andreas,
I was wondering what the status of OPTIMIZED_RESIZE_REDRAW is. Has anyone run into any problems with it? I’ve enabled it in a few of my test programs and haven’t seen any problems yet. Is this the right place to ask? Thanks again for this! I recently noticed QC #59963 in one of my programs and the VCLFixPack solved my problem!
-Mark
Hi Andreas,
Does the unit add around 400kB to the size of the compiled executable or am I doing something wrong?
Thanks anyway for the fixes,
Stefan
The unit itself doesn’t add the 400 KB to your project but the units that it patches are now part of your project. For example if your project doesn’t use database units (DBGrids, DBCtrls) then it now uses it. But you can tell VclFixPack to not patch those units by removing the “{$DEFINE VCLFIXPACK_DB_SUPPORT}” condition in the VclFixPack.pas.
Thanks very much for these fixes!
I don’t know if you’re considering any requests, but if you could generate patches for the various problems with 2009’s TDictionary (e.g. QCs 67620, 67558, 68234)
I can’t patch TDictionary. Everything that includes generics can’t be patched without altering the unit code itself what will cause interface changes and leads to the “unit xy was compiled with a different version of ab” compiler error.
Andreas, strange thing happens while trying to open
http://cc.embarcadero.com/Item/25239
and
http://cc.embarcadero.com/item/26282
also for #59963 it is said “Sorry, you don’t have access to this submission.”
My main reason was to read about bug #59963 more thoroughly, as I think I have the similar case of out-of-order modal windows not shown above all windows of my application.
Could you give me advice how to apply more information about it. Thanks for attention.
The CodeCentral items 25239 and 26282 are superseded by the VCLFixPack and I have deleted them, especially because their implementation was overhauled in the VCLFixPack and I haven’t updated them.
For the Quality Central report #59963 you can use this link:
http://qc.embarcadero.com/wc/qcmain.aspx?d=59963
Hi Andreas,
Do these fixes work for applications that use run-time packages?
Also, do they include a fix for the ValidateTimeStamp function that causes the dreaded ‘0.0 is not a valid timestamp’ error when querying certain tables using the BDE?
> Do these fixes work for applications that use run-time packages?
Yes.
> Also, do they include a fix for the ValidateTimeStamp function
Not in the list, so it is not fixed.
Thanks for the info.
Hi Andy,
Thanks for VCLFixPack! I use it in all my Delphi 2009 projects.
I came across a post about a Delphi 2009 memory corruption bug in TDictionary.TPairEnumerator.MoveNext
Just mentioning in case you were looking another challenge for the next VCLFixPack.
The post and code snippet was found here (it turned out to have nothing to do with Eurekalog):
http://news.eurekalog.com/showthread.php?t=2311
Copy&Paste from a comment by me:
I can’t patch TDictionary. Everything that includes generics can’t be patched without altering the unit code itself what will cause interface changes and leads to the “unit xy was compiled with a different version of ab” compiler error.
First, thanks for your excellent work.
Second, are you aware about this patch, based on your VCLFixPack: D7DoubleBufferedThemeFix? The patch solves the double-buffering problems at least for Delphi 7 and XP themes. I’ve found it here:
http://www.delphi-forum.de/viewtopic.php?p=550121?&sid=d8208a89cd7356a39ed56e776ce7acd9
(you have to register in order to download the file).
I’ve tried it and it worked after I applied the following procedure to the form:
procedure SetDoubleBufferedDeep(WinControl: TWinControl);
var
I: Integer;
begin
WinControl.DoubleBuffered := True;
for I := 0 to WinControl.ControlCount – 1 do
begin
if WinControl.Controls[I] is TWinControl then
SetDoubleBufferedDeep(TWinControl(WinControl.Controls[I]));
end;
end;
Maybe you decide to include this fix to your VCLFixPack.
Hi Andreas,
I’m noticing that the new improved fix for the z-order issue seems to not work all the time for me. The situation is where my program puts up a modal form while the main form is behind another application. I click on the modal form, bringing it to the front, and close it. The main form is now (usually?) behind the other application instead of in front of it. I didn’t notice this issue with the 1.1 version. This is on my 32bit XP SP3 system by the way. I just thought I’d mention it and also how much I appreciate your fantastic work and the fact that you make this publicly available!
-MarkF
Hi there,
when I use your FixPack with Advantage Local Server v9.1, it somehow blocks the password property I set to its TAdsConnection and the user must manually enter it.
That problem only exists as long as the VCLFIXPACK_DB_SUPPORT define is set.
I just thought I’d mention it.
Are you sure that it is the VCLFIXPACK_DB_SUPPORT define? Because this only patches the TDBGrid.WMEraseBkGnd method (flicker reduction) and the TDBNavigator.SetFlat method (ControlStyle:=ControlStyle+/-[csOpace]). So only visual things.
It also adds DBGrids and DBCtrls to the uses clause and that may change the order of unit initialization.
Yes, I just reconfirmed it.
Compiled with the define active – app asked for the password.
Compiled without the define – worked without any problems.
As I don’t need those changes in the FixPack, I don’t really care about that behaviour. Just thought every “bug” (on whichever side it is) should be reported. 🙂
Oh and I’m using D2009.
Hi Andreas,
First of all, thanks for releasing this.
I noticed the following issue since we installed the VCLFixPack.
I have a panel aligned alLeft, that is anchored [ akLeft, akTop, akBottom ]. It is beside a splitter and another panel.
At run time, my panel (on the left) doesn’t respect the akBottom value.
As soon as something gets resized (the splitter beside it or the form being resized) then my panel is repainted with the akBottom correctly .
If I also include akRight at design time, the akBottom is respected but I do not want it anchored to the right. Somehow, the VCLFixPack gets rid of my akBottom value, when the program loads.
Sorry, I should specify, the control I am having an issue here is not the panel but the TTreeView that’s on it.
Thanks.
Oh and I’m using Delphi 2007.
When the panel it sits on has akRight, the TreeView (which is alClient [ akLeft, akTop, akRight, akBottom ] stretches as it should. So it seems to be the parent panel that is affecting the child treeview.
By adding the following code on the form show, I get around the issue.
procedure TMyForm.FormShow(Sender: TObject);
begin
// We need the combination of the following 2 lines:
MyTreeView.Align := alLeft; // Should really be alClient as in design time but doesn’t work
//if set to alClient
MyTreeView.Anchors := [ akLeft, akTop, akRight, akBottom ];
…
end;
Can you fix this ?
http://qc.embarcadero.com/wc/qcmain.aspx?d=69856
Are all of these included? http://www.automatedqa.com/support/leaks/leaksd7/
I’ve fixed this one very annoying QC #67729: Converting Array of String to Variant fails
*** C:\VCLFixPack.pas 2009-03-03 23:07:24.000000000 -0700
— R:\VCLFixPack.pas 2009-05-26 19:32:02.000000000 -0700
***************
*** 132,144 ****
— 132,148 —-
QC #69752: ToUpper and ToLower with NullString
– [2009]
QC #69875: StringBuilder.Replace is incorrect
QC #67564: Error in TStringBuilder.Replace
+ – [2009]
+ QC #67729: Converting Array of String to Variant fails
+ (http://qc.embarcadero.com/wc/qcmain.aspx?d=67729)
+
Changlog:
2009-03-03:
Fixed: Rewritten patch for QC #59963 (AppDeActivateZOrderFix) to fix the cause instead of the symptom
Added: QC #52439: DbNavigator paints incorrectly when flat=true in themed mode
Added: QC #70441: ToUpper and ToLower modify a Const argument
Added: QC #69752: ToUpper and ToLower with NullString
***************
*** 236,247 ****
— 240,255 —-
{$IF (CompilerVersion >= 18.5) and (CompilerVersion = 20.0}
Character,
{$IFEND}
{$IFDEF VCLFIXPACK_DB_SUPPORT}
DBGrids, DBCtrls,
{$ENDIF VCLFIXPACK_DB_SUPPORT}
+ {$IFDEF DynArrayVarTypeFix}
+ Variants,
+ {$ENDIF DynArrayVarTypeFix}
Graphics, Controls, Forms, Dialogs, StdCtrls, Grids, ComCtrls, Buttons,
CommCtrl;
{ —————————————————————————- }
{ Helper functions, shared }
type
***************
*** 2650,2661 ****
— 2661,2748 —-
VirtualFree(JumpTable, 0, MEM_RELEASE);
JumpTable := nil;
end;
end;
{$ENDIF VistaCompareStringFix}
{ —————————————————————————- }
+ { QC #67729: Converting Array of String to Variant fails }
+ {$IFDEF DynArrayVarTypeFix}
+ const
+ tkDynArray = 17;
+ var
+ DynArrayVarTypeHook: TXRedirCode;
+
+ function VariantsDynArrayVarType(typeInfo: PDynArrayTypeInfo): Integer;
+ begin
+ Result := varNull;
+ if (typeInfo nil) and (typeInfo.Kind = tkDynArray) then
+ begin
+ Inc(PAnsiChar(typeInfo), Length(typeInfo.name));
+ Result := typeInfo.varType;
+
+ { NOTE: DECL.H and SYSTEM.PAS have different values for varString }
+ if Result = $48 then
+ Result := varString;
+
+ if Result = $4A then
+ Result := varUString;
+ end;
+
+ { Validate the Result }
+ if (Result varInt64) and not ((Result = varString) or (Result = varUString))) then
+ VarCastError;
+ end;
+
+ function GetDynArrayVarTypeAddr : pointer;
+ var
+ P: PAnsiChar;
+ Len: Integer;
+ begin
+ P := GetActualAddr(@Variants.DynArrayToVariant);
+ Dec(P);
+ Len := 0;
+ while Len <= 80 do begin
+ if (P[0] = #$53) and // push ebx
+ (P[1] = #$BB) and // mov ebx, $00000001
+ (P[2] = #$01) and
+ (P[3] = #$00) and
+ (P[4] = #$00) and
+ (P[5] = #$00) and
+ (P[6] = #$85) and // test eax, eax
+ (P[7] = #$C0)
+ then begin
+ Result:= P;
+ Exit;
+ end;
+ Dec(P);
+ Inc(Len);
+ end;
+ Result:= nil;
+ end;
+
+ var
+ DynArrayVarTypeAddr : pointer;
+
+ procedure InitDynArrayVarTypeFix;
+ begin
+ DebugLog(‘DynArrayVarTypeFix’);
+ DynArrayVarTypeAddr:= GetDynArrayVarTypeAddr;
+ if DynArrayVarTypeAddr nil then
+ HookProc(DynArrayVarTypeAddr, @VariantsDynArrayVarType, DynArrayVarTypeHook);
+ end;
+
+ procedure FiniDynArrayVarTypeFix;
+ begin
+ if DynArrayVarTypeAddr nil then
+ UnhookProc(DynArrayVarTypeAddr, DynArrayVarTypeHook);
+ end;
+ {$ENDIF SysUtilsAbortFix}
+ { —————————————————————————- }
initialization
{$IFDEF GetNonToolWindowPopupParentFix}
FixGetNonToolWindowPopupParent;
{$ENDIF GetNonToolWindowPopupParentFix}
***************
*** 2737,2750 ****
— 2824,2845 —-
{$ENDIF StringBuilderFix}
{$IFDEF VistaCompareStringFix}
InitCompareStringFix;
{$ENDIF VistaCompareStringFix}
+ {$IFDEF DynArrayVarTypeFix}
+ InitDynArrayVarTypeFix;
+ {$ENDIF DynArrayVarTypeFix}
+
finalization
// In revers order
+
+ {$IFDEF DynArrayVarTypeFix}
+ FiniDynArrayVarTypeFix;
+ {$ENDIF DynArrayVarTypeFix}
{$IFDEF VistaCompareStringFix}
FiniCompareStringFix;
{$ENDIF VistaCompareStringFix}
{$IFDEF StringBuilderFix}
Looks like VistaProgressBarMarqueeFix
QC #69294: TProgressBar fails with PBS_MARQUEE and disabled Themes (Vista)
http://qc.codegear.com/wc/qcmain.aspx?d=69294
was fixed in Update3 and should be disabled in VCL Fix Pack.