The Wiert Corner – irregular stream of stuff

Jeroen W. Pluimers on .NET, C#, Delphi, databases, and personal interests

  • My badges

  • Twitter Updates

  • My Flickr Stream

  • Pages

  • All categories

  • Enter your email address to subscribe to this blog and receive notifications of new posts by email.

    Join 1,862 other subscribers

Archive for the ‘Delphi’ Category

Delphi: A few notes on tracking down a use-after free related issue involving interfaces crashing inside System._IntfClear.

Posted by jpluimers on 2020/01/20

A few notes on tracking down a use-after free related issue involving interfaces.

The crash message is like this:

Project UseAfterFreeWithInterface.exe raised exception class $C0000005 with message 'access violation at 0x004106c0: read of address 0x80808088'.

Two things here:

An important note first

Basically any memory value in an exception starting with $8080 and sometimes even $80 should raise suspicion: it usually means a use-after-free case.

You see these errors with FastMM and not with the memory manager as [WayBack] delphi • View topic • Problem with FastMM and D7 explains:

Read the rest of this entry »

Posted in Conference Topics, Conferences, Delphi, Development, Event, Software Development | 8 Comments »

Tweaking4All.com – Topics – Delphi – How to change the font of a hint window

Posted by jpluimers on 2020/01/19

[WayBack] Tweaking4All.com – Topics – Delphi – How to change the font of a hint window: Delphi THintWindow are odd, as you cannot set the Vcl.Forms.HintWindowClass before uses it to initialise the hint window in the Application instance from the initialisation section in the Vcl.Forms unit.

The only way to change it is to:

  1. Set the HintWindowClass to a new class
  2. Toggle the state of Application.ShowHint

So the duplicate line below is no accident:

  HintWindowClass := TMyHintWindow;
  Application.ShowHint := not Application.ShowHint;
  Application.ShowHint := not Application.ShowHint;

References:

–jeroen

Posted in Delphi, Development, Software Development | Leave a Comment »

Drawbacks for separating TDS/TD32 symbol information in separate file for your Delphi applications? What about Visual Studio?

Posted by jpluimers on 2020/01/15

A while ago this interesting question came by: [WayBack] Delphi XE2 has got the Linking option “Place debug information in separate TDS file” … Does this have any adverse effects for Win32 Delphi executables? – Thomas Mueller (dummzeuch) – Google+

The answer is “no”.

By about mid 2018, the same holds for Visual Studio and PDB symbol information.

Delphi

Since long ago (I think about Delphi 2), the Delphi debugger understands TDS (historically also known as TD32) Turbo Debugger Symbol Information which can be either in the .EXE or in a separate .TDS file with the same name and directory as the .EXE.

Many other tools also know how to get the symbols from either place, see for instance TD32-TDS-SYMBOL-INFORMATION.

The advantage of keeping it in the EXE is that it is easier to ship to clients. Unless you do not want the clients to have it. Then it is easier to separate it in a file.

David Heffernan raises an important point though, as many people confuse these two topics:

  • the presence of Debug Symbols
  • the code generation of extra run-time checks and debug-assistance (like stack frames)

This is caused by both of the above usually being enabled in DEBUG mode and disabled in RELEASE mode.

However, nothing prevents you from generating the Debug Symbols in RELEASE mode, and they can highly help track down customer problems.

This is David’s comment:

There’s a common myth that “debug builds” perform worse than “release builds”.

Whether or not debug information is generated is completely independent from the performance of the code.

Visual Studio

For a long time, EXE files generated by Microsoft Tools could only include .DBG symbol information, but no .PDB symbol information.

[WayBack] executable – Embed .pdb debug symbol information into an .exe file in Visual Studio – Stack Overflow. Especially read the comments about:

–jeroen

Posted in Debugging, Delphi, Development, MAP Symbol Information, Software Development, TD32/TDS Symbol information | Leave a Comment »

Delphi Datasnap: How to know the name of the methods called by client in delphi datasnap server?

Posted by jpluimers on 2020/01/14

A great tip from [WayBack] Hi, need help regarding Datasnap. How to know the name of the methods called by client in delphi datasnap server? – sujansiddhi – Google+ that I needed a few months ago:

Walter Prins:

Inside TDSAuthenticationManager.OnUserAuthorize, inspect the EventObject.MethodAlias property. (Obviously once the method is actually called you implicitly know the methodname.)

This was introduced in Delphi XE:

–jeroen

Posted in Delphi, Development, Software Development | Leave a Comment »

Getting the up to date project source code from the IDE – Dave’s Development Blog

Posted by jpluimers on 2020/01/09

