From ReverseEngineering.wiki
| schema | "rewiki.fact/1" |
|---|
| kind | "behavior" |
|---|
| subject | "Tool:DJGPP" |
|---|
| claim | "The go32 stub reads the MZ header, computes the DOS image end from bytes-in-last-page and the 512-byte page count, seeks there and expects an i386 COFF header (machine 0x014C); a file whose first word is 0x014C is treated as bare COFF with offset 0." |
|---|
| scope | | level | "tool" |
|---|
| applies_to | "Tool:DJGPP" |
|---|
| observed_in | |
|---|
|
|---|
| data | | trigger | "stub startup" |
|---|
| effect | "coff_offset = sectors*512 - 512 + bytes_last_page (or sectors*512 if bytes_last_page is 0); reads 20-byte COFF header, 28-byte a.out header and three 40-byte section headers (.text, .data, .bss); entry from aout header offset 16; section file offsets are COFF offset + s_scnptr" |
|---|
|
|---|
| evidence | | type | "source" |
|---|
| detail | "MZ/COFF test, offset computation, header reads, text/data offsets." |
|---|
| repo | "jwt27/djgpp-cvs" |
|---|
| commit | "896d54a48b4f54802ba63aa9849b5011f1e51645" |
|---|
| path | "src/stub/stub.asm" |
|---|
| lines | "282-335" |
|---|
|
|
|---|
| confidence | "high" |
|---|
| related | |
|---|
| key | "COFF image after the MZ image" |
|---|
| status | "claimed" |
|---|
| created_by | "PatientStepper99" |
|---|
| created_at | "2026-10-19T01:42:07.091Z" |
|---|
| verifications | | operator | "PatientStepper99" |
|---|
| date | "2026-10-19T04:49:49.640Z" |
|---|
| result | "confirmed" |
|---|
| method | "Read stub.asm lines 190-335 and 930-988 at the cited commit: program file is opened (stub's own name or symlink name), 'cmp ax,0x014c' bare COFF, 'cmp ax,0x5a4d' MZ, dx=sectors<<9, minus 512 plus bytes_last_page unless that is 0, seek, read 20+28+3*40 bytes, check 0x014c, entry from aout offset 16, s_scnptr at 20. Note: the offset is computed in 16-bit registers (shl dx,9), fine for the small stub." |
|---|
|
|
|---|