22#define NONAMELESSUNION
42#define VA_START 0x400000
43#define FILE_PE_START 0x50
45#define FILE_TEXT 0x200
46#define RVA_TEXT 0x1000
48#define FILE_IDATA 0x400
49#define RVA_IDATA 0x3000
50#define FILE_TOTAL 0x600
51#define RVA_TOTAL 0x4000
63#define EXIT_PROCESS (VA_START+RVA_IDATA+FIELD_OFFSET(struct Imports, thunks))
77 {
IMAGE_DOS_SIGNATURE, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, {0}, 0, 0, {0},
FILE_PE_START},
88 RVA_TEXT,
RVA_TEXT,
RVA_BSS,
VA_START, 0x1000, 0x200, 4, 0, 1, 0, 4, 0, 0,
90 0x200000, 0x1000, 0x100000, 0x1000, 0, 0x10,
100 {
".bss", {0x400},
RVA_BSS, 0, 0, 0, 0, 0, 0,
198 ok(
expected->updates[
i].cb == got->
updates[
i].cb,
"%s, update %d: expected %d bytes, got %d\n",
202 "%s, update %d: unexpected value\n",
header,
i);
221 {
sizeof(
bin.nt_headers), &
bin.nt_headers},
222 {
sizeof(
bin.sections), &
bin.sections},
224 {
sizeof(
bin.idata_section.descriptors[0].u.OriginalFirstThunk),
225 &
bin.idata_section.descriptors[0].u.OriginalFirstThunk},
228 &
bin.idata_section.descriptors[0].Name},
230 &
bin.idata_section.ibn}
237 {
sizeof(
bin.nt_headers), &
bin.nt_headers},
238 {
sizeof(
bin.sections), &
bin.sections},
267 bin.nt_headers.OptionalHeader.CheckSum = 0;
280 bin.nt_headers.OptionalHeader.CheckSum =
sum;
296 ok(!
strcmp(DllName,
"KERNEL32.DLL"),
"expected DllName to be KERNEL32.DLL, got %s\n",
303 strcat(kernel32_path,
"\\KERNEL32.DLL");
304 ok(!
lstrcmpiA(DllName, kernel32_path),
"expected DllName to be %s, got %s\n",
305 kernel32_path, DllName);
307 "expected Parameter to be ExitProcess, got %s\n", (
char *)
Parameter);
311 ok(0,
"got unexpected reason %d\n",
reason);
325 if (!pImageGetDigestStream)
327 win_skip(
"ImageGetDigestStream function is not available\n");
333 "expected ERROR_INVALID_PARAMETER, got %d\n",
GetLastError());
337 skip(
"couldn't create temp file\n");
343 "expected ERROR_INVALID_PARAMETER, got %d\n",
GetLastError());
347 "expected ERROR_INVALID_PARAMETER, got %d\n",
GetLastError());
352 "expected ERROR_INVALID_PARAMETER, got %d\n",
GetLastError());
361 bin.nt_headers.OptionalHeader.CheckSum = 0;
362 bin.nt_headers.OptionalHeader.SizeOfInitializedData = 0;
363 bin.nt_headers.OptionalHeader.SizeOfImage = 0;
372 check_updates(
"flags = CERT_PE_IMAGE_DIGEST_ALL_IMPORT_INFO", &
a2, &accum);
387 win_skip(
"BindImageEx function is not available\n");
397 "expected ERROR_FILE_NOT_FOUND or ERROR_INVALID_PARAMETER, got %d\n",
403 skip(
"couldn't create temp file\n");
439 if (!pImageLoad || !pImageUnload || !pGetImageUnusedHeaderBytes)
441 win_skip(
"ImageLoad functions are not available\n");
448 skip(
"couldn't create temp file\n");
456 ok(
img !=
NULL,
"ImageLoad unexpectedly failed\n");
461 "unexpected ModuleName, got %s instead of %s\n",
img->ModuleName,
temp_file);
462 ok(
img->MappedAddress !=
NULL,
"MappedAddress != NULL\n");
463 if (
img->MappedAddress)
466 "MappedAddress doesn't point to IMAGE_DOS_HEADER\n");
468 ok(
img->FileHeader !=
NULL,
"FileHeader != NULL\n");
472 "FileHeader doesn't point to IMAGE_NT_HEADERS32\n");
474 ok(
img->NumberOfSections == 3,
475 "unexpected NumberOfSections, got %d instead of 3\n",
img->NumberOfSections);
476 if (
img->NumberOfSections >= 3)
478 ok(!
strcmp((
const char *)
img->Sections[0].Name,
".text"),
479 "unexpected name for section 0, expected .text, got %s\n",
480 (
const char *)
img->Sections[0].Name);
481 ok(!
strcmp((
const char *)
img->Sections[1].Name,
".bss"),
482 "unexpected name for section 1, expected .bss, got %s\n",
483 (
const char *)
img->Sections[1].Name);
484 ok(!
strcmp((
const char *)
img->Sections[2].Name,
".idata"),
485 "unexpected name for section 2, expected .idata, got %s\n",
486 (
const char *)
img->Sections[2].Name);
488 ok(
img->Characteristics == 0x102,
489 "unexpected Characteristics, got 0x%x instead of 0x102\n",
img->Characteristics);
490 ok(
img->fSystemImage == 0,
491 "unexpected fSystemImage, got %d instead of 0\n",
img->fSystemImage);
492 ok(
img->fDOSImage == 0,
493 "unexpected fDOSImage, got %d instead of 0\n",
img->fDOSImage);
495 "unexpected fReadOnly, got %d instead of 1\n",
img->fReadOnly);
497 "unexpected Version, got %d instead of 1\n",
img->Version);
498 ok(
img->SizeOfImage == 0x600,
499 "unexpected SizeOfImage, got 0x%x instead of 0x600\n",
img->SizeOfImage);
504 ok(
ret == 448,
"GetImageUnusedHeaderBytes returned %u instead of 448\n",
ret);
506 ok(
count == 64,
"unexpected size for unused header bytes, got %u instead of 64\n",
count);
char * strcat(char *DstString, const char *SrcString)
int strcmp(const char *String1, const char *String2)
int memcmp(void *Buffer1, void *Buffer2, ACPI_SIZE Count)
struct _LOADED_IMAGE * PLOADED_IMAGE
static WCHAR reason[MAX_STRING_RESOURCE_LEN]
#define ERROR_INVALID_PARAMETER
#define GetProcAddress(x, y)
#define INVALID_HANDLE_VALUE
#define CreateFileA(a, b, c, d, e, f, g)
#define HeapFree(x, y, z)
#define FILE_ATTRIBUTE_NORMAL
BOOL WINAPI DeleteFileA(IN LPCSTR lpFileName)
BOOL WINAPI FlushFileBuffers(IN HANDLE hFile)
BOOL WINAPI WriteFile(IN HANDLE hFile, IN LPCVOID lpBuffer, IN DWORD nNumberOfBytesToWrite OPTIONAL, OUT LPDWORD lpNumberOfBytesWritten, IN LPOVERLAPPED lpOverlapped OPTIONAL)
HINSTANCE WINAPI DECLSPEC_HOTPATCH LoadLibraryA(LPCSTR lpLibFileName)
DWORD WINAPI GetTempPathA(IN DWORD nBufferLength, OUT LPSTR lpBuffer)
UINT WINAPI GetSystemDirectoryA(OUT LPSTR lpBuffer, IN UINT uSize)
int WINAPI lstrcmpiA(LPCSTR str1, LPCSTR str2)
UINT WINAPI GetTempFileNameA(IN LPCSTR lpPathName, IN LPCSTR lpPrefixString, IN UINT uUnique, OUT LPSTR lpTempFileName)
struct _IMAGE_DOS_HEADER IMAGE_DOS_HEADER
struct _IMAGE_OPTIONAL_HEADER IMAGE_OPTIONAL_HEADER32
struct _IMAGE_NT_HEADERS IMAGE_NT_HEADERS32
GLuint GLuint GLsizei count
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
enum _IMAGEHLP_STATUS_REASON IMAGEHLP_STATUS_REASON
#define BIND_NO_BOUND_IMPORTS
#define CERT_PE_IMAGE_DIGEST_ALL_IMPORT_INFO
BOOL(WINAPI * PIMAGEHLP_STATUS_ROUTINE)(IMAGEHLP_STATUS_REASON, PCSTR, PCSTR, ULONG_PTR, ULONG_PTR)
#define memcpy(s1, s2, n)
#define ERROR_FILE_NOT_FOUND
static void check_updates(LPCSTR header, const struct update_accum *expected, const struct update_accum *got)
static BOOL WINAPI accumulating_stream_output(const void *pvArg, BYTE *pb, DWORD cb, BOOL final)
static const struct update_accum a1
static const struct update_accum a2
static CRYPT_DATA_BLOB b2[]
static void free_updates(struct update_accum *accum)
static CRYPT_DATA_BLOB b1[]
static UINT *static UINT UINT UINT UINT *static GdiplusAbort *static BOOL
static void update_checksum(void)
static void test_bind_image_ex(void)
static void test_image_load(void)
static const char const char * DllPath
static BOOL CALLBACK testing_status_routine(IMAGEHLP_STATUS_REASON reason, const char *ImageName, const char *DllName, ULONG_PTR Va, ULONG_PTR Parameter)
static const char const char const char PIMAGEHLP_STATUS_ROUTINE StatusRoutine
static const char * ImageName
static int status_routine_called[BindSymbolsNotUpdated+1]
static struct _PeImage bin
static const char const char const char * SymbolPath
static void test_get_digest_stream(void)
static HMODULE MODULEINFO DWORD cb
#define todo_wine_if(is_todo)
static HANDLE create_temp_file(WCHAR *temp_file)
static struct _PeImage bin
#define IMAGE_SCN_MEM_WRITE
#define IMAGE_NT_OPTIONAL_HDR32_MAGIC
#define IMAGE_SCN_CNT_INITIALIZED_DATA
#define IMAGE_SUBSYSTEM_WINDOWS_GUI
#define IMAGE_SCN_CNT_CODE
#define IMAGE_SCN_MEM_EXECUTE
#define IMAGE_SCN_MEM_READ
#define IMAGE_SCN_CNT_UNINITIALIZED_DATA
#define IMAGE_FILE_EXECUTABLE_IMAGE
#define IMAGE_FILE_MACHINE_I386
#define IMAGE_NT_SIGNATURE
#define IMAGE_DOS_SIGNATURE
#define IMAGE_FILE_32BIT_MACHINE
static int sum(int x_, int y_)
IMAGE_THUNK_DATA32 thunks[2]
struct Imports::__IMPORT_BY_NAME ibn
IMAGE_IMPORT_DESCRIPTOR descriptors[2]
IMAGE_THUNK_DATA32 original_thunks[2]
char __alignment1[FILE_PE_START - sizeof(IMAGE_DOS_HEADER)]
IMAGE_NT_HEADERS32 nt_headers
unsigned char text_section[FILE_IDATA-FILE_TEXT]
IMAGE_SECTION_HEADER sections[NUM_SECTIONS]
char __alignment2[FILE_TEXT - FILE_PE_START - sizeof(IMAGE_NT_HEADERS32) - NUM_SECTIONS *sizeof(IMAGE_SECTION_HEADER)]
struct Imports idata_section
IMAGE_DOS_HEADER dos_header
char __alignment3[FILE_TOTAL-FILE_IDATA-sizeof(struct Imports)]
const struct expected_blob * updates
CRYPT_DATA_BLOB * updates
#define FIELD_OFFSET(t, f)
DWORD WINAPI GetLastError(void)
_Must_inspect_result_ _In_ ULONG Flags
_Inout_opt_ PVOID Parameter