/* This little program is my try to provide information about the EtherBoot rom via environment variables to a batch file. This could be done better, I think, but it works... The program compiles with Borland C 3.1; other versions not tested. The C code for setting the environment variables I got from an archive, it was written by Richard Marks . ROMID is written by Guenter Knauf */ #define VERSION "0.6" #define VDATE "2003-08-24" #include #include #include #include #define ROMSTART 0xC8000 #define ROMEND 0xE8000 #define ROMINCREMENT 0x00800 #define ROMMASK 0x03FFF int verbose = 0; int settheenv(char *symbol, char *val); static int rom_scan(const unsigned char huge *rom,long offset,long len) { long size,i,j; char symbol[16]; char val[64]; char romid[64]; char *rptr; if (rom[offset] != 0x55 || rom[offset+1] != 0xAA) return 0; size = (long)rom[offset+2]*512L; if (verbose) { printf("Found ROM header at %04lX:0000; announces %ldk image\n", offset/16,(size+512)/1024); if (offset & ROMMASK) printf(" This is a unusual position; not all BIOSs might find it.\n" " Try to move to a 16kB boundary.\n"); if (size > len) { printf(" This image extends beyond %04X:0000. It clashes with the system BIOS\n", ROMEND/16); size = len; } } for (i=0; i<64; i++) { if (rom[offset+size-3-i] == 0xff) break; } if (20 1) { /* parse input parameters */ for (argc--, argv++; *argv; argc--, argv++) { if ((strnicmp (*argv, "-", 1) == 0) || (strnicmp (*argv, "/", 1) == 0)) { if ((strnicmp (*argv, "-V", 2) == 0) || (strnicmp (*argv, "/V", 2) == 0)) { verbose = 1; } else { printf("Usage: %s [-v]\n"); } } } } for (i = ROMEND; (i -= ROMINCREMENT) >= ROMSTART;) if (rom_scan(0,i,ROMEND-i)) break; return 0; }