windows revision 288143
129088Smarkm
229088Smarkm#------------------------------------------------------------------------------
329088Smarkm# $File: windows,v 1.12 2015/08/29 07:10:35 christos Exp $
429088Smarkm# windows:  file(1) magic for Microsoft Windows
529088Smarkm#
629088Smarkm# This file is mainly reserved for files where programs
729088Smarkm# using them are run almost always on MS Windows 3.x or
829088Smarkm# above, or files only used exclusively in Windows OS,
929088Smarkm# where there is no better category to allocate for.
1029088Smarkm# For example, even though WinZIP almost run on Windows
1129088Smarkm# only, it is better to treat them as "archive" instead.
1229088Smarkm# For format usable in DOS, such as generic executable
1329088Smarkm# format, please specify under "msdos" file.
1429088Smarkm#
1529088Smarkm
1629088Smarkm
1729088Smarkm# Summary: Outlook Express DBX file
1829088Smarkm# Extension: .dbx
1929088Smarkm# Created by: Christophe Monniez
2029088Smarkm0	string	\xCF\xAD\x12\xFE	MS Outlook Express DBX file
2129088Smarkm>4	byte	=0xC5			\b, message database
2229088Smarkm>4	byte	=0xC6			\b, folder database
2329088Smarkm>4	byte	=0xC7			\b, account information
2429088Smarkm>4	byte	=0x30			\b, offline database
2529088Smarkm
2629088Smarkm
2729088Smarkm# Summary: Windows crash dump
2829088Smarkm# Extension: .dmp
2929088Smarkm# Created by: Andreas Schuster (http://computer.forensikblog.de/)
3029088Smarkm# Reference (1): http://computer.forensikblog.de/en/2008/02/64bit_magic.html
3129088Smarkm# Modified by (1): Abel Cheung (Avoid match with first 4 bytes only)
3229088Smarkm0	string		PAGE		
3329088Smarkm>4	string		DUMP		MS Windows 32bit crash dump
3484305Smarkm>>0x05c	byte            0		\b, no PAE
3587139Smarkm>>0x05c	byte            1		\b, PAE
3684305Smarkm>>0xf88	lelong		1		\b, full dump
3784305Smarkm>>0xf88	lelong		2		\b, kernel dump
3829088Smarkm>>0xf88	lelong		3		\b, small dump
3929088Smarkm>>0x068	lelong		x		\b, %d pages
4029088Smarkm>4	string		DU64		MS Windows 64bit crash dump
4129088Smarkm>>0xf98	lelong		1		\b, full dump
4229088Smarkm>>0xf98	lelong		2		\b, kernel dump
4329088Smarkm>>0xf98	lelong		3		\b, small dump
4429088Smarkm>>0x090	lequad		x		\b, %lld pages
4529088Smarkm
4629088Smarkm
4729088Smarkm# Summary: Vista Event Log
4829088Smarkm# Extension: .evtx
4929088Smarkm# Created by: Andreas Schuster (http://computer.forensikblog.de/)
5029088Smarkm# Reference (1): http://computer.forensikblog.de/en/2007/05/some_magic.html
5129088Smarkm0	string		ElfFile\0	MS Windows Vista Event Log
5229088Smarkm>0x2a	leshort		x		\b, %d chunks
5329088Smarkm>>0x10	lelong		x		\b (no. %d in use)
5429088Smarkm>0x18	lelong		>1		\b, next record no. %d
5529088Smarkm>0x18	lelong		=1		\b, empty
5629088Smarkm>0x78	lelong		&1		\b, DIRTY
5729088Smarkm>0x78	lelong		&2		\b, FULL
5829088Smarkm
5929088Smarkm
6029088Smarkm# Summary: Windows 3.1 group files
6129088Smarkm# Extension: .grp
6229088Smarkm# Created by: unknown
6329088Smarkm0	string		\120\115\103\103	MS Windows 3.1 group files
6429088Smarkm
6529088Smarkm
6629088Smarkm# Summary: Old format help files
6729088Smarkm# Extension: .hlp
6829088Smarkm# Created by: Dirk Jagdmann <doj@cubic.org>
6929088Smarkm0	lelong		0x00035f3f		MS Windows 3.x help file
7029088Smarkm
7129088Smarkm
7229088Smarkm# Summary: Hyper terminal
7329088Smarkm# Extension: .ht
7429088Smarkm# Created by: unknown
7529088Smarkm0	string		HyperTerminal\ 
7629088Smarkm>15	string		1.0\ --\ HyperTerminal\ data\ file	MS Windows HyperTerminal profile
7729088Smarkm
7829088Smarkm# http://ithreats.files.wordpress.com/2009/05/\
7929088Smarkm# lnk_the_windows_shortcut_file_format.pdf
8029088Smarkm# Summary: Windows shortcut
8129088Smarkm# Extension: .lnk
8229088Smarkm# Created by: unknown
8329088Smarkm# 'L' + GUUID
8429088Smarkm0	string		\114\0\0\0\001\024\002\0\0\0\0\0\300\0\0\0\0\0\0\106	MS Windows shortcut
8529088Smarkm>20	lelong&1	1	\b, Item id list present
8629088Smarkm>20	lelong&2	2	\b, Points to a file or directory
8729088Smarkm>20	lelong&4	4	\b, Has Description string
8829088Smarkm>20	lelong&8	8	\b, Has Relative path
8929088Smarkm>20	lelong&16	16	\b, Has Working directory
9029088Smarkm>20	lelong&32	32	\b, Has command line arguments
9129088Smarkm>20	lelong&64	64	\b, Icon
9229088Smarkm>>56	lelong		x	\b number=%d
9329088Smarkm>24	lelong&1	1	\b, Read-Only
9429088Smarkm>24	lelong&2	2	\b, Hidden
9529088Smarkm>24	lelong&4	4	\b, System
9629088Smarkm>24	lelong&8	8	\b, Volume Label
9729088Smarkm>24	lelong&16	16	\b, Directory
9829088Smarkm>24	lelong&32	32	\b, Archive
9929088Smarkm>24	lelong&64	64	\b, Encrypted
10029088Smarkm>24	lelong&128	128	\b, Normal
10129088Smarkm>24	lelong&256	256	\b, Temporary
10229088Smarkm>24	lelong&512	512	\b, Sparse
10329088Smarkm>24	lelong&1024	1024	\b, Reparse point
10429088Smarkm>24	lelong&2048	2048	\b, Compressed
10529088Smarkm>24	lelong&4096	4096	\b, Offline
10629088Smarkm>28	leqwdate	x	\b, ctime=%s
10729088Smarkm>36	leqwdate	x	\b, mtime=%s
10829088Smarkm>44	leqwdate	x	\b, atime=%s
10929088Smarkm>52	lelong		x	\b, length=%u, window=
11029088Smarkm>60	lelong&1	1	\bhide
11129088Smarkm>60	lelong&2	2	\bnormal
11229088Smarkm>60	lelong&4	4	\bshowminimized
11329088Smarkm>60	lelong&8	8	\bshowmaximized
11429088Smarkm>60	lelong&16	16	\bshownoactivate
11529088Smarkm>60	lelong&32	32	\bminimize
11629088Smarkm>60	lelong&64	64	\bshowminnoactive
11729088Smarkm>60	lelong&128	128	\bshowna
11829088Smarkm>60	lelong&256	256	\brestore
11929088Smarkm>60	lelong&512	512	\bshowdefault
12029088Smarkm#>20	lelong&1	0
12129088Smarkm#>>20	lelong&2	2
12229088Smarkm#>>>(72.l-64)	pstring/h	x	\b [%s]
12329088Smarkm#>20	lelong&1	1
12429088Smarkm#>>20	lelong&2	2
12529088Smarkm#>>>(72.s)	leshort	x
12629088Smarkm#>>>&75	pstring/h	x	\b [%s]
12729088Smarkm
12829088Smarkm# Summary: Outlook Personal Folders
12929088Smarkm# Created by: unknown
13029088Smarkm0	lelong		0x4E444221	Microsoft Outlook email folder
13129088Smarkm>10	leshort		0x0e		(<=2002)
13229088Smarkm>10	leshort		0x17		(>=2003)
13329088Smarkm
13429088Smarkm
13529088Smarkm# Summary: Windows help cache
13629088Smarkm# Created by: unknown
13729088Smarkm0	string		\164\146\115\122\012\000\000\000\001\000\000\000	MS Windows help cache
13829088Smarkm
13929088Smarkm
14029088Smarkm# Summary: IE cache file
14129088Smarkm# Created by: Christophe Monniez
14229088Smarkm0	string	Client\ UrlCache\ MMF 	Internet Explorer cache file
14329088Smarkm>20	string	>\0			version %s
14429088Smarkm
14529088Smarkm
14629088Smarkm# Summary: Registry files
14729088Smarkm# Created by: unknown
14829088Smarkm# Modified by (1): Joerg Jenderek
14929088Smarkm0	string		regf		MS Windows registry file, NT/2000 or above
15029088Smarkm0	string		CREG		MS Windows 95/98/ME registry file
15129088Smarkm0	string		SHCC3		MS Windows 3.1 registry file
15229088Smarkm
15329088Smarkm
15429088Smarkm# Summary: Windows Registry text
15529088Smarkm# Extension: .reg
15629088Smarkm# Submitted by: Abel Cheung <abelcheung@gmail.com>
15729088Smarkm0	string		REGEDIT4\r\n\r\n	Windows Registry text (Win95 or above)
15829088Smarkm0	string		Windows\ Registry\ Editor\ 
15929088Smarkm>&0	string		Version\ 5.00\r\n\r\n	Windows Registry text (Win2K or above)
16029088Smarkm
16129088Smarkm# Windows *.INF *.INI files updated by Joerg Jenderek at Apr 2013
16229088Smarkm# empty ,comment , section
16329088Smarkm# PR/383: remove unicode BOM because it is not portable across regex impls
16429088Smarkm0	regex/s		\\`(\\r\\n|;|[[])
16529088Smarkm# left bracket in section line
16629088Smarkm>&0	search/8192	[						
16729088Smarkm# http://en.wikipedia.org/wiki/Autorun.inf
16829088Smarkm# http://msdn.microsoft.com/en-us/library/windows/desktop/cc144200.aspx
16929088Smarkm>>&0	regex/c		\^(autorun)]\r\n				
17029088Smarkm>>>&0	ubyte		=0x5b						INItialization configuration
17129088Smarkm!:mime application/x-wine-extension-ini
17229088Smarkm# From: Pal Tamas <folti@balabit.hu>
17329088Smarkm# Autorun File
17429088Smarkm>>>&0	ubyte		!0x5b						Microsoft Windows Autorun file
17529088Smarkm!:mime application/x-setupscript
17629088Smarkm# http://msdn.microsoft.com/en-us/library/windows/hardware/ff549520(v=vs.85).aspx
17729088Smarkm# version strings ASCII coded case-independent for Windows setup information script file
17829088Smarkm>>&0	regex/c		\^(version|strings)]				Windows setup INFormation
17929088Smarkm!:mime	application/x-setupscript
18029088Smarkm#!:mime application/inf
18129088Smarkm#!:mime application/x-wine-extension-inf
18229088Smarkm>>&0	regex/c		\^(WinsockCRCList|OEMCPL)]			Windows setup INFormation
18329088Smarkm!:mime	text/inf
18429088Smarkm# http://www.winfaq.de/faq_html/Content/tip2500/onlinefaq.php?h=tip2653.htm
18529088Smarkm# http://msdn.microsoft.com/en-us/library/windows/desktop/cc144102.aspx
18629088Smarkm# .ShellClassInfo DeleteOnCopy LocalizedFileNames ASCII coded case-independent
18729088Smarkm>>&0	regex/c	\^(\.ShellClassInfo|DeleteOnCopy|LocalizedFileNames)]	Windows desktop.ini
18829088Smarkm!:mime application/x-wine-extension-ini
18929088Smarkm#!:mime text/plain
19029088Smarkm# http://support.microsoft.com/kb/84709/
19129088Smarkm>>&0	regex/c		\^(don't\ load)]				Windows CONTROL.INI
19229088Smarkm!:mime application/x-wine-extension-ini
19329088Smarkm>>&0	regex/c		\^(ndishlp\\$|protman\\$|NETBEUI\\$)]		Windows PROTOCOL.INI
19429088Smarkm!:mime application/x-wine-extension-ini
19529088Smarkm# http://technet.microsoft.com/en-us/library/cc722567.aspx
19629088Smarkm# http://www.winfaq.de/faq_html/Content/tip0000/onlinefaq.php?h=tip0137.htm
19729088Smarkm>>&0	regex/c		\^(windows|Compatibility|embedding)]		Windows WIN.INI
19829088Smarkm!:mime application/x-wine-extension-ini
19929088Smarkm# http://en.wikipedia.org/wiki/SYSTEM.INI
20029088Smarkm>>&0	regex/c		\^(boot|386enh|drivers)]			Windows SYSTEM.INI
20129088Smarkm!:mime application/x-wine-extension-ini
20229088Smarkm# http://www.mdgx.com/newtip6.htm
20329088Smarkm>>&0	regex/c		\^(SafeList)]					Windows IOS.INI
20429088Smarkm!:mime application/x-wine-extension-ini
20529088Smarkm# http://en.wikipedia.org/wiki/NTLDR	Windows Boot Loader information
20629088Smarkm>>&0	regex/c		\^(boot\x20loader)]				Windows boot.ini
20729088Smarkm!:mime application/x-wine-extension-ini
20829088Smarkm>>>&0	ubyte		x						
20929088Smarkm# http://en.wikipedia.org/wiki/CONFIG.SYS
21029088Smarkm>>&0	regex/c		\^(menu)]\r\n					MS-DOS CONFIG.SYS
21129088Smarkm# http://support.microsoft.com/kb/118579/
21229088Smarkm>>&0	regex/c		\^(Paths)]\r\n					MS-DOS MSDOS.SYS
21329088Smarkm# VERS string unicoded case-independent
21429088Smarkm>>&0	ubequad&0xFFdfFFdfFFdfFFdf	0x0056004500520053		
21529088Smarkm# ION] string unicoded case-independent
21629088Smarkm>>>&0	ubequad&0xFFdfFFdfFFdfFFff	0x0049004f004e005d		Windows setup INFormation 
21729088Smarkm!:mime application/x-setupscript
21829088Smarkm# STRI string unicoded case-independent
21929088Smarkm>>&0	ubequad&0xFFdfFFdfFFdfFFdf	0x0053005400520049		
22029088Smarkm# NGS] string unicoded case-independent
22129088Smarkm>>>&0	ubequad&0xFFdfFFdfFFdfFFff	0x004e00470053005D		Windows setup INFormation 
22229088Smarkm!:mime application/x-setupscript
22329088Smarkm# unknown keyword after opening bracket
22429088Smarkm>>&0	default				x				
22529088Smarkm>>>&0	search/8192			[				
22629088Smarkm# version Strings FileIdentification
22729088Smarkm>>>>&0	string/c			version				Windows setup INFormation 
22829088Smarkm!:mime application/x-setupscript
22929088Smarkm# VERS string unicoded case-independent
23029088Smarkm>>>>&0	ubequad&0xFFdfFFdfFFdfFFdf	0x0056004500520053		
23129088Smarkm# ION] string unicoded case-independent
23229088Smarkm>>>>>&0	ubequad&0xFFdfFFdfFFdfFFff	0x0049004f004e005d		Windows setup INFormation 
23329088Smarkm!:mime application/x-setupscript
23429088Smarkm# http://en.wikipedia.org/wiki/Initialization_file	Windows Initialization File or other
23529088Smarkm#>>>>&0	default				x				Generic INItialization configuration
23629088Smarkm#!:mime application/x-wine-extension-ini
23729088Smarkm
23829088Smarkm# Windows Precompiled INF files *.PNF added by Joerg Jenderek at Mar 2013 of _PNF_HEADER inf.h
23929088Smarkm# http://read.pudn.com/downloads3/sourcecode/windows/248345/win2k/private/windows/setup/setupapi/inf.h__.htm
24029088Smarkm# GRR: line below too general as it catches also PDP-11 UNIX/RT ldp
24129088Smarkm0		leshort&0xFeFe	0x0000		
24229088Smarkm!:strength -5
24329088Smarkm# test for unused null bits in PNF_FLAGs
24429088Smarkm>4	ulelong&0xFCffFe00	0x00000000	
24529088Smarkm# only found 58h for Offset of WinDirPath immediately after _PNF_HEADER structure
24629088Smarkm>>68		ulelong		>0x57		
24729088Smarkm# test for zero high byte of InfValueBlockSize, followed by WinDirPath like
24829088Smarkm# C:\WINDOWS (ASCII 0x433a5c.. , unicode 0x43003a005c..) or X:\MININT
24929088Smarkm>>>(68.l-1)	ubelong&0xffE0C519	=0x00400018	Windows Precompiled iNF
25029088Smarkm!:mime	application/x-pnf
25129088Smarkm# currently only found Major Version=1 and Minor Version=1
25229088Smarkm#>>>>0		uleshort	=0x0101		
25329088Smarkm#>>>>>1		ubyte		x		\b, version %u
25429088Smarkm#>>>>>0		ubyte		x		\b.%u
25529088Smarkm>>>>0		uleshort	!0x0101		
25629088Smarkm>>>>>1		ubyte		x		\b, version %u
25729088Smarkm>>>>>0		ubyte		x		\b.%u
25829088Smarkm# 1 ,2 (windows 98 SE)
25929088Smarkm#>>>>2		uleshort	=2		\b, InfStyle %u
26029088Smarkm>>>>2		uleshort	!2		\b, InfStyle %u
26129088Smarkm#	PNF_FLAG_IS_UNICODE		0x00000001
26229088Smarkm#	PNF_FLAG_HAS_STRINGS		0x00000002
26329088Smarkm#	PNF_FLAG_SRCPATH_IS_URL		0x00000004
26429088Smarkm#	PNF_FLAG_HAS_VOLATILE_DIRIDS	0x00000008
26529088Smarkm#	PNF_FLAG_INF_VERIFIED		0x00000010
26629088Smarkm#	PNF_FLAG_INF_DIGITALLY_SIGNED	0x00000020
26729088Smarkm#	??				0x00000100
26829088Smarkm#	??				0x01000000
26929088Smarkm#	??				0x02000000
27029088Smarkm>>>>4	ulelong&0x00000001	0x00000001	\b, unicoded
27129088Smarkm>>>>4	ulelong&0x00000020	0x00000020	\b, digitally signed
27229088Smarkm#>>>>8		ulelong		x		\b, InfSubstValueListOffset 0x%x
27329088Smarkm# many 0, 1 lmouusb.PNF, 2 linkfx10.PNF , f webfdr16.PNF
27429088Smarkm#>>>>12		uleshort	x		\b, InfSubstValueCount 0x%x
27529088Smarkm# only < 9 found
27629088Smarkm#>>>>14		uleshort	x		\b, InfVersionDatumCount 0x%x
27729088Smarkm# only found values lower 0x0000ffff
27829088Smarkm#>>>>16		ulelong		x		\b, InfVersionDataSize 0x%x
27929088Smarkm# only found positive values lower 0x00ffFFff for InfVersionDataOffset
28029088Smarkm>>>>20		ulelong		x		\b, at 0x%x
28129088Smarkm>>>>4	ulelong&0x00000001	=0x00000001	
28229088Smarkm# case independent: CatalogFile Class DriverVer layoutfile LayoutFile SetupClass signature Signature    
28329088Smarkm>>>>>(20.l)	lestring16	x		"%s"
28429088Smarkm>>>>4	ulelong&0x00000001	!0x00000001	
28529088Smarkm>>>>>(20.l)	string		x		"%s"
28629088Smarkm# FILETIME is number of 100-nanosecond intervals since 1 January 1601
28729088Smarkm#>>>>24		ulequad		x		\b, InfVersionLastWriteTime %16.16llx
28829088Smarkm# only found values lower 0x00ffFFff
28929088Smarkm#>>>>32		ulelong		x		\b, StringTableBlockOffset 0x%x
29029088Smarkm#>>>>36		ulelong		x		\b, StringTableBlockSize 0x%x
29129088Smarkm#>>>>40		ulelong		x		\b, InfSectionCount 0x%x
29229088Smarkm#>>>>44		ulelong		x		\b, InfSectionBlockOffset 0x%x
29329088Smarkm#>>>>48		ulelong		x		\b, InfSectionBlockSize 0x%x
29429088Smarkm#>>>>52		ulelong		x		\b, InfLineBlockOffset 0x%x
29529088Smarkm#>>>>56		ulelong		x		\b, InfLineBlockSize 0x%x
29629088Smarkm#>>>>60		ulelong		x		\b, InfValueBlockOffset 0x%x
29729088Smarkm#>>>>64		ulelong		x		\b, InfValueBlockSize 0x%x
29829088Smarkm# WinDirPathOffset
29929088Smarkm#>>>>68		ulelong		x		\b, at 0x%x
30029088Smarkm>>>>68		ulelong		>0x57		
30129088Smarkm>>>>>4	ulelong&0x00000001	=0x00000001	
30229088Smarkm>>>>>>(68.l)	ubequad		=0x43003a005c005700			
30329088Smarkm# normally unicoded C:\Windows
30429088Smarkm#>>>>>>>(68.l)	lestring16	x		\b, WinDirPath "%s"
30529088Smarkm>>>>>>(68.l)	ubequad		!0x43003a005c005700			
30629088Smarkm>>>>>>>(68.l)	lestring16	x		\b, WinDirPath "%s"
30729088Smarkm>>>>>4	ulelong&0x00000001	!0x00000001	
30829088Smarkm# normally ASCII C:\WINDOWS
30929088Smarkm#>>>>>>(68.l)	string		=C:\\WINDOWS	\b, WinDirPath "%s"
31029088Smarkm>>>>>>(68.l)	string		!C:\\WINDOWS	\b, WinDirPath "%s"
31129088Smarkm# found OsLoaderPathOffset values often 0 , once 70h corelist.PNF, once 68h ASCII machine.PNF 
31229088Smarkm#>>>>72		ulelong		>0		\b, at 0x%x
31329088Smarkm>>>>72		ulelong		>0		\b,
31429088Smarkm>>>>>4	ulelong&0x00000001	=0x00000001	
31529088Smarkm>>>>>>(72.l)	lestring16	x		OsLoaderPath "%s"
31629088Smarkm>>>>>4	ulelong&0x00000001	!0x00000001	
31729088Smarkm# seldom C:\ instead empty
31829088Smarkm>>>>>>(72.l)	string		x		OsLoaderPath "%s"
31929088Smarkm# 1fdh
32029088Smarkm#>>>>76		uleshort	x		\b, StringTableHashBucketCount 0x%x
32129088Smarkm>>>>78		uleshort	!0x407		\b, LanguageId %x
32229088Smarkm# only 407h found
32329088Smarkm#>>>>78		uleshort	=0x407		\b, LanguageId %x
32429088Smarkm# InfSourcePathOffset often 0
32529088Smarkm#>>>>80		ulelong		>0		\b, at 0x%x
32629088Smarkm>>>>80		ulelong		>0		\b,
32729088Smarkm>>>>>4	ulelong&0x00000001	=0x00000001	
32829088Smarkm>>>>>>(80.l)	lestring16	x		SourcePath "%s"
32929088Smarkm>>>>>4	ulelong&0x00000001	!0x00000001	
33029088Smarkm>>>>>>(80.l)	string		>\0		SourcePath "%s"
33129088Smarkm# OriginalInfNameOffset often 0
33229088Smarkm#>>>>84		ulelong		>0		\b, at 0x%x
33329088Smarkm>>>>84		ulelong		>0		\b,
33429088Smarkm>>>>>4	ulelong&0x00000001	=0x00000001	
33529088Smarkm>>>>>>(84.l)	lestring16	x		InfName "%s"
33629088Smarkm>>>>>4	ulelong&0x00000001	!0x00000001	
33729088Smarkm>>>>>>(84.l)	string		>\0		InfName "%s"
33829088Smarkm
33929088Smarkm