msdos 125 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098209921002101210221032104210521062107210821092110211121122113211421152116211721182119212021212122212321242125212621272128212921302131213221332134213521362137213821392140214121422143214421452146214721482149215021512152215321542155215621572158215921602161216221632164216521662167216821692170217121722173217421752176217721782179218021812182218321842185218621872188218921902191219221932194219521962197219821992200220122022203220422052206220722082209221022112212221322142215221622172218221922202221222222232224222522262227222822292230223122322233223422352236223722382239224022412242224322442245224622472248224922502251225222532254225522562257225822592260226122622263226422652266226722682269227022712272227322742275227622772278227922802281228222832284228522862287228822892290229122922293229422952296229722982299230023012302230323042305230623072308230923102311231223132314231523162317231823192320232123222323232423252326232723282329233023312332233323342335233623372338233923402341234223432344234523462347234823492350235123522353235423552356235723582359236023612362236323642365236623672368236923702371237223732374237523762377237823792380238123822383238423852386238723882389239023912392239323942395239623972398239924002401240224032404240524062407240824092410241124122413241424152416241724182419242024212422242324242425242624272428242924302431243224332434243524362437243824392440244124422443244424452446244724482449245024512452245324542455245624572458245924602461246224632464246524662467246824692470247124722473247424752476247724782479248024812482248324842485248624872488248924902491249224932494249524962497249824992500250125022503250425052506250725082509251025112512251325142515251625172518251925202521252225232524252525262527252825292530253125322533253425352536253725382539254025412542254325442545254625472548254925502551255225532554255525562557255825592560256125622563256425652566256725682569257025712572257325742575257625772578257925802581258225832584258525862587258825892590259125922593259425952596259725982599260026012602260326042605260626072608260926102611261226132614261526162617261826192620262126222623262426252626262726282629263026312632263326342635263626372638263926402641264226432644264526462647264826492650265126522653265426552656265726582659266026612662266326642665266626672668266926702671267226732674267526762677267826792680268126822683268426852686268726882689269026912692269326942695269626972698269927002701270227032704270527062707270827092710271127122713271427152716271727182719272027212722272327242725272627272728272927302731273227332734273527362737273827392740274127422743274427452746274727482749275027512752275327542755275627572758275927602761276227632764276527662767276827692770277127722773277427752776277727782779278027812782278327842785278627872788278927902791279227932794279527962797279827992800280128022803280428052806280728082809281028112812281328142815281628172818281928202821282228232824282528262827282828292830283128322833283428352836283728382839284028412842284328442845284628472848284928502851285228532854285528562857285828592860286128622863286428652866286728682869287028712872287328742875287628772878287928802881288228832884288528862887288828892890289128922893289428952896289728982899290029012902290329042905290629072908290929102911291229132914291529162917291829192920292129222923292429252926292729282929293029312932293329342935293629372938293929402941294229432944294529462947294829492950295129522953295429552956295729582959296029612962296329642965296629672968296929702971297229732974297529762977297829792980298129822983298429852986298729882989299029912992299329942995299629972998299930003001300230033004300530063007300830093010301130123013301430153016301730183019302030213022302330243025302630273028302930303031303230333034303530363037303830393040304130423043304430453046304730483049305030513052305330543055305630573058305930603061306230633064306530663067306830693070307130723073
  1. #------------------------------------------------------------------------------
  2. # $File: msdos,v 1.208 2024/08/27 18:50:57 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. # Tests for various EXE types.
  27. #
  28. # Many of the compressed formats were extracted from IDARC 1.23 source code.
  29. #
  30. # e_magic
  31. 0 string/b MZ
  32. # TODO
  33. # FLT: Syntrillium CoolEdit Filter https://en.wikipedia.org/wiki/Adobe_Audition
  34. # FMX64:FileMaker Pro 64-bit plug-in https://en.wikipedia.org/wiki/FileMaker
  35. # FMX: FileMaker Pro 32-bit plug-in https://en.wikipedia.org/wiki/FileMaker
  36. # FOD: WIFE Font Driver
  37. # GAU: MS Flight Simulator Gauge
  38. # IFS: OS/2 Installable File System https://en.wikipedia.org/wiki/OS/2
  39. # MEXW32:MATLAB Windows 32bit compiled function https://en.wikipedia.org/wiki/MATLAB
  40. # MEXW64:MATLAB Windows 64bit compiled function https://en.wikipedia.org/wiki/MATLAB
  41. # MLL: Maya plug-in (generic) http://en.wikipedia.org/wiki/Autodesk_Maya
  42. # PFL: PhotoFilter plugin http://photofiltre.free.fr
  43. # 8*: PhotoShop plug-in (generic) http://www.adobe.com/products/photoshop/main.html
  44. # PLG: Aston Shell plugin http://www.astonshell.com/
  45. # QLB: Microsoft Basic Quick library https://en.wikipedia.org/wiki/QuickBASIC
  46. # SKL: WinLIFT skin http://www.zapsolution.com/winlift/index.htm
  47. # TBK: Asymetrix ToolBook application http://www.toolbook.com
  48. # TBP: The Bat! plugin http://www.ritlabs.com
  49. # UPC: Ultimate Paint Graphics Editor plugin http://ultimatepaint.j-t-l.com
  50. # XFM: Syntrillium Cool Edit Transform Effect bad http://www.cooledit.com
  51. # XPL: X-Plane plugin http://www.xsquawkbox.net/xpsdk/
  52. # ZAP: ZoneLabs Zone Alarm data http://www.zonelabs.com
  53. #
  54. # NEXT LINES FOR DEBUGGING!
  55. # e_cblp; bytes on last page of file
  56. # e_cp; pages in file
  57. #>4 uleshort x \b, e_cp 0x%x
  58. # e_lfanew; file address of new exe header
  59. #>0x3c ulelong x \b, e_lfanew 0x%x
  60. # e_lfarlc; address of relocation table
  61. #>0x18 uleshort x \b, e_lfarlc=0x%x
  62. # e_ovno; overlay number. If zero, this is the main executable foo
  63. #>0x1a uleshort !0 \b, e_ovno 0x%x
  64. #>0x1C ubequad !0 \b, e_res 0x%16.16llx
  65. # e_oemid; often 0
  66. #>0x24 uleshort !0 \b, e_oemid 0x%x
  67. # e_oeminfo; typically zeroes, but 13Dh (WORDSTAR.CNV WPFT5.CNV) 143h (WRITWIN.CNV)
  68. # 1A3h (DBASE.CNV LOTUS123.CNV RFTDCA.CNV WORDDOS.CNV WORDMAC.CNV WORDWIN1.CNVXLBIFF.CNV)
  69. #>0x26 uleshort !0 \b, e_oeminfo 0x%x
  70. # e_res2; typically zeroes, but 000006006F082D2Ah SCSICFG.EXE 00009A0300007C03h de.exe
  71. # 0000CA0000000002h country.exe dosxmgr.exe 421E0A00421EA823h QMC.EXE
  72. #>0x28 ubequad !0 \b, e_res2 0x%16.16llx
  73. # https://web.archive.org/web/20171116024937/http://www.ctyme.com/intr/rb-2939.htm#table1593
  74. # https://github.com/uxmal/reko/blob/master/src/ImageLoaders/MzExe/ExeImageLoader.cs
  75. # new exe header magic like: PE NE LE LX W3 W4
  76. # no examples found for ZM DL MP P2 P3
  77. #>(0x3c.l) string x \b, at [0x3c] %.2s
  78. #>(0x3c.l) ubelong x \b, at [0x3c] %#8.8x
  79. #>(0x3c.l+4) ubelong x \b, at [0x3c+4] %#8.8x
  80. #
  81. # Most non-DOS MZ-executable extensions have the relocation table more than 0x40 bytes into the file.
  82. # http://www.mitec.cz/Downloads/EXE.zip/EXE64.exe e_lfarlc=0x8ead
  83. # OS/2 ECS\INSTALL\DETECTEI\PCISCAN.EXE e_lfarlc=0x1c
  84. # some EFI apps Shell_Full.efi ext4_x64_signed.efi e_lfarlc=0
  85. # Icon library WORD60.ICL e_lfarlc=0
  86. # Microsoft compiled help format 2.0 WINWORD.DEV.HXS e_lfarlc=0
  87. >0x18 uleshort <0x40
  88. # check magic of new second header
  89. # skip Portable Executable (PE) with low e_lfarlc here, because handled later
  90. # like: ext4_x64_signed.efi Shell_Full.efi WINWORD.DEV.HXS
  91. >>(0x3c.l) string !PE\0\0 MS-DOS executable
  92. # NE executable with low e_lfarlc like: WORD60.ICL
  93. # This is Icon Manager (IM) by Impact Software format, based on NE version 5 with cleared NE version and e_lfarlc fields
  94. # It can be parsed/loaded as NE version 5 binary just by skipping e_lfarlc and NE version checks
  95. # ICL: Icons Library 16-bit http://fileformats.archiveteam.org/wiki/Icon_library
  96. >>(0x3c.l-0x02) string IMNE \b, NE
  97. >>>(0x3c.l+0x02) ubyte x \b version %u
  98. >>>(0x3c.l+0x36) byte 2 for MS Windows
  99. >>>>(0x3c.l+0x3E) ushort !0
  100. >>>>>(0x3c.l+0x3F) ubyte x %u
  101. >>>>>(0x3c.l+0x3E) ubyte x \b.%02u
  102. >>>(0x3c.l+0x02) ubyte x (Icon Library, Icon Manager by Impact Software)
  103. !:ext icl
  104. # handle LX executable with low e_lfarlc like: PCISCAN.EXE
  105. >>(0x3c.l) string LX \b, LX
  106. >>>(0x3c.l+0x2) uleshort =0x0000
  107. >>>>(0x3c.l) use lx-executable
  108. # no examples found for big endian variant
  109. >>>(0x3c.l+0x2) uleshort =0x0101
  110. >>>>(0x3c.l) use \^lx-executable
  111. # no examples found for PDP-11 endian variant
  112. >>>(0x3c.l+0x2) uleshort =0x0100
  113. # PDP-11-endian is not supported by magic "use" keyword yet
  114. # no examples found for other endian variants
  115. >>>0 default x
  116. # other endianity is not supported by magic "use" keyword
  117. # Maybe it's a PE?
  118. # URL: http://fileformats.archiveteam.org/wiki/Portable_Executable
  119. # Reference: https://docs.microsoft.com/de-de/windows/win32/debug/pe-format
  120. >(0x3c.l) string PE\0\0 PE
  121. !:mime application/vnd.microsoft.portable-executable
  122. # https://docs.microsoft.com/de-de/windows/win32/debug/pe-format#characteristics
  123. # DLL Characteristics
  124. #>>(0x3c.l+22) uleshort x \b, CHARACTERISTICS %#4.4x,
  125. # 0x0200~IMAGE_FILE_DEBUG_STRIPPED Debugging information is removed from the image file
  126. # 0x1000~IMAGE_FILE_SYSTEM The image file is a system file, not a user program.
  127. # 0x2000~IMAGE_FILE_DLL The image file is a dynamic-link library (DLL)
  128. >>(0x3c.l+24) leshort 0x010b \b32 executable
  129. # https://learn.microsoft.com/en-us/windows/win32/debug/pe-format#windows-subsystem
  130. #>>>(0x3c.l+92) leshort x \b, SUBSYSTEM %u
  131. >>(0x3c.l+24) leshort 0x020b \b32+ executable
  132. #>>>(0x3c.l+92) leshort x \b, SUBSYSTEM %u
  133. # ROM image is without DOS MZ header and without PE\0\0 signature
  134. #>>(0x3c.l+24) leshort 0x0107 ROM image
  135. >>(0x3c.l+24) default x with unknown signature
  136. >>>&0 leshort x %#x
  137. ## Start of the subsystem switch
  138. >>(0x3c.l+92) clear x
  139. # 0~IMAGE_SUBSYSTEM_UNKNOWN An unknown subsystem
  140. >>(0x3c.l+92) leshort 0
  141. # WINE https://www.winehq.org/ DLL libraries without subsystem, some examples:
  142. # fakedlls/l3codeca.acm fakedlls/msadp32.acm fakedlls/inetcpl.cpl fakedlls/inetcpl.cpl fakedlls/kernel32.dll fakedlls/user32.dll fakedlls/gdi32.dll
  143. # fakedlls/winex11.drv fakedlls/winspool.drv fakedlls/gphoto2.ds fakedlls/sane.ds fakedlls/ntoskrnl.exe fakedlls/dhtmled.ocx fakedlls/hhctrl.ocx
  144. # fakedlls/hidclass.sys fakedlls/mshtml.tlb fakedlls/stdole32.tlb fakedlls/vwin32.vxd fakedlls/vmm.vxd
  145. >>>0x40 string Wine\ placeholder\ DLL for WINE stub (DLL)
  146. !:ext acm/cpl/dll/drv/ds/exe/ocx/sys/tlb/vxd
  147. >>>0x40 string Wine\ builtin\ DLL for WINE (DLL)
  148. !:ext acm/cpl/dll/drv/ds/exe/ocx/sys/tlb/vxd
  149. >>>0 default x
  150. # Summary: Microsoft compiled help *.HXS format 2.0
  151. # URL: https://en.wikipedia.org/wiki/Microsoft_Help_2
  152. # Reference: http://www.russotto.net/chm/itolitlsformat.html
  153. # https://mark0.net/download/triddefs_xml.7z/defs/h/hxs.trid.xml
  154. # Note: Microsoft compiled help format contains 2 PE32 sections (.rsrc, .its) for Intel i386;
  155. # The help content is appended after the PE32 binary and starts with ITOLITLS string;
  156. # End of the PE32 binary is immediately after the .its section.
  157. # verified by command like:
  158. # `pelook.exe -d WINWORD.HXS & pelook.exe -h WINWORD.HXS`
  159. # `objdump -p -s WINWORD.HXS`
  160. # `readpe WINWORD.HXS`
  161. >>>>(0x3c.l+6) uleshort =2
  162. # Second section for these binaries starts at fixed offset 288 (size of PE signature + size of COFF header + size
  163. # of PE32 optional header with all data dirs + size of first .rsrc section header = 4 + 20 + 96+8*16 + 40 = 288)
  164. >>>>>(0x3c.l+288) string/b .its\0\0\0\0
  165. # Read start+length of .its section and just after it
  166. >>>>>>(&4.l+(-4)) string ITOLITLS \b, Microsoft compiled help format 2.0
  167. !:ext hxs
  168. # Fallback for any unrecognized binary with Unknown subsystem 0
  169. >>>>>>0 default x for Unknown subsystem 0
  170. >>>>>0 default x for Unknown subsystem 0
  171. >>>>0 default x for Unknown subsystem 0
  172. # 1~IMAGE_SUBSYSTEM_NATIVE device drivers and native Windows processes
  173. >>(0x3c.l+92) leshort 1
  174. # WINE https://www.winehq.org/: fakedlls/fltmgr.sys fakedlls/mountmgr.sys fakedlls/scsiport.sys fakedlls/winebus.sys fakedlls/winehid.sys
  175. >>>0x40 string Wine\ placeholder\ DLL for WINE stub
  176. >>>0x40 string Wine\ builtin\ DLL for WINE
  177. >>>0 default x for MS Windows
  178. >>>>(0x3c.l+72) leshort x %u
  179. >>>>(0x3c.l+74) leshort x \b.%02u
  180. # Native PEs are used by:
  181. # - NT kernel DLLs: hal.dll, kdcom.dll, pshed.dll, bootvid.dll, ...
  182. # - NT kernel images: ntoskrnl.exe, ntkrnlmp.exe, ntkrnlpa.exe, ntkrpamp.exe
  183. # - NT kernel drivers: Windows/System32/drivers/*.sys
  184. # - NT native userspace DLLs: ntdll.dll, ...
  185. # - NT native userspace executables: smss.exe, csrss.exe, autochk.exe, ...
  186. # TODO: write rule to distinguish between Kernel and Native processes
  187. # (the only way to do this is based on the presence of ntoskrnl.exe in import table)
  188. >>>(0x3c.l+22) leshort&0x2000 >0 (native)
  189. !:ext dll/sys
  190. >>>(0x3c.l+22) leshort&0x2000 0 (native)
  191. !:ext exe/sys
  192. # 2~IMAGE_SUBSYSTEM_WINDOWS_GUI The Windows graphical user interface (GUI) subsystem
  193. >>(0x3c.l+92) leshort 2
  194. # WINE https://www.winehq.org/: fakedlls/clock.exe fakedlls/control.exe fakedlls/explorer.exe fakedlls/notepad.exe
  195. >>>0x40 string Wine\ placeholder\ DLL for WINE stub
  196. >>>0x40 string Wine\ builtin\ DLL for WINE
  197. >>>0 default x for MS Windows
  198. >>>>(0x3c.l+72) leshort x %u
  199. >>>>(0x3c.l+74) leshort x \b.%02u
  200. >>>(0x3c.l+22) leshort&0x2000 >0 (DLL)
  201. # These could probably be at least partially distinguished from one another by
  202. # looking for specific exported functions.
  203. # CPL: Control Panel item
  204. # TLB: Type library
  205. # OCX: OLE/ActiveX control
  206. # ACM: Audio compression manager codec
  207. # AX: DirectShow source filter
  208. # IME: Input method editor
  209. !:ext dll/cpl/tlb/ocx/acm/ax/ime
  210. >>>(0x3c.l+22) leshort&0x2000 0 (GUI)
  211. # Screen savers typically include code from the scrnsave.lib static library, but
  212. # that's not guaranteed.
  213. !:ext exe/scr
  214. # 3~IMAGE_SUBSYSTEM_WINDOWS_CUI The Windows character subsystem
  215. >>(0x3c.l+92) leshort 3
  216. # WINE https://www.winehq.org/: fakedlls/cacls.exe fakedlls/cmd.exe fakedlls/expand.exe fakedlls/net.exe fakedlls/reg.exe
  217. >>>0x40 string Wine\ placeholder\ DLL for WINE stub
  218. >>>0x40 string Wine\ builtin\ DLL for WINE
  219. >>>0 default x for MS Windows
  220. >>>>(0x3c.l+72) leshort x %u
  221. >>>>(0x3c.l+74) leshort x \b.%02u
  222. >>>(0x3c.l+22) leshort&0x2000 >0 (DLL)
  223. !:ext dll/cpl/tlb/ocx/acm/ax/ime
  224. >>>(0x3c.l+22) leshort&0x2000 0 (console)
  225. !:ext exe/com
  226. # 4~Old Windows CE subsystem (never used)
  227. #>>(0x3c.l+92) leshort 4 for MS Windows CE OLD
  228. # 5~IMAGE_SUBSYSTEM_OS2_CUI The OS/2 character subsystem
  229. # Not used in image files, constant used only in in-memory structures of OS/2 subsystem as part of Windows NT
  230. #>>(0x3c.l+92) leshort 5 for OS/2
  231. # NO Windows Subsystem number 6!
  232. #>>(0x3c.l+92) leshort 6 for Unknown subsystem 6
  233. # 7~IMAGE_SUBSYSTEM_POSIX_CUI The Posix character subsystem
  234. >>(0x3c.l+92) leshort 7 for POSIX
  235. >>>(0x3c.l+72) leshort x %u
  236. >>>(0x3c.l+74) leshort x \b.%02u
  237. >>>(0x3c.l+22) leshort&0x2000 >0 (DLL)
  238. # like: PSXDLL.DLL
  239. !:ext dll
  240. >>>(0x3c.l+22) leshort&0x2000 0 (EXE)
  241. # like: PAX.EXE
  242. !:ext exe
  243. # 8~IMAGE_SUBSYSTEM_NATIVE_WINDOWS Native Win9x driver
  244. # Win9x never used subsystem 8, all Win9x drivers are either LE/VXD or PE with native (1) subsystem
  245. # MSVC4 LINK.EXE can create PE binary for subsystem 8 by /SUBSYSTEM:MMOSA flag
  246. # MMOSA refers to Native Win32E (embedded) API, mentioned at:
  247. # https://www.microsoft.com/en-us/research/wp-content/uploads/2016/02/tr-97-18.doc
  248. #>>(0x3c.l+92) leshort 8 for Win9x/MMOSA
  249. # GRR: No examples found by Joerg Jenderek
  250. # 9~IMAGE_SUBSYSTEM_WINDOWS_CE_GUI Windows CE
  251. >>(0x3c.l+92) leshort 9
  252. # WINE https://www.winehq.org/
  253. >>>0x40 string Wine\ placeholder\ DLL for WINE stub
  254. >>>0x40 string Wine\ builtin\ DLL for WINE
  255. >>>0 default x for MS Windows CE
  256. >>>>(0x3c.l+72) leshort x %u
  257. >>>>(0x3c.l+74) leshort x \b.%02u
  258. >>>(0x3c.l+22) leshort&0x2000 >0 (DLL)
  259. # like: MCS9900Ce50.dll Mosiisr99x.dll TMCGPS.DLL
  260. !:ext dll
  261. >>>(0x3c.l+22) leshort&0x2000 0 (EXE)
  262. # like: NNGStart.exe navigator.exe
  263. !:ext exe
  264. # 10~IMAGE_SUBSYSTEM_EFI_APPLICATION An Extensible Firmware Interface (EFI) application
  265. >>(0x3c.l+92) leshort 10 for EFI (application)
  266. # like: bootmgfw.efi grub.efi gdisk_x64.efi Shell_Full.efi shim.efi syslinux.efi
  267. !:ext efi
  268. # 11~IMAGE_SUBSYSTEM_EFI_BOOT_SERVICE_DRIVER An EFI driver with boot services
  269. >>(0x3c.l+92) leshort 11 for EFI (boot service driver)
  270. # like: ext2_x64_signed.efi Fat_x64.efi iso9660_x64_signed.efi
  271. !:ext efi
  272. # 12~IMAGE_SUBSYSTEM_EFI_RUNTIME_DRIVER An EFI driver with run-time services
  273. >>(0x3c.l+92) leshort 12 for EFI (runtime driver)
  274. # no sample found
  275. !:ext efi
  276. # 13~IMAGE_SUBSYSTEM_EFI_ROM An EFI ROM image
  277. >>(0x3c.l+92) leshort 13 for EFI (ROM)
  278. # no sample found
  279. !:ext efi
  280. # 14~IMAGE_SUBSYSTEM_XBOX XBOX
  281. >>(0x3c.l+92) leshort 14 for XBOX
  282. #!:ext foo-xbox
  283. # NO Windows Subsystem number 15!
  284. #>>(0x3c.l+92) leshort 15 for Unknown subsystem 15
  285. # 16~IMAGE_SUBSYSTEM_WINDOWS_BOOT_APPLICATION Windows boot application
  286. >>(0x3c.l+92) leshort 16 for MS Windows
  287. >>>(0x3c.l+72) leshort x %u
  288. >>>(0x3c.l+74) leshort x \b.%02u
  289. >>>(0x3c.l+22) leshort&0x2000 >0 (boot DLL)
  290. # like: bootvhd.dll bootuwf.dll hvloader.dll tcbloader.dll bootspaces.dll
  291. !:ext dll
  292. >>>(0x3c.l+22) leshort&0x2000 0 (boot application)
  293. # like: bootmgr.efi memtest.efi shellx64.efi memtest.exe winload.exe winresume.exe bootvhd.dll hvloader.dll
  294. !:ext efi/exe
  295. >>(0x3c.l+92) default x
  296. >>>&0 leshort x for Unknown subsystem %#x
  297. ## End of the subsystem switch
  298. >>(0x3c.l+4) clear x \b,
  299. >>(0x3c.l+4) use display-coff-processor
  300. >>(0x3c.l+22) leshort&0x0200 >0 (stripped to external PDB)
  301. >>(0x3c.l+22) leshort&0x1000 >0 system file
  302. # Check for presence of COM Runtime descriptor
  303. >>(0x3c.l+24) leshort 0x010b
  304. >>>(0x3c.l+116) leshort >14
  305. >>>>(0x3c.l+232) lelong >0 Mono/.Net assembly
  306. >>(0x3c.l+24) leshort 0x020b
  307. >>>(0x3c.l+132) leshort >14
  308. >>>>(0x3c.l+248) lelong >0 Mono/.Net assembly
  309. # hooray, there's a DOS extender using the PE format, with a valid PE
  310. # executable inside (which just prints a message and exits if run in win)
  311. # FIXME: Find sample of such executable for investigation. In was introduced
  312. # in file version 4.14 with following check:
  313. # "(8.s*16) string 32STUB for MS-DOS, 32rtm DOS extender"
  314. # "(8.s*16) string !32STUB for MS Windows"
  315. # But that check is too generic and had lot of false positives. 32STUB/32rtm
  316. # sounds like Borland DOS extender with PE loader and Windows emulation which
  317. # can be injected into any valid Windows PE binary.
  318. # So it is needed to look at the sample of such executable and check for
  319. # subsystem or cpu/machine.
  320. # Detect embedded DOS extenders
  321. >>(8.s*16) string 32STUB
  322. # BRC32.EXE, TLINK32.EXE or TASM32.EXE from TASM 5.0
  323. >>>(8.s*16) search/0x50 32rtm-stub\ for\ PE\ files \b, Borland 32rtm DOS extender (stub)
  324. # CL.EXE or LINK.EXE from MS Visual C++ 1.x
  325. >>(8.s*16) search/0x50 Phar\ Lap\ Software,\ Inc. \b, Phar Lap TNT DOS extender
  326. # ulink.exe
  327. >>(8.s*16) search/0x200 Can't\ find\ DOSWIN32.RTM \b, DosWin32 DOS extender (stub)
  328. >>(8.s*16) search/0x4000 Stub\ failed\ to\ find\ DOS/4G\ extender. \b, DOS/4G DOS extender (stub)
  329. # LOADPEX.BIN and HDLD32.BIN
  330. # x86 jmp near relative (0xe9 0x?? 0x??) + string "MI" (0x4d 0x49)
  331. >>(8.s*16) ulequad&0xffff0000ff =0x494d0000e9 \b, HX DOS extender (embedded with DPMI host)
  332. >>(8.s*16) ulequad&0xffff0000ff !0x494d0000e9
  333. # DPMIST32.BIN
  334. >>>(8.s*16) search/0x200 cannot\ find\ loader\ DPMILD32.EXE \b, HX DOS extender (stub)
  335. # LOADPE.BIN
  336. >>>(8.s*16) search/0x600 PATH=HDPMI32.EXE \b, HX DOS extender (embedded without DPMI host)
  337. # DPMILD32.BIN
  338. >>>(8.s*16) search/0x4000 DPMILD32: \b, HX DOS extender (embedded without DPMI host)
  339. >>(0x3c.l+0xf8) string UPX0 \b, UPX compressed
  340. >>(0x3c.l+0xf8) search/0x140 PEC2 \b, PECompact2 compressed
  341. >>(0x3c.l+0xf8) search/0x140 UPX2
  342. >>>(&0x10.l+(-4)) string PK\3\4 \b, ZIP self-extracting archive (Info-Zip)
  343. >>(0x3c.l+0xf8) search/0x140 .idata
  344. >>>(&0xe.l+(-4)) string PK\3\4 \b, ZIP self-extracting archive (Info-Zip)
  345. >>>(&0xe.l+(-4)) string ZZ0 \b, ZZip self-extracting archive
  346. >>>(&0xe.l+(-4)) string ZZ1 \b, ZZip self-extracting archive
  347. >>(0x3c.l+0xf8) search/0x140 .rsrc
  348. >>>(&0x0f.l+(-4)) string a\\\4\5 \b, WinHKI self-extracting archive
  349. >>>(&0x0f.l+(-4)) string Rar! \b, RAR self-extracting archive
  350. >>>(&0x0f.l+(-4)) search/0x3000 MSCF \b, InstallShield self-extracting archive
  351. >>>(&0x0f.l+(-4)) search/32 Nullsoft \b, Nullsoft Installer self-extracting archive
  352. >>(0x3c.l+0xf8) search/0x140 .data
  353. >>>(&0x0f.l) string WEXTRACT \b, MS CAB-Installer self-extracting archive
  354. >>(0x3c.l+0xf8) search/0x140 .petite\0 \b, Petite compressed
  355. >>>(0x3c.l+0xf7) byte x
  356. >>>>(&0x104.l+(-4)) string =!sfx! \b, ACE self-extracting archive
  357. >>(0x3c.l+0xf8) search/0x140 .WISE \b, WISE installer self-extracting archive
  358. >>(0x3c.l+0xf8) search/0x140 .dz\0\0\0 \b, Dzip self-extracting archive
  359. >>&(0x3c.l+0xf8) search/0x100 _winzip_ \b, ZIP self-extracting archive (WinZip)
  360. >>&(0x3c.l+0xf8) search/0x100 SharedD \b, Microsoft Installer self-extracting archive
  361. >>0x30 string Inno \b, InnoSetup self-extracting archive
  362. # NumberOfSections; Normal Dynamic Link libraries have a few sections for code, data and resource etc.
  363. # PE used as container have less sections
  364. >>(0x3c.l+6) leshort >1 \b, %u sections
  365. # do not display for 1 section to get output like in version 5.43 and to keep output columns low
  366. #>>(0x3c.l+6) leshort =1 \b, %u section
  367. # If the relocation table is 0x40 or more bytes into the file, it's definitely
  368. # not a DOS EXE.
  369. >0x18 uleshort >0x3f
  370. # Hmm, not a PE but the relocation table is too high for a traditional DOS exe,
  371. # must be one of the unusual subformats.
  372. >>(0x3c.l) string !PE\0\0 MS-DOS executable
  373. #!:mime application/x-dosexec
  374. >>(0x3c.l) string NE \b, NE
  375. #!:mime application/x-dosexec
  376. !:mime application/x-ms-ne-executable
  377. >>>(0x3c.l+0x02) ubyte x \b version %u
  378. >>>(0x3c.l+0x02) ubyte >5
  379. >>>>(0x3c.l+0x03) ubyte x \b.%02u
  380. # FOR DEBUGGING!
  381. # Reference: https://wiki.osdev.org/NE
  382. # Create time for NE version <5 in FAT12 format
  383. #>>>(0x3c.l+0x02) ubyte <5
  384. #>>>>(0x3c.l+0x08) ulelong !0 \b, Created at
  385. #>>>>>(0x3c.l+0x0a) lemsdosdate x %s
  386. #>>>>>(0x3c.l+0x08) lemsdostime x %s
  387. # ProgFlags; Program flags, bitmapped
  388. #>>>(0x3c.l+0x0C) ubyte x \b, ProgFlags 0x%2.2x
  389. # >>>(0x3c.l+0x0c) ubyte&0x03 =0 \b, no automatic data segment
  390. # >>>(0x3c.l+0x0c) ubyte&0x03 =1 \b, single shared
  391. # >>>(0x3c.l+0x0c) ubyte&0x03 =2 \b, multiple
  392. # >>>(0x3c.l+0x0c) ubyte&0x03 =3 \b, (null)
  393. # >>>(0x3c.l+0x0c) ubyte &0x04 \b, Per-Process Library Initialization OR real mode only
  394. # >>>(0x3c.l+0x0c) ubyte &0x08 \b, Protected mode only
  395. # >>>(0x3c.l+0x0c) ubyte &0x10 \b, 8086 instructions in OS/2 app OR LIM 3.2 EMS API in Win app
  396. # >>>(0x3c.l+0x0c) ubyte &0x20 \b, i286 instructions in OS/2 app OR each instance in separate EMS bank in Win app
  397. # >>>(0x3c.l+0x0c) ubyte &0x40 \b, i386 instructions in OS/2 app OR private GlobalAlloc above the EMS line in Win app
  398. # >>>(0x3c.l+0x0c) ubyte &0x80 \b, x87 floating point instructions
  399. # ApplFlags; Application flags, bitmapped
  400. # https://www.fileformat.info/format/exe/corion-ne.htm
  401. #>>>(0x3c.l+0x0D) ubyte x \b, ApplFlags 0x%2.2x
  402. # Application type (bits 0-2); 1~Full screen (not aware of Windows/P.M. API)
  403. # 2~Compatible with Windows/P.M. API 3~Uses Windows/P.M. API
  404. #>>>(0x3c.l+0x0D) ubyte&0x07 =1 \b, Not compatiblr with Windows/P.M. API (full screen)
  405. #>>>(0x3c.l+0x0D) ubyte&0x07 =2 \b, Compatible with Windows/P.M. API (console mode)
  406. #>>>(0x3c.l+0x0D) ubyte&0x07 =3 \b, use Windows/P.M. API (window mode)
  407. #>>>(0x3c.l+0x0D) ubyte &0x08 \b, Bound OS/2 app OR application specific loader in Win app
  408. #>>>(0x3c.l+0x0D) ubyte &0x20 \b, Errors in image
  409. #>>>(0x3c.l+0x0D) ubyte &0x40 \b, Non-conforming OS/2 app OR private Win library above EMS line
  410. # bit 7; DLL or driver (SS:SP info invalid, CS:IP points at FAR init routine called with AX handle
  411. #>>>(0x3c.l+0x0D) ubyte &0x80 \b, DLL or driver
  412. # AutoDataSegIndex; automatic data segment index like: 0 2 3 22
  413. # zero if the SINGLEDATA and MULTIPLEDATA bits are cleared
  414. #>>>(0x3c.l+0x0e) uleshort x \b, AutoDataSegIndex %u
  415. # InitHeapSize; intial local heap size like; 0 400h 1400h
  416. # zero if there is no local allocation
  417. #>>>(0x3c.l+0x10) uleshort !0 \b, InitHeapSize 0x%x
  418. # InitStackSize; inital stack size like: 0 10h A00h 7D0h A8Ch FA0h 1000h 1388h
  419. # 1400h (CBT) 1800h 2000h 2800h 2EE0h 2F3Ch 3258h 3E80h 4000h 4E20h 5000h 6000h
  420. # 6D60h 8000h 40000h
  421. # zero if the SS register value does not equal the DS register value
  422. #>>>(0x3c.l+0x12) uleshort !0 \b, InitStackSize 0x%x
  423. # EntryPoint; segment offset value of CS:IP like: 0 10000h 18A84h 11C1Ah 307F1h
  424. #>>>(0x3c.l+0x14) ulelong !0 \b, EntryPoint 0x%x
  425. # InitStack; specifies the segment offset value of stack pointer SS:SP
  426. # like: 0 20000h 160000h
  427. #>>>(0x3c.l+0x18) ulelong !0 \b, InitStack 0x%x
  428. # SegCount; number of segments in segment table like: 0 1 2 3 16h
  429. #>>>(0x3c.l+0x1C) uleshort x \b, SegCount 0x%x
  430. # ModRefs; number of module references (DLLs) like; 0 1 3
  431. #>>>(0x3c.l+0x1E) uleshort !0 \b, ModRefs %u
  432. # NoResNamesTabSiz; size in bytes of non-resident names table
  433. # like: Bh 16h B4h B9h 2Ch 18Fh 16AAh
  434. #>>>(0x3c.l+0x20) uleshort x \b, NoResNamesTabSiz 0x%x
  435. # SegTableOffset; offset of Segment table like: 40h
  436. #>>>(0x3c.l+0x22) uleshort !0x40 \b, SegTableOffset 0x%x
  437. # ResTableOffset; offset of resources table like: 40h 50h 58h F0h
  438. # 40h for most fonts likedos737.fon FMFONT.FOT but 60h for L1WBASE.FON
  439. #>>>(0x3c.l+0x24) uleshort x \b, ResTableOffset 0x%x
  440. # ResidNamTable; offset of resident names table
  441. # like: 58h 5Ch 60h 68h 74h 98h 2E3h 2E7h 2F0h
  442. #>>>(0x3c.l+0x26) uleshort x \b, ResidNamTable 0x%x
  443. # ImportNameTable; offset of imported names table (array of counted strings, terminated with string of length 00h)
  444. # like: 77h 7Eh 80h C6h A7h ACh 2F8h 3FFh
  445. #>>>(0x3c.l+0x2a) uleshort x \b, ImportNameTable 0x%x
  446. # OffStartNonResTab; offset from start of file to non-resident names table
  447. # like: 110h 11Dh 19Bh 1A5h 3F5h 4C8h 4EEh D93h
  448. #>>>(0x3c.l+0x2c) ulelong x \b, OffStartNonResTab 0x%x
  449. # MovEntryCount; number of movable entry points like: 0 4 5 6 16 17 24 312 355 446
  450. #>>>(0x3c.l+0x30) uleshort !0 \b, MovEntryCount %u
  451. # FileAlnSzShftCnt; log2 of the segment sector size; 4~16 0~9~512 (default)
  452. #>>>(0x3c.l+0x32) uleshort !9 \b, FileAlnSzShftCnt %u
  453. # nResTabEntries; number of resource table entries like: 0 2
  454. #>>>(0x3c.l+0x34) uleshort !0 \b, nResTabEntries %u
  455. # Following fields are valid only for NE version 5+
  456. >>>(0x3c.l+0x02) ubyte >4
  457. # targOS; Target OS; 0~unspecified (OS/2 or Windows); detect it based on Windows-only flags and OS/2 specific import lib (DOSCALLS)
  458. #>>>(0x3c.l+0x36) byte x TARGOS %x
  459. >>>>(0x3c.l+0x36) byte 0
  460. # if windows version is specified then it is windows binary
  461. >>>>>(0x3c.l+0x3E) ushort !0 for MS Windows
  462. >>>>>>(0x3c.l+0x3F) ubyte x %u
  463. >>>>>>(0x3c.l+0x3E) ubyte x \b.%02u
  464. >>>>>>(0x3c.l+0x3F) ubyte <3
  465. >>>>>>>(0x3c.l+0x37) byte&0x04 0 (real mode only)
  466. >>>>>>>(0x3c.l+0x37) byte&0x04 !0 (real+protected mode)
  467. >>>>>>(0x3c.l+0x3E) ushort =0x0300
  468. >>>>>>>(0x3c.l+0x0c) ubyte&0x08 0 (real+protected mode)
  469. >>>>>>>(0x3c.l+0x0c) ubyte&0x08 !0 (protected mode only)
  470. >>>>>(0x3c.l+0x3E) ushort 0
  471. >>>>>>(0x3c.l+0x2a) leshort 0 for OS/2 1.x or MS Windows 1.x/2.x
  472. >>>>>>(0x3c.l+0x2a) default x
  473. # Binaries with DOSCALLS import library are for OS/2
  474. >>>>>>>&(&0.s-0x29) search/512/C \x08DOSCALLS for OS/2 1.x
  475. >>>>>>>(0x3c.l+0x2a) default x
  476. # Binaries with KERNEL, USER or GDI import library are for Windows
  477. # FIXME: names are prefixed by its length, but regex type does not support binary bytes
  478. >>>>>>>>&(&0.s-0x29) regex/512/C KERNEL|USER|GDI for MS Windows 1.x/2.x
  479. >>>>>>>>>(0x3c.l+0x37) byte&0x04 0 (real mode only)
  480. >>>>>>>>>(0x3c.l+0x37) byte&0x04 !0 (real+protected mode)
  481. # Binaries without any of those import library can be for any OS
  482. >>>>>>>>(0x3c.l+0x2a) default x for OS/2 1.x or MS Windows 1.x/2.x
  483. >>>>(0x3c.l+0x36) byte 1 for OS/2 1.x
  484. >>>>(0x3c.l+0x36) byte 2 for MS Windows
  485. # expctwinver; expected Windows version (minor first) like:
  486. # 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
  487. >>>>>(0x3c.l+0x3E) ushort !0
  488. >>>>>>(0x3c.l+0x3F) ubyte x %u
  489. >>>>>>(0x3c.l+0x3E) ubyte x \b.%02u
  490. # Empty version is is treated by Windows 3.x OS as Windows 2.01 version and by Windows 2.x OS as Windows 1.01 version
  491. >>>>>(0x3c.l+0x3E) ushort 0 1.x/2.x
  492. >>>>>(0x3c.l+0x3F) ubyte <3
  493. >>>>>>(0x3c.l+0x37) byte&0x04 0 (real mode only)
  494. >>>>>>(0x3c.l+0x37) byte&0x04 !0 (real+protected mode)
  495. >>>>>(0x3c.l+0x3E) ushort =0x0300
  496. >>>>>>(0x3c.l+0x0c) ubyte&0x08 0 (real+protected mode)
  497. >>>>>>(0x3c.l+0x0c) ubyte&0x08 !0 (protected mode only)
  498. # Windows P-code application
  499. # https://web.archive.org/web/20000304044656/http://msdn.microsoft.com/library/backgrnd/html/msdn_c7pcode2.htm
  500. # https://library.thedatadungeon.com/msdn-1992-09/msjv7/html/msjv0g6a.content.htm
  501. # https://en.wikipedia.org/wiki/P-code_machine#Microsoft_P-code
  502. # Can be created by MSC7 or MSVC1.x CL.EXE /Oq switch which calls MPC.EXE
  503. # MPC.EXE (Make P-Code utility) sets bit2 in MZ e_res[2] (e_flags) field
  504. # Filter out false-positive Windows 3.x applications with OS/2 WLO loader
  505. # (sets bit7 in NE ne_flagsothers) as they do not have MZ e_res[] fields
  506. >>>>>(0x3c.l+0x3E) ushort >0x0300
  507. >>>>>>(0x3c.l+0x37) ubyte&0x80 0
  508. >>>>>>>0x20 ubyte&0x04 !0 \b, P-code application
  509. # 32-bit Watcom Win386 extender in 16-bit Windows 3.x NE binaries
  510. # https://www.os2museum.com/wp/watcom-win386/
  511. # https://github.com/open-watcom/open-watcom-v2/blob/master/bld/win386/
  512. # https://misc.daniel-marschall.de/spiele/blown_away/disassemble.php
  513. # Examples: BA_LITE.EXE WALDO.EXE
  514. >>>>>(0x3c.l+0x3E) ushort >0x0300
  515. >>>>>>0x38 ulong !0
  516. >>>>>>>(0x38.l) string MQ \b, Watcom Win386 extender
  517. # OS 3 was reserved for Multitasking MS-DOS but it never used NE version 5+ (only NE version 4)
  518. #>>>>(0x3c.l+0x36) byte 3 for Multitasking MS-DOS
  519. # OS 4 was reserved for MS Windows/386 device drivers but MS Windows/386 2.x never used NE format (Xenix x.out format was used instead)
  520. #>>>>(0x3c.l+0x36) byte 4 for MS Windows/386 device driver
  521. # OS 5 is assigned to BOSS (Borland Operating System Services) but is used also by other 16-bit DOS applications
  522. >>>>(0x3c.l+0x36) byte 5 for MS-DOS
  523. # HDLD16.BIN
  524. # x86 jmp near relative (0xe9 0x?? 0x??) + string "MI" (0x4d 0x49)
  525. >>>>>(8.s*16) ulequad&0xffff0000ff =0x494d0000e9 \b, HX DOS extender 16-bit (embedded with DPMI host)
  526. >>>>>(8.s*16) ulequad&0xffff0000ff !0x494d0000e9
  527. # DPMIST16.BIN
  528. >>>>>>(8.s*16) search/0x200 cannot\ find\ loader\ DPMILD16.EXE \b, HX DOS extender 16-bit (stub)
  529. # DPMILD16.BIN
  530. >>>>>>(8.s*16) search/0x4000 DPMILD16: \b, HX DOS extender 16-bit (embedded without DPMI host)
  531. # TLINK.EXE or TD.EXE from TASM 5.0
  532. >>>>>>(8.s*16) string 16STUB
  533. >>>>>>>(8.s*16) search/0x1000 rtm.exe\0dpmi16bi.ovl \b, Borland rtm DOS extender (stub)
  534. >>>>>>(8.s*16) string !16STUB
  535. # TLINK.EXE or BRC.EXE from Borland Pascal 7.0
  536. >>>>>>>(8.s*16) search/0x1000 BOSS\ Stub\ Version \b, Borland BOSS DOS extender (stub)
  537. # OS 6 is not assigned but is used by 32-bit DOS application with extender (found only with HX DOS extender 32-bit)
  538. # http://downloads.sourceforge.net/dfendreloaded/D-Fend-Reloaded-1.4.4.zip
  539. # D-Fend Reloaded/VirtualHD/FREEDOS/DPMILD32.EXE
  540. # https://www.japheth.de/HX/DPMILD32.TXT
  541. >>>>(0x3c.l+0x36) byte 6 for MS-DOS
  542. # HDLD32.BIN
  543. # x86 jmp near relative (0xe9 0x?? 0x??) + string "MI" (0x4d 0x49)
  544. >>>>>(8.s*16) ulequad&0xffff0000ff =0x494d0000e9 \b, HX DOS extender 32-bit (embedded with DPMI host)
  545. >>>>>(8.s*16) ulequad&0xffff0000ff !0x494d0000e9
  546. # DPMIST32.BIN
  547. >>>>>>(8.s*16) search/0x200 cannot\ find\ loader\ DPMILD32.EXE \b, HX DOS extender 32-bit (stub)
  548. # DPMILD32.BIN
  549. >>>>>>(8.s*16) search/0x4000 DPMILD32: \b, HX DOS extender 32-bit (embedded without DPMI host)
  550. # https://en.wikipedia.org/wiki/Phar_Lap_(company)
  551. # like: TELLPROT.EXE from 286DEX
  552. # can be created by BIND286.EXE from OS/2 NE binary
  553. >>>>(0x3c.l+0x36) byte 0x81 for MS-DOS, Phar Lap 286 DOS extender, emulating OS/2 1.x
  554. # like: CVP7.EXE from 286DEX
  555. # can be created by BIND286.EXE from Windows NE binary
  556. >>>>(0x3c.l+0x36) byte 0x82 for MS-DOS, Phar Lap 286 DOS extender, emulating MS Windows
  557. >>>>>(0x3c.l+0x3E) ushort 0 1.x/2.x
  558. >>>>>(0x3c.l+0x3E) ushort !0
  559. >>>>>>(0x3c.l+0x3F) ubyte x %u
  560. >>>>>>(0x3c.l+0x3E) ubyte x \b.%02u
  561. >>>>(0x3c.l+0x36) default x
  562. >>>>>(0x3c.l+0x36) ubyte x for unknown OS %#x
  563. # OS2EXEFlags; other EXE flags
  564. # 1~Long filename support 2~Win2.x proportional fonts 4~Win2.x protected mode 8~Executable has gangload area 10~Win9x thunk lib without DllEntryPoint 80~Win3.x app with OS/2 WLO loader
  565. #>>>>(0x3c.l+0x37) byte !0 \b, OS2EXEFlags 0x%x
  566. # gangstart; offset to start of gangload area like: 0 34h 58h 246h
  567. #>>>>(0x3c.l+0x38) uleshort !0 \b, gangstart 0x%x
  568. # ganglength; size of gangload area
  569. # like: 0 33Eh 39Ah AEEh
  570. #>>>>(0x3c.l+0x3A) uleshort !0 \b, ganglength 0x%x
  571. # mincodeswap; minimum code swap area size like 0 620Ch
  572. #>>>>(0x3c.l+0x3C) uleshort !0 \b, mincodeswap 0x%x
  573. >>>>(0x3c.l+0x3F) ubyte =3
  574. >>>>>0x3c ulelong >0x800
  575. >>>>>>(0x3c.l+0x37) ubyte &0x80 with OS/2 WLO loader
  576. # Detection for NE versions <5 which do not have OS type byte 0x36
  577. # These versions are used only by WINE, Windows 1.x/2.x and Multitasking MS-DOS
  578. # WINE binaries have special signature after the dos header (at fixed offset 0x40)
  579. # Multitasking MS-DOS binaries imports DOSCALLS library, so use it for distinguishing
  580. # Import libraries are part of the string table which starts one byte after the
  581. # 16-bit indirect offset 0x2a relative to the beginning of NE header, and consist
  582. # of concatenated pascal strings (first byte of the string is its length)
  583. >>>(0x3c.l+0x02) ubyte <5
  584. # like: fakedlls/krnl386.exe16 fakedlls/gdi.exe16 fakedlls/winsock.dll16 fakedlls/winoldap.mod16 fakedlls/mouse.drv16
  585. >>>>0x40 string Wine\ placeholder\ DLL for WINE stub
  586. >>>>(0x3c.l+0x2a) default x
  587. # like: HE_DAEM.EXE POPUP.EXE QUEUER.EXE
  588. >>>>>&(&0.s-0x29) search/512/C \x08DOSCALLS for Multitasking MS-DOS
  589. >>>>>(0x3c.l+0x2a) default x for MS Windows 1.x/2.x
  590. # Special case, Windows 3.x OS parse from NE version 4 binaries also following NE version 5 fields:
  591. # - os type if is 0 or 2
  592. # - bits proportional fonts and protected mode
  593. # Such NE version 4 binary is treated by Windows 3.x OS as Windows 2.01
  594. # compatible binary and by Windows 2.x OS as Windows 1.01 compatible binary.
  595. # So if os type is correct (0 or 2; matched mask 0xfd) and at least one
  596. # of those bits is set and others are cleared (matched mask 0xf9) then
  597. # detect if binary has NE version 5 protected mode bit set.
  598. >>>>>>(0x3c.l+0x36) leshort&0xf9fd 0
  599. >>>>>>>(0x3c.l+0x37) byte&0x06 !0
  600. >>>>>>>>(0x3c.l+0x37) byte&0x04 0 (real mode only)
  601. >>>>>>>>(0x3c.l+0x37) byte&0x04 !0 (real+protected mode)
  602. >>>>>>>(0x3c.l+0x37) default x (real mode only)
  603. >>>>>>(0x3c.l+0x36) default x (real mode only)
  604. # DRV: Driver
  605. # 3GR: Grabber device driver
  606. # CPL: Control Panel Item
  607. # VBX: Visual Basic Extension https://en.wikipedia.org/wiki/Visual_Basic
  608. # FON: Bitmap font http://fileformats.archiveteam.org/wiki/FON
  609. # FOT: Font resource file
  610. # EXE: WINSPOOL.EXE USER.EXE krnl386.exe GDI.EXE
  611. # CNV: Microsoft Word text conversion https://www.file-extensions.org/cnv-file-extension-microsoft-word-text-conversion-data
  612. >>>(0x3c.l+0x0c) leshort &0x8000
  613. # Check segment count, if 0 then this is resource-only DLL
  614. >>>>(0x3c.l+0x1c) leshort 0
  615. >>>>>(0x3c.l+0x2c) lelong !0
  616. >>>>>>(&-4.l+1) string/C FONTRES (DLL, font)
  617. !:ext fon/fot
  618. >>>>>>(&-4.l+1) default x (DLL, resource-only)
  619. !:ext dll
  620. >>>>>(0x3c.l+0x2c) lelong 0 (DLL, resource-only)
  621. !:ext dll
  622. >>>>(0x3c.l+0x1c) leshort !0
  623. # Check description of the module, first word specifies type of the DLL library
  624. >>>>>(0x3c.l+0x2c) lelong !0
  625. >>>>>>(&-4.l+1) string/C DDRV (DLL, driver)
  626. !:ext drv
  627. >>>>>>(&-4.l+1) default x (DLL)
  628. !:ext dll/drv/3gr/cpl/vbx
  629. >>>>>(0x3c.l+0x2c) lelong 0 (DLL)
  630. !:ext dll/drv/3gr/cpl/vbx
  631. >>>(0x3c.l+0x0c) leshort&0x8000 0 (EXE)
  632. !:ext exe/scr
  633. >>>>(0x3c.l+0x0d) ubyte&0x07 =1 (full screen)
  634. >>>>(0x3c.l+0x0d) ubyte&0x07 =2 (console)
  635. >>>>(0x3c.l+0x0d) ubyte&0x07 =3 (GUI)
  636. >>>&(&0x24.s-1) string ARJSFX \b, ARJ self-extracting archive
  637. >>>(0x3c.l+0x70) search/0x80 WinZip(R)\ Self-Extractor \b, ZIP self-extracting archive (WinZip)
  638. >>(0x3c.l) string LX \b, LX
  639. !:mime application/x-dosexec
  640. >>>(0x3c.l+0x2) uleshort =0x0000
  641. >>>>(0x3c.l) use lx-executable
  642. # no examples found for big endian variant
  643. >>>(0x3c.l+0x2) uleshort =0x0101
  644. >>>>(0x3c.l) use \^lx-executable
  645. # no examples found for PDP-11 endian variant
  646. >>>(0x3c.l+0x2) uleshort =0x0100
  647. # PDP-11-endian is not supported by magic "use" keyword yet
  648. # no examples found for other endian variants
  649. >>>0 default x
  650. # other endianity is not supported by magic "use" keyword
  651. >>>(8.s*16) string emx \b, emx
  652. >>>>&1 string x %s
  653. >>>&(&0x54.l-3) string arjsfx \b, ARJ self-extracting archive
  654. # MS Windows system file, supposedly a collection of LE executables
  655. # like vmm32.vxd WIN386.EXE
  656. >>(0x3c.l) string W3 \b, W3 for MS Windows
  657. #!:mime application/x-dosexec
  658. !:mime application/x-ms-w3-executable
  659. >>>(0x3c.l+0x3) ubyte <4 %u
  660. # Windows 3.x WIN386.EXE
  661. !:ext exe
  662. >>>(0x3c.l+0x3) ubyte >3 %u
  663. # Windows 95 VMM32.VXD
  664. !:ext vxd
  665. >>>(0x3c.l+0x2) ubyte x \b.%02u
  666. # W4 executable
  667. >>(0x3c.l) string W4 \b, W4 for MS Windows
  668. #!:mime application/x-dosexec
  669. !:mime application/x-ms-w4-executable
  670. # windows 98 VMM32.VXD
  671. !:ext vxd
  672. >>>(0x3c.l+0x3) ubyte x %u
  673. >>>(0x3c.l+0x2) ubyte x \b.%02u
  674. # Linear Executable (LE) in Little Endian (\0\0)
  675. >>(0x3c.l) string LE\0\0 \b, LE
  676. !:mime application/x-dosexec
  677. >>>(0x3c.l+0x0a) leshort 1
  678. # some DOS extenders use LE files with OS/2 header
  679. >>>>0x240 search/0x100 DOS/4G for MS-DOS, DOS/4G DOS extender
  680. >>>>0x240 search/0x200 WATCOM\ C/C++ for MS-DOS, DOS/4GW DOS extender
  681. >>>>0x440 search/0x100 CauseWay\ DOS\ Extender for MS-DOS, CauseWay DOS extender
  682. >>>>0x40 search/0x40 PMODE/W for MS-DOS, PMODE/W DOS extender
  683. >>>>0x40 search/0x40 STUB/32A for MS-DOS, DOS/32A DOS extender (stub)
  684. >>>>0x40 search/0x80 STUB/32C for MS-DOS, DOS/32A DOS extender (configurable stub)
  685. >>>>0x40 search/0x80 DOS/32A for MS-DOS, DOS/32A DOS extender (embedded)
  686. # D3XW.EXE
  687. >>>>(8.s*16) string o2LEstub for MS-DOS, D3X DOS extender
  688. >>>>0 default x
  689. # DOS32MW.DLL
  690. >>>>>(0x3c.l+0x10) lelong&0x38000 =0x18000 for MS-DOS (DLL)
  691. !:ext dll
  692. # HPFS.386 (HPFS386 filesystem for OS/2 1.x, part of Microsoft LAN Manager)
  693. # https://www.os2museum.com/wp/os2-history/os2-16-bit-server/
  694. # EXE module (&0x38000=0x00000) with zero application type (&0x700=0x000) and
  695. # with no external fixups (&0x20=0x20) is .386 32-bit driver module for OS/2 1.x
  696. >>>>>(0x3c.l+0x10) lelong&0x38720 =0x00020 for OS/2 1.x (driver)
  697. !:ext 386
  698. >>>>>0 default x for unknown OS 0x1
  699. # this is a wild guess; hopefully it is a specific signature
  700. >>>>&0x24 lelong <0x50
  701. >>>>>(&0x4c.l) string \xfc\xb8WATCOM
  702. >>>>>>&0 search/8 3\xdbf\xb9 \b, 32Lite compressed
  703. # another wild guess: if real OS/2 LE executables exist, they probably have higher start EIP
  704. #>>>>(0x3c.l+0x1c) lelong >0x10000 for OS/2
  705. # fails with DOS-Extenders.
  706. # OS 2 was reserved for MS Windows 16-bit but it never used LE (NE format was used instead)
  707. #>>>(0x3c.l+0x0a) leshort 2 for MS Windows 16-bit
  708. # OS 3 was reserved for Multitasking MS-DOS but it never used LE (NE format was used instead)
  709. #>>>(0x3c.l+0x0a) leshort 3 for Multitasking MS-DOS
  710. >>>(0x3c.l+0x0a) leshort 4 for MS Windows
  711. >>>>(0x3c.l+0xc3) ubyte x %u
  712. >>>>(0x3c.l+0xc2) ubyte x \b.%02u
  713. >>>>(0x3c.l+0x10) lelong&0x38000 =0x08000
  714. # DLL module (0x08000) with no external fixups (0x20) for i386 CPU (2) is .386 VxD file for MS Windows 3.x
  715. >>>>>(0x3c.l+0x10) lelong&0x20 !0
  716. >>>>>>(0x3c.l+0x08) leshort 2 (VxD 386)
  717. !:ext 386
  718. >>>>(0x3c.l+0x10) lelong&0x38000 =0x28000 (VxD static)
  719. # VXD: VxD for MS Windows 95/98/Me
  720. # PDR: Port driver
  721. # MPD: Miniport driver (?)
  722. !:ext vxd/pdr/mpd
  723. >>>>(0x3c.l+0x10) lelong&0x38000 =0x38000 (VxD dynamic)
  724. !:ext vxd/pdr/mpd
  725. >>>(0x3c.l+0x0a) default x
  726. >>>>(0x3c.l+0x0a) leshort x for unknown OS %#x
  727. >>>(&0x7c.l+0x26) string UPX \b, UPX compressed
  728. >>>&(&0x54.l-3) string UNACE \b, ACE self-extracting archive
  729. # DOS/32A Linear Compressed file format
  730. >>(0x3c.l) string LC\0\0 \b, LC for MS-DOS
  731. >>>0x40 search/0x40 STUB/32A \b, DOS/32A DOS extender (stub)
  732. >>>0x40 search/0x80 STUB/32C \b, DOS/32A DOS extender (configurable stub)
  733. >>>0x40 search/0x80 DOS/32A \b, DOS/32A DOS extender (embedded)
  734. # PX\0\0 signature for 32bit DOS Applications in DOS-PE Format (https://www.japheth.de/HX.html)
  735. # SHDPMI.EXE, DOSTEST.EXE, GETVMODE.EXE, RMINT.EXE
  736. >(0x3c.l) string PX\0\0 \b, PE32
  737. >>(0x3c.l+24) leshort 0x020b \b+
  738. >>0 clear x
  739. >>0 default x executable for MS-DOS
  740. # LOADPEX.BIN and HDLD32.BIN
  741. # x86 jmp near relative (0xe9 0x?? 0x??) + string "MI" (0x4d 0x49)
  742. >>(8.s*16) ulequad&0xffff0000ff =0x494d0000e9 \b, HX DOS extender (embedded with DPMI host)
  743. >>(8.s*16) ulequad&0xffff0000ff !0x494d0000e9
  744. # DPMIST32.BIN
  745. >>>(8.s*16) search/0x200 cannot\ find\ loader\ DPMILD32.EXE \b, HX DOS extender (stub)
  746. # LOADPE.BIN
  747. >>>(8.s*16) search/0x600 PATH=HDPMI32.EXE \b, HX DOS extender (embedded without DPMI host)
  748. # DPMILD32.BIN
  749. >>>(8.s*16) search/0x4000 DPMILD32: \b, HX DOS extender (embedded without DPMI host)
  750. >0 clear x
  751. # Skip already parsed binary types
  752. # If magic in the branch is not parsed then always jumps to mz-unrecognized
  753. >(0x3c.l) string PE\0\0
  754. >(0x3c.l) string PX\0\0
  755. >(0x3c.l) string LX
  756. >(0x3c.l) string NE
  757. >>(0x3c.l-0x02) string !IMNE
  758. >>>0x18 uleshort <0x40
  759. >>>>0 use mz-unrecognized
  760. >(0x3c.l) string W3
  761. >>0x18 uleshort <0x40
  762. >>>0 use mz-unrecognized
  763. >(0x3c.l) string W4
  764. >>0x18 uleshort <0x40
  765. >>>0 use mz-unrecognized
  766. >(0x3c.l) string LE\0\0
  767. >>0x18 uleshort <0x40
  768. >>>0 use mz-unrecognized
  769. >(0x3c.l) string LC
  770. >>0x18 uleshort <0x40
  771. >>>0 use mz-unrecognized
  772. >0 default x
  773. # This sequence jumps to the next MZ overlay
  774. >>2 leshort !0
  775. # FIXME: Following line does not match binaries which total size is less than (4.s*512)
  776. >>>(4.s*512) leshort x
  777. >>>>&(2.s-514) leshort x
  778. >>>>>&-2 use mz-next-overlay
  779. >>>>>&-2 string BW
  780. >>>>>>0 use mz-bw-collection
  781. >>>>>&-2 string 3P
  782. >>>>>>0 use mz-3p
  783. >>>>0 default x
  784. >>>>>0 use mz-unrecognized
  785. >>>0 default x
  786. >>>>0 use mz-unrecognized
  787. >>2 leshort 0
  788. >>>(4.s*512) leshort x
  789. >>>>&-2 use mz-next-overlay
  790. >>>>&-2 string BW
  791. >>>>>0 use mz-bw-collection
  792. >>>>&-2 string 3P
  793. >>>>>0 use mz-3p
  794. >>>0 default x
  795. >>>>0 use mz-unrecognized
  796. # Parse content of the COFF, executable type was already printed in mz-next-overlay
  797. >(4.s*512) leshort 0x014c
  798. #!:mime application/x-dosexec
  799. # djgpp go32 v1 COFF
  800. # F2C.EXE from f2c95201.zip or compress.exe from djdev112.zip
  801. >>(&-6.l) string/b StubInfoMagic!!\0 for MS-DOS
  802. # djgpp go32 v2 COFF
  803. >>(8.s*16) string go32stub for MS-DOS
  804. >>(8.s*16) string emx
  805. >>>&1 string x for DOS, Win or OS/2, emx %s
  806. >>&(&0x42.l-3) byte x
  807. >>>&0x26 string UPX \b, UPX compressed
  808. # and yet another guess: small .text, and after large .data is unusual, could be 32lite
  809. >>&0x2c search/0xa0 .text
  810. >>>&0x0b lelong <0x2000
  811. >>>>&0 lelong >0x6000 \b, 32lite compressed
  812. # Parse content of the a.out, executable type was already printed in mz-next-overlay
  813. >(4.s*512) leshort 0x010b
  814. # djgpp go32 v1 a.out
  815. >>(&-6.l) string/b StubInfoMagic!!\0 for MS-DOS
  816. # djgpp go32 v1
  817. # Note that for "redirect" binaries is offset (4.s*512) behind end-of-file, so access it via "default"
  818. >(4.s*512) clear x
  819. >(4.s*512) default x
  820. >>(&-4.l) string/b StubInfoMagic!!\0
  821. >>>&0 lelong >39
  822. >>>>&19 byte x \b, DJGPP go32 v%u
  823. >>>>&18 byte x \b.%u
  824. >>>>&17 byte x \b%c DOS extender (stub)
  825. >>>&0 lelong <40 \b, DJGPP go32 v1 DOS extender (stub)
  826. >>>&0 lelong >35
  827. >>>>&0 byte !0
  828. >>>>>&-1 string/16 x \b, autoload "%s"
  829. >>>&0 lelong >62
  830. >>>>&28 byte !0
  831. # zcat.exe from djdev112.zip
  832. >>>>>&-1 string/15 x \b, redirect to "%s"
  833. # djgpp go32 v2
  834. >(8.s*16) string go32stub
  835. # Version string is usually ", v 2.05", so skip leading spaces
  836. >>&0 string ,\ v\
  837. >>>&0 string/4 x \b, DJGPP go32 v%s DOS extender
  838. >>&0 default x
  839. >>>&0 string/8 x \b, DJGPP go32 %s DOS extender
  840. >>&8 lelong >43
  841. >>>&24 byte 0
  842. # check for embedded DPMI host PMODSTUB.EXE
  843. >>>>0x1c string PMODSTUB.EXE (embedded PMODE/DJ)
  844. >>>>0x1c string !PMODSTUB.EXE
  845. >>>>>0x18 leshort 0
  846. # check for the default djgpp stub
  847. >>>>>>0x40 search/0x80 The\ STUB.EXE\ stub\ loader (stub)
  848. >>>>>>>(8.s*16) default x
  849. >>>>>>>>&8 lelong >83
  850. >>>>>>>>>&56 byte !0
  851. # show which DPMI host executable is autoloaded when none is running
  852. >>>>>>>>>>&-1 string/16 x \b, autoload "%s"
  853. >>>>>(0x18.s) default x
  854. >>>>>>&(0x6.s*4) default x
  855. # check for embedded DPMI host CWSDSTUB.EXE
  856. >>>>>>>&0 search/16 CWSDPMI
  857. >>>>>>>>&-7 regex/T =^CWSDPMI(\ [^\ ]+\ )? (embedded %s)
  858. # check for embedded DPMI host D3XD.EXE
  859. >>>>>>>&0 search/16 D3X
  860. >>>>>>>>&-3 regex/T =^D3X(\ [^\ ]+\ )? (embedded %s)
  861. >>>&24 byte !0
  862. # djtarx.exe or dxegen.exe from djdev205.zip
  863. >>>>&-1 string/8 x \b, redirect to "%s"
  864. >(8.s*16) string $WdX \b, WDos/X DOS extender
  865. # By now an executable type should have been printed out. The executable
  866. # may be a self-uncompressing archive, so look for evidence of that and
  867. # print it out.
  868. #
  869. # Some signatures below from Greg Roelofs, newt@uchicago.edu.
  870. #
  871. >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
  872. >0xe7 string LH/2\ Self-Extract \b, %s
  873. >0x1c string UC2X \b, UCEXE compressed
  874. >0x1c string WWP\ \b, WWPACK compressed
  875. >0x1c string RJSX \b, ARJ self-extracting archive
  876. >0x1c string diet \b, diet compressed
  877. >0x1c string LZ09 \b, LZEXE v0.90 compressed
  878. >0x1c string LZ91 \b, LZEXE v0.91 compressed
  879. >0x1c string tz \b, TinyProg compressed
  880. >0x1e string Copyright\ 1989-1990\ PKWARE\ Inc. \b, Self-extracting PKZIP archive
  881. !:mime application/zip
  882. # Yes, this really is "Copr", not "Corp."
  883. >0x1e string PKLITE\ Copr. \b, Self-extracting PKZIP archive
  884. !:mime application/zip
  885. # winarj stores a message in the stub instead of the sig in the MZ header
  886. >0x20 search/0xe0 aRJsfX \b, ARJ self-extracting archive
  887. >0x20 string AIN
  888. >>0x23 string 2 \b, AIN 2.x compressed
  889. >>0x23 string <2 \b, AIN 1.x compressed
  890. >>0x23 string >2 \b, AIN 1.x compressed
  891. >0x24 string LHa's\ SFX \b, LHa self-extracting archive
  892. !:mime application/x-lha
  893. >0x24 string LHA's\ SFX \b, LHa self-extracting archive
  894. !:mime application/x-lha
  895. >0x24 string \ $ARX \b, ARX self-extracting archive
  896. >0x24 string \ $LHarc \b, LHarc self-extracting archive
  897. >0x20 string SFX\ by\ LARC \b, LARC self-extracting archive
  898. >0x40 string aPKG \b, aPackage self-extracting archive
  899. >0x64 string W\ Collis\0\0 \b, Compack compressed
  900. >0x7a string Windows\ self-extracting\ ZIP \b, ZIP self-extracting archive
  901. >>&0xf4 search/0x140 \x0\x40\x1\x0
  902. >>>(&0.l+(4)) string MSCF \b, WinHKI CAB self-extracting archive
  903. >1638 string -lh5- \b, LHa self-extracting archive v2.13S
  904. >0x17888 string Rar! \b, RAR self-extracting archive
  905. # Skip to the end of the EXE. This will usually work fine in the PE case
  906. # because the MZ image is hardcoded into the toolchain and almost certainly
  907. # won't match any of these signatures.
  908. >(4.s*512) long x
  909. >>&(2.s-517) byte x
  910. >>>&0 string PK\3\4 \b, ZIP self-extracting archive
  911. >>>&0 string Rar! \b, RAR self-extracting archive
  912. >>>&0 string =!\x11 \b, AIN 2.x self-extracting archive
  913. >>>&0 string =!\x12 \b, AIN 2.x self-extracting archive
  914. >>>&0 string =!\x17 \b, AIN 1.x self-extracting archive
  915. >>>&0 string =!\x18 \b, AIN 1.x self-extracting archive
  916. >>>&7 search/400 **ACE** \b, ACE self-extracting archive
  917. >>>&0 search/0x480 UC2SFX\ Header \b, UC2 self-extracting archive
  918. # a few unknown ZIP sfxes, no idea if they are needed or if they are
  919. # already captured by the generic patterns above
  920. >(8.s*16) search/0x20 PKSFX \b, ZIP self-extracting archive (PKZIP)
  921. # TODO: how to add this? >FileSize-34 string Windows\ Self-Installing\ Executable \b, ZIP self-extracting archive
  922. #
  923. # TELVOX Teleinformatica CODEC self-extractor for OS/2:
  924. >49801 string \x79\xff\x80\xff\x76\xff \b, CODEC archive v3.21
  925. >>49824 leshort =1 \b, 1 file
  926. >>49824 leshort >1 \b, %u files
  927. # This named instance is called for multi overlay MZ executable with offset of the next overlay
  928. 0 name mz-next-overlay
  929. >0 string P2 \b, EXP (P2) for MS-DOS, Phar Lap 286 DOS extender
  930. >0 string P3 \b, EXP (P3) for MS-DOS, Phar Lap 386 DOS extender
  931. >0 string MT \b, MT for MS-DOS, IGC XMLOD i386 DOS extender
  932. >0 string 3P \b, 3P for MS-DOS
  933. # Other 3P details are printed later as they depend on the original MZ content
  934. >>32 lelong&0x00000001 !0 \b, 16-bit
  935. >>32 lelong&0x00000001 0
  936. # CWC.EXE from cw349bin.zip is 32-bit
  937. >>>32 lelong&0x00010000 0 \b, 32-bit
  938. # WL32.EXE from cw349bin.zip is dual mode
  939. >>>32 lelong&0x00010000 !0 \b, Dual mode
  940. >>32 lelong&0x80000000 !0 \b, Compressed
  941. >0 string D3X1 \b, D3X1 for MS-DOS, D3X DOS extender
  942. # BW details are printed later as they depend on the original MZ content
  943. >0 string BW \b, BW collection for MS-DOS
  944. # a.out details are printed later as they depend on the original MZ content
  945. >0 leshort 0x010b \b, a.out
  946. # COFF details are printed later as they depend on the original MZ content
  947. >0 leshort 0x014c \b, COFF
  948. >0 default x
  949. # now make offset aligned to 0x10
  950. >>0 offset%0x10 0x0
  951. # already aligned
  952. >>>0x0 use mz-next-overlay-aligned
  953. >>0 offset%0x10 0x1
  954. >>>0xf use mz-next-overlay-aligned
  955. >>0 offset%0x10 0x2
  956. >>>0xe use mz-next-overlay-aligned
  957. >>0 offset%0x10 0x3
  958. >>>0xd use mz-next-overlay-aligned
  959. >>0 offset%0x10 0x4
  960. >>>0xc use mz-next-overlay-aligned
  961. >>0 offset%0x10 0x5
  962. >>>0xb use mz-next-overlay-aligned
  963. >>0 offset%0x10 0x6
  964. >>>0xa use mz-next-overlay-aligned
  965. >>0 offset%0x10 0x7
  966. >>>0x9 use mz-next-overlay-aligned
  967. >>0 offset%0x10 0x8
  968. >>>0x8 use mz-next-overlay-aligned
  969. >>0 offset%0x10 0x9
  970. >>>0x7 use mz-next-overlay-aligned
  971. >>0 offset%0x10 0xa
  972. >>>0x6 use mz-next-overlay-aligned
  973. >>0 offset%0x10 0xb
  974. >>>0x5 use mz-next-overlay-aligned
  975. >>0 offset%0x10 0xc
  976. >>>0x4 use mz-next-overlay-aligned
  977. >>0 offset%0x10 0xd
  978. >>>0x3 use mz-next-overlay-aligned
  979. >>0 offset%0x10 0xe
  980. >>>0x2 use mz-next-overlay-aligned
  981. >>0 offset%0x10 0xf
  982. >>>0x1 use mz-next-overlay-aligned
  983. 0 name mz-next-overlay-aligned
  984. >0 string MP \b, EXP (MP) for MS-DOS, Phar Lap 386 DOS extender
  985. >0 default x
  986. >>0 use mz-unrecognized
  987. # This named instance is called for unrecognized MZ DOS binary from any offset
  988. 0 name mz-unrecognized
  989. >0 default x \b, MZ for MS-DOS
  990. !:mime application/x-dosexec
  991. # Windows and later versions of DOS will allow .EXEs to be named with a .COM
  992. # extension, mostly for compatibility's sake.
  993. # like: EDIT.COM 4DOS.COM CMD8086.COM CMD-FR.COM SYSLINUX.COM
  994. # URL: https://en.wikipedia.org/wiki/Personal_NetWare#VLM
  995. # Reference: https://mark0.net/download/triddefs_xml.7z/defs/e/exe-vlm-msg.trid.xml
  996. # also like: BGISRV.DRV
  997. !:ext exe/com/vlm/drv
  998. # This named instance is called for BW collection with offset from the beginning of the file
  999. 0 name mz-bw-collection
  1000. >(8.s*16) default x
  1001. >>&(&0x30.s) default x
  1002. >>>&0 string DOS/16M \b, DOS/16M DOS extender (embedded)
  1003. >>>&-8 string DOS/16M \b, DOS/16M DOS extender (embedded)
  1004. >>>&-8 string DOS/4G \b, DOS/4G DOS extender (embedded)
  1005. >>>0 default x
  1006. >>>>(8.s*16) search/0x4000 Stub\ failed\ to\ find\ DOS/4G\ extender. \b, DOS/4G DOS extender (stub)
  1007. # This named instance is called for CauseWay MZ 3P binary with offset from the beginning of the file
  1008. 0 name mz-3p
  1009. # CWC.EXE and WL32.EXE from cw349bin.bin
  1010. >0x440 search/0x100 CauseWay\ DOS\ Extender \b, CauseWay DOS extender
  1011. # CWHELP.EXE from cw349bin.bin
  1012. >0x200 search/0x100 CauseWay\ dynamic\ link\ library \b, CauseWay DLL
  1013. # Summary: OS/2 LX Library and device driver (no DOS stub)
  1014. # From: Joerg Jenderek
  1015. # URL: http://en.wikipedia.org/wiki/EXE
  1016. # Reference: http://www.textfiles.com/programming/FORMATS/lxexe.txt
  1017. # https://github.com/open-watcom/open-watcom-v2/blob/master/bld/watcom/h/exeflat.h
  1018. # https://github.com/bitwiseworks/os2tk45/blob/master/h/exe386.h
  1019. # https://archive.org/download/IBMOS2Warp4ToolkitDocuments2/lxref.htm
  1020. # Note: by dll-os2-no-dos-stub.trid.xml called "OS/2 Dynamic Link Library (no DOS stub)"
  1021. # similar looking like variant with MS-DOS stub (MZ magic): "MS-DOS executable, LX"
  1022. 0 string/b LX LX executable
  1023. #!:mime application/x-msdownload
  1024. !:mime application/x-lx-executable
  1025. >2 uleshort =0x0000
  1026. >>0 use lx-executable
  1027. # no examples found for big endian variant
  1028. >2 uleshort =0x0101
  1029. >>0 use \^lx-executable
  1030. # no examples found for PDP-11 endian variant
  1031. >2 uleshort =0x0100
  1032. # PDP-11-endian is not supported by magic "use" keyword yet
  1033. # no examples found for other endian variants
  1034. >>0 default x
  1035. # other endianity is not supported by magic "use" keyword
  1036. 0 name lx-executable
  1037. # FOR DEBUGGING!
  1038. # byte order: 00h~little-endian 01h~big-endian
  1039. #>0x02 ubyte =0 \b, little-endian byte order
  1040. #>0x02 ubyte =1 \b, big-endian word order
  1041. # word order: 00h~little-endian 01h~big-endian
  1042. #>0x03 ubyte =0 \b, little-endian word order
  1043. #>0x03 ubyte =1 \b, big-endian word order
  1044. # cpu_type; CPU type like: 1~i286 2~i386 3~i486 4~i586 20h~i860-N10 21h~i860-N11 40h~MIPS R2000,R3000 41h~MIPS R6000 42h~MIPS R4000
  1045. #>0x08 uleshort x \b, CPU %u
  1046. # os_type; target operating system like: 0~unknown 1~OS/2 2~Windows 16-bit 3~Multitasking MS-DOS 4.x 4~Windows 386 5~IBM Microkernel PN
  1047. #>0x0A leshort x \b, OS %u
  1048. # flags; module type flags
  1049. #>0x10 ulelong x \b, FLAGS %#8.8x
  1050. # 00000002h ~Reserved for system use
  1051. #>0x10 ulelong &0x00000002 \b, 2h reserved
  1052. # OSF_INIT_INSTANCE=00000004h ~Per-Process Library Initialization; setting this bit for EXE file is invalid
  1053. #>0x10 ulelong &0x00000004 \b, per-process library Initialization
  1054. #>0x10 ulelong &0x00000008 \b, system dll
  1055. # OSF_INTERNAL_FIXUPS_DONE=00000010h ~Internal fixups for the module have been applied
  1056. #>0x10 ulelong &0x00000010 \b, int. fixup
  1057. # OSF_EXTERNAL_FIXUPS_DONE=00000020h ~External fixups for the module have been applied
  1058. #>0x10 ulelong &0x00000020 \b, ext. fixup
  1059. # OSF_NOT_PM_COMPATIBLE=00000100h ~Incompatible with PM windowing
  1060. #>0x10 ulelong&0x00000700 =0x00000100 \b, incompatible with PM windowing
  1061. # OSF_PM_COMPATIBLE=00000200h ~Compatible with PM windowing
  1062. #>0x10 ulelong&0x00000700 =0x00000200 \b, compatible with PM windowing
  1063. #>0x10 ulelong&0x00000700 =0x00000300 \b, uses PM windowing API
  1064. #>0x10 ulelong &0x00002000 \b, not loadable
  1065. #>0x10 ulelong &0x00008000 \b, library module
  1066. # bit 17; device driver
  1067. #>0x10 ulelong &0x00020000 \b, device driver
  1068. #>0x10 ulelong &0x00080000 \b, multiple-processor unsafe
  1069. # Per-process Library Termination; setting this bit for EXE file is invalid
  1070. #>0x10 ulelong &0x40000000 \b, per-process library termination
  1071. # OS type
  1072. >0x0a clear x
  1073. >0x0a leshort 1 for OS/2
  1074. # OS 2 was reserved for MS Windows 16-bit but it never used LX (NE format was used instead)
  1075. #>0x0a leshort 2 for MS Windows 16-bit
  1076. # OS 3 was reserved for Multitasking MS-DOS but it never used LX (NE format was used instead)
  1077. #>0x0a leshort 3 for Multitasking MS-DOS
  1078. # OS 4 was reserved for MS Windows device drivers but it never used LX (LE format was used instead)
  1079. #>0x0a leshort 4 for MS Windows
  1080. # OS 5 was reserved for IBM Microkernel Personality Neutral but it never used LX (the only released IBM Workplace OS for PowerPC used ELF format)
  1081. #>0x0a leshort 5 for IBM Microkernel Personality Neutral
  1082. >0x0a default x
  1083. >>0x0a leshort x for unknown OS %#x
  1084. # http://www.ctyme.com/intr/rb-2939.htm#Table1610
  1085. # library by module type mask 00038000h (bits 15-17);
  1086. # 0h ~executable Program module
  1087. >0x10 ulelong&0x00038000 =0x00000000 (EXE)
  1088. !:ext exe
  1089. # bits 8-10; OSF_PM_APP=700h in flags ~Uses PM windowing API; either it is GUI or console
  1090. >>0x10 ulelong&0x00000700 =0x00000100 (full screen)
  1091. >>0x10 ulelong&0x00000700 =0x00000200 (console)
  1092. >>0x10 ulelong&0x00000700 =0x00000300 (GUI)
  1093. >0x10 ulelong&0x00038000 =0x00008000 (DLL)
  1094. !:ext dll
  1095. >0x10 ulelong&0x00038000 =0x00010000 (unknown)
  1096. >0x10 ulelong&0x00038000 =0x00018000 (PMDLL)
  1097. >0x10 ulelong&0x00038000 =0x00020000 (PDD)
  1098. !:ext sys
  1099. >0x10 ulelong&0x00038000 =0x00028000 (VDD)
  1100. !:ext sys
  1101. >0x10 ulelong&0x00038000 =0x00030000 (DLD)
  1102. >0x10 ulelong&0x00038000 =0x00038000 (unknown)
  1103. # CPU type
  1104. >0x08 clear x
  1105. >0x08 uleshort 1 \b, Intel i286
  1106. # all inspected examples
  1107. >0x08 uleshort 2 \b, Intel i386
  1108. >0x08 uleshort 3 \b, Intel i486
  1109. >0x08 uleshort 4 \b, Intel i586
  1110. # 20h Intel i860 N10 or compatible
  1111. # 21h Intel i860 N11 or compatible
  1112. # 40h MIPS Mark I ( R2000, R3000) or compatible
  1113. # 41h MIPS Mark II ( R6000 ) or compatible
  1114. # 42h MIPS Mark III ( R4000 ) or compatible
  1115. >0x08 default x
  1116. >>0x08 uleshort x \b, unknown CPU %#x
  1117. # Endianity for debugging, there are no samples for non-little-endian
  1118. #>0x02 clear x
  1119. #>0x02 uleshort =0x0000 (little-endian)
  1120. #>0x02 uleshort =0x0101 (big-endian)
  1121. #>0x02 uleshort =0x0100 (PDP-11-endian)
  1122. #>0x02 default x (unknown-endian)
  1123. # added by Joerg Jenderek of https://www.freedos.org/software/?prog=kc
  1124. # and https://www.freedos.org/software/?prog=kpdos
  1125. # for FreeDOS files like KEYBOARD.SYS, KEYBRD2.SYS, KEYBRD3.SYS, *.KBD
  1126. 0 string/b KCF FreeDOS KEYBoard Layout collection
  1127. # only version=0x100 found
  1128. >3 uleshort x \b, version %#x
  1129. # length of string containing author,info and special characters
  1130. >6 ubyte >0
  1131. #>>6 pstring x \b, name=%s
  1132. >>7 string >\0 \b, author=%-.14s
  1133. >>7 search/254 \xff \b, info=
  1134. #>>>&0 string x \b%-s
  1135. >>>&0 string x \b%-.15s
  1136. # for FreeDOS *.KL files
  1137. 0 string/b KLF FreeDOS KEYBoard Layout file
  1138. # only version=0x100 or 0x101 found
  1139. >3 uleshort x \b, version %#x
  1140. # stringlength
  1141. >5 ubyte >0
  1142. >>8 string x \b, name=%-.2s
  1143. 0 string \xffKEYB\ \ \ \0\0\0\0
  1144. >12 string \0\0\0\0`\004\360 MS-DOS KEYBoard Layout file
  1145. # DOS device driver updated by Joerg Jenderek at May 2011,Mar 2017,Aug 2020,Mar 2023
  1146. # URL: http://fileformats.archiveteam.org/wiki/DOS_device_driver
  1147. # Reference: http://www.delorie.com/djgpp/doc/rbinter/it/46/16.html
  1148. # http://www.o3one.org/hwdocs/bios_doc/dosref22.html
  1149. 0 ulequad&0x07a0ffffffff 0xffffffff
  1150. # skip OS/2 INI ./os2
  1151. >4 ubelong !0x14000000
  1152. #>>10 ubequad x MAYBE_DRIVER_NAME=%16.16llx
  1153. # https://bugs.astron.com/view.php?id=434
  1154. # skip OOXML document fragment 0000.dat where driver name is "empty" instead of "ASCII like"
  1155. >>10 ubequad !0
  1156. >>>0 use msdos-driver
  1157. 0 name msdos-driver DOS executable (
  1158. #!:mime application/octet-stream
  1159. !:mime application/x-dosdriver
  1160. # also found FreeDOS print driver SPOOL.DEV and disc compression driver STACLOAD.BIN
  1161. # and IBM Token-Ring adapter IBMTOK.DOS. Why and when DOS instead SYS is used?
  1162. # PROTMAN.DOS ELNKPL.DOS
  1163. !:ext sys/dev/bin/dos
  1164. # 1 space char after "UPX compressed" to get phrase like "UPX compressed character device"
  1165. >40 search/7 UPX! \bUPX compressed
  1166. # DOS device driver attributes
  1167. >4 uleshort&0x8000 0x0000 \bblock device driver
  1168. # character device
  1169. >4 uleshort&0x8000 0x8000 \b
  1170. # 1 space char after "clock" to get phrase like "clock character device driver CLOCK$"
  1171. >>4 uleshort&0x0008 0x0008 \bclock
  1172. # fast video output by int 29h
  1173. # 1 space char after "fast" to get phrase like "fast standard input/output character device driver"
  1174. >>4 uleshort&0x0010 0x0010 \bfast
  1175. # standard input/output device
  1176. # 1 space char after "standard" to get phrase like "standard input/output character device driver"
  1177. >>4 uleshort&0x0003 >0 \bstandard
  1178. >>>4 uleshort&0x0001 0x0001 \binput
  1179. >>>4 uleshort&0x0003 0x0003 \b/
  1180. # 1 space char after "output" to get phrase like "input/output character device driver"
  1181. >>>4 uleshort&0x0002 0x0002 \boutput
  1182. >>4 uleshort&0x8000 0x8000 \bcharacter device driver
  1183. >0 ubyte x
  1184. # upx compressed device driver has garbage instead of real in name field of header
  1185. >>40 search/7 UPX!
  1186. >>40 default x
  1187. # leading/trailing nulls, zeros or non ASCII characters in 8-byte name field at offset 10 are skipped
  1188. # 1 space char before device driver name to get phrase like "device driver PROTMAN$" "device driver HP-150II" "device driver PC$MOUSE"
  1189. >>>12 ubyte >0x23 \b
  1190. >>>>10 ubyte >0x20
  1191. >>>>>10 ubyte !0x2E
  1192. >>>>>>10 ubyte !0x2A \b%c
  1193. >>>>11 ubyte >0x20
  1194. >>>>>11 ubyte !0x2E \b%c
  1195. >>>>12 ubyte >0x20
  1196. >>>>>12 ubyte !0x39
  1197. >>>>>>12 ubyte !0x2E \b%c
  1198. >>>13 ubyte >0x20
  1199. >>>>13 ubyte !0x2E \b%c
  1200. >>>>14 ubyte >0x20
  1201. >>>>>14 ubyte !0x2E \b%c
  1202. >>>>15 ubyte >0x20
  1203. >>>>>15 ubyte !0x2E \b%c
  1204. >>>>16 ubyte >0x20
  1205. >>>>>16 ubyte !0x2E
  1206. >>>>>>16 ubyte <0xCB \b%c
  1207. >>>>17 ubyte >0x20
  1208. >>>>>17 ubyte !0x2E
  1209. >>>>>>17 ubyte <0x90 \b%c
  1210. # some character device drivers like ASPICD.SYS, btcdrom.sys and Cr_atapi.sys contain only spaces or points in name field
  1211. >>>12 ubyte <0x2F
  1212. # they have their real name at offset 22
  1213. # also block device drivers like DUMBDRV.SYS
  1214. >>>>22 string >\056 %-.6s
  1215. >4 uleshort&0x8000 0x0000
  1216. # 32 bit sector addressing ( > 32 MB) for block devices
  1217. >>4 uleshort&0x0002 0x0002 \b,32-bit sector-
  1218. # support by driver functions 13h, 17h, 18h
  1219. >4 uleshort&0x0040 0x0040 \b,IOCTL-
  1220. # open, close, removable media support by driver functions 0Dh, 0Eh, 0Fh
  1221. >4 uleshort&0x0800 0x0800 \b,close media-
  1222. # output until busy support by int 10h for character device driver
  1223. >4 uleshort&0x8000 0x8000
  1224. >>4 uleshort&0x2000 0x2000 \b,until busy-
  1225. # direct read/write support by driver functions 03h,0Ch
  1226. >4 uleshort&0x4000 0x4000 \b,control strings-
  1227. >4 uleshort&0x8000 0x8000
  1228. >>4 uleshort&0x6840 >0 \bsupport
  1229. >4 uleshort&0x8000 0x0000
  1230. >>4 uleshort&0x4842 >0 \bsupport
  1231. >0 ubyte x \b)
  1232. >0 ulelong !0xffffffff with pointer %#x
  1233. # DOS driver cmd640x.sys has 0x12 instead of 0xffffffff for pointer field to next device header
  1234. 0 ulequad 0x0513c00000000012
  1235. >0 use msdos-driver
  1236. # DOS drivers DC2975.SYS, DUMBDRV.SYS, ECHO.SYS has also none 0xffffffff for pointer field
  1237. 0 ulequad 0x32f28000ffff0016
  1238. >0 use msdos-driver
  1239. 0 ulequad 0x007f00000000ffff
  1240. >0 use msdos-driver
  1241. # https://www.uwe-sieber.de/files/cfg_echo.zip
  1242. 0 ulequad 0x001600000000ffff
  1243. >0 use msdos-driver
  1244. # DOS drivers LS120.SYS, MKELS120.SYS use reserved bits of attribute field
  1245. 0 ulequad 0x0bf708c2ffffffff
  1246. >0 use msdos-driver
  1247. 0 ulequad 0x07bd08c2ffffffff
  1248. >0 use msdos-driver
  1249. # 3Com EtherLink 3C501 CID\SERVER\IBMLS\IBM500D1\DLSNETDR.ZIP\ELNK.DOS
  1250. 0 ulequad 0x027ac0c0ffffffff
  1251. >0 use msdos-driver
  1252. # IBM Streamer CID\SERVER\IBMLS\IBM500D1\DLSNETDR.ZIP\IBMMPC.DOS
  1253. 0 ulequad 0x00228880ffffffff
  1254. >0 use msdos-driver
  1255. # updated by Joerg Jenderek
  1256. # GRR: line below too general as it catches also
  1257. # rt.lib DYADISKS.PIC and many more
  1258. # start with assembler instruction MOV
  1259. 0 ubyte 0x8c
  1260. # skip "AppleWorks word processor data" like ARTICLE.1 ./apple
  1261. >4 string !O====
  1262. # skip some unknown basic binaries like RocketRnger.SHR
  1263. >>5 string !MAIN
  1264. # skip "GPG symmetrically encrypted data" ./gnu
  1265. # skip "PGP symmetric key encrypted data" ./pgp
  1266. # openpgpdefs.h: fourth byte < 14 indicate cipher algorithm type
  1267. >>>4 ubyte >13
  1268. >>>>0 use msdos-com
  1269. # the remaining files should be DOS *.COM executables
  1270. # dosshell.COM 8cc0 2ea35f07 e85211 e88a11 b80058 cd
  1271. # hmload.COM 8cc8 8ec0 bbc02b 89dc 83c30f c1eb04 b4
  1272. # UNDELETE.COM 8cca 2e8916 6503 b430 cd21 8b 2e0200 8b
  1273. # BOOTFIX.COM 8cca 2e8916 9603 b430 cd21 8b 2e0200 8b
  1274. # RAWRITE3.COM 8cca 2e8916 d602 b430 cd21 8b 2e0200 8b
  1275. # SHARE.COM 8cca 2e8916 d602 b430 cd21 8b 2e0200 8b
  1276. # validchr.COM 8cca 2e8916 9603 b430 cd21 8b 2e028b1e
  1277. # devload.COM 8cca 8916ad01 b430 cd21 8b2e0200 892e
  1278. 0 name msdos-com
  1279. # URL: http://fileformats.archiveteam.org/wiki/DOS_executable_(.com)
  1280. >0 byte x DOS executable (
  1281. # DOS executable with JuMP 16-bit instruction
  1282. >0 byte =0xE9
  1283. # check for probably nil padding til offset 64 of Lotus driver name
  1284. >>56 quad =0
  1285. # check for "long" alphabetic Lotus driver name like:
  1286. # Diablo "COMPAQ Text Display" "IBM Monochrome Display" "Plantronics ColorPlus"
  1287. >>>24 regex =^[A-Z][A-Za-z\040]{5,21} \bLotus driver) %s
  1288. !:mime application/x-dosexec
  1289. # like: CPQ0TD.DRV IBM0MONO.DRV (Lotus 123 10a) SDIAB4.DRV SPL0CPLS.DRV (Lotus Symphony 2)
  1290. !:ext drv
  1291. # COM with nils like MODE.COM IBMDOS.COM (pcdos 3.31 ru Compaq) RSSTUB.COM (PC-DOS 2000 de) ACCESS.COM (Lotus Symphony 1)
  1292. >>>24 default x \bCOM)
  1293. !:mime application/x-dosexec
  1294. !:ext com
  1295. # DOS executable with JuMP 16-bit and without nil padding
  1296. >>56 quad !0
  1297. # https://wiki.syslinux.org/wiki/index.php?title=Doc/comboot
  1298. # TODO: HOWTO distinguish COMboot from pure DOS executables?
  1299. # look for unreliable Syslinux specific api call INTerrupt 22h for 16-bit COMBOOT program
  1300. >>>1 search/0xc088 \xcd\x22 \bCOM or COMBOOT 16-bit)
  1301. !:mime application/x-dosexec
  1302. # like: sbm.cbt command.com (Windows XP) UNI2ASCI.COM (FreeDOS 1.2)
  1303. !:ext com/cbt
  1304. >>>1 default x \bCOM)
  1305. !:mime application/x-dosexec
  1306. !:ext com
  1307. # DOS executable without JuMP 16-bit instruction
  1308. >0 byte !0xE9
  1309. # SCREATE.SYS https://en.wikipedia.org/wiki/Stac_Electronics
  1310. >>10 string =?STACVOL \bSCREATE.SYS)
  1311. !:mime application/x-dosexec
  1312. !:ext sys
  1313. # COM executable without JuMP 16-bit instruction and not SCREATE.SYS
  1314. >>10 string !?STACVOL \bCOM)
  1315. !:mime application/x-dosexec
  1316. !:ext com
  1317. >6 string SFX\ of\ LHarc \b, %s
  1318. >0x1FE leshort 0xAA55 \b, boot code
  1319. >85 string UPX \b, UPX compressed
  1320. >4 string \ $ARX \b, ARX self-extracting archive
  1321. >4 string \ $LHarc \b, LHarc self-extracting archive
  1322. >0x20e string SFX\ by\ LARC \b, LARC self-extracting archive
  1323. # like: E30ODI.COM MADGEODI.COM UNI2ASCI.COM RECOVER.COM (DOS 2) COMMAND.COM (DOS 2)
  1324. >1 search/0xc088 \xcd\x22 \b, maybe with interrupt 22h
  1325. >0 ubelong x \b, start instruction %#8.8x
  1326. # show more instructions but not in samples like: rem.com (DJGPP)
  1327. >4 ubelong x %8.8x
  1328. # JMP 8bit
  1329. 0 byte 0xeb
  1330. # byte 0xeb conflicts with magic leshort 0xn2eb of "SYMMETRY i386" handled by ./sequent
  1331. # allow forward jumps only
  1332. >1 byte >-1
  1333. # that offset must be accessible
  1334. # with hexadecimal values like: 0e 2e 50 8c 8d ba bc bd be e8 fb fc
  1335. >>(1.b+2) byte x
  1336. # if look like COM executable with x86 boot signature then this
  1337. # implies FAT volume with x86 real mode code already handled by ./filesystems
  1338. #
  1339. # No x86 boot signature implies often DOS executable
  1340. # check for unrealistic high number of FATs. Then it is an unusual disk image or often a DOS executable
  1341. # like: FIXBIOS.COM (50 bytes)
  1342. >>>16 ubyte >3
  1343. # https://www.drivedroid.io/
  1344. # skip MBR disk image drivedroid.img version 12 July 2013 by start message
  1345. >>>>2 string !DriveDroid
  1346. # ftp://old-dos.ru/OSCollect/OS/MS-DOS/Final Releases/
  1347. # skip unusual floppy image disk1.img of MS-DOS 1.25 (Corona Data Systems OEM)
  1348. # by check for characteristic message text near the beginning
  1349. >>>>>15 string !Non\040System\040disk
  1350. # "ftp://old-dos.ru/OSCollect/OS/BeOS/BeOS 4.0.rar"
  1351. # skip BeOS 4 bootfloppy.img done as "Linux kernel x86 boot executable" by ./linux
  1352. # by check for characteristic message text near the beginning
  1353. >>>>>>6 string !read\040error\015
  1354. # https://github.com/ventoy/Ventoy/releases/download/v1.0.78/ventoy-1.0.78-windows.zip
  1355. # skip ventoy 1.0.78 boot_hybrid.img
  1356. >>>>>>>24 string !\220\220\353I$\022\017
  1357. # "ftp://old-dos.ru/OSCollect/OS/MS-DOS/Final Releases/PC-DOS 1.0 (5.25).rar"
  1358. # skip unusual floppy image PCDOS100.IMG of DOS 1.0
  1359. # by check for characteristic message text near the beginning
  1360. >>>>>>>>9 string !7-May-81
  1361. # "ftp://old-dos.ru/OSCollect/OS/BeOS/BeOS 5.0 Personal (BA).rar"
  1362. # skip BeOS 5 floppy_1.44.00.ima done as "DOS/MBR boot sector" by ./filesystems
  1363. # by check for characteristic message near the beginning
  1364. >>>>>>>>>3 string !\370sdfS\270
  1365. # like: FIXBIOS.COM (50 bytes)
  1366. >>>>>>>>>>0 use msdos-com
  1367. # check for unrealistic low number of FATs. Then it is an unusual FAT disk image or often a DOS executable
  1368. # like: DEVICE.COM INSTALL.COM (GAG 4.10) WORD.COM (Word 1.15)
  1369. >>>16 ubyte =0
  1370. # if low FATs with x86 boot signature it can be unusual disk image like: boot.img (Ventoy 1.0.27) geodspms.img (Syslinux)
  1371. >>>>0x1FE leshort =0xAA55
  1372. >>>>0x1FE default x
  1373. # https://thestarman.pcministry.com/tool/hxd/dimtut.htm
  1374. # skip unusual floppy image TK-DOS11.img IBMDOS11.img of IBM DOS 1.10
  1375. # by check for characteristic bootloader names near end of boot sector
  1376. >>>>>395 string !ibmbio\040\040com
  1377. >>>>>>0 use msdos-com
  1378. # 8-bit jump with valid number of FAT implies FAT volume already handled by ./filesystems
  1379. # like: balder.img
  1380. >>>16 default x
  1381. # skip disk images with boot signature at end of 1st sector
  1382. # like: TDSK-64b.img
  1383. >>>>(11.s-2) uleshort !0xAA55
  1384. # skip unusual floppy image without boot signature like 360k-256.img (mtools 4.0.18)
  1385. # by check for characteristic file system type text for FAT (12 bit or 16 bit)
  1386. >>>>>54 string !FAT
  1387. # "ftp://old-dos.ru/OSCollect/OS/MS-DOS/Final Releases/Microsoft MS-DOS 3.31 (Compaq OEM) (3.5).rar"
  1388. # skip unusual floppy image Disk4.img without boot signature and file system type text
  1389. # by check for characteristic OEM-ID text
  1390. >>>>>>3 string !COMPAQ\040\040
  1391. # no such DOS COM executables found
  1392. >>>>>>>0 use msdos-com
  1393. # JMP 16bit
  1394. 0 byte 0xe9
  1395. # display DOS executable (COM or COMBOOT 16-bit strength=40=40-0) after ESP-IDF application image (strength=40=40+0) handled by ./firmware
  1396. #!:strength -0
  1397. # 16-bit offset; for DEBUGGING!; can be negative like: USBDRIVE.COM
  1398. # 2h (CPQ0TD.DRV) 4FEh (NDN.COM) 581h (DRMOUSE.COM) 1FDh (GAG.COM) BE07h (USBDRIVE.COM)
  1399. #>1 uleshort x \b, OFFSET=%#4.4x
  1400. #>1 leshort x \b, OFFSET %d
  1401. # forward jumps
  1402. >1 leshort >-1
  1403. # that offset must be accessible
  1404. # with hexadecimal values like: 06 1e 0e 2e 60 8c 8d b4 ba be e8 fc
  1405. >>(1.s+3) byte x
  1406. # check for unrealistic high number of FATs. Then it is not a disk image and it is a DOS executable
  1407. # like: CALLVER.COM CPUCACHE.COM K437_EUR.COM SHSUCDX.COM UMBFILL.COM (183 bytes)
  1408. >>>16 ubyte >3
  1409. >>>>0 use msdos-com
  1410. # check for unrealistic low number of FATs. Then it is not a disk image and it is a DOS executable
  1411. # like: GAG.COM DRMOUSE.COM NDN.COM CPQ0TD.DRV
  1412. # or ESP-IDF application image like: WLED_0.14.0_ESP32-C3.bin opendtu-generic_esp32.bin
  1413. >>>16 ubyte =0
  1414. # skip ESP-IDF application image handled by ./firmware with ESP_APP_DESC_MAGIC_WORD
  1415. >>>>32 ulelong !0xABCD5432
  1416. >>>>>0 use msdos-com
  1417. # maybe disc image with valid number of FATs or DOS executable
  1418. # like: IPXODI.COM PERUSE.COM TASKID.COM
  1419. >>>16 default x
  1420. # invalid low media descriptor. Then it is not a disk image and it is a DOS executable
  1421. >>>>21 ubyte <0xE5
  1422. >>>>>0 use msdos-com
  1423. # valid media descriptor. Then it is maybe disk image or DOS executable
  1424. >>>>21 ubyte >0xE4
  1425. # invalid sectorsize not a power of 2 from 32-32768. Then it is not a disk image and it must be DOS executable
  1426. # like: LEARN.COM (Word 1.15)
  1427. >>>>>11 uleshort&0x001f !0
  1428. >>>>>>0 use msdos-com
  1429. # negative offset, must not lead into PSP
  1430. # like: BASICA.COM (PC dos 3.20) FORMAT.COM SMC8100.COM WORD.COM (word4)
  1431. # HIDSUPT1.COM USBDRIVE.COM USBSUPT1.COM USBUHCI.COM (FreeDOS USBDOS)
  1432. >1 leshort <-259
  1433. # that offset must be accessible
  1434. # add 10000h to jump at end of 64 KiB segment, add 1 for jump instruction and 2 for 16-bit offset
  1435. >>(1,s+65539) byte x
  1436. # after jump next instruction for DEBUGGING!
  1437. #>>>&-1 ubelong x \b, NEXT instruction %#8.8x
  1438. >>>0 use msdos-com
  1439. # updated by Joerg Jenderek at Oct 2008,2015,2022
  1440. # following line is too general
  1441. 0 ubyte 0xb8
  1442. # skip 2 linux kernels like memtest.bin with "\xb8\xc0\x07\x8e" in ./linux
  1443. >0 string !\xb8\xc0\x07\x8e
  1444. # modified by Joerg Jenderek
  1445. # syslinux COM32 or COM32R executable
  1446. >>1 lelong&0xFFFFFFFe 0x21CD4CFe COM executable (32-bit COMBOOT
  1447. # https://www.syslinux.org/wiki/index.php/Comboot_API
  1448. # Since version 5.00 c32 modules switched from the COM32 object format to ELF
  1449. !:mime application/x-c32-comboot-syslinux-exec
  1450. !:ext c32
  1451. # https://syslinux.zytor.com/comboot.php
  1452. # older syslinux version ( <4 )
  1453. # (32-bit COMBOOT) programs *.C32 contain 32-bit code and run in flat-memory 32-bit protected mode
  1454. # start with assembler instructions mov eax,21cd4cffh
  1455. >>>1 lelong 0x21CD4CFf \b)
  1456. # syslinux:doc/comboot.txt
  1457. # A COM32R program must start with the byte sequence B8 FE 4C CD 21 (mov
  1458. # eax,21cd4cfeh) as a magic number.
  1459. # syslinux version (4.x)
  1460. # "COM executable (COM32R)" or "Syslinux COM32 module" by TrID
  1461. >>>1 lelong 0x21CD4CFe \b, relocatable)
  1462. >>1 default x
  1463. # look for interrupt instruction like in rem.com (DJGPP) LOADER.COM (DR-DOS 7.x)
  1464. >>>3 search/118 \xCD
  1465. # FOR DEBUGGING; possible hexadecimal interrupt number like: 10~BANNER.COM 13~bcdw_cl.com 15~poweroff.com (Syslinux)
  1466. # 1A~BERNDPCI.COM 20~SETENHKB.COM 21~mostly 22~gfxboot.com (Syslinux) 2F~SHUTDOWN.COM (GEMSYS)
  1467. #>>>>&0 ubyte x \b, INTERUPT %#x
  1468. # few examples with interrupt 0x13 instruction
  1469. >>>>&0 ubyte =0x13
  1470. # FOR DEBUGGING!
  1471. #>>>>>3 ubequad x \b, 2nd INSTRUCTION %#16.16llx
  1472. # skip Gpt.com Mbr.com (edk2-UDK2018 bootsector) described as "DOS/MBR boot sector" by ./filesystems
  1473. # by check for assembler instructions: mov es,ax ; mov ax,07c0h ; mov ds,ax
  1474. >>>>>3 ubequad !0x8ec0b8c0078ed88d
  1475. # few COM executables with interrupt 0x13 instruction like: Bootable CD Wizard executables bcdw_cl.com fdemuoff.com
  1476. # http://bootcd.narod.ru/bcdw150z_en.zip
  1477. >>>>>>0 use msdos-com
  1478. # few examples with interrupt 0x16 instruction like flashimg.img
  1479. >>>>&0 ubyte =0x16
  1480. # skip Syslinux 3.71 flashimg.img done as "DOS/MBR boot sector" by ./filesystems
  1481. # by check for assembler instructions: cmp ax 0xE4E4 (magic); jnz
  1482. >>>>>8 ubelong !0x3DE4E475
  1483. # no DOS executable with interrupt 0x16 found
  1484. >>>>>>0 use msdos-com
  1485. # most examples with interrupt instruction unequal 0x13 and 0x16
  1486. >>>>&0 default x
  1487. #>>>>>&-1 ubyte x \b, INTERUPT %#x
  1488. # like: LOADER.COM SETENHKB.COM banner.com copybs.com gif2raw.com poweroff.com rem.com
  1489. >>>>>0 use msdos-com
  1490. # few COM executables without interrupt instruction like RESTART.COM (DOS 7.10) REBOOT.COM
  1491. # or some EUC-KR text files or one Ulead Imaginfo thumbnail
  1492. >>>3 default x
  1493. # FOR DEBUGGING; 2nd instruction like 0x50 (RESTART.COM) 0x8e (REBOOT.COM)
  1494. # or random like: 0x0 (IMAGINFO.PE3 sky_snow) 0xb1 (euckr_.txt)
  1495. #>>>>3 ubyte x \b, 2nd INSTRUCTION %#x
  1496. # skip 1 Ulead Imaginfo thumbnail (IMAGINFO.PE3 sky_snow)
  1497. # inside SAMPLES/TEXTURES/SKY_SNOW
  1498. # from https://archive.org/download/PI3CANON/PI3CANON.iso
  1499. >>>>3 ubyte !0x0
  1500. # skip some EUC-KR text files like: euckr_falsepositive.txt
  1501. # https://bugs.astron.com/view.php?id=186
  1502. >>>>>3 ubyte !0xb1
  1503. # like: RESTART.COM (DOS 7.10) REBOOT.COM
  1504. >>>>>>0 use msdos-com
  1505. # URL: https://en.wikipedia.org/wiki/UPX
  1506. # Reference: https://github.com/upx/upx/archive/v3.96.zip/upx-3.96/
  1507. # src/stub/src/i086-dos16.com.S
  1508. # Update: Joerg Jenderek
  1509. # assembler instructions: cmp sp, offset sp_limit
  1510. 0 string/b \x81\xfc
  1511. #>2 uleshort x \b, sp_limit=%#x
  1512. # assembler instructions: jump above +2; int 0x20; mov cx, offset bytes_to_copy
  1513. >4 string \x77\x02\xcd\x20\xb9
  1514. #>9 uleshort x \b, [bytes_to_copy]=%#x
  1515. # at different offsets assembler instructions: push di; jump decomp_start_n2b
  1516. >0x1e search/3 \x57\xe9
  1517. #>>&0 uleshort x \b, decomp_start_n2b=%#x
  1518. # src/stub/src/include/header.S; UPX_MAGIC_LE32
  1519. >>&2 string UPX! FREE-DOS executable (COM), UPX
  1520. !:mime application/x-dosexec
  1521. # UPX compressed *.CPI; See ./fonts
  1522. >>>&21 string =FONT compressed DOS code page font
  1523. !:ext cpx
  1524. >>>&21 string !FONT compressed
  1525. !:ext com
  1526. # compressed size?
  1527. #>>>&14 uleshort+152 x \b, %u bytes
  1528. # uncompressed len
  1529. >>>&12 uleshort x \b, uncompressed %u bytes
  1530. 252 string Must\ have\ DOS\ version DR-DOS executable (COM)
  1531. !:mime application/x-dosexec
  1532. !:ext com
  1533. # GRR search is not working
  1534. #2 search/28 \xcd\x21 COM executable for MS-DOS
  1535. #WHICHFAT.cOM
  1536. 2 string \xcd\x21 COM executable for DOS
  1537. !:mime application/x-dosexec
  1538. !:ext com
  1539. #DELTREE.cOM DELTREE2.cOM
  1540. 4 string \xcd\x21 COM executable for DOS
  1541. !:mime application/x-dosexec
  1542. !:ext com
  1543. #IFMEMDSK.cOM ASSIGN.cOM COMP.cOM
  1544. 5 string \xcd\x21 COM executable for DOS
  1545. !:mime application/x-dosexec
  1546. !:ext com
  1547. #DELTMP.COm HASFAT32.cOM
  1548. 7 string \xcd\x21
  1549. >0 byte !0xb8 COM executable for DOS
  1550. !:mime application/x-dosexec
  1551. !:ext com
  1552. #COMP.cOM MORE.COm
  1553. 10 string \xcd\x21
  1554. >5 string !\xcd\x21 COM executable for DOS
  1555. !:mime application/x-dosexec
  1556. !:ext com
  1557. #comecho.com
  1558. 13 string \xcd\x21 COM executable for DOS
  1559. !:mime application/x-dosexec
  1560. !:ext com
  1561. #HELP.COm EDIT.coM
  1562. 18 string \xcd\x21
  1563. # not printable before it?
  1564. >17 byte >32
  1565. >>17 byte <126
  1566. >>17 default x COM executable for MS-DOS
  1567. !:mime application/x-dosexec
  1568. !:ext com
  1569. #NWRPLTRM.COm
  1570. 23 string \xcd\x21 COM executable for MS-DOS
  1571. !:mime application/x-dosexec
  1572. !:ext com
  1573. #LOADFIX.cOm LOADFIX.cOm
  1574. 30 string \xcd\x21 COM executable for MS-DOS
  1575. !:mime application/x-dosexec
  1576. !:ext com
  1577. #syslinux.com 3.11
  1578. 70 string \xcd\x21 COM executable for DOS
  1579. !:mime application/x-dosexec
  1580. !:ext com
  1581. # many compressed/converted COMs start with a copy loop instead of a jump
  1582. 0x6 search/0xa \xfc\x57\xf3\xa5\xc3 COM executable for MS-DOS
  1583. !:mime application/x-dosexec
  1584. !:ext com
  1585. 0x6 search/0xa \xfc\x57\xf3\xa4\xc3 COM executable for DOS
  1586. !:mime application/x-dosexec
  1587. !:ext com
  1588. >0x18 search/0x10 \x50\xa4\xff\xd5\x73 \b, aPack compressed
  1589. 0x3c string W\ Collis\0\0 COM executable for MS-DOS, Compack compressed
  1590. !:mime application/x-dosexec
  1591. !:ext com
  1592. # FIXME: missing diet .com compression
  1593. # miscellaneous formats
  1594. 0 string/b LZ MS-DOS executable (built-in)
  1595. #0 byte 0xf0 MS-DOS program library data
  1596. #
  1597. # AAF files:
  1598. # <stuartc@rd.bbc.co.uk> Stuart Cunningham
  1599. 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
  1600. >30 byte 9 (512B sectors)
  1601. >30 byte 12 (4kB sectors)
  1602. 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
  1603. >30 byte 9 (512B sectors)
  1604. >30 byte 12 (4kB sectors)
  1605. # Popular applications
  1606. #
  1607. # Update: Joerg Jenderek
  1608. # URL: http://fileformats.archiveteam.org/wiki/DOC
  1609. # Reference: https://web.archive.org/web/20170206041048/
  1610. # http://www.msxnet.org/word2rtf/formats/ffh-dosword5
  1611. # wIdent+dty
  1612. 0 belong 0x31be0000
  1613. # skip droid skeleton like x-fmt-274-signature-id-488.doc
  1614. >128 ubyte >0 Microsoft
  1615. >>96 uleshort =0 Word
  1616. !:mime application/msword
  1617. !:apple MSWDWDBN
  1618. # DCX is used in the Unix version.
  1619. !:ext doc/dcx
  1620. >>>0x6E ulequad =0 1.0-4.0
  1621. >>>0x6E ulequad !0 5.0-6.0
  1622. >>>0x6E ulequad x (DOS) Document
  1623. # https://web.archive.org/web/20130831064118/http://msxnet.org/word2rtf/formats/write.txt
  1624. >>96 uleshort !0 Write 3.0 (Windows) Document
  1625. !:mime application/x-mswrite
  1626. !:apple MSWDWDBN
  1627. # sometimes also doc like in splitter.doc srchtest.doc
  1628. !:ext wri/doc
  1629. # wTool must be 0125400 octal
  1630. #>>4 uleshort !0xAB00 \b, wTool %o
  1631. # reserved; must be zero
  1632. #>>6 ulelong !0 \b, reserved %u
  1633. # block pointer to the block containing optional file manager information
  1634. #>>0x1C uleshort x \b, at %#x info block
  1635. # jump to File manager information block
  1636. >>(0x1C.s*128) uleshort x
  1637. # test for valid information start; maybe also 0012h
  1638. >>>&-2 uleshort =0x0014
  1639. # Document ASCIIZ name
  1640. >>>>&0x12 string x %s
  1641. # author name
  1642. >>>>>&1 string x \b, author %s
  1643. # reviser name
  1644. >>>>>>&1 string x \b, reviser %s
  1645. # keywords
  1646. >>>>>>>&1 string x \b, keywords %s
  1647. # comment
  1648. >>>>>>>>&1 string x \b, comment %s
  1649. # version number
  1650. >>>>>>>>>&1 string x \b, version %s
  1651. # date of last change MM/DD/YY
  1652. >>>>>>>>>>&1 string x \b, %-.8s
  1653. # creation date MM/DD/YY
  1654. >>>>>>>>>>&9 string x created %-.8s
  1655. # file name of print format like NORMAL.STY
  1656. >>0x1E string >0 \b, formatted by %-.66s
  1657. # count of pages in whole file for write variant; maybe some times wrong
  1658. >>96 uleshort >0 \b, %u pages
  1659. # name of the printer driver like HPLASMS
  1660. >>0x62 string >0 \b, %-.8s printer
  1661. # number of blocks used in the file; seems to be 0 for Word 4.0 and Write 3.0
  1662. >>0x6A uleshort >0 \b, %u blocks
  1663. # bit field for corrected text areas
  1664. #>>0x6C uleshort x \b, %#x bit field
  1665. # text of document; some times start with 4 non printable characters like CR LF
  1666. >>128 ubyte x \b,
  1667. >>>128 ubyte >0x1F
  1668. >>>>128 string x %s
  1669. >>>128 ubyte <0x20
  1670. >>>>129 ubyte >0x1F
  1671. >>>>>129 string x %s
  1672. >>>>129 ubyte <0x20
  1673. >>>>>130 ubyte >0x1F
  1674. >>>>>>130 string x %s
  1675. >>>>>130 ubyte <0x20
  1676. >>>>>>131 ubyte >0x1F
  1677. >>>>>>>131 string x %s
  1678. >>>>>>131 ubyte <0x20
  1679. >>>>>>>132 ubyte >0x1F
  1680. >>>>>>>>132 string x %s
  1681. >>>>>>>132 ubyte <0x20
  1682. >>>>>>>>133 ubyte >0x1F
  1683. >>>>>>>>>133 string x %s
  1684. #
  1685. 0 string/b PO^Q` Microsoft Word 6.0 Document
  1686. !:mime application/msword
  1687. #
  1688. 4 long 0
  1689. >0 belong 0xfe320000 Microsoft Word for Macintosh 1.0
  1690. !:mime application/msword
  1691. !:ext mcw
  1692. >0 belong 0xfe340000 Microsoft Word for Macintosh 3.0
  1693. !:mime application/msword
  1694. !:ext mcw
  1695. >0 belong 0xfe37001c Microsoft Word for Macintosh 4.0
  1696. !:mime application/msword
  1697. !:ext mcw
  1698. >0 belong 0xfe370023 Microsoft Word for Macintosh 5.0
  1699. !:mime application/msword
  1700. !:ext mcw
  1701. 0 string/b \333\245-\0\0\0 Microsoft Word 2.0 Document
  1702. !:mime application/msword
  1703. !:ext doc
  1704. # Note: seems already recognized as "OLE 2 Compound Document" in ./ole2compounddocs
  1705. #512 string/b \354\245\301 Microsoft Word Document
  1706. #!:mime application/msword
  1707. #
  1708. 0 string/b \xDB\xA5\x2D\x00 Microsoft WinWord 2.0 Document
  1709. !:mime application/msword
  1710. #
  1711. 0 string/b \x09\x04\x06\x00\x00\x00\x10\x00 Microsoft Excel Worksheet
  1712. !:mime application/vnd.ms-excel
  1713. # https://www.macdisk.com/macsigen.php
  1714. !:apple XCELXLS4
  1715. !:ext xls
  1716. #
  1717. # Update: Joerg Jenderek
  1718. # URL: https://en.wikipedia.org/wiki/Lotus_1-2-3
  1719. # Reference: http://www.aboutvb.de/bas/formate/pdf/wk3.pdf
  1720. # Note: newer Lotus versions >2 use longer BOF record
  1721. # record type (BeginningOfFile=0000h) + length (001Ah)
  1722. 0 belong 0x00001a00
  1723. # reserved should be 0h but 8c0dh for TUTMAC.WK3, 5h for SAMPADNS.WK3, 1h for a_readme.wk3, 1eh for K&G86.WK3
  1724. #>18 uleshort&0x73E0 0
  1725. # Lotus Multi Byte Character Set (LMBCS=1-31)
  1726. >20 ubyte >0
  1727. >>20 ubyte <32 Lotus 1-2-3
  1728. #!:mime application/x-123
  1729. !:mime application/vnd.lotus-1-2-3
  1730. !:apple ????L123
  1731. # (version 5.26) labeled the entry as "Lotus 1-2-3 wk3 document data"
  1732. >>>4 uleshort 0x1000 WorKsheet, version 3
  1733. !:ext wk3
  1734. # (version 5.26) labeled the entry as "Lotus 1-2-3 wk4 document data"
  1735. >>>4 uleshort 0x1002 WorKsheet, version 4
  1736. # also worksheet template 4 (.wt4)
  1737. !:ext wk4/wt4
  1738. # no example or documentation for wk5
  1739. #>>4 uleshort 0x???? WorKsheet, version 4
  1740. #!:ext wk5
  1741. # only MacrotoScript.123 example
  1742. >>>4 uleshort 0x1003 WorKsheet, version 97
  1743. # also worksheet template Smartmaster (.12M)?
  1744. !:ext 123
  1745. # only Set_Y2K.123 example
  1746. >>>4 uleshort 0x1005 WorKsheet, version 9.8 Millennium
  1747. !:ext 123
  1748. # no example for this version
  1749. >>>4 uleshort 0x8001 FoRMatting data
  1750. !:ext frm
  1751. # (version 5.26) labeled the entry as "Lotus 1-2-3 fm3 or fmb document data"
  1752. # TrID labeles the entry as "Formatting Data for Lotus 1-2-3 worksheet"
  1753. >>>4 uleshort 0x8007 ForMatting data, version 3
  1754. !:ext fm3
  1755. >>>4 default x unknown
  1756. # file revision sub code 0004h for worksheets
  1757. >>>>6 uleshort =0x0004 worksheet
  1758. !:ext wXX
  1759. >>>>6 uleshort !0x0004 formatting data
  1760. !:ext fXX
  1761. # main revision number
  1762. >>>>4 uleshort x \b, revision %#x
  1763. >>>6 uleshort =0x0004 \b, cell range
  1764. # active cellcoord range (start row, page,column ; end row, page, column)
  1765. # start values normally 0~1st sheet A1
  1766. >>>>8 ulelong !0
  1767. >>>>>10 ubyte >0 \b%d*
  1768. >>>>>8 uleshort x \b%d,
  1769. >>>>>11 ubyte x \b%d-
  1770. # end page mostly 0
  1771. >>>>14 ubyte >0 \b%d*
  1772. # end raw, column normally not 0
  1773. >>>>12 uleshort x \b%d,
  1774. >>>>15 ubyte x \b%d
  1775. # Lotus Multi Byte Character Set (1~cp850,2~cp851,...,16~japan,...,31~??)
  1776. >>>>20 ubyte >1 \b, character set %#x
  1777. # flags
  1778. >>>>21 ubyte x \b, flags %#x
  1779. >>>6 uleshort !0x0004
  1780. # record type (FONTNAME=00AEh)
  1781. >>>>30 search/29 \0\xAE
  1782. # variable length m (2) + entries (1) + ?? (1) + LCMBS string (n)
  1783. >>>>>&4 string >\0 \b, 1st font "%s"
  1784. #
  1785. # Update: Joerg Jenderek
  1786. # URL: http://fileformats.archiveteam.org/wiki/Lotus_1-2-3
  1787. # Reference: http://www.schnarff.com/file-formats/lotus-1-2-3/WSFF2.TXT
  1788. # Note: Used by both old Lotus 1-2-3 and Lotus Symphony (DOS) til version 2.x
  1789. # record type (BeginningOfFile=0000h) + length (0002h)
  1790. 0 belong 0x00000200
  1791. # GRR: line above is too general as it catches also MS Windows CURsor
  1792. # to display MS Windows cursor (strength=70) before Lotus 1-2-3 (strength=70-1)
  1793. !:strength -1
  1794. # skip Windows cursors with image height <256 and keep Lotus with low opcode 0001-0083h
  1795. >7 ubyte 0
  1796. # skip Windows cursors with image width 256 and keep Lotus with positive opcode
  1797. >>6 ubyte >0 Lotus
  1798. # !:mime application/x-123
  1799. !:mime application/vnd.lotus-1-2-3
  1800. !:apple ????L123
  1801. # revision number (0404h = 123 1A, 0405h = Lotus Symphony , 0406h = 123 2.x wk1 , 8006h = fmt , ...)
  1802. # undocumented; (version 5.26) labeled the configurations as "Lotus 1-2-3"
  1803. >>>4 uleshort 0x0007 1-2-3 CoNFiguration, version 2.x (PGRAPH.CNF)
  1804. !:ext cnf
  1805. >>>4 uleshort 0x0C05 1-2-3 CoNFiguration, version 2.4J
  1806. !:ext cnf
  1807. >>>4 uleshort 0x0801 1-2-3 CoNFiguration, version 1-2.1
  1808. !:ext cnf
  1809. >>>4 uleshort 0x0802 Symphony CoNFiguration
  1810. !:ext cnf
  1811. >>>4 uleshort 0x0804 1-2-3 CoNFiguration, version 2.2
  1812. !:ext cnf
  1813. >>>4 uleshort 0x080A 1-2-3 CoNFiguration, version 2.3-2.4
  1814. !:ext cnf
  1815. >>>4 uleshort 0x1402 1-2-3 CoNFiguration, version 3.x
  1816. !:ext cnf
  1817. >>>4 uleshort 0x1450 1-2-3 CoNFiguration, version 4.x
  1818. !:ext cnf
  1819. # (version 5.26) labeled the entry as "Lotus 123"
  1820. # TrID labeles the entry as "Lotus 123 Worksheet (generic)"
  1821. >>>4 uleshort 0x0404 1-2-3 WorKSheet, version 1
  1822. # extension "wks" also for Microsoft Works document
  1823. !:ext wks
  1824. # (version 5.26) labeled the entry as "Lotus 123"
  1825. # TrID labeles the entry as "Lotus 123 Worksheet (generic)"
  1826. >>>4 uleshort 0x0405 Symphony WoRksheet, version 1.0
  1827. !:ext wrk/wr1
  1828. # (version 5.26) labeled the entry as "Lotus 1-2-3 wk1 document data"
  1829. # TrID labeles the entry as "Lotus 123 Worksheet (V2)"
  1830. >>>4 uleshort 0x0406 1-2-3/Symphony worksheet, version 2
  1831. # Symphony (.wr1)
  1832. !:ext wk1/wr1
  1833. # no example for this japan version
  1834. >>>4 uleshort 0x0600 1-2-3 WorKsheet, version 1.xJ
  1835. !:ext wj1
  1836. # no example or documentation for wk2
  1837. #>>>4 uleshort 0x???? 1-2-3 WorKsheet, version 2
  1838. #!:ext wk2
  1839. # undocumented japan version
  1840. >>>4 uleshort 0x0602 1-2-3 worksheet, version 2.4J
  1841. !:ext wj3
  1842. # (version 5.26) labeled the entry as "Lotus 1-2-3 fmt document data"
  1843. >>>4 uleshort 0x8006 1-2-3 ForMaTting data, version 2.x
  1844. # japan version 2.4J (fj3)
  1845. !:ext fmt/fj3
  1846. # no example for this version
  1847. >>>4 uleshort 0x8007 1-2-3 FoRMatting data, version 2.0
  1848. !:ext frm
  1849. # (version 5.26) labeled the entry as "Lotus 1-2-3"
  1850. >>>4 default x unknown worksheet or configuration
  1851. !:ext cnf
  1852. >>>>4 uleshort x \b, revision %#x
  1853. # 2nd record for most worksheets describes cells range
  1854. >>>6 use lotus-cells
  1855. # 3rd record for most japan worksheets describes cells range
  1856. >>>(8.s+10) use lotus-cells
  1857. # check and then display Lotus worksheet cells range
  1858. 0 name lotus-cells
  1859. # look for type (RANGE=0006h) + length (0008h) at record begin
  1860. >0 ubelong 0x06000800 \b, cell range
  1861. # cell range (start column, row, end column, row) start values normally 0,0~A1 cell
  1862. >>4 ulong !0
  1863. >>>4 uleshort x \b%d,
  1864. >>>6 uleshort x \b%d-
  1865. # end of cell range
  1866. >>8 uleshort x \b%d,
  1867. >>10 uleshort x \b%d
  1868. # EndOfLotus123
  1869. 0 string/b WordPro\0 Lotus WordPro
  1870. !:mime application/vnd.lotus-wordpro
  1871. 0 string/b WordPro\r\373 Lotus WordPro
  1872. !:mime application/vnd.lotus-wordpro
  1873. # Summary: Script used by InstallScield to uninstall applications
  1874. # Extension: .isu
  1875. # Submitted by: unknown
  1876. # Modified by (1): Abel Cheung <abelcheung@gmail.com> (replace useless entry)
  1877. 0 string \x71\xa8\x00\x00\x01\x02
  1878. >12 string Stirling\ Technologies, InstallShield Uninstall Script
  1879. # Winamp .avs
  1880. #0 string Nullsoft\ AVS\ Preset\ \060\056\061\032 A plug in for Winamp ms-windows Freeware media player
  1881. 0 string/b Nullsoft\ AVS\ Preset\ Winamp plug in
  1882. # Windows Metafile .WMF
  1883. # URL: http://fileformats.archiveteam.org/wiki/Windows_Metafile
  1884. # http://en.wikipedia.org/wiki/Windows_Metafile
  1885. # Reference: https://winprotocoldoc.blob.core.windows.net/productionwindowsarchives/MS-WMF/%5bMS-WMF%5d.pdf
  1886. # http://mark0.net/download/triddefs_xml.7z/defs/w/wmf.trid.xml
  1887. # Note: called "Windows Metafile" by TrID and
  1888. # verified by ImageMagick `identify -verbose *.wmf` as WMF (Windows Meta File)
  1889. # META_PLACEABLE Record (Aldus Placeable Metafile signature)
  1890. 0 string/b \327\315\306\232
  1891. # Note: called "Windows Metafile Image with Placeable File Header" by DROID via PUID x-fmt/119
  1892. # and verified by XnView `nconvert -info abydos.wmf SPA_FLAG.wmf hardcopy-windows-meta.wmf` as "Windows Placeable metafile"
  1893. # skip failed libreoffice-7.3.2.2 ofz35149-1.wmf with invalid version 2020h and exttextout-2.wmf with invalid version 3a02h
  1894. # and x-fmt-119-signature-id-609.wmf without version instead of 0100h=METAVERSION100 or 0300h=METAVERSION300
  1895. >26 uleshort&0xFDff =0x0100 Windows metafile
  1896. # HWmf; resource handle to the metafile; When the metafile is on disk, this field MUST contain 0
  1897. # seems to be always true but in failed samples 2020h ofz35149-1.wmf 56f8h exttextout-2.wmf
  1898. >>4 uleshort !0 \b, resource handle %#x
  1899. # BoundingBox; the rectangle in the playback context measured in logical units for displaying
  1900. # sometimes useful like: hardcopy-windows-meta.wmf (0,0 / 1280,1024)
  1901. # but garbage in x-fmt-119-signature-id-609.wmf (-21589,-21589 / -21589,-21589)
  1902. #>>6 ubequad x \b, bounding box %#16.16llx
  1903. # Left; x-coordinate of the upper-left corner of the rectangle
  1904. >>6 leshort x \b, bounding box (%d
  1905. # Top; y-coordinate upper-left corner
  1906. >>8 leshort x \b,%d
  1907. # Right; x-coordinate lower-right corner
  1908. >>10 leshort x / %d
  1909. # Bottom; y-coordinate lower-right corner
  1910. >>12 leshort x \b,%d)
  1911. # Inch; number of logical units per inch like: 72 96 575 576 1000 1200 1439 1440 2540
  1912. >>14 uleshort x \b, dpi %u
  1913. # Reserved; field is not used and MUST be set to 0; but ababababh in x-fmt-119-signature-id-609.wmf
  1914. >>16 ulelong !0 \b, reserved %#x
  1915. # Checksum; checksum for the previous 10 words
  1916. >>20 uleshort x \b, checksum %#x
  1917. # META_HEADER Record after META_PLACEABLE Record
  1918. >>22 use wmf-head
  1919. # GRR: no example for type 2 (DISKMETAFILE) variant found under few thousands WMF
  1920. 0 string/b \002\000\011\000 Windows metafile
  1921. >0 use wmf-head
  1922. # Reference: http://mark0.net/download/triddefs_xml.7z/defs/w/wmf-16.trid.xml
  1923. # Note: called "Windows Metafile (old Win 3.x format)" by TrID and
  1924. # "Windows Metafile Image without Placeable File Header" by DROID via PUID x-fmt/119
  1925. # verified by XnView `nconvert -info *.wmf` as Windows metafile
  1926. # variant with type=1=MEMORYMETAFILE and valid HeaderSize 9
  1927. 0 string/b \001\000\011\000
  1928. # skip DROID x-fmt-119-signature-id-1228.wmf by looking for content after header (18 bytes=2*011)
  1929. >18 ulelong >0 Windows metafile
  1930. # GRR: in version 5.44 unequal and not endian variant not working!
  1931. #>18 ulelong !0 THIS_SHOULD_NOT_HAPPEN
  1932. #>18 long !0 THIS_SHOULD_NOT_HAPPEN
  1933. >>0 use wmf-head
  1934. # display information of Windows metafile header (type, size, objects)
  1935. 0 name wmf-head
  1936. # MetafileType: 0001h=MEMORYMETAFILE~Metafile is stored in memory 0002h=DISKMETAFILE~Metafile is stored on disk
  1937. >0 uleshort !0x0001 \b, type %#x
  1938. # HeaderSize; the number of WORDs in header record; seems to be always 9 (18 bytes)
  1939. >2 uleshort*2 !18 \b, header size %u
  1940. # MetafileVersion: 0100h=METAVERSION100~DIBs (device-independent bitmaps) not supported 0300h=METAVERSION300~DIBs are supported
  1941. # but in failed samples 2020h ofz35149-1.wmf 3a02h exttextout-2.wmf
  1942. >4 uleshort =0x0100 \b, DIBs not supported
  1943. >4 uleshort =0x0300
  1944. #>4 uleshort =0x0300 \b, DIBs supported
  1945. # this should not happen!
  1946. >4 default x \b, version
  1947. >>4 uleshort x %#x
  1948. # Size; the number of WORDs in the entire metafile
  1949. >6 ulelong x \b, size %u words
  1950. #>6 ulelong*2 x \b, size %u bytes
  1951. !:mime image/wmf
  1952. !:ext wmf
  1953. # 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
  1954. >10 uleshort x \b, %u objects
  1955. # MaxRecord: the size of the largest record in the metafile in WORDs like: 78h b0h 1f4h 310h 63fh 1e0022h 3fcc21h
  1956. >12 ulelong x \b, largest record size %#x
  1957. # 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
  1958. >16 uleshort !0 \b, %u members
  1959. #tz3 files whatever that is (MS Works files)
  1960. 0 string/b \003\001\001\004\070\001\000\000 tz3 ms-works file
  1961. 0 string/b \003\002\001\004\070\001\000\000 tz3 ms-works file
  1962. 0 string/b \003\003\001\004\070\001\000\000 tz3 ms-works file
  1963. # PGP sig files .sig
  1964. #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
  1965. 0 string \211\000\077\003\005\000\063\237\127\065\027\266\151\064\005\045\101\233\021\002 PGP sig
  1966. 0 string \211\000\077\003\005\000\063\237\127\066\027\266\151\064\005\045\101\233\021\002 PGP sig
  1967. 0 string \211\000\077\003\005\000\063\237\127\067\027\266\151\064\005\045\101\233\021\002 PGP sig
  1968. 0 string \211\000\077\003\005\000\063\237\127\070\027\266\151\064\005\045\101\233\021\002 PGP sig
  1969. 0 string \211\000\077\003\005\000\063\237\127\071\027\266\151\064\005\045\101\233\021\002 PGP sig
  1970. 0 string \211\000\225\003\005\000\062\122\207\304\100\345\042 PGP sig
  1971. # windows zips files .dmf
  1972. 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
  1973. # Windows icons
  1974. # Update: Joerg Jenderek
  1975. # URL: https://en.wikipedia.org/wiki/CUR_(file_format)
  1976. # Note: similar to Windows CURsor. container for BMP (only DIB part) or PNG
  1977. 0 belong 0x00000100
  1978. >9 byte 0
  1979. >>0 byte x
  1980. >>0 use cur-ico-dir
  1981. >9 ubyte 0xff
  1982. >>0 byte x
  1983. >>0 use cur-ico-dir
  1984. # displays number of icons and information for icon or cursor
  1985. 0 name cur-ico-dir
  1986. # skip some Lotus 1-2-3 worksheets, CYCLE.PIC and keep Windows cursors with
  1987. # 1st data offset = dir header size + n * dir entry size = 6 + n * 10h = ?6h
  1988. >18 ulelong &0x00000006
  1989. # skip remaining worksheets, because valid only for DIB image (40) or PNG image (\x89PNG)
  1990. >>(18.l) ulelong x MS Windows
  1991. >>>0 ubelong 0x00000100 icon resource
  1992. # https://www.iana.org/assignments/media-types/image/vnd.microsoft.icon
  1993. !:mime image/vnd.microsoft.icon
  1994. #!:mime image/x-icon
  1995. !:ext ico
  1996. >>>>4 uleshort x - %d icon
  1997. # plural s
  1998. >>>>4 uleshort >1 \bs
  1999. # 1st icon
  2000. >>>>0x06 use ico-entry
  2001. # 2nd icon
  2002. >>>>4 uleshort >1
  2003. >>>>>0x16 use ico-entry
  2004. >>>0 ubelong 0x00000200 cursor resource
  2005. #!:mime image/x-cur
  2006. !:mime image/x-win-bitmap
  2007. !:ext cur
  2008. >>>>4 uleshort x - %d icon
  2009. >>>>4 uleshort >1 \bs
  2010. # 1st cursor
  2011. >>>>0x06 use cur-entry
  2012. #>>>>0x16 use cur-entry
  2013. # display information of one cursor entry
  2014. 0 name cur-entry
  2015. >0 use cur-ico-entry
  2016. >4 uleshort x \b, hotspot @%dx
  2017. >6 uleshort x \b%d
  2018. # display information of one icon entry
  2019. 0 name ico-entry
  2020. >0 use cur-ico-entry
  2021. # normally 0 1 but also found 14
  2022. >4 uleshort >1 \b, %d planes
  2023. # normally 0 1 but also found some 3, 4, some 6, 8, 24, many 32, two 256
  2024. >6 uleshort >1 \b, %d bits/pixel
  2025. # display shared information of cursor or icon entry
  2026. 0 name cur-ico-entry
  2027. >0 byte =0 \b, 256x
  2028. >0 byte !0 \b, %dx
  2029. >1 byte =0 \b256
  2030. >1 byte !0 \b%d
  2031. # number of colors in palette
  2032. >2 ubyte !0 \b, %d colors
  2033. # reserved 0 FFh
  2034. #>3 ubyte x \b, reserved %x
  2035. #>8 ulelong x \b, image size %d
  2036. # offset of PNG or DIB image
  2037. #>12 ulelong x \b, offset %#x
  2038. # PNG header (\x89PNG)
  2039. >(12.l) ubelong =0x89504e47
  2040. # 1 space char after "with" to get phrase "with PNG image" by magic in ./images
  2041. >>&-4 indirect x \b with
  2042. # DIB image
  2043. >(12.l) ubelong !0x89504e47
  2044. #>>&-4 use dib-image
  2045. # Windows non-animated cursors
  2046. # Update: Joerg Jenderek
  2047. # URL: https://en.wikipedia.org/wiki/CUR_(file_format)
  2048. # Note: similar to Windows ICOn. container for BMP ( only DIB part)
  2049. # GRR: line below is too general as it catches also Lotus 1-2-3 files
  2050. 0 belong 0x00000200
  2051. >9 byte 0
  2052. >>0 use cur-ico-dir
  2053. >9 ubyte 0xff
  2054. >>0 use cur-ico-dir
  2055. # .chr files
  2056. 0 string/b PK\010\010BGI Borland font
  2057. >4 string >\0 %s
  2058. # then there is a copyright notice
  2059. # .bgi files
  2060. 0 string/b pk\010\010BGI Borland device
  2061. >4 string >\0 %s
  2062. # then there is a copyright notice
  2063. # Windows Recycle Bin record file (named INFO2)
  2064. # By Abel Cheung (abelcheung AT gmail dot com)
  2065. # Version 4 always has 280 bytes (0x118) per record, version 5 has 800 bytes
  2066. # Since Vista uses another structure, INFO2 structure probably won't change
  2067. # anymore. Detailed analysis in:
  2068. # http://www.cybersecurityinstitute.biz/downloads/INFO2.pdf
  2069. 0 lelong 0x00000004
  2070. >12 lelong 0x00000118 Windows Recycle Bin INFO2 file (Win98 or below)
  2071. 0 lelong 0x00000005
  2072. >12 lelong 0x00000320 Windows Recycle Bin INFO2 file (Win2k - WinXP)
  2073. # From Doug Lee via a FreeBSD pr
  2074. 9 string GERBILDOC First Choice document
  2075. 9 string GERBILDB First Choice database
  2076. 9 string GERBILCLIP First Choice database
  2077. 0 string GERBIL First Choice device file
  2078. 9 string RABBITGRAPH RabbitGraph file
  2079. 0 string DCU1 Borland Delphi .DCU file
  2080. 0 string =!<spell> MKS Spell hash list (old format)
  2081. 0 string =!<spell2> MKS Spell hash list
  2082. # Too simple - MPi
  2083. #0 string AH Halo(TM) bitmapped font file
  2084. 0 lelong 0x08086b70 TurboC BGI file
  2085. 0 lelong 0x08084b50 TurboC Font file
  2086. # Debian#712046: The magic below identifies "Delphi compiled form data".
  2087. # An additional source of information is available at:
  2088. # http://www.woodmann.com/fravia/dafix_t1.htm
  2089. 0 string TPF0
  2090. >4 pstring >\0 Delphi compiled form '%s'
  2091. # tests for DBase files moved, updated and merged to database
  2092. 0 string PMCC Windows 3.x .GRP file
  2093. 1 string RDC-meg MegaDots
  2094. >8 byte >0x2F version %c
  2095. >9 byte >0x2F \b.%c file
  2096. # .PIF files added by Joerg Jenderek from https://smsoft.ru/en/pifdoc.htm
  2097. # only for windows versions equal or greater 3.0
  2098. 0x171 string MICROSOFT\ PIFEX\0 Windows Program Information File
  2099. !:mime application/x-dosexec
  2100. !:ext pif
  2101. #>2 string >\0 \b, Title:%.30s
  2102. >0x24 string >\0 \b for %.63s
  2103. >0x65 string >\0 \b, directory=%.64s
  2104. >0xA5 string >\0 \b, parameters=%.64s
  2105. #>0x181 leshort x \b, offset %x
  2106. #>0x183 leshort x \b, offsetdata %x
  2107. #>0x185 leshort x \b, section length %x
  2108. >0x187 search/0xB55 WINDOWS\ VMM\ 4.0\0
  2109. >>&0x5e ubyte >0
  2110. >>>&-1 string <PIFMGR.DLL \b, icon=%s
  2111. #>>>&-1 string PIFMGR.DLL \b, icon=%s
  2112. >>>&-1 string >PIFMGR.DLL \b, icon=%s
  2113. >>&0xF0 ubyte >0
  2114. >>>&-1 string <Terminal \b, font=%.32s
  2115. #>>>&-1 string =Terminal \b, font=%.32s
  2116. >>>&-1 string >Terminal \b, font=%.32s
  2117. >>&0x110 ubyte >0
  2118. >>>&-1 string <Lucida\ Console \b, TrueTypeFont=%.32s
  2119. #>>>&-1 string =Lucida\ Console \b, TrueTypeFont=%.32s
  2120. >>>&-1 string >Lucida\ Console \b, TrueTypeFont=%.32s
  2121. #>0x187 search/0xB55 WINDOWS\ 286\ 3.0\0 \b, Windows 3.X standard mode-style
  2122. #>0x187 search/0xB55 WINDOWS\ 386\ 3.0\0 \b, Windows 3.X enhanced mode-style
  2123. >0x187 search/0xB55 WINDOWS\ NT\ \ 3.1\0 \b, Windows NT-style
  2124. #>0x187 search/0xB55 WINDOWS\ NT\ \ 4.0\0 \b, Windows NT-style
  2125. >0x187 search/0xB55 CONFIG\ \ SYS\ 4.0\0 \b +CONFIG.SYS
  2126. #>>&06 string x \b:%s
  2127. >0x187 search/0xB55 AUTOEXECBAT\ 4.0\0 \b +AUTOEXEC.BAT
  2128. #>>&06 string x \b:%s
  2129. # Norton Guide (.NG , .HLP) files added by Joerg Jenderek from source NG2HTML.C
  2130. # of http://www.davep.org/norton-guides/ng2h-105.tgz
  2131. # https://en.wikipedia.org/wiki/Norton_Guides
  2132. 0 string NG\0\001
  2133. # only value 0x100 found at offset 2
  2134. >2 ulelong 0x00000100 Norton Guide
  2135. !:mime application/x-norton-guide
  2136. # often like NORTON.NG but some times like NC.HLP
  2137. !:ext ng/hlp
  2138. # Title[40]
  2139. >>8 string >\0 "%-.40s"
  2140. #>>6 uleshort x \b, MenuCount=%u
  2141. # szCredits[5][66]
  2142. >>48 string >\0 \b, %-.66s
  2143. >>114 string >\0 %-.66s
  2144. # URL: https://en.wikipedia.org/wiki/Norton_Commander
  2145. # Reference: http://mark0.net/download/triddefs_xml.7z/defs/m/msg-nc-eng.trid.xml
  2146. # From: Joerg Jenderek
  2147. # Note: Message file is used by executable with same main name.
  2148. # Only tested with version 5.50 (english) and 2.01 (Windows)
  2149. 0 string Abort
  2150. # \0 or i
  2151. #>5 ubyte x %x
  2152. # skip ASCII Abort text by looking for error message like in NCVIEW.MSG
  2153. >6 search/7089 Non-DOS\ disk Norton Commander module message
  2154. !:mime application/x-norton-msg
  2155. !:ext msg
  2156. # URL: http://www.antonis.de/dos/dos-tuts/mpdostip/html/nwdostip.htm
  2157. # Reference: https://mark0.net/download/triddefs_xml.7z/defs/m/msg-netware-dos.trid.xml
  2158. # From: Joerg Jenderek
  2159. 0 string DOS\ Client\ Message\ File: Novell DOS client message
  2160. #!:mime application/octet-stream
  2161. #!:mime application/x-novell-msg
  2162. !:ext msg
  2163. # look for second letter instead space character
  2164. >26 ubyte >0x20
  2165. # digit 1 or often main or program name like: IPXODI.COM TASKID pnwtrap DOSRqstr
  2166. >>25 ubyte !0x20 %c
  2167. >>>26 ubyte !0x20 \b%c
  2168. >>>>27 ubyte !0x20 \b%c
  2169. >>>>>28 ubyte !0x20 \b%c
  2170. >>>>>>29 ubyte !0x20 \b%c
  2171. >>>>>>>30 ubyte !0x20 \b%c
  2172. >>>>>>>>31 ubyte !0x20 \b%c
  2173. >>>>>>>>>32 ubyte !0x20 \b%c
  2174. >>>>>>>>>>33 ubyte !0x20 \b%c
  2175. >>>>>>>>>>>34 ubyte !0x20 \b%c
  2176. >>>>>>>>>>>>35 ubyte !0x20 \b%c
  2177. >>>>>>>>>>>>>36 ubyte !0x20 \b%c
  2178. # followed by string like: 0 v.10 V1.20
  2179. #
  2180. # followed by ,\040Tran
  2181. >28 search/14 ,\040Tran
  2182. # probably translated version string like: 0 v1.00
  2183. >>&0 string x \b, tran version %s
  2184. # followed by Ctrl-J Ctrl-Z
  2185. >>>&0 ubyte !0xa \b, terminated by %#2.2x
  2186. >>>>&0 ubyte x \b%2.2x
  2187. # Ctrl-Z
  2188. >0x65 ubyte !0x1A \b, at 0x65 %#x
  2189. # one
  2190. >0x66 ubyte !0x01 \b, at 0x66 %#x
  2191. # URL: https://en.wikipedia.org/wiki/NetWare
  2192. # Reference: http://mark0.net/download/triddefs_xml.7z/defs/d/dat-novell-msg.trid.xml
  2193. # ftp://ftp.iitb.ac.in/LDP/en/NLM-HOWTO/NLM-HOWTO-single.html
  2194. # From: Joerg Jenderek
  2195. 0 string Novell\ Message\ Librarian\ Data\ File Novell message librarian data
  2196. #>35 string Version\ 1.00
  2197. #>49 string COPYRIGHT\ (c)\ 1985\ by\ Novell,\ Inc.
  2198. #>83 string \ \ All\ Rights\ Reserved
  2199. #!:mime application/octet-stream
  2200. #!:mime application/x-novell-msg
  2201. !:ext msg
  2202. #!:ext msg/dat
  2203. # Summary: Turbo Pascal Help
  2204. # From: Joerg Jenderek
  2205. # URL: https://en.wikipedia.org/wiki/Turbo_Pascal
  2206. # Reference: http://mark0.net/download/triddefs_xml.7z/defs/h/hlp-tp-2.trid.xml
  2207. # Note: called "Turbo Pascal Help (v2)" by TrID
  2208. 0 string TPH2 Turbo Pascal help, version 2
  2209. #!:mime application/octet-stream
  2210. !:mime application/x-pascal-hlp
  2211. # 4DOS help file, version 1.00 3.30
  2212. !:ext hlp
  2213. # URL: https://en.wikipedia.org/wiki/4DOS
  2214. # Reference: http://mark0.net/download/triddefs_xml.7z/defs/h/hlp-4dos-v2.trid.xml
  2215. # Note: called "4DOS Help (v2)" by TrID
  2216. 0 string ALIAS\r\nASSIGN\r\n
  2217. >13 search/3016 4DOS 4DOS help file, version 2.x
  2218. #!:mime text/plain
  2219. !:mime application/x-4dos-hlp
  2220. # DOS.HLP 4DOS help file, version 2.21
  2221. !:ext hlp
  2222. # Reference: http://mark0.net/download/triddefs_xml.7z/defs/h/hlp-4dos-v4.trid.xml
  2223. # Note: called "4DOS Help (v4)" by TrID
  2224. 0 string 4DH4 4DOS help file, version 4.x
  2225. #!:mime application/octet-stream
  2226. !:mime application/x-4dos-hlp
  2227. # 4dos402b.hlp
  2228. !:ext hlp
  2229. # Reference: https://4dos.info/4dsource/4helpsrc.zip/TPHELP.PAS
  2230. # Reference: http://mark0.net/download/triddefs_xml.7z/defs/h/hlp-4dos.trid.xml
  2231. # 4DOS help (.HLP) files added by Joerg Jenderek from source TPHELP.PAS
  2232. # of https://www.4dos.info/
  2233. # check for valid pascal string length (6 or 8) of HelpID, 4DH magic, valid major number (5 6 7 8)
  2234. 0 ubequad&0xF1ffFFffF0000000 0x0034444830000000 4DOS help file
  2235. #!:mime application/octet-stream
  2236. !:mime application/x-4dos-hlp
  2237. !:ext hlp
  2238. # pascal string length of of HelpID like: 6 8
  2239. #>0 ubyte x PLENGHT=%x
  2240. # Note: version string correspond or is a little bit lower than value of _4VER variable or output of 4DOS command `VER /R`
  2241. # one-digit major version number of version string
  2242. >4 string x \b, version %-1.1s
  2243. # two-digit minor version number depending on pascal string length at the beginning
  2244. >>0 ubyte 8 \b.
  2245. >>>5 string x \b%-2.2s
  2246. # Byte at offset 7 (A=41h) and 8 (A=41h) is not Revison like C (=43h) as reported by VER /R for 4DOS602b.HLP
  2247. # GRR: maybe this is patch level
  2248. >>>7 string x %-.2s
  2249. # few samples with string length 6 (implying exact 2 byte minor version digits) like in 4DOS500f.HLP 4dos551c_ge.hlp
  2250. >>0 ubyte 6 \b.
  2251. >>>5 string x \b%-2.2s
  2252. # just in case pascal string length is neither 6 nor 8
  2253. #>>0 default x \b.
  2254. #>>>5 string x %-2.2s
  2255. # false for version 5.52 and older, but true for version 6.02 and newer
  2256. >4 ubeshort >0x3535
  2257. # HighestTopic; highest topic number
  2258. #>>9 uleshort x HighestTopic=%#4.4x
  2259. # NumTopics; number of topics
  2260. #>>11 uleshort x NumTopics=%#4.4x
  2261. # BiggestTopic; size of largest topic in uncompressed bytes
  2262. #>>13 uleshort x BiggestTopic=%#4.4x
  2263. # NamedTopics; number of topics in help index
  2264. #>>15 uleshort x NamedTopics=%#4.4x
  2265. # NameSize; Size of largest name, 0 for none
  2266. #>>17 uleshort x NameSize=%#4.4x
  2267. # PickSize; size of each entry in pick table, 0 for none
  2268. #>>18 uleshort x PickSize=%#4.4x
  2269. # width; width of help window, with frame if any
  2270. #>>19 ubyte x Width=%#2.2x
  2271. # FirstTopic; topic to show first (0 = index)
  2272. #>>20 uleshort x FirstTopic=%#4.4x
  2273. # KeysTopic; topic to show when keys help needed
  2274. #>>22 uleshort x KeysTopic=%#4.4x
  2275. # ExtHelpName; string[13]; name for external help program like: HELP.COM DOSBOOK.EXE
  2276. >>24 pstring x \b, external help %s
  2277. # ExtHelpEnv; String[16]; environment variable for alternate external help program name like: DOSHELP
  2278. >>38 pstring x or specified by DOS environment variable %s
  2279. # XlateArray = array[0..29] of Byte; {Most common characters in help text}
  2280. #>>55 ubequad x XlateArray=%#16.16llx
  2281. # SharewareData : SharewareDataRec; shareware info for 4DOS.COM
  2282. #>>87 ubequad x SharewareData=%#16.16llx
  2283. # old binary Microsoft (.HLP) files added by Joerg Jenderek from http://file-extension.net/seeker/file_extension_hlp
  2284. # URL: http://fileformats.archiveteam.org/wiki/Microsoft_Advisor_Help
  2285. # Reference: http://mark0.net/download/triddefs_xml.7z/defs/h/hlp-ms-adv.trid.xml
  2286. # Note: called "Microsoft Advisor Help" by TrID
  2287. 0 ulequad&0xFFffFFfeFFffFFff 0x003a000000024e4c MS Advisor help file
  2288. #!:mime application/octet-stream
  2289. !:mime application/x-ms-hlp
  2290. !:ext hlp
  2291. # HtmlHelp files (.chm)
  2292. 0 string/b ITSF\003\000\000\000\x60\000\000\000 MS Windows HtmlHelp Data
  2293. !:mime application/vnd.ms-htmlhelp
  2294. !:ext chm
  2295. # GFA-BASIC (Wolfram Kleff)
  2296. 2 string/b GFA-BASIC3 GFA-BASIC 3 data
  2297. #------------------------------------------------------------------------------
  2298. # From Stuart Caie <kyzer@4u.net> (developer of cabextract)
  2299. # Update: Joerg Jenderek
  2300. # URL: https://en.wikipedia.org/wiki/Cabinet_(file_format)
  2301. # Reference: https://msdn.microsoft.com/en-us/library/bb267310.aspx
  2302. # Note: verified by `7z l *.cab`
  2303. # Microsoft Cabinet files
  2304. 0 string/b MSCF\0\0\0\0 Microsoft Cabinet archive data
  2305. #
  2306. # https://support.microsoft.com/en-us/help/973559/frequently-asked-questions-about-the-microsoft-support-diagnostic-tool
  2307. # CAB with *.{diagcfg,diagpkg} is used by Microsoft Support Diagnostic Tool MSDT.EXE
  2308. # because some archive does not have *.diag* as 1st or 2nd archive member like
  2309. # O15CTRRemove.diagcab or AzureStorageAnalyticsLogs_global.DiagCab
  2310. # brute looking after header for filenames with diagcfg or diagpkg extension in CFFILE section
  2311. >0x2c search/980/c .diag \b, Diagnostic
  2312. !:mime application/vnd.ms-cab-compressed
  2313. !:ext diagcab
  2314. # http://fileformats.archiveteam.org/wiki/PUZ
  2315. # Microsoft Publisher version about 2003 has a "Pack and Go" feature that
  2316. # bundles a Publisher document *PNG.pub with all links into a CAB
  2317. >0x2c search/300/c png.pub\0 \b, Publisher Packed and Go
  2318. !:mime application/vnd.ms-cab-compressed
  2319. !:ext puz
  2320. # ppz variant with Microsoft PowerPoint Viewer ppview32.exe to play PowerPoint presentation
  2321. >0x2c search/17/c ppview32.exe\0 \b, PowerPoint Viewer Packed and Go
  2322. !:mime application/vnd.ms-powerpoint
  2323. #!:mime application/mspowerpoint
  2324. !:ext ppz
  2325. # URL: https://en.wikipedia.org/wiki/Windows_Desktop_Gadgets
  2326. # Reference: https://docs.microsoft.com/en-us/previous-versions/windows/desktop/sidebar/
  2327. # http://win10gadgets.com/download/273/ All_CPU_Meter1.zip/All_CPU_Meter_V4.7.3.gadget
  2328. >0x2c search/968/c gadget.xml \b, Windows Desktop Gadget
  2329. #!:mime application/vnd.ms-cab-compressed
  2330. # http://extension.nirsoft.net/gadget
  2331. !:mime application/x-windows-gadget
  2332. !:ext gadget
  2333. # http://www.incredimail.com/
  2334. # IncrediMail CAB contains an initialisation file "content.ini" like in im2.ims
  2335. >0x2c search/3369/c content.ini\0 \b, IncrediMail
  2336. !:mime application/x-incredimail
  2337. # member Flavor.htm implies IncrediMail ecard like in tell_a_friend.imf
  2338. >>0x2c search/83/c Flavor.htm\0 ecard
  2339. !:ext imf
  2340. # member Macromedia Flash data *.swf implies IncrediMail skin like in im2.ims
  2341. >>0x2c search/211/c .swf\0 skin
  2342. !:ext ims
  2343. # member anim.im3 implies IncrediMail animation like in letter_fold.ima
  2344. >>0x2c search/92/c anim.im3\0 animation
  2345. !:ext ima
  2346. # other IncrediMail cab archive
  2347. >>0x2c default x
  2348. >>>0x2c search/116/c thumb ecard, image, notifier or skin
  2349. !:ext imf/imi/imn/ims
  2350. # http://file-extension.net/seeker/file_extension_ime
  2351. >>>0x2c default x emoticons or sound
  2352. !:ext ime/imw
  2353. # no Diagnostic, Packed and Go, Windows Desktop Gadget, IncrediMail
  2354. >0x2c default x
  2355. # look for 1st member name
  2356. >>(16.l+16) ubyte x
  2357. # From: Joerg Jenderek
  2358. # URL: https://docs.microsoft.com/en-us/windows-hardware/drivers/install/building-device-metadata-packages
  2359. # Reference: http://mark0.net/download/triddefs_xml.7z/defs/d/devicemetadata-ms.trid.xml
  2360. >>>&-1 string PackageInfo.xml \b, Device Metadata Package
  2361. !:mime application/vnd.ms-cab-compressed
  2362. !:ext devicemetadata-ms
  2363. # https://en.wikipedia.org/wiki/SNP_file_format
  2364. >>>&-1 string/c _accrpt_.snp \b, Access report snapshot
  2365. !:mime application/msaccess
  2366. !:ext snp
  2367. # https://en.wikipedia.org/wiki/Microsoft_InfoPath
  2368. >>>&-1 string manifest.xsf \b, InfoPath Form Template
  2369. !:mime application/vnd.ms-cab-compressed
  2370. #!:mime application/vnd.ms-infopath
  2371. !:ext xsn
  2372. # https://www.cabextract.org.uk/wince_cab_format/
  2373. # extension of DOS 8+3 name with ".000" of 1st archive member name implies Windows CE installer
  2374. >>>&7 string =.000 \b, WinCE install
  2375. !:mime application/vnd.ms-cab-compressed
  2376. !:ext cab
  2377. # https://support.microsoft.com/kb/934307/en-US
  2378. # All inspected MSU contain a file with name WSUSSCAN.cab
  2379. # that is called "Windows Update meta data" by Microsoft
  2380. >>>&-1 string/c wsusscan.cab \b, Microsoft Standalone Update
  2381. !:mime application/vnd.ms-cab-compressed
  2382. !:ext msu
  2383. >>>&-1 default x
  2384. # look at point character of 1st archive member name for file name extension
  2385. # GRR: search range is maybe too large and match point else where like in EN600x64.cab!
  2386. >>>>&-1 search/255 .
  2387. # http://www.pptfaq.com/FAQ00164_What_is_a_PPZ_file-.htm
  2388. # PPZ were created using Pack & Go feature of PowerPoint versions 97 - 2002
  2389. # packs optional files, a PowerPoint presentation *.ppt with optional PLAYLIST.LST to CAB
  2390. >>>>>&0 string/c ppt\0
  2391. >>>>>>28 uleshort >1 \b, PowerPoint Packed and Go
  2392. !:mime application/vnd.ms-powerpoint
  2393. #!:mime application/mspowerpoint
  2394. !:ext ppz
  2395. # or POWERPNT.PPT packed as POWERPNT.PP_ found on Windows 2000,XP setup CD in directory i386
  2396. >>>>>>28 uleshort =1 \b, one packed PowerPoint
  2397. !:mime application/vnd.ms-cab-compressed
  2398. !:ext pp_
  2399. # https://msdn.microsoft.com/en-us/library/windows/desktop/bb773190(v=vs.85).aspx
  2400. # first member *.theme implies Windows 7 Theme Pack like in CommunityShowcaseAqua3.themepack
  2401. # or Windows 8 Desktop Theme Pack like in PanoramicGlaciers.deskthemepack
  2402. >>>>>&0 string/c theme \b, Windows
  2403. !:mime application/x-windows-themepack
  2404. # https://www.drewkeller.com/content/using-theme-both-windows-7-and-windows-8
  2405. # 1st member Panoramic.theme or Panoramas.theme implies Windows 8-10 Theme Pack
  2406. # with MTSM=RJSPBS in [MasterThemeSelector] inside *.theme
  2407. >>>>>>(16.l+16) string =Panoram 8
  2408. !:ext deskthemepack
  2409. >>>>>>(16.l+16) string !Panoram 7 or 8
  2410. !:ext themepack/deskthemepack
  2411. >>>>>>(16.l+16) ubyte x Theme Pack
  2412. # URL: https://en.wikipedia.org/wiki/Microsoft_OneNote#File_format
  2413. # http://fileformats.archiveteam.org/wiki/OneNote
  2414. # Reference: https://mark0.net/download/triddefs_xml.7z/defs/o/onepkg.trid.xml
  2415. # 1st member name like: "Class Notes.one" "test-onenote.one" "Open Notebook.onetoc2" "Editor Öffnen.onetoc2"
  2416. >>>>>&0 string/c one \b, OneNote Package
  2417. !:mime application/msonenote
  2418. !:ext onepkg
  2419. >>>>>&0 default x
  2420. # look for null terminator of 1st member name
  2421. >>>>>>&0 search/255 \0
  2422. # 2nd member name WSUSSCAN.cab like in Microsoft-Windows-MediaFeaturePack-OOB-Package.msu
  2423. >>>>>>>&16 string/c wsusscan.cab \b, Microsoft Standalone Update
  2424. !:mime application/vnd.ms-cab-compressed
  2425. !:ext msu
  2426. >>>>>>>&16 default x
  2427. # archive with more then one file need some output in version 5.32 to avoid error message like
  2428. # Magdir/msdos, 1138: Warning: Current entry does not yet have a description for adding a MIME type
  2429. # Magdir/msdos, 1139: Warning: Current entry does not yet have a description for adding a EXTENSION type
  2430. # file: could not find any valid magic files!
  2431. >>>>>>>>28 uleshort >1 \b, many
  2432. !:mime application/vnd.ms-cab-compressed
  2433. !:ext cab
  2434. # remaining archives with just one file
  2435. >>>>>>>>28 uleshort =1
  2436. # neither extra bytes nor cab chain implies Windows 2000,XP setup files in directory i386
  2437. >>>>>>>>>30 uleshort =0x0000 \b, Windows 2000/XP setup
  2438. # cut of last char of source extension and add underscore to generate extension
  2439. # TERMCAP._ ... FXSCOUNT.H_ ... L3CODECA.AC_ ... NPDRMV2.ZI_
  2440. !:mime application/vnd.ms-cab-compressed
  2441. !:ext _/?_/??_
  2442. # archive need some output like "single" in version 5.32 to avoid error messages
  2443. >>>>>>>>>30 uleshort !0x0000 \b, single
  2444. !:mime application/vnd.ms-cab-compressed
  2445. !:ext cab
  2446. # first archive name without point character
  2447. >>>>&-1 default x
  2448. >>>>>28 uleshort =1 \b, single
  2449. !:mime application/vnd.ms-cab-compressed
  2450. # on XP_CD\I386\ like: NETWORKS._ PROTOCOL._ QUOTES._ SERVICES._
  2451. !:ext _
  2452. >>>>>28 uleshort >1 \b, many
  2453. !:mime application/vnd.ms-cab-compressed
  2454. # like: HP Envy 6000 printer driver packages Full_x86.cab Full_x64.cab
  2455. !:ext cab
  2456. # TODO: additional extensions like
  2457. # .xtp InfoPath Template Part
  2458. # .lvf Logitech Video Effects Face Accessory
  2459. >8 ulelong x \b, %u bytes
  2460. >28 uleshort 1 \b, 1 file
  2461. >28 uleshort >1 \b, %u files
  2462. # Reserved fields, set to zero
  2463. #>4 belong !0 \b, reserved1 %x
  2464. #>12 belong !0 \b, reserved2 %x
  2465. # offset of the first CFFILE entry coffFiles: minimal 2Ch
  2466. >16 ulelong x \b, at %#x
  2467. >(16.l) use cab-file
  2468. # at least also 2nd member
  2469. >28 uleshort >1
  2470. >>(16.l+16) ubyte x
  2471. >>>&0 search/255 \0
  2472. # second member info
  2473. >>>>&0 use cab-file
  2474. #>20 belong !0 \b, reserved %x
  2475. # Cabinet file format version. Currently, versionMajor = 1 and versionMinor = 3
  2476. >24 ubeshort !0x0301 \b version %#x
  2477. # number of CFFOLDER entries
  2478. >26 uleshort >1 \b, %u cffolders
  2479. # cabinet file option indicators 1~PREVIOUS, 2~NEXT, 4~reserved fields
  2480. # only found for flags 0 1 2 3 4 not 7
  2481. >30 uleshort >0 \b, flags %#x
  2482. # Cabinet files have a 16-bit cabinet setID field that is designed for application use.
  2483. # default is zero, however, the -i option of cabarc can be used to set this field
  2484. >32 uleshort >0 \b, ID %u
  2485. # iCabinet is number of this cabinet file in a set, where 0 for the first cabinet
  2486. #>34 uleshort x \b, iCabinet %u
  2487. # add one for display because humans start numbering by 1 and also fit to name of disk szDisk*
  2488. >34 uleshort+1 x \b, number %u
  2489. >30 uleshort &0x0004 \b, extra bytes
  2490. # cbCFHeader optional size of per-cabinet reserved area 14h 1800h
  2491. >>36 uleshort >0 %u in head
  2492. # cbCFFolder is optional size of per-folder reserved area
  2493. >>38 ubyte >0 %u in folder
  2494. # cbCFData is optional size of per-datablock reserved area
  2495. >>39 ubyte >0 %u in data block
  2496. # optional per-cabinet reserved area abReserve[cbCFHeader]
  2497. >>36 uleshort >0
  2498. # 1st CFFOLDER after reserved area in header
  2499. >>>(36.s+40) use cab-folder
  2500. # no reserved area in header
  2501. >30 uleshort ^0x0004
  2502. # no previous and next cab archive
  2503. >>30 uleshort =0x0000
  2504. >>>36 use cab-folder
  2505. # only previous cab archive
  2506. >>30 uleshort =0x0001 \b, previous
  2507. >>>36 use cab-anchor
  2508. # only next cab archive
  2509. >>30 uleshort =0x0002 \b, next
  2510. >>>36 use cab-anchor
  2511. # previous+next cab archive
  2512. # can not use sub routine cab-anchor to display previous and next cabinet together
  2513. #>>>36 use cab-anchor
  2514. #>>>>&0 use cab-anchor
  2515. >>30 uleshort =0x0003 \b, previous
  2516. >>>36 string x %s
  2517. # optional name of previous disk szDisk*
  2518. >>>>&1 string x disk %s
  2519. >>>>>&1 string x \b, next %s
  2520. # optional name of previous disk szDisk*
  2521. >>>>>>&1 string x disk %s
  2522. >>>>>>>&1 use cab-folder
  2523. # display filename and disk name of previous or next cabinet
  2524. 0 name cab-anchor
  2525. # optional name of previous/next cabinet file szCabinet*[255]
  2526. >&0 string x %s
  2527. # optional name of previous/next disk szDisk*[255]
  2528. >>&1 string x disk %s
  2529. # display folder structure CFFOLDER information like compression of cabinet
  2530. 0 name cab-folder
  2531. # offset of the CFDATA block in this folder
  2532. #>0 ulelong x \b, coffCabStart %#x
  2533. # number of CFDATA blocks in folder
  2534. >4 uleshort x \b, %u datablock
  2535. # plural s
  2536. >4 uleshort >1 \bs
  2537. # compression typeCompress: 0~None 1~MSZIP 0x1503~LZX:21 0x1003~LZX:16 0x0f03~LZX:15
  2538. >6 uleshort x \b, %#x compression
  2539. # optional per-folder reserved area
  2540. #>8 ubequad x \b, abReserve %#llx
  2541. # display member structure CFFILE information like member name of cabinet
  2542. 0 name cab-file
  2543. # cbFile is uncompressed size of file in bytes
  2544. #>0 ulelong x \b, cbFile %u
  2545. # uoffFolderStart is uncompressed offset of file in folder
  2546. #>4 ulelong >0 \b, uoffFolderStart %#x
  2547. # iFolder is index into the CFFOLDER area. 0 indicates first folder in cabinet
  2548. # define ifoldCONTINUED_FROM_PREV (0xFFFD)
  2549. # define ifoldCONTINUED_TO_NEXT (0xFFFE)
  2550. # define ifoldCONTINUED_PREV_AND_NEXT (0xFFFF)
  2551. >8 uleshort >0 \b, iFolder %#x
  2552. # date stamp for file
  2553. >10 lemsdosdate x last modified %s
  2554. # time stamp for file
  2555. >12 lemsdostime x %s
  2556. # attribs is attribute flags for file
  2557. # define _A_RDONLY (0x01) file is read-only
  2558. # define _A_HIDDEN (0x02) file is hidden
  2559. # define _A_SYSTEM (0x04) file is a system file
  2560. # define _A_ARCH (0x20) file modified since last backup
  2561. # example http://sebastien.kirche.free.fr/pebuilder_plugins/depends.cab
  2562. # define _A_EXEC (0x40) run after extraction
  2563. # define _A_NAME_IS_UTF (0x80) szName[] contains UTF
  2564. # define UNKNOWN (0x0100) undocumented or accident
  2565. #>14 uleshort x \b, attribs %#x
  2566. >14 uleshort >0 +
  2567. >>14 uleshort &0x0001 \bR
  2568. >>14 uleshort &0x0002 \bH
  2569. >>14 uleshort &0x0004 \bS
  2570. >>14 uleshort &0x0020 \bA
  2571. >>14 uleshort &0x0040 \bX
  2572. >>14 uleshort &0x0080 \bUtf
  2573. # unknown 0x0100 flag found on one XP_CD:\I386\DRIVER.CAB
  2574. >>14 uleshort &0x0100 \b?
  2575. # szName is name of archive member
  2576. >16 string x "%s"
  2577. # next archive member name if more files
  2578. #>>&17 string >\0 \b, NEXT NAME %-.50s
  2579. # InstallShield Cabinet files
  2580. 0 string/b ISc( InstallShield Cabinet archive data
  2581. >5 byte&0xf0 =0x60 version 6,
  2582. >5 byte&0xf0 !0x60 version 4/5,
  2583. >(12.l+40) lelong x %u files
  2584. # Windows CE package files
  2585. 0 string/b MSCE\0\0\0\0 Microsoft WinCE install header
  2586. >20 lelong 0 \b, architecture-independent
  2587. >20 lelong 103 \b, Hitachi SH3
  2588. >20 lelong 104 \b, Hitachi SH4
  2589. >20 lelong 0xA11 \b, StrongARM
  2590. >20 lelong 4000 \b, MIPS R4000
  2591. >20 lelong 10003 \b, Hitachi SH3
  2592. >20 lelong 10004 \b, Hitachi SH3E
  2593. >20 lelong 10005 \b, Hitachi SH4
  2594. >20 lelong 70001 \b, ARM 7TDMI
  2595. >52 leshort 1 \b, 1 file
  2596. >52 leshort >1 \b, %u files
  2597. >56 leshort 1 \b, 1 registry entry
  2598. >56 leshort >1 \b, %u registry entries
  2599. # Windows Enhanced Metafile (EMF)
  2600. # See msdn.microsoft.com/archive/en-us/dnargdi/html/msdn_enhmeta.asp
  2601. # for further information.
  2602. 0 ulelong 1
  2603. >40 string \ EMF Windows Enhanced Metafile (EMF) image data
  2604. >>44 ulelong x version %#x
  2605. 0 string/b \224\246\056 Microsoft Word Document
  2606. !:mime application/msword
  2607. # From: "Nelson A. de Oliveira" <naoliv@gmail.com>
  2608. # Magic type for Dell's BIOS .hdr files
  2609. # Dell's .hdr
  2610. 0 string/b $RBU
  2611. >23 string Dell %s system BIOS
  2612. >5 byte 2
  2613. >>48 byte x version %d.
  2614. >>49 byte x \b%d.
  2615. >>50 byte x \b%d
  2616. >5 byte <2
  2617. >>48 string x version %.3s
  2618. # Type: Microsoft Document Imaging Format (.mdi)
  2619. # URL: https://en.wikipedia.org/wiki/Microsoft_Document_Imaging_Format
  2620. # From: Daniele Sempione <scrows@oziosi.org>
  2621. # Too weak (EP)
  2622. #0 short 0x5045 Microsoft Document Imaging Format
  2623. # MS eBook format (.lit)
  2624. 0 string/b ITOLITLS Microsoft Reader eBook Data
  2625. >8 lelong x \b, version %u
  2626. !:mime application/x-ms-reader
  2627. # Windows CE Binary Image Data Format
  2628. # From: Dr. Jesus <j@hug.gs>
  2629. 0 string/b B000FF\n Windows Embedded CE binary image
  2630. # The second byte of these signatures is a file version; I don't know what,
  2631. # if anything, produced files with version numbers 0-2.
  2632. # From: John Elliott <johne@seasip.demon.co.uk>
  2633. 0 string \xfc\x03\x00 Mallard BASIC program data (v1.11)
  2634. 0 string \xfc\x04\x00 Mallard BASIC program data (v1.29+)
  2635. 0 string \xfc\x03\x01 Mallard BASIC protected program data (v1.11)
  2636. 0 string \xfc\x04\x01 Mallard BASIC protected program data (v1.29+)
  2637. 0 string MIOPEN Mallard BASIC Jetsam data
  2638. 0 string Jetsam0 Mallard BASIC Jetsam index data
  2639. # DOS backup 2.0 to 3.2
  2640. # URL: http://fileformats.archiveteam.org/wiki/BACKUP_(MS-DOS)
  2641. # Reference: http://www.ibiblio.org/pub/micro/pc-stuff/freedos/files/dos/restore/brtecdoc.htm
  2642. # backupid.@@@
  2643. # plausibility check for date
  2644. 0x3 ushort >1979
  2645. >0x5 ubyte-1 <31
  2646. >>0x6 ubyte-1 <12
  2647. # actually 121 nul bytes
  2648. >>>0x7 string \0\0\0\0\0\0\0\0
  2649. >>>>0x1 ubyte x DOS 2.0 backup id file, sequence %d
  2650. #!:mime application/octet-stream
  2651. !:ext @@@
  2652. >>>>0x0 ubyte 0xff \b, last disk
  2653. # backed up file
  2654. # skip some AppleWorks word like Tomahawk.Awp, WIN98SE-DE.vhd
  2655. # by looking for trailing nul of maximal file name string
  2656. 0x52 ubyte 0
  2657. # test for flag byte: FFh~complete file, 00h~split file
  2658. # FFh -127 = -1 -127 = -128
  2659. # 00h -127 = 0 -127 = -127
  2660. >0 byte-127 <-126
  2661. # plausibility check for file name length
  2662. >>0x53 ubyte-1 <78
  2663. # looking for terminating nul of file name string
  2664. >>>(0x53.b+4) ubyte 0
  2665. # looking if last char of string is valid DOS file name
  2666. >>>>(0x53.b+3) ubyte >0x1F
  2667. # actually 44 nul bytes
  2668. # but sometimes garbage according to Ralf Quint. So can not be used as test
  2669. #>0x54 string \0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0
  2670. # first char of full file name is DOS (5Ch) or UNIX (2Fh) path separator
  2671. # only DOS variant found. UNIX variant according to V32SLASH.TXT in archive PD0315.EXE
  2672. >>>>>5 ubyte&0x8C 0x0C
  2673. # ./msdos (version 5.30) labeled the entry as
  2674. # "DOS 2.0 backed up file %s, split file, sequence %d" or
  2675. # "DOS 2.0 backed up file %s, complete file"
  2676. >>>>>>0 ubyte x DOS 2.0-3.2 backed up
  2677. #>>>>>>0 ubyte 0xff complete
  2678. >>>>>>0 ubyte 0
  2679. >>>>>>>1 uleshort x sequence %d of
  2680. # full file name with path but without drive letter and colon stored from 0x05 til 0x52
  2681. >>>>>>0x5 string x file %s
  2682. #!:mime application/octet-stream
  2683. # backup name is original filename
  2684. #!:ext doc/exe/rar/zip
  2685. #!:ext *
  2686. # magic/Magdir/msdos, 1169: Warning: EXTENSION type ` *' has bad char '*'
  2687. # file: line 1169: Bad magic entry ' *'
  2688. # after header original file content
  2689. >>>>>>128 indirect x \b;
  2690. # DOS backup 3.3 to 5.x
  2691. # CONTROL.nnn files
  2692. 0 string \x8bBACKUP\x20
  2693. # actually 128 nul bytes
  2694. >0xa string \0\0\0\0\0\0\0\0
  2695. >>0x9 ubyte x DOS 3.3 backup control file, sequence %d
  2696. >>0x8a ubyte 0xff \b, last disk
  2697. # NB: The BACKUP.nnn files consist of the files backed up,
  2698. # concatenated.
  2699. # From: Joerg Jenderek
  2700. # URL: http://fileformats.archiveteam.org/wiki/MS-DOS_date/time
  2701. # Reference: https://docs.microsoft.com/en-us/windows/win32/api/winbase/nf-winbase-dosdatetimetofiletime
  2702. # Note: DOS date+time format is different from formats such as Unix epoch
  2703. # bit encoded; uses year values relative to 1980 and 2 second precision
  2704. 0 name dos-date
  2705. # HHHHHMMMMMMSSSSS bit encoded Hour (0-23) Minute (0-59) SecondPart (*2)
  2706. #>0 uleshort x RAW TIME [%#4.4x]
  2707. # hour part
  2708. #>0 uleshort/2048 x hour [%u]
  2709. # YYYYYMMMMDDDDD bit encoded YearPart (+1980) Month (1-12) Day (1-31)
  2710. #>2 uleshort x RAW DATE [%#4.4x]
  2711. # day part
  2712. >2 uleshort&0x001F x %u
  2713. #>2 uleshort/16 x MONTH PART [%#x]
  2714. # GRR: not working
  2715. #>2 uleshort/16 &0x000F MONTH [%u]
  2716. #>2 uleshort&0x01E0 x MONTH PART [%#4.4x]
  2717. >2 uleshort&0x01E0 =0x0020 jan
  2718. >2 uleshort&0x01E0 =0x0040 feb
  2719. >2 uleshort&0x01E0 =0x0060 mar
  2720. >2 uleshort&0x01E0 =0x0080 apr
  2721. >2 uleshort&0x01E0 =0x00A0 may
  2722. >2 uleshort&0x01E0 =0x00C0 jun
  2723. >2 uleshort&0x01E0 =0x00E0 jul
  2724. >2 uleshort&0x01E0 =0x0100 aug
  2725. >2 uleshort&0x01E0 =0x0120 sep
  2726. >2 uleshort&0x01E0 =0x0140 oct
  2727. >2 uleshort&0x01E0 =0x0160 nov
  2728. >2 uleshort&0x01E0 =0x0180 dec
  2729. # year part
  2730. >2 uleshort/512 x 1980+%u
  2731. #
  2732. # ExcelBIFF2-8BOF.magic - Excel Binary Interchange File Format versions 2-8
  2733. # Beginning of File records
  2734. # See https://www.gaia-gis.it/gaia-sins/freexl-1.0.6-doxy-doc/html/Format.html
  2735. # Excel Commercial BIFF Release
  2736. # Version Name Version Year Notes
  2737. # 2.x Excel 2.0 BIFF2 1987 Before CFBF. File is the BIFF
  2738. # stream, containing a single
  2739. # worksheet.
  2740. # 3.0 Excel 3.0 BIFF3 1990 ""
  2741. # 4.0 Excel 4.0 BIFF4 1992 ""
  2742. # 5.0 Excel 5.0 BIFF5 1993 Starting with BIFF5, a single
  2743. # Workbook can internally store
  2744. # many individual Worksheets.
  2745. # The BIFF stream is stored in
  2746. # the CFBF file container.
  2747. # 7.0 Excel 95 BIFF5 1995
  2748. # 8.0 Excel 98 BIFF8 1998
  2749. # 9.0 Excel 2000 BIFF8 1999
  2750. # 10.0 Excel XP BIFF8 2001
  2751. # 11.0 Excel 2003 BIFF8 2003
  2752. # See https://www.openoffice.org/sc/excelfileformat.pdf#page=135
  2753. # 5.8 BOF – Beginning of File
  2754. # See also https://en.wikipedia.org/wiki/Microsoft_Excel;
  2755. # Old file extensions
  2756. # Format Extension Description
  2757. # Spreadsheet .xls Main spreadsheet format which holds data in
  2758. # worksheets, charts, and macros
  2759. # Add-in (VBA) .xla Adds custom functionality; written in VBA
  2760. # Toolbar .xlb The file extension where Microsoft Excel custom
  2761. # toolbar settings are stored.
  2762. # Chart .xlc A chart created with data from a Microsoft Excel
  2763. # spreadsheet that only saves the chart.
  2764. # To save the chart and spreadsheet save as .XLS.
  2765. # XLC is not supported in Excel 2007 or in any
  2766. # newer versions of Excel.
  2767. # Dialog .xld Used in older versions of Excel.
  2768. # Archive .xlk A backup of an Excel Spreadsheet
  2769. # Add-in (DLL) .xll Adds custom functionality; written in C++/C,
  2770. # Fortran, etc. and compiled in to a special
  2771. # dynamic-link library
  2772. # Macro .xlm A macro is created by the user or pre-installed
  2773. # with Excel.
  2774. # Template .xlt A pre-formatted spreadsheet created by the user
  2775. # or by Microsoft Excel.
  2776. # Module .xlv A module is written in VBA (Visual Basic for
  2777. # Applications) for Microsoft Excel
  2778. # Workspace .xlw Arrangement of the windows of multiple Workbooks
  2779. # Library .DLL Code written in VBA may access functions in a
  2780. # DLL, typically this is used to access the
  2781. # Windows API
  2782. #!:ext xls/xla/xlb/xlc/xld/xlk/xll/xlm/xlt/xlv/xlw
  2783. #!:mime application/vnd.ms-excel
  2784. # 5.8.1 BOF Records Written by Excel
  2785. # Record BOF, BIFF2 (record identifier is 0009 H):
  2786. # Offset Size Contents
  2787. # 0 2 BIFF version (not used)
  2788. # 2 2 Type of the following data: 0010H = Sheet
  2789. # 0020H = Chart
  2790. # 0040H = Macro sheet
  2791. # e.g. 0x0009 BOF len 4 version 2 content 0x0010 Sheet
  2792. 0 uleshort =0x0009 Excel 2 BIFF 2
  2793. >2 uleshort =4
  2794. # version
  2795. >>4 uleshort =0
  2796. >>4 uleshort =2
  2797. >>>6 uleshort =0x0010 Sheet
  2798. >>>6 uleshort =0x0020 Chart
  2799. >>>6 uleshort =0x0040 Macros
  2800. # Record BOF, BIFF3 (record identifier is 0209 H) and
  2801. # BIFF4 (record identifier is 0409H):
  2802. # Offset Size Contents
  2803. # 0 2 BIFF version (not used)
  2804. # 2 2 Type of the following data: 0010H = Sheet
  2805. # 0020H = Chart
  2806. # 0040H = Macro sheet
  2807. # 0100H = Workspace
  2808. # (BIFF3W/BIFF4W only)
  2809. # 4 2 Not used
  2810. 0 uleshort =0x0209 Excel 3 BIFF 3
  2811. >2 uleshort =6
  2812. # version
  2813. >>4 uleshort =0
  2814. >>4 uleshort =3
  2815. >>>6 uleshort =0x0010 Sheet
  2816. >>>6 uleshort =0x0020 Chart
  2817. >>>6 uleshort =0x0040 Macros
  2818. # (BIFF3W only)
  2819. >>>6 uleshort =0x0100 Workspace
  2820. 0 uleshort =0x0409 Excel 4 BIFF 4
  2821. >2 uleshort =6
  2822. # version
  2823. >>4 uleshort =0
  2824. >>4 uleshort =4
  2825. >>>6 uleshort =0x0010 Sheet
  2826. >>>6 uleshort =0x0020 Chart
  2827. >>>6 uleshort =0x0040 Macros
  2828. # (BIFF4W only)
  2829. >>>6 uleshort =0x0100 Workspace
  2830. # Record BOF, BIFF5 (record identifier is 0809 H):
  2831. # Offset Size Contents
  2832. # 0 2 BIFF version (always 0500H for BIFF5).
  2833. # Should only be used, if this record is the leading
  2834. # workbook globals BOF (see above).
  2835. # 2 2 Type of the following data:
  2836. # 0005H = Workbook globals
  2837. # 0006H = Visual Basic module
  2838. # 0010H = Sheet or dialogue (see SHEETPR,
  2839. # ➜5.97)
  2840. # 0020H = Chart
  2841. # 0040H = Macro sheet
  2842. # 0100H = Workspace (BIFF5W only)
  2843. # 4 2 Build identifier, must not be 0
  2844. # 6 2 Build year
  2845. 0 uleshort =0x0809 Excel 5 BIFF 5
  2846. >2 uleshort =8
  2847. # version
  2848. >>4 uleshort =0x0500
  2849. >>4 uleshort =5
  2850. >>4 uleshort =0
  2851. >>>6 uleshort =0x0005 Workbook Globals
  2852. >>>6 uleshort =0x0006 VB Module
  2853. >>>6 uleshort =0x0010 Sheet
  2854. >>>6 uleshort =0x0020 Chart
  2855. >>>6 uleshort =0x0040 Macros
  2856. # (BIFF5W only)
  2857. >>>6 uleshort =0x0100 Workspace
  2858. >>>>8 uleshort >0 Build %d
  2859. >>>>>10 uleshort >1900 Year %d
  2860. # Record BOF, BIFF8 (record identifier is 0809 H):
  2861. # Offset Size Contents
  2862. # 0 2 BIFF version (always 0600 H for BIFF8)
  2863. # 2 2 Type of the following data:
  2864. # 0005H = Workbook globals
  2865. # 0006H = Visual Basic module
  2866. # 0010H = Sheet or dialogue (see SHEETPR,
  2867. # ➜5.97)
  2868. # 0020H = Chart
  2869. # 0040H = Macro sheet
  2870. # 0100H = Workspace (BIFF8W only)
  2871. # 4 2 Build identifier, must not be 0
  2872. # 6 2 Build year, must not be 0
  2873. # 8 4 File history flags
  2874. # 12 4 Lowest Excel version that can read all records in this
  2875. # file
  2876. 0 uleshort =0x0809 Excel 8 BIFF 8
  2877. >2 uleshort =16
  2878. # version
  2879. >>4 uleshort =0x0600
  2880. >>4 uleshort =8
  2881. >>4 uleshort =0
  2882. >>>6 uleshort =0x0005 Workbook Globals
  2883. >>>6 uleshort =0x0006 VB Module
  2884. >>>6 uleshort =0x0010 Sheet
  2885. >>>6 uleshort =0x0020 Chart
  2886. >>>6 uleshort =0x0040 Macros
  2887. # (BIFF8W only)
  2888. >>>6 uleshort =0x0100 Workspace
  2889. >>>>8 uleshort >0 Build %d
  2890. >>>>>10 uleshort >1900 Year %d
  2891. >>>>>>12 ulelong !0 File history %d
  2892. >>>>>>16 ulelong >0 Excel version needed %d
  2893. # 5.8.2 BOF Records Written by Other External Tools
  2894. # Various external tools write non-standard BOF records with the record
  2895. # identifier 0809H (determining a BIFF5-BIFF8 BOF record), but with a
  2896. # different BIFF version field. In this case, the record identifier is
  2897. # ignored, and only the version field is used to set the BIFF version of
  2898. # the workbook.
  2899. # Record BOF (record identifier is 0809 H):
  2900. # Offset Size Contents
  2901. # 0 2 BIFF version: 0000H = BIFF5
  2902. # 0200H = BIFF2
  2903. # 0300H = BIFF3
  2904. # 0400H = BIFF4
  2905. # 0500H = BIFF5
  2906. # 0600H = BIFF8
  2907. # 2 2 Type of the following data:
  2908. # 0005H = Workbook globals
  2909. # 0006H = Visual Basic module
  2910. # 0010H = Sheet or dialogue (see SHEETPR,
  2911. # ➜5.97)
  2912. # 0020H = Chart
  2913. # 0040H = Macro sheet
  2914. # 0100H = Workspace
  2915. # [4] var. (optional) Additional fields of a BOF record,
  2916. # should be ignored
  2917. 0 uleshort =0x0809
  2918. # >= 4
  2919. >2 uleshort >3
  2920. >>4 uleshort =0 Excel 5 BIFF 5
  2921. >>4 uleshort =0x0200 Excel 2 BIFF 2
  2922. >>4 uleshort =2 Excel 2 BIFF 2
  2923. >>4 uleshort =0x0300 Excel 3 BIFF 3
  2924. >>4 uleshort =3 Excel 3 BIFF 3
  2925. >>4 uleshort =0x0400 Excel 4 BIFF 4
  2926. >>4 uleshort =4 Excel 4 BIFF 4
  2927. >>4 uleshort =0x0500 Excel 5 BIFF 5
  2928. >>4 uleshort =5 Excel 5 BIFF 5
  2929. >>4 uleshort =0x0600 Excel 8 BIFF 8
  2930. >>4 uleshort =6 Excel 8 BIFF 8
  2931. >>4 uleshort =0x0800 Excel 8 BIFF 8
  2932. >>4 uleshort =8 Excel 8 BIFF 8
  2933. >>>6 uleshort =0x0005 Workbook Globals
  2934. >>>6 uleshort =0x0006 VB Module
  2935. >>>6 uleshort =0x0010 Sheet/Dialogue
  2936. >>>6 uleshort =0x0020 Chart
  2937. >>>6 uleshort =0x0040 Macros
  2938. # (BIFF8W only)
  2939. >>>6 uleshort =0x0100 Workspace