msdos 94 KB

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