For my link archive: [WayBackGetting the up to date project source code from the IDE – Dave’s Development Blog

It shows how to “using the IDE’s live files and if the IDE hasn’t got a file open, the file from disk”.

This gives you the same view the compiler in the IDE has.

Via [WayBack] Getting the up to date project source code from the IDE – David Hoyle – Google+

–jeroen

Posted in Delphi, Development, Software Development | Leave a Comment »

TFreedObject in FastMM4/FastMM4.pas at master · pleriche/FastMM4 · GitHub

Posted by jpluimers on 2020/01/08

Reminder to Self:

  {The class used to catch attempts to execute a virtual method of a freed
   object}
  TFreedObject = class
  public
    procedure GetVirtualMethodIndex;
    procedure VirtualMethodError;
{$ifdef CatchUseOfFreedInterfaces}
    procedure InterfaceError;
{$endif}
  end;

If you encounter the class TFreedObject when doing a cast, then you’re working on a freed object and have FastMM4 enabled to detect that.

Source: [WayBackFastMM4/FastMM4.pas at master · pleriche/FastMM4 · GitHub; FastMM4 – A memory manager for Delphi and C++ Builder with powerful debugging facilities

Note that if you want to see the underlying FastMM data for any TObject allocation, use this watch (where Self is the current instance):

PFullDebugBlockHeader(PByte(Self) - SizeOf(TFullDebugBlockHeader))^

You can also put a ,r behind it to see the fields of this structure:

(Reserved1:nil; Reserved2:nil; AllocatedByRoutine:$41BF74; AllocationGroup:0; 
AllocationNumber:592682; 
AllocationStackTrace:(4224198, 4233131, 4235210, 11103806, 6552132, 131126, 6597961, 11106984, 4235210, 11107153, 11104090); 
AllocatedByThread:90428; FreedByThread:90428; 
FreeStackTrace:(4241541, 131126, 4235210, 11103806, 6552132, 131126, 6597961, 11106984, 4235210, 11107153, 11104090); 
UserSize:36; PreviouslyUsedByClass:132272; HeaderCheckSum:2673350594)

–jeroen

Posted in Conference Topics, Conferences, Delphi, Development, Event, Software Development | Leave a Comment »

VCL FadingEffect by Paul Toth at GitHub

Posted by jpluimers on 2020/01/07

In case I ever need a fading effect between 2 panels on one form, there is some code that will get me started.

I’d probably code it in a different design (without a global variable), but it works so can be a good source of ideas.

Source: Delphi/FadingEffect at master · tothpaul/Delphi · GitHub

Via: [WayBack] VCL Tiny demo of a Fading effect for Delphi Tokyo  – Paul TOTH – Google+

–jeroen

Read the rest of this entry »

Posted in Delphi, Development, Software Development | Leave a Comment »

Im memoriam: Rudy Velthuis

Posted by jpluimers on 2020/01/05

Given that I’m fighting rectal cancer and am extremely low on energy, I am keeping this much shorter than I want to.

Recently, I learned that Rudy Velthuis passed away on 2019-05-13. Born on 1960-10-30, he passed away at only age 58.

After asking permission from his family, I wrote a small im memoriam.

We frequently encountered each other on-line in the Delphi community, especially in the early days when I was way more active on forums, newsgroups and chat channels. He was famous there, with good reason.

Though colloquially known as [WayBack“dentist with a strong interest in programming”, he was a great Delphi programmer and very well known for thoroughly documenting the many gaps that Embarcadero left in their documentation.

In 2009, Edwin van der Kraan and I had an opportunity to have dinner with Rudy. We met at his house, where we learned he not only ran a fully fledged dentistry practice, but also was married someone who origilally was from the Philippines. A truly happy couple they were.

In retrospect, I wish we had had met in real life more often, but I’m learning the hard way that life is finite giving you only so much time to do things.

I will remember Rudy because of his knowledge, wit and odd – but great – combination of work and interests.

In the mean time, I have asked a few archival organisations (including the WayBack machine) to archive his sites:

Some of his profiles that I archived on 20190103:

I love the “Kraftwerk – Autobahn” picture on his Stack Overflow profile page, so I included that song below the fold.

Related:

–jeroen

Read the rest of this entry »

Posted in About, Delphi, Development, History, Personal, Software Development | 4 Comments »

Delphi Programming Blog (by Shaun Roselt): Delphi Communties on: WhatsApp, Telegram, Google+, Facebook

Posted by jpluimers on 2020/01/02

From a while ago by a young (then ~18, now around ~20) enthusiastic Delphi programmer: [WayBackDelphi Programming Blog (by Shaun Roselt): Delphi Communties on: WhatsApp, Telegram, Google+, Facebook

He has an interesting YouTube channel too: https://www.youtube.com/user/shaunroselt/videos

–jeroen

Via: [WayBack] More Delphi communities! – Ilya S – Google+

 

Posted in Delphi, Development, Software Development | Leave a Comment »

GitHub – Libaud/POLCLVCLISO: Pascal Object LCL and VCL ISO standards implementation for CodeTyphon, Delphi, Lazarus

Posted by jpluimers on 2020/01/02

For my link archive: GitHub – Libaud/POLCLVCLISO: Pascal Object LCL and VCL ISO standards implementation for CodeTyphon, Delphi, Lazarus

It implements these standards:

  • ISO standard 3166-1, 3166-2, 3166-3 implementation
    • (all part of the ISO 3166 – Wikipedia that “defines codes for the names of countries, dependent territories, special areas of geographical interest, and their principal subdivisions)”
  • ISO standard 4217 implementation
    • ISO 4217 – Wikipedia  “delineates currency designators, country codes (alpha and numeric)” where the country codes are the same as in ISO 3166
  • ITU E.164 standard implementation
    • E.164 – Wikipedia “E.164 defines a general format for international telephone numbers. Plan-conforming numbers are limited to a maximum of 15 digits, excluding the international call prefix.”

A library like this needs monitoring the standards changes, so hopefully Libaud will do that.

Some of my posts related to ISO 3166 are below.

–jeroen

Related:

 

Posted in Delphi, Development, FreePascal, Lazarus, Pascal, Software Development | Leave a Comment »