Getting the command line parameters of an executable

I’m currently trying to reverse engineer a tool that consists of a frontend
with a really dreadful GUI and a command line program as backend, which is called by that frontend and does the actual work. The idea is to write my own frontend that does some additional preparatory work, then calls the backend and after that has finished, do some more work with the results.

For this I want to know how the frontend calls the backend, in particular which parameters it passes to it. Unfortunately the backend’s documentation leaves quite a lot to desire.

There are actually several ways to get this information using Windows tools, but they work only while that executable is running. I want to intercept the call to the backend before it actually starts.

Enter dzCmdLineDisplay, a small tool that is meant to be used in the following way:

  1. Rename the original executable of the backend to backend-renamed.exe
  2. Copy dzCmdLineDisplay.exe to the folder containing the backend executable
  3. Rename dzCmdLineDisplay.exe to backend.exe

By doing this, the frontend will call the renamed dzCmdLineDisplay which then will do the following:

  1. Get the parameters passed to it and display them in an edit field.
  2. Check whether there is an executable with its own name but “-renamed” added to it (backend-renamed.exe).
  3. If there is such an executable, offer to call it with the original parameters

I hope that this will allow me to reverse engineer how to use the backend without the frontend.

If you are interested in this tool, dzCmdLineDisplay is available under the MPL from OSDN.

Discussion about this blog post in the international Delphi Praxis forum.