2 #------------------------------------------------------------------------------
3 # $File: windows,v 1.12 2015/08/29 07:10:35 christos Exp $
4 # windows: file(1) magic for Microsoft Windows
6 # This file is mainly reserved for files where programs
7 # using them are run almost always on MS Windows 3.x or
8 # above, or files only used exclusively in Windows OS,
9 # where there is no better category to allocate for.
10 # For example, even though WinZIP almost run on Windows
11 # only, it is better to treat them as "archive" instead.
12 # For format usable in DOS, such as generic executable
13 # format, please specify under "msdos" file.
17 # Summary: Outlook Express DBX file
19 # Created by: Christophe Monniez
20 0 string \xCF\xAD\x12\xFE MS Outlook Express DBX file
21 >4 byte =0xC5 \b, message database
22 >4 byte =0xC6 \b, folder database
23 >4 byte =0xC7 \b, account information
24 >4 byte =0x30 \b, offline database
27 # Summary: Windows crash dump
29 # Created by: Andreas Schuster (http://computer.forensikblog.de/)
30 # Reference (1): http://computer.forensikblog.de/en/2008/02/64bit_magic.html
31 # Modified by (1): Abel Cheung (Avoid match with first 4 bytes only)
33 >4 string DUMP MS Windows 32bit crash dump
34 >>0x05c byte 0 \b, no PAE
35 >>0x05c byte 1 \b, PAE
36 >>0xf88 lelong 1 \b, full dump
37 >>0xf88 lelong 2 \b, kernel dump
38 >>0xf88 lelong 3 \b, small dump
39 >>0x068 lelong x \b, %d pages
40 >4 string DU64 MS Windows 64bit crash dump
41 >>0xf98 lelong 1 \b, full dump
42 >>0xf98 lelong 2 \b, kernel dump
43 >>0xf98 lelong 3 \b, small dump
44 >>0x090 lequad x \b, %lld pages
47 # Summary: Vista Event Log
49 # Created by: Andreas Schuster (http://computer.forensikblog.de/)
50 # Reference (1): http://computer.forensikblog.de/en/2007/05/some_magic.html
51 0 string ElfFile\0 MS Windows Vista Event Log
52 >0x2a leshort x \b, %d chunks
53 >>0x10 lelong x \b (no. %d in use)
54 >0x18 lelong >1 \b, next record no. %d
55 >0x18 lelong =1 \b, empty
56 >0x78 lelong &1 \b, DIRTY
57 >0x78 lelong &2 \b, FULL
60 # Summary: Windows 3.1 group files
63 0 string \120\115\103\103 MS Windows 3.1 group files
66 # Summary: Old format help files
68 # Created by: Dirk Jagdmann <doj@cubic.org>
69 0 lelong 0x00035f3f MS Windows 3.x help file
72 # Summary: Hyper terminal
75 0 string HyperTerminal\
76 >15 string 1.0\ --\ HyperTerminal\ data\ file MS Windows HyperTerminal profile
78 # http://ithreats.files.wordpress.com/2009/05/\
79 # lnk_the_windows_shortcut_file_format.pdf
80 # Summary: Windows shortcut
84 0 string \114\0\0\0\001\024\002\0\0\0\0\0\300\0\0\0\0\0\0\106 MS Windows shortcut
85 >20 lelong&1 1 \b, Item id list present
86 >20 lelong&2 2 \b, Points to a file or directory
87 >20 lelong&4 4 \b, Has Description string
88 >20 lelong&8 8 \b, Has Relative path
89 >20 lelong&16 16 \b, Has Working directory
90 >20 lelong&32 32 \b, Has command line arguments
91 >20 lelong&64 64 \b, Icon
92 >>56 lelong x \b number=%d
93 >24 lelong&1 1 \b, Read-Only
94 >24 lelong&2 2 \b, Hidden
95 >24 lelong&4 4 \b, System
96 >24 lelong&8 8 \b, Volume Label
97 >24 lelong&16 16 \b, Directory
98 >24 lelong&32 32 \b, Archive
99 >24 lelong&64 64 \b, Encrypted
100 >24 lelong&128 128 \b, Normal
101 >24 lelong&256 256 \b, Temporary
102 >24 lelong&512 512 \b, Sparse
103 >24 lelong&1024 1024 \b, Reparse point
104 >24 lelong&2048 2048 \b, Compressed
105 >24 lelong&4096 4096 \b, Offline
106 >28 leqwdate x \b, ctime=%s
107 >36 leqwdate x \b, mtime=%s
108 >44 leqwdate x \b, atime=%s
109 >52 lelong x \b, length=%u, window=
110 >60 lelong&1 1 \bhide
111 >60 lelong&2 2 \bnormal
112 >60 lelong&4 4 \bshowminimized
113 >60 lelong&8 8 \bshowmaximized
114 >60 lelong&16 16 \bshownoactivate
115 >60 lelong&32 32 \bminimize
116 >60 lelong&64 64 \bshowminnoactive
117 >60 lelong&128 128 \bshowna
118 >60 lelong&256 256 \brestore
119 >60 lelong&512 512 \bshowdefault
122 #>>>(72.l-64) pstring/h x \b [%s]
126 #>>>&75 pstring/h x \b [%s]
128 # Summary: Outlook Personal Folders
129 # Created by: unknown
130 0 lelong 0x4E444221 Microsoft Outlook email folder
131 >10 leshort 0x0e (<=2002)
132 >10 leshort 0x17 (>=2003)
135 # Summary: Windows help cache
136 # Created by: unknown
137 0 string \164\146\115\122\012\000\000\000\001\000\000\000 MS Windows help cache
140 # Summary: IE cache file
141 # Created by: Christophe Monniez
142 0 string Client\ UrlCache\ MMF Internet Explorer cache file
143 >20 string >\0 version %s
146 # Summary: Registry files
147 # Created by: unknown
148 # Modified by (1): Joerg Jenderek
149 0 string regf MS Windows registry file, NT/2000 or above
150 0 string CREG MS Windows 95/98/ME registry file
151 0 string SHCC3 MS Windows 3.1 registry file
154 # Summary: Windows Registry text
156 # Submitted by: Abel Cheung <abelcheung@gmail.com>
157 0 string REGEDIT4\r\n\r\n Windows Registry text (Win95 or above)
158 0 string Windows\ Registry\ Editor\
159 >&0 string Version\ 5.00\r\n\r\n Windows Registry text (Win2K or above)
161 # Windows *.INF *.INI files updated by Joerg Jenderek at Apr 2013
162 # empty ,comment , section
163 # PR/383: remove unicode BOM because it is not portable across regex impls
164 0 regex/s \\`(\\r\\n|;|[[])
165 # left bracket in section line
167 # http://en.wikipedia.org/wiki/Autorun.inf
168 # http://msdn.microsoft.com/en-us/library/windows/desktop/cc144200.aspx
169 >>&0 regex/c \^(autorun)]\r\n
170 >>>&0 ubyte =0x5b INItialization configuration
171 !:mime application/x-wine-extension-ini
172 # From: Pal Tamas <folti@balabit.hu>
174 >>>&0 ubyte !0x5b Microsoft Windows Autorun file
175 !:mime application/x-setupscript
176 # http://msdn.microsoft.com/en-us/library/windows/hardware/ff549520(v=vs.85).aspx
177 # version strings ASCII coded case-independent for Windows setup information script file
178 >>&0 regex/c \^(version|strings)] Windows setup INFormation
179 !:mime application/x-setupscript
180 #!:mime application/inf
181 #!:mime application/x-wine-extension-inf
182 >>&0 regex/c \^(WinsockCRCList|OEMCPL)] Windows setup INFormation
184 # http://www.winfaq.de/faq_html/Content/tip2500/onlinefaq.php?h=tip2653.htm
185 # http://msdn.microsoft.com/en-us/library/windows/desktop/cc144102.aspx
186 # .ShellClassInfo DeleteOnCopy LocalizedFileNames ASCII coded case-independent
187 >>&0 regex/c \^(\.ShellClassInfo|DeleteOnCopy|LocalizedFileNames)] Windows desktop.ini
188 !:mime application/x-wine-extension-ini
190 # http://support.microsoft.com/kb/84709/
191 >>&0 regex/c \^(don't\ load)] Windows CONTROL.INI
192 !:mime application/x-wine-extension-ini
193 >>&0 regex/c \^(ndishlp\\$|protman\\$|NETBEUI\\$)] Windows PROTOCOL.INI
194 !:mime application/x-wine-extension-ini
195 # http://technet.microsoft.com/en-us/library/cc722567.aspx
196 # http://www.winfaq.de/faq_html/Content/tip0000/onlinefaq.php?h=tip0137.htm
197 >>&0 regex/c \^(windows|Compatibility|embedding)] Windows WIN.INI
198 !:mime application/x-wine-extension-ini
199 # http://en.wikipedia.org/wiki/SYSTEM.INI
200 >>&0 regex/c \^(boot|386enh|drivers)] Windows SYSTEM.INI
201 !:mime application/x-wine-extension-ini
202 # http://www.mdgx.com/newtip6.htm
203 >>&0 regex/c \^(SafeList)] Windows IOS.INI
204 !:mime application/x-wine-extension-ini
205 # http://en.wikipedia.org/wiki/NTLDR Windows Boot Loader information
206 >>&0 regex/c \^(boot\x20loader)] Windows boot.ini
207 !:mime application/x-wine-extension-ini
209 # http://en.wikipedia.org/wiki/CONFIG.SYS
210 >>&0 regex/c \^(menu)]\r\n MS-DOS CONFIG.SYS
211 # http://support.microsoft.com/kb/118579/
212 >>&0 regex/c \^(Paths)]\r\n MS-DOS MSDOS.SYS
213 # VERS string unicoded case-independent
214 >>&0 ubequad&0xFFdfFFdfFFdfFFdf 0x0056004500520053
215 # ION] string unicoded case-independent
216 >>>&0 ubequad&0xFFdfFFdfFFdfFFff 0x0049004f004e005d Windows setup INFormation
217 !:mime application/x-setupscript
218 # STRI string unicoded case-independent
219 >>&0 ubequad&0xFFdfFFdfFFdfFFdf 0x0053005400520049
220 # NGS] string unicoded case-independent
221 >>>&0 ubequad&0xFFdfFFdfFFdfFFff 0x004e00470053005D Windows setup INFormation
222 !:mime application/x-setupscript
223 # unknown keyword after opening bracket
226 # version Strings FileIdentification
227 >>>>&0 string/c version Windows setup INFormation
228 !:mime application/x-setupscript
229 # VERS string unicoded case-independent
230 >>>>&0 ubequad&0xFFdfFFdfFFdfFFdf 0x0056004500520053
231 # ION] string unicoded case-independent
232 >>>>>&0 ubequad&0xFFdfFFdfFFdfFFff 0x0049004f004e005d Windows setup INFormation
233 !:mime application/x-setupscript
234 # http://en.wikipedia.org/wiki/Initialization_file Windows Initialization File or other
235 #>>>>&0 default x Generic INItialization configuration
236 #!:mime application/x-wine-extension-ini
238 # Windows Precompiled INF files *.PNF added by Joerg Jenderek at Mar 2013 of _PNF_HEADER inf.h
239 # http://read.pudn.com/downloads3/sourcecode/windows/248345/win2k/private/windows/setup/setupapi/inf.h__.htm
240 # GRR: line below too general as it catches also PDP-11 UNIX/RT ldp
241 0 leshort&0xFeFe 0x0000
243 # test for unused null bits in PNF_FLAGs
244 >4 ulelong&0xFCffFe00 0x00000000
245 # only found 58h for Offset of WinDirPath immediately after _PNF_HEADER structure
247 # test for zero high byte of InfValueBlockSize, followed by WinDirPath like
248 # C:\WINDOWS (ASCII 0x433a5c.. , unicode 0x43003a005c..) or X:\MININT
249 >>>(68.l-1) ubelong&0xffE0C519 =0x00400018 Windows Precompiled iNF
250 !:mime application/x-pnf
251 # currently only found Major Version=1 and Minor Version=1
252 #>>>>0 uleshort =0x0101
253 #>>>>>1 ubyte x \b, version %u
254 #>>>>>0 ubyte x \b.%u
255 >>>>0 uleshort !0x0101
256 >>>>>1 ubyte x \b, version %u
258 # 1 ,2 (windows 98 SE)
259 #>>>>2 uleshort =2 \b, InfStyle %u
260 >>>>2 uleshort !2 \b, InfStyle %u
261 # PNF_FLAG_IS_UNICODE 0x00000001
262 # PNF_FLAG_HAS_STRINGS 0x00000002
263 # PNF_FLAG_SRCPATH_IS_URL 0x00000004
264 # PNF_FLAG_HAS_VOLATILE_DIRIDS 0x00000008
265 # PNF_FLAG_INF_VERIFIED 0x00000010
266 # PNF_FLAG_INF_DIGITALLY_SIGNED 0x00000020
270 >>>>4 ulelong&0x00000001 0x00000001 \b, unicoded
271 >>>>4 ulelong&0x00000020 0x00000020 \b, digitally signed
272 #>>>>8 ulelong x \b, InfSubstValueListOffset 0x%x
273 # many 0, 1 lmouusb.PNF, 2 linkfx10.PNF , f webfdr16.PNF
274 #>>>>12 uleshort x \b, InfSubstValueCount 0x%x
276 #>>>>14 uleshort x \b, InfVersionDatumCount 0x%x
277 # only found values lower 0x0000ffff
278 #>>>>16 ulelong x \b, InfVersionDataSize 0x%x
279 # only found positive values lower 0x00ffFFff for InfVersionDataOffset
280 >>>>20 ulelong x \b, at 0x%x
281 >>>>4 ulelong&0x00000001 =0x00000001
282 # case independent: CatalogFile Class DriverVer layoutfile LayoutFile SetupClass signature Signature
283 >>>>>(20.l) lestring16 x "%s"
284 >>>>4 ulelong&0x00000001 !0x00000001
285 >>>>>(20.l) string x "%s"
286 # FILETIME is number of 100-nanosecond intervals since 1 January 1601
287 #>>>>24 ulequad x \b, InfVersionLastWriteTime %16.16llx
288 # only found values lower 0x00ffFFff
289 #>>>>32 ulelong x \b, StringTableBlockOffset 0x%x
290 #>>>>36 ulelong x \b, StringTableBlockSize 0x%x
291 #>>>>40 ulelong x \b, InfSectionCount 0x%x
292 #>>>>44 ulelong x \b, InfSectionBlockOffset 0x%x
293 #>>>>48 ulelong x \b, InfSectionBlockSize 0x%x
294 #>>>>52 ulelong x \b, InfLineBlockOffset 0x%x
295 #>>>>56 ulelong x \b, InfLineBlockSize 0x%x
296 #>>>>60 ulelong x \b, InfValueBlockOffset 0x%x
297 #>>>>64 ulelong x \b, InfValueBlockSize 0x%x
299 #>>>>68 ulelong x \b, at 0x%x
301 >>>>>4 ulelong&0x00000001 =0x00000001
302 >>>>>>(68.l) ubequad =0x43003a005c005700
303 # normally unicoded C:\Windows
304 #>>>>>>>(68.l) lestring16 x \b, WinDirPath "%s"
305 >>>>>>(68.l) ubequad !0x43003a005c005700
306 >>>>>>>(68.l) lestring16 x \b, WinDirPath "%s"
307 >>>>>4 ulelong&0x00000001 !0x00000001
308 # normally ASCII C:\WINDOWS
309 #>>>>>>(68.l) string =C:\\WINDOWS \b, WinDirPath "%s"
310 >>>>>>(68.l) string !C:\\WINDOWS \b, WinDirPath "%s"
311 # found OsLoaderPathOffset values often 0 , once 70h corelist.PNF, once 68h ASCII machine.PNF
312 #>>>>72 ulelong >0 \b, at 0x%x
313 >>>>72 ulelong >0 \b,
314 >>>>>4 ulelong&0x00000001 =0x00000001
315 >>>>>>(72.l) lestring16 x OsLoaderPath "%s"
316 >>>>>4 ulelong&0x00000001 !0x00000001
317 # seldom C:\ instead empty
318 >>>>>>(72.l) string x OsLoaderPath "%s"
320 #>>>>76 uleshort x \b, StringTableHashBucketCount 0x%x
321 >>>>78 uleshort !0x407 \b, LanguageId %x
323 #>>>>78 uleshort =0x407 \b, LanguageId %x
324 # InfSourcePathOffset often 0
325 #>>>>80 ulelong >0 \b, at 0x%x
326 >>>>80 ulelong >0 \b,
327 >>>>>4 ulelong&0x00000001 =0x00000001
328 >>>>>>(80.l) lestring16 x SourcePath "%s"
329 >>>>>4 ulelong&0x00000001 !0x00000001
330 >>>>>>(80.l) string >\0 SourcePath "%s"
331 # OriginalInfNameOffset often 0
332 #>>>>84 ulelong >0 \b, at 0x%x
333 >>>>84 ulelong >0 \b,
334 >>>>>4 ulelong&0x00000001 =0x00000001
335 >>>>>>(84.l) lestring16 x InfName "%s"
336 >>>>>4 ulelong&0x00000001 !0x00000001
337 >>>>>>(84.l) string >\0 InfName "%s"