View Full Version : Command line switch routine
Stilgar
March 21st, 2003, 16:05
I'm reversing a old DOS game (reversed the structure of the high scores and levels) and I need a little help: how can I find the routine where a command line switch is checked? Example: yourapp /switch (or -switch). I searched for info about it, but had no good results.
I'm using Wdasm to obtain a dead listing and softice for DOS to debug.
Thanks in advance, and I hope that my bad english isn't a problem. Sorry

disavowed
March 21st, 2003, 16:14
"The command line switches are received by the program
from the program segment prefix (PSP) beginning at offset 80h."
In other words, the command line is located at ES:[80h] when the program starts.
Aimless
March 24th, 2003, 04:39
Usually, old dos programs have their commandlines spelt out easily in IDA. Alternatively, simply tdump the file for strings and they'll be there in all glory.
Note that some programs (dos based) use single line params (which you can easily check in the PSP) to trigger a value in a table that could be encrypted/compressed or god knows what. The values are triggerd in certain sequence only. This implies, that knowing the options (tdumping or PSPing) may not get the desired result.
Best idea is to run the program under IDA and trace the stack pointer, to see if its being accessed somewhere. For a more detailed view about the contents, ICE would do.
Have Phun,
Stilgar
March 24th, 2003, 07:30
Thanks, disavowed and Aimless. After the post of disavowed, I used the info about PSP to search and found a comprehensive explanation at
h++p://www.ee.up.ac.za/~justin/cos284/asm/psp.html
I had a look at the code and found the "probable" areas. I'll look with S-ICE later and post the results. If this doesn't work, the suggestion of Aimless is my next step (run under IDA).
Thanks for the help!
Powered by vBulletin® Version 4.2.2 Copyright © 2018 vBulletin Solutions, Inc. All rights reserved.