msvc 9.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222
  1. #------------------------------------------------------------------------------
  2. # $File: msvc,v 1.11 2022/01/17 17:17:30 christos Exp $
  3. # msvc: file(1) magic for msvc
  4. # "H. Nanosecond" <aldomel@ix.netcom.com>
  5. # Microsoft visual C
  6. #
  7. # I have version 1.0
  8. # .aps
  9. 0 string HWB\000\377\001\000\000\000 Microsoft Visual C .APS file
  10. # .ide
  11. #too long 0 string \102\157\162\154\141\156\144\040\103\053\053\040\120\162\157\152\145\143\164\040\106\151\154\145\012\000\032\000\002\000\262\000\272\276\372\316 MSVC .ide
  12. 0 string \102\157\162\154\141\156\144\040\103\053\053\040\120\162\157 MSVC .ide
  13. # .res
  14. 0 string \000\000\000\000\040\000\000\000\377 MSVC .res
  15. 0 string \377\003\000\377\001\000\020\020\350 MSVC .res
  16. 0 string \377\003\000\377\001\000\060\020\350 MSVC .res
  17. #.lib
  18. # URL: https://en.wikipedia.org/wiki/Microsoft_Visual_C%2B%2B
  19. # http://fileformats.archiveteam.org/wiki/Microsoft_Library
  20. # http://fileformats.archiveteam.org/wiki/OMF
  21. # Reference: http://mark0.net/download/triddefs_xml.7z/defs/l/lib-msvc.trid.xml
  22. # https://pierrelib.pagesperso-orange.fr/exec_formats/OMF_v1.1.pdf
  23. # Update: Joerg Jenderek
  24. #0 string \360\015\000\000 Microsoft Visual C library
  25. #0 string \360\075\000\000 Microsoft Visual C library
  26. #0 string \360\175\000\000 Microsoft Visual C library
  27. # test for RecordType~LibraryHeaderRecord=0xF0 + RecordLength=???Dh + dictionary offset is multiple of 0x200
  28. 0 ubelong&0xFF0f80ff =0xF00d0000
  29. # Microsoft Visual C library (strength=70) before MIDI SysEx messages (strength=50) handled by ./sysex
  30. #!:strength +0
  31. # test for valid 2nd RecordType~Translator Header Record=THEADR=80h or LHEADR=82h
  32. >(1.s+3) ubyte&0xFD =0x80
  33. >>0 use omf-lib
  34. # display information about Microsoft Visual C/OMF library
  35. 0 name omf-lib
  36. # RecordType~LibraryHeaderRecord=0xF0
  37. #>0 byte 0xF0 Microsoft Visual C library
  38. # the above description was used in file version 5.41
  39. >0 byte 0xF0 Microsoft Visual C/OMF library
  40. #>0 byte 0xF0 relocatable Object Module Format (OMF) libray
  41. #!:mime application/octet-stream
  42. !:mime application/x-omf-lib
  43. !:ext lib
  44. # 1st record data length like 13=0Dh 29=1Dh 61=3Dh 125=7Dh 509=01FDh ... 32765=7FFDh
  45. #>1 uleshort x \b, 1st record data length %u
  46. #>1 uleshort x \b, 1st record data length %#x
  47. # 2**4=16 <= RecordLength+3 = PageSize = 2**n {16 32 512 no examples 64 128 256 1024 2048 ...32768} <= 2**15=32768
  48. >1 uleshort+3 x \b, page size %u
  49. # dictionary offset like: 400h 600h a00h c00h 1200h 1800h 2400h 5600h 12800h 19200h 28a00h
  50. >3 ulelong x \b, at %#x dictionary
  51. # dictionary block a 512 bytes; the first 37 bytes correspond to the 37 buckets
  52. #>(3.l) ubequad x (%#16.16llx...)
  53. # dictionary size; length in 512-byte blocks; a prime number? like:
  54. # 1 2 3 4 5 6 7 9 11 13 15 16 18 21 22 23 24 25 31 50 53 89 101 117 277
  55. >7 uleshort x with %u block
  56. # plurals s
  57. >7 uleshort >1 \bs
  58. # If dictionary byte 38 (FFLAG) has the value 255, there is no space left
  59. >(3.l+37) ubyte <0xFF (FFLAG=%#x)
  60. >(3.l+37) ubyte =0xFF (FFLAG=full)
  61. # dictionary entry; length byte of following symbol, the following text bytes of symbol, two bytes specifies the page number
  62. # like: dbfntx1! DBFNTX.LIB zlibCompileFlags_ ZLIB.LIB atoi! mwlibc.lib
  63. >(3.l+38) pstring x 1st entry %s
  64. # like: 1 33 41 47 458 8783
  65. >>&0 uleshort x in page %u
  66. # library flags; 0 or 1, but WHAT IS 0x4d in MOUSE.LIB ?
  67. >9 ubyte >1 \b, flags %#x
  68. >9 ubyte =1 case sensitive
  69. # In the library after header comes first object module with a Library Module Header Record (LHEADR=82h)
  70. # but in examples Translator Header Record (THEADR=80h) which is handled identically
  71. >(1.s+3) ubyte x \b, 2nd record
  72. >(1.s+3) ubyte !0x80 (type %#x)
  73. #>(1.s+4) uleshort x \b, 2nd record data length %u
  74. # Module name often source name like "dos\crt0.asm" in mlibce.lib or "QB4UTIL.ASM" in QB4UTIL.LIB
  75. # or "C:\Documents and Settings\Allan Campbell\My Documents\FDOSBoot\zlib\zutil.c" in ZLIB.LIB
  76. # or title like "87INIT" in FP87.LIB or "ACOSASIN" in MATHC.LIB or "Copyright" in calc-bcc.lib
  77. >(1.s+6) pstring x "%s"
  78. # 2nd record checksum
  79. #>>&0 ubyte x checksum %#x
  80. # 3rd RecordType: 96h~LNAMES 88h~COMENT
  81. >>&1 ubyte x \b, 3rd record
  82. >>&1 ubyte !0x88
  83. >>>&-1 ubyte !0x96
  84. # 3rd unusual record type
  85. >>>>&-1 ubyte x (type %#x)
  86. # 3rd record is a List of Names Record (LNAMES=96h)
  87. >>&1 ubyte =0x96 LNAMES
  88. # LNAMES record length like: 2 15 19
  89. #>>>&0 uleshort x \b, LNAMES record length %u
  90. >>>&0 uleshort >2
  91. # 1st LNAME string length; null is valid; maximal 255
  92. #>>>>&0 ubyte x 1st LNAME length %u
  93. >>>>&0 ubyte =0
  94. # 2nd LNAME length like: 4 7 8 17 31
  95. #>>>>>&0 ubyte x 2nd LNAME length %u
  96. # name used for segment, class, group, overlay, etc like:
  97. # CODE (mwlibc.lib) _TEXT32 (JMPPM32.LIB) _OVLCODE (WOVL.LIB)
  98. >>>>>&0 pstring x %s
  99. # 3rd LNAME length like: 4 5
  100. #>>>>>>&0 ubyte x 3rd LNAME length %u
  101. # like: DATA (mwlibc.lib) CODE (JMPPM32.LIB) _TEXT (EMU87.LIB)
  102. >>>>>>&0 pstring x %s
  103. # maybe 4th LNAME length like: 4 6
  104. >>>>>>>&0 ubyte <44
  105. # like: DATA (DEBUG.LIB) DGROUP (mwlibc.lib MOUSE.LIB)
  106. >>>>>>>>&-1 pstring x %s
  107. # 3rd record is a COMMENT (Including all comment class extensions)
  108. >>&1 ubyte =0x88 COMMENT
  109. # comment record length like: 3 FLIB7M.LIB 1Bh 1Eh 23h 27h 2Bh 30h freetype-bcc.lib
  110. #>>>&0 uleshort x \b, record length %#x
  111. # real comment length = record length - 1 (comment type) - 1 (comment Class) - 1 (checksum) -1 (char count)
  112. # like: 2 LIBFL.LIB 4 "UUID" 5 "dscap" 6 "int386" 7 "qb4util" 8 "AMSGEXIT" 16 REXX.LIB 20 27 35 44 freetype-bcc.lib
  113. #>>>>&-2 uleshort-4 >0 \b, comment length %u
  114. # check that record contain at least comment type (1 byte), comment class (1 byte), checksum (1 byte)
  115. # probably always true
  116. >>>&0 uleshort >2
  117. # comment type: 80h~NP~no purge bit 40h~NL~no list bit
  118. #>>>>&0 ubyte !0 Type %#x
  119. >>>>&0 ubyte &0x80 Preserved
  120. # no example
  121. >>>>&0 ubyte &0x40 NoList
  122. # comment class like: 0~Translator A0~OMF extensions A3~LIBMOD A1~New OMF extensions AA~UNKNOWN
  123. >>>>&1 ubyte x class=%#x
  124. # check that comment record contains at least real content
  125. >>>>&-2 uleshort >3
  126. # Translator comment record (0); it may name the source language or translator
  127. >>>>>&1 ubyte =0 Translator
  128. #>>>>>>&0 ubyte x Translator length %u
  129. # like: "TC86 Borland Turbo C 2.01 " (GEMS.LIB) "TC86 Borland Turbo C++ 3.00" (CATDB.LIB)
  130. >>>>>>&0 pstring x "%s"
  131. # OMF extensions comment record (A0); first byte of commentary string identifies subtype
  132. >>>>>&1 ubyte =0xA0 OMF extensions
  133. # A0 subtype like: 1~IMPDEF
  134. >>>>>>&0 ubyte !1 subtype %#x
  135. # Import Definition Record (Comment Class A0, Subtype 01~IMPDEF)
  136. >>>>>>&0 ubyte 1 IMPDEF
  137. # ordinal flag; determines form of Entry Ident field. If nonzero (seems to be 1) Entry is ordinal
  138. >>>>>>>&0 ubyte !0 ordinal
  139. # like: IMPORT.LIB DOSCALLS.LIB mlibw.lib mwinlibc.lib REXX.LIB
  140. >>>>>>>>&-1 ubyte >1 %u
  141. # Internal Name in count, char string format; module name for the imported symbol
  142. # like: 7 "REXXSAA" 9 11 13 14 15 16 20 21 26 "_Z10_clip_linePdS_S_S_dddd"
  143. #>>>>>>>&1 ubyte x internal name length %u
  144. # internal module name like: _DllGetVersion DllGetVersion BezierTerminationTest Copyright
  145. >>>>>>>&1 pstring x %s
  146. # module name in count, char string format; DLL name that supplies a matching export symbol
  147. # like: jpeg62.dll (jpeg-bcc.lib) unrar3.dll (unrar-bcc.lib) REXX (REXX.LIB)
  148. >>>>>>>>&0 pstring x exported by %s
  149. # Entry Ident; 16-bit if ordinal flag != 0 or imported name in count, char string format if ordinal flag = 0
  150. # like: \0 (calc-bcc.lib) DllGetVersion (libtiff-bcc.lib) UTF8ToHtml (libxml2-bcc.lib) xslAddCall (libxslt-bcc.lib)
  151. #>>>>>>>>>&0 pstring >\0 entry ident %s
  152. # "New OMF" extensions comment (A1); indicate version of symbolic debug information
  153. # like: LIBFL.LIB
  154. >>>>>&1 ubyte =0xA1 New OMF extensions
  155. # symbolic debug information version n
  156. >>>>>>&0 ubyte x n=%u
  157. # symbolic debug information style like: HL~IBM PM Debugger style (LIBFL.LIB) DX~AIX style CV~Microsoft symbol and type style
  158. >>>>>>>&0 string HL IBM style
  159. >>>>>>>&0 string DX AIX style
  160. >>>>>>>&0 string CV Microsoft style
  161. # LIBMOD comment record (A3) used only by the librarian
  162. # Microsoft extension added for LIB version 3.07 in macro assembler (MASM 5.0)
  163. >>>>>&1 ubyte =0xA3 LIBMOD
  164. # The A3 LIBMOD record contains only the ASCII string of the module name in count char format
  165. #>>>>>>&0 ubyte x LIBMOD length %u
  166. # LIBMOD comment record module name without path and extension like:
  167. # qb4util (QB4UTIL.LIB) affaldiv (libh.lib) crt0 (slibc.lib) clipper (DDDRAWS.LIB) dinpdev (DINPUTS.LIB) UUID (UUID.LIB)
  168. >>>>>>&0 pstring x %s
  169. # GRR: WHAT iS THAT? AA foo comment record
  170. #>>>>>&1 ubyte =0xAA AA-comment
  171. # like: OS220
  172. #>>>>>>&0 string x what=%-5.5s
  173. #
  174. #.pch
  175. 0 string DTJPCH0\000\022\103\006\200 Microsoft Visual C .pch
  176. # Summary: Symbol Table / Debug info used by Microsoft compilers
  177. # URL: https://en.wikipedia.org/wiki/Program_database
  178. # Reference: https://code.google.com/p/pdbparser/wiki/MSF_Format
  179. # Update: Joerg Jenderek
  180. # Note: test only for Windows XP+SP3 x86 , 8.1 x64 arm and 10.1 x86
  181. # info does only applies partly for older files like msvbvm50.pdb about year 2001
  182. 0 string Microsoft\ C/C++\040
  183. # "Microsoft Program DataBase" by TrID
  184. >24 search/14 \r\n\x1A MSVC program database
  185. !:mime application/x-ms-pdb
  186. !:ext pdb
  187. # "MSF 7.00" "program database 2.00" for msvbvm50.pdb
  188. >>16 regex \([0-9.]+\) ver %s
  189. #>>>0x38 search/128123456 /LinkInfo \b with linkinfo
  190. # "MSF 7.00" variant
  191. >>0x1e leshort 0
  192. # PageSize 400h 1000h
  193. >>>0x20 lelong x \b, %d
  194. # Page Count
  195. >>>0x28 lelong x \b*%d bytes
  196. # "program database 2.00" variant
  197. >>0x1e leshort !0
  198. # PageSize 400h
  199. >>>0x2c lelong x \b, %d
  200. # Page Count for msoo-dll.pdb 4379h
  201. >>>0x32 leshort x \b*%d bytes
  202. # Reference: https://github.com/Microsoft/vstest/pull/856/commits/fdc7a9f074ca5a8dfeec83b1be9162bf0cf4000d
  203. 0 string/c bsjb\001\000\001\000\000\000\000\000\f\000\000\000pdb\ v1.0 Microsoft Roslyn C# debugging symbols version 1.0
  204. #.sbr
  205. 0 string \000\002\000\007\000 MSVC .sbr
  206. >5 string >\0 %s
  207. #.bsc
  208. 0 string \002\000\002\001 MSVC .bsc
  209. #.wsp
  210. 0 string 1.00\ .0000.0000\000\003 MSVC .wsp version 1.0000.0000
  211. # these seem to start with the version and contain menus