0

I was asked for a special debugger which prints out the name of original calls used by author. I know the original exe was packed with Borland Turbo C (v.3) and the only debugger which output function calls is Turbo Debugger from '90 era. The author used function name like call gocheckdate, call gettimepassedfromlastsave, for example. Other debuggers list call sub_ or _loc but I don't need those kind of outputs. So, for short: how can I output the entire Cpu pannel (code) from Turbo Debugger to a file without the method to capture screen, copy/dump to log, because this is a long time consuming job. I just need to output in a step (well 2 or 3 steps) all cpu pane window (starting from top or program entry point and ending at the bottom of listing- that is, at the end of scrolling), not to copy,paste,dump only the portion of code displayed at a moment on screen. (MS-DOS 16 bit exe, btw). If there is another disassembler who can indeed presents the original procedure/function name used by original author and can save entire code (assembler) to file please let me know. I also am aware about IDA but due different output it will be a more consuming time job to identify function/procedure names in Turbo Debugger (from Borland) and rewrite/replace IDA output. And I am also aware IDA output is different from TD output.

1
  • I would imagine that Turbo Debugger only provides symbolic information if you have the associated TDS file. IDA can load those files as well via file > load file > tds file.
    – broadway
    Mar 24, 2015 at 11:53

1 Answer 1

1

td.exe that's way back don't have it handy to do a trial
answer pertains to td32 but i remember similar option available in td too
i see a log of an old lode runner game LR.com in the folder with pane dumps

alt+v->l->alt+f10-> open log file default is <prog_name>.log->ok
enable logging yes 
dump the pane to log file using
alt+e->d->page down
iirc td macros can record macros to repeat keystrokes or 
autoit can be used to script findwindow() sendmessage()
  1. alt+v opens view menu
  2. l opens log window
  3. alt+f10 opens speed menu in log window
  4. browse or accept default log file name
  5. alt+ e opens edit menu
  6. d dumps cpu pane to log file
  7. pagedown to view and dump the next page

logging td32 cpu pane

macro to reduce keystrokes to one charecter

alt+o -> create macro -> assign key (i assign 'z')     
alt+e -> d -> page down -> alt + hyphen to stop recording

just keep z pressed till all is dumped :)

compile the code below and dump N number of panes to previously opened log file (alt+v->L->alt+f10->browse->ok) using the above mentioned macro 'z'

#include <stdio.h>
#include <windows.h>
#pragma comment(lib , "user32.lib")
unsigned long numtopaste = 1;
BOOL CALLBACK EnumWindowsProc( HWND hWnd, LPARAM lParam )  {
    UNREFERENCED_PARAMETER(lParam);
    PCHAR Temp = (PCHAR) calloc(64,sizeof(char));
    if (Temp != NULL)    {
        GetClassName(hWnd, Temp, 64);
        if ( strcmp ( Temp , "ConsoleWindowClass" ) == 0 ) {
            PCHAR Wind = (PCHAR) calloc(64,sizeof(char));
            if (Wind != NULL) {
                GetWindowText(hWnd,Wind,64);
                if ((strstr(Wind,"TD32.EXE")) != NULL) {
                    printf("found TD32.EXE ConsoleWindowClass\nHandle = %p\n"
                        "Command Line =%s\n pasting %c Number of Times %d \n", 
                        hWnd, Wind,'z',numtopaste ); 
     // blogs.msdn.com/b/bill copy to clipboard 'z' and paste to Console
                    for(ULONG i = 1; i < numtopaste ; i++) {
                        SendMessage(hWnd, WM_COMMAND, 0xfff1, 0);
                    }
                }
                free(Wind);
            }
        }
        free(Temp);
    }
    return TRUE;
}
int main(int argc , char * argv[]) {
    if(argc !=2) { printf ("usage %s NUM",argv[0]); return 0;}
    numtopaste = strtoul(argv[1],NULL,10);
    EnumWindows(EnumWindowsProc,NULL);
    return 0;
}
4
  • I know this kind of save /dump one by one screen to log. Imagine this: my code pane has over 1000000 lines (just an example). It is time consuming to press f10, [e], [d], page down. Thanks anyway for the answer, I will vote up for the details.
    – ares777
    Mar 24, 2015 at 13:28
  • i added a macro sequence try that you don't. have to press several keys and pressing that single key can also be automated
    – blabb
    Mar 24, 2015 at 13:48
  • Tried macro sequence it is better anyway than previous. :D Thanks.
    – ares777
    Mar 24, 2015 at 14:09
  • compile the edited code to foo.exe and run it like foo 10 will dump 10 panes to log file (code assumes you have setup z macro )
    – blabb
    Mar 24, 2015 at 21:26

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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