Re: DOS & Long File Names
- Posted by Jacques Deschenes <desja at GLOBETROTTER.QC.CA> Jul 26, 1998
- 443 views
At 16:14 26/07/98 -0700, you wrote: > I have very limited hard drive space. I want to scan for Windows > programs. I have a program that will let me find *.exe files, BUT I don't know > what the difference in the header between DOS executables and Windows > Executables. (I want to get rid of any Windows programs floating around on my > computer. There probably are some because I found one the other day.) So > anybody know what the difference is? Thanks for all your help. > - Robert McDougal here is a function that will check a file to determine if it is a windows executable. include file.e constant signatures = { -- possible window file signatures "PE",-- window NT file "NE" -- window 3.x or later file } -- this function return 1 if the file is a widowns executable (.DLL or .EXE) -- return 0 if not a windows exec -- return -1 if can't open it. atom fh,ok integer c,hdr sequence FileId fh = open(FileName,"rb") if fh = -1 then return -1 end if FileId = getc(fh) & getc(fh) if compare(FileId,"MZ") != 0 then return 0 -- it's not a DOS or windows executable end if ok = seek(fh,#18) c = getc(fh)+256*getc(fh) if c < #40 then close(fh) return 0 -- not a window file. (DOS executable) end if ok = seek(fh,#3C) hdr = getc(fh)+256*getc(fh) -- offset of new executable header ok = seek(fh,hdr) -- window file header start here. FileId = getc(fh) & getc(fh) -- new header signature close(fh) if find(FileId,signatures) then return 1 -- yes it is a windows executable file. else return 0 -- unkown file type. end if ------------------------------ Jacques Deschenes Baie-Comeau, Quebec Canada desja at globetrotter.qc.ca