1 |
|
---|
2 | #define OS2EMX_PLAIN_CHAR
|
---|
3 | // this is needed for "os2emx.h"; if this is defined,
|
---|
4 | // emx will define PSZ as _signed_ char, otherwise
|
---|
5 | // as unsigned char
|
---|
6 |
|
---|
7 | #define INCL_DOSMODULEMGR
|
---|
8 | #define INCL_DOSPROCESS
|
---|
9 | #define INCL_DOSEXCEPTIONS
|
---|
10 | #define INCL_DOSSESMGR
|
---|
11 | #define INCL_DOSQUEUES
|
---|
12 | #define INCL_DOSSEMAPHORES
|
---|
13 | #define INCL_DOSMISC
|
---|
14 | #define INCL_DOSDEVICES
|
---|
15 | #define INCL_DOSDEVIOCTL
|
---|
16 | #define INCL_DOSERRORS
|
---|
17 |
|
---|
18 | #define INCL_KBD
|
---|
19 | #define INCL_WINPROGRAMLIST // needed for PROGDETAILS, wppgm.h
|
---|
20 | #include <os2.h>
|
---|
21 |
|
---|
22 | #include <stdlib.h>
|
---|
23 | #include <string.h>
|
---|
24 | #include <stdio.h>
|
---|
25 | #include <stdarg.h>
|
---|
26 | #include <ctype.h>
|
---|
27 |
|
---|
28 | #include "setup.h" // code generation and debugging options
|
---|
29 |
|
---|
30 | #include "helpers\dosh.h"
|
---|
31 | #include "helpers\exeh.h"
|
---|
32 | #include "helpers\standards.h"
|
---|
33 |
|
---|
34 | #pragma hdrstop
|
---|
35 |
|
---|
36 | int main (int argc, char *argv[])
|
---|
37 | {
|
---|
38 | int arc = 0;
|
---|
39 | PEXECUTABLE pExe;
|
---|
40 |
|
---|
41 | if (argc != 2)
|
---|
42 | {
|
---|
43 | printf("exeh (built " __DATE__ "): displays the bldlevel of an executable.\n");
|
---|
44 | printf("Usage: exeh <name.exe>\n");
|
---|
45 | arc = 1003;
|
---|
46 | }
|
---|
47 | else
|
---|
48 | {
|
---|
49 | if (!(arc = exehOpen(argv[1], &pExe)))
|
---|
50 | {
|
---|
51 | APIRET arc2;
|
---|
52 | ULONG progt;
|
---|
53 |
|
---|
54 | printf("exeh: dumping base info of \"%s\"\n", argv[1]);
|
---|
55 | printf(" cbDosExeHeader %d\n", pExe->cbDosExeHeader);
|
---|
56 | printf(" ulExeFormat %d (%s)\n",
|
---|
57 | pExe->ulExeFormat,
|
---|
58 | (pExe->ulExeFormat == EXEFORMAT_OLDDOS) ? "EXEFORMAT_OLDDOS"
|
---|
59 | : (pExe->ulExeFormat == EXEFORMAT_NE) ? "EXEFORMAT_NE"
|
---|
60 | : (pExe->ulExeFormat == EXEFORMAT_PE) ? "EXEFORMAT_PE"
|
---|
61 | : (pExe->ulExeFormat == EXEFORMAT_LX) ? "EXEFORMAT_LX"
|
---|
62 | : (pExe->ulExeFormat == EXEFORMAT_TEXT_BATCH) ? "EXEFORMAT_TEXT_BATCH"
|
---|
63 | : (pExe->ulExeFormat == EXEFORMAT_TEXT_CMD) ? "EXEFORMAT_TEXT_CMD"
|
---|
64 | : (pExe->ulExeFormat == EXEFORMAT_COM) ? "EXEFORMAT_COM"
|
---|
65 | : "unknown"
|
---|
66 | );
|
---|
67 | if (pExe->pLXHeader)
|
---|
68 | printf(" LX flags: 0x%lX\n", pExe->pLXHeader->ulFlags);
|
---|
69 | else if (pExe->pNEHeader)
|
---|
70 | printf(" NE flags: 0x%lX\n", pExe->pNEHeader->usFlags);
|
---|
71 | printf(" fLibrary %d\n", pExe->fLibrary);
|
---|
72 | printf(" f32Bits %d\n", pExe->f32Bits);
|
---|
73 | if (!(arc2 = exehQueryProgType(pExe, &progt)))
|
---|
74 | printf(" progtype: %d (%s)\n", progt, exehDescribeProgType(progt));
|
---|
75 | else
|
---|
76 | printf(" exehQueryProgType returned %d\n", arc2);
|
---|
77 | printf("exeh: dumping bldlevel of \"%s\"\n", argv[1]);
|
---|
78 |
|
---|
79 | if (!(arc = exehQueryBldLevel(pExe)))
|
---|
80 | {
|
---|
81 | #define STRINGORNA(p) ((pExe->p) ? (pExe->p) : "n/a")
|
---|
82 |
|
---|
83 | printf(" Description: \"%s\"\n", STRINGORNA(pszDescription));
|
---|
84 | printf(" Vendor: \"%s\"\n", STRINGORNA(pszVendor));
|
---|
85 | printf(" Version: \"%s\"\n", STRINGORNA(pszVersion));
|
---|
86 | printf(" Info: \"%s\"\n", STRINGORNA(pszInfo));
|
---|
87 | printf(" Build date/time: \"%s\"\n", STRINGORNA(pszBuildDateTime));
|
---|
88 | printf(" Build machine: \"%s\"\n", STRINGORNA(pszBuildMachine));
|
---|
89 | printf(" ASD: \"%s\"\n", STRINGORNA(pszASD));
|
---|
90 | printf(" Language: \"%s\"\n", STRINGORNA(pszLanguage));
|
---|
91 | printf(" Country: \"%s\"\n", STRINGORNA(pszCountry));
|
---|
92 | printf(" Revision: \"%s\"\n", STRINGORNA(pszRevision));
|
---|
93 | printf(" Unknown string: \"%s\"\n", STRINGORNA(pszUnknown));
|
---|
94 | printf(" Fixpak: \"%s\"\n", STRINGORNA(pszFixpak));
|
---|
95 |
|
---|
96 | }
|
---|
97 |
|
---|
98 | exehClose(&pExe);
|
---|
99 | }
|
---|
100 |
|
---|
101 | if (arc)
|
---|
102 | {
|
---|
103 | printf("exeh: Error %d occurred with \"%s\".\n", arc, argv[1]);
|
---|
104 | }
|
---|
105 | }
|
---|
106 |
|
---|
107 | return arc;
|
---|
108 | }
|
---|