Post by Paul EdwardsI know how to get these things in OS/2 1.0, but
DosGetEnv(&seg, &offs)
is not one of the ones available for MT MSDOS
that I saw.
So I would guess that that means those registers are
the ONLY official way of retrieving both the environment
and the command line.
Which means the startup code for an application must be
written in assembler for MT MSDOS, unlike OS/2 1.x and
2.x which should be possible to do in C since registers
are not needed, and the stack can be ignored too, which
is helpful to me.
I spoke too soon about OS/2 2.x. It turned out that
DosGetEnv was not available.
For a while I thought I would be in the same boat
as MSDOS 4.0 - required to rely on the stack on
entry to the program (which I don't want to do,
because I want to redefine that for PDOS-generic).
After a lot of looking, I found how to do it
another way:
#ifdef __16BIT__
{
USHORT seg, offs;
if (DosGetEnv(&seg, &offs) != 0)
{
p = "\0"; /* two NUL characters */
}
else
{
p = (char *)(((unsigned long)seg << 16)
| offs);
}
}
#else
{
PIB *pib;
if (DosGetInfoBlocks(NULL, &pib) != 0)
{
p = "\0"; /* two NUL characters */
}
else
{
/* skip three 32-bit values and then you get a
pointer to the command line */
p = pib->pib_pchcmd;
}
}
#endif
I didn't see an equivalent of DosGetInfoBlocks
for MSDOS 4.0, so I still may be dependent on
the registers on entry to the NE executable.
I don't know if I can still get an "artificial"
PSP for an NE executable on MSDOS 4.0 by calling
the appropriate INT 21H.
But it's not important to be able to support
MSDOS 4.0 anyway - which I don't have to test
(and don't bother sending me a link to it - I
know I can get it if I want a bootleg copy).
BFN. Paul.