]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - contrib/file/magic/Magdir/windows
MFC r362258, r362279: file 5.39
[FreeBSD/FreeBSD.git] / contrib / file / magic / Magdir / windows
1
2 #------------------------------------------------------------------------------
3 # $File: windows,v 1.31 2020/03/15 16:44:37 christos Exp $
4 # windows:  file(1) magic for Microsoft Windows
5 #
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.
14 #
15
16
17 # Summary: Outlook Express DBX file
18 # Extension: .dbx
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
25
26
27 # Summary: Windows crash dump
28 # Extension: .dmp
29 # Created by: Andreas Schuster (https://computer.forensikblog.de/)
30 # Reference (1): https://computer.forensikblog.de/en/2008/02/64bit_magic.html
31 # Modified by (1): Abel Cheung (Avoid match with first 4 bytes only)
32 0       string          PAGE
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
45
46
47 # Summary: Vista Event Log
48 # Extension: .evtx
49 # Created by: Andreas Schuster (https://computer.forensikblog.de/)
50 # Reference (1): https://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
58
59 # Summary: Windows System Deployment Image
60 # Created by: Joerg Jenderek
61 # URL: http://en.wikipedia.org/wiki/System_Deployment_Image
62 # Reference: http://skolk.livejournal.com/1320.html
63 0       string                  $SDI
64 >4      string                  0001            System Deployment Image
65 !:mime  application/x-ms-sdi
66 #!:mime application/octet-stream
67 # \Boot\boot.sdi
68 !:ext   sdi
69 # MDBtype: 0~Unspecified 1~RAM 2~ROM
70 >>8     ulequad                 !0              \b, MDBtype 0x%llx
71 # BootCodeOffset
72 >>16    ulequad                 !0              \b, BootCodeOffset 0x%llx
73 # BootCodeSize
74 >>24    ulequad                 !0              \b, BootCodeSize 0x%llx
75 # VendorID
76 >>32    ulequad                 !0              \b, VendorID 0x%llx
77 # DeviceID
78 >>40    ulequad                 !0              \b, DeviceID 0x%llx
79 # DeviceModel
80 >>48    ulequad                 !0              \b, DeviceModel 0x%llx
81 >>>56   ulequad                 !0              \b%llx
82 # DeviceRole
83 >>64    ulequad                 !0              \b, DeviceRole 0x%llx
84 # Reserved1; reserved fields and gaps between BLOBs are padded with \0
85 #>>72   ulequad                 !0              \b, Reserved1 0x%llx
86 # RuntimeGUID
87 >>80    ulequad                 !0              \b, RuntimeGUID 0x%llx
88 >>>88   ulequad                 !0              \b%llx
89 # RuntimeOEMrev
90 >>96    ulequad                 !0              \b, RuntimeOEMrev 0x%llx
91 # Reserved2
92 #>>104  ulequad                 !0              \b, Reserved2 0x%llx
93 # BLOB alignment value in pages, as specified in sdimgr /pack: 1~4K 2~8k
94 >>112   ulequad                 !0              \b, PageAlignment %llu
95 # Reserved3[48]
96 #>>120  ulequad                 !0              \b, Reserved3 0x%llx
97 # SDI checksum 39h
98 >>0x1f8 ulequad                 x               \b, checksum 0x%llx
99 # BLOBtype[8] \0-padded: PART, WIM , BOOT, LOAD, DISK
100 >>0x400 string                  >\0             \b, type %-3.8s
101 # 0~non-filesystem 7~NTFS 6~BIGFAT
102 >>>0x420        ulequad         !0              (0x%llx)
103 # ATTRibutes
104 >>>0x408        ulequad         !0              0x%llx attributes
105 # Offset
106 >>>0x410        ulequad         x               at 0x%llx
107 # print 1 space after size and then handles NTFS boot sector by ./filesystems
108 >>>0x418        ulequad         >0              %llu bytes 
109 >>>>(0x410.l)   indirect        x
110 # 2nd BLOB: WIM
111 >>0x440         string          >\0             \b, type %-3.8s
112 >>>0x428        ulequad         !0              (0x%llx)
113 # ATTRibutes
114 >>>0x448        ulequad         !0              0x%llx attributes
115 # Offset
116 >>>0x450        ulequad         x               at 0x%llx
117 >>>0x458        ulequad         >0              %llu bytes 
118 >>>>(0x450.l)   indirect        x
119 # 3rd BLOB
120 >>0x480         string          >\0             \b, type %-3.8s
121
122 # Summary:      Windows boot status log BOOTSTAT.DAT
123 # From:         Joerg Jenderek
124 # Reference:    https://www.geoffchappell.com/notes/windows/boot/bsd.htm
125 # Note:         mainly refers to older Windows Vista, sometimes
126 #               BOOTSTAT.DAT only contains nulls or invalid data
127 # checking for valid version below 5
128 0               ulelong         <5
129 # skip many ISO images by checking for valid 64 KiB file size
130 >8              ulelong         =0x00010000
131 >>0             use             bootstat-dat
132 # display information of BOOTSTAT.DAT
133 0       name            bootstat-dat
134 >0              ulelong         x               Windows boot log
135 #!:mime application/octet-stream
136 !:mime  application/x-ms-dat
137 # BOOTSTAT.DAT in BOOT subdirectory
138 !:ext   dat
139 # apparently a version number: 2 for older like Vista, 3, 4 Windows 10
140 >0              ulelong         >2              \b, version %u
141 # apparently the size of the header: often 10h in older Windows, 14h, 18h
142 >4              ulelong         !0x10           \b, header size 0x%x
143 #>4             ulelong         !0x10           \b, header size %u
144 # apparently the size of the file: always 0x00010000~64KiB
145 # the file is acceptable to BOOTMGR only if it is exactly 64 KiB
146 >8              ulelong         !0x00010000     \b, file size 0x%x
147 # size of valid data, in bytes: C8h 50h 172h 5D5Ch
148 >0xc            ulelong         x               \b, 0x%x valid bytes
149 # skip header and jump to first bootstat entry and display information
150 >(0x4.l-1)      ubyte           x
151 >>&0            use             bootstat-entry
152 # jump to first entry again because pointer are bad after "use"
153 >(0x4.l-1)      ubyte           x
154 # by 1st entry size jump to 2nd entry and display information
155 >>&(&0x18.l-1)  ubyte           x
156 >>>&0           use             bootstat-entry
157 # jump to possible 3rd boot entry and display information
158 # >(0x4.l-1)    ubyte           x
159 # >>&(&0x18.l-1)        ubyte           x
160 # >>>&(&0x18.l-1)       ubyte           x
161 # >>>>&0                use             bootstat-entry
162 #       display BOOTSTAT.DAT entry
163 0       name            bootstat-entry
164 #>0x00          ubequad         x               \b, ENTRY %16.16llx
165 # size of entry, in bytes: 40h(init) 78h(launced) 9Ch
166 #>0x18          ulelong         x               \b; entry size %u
167 >0x18           ulelong         x               \b; entry size 0x%x
168 # time stamp, in seconds 
169 >0x00           ulelong         x               \b, 0x%x seconds
170 # always zero, significance unknown
171 >0x04           ulelong         !0              \b, not null %u
172 # GUID of event source; but empty if event source is BOOTMGR 
173 >0x08           ubequad         !0              \b, GUID 0x%16.16llx
174 >>0x10          ubequad         x               \b%16.16llx
175 # severity code: 1~informational 3~errors
176 >0x1C           ulelong         !1              \b, severity 0x%x
177 # apparently a version number: 2 
178 >0x20           ulelong         !2              \b, version %u
179 # event identifier 1~log file initialised 11h~boot application launched 
180 #>0x24          ulelong         x               \b, event 0x%x
181 >0x24           ulelong         !1
182 >>0x24          ulelong         !0x11           \b, event 0x%x
183 # entry data; size depends on event identifier  
184 #>0x28          ubequad         x               \b, data 0x%16.16llx
185 >0x24           ulelong         =0x1            \b, Init
186 # always 0, significance unknown 
187 >>0x34          uleshort        !0              \b, not null %u
188 # always 7, significance unknown 
189 >>0x36          uleshort        !7              \b, not seven %u
190 # year
191 >>0x28          uleshort        x               %u
192 # month
193 >>0x2A          uleshort        x               \b-%u
194 # day
195 >>0x2C          uleshort        x               \b-%u
196 # hour
197 >>0x2E          uleshort        x               %u
198 # minute
199 >>0x30          uleshort        x               \b:%u
200 # second
201 >>0x32          uleshort        x               \b:%u
202 # boot application launched
203 >0x24           ulelong         =0x11           \b, launched
204 # type of start: 0 normally, 1 or 2 maybe in a recovery sequence
205 >>0x38          uleshort        !0              \b, type %u
206 # pathname of boot application, as null-terminated Unicode string; typically
207 # \Windows\system32\winload.exe \Windows\system32\winload.efi
208 >>0x3C          lestring16      x               %s
209
210 # Summary:      Windows Error Report text files
211 # URL:          https://en.wikipedia.org/wiki/Windows_Error_Reporting
212 # Reference:    https://www.nirsoft.net/utils/app_crash_view.html
213 # Created by:   Joerg Jenderek
214 # Note:         in directories  %ProgramData%\Microsoft\Windows\WER\{ReportArchive,ReportQueue}
215 #                               %LOCALAPPDATA%\Microsoft\Windows\WER\{ReportArchive,ReportQueue}
216 0       lestring16      Version=        
217 >22     lestring16      EventType       Windows Error Report
218 !:mime  text/plain
219 # Report.wer
220 !:ext   wer
221
222 # Summary: Windows 3.1 group files
223 # Extension: .grp
224 # Created by: unknown
225 0       string          \120\115\103\103        MS Windows 3.1 group files
226
227
228 # Summary: Old format help files
229 # URL: https://en.wikipedia.org/wiki/WinHelp
230 # Reference: https://www.oocities.org/mwinterhoff/helpfile.htm
231 # Update: Joerg Jenderek
232 # Created by: Dirk Jagdmann <doj@cubic.org>
233 #
234 # check and then display version and date inside MS Windows HeLP file fragment
235 0       name                            help-ver-date
236 # look for Magic of SYSTEMHEADER
237 >0      leshort         0x036C
238 # version Major         1 for right file fragment
239 >>4     leshort         1               Windows
240 # print non empty string above to avoid error message
241 # Warning: Current entry does not yet have a description for adding a MIME type
242 !:mime  application/winhelp
243 !:ext   hlp
244 # version Minor of help file format is hint for windows version
245 >>>2    leshort         0x0F            3.x
246 >>>2    leshort         0x15            3.0
247 >>>2    leshort         0x21            3.1
248 >>>2    leshort         0x27            x.y
249 >>>2    leshort         0x33            95
250 >>>2    default         x               y.z
251 >>>>2   leshort         x               0x%x
252 # to complete message string like "MS Windows 3.x help file"
253 >>>2    leshort         x               help
254 # GenDate often older than file creation date
255 >>>6    ldate           x               \b, %s
256 #
257 # Magic for HeLP files
258 0       lelong          0x00035f3f
259 # ./windows (version 5.25) labeled the entry as "MS Windows 3.x help file"
260 # file header magic 0x293B at DirectoryStart+9
261 >(4.l+9)        uleshort        0x293B          MS
262 # look for @VERSION     bmf.. like IBMAVW.ANN
263 >>0xD4          string  =\x62\x6D\x66\x01\x00   Windows help annotation
264 !:mime  application/x-winhelp
265 !:ext   ann
266 >>0xD4          string  !\x62\x6D\x66\x01\x00
267 # "GID Help index" by TrID
268 >>>(4.l+0x65)   string  =|Pete                  Windows help Global Index
269 !:mime  application/x-winhelp
270 !:ext   gid
271 # HeLP Bookmark or
272 # "Windows HELP File" by TrID
273 >>>(4.l+0x65)           string          !|Pete
274 # maybe there exist a cleaner way to detect HeLP fragments
275 # brute search for Magic 0x036C with matching Major maximal 7 iterations
276 # discapp.hlp
277 >>>>16                  search/0x49AF/s \x6c\x03
278 >>>>>&0                 use             help-ver-date
279 >>>>>&4                 leshort         !1
280 # putty.hlp
281 >>>>>>&0                search/0x69AF/s \x6c\x03
282 >>>>>>>&0               use             help-ver-date
283 >>>>>>>&4               leshort         !1
284 >>>>>>>>&0              search/0x49AF/s \x6c\x03
285 >>>>>>>>>&0             use             help-ver-date
286 >>>>>>>>>&4             leshort         !1
287 >>>>>>>>>>&0            search/0x49AF/s \x6c\x03
288 >>>>>>>>>>>&0           use             help-ver-date
289 >>>>>>>>>>>&4           leshort         !1
290 >>>>>>>>>>>>&0          search/0x49AF/s \x6c\x03
291 >>>>>>>>>>>>>&0         use             help-ver-date
292 >>>>>>>>>>>>>&4         leshort         !1
293 >>>>>>>>>>>>>>&0        search/0x49AF/s \x6c\x03
294 >>>>>>>>>>>>>>>&0       use             help-ver-date
295 >>>>>>>>>>>>>>>&4       leshort         !1
296 >>>>>>>>>>>>>>>>&0      search/0x49AF/s \x6c\x03
297 # GCC.HLP is detected after 7 iterations
298 >>>>>>>>>>>>>>>>>&0     use             help-ver-date
299 # this only happens if bigger hlp file is detected after used search iterations
300 >>>>>>>>>>>>>>>>>&4     leshort         !1              Windows y.z help
301 !:mime  application/winhelp
302 !:ext   hlp
303 # repeat search again or following default line does not work
304 >>>>16                  search/0x49AF/s \x6c\x03
305 # remaining files should be HeLP Bookmark WinHlp32.BMK (XP 32-bit) or WinHlp32 (Windows 8.1 64-bit)
306 >>>>16  default                         x       Windows help Bookmark
307 !:mime  application/x-winhelp
308 !:ext   bmk
309 ## FirstFreeBlock normally FFFFFFFFh 10h for *ANN
310 ##>>8   lelong                  x               \b, FirstFreeBlock 0x%8.8x
311 # EntireFileSize
312 >>12    lelong                  x               \b, %d bytes
313 ## ReservedSpace normally 042Fh AFh for *.ANN
314 #>>(4.l)        lelong          x               \b, ReservedSpace 0x%8.8x
315 ## UsedSpace normally 0426h A6h for *.ANN
316 #>>(4.l+4)      lelong          x               \b, UsedSpace 0x%8.8x
317 ## FileFlags normally 04...
318 #>>(4.l+5)      lelong          x               \b, FileFlags 0x%8.8x
319 ## file header magic 0x293B
320 #>>(4.l+9)      uleshort        x               \b, file header magic 0x%4.4x
321 ## file header Flags            0x0402
322 #>>(4.l+11)     uleshort        x               \b, file header Flags 0x%4.4x
323 ## file header PageSize 0400h 80h for *.ANN
324 #>>(4.l+13)     uleshort        x               \b, PageSize 0x%4.4x
325 ## Structure[16]                z4
326 #>>(4.l+15)     string          >\0             \b, Structure_"%-.16s"
327 ## MustBeZero                   0
328 #>>(4.l+31)     uleshort        x               \b, MustBeZero 0x%4.4x
329 ## PageSplits
330 #>>(4.l+33)     uleshort        x               \b, PageSplits 0x%4.4x
331 ## RootPage
332 #>>(4.l+35)     uleshort        x               \b, RootPage 0x%4.4x
333 ## MustBeNegOne                 0xffff
334 #>>(4.l+37)     uleshort        x               \b, MustBeNegOne 0x%4.4x
335 ## TotalPages                   1
336 #>>(4.l+39)     uleshort        x               \b, TotalPages 0x%4.4x
337 ## NLevels                      0x0001
338 #>>(4.l+41)     uleshort        x               \b, NLevels 0x%4.4x
339 ## TotalBtreeEntries
340 #>>(4.l+43)     ulelong         x               \b, TotalBtreeEntries 0x%8.8x
341 ## pages of the B+ tree
342 #>>(4.l+47)     ubequad         x               \b, PageStart 0x%16.16llx
343
344 # start with colon or semicolon for comment line like Back2Life.cnt
345 0               regex           \^(:|;)
346 # look for first keyword Base
347 >0              search/45       :Base
348 >>&0                            use             cnt-name
349 # only solution to search again from beginning , because relative offsets changes when use is called
350 >0              search/45       :Base
351 >0              default         x
352 # look for other keyword Title like in putty.cnt
353 >>0             search/45       :Title
354 >>>&0                           use             cnt-name
355 #
356 # display mime type and name of Windows help Content source
357 0       name                            cnt-name
358 # skip space at beginning
359 >0     string           \040
360 # name without extension and greater character or name with hlp extension
361 >>1     regex/c         \^([^\xd>]*|.*\.hlp)    MS Windows help file Content, based "%s"
362 !:mime  text/plain
363 !:apple ????TEXT
364 !:ext   cnt
365 #
366 # Windows creates a full text search from hlp file, if the user clicks the "Find" tab and enables keyword indexing
367 0       string          tfMR                    MS Windows help Full Text Search index
368 !:mime application/x-winhelp-fts
369 !:ext   fts
370 >16     string          >\0                     for "%s"
371
372 # Summary: Hyper terminal
373 # Extension: .ht
374 # Created by: unknown
375 0       string          HyperTerminal\040
376 >15     string          1.0\ --\ HyperTerminal\ data\ file      MS Windows HyperTerminal profile
377
378 # https://ithreats.files.wordpress.com/2009/05/\040
379 # lnk_the_windows_shortcut_file_format.pdf
380 # Summary: Windows shortcut
381 # Extension: .lnk
382 # Created by: unknown
383 # 'L' + GUUID
384 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
385 >20     lelong&1        1       \b, Item id list present
386 >20     lelong&2        2       \b, Points to a file or directory
387 >20     lelong&4        4       \b, Has Description string
388 >20     lelong&8        8       \b, Has Relative path
389 >20     lelong&16       16      \b, Has Working directory
390 >20     lelong&32       32      \b, Has command line arguments
391 >20     lelong&64       64      \b, Icon
392 >>56    lelong          x       \b number=%d
393 >24     lelong&1        1       \b, Read-Only
394 >24     lelong&2        2       \b, Hidden
395 >24     lelong&4        4       \b, System
396 >24     lelong&8        8       \b, Volume Label
397 >24     lelong&16       16      \b, Directory
398 >24     lelong&32       32      \b, Archive
399 >24     lelong&64       64      \b, Encrypted
400 >24     lelong&128      128     \b, Normal
401 >24     lelong&256      256     \b, Temporary
402 >24     lelong&512      512     \b, Sparse
403 >24     lelong&1024     1024    \b, Reparse point
404 >24     lelong&2048     2048    \b, Compressed
405 >24     lelong&4096     4096    \b, Offline
406 >28     leqwdate        x       \b, ctime=%s
407 >36     leqwdate        x       \b, mtime=%s
408 >44     leqwdate        x       \b, atime=%s
409 >52     lelong          x       \b, length=%u, window=
410 >60     lelong&1        1       \bhide
411 >60     lelong&2        2       \bnormal
412 >60     lelong&4        4       \bshowminimized
413 >60     lelong&8        8       \bshowmaximized
414 >60     lelong&16       16      \bshownoactivate
415 >60     lelong&32       32      \bminimize
416 >60     lelong&64       64      \bshowminnoactive
417 >60     lelong&128      128     \bshowna
418 >60     lelong&256      256     \brestore
419 >60     lelong&512      512     \bshowdefault
420 #>20    lelong&1        0
421 #>>20   lelong&2        2
422 #>>>(72.l-64)   pstring/h       x       \b [%s]
423 #>20    lelong&1        1
424 #>>20   lelong&2        2
425 #>>>(72.s)      leshort x
426 #>>>&75 pstring/h       x       \b [%s]
427
428 # Summary: Outlook Personal Folders
429 # Created by: unknown
430 0       lelong          0x4E444221      Microsoft Outlook email folder
431 >10     leshort         0x0e            (<=2002)
432 >10     leshort         0x17            (>=2003)
433
434
435 # Summary: Windows help cache
436 # Created by: unknown
437 0       string          \164\146\115\122\012\000\000\000\001\000\000\000        MS Windows help cache
438
439
440 # Summary: IE cache file
441 # Created by: Christophe Monniez
442 0       string  Client\ UrlCache\ MMF   Internet Explorer cache file
443 >20     string  >\0                     version %s
444
445
446 # Summary: Registry files
447 # Created by: unknown
448 # Modified by (1): Joerg Jenderek
449 0       string          regf            MS Windows registry file, NT/2000 or above
450 0       string          CREG            MS Windows 95/98/ME registry file
451 0       string          SHCC3           MS Windows 3.1 registry file
452
453
454 # Summary: Windows Registry text
455 # URL: https://en.wikipedia.org/wiki/Windows_Registry#.REG_files
456 # Reference: http://fileformats.archiveteam.org/wiki/Windows_Registry
457 # Submitted by: Abel Cheung <abelcheung@gmail.com>
458 # Update: Joerg Jenderek
459 #               Windows 3-9X variant
460 0       string          REGEDIT
461 # skip ASCII text like "REGEDITor.txt" but match
462 # L1WMAP.REG with only 1 CRNL or org.gnome.gnumeric.reg with 2 NL
463 >7      search/3        \n                      Windows Registry text
464 !:mime  text/x-ms-regedit
465 !:ext   reg
466 #               Windows 9X variant
467 >>0     string          REGEDIT4                (Win95 or above)
468 #               Windows 2K ANSI variant
469 0       string          Windows\ Registry\ Editor\ 
470 >&0     string          Version\ 5.00\r\n\r\n   Windows Registry text (Win2K or above)
471 !:mime  text/x-ms-regedit
472 !:ext   reg
473 #               Windows 2K UTF-16 variant
474 2       lestring16      Windows\ Registry\ Editor\ 
475 >0x32   lestring16      Version\ 5.00\r\n\r\n   Windows Registry little-endian text (Win2K or above)
476 # relative offset not working
477 #>&0    lestring16      Version\ 5.00\r\n\r\n   Windows Registry little-endian text (Win2K or above)
478 !:mime  text/x-ms-regedit
479 !:ext   reg
480 #               WINE variant
481 # URL: https://en.wikipedia.org/wiki/Wine_(software)
482 # Reference: https://www.winehq.org/pipermail/wine-cvs/2005-October/018763.html
483 # Note: WINE use text based registry (system.reg,user.reg,userdef.reg)
484 #       instead binary hiv structure like Windows
485 0       string  WINE\ REGISTRY\ Version\        WINE registry text
486 # version 2
487 >&0     string  x                               \b, version %s
488 !:mime  text/x-wine-extension-reg
489 !:ext   reg
490
491 # Windows *.INF *.INI files updated by Joerg Jenderek at Apr 2013, Feb 2018
492 # empty ,comment , section
493 # PR/383: remove unicode BOM because it is not portable across regex impls
494 #0      regex/s         \\`(\\r\\n|;|[[])
495 # empty line CRLF
496 0       ubeshort        0x0D0A
497 >0      use             ini-file
498 # comment line
499 0       string          ;
500 >0      use             ini-file
501 # section line
502 0       string          [
503 >0      use             ini-file
504 # check and then display Windows INItialization configuration
505 0       name            ini-file
506 # look for left bracket in section line
507 >0      search/8192     [
508 # https://en.wikipedia.org/wiki/Autorun.inf
509 # https://msdn.microsoft.com/en-us/library/windows/desktop/cc144200.aspx
510 # space after right bracket
511 # or AutoRun.Amd64 for 64 bit systems
512 # or only NL separator
513 >>&0    regex/c         \^(autorun)
514 # but sometimes total commander directory tree file "treeinfo.wc" with lines like
515 # [AUTORUN]
516 # [boot]
517 >>>&0   string          =]\r\n[                                 Total commander directory treeinfo.wc
518 !:mime text/plain
519 !:ext   wc
520 # From: Pal Tamas <folti@balabit.hu>
521 # Autorun File
522 >>>&0   string          !]\r\n[                                 Microsoft Windows Autorun file
523 !:mime application/x-setupscript
524 !:ext   inf
525 # https://msdn.microsoft.com/en-us/library/windows/hardware/ff549520(v=vs.85).aspx
526 # version strings ASCII coded case-independent for Windows setup information script file
527 >>&0    regex/c         \^(version|strings)]                            Windows setup INFormation
528 !:mime  application/x-setupscript
529 #!:mime application/x-wine-extension-inf
530 !:ext   inf
531 # NETCRC.INF OEMCPL.INF
532 >>&0    regex/c         \^(WinsockCRCList|OEMCPL)]                      Windows setup INFormation
533 !:mime  application/x-setupscript
534 !:ext   inf
535 # http://www.winfaq.de/faq_html/Content/tip2500/onlinefaq.php?h=tip2653.htm
536 # https://msdn.microsoft.com/en-us/library/windows/desktop/cc144102.aspx
537 # .ShellClassInfo DeleteOnCopy LocalizedFileNames ASCII coded case-independent
538 >>&0    regex/c \^(\.ShellClassInfo|DeleteOnCopy|LocalizedFileNames)]   Windows desktop.ini
539 !:mime application/x-wine-extension-ini
540 #!:mime text/plain
541 # https://support.microsoft.com/kb/84709/
542 >>&0    regex/c         \^(don't\ load)]                                Windows CONTROL.INI
543 !:mime application/x-wine-extension-ini
544 !:ext   ini
545 >>&0    regex/c         \^(ndishlp\\$|protman\\$|NETBEUI\\$)]           Windows PROTOCOL.INI
546 !:mime application/x-wine-extension-ini
547 !:ext   ini
548 # https://technet.microsoft.com/en-us/library/cc722567.aspx
549 # http://www.winfaq.de/faq_html/Content/tip0000/onlinefaq.php?h=tip0137.htm
550 >>&0    regex/c         \^(windows|Compatibility|embedding)]            Windows WIN.INI
551 !:mime application/x-wine-extension-ini
552 !:ext   ini
553 # https://en.wikipedia.org/wiki/SYSTEM.INI
554 >>&0    regex/c         \^(boot|386enh|drivers)]                        Windows SYSTEM.INI
555 !:mime application/x-wine-extension-ini
556 !:ext   ini
557 # http://www.mdgx.com/newtip6.htm
558 >>&0    regex/c         \^(SafeList)]                                   Windows IOS.INI
559 !:mime application/x-wine-extension-ini
560 !:ext   ini
561 # https://en.wikipedia.org/wiki/NTLDR   Windows Boot Loader information
562 >>&0    regex/c         \^(boot\x20loader)]                             Windows boot.ini
563 !:mime application/x-wine-extension-ini
564 !:ext   ini
565 # https://en.wikipedia.org/wiki/CONFIG.SYS
566 >>&0    regex/c         \^(menu)]                                       MS-DOS CONFIG.SYS
567 # @CONFIG.UI configuration file of previous DOS version saved by Caldera OPENDOS INSTALL.EXE
568 # CONFIG.PSS saved version of file CONFIG.SYS created by %WINDIR%\SYSTEM\MSCONFIG.EXE
569 # CONFIG.TSH renamed file CONFIG.SYS.BAT by %WINDIR%\SYSTEM\MSCONFIG.EXE
570 # dos and w40 used in dual booting scene
571 !:ext   sys/dos/w40
572 # https://support.microsoft.com/kb/118579/
573 >>&0    regex/c         \^(Paths)]\r\n                                  MS-DOS MSDOS.SYS
574 !:ext   sys/dos
575 # http://chmspec.nongnu.org/latest/INI.html#HHP
576 >>&0    regex/c         \^(options)]\r\n                                Microsoft HTML Help Project
577 !:mime text/plain
578 !:ext   hhp
579 # unknown keyword after opening bracket
580 >>&0    default                         x
581 #>>>&0  string/c                        x       UNKNOWN [%s
582 # look for left bracket of second section
583 >>>&0   search/8192                     [
584 # version Strings FileIdentification
585 >>>>&0  string/c                        version                         Windows setup INFormation
586 !:mime application/x-setupscript
587 !:ext   inf
588 # https://en.wikipedia.org/wiki/Initialization_file     Windows Initialization File or other
589 >>>>&0  default                         x
590 >>>>>&0 ubyte                           x
591 # characters, digits, underscore and white space followed by right bracket
592 # terminated by CR implies section line to skip BOOTLOG.TXT DETLOG.TXT
593 >>>>>>&-1       regex                   \^([A-Za-z0-9_\(\)\ ]+)\]\r     Generic INItialization configuration [%-.40s
594 # NETDEF.INF multiarc.ini 
595 #!:mime application/x-setupscript
596 !:mime  application/x-wine-extension-ini
597 #!:mime text/plain
598 !:ext   ini/inf
599 # UTF-16 BOM followed by CR~0D00 , comment~semicolon~3B00 , section~bracket~5B00
600 0       ubelong&0xFFff89FF      =0xFFFE0900
601 # look for left bracket in section line
602 >2      search/8192             [
603 # keyword without 1st letter which is maybe up-/down-case
604 >>&3    lestring16              ersion]                 Windows setup INFormation
605 !:mime  application/x-setupscript
606 !:ext   inf
607 >>&3    lestring16              trings]                 Windows setup INFormation
608 !:mime  application/x-setupscript
609 !:ext   inf
610 >>&3    lestring16              ourceDisksNames]        Windows setup INFormation
611 !:mime  application/x-setupscript
612 !:ext   inf
613 # netnwcli.inf start with ;---[ NetNWCli.INX ]
614 >>&3    default                 x
615 # look for NL followed by left bracket
616 >>>&0   search/8192             \x0A\x00\x5b
617 >>>>&3  lestring16              ersion]                 Windows setup INFormation
618 !:mime  application/x-setupscript
619 !:ext   inf
620
621 # Windows Precompiled INF files *.PNF added by Joerg Jenderek at Mar 2013 of _PNF_HEADER inf.h
622 # http://read.pudn.com/downloads3/sourcecode/windows/248345/win2k/private/windows/setup/setupapi/inf.h__.htm
623 # URL:          http://fileformats.archiveteam.org/wiki/INF_(Windows)
624 # Reference:    http://en.verysource.com/code/10350344_1/inf.h.html
625 # Note:         stored in %Windir%\Inf %Windir%\System32\DriverStore\FileRepository
626 # check for valid major and minor versions: 101h - 303h 
627 0               leshort&0xFcFc  =0x0000
628 # GRR: line above (strength 50) is too general as it catches also "PDP-11 UNIX/RT ldp" ./pdp
629 >0              leshort&0x0303  !0x0000
630 # test for valid InfStyles: 1 2 
631 >>2             uleshort        >0
632 >>>2            uleshort        <3
633 # look for colon in WinDirPath after PNF header
634 #>>>>0x59       search/18       :
635 >>>>0   use     PreCompiledInf
636 0       name    PreCompiledInf
637 >0              uleshort        x       Windows Precompiled iNF
638 !:mime  application/x-pnf
639 !:ext   pnf
640 # major version 1 for older Windows like XP and 3 since about Windows Vista
641 # 101h~98-XP; 301h~Windows Vista-7 ; 302h~Windows 10 14393; 303h~Windows 10 18362
642 >1              ubyte           x               \b, version %u
643 >0              ubyte           x               \b.%u
644 >0              uleshort        =0x0101         (Windows
645 >>4     ulelong&0x00000001      !0x00000001     98)
646 >>4     ulelong&0x00000001      =0x00000001     XP)
647 >0              uleshort        =0x0301         (Windows Vista-8.1)
648 >0              uleshort        =0x0302         (Windows 10 older)
649 >0              uleshort        =0x0303         (Windows 10)
650 # 1 ,2 (windows 98 SE)
651 >2              uleshort        !2              \b, InfStyle %u
652 #       PNF_FLAG_IS_UNICODE             0x00000001
653 #       PNF_FLAG_HAS_STRINGS            0x00000002
654 #       PNF_FLAG_SRCPATH_IS_URL         0x00000004
655 #       PNF_FLAG_HAS_VOLATILE_DIRIDS    0x00000008
656 #       PNF_FLAG_INF_VERIFIED           0x00000010
657 #       PNF_FLAG_INF_DIGITALLY_SIGNED   0x00000020
658 #       UNKNOWN8                        0x00000080
659 #       UNKNOWN                         0x00000100
660 #       UNKNOWN1                        0x01000000
661 #       UNKNOWN2                        0x02000000
662 >4      ulelong&0x03000180      >0              \b, flags
663 >>4     ulelong                 x               0x%x
664 >4      ulelong&0x00000001      0x00000001      \b, unicoded
665 >4      ulelong&0x00000002      0x00000002      \b, has strings
666 >4      ulelong&0x00000004      0x00000004      \b, src URL
667 >4      ulelong&0x00000008      0x00000008      \b, volatile dir ids
668 >4      ulelong&0x00000010      0x00000010      \b, verified
669 >4      ulelong&0x00000020      0x00000020      \b, digitally signed
670 # >4    ulelong&0x00000080      0x00000080      \b, UNKNOWN8
671 # >4    ulelong&0x00000100      0x00000100      \b, UNKNOWN
672 # >4    ulelong&0x01000000      0x01000000      \b, UNKNOWN1
673 # >4    ulelong&0x02000000      0x02000000      \b, UNKNOWN2
674 #>8             ulelong         x               \b, InfSubstValueListOffset 0x%x
675 # many 0, 1 lmouusb.PNF, 2 linkfx10.PNF , f webfdr16.PNF
676 # , 6 bth.PNF, 9 usbport.PNF, d netnwifi.PNF, 10h nettcpip.PNF
677 #>12            uleshort        x               \b, InfSubstValueCount 0x%x
678 # only < 9 found: 8 hcw85b64.PNF
679 #>14            uleshort        x               \b, InfVersionDatumCount 0x%x
680 # only found values lower 0x0000ffff ??
681 #>16            ulelong         x               \b, InfVersionDataSize 0x%x
682 # only found positive values lower 0x00ffFFff for InfVersionDataOffset
683 >20             ulelong         x               \b, at 0x%x
684 >4      ulelong&0x00000001      =0x00000001
685 # case independent: CatalogFile Class DriverVer layoutfile LayoutFile SetupClass signature Signature
686 >>(20.l)        lestring16      x               "%s"
687 >4      ulelong&0x00000001      !0x00000001
688 >>(20.l)        string          x               "%s"
689 # FILETIME is number of 100-nanosecond intervals since 1 January 1601
690 #>24            ulequad         x               \b, InfVersionLastWriteTime %16.16llx
691 #>24            foodate-0xbar   x               \b, InfVersionLastWriteTime %s
692 # for Windows 98, XP
693 >0              uleshort        <0x0102
694 # only found values lower 0x00ffFFff
695 # often 70 but also 78h for corelist.PNF
696 # >>32          ulelong         x               \b, StringTableBlockOffset 0x%x
697 # >>36          ulelong         x               \b, StringTableBlockSize 0x%x
698 # >>40          ulelong         x               \b, InfSectionCount 0x%x
699 # >>44          ulelong         x               \b, InfSectionBlockOffset 0x%x
700 # >>48          ulelong         x               \b, InfSectionBlockSize 0x%x
701 # >>52          ulelong         x               \b, InfLineBlockOffset 0x%x
702 # >>56          ulelong         x               \b, InfLineBlockSize 0x%x
703 # >>60          ulelong         x               \b, InfValueBlockOffset 0x%x
704 # >>64          ulelong         x               \b, InfValueBlockSize 0x%x
705 # WinDirPathOffset
706 # like 58h, which means direct after PNF header
707 #>>68           ulelong         x               \b, at 0x%x
708 >>68            ulelong         x
709 >>>4    ulelong&0x00000001      =0x00000001
710 #>>>>(68.l)     ubequad         =0x43003a005c005700
711 # normally unicoded C:\Windows
712 #>>>>>(68.l)    lestring16      x               \b, WinDirPath "%s"
713 >>>>(68.l)      ubequad         !0x43003a005c005700
714 >>>>>(68.l)     lestring16      x               \b, WinDirPath "%s"
715 >>>4    ulelong&0x00000001      !0x00000001
716 # normally ASCII C:\WINDOWS
717 #>>>>(68.l)     string          =C:\\WINDOWS    \b, WinDirPath "%s"
718 >>>>(68.l)      string          !C:\\WINDOWS
719 >>>>>(68.l)     string          x               \b, WinDirPath "%s"
720 # found OsLoaderPathOffset values often 0 , once 70h corelist.PNF, once 68h ASCII machine.PNF
721 >>>72           ulelong         >0              \b,
722 >>>>4   ulelong&0x00000001      =0x00000001
723 >>>>>(72.l)     lestring16      x               OsLoaderPath "%s"
724 >>>>4   ulelong&0x00000001      !0x00000001
725 # seldom C:\ instead empty
726 >>>>>(72.l)     string          x               OsLoaderPath "%s"
727 # 1fdh
728 #>>>76          uleshort        x               \b, StringTableHashBucketCount 0x%x
729 # only 407h found
730 >>>78           uleshort        !0x409          \b, LanguageID %x
731 #>>>78          uleshort        =0x409          \b, LanguageID %x
732 # InfSourcePathOffset often 0
733 >>>80           ulelong         >0              \b, at 0x%x
734 >>>>4   ulelong&0x00000001      =0x00000001
735 >>>>>(80.l)     lestring16      x               SourcePath "%s"
736 >>>>4   ulelong&0x00000001      !0x00000001
737 >>>>>(80.l)     string          >\0             SourcePath "%s"
738 # OriginalInfNameOffset often 0
739 >>>84           ulelong         >0              \b, at 0x%x
740 >>>>4   ulelong&0x00000001      =0x00000001
741 >>>>>(84.l)     lestring16      x               InfName "%s"
742 >>>>4   ulelong&0x00000001      !0x00000001
743 >>>>>(84.l)     string          >\0             InfName "%s"
744
745 # for newer Windows like Vista, 7 , 8.1 , 10
746 >0              uleshort        >0x0101
747 >>80    ulelong                 x               \b, at 0x%x WinDirPath
748 >>>4    ulelong&0x00000001      0x00000001
749 # normally unicoded C:\Windows
750 #>>>>(80.l)     ubequad         =0x43003a005c005700
751 #>>>>>(80.l)    lestring16      x               "%s"
752 >>>>(80.l)      ubequad         !0x43003a005c005700
753 >>>>>(80.l)     lestring16      x               "%s"
754 # language id: 0 407h~german 409h~English_US
755 >>90            uleshort        !0x409          \b, LanguageID %x
756 #>>90           uleshort        =0x409          \b, LanguageID %x
757 >>92    ulelong                 >0              \b, at 0x%x
758 >>>4    ulelong&0x00000001      0x00000001
759 # language string like: de-DE en-US
760 >>>>(92.l)      lestring16      x               language %s
761
762 # Summary: backup file created with utility like NTBACKUP.EXE shipped with Windows NT/2K/XP/2003
763 # Extension: .bkf
764 # Created by: Joerg Jenderek
765 # URL: https://en.wikipedia.org/wiki/NTBackup
766 # Reference: http://laytongraphics.com/mtf/MTF_100a.PDF
767 # Descriptor BloCK name of Microsoft Tape Format
768 0       string                  TAPE
769 # Format Logical Address is zero
770 >20     ulequad                 0
771 # Reserved for MBC is zero
772 >>28    uleshort                0
773 # Control Block ID is zero
774 >>>36   ulelong                 0
775 # BIT4-BIT15, BIT18-BIT31 of block attributes are unused
776 >>>>4   ulelong&0xFFfcFFe0      0               Windows NTbackup archive
777 #!:mime application/x-ntbackup
778 !:ext bkf
779 # OS ID
780 >>>>>10 ubyte                   1               \b NetWare
781 >>>>>10 ubyte                   13              \b NetWare SMS
782 >>>>>10 ubyte                   14              \b NT
783 >>>>>10 ubyte                   24              \b 3
784 >>>>>10 ubyte                   25              \b OS/2
785 >>>>>10 ubyte                   26              \b 95
786 >>>>>10 ubyte                   27              \b Macintosh
787 >>>>>10 ubyte                   28              \b UNIX
788 # OS Version (2)
789 #>>>>>11        ubyte                   x               OS V=%x
790 # MTF_CONTINUATION      Media Sequence Number > 1
791 #>>>>>4 ulelong&0x00000001      !0              \b, continued
792 # MTF_COMPRESSION
793 >>>>>4  ulelong&0x00000004      !0              \b, compressed
794 # MTF_EOS_AT_EOM        End Of Medium was hit during end of set processing
795 >>>>>4  ulelong&0x00000008      !0              \b, End Of Medium hit
796 >>>>>4  ulelong&0x00020000      0
797 # MTF_SET_MAP_EXISTS    A Media Based Catalog Set Map may exist on tape
798 >>>>>>4 ulelong&0x00010000      !0              \b, with catalog
799 # MTF_FDD_ALLOWED       However File/Directory Detail can only exist if a Set Map is also present
800 >>>>>4  ulelong&0x00020000      !0              \b, with file catalog
801 # Offset To First Event 238h,240h,28Ch
802 #>>>>>8 uleshort                x               \b, event offset %4.4x
803 # Displayable Size (20e0230h 20e024ch 20e0224h)
804 #>>>>>8 ulequad                 x               dis. size %16.16llx
805 # Media Family ID (455288C4h 4570BD1Ah 45708F2Fh 4570BBF5h)
806 #>>>>>52        ulelong                 x               family ID %8.8x
807 # TAPE Attributes (3)
808 #>>>>>56        ulelong                 x               TAPE %8.8x
809 # Media Sequence Number
810 >>>>>60 uleshort                >1              \b, sequence %u
811 # Password Encryption Algorithm (3)
812 >>>>>62 uleshort                >0              \b, 0x%x encrypted
813 # Soft Filemark Block Size * 512 (2)
814 #>>>>>64        uleshort                =2              \b, soft size %u*512
815 >>>>>64 uleshort                !2              \b, soft size %u*512
816 # Media Based Catalog Type (1,2)
817 #>>>>>66        uleshort                x               \b, catalog type %4.4x
818 # size of Media Name (66,68,6Eh)
819 >>>>>68 uleshort                >0
820 # offset of Media Name (5Eh)
821 >>>>>>70        uleshort        >0
822 # 0~, 1~ANSI, 2~UNICODE
823 >>>>>>>48       ubyte           1
824 # size terminated ansi coded string normally followed by "MTF Media Label"
825 >>>>>>>>(70.s)  string          >\0             \b, name: %s
826 >>>>>>>48       ubyte           2
827 # Not null, but size terminated unicoded string
828 >>>>>>>>(70.s)  lestring16      x               \b, name: %s
829 # size of Media Label (104h)
830 >>>>>72 uleshort                >0
831 # offset of Media Label (C4h,C6h,CCh)
832 >>>>>74         uleshort        >0
833 >>>>>>48        ubyte           1
834 #Tag|Version|Vendor|Vendor ID|Creation Time Stamp|Cartridge Label|Side|Media ID|Media Domain ID|Vendor Specific fields
835 >>>>>>>(74.s)   string          >\0             \b, label: %s
836 >>>>>>48        ubyte           2
837 >>>>>>>(74.s)   lestring16      x               \b, label: %s
838 # size of password name (0,1Ch)
839 #>>>>>76        uleshort                >0              \b, password size %4.4x
840 # Software Vendor ID (CBEh)
841 >>>>>86 uleshort                x               \b, software (0x%x)
842 # size of Software Name (6Eh)
843 >>>>>80 uleshort                >0
844 # offset of Software Name (1C8h,1CAh,1D0h)
845 >>>>>>82        uleshort        >0
846 # 1~ANSI, 2~UNICODE
847 >>>>>>>48       ubyte           1
848 >>>>>>>>(82.s)  string          >\0             \b: %s
849 >>>>>>>48       ubyte           2
850 # size terminated unicoded coded string normally followed by "SPAD"
851 >>>>>>>>(82.s)  lestring16      x               \b: %s
852 # Format Logical Block Size (512,1024)
853 #>>>>>84        uleshort                =1024           \b, block size %u
854 >>>>>84 uleshort                !1024           \b, block size %u
855 # Media Date of MTF_DATE_TIME type with 5 bytes
856 #>>>>>>88       ubequad                 x               DATE %16.16llx
857 # MTF Major Version (1)
858 #>>>>>>93       ubyte           x               \b, MFT version %x
859 #
860
861 # URL: https://en.wikipedia.org/wiki/PaintShop_Pro
862 # Reference: https://www.cryer.co.uk/file-types/p/pal.htm
863 # Created by: Joerg Jenderek
864 # Note: there exist other color palette formats also with .pal extension
865 0       string  JASC-PAL\r\n    PaintShop Pro color palette
866 #!:mime text/plain
867 # PspPalette extension is used by newer (probably 8) PaintShopPro versions
868 !:ext   pal/PspPalette
869 # 2nd line contains palette file version. For example "0100"
870 >10     string  !0100           \b, version %.4s
871 # third line contains the number of colours: 16 256 ...
872 >16     string  x               \b, %.3s colors
873
874 # URL: https://en.wikipedia.org/wiki/Innosetup
875 # Reference: https://github.com/jrsoftware/issrc/blob/master/Projects/Undo.pas
876 # Created by: Joerg Jenderek
877 # Note: created by like "InnoSetup self-extracting archive" inside ./msdos
878 # TrID labeles the entry as "Inno Setup Uninstall Log"
879 #       TUninstallLogID
880 0       string  Inno\ Setup\ Uninstall\ Log\ (b)        InnoSetup Log
881 !:mime  application/x-innosetup
882 # unins000.dat, unins001.dat, ...
883 !:ext   dat
884 # " 64-bit" variant
885 >0x1c   string          >\0                             \b%.7s
886 # AppName[0x80] like "Minimal SYStem", ClamWin Free Antivirus , ...
887 >0xc0   string          x                               %s
888 # AppId[0x80] is similar to AppName or
889 # GUID like {4BB0DCDC-BC24-49EC-8937-72956C33A470} start with left brace
890 >0x40   ubyte           0x7b
891 >>0x40  string          x                               %-.38s
892 # do not know how this log version correlates to program version
893 >0x140  ulelong         x                               \b, version 0x%x
894 # NumRecs
895 #>0x144 ulelong         x                               \b, 0x%4.4x records
896 # EndOffset means files size
897 >0x148  ulelong         x                               \b, %u bytes
898 # Flags 5 25h 35h
899 #>0x14c ulelong         x                               \b, flags %8.8x
900 # Reserved: array[0..26] of Longint
901 # the non Unicode HighestSupportedVersion may never become greater than or equal to 1000
902 >0x140  ulelong         <1000
903 # hostname
904 >>0x1d6 pstring         x                               \b, %s
905 # user name
906 >>>&0   pstring         x                               \b\%s
907 # directory like C:\Program Files (x86)\GnuWin32
908 >>>>&0  pstring         x                               \b, "%s"
909 # version 1000 or higher implies unicode
910 >0x140  ulelong         >999
911 # hostname
912 >>0x1db lestring16      x                               \b, %-.9s
913 # utf string variant with prepending fe??ffFFff
914 >>0x1db search/43       \xFF\xFF\xFF                    
915 # user name
916 >>>&0   lestring16      x                               \b\%-.9s
917 >>>&0   search/43       \xFF\xFF\xFF                    
918 # directory like C:\Program Files\GIMP 2
919 >>>>&0  lestring16      x                               \b, %-.42s
920
921 # Windows Imaging (WIM) Image
922 # Update: Joerg Jenderek at Mar 2019
923 # URL: https://en.wikipedia.org/wiki/Windows_Imaging_Format
924 # Reference: https://download.microsoft.com/download/f/e/f/
925 # fefdc36e-392d-4678-9e4e-771ffa2692ab/Windows%20Imaging%20File%20Format.rtf
926 # Note: verified by like `7z t boot.wim` `wiminfo install.esd --header`
927 0       string          MSWIM\000\000\000
928 >0      use             wim-archive
929 # https://wimlib.net/man1/wimoptimize.html
930 0       string          WLPWM\000\000\000
931 >0      use             wim-archive
932 0       name            wim-archive
933 # _WIMHEADER_V1_PACKED ImageTag[8]
934 >0      string          x                       Windows imaging
935 !:mime  application/x-ms-wim
936 # TO avoid in file version 5.36 error like
937 # Magdir/windows, 760: Warning: Current entry does not yet have a description
938 # file: could not find any valid magic files! (No error)
939 # splitted WIM
940 >16     ulelong         &0x00000008             (SWM
941 !:ext   swm
942 # usPartNumber; 1, unless the file was split into multiple parts
943 >>40    uleshort        x                       \b %u
944 # usTotalParts; The total number of WIM file parts in a spanned set
945 >>42    uleshort        x                       \b of %u) image
946 # non splitted WIM
947 >16     ulelong         ^0x00000008
948 # https://wimlib.net/man1/wimmount.html
949 # solid WIMs; version 3584; usually contain LZMS-compressed and the .esd extension
950 >>12    ulelong         3584                    (ESD) image
951 !:ext   esd
952 >>12    ulelong         !3584                   (WIM) image
953 !:ext   wim
954 >0      string/b        WLPWM\000\000\000       \b, wimlib pipable format
955 # cbSize size of the WIM header in bytes like 208
956 #>8     ulelong         x                       \b, headersize %u
957 # dwVersion version of the WIM file 00010d00h~1.13 00000e00h~0.14
958 >14     uleshort        x                       v%u
959 >13     ubyte           x                       \b.%u
960 # dwImageCount; The number of images contained in the WIM file
961 >44     ulelong         >1                      \b, %u images
962 # dwBootIndex
963 # 1-based index of the bootable image of the WIM, or 0 if no image is bootable
964 >0x78   ulelong         >0                      \b, bootable no. %u
965 # dwFlags
966 #>16    ulelong         x                       \b, flags 0x%8.8x
967 #define FLAG_HEADER_COMPRESSION         0x00000002
968 #define FLAG_HEADER_READONLY            0x00000004
969 #define FLAG_HEADER_SPANNED             0x00000008
970 #define FLAG_HEADER_RESOURCE_ONLY       0x00000010
971 #define FLAG_HEADER_METADATA_ONLY       0x00000020
972 #define FLAG_HEADER_WRITE_IN_PROGRESS   0x00000040
973 #define FLAG_HEADER_RP_FIX              0x00000080 reparse point fixup
974 #define FLAG_HEADER_COMPRESS_RESERVED   0x00010000
975 #define FLAG_HEADER_COMPRESS_XPRESS     0x00020000
976 #define FLAG_HEADER_COMPRESS_LZX        0x00040000
977 #define FLAG_HEADER_COMPRESS_LZMS       0x00080000
978 #define FLAG_HEADER_COMPRESS_XPRESS2    0x00100000 wimlib-1.13.0\include\wimlib\header.h 
979 # XPRESS, with small chunk size
980 >16     ulelong         &0x00100000             \b, XPRESS2
981 >16     ulelong         &0x00080000             \b, LZMS
982 >16     ulelong         &0x00040000             \b, LZX
983 >16     ulelong         &0x00020000             \b, XPRESS
984 >16     ulelong         &0x00000002             compressed
985 >16     ulelong         &0x00000004             \b, read only
986 >16     ulelong         &0x00000010             \b, resource only
987 >16     ulelong         &0x00000020             \b, metadata only
988 >16     ulelong         &0x00000080             \b, reparse point fixup
989 #>16    ulelong         &0x00010000             \b, RESERVED
990 # dwCompressionSize; Uncompressed chunk size for resources or 0 if uncompressed
991 #>20    ulelong         >0                      \b, chunk size %u bytes
992 # gWIMGuid
993 #>24    ubequad         x                       \b, GUID 0x%16.16llx
994 #>>32   ubequad         x                       \b%16.16llx
995 # rhOffsetTable; the location of the resource lookup table
996 # wim_reshdr_disk[24]= u8 size_in_wim[7] + u8 flags + le64 offset_in_wim + le64 uncompressed_size
997 #>48    ubequad         x                       \b, rhOffsetTable 0x%16.16llx
998 # rhXmlData; the location of the XML data
999 #>0x50  ulelong         x                       \b, at 0x%8.8x
1000 # NOT WORKING \xff\xfe<\0W\0I\0M\0
1001 #>(0x50.l)      ubequad x                       \b, xml=%16.16llx
1002 # rhBootMetadata; the location of the metadata resource
1003 #>0x60  ubequad         x                       \b, rhBootMetadata 0x%16.16llx
1004 # rhIntegrity; the location of integrity table used to verify files
1005 #>0x7c  ubequad         x                       \b, rhIntegrity 0x%16.16llx
1006 # Unused[60]
1007 #>148   ubequad         !0                      \b,unused 0x%16.16llx
1008 #
1009
1010 # From:         Joerg Jenderek
1011 # URL:          https://en.wikipedia.org/wiki/Windows_Easy_Transfer
1012 # Reference:    http://mark0.net/download/triddefs_xml.7z/defs/m/mig.trid.xml
1013 # Note:         called "Windows Easy Transfer migration data" by TrID,
1014 #               "Migration Store" or "EasyTransfer file" by Microsoft
1015 0               string          1giM    Windows Easy Transfer migration data
1016 #!:mime         application/octet-stream
1017 !:mime          application/x-ms-mig
1018 !:ext           mig
1019 >0x18           string          =MRTS   without password
1020 # data offset with 1 space at end
1021 >>0x1c          ulelong+0x38    x       \b, at 0x%x 
1022 # look for zlib compressed data by ./compress
1023 >>(0x1c.l+0x38) ubyte           x
1024 >>>&-1  indirect        x
1025 # in password protected examples MRTS comes some bytes further
1026 >0x18           string          !MRTS   with password
1027 # look for first MRTS tag
1028 >0x18           search/29/b     MRTS
1029 # probably first file name length like 178, ...
1030 #>>&0           ulelong         x       \b, 1st length %u
1031 # URL like File\C:\Users\nutzer\AppData\Roaming\Microsoft\Internet Explorer\Quick Launch\desktop.ini
1032 >>&20           lestring16      x       \b, 1st %-s
1033
1034 # Microsoft SYLK
1035 # https://en.wikipedia.org/wiki/SYmbolic_LinK_(SYLK)
1036 # https://outflank.nl/upload/sylksum.txt
1037 0       string  ID;P    Microsoft SYLK program
1038 >4      string  >0      \b, created by %s
1039 !:ext   slk/sylk