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