Created
September 6, 2024 21:27
-
-
Save ssg/4d0481d55e34aa26b1555c3afa933792 to your computer and use it in GitHub Desktop.
My attempt at an executable dumper for new EXE formats introduced with Windows 3.1, OS/2 etc
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ NE Lister } | |
uses XTypes,Dos,Objects; | |
var | |
dirinfo:SearchRec; | |
T:TDosStream; | |
H:TEXEHeader; | |
w:word; | |
l:longint; | |
b:byte; | |
begin | |
writeln('NewExe Dumper v1.00b - (c) 1994 SSG'); | |
writeln; | |
FindFirst('*.EXE',ReadOnly+Archive,dirinfo); | |
while DosError = 0 do begin | |
while length(dirinfo.name) < 12 do dirinfo.name := dirinfo.name + #32; | |
T.Init(dirinfo.name,stOpenRead); | |
T.Read(H,SizeOf(H)); | |
T.Seek(H.RelOfs-4); | |
T.Read(l,4); | |
T.Seek(l); | |
T.Read(w,2); | |
if w = $454e then begin | |
write(dirinfo.name+': '); | |
T.Seek(l+54); | |
T.Read(b,1); | |
case b of | |
1 : writeln('OS/2'); | |
2 : writeln('Windows'); | |
3 : writeln('DOS4'); | |
4 : writeln('Windows 386'); | |
5 : writeln('BOSS'); | |
else writeln('Unknown NewExe'); | |
end; | |
end else if w = $454c then begin | |
write(dirinfo.name+': '); | |
writeln('OS/2 Linear'); | |
end; | |
{ if H.Id <> $5A4D then writeln('not executable') else begin | |
T.Seek(H.HdrSize*16+H.LastPageSize); | |
T.Read(w,2); | |
if w = $454E then writeln('Windows') else begin | |
T.Seek(H.HdrSize*16-4); | |
T.Read(l,4); | |
T.Seek(l); | |
T.Read(w,2); | |
if w <> $454E then writeln('DOS') else writeln('OS/2'); | |
end; | |
end;} | |
T.Done; | |
FindNext(dirinfo); | |
end; | |
end. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment