msdos 55 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505
  1. #------------------------------------------------------------------------------
  2. # $File: msdos,v 1.125 2018/07/25 06:05:34 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 http://www.freedos.org/software/?prog=kc
  331. # and http://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. # http://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. # http://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. #!:mime image/vnd.microsoft.icon
  881. !:mime image/x-icon
  882. !:ext ico
  883. >>>>4 uleshort x - %d icon
  884. # plural s
  885. >>>>4 uleshort >1 \bs
  886. # 1st icon
  887. >>>>0x06 use ico-entry
  888. # 2nd icon
  889. >>>>4 uleshort >1
  890. >>>>>0x16 use ico-entry
  891. >>>0 ubelong 0x00000200 cursor resource
  892. #!:mime image/x-cur
  893. !:mime image/x-win-bitmap
  894. !:ext cur
  895. >>>>4 uleshort x - %d icon
  896. >>>>4 uleshort >1 \bs
  897. # 1st cursor
  898. >>>>0x06 use cur-entry
  899. #>>>>0x16 use cur-entry
  900. # display information of one cursor entry
  901. 0 name cur-entry
  902. >0 use cur-ico-entry
  903. >4 uleshort x \b, hotspot @%dx
  904. >6 uleshort x \b%d
  905. # display information of one icon entry
  906. 0 name ico-entry
  907. >0 use cur-ico-entry
  908. # normally 0 1 but also found 14
  909. >4 uleshort >1 \b, %d planes
  910. # normally 0 1 but also found some 3, 4, some 6, 8, 24, many 32, two 256
  911. >6 uleshort >1 \b, %d bits/pixel
  912. # display shared information of cursor or icon entry
  913. 0 name cur-ico-entry
  914. >0 byte =0 \b, 256x
  915. >0 byte !0 \b, %dx
  916. >1 byte =0 \b256
  917. >1 byte !0 \b%d
  918. # number of colors in palette
  919. >2 ubyte !0 \b, %d colors
  920. # reserved 0 FFh
  921. #>3 ubyte x \b, reserved %x
  922. #>8 ulelong x \b, image size %d
  923. # offset of PNG or DIB image
  924. #>12 ulelong x \b, offset 0x%x
  925. # PNG header (\x89PNG)
  926. >(12.l) ubelong =0x89504e47
  927. >>&-4 indirect x \b with
  928. # DIB image
  929. >(12.l) ubelong !0x89504e47
  930. #>>&-4 use dib-image
  931. # Windows non-animated cursors
  932. # Update: Joerg Jenderek
  933. # URL: https://en.wikipedia.org/wiki/CUR_(file_format)
  934. # Note: similar to Windows ICOn. container for BMP ( only DIB part)
  935. # GRR: line below is too general as it catches also Lotus 1-2-3 files
  936. 0 belong 0x00000200
  937. >9 byte 0
  938. >>0 use cur-ico-dir
  939. >9 ubyte 0xff
  940. >>0 use cur-ico-dir
  941. # .chr files
  942. 0 string/b PK\010\010BGI Borland font
  943. >4 string >\0 %s
  944. # then there is a copyright notice
  945. # .bgi files
  946. 0 string/b pk\010\010BGI Borland device
  947. >4 string >\0 %s
  948. # then there is a copyright notice
  949. # Windows Recycle Bin record file (named INFO2)
  950. # By Abel Cheung (abelcheung AT gmail dot com)
  951. # Version 4 always has 280 bytes (0x118) per record, version 5 has 800 bytes
  952. # Since Vista uses another structure, INFO2 structure probably won't change
  953. # anymore. Detailed analysis in:
  954. # http://www.cybersecurityinstitute.biz/downloads/INFO2.pdf
  955. 0 lelong 0x00000004
  956. >12 lelong 0x00000118 Windows Recycle Bin INFO2 file (Win98 or below)
  957. 0 lelong 0x00000005
  958. >12 lelong 0x00000320 Windows Recycle Bin INFO2 file (Win2k - WinXP)
  959. # From Doug Lee via a FreeBSD pr
  960. 9 string GERBILDOC First Choice document
  961. 9 string GERBILDB First Choice database
  962. 9 string GERBILCLIP First Choice database
  963. 0 string GERBIL First Choice device file
  964. 9 string RABBITGRAPH RabbitGraph file
  965. 0 string DCU1 Borland Delphi .DCU file
  966. 0 string =!<spell> MKS Spell hash list (old format)
  967. 0 string =!<spell2> MKS Spell hash list
  968. # Too simple - MPi
  969. #0 string AH Halo(TM) bitmapped font file
  970. 0 lelong 0x08086b70 TurboC BGI file
  971. 0 lelong 0x08084b50 TurboC Font file
  972. # Debian#712046: The magic below identifies "Delphi compiled form data".
  973. # An additional source of information is available at:
  974. # http://www.woodmann.com/fravia/dafix_t1.htm
  975. 0 string TPF0
  976. >4 pstring >\0 Delphi compiled form '%s'
  977. # tests for DBase files moved, updated and merged to database
  978. 0 string PMCC Windows 3.x .GRP file
  979. 1 string RDC-meg MegaDots
  980. >8 byte >0x2F version %c
  981. >9 byte >0x2F \b.%c file
  982. 0 lelong 0x4C
  983. >4 lelong 0x00021401 Windows shortcut file
  984. # .PIF files added by Joerg Jenderek from http://smsoft.ru/en/pifdoc.htm
  985. # only for windows versions equal or greater 3.0
  986. 0x171 string MICROSOFT\ PIFEX\0 Windows Program Information File
  987. !:mime application/x-dosexec
  988. !:ext pif
  989. #>2 string >\0 \b, Title:%.30s
  990. >0x24 string >\0 \b for %.63s
  991. >0x65 string >\0 \b, directory=%.64s
  992. >0xA5 string >\0 \b, parameters=%.64s
  993. #>0x181 leshort x \b, offset %x
  994. #>0x183 leshort x \b, offsetdata %x
  995. #>0x185 leshort x \b, section length %x
  996. >0x187 search/0xB55 WINDOWS\ VMM\ 4.0\0
  997. >>&0x5e ubyte >0
  998. >>>&-1 string <PIFMGR.DLL \b, icon=%s
  999. #>>>&-1 string PIFMGR.DLL \b, icon=%s
  1000. >>>&-1 string >PIFMGR.DLL \b, icon=%s
  1001. >>&0xF0 ubyte >0
  1002. >>>&-1 string <Terminal \b, font=%.32s
  1003. #>>>&-1 string =Terminal \b, font=%.32s
  1004. >>>&-1 string >Terminal \b, font=%.32s
  1005. >>&0x110 ubyte >0
  1006. >>>&-1 string <Lucida\ Console \b, TrueTypeFont=%.32s
  1007. #>>>&-1 string =Lucida\ Console \b, TrueTypeFont=%.32s
  1008. >>>&-1 string >Lucida\ Console \b, TrueTypeFont=%.32s
  1009. #>0x187 search/0xB55 WINDOWS\ 286\ 3.0\0 \b, Windows 3.X standard mode-style
  1010. #>0x187 search/0xB55 WINDOWS\ 386\ 3.0\0 \b, Windows 3.X enhanced mode-style
  1011. >0x187 search/0xB55 WINDOWS\ NT\ \ 3.1\0 \b, Windows NT-style
  1012. #>0x187 search/0xB55 WINDOWS\ NT\ \ 4.0\0 \b, Windows NT-style
  1013. >0x187 search/0xB55 CONFIG\ \ SYS\ 4.0\0 \b +CONFIG.SYS
  1014. #>>&06 string x \b:%s
  1015. >0x187 search/0xB55 AUTOEXECBAT\ 4.0\0 \b +AUTOEXEC.BAT
  1016. #>>&06 string x \b:%s
  1017. # DOS EPS Binary File Header
  1018. # From: Ed Sznyter <ews@Black.Market.NET>
  1019. 0 belong 0xC5D0D3C6 DOS EPS Binary File
  1020. !:mime image/x-eps
  1021. >4 long >0 Postscript starts at byte %d
  1022. >>8 long >0 length %d
  1023. >>>12 long >0 Metafile starts at byte %d
  1024. >>>>16 long >0 length %d
  1025. >>>20 long >0 TIFF starts at byte %d
  1026. >>>>24 long >0 length %d
  1027. # TNEF magic From "Joomy" <joomy@se-ed.net>
  1028. # Microsoft Outlook's Transport Neutral Encapsulation Format (TNEF)
  1029. 0 lelong 0x223e9f78 TNEF
  1030. !:mime application/vnd.ms-tnef
  1031. # Norton Guide (.NG , .HLP) files added by Joerg Jenderek from source NG2HTML.C
  1032. # of http://www.davep.org/norton-guides/ng2h-105.tgz
  1033. # http://en.wikipedia.org/wiki/Norton_Guides
  1034. 0 string NG\0\001
  1035. # only value 0x100 found at offset 2
  1036. >2 ulelong 0x00000100 Norton Guide
  1037. # Title[40]
  1038. >>8 string >\0 "%-.40s"
  1039. #>>6 uleshort x \b, MenuCount=%u
  1040. # szCredits[5][66]
  1041. >>48 string >\0 \b, %-.66s
  1042. >>114 string >\0 %-.66s
  1043. # 4DOS help (.HLP) files added by Joerg Jenderek from source TPHELP.PAS
  1044. # of http://www.4dos.info/
  1045. # pointer,HelpID[8]=4DHnnnmm
  1046. 0 ulelong 0x48443408 4DOS help file
  1047. >4 string x \b, version %-4.4s
  1048. # old binary Microsoft (.HLP) files added by Joerg Jenderek from http://file-extension.net/seeker/file_extension_hlp
  1049. 0 ulequad 0x3a000000024e4c MS Advisor help file
  1050. # HtmlHelp files (.chm)
  1051. 0 string/b ITSF\003\000\000\000\x60\000\000\000 MS Windows HtmlHelp Data
  1052. # GFA-BASIC (Wolfram Kleff)
  1053. 2 string/b GFA-BASIC3 GFA-BASIC 3 data
  1054. #------------------------------------------------------------------------------
  1055. # From Stuart Caie <kyzer@4u.net> (developer of cabextract)
  1056. # Update: Joerg Jenderek
  1057. # URL: https://en.wikipedia.org/wiki/Cabinet_(file_format)
  1058. # Reference: https://msdn.microsoft.com/en-us/library/bb267310.aspx
  1059. # Note: verified by `7z l *.cab`
  1060. # Microsoft Cabinet files
  1061. 0 string/b MSCF\0\0\0\0 Microsoft Cabinet archive data
  1062. #
  1063. # https://support.microsoft.com/en-us/help/973559/frequently-asked-questions-about-the-microsoft-support-diagnostic-tool
  1064. # CAB with *.{diagcfg,diagpkg} is used by Microsoft Support Diagnostic Tool MSDT.EXE
  1065. # because some archive does not have *.diag* as 1st or 2nd archive member like
  1066. # O15CTRRemove.diagcab or AzureStorageAnalyticsLogs_global.DiagCab
  1067. # brute looking after header for filenames with diagcfg or diagpkg extension in CFFILE section
  1068. >0x2c search/980/c .diag \b, Diagnostic
  1069. !:mime application/vnd.ms-cab-compressed
  1070. !:ext diagcab
  1071. # http://fileformats.archiveteam.org/wiki/PUZ
  1072. # Microsoft Publisher version about 2003 has a "Pack and Go" feature that
  1073. # bundles a Publisher document *PNG.pub with all links into a CAB
  1074. >0x2c search/300/c png.pub\0 \b, Publisher Packed and Go
  1075. !:mime application/vnd.ms-cab-compressed
  1076. !:ext puz
  1077. # ppz variant with Microsoft PowerPoint Viewer ppview32.exe to play PowerPoint presentation
  1078. >0x2c search/17/c ppview32.exe\0 \b, PowerPoint Viewer Packed and Go
  1079. !:mime application/vnd.ms-powerpoint
  1080. #!:mime application/mspowerpoint
  1081. !:ext ppz
  1082. # http://www.incredimail.com/
  1083. # IncrediMail CAB contains an initialisation file "content.ini" like in im2.ims
  1084. >0x2c search/3369/c content.ini\0 \b, IncrediMail
  1085. !:mime application/x-incredimail
  1086. # member Flavor.htm implies IncrediMail ecard like in tell_a_friend.imf
  1087. >>0x2c search/83/c Flavor.htm\0 ecard
  1088. !:ext imf
  1089. # member Macromedia Flash data *.swf implies IncrediMail skin like in im2.ims
  1090. >>0x2c search/211/c .swf\0 skin
  1091. !:ext ims
  1092. # member anim.im3 implies IncrediMail animation like in letter_fold.ima
  1093. >>0x2c search/92/c anim.im3\0 animation
  1094. !:ext ima
  1095. # other IncrediMail cab archive
  1096. >>0x2c default x
  1097. >>>0x2c search/116/c thumb ecard, image, notifier or skin
  1098. !:ext imf/imi/imn/ims
  1099. # http://file-extension.net/seeker/file_extension_ime
  1100. >>>0x2c default x emoticons or sound
  1101. !:ext ime/imw
  1102. # no Diagnostic and IncrediMail
  1103. >0x2c default x
  1104. # look for 1st member name
  1105. >>(16.l+16) ubyte x
  1106. # https://en.wikipedia.org/wiki/SNP_file_format
  1107. >>>&-1 string/c _accrpt_.snp \b, Access report snapshot
  1108. !:mime application/msaccess
  1109. !:ext snp
  1110. # https://www.cabextract.org.uk/wince_cab_format/
  1111. # extension of DOS 8+3 name with ".000" of 1st archive member name implies Windows CE installer
  1112. >>>&7 string =.000 \b, WinCE install
  1113. !:mime application/vnd.ms-cab-compressed
  1114. !:ext cab
  1115. # http://support.microsoft.com/kb/934307/en-US
  1116. # All inspected MSU contain a file with name WSUSSCAN.cab
  1117. # that is called "Windows Update meta data" by Microsoft
  1118. >>>&-1 string/c wsusscan.cab \b, Microsoft Standalone Update
  1119. !:mime application/vnd.ms-cab-compressed
  1120. !:ext msu
  1121. >>>&-1 default x
  1122. # look at point charcter of 1st archive member name for file name extension
  1123. >>>>&-1 search/255 .
  1124. # http://www.pptfaq.com/FAQ00164_What_is_a_PPZ_file-.htm
  1125. # PPZ were created using Pack & Go feature of PowerPoint versions 97 - 2002
  1126. # packs optional files, a PowerPoint presentation *.ppt with optional PLAYLIST.LST to CAB
  1127. >>>>>&0 string/c ppt\0 \b, PowerPoint Packed and Go
  1128. !:mime application/vnd.ms-powerpoint
  1129. #!:mime application/mspowerpoint
  1130. !:ext ppz
  1131. # https://msdn.microsoft.com/en-us/library/windows/desktop/bb773190(v=vs.85).aspx
  1132. # first member *.theme implies Windows 7 Theme Pack like in CommunityShowcaseAqua3.themepack
  1133. # or Windows 8 Desktop Theme Pack like in PanoramicGlaciers.deskthemepack
  1134. >>>>>&0 string/c theme \b, Windows
  1135. !:mime application/x-windows-themepack
  1136. # http://www.drewkeller.com/content/using-theme-both-windows-7-and-windows-8
  1137. # 1st member Panoramic.theme or Panoramas.theme implies Windows 8-10 Theme Pack
  1138. # with MTSM=RJSPBS in [MasterThemeSelector] inside *.theme
  1139. >>>>>>(16.l+16) string =Panoram 8
  1140. !:ext deskthemepack
  1141. >>>>>>(16.l+16) string !Panoram 7 or 8
  1142. !:ext themepack/deskthemepack
  1143. >>>>>>(16.l+16) ubyte x Theme Pack
  1144. >>>>>&0 default x
  1145. # look for null terminator of 1st member name
  1146. >>>>>>&0 search/255 \0
  1147. # 2nd member name WSUSSCAN.cab like in Microsoft-Windows-MediaFeaturePack-OOB-Package.msu
  1148. >>>>>>>&16 string/c wsusscan.cab \b, Microsoft Standalone Update
  1149. !:mime application/vnd.ms-cab-compressed
  1150. !:ext msu
  1151. >>>>>>>&16 default x
  1152. # archive with more then one file need some output in version 5.32 to avoid error message like
  1153. # Magdir/msdos, 1138: Warning: Current entry does not yet have a description for adding a MIME type
  1154. # Magdir/msdos, 1139: Warning: Current entry does not yet have a description for adding a EXTENSION type
  1155. # file: could not find any valid magic files!
  1156. >>>>>>>>28 uleshort >1 \b, many
  1157. !:mime application/vnd.ms-cab-compressed
  1158. !:ext cab
  1159. # remaining archives with just one file
  1160. >>>>>>>>28 uleshort =1
  1161. # neither extra bytes nor cab chain implies Windows 2000,XP setup files in directory i386
  1162. >>>>>>>>>30 uleshort =0x0000 \b, Windows 2000/XP setup
  1163. # cut of last char of source extension and add underscore to generate extension
  1164. # TERMCAP._ ... FXSCOUNT.H_ ... L3CODECA.AC_ ... NPDRMV2.ZI_
  1165. !:mime application/vnd.ms-cab-compressed
  1166. !:ext _/?_/??_
  1167. # archive need some output like "single" in version 5.32 to avoid error messages
  1168. >>>>>>>>>30 uleshort !0x0000 \b, single
  1169. !:mime application/vnd.ms-cab-compressed
  1170. !:ext cab
  1171. # TODO: additional extensions like
  1172. # .xsn InfoPath Dynamic Form
  1173. # .xtp InfoPath Template Part
  1174. # .lvf Logitech Video Effects Face Accessory
  1175. >8 ulelong x \b, %u bytes
  1176. >28 uleshort 1 \b, 1 file
  1177. >28 uleshort >1 \b, %u files
  1178. # Reserved fields, set to zero
  1179. #>4 belong !0 \b, reserved1 %x
  1180. #>12 belong !0 \b, reserved2 %x
  1181. # offset of the first CFFILE entry coffFiles: minimal 2Ch
  1182. >16 ulelong x \b, at 0x%x
  1183. >(16.l) use cab-file
  1184. # at least also 2nd member
  1185. >28 uleshort >1
  1186. >>(16.l+16) ubyte x
  1187. >>>&0 search/255 \0
  1188. # second member info
  1189. >>>>&0 use cab-file
  1190. #>20 belong !0 \b, reserved %x
  1191. # Cabinet file format version. Currently, versionMajor = 1 and versionMinor = 3
  1192. >24 ubeshort !0x0301 \b version 0x%x
  1193. # number of CFFOLDER entries
  1194. >26 uleshort >1 \b, %u cffolders
  1195. # cabinet file option indicators 1~PREVIOUS, 2~NEXT, 4~reserved fields
  1196. # only found for flags 0 1 2 3 4 not 7
  1197. >30 uleshort >0 \b, flags 0x%x
  1198. # Cabinet files have a 16-bit cabinet setID field that is designed for application use.
  1199. # default is zero, however, the -i option of cabarc can be used to set this field
  1200. >32 uleshort >0 \b, ID %u
  1201. # iCabinet is number of this cabinet file in a set, where 0 for the first cabinet
  1202. #>34 uleshort x \b, iCabinet %u
  1203. # add one for display because humans start numbering by 1 and also fit to name of disk szDisk*
  1204. >34 uleshort+1 x \b, number %u
  1205. >30 uleshort &0x0004 \b, extra bytes
  1206. # cbCFHeader optional size of per-cabinet reserved area 14h 1800h
  1207. >>36 uleshort >0 %u in head
  1208. # cbCFFolder is optional size of per-folder reserved area
  1209. >>38 ubyte >0 %u in folder
  1210. # cbCFData is optional size of per-datablock reserved area
  1211. >>39 ubyte >0 %u in data block
  1212. # optional per-cabinet reserved area abReserve[cbCFHeader]
  1213. >>36 uleshort >0
  1214. # 1st CFFOLDER after reserved area in header
  1215. >>>(36.s+40) use cab-folder
  1216. # no reserved area in header
  1217. >30 uleshort ^0x0004
  1218. # no previous and next cab archive
  1219. >>30 uleshort =0x0000
  1220. >>>36 use cab-folder
  1221. # only previous cab archive
  1222. >>30 uleshort =0x0001 \b, previous
  1223. >>>36 use cab-anchor
  1224. # only next cab archive
  1225. >>30 uleshort =0x0002 \b, next
  1226. >>>36 use cab-anchor
  1227. # previous+next cab archive
  1228. # can not use sub routine cab-anchor to display previous and next cabinet together
  1229. #>>>36 use cab-anchor
  1230. #>>>>&0 use cab-anchor
  1231. >>30 uleshort =0x0003 \b, previous
  1232. >>>36 string x %s
  1233. # optional name of previous disk szDisk*
  1234. >>>>&1 string x disk %s
  1235. >>>>>&1 string x \b, next %s
  1236. # optional name of previous disk szDisk*
  1237. >>>>>>&1 string x disk %s
  1238. >>>>>>>&1 use cab-folder
  1239. # display filename and disk name of previous or next cabinet
  1240. 0 name cab-anchor
  1241. # optional name of previous/next cabinet file szCabinet*[255]
  1242. >&0 string x %s
  1243. # optional name of previous/next disk szDisk*[255]
  1244. >>&1 string x disk %s
  1245. # display folder structure CFFOLDER information like compression of cabinet
  1246. 0 name cab-folder
  1247. # offset of the CFDATA block in this folder
  1248. #>0 ulelong x \b, coffCabStart 0x%x
  1249. # number of CFDATA blocks in folder
  1250. >4 uleshort x \b, %u datablock
  1251. # plural s
  1252. >4 uleshort >1 \bs
  1253. # compression typeCompress: 0~None 1~MSZIP 0x1503~LZX:21 0x1003~LZX:16 0x0f03~LZX:15
  1254. >6 uleshort x \b, 0x%x compression
  1255. # optional per-folder reserved area
  1256. #>8 ubequad x \b, abReserve 0x%llx
  1257. # display member structure CFFILE information like member name of cabinet
  1258. 0 name cab-file
  1259. # cbFile is uncompressed size of file in bytes
  1260. #>0 ulelong x \b, cbFile %u
  1261. # uoffFolderStart is uncompressed offset of file in folder
  1262. #>4 ulelong >0 \b, uoffFolderStart 0x%x
  1263. # iFolder is index into the CFFOLDER area. 0 indicates first folder in cabinet
  1264. # define ifoldCONTINUED_FROM_PREV (0xFFFD)
  1265. # define ifoldCONTINUED_TO_NEXT (0xFFFE)
  1266. # define ifoldCONTINUED_PREV_AND_NEXT (0xFFFF)
  1267. >8 uleshort >0 \b, iFolder 0x%x
  1268. # date stamp for file
  1269. #>10 uleshort x \b, date 0x%x
  1270. # time stamp for file
  1271. #>12 uleshort x \b, time 0x%x
  1272. # attribs is attribute flags for file
  1273. # define _A_RDONLY (0x01) file is read-only
  1274. # define _A_HIDDEN (0x02) file is hidden
  1275. # define _A_SYSTEM (0x04) file is a system file
  1276. # define _A_ARCH (0x20) file modified since last backup
  1277. # example http://sebastien.kirche.free.fr/pebuilder_plugins/depends.cab
  1278. # define _A_EXEC (0x40) run after extraction
  1279. # define _A_NAME_IS_UTF (0x80) szName[] contains UTF
  1280. # define UNKNOWN (0x0100) undocumented or accident
  1281. #>14 uleshort x \b, attribs 0x%x
  1282. >14 uleshort >0 +
  1283. >>14 uleshort &0x0001 \bR
  1284. >>14 uleshort &0x0002 \bH
  1285. >>14 uleshort &0x0004 \bS
  1286. >>14 uleshort &0x0020 \bA
  1287. >>14 uleshort &0x0040 \bX
  1288. >>14 uleshort &0x0080 \bUtf
  1289. # unknown 0x0100 flag found on one XP_CD:\I386\DRIVER.CAB
  1290. >>14 uleshort &0x0100 \b?
  1291. # szName is name of archive member
  1292. >16 string x "%s"
  1293. # next archive member name if more files
  1294. #>>&17 string >\0 \b, NEXT NAME %-.50s
  1295. # InstallShield Cabinet files
  1296. 0 string/b ISc( InstallShield Cabinet archive data
  1297. >5 byte&0xf0 =0x60 version 6,
  1298. >5 byte&0xf0 !0x60 version 4/5,
  1299. >(12.l+40) lelong x %u files
  1300. # Windows CE package files
  1301. 0 string/b MSCE\0\0\0\0 Microsoft WinCE install header
  1302. >20 lelong 0 \b, architecture-independent
  1303. >20 lelong 103 \b, Hitachi SH3
  1304. >20 lelong 104 \b, Hitachi SH4
  1305. >20 lelong 0xA11 \b, StrongARM
  1306. >20 lelong 4000 \b, MIPS R4000
  1307. >20 lelong 10003 \b, Hitachi SH3
  1308. >20 lelong 10004 \b, Hitachi SH3E
  1309. >20 lelong 10005 \b, Hitachi SH4
  1310. >20 lelong 70001 \b, ARM 7TDMI
  1311. >52 leshort 1 \b, 1 file
  1312. >52 leshort >1 \b, %u files
  1313. >56 leshort 1 \b, 1 registry entry
  1314. >56 leshort >1 \b, %u registry entries
  1315. # Windows Enhanced Metafile (EMF)
  1316. # See msdn.microsoft.com/archive/en-us/dnargdi/html/msdn_enhmeta.asp
  1317. # for further information.
  1318. 0 ulelong 1
  1319. >40 string \ EMF Windows Enhanced Metafile (EMF) image data
  1320. >>44 ulelong x version 0x%x
  1321. 0 string/b \224\246\056 Microsoft Word Document
  1322. !:mime application/msword
  1323. 512 string R\0o\0o\0t\0\ \0E\0n\0t\0r\0y Microsoft Word Document
  1324. !:mime application/msword
  1325. # From: "Nelson A. de Oliveira" <naoliv@gmail.com>
  1326. # Magic type for Dell's BIOS .hdr files
  1327. # Dell's .hdr
  1328. 0 string/b $RBU
  1329. >23 string Dell %s system BIOS
  1330. >5 byte 2
  1331. >>48 byte x version %d.
  1332. >>49 byte x \b%d.
  1333. >>50 byte x \b%d
  1334. >5 byte <2
  1335. >>48 string x version %.3s
  1336. # Type: Microsoft Document Imaging Format (.mdi)
  1337. # URL: http://en.wikipedia.org/wiki/Microsoft_Document_Imaging_Format
  1338. # From: Daniele Sempione <scrows@oziosi.org>
  1339. # Too weak (EP)
  1340. #0 short 0x5045 Microsoft Document Imaging Format
  1341. # MS eBook format (.lit)
  1342. 0 string/b ITOLITLS Microsoft Reader eBook Data
  1343. >8 lelong x \b, version %u
  1344. !:mime application/x-ms-reader
  1345. # Windows CE Binary Image Data Format
  1346. # From: Dr. Jesus <j@hug.gs>
  1347. 0 string/b B000FF\n Windows Embedded CE binary image
  1348. # Windows Imaging (WIM) Image
  1349. 0 string/b MSWIM\000\000\000 Windows imaging (WIM) image
  1350. 0 string/b WLPWM\000\000\000 Windows imaging (WIM) image, wimlib pipable format
  1351. # The second byte of these signatures is a file version; I don't know what,
  1352. # if anything, produced files with version numbers 0-2.
  1353. # From: John Elliott <johne@seasip.demon.co.uk>
  1354. 0 string \xfc\x03\x00 Mallard BASIC program data (v1.11)
  1355. 0 string \xfc\x04\x00 Mallard BASIC program data (v1.29+)
  1356. 0 string \xfc\x03\x01 Mallard BASIC protected program data (v1.11)
  1357. 0 string \xfc\x04\x01 Mallard BASIC protected program data (v1.29+)
  1358. 0 string MIOPEN Mallard BASIC Jetsam data
  1359. 0 string Jetsam0 Mallard BASIC Jetsam index data
  1360. # DOS backup 2.0 to 3.2
  1361. # backupid.@@@
  1362. # plausibility check for date
  1363. 0x3 ushort >1979
  1364. >0x5 ubyte-1 <31
  1365. >>0x6 ubyte-1 <12
  1366. # actually 121 nul bytes
  1367. >>>0x7 string \0\0\0\0\0\0\0\0
  1368. >>>>0x1 ubyte x DOS 2.0 backup id file, sequence %d
  1369. !:ext @@@
  1370. >>>>0x0 ubyte 0xff \b, last disk
  1371. # backed up file
  1372. # skip some AppleWorks word like Tomahawk.Awp, WIN98SE-DE.vhd
  1373. # by looking for trailing nul of maximal file name string
  1374. 0x52 ubyte 0
  1375. # test for flag byte: FFh~complete file, 00h~split file
  1376. # FFh -127 = -1 -127 = -128
  1377. # 00h -127 = 0 -127 = -127
  1378. >0 byte-127 <-126
  1379. # plausibility check for file name length
  1380. >>0x53 ubyte-1 <78
  1381. # looking for terminating nul of file name string
  1382. >>>(0x53.b+4) ubyte 0
  1383. # looking if last char of string is valid DOS file name
  1384. >>>>(0x53.b+3) ubyte >0x1F
  1385. # actually 44 nul bytes
  1386. # but sometimes garbage according to Ralf Quint. So can not be used as test
  1387. #>0x54 string \0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0
  1388. # first char of full file name is DOS (5Ch) or UNIX (2Fh) path separator
  1389. # only DOS variant found. UNIX variant according to V32SLASH.TXT in archive PD0315.EXE
  1390. >>>>>5 ubyte&0x8C 0x0C
  1391. # ./msdos (version 5.30) labeled the entry as
  1392. # "DOS 2.0 backed up file %s, split file, sequence %d" or
  1393. # "DOS 2.0 backed up file %s, complete file"
  1394. >>>>>>0 ubyte x DOS 2.0-3.2 backed up
  1395. #>>>>>>0 ubyte 0xff complete
  1396. >>>>>>0 ubyte 0
  1397. >>>>>>>1 uleshort x sequence %d of
  1398. # full file name with path but without drive letter and colon stored from 0x05 til 0x52
  1399. >>>>>>0x5 string x file %s
  1400. # backup name is original filename
  1401. #!:ext *
  1402. # magic/Magdir/msdos, 1169: Warning: EXTENSION type ` *' has bad char '*'
  1403. # file: line 1169: Bad magic entry ' *'
  1404. # after header original file content
  1405. >>>>>>128 indirect x \b;
  1406. # DOS backup 3.3 to 5.x
  1407. # CONTROL.nnn files
  1408. 0 string \x8bBACKUP\x20
  1409. # actually 128 nul bytes
  1410. >0xa string \0\0\0\0\0\0\0\0
  1411. >>0x9 ubyte x DOS 3.3 backup control file, sequence %d
  1412. >>0x8a ubyte 0xff \b, last disk
  1413. # NB: The BACKUP.nnn files consist of the files backed up,
  1414. # concatenated.