From: Martin Str|mberg Message-Id: <200101021603.RAA28364@father.ludd.luth.se> Subject: The stub's use of reserved position in DOZE EXE header (djasm.y) To: djgpp-workers AT delorie DOT com (DJGPP-WORKERS) Date: Tue, 2 Jan 2001 17:03:11 +0100 (MET) X-Mailer: ELM [version 2.4ME+ PL54 (25)] MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Reply-To: djgpp-workers AT delorie DOT com I've been running go32 and go32-v2 in every combination according to src/stub/go32-v2.c: /* If you want to change this, remember to test it with all the various ways `go32' can be called. The following is the list of different cases I know about: x go32 is called from DOS prompt without any arguments x go32 is called from DOS prompt to run unstubbed COFF image of a v2 program x(1) go32 is called from DOS prompt to debug a v1 COFF image (go32 -d) x v2's Make calls go32 to run unstubbed COFF image of a v2 program x v1's Make calls go32 to run unstubbed COFF image of a v2 program x 16-bit Make calls go32 to run unstubbed COFF image of a v2 program x v2's Make calls go32 to run unstubbed COFF image of a v1 program x v1's Make calls go32 to run unstubbed COFF image of a v1 program x 16-bit Make calls go32 to run unstubbed COFF image of a v1 program x v1 .EXE program is called from the DOS prompt x v1 symlink is called from the DOS prompt x v2's Make calls a v1 .EXE program x v1's Make calls a v1 .EXE program x 16-bit Make calls a v1 .EXE program x(2) when v2's Make calls go32, you need to test command lines which are both shorter and longer than the DOS 126-character limit Note that there is nothing special about Make, it just serves as an example of one program that calls another. It is convenient to use Make to test the above cases, because Make is available as both v2 and v1 executable and as a 16-bit program, and because it can be easily used to call different programs with different command lines by tweaking a Makefile. */ (1) go32-v2 can't find edebug32 or ed32-dpm unless it's in the same directory or the full path to it is given. (2) Works exactly like djdev203.zip version, i. e. almost all cases except the reported one (make bug?). Have I understood the setup correctly: 1. A v2 setup. 2. Put go32.exe in a directory in the path, but after DJGPP/BIN. 3. Rename go32-v2.exe to go32.exe. 4. Borlands real-mode make (called MAKER.EXE) is a 16-bit make. If everyone is happy with this, I'll commit the following patch, which fixes that reserved field in the header and changes dates to YYYY-MM-DD format. Right, MartinS Index: src/stub/djasm.y =================================================================== RCS file: /cvs/djgpp/djgpp/src/stub/djasm.y,v retrieving revision 1.5 diff -p -u -r1.5 djasm.y --- djasm.y 1999/06/03 17:27:41 1.5 +++ djasm.y 2001/01/02 15:29:28 @@ -1362,11 +1362,20 @@ int main(int argc, char **argv) exe[22] = 0; /* relative CS */ exe[23] = 0; + /* These must be zero, otherwise they are interpreted as an offset to + a "new executable" header. */ + exe[60] = 0; + exe[61] = 0; + exe[62] = 0; + exe[63] = 0; +#define INFO_TEXT_START (64) + time(&now); - sprintf(exe+28, "\r\n%s generated from %s by djasm, on %.24s\r\n", argv[2], argv[1], ctime(&now)); + + sprintf(exe+INFO_TEXT_START, "\r\n%s generated from %s by djasm, on %.24s\r\n", argv[2], argv[1], ctime(&now)); if (copyright) - strncat(exe+36, copyright, 476-strlen(exe+36)); - strcat(exe+36, "\r\n\032"); + strncat(exe+INFO_TEXT_START, copyright, (512-3-INFO_TEXT_START)-strlen(exe+INFO_TEXT_START)); /* -3 for the following line: */ + strcat(exe+INFO_TEXT_START, "\r\n\032"); if (argv[2] == 0) { @@ -2510,20 +2519,20 @@ void add_rcs_ident(char *buf) struct tm *tm; time(&now); tm = localtime(&now); - sprintf(tmp, "%cId: %s built %02d/%02d/%02d %02d:%02d:%02d by djasm $\n", + sprintf(tmp, "%cId: %s built %04d-%02d-%02d %02d:%02d:%02d by djasm $\n", '$', inname, + tm->tm_year + 1900, tm->tm_mon + 1, tm->tm_mday, - tm->tm_year, tm->tm_hour, tm->tm_min, tm->tm_sec); add_copyright(tmp); - sprintf(tmp, "@(#) %s built %02d/%02d/%02d %02d:%02d:%02d by djasm\n", + sprintf(tmp, "@(#) %s built %04d-%02d-%02d %02d:%02d:%02d by djasm\n", inname, + tm->tm_year + 1900, tm->tm_mon + 1, tm->tm_mday, - tm->tm_year, tm->tm_hour, tm->tm_min, tm->tm_sec);