msdos 58 KB

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