🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: fj.os.msdos
Article #4004

Re: Is this progrram overlay?

#4004
From: Junn Ohta
Date: Wed, 24 Mar 1993 03:03
123 lines
5554 bytes
$BB@ED=c!w%j%3!<$G$9!#(B

In article <ICHIDA.93Mar23181059@majesty.pt1.ybp.omron.co.jp>
	ichida@pt1.ybp.omron.co.jp (OMRON Corporation, Yokohama R&D Lab.) writes:
> $B$=$N%W%m%0%i%`$H$$$&$N$O4{B8$N#E#X#E%U%!%$%k$K$H$j$D$$$F!J$H$$$C$F$b%&(B
> $B%$%k%9$G$O$"$j$^$;$s!#G0$N$?$a!KF0$/%W%m%0%i%`$J$N$G$9$,!"$H$j$D$$$F$b(B
> $B$$$$$+$I$&$+$NH=CG$N0l$D$K#E#X#E%U%!%$%k$,%*!<%P!<%l%$$r;HMQ$7$F$$$k$+(B
> $B$I$&$+$N%A%'%C%/$r$7$?$$$H;W$C$F$^$9!#(B
> ...
> diet  $B$J$I$OBP>]$H$9$k%W%m%0%i%`$,%*!<%P!<%l%$$+$I$&$+$r%A%'%C%/$7$F$$(B
> $B$k$_$?$$$G$9$,!"$I$N$h$&$KH=CG$7$F$$$k$N$+IT;W5D$K;W$C$F$^$9!#(B

$B7o$N(BDIET$B$N%^%K%e%"%k(B(DIET110$B$H(BDIET143$B$G3NG'(B)$B$K$O(B
$B<!$N$h$&$J5-=R$,$"$k$s$G$9$1$I(B...$B!#(B:-)

: $B!Z05=L$KE,$5$J$$%U%!%$%k$b05=L$9$k![!J!]#I%*%W%7%g%s!K(B
: 
: $B#E#X#E%U%!%$%k$N%X%C%@$K$h$jF@$i$l$k%U%!%$%k%5%$%:$H<B:]$N%U%!%$%k$,0[$J$k>l(B
: $B9g!"$=$N%U%!%$%k$O%*!<%P!<%l%$$r4^$s$G$$$k2DG=@-$,$"$j$^$9!J<B:]$K$O!"%G%P%C(B
: $B%0Ey$N>pJs$r4^$s$G$$$k$@$1$G!"%*!<%P!<%l%$$G$O$J$$%1!<%9$b$"$k!K!#$3$N$h$&$J(B
: $B#E#X#E%U%!%$%k$r05=L$7$h$&$H$9$k$H!"DL>o$O7Y9p%a%C%;!<%8$rI=<($7$F=hM}$rCf;_(B
: $B$7$^$9$,!"$3$N%*%W%7%g%s$,;XDj$5$l$F$$$k$H=hM}$r7QB3$7$^$9!#(B

$B%*!<%P!<%l%$$r;}$D%U%!%$%k$O%W%m%0%i%`$N5/F0;~$K(B
$B%U%!%$%kA4BN$,%m!<%I$5$l$J$$$N$G!"(BEXE$B%X%C%@!<$+$i(B
$B7W;;$5$l$k%U%!%$%k%5%$%:(B($B$3$l$+$i<B:]$K%m!<%I$9$k(B
$B%5%$%:$,7h$^$k(B)$B$H<B:]$N%U%!%$%k%5%$%:$rHf3S$9$k$H!"(B
EXE$B%X%C%@!<$+$i7W;;$7$?%5%$%:$N$[$&$,>.$5$/$J$k!"(B
$B$H$$$&$3$H$N$h$&$G$9!#$3$N7W;;$r9T$&%W%m%0%i%`$r(B
$BIU$1$F$*$-$^$9$N$G!";n$7$F$_$F$/$@$5$$!#(B

--------------------------------
ohta@src.ricoh.co.jp (Junn Ohta)
--------------------------------
EXE$B%X%C%@!<$NFbMF$rI=<($7!"(B
$B%U%!%$%k%5%$%:$N7W;;$r9T$&%W%m%0%i%`(B
examine.c

#include <stdio.h>
#include <fcntl.h>
#include <sys/types.h>
#include <sys/stat.h>

char *prog = "examine";

typedef	unsigned short ushort;

#define	MAGIC	0x5A4D	/* $B%^%8%C%/%J%s%P!<(B 'MZ' (0x5A4D) */
#define	PAGSIZ	512	/* $B%Z!<%8%5%$%:(B */
#define	PARSIZ	16	/* $B%Q%i%0%i%U%5%$%:(B */

typedef struct {
	ushort	magic;	/* $B%^%8%C%/%J%s%P!<(B */
	ushort	endpag;	/* $B:G=*%Z!<%8$N%P%$%H?t(B */
	ushort	filsiz;	/* $B%Z!<%8C10L$N%U%!%$%k%5%$%:(B */
	ushort	relocs;	/* $B%j%m%1!<%7%g%s%F!<%V%kMWAG?t(B */
	ushort	hdrsiz;	/* $B%Q%i%0%i%UC10L$N%X%C%@!<%5%$%:(B */
	ushort	minalc;	/* $B<B9T$KI,MW$J:G>.%Q%i%0%i%U?t(B */
	ushort	maxalc;	/* $B<B9T$KI,MW$J:GBg%Q%i%0%i%U?t(B */
	ushort	initss;	/* SS$B%l%8%9%?!<$N=i4|CM(B */
	ushort	initsp;	/* SP$B%l%8%9%?!<$N=i4|CM(B */
	ushort	chksum;	/* $B%U%!%$%k$N%A%'%C%/%5%`(B */
	ushort	initip;	/* IP$B%l%8%9%?!<$N=i4|CM(B */
	ushort	initcs;	/* CS$B%l%8%9%?!<$N=i4|CM(B */
	ushort	reloff;	/* $B%j%m%1!<%7%g%s%F!<%V%k%*%U%;%C%H(B */
	ushort	ovlnum;	/* $B%*!<%P!<%l%$HV9f(B */
	char	pad[PAGSIZ - 14 * sizeof(short)];
} EXEHDR;

main(ac, av)
int ac;
char **av;
{
	int fd;
	long size1, size2;
	struct stat st;
	EXEHDR hdr;

	ac--, av++;
	if (ac != 1) {
		fprintf(stderr, "Usage: %s file.exe\n", prog);
		exit(1);
	}
	if ((fd = open(*av, O_RDONLY|O_BINARY)) < 0) {
		fprintf(stderr, "%s: can't open %s\n", prog, *av);
		exit(1);
	}
	if (fstat(fd, &st) < 0) {
		fprintf(stderr, "%s: can't stat %s\n", prog, *av);
		exit(1);
	}
	if (read(fd, (char *)&hdr, sizeof(hdr)) != sizeof(hdr)) {
		fprintf(stderr, "%s: read failed\n", prog);
		exit(1);
	}
	close(fd);
	if (hdr.magic != MAGIC) {
		printf("%s is not an EXE file\n", *av);
		exit(0);
	}
	printf("$B!Z%U%!%$%k(B %s $B$N%X%C%@!<>pJs![(B\n", *av);
	printf("\n");
	printf("            $B:G=*%Z!<%8$N%P%$%H?t(B: %6u\n", hdr.endpag);
	printf("      $B%Z!<%8C10L$N%U%!%$%k%5%$%:(B: %6u\n", hdr.filsiz);
	printf("    $B%j%m%1!<%7%g%s%F!<%V%kMWAG?t(B: %6u\n", hdr.relocs);
	printf("  $B%Q%i%0%i%UC10L$N%X%C%@!<%5%$%:(B: %6u\n", hdr.hdrsiz);
	printf("    $B<B9T$KI,MW$J:G>.%Q%i%0%i%U?t(B: %6u\n", hdr.minalc);
	printf("    $B<B9T$KI,MW$J:GBg%Q%i%0%i%U?t(B: %6u\n", hdr.maxalc);
	printf("            SS$B%l%8%9%?!<$N=i4|CM(B: 0x%04x\n", hdr.initss);
	printf("            SP$B%l%8%9%?!<$N=i4|CM(B: 0x%04x\n", hdr.initsp);
	printf("          $B%U%!%$%k$N%A%'%C%/%5%`(B: 0x%04x\n", hdr.chksum);
	printf("            IP$B%l%8%9%?!<$N=i4|CM(B: 0x%04x\n", hdr.initip);
	printf("            CS$B%l%8%9%?!<$N=i4|CM(B: 0x%04x\n", hdr.initcs);
	printf("$B%j%m%1!<%7%g%s%F!<%V%k%*%U%;%C%H(B: %6u\n", hdr.reloff);
	printf("                $B%*!<%P!<%l%$HV9f(B: %6u\n", hdr.ovlnum);
	printf("\n");

	size1 = st.st_size;
	size2 = (long)(hdr.filsiz - 1) * PAGSIZ + (long)hdr.endpag;
	printf("            $B<B:]$N%U%!%$%k%5%$%:(B: %6ld bytes\n", size1);
	printf("    $B%X%C%@!<$K$h$k%U%!%$%k%5%$%:(B: %6ld bytes\n", size2);
	exit(0);
}
Technical Details
Message-ID: <1ooj17INNlh1@snoopy.src.ricoh.co.jp>
Path: arc1-ca.pugleaf.net!sparky!uunet!stanford.edu!sun-barr!sh.wide!wnoc-tyo-news!ricohgwy!patty!patty.src.ricoh.co.jp!snoopy.src.ricoh.co.jp!not-for-mail
References: <ICHIDA.93Mar23181059@majesty.pt1.ybp.omron.co.jp>

Show Full Headers
Complete Article Headers
X-Google-Language: Japanese,JIS
X-Google-Thread: ff2c9,e292c610256a0341
X-Google-Attributes: gidff2c9,public
X-Google-ArrivalTime: 1993-03-24 01:01:18 PST
Path: arc1-ca.pugleaf.net!sparky!uunet!stanford.edu!sun-barr!sh.wide!wnoc-tyo-news!ricohgwy!patty!patty.src.ricoh.co.jp!snoopy.src.ricoh.co.jp!not-for-mail
From: ohta@src.ricoh.co.jp (Junn Ohta)
Newsgroups: fj.os.msdos
Subject: Re: Is this progrram overlay?
Message-ID: <1ooj17INNlh1@snoopy.src.ricoh.co.jp>
Date: 24 Mar 93 03:03:03 GMT
References: <ICHIDA.93Mar23181059@majesty.pt1.ybp.omron.co.jp>
Distribution: fj
Organization: RICOH Software Division, Tokyo
Lines: 123
NNTP-Posting-Host: snoopy.src.ricoh.co.jp