Back to home page

DOS ain't dead

Forum index page

Log in | Register

Back to the board
Thread view  Mix view  Order
DosWorld

25.12.2020, 22:39
 

Where is paramstr(0) hide ? (Developers)

Hello!

Does any anybody know, where is DOS have path and name of executed program?
I talk about paramstr(0) (in pascal) or first element of argv (in C) - like C:\PATH\COOLPRG.EXE

I am try disassemble minimal program in TP7, but have 31k disassembled text :-) and continue investigate (may be somebody already known it and can make may path is short).

---
Make DOS great again!

Carthago delenda est, Ceterum censeo Carthaginem delendam esse.

ecm

Homepage E-mail

Düsseldorf, Germany,
25.12.2020, 22:51

@ DosWorld

Where is paramstr(0) hide ?

> Hello!
>
> Does any anybody know, where is DOS have path and name of executed
> program?
> I talk about paramstr(0) (in pascal) or first element of argv (in C) - like
> C:\PATH\COOLPRG.EXE
>
> I am try disassemble minimal program in TP7, but have 31k disassembled text
> :-) and continue investigate (may be somebody already known it and can make
> may path is short).

I believe it is at the end of the environment block, after the double-zero that marks the end of the variables stored in the block.

---
l

Laaca

Homepage

Czech republic,
26.12.2020, 00:10

@ ecm

Where is paramstr(0) hide ?

It is in PSP (program segment prefix)
Look at wikipedia article: https://en.wikipedia.org/wiki/Program_Segment_Prefix

---
DOS-u-akbar!

tkchia

Homepage

26.12.2020, 07:22

@ ecm

Where is paramstr(0) hide ?

Hello ecm,

> I believe it is at the end of the environment block, after the double-zero
> that marks the end of the variables stored in the block.

Indeed --- according to the all-knowing RBIL: :-D
Format of environment block:
Offset  Size    Description     (Table 01379)
 00h  N BYTEs   first environment variable, ASCIZ string of form "var=value"
      N BYTEs   second environment variable, ASCIZ string
        ...
      N BYTEs   last environment variable, ASCIZ string of form "var=value"
        BYTE    00h
---DOS 3.0+ ---
        WORD    number of strings following environment (normally 1)
      N BYTEs   ASCIZ full pathname of program owning this environment
                other strings may follow

(This is under the entry for int 0x21, ah = 0x26.)

I wonder if there is a way to get the program name for DOS versions before 3.0.

Thank you!

---
https://gitlab.com/tkchia · https://codeberg.org/tkchia · 😴 "MOV AX,0D500H+CMOS_REG_D+NMI"

DosWorld

29.12.2020, 00:41

@ ecm

Where is paramstr(0) hide ?

> I believe it is at the end of the environment block, after the double-zero
> that marks the end of the variables stored in the block.

Thanks! It works!

---
Make DOS great again!

Carthago delenda est, Ceterum censeo Carthaginem delendam esse.

Back to the board
Thread view  Mix view  Order
22049 Postings in 2034 Threads, 396 registered users, 247 users online (2 registered, 245 guests)
DOS ain't dead | Admin contact
RSS Feed
powered by my little forum