views:

220

answers:

7

HI:

I've a Delphi 7 program that I wrote many years ago, but I've lost the source code. It's a small program but very useful for me.

I've tried to 'install' it again in a new Windows XP computer, just copying the folder with de data (.db paradox files), and configured the BDE connection.

When the programm starts I receive an "Unknown exception" and halts. I've no idea why this happens, and can't debug cause the lost source code. I've tried in another computer with the same results.

Any suggestions or ideas? What do you do in a situation like this?

Thanks in advance.

EDIT: When I installed Delphi 7 in the new XP computer, the exception came from unknown to known. It was something related to the folder for the Paradox.net file. Thnk you all.

+6  A: 

You can use any debugger, either Visual Studio one, or a free OllyDbg, don't know if Delphi IDE have a simple external-exe-debugger.

But debugging will be very hard w/o source codes, and you must have at least basic knowledge of Assembler Language and win32api.

Alternatively you can use tools like FileMon & RegMon to examine your app activity and find potential problems.

zed_0xff
The FileMon/RegMon ideas are good - ideally, you'd see it trying to open a file in a directory that doesn't exist, or something like that, which could be easily remedied externally.
Chris Thornton
The Delphi debugger does support loading a process. In current Delphi versions, use the "Run | Load Process" menu item. You specify the .exe and then click Load to load it in the debugger. In older Delphi versions, similar functionality is available in the "Run | Parameters" dialog box.
Chris Hesik
+2  A: 

You can try "Run|Connect to process..." in the Delphi IDE. But what zed_0xff said regarding debbugging without sources still applies.

Ulrich Gerhardt
+6  A: 

Delphi IDE can attach to a running process and debug it (Run -> Attach to process), although without debug symbols you will end up debugging plain assembler code, which requires some knowledge of assembler and how a Windows application works. And debugging startup exceptions could be pretty difficult if the debugger can't start the program. You can also use the WinDbg debugger from Microsoft. There are disassemblers (I used the very powerful IDA Pro) that are able to recognize standard library calls helping analysys a lot. You may also find decompilers, although decompiling native applications is a bit more difficult than with those using a p-code or the like. If the error is not due to a misconfiguration, patching a binary file is not easy.

ldsandon
+2  A: 

I would go for the disassemble approach like ldsandon suggest, especially since you have (some) knowledge about what your exe is doing. Besides IDA Pro also take a look at tools aimed specifically at Delphi such as IDR (Interactive Delphi Reconstructor), DeDe and PE Explorer.

Remko
+1  A: 

To make sure it is not BDE related, I would build another rudimentary application trying to access the same data on this machine.
Once this application works, you can move on to test on the Pascal code side of things.
I have had my share of BDE oddities so I'd prefer to rule this out.

François
A: 

You can send me your executable file and I'll try to recover source code with my IDR.

+2  A: 

im not sure if this will work for you.. i know good application olley debugger wich letting you know the basic function of blocks such as loop case etc. this my help you to trace some values causes an error on your apps. sorry for my english

XBasic3000