1

I am trying to reverse engineer an old native application written in Borland Delphi in order to modify it for my needs:

enter image description here

The application interfaces with the special hardware and displays events that it receives in the TDBCtrlGrid control, that acts as a long list. Using the Spy++ tool I was able to see that it has a child window TDBCtrlPanel:

enter image description here

So both are placed in the actual application as such:

enter image description here

I need to add some custom functionality to this application and namely, to be able to track when a certain hardware-related event occurs. I am not the author of this application and the company who created it is long gone.

So my only solution seems to be trying to patch the executable with my own code trampoline. My goal is to trap instances when a new line is added to that TDBCtrlGrid control and ideally get the text from it. (Example: 5/30/2018 9:30:00 PM Beam Alarm Zone Alarm Zone Armed that is the last line from the screenshot above.)

I've never done much in Delphi/Pascal. So I don't know its structure. To start, I need to find out how do those Delphi controls receive text for a new row to try to trap the part of the original code that does it?

PS. If it was Windows common controls, I know that they receive most notifications via SendMessage API. I tried that approach with Spy++, but the only messages those two Delphi controls receive were WM_PAINT and WM_STYLECHANGED.

1

This sounds more like you need to become familiar with the Delphi API. I googled a bit:

At runtime, users can use the database navigator (TDBNavigator) to move through data in the TDBCtrlGrid object, and to insert, delete, and edit the data.

from http://docs.embarcadero.com/products/rad_studio/delphiAndcpp2009/HelpUpdate2/EN/html/delphivclwin32/DBCGrids_TDBCtrlGrid.html

From my understanding, you define a data source (this is the part I didn't understand), connect it to a data viewer widget like your CtrlGrid and add a Navigator that handles the view into the data source.

So either the program uses the TDBNavigator to add data and this might be your hook, or there is some other way to alter your data source.

I'd probably look for simple example code using all the above to see how one typically implements it in Delphi, then it should be straight-forward to find the proper hook location.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.