OS/2, eCS & ArcaOS - Technical > Programming

again MeShell - binary distinguishing PM programs from cmd programs

(1/3) > >>

Martin Vieregg:
I have written a syntax completion of commands for the next MeShell version. For this purpose, I have saved the PATH list exe, com, bat and cmd files in a very fast string list. I want to use this for another purpose:

In my opinion, it is nervy to write "start" in front of the name of the PM program which is not running in the same session as cmd.exe. Otherwise MeShell switches to non prompt state (LED glows red). I want to send a "start progname" to cmd.exe instead of "progname". I need a secure way to binary analyze the EXE file and to see if it is a PM program or a cmd program (generating stdout or VIO and running in a command window). Any ideas what part of the binary I have to check? Or is there an API call doing this?

Pete:
Hi Martin

You probably want to play with DosQueryAppType


Regards

Pete

Dave Yeo:
IIRC, it is a bit in the executables header. There's other ones to consider like a program that can only run in a full screen session, which would also need start or start /f, plus it is possible to morph a vio program into a PM program.
exehdr.exe /? gives these options,

--- Quote ---/PMTYPE:(PM | VIO | NOVIO | WINDOWAPI | WINDOWCOMPAT | NOTWINDOWCOMPAT

--- End quote ---

Martin Vieregg:
Thank you for your answers. DosQueryAppType should fit my purpose. This API call refers to the bits Dave mentioned. I assume that the following bits are interesting for me:

001 -     (FAPPTYP_NOTWINDOWCOMPAT, 0x00000001): Application type is not-window-compatible.
010 -     (FAPPTYP_WINDOWCOMPAT, 0x00000002): Application type is window-compatible.
011 -     (FAPPTYP_WINDOWAPI, 0x00000003): Application type is window-API

So it seems that 0x1 means the program runs in the cmd.exe session.

Bit 5     (FAPPTYP_DOS, 0x00000020): Set to 1 if the executable file is in PC/DOS format. Bits 0, 1, 2, 3, and 4 will be set to 0.

DOS programs have to run in their own session, of course. So I think simply checking bit 0x1 set and 0x2 unchecked should be sufficient.

I will report here after testing different sample programs. I am not clear what "window-compatible" means.

Lars:
"window compatible" is a text mode application that can run either in a command window or fullscreen.
"not window compatible" is a text mode application that can only run fullscreen.
There are only a few text mode applications that have a technical reason to run "only fullscreen" but by setting the corresponding bit (via MARKEXE.EXE or by setting the corresponding linker DEF directive) you can force the system to only allow that app to run fullscreen.

Navigation

[0] Message Index

[#] Next page

Go to full version