2 * Copyright 2015,2016 Mark Jansen
4 * This library is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU Lesser General Public
6 * License as published by the Free Software Foundation; either
7 * version 2.1 of the License, or (at your option) any later version.
9 * This library is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 * Lesser General Public License for more details.
14 * You should have received a copy of the GNU Lesser General Public
15 * License along with this library; if not, write to the Free Software
16 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
21 #include "wine/test.h"
24 static IMAGE_DOS_HEADER dos_header
=
26 IMAGE_DOS_SIGNATURE
, /* e_magic */
32 65535, /* e_maxalloc */
43 { 0 }, /* e_res2[10] */
47 static IMAGE_NT_HEADERS32 nt_header
=
49 IMAGE_NT_SIGNATURE
, /* Signature */
51 IMAGE_FILE_MACHINE_I386
, /* Machine */
52 2, /* NumberOfSections */
53 0x12345, /* TimeDateStamp */
54 0, /* PointerToSymbolTable */
55 0, /* NumberOfSymbols */
56 sizeof(IMAGE_OPTIONAL_HEADER
), /* SizeOfOptionalHeader */
57 IMAGE_FILE_RELOCS_STRIPPED
| IMAGE_FILE_EXECUTABLE_IMAGE
| IMAGE_FILE_LINE_NUMS_STRIPPED
| IMAGE_FILE_32BIT_MACHINE
/* Characteristics */
60 IMAGE_NT_OPTIONAL_HDR_MAGIC
, /* Magic */
61 6, /* MajorLinkerVersion */
62 3, /* MinorLinkerVersion */
64 0, /* SizeOfInitializedData */
65 0, /* SizeOfUninitializedData */
66 0x1000, /* AddressOfEntryPoint */
67 0x1000, /* BaseOfCode */
71 0x400000, /* ImageBase */
72 0x1000, /* SectionAlignment */
73 0x200, /* FileAlignment */
74 4, /* MajorOperatingSystemVersion */
75 1, /* MinorOperatingSystemVersion */
76 4, /* MajorImageVersion */
77 2, /* MinorImageVersion */
78 4, /* MajorSubsystemVersion */
79 3, /* MinorSubsystemVersion */
80 0, /* Win32VersionValue */
81 0x3000, /* SizeOfImage */
82 0x200, /* SizeOfHeaders */
83 0xBAAD, /* CheckSum: This checksum is not the correct checksum, intentionally! */
84 IMAGE_SUBSYSTEM_WINDOWS_CUI
, /* Subsystem */
85 0, /* DllCharacteristics */
86 0x100000, /* SizeOfStackReserve */
87 0x1000, /* SizeOfStackCommit */
88 0x100000, /* SizeOfHeapReserve */
89 0x1000, /* SizeOfHeapCommit */
91 0x10, /* NumberOfRvaAndSizes */
93 /* IMAGE_DIRECTORY_ENTRY_EXPORT */
95 0x2370, /* VirtualAddress */
99 /* IMAGE_DIRECTORY_ENTRY_RESOURCE */
101 0x2000, /* VirtualAddress */
104 } /* DataDirectory[IMAGE_NUMBEROF_DIRECTORY_ENTRIES] */
108 static IMAGE_SECTION_HEADER section_headers
[] =
111 { '.','t','e','x','t',0 }, /* Name */
112 { 24 }, /* VirtualSize */
113 0x1000, /* VirtualAddress */
114 0x200, /* SizeOfRawData */
115 0x200, /* PointerToRawData */
116 0, /* PointerToRelocations */
117 0, /* PointerToLinenumbers */
118 0, /* NumberOfRelocations */
119 0, /* NumberOfLinenumbers */
120 IMAGE_SCN_CNT_CODE
| IMAGE_SCN_MEM_EXECUTE
| IMAGE_SCN_MEM_READ
/* Characteristics */
123 { '.','r','s','r','c',0 }, /* Name */
124 { 880 }, /* VirtualSize */
125 0x2000, /* VirtualAddress */
126 0x400, /* SizeOfRawData */
127 0x400, /* PointerToRawData */
128 0, /* PointerToRelocations */
129 0, /* PointerToLinenumbers */
130 0, /* NumberOfRelocations */
131 0, /* NumberOfLinenumbers */
132 IMAGE_SCN_CNT_INITIALIZED_DATA
| IMAGE_SCN_MEM_READ
/* Characteristics */
136 static const unsigned char text_section
[] =
138 0x33, 0xc0, /* xor eax, eax */
143 /* taken from fusionpriv.h */
150 VS_FIXEDFILEINFO Value
;
193 typedef struct rsrc_section_t
195 IMAGE_RESOURCE_DIRECTORY header
;
196 IMAGE_RESOURCE_DIRECTORY_ENTRY file_info_id
;
197 IMAGE_RESOURCE_DIRECTORY file_info_header
;
198 IMAGE_RESOURCE_DIRECTORY_ENTRY version_info_id
;
199 IMAGE_RESOURCE_DIRECTORY version_info_header
;
200 IMAGE_RESOURCE_DIRECTORY_ENTRY version_lang_id
;
201 IMAGE_RESOURCE_DATA_ENTRY version_data_entry
;
203 VS_VERSIONINFO version_info
;
204 STRINGFILEINFO string_file_info
;
205 STRINGTABLE string_table
;
207 STRINGHDR FileVersion_hdr
;
208 WCHAR FileVersion_key
[13];
209 WCHAR FileVersion_val
[8];
211 STRINGHDR ProductVersion_hdr
;
212 WCHAR ProductVersion_key
[15];
213 WCHAR ProductVersion_val
[8];
215 STRINGHDR CompanyName_hdr
;
216 WCHAR CompanyName_key
[13];
217 WCHAR CompanyName_val
[12];
219 STRINGHDR FileDescription_hdr
;
220 WCHAR FileDescription_key
[17];
221 WCHAR FileDescription_val
[16];
223 STRINGHDR InternalName_hdr
;
224 WCHAR InternalName_key
[13];
225 WCHAR InternalName_val
[14];
227 STRINGHDR LegalCopyright_hdr
;
228 WCHAR LegalCopyright_key
[15];
229 WCHAR LegalCopyright_val
[16];
231 STRINGHDR LegalTrademarks_hdr
;
232 WCHAR LegalTrademarks_key
[17];
233 WCHAR LegalTrademarks_val
[16];
235 STRINGHDR OriginalFilename_hdr
;
236 WCHAR OriginalFilename_key
[17];
237 WCHAR OriginalFilename_val
[18];
239 STRINGHDR Productname_hdr
;
240 WCHAR Productname_key
[13];
241 WCHAR Productname_val
[12];
243 VARFILEINFO file_info
;
247 static const rsrc_section_t rsrc_section
=
251 0, /* Characteristics */
252 0x55FE8E21, /* TimeDateStamp, 20/09/2015 10:44:49 */
253 0, /* MajorVersion */
254 0, /* MinorVersion */
255 0, /* NumberOfNamedEntries */
256 1, /* NumberOfIdEntries */
261 (DWORD
)VS_FILE_INFO
, /* NameOffset:31 */
262 0 /* NameIsString:1 */
265 0x80000018 /* OffsetToData */
268 /* file_info_header */
270 0, /* Characteristics */
271 0x55FE8E21, /* TimeDateStamp, 20/09/2015 10:44:49 */
272 0, /* MajorVersion */
273 0, /* MinorVersion */
274 0, /* NumberOfNamedEntries */
275 1, /* NumberOfIdEntries */
277 /* version_info_id */
280 VS_VERSION_INFO
, /* NameOffset:31 */
281 0 /* NameIsString:1 */
284 0x80000030 /* OffsetToData */
287 /* version_info_header */
289 0, /* Characteristics */
290 0x55FE8E21, /* TimeDateStamp, 20/09/2015 10:44:49 */
291 0, /* MajorVersion */
292 0, /* MinorVersion */
293 0, /* NumberOfNamedEntries */
294 1, /* NumberOfIdEntries */
296 /* version_lang_id */
299 1033, /* NameOffset:31 */
300 0 /* NameIsString:1 */
303 0x48 /* OffsetToDirectory */
306 /* version_data_entry */
308 0x2058, /* OffsetToData */
317 0x34, /* wValueLength */
318 0, /* wType: Binary */
319 { 'V','S','_','V','E','R','S','I','O','N','_','I','N','F','O','\0','\0' }, /* szKey[17] */
322 0xFEEF04BD, /* dwSignature */
323 0x10000, /* dwStrucVersion */
324 0x10000, /* dwFileVersionMS */
325 0, /* dwFileVersionLS */
326 0x10000, /* dwProductVersionMS */
327 1, /* dwProductVersionLS */
328 0, /* dwFileFlagsMask */
330 VOS__WINDOWS32
, /* dwFileOS */
331 VFT_APP
, /* dwFileType */
332 0, /* dwFileSubtype */
333 0x01d1a019, /* dwFileDateMS */
334 0xac754c50 /* dwFileDateLS */
338 /* string_file_info */
341 0, /* wValueLength */
343 { 'S','t','r','i','n','g','F','i','l','e','I','n','f','o','\0' } /* szKey[15] */
348 0, /* wValueLength */
350 { 'F','F','F','F','0','0','0','0','\0' } /* szKey[9] */
356 8, /* wValueLength */
359 { 'F','i','l','e','V','e','r','s','i','o','n','\0' },
360 { '1','.','0','.','0','.','0','\0' },
365 8, /* wValueLength */
368 { 'P','r','o','d','u','c','t','V','e','r','s','i','o','n','\0' },
369 { '1','.','0','.','0','.','1','\0' },
374 12, /* wValueLength */
377 { 'C','o','m','p','a','n','y','N','a','m','e','\0' },
378 { 'C','o','m','p','a','n','y','N','a','m','e','\0' },
380 /* FileDescription */
383 16, /* wValueLength */
386 { 'F','i','l','e','D','e','s','c','r','i','p','t','i','o','n','\0' },
387 { 'F','i','l','e','D','e','s','c','r','i','p','t','i','o','n','\0' },
392 13, /* wValueLength */
395 { 'I','n','t','e','r','n','a','l','N','a','m','e','\0' },
396 { 'I','n','t','e','r','n','a','l','N','a','m','e','\0' },
401 15, /* wValueLength */
404 { 'L','e','g','a','l','C','o','p','y','r','i','g','h','t','\0' },
405 { 'L','e','g','a','l','C','o','p','y','r','i','g','h','t','\0' },
407 /* LegalTrademarks */
410 16, /* wValueLength */
413 { 'L','e','g','a','l','T','r','a','d','e','m','a','r','k','s','\0' },
414 { 'L','e','g','a','l','T','r','a','d','e','m','a','r','k','s','\0' },
416 /* OriginalFilename */
419 17, /* wValueLength */
422 { 'O','r','i','g','i','n','a','l','F','i','l','e','n','a','m','e','\0' },
423 { 'O','r','i','g','i','n','a','l','F','i','l','e','n','a','m','e','\0' },
428 12, /* wValueLength */
431 { 'P','r','o','d','u','c','t','N','a','m','e','\0' },
432 { 'P','r','o','d','u','c','t','N','a','m','e','\0' },
438 0, /* wValueLength */
440 { 'V','a','r','F','i','l','e','I','n','f','o','\0' } /* szKey[13] */
446 4, /* wValueLength */
447 0, /* wType: Binary */
448 { 'T','r','a','n','s','l','a','t','i','o','n','\0' }, /* szKey[13] */
453 typedef struct export_section_t
455 IMAGE_EXPORT_DIRECTORY desc
;
456 char binary_name
[10];
459 /* This export section is not complete, but the Name RVA is only taken into account */
460 static export_section_t export_dir
=
463 0, /* Characteristics */
464 0, /* TimeDateStamp */
465 0, /* MajorVersion */
466 0, /* MinorVersion */
467 0x2398, /* Name (RVA) */
469 0, /* NumberOfFunctions */
470 0, /* NumberOfNames */
471 0, /* AddressOfFunctions (RVA) */
472 0, /* AddressOfNames (RVA) */
473 0, /* AddressOfNameOrdinals (RVA) */
475 { 'T','e','S','t','2','.','e','x','e',0 }, /* binary_name */
479 void test_create_exe_imp(const char* name
, int skip_rsrc_exports
)
486 file
= CreateFileA(name
, GENERIC_WRITE
, 0, NULL
, CREATE_ALWAYS
, FILE_ATTRIBUTE_NORMAL
, NULL
);
487 winetest_ok(file
!= INVALID_HANDLE_VALUE
, "can't create file\n");
488 if(file
== INVALID_HANDLE_VALUE
)
491 memset(buf
, 0, size
);
493 cur
= memcpy(buf
, &dos_header
, sizeof(dos_header
));
494 cur
+= dos_header
.e_lfanew
;
496 memcpy(cur
, &nt_header
, sizeof(nt_header
));
497 if (skip_rsrc_exports
)
499 ((IMAGE_NT_HEADERS32
*)cur
)->OptionalHeader
.DataDirectory
[IMAGE_DIRECTORY_ENTRY_EXPORT
].VirtualAddress
= 0;
500 ((IMAGE_NT_HEADERS32
*)cur
)->OptionalHeader
.DataDirectory
[IMAGE_DIRECTORY_ENTRY_RESOURCE
].VirtualAddress
= 0;
502 cur
+= sizeof(nt_header
);
503 memcpy(cur
, section_headers
, sizeof(section_headers
));
505 /* write code section: */
506 cur
= buf
+ section_headers
[0].PointerToRawData
;
507 memcpy(cur
, text_section
, sizeof(text_section
));
509 if (!skip_rsrc_exports
)
511 /* write resource section: */
512 cur
= buf
+ section_headers
[1].PointerToRawData
;
513 memcpy(cur
, &rsrc_section
, sizeof(rsrc_section
));
515 /* write minimal export directory: */
517 memcpy(cur
, &export_dir
, sizeof(export_dir
));
520 WriteFile(file
, buf
, size
, &size
, NULL
);
526 /* Almost everything in this filetype is ignored, only e_lfanew, ne_restab and ne_nrestab are relevant */
527 void test_create_ne_imp(const char* name
, int skip_names
)
531 IMAGE_DOS_HEADER MZ_hdr
= { IMAGE_DOS_SIGNATURE
, 0 };
532 IMAGE_OS2_HEADER NE_hdr
= { IMAGE_OS2_SIGNATURE
, 0 };
533 static const BYTE NE_names
[] =
535 /* Show that the length is used, not the nullterm*/
536 11,'T','E','S','T','M','O','D','.','h','X','x','x',0,0,0,
537 20,'M','O','D',' ','D','E','S','C','R','I','P','T','I','O','N',' ','H','E','R','E',0,0,0
540 file
= CreateFileA(name
, GENERIC_WRITE
, 0, NULL
, CREATE_ALWAYS
, FILE_ATTRIBUTE_NORMAL
, NULL
);
541 winetest_ok(file
!= INVALID_HANDLE_VALUE
, "can't create file\n");
542 if(file
== INVALID_HANDLE_VALUE
)
545 MZ_hdr
.e_lfanew
= sizeof(MZ_hdr
);
548 NE_hdr
.ne_restab
= sizeof(NE_hdr
); /* First entry (pascal string + ordinal) = module name */
549 NE_hdr
.ne_nrestab
= sizeof(MZ_hdr
) + sizeof(NE_hdr
) + 16; /* First entry (pascal string + ordinal) = module description */
552 WriteFile(file
, &MZ_hdr
, sizeof(MZ_hdr
), &size
, NULL
);
553 WriteFile(file
, &NE_hdr
, sizeof(NE_hdr
), &size
, NULL
);
554 WriteFile(file
, NE_names
, sizeof(NE_names
), &size
, NULL
);
559 void test_create_file_imp(const char* name
, const char* contents
, size_t len
)
561 HANDLE file
= CreateFileA(name
, GENERIC_WRITE
, 0, NULL
, CREATE_ALWAYS
, FILE_ATTRIBUTE_NORMAL
, NULL
);
562 winetest_ok(file
!= INVALID_HANDLE_VALUE
, "can't create file\n");
563 if (file
!= INVALID_HANDLE_VALUE
)
568 WriteFile(file
, contents
, len
, &size
, NULL
);
574 static unsigned char rawData
[2356] = {
575 0x02, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x73, 0x64, 0x62, 0x66,
576 0x02, 0x78, 0x3E, 0x01, 0x00, 0x00, 0x03, 0x78, 0x44, 0x00, 0x00, 0x00,
577 0x02, 0x38, 0x07, 0x70, 0x03, 0x38, 0x01, 0x60, 0x16, 0x40, 0x01, 0x00,
578 0x00, 0x00, 0x01, 0x98, 0x30, 0x00, 0x00, 0x00, 0x4C, 0x4C, 0x41, 0x5F,
579 0x54, 0x53, 0x45, 0x54, 0xC6, 0x01, 0x00, 0x00, 0x53, 0x49, 0x44, 0x5F,
580 0x54, 0x53, 0x45, 0x54, 0x56, 0x02, 0x00, 0x00, 0x57, 0x45, 0x4E, 0x5F,
581 0x54, 0x53, 0x45, 0x54, 0xEC, 0x02, 0x00, 0x00, 0x4B, 0x32, 0x57, 0x5F,
582 0x54, 0x53, 0x45, 0x54, 0x7C, 0x03, 0x00, 0x00, 0x03, 0x78, 0x0E, 0x00,
583 0x00, 0x00, 0x02, 0x38, 0x07, 0x70, 0x03, 0x38, 0x0B, 0x60, 0x01, 0x98,
584 0x00, 0x00, 0x00, 0x00, 0x03, 0x78, 0x0E, 0x00, 0x00, 0x00, 0x02, 0x38,
585 0x07, 0x70, 0x03, 0x38, 0x20, 0x60, 0x01, 0x98, 0x00, 0x00, 0x00, 0x00,
586 0x03, 0x78, 0x0E, 0x00, 0x00, 0x00, 0x02, 0x38, 0x04, 0x70, 0x03, 0x38,
587 0x01, 0x60, 0x01, 0x98, 0x00, 0x00, 0x00, 0x00, 0x03, 0x78, 0x26, 0x00,
588 0x00, 0x00, 0x02, 0x38, 0x0D, 0x70, 0x03, 0x38, 0x15, 0x40, 0x01, 0x98,
589 0x18, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
590 0x74, 0x04, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
591 0x50, 0x04, 0x00, 0x00, 0x03, 0x78, 0x14, 0x00, 0x00, 0x00, 0x02, 0x38,
592 0x10, 0x70, 0x03, 0x38, 0x01, 0x60, 0x16, 0x40, 0x01, 0x00, 0x00, 0x00,
593 0x01, 0x98, 0x00, 0x00, 0x00, 0x00, 0x03, 0x78, 0x0E, 0x00, 0x00, 0x00,
594 0x02, 0x38, 0x12, 0x70, 0x03, 0x38, 0x06, 0x90, 0x01, 0x98, 0x00, 0x00,
595 0x00, 0x00, 0x03, 0x78, 0x14, 0x00, 0x00, 0x00, 0x02, 0x38, 0x12, 0x70,
596 0x03, 0x38, 0x04, 0x90, 0x16, 0x40, 0x01, 0x00, 0x00, 0x00, 0x01, 0x98,
597 0x00, 0x00, 0x00, 0x00, 0x03, 0x78, 0x3E, 0x00, 0x00, 0x00, 0x02, 0x38,
598 0x07, 0x70, 0x03, 0x38, 0x04, 0x90, 0x01, 0x98, 0x30, 0x00, 0x00, 0x00,
599 0xED, 0xB4, 0x89, 0x50, 0xB1, 0xA4, 0x82, 0xA7, 0xEC, 0x02, 0x00, 0x00,
600 0x85, 0x2B, 0x88, 0x40, 0x97, 0x76, 0xA6, 0xC4, 0xC6, 0x01, 0x00, 0x00,
601 0x77, 0x7A, 0xBF, 0x48, 0x78, 0xB1, 0x69, 0xD2, 0x56, 0x02, 0x00, 0x00,
602 0xD0, 0x15, 0xE6, 0xCB, 0xE8, 0x90, 0x68, 0xFE, 0x7C, 0x03, 0x00, 0x00,
603 0x01, 0x70, 0x42, 0x03, 0x00, 0x00, 0x01, 0x50, 0x3E, 0xD6, 0xC0, 0x02,
604 0x1A, 0xB9, 0xD1, 0x01, 0x22, 0x60, 0x06, 0x00, 0x00, 0x00, 0x01, 0x60,
605 0x1C, 0x00, 0x00, 0x00, 0x23, 0x40, 0x01, 0x00, 0x00, 0x00, 0x07, 0x90,
606 0x10, 0x00, 0x00, 0x00, 0xB0, 0x0E, 0x9B, 0xE3, 0xDB, 0x55, 0x0B, 0x45,
607 0x9B, 0xD4, 0xD2, 0x0C, 0x94, 0x84, 0x26, 0x0F, 0x02, 0x70, 0x00, 0x00,
608 0x00, 0x00, 0x0B, 0x70, 0x32, 0x00, 0x00, 0x00, 0x01, 0x60, 0x3E, 0x00,
609 0x00, 0x00, 0x09, 0x70, 0x26, 0x00, 0x00, 0x00, 0x01, 0x60, 0x5C, 0x00,
610 0x00, 0x00, 0x08, 0x60, 0x82, 0x00, 0x00, 0x00, 0x03, 0x70, 0x06, 0x00,
611 0x00, 0x00, 0x03, 0x60, 0xA0, 0x00, 0x00, 0x00, 0x03, 0x70, 0x08, 0x00,
612 0x00, 0x00, 0x01, 0x10, 0x03, 0x60, 0xBE, 0x00, 0x00, 0x00, 0x07, 0x70,
613 0x8A, 0x00, 0x00, 0x00, 0x01, 0x60, 0xDC, 0x00, 0x00, 0x00, 0x06, 0x60,
614 0x00, 0x01, 0x00, 0x00, 0x05, 0x60, 0x2C, 0x01, 0x00, 0x00, 0x04, 0x90,
615 0x10, 0x00, 0x00, 0x00, 0x3F, 0xC9, 0x50, 0x4E, 0x63, 0xB8, 0xFA, 0x4D,
616 0xBA, 0xE2, 0xD8, 0x0E, 0xF4, 0xCE, 0x5C, 0x89, 0x0D, 0x70, 0x24, 0x00,
617 0x00, 0x00, 0x17, 0x40, 0x01, 0x00, 0x00, 0x00, 0x10, 0x40, 0x01, 0x00,
618 0x00, 0x00, 0x15, 0x40, 0x01, 0x00, 0x00, 0x00, 0x24, 0x40, 0x72, 0x00,
619 0x6F, 0x00, 0x25, 0x40, 0x67, 0x00, 0x72, 0x00, 0x26, 0x40, 0x00, 0x00,
620 0x00, 0x00, 0x08, 0x70, 0x32, 0x00, 0x00, 0x00, 0x01, 0x60, 0x5C, 0x01,
621 0x00, 0x00, 0x09, 0x60, 0x66, 0x01, 0x00, 0x00, 0x10, 0x60, 0x84, 0x01,
622 0x00, 0x00, 0x11, 0x60, 0xA2, 0x01, 0x00, 0x00, 0x13, 0x60, 0xB8, 0x01,
623 0x00, 0x00, 0x06, 0x50, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00,
624 0x0D, 0x50, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x07, 0x70,
625 0x90, 0x00, 0x00, 0x00, 0x01, 0x60, 0xCE, 0x01, 0x00, 0x00, 0x06, 0x60,
626 0xF8, 0x01, 0x00, 0x00, 0x05, 0x60, 0x2A, 0x02, 0x00, 0x00, 0x04, 0x90,
627 0x10, 0x00, 0x00, 0x00, 0xE1, 0x20, 0x67, 0x15, 0x98, 0xEF, 0x04, 0x4D,
628 0x96, 0x5A, 0xD8, 0x5D, 0xE0, 0x5E, 0x6D, 0x9F, 0x0D, 0x70, 0x24, 0x00,
629 0x00, 0x00, 0x17, 0x40, 0x01, 0x00, 0x00, 0x00, 0x10, 0x40, 0x02, 0x00,
630 0x00, 0x00, 0x15, 0x40, 0x02, 0x00, 0x00, 0x00, 0x24, 0x40, 0x20, 0x00,
631 0x32, 0x00, 0x25, 0x40, 0x2E, 0x00, 0x38, 0x00, 0x26, 0x40, 0x00, 0x00,
632 0x00, 0x00, 0x08, 0x70, 0x38, 0x00, 0x00, 0x00, 0x01, 0x60, 0x5C, 0x01,
633 0x00, 0x00, 0x09, 0x60, 0x66, 0x01, 0x00, 0x00, 0x10, 0x60, 0x84, 0x01,
634 0x00, 0x00, 0x11, 0x60, 0xA2, 0x01, 0x00, 0x00, 0x02, 0x50, 0x00, 0x00,
635 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x03, 0x50, 0x01, 0x00, 0x00, 0x00,
636 0x00, 0x00, 0x01, 0x00, 0x0B, 0x40, 0xAD, 0xBA, 0x00, 0x00, 0x13, 0x60,
637 0xB8, 0x01, 0x00, 0x00, 0x07, 0x70, 0x8A, 0x00, 0x00, 0x00, 0x01, 0x60,
638 0x60, 0x02, 0x00, 0x00, 0x06, 0x60, 0x80, 0x02, 0x00, 0x00, 0x05, 0x60,
639 0x9E, 0x02, 0x00, 0x00, 0x04, 0x90, 0x10, 0x00, 0x00, 0x00, 0x69, 0xEF,
640 0x70, 0xCE, 0x1D, 0xA2, 0x8B, 0x40, 0x84, 0x5B, 0xF9, 0x9E, 0xAC, 0x06,
641 0x09, 0xE7, 0x08, 0x70, 0x32, 0x00, 0x00, 0x00, 0x01, 0x60, 0x5C, 0x01,
642 0x00, 0x00, 0x09, 0x60, 0x66, 0x01, 0x00, 0x00, 0x10, 0x60, 0x84, 0x01,
643 0x00, 0x00, 0x11, 0x60, 0xA2, 0x01, 0x00, 0x00, 0x02, 0x50, 0x00, 0x00,
644 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x03, 0x50, 0x01, 0x00, 0x00, 0x00,
645 0x00, 0x00, 0x01, 0x00, 0x13, 0x60, 0xB8, 0x01, 0x00, 0x00, 0x08, 0x70,
646 0x12, 0x00, 0x00, 0x00, 0x01, 0x60, 0xC0, 0x02, 0x00, 0x00, 0x01, 0x40,
647 0x04, 0x00, 0x00, 0x00, 0x03, 0x40, 0xB0, 0xB0, 0xB0, 0xB0, 0x0B, 0x70,
648 0x0C, 0x00, 0x00, 0x00, 0x01, 0x60, 0x3E, 0x00, 0x00, 0x00, 0x1A, 0x40,
649 0x8E, 0x01, 0x00, 0x00, 0x07, 0x70, 0xCE, 0x00, 0x00, 0x00, 0x01, 0x60,
650 0xEC, 0x02, 0x00, 0x00, 0x06, 0x60, 0x0E, 0x03, 0x00, 0x00, 0x05, 0x60,
651 0x26, 0x03, 0x00, 0x00, 0x04, 0x90, 0x10, 0x00, 0x00, 0x00, 0x44, 0xD1,
652 0xEA, 0xB4, 0x40, 0xF6, 0x4B, 0x4E, 0x94, 0xC4, 0x0C, 0x7F, 0xA8, 0x66,
653 0x23, 0xB0, 0x08, 0x70, 0x94, 0x00, 0x00, 0x00, 0x01, 0x60, 0x5C, 0x01,
654 0x00, 0x00, 0x01, 0x40, 0x00, 0x08, 0x00, 0x00, 0x03, 0x40, 0x29, 0xD6,
655 0x8B, 0x17, 0x09, 0x60, 0x66, 0x01, 0x00, 0x00, 0x10, 0x60, 0x84, 0x01,
656 0x00, 0x00, 0x11, 0x60, 0xA2, 0x01, 0x00, 0x00, 0x12, 0x60, 0x42, 0x03,
657 0x00, 0x00, 0x02, 0x50, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00,
658 0x03, 0x50, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x06, 0x40,
659 0x03, 0x00, 0x00, 0x00, 0x09, 0x40, 0x04, 0x00, 0x00, 0x00, 0x0A, 0x40,
660 0x01, 0x00, 0x00, 0x00, 0x0B, 0x40, 0xAD, 0xBA, 0x00, 0x00, 0x1C, 0x40,
661 0x02, 0x00, 0x04, 0x00, 0x13, 0x60, 0xB8, 0x01, 0x00, 0x00, 0x14, 0x60,
662 0x68, 0x03, 0x00, 0x00, 0x15, 0x60, 0x90, 0x03, 0x00, 0x00, 0x16, 0x60,
663 0xB0, 0x03, 0x00, 0x00, 0x06, 0x50, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00,
664 0x01, 0x00, 0x0D, 0x50, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00,
665 0x1D, 0x40, 0x45, 0x23, 0x01, 0x00, 0x1E, 0x40, 0x45, 0x23, 0x01, 0x00,
666 0x0B, 0x70, 0x06, 0x00, 0x00, 0x00, 0x01, 0x60, 0xD4, 0x03, 0x00, 0x00,
667 0x0D, 0x70, 0x1E, 0x00, 0x00, 0x00, 0x15, 0x40, 0x02, 0x00, 0x00, 0x00,
668 0x0E, 0x70, 0x06, 0x00, 0x00, 0x00, 0x19, 0x60, 0xEC, 0x03, 0x00, 0x00,
669 0x1B, 0x60, 0xF8, 0x01, 0x00, 0x00, 0x18, 0x60, 0x2A, 0x04, 0x00, 0x00,
670 0x0D, 0x70, 0x1E, 0x00, 0x00, 0x00, 0x15, 0x40, 0x01, 0x00, 0x00, 0x00,
671 0x0E, 0x70, 0x06, 0x00, 0x00, 0x00, 0x19, 0x60, 0x4A, 0x04, 0x00, 0x00,
672 0x1B, 0x60, 0x00, 0x01, 0x00, 0x00, 0x18, 0x60, 0x82, 0x04, 0x00, 0x00,
673 0x01, 0x78, 0x96, 0x04, 0x00, 0x00, 0x01, 0x88, 0x10, 0x00, 0x00, 0x00,
674 0x32, 0x00, 0x2E, 0x00, 0x31, 0x00, 0x2E, 0x00, 0x30, 0x00, 0x2E, 0x00,
675 0x33, 0x00, 0x00, 0x00, 0x01, 0x88, 0x1C, 0x00, 0x00, 0x00, 0x61, 0x00,
676 0x70, 0x00, 0x70, 0x00, 0x68, 0x00, 0x65, 0x00, 0x6C, 0x00, 0x70, 0x00,
677 0x5F, 0x00, 0x74, 0x00, 0x65, 0x00, 0x73, 0x00, 0x74, 0x00, 0x31, 0x00,
678 0x00, 0x00, 0x01, 0x88, 0x18, 0x00, 0x00, 0x00, 0x54, 0x00, 0x65, 0x00,
679 0x73, 0x00, 0x74, 0x00, 0x4E, 0x00, 0x65, 0x00, 0x77, 0x00, 0x4D, 0x00,
680 0x6F, 0x00, 0x64, 0x00, 0x65, 0x00, 0x00, 0x00, 0x01, 0x88, 0x20, 0x00,
681 0x00, 0x00, 0x56, 0x00, 0x69, 0x00, 0x72, 0x00, 0x74, 0x00, 0x75, 0x00,
682 0x61, 0x00, 0x6C, 0x00, 0x52, 0x00, 0x65, 0x00, 0x67, 0x00, 0x69, 0x00,
683 0x73, 0x00, 0x74, 0x00, 0x72, 0x00, 0x79, 0x00, 0x00, 0x00, 0x01, 0x88,
684 0x18, 0x00, 0x00, 0x00, 0x54, 0x00, 0x68, 0x00, 0x65, 0x00, 0x6D, 0x00,
685 0x65, 0x00, 0x41, 0x00, 0x63, 0x00, 0x74, 0x00, 0x69, 0x00, 0x76, 0x00,
686 0x65, 0x00, 0x00, 0x00, 0x01, 0x88, 0x18, 0x00, 0x00, 0x00, 0x65, 0x00,
687 0x78, 0x00, 0x63, 0x00, 0x6C, 0x00, 0x75, 0x00, 0x64, 0x00, 0x65, 0x00,
688 0x2E, 0x00, 0x64, 0x00, 0x6C, 0x00, 0x6C, 0x00, 0x00, 0x00, 0x01, 0x88,
689 0x18, 0x00, 0x00, 0x00, 0x69, 0x00, 0x6E, 0x00, 0x63, 0x00, 0x6C, 0x00,
690 0x75, 0x00, 0x64, 0x00, 0x65, 0x00, 0x2E, 0x00, 0x64, 0x00, 0x6C, 0x00,
691 0x6C, 0x00, 0x00, 0x00, 0x01, 0x88, 0x1E, 0x00, 0x00, 0x00, 0x74, 0x00,
692 0x65, 0x00, 0x73, 0x00, 0x74, 0x00, 0x5F, 0x00, 0x61, 0x00, 0x6C, 0x00,
693 0x6C, 0x00, 0x6F, 0x00, 0x77, 0x00, 0x2E, 0x00, 0x65, 0x00, 0x78, 0x00,
694 0x65, 0x00, 0x00, 0x00, 0x01, 0x88, 0x26, 0x00, 0x00, 0x00, 0x61, 0x00,
695 0x70, 0x00, 0x70, 0x00, 0x68, 0x00, 0x65, 0x00, 0x6C, 0x00, 0x70, 0x00,
696 0x5F, 0x00, 0x6E, 0x00, 0x61, 0x00, 0x6D, 0x00, 0x65, 0x00, 0x5F, 0x00,
697 0x61, 0x00, 0x6C, 0x00, 0x6C, 0x00, 0x6F, 0x00, 0x77, 0x00, 0x00, 0x00,
698 0x01, 0x88, 0x2A, 0x00, 0x00, 0x00, 0x61, 0x00, 0x70, 0x00, 0x70, 0x00,
699 0x68, 0x00, 0x65, 0x00, 0x6C, 0x00, 0x70, 0x00, 0x5F, 0x00, 0x76, 0x00,
700 0x65, 0x00, 0x6E, 0x00, 0x64, 0x00, 0x6F, 0x00, 0x72, 0x00, 0x5F, 0x00,
701 0x61, 0x00, 0x6C, 0x00, 0x6C, 0x00, 0x6F, 0x00, 0x77, 0x00, 0x00, 0x00,
702 0x01, 0x88, 0x04, 0x00, 0x00, 0x00, 0x2A, 0x00, 0x00, 0x00, 0x01, 0x88,
703 0x18, 0x00, 0x00, 0x00, 0x43, 0x00, 0x6F, 0x00, 0x6D, 0x00, 0x70, 0x00,
704 0x61, 0x00, 0x6E, 0x00, 0x79, 0x00, 0x4E, 0x00, 0x61, 0x00, 0x6D, 0x00,
705 0x65, 0x00, 0x00, 0x00, 0x01, 0x88, 0x18, 0x00, 0x00, 0x00, 0x50, 0x00,
706 0x72, 0x00, 0x6F, 0x00, 0x64, 0x00, 0x75, 0x00, 0x63, 0x00, 0x74, 0x00,
707 0x4E, 0x00, 0x61, 0x00, 0x6D, 0x00, 0x65, 0x00, 0x00, 0x00, 0x01, 0x88,
708 0x10, 0x00, 0x00, 0x00, 0x31, 0x00, 0x2E, 0x00, 0x30, 0x00, 0x2E, 0x00,
709 0x30, 0x00, 0x2E, 0x00, 0x31, 0x00, 0x00, 0x00, 0x01, 0x88, 0x10, 0x00,
710 0x00, 0x00, 0x31, 0x00, 0x2E, 0x00, 0x30, 0x00, 0x2E, 0x00, 0x30, 0x00,
711 0x2E, 0x00, 0x30, 0x00, 0x00, 0x00, 0x01, 0x88, 0x24, 0x00, 0x00, 0x00,
712 0x74, 0x00, 0x65, 0x00, 0x73, 0x00, 0x74, 0x00, 0x5F, 0x00, 0x64, 0x00,
713 0x69, 0x00, 0x73, 0x00, 0x61, 0x00, 0x6C, 0x00, 0x6C, 0x00, 0x6F, 0x00,
714 0x77, 0x00, 0x2E, 0x00, 0x65, 0x00, 0x78, 0x00, 0x65, 0x00, 0x00, 0x00,
715 0x01, 0x88, 0x2C, 0x00, 0x00, 0x00, 0x61, 0x00, 0x70, 0x00, 0x70, 0x00,
716 0x68, 0x00, 0x65, 0x00, 0x6C, 0x00, 0x70, 0x00, 0x5F, 0x00, 0x6E, 0x00,
717 0x61, 0x00, 0x6D, 0x00, 0x65, 0x00, 0x5F, 0x00, 0x64, 0x00, 0x69, 0x00,
718 0x73, 0x00, 0x61, 0x00, 0x6C, 0x00, 0x6C, 0x00, 0x6F, 0x00, 0x77, 0x00,
719 0x00, 0x00, 0x01, 0x88, 0x30, 0x00, 0x00, 0x00, 0x61, 0x00, 0x70, 0x00,
720 0x70, 0x00, 0x68, 0x00, 0x65, 0x00, 0x6C, 0x00, 0x70, 0x00, 0x5F, 0x00,
721 0x76, 0x00, 0x65, 0x00, 0x6E, 0x00, 0x64, 0x00, 0x6F, 0x00, 0x72, 0x00,
722 0x5F, 0x00, 0x64, 0x00, 0x69, 0x00, 0x73, 0x00, 0x61, 0x00, 0x6C, 0x00,
723 0x6C, 0x00, 0x6F, 0x00, 0x77, 0x00, 0x00, 0x00, 0x01, 0x88, 0x1A, 0x00,
724 0x00, 0x00, 0x74, 0x00, 0x65, 0x00, 0x73, 0x00, 0x74, 0x00, 0x5F, 0x00,
725 0x6E, 0x00, 0x65, 0x00, 0x77, 0x00, 0x2E, 0x00, 0x65, 0x00, 0x78, 0x00,
726 0x65, 0x00, 0x00, 0x00, 0x01, 0x88, 0x18, 0x00, 0x00, 0x00, 0x66, 0x00,
727 0x69, 0x00, 0x78, 0x00, 0x6E, 0x00, 0x65, 0x00, 0x77, 0x00, 0x5F, 0x00,
728 0x6E, 0x00, 0x61, 0x00, 0x6D, 0x00, 0x65, 0x00, 0x00, 0x00, 0x01, 0x88,
729 0x1C, 0x00, 0x00, 0x00, 0x66, 0x00, 0x69, 0x00, 0x78, 0x00, 0x6E, 0x00,
730 0x65, 0x00, 0x77, 0x00, 0x5F, 0x00, 0x76, 0x00, 0x65, 0x00, 0x6E, 0x00,
731 0x64, 0x00, 0x6F, 0x00, 0x72, 0x00, 0x00, 0x00, 0x01, 0x88, 0x26, 0x00,
732 0x00, 0x00, 0x74, 0x00, 0x65, 0x00, 0x73, 0x00, 0x74, 0x00, 0x5F, 0x00,
733 0x63, 0x00, 0x68, 0x00, 0x65, 0x00, 0x63, 0x00, 0x6B, 0x00, 0x66, 0x00,
734 0x69, 0x00, 0x6C, 0x00, 0x65, 0x00, 0x2E, 0x00, 0x74, 0x00, 0x78, 0x00,
735 0x74, 0x00, 0x00, 0x00, 0x01, 0x88, 0x1C, 0x00, 0x00, 0x00, 0x74, 0x00,
736 0x65, 0x00, 0x73, 0x00, 0x74, 0x00, 0x5F, 0x00, 0x77, 0x00, 0x32, 0x00,
737 0x6B, 0x00, 0x33, 0x00, 0x2E, 0x00, 0x65, 0x00, 0x78, 0x00, 0x65, 0x00,
738 0x00, 0x00, 0x01, 0x88, 0x12, 0x00, 0x00, 0x00, 0x66, 0x00, 0x69, 0x00,
739 0x78, 0x00, 0x5F, 0x00, 0x6E, 0x00, 0x61, 0x00, 0x6D, 0x00, 0x65, 0x00,
740 0x00, 0x00, 0x01, 0x88, 0x16, 0x00, 0x00, 0x00, 0x66, 0x00, 0x69, 0x00,
741 0x78, 0x00, 0x5F, 0x00, 0x76, 0x00, 0x65, 0x00, 0x6E, 0x00, 0x64, 0x00,
742 0x6F, 0x00, 0x72, 0x00, 0x00, 0x00, 0x01, 0x88, 0x20, 0x00, 0x00, 0x00,
743 0x46, 0x00, 0x69, 0x00, 0x6C, 0x00, 0x65, 0x00, 0x44, 0x00, 0x65, 0x00,
744 0x73, 0x00, 0x63, 0x00, 0x72, 0x00, 0x69, 0x00, 0x70, 0x00, 0x74, 0x00,
745 0x69, 0x00, 0x6F, 0x00, 0x6E, 0x00, 0x00, 0x00, 0x01, 0x88, 0x22, 0x00,
746 0x00, 0x00, 0x4F, 0x00, 0x72, 0x00, 0x69, 0x00, 0x67, 0x00, 0x69, 0x00,
747 0x6E, 0x00, 0x61, 0x00, 0x6C, 0x00, 0x46, 0x00, 0x69, 0x00, 0x6C, 0x00,
748 0x65, 0x00, 0x6E, 0x00, 0x61, 0x00, 0x6D, 0x00, 0x65, 0x00, 0x00, 0x00,
749 0x01, 0x88, 0x1A, 0x00, 0x00, 0x00, 0x49, 0x00, 0x6E, 0x00, 0x74, 0x00,
750 0x65, 0x00, 0x72, 0x00, 0x6E, 0x00, 0x61, 0x00, 0x6C, 0x00, 0x4E, 0x00,
751 0x61, 0x00, 0x6D, 0x00, 0x65, 0x00, 0x00, 0x00, 0x01, 0x88, 0x1E, 0x00,
752 0x00, 0x00, 0x4C, 0x00, 0x65, 0x00, 0x67, 0x00, 0x61, 0x00, 0x6C, 0x00,
753 0x43, 0x00, 0x6F, 0x00, 0x70, 0x00, 0x79, 0x00, 0x72, 0x00, 0x69, 0x00,
754 0x67, 0x00, 0x68, 0x00, 0x74, 0x00, 0x00, 0x00, 0x01, 0x88, 0x12, 0x00,
755 0x00, 0x00, 0x57, 0x00, 0x69, 0x00, 0x6E, 0x00, 0x53, 0x00, 0x72, 0x00,
756 0x76, 0x00, 0x30, 0x00, 0x33, 0x00, 0x00, 0x00, 0x01, 0x88, 0x38, 0x00,
757 0x00, 0x00, 0x68, 0x00, 0x74, 0x00, 0x74, 0x00, 0x70, 0x00, 0x3A, 0x00,
758 0x2F, 0x00, 0x2F, 0x00, 0x72, 0x00, 0x65, 0x00, 0x61, 0x00, 0x63, 0x00,
759 0x74, 0x00, 0x6F, 0x00, 0x73, 0x00, 0x2E, 0x00, 0x6F, 0x00, 0x72, 0x00,
760 0x67, 0x00, 0x2F, 0x00, 0x64, 0x00, 0x69, 0x00, 0x73, 0x00, 0x61, 0x00,
761 0x6C, 0x00, 0x6C, 0x00, 0x6F, 0x00, 0x77, 0x00, 0x00, 0x00, 0x01, 0x88,
762 0x1A, 0x00, 0x00, 0x00, 0x4E, 0x00, 0x6F, 0x00, 0x74, 0x00, 0x20, 0x00,
763 0x61, 0x00, 0x6C, 0x00, 0x6C, 0x00, 0x6F, 0x00, 0x77, 0x00, 0x65, 0x00,
764 0x64, 0x00, 0x21, 0x00, 0x00, 0x00, 0x01, 0x88, 0x32, 0x00, 0x00, 0x00,
765 0x68, 0x00, 0x74, 0x00, 0x74, 0x00, 0x70, 0x00, 0x3A, 0x00, 0x2F, 0x00,
766 0x2F, 0x00, 0x72, 0x00, 0x65, 0x00, 0x61, 0x00, 0x63, 0x00, 0x74, 0x00,
767 0x6F, 0x00, 0x73, 0x00, 0x2E, 0x00, 0x6F, 0x00, 0x72, 0x00, 0x67, 0x00,
768 0x2F, 0x00, 0x61, 0x00, 0x6C, 0x00, 0x6C, 0x00, 0x6F, 0x00, 0x77, 0x00,
769 0x00, 0x00, 0x01, 0x88, 0x14, 0x00, 0x00, 0x00, 0x41, 0x00, 0x6C, 0x00,
770 0x6C, 0x00, 0x6F, 0x00, 0x77, 0x00, 0x20, 0x00, 0x69, 0x00, 0x74, 0x00,
771 0x21, 0x00, 0x00, 0x00
774 DWORD
test_get_db_size()
776 return sizeof(rawData
);
779 void test_create_db_imp(const char* name
)
781 HANDLE file
= CreateFileA(name
, GENERIC_WRITE
, 0, NULL
, CREATE_ALWAYS
, FILE_ATTRIBUTE_NORMAL
, NULL
);
782 winetest_ok(file
!= INVALID_HANDLE_VALUE
, "can't create file '%s'\n", name
);
783 if (file
!= INVALID_HANDLE_VALUE
)
786 WriteFile(file
, rawData
, sizeof(rawData
), &size
, NULL
);
791 static DWORD g_WinVersion
;
792 DWORD
get_host_winver(void)
796 RTL_OSVERSIONINFOEXW rtlinfo
= {0};
797 void (__stdcall
* pRtlGetVersion
)(RTL_OSVERSIONINFOEXW
*);
798 pRtlGetVersion
= (void (__stdcall
*)(RTL_OSVERSIONINFOEXW
*))GetProcAddress(GetModuleHandleA("ntdll"), "RtlGetVersion");
800 rtlinfo
.dwOSVersionInfoSize
= sizeof(rtlinfo
);
801 pRtlGetVersion(&rtlinfo
);
802 g_WinVersion
= (rtlinfo
.dwMajorVersion
<< 8) | rtlinfo
.dwMinorVersion
;
807 void silence_debug_output(void)
809 if (GetEnvironmentVariableA("SHIM_DEBUG_LEVEL", NULL
, 0) == ERROR_ENVVAR_NOT_FOUND
)
810 SetEnvironmentVariableA("SHIM_DEBUG_LEVEL", "0");
811 if (GetEnvironmentVariableA("SHIMENG_DEBUG_LEVEL", NULL
, 0) == ERROR_ENVVAR_NOT_FOUND
)
812 SetEnvironmentVariableA("SHIMENG_DEBUG_LEVEL", "0");