kernel32/tests: Add tests for FillConsoleOutputCharacterA.
[wine] / dlls / kernel32 / tests / resource.c
1 /*
2  * Unit test suite for resource functions.
3  *
4  * Copyright 2006 Mike McCormack
5  *
6  * This library is free software; you can redistribute it and/or
7  * modify it under the terms of the GNU Lesser General Public
8  * License as published by the Free Software Foundation; either
9  * version 2.1 of the License, or (at your option) any later version.
10  *
11  * This library is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
14  * Lesser General Public License for more details.
15  *
16  * You should have received a copy of the GNU Lesser General Public
17  * License along with this library; if not, write to the Free Software
18  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
19  */
20
21 #include <windows.h>
22 #include <stdio.h>
23
24 #include "wine/test.h"
25
26 static const char filename[] = "test_.exe";
27 static DWORD GLE;
28
29 enum constants {
30     page_size = 0x1000,
31     rva_rsrc_start = page_size * 3,
32     max_sections = 3
33 };
34
35 /* rodata @ [0x1000-0x3000) */
36 static const IMAGE_SECTION_HEADER sh_rodata_1 =
37 {
38     ".rodata", {2*page_size}, page_size, 2*page_size, page_size, 0, 0, 0, 0,
39     IMAGE_SCN_CNT_INITIALIZED_DATA | IMAGE_SCN_MEM_READ
40 };
41
42 /* rodata @ [0x1000-0x4000) */
43 static const IMAGE_SECTION_HEADER sh_rodata_2 =
44 {
45     ".rodata", {3*page_size}, page_size, 3*page_size, page_size, 0, 0, 0, 0,
46     IMAGE_SCN_CNT_INITIALIZED_DATA | IMAGE_SCN_MEM_READ
47 };
48
49 /* rodata @ [0x1000-0x2000) */
50 static const IMAGE_SECTION_HEADER sh_rodata_3 =
51 {
52     ".rodata", {page_size}, page_size, page_size, page_size, 0, 0, 0, 0,
53     IMAGE_SCN_CNT_INITIALIZED_DATA | IMAGE_SCN_MEM_READ
54 };
55
56 /* rsrc @ [0x3000-0x4000) */
57 static const IMAGE_SECTION_HEADER sh_rsrc_1 =
58 {
59     ".rsrc\0\0", {page_size}, rva_rsrc_start, page_size, rva_rsrc_start, 0, 0, 0, 0,
60     IMAGE_SCN_CNT_INITIALIZED_DATA | IMAGE_SCN_MEM_READ
61 };
62
63 /* rsrc @ [0x4000-0x5000) */
64 static const IMAGE_SECTION_HEADER sh_rsrc_2 =
65 {
66     ".rsrc\0\0", {page_size}, 4*page_size, page_size, 4*page_size, 0, 0, 0, 0,
67     IMAGE_SCN_CNT_INITIALIZED_DATA | IMAGE_SCN_MEM_READ
68 };
69
70 /* rsrc @ [0x2000-0x4000) */
71 static const IMAGE_SECTION_HEADER sh_rsrc_3 =
72 {
73     ".rsrc\0\0", {2*page_size}, rva_rsrc_start-page_size, 2*page_size, rva_rsrc_start-page_size, 0, 0, 0, 0,
74     IMAGE_SCN_CNT_INITIALIZED_DATA | IMAGE_SCN_MEM_READ
75 };
76
77 /* rsrc @ [0x2000-0x3000) */
78 static const IMAGE_SECTION_HEADER sh_rsrc_4 =
79 {
80     ".rsrc\0\0", {page_size}, rva_rsrc_start-page_size, page_size, rva_rsrc_start-page_size, 0, 0, 0, 0,
81     IMAGE_SCN_CNT_INITIALIZED_DATA | IMAGE_SCN_MEM_READ
82 };
83
84 /* rsrc @ [0x3000-0x6000) */
85 static const IMAGE_SECTION_HEADER sh_rsrc_5 =
86 {
87     ".rsrc\0\0", {3*page_size}, rva_rsrc_start, 3*page_size, rva_rsrc_start, 0, 0, 0, 0,
88     IMAGE_SCN_CNT_INITIALIZED_DATA | IMAGE_SCN_MEM_READ
89 };
90
91 /* rsrc @ [0x4000-0x7000) */
92 static const IMAGE_SECTION_HEADER sh_rsrc_6 =
93 {
94     ".rsrc\0\0", {3*page_size}, 4*page_size, 3*page_size, 4*page_size, 0, 0, 0, 0,
95     IMAGE_SCN_CNT_INITIALIZED_DATA | IMAGE_SCN_MEM_READ
96 };
97
98 /* rsrc @ [0x2000-0x5000) */
99 static const IMAGE_SECTION_HEADER sh_rsrc_7 =
100 {
101     ".rsrc\0\0", {3*page_size}, 2*page_size, 3*page_size, 2*page_size, 0, 0, 0, 0,
102     IMAGE_SCN_CNT_INITIALIZED_DATA | IMAGE_SCN_MEM_READ
103 };
104
105 /* rsrc @ [0x3000-0x4000), small SizeOfRawData */
106 static const IMAGE_SECTION_HEADER sh_rsrc_8 =
107 {
108     ".rsrc\0\0", {page_size}, rva_rsrc_start, 8, rva_rsrc_start, 0, 0, 0, 0,
109     IMAGE_SCN_CNT_INITIALIZED_DATA | IMAGE_SCN_MEM_READ
110 };
111
112 /* reloc @ [0x4000-0x5000) */
113 static const IMAGE_SECTION_HEADER sh_junk =
114 {
115     ".reloc\0", {page_size}, 4*page_size, page_size, 4*page_size, 0, 0, 0, 0,
116     IMAGE_SCN_CNT_INITIALIZED_DATA | IMAGE_SCN_MEM_READ
117 };
118
119 /* reloc @ [0x6000-0x7000) */
120 static const IMAGE_SECTION_HEADER sh_junk_2 =
121 {
122     ".reloc\0", {page_size}, 6*page_size, page_size, 6*page_size, 0, 0, 0, 0,
123     IMAGE_SCN_CNT_INITIALIZED_DATA | IMAGE_SCN_MEM_READ
124 };
125
126 typedef struct _sec_build
127 {
128     const IMAGE_SECTION_HEADER *sect_in[max_sections];
129 } sec_build;
130
131 typedef struct _sec_verify
132 {
133     const IMAGE_SECTION_HEADER *sect_out[max_sections];
134     DWORD length;
135     int rsrc_section;
136     DWORD NumberOfNamedEntries, NumberOfIdEntries;
137 } sec_verify;
138
139 static const struct _sec_variants
140 {
141     sec_build build;
142     sec_verify chk_none, chk_delete, chk_version, chk_bigdata;
143 } sec_variants[] =
144 {
145     /* .rsrc is the last section, data directory entry points to whole section */
146     {
147         {{&sh_rodata_1, &sh_rsrc_1, NULL}},
148         {{&sh_rodata_1, &sh_rsrc_1, NULL}, 4*page_size, 1, 0, 0},
149         {{&sh_rodata_1, &sh_rsrc_1, NULL}, 4*page_size, 1, 0, 0},
150         {{&sh_rodata_1, &sh_rsrc_1, NULL}, 4*page_size, 1, 0, 1},
151         {{&sh_rodata_1, &sh_rsrc_5, NULL}, 6*page_size, 1, 0, 1}
152     },
153     /* single .rodata section with compatible characteristics, data directory entry points to section end */
154     /* Vista+ - existing section isn't used, new section is created at the end of file */
155     /* NT4/2000/2003 - image is broken */
156 #if 0
157     {
158         {{&sh_rodata_2, NULL, NULL}},
159         {{&sh_rodata_2, &sh_rsrc_2, NULL}, 5*page_size, 1, 0, 0},
160         {{&sh_rodata_2, &sh_rsrc_2, NULL}, 5*page_size, 1, 0, 0},
161         {{&sh_rodata_2, &sh_rsrc_2, NULL}, 5*page_size, 1, 0, 1},
162         {{&sh_rodata_2, &sh_rsrc_6, NULL}, 7*page_size, 1, 0, 1}
163     },
164 #endif
165     /* .rsrc is the last section, data directory entry points to section end */
166     /* Vista+ - resources are moved to section start (trashing data that could be there), and section is trimmed */
167     /* NT4/2000/2003 - resources are moved to section start (trashing data that could be there); section isn't trimmed */
168     {
169         {{&sh_rodata_3, &sh_rsrc_3, NULL}},
170         {{&sh_rodata_3, &sh_rsrc_4, NULL}, 3*page_size, 1, 0, 0},
171         {{&sh_rodata_3, &sh_rsrc_4, NULL}, 3*page_size, 1, 0, 0},
172         {{&sh_rodata_3, &sh_rsrc_4, NULL}, 3*page_size, 1, 0, 1},
173         {{&sh_rodata_3, &sh_rsrc_7, NULL}, 5*page_size, 1, 0, 1}
174     },
175     /* .rsrc is not the last section */
176     /* section is reused; sections after .rsrc are shifted to give space to rsrc (in-image offset and RVA!) */
177     {
178         {{&sh_rodata_1, &sh_rsrc_1, &sh_junk}},
179         {{&sh_rodata_1, &sh_rsrc_1, &sh_junk}, 5*page_size, 1, 0, 0},
180         {{&sh_rodata_1, &sh_rsrc_1, &sh_junk}, 5*page_size, 1, 0, 0},
181         {{&sh_rodata_1, &sh_rsrc_1, &sh_junk}, 5*page_size, 1, 0, 1},
182         {{&sh_rodata_1, &sh_rsrc_5, &sh_junk_2}, 7*page_size, 1, 0, 1}
183     },
184     /* .rsrc is the last section, data directory entry points to whole section, file size is not aligned on FileAlign */
185     {
186         {{&sh_rodata_1, &sh_rsrc_8, NULL}},
187         {{&sh_rodata_1, &sh_rsrc_1, NULL}, 4*page_size, 1, 0, 0},
188         {{&sh_rodata_1, &sh_rsrc_1, NULL}, 4*page_size, 1, 0, 0},
189         {{&sh_rodata_1, &sh_rsrc_1, NULL}, 4*page_size, 1, 0, 1},
190         {{&sh_rodata_1, &sh_rsrc_5, NULL}, 6*page_size, 1, 0, 1}
191     }
192 };
193
194 static int build_exe( const sec_build* sec_descr )
195 {
196     IMAGE_DOS_HEADER *dos;
197     IMAGE_NT_HEADERS *nt;
198     IMAGE_SECTION_HEADER *sec;
199     IMAGE_OPTIONAL_HEADER *opt;
200     HANDLE file;
201     DWORD written, i, file_size;
202     BYTE page[page_size];
203
204     memset( page, 0, sizeof page );
205
206     dos = (void*) page;
207     dos->e_magic = IMAGE_DOS_SIGNATURE;
208     dos->e_lfanew = sizeof *dos;
209
210     nt = (void*) &dos[1];
211
212     nt->Signature = IMAGE_NT_SIGNATURE;
213     nt->FileHeader.Machine = IMAGE_FILE_MACHINE_I386;
214     nt->FileHeader.NumberOfSections = 0;
215     nt->FileHeader.SizeOfOptionalHeader = sizeof nt->OptionalHeader;
216     nt->FileHeader.Characteristics = IMAGE_FILE_EXECUTABLE_IMAGE | IMAGE_FILE_DLL;
217
218     opt = &nt->OptionalHeader;
219
220     opt->Magic = IMAGE_NT_OPTIONAL_HDR_MAGIC;
221     opt->MajorLinkerVersion = 1;
222     opt->BaseOfCode = 0x10;
223     opt->ImageBase = 0x10000000;
224     opt->MajorOperatingSystemVersion = 4;
225     opt->MajorImageVersion = 1;
226     opt->MajorSubsystemVersion = 4;
227     opt->SizeOfHeaders = sizeof *dos + sizeof *nt + sizeof *sec * 2;
228     opt->SizeOfImage = page_size;
229     opt->Subsystem = IMAGE_SUBSYSTEM_WINDOWS_CUI;
230
231     /* if SectionAlignment and File alignment are not specified */
232     /* UpdateResource fails trying to create a huge temporary file */
233     opt->SectionAlignment = page_size;
234     opt->FileAlignment = page_size;
235
236     opt->DataDirectory[IMAGE_FILE_RESOURCE_DIRECTORY].VirtualAddress = rva_rsrc_start;
237     opt->DataDirectory[IMAGE_FILE_RESOURCE_DIRECTORY].Size = page_size;
238
239     sec = (void*) &nt[1];
240
241     file_size = 0;
242     for ( i = 0; i < max_sections; i++ )
243         if ( sec_descr->sect_in[i] )
244         {
245             DWORD virt_end_of_section = sec_descr->sect_in[i]->Misc.VirtualSize +
246                 sec_descr->sect_in[i]->VirtualAddress;
247             DWORD phys_end_of_section = sec_descr->sect_in[i]->SizeOfRawData +
248                 sec_descr->sect_in[i]->PointerToRawData;
249             memcpy( sec + nt->FileHeader.NumberOfSections, sec_descr->sect_in[i],
250                     sizeof(sec[0]) );
251             nt->FileHeader.NumberOfSections++;
252             if ( opt->SizeOfImage < virt_end_of_section )
253                 opt->SizeOfImage = virt_end_of_section;
254             if ( file_size < phys_end_of_section )
255                 file_size = phys_end_of_section;
256         }
257
258     file = CreateFile(filename, GENERIC_WRITE, 0, NULL, CREATE_ALWAYS, 0, 0);
259     ok (file != INVALID_HANDLE_VALUE, "failed to create file\n");
260
261     /* write out the header */
262     WriteFile( file, page, sizeof page, &written, NULL );
263
264     /* write out zeroed pages for sections */
265     memset( page, 0, sizeof page );
266     for ( i = page_size; i < file_size; i += page_size )
267     {
268         DWORD size = min(page_size, file_size - i);
269         WriteFile( file, page, size, &written, NULL );
270     }
271
272     CloseHandle( file );
273
274     return 0;
275 }
276
277 static void update_missing_exe( void )
278 {
279     HANDLE res;
280
281     SetLastError(0xdeadbeef);
282     res = BeginUpdateResource( filename, TRUE );
283     GLE = GetLastError();
284     ok( res == NULL, "BeginUpdateResource should fail\n");
285 }
286
287 static void update_empty_exe( void )
288 {
289     HANDLE file, res, test;
290     BOOL r;
291
292     file = CreateFile(filename, GENERIC_WRITE, 0, NULL, CREATE_ALWAYS, 0, 0);
293     ok (file != INVALID_HANDLE_VALUE, "failed to create file\n");
294
295     CloseHandle( file );
296
297     res = BeginUpdateResource( filename, TRUE );
298     if ( res != NULL || GetLastError() != ERROR_FILE_INVALID )
299     {
300         ok( res != NULL, "BeginUpdateResource failed\n");
301
302         /* check if it's possible to open the file now */
303         test = CreateFile(filename, GENERIC_READ, 0, NULL, OPEN_EXISTING, 0, 0);
304         ok (test != INVALID_HANDLE_VALUE, "failed to create file\n");
305
306         CloseHandle( test );
307
308         r = EndUpdateResource( res, FALSE );
309         ok( r == FALSE, "EndUpdateResource failed\n");
310     }
311     else
312         skip( "Can't update resource in empty file\n" );
313
314     res = BeginUpdateResource( filename, FALSE );
315     ok( res == NULL, "BeginUpdateResource failed\n");
316 }
317
318 static void update_resources_none( void )
319 {
320     HMODULE res;
321     BOOL r;
322
323     res = BeginUpdateResource( filename, FALSE );
324     ok( res != NULL, "BeginUpdateResource failed\n");
325
326     r = EndUpdateResource( res, FALSE );
327     ok( r, "EndUpdateResource failed\n");
328 }
329
330 static void update_resources_delete( void )
331 {
332     HMODULE res;
333     BOOL r;
334
335     res = BeginUpdateResource( filename, TRUE );
336     ok( res != NULL, "BeginUpdateResource failed\n");
337
338     r = EndUpdateResource( res, FALSE );
339     ok( r, "EndUpdateResource failed\n");
340 }
341
342 static void update_resources_version( void )
343 {
344     HANDLE res = NULL;
345     BOOL r;
346     char foo[] = "red and white";
347
348     res = BeginUpdateResource( filename, TRUE );
349     ok( res != NULL, "BeginUpdateResource failed\n");
350
351     if (0)  /* this causes subsequent tests to fail on Vista */
352     {
353         r = UpdateResource( res,
354                             MAKEINTRESOURCE(0x1230),
355                             MAKEINTRESOURCE(0x4567),
356                             0xabcd,
357                             NULL, 0 );
358         ok( r == FALSE, "UpdateResource failed\n");
359     }
360
361     r = UpdateResource( res,
362                         MAKEINTRESOURCE(0x1230),
363                         MAKEINTRESOURCE(0x4567),
364                         0xabcd,
365                         foo, sizeof foo );
366     ok( r == TRUE, "UpdateResource failed: %d\n", GetLastError());
367
368     r = EndUpdateResource( res, FALSE );
369     ok( r, "EndUpdateResource failed: %d\n", GetLastError());
370 }
371
372 static void update_resources_bigdata( void )
373 {
374     HANDLE res = NULL;
375     BOOL r;
376     char foo[2*page_size] = "foobar";
377
378     res = BeginUpdateResource( filename, TRUE );
379     ok( res != NULL, "BeginUpdateResource succeeded\n");
380
381     r = UpdateResource( res,
382                         MAKEINTRESOURCE(0x3012),
383                         MAKEINTRESOURCE(0x5647),
384                         0xcdba,
385                         foo, sizeof foo );
386     ok( r == TRUE, "UpdateResource failed: %d\n", GetLastError());
387
388     r = EndUpdateResource( res, FALSE );
389     ok( r, "EndUpdateResource failed\n");
390 }
391
392 static void check_exe( const sec_verify *verify )
393 {
394     int i;
395     IMAGE_DOS_HEADER *dos;
396     IMAGE_NT_HEADERS *nt;
397     IMAGE_SECTION_HEADER *sec;
398     IMAGE_RESOURCE_DIRECTORY *dir;
399     HANDLE file, mapping;
400     DWORD length, sec_count = 0;
401
402     file = CreateFile(filename, GENERIC_READ, 0, NULL, OPEN_EXISTING, 0, 0);
403     ok (file != INVALID_HANDLE_VALUE, "failed to create file (%d)\n", GetLastError());
404
405     length = GetFileSize( file, NULL );
406     ok( length >= verify->length, "file size wrong\n");
407
408     mapping = CreateFileMapping( file, NULL, PAGE_READONLY, 0, 0, NULL );
409     ok (mapping != NULL, "failed to create file\n");
410
411     dos = MapViewOfFile( mapping, FILE_MAP_READ, 0, 0, length );
412     ok( dos != NULL, "failed to map file\n");
413
414     if (!dos)
415         goto end;
416
417     nt = (void*) ((BYTE*) dos + dos->e_lfanew);
418     sec = (void*) &nt[1];
419
420     for(i = 0; i < max_sections; i++)
421         if (verify->sect_out[i])
422         {
423             ok( !memcmp(&verify->sect_out[i]->Name, &sec[sec_count].Name, 8), "section %d name wrong\n", sec_count);
424             ok( verify->sect_out[i]->VirtualAddress == sec[sec_count].VirtualAddress, "section %d vaddr wrong\n", sec_count);
425             ok( verify->sect_out[i]->SizeOfRawData <= sec[sec_count].SizeOfRawData, "section %d SizeOfRawData wrong (%d vs %d)\n", sec_count, verify->sect_out[i]->SizeOfRawData ,sec[sec_count].SizeOfRawData);
426             ok( verify->sect_out[i]->PointerToRawData == sec[sec_count].PointerToRawData, "section %d PointerToRawData wrong\n", sec_count);
427             ok( verify->sect_out[i]->Characteristics == sec[sec_count].Characteristics , "section %d characteristics wrong\n", sec_count);
428             sec_count++;
429         }
430
431     ok( nt->FileHeader.NumberOfSections == sec_count, "number of sections wrong\n" );
432
433     if (verify->rsrc_section >= 0 && verify->rsrc_section < nt->FileHeader.NumberOfSections)
434     {
435         dir = (void*) ((BYTE*) dos + sec[verify->rsrc_section].VirtualAddress);
436
437         ok( dir->Characteristics == 0, "Characteristics wrong\n");
438         ok( dir->TimeDateStamp == 0 || abs( dir->TimeDateStamp - GetTickCount() ) < 1000 /* nt4 */,
439             "TimeDateStamp wrong %u\n", dir->TimeDateStamp);
440         ok( dir->MajorVersion == 4, "MajorVersion wrong\n");
441         ok( dir->MinorVersion == 0, "MinorVersion wrong\n");
442
443         ok( dir->NumberOfNamedEntries == verify->NumberOfNamedEntries, "NumberOfNamedEntries should be %d instead of %d\n",
444                 verify->NumberOfNamedEntries, dir->NumberOfNamedEntries);
445         ok( dir->NumberOfIdEntries == verify->NumberOfIdEntries, "NumberOfIdEntries should be %d instead of %d\n",
446                 verify->NumberOfIdEntries, dir->NumberOfIdEntries);
447     }
448
449 end:
450     UnmapViewOfFile( dos );
451
452     CloseHandle( mapping );
453
454     CloseHandle( file );
455 }
456
457 static void test_find_resource(void)
458 {
459     HRSRC rsrc;
460
461     rsrc = FindResourceW( GetModuleHandle(0), (LPCWSTR)MAKEINTRESOURCE(1), (LPCWSTR)RT_MENU );
462     ok( rsrc != 0, "resource not found\n" );
463     rsrc = FindResourceExW( GetModuleHandle(0), (LPCWSTR)RT_MENU, (LPCWSTR)MAKEINTRESOURCE(1),
464                             MAKELANGID( LANG_NEUTRAL, SUBLANG_NEUTRAL ));
465     ok( rsrc != 0, "resource not found\n" );
466     rsrc = FindResourceExW( GetModuleHandle(0), (LPCWSTR)RT_MENU, (LPCWSTR)MAKEINTRESOURCE(1),
467                             MAKELANGID( LANG_GERMAN, SUBLANG_DEFAULT ));
468     ok( rsrc != 0, "resource not found\n" );
469
470     SetLastError( 0xdeadbeef );
471     rsrc = FindResourceW( GetModuleHandle(0), (LPCWSTR)MAKEINTRESOURCE(1), (LPCWSTR)RT_DIALOG );
472     ok( !rsrc, "resource found\n" );
473     ok( GetLastError() == ERROR_RESOURCE_TYPE_NOT_FOUND, "wrong error %u\n", GetLastError() );
474
475     SetLastError( 0xdeadbeef );
476     rsrc = FindResourceW( GetModuleHandle(0), (LPCWSTR)MAKEINTRESOURCE(2), (LPCWSTR)RT_MENU );
477     ok( !rsrc, "resource found\n" );
478     ok( GetLastError() == ERROR_RESOURCE_NAME_NOT_FOUND, "wrong error %u\n", GetLastError() );
479
480     SetLastError( 0xdeadbeef );
481     rsrc = FindResourceExW( GetModuleHandle(0), (LPCWSTR)RT_MENU, (LPCWSTR)MAKEINTRESOURCE(1),
482                             MAKELANGID( LANG_ENGLISH, SUBLANG_DEFAULT ) );
483     ok( !rsrc, "resource found\n" );
484     ok( GetLastError() == ERROR_RESOURCE_LANG_NOT_FOUND, "wrong error %u\n", GetLastError() );
485
486     SetLastError( 0xdeadbeef );
487     rsrc = FindResourceExW( GetModuleHandle(0), (LPCWSTR)RT_MENU, (LPCWSTR)MAKEINTRESOURCE(1),
488                             MAKELANGID( LANG_FRENCH, SUBLANG_DEFAULT ) );
489     ok( !rsrc, "resource found\n" );
490     ok( GetLastError() == ERROR_RESOURCE_LANG_NOT_FOUND, "wrong error %u\n", GetLastError() );
491 }
492
493 START_TEST(resource)
494 {
495     DWORD i;
496
497     DeleteFile( filename );
498     update_missing_exe();
499
500     if (GLE == ERROR_CALL_NOT_IMPLEMENTED)
501     {
502         win_skip("Resource calls are not implemented\n");
503         return;
504     }
505
506     update_empty_exe();
507
508     for(i=0; i < sizeof( sec_variants ) / sizeof( sec_variants[0] ); i++)
509     {
510         const struct _sec_variants *sec = &sec_variants[i];
511         build_exe( &sec->build );
512         update_resources_none();
513         check_exe( &sec->chk_none );
514         update_resources_delete();
515         check_exe( &sec->chk_delete );
516         update_resources_version();
517         check_exe( &sec->chk_version );
518         update_resources_bigdata();
519         check_exe( &sec->chk_bigdata );
520         DeleteFile( filename );
521     }
522     test_find_resource();
523 }