msdos 75 KB

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