msdos 66 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767
  1. #------------------------------------------------------------------------------
  2. # $File: msdos,v 1.152 2021/10/12 18:26:10 christos Exp $
  3. # msdos: file(1) magic for MS-DOS files
  4. #
  5. # .BAT files (Daniel Quinlan, quinlan@yggdrasil.com)
  6. # updated by Joerg Jenderek at Oct 2008,Apr 2011
  7. 0 string/t @
  8. >1 string/cW \ echo\ off DOS batch file text
  9. !:mime text/x-msdos-batch
  10. !:ext bat
  11. >1 string/cW echo\ off DOS batch file text
  12. !:mime text/x-msdos-batch
  13. !:ext bat
  14. >1 string/cW rem DOS batch file text
  15. !:mime text/x-msdos-batch
  16. !:ext bat
  17. >1 string/cW set\ DOS batch file text
  18. !:mime text/x-msdos-batch
  19. !:ext bat
  20. # OS/2 batch files are REXX. the second regex is a bit generic, oh well
  21. # the matched commands seem to be common in REXX and uncommon elsewhere
  22. 100 search/0xffff rxfuncadd
  23. >100 regex/c =^[\ \t]{0,10}call[\ \t]{1,10}rxfunc OS/2 REXX batch file text
  24. 100 search/0xffff say
  25. >100 regex/c =^[\ \t]{0,10}say\ ['"] OS/2 REXX batch file text
  26. # updated by Joerg Jenderek at Oct 2015
  27. # https://de.wikipedia.org/wiki/Common_Object_File_Format
  28. # http://www.delorie.com/djgpp/doc/coff/filhdr.html
  29. # ./intel already labeled COFF type 0x14c=0514 as "80386 COFF executable"
  30. #0 leshort 0x14c MS Windows COFF Intel 80386 object file
  31. #>4 ledate x stamp %s
  32. 0 leshort 0x166 MS Windows COFF MIPS R4000 object file
  33. #>4 ledate x stamp %s
  34. 0 leshort 0x184 MS Windows COFF Alpha object file
  35. #>4 ledate x stamp %s
  36. 0 leshort 0x268 MS Windows COFF Motorola 68000 object file
  37. #>4 ledate x stamp %s
  38. 0 leshort 0x1f0 MS Windows COFF PowerPC object file
  39. #>4 ledate x stamp %s
  40. 0 leshort 0x290 MS Windows COFF PA-RISC object file
  41. #>4 ledate x stamp %s
  42. # Tests for various EXE types.
  43. #
  44. # Many of the compressed formats were extracted from IDARC 1.23 source code.
  45. #
  46. 0 string/b MZ
  47. # All non-DOS EXE extensions have the relocation table more than 0x40 bytes into the file.
  48. >0x18 leshort <0x40 MS-DOS executable
  49. !:mime application/x-dosexec
  50. # Windows and later versions of DOS will allow .EXEs to be named with a .COM
  51. # extension, mostly for compatibility's sake.
  52. # URL: https://en.wikipedia.org/wiki/Personal_NetWare#VLM
  53. # Reference: https://mark0.net/download/triddefs_xml.7z/defs/e/exe-vlm-msg.trid.xml
  54. !:ext exe/com/vlm
  55. # These traditional tests usually work but not always. When test quality support is
  56. # implemented these can be turned on.
  57. #>>0x18 leshort 0x1c (Borland compiler)
  58. #>>0x18 leshort 0x1e (MS compiler)
  59. # Maybe it's a PE?
  60. >(0x3c.l) string PE\0\0 PE
  61. !:mime application/x-dosexec
  62. >>(0x3c.l+24) leshort 0x010b \b32 executable
  63. >>(0x3c.l+24) leshort 0x020b \b32+ executable
  64. >>(0x3c.l+24) leshort 0x0107 ROM image
  65. >>(0x3c.l+24) default x Unknown PE signature
  66. >>>&0 leshort x %#x
  67. >>(0x3c.l+22) leshort&0x2000 >0 (DLL)
  68. >>(0x3c.l+92) leshort 1
  69. # Native PEs include ntoskrnl.exe, hal.dll, smss.exe, autochk.exe, and all the
  70. # drivers in Windows/System32/drivers/*.sys.
  71. >>>(0x3c.l+22) leshort&0x2000 >0 (native)
  72. !:ext dll/sys
  73. >>>(0x3c.l+22) leshort&0x2000 0 (native)
  74. !:ext exe/sys
  75. >>(0x3c.l+92) leshort 2
  76. >>>(0x3c.l+22) leshort&0x2000 >0 (GUI)
  77. # These could probably be at least partially distinguished from one another by
  78. # looking for specific exported functions.
  79. # CPL: Control Panel item
  80. # TLB: Type library
  81. # OCX: OLE/ActiveX control
  82. # ACM: Audio compression manager codec
  83. # AX: DirectShow source filter
  84. # IME: Input method editor
  85. !:ext dll/cpl/tlb/ocx/acm/ax/ime
  86. >>>(0x3c.l+22) leshort&0x2000 0 (GUI)
  87. # Screen savers typically include code from the scrnsave.lib static library, but
  88. # that's not guaranteed.
  89. !:ext exe/scr
  90. >>(0x3c.l+92) leshort 3
  91. >>>(0x3c.l+22) leshort&0x2000 >0 (console)
  92. !:ext dll/cpl/tlb/ocx/acm/ax/ime
  93. >>>(0x3c.l+22) leshort&0x2000 0 (console)
  94. !:ext exe/com
  95. # https://docs.microsoft.com/en-us/windows/win32/debug/pe-format
  96. >>(0x3c.l+92) leshort 7 (POSIX)
  97. >>(0x3c.l+92) leshort 9 (Windows CE)
  98. >>(0x3c.l+92) leshort 10 (EFI application)
  99. >>(0x3c.l+92) leshort 11 (EFI boot service driver)
  100. >>(0x3c.l+92) leshort 12 (EFI runtime driver)
  101. >>(0x3c.l+92) leshort 13 (EFI ROM)
  102. >>(0x3c.l+92) leshort 14 (XBOX)
  103. >>(0x3c.l+92) leshort 15 (Windows boot application)
  104. >>(0x3c.l+92) default x (Unknown subsystem
  105. >>>&0 leshort x %#x)
  106. >>(0x3c.l+4) leshort 0x14c Intel 80386
  107. >>(0x3c.l+4) leshort 0x166 MIPS R4000
  108. >>(0x3c.l+4) leshort 0x168 MIPS R10000
  109. >>(0x3c.l+4) leshort 0x184 Alpha
  110. >>(0x3c.l+4) leshort 0x1a2 Hitachi SH3
  111. >>(0x3c.l+4) leshort 0x1a3 Hitachi SH3 DSP
  112. >>(0x3c.l+4) leshort 0x1a8 Hitachi SH5
  113. >>(0x3c.l+4) leshort 0x169 MIPS WCE v2
  114. >>(0x3c.l+4) leshort 0x1a6 Hitachi SH4
  115. >>(0x3c.l+4) leshort 0x1c0 ARM
  116. >>(0x3c.l+4) leshort 0x1c2 ARM Thumb
  117. >>(0x3c.l+4) leshort 0x1c4 ARMv7 Thumb
  118. >>(0x3c.l+4) leshort 0x1d3 Matsushita AM33
  119. >>(0x3c.l+4) leshort 0x1f0 PowerPC
  120. >>(0x3c.l+4) leshort 0x1f1 PowerPC with FPU
  121. >>(0x3c.l+4) leshort 0x1f2 PowerPC (big-endian)
  122. >>(0x3c.l+4) leshort 0x200 Intel Itanium
  123. >>(0x3c.l+4) leshort 0x266 MIPS16
  124. >>(0x3c.l+4) leshort 0x268 Motorola 68000
  125. >>(0x3c.l+4) leshort 0x290 PA-RISC
  126. >>(0x3c.l+4) leshort 0x366 MIPSIV
  127. >>(0x3c.l+4) leshort 0x466 MIPS16 with FPU
  128. >>(0x3c.l+4) leshort 0xebc EFI byte code
  129. >>(0x3c.l+4) leshort 0x5032 RISC-V 32-bit
  130. >>(0x3c.l+4) leshort 0x5064 RISC-V 64-bit
  131. >>(0x3c.l+4) leshort 0x5128 RISC-V 128-bit
  132. >>(0x3c.l+4) leshort 0x9041 Mitsubishi M32R
  133. >>(0x3c.l+4) leshort 0x8664 x86-64
  134. >>(0x3c.l+4) leshort 0xaa64 Aarch64
  135. >>(0x3c.l+4) leshort 0xc0ee MSIL
  136. >>(0x3c.l+4) default x Unknown processor type
  137. >>>&0 leshort x %#x
  138. >>(0x3c.l+22) leshort&0x0200 >0 (stripped to external PDB)
  139. >>(0x3c.l+22) leshort&0x1000 >0 system file
  140. >>(0x3c.l+24) leshort 0x010b
  141. >>>(0x3c.l+232) lelong >0 Mono/.Net assembly
  142. >>(0x3c.l+24) leshort 0x020b
  143. >>>(0x3c.l+248) lelong >0 Mono/.Net assembly
  144. # hooray, there's a DOS extender using the PE format, with a valid PE
  145. # executable inside (which just prints a message and exits if run in win)
  146. >>(8.s*16) string 32STUB \b, 32rtm DOS extender
  147. >>(8.s*16) string !32STUB \b, for MS Windows
  148. >>(0x3c.l+0xf8) string UPX0 \b, UPX compressed
  149. >>(0x3c.l+0xf8) search/0x140 PEC2 \b, PECompact2 compressed
  150. >>(0x3c.l+0xf8) search/0x140 UPX2
  151. >>>(&0x10.l+(-4)) string PK\3\4 \b, ZIP self-extracting archive (Info-Zip)
  152. >>(0x3c.l+0xf8) search/0x140 .idata
  153. >>>(&0xe.l+(-4)) string PK\3\4 \b, ZIP self-extracting archive (Info-Zip)
  154. >>>(&0xe.l+(-4)) string ZZ0 \b, ZZip self-extracting archive
  155. >>>(&0xe.l+(-4)) string ZZ1 \b, ZZip self-extracting archive
  156. >>(0x3c.l+0xf8) search/0x140 .rsrc
  157. >>>(&0x0f.l+(-4)) string a\\\4\5 \b, WinHKI self-extracting archive
  158. >>>(&0x0f.l+(-4)) string Rar! \b, RAR self-extracting archive
  159. >>>(&0x0f.l+(-4)) search/0x3000 MSCF \b, InstallShield self-extracting archive
  160. >>>(&0x0f.l+(-4)) search/32 Nullsoft \b, Nullsoft Installer self-extracting archive
  161. >>(0x3c.l+0xf8) search/0x140 .data
  162. >>>(&0x0f.l) string WEXTRACT \b, MS CAB-Installer self-extracting archive
  163. >>(0x3c.l+0xf8) search/0x140 .petite\0 \b, Petite compressed
  164. >>>(0x3c.l+0xf7) byte x
  165. >>>>(&0x104.l+(-4)) string =!sfx! \b, ACE self-extracting archive
  166. >>(0x3c.l+0xf8) search/0x140 .WISE \b, WISE installer self-extracting archive
  167. >>(0x3c.l+0xf8) search/0x140 .dz\0\0\0 \b, Dzip self-extracting archive
  168. >>&(0x3c.l+0xf8) search/0x100 _winzip_ \b, ZIP self-extracting archive (WinZip)
  169. >>&(0x3c.l+0xf8) search/0x100 SharedD \b, Microsoft Installer self-extracting archive
  170. >>0x30 string Inno \b, InnoSetup self-extracting archive
  171. # If the relocation table is 0x40 or more bytes into the file, it's definitely
  172. # not a DOS EXE.
  173. >0x18 leshort >0x3f
  174. # Hmm, not a PE but the relocation table is too high for a traditional DOS exe,
  175. # must be one of the unusual subformats.
  176. >>(0x3c.l) string !PE\0\0 MS-DOS executable
  177. !:mime application/x-dosexec
  178. >>(0x3c.l) string NE \b, NE
  179. !:mime application/x-dosexec
  180. >>>(0x3c.l+0x36) byte 1 for OS/2 1.x
  181. >>>(0x3c.l+0x36) byte 2 for MS Windows 3.x
  182. >>>(0x3c.l+0x36) byte 3 for MS-DOS
  183. >>>(0x3c.l+0x36) byte 4 for Windows 386
  184. >>>(0x3c.l+0x36) byte 5 for Borland Operating System Services
  185. >>>(0x3c.l+0x36) default x
  186. >>>>(0x3c.l+0x36) byte x (unknown OS %x)
  187. >>>(0x3c.l+0x36) byte 0x81 for MS-DOS, Phar Lap DOS extender
  188. >>>(0x3c.l+0x0c) leshort&0x8000 0x8000 (DLL or font)
  189. # DRV: Driver
  190. # 3GR: Grabber device driver
  191. # CPL: Control Panel Item
  192. # VBX: Visual Basic Extension
  193. # FON: Bitmap font
  194. # FOT: Font resource file
  195. !:ext dll/drv/3gr/cpl/vbx/fon/fot
  196. >>>(0x3c.l+0x0c) leshort&0x8000 0 (EXE)
  197. !:ext exe/scr
  198. >>>&(&0x24.s-1) string ARJSFX \b, ARJ self-extracting archive
  199. >>>(0x3c.l+0x70) search/0x80 WinZip(R)\ Self-Extractor \b, ZIP self-extracting archive (WinZip)
  200. >>(0x3c.l) string LX\0\0 \b, LX
  201. !:mime application/x-dosexec
  202. >>>(0x3c.l+0x0a) leshort <1 (unknown OS)
  203. >>>(0x3c.l+0x0a) leshort 1 for OS/2
  204. >>>(0x3c.l+0x0a) leshort 2 for MS Windows
  205. >>>(0x3c.l+0x0a) leshort 3 for DOS
  206. >>>(0x3c.l+0x0a) leshort >3 (unknown OS)
  207. >>>(0x3c.l+0x10) lelong&0x28000 =0x8000 (DLL)
  208. >>>(0x3c.l+0x10) lelong&0x20000 >0 (device driver)
  209. >>>(0x3c.l+0x10) lelong&0x300 0x300 (GUI)
  210. >>>(0x3c.l+0x10) lelong&0x28300 <0x300 (console)
  211. >>>(0x3c.l+0x08) leshort 1 i80286
  212. >>>(0x3c.l+0x08) leshort 2 i80386
  213. >>>(0x3c.l+0x08) leshort 3 i80486
  214. >>>(8.s*16) string emx \b, emx
  215. >>>>&1 string x %s
  216. >>>&(&0x54.l-3) string arjsfx \b, ARJ self-extracting archive
  217. # MS Windows system file, supposedly a collection of LE executables
  218. >>(0x3c.l) string W3 \b, W3 for MS Windows
  219. !:mime application/x-dosexec
  220. >>(0x3c.l) string LE\0\0 \b, LE executable
  221. !:mime application/x-dosexec
  222. >>>(0x3c.l+0x0a) leshort 1
  223. # some DOS extenders use LE files with OS/2 header
  224. >>>>0x240 search/0x100 DOS/4G for MS-DOS, DOS4GW DOS extender
  225. >>>>0x240 search/0x200 WATCOM\ C/C++ for MS-DOS, DOS4GW DOS extender
  226. >>>>0x440 search/0x100 CauseWay\ DOS\ Extender for MS-DOS, CauseWay DOS extender
  227. >>>>0x40 search/0x40 PMODE/W for MS-DOS, PMODE/W DOS extender
  228. >>>>0x40 search/0x40 STUB/32A for MS-DOS, DOS/32A DOS extender (stub)
  229. >>>>0x40 search/0x80 STUB/32C for MS-DOS, DOS/32A DOS extender (configurable stub)
  230. >>>>0x40 search/0x80 DOS/32A for MS-DOS, DOS/32A DOS extender (embedded)
  231. # this is a wild guess; hopefully it is a specific signature
  232. >>>>&0x24 lelong <0x50
  233. >>>>>(&0x4c.l) string \xfc\xb8WATCOM
  234. >>>>>>&0 search/8 3\xdbf\xb9 \b, 32Lite compressed
  235. # another wild guess: if real OS/2 LE executables exist, they probably have higher start EIP
  236. #>>>>(0x3c.l+0x1c) lelong >0x10000 for OS/2
  237. # fails with DOS-Extenders.
  238. >>>(0x3c.l+0x0a) leshort 2 for MS Windows
  239. >>>(0x3c.l+0x0a) leshort 3 for DOS
  240. >>>(0x3c.l+0x0a) leshort 4 for MS Windows (VxD)
  241. # VXD: VxD for Windows 95/98/Me
  242. # 386: VxD for Windows 2.10, 3.0, 3.1x
  243. # PDR: Port driver
  244. # MPD: Miniport driver (?)
  245. !:ext vxd/386/pdr/mpd
  246. >>>(&0x7c.l+0x26) string UPX \b, UPX compressed
  247. >>>&(&0x54.l-3) string UNACE \b, ACE self-extracting archive
  248. # looks like ASCII, probably some embedded copyright message.
  249. # and definitely not NE/LE/LX/PE
  250. >>0x3c lelong >0x20000000
  251. >>>(4.s*512) leshort !0x014c \b, MZ for MS-DOS
  252. !:mime application/x-dosexec
  253. !:ext exe/com
  254. # header data too small for extended executable
  255. >2 long !0
  256. >>0x18 leshort <0x40
  257. >>>(4.s*512) leshort !0x014c
  258. >>>>&(2.s-514) string !LE
  259. >>>>>&-2 string !BW \b, MZ for MS-DOS
  260. !:mime application/x-dosexec
  261. >>>>&(2.s-514) string LE \b, LE
  262. >>>>>0x240 search/0x100 DOS/4G for MS-DOS, DOS4GW DOS extender
  263. # educated guess since indirection is still not capable enough for complex offset
  264. # calculations (next embedded executable would be at &(&2*512+&0-2)
  265. # I suspect there are only LE executables in these multi-exe files
  266. >>>>&(2.s-514) string BW
  267. >>>>>0x240 search/0x100 DOS/4G \b, LE for MS-DOS, DOS4GW DOS extender (embedded)
  268. >>>>>0x240 search/0x100 !DOS/4G \b, BW collection for MS-DOS
  269. # This sequence skips to the first COFF segment, usually .text
  270. >(4.s*512) leshort 0x014c \b, COFF
  271. !:mime application/x-dosexec
  272. >>(8.s*16) string go32stub for MS-DOS, DJGPP go32 DOS extender
  273. >>(8.s*16) string emx
  274. >>>&1 string x for DOS, Win or OS/2, emx %s
  275. >>&(&0x42.l-3) byte x
  276. >>>&0x26 string UPX \b, UPX compressed
  277. # and yet another guess: small .text, and after large .data is unusual, could be 32lite
  278. >>&0x2c search/0xa0 .text
  279. >>>&0x0b lelong <0x2000
  280. >>>>&0 lelong >0x6000 \b, 32lite compressed
  281. >(8.s*16) string $WdX \b, WDos/X DOS extender
  282. # By now an executable type should have been printed out. The executable
  283. # may be a self-uncompressing archive, so look for evidence of that and
  284. # print it out.
  285. #
  286. # Some signatures below from Greg Roelofs, newt@uchicago.edu.
  287. #
  288. >0x35 string \x8e\xc0\xb9\x08\x00\xf3\xa5\x4a\x75\xeb\x8e\xc3\x8e\xd8\x33\xff\xbe\x30\x00\x05 \b, aPack compressed
  289. >0xe7 string LH/2\ Self-Extract \b, %s
  290. >0x1c string UC2X \b, UCEXE compressed
  291. >0x1c string WWP\ \b, WWPACK compressed
  292. >0x1c string RJSX \b, ARJ self-extracting archive
  293. >0x1c string diet \b, diet compressed
  294. >0x1c string LZ09 \b, LZEXE v0.90 compressed
  295. >0x1c string LZ91 \b, LZEXE v0.91 compressed
  296. >0x1c string tz \b, TinyProg compressed
  297. >0x1e string Copyright\ 1989-1990\ PKWARE\ Inc. Self-extracting PKZIP archive
  298. !:mime application/zip
  299. # Yes, this really is "Copr", not "Corp."
  300. >0x1e string PKLITE\ Copr. Self-extracting PKZIP archive
  301. !:mime application/zip
  302. # winarj stores a message in the stub instead of the sig in the MZ header
  303. >0x20 search/0xe0 aRJsfX \b, ARJ self-extracting archive
  304. >0x20 string AIN
  305. >>0x23 string 2 \b, AIN 2.x compressed
  306. >>0x23 string <2 \b, AIN 1.x compressed
  307. >>0x23 string >2 \b, AIN 1.x compressed
  308. >0x24 string LHa's\ SFX \b, LHa self-extracting archive
  309. !:mime application/x-lha
  310. >0x24 string LHA's\ SFX \b, LHa self-extracting archive
  311. !:mime application/x-lha
  312. >0x24 string \ $ARX \b, ARX self-extracting archive
  313. >0x24 string \ $LHarc \b, LHarc self-extracting archive
  314. >0x20 string SFX\ by\ LARC \b, LARC self-extracting archive
  315. >0x40 string aPKG \b, aPackage self-extracting archive
  316. >0x64 string W\ Collis\0\0 \b, Compack compressed
  317. >0x7a string Windows\ self-extracting\ ZIP \b, ZIP self-extracting archive
  318. >>&0xf4 search/0x140 \x0\x40\x1\x0
  319. >>>(&0.l+(4)) string MSCF \b, WinHKI CAB self-extracting archive
  320. >1638 string -lh5- \b, LHa self-extracting archive v2.13S
  321. >0x17888 string Rar! \b, RAR self-extracting archive
  322. # Skip to the end of the EXE. This will usually work fine in the PE case
  323. # because the MZ image is hardcoded into the toolchain and almost certainly
  324. # won't match any of these signatures.
  325. >(4.s*512) long x
  326. >>&(2.s-517) byte x
  327. >>>&0 string PK\3\4 \b, ZIP self-extracting archive
  328. >>>&0 string Rar! \b, RAR self-extracting archive
  329. >>>&0 string =!\x11 \b, AIN 2.x self-extracting archive
  330. >>>&0 string =!\x12 \b, AIN 2.x self-extracting archive
  331. >>>&0 string =!\x17 \b, AIN 1.x self-extracting archive
  332. >>>&0 string =!\x18 \b, AIN 1.x self-extracting archive
  333. >>>&7 search/400 **ACE** \b, ACE self-extracting archive
  334. >>>&0 search/0x480 UC2SFX\ Header \b, UC2 self-extracting archive
  335. # a few unknown ZIP sfxes, no idea if they are needed or if they are
  336. # already captured by the generic patterns above
  337. >(8.s*16) search/0x20 PKSFX \b, ZIP self-extracting archive (PKZIP)
  338. # TODO: how to add this? >FileSize-34 string Windows\ Self-Installing\ Executable \b, ZIP self-extracting archive
  339. #
  340. # TELVOX Teleinformatica CODEC self-extractor for OS/2:
  341. >49801 string \x79\xff\x80\xff\x76\xff \b, CODEC archive v3.21
  342. >>49824 leshort =1 \b, 1 file
  343. >>49824 leshort >1 \b, %u files
  344. # Summary: OS/2 LX Library and device driver (no DOS stub)
  345. # From: Joerg Jenderek
  346. # URL: http://en.wikipedia.org/wiki/EXE
  347. # Reference: http://www.textfiles.com/programming/FORMATS/lxexe.txt
  348. # https://github.com/open-watcom/open-watcom-v2/blob/master/bld/watcom/h/exeflat.h
  349. # Note: by dll-os2-no-dos-stub.trid.xml called "OS/2 Dynamic Link Library (no DOS stub)"
  350. # TODO: unify with DOS stub variant (MZ magic)
  351. 0 string/b LX
  352. >2 ushort =0
  353. >>0 use lx-executable
  354. # no examples found for big endian variant
  355. >2 ushort =0x0101
  356. >>0 use \^lx-executable
  357. 0 name lx-executable
  358. # similar looking like variant with MS-DOS stub (MZ magic): "MS-DOS executable, LX"
  359. #>0x00 uleshort x executable,
  360. # signature OSF_FLAT_LX_SIGNATURE~0x584C~LX OSF_FLAT_SIGNATURE~0x454C~LE
  361. >0x00 uleshort =0x584c LX
  362. >0x00 uleshort =0x454C LE
  363. >0x00 uleshort x executable
  364. #!:mime application/x-msdownload
  365. !:mime application/x-lx-executable
  366. # byte order: 00h~little-endian non-zero=1~big-endian
  367. #>0x02 ubyte =0 (little-endian)
  368. >0x02 ubyte !0 (big-endian)
  369. # FOR DEBUGGING!
  370. # word order: 00h~little-endian non-zero=1~big-endian
  371. #>0x03 ubyte =0 \b, little-endian word order
  372. #>0x03 ubyte !0 \b, big-endian word order
  373. # cpu_type; CPU type like: 1~286 2~386 3~486 4 20h~i860 21h~Intel N11 40h~MIPS R2000,R3000 41h~MIPS R6000 42h~MIPS R4000
  374. #>0x08 uleshort x \b, CPU %u
  375. # os_type; target operating system like: 0~unknown 1~OS/2 2~Windows 3~DOS 4.x 4~Windows 386
  376. #>0x0A leshort x \b, OS %u
  377. # flags; module type flags
  378. #>0x10 ulelong x \b, FLAGS %#8.8x
  379. # 00000002h ~Reserved for system use
  380. #>0x10 ulelong &0x00000002 \b, 2h reserved
  381. # OSF_INIT_INSTANCE=00000004h ~Per-Process Library Initialization; setting this bit for EXE file is invalid
  382. #>0x10 ulelong &0x00000004 \b, per-process library Initialization
  383. # OSF_INTERNAL_FIXUPS_DONE=00000010h ~Internal fixups for the module have been applied
  384. #>0x10 ulelong &0x00000010 \b, int. fixup
  385. # OSF_EXTERNAL_FIXUPS_DONE=00000020h ~External fixups for the module have been applied
  386. #>0x10 ulelong &0x00000020 \b, ext. fixup
  387. # OSF_NOT_PM_COMPATIBLE=00000100h ~Incompatible with PM windowing
  388. #>0x10 ulelong&0x00000100 =0x00000100 \b, incompatible with PM windowing
  389. # OSF_PM_COMPATIBLE=00000200h ~Compatible with PM windowing
  390. #>0x10 ulelong&0x00000200 =0x00000200 \b, compatible with PM windowing
  391. # bit 17; device driver
  392. #>0x10 ulelong&0x00020000 >0 \b, device driver
  393. # Per-process Library Termination; setting this bit for EXE file is invalid
  394. #>0x10 ulelong&0x40000000 =0x40000000 \b, per-process library termination
  395. >0x0a leshort 1 for OS/2
  396. # no example found
  397. >0x0a leshort 3 for DOS
  398. # http://www.ctyme.com/intr/rb-2939.htm#Table1610
  399. # library by module type mask 00038000h (bits 15-17);
  400. # 0h ~exectable Program module
  401. >0x10 ulelong&0x00038000 =0x00000000 (program)
  402. #!:ext exe
  403. # OSF_IS_DLL=8000h ~Library module (DLL)
  404. >0x10 ulelong&0x00038000 >0x00000000
  405. # OSF_PHYS_DEVICE=00020000h ~device driver
  406. >>0x10 ulelong&0x00020000 >0 (device driver)
  407. !:ext sys
  408. # if not device driver it is library (DLL)
  409. >>0x10 ulelong&0x00020000 =0 (library)
  410. !:ext dll
  411. # bits 8-10; OSF_PM_APP=300h in flags ~Uses PM windowing API; either it is GUI or console
  412. >0x10 ulelong&0x00000300 =0x00000300 (GUI)
  413. >0x10 ulelong&0x00000300 !0x00000300 (console)
  414. # CPU type
  415. >0x08 uleshort 1 i80286
  416. # all inspected examples
  417. >0x08 uleshort 2 i80386
  418. >0x08 uleshort 3 i80486
  419. >0x08 uleshort 4 i80586
  420. # 21h Intel "N11" or compatible
  421. # 40h MIPS Mark I ( R2000, R3000) or compatible
  422. # 41h MIPS Mark II ( R6000 ) or compatible
  423. # 42h MIPS Mark III ( R4000 ) or compatible
  424. # added by Joerg Jenderek of https://www.freedos.org/software/?prog=kc
  425. # and https://www.freedos.org/software/?prog=kpdos
  426. # for FreeDOS files like KEYBOARD.SYS, KEYBRD2.SYS, KEYBRD3.SYS, *.KBD
  427. 0 string/b KCF FreeDOS KEYBoard Layout collection
  428. # only version=0x100 found
  429. >3 uleshort x \b, version %#x
  430. # length of string containing author,info and special characters
  431. >6 ubyte >0
  432. #>>6 pstring x \b, name=%s
  433. >>7 string >\0 \b, author=%-.14s
  434. >>7 search/254 \xff \b, info=
  435. #>>>&0 string x \b%-s
  436. >>>&0 string x \b%-.15s
  437. # for FreeDOS *.KL files
  438. 0 string/b KLF FreeDOS KEYBoard Layout file
  439. # only version=0x100 or 0x101 found
  440. >3 uleshort x \b, version %#x
  441. # stringlength
  442. >5 ubyte >0
  443. >>8 string x \b, name=%-.2s
  444. 0 string \xffKEYB\ \ \ \0\0\0\0
  445. >12 string \0\0\0\0`\004\360 MS-DOS KEYBoard Layout file
  446. # DOS device driver updated by Joerg Jenderek at May 2011,Mar 2017,Aug 2020
  447. # URL: http://fileformats.archiveteam.org/wiki/DOS_device_driver
  448. # Reference: http://www.delorie.com/djgpp/doc/rbinter/it/46/16.html
  449. # https://amaus.net/static/S100/IBM/software/DOS/DOS%20techref/CHAPTER.009
  450. 0 ulequad&0x07a0ffffffff 0xffffffff
  451. # skip OS/2 INI ./os2
  452. >4 ubelong !0x14000000
  453. >>0 use msdos-driver
  454. 0 name msdos-driver DOS executable (
  455. #!:mime application/octet-stream
  456. !:mime application/x-dosdriver
  457. # also found FreeDOS print driver SPOOL.DEV and disc compression driver STACLOAD.BIN
  458. # and IBM Token-Ring adapter IBMTOK.DOS. Why and when DOS instead SYS is used?
  459. # PROTMAN.DOS ELNKPL.DOS
  460. !:ext sys/dev/bin/dos
  461. # 1 space char after "UPX compressed" to get phrase like "UPX compressed character device"
  462. >40 search/7 UPX! \bUPX compressed
  463. # DOS device driver attributes
  464. >4 uleshort&0x8000 0x0000 \bblock device driver
  465. # character device
  466. >4 uleshort&0x8000 0x8000 \b
  467. # 1 space char after "clock" to get phrase like "clock character device driver CLOCK$"
  468. >>4 uleshort&0x0008 0x0008 \bclock
  469. # fast video output by int 29h
  470. # 1 space char after "fast" to get phrase like "fast standard input/output character device driver"
  471. >>4 uleshort&0x0010 0x0010 \bfast
  472. # standard input/output device
  473. # 1 space char after "standard" to get phrase like "standard input/output character device driver"
  474. >>4 uleshort&0x0003 >0 \bstandard
  475. >>>4 uleshort&0x0001 0x0001 \binput
  476. >>>4 uleshort&0x0003 0x0003 \b/
  477. # 1 space char after "output" to get phrase like "input/output character device driver"
  478. >>>4 uleshort&0x0002 0x0002 \boutput
  479. >>4 uleshort&0x8000 0x8000 \bcharacter device driver
  480. >0 ubyte x
  481. # upx compressed device driver has garbage instead of real in name field of header
  482. >>40 search/7 UPX!
  483. >>40 default x
  484. # leading/trailing nulls, zeros or non ASCII characters in 8-byte name field at offset 10 are skipped
  485. # 1 space char before device driver name to get phrase like "device driver PROTMAN$"
  486. >>>12 ubyte >0x2E \b
  487. >>>>10 ubyte >0x20
  488. >>>>>10 ubyte !0x2E
  489. >>>>>>10 ubyte !0x2A \b%c
  490. >>>>11 ubyte >0x20
  491. >>>>>11 ubyte !0x2E \b%c
  492. >>>>12 ubyte >0x20
  493. >>>>>12 ubyte !0x39
  494. >>>>>>12 ubyte !0x2E \b%c
  495. >>>13 ubyte >0x20
  496. >>>>13 ubyte !0x2E \b%c
  497. >>>>14 ubyte >0x20
  498. >>>>>14 ubyte !0x2E \b%c
  499. >>>>15 ubyte >0x20
  500. >>>>>15 ubyte !0x2E \b%c
  501. >>>>16 ubyte >0x20
  502. >>>>>16 ubyte !0x2E
  503. >>>>>>16 ubyte <0xCB \b%c
  504. >>>>17 ubyte >0x20
  505. >>>>>17 ubyte !0x2E
  506. >>>>>>17 ubyte <0x90 \b%c
  507. # some character device drivers like ASPICD.SYS, btcdrom.sys and Cr_atapi.sys contain only spaces or points in name field
  508. >>>12 ubyte <0x2F
  509. # they have their real name at offset 22
  510. # also block device drivers like DUMBDRV.SYS
  511. >>>>22 string >\056 %-.6s
  512. >4 uleshort&0x8000 0x0000
  513. # 32 bit sector addressing ( > 32 MB) for block devices
  514. >>4 uleshort&0x0002 0x0002 \b,32-bit sector-
  515. # support by driver functions 13h, 17h, 18h
  516. >4 uleshort&0x0040 0x0040 \b,IOCTL-
  517. # open, close, removable media support by driver functions 0Dh, 0Eh, 0Fh
  518. >4 uleshort&0x0800 0x0800 \b,close media-
  519. # output until busy support by int 10h for character device driver
  520. >4 uleshort&0x8000 0x8000
  521. >>4 uleshort&0x2000 0x2000 \b,until busy-
  522. # direct read/write support by driver functions 03h,0Ch
  523. >4 uleshort&0x4000 0x4000 \b,control strings-
  524. >4 uleshort&0x8000 0x8000
  525. >>4 uleshort&0x6840 >0 \bsupport
  526. >4 uleshort&0x8000 0x0000
  527. >>4 uleshort&0x4842 >0 \bsupport
  528. >0 ubyte x \b)
  529. >0 ulelong !0xffffffff with pointer %#x
  530. # DOS driver cmd640x.sys has 0x12 instead of 0xffffffff for pointer field to next device header
  531. 0 ulequad 0x0513c00000000012
  532. >0 use msdos-driver
  533. # DOS drivers DC2975.SYS, DUMBDRV.SYS, ECHO.SYS has also none 0xffffffff for pointer field
  534. 0 ulequad 0x32f28000ffff0016
  535. >0 use msdos-driver
  536. 0 ulequad 0x007f00000000ffff
  537. >0 use msdos-driver
  538. # https://www.uwe-sieber.de/files/cfg_echo.zip
  539. 0 ulequad 0x001600000000ffff
  540. >0 use msdos-driver
  541. # DOS drivers LS120.SYS, MKELS120.SYS use reserved bits of attribute field
  542. 0 ulequad 0x0bf708c2ffffffff
  543. >0 use msdos-driver
  544. 0 ulequad 0x07bd08c2ffffffff
  545. >0 use msdos-driver
  546. # 3Com EtherLink 3C501 CID\SERVER\IBMLS\IBM500D1\DLSNETDR.ZIP\ELNK.DOS
  547. 0 ulequad 0x027ac0c0ffffffff
  548. >0 use msdos-driver
  549. # IBM Streamer CID\SERVER\IBMLS\IBM500D1\DLSNETDR.ZIP\IBMMPC.DOS
  550. 0 ulequad 0x00228880ffffffff
  551. >0 use msdos-driver
  552. # updated by Joerg Jenderek
  553. # GRR: line below too general as it catches also
  554. # rt.lib DYADISKS.PIC and many more
  555. # start with assembler instruction MOV
  556. 0 ubyte 0x8c
  557. # skip "AppleWorks word processor data" like ARTICLE.1 ./apple
  558. >4 string !O====
  559. # skip some unknown basic binaries like RocketRnger.SHR
  560. >>5 string !MAIN
  561. # skip "GPG symmetrically encrypted data" ./gnu
  562. # skip "PGP symmetric key encrypted data" ./pgp
  563. # openpgpdefs.h: fourth byte < 14 indicate cipher algorithm type
  564. >>>4 ubyte >13 DOS executable (COM, 0x8C-variant)
  565. # the remaining files should be DOS *.COM executables
  566. # dosshell.COM 8cc0 2ea35f07 e85211 e88a11 b80058 cd
  567. # hmload.COM 8cc8 8ec0 bbc02b 89dc 83c30f c1eb04 b4
  568. # UNDELETE.COM 8cca 2e8916 6503 b430 cd21 8b 2e0200 8b
  569. # BOOTFIX.COM 8cca 2e8916 9603 b430 cd21 8b 2e0200 8b
  570. # RAWRITE3.COM 8cca 2e8916 d602 b430 cd21 8b 2e0200 8b
  571. # SHARE.COM 8cca 2e8916 d602 b430 cd21 8b 2e0200 8b
  572. # validchr.COM 8cca 2e8916 9603 b430 cd21 8b 2e028b1e
  573. # devload.COM 8cca 8916ad01 b430 cd21 8b2e0200 892e
  574. !:mime application/x-dosexec
  575. !:ext com
  576. # updated by Joerg Jenderek at Oct 2008
  577. 0 ulelong 0xffff10eb DR-DOS executable (COM)
  578. # byte 0xeb conflicts with "sequent" magic leshort 0xn2eb
  579. 0 ubeshort&0xeb8d >0xeb00
  580. # DR-DOS STACKER.COM SCREATE.SYS missed
  581. 0 name msdos-com
  582. >0 byte x DOS executable (COM)
  583. !:mime application/x-dosexec
  584. !:ext com
  585. >6 string SFX\ of\ LHarc \b, %s
  586. >0x1FE leshort 0xAA55 \b, boot code
  587. >85 string UPX \b, UPX compressed
  588. >4 string \ $ARX \b, ARX self-extracting archive
  589. >4 string \ $LHarc \b, LHarc self-extracting archive
  590. >0x20e string SFX\ by\ LARC \b, LARC self-extracting archive
  591. # JMP 8bit
  592. 0 byte 0xeb
  593. # allow forward jumps only
  594. >1 byte >-1
  595. # that offset must be accessible
  596. >>(1.b+2) byte x
  597. >>>0 use msdos-com
  598. # JMP 16bit
  599. 0 byte 0xe9
  600. # forward jumps
  601. >1 short >-1
  602. # that offset must be accessible
  603. >>(1.s+3) byte x
  604. >>>0 use msdos-com
  605. # negative offset, must not lead into PSP
  606. >1 short <-259
  607. # that offset must be accessible
  608. >>(1,s+65539) byte x
  609. >>>0 use msdos-com
  610. # updated by Joerg Jenderek at Oct 2008,2015
  611. # following line is too general
  612. 0 ubyte 0xb8
  613. # skip 2 linux kernels like memtest.bin with "\xb8\xc0\x07\x8e" in ./linux
  614. >0 string !\xb8\xc0\x07\x8e
  615. # modified by Joerg Jenderek
  616. # syslinux COM32 or COM32R executable
  617. >>1 lelong&0xFFFFFFFe 0x21CD4CFe COM executable (32-bit COMBOOT
  618. # https://www.syslinux.org/wiki/index.php/Comboot_API
  619. # Since version 5.00 c32 modules switched from the COM32 object format to ELF
  620. !:mime application/x-c32-comboot-syslinux-exec
  621. !:ext c32
  622. # https://syslinux.zytor.com/comboot.php
  623. # older syslinux version ( <4 )
  624. # (32-bit COMBOOT) programs *.C32 contain 32-bit code and run in flat-memory 32-bit protected mode
  625. # start with assembler instructions mov eax,21cd4cffh
  626. >>>1 lelong 0x21CD4CFf \b)
  627. # syslinux:doc/comboot.txt
  628. # A COM32R program must start with the byte sequence B8 FE 4C CD 21 (mov
  629. # eax,21cd4cfeh) as a magic number.
  630. # syslinux version (4.x)
  631. # "COM executable (COM32R)" or "Syslinux COM32 module" by TrID
  632. >>>1 lelong 0x21CD4CFe \b, relocatable)
  633. # Hajin Jang <hajin_jang@worksmobile.com>:
  634. # Disable simplest COM signature to prevent false positive on some EUC-KR text files.
  635. ## remaining are DOS COM executables starting with assembler instruction MOV
  636. ## like FreeDOS BANNER*.COM FINDDISK.COM GIF2RAW.COM WINCHK.COM
  637. ## MS-DOS SYS.COM RESTART.COM
  638. ## SYSLINUX.COM (version 1.40 - 2.13)
  639. ## GFXBOOT.COM (version 3.75)
  640. ## COPYBS.COM POWEROFF.COM INT18.COM
  641. >>1 default x COM executable for DOS
  642. !:mime application/x-dosexec
  643. ##!:mime application/x-ms-dos-executable
  644. ##!:mime application/x-msdos-program
  645. !:ext com
  646. # URL: https://en.wikipedia.org/wiki/UPX
  647. # Reference: https://github.com/upx/upx/archive/v3.96.zip/upx-3.96/
  648. # src/stub/src/i086-dos16.com.S
  649. # Update: Joerg Jenderek
  650. # assembler instructions: cmp sp, offset sp_limit
  651. 0 string/b \x81\xfc
  652. #>2 uleshort x \b, sp_limit=%#x
  653. # assembler instructions: jump above +2; int 0x20; mov cx, offset bytes_to_copy
  654. >4 string \x77\x02\xcd\x20\xb9
  655. #>9 uleshort x \b, [bytes_to_copy]=%#x
  656. # at different offsets assembler instructions: push di; jump decomp_start_n2b
  657. >0x1e search/3 \x57\xe9
  658. #>>&0 uleshort x \b, decomp_start_n2b=%#x
  659. # src/stub/src/include/header.S; UPX_MAGIC_LE32
  660. >>&2 string UPX! FREE-DOS executable (COM), UPX
  661. !:mime application/x-dosexec
  662. # UPX compressed *.CPI; See ./fonts
  663. >>>&21 string =FONT compressed DOS code page font
  664. !:ext cpx
  665. >>>&21 string !FONT compressed
  666. !:ext com
  667. # compressed size?
  668. #>>>&14 uleshort+152 x \b, %u bytes
  669. # uncompressed len
  670. >>>&12 uleshort x \b, uncompressed %u bytes
  671. 252 string Must\ have\ DOS\ version DR-DOS executable (COM)
  672. !:mime application/x-dosexec
  673. !:ext com
  674. # GRR search is not working
  675. #2 search/28 \xcd\x21 COM executable for MS-DOS
  676. #WHICHFAT.cOM
  677. 2 string \xcd\x21 COM executable for DOS
  678. !:mime application/x-dosexec
  679. !:ext com
  680. #DELTREE.cOM DELTREE2.cOM
  681. 4 string \xcd\x21 COM executable for DOS
  682. !:mime application/x-dosexec
  683. !:ext com
  684. #IFMEMDSK.cOM ASSIGN.cOM COMP.cOM
  685. 5 string \xcd\x21 COM executable for DOS
  686. !:mime application/x-dosexec
  687. !:ext com
  688. #DELTMP.COm HASFAT32.cOM
  689. 7 string \xcd\x21
  690. >0 byte !0xb8 COM executable for DOS
  691. !:mime application/x-dosexec
  692. !:ext com
  693. #COMP.cOM MORE.COm
  694. 10 string \xcd\x21
  695. >5 string !\xcd\x21 COM executable for DOS
  696. !:mime application/x-dosexec
  697. !:ext com
  698. #comecho.com
  699. 13 string \xcd\x21 COM executable for DOS
  700. !:mime application/x-dosexec
  701. !:ext com
  702. #HELP.COm EDIT.coM
  703. 18 string \xcd\x21
  704. # not printable before it?
  705. >17 byte >32
  706. >>17 byte <126
  707. >>17 default x COM executable for MS-DOS
  708. !:mime application/x-dosexec
  709. !:ext com
  710. #NWRPLTRM.COm
  711. 23 string \xcd\x21 COM executable for MS-DOS
  712. !:mime application/x-dosexec
  713. !:ext com
  714. #LOADFIX.cOm LOADFIX.cOm
  715. 30 string \xcd\x21 COM executable for MS-DOS
  716. !:mime application/x-dosexec
  717. !:ext com
  718. #syslinux.com 3.11
  719. 70 string \xcd\x21 COM executable for DOS
  720. !:mime application/x-dosexec
  721. !:ext com
  722. # many compressed/converted COMs start with a copy loop instead of a jump
  723. 0x6 search/0xa \xfc\x57\xf3\xa5\xc3 COM executable for MS-DOS
  724. !:mime application/x-dosexec
  725. !:ext com
  726. 0x6 search/0xa \xfc\x57\xf3\xa4\xc3 COM executable for DOS
  727. !:mime application/x-dosexec
  728. !:ext com
  729. >0x18 search/0x10 \x50\xa4\xff\xd5\x73 \b, aPack compressed
  730. 0x3c string W\ Collis\0\0 COM executable for MS-DOS, Compack compressed
  731. !:mime application/x-dosexec
  732. !:ext com
  733. # FIXME: missing diet .com compression
  734. # miscellaneous formats
  735. 0 string/b LZ MS-DOS executable (built-in)
  736. #0 byte 0xf0 MS-DOS program library data
  737. #
  738. # AAF files:
  739. # <stuartc@rd.bbc.co.uk> Stuart Cunningham
  740. 0 string/b \320\317\021\340\241\261\032\341AAFB\015\000OM\006\016\053\064\001\001\001\377 AAF legacy file using MS Structured Storage
  741. >30 byte 9 (512B sectors)
  742. >30 byte 12 (4kB sectors)
  743. 0 string/b \320\317\021\340\241\261\032\341\001\002\001\015\000\002\000\000\006\016\053\064\003\002\001\001 AAF file using MS Structured Storage
  744. >30 byte 9 (512B sectors)
  745. >30 byte 12 (4kB sectors)
  746. # Popular applications
  747. #
  748. # Update: Joerg Jenderek
  749. # URL: http://fileformats.archiveteam.org/wiki/DOC
  750. # Reference: https://web.archive.org/web/20170206041048/
  751. # http://www.msxnet.org/word2rtf/formats/ffh-dosword5
  752. # wIdent+dty
  753. 0 belong 0x31be0000
  754. # skip droid skeleton like x-fmt-274-signature-id-488.doc
  755. >128 ubyte >0 Microsoft
  756. >>96 uleshort =0 Word
  757. !:mime application/msword
  758. !:apple MSWDWDBN
  759. # DCX is used in the Unix version.
  760. !:ext doc/dcx
  761. >>>0x6E ulequad =0 1.0-4.0
  762. >>>0x6E ulequad !0 5.0-6.0
  763. >>>0x6E ulequad x (DOS) Document
  764. # https://web.archive.org/web/20130831064118/http://msxnet.org/word2rtf/formats/write.txt
  765. >>96 uleshort !0 Write 3.0 (Windows) Document
  766. !:mime application/x-mswrite
  767. !:apple MSWDWDBN
  768. # sometimes also doc like in splitter.doc srchtest.doc
  769. !:ext wri/doc
  770. # wTool must be 0125400 octal
  771. #>>4 uleshort !0xAB00 \b, wTool %o
  772. # reserved; must be zero
  773. #>>6 ulelong !0 \b, reserved %u
  774. # block pointer to the block containing optional file manager information
  775. #>>0x1C uleshort x \b, at %#x info block
  776. # jump to File manager information block
  777. >>(0x1C.s*128) uleshort x
  778. # test for valid information start; maybe also 0012h
  779. >>>&-2 uleshort =0x0014
  780. # Document ASCIIZ name
  781. >>>>&0x12 string x %s
  782. # author name
  783. >>>>>&1 string x \b, author %s
  784. # reviser name
  785. >>>>>>&1 string x \b, reviser %s
  786. # keywords
  787. >>>>>>>&1 string x \b, keywords %s
  788. # comment
  789. >>>>>>>>&1 string x \b, comment %s
  790. # version number
  791. >>>>>>>>>&1 string x \b, version %s
  792. # date of last change MM/DD/YY
  793. >>>>>>>>>>&1 string x \b, %-.8s
  794. # creation date MM/DD/YY
  795. >>>>>>>>>>&9 string x created %-.8s
  796. # file name of print format like NORMAL.STY
  797. >>0x1E string >0 \b, formatted by %-.66s
  798. # count of pages in whole file for write variant; maybe some times wrong
  799. >>96 uleshort >0 \b, %u pages
  800. # name of the printer driver like HPLASMS
  801. >>0x62 string >0 \b, %-.8s printer
  802. # number of blocks used in the file; seems to be 0 for Word 4.0 and Write 3.0
  803. >>0x6A uleshort >0 \b, %u blocks
  804. # bit field for corrected text areas
  805. #>>0x6C uleshort x \b, %#x bit field
  806. # text of document; some times start with 4 non printable characters like CR LF
  807. >>128 ubyte x \b,
  808. >>>128 ubyte >0x1F
  809. >>>>128 string x %s
  810. >>>128 ubyte <0x20
  811. >>>>129 ubyte >0x1F
  812. >>>>>129 string x %s
  813. >>>>129 ubyte <0x20
  814. >>>>>130 ubyte >0x1F
  815. >>>>>>130 string x %s
  816. >>>>>130 ubyte <0x20
  817. >>>>>>131 ubyte >0x1F
  818. >>>>>>>131 string x %s
  819. >>>>>>131 ubyte <0x20
  820. >>>>>>>132 ubyte >0x1F
  821. >>>>>>>>132 string x %s
  822. >>>>>>>132 ubyte <0x20
  823. >>>>>>>>133 ubyte >0x1F
  824. >>>>>>>>>133 string x %s
  825. #
  826. 0 string/b PO^Q` Microsoft Word 6.0 Document
  827. !:mime application/msword
  828. #
  829. 4 long 0
  830. >0 belong 0xfe320000 Microsoft Word for Macintosh 1.0
  831. !:mime application/msword
  832. !:ext mcw
  833. >0 belong 0xfe340000 Microsoft Word for Macintosh 3.0
  834. !:mime application/msword
  835. !:ext mcw
  836. >0 belong 0xfe37001c Microsoft Word for Macintosh 4.0
  837. !:mime application/msword
  838. !:ext mcw
  839. >0 belong 0xfe370023 Microsoft Word for Macintosh 5.0
  840. !:mime application/msword
  841. !:ext mcw
  842. 0 string/b \333\245-\0\0\0 Microsoft Word 2.0 Document
  843. !:mime application/msword
  844. !:ext doc
  845. # Note: seems already recognized as "OLE 2 Compound Document" in ./ole2compounddocs
  846. #512 string/b \354\245\301 Microsoft Word Document
  847. #!:mime application/msword
  848. #
  849. 0 string/b \xDB\xA5\x2D\x00 Microsoft WinWord 2.0 Document
  850. !:mime application/msword
  851. #
  852. 0 string/b \xDB\xA5\x2D\x00 Microsoft WinWord 2.0 Document
  853. !:mime application/msword
  854. #
  855. 0 string/b \x09\x04\x06\x00\x00\x00\x10\x00 Microsoft Excel Worksheet
  856. !:mime application/vnd.ms-excel
  857. # https://www.macdisk.com/macsigen.php
  858. !:apple XCELXLS4
  859. !:ext xls
  860. #
  861. # Update: Joerg Jenderek
  862. # URL: https://en.wikipedia.org/wiki/Lotus_1-2-3
  863. # Reference: http://www.aboutvb.de/bas/formate/pdf/wk3.pdf
  864. # Note: newer Lotus versions >2 use longer BOF record
  865. # record type (BeginningOfFile=0000h) + length (001Ah)
  866. 0 belong 0x00001a00
  867. # reserved should be 0h but 8c0dh for TUTMAC.WK3, 5h for SAMPADNS.WK3, 1h for a_readme.wk3, 1eh for K&G86.WK3
  868. #>18 uleshort&0x73E0 0
  869. # Lotus Multi Byte Character Set (LMBCS=1-31)
  870. >20 ubyte >0
  871. >>20 ubyte <32 Lotus 1-2-3
  872. #!:mime application/x-123
  873. !:mime application/vnd.lotus-1-2-3
  874. !:apple ????L123
  875. # (version 5.26) labeled the entry as "Lotus 1-2-3 wk3 document data"
  876. >>>4 uleshort 0x1000 WorKsheet, version 3
  877. !:ext wk3
  878. # (version 5.26) labeled the entry as "Lotus 1-2-3 wk4 document data"
  879. >>>4 uleshort 0x1002 WorKsheet, version 4
  880. # also worksheet template 4 (.wt4)
  881. !:ext wk4/wt4
  882. # no example or documentation for wk5
  883. #>>4 uleshort 0x???? WorKsheet, version 4
  884. #!:ext wk5
  885. # only MacrotoScript.123 example
  886. >>>4 uleshort 0x1003 WorKsheet, version 97
  887. # also worksheet template Smartmaster (.12M)?
  888. !:ext 123
  889. # only Set_Y2K.123 example
  890. >>>4 uleshort 0x1005 WorKsheet, version 9.8 Millennium
  891. !:ext 123
  892. # no example for this version
  893. >>>4 uleshort 0x8001 FoRMatting data
  894. !:ext frm
  895. # (version 5.26) labeled the entry as "Lotus 1-2-3 fm3 or fmb document data"
  896. # TrID labeles the entry as "Formatting Data for Lotus 1-2-3 worksheet"
  897. >>>4 uleshort 0x8007 ForMatting data, version 3
  898. !:ext fm3
  899. >>>4 default x unknown
  900. # file revision sub code 0004h for worksheets
  901. >>>>6 uleshort =0x0004 worksheet
  902. !:ext wXX
  903. >>>>6 uleshort !0x0004 formatting data
  904. !:ext fXX
  905. # main revision number
  906. >>>>4 uleshort x \b, revision %#x
  907. >>>6 uleshort =0x0004 \b, cell range
  908. # active cellcoord range (start row, page,column ; end row, page, column)
  909. # start values normally 0~1st sheet A1
  910. >>>>8 ulelong !0
  911. >>>>>10 ubyte >0 \b%d*
  912. >>>>>8 uleshort x \b%d,
  913. >>>>>11 ubyte x \b%d-
  914. # end page mostly 0
  915. >>>>14 ubyte >0 \b%d*
  916. # end raw, column normally not 0
  917. >>>>12 uleshort x \b%d,
  918. >>>>15 ubyte x \b%d
  919. # Lotus Multi Byte Character Set (1~cp850,2~cp851,...,16~japan,...,31~??)
  920. >>>>20 ubyte >1 \b, character set %#x
  921. # flags
  922. >>>>21 ubyte x \b, flags %#x
  923. >>>6 uleshort !0x0004
  924. # record type (FONTNAME=00AEh)
  925. >>>>30 search/29 \0\xAE
  926. # variable length m (2) + entries (1) + ?? (1) + LCMBS string (n)
  927. >>>>>&4 string >\0 \b, 1st font "%s"
  928. #
  929. # Update: Joerg Jenderek
  930. # URL: http://fileformats.archiveteam.org/wiki/Lotus_1-2-3
  931. # Reference: http://www.schnarff.com/file-formats/lotus-1-2-3/WSFF2.TXT
  932. # Note: Used by both old Lotus 1-2-3 and Lotus Symphony (DOS) til version 2.x
  933. # record type (BeginningOfFile=0000h) + length (0002h)
  934. 0 belong 0x00000200
  935. # GRR: line above is too general as it catches also MS Windows CURsor
  936. # to display MS Windows cursor (strength=70) before Lotus 1-2-3 (strength=70-1)
  937. !:strength -1
  938. # skip Windows cursors with image height <256 and keep Lotus with low opcode 0001-0083h
  939. >7 ubyte 0
  940. # skip Windows cursors with image width 256 and keep Lotus with positive opcode
  941. >>6 ubyte >0 Lotus
  942. # !:mime application/x-123
  943. !:mime application/vnd.lotus-1-2-3
  944. !:apple ????L123
  945. # revision number (0404h = 123 1A, 0405h = Lotus Symphony , 0406h = 123 2.x wk1 , 8006h = fmt , ...)
  946. # undocumented; (version 5.26) labeled the configurations as "Lotus 1-2-3"
  947. >>>4 uleshort 0x0007 1-2-3 CoNFiguration, version 2.x (PGRAPH.CNF)
  948. !:ext cnf
  949. >>>4 uleshort 0x0C05 1-2-3 CoNFiguration, version 2.4J
  950. !:ext cnf
  951. >>>4 uleshort 0x0801 1-2-3 CoNFiguration, version 1-2.1
  952. !:ext cnf
  953. >>>4 uleshort 0x0802 Symphony CoNFiguration
  954. !:ext cnf
  955. >>>4 uleshort 0x0804 1-2-3 CoNFiguration, version 2.2
  956. !:ext cnf
  957. >>>4 uleshort 0x080A 1-2-3 CoNFiguration, version 2.3-2.4
  958. !:ext cnf
  959. >>>4 uleshort 0x1402 1-2-3 CoNFiguration, version 3.x
  960. !:ext cnf
  961. >>>4 uleshort 0x1450 1-2-3 CoNFiguration, version 4.x
  962. !:ext cnf
  963. # (version 5.26) labeled the entry as "Lotus 123"
  964. # TrID labeles the entry as "Lotus 123 Worksheet (generic)"
  965. >>>4 uleshort 0x0404 1-2-3 WorKSheet, version 1
  966. # extension "wks" also for Microsoft Works document
  967. !:ext wks
  968. # (version 5.26) labeled the entry as "Lotus 123"
  969. # TrID labeles the entry as "Lotus 123 Worksheet (generic)"
  970. >>>4 uleshort 0x0405 Symphony WoRksheet, version 1.0
  971. !:ext wrk/wr1
  972. # (version 5.26) labeled the entry as "Lotus 1-2-3 wk1 document data"
  973. # TrID labeles the entry as "Lotus 123 Worksheet (V2)"
  974. >>>4 uleshort 0x0406 1-2-3/Symphony worksheet, version 2
  975. # Symphony (.wr1)
  976. !:ext wk1/wr1
  977. # no example for this japan version
  978. >>>4 uleshort 0x0600 1-2-3 WorKsheet, version 1.xJ
  979. !:ext wj1
  980. # no example or documentation for wk2
  981. #>>>4 uleshort 0x???? 1-2-3 WorKsheet, version 2
  982. #!:ext wk2
  983. # undocumented japan version
  984. >>>4 uleshort 0x0602 1-2-3 worksheet, version 2.4J
  985. !:ext wj3
  986. # (version 5.26) labeled the entry as "Lotus 1-2-3 fmt document data"
  987. >>>4 uleshort 0x8006 1-2-3 ForMaTting data, version 2.x
  988. # japan version 2.4J (fj3)
  989. !:ext fmt/fj3
  990. # no example for this version
  991. >>>4 uleshort 0x8007 1-2-3 FoRMatting data, version 2.0
  992. !:ext frm
  993. # (version 5.26) labeled the entry as "Lotus 1-2-3"
  994. >>>4 default x unknown worksheet or configuration
  995. !:ext cnf
  996. >>>>4 uleshort x \b, revision %#x
  997. # 2nd record for most worksheets describes cells range
  998. >>>6 use lotus-cells
  999. # 3rd record for most japan worksheets describes cells range
  1000. >>>(8.s+10) use lotus-cells
  1001. # check and then display Lotus worksheet cells range
  1002. 0 name lotus-cells
  1003. # look for type (RANGE=0006h) + length (0008h) at record begin
  1004. >0 ubelong 0x06000800 \b, cell range
  1005. # cell range (start column, row, end column, row) start values normally 0,0~A1 cell
  1006. >>4 ulong !0
  1007. >>>4 uleshort x \b%d,
  1008. >>>6 uleshort x \b%d-
  1009. # end of cell range
  1010. >>8 uleshort x \b%d,
  1011. >>10 uleshort x \b%d
  1012. # EndOfLotus123
  1013. 0 string/b WordPro\0 Lotus WordPro
  1014. !:mime application/vnd.lotus-wordpro
  1015. 0 string/b WordPro\r\373 Lotus WordPro
  1016. !:mime application/vnd.lotus-wordpro
  1017. # Summary: Script used by InstallScield to uninstall applications
  1018. # Extension: .isu
  1019. # Submitted by: unknown
  1020. # Modified by (1): Abel Cheung <abelcheung@gmail.com> (replace useless entry)
  1021. 0 string \x71\xa8\x00\x00\x01\x02
  1022. >12 string Stirling\ Technologies, InstallShield Uninstall Script
  1023. # Winamp .avs
  1024. #0 string Nullsoft\ AVS\ Preset\ \060\056\061\032 A plug in for Winamp ms-windows Freeware media player
  1025. 0 string/b Nullsoft\ AVS\ Preset\ Winamp plug in
  1026. # Windows Metafile .WMF
  1027. 0 string/b \327\315\306\232 Windows metafile
  1028. !:mime image/wmf
  1029. !:ext wmf
  1030. 0 string/b \002\000\011\000 Windows metafile
  1031. !:mime image/wmf
  1032. !:ext wmf
  1033. 0 string/b \001\000\011\000 Windows metafile
  1034. !:mime image/wmf
  1035. !:ext wmf
  1036. #tz3 files whatever that is (MS Works files)
  1037. 0 string/b \003\001\001\004\070\001\000\000 tz3 ms-works file
  1038. 0 string/b \003\002\001\004\070\001\000\000 tz3 ms-works file
  1039. 0 string/b \003\003\001\004\070\001\000\000 tz3 ms-works file
  1040. # PGP sig files .sig
  1041. #0 string \211\000\077\003\005\000\063\237\127 065 to \027\266\151\064\005\045\101\233\021\002 PGP sig
  1042. 0 string \211\000\077\003\005\000\063\237\127\065\027\266\151\064\005\045\101\233\021\002 PGP sig
  1043. 0 string \211\000\077\003\005\000\063\237\127\066\027\266\151\064\005\045\101\233\021\002 PGP sig
  1044. 0 string \211\000\077\003\005\000\063\237\127\067\027\266\151\064\005\045\101\233\021\002 PGP sig
  1045. 0 string \211\000\077\003\005\000\063\237\127\070\027\266\151\064\005\045\101\233\021\002 PGP sig
  1046. 0 string \211\000\077\003\005\000\063\237\127\071\027\266\151\064\005\045\101\233\021\002 PGP sig
  1047. 0 string \211\000\225\003\005\000\062\122\207\304\100\345\042 PGP sig
  1048. # windows zips files .dmf
  1049. 0 string/b MDIF\032\000\010\000\000\000\372\046\100\175\001\000\001\036\001\000 MS Windows special zipped file
  1050. # Windows icons
  1051. # Update: Joerg Jenderek
  1052. # URL: https://en.wikipedia.org/wiki/CUR_(file_format)
  1053. # Note: similar to Windows CURsor. container for BMP (only DIB part) or PNG
  1054. 0 belong 0x00000100
  1055. >9 byte 0
  1056. >>0 byte x
  1057. >>0 use cur-ico-dir
  1058. >9 ubyte 0xff
  1059. >>0 byte x
  1060. >>0 use cur-ico-dir
  1061. # displays number of icons and information for icon or cursor
  1062. 0 name cur-ico-dir
  1063. # skip some Lotus 1-2-3 worksheets, CYCLE.PIC and keep Windows cursors with
  1064. # 1st data offset = dir header size + n * dir entry size = 6 + n * 10h = ?6h
  1065. >18 ulelong &0x00000006
  1066. # skip remaining worksheets, because valid only for DIB image (40) or PNG image (\x89PNG)
  1067. >>(18.l) ulelong x MS Windows
  1068. >>>0 ubelong 0x00000100 icon resource
  1069. # https://www.iana.org/assignments/media-types/image/vnd.microsoft.icon
  1070. !:mime image/vnd.microsoft.icon
  1071. #!:mime image/x-icon
  1072. !:ext ico
  1073. >>>>4 uleshort x - %d icon
  1074. # plural s
  1075. >>>>4 uleshort >1 \bs
  1076. # 1st icon
  1077. >>>>0x06 use ico-entry
  1078. # 2nd icon
  1079. >>>>4 uleshort >1
  1080. >>>>>0x16 use ico-entry
  1081. >>>0 ubelong 0x00000200 cursor resource
  1082. #!:mime image/x-cur
  1083. !:mime image/x-win-bitmap
  1084. !:ext cur
  1085. >>>>4 uleshort x - %d icon
  1086. >>>>4 uleshort >1 \bs
  1087. # 1st cursor
  1088. >>>>0x06 use cur-entry
  1089. #>>>>0x16 use cur-entry
  1090. # display information of one cursor entry
  1091. 0 name cur-entry
  1092. >0 use cur-ico-entry
  1093. >4 uleshort x \b, hotspot @%dx
  1094. >6 uleshort x \b%d
  1095. # display information of one icon entry
  1096. 0 name ico-entry
  1097. >0 use cur-ico-entry
  1098. # normally 0 1 but also found 14
  1099. >4 uleshort >1 \b, %d planes
  1100. # normally 0 1 but also found some 3, 4, some 6, 8, 24, many 32, two 256
  1101. >6 uleshort >1 \b, %d bits/pixel
  1102. # display shared information of cursor or icon entry
  1103. 0 name cur-ico-entry
  1104. >0 byte =0 \b, 256x
  1105. >0 byte !0 \b, %dx
  1106. >1 byte =0 \b256
  1107. >1 byte !0 \b%d
  1108. # number of colors in palette
  1109. >2 ubyte !0 \b, %d colors
  1110. # reserved 0 FFh
  1111. #>3 ubyte x \b, reserved %x
  1112. #>8 ulelong x \b, image size %d
  1113. # offset of PNG or DIB image
  1114. #>12 ulelong x \b, offset %#x
  1115. # PNG header (\x89PNG)
  1116. >(12.l) ubelong =0x89504e47
  1117. # 1 space char after "with" to get phrase "with PNG image" by magic in ./images
  1118. >>&-4 indirect x \b with
  1119. # DIB image
  1120. >(12.l) ubelong !0x89504e47
  1121. #>>&-4 use dib-image
  1122. # Windows non-animated cursors
  1123. # Update: Joerg Jenderek
  1124. # URL: https://en.wikipedia.org/wiki/CUR_(file_format)
  1125. # Note: similar to Windows ICOn. container for BMP ( only DIB part)
  1126. # GRR: line below is too general as it catches also Lotus 1-2-3 files
  1127. 0 belong 0x00000200
  1128. >9 byte 0
  1129. >>0 use cur-ico-dir
  1130. >9 ubyte 0xff
  1131. >>0 use cur-ico-dir
  1132. # .chr files
  1133. 0 string/b PK\010\010BGI Borland font
  1134. >4 string >\0 %s
  1135. # then there is a copyright notice
  1136. # .bgi files
  1137. 0 string/b pk\010\010BGI Borland device
  1138. >4 string >\0 %s
  1139. # then there is a copyright notice
  1140. # Windows Recycle Bin record file (named INFO2)
  1141. # By Abel Cheung (abelcheung AT gmail dot com)
  1142. # Version 4 always has 280 bytes (0x118) per record, version 5 has 800 bytes
  1143. # Since Vista uses another structure, INFO2 structure probably won't change
  1144. # anymore. Detailed analysis in:
  1145. # http://www.cybersecurityinstitute.biz/downloads/INFO2.pdf
  1146. 0 lelong 0x00000004
  1147. >12 lelong 0x00000118 Windows Recycle Bin INFO2 file (Win98 or below)
  1148. 0 lelong 0x00000005
  1149. >12 lelong 0x00000320 Windows Recycle Bin INFO2 file (Win2k - WinXP)
  1150. # From Doug Lee via a FreeBSD pr
  1151. 9 string GERBILDOC First Choice document
  1152. 9 string GERBILDB First Choice database
  1153. 9 string GERBILCLIP First Choice database
  1154. 0 string GERBIL First Choice device file
  1155. 9 string RABBITGRAPH RabbitGraph file
  1156. 0 string DCU1 Borland Delphi .DCU file
  1157. 0 string =!<spell> MKS Spell hash list (old format)
  1158. 0 string =!<spell2> MKS Spell hash list
  1159. # Too simple - MPi
  1160. #0 string AH Halo(TM) bitmapped font file
  1161. 0 lelong 0x08086b70 TurboC BGI file
  1162. 0 lelong 0x08084b50 TurboC Font file
  1163. # Debian#712046: The magic below identifies "Delphi compiled form data".
  1164. # An additional source of information is available at:
  1165. # http://www.woodmann.com/fravia/dafix_t1.htm
  1166. 0 string TPF0
  1167. >4 pstring >\0 Delphi compiled form '%s'
  1168. # tests for DBase files moved, updated and merged to database
  1169. 0 string PMCC Windows 3.x .GRP file
  1170. 1 string RDC-meg MegaDots
  1171. >8 byte >0x2F version %c
  1172. >9 byte >0x2F \b.%c file
  1173. 0 lelong 0x4C
  1174. >4 lelong 0x00021401 Windows shortcut file
  1175. # .PIF files added by Joerg Jenderek from https://smsoft.ru/en/pifdoc.htm
  1176. # only for windows versions equal or greater 3.0
  1177. 0x171 string MICROSOFT\ PIFEX\0 Windows Program Information File
  1178. !:mime application/x-dosexec
  1179. !:ext pif
  1180. #>2 string >\0 \b, Title:%.30s
  1181. >0x24 string >\0 \b for %.63s
  1182. >0x65 string >\0 \b, directory=%.64s
  1183. >0xA5 string >\0 \b, parameters=%.64s
  1184. #>0x181 leshort x \b, offset %x
  1185. #>0x183 leshort x \b, offsetdata %x
  1186. #>0x185 leshort x \b, section length %x
  1187. >0x187 search/0xB55 WINDOWS\ VMM\ 4.0\0
  1188. >>&0x5e ubyte >0
  1189. >>>&-1 string <PIFMGR.DLL \b, icon=%s
  1190. #>>>&-1 string PIFMGR.DLL \b, icon=%s
  1191. >>>&-1 string >PIFMGR.DLL \b, icon=%s
  1192. >>&0xF0 ubyte >0
  1193. >>>&-1 string <Terminal \b, font=%.32s
  1194. #>>>&-1 string =Terminal \b, font=%.32s
  1195. >>>&-1 string >Terminal \b, font=%.32s
  1196. >>&0x110 ubyte >0
  1197. >>>&-1 string <Lucida\ Console \b, TrueTypeFont=%.32s
  1198. #>>>&-1 string =Lucida\ Console \b, TrueTypeFont=%.32s
  1199. >>>&-1 string >Lucida\ Console \b, TrueTypeFont=%.32s
  1200. #>0x187 search/0xB55 WINDOWS\ 286\ 3.0\0 \b, Windows 3.X standard mode-style
  1201. #>0x187 search/0xB55 WINDOWS\ 386\ 3.0\0 \b, Windows 3.X enhanced mode-style
  1202. >0x187 search/0xB55 WINDOWS\ NT\ \ 3.1\0 \b, Windows NT-style
  1203. #>0x187 search/0xB55 WINDOWS\ NT\ \ 4.0\0 \b, Windows NT-style
  1204. >0x187 search/0xB55 CONFIG\ \ SYS\ 4.0\0 \b +CONFIG.SYS
  1205. #>>&06 string x \b:%s
  1206. >0x187 search/0xB55 AUTOEXECBAT\ 4.0\0 \b +AUTOEXEC.BAT
  1207. #>>&06 string x \b:%s
  1208. # DOS EPS Binary File Header
  1209. # From: Ed Sznyter <ews@Black.Market.NET>
  1210. 0 belong 0xC5D0D3C6 DOS EPS Binary File
  1211. !:mime image/x-eps
  1212. >4 long >0 Postscript starts at byte %d
  1213. >>8 long >0 length %d
  1214. >>>12 long >0 Metafile starts at byte %d
  1215. >>>>16 long >0 length %d
  1216. >>>20 long >0 TIFF starts at byte %d
  1217. >>>>24 long >0 length %d
  1218. # TNEF magic From "Joomy" <joomy@se-ed.net>
  1219. # Microsoft Outlook's Transport Neutral Encapsulation Format (TNEF)
  1220. 0 lelong 0x223e9f78 TNEF
  1221. !:mime application/vnd.ms-tnef
  1222. # Norton Guide (.NG , .HLP) files added by Joerg Jenderek from source NG2HTML.C
  1223. # of http://www.davep.org/norton-guides/ng2h-105.tgz
  1224. # https://en.wikipedia.org/wiki/Norton_Guides
  1225. 0 string NG\0\001
  1226. # only value 0x100 found at offset 2
  1227. >2 ulelong 0x00000100 Norton Guide
  1228. !:mime application/x-norton-guide
  1229. # often like NORTON.NG but some times like NC.HLP
  1230. !:ext ng/hlp
  1231. # Title[40]
  1232. >>8 string >\0 "%-.40s"
  1233. #>>6 uleshort x \b, MenuCount=%u
  1234. # szCredits[5][66]
  1235. >>48 string >\0 \b, %-.66s
  1236. >>114 string >\0 %-.66s
  1237. # URL: https://en.wikipedia.org/wiki/Norton_Commander
  1238. # Reference: http://mark0.net/download/triddefs_xml.7z/defs/m/msg-nc-eng.trid.xml
  1239. # From: Joerg Jenderek
  1240. # Note: Message file is used by executable with same main name.
  1241. # Only tested with version 5.50 (english) and 2.01 (Windows)
  1242. 0 string Abort
  1243. # \0 or i
  1244. #>5 ubyte x %x
  1245. # skip ASCII Abort text by looking for error message like in NCVIEW.MSG
  1246. >6 search/7089 Non-DOS\ disk Norton Commander module message
  1247. !:mime application/x-norton-msg
  1248. !:ext msg
  1249. # URL: http://www.antonis.de/dos/dos-tuts/mpdostip/html/nwdostip.htm
  1250. # Reference: https://mark0.net/download/triddefs_xml.7z/defs/m/msg-netware-dos.trid.xml
  1251. # From: Joerg Jenderek
  1252. 0 string DOS\ Client\ Message\ File: Novell DOS client message
  1253. #!:mime application/octet-stream
  1254. #!:mime application/x-novell-msg
  1255. !:ext msg
  1256. # look for second letter instead space character
  1257. >26 ubyte >0x20
  1258. # digit 1 or often main or program name like: IPXODI.COM TASKID pnwtrap DOSRqstr
  1259. >>25 ubyte !0x20 %c
  1260. >>>26 ubyte !0x20 \b%c
  1261. >>>>27 ubyte !0x20 \b%c
  1262. >>>>>28 ubyte !0x20 \b%c
  1263. >>>>>>29 ubyte !0x20 \b%c
  1264. >>>>>>>30 ubyte !0x20 \b%c
  1265. >>>>>>>>31 ubyte !0x20 \b%c
  1266. >>>>>>>>>32 ubyte !0x20 \b%c
  1267. >>>>>>>>>>33 ubyte !0x20 \b%c
  1268. >>>>>>>>>>>34 ubyte !0x20 \b%c
  1269. >>>>>>>>>>>>35 ubyte !0x20 \b%c
  1270. >>>>>>>>>>>>>36 ubyte !0x20 \b%c
  1271. # followed by string like: 0 v.10 V1.20
  1272. #
  1273. # followed by ,\040Tran
  1274. >28 search/14 ,\040Tran
  1275. # probably translated version string like: 0 v1.00
  1276. >>&0 string x \b, tran version %s
  1277. # followed by Ctrl-J Ctrl-Z
  1278. >>>&0 ubyte !0xa \b, terminated by %#2.2x
  1279. >>>>&0 ubyte x \b%2.2x
  1280. # Ctrl-Z
  1281. >0x65 ubyte !0x1A \b, at 0x65 %#x
  1282. # one
  1283. >0x66 ubyte !0x01 \b, at 0x66 %#x
  1284. # URL: https://en.wikipedia.org/wiki/NetWare
  1285. # Reference: http://mark0.net/download/triddefs_xml.7z/defs/d/dat-novell-msg.trid.xml
  1286. # ftp://ftp.iitb.ac.in/LDP/en/NLM-HOWTO/NLM-HOWTO-single.html
  1287. # From: Joerg Jenderek
  1288. 0 string Novell\ Message\ Librarian\ Data\ File Novell message librarian data
  1289. #>35 string Version\ 1.00
  1290. #>49 string COPYRIGHT\ (c)\ 1985\ by\ Novell,\ Inc.
  1291. #>83 string \ \ All\ Rights\ Reserved
  1292. #!:mime application/octet-stream
  1293. #!:mime application/x-novell-msg
  1294. !:ext msg
  1295. #!:ext msg/dat
  1296. # 4DOS help (.HLP) files added by Joerg Jenderek from source TPHELP.PAS
  1297. # of https://www.4dos.info/
  1298. # pointer,HelpID[8]=4DHnnnmm
  1299. 0 ulelong 0x48443408 4DOS help file
  1300. >4 string x \b, version %-4.4s
  1301. # old binary Microsoft (.HLP) files added by Joerg Jenderek from http://file-extension.net/seeker/file_extension_hlp
  1302. 0 ulequad 0x3a000000024e4c MS Advisor help file
  1303. # HtmlHelp files (.chm)
  1304. 0 string/b ITSF\003\000\000\000\x60\000\000\000 MS Windows HtmlHelp Data
  1305. # GFA-BASIC (Wolfram Kleff)
  1306. 2 string/b GFA-BASIC3 GFA-BASIC 3 data
  1307. #------------------------------------------------------------------------------
  1308. # From Stuart Caie <kyzer@4u.net> (developer of cabextract)
  1309. # Update: Joerg Jenderek
  1310. # URL: https://en.wikipedia.org/wiki/Cabinet_(file_format)
  1311. # Reference: https://msdn.microsoft.com/en-us/library/bb267310.aspx
  1312. # Note: verified by `7z l *.cab`
  1313. # Microsoft Cabinet files
  1314. 0 string/b MSCF\0\0\0\0 Microsoft Cabinet archive data
  1315. #
  1316. # https://support.microsoft.com/en-us/help/973559/frequently-asked-questions-about-the-microsoft-support-diagnostic-tool
  1317. # CAB with *.{diagcfg,diagpkg} is used by Microsoft Support Diagnostic Tool MSDT.EXE
  1318. # because some archive does not have *.diag* as 1st or 2nd archive member like
  1319. # O15CTRRemove.diagcab or AzureStorageAnalyticsLogs_global.DiagCab
  1320. # brute looking after header for filenames with diagcfg or diagpkg extension in CFFILE section
  1321. >0x2c search/980/c .diag \b, Diagnostic
  1322. !:mime application/vnd.ms-cab-compressed
  1323. !:ext diagcab
  1324. # http://fileformats.archiveteam.org/wiki/PUZ
  1325. # Microsoft Publisher version about 2003 has a "Pack and Go" feature that
  1326. # bundles a Publisher document *PNG.pub with all links into a CAB
  1327. >0x2c search/300/c png.pub\0 \b, Publisher Packed and Go
  1328. !:mime application/vnd.ms-cab-compressed
  1329. !:ext puz
  1330. # ppz variant with Microsoft PowerPoint Viewer ppview32.exe to play PowerPoint presentation
  1331. >0x2c search/17/c ppview32.exe\0 \b, PowerPoint Viewer Packed and Go
  1332. !:mime application/vnd.ms-powerpoint
  1333. #!:mime application/mspowerpoint
  1334. !:ext ppz
  1335. # URL: https://en.wikipedia.org/wiki/Windows_Desktop_Gadgets
  1336. # Reference: https://docs.microsoft.com/en-us/previous-versions/windows/desktop/sidebar/
  1337. # http://win10gadgets.com/download/273/ All_CPU_Meter1.zip/All_CPU_Meter_V4.7.3.gadget
  1338. >0x2c search/968/c gadget.xml \b, Windows Desktop Gadget
  1339. #!:mime application/vnd.ms-cab-compressed
  1340. # http://extension.nirsoft.net/gadget
  1341. !:mime application/x-windows-gadget
  1342. !:ext gadget
  1343. # http://www.incredimail.com/
  1344. # IncrediMail CAB contains an initialisation file "content.ini" like in im2.ims
  1345. >0x2c search/3369/c content.ini\0 \b, IncrediMail
  1346. !:mime application/x-incredimail
  1347. # member Flavor.htm implies IncrediMail ecard like in tell_a_friend.imf
  1348. >>0x2c search/83/c Flavor.htm\0 ecard
  1349. !:ext imf
  1350. # member Macromedia Flash data *.swf implies IncrediMail skin like in im2.ims
  1351. >>0x2c search/211/c .swf\0 skin
  1352. !:ext ims
  1353. # member anim.im3 implies IncrediMail animation like in letter_fold.ima
  1354. >>0x2c search/92/c anim.im3\0 animation
  1355. !:ext ima
  1356. # other IncrediMail cab archive
  1357. >>0x2c default x
  1358. >>>0x2c search/116/c thumb ecard, image, notifier or skin
  1359. !:ext imf/imi/imn/ims
  1360. # http://file-extension.net/seeker/file_extension_ime
  1361. >>>0x2c default x emoticons or sound
  1362. !:ext ime/imw
  1363. # no Diagnostic, Packed and Go, Windows Desktop Gadget, IncrediMail
  1364. >0x2c default x
  1365. # look for 1st member name
  1366. >>(16.l+16) ubyte x
  1367. # https://en.wikipedia.org/wiki/SNP_file_format
  1368. >>>&-1 string/c _accrpt_.snp \b, Access report snapshot
  1369. !:mime application/msaccess
  1370. !:ext snp
  1371. # https://en.wikipedia.org/wiki/Microsoft_InfoPath
  1372. >>>&-1 string manifest.xsf \b, InfoPath Form Template
  1373. !:mime application/vnd.ms-cab-compressed
  1374. #!:mime application/vnd.ms-infopath
  1375. !:ext xsn
  1376. # https://www.cabextract.org.uk/wince_cab_format/
  1377. # extension of DOS 8+3 name with ".000" of 1st archive member name implies Windows CE installer
  1378. >>>&7 string =.000 \b, WinCE install
  1379. !:mime application/vnd.ms-cab-compressed
  1380. !:ext cab
  1381. # https://support.microsoft.com/kb/934307/en-US
  1382. # All inspected MSU contain a file with name WSUSSCAN.cab
  1383. # that is called "Windows Update meta data" by Microsoft
  1384. >>>&-1 string/c wsusscan.cab \b, Microsoft Standalone Update
  1385. !:mime application/vnd.ms-cab-compressed
  1386. !:ext msu
  1387. >>>&-1 default x
  1388. # look at point character of 1st archive member name for file name extension
  1389. >>>>&-1 search/255 .
  1390. # http://www.pptfaq.com/FAQ00164_What_is_a_PPZ_file-.htm
  1391. # PPZ were created using Pack & Go feature of PowerPoint versions 97 - 2002
  1392. # packs optional files, a PowerPoint presentation *.ppt with optional PLAYLIST.LST to CAB
  1393. >>>>>&0 string/c ppt\0 \b, PowerPoint Packed and Go
  1394. !:mime application/vnd.ms-powerpoint
  1395. #!:mime application/mspowerpoint
  1396. !:ext ppz
  1397. # https://msdn.microsoft.com/en-us/library/windows/desktop/bb773190(v=vs.85).aspx
  1398. # first member *.theme implies Windows 7 Theme Pack like in CommunityShowcaseAqua3.themepack
  1399. # or Windows 8 Desktop Theme Pack like in PanoramicGlaciers.deskthemepack
  1400. >>>>>&0 string/c theme \b, Windows
  1401. !:mime application/x-windows-themepack
  1402. # https://www.drewkeller.com/content/using-theme-both-windows-7-and-windows-8
  1403. # 1st member Panoramic.theme or Panoramas.theme implies Windows 8-10 Theme Pack
  1404. # with MTSM=RJSPBS in [MasterThemeSelector] inside *.theme
  1405. >>>>>>(16.l+16) string =Panoram 8
  1406. !:ext deskthemepack
  1407. >>>>>>(16.l+16) string !Panoram 7 or 8
  1408. !:ext themepack/deskthemepack
  1409. >>>>>>(16.l+16) ubyte x Theme Pack
  1410. >>>>>&0 default x
  1411. # look for null terminator of 1st member name
  1412. >>>>>>&0 search/255 \0
  1413. # 2nd member name WSUSSCAN.cab like in Microsoft-Windows-MediaFeaturePack-OOB-Package.msu
  1414. >>>>>>>&16 string/c wsusscan.cab \b, Microsoft Standalone Update
  1415. !:mime application/vnd.ms-cab-compressed
  1416. !:ext msu
  1417. >>>>>>>&16 default x
  1418. # archive with more then one file need some output in version 5.32 to avoid error message like
  1419. # Magdir/msdos, 1138: Warning: Current entry does not yet have a description for adding a MIME type
  1420. # Magdir/msdos, 1139: Warning: Current entry does not yet have a description for adding a EXTENSION type
  1421. # file: could not find any valid magic files!
  1422. >>>>>>>>28 uleshort >1 \b, many
  1423. !:mime application/vnd.ms-cab-compressed
  1424. !:ext cab
  1425. # remaining archives with just one file
  1426. >>>>>>>>28 uleshort =1
  1427. # neither extra bytes nor cab chain implies Windows 2000,XP setup files in directory i386
  1428. >>>>>>>>>30 uleshort =0x0000 \b, Windows 2000/XP setup
  1429. # cut of last char of source extension and add underscore to generate extension
  1430. # TERMCAP._ ... FXSCOUNT.H_ ... L3CODECA.AC_ ... NPDRMV2.ZI_
  1431. !:mime application/vnd.ms-cab-compressed
  1432. !:ext _/?_/??_
  1433. # archive need some output like "single" in version 5.32 to avoid error messages
  1434. >>>>>>>>>30 uleshort !0x0000 \b, single
  1435. !:mime application/vnd.ms-cab-compressed
  1436. !:ext cab
  1437. # TODO: additional extensions like
  1438. # .xtp InfoPath Template Part
  1439. # .lvf Logitech Video Effects Face Accessory
  1440. >8 ulelong x \b, %u bytes
  1441. >28 uleshort 1 \b, 1 file
  1442. >28 uleshort >1 \b, %u files
  1443. # Reserved fields, set to zero
  1444. #>4 belong !0 \b, reserved1 %x
  1445. #>12 belong !0 \b, reserved2 %x
  1446. # offset of the first CFFILE entry coffFiles: minimal 2Ch
  1447. >16 ulelong x \b, at %#x
  1448. >(16.l) use cab-file
  1449. # at least also 2nd member
  1450. >28 uleshort >1
  1451. >>(16.l+16) ubyte x
  1452. >>>&0 search/255 \0
  1453. # second member info
  1454. >>>>&0 use cab-file
  1455. #>20 belong !0 \b, reserved %x
  1456. # Cabinet file format version. Currently, versionMajor = 1 and versionMinor = 3
  1457. >24 ubeshort !0x0301 \b version %#x
  1458. # number of CFFOLDER entries
  1459. >26 uleshort >1 \b, %u cffolders
  1460. # cabinet file option indicators 1~PREVIOUS, 2~NEXT, 4~reserved fields
  1461. # only found for flags 0 1 2 3 4 not 7
  1462. >30 uleshort >0 \b, flags %#x
  1463. # Cabinet files have a 16-bit cabinet setID field that is designed for application use.
  1464. # default is zero, however, the -i option of cabarc can be used to set this field
  1465. >32 uleshort >0 \b, ID %u
  1466. # iCabinet is number of this cabinet file in a set, where 0 for the first cabinet
  1467. #>34 uleshort x \b, iCabinet %u
  1468. # add one for display because humans start numbering by 1 and also fit to name of disk szDisk*
  1469. >34 uleshort+1 x \b, number %u
  1470. >30 uleshort &0x0004 \b, extra bytes
  1471. # cbCFHeader optional size of per-cabinet reserved area 14h 1800h
  1472. >>36 uleshort >0 %u in head
  1473. # cbCFFolder is optional size of per-folder reserved area
  1474. >>38 ubyte >0 %u in folder
  1475. # cbCFData is optional size of per-datablock reserved area
  1476. >>39 ubyte >0 %u in data block
  1477. # optional per-cabinet reserved area abReserve[cbCFHeader]
  1478. >>36 uleshort >0
  1479. # 1st CFFOLDER after reserved area in header
  1480. >>>(36.s+40) use cab-folder
  1481. # no reserved area in header
  1482. >30 uleshort ^0x0004
  1483. # no previous and next cab archive
  1484. >>30 uleshort =0x0000
  1485. >>>36 use cab-folder
  1486. # only previous cab archive
  1487. >>30 uleshort =0x0001 \b, previous
  1488. >>>36 use cab-anchor
  1489. # only next cab archive
  1490. >>30 uleshort =0x0002 \b, next
  1491. >>>36 use cab-anchor
  1492. # previous+next cab archive
  1493. # can not use sub routine cab-anchor to display previous and next cabinet together
  1494. #>>>36 use cab-anchor
  1495. #>>>>&0 use cab-anchor
  1496. >>30 uleshort =0x0003 \b, previous
  1497. >>>36 string x %s
  1498. # optional name of previous disk szDisk*
  1499. >>>>&1 string x disk %s
  1500. >>>>>&1 string x \b, next %s
  1501. # optional name of previous disk szDisk*
  1502. >>>>>>&1 string x disk %s
  1503. >>>>>>>&1 use cab-folder
  1504. # display filename and disk name of previous or next cabinet
  1505. 0 name cab-anchor
  1506. # optional name of previous/next cabinet file szCabinet*[255]
  1507. >&0 string x %s
  1508. # optional name of previous/next disk szDisk*[255]
  1509. >>&1 string x disk %s
  1510. # display folder structure CFFOLDER information like compression of cabinet
  1511. 0 name cab-folder
  1512. # offset of the CFDATA block in this folder
  1513. #>0 ulelong x \b, coffCabStart %#x
  1514. # number of CFDATA blocks in folder
  1515. >4 uleshort x \b, %u datablock
  1516. # plural s
  1517. >4 uleshort >1 \bs
  1518. # compression typeCompress: 0~None 1~MSZIP 0x1503~LZX:21 0x1003~LZX:16 0x0f03~LZX:15
  1519. >6 uleshort x \b, %#x compression
  1520. # optional per-folder reserved area
  1521. #>8 ubequad x \b, abReserve %#llx
  1522. # display member structure CFFILE information like member name of cabinet
  1523. 0 name cab-file
  1524. # cbFile is uncompressed size of file in bytes
  1525. #>0 ulelong x \b, cbFile %u
  1526. # uoffFolderStart is uncompressed offset of file in folder
  1527. #>4 ulelong >0 \b, uoffFolderStart %#x
  1528. # iFolder is index into the CFFOLDER area. 0 indicates first folder in cabinet
  1529. # define ifoldCONTINUED_FROM_PREV (0xFFFD)
  1530. # define ifoldCONTINUED_TO_NEXT (0xFFFE)
  1531. # define ifoldCONTINUED_PREV_AND_NEXT (0xFFFF)
  1532. >8 uleshort >0 \b, iFolder %#x
  1533. # date stamp for file
  1534. #>10 uleshort x \b, date %#x
  1535. # time stamp for file
  1536. #>12 uleshort x \b, time %#x
  1537. # attribs is attribute flags for file
  1538. # define _A_RDONLY (0x01) file is read-only
  1539. # define _A_HIDDEN (0x02) file is hidden
  1540. # define _A_SYSTEM (0x04) file is a system file
  1541. # define _A_ARCH (0x20) file modified since last backup
  1542. # example http://sebastien.kirche.free.fr/pebuilder_plugins/depends.cab
  1543. # define _A_EXEC (0x40) run after extraction
  1544. # define _A_NAME_IS_UTF (0x80) szName[] contains UTF
  1545. # define UNKNOWN (0x0100) undocumented or accident
  1546. #>14 uleshort x \b, attribs %#x
  1547. >14 uleshort >0 +
  1548. >>14 uleshort &0x0001 \bR
  1549. >>14 uleshort &0x0002 \bH
  1550. >>14 uleshort &0x0004 \bS
  1551. >>14 uleshort &0x0020 \bA
  1552. >>14 uleshort &0x0040 \bX
  1553. >>14 uleshort &0x0080 \bUtf
  1554. # unknown 0x0100 flag found on one XP_CD:\I386\DRIVER.CAB
  1555. >>14 uleshort &0x0100 \b?
  1556. # szName is name of archive member
  1557. >16 string x "%s"
  1558. # next archive member name if more files
  1559. #>>&17 string >\0 \b, NEXT NAME %-.50s
  1560. # InstallShield Cabinet files
  1561. 0 string/b ISc( InstallShield Cabinet archive data
  1562. >5 byte&0xf0 =0x60 version 6,
  1563. >5 byte&0xf0 !0x60 version 4/5,
  1564. >(12.l+40) lelong x %u files
  1565. # Windows CE package files
  1566. 0 string/b MSCE\0\0\0\0 Microsoft WinCE install header
  1567. >20 lelong 0 \b, architecture-independent
  1568. >20 lelong 103 \b, Hitachi SH3
  1569. >20 lelong 104 \b, Hitachi SH4
  1570. >20 lelong 0xA11 \b, StrongARM
  1571. >20 lelong 4000 \b, MIPS R4000
  1572. >20 lelong 10003 \b, Hitachi SH3
  1573. >20 lelong 10004 \b, Hitachi SH3E
  1574. >20 lelong 10005 \b, Hitachi SH4
  1575. >20 lelong 70001 \b, ARM 7TDMI
  1576. >52 leshort 1 \b, 1 file
  1577. >52 leshort >1 \b, %u files
  1578. >56 leshort 1 \b, 1 registry entry
  1579. >56 leshort >1 \b, %u registry entries
  1580. # Windows Enhanced Metafile (EMF)
  1581. # See msdn.microsoft.com/archive/en-us/dnargdi/html/msdn_enhmeta.asp
  1582. # for further information.
  1583. 0 ulelong 1
  1584. >40 string \ EMF Windows Enhanced Metafile (EMF) image data
  1585. >>44 ulelong x version %#x
  1586. 0 string/b \224\246\056 Microsoft Word Document
  1587. !:mime application/msword
  1588. # From: "Nelson A. de Oliveira" <naoliv@gmail.com>
  1589. # Magic type for Dell's BIOS .hdr files
  1590. # Dell's .hdr
  1591. 0 string/b $RBU
  1592. >23 string Dell %s system BIOS
  1593. >5 byte 2
  1594. >>48 byte x version %d.
  1595. >>49 byte x \b%d.
  1596. >>50 byte x \b%d
  1597. >5 byte <2
  1598. >>48 string x version %.3s
  1599. # Type: Microsoft Document Imaging Format (.mdi)
  1600. # URL: https://en.wikipedia.org/wiki/Microsoft_Document_Imaging_Format
  1601. # From: Daniele Sempione <scrows@oziosi.org>
  1602. # Too weak (EP)
  1603. #0 short 0x5045 Microsoft Document Imaging Format
  1604. # MS eBook format (.lit)
  1605. 0 string/b ITOLITLS Microsoft Reader eBook Data
  1606. >8 lelong x \b, version %u
  1607. !:mime application/x-ms-reader
  1608. # Windows CE Binary Image Data Format
  1609. # From: Dr. Jesus <j@hug.gs>
  1610. 0 string/b B000FF\n Windows Embedded CE binary image
  1611. # The second byte of these signatures is a file version; I don't know what,
  1612. # if anything, produced files with version numbers 0-2.
  1613. # From: John Elliott <johne@seasip.demon.co.uk>
  1614. 0 string \xfc\x03\x00 Mallard BASIC program data (v1.11)
  1615. 0 string \xfc\x04\x00 Mallard BASIC program data (v1.29+)
  1616. 0 string \xfc\x03\x01 Mallard BASIC protected program data (v1.11)
  1617. 0 string \xfc\x04\x01 Mallard BASIC protected program data (v1.29+)
  1618. 0 string MIOPEN Mallard BASIC Jetsam data
  1619. 0 string Jetsam0 Mallard BASIC Jetsam index data
  1620. # DOS backup 2.0 to 3.2
  1621. # URL: http://fileformats.archiveteam.org/wiki/BACKUP_(MS-DOS)
  1622. # Reference: http://www.ibiblio.org/pub/micro/pc-stuff/freedos/files/dos/restore/brtecdoc.htm
  1623. # backupid.@@@
  1624. # plausibility check for date
  1625. 0x3 ushort >1979
  1626. >0x5 ubyte-1 <31
  1627. >>0x6 ubyte-1 <12
  1628. # actually 121 nul bytes
  1629. >>>0x7 string \0\0\0\0\0\0\0\0
  1630. >>>>0x1 ubyte x DOS 2.0 backup id file, sequence %d
  1631. #!:mime application/octet-stream
  1632. !:ext @@@
  1633. >>>>0x0 ubyte 0xff \b, last disk
  1634. # backed up file
  1635. # skip some AppleWorks word like Tomahawk.Awp, WIN98SE-DE.vhd
  1636. # by looking for trailing nul of maximal file name string
  1637. 0x52 ubyte 0
  1638. # test for flag byte: FFh~complete file, 00h~split file
  1639. # FFh -127 = -1 -127 = -128
  1640. # 00h -127 = 0 -127 = -127
  1641. >0 byte-127 <-126
  1642. # plausibility check for file name length
  1643. >>0x53 ubyte-1 <78
  1644. # looking for terminating nul of file name string
  1645. >>>(0x53.b+4) ubyte 0
  1646. # looking if last char of string is valid DOS file name
  1647. >>>>(0x53.b+3) ubyte >0x1F
  1648. # actually 44 nul bytes
  1649. # but sometimes garbage according to Ralf Quint. So can not be used as test
  1650. #>0x54 string \0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0
  1651. # first char of full file name is DOS (5Ch) or UNIX (2Fh) path separator
  1652. # only DOS variant found. UNIX variant according to V32SLASH.TXT in archive PD0315.EXE
  1653. >>>>>5 ubyte&0x8C 0x0C
  1654. # ./msdos (version 5.30) labeled the entry as
  1655. # "DOS 2.0 backed up file %s, split file, sequence %d" or
  1656. # "DOS 2.0 backed up file %s, complete file"
  1657. >>>>>>0 ubyte x DOS 2.0-3.2 backed up
  1658. #>>>>>>0 ubyte 0xff complete
  1659. >>>>>>0 ubyte 0
  1660. >>>>>>>1 uleshort x sequence %d of
  1661. # full file name with path but without drive letter and colon stored from 0x05 til 0x52
  1662. >>>>>>0x5 string x file %s
  1663. #!:mime application/octet-stream
  1664. # backup name is original filename
  1665. #!:ext doc/exe/rar/zip
  1666. #!:ext *
  1667. # magic/Magdir/msdos, 1169: Warning: EXTENSION type ` *' has bad char '*'
  1668. # file: line 1169: Bad magic entry ' *'
  1669. # after header original file content
  1670. >>>>>>128 indirect x \b;
  1671. # DOS backup 3.3 to 5.x
  1672. # CONTROL.nnn files
  1673. 0 string \x8bBACKUP\x20
  1674. # actually 128 nul bytes
  1675. >0xa string \0\0\0\0\0\0\0\0
  1676. >>0x9 ubyte x DOS 3.3 backup control file, sequence %d
  1677. >>0x8a ubyte 0xff \b, last disk
  1678. # NB: The BACKUP.nnn files consist of the files backed up,
  1679. # concatenated.