msdos 55 KB

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