delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp-workers/2000/09/09/12:56:33

From: Martin Str|mberg <ams AT ludd DOT luth DOT se>
Message-Id: <200009091656.SAA27681@father.ludd.luth.se>
Subject: stub text shift
To: djgpp-workers AT delorie DOT com (DJGPP-WORKERS)
Date: Sat, 9 Sep 2000 18:56:09 +0200 (MET DST)
X-Mailer: ELM [version 2.4ME+ PL54 (25)]
MIME-Version: 1.0
Reply-To: djgpp-workers AT delorie DOT com

Here is a patch that shifts the stub text a little later to comply
with the specification of the .EXE format.

Of the programs I've compiled and tested (du, df, sync, ls and the
ones generated by the DJGPP libraries build process), all of them
works.

Comments?


Right,

						MartinS

(Pasted, so might not apply cleanly.)
diff -u -r1.5 djasm.y
--- djasm.y     1999/06/03 17:27:41     1.5
+++ djasm.y     2000/09/09 16:50:57
@@ -1362,11 +1362,20 @@
   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)
   {

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019