ReactOS 0.4.17-dev-966-gf06eace
image.c
Go to the documentation of this file.
1/*
2 * Copyright 2008 Juan Lang
3 * Copyright 2010 Andrey Turkin
4 *
5 * This library is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU Lesser General Public
7 * License as published by the Free Software Foundation; either
8 * version 2.1 of the License, or (at your option) any later version.
9 *
10 * This library is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 * Lesser General Public License for more details.
14 *
15 * You should have received a copy of the GNU Lesser General Public
16 * License along with this library; if not, write to the Free Software
17 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
18 */
19#include <stdio.h>
20#include <stdarg.h>
21
22#include <windef.h>
23#include <winbase.h>
24#include <winver.h>
25#include <winnt.h>
26#include <winuser.h>
27#include <imagehlp.h>
28
29#include "wine/test.h"
30
31static char *load_resource(const char *name)
32{
33 static char path[MAX_PATH];
34 DWORD written;
36 HRSRC res;
37 void *ptr;
38
41
43 ok(file != INVALID_HANDLE_VALUE, "Failed to create file %s, error %lu.\n",
45
46 res = FindResourceA(NULL, name, "TESTDLL");
47 ok(!!res, "Failed to load resource, error %lu.\n", GetLastError());
50 ok(written == SizeofResource(GetModuleHandleA(NULL), res), "Failed to write resource.\n");
52
53 return path;
54}
55
56/* minimal PE file image */
57#define VA_START 0x400000
58#define FILE_PE_START 0x50
59#define NUM_SECTIONS 3
60#define FILE_TEXT 0x200
61#define RVA_TEXT 0x1000
62#define RVA_BSS 0x2000
63#define FILE_IDATA 0x400
64#define RVA_IDATA 0x3000
65#define FILE_TOTAL 0x600
66#define RVA_TOTAL 0x4000
67
68#include <pshpack1.h>
69struct imports
70{
74 struct
75 {
77 char funcname[0x20];
78 } ibn;
79 char dllname[0x10];
80};
81#define EXIT_PROCESS (VA_START + RVA_IDATA + FIELD_OFFSET(struct imports, thunks))
82
83static struct image
84{
94}
95bin =
96{
97 /* dos header */
98 {IMAGE_DOS_SIGNATURE, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, {0}, 0, 0, {0}, FILE_PE_START},
99 /* alignment before PE header */
100 {0},
101 /* nt headers */
103 /* basic headers - 3 sections, no symbols, EXE file */
106 /* optional header */
109 RVA_TEXT, RVA_TEXT, RVA_BSS, VA_START, 0x1000, 0x200, 4, 0, 1, 0, 4, 0, 0,
111 0x200000, 0x1000, 0x100000, 0x1000, 0, 0x10,
112 {{0, 0},
113 {RVA_IDATA, sizeof(struct imports)}
114 }
115 }
116 },
117 /* sections */
118 {
119 {".text", {0x100}, RVA_TEXT, FILE_IDATA-FILE_TEXT, FILE_TEXT,
121 {".bss", {0x400}, RVA_BSS, 0, 0, 0, 0, 0, 0,
123 {".idata", {sizeof(struct imports)}, RVA_IDATA, FILE_TOTAL-FILE_IDATA, FILE_IDATA, 0,
125 },
126 /* alignment before first section */
127 {0},
128 /* .text section */
129 {
130 0x31, 0xC0, /* xor eax, eax */
131 0xFF, 0x25, EXIT_PROCESS&0xFF, (EXIT_PROCESS>>8)&0xFF, (EXIT_PROCESS>>16)&0xFF,
132 (EXIT_PROCESS>>24)&0xFF, /* jmp ExitProcess */
133 0
134 },
135 /* .idata section */
136 {
137 {
138 {{RVA_IDATA + FIELD_OFFSET(struct imports, original_thunks)}, 0, 0,
141 },
142 {{0}, 0, 0, 0, 0}
143 },
144 {{{RVA_IDATA+FIELD_OFFSET(struct imports, ibn)}}, {{0}}},
145 {{{RVA_IDATA+FIELD_OFFSET(struct imports, ibn)}}, {{0}}},
146 {0,"ExitProcess"},
147 "KERNEL32.DLL"
148 },
149 /* final alignment */
150 {0}
152
154{
156 IMAGE_THUNK_DATA64 original_thunks[2];
158 struct
159 {
161 char funcname[0x20];
162 } ibn;
163 char dllname[0x10];
164};
165
166static struct image64
167{
169 char __alignment1[FILE_PE_START - sizeof(IMAGE_DOS_HEADER)];
172 char __alignment2[FILE_TEXT - FILE_PE_START - sizeof(IMAGE_NT_HEADERS64) - 2 * sizeof(IMAGE_SECTION_HEADER)];
174 struct imports64 idata_section;
175 char __alignment3[FILE_TOTAL - FILE_IDATA - sizeof(struct imports64)];
176}
177bin64 =
178{
179 /* dos header */
180 { IMAGE_DOS_SIGNATURE, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, {0}, 0, 0, {0}, FILE_PE_START },
181 /* alignment before PE header */
182 {0},
183 /* nt headers */
184 {
186 /* basic headers - 2 sections, no symbols, EXE file */
189 /* optional header */
190 {
193 RVA_TEXT, RVA_TEXT, VA_START, 0x1000, 0x200, 4, 0, 1, 0, 5, 2, 0,
195 0x200000, 0x1000, 0x100000, 0x1000, 0, 0x10,
196 {{0, 0}, {RVA_IDATA, sizeof(struct imports64)}}
197 }
198 },
199 /* sections */
200 {
201 { ".text", {0x100}, RVA_TEXT, FILE_IDATA - FILE_TEXT, FILE_TEXT,
203 { ".idata", {sizeof(struct imports64)}, RVA_IDATA, FILE_TOTAL - FILE_IDATA, FILE_IDATA, 0,
205 },
206 /* alignment before first section */
207 {0},
208 /* .text section */
209 {
210 0x90
211 },
212 /* .idata section */
213 {
214 { {{RVA_IDATA + FIELD_OFFSET(struct imports64, original_thunks)}, 0, 0,
215 RVA_IDATA + FIELD_OFFSET(struct imports64, dllname),
216 RVA_IDATA + FIELD_OFFSET(struct imports64, thunks)},
217 {{0}, 0, 0, 0, 0} },
218 { {{RVA_IDATA + FIELD_OFFSET(struct imports64, ibn)}}, {{0}} },
219 { {{RVA_IDATA + FIELD_OFFSET(struct imports64, ibn)}}, {{0}} },
220 { 0, "ExitProcess" },
221 "KERNEL32.DLL"
222 },
223 /* final alignment */
224 {0}
226#include <poppack.h>
227
228struct blob
229{
232};
233
235{
237 const void *pb;
238};
239
240struct update_accum
241{
242 DWORD cUpdates;
243 struct blob *updates;
244};
245
247{
249 const struct expected_blob *updates;
251};
252
254 DWORD cb)
255{
256 struct update_accum *accum = (struct update_accum *)handle;
257 BOOL ret = FALSE;
258
259 if (accum->cUpdates)
260 accum->updates = HeapReAlloc(GetProcessHeap(), 0, accum->updates,
261 (accum->cUpdates + 1) * sizeof(struct blob));
262 else
263 accum->updates = HeapAlloc(GetProcessHeap(), 0, sizeof(struct blob));
264 if (accum->updates)
265 {
266 struct blob *blob = &accum->updates[accum->cUpdates];
267
269 if (blob->pb)
270 {
271 memcpy(blob->pb, pb, cb);
272 blob->cb = cb;
273 ret = TRUE;
274 }
275 accum->cUpdates++;
276 }
277 return ret;
278}
279
281 const struct update_accum *got)
282{
283 DWORD i;
284
285 todo_wine_if (expected->todo)
286 ok(expected->cUpdates == got->cUpdates, "%s: expected %ld updates, got %ld\n",
287 header, expected->cUpdates, got->cUpdates);
288 for (i = 0; i < min(expected->cUpdates, got->cUpdates); i++)
289 {
290 ok(expected->updates[i].cb == got->updates[i].cb, "%s, update %ld: expected %ld bytes, got %ld\n",
291 header, i, expected->updates[i].cb, got->updates[i].cb);
292 if (expected->updates[i].cb && expected->updates[i].cb == got->updates[i].cb)
293 ok(!memcmp(expected->updates[i].pb, got->updates[i].pb, got->updates[i].cb),
294 "%s, update %ld: unexpected value\n", header, i);
295 }
296}
297
298/* Frees the updates stored in accum */
299static void free_updates(struct update_accum *accum)
300{
301 DWORD i;
302
303 for (i = 0; i < accum->cUpdates; i++)
304 HeapFree(GetProcessHeap(), 0, accum->updates[i].pb);
305 HeapFree(GetProcessHeap(), 0, accum->updates);
306 accum->updates = NULL;
307 accum->cUpdates = 0;
308}
309
310static const struct expected_blob b1[] = {
311 {FILE_PE_START, &bin},
312 /* with zeroed Checksum/SizeOfInitializedData/SizeOfImage fields */
313 {sizeof(bin.nt_headers), &bin.nt_headers},
314 {sizeof(bin.sections), &bin.sections},
315 {FILE_IDATA-FILE_TEXT, &bin.text_section},
316 {sizeof(bin.idata_section.descriptors[0].OriginalFirstThunk),
317 &bin.idata_section.descriptors[0].OriginalFirstThunk},
318 {FIELD_OFFSET(struct imports, thunks)-
320 &bin.idata_section.descriptors[0].Name},
322 &bin.idata_section.ibn}
323};
324static const struct expected_update_accum a1 = { ARRAY_SIZE(b1), b1, TRUE };
325
326static const struct expected_blob b2[] = {
327 {FILE_PE_START, &bin},
328 /* with zeroed Checksum/SizeOfInitializedData/SizeOfImage fields */
329 {sizeof(bin.nt_headers), &bin.nt_headers},
330 {sizeof(bin.sections), &bin.sections},
331 {FILE_IDATA-FILE_TEXT, &bin.text_section},
332 {FILE_TOTAL-FILE_IDATA, &bin.idata_section}
333};
334static const struct expected_update_accum a2 = { ARRAY_SIZE(b2), b2, FALSE };
335
336static const struct expected_blob b3[] = {
338 /* with zeroed Checksum/SizeOfInitializedData/SizeOfImage fields */
339 {sizeof(bin64.nt_headers), &bin64.nt_headers},
340 {sizeof(bin64.sections), &bin64.sections},
341 {FILE_IDATA - FILE_TEXT, &bin64.text_section},
342 {sizeof(bin64.idata_section.descriptors[0].OriginalFirstThunk),
343 &bin64.idata_section.descriptors[0].OriginalFirstThunk},
344 {FIELD_OFFSET(struct imports64, thunks) -
346 &bin64.idata_section.descriptors[0].Name},
347 {FILE_TOTAL - FILE_IDATA - FIELD_OFFSET(struct imports64, ibn), &bin64.idata_section.ibn}
348};
349static const struct expected_update_accum a3 = { ARRAY_SIZE(b3), b3, TRUE };
350
351static const struct expected_blob b4[] = {
353 /* with zeroed Checksum/SizeOfInitializedData/SizeOfImage fields */
354 {sizeof(bin64.nt_headers), &bin64.nt_headers},
355 {sizeof(bin64.sections), &bin64.sections},
356 {FILE_IDATA - FILE_TEXT, &bin64.text_section},
357 {FILE_TOTAL - FILE_IDATA, &bin64.idata_section}
358};
359static const struct expected_update_accum a4 = { ARRAY_SIZE(b4), b4, FALSE };
360
361/* Creates a test file and returns a handle to it. The file's path is returned
362 * in temp_file, which must be at least MAX_PATH characters in length.
363 */
365{
367 char temp_path[MAX_PATH];
368
369 if (GetTempPathA(sizeof(temp_path), temp_path))
370 {
371 if (GetTempFileNameA(temp_path, "img", 0, temp_file))
374 }
375 return file;
376}
377
379{
380 const WORD *ptr = image;
381 DWORD size, sum = 0;
382
383 for (size = (image_size + 1) / sizeof(WORD); size > 0; ptr++, size--)
384 {
385 sum += *ptr;
386 if (HIWORD(sum)) sum = LOWORD(sum) + HIWORD(sum);
387 }
388 sum = (WORD)(LOWORD(sum) + HIWORD(sum));
389 sum += image_size;
390
391 return sum;
392}
393
394static void test_get_digest_stream(void)
395{
396 BOOL ret;
397 HANDLE file;
398 char temp_file[MAX_PATH];
400 struct update_accum accum = { 0, NULL };
401
402 SetLastError(0xdeadbeef);
405 "expected ERROR_INVALID_PARAMETER, got %ld\n", GetLastError());
408 {
409 skip("couldn't create temp file\n");
410 return;
411 }
412 SetLastError(0xdeadbeef);
415 "expected ERROR_INVALID_PARAMETER, got %ld\n", GetLastError());
416 SetLastError(0xdeadbeef);
419 "expected ERROR_INVALID_PARAMETER, got %ld\n", GetLastError());
420 /* Even with "valid" parameters, it fails with an empty file */
421 SetLastError(0xdeadbeef);
424 "expected ERROR_INVALID_PARAMETER, got %ld\n", GetLastError());
425 /* Finally, with a valid executable in the file, it succeeds. Note that
426 * the file pointer need not be positioned at the beginning.
427 */
428 bin.nt_headers.OptionalHeader.CheckSum = 0;
429 checksum = compute_checksum((const WORD *)&bin, sizeof(bin));
430 bin.nt_headers.OptionalHeader.CheckSum = checksum;
431
432 WriteFile(file, &bin, sizeof(bin), &count, NULL);
434
435 /* zero out some fields ImageGetDigestStream would zero out */
436 bin.nt_headers.OptionalHeader.CheckSum = 0;
437 bin.nt_headers.OptionalHeader.SizeOfInitializedData = 0;
438 bin.nt_headers.OptionalHeader.SizeOfImage = 0;
439
441 ok(ret, "ImageGetDigestStream failed: %ld\n", GetLastError());
442 check_updates("flags = 0", &a1, &accum);
443 free_updates(&accum);
446 ok(ret, "ImageGetDigestStream failed: %ld\n", GetLastError());
447 check_updates("flags = CERT_PE_IMAGE_DIGEST_ALL_IMPORT_INFO", &a2, &accum);
448 free_updates(&accum);
451
454 {
455 skip("couldn't create temp file\n");
456 return;
457 }
458
459 bin64.nt_headers.OptionalHeader.CheckSum = 0;
460 checksum = compute_checksum((const WORD *)&bin64, sizeof(bin64));
461 bin64.nt_headers.OptionalHeader.CheckSum = checksum;
462
463 WriteFile(file, &bin64, sizeof(bin64), &count, NULL);
465
466 bin64.nt_headers.OptionalHeader.CheckSum = 0;
467 bin64.nt_headers.OptionalHeader.SizeOfInitializedData = 0;
468 bin64.nt_headers.OptionalHeader.SizeOfImage = 0;
469
471 ok(ret, "ImageGetDigestStream failed: %lu\n", GetLastError());
472 check_updates("flags = 0", &a3, &accum);
473 free_updates(&accum);
476 ok(ret, "ImageGetDigestStream failed: %lu\n", GetLastError());
477 check_updates("flags = CERT_PE_IMAGE_DIGEST_ALL_IMPORT_INFO", &a4, &accum);
478 free_updates(&accum);
481}
482
484
486 const char *module, ULONG_PTR va, ULONG_PTR param)
487{
488 static char last_module[MAX_PATH];
489
490 if (winetest_debug > 1)
491 trace("reason %u, file %s, module %s, va %#Ix, param %#Ix\n",
493
495 {
496 ok(!strchr(module, '\\'), "got module name %s\n", debugstr_a(module));
497 strcpy(last_module, module);
498 ok(!va, "got VA %#Ix\n", va);
499 ok(!param, "got param %#Ix\n", param);
500 }
501 else if (reason == BindImportProcedure)
502 {
503 char full_path[MAX_PATH];
504 BOOL ret;
505
506 todo_wine ok(!!va, "expected nonzero VA\n");
507 ret = SearchPathA(NULL, last_module, ".dll", sizeof(full_path), full_path, NULL);
508 ok(ret, "got error %lu\n", GetLastError());
509 ok(!strcmp(module, full_path), "expected %s, got %s\n", debugstr_a(full_path), debugstr_a(module));
510
511 if (!strcmp((const char *)param, "SysAllocString"))
512 {
513 ok(!strcmp(last_module, "oleaut32.dll"), "got wrong module %s\n", debugstr_a(module));
515 }
516 else if (!strcmp((const char *)param, "GetOpenFileNameA"))
517 {
518 ok(!strcmp(last_module, "comdlg32.dll"), "got wrong module %s\n", debugstr_a(module));
520 }
521 else if (!strcmp((const char *)param, "Ordinal117"))
522 {
523 ok(!strcmp(last_module, "shlwapi.dll"), "got wrong module %s\n", debugstr_a(module));
525 }
526 }
527 else
528 {
529 ok(0, "got unexpected reason %#x\n", reason);
530 }
531 return TRUE;
532}
533
534static void test_bind_image_ex(void)
535{
536 const char *filename = load_resource("testdll.dll");
537 BOOL ret;
538
539 SetLastError(0xdeadbeef);
541 "nonexistent.dll", 0, 0, bind_image_cb);
542 ok(!ret, "expected failure\n");
544 "got error %lu\n", GetLastError());
545
548 ok(ret, "got error %lu\n", GetLastError());
549 ok(got_SysAllocString == 1, "got %u imports of SysAllocString\n", got_SysAllocString);
550 ok(got_GetOpenFileNameA == 1, "got %u imports of GetOpenFileNameA\n", got_GetOpenFileNameA);
551 todo_wine ok(got_SHRegGetIntW == 1, "got %u imports of SHRegGetIntW\n", got_SHRegGetIntW);
552
554 ok(ret, "got error %lu\n", GetLastError());
555}
556
557static void test_image_load(void)
558{
559 char temp_file[MAX_PATH];
561 DWORD ret, count;
562 HANDLE file;
563
566 {
567 skip("couldn't create temp file\n");
568 return;
569 }
570
571 WriteFile(file, &bin, sizeof(bin), &count, NULL);
573
575 ok(img != NULL, "ImageLoad unexpectedly failed\n");
576
577 if (img)
578 {
579 ok(!strcmp(img->ModuleName, temp_file),
580 "unexpected ModuleName, got %s instead of %s\n", img->ModuleName, temp_file);
581 ok(img->MappedAddress != NULL, "MappedAddress != NULL\n");
582 if (img->MappedAddress)
583 {
584 ok(!memcmp(img->MappedAddress, &bin.dos_header, sizeof(bin.dos_header)),
585 "MappedAddress doesn't point to IMAGE_DOS_HEADER\n");
586 }
587 ok(img->FileHeader != NULL, "FileHeader != NULL\n");
588 if (img->FileHeader)
589 {
590 ok(!memcmp(img->FileHeader, &bin.nt_headers, sizeof(bin.nt_headers)),
591 "FileHeader doesn't point to IMAGE_NT_HEADERS32\n");
592 }
593 ok(img->NumberOfSections == 3,
594 "unexpected NumberOfSections, got %ld instead of 3\n", img->NumberOfSections);
595 if (img->NumberOfSections >= 3)
596 {
597 ok(!strcmp((const char *)img->Sections[0].Name, ".text"),
598 "unexpected name for section 0, expected .text, got %s\n",
599 (const char *)img->Sections[0].Name);
600 ok(!strcmp((const char *)img->Sections[1].Name, ".bss"),
601 "unexpected name for section 1, expected .bss, got %s\n",
602 (const char *)img->Sections[1].Name);
603 ok(!strcmp((const char *)img->Sections[2].Name, ".idata"),
604 "unexpected name for section 2, expected .idata, got %s\n",
605 (const char *)img->Sections[2].Name);
606 }
607 ok(img->Characteristics == 0x102,
608 "unexpected Characteristics, got 0x%lx instead of 0x102\n", img->Characteristics);
609 ok(img->fSystemImage == 0,
610 "unexpected fSystemImage, got %d instead of 0\n", img->fSystemImage);
611 ok(img->fDOSImage == 0,
612 "unexpected fDOSImage, got %d instead of 0\n", img->fDOSImage);
613 todo_wine ok(img->fReadOnly == 1 || broken(!img->fReadOnly) /* <= WinXP */,
614 "unexpected fReadOnly, got %d instead of 1\n", img->fReadOnly);
615 todo_wine ok(img->Version == 1 || broken(!img->Version) /* <= WinXP */,
616 "unexpected Version, got %d instead of 1\n", img->Version);
617 ok(img->SizeOfImage == 0x600,
618 "unexpected SizeOfImage, got 0x%lx instead of 0x600\n", img->SizeOfImage);
619
620 count = 0xdeadbeef;
623 ok(ret == 448, "GetImageUnusedHeaderBytes returned %lu instead of 448\n", ret);
625 ok(count == 64, "unexpected size for unused header bytes, got %lu instead of 64\n", count);
626
628 }
629
631}
632
634{
638}
#define trace
Definition: atltest.h:70
#define ok(value,...)
Definition: atltest.h:57
#define skip(...)
Definition: atltest.h:64
#define broken(x)
Definition: atltest.h:178
#define START_TEST(x)
Definition: atltest.h:75
#define ARRAY_SIZE(A)
Definition: main.h:20
LPWSTR Name
Definition: desk.c:124
#define NULL
Definition: types.h:112
#define TRUE
Definition: types.h:120
#define FALSE
Definition: types.h:117
static cab_ULONG checksum(const cab_UBYTE *data, cab_UWORD bytes, cab_ULONG csum)
Definition: fdi.c:353
static WCHAR reason[MAX_STRING_RESOURCE_LEN]
Definition: object.c:1971
#define CloseHandle
Definition: compat.h:739
#define GetProcessHeap()
Definition: compat.h:736
#define ERROR_INVALID_PARAMETER
Definition: compat.h:101
#define SetLastError(x)
Definition: compat.h:752
#define INVALID_HANDLE_VALUE
Definition: compat.h:731
#define HeapAlloc
Definition: compat.h:733
#define HeapReAlloc
Definition: compat.h:734
#define CreateFileA(a, b, c, d, e, f, g)
Definition: compat.h:740
#define GENERIC_READ
Definition: compat.h:135
#define MAX_PATH
Definition: compat.h:34
#define HeapFree(x, y, z)
Definition: compat.h:735
#define FILE_ATTRIBUTE_NORMAL
Definition: compat.h:137
PLOADED_IMAGE WINAPI ImageLoad(PCSTR dll_name, PCSTR dll_path)
Definition: access.c:71
BOOL WINAPI ImageUnload(PLOADED_IMAGE loaded_image)
Definition: access.c:97
DWORD WINAPI GetImageUnusedHeaderBytes(PLOADED_IMAGE LoadedImage, LPDWORD SizeUnusedHeaderBytes)
Definition: access.c:57
BOOL WINAPI ImageGetDigestStream(HANDLE FileHandle, DWORD DigestLevel, DIGEST_FUNCTION DigestFunction, DIGEST_HANDLE DigestHandle)
Definition: integrity.c:782
BOOL WINAPI DeleteFileA(IN LPCSTR lpFileName)
Definition: delete.c:24
BOOL WINAPI FlushFileBuffers(IN HANDLE hFile)
Definition: fileinfo.c:25
BOOL WINAPI WriteFile(_In_ HANDLE hFile, _In_reads_bytes_opt_(nNumberOfBytesToWrite) LPCVOID lpBuffer, _In_ DWORD nNumberOfBytesToWrite, _Out_opt_ LPDWORD lpNumberOfBytesWritten, _Inout_opt_ LPOVERLAPPED lpOverlapped)
Definition: rw.c:25
HMODULE WINAPI DECLSPEC_HOTPATCH GetModuleHandleA(LPCSTR lpModuleName)
Definition: loader.c:812
DWORD WINAPI SearchPathA(IN LPCSTR lpPath OPTIONAL, IN LPCSTR lpFileName, IN LPCSTR lpExtension OPTIONAL, IN DWORD nBufferLength, OUT LPSTR lpBuffer, OUT LPSTR *lpFilePart OPTIONAL)
Definition: path.c:1222
DWORD WINAPI GetTempPathA(IN DWORD nBufferLength, OUT LPSTR lpBuffer)
Definition: path.c:2072
HRSRC WINAPI FindResourceA(HMODULE hModule, LPCSTR name, LPCSTR type)
Definition: res.c:155
DWORD WINAPI SizeofResource(HINSTANCE hModule, HRSRC hRsrc)
Definition: res.c:568
LPVOID WINAPI LockResource(HGLOBAL handle)
Definition: res.c:550
HGLOBAL WINAPI LoadResource(HINSTANCE hModule, HRSRC hRsrc)
Definition: res.c:532
static MonoProfilerRuntimeShutdownBeginCallback cb
Definition: metahost.c:118
_ACRTIMP int __cdecl memcmp(const void *, const void *, size_t)
Definition: string.c:2807
_ACRTIMP char *__cdecl strchr(const char *, int)
Definition: string.c:3291
_ACRTIMP int __cdecl strcmp(const char *, const char *)
Definition: string.c:3324
return ret
Definition: mutex.c:147
static BOOL create_temp_file(FCI_Int *fci, struct temp_file *file)
Definition: fci.c:229
UINT WINAPI GetTempFileNameA(IN LPCSTR lpPathName, IN LPCSTR lpPrefixString, IN UINT uUnique, OUT LPSTR lpTempFileName)
Definition: filename.c:26
unsigned short WORD
Definition: ntddk_ex.h:93
unsigned int BOOL
Definition: ntddk_ex.h:94
unsigned long DWORD
Definition: ntddk_ex.h:95
struct _IMAGE_DOS_HEADER IMAGE_DOS_HEADER
struct _IMAGE_OPTIONAL_HEADER IMAGE_OPTIONAL_HEADER32
struct _IMAGE_NT_HEADERS IMAGE_NT_HEADERS32
GLint GLvoid * img
Definition: gl.h:1956
GLuint GLuint GLsizei count
Definition: gl.h:1545
GLuint res
Definition: glext.h:9613
GLsizeiptr size
Definition: glext.h:5919
GLfloat param
Definition: glext.h:5796
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
BOOL WINAPI BindImageEx(DWORD flags, const char *module, const char *dll_path, const char *symbol_path, PIMAGEHLP_STATUS_ROUTINE cb)
Definition: modify.c:48
enum _IMAGEHLP_STATUS_REASON IMAGEHLP_STATUS_REASON
#define BIND_NO_UPDATE
Definition: imagehlp.h:35
#define BIND_NO_BOUND_IMPORTS
Definition: imagehlp.h:34
#define CERT_PE_IMAGE_DIGEST_ALL_IMPORT_INFO
Definition: imagehlp.h:45
@ BindImportModule
Definition: imagehlp.h:105
@ BindImportProcedure
Definition: imagehlp.h:106
#define BIND_ALL_IMAGES
Definition: imagehlp.h:36
const char * filename
Definition: ioapi.h:137
#define debugstr_a
Definition: kernel32.h:31
int winetest_debug
#define todo_wine_if(is_todo)
Definition: minitest.h:81
#define todo_wine
Definition: minitest.h:80
static GLint image_size(GLint width, GLint height, GLenum format, GLenum type)
Definition: mipmap.c:4858
#define memcpy(s1, s2, n)
Definition: mkisofs.h:878
#define CREATE_ALWAYS
Definition: disk.h:72
#define ERROR_FILE_NOT_FOUND
Definition: disk.h:79
static const unsigned char text_section[]
Definition: data.c:123
static PVOID ptr
Definition: dispmode.c:27
static const unsigned char bin64[]
Definition: encode.c:2836
static void check_updates(LPCSTR header, const struct update_accum *expected, const struct update_accum *got)
Definition: msg.c:558
static BOOL WINAPI accumulating_stream_output(const void *pvArg, BYTE *pb, DWORD cb, BOOL final)
Definition: msg.c:498
static const struct update_accum a1
Definition: msg.c:534
static CRYPT_DATA_BLOB b4
Definition: msg.c:2187
static const struct update_accum a2
Definition: msg.c:542
static CRYPT_DATA_BLOB b3[]
Definition: msg.c:548
static CRYPT_DATA_BLOB b2[]
Definition: msg.c:538
static void free_updates(struct update_accum *accum)
Definition: msg.c:581
static CRYPT_DATA_BLOB b1[]
Definition: msg.c:529
static const struct update_accum a3
Definition: msg.c:556
static const struct update_accum a4
Definition: msg.c:2188
BOOL expected
Definition: store.c:2000
#define load_resource(a, b, c)
Definition: font.c:46
#define RVA_TEXT
Definition: image.c:61
#define FILE_IDATA
Definition: image.c:63
#define EXIT_PROCESS
Definition: image.c:81
static void test_bind_image_ex(void)
Definition: image.c:534
static void test_image_load(void)
Definition: image.c:557
#define FILE_TOTAL
Definition: image.c:65
#define VA_START
Definition: image.c:57
static unsigned int got_SHRegGetIntW
Definition: image.c:483
static BOOL WINAPI bind_image_cb(IMAGEHLP_STATUS_REASON reason, const char *file, const char *module, ULONG_PTR va, ULONG_PTR param)
Definition: image.c:485
#define RVA_IDATA
Definition: image.c:64
#define FILE_TEXT
Definition: image.c:60
#define NUM_SECTIONS
Definition: image.c:59
static struct image64 bin64
static unsigned int got_GetOpenFileNameA
Definition: image.c:483
static struct image bin
static void test_get_digest_stream(void)
Definition: image.c:394
#define RVA_TOTAL
Definition: image.c:66
static DWORD compute_checksum(const WORD *image, DWORD image_size)
Definition: image.c:378
static unsigned int got_SysAllocString
Definition: image.c:483
#define RVA_BSS
Definition: image.c:62
#define FILE_PE_START
Definition: image.c:58
struct section sections[2]
Definition: diskspace.c:792
#define min(a, b)
Definition: monoChain.cc:55
char temp_path[MAX_PATH]
Definition: mspatcha.c:123
#define GENERIC_WRITE
Definition: nt_native.h:90
#define IMAGE_SCN_MEM_WRITE
Definition: ntimage.h:241
struct _IMAGE_OPTIONAL_HEADER64 IMAGE_OPTIONAL_HEADER64
#define IMAGE_NT_OPTIONAL_HDR32_MAGIC
Definition: ntimage.h:376
#define IMAGE_SCN_CNT_INITIALIZED_DATA
Definition: ntimage.h:231
#define IMAGE_NT_OPTIONAL_HDR64_MAGIC
Definition: ntimage.h:377
#define IMAGE_SUBSYSTEM_WINDOWS_GUI
Definition: ntimage.h:437
#define IMAGE_SCN_CNT_CODE
Definition: ntimage.h:230
#define IMAGE_SCN_MEM_EXECUTE
Definition: ntimage.h:239
#define IMAGE_FILE_MACHINE_AMD64
Definition: ntimage.h:17
#define IMAGE_SCN_MEM_READ
Definition: ntimage.h:240
#define IMAGE_SCN_CNT_UNINITIALIZED_DATA
Definition: ntimage.h:232
struct _IMAGE_NT_HEADERS64 IMAGE_NT_HEADERS64
#define LOWORD(l)
Definition: pedump.c:82
#define IMAGE_FILE_EXECUTABLE_IMAGE
Definition: pedump.c:160
#define IMAGE_FILE_MACHINE_I386
Definition: pedump.c:174
#define IMAGE_NT_SIGNATURE
Definition: pedump.c:93
#define IMAGE_DOS_SIGNATURE
Definition: pedump.c:89
#define IMAGE_FILE_32BIT_MACHINE
Definition: pedump.c:164
static int sum(int x_, int y_)
Definition: ptr2_test.cpp:35
strcat
Definition: string.h:92
strcpy
Definition: string.h:131
#define funcname
Definition: shellext.h:96
Definition: image.c:229
DWORD cb
Definition: image.c:230
BYTE * pb
Definition: image.c:231
DWORD cb
Definition: image.c:236
const void * pb
Definition: image.c:237
const struct expected_blob * updates
Definition: image.c:249
Definition: fci.c:123
Definition: image.c:167
IMAGE_NT_HEADERS64 nt_headers
Definition: image.c:170
IMAGE_DOS_HEADER dos_header
Definition: image.c:168
Definition: image.c:84
IMAGE_NT_HEADERS32 nt_headers
Definition: image.c:87
struct imports idata_section
Definition: image.c:92
unsigned char text_section[FILE_IDATA-FILE_TEXT]
Definition: image.c:91
IMAGE_SECTION_HEADER sections[NUM_SECTIONS]
Definition: image.c:88
char __alignment1[FILE_PE_START - sizeof(IMAGE_DOS_HEADER)]
Definition: image.c:86
char __alignment2[FILE_TEXT - FILE_PE_START - sizeof(IMAGE_NT_HEADERS32) - NUM_SECTIONS *sizeof(IMAGE_SECTION_HEADER)]
Definition: image.c:90
IMAGE_DOS_HEADER dos_header
Definition: image.c:85
char __alignment3[FILE_TOTAL-FILE_IDATA-sizeof(struct imports)]
Definition: image.c:93
WORD hint
Definition: image.c:160
Definition: image.c:70
IMAGE_THUNK_DATA32 thunks[2]
Definition: image.c:73
WORD hint
Definition: image.c:76
IMAGE_THUNK_DATA32 original_thunks[2]
Definition: image.c:72
IMAGE_IMPORT_DESCRIPTOR descriptors[2]
Definition: image.c:71
struct imports::@1921 ibn
char funcname[0x20]
Definition: image.c:77
char dllname[0x10]
Definition: image.c:79
Definition: name.c:39
Definition: fci.c:106
DWORD cUpdates
Definition: msg.c:494
CRYPT_DATA_BLOB * updates
Definition: msg.c:495
struct blob * updates
Definition: image.c:243
const char * LPCSTR
Definition: typedefs.h:52
#define FIELD_OFFSET(t, f)
Definition: typedefs.h:255
uint32_t ULONG_PTR
Definition: typedefs.h:65
#define HIWORD(l)
Definition: typedefs.h:247
DWORD WINAPI GetLastError(void)
Definition: except.c:1042
#define WINAPI
Definition: msvc.h:6
unsigned char BYTE
Definition: xxhash.c:193