Finding GUIDs with GExperts Grep

 Delphi, GExperts  Comments Off on Finding GUIDs with GExperts Grep
Feb 162019
 

I recently had a problem with access violations when calling methods of interfaces. The reason turned out to be duplicate GUIDs in the interface declarations. This caused AVs because the wrong methods were called and the parameters passed to them were not of the right type and numbers. Duplicate GUIDs are usually caused by copying existing interfaces and changing them, without also generating a GUID for the copy. (Btw: The Hotkey for generating a new GUID in the Delphi IDE is Ctrl+Shift+G.)

So I looked for a way to find all interfaces and their GUIDs in my program. There is a uInterfaces.Duplicates unit on GitHub which claims to retrieve this list. Unfortunately I needed this for a Delphi 2007 program and Delphi 2007 does not come with a System.RTTI unit, so this was not an option (and therefore I don’t know whether this unit would have worked).

StackOverflow didn’t help much either, apart from David Heffernan’s suggestion to parse the source code.

So this is what I did. I used GExperts Grep to search for GUIDs, or more eaxct: For the pattern that is used to add a GUID to an interface declaration in Delphi.

It always looks like this:

type
  ISomeInterface = interface ['{XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX}'];

Where X is a hexadecimal digit in upper case.

The Regular Expression for this is:

\['\{[0-9A-F]{8}-[0-9A-F]{4}-[0-9A-F]{4}-[0-9A-F]{4}-[0-9A-F]{12}\}'\]

The literals [ ] and { } must be escaped with a backslash because they have special meaning in a RegEx. [0-9A-F] means one of ‘0’..’9′ or ‘A’..’F’ which is an upper case hexadecimal digit. {4} means four of those {8} means eight and of course {12} means twelve.

You have to turn off the option “Whole Word” and turn on “Regular Expression”. Of course this needs to search at least all files in the project.

Why do I say “at least”? Because actually it needs to search all files linked into the project, including any packages if such are used. “All files in project” only searches files listed in the DPR file, so it’s potentially missing quite a lot.

Which, again, reminds me that I wanted to extend Grep Search to search all files in the MAP file. Code for getting that list is already in place and being used e.g. in the Open File Expert. I “just” need to put the pieces together.

I’m thinking about making yet another Expert out of this, that not only lists all GUIDs but shows a list of Interface names and their associated GUIDs and of course checks for duplicates.

Discussion about this post in the international Delphi Praxis forum.

 Posted by on 2019-02-16 at 12:28

Delphi Blogs

 Delphi  Comments Off on Delphi Blogs
Feb 102019
 

The Delphi Wiki has a list of “Useful Sites” which has a sub section for Delphi Blogs.

I have just further divided that section into:

  • Active Blogs, which contains blogs that are active
  • Intensive Care Unit, which contains blogs that are still available but have been inactive for more than a year
  • Cemetery, which contains blogs that are dead, so I have changed the link to point to the last snapshot in the Internet Archive.

If you find your blog in one of the later ones and it is still active (maybe moved to a new url), feel free to edit the page again. It’s a Wiki after all.

I have also added the
Delphi Praxis international developer community and the new
Embarcadero Discussion Forum (Delphi) to the list of Web Based Forums and removed some outdated links.

 Posted by on 2019-02-10 at 15:53

Two GExperts bugs fixed, 14 to go

 Delphi, GExperts  Comments Off on Two GExperts bugs fixed, 14 to go
Feb 092019
 

I just fixed two (newly reported) bugs in GExperts:

  1. The Set Tab Order dialog no longer worked in Delphi 6, 7 and 2005. This was due to me adding AlignWithMargins (and the associated Margins property) to the dfm file. This property apparently was introduced in Delphi 2006. Again, this underlines what I mentioned several times: I do not use Delphi < 2007 for anything but testing and fixing bugs GExperts. That’s why glitches like this tend to slip by unnoticed. That’s why I would like people to volunteer for testing the various versions. But apparently nobody can be bothered. Fine by me, but you will have to live with the consequences. I don’t have a QA department.
  2. The extensions to the Uses Clause Manager caused several thousand (small) files to be created in the GExperts configuration directory. This directory is located under AppData\roaming\GExperts which means it will be copied when roaming profiles are enabledin a Windows domain. I didn’t know that anybody still uses roaming profiles since they are usually not worth the trouble, but apparently they are still being used. So I now moved that cache to AppData\local and also added a config option to disable caching altogether.

There are now 14 open bug reports on SourceForge. But if you encounter more, please do report them there!

There is no release yet and it might take a while until I feel like doing one, but you can always compile your own GExperts DLL. Make sure you delete the existing directory AppData\roaming\GExperts\DelphiXXX\UsesExpertCache when you replace the DLL with the new one.

btw: Did you notice that I have added menus to my blog?

Discussion about this post in the international Delphi Praxis forum.

 Posted by on 2019-02-09 at 17:22

Sie wollen mich einstellen?

 Delphi  Comments Off on Sie wollen mich einstellen?
Jan 272019
 

Derzeit habe ich eine unbefristete Vollzeitstelle (40h) als Leiter der Softwareentwicklung bei der TÜV Rheinland Schniering GmbH. Ich bin damit ganz zufrieden und suche nicht aktiv nach einer neuen Stelle.

Da ich aber immer wieder mal gefragt werde, ob ich an einem Angebot Interesse habe, stelle ich hier auf, was man mir bieten müsste, damit ich über einen Wechsel nachdenke.

 Posted by on 2019-01-27 at 15:24

RDP Wrapper Library

 Delphi  Comments Off on RDP Wrapper Library
Jan 272019
 

I need to check this out:

The goal of the RDP Wrapper Library project is to enable Remote Desktop Host support and concurrent RDP sessions on reduced functionality systems for home usage.

RDP Wrapper works as a layer between Service Control Manager and Terminal Services, so the original termsrv.dll file remains untouched. Also this method is very strong against Windows Update.

https://github.com/stascorp/rdpwrap/blob/master/README.md

 Posted by on 2019-01-27 at 14:34

New option in Delphi Help Expert to open in web browser

 Delphi  Comments Off on New option in Delphi Help Expert to open in web browser
Jan 012019
 

Prompted by a suggestion from Peter Aschbacher I just added a new feature to my Delphi Help Expert:

You can now force it to use the default web browser instead of the Welcome Page for web URLS.

This is a global setting.

I also fixed a bug I recently introduced which resulted in the Welcome Page of Delphi 2007 no longer being found.

Discussion about this post in the international Delphi Praxis forum.

 Posted by on 2019-01-01 at 14:55

You can now follow me on Diaspora

 blog, Delphi  Comments Off on You can now follow me on Diaspora
Dec 312018
 

I created an account on Pluspora (I’m dz@pluspora.com *1).

If the WordPress plugin I just installed works as expected, all blog posts will be available there. And if I understand correctly how Diaspora works, it should be possible to follow me on other Diaspora Pods too.

(*1 dummzeuch@pluspora.com was blocked for whatever reason, It’s quite possible that I registered it before and deleted that account later. I don’t remember doing that though.)

 Posted by on 2018-12-31 at 19:25