57#define VA_START 0x400000
58#define FILE_PE_START 0x50
60#define FILE_TEXT 0x200
61#define RVA_TEXT 0x1000
63#define FILE_IDATA 0x400
64#define RVA_IDATA 0x3000
65#define FILE_TOTAL 0x600
66#define RVA_TOTAL 0x4000
81#define EXIT_PROCESS (VA_START + RVA_IDATA + FIELD_OFFSET(struct imports, thunks))
98 {
IMAGE_DOS_SIGNATURE, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, {0}, 0, 0, {0},
FILE_PE_START},
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,
121 {
".bss", {0x400},
RVA_BSS, 0, 0, 0, 0, 0, 0,
180 {
IMAGE_DOS_SIGNATURE, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, {0}, 0, 0, {0},
FILE_PE_START },
193 RVA_TEXT,
RVA_TEXT,
VA_START, 0x1000, 0x200, 4, 0, 1, 0, 5, 2, 0,
195 0x200000, 0x1000, 0x100000, 0x1000, 0, 0x10,
220 { 0,
"ExitProcess" },
290 ok(
expected->updates[
i].cb == got->
updates[
i].cb,
"%s, update %ld: expected %ld bytes, got %ld\n",
294 "%s, update %ld: unexpected value\n",
header,
i);
313 {
sizeof(
bin.nt_headers), &
bin.nt_headers},
314 {
sizeof(
bin.sections), &
bin.sections},
316 {
sizeof(
bin.idata_section.descriptors[0].OriginalFirstThunk),
317 &
bin.idata_section.descriptors[0].OriginalFirstThunk},
320 &
bin.idata_section.descriptors[0].Name},
322 &
bin.idata_section.ibn}
329 {
sizeof(
bin.nt_headers), &
bin.nt_headers},
330 {
sizeof(
bin.sections), &
bin.sections},
339 {
sizeof(
bin64.nt_headers), &
bin64.nt_headers},
342 {
sizeof(
bin64.idata_section.descriptors[0].OriginalFirstThunk),
343 &
bin64.idata_section.descriptors[0].OriginalFirstThunk},
346 &
bin64.idata_section.descriptors[0].Name},
354 {
sizeof(
bin64.nt_headers), &
bin64.nt_headers},
405 "expected ERROR_INVALID_PARAMETER, got %ld\n",
GetLastError());
409 skip(
"couldn't create temp file\n");
415 "expected ERROR_INVALID_PARAMETER, got %ld\n",
GetLastError());
419 "expected ERROR_INVALID_PARAMETER, got %ld\n",
GetLastError());
424 "expected ERROR_INVALID_PARAMETER, got %ld\n",
GetLastError());
428 bin.nt_headers.OptionalHeader.CheckSum = 0;
436 bin.nt_headers.OptionalHeader.CheckSum = 0;
437 bin.nt_headers.OptionalHeader.SizeOfInitializedData = 0;
438 bin.nt_headers.OptionalHeader.SizeOfImage = 0;
447 check_updates(
"flags = CERT_PE_IMAGE_DIGEST_ALL_IMPORT_INFO", &
a2, &accum);
455 skip(
"couldn't create temp file\n");
459 bin64.nt_headers.OptionalHeader.CheckSum = 0;
466 bin64.nt_headers.OptionalHeader.CheckSum = 0;
467 bin64.nt_headers.OptionalHeader.SizeOfInitializedData = 0;
468 bin64.nt_headers.OptionalHeader.SizeOfImage = 0;
477 check_updates(
"flags = CERT_PE_IMAGE_DIGEST_ALL_IMPORT_INFO", &
a4, &accum);
491 trace(
"reason %u, file %s, module %s, va %#Ix, param %#Ix\n",
498 ok(!va,
"got VA %#Ix\n", va);
511 if (!
strcmp((
const char *)
param,
"SysAllocString"))
516 else if (!
strcmp((
const char *)
param,
"GetOpenFileNameA"))
521 else if (!
strcmp((
const char *)
param,
"Ordinal117"))
529 ok(0,
"got unexpected reason %#x\n",
reason);
542 ok(!
ret,
"expected failure\n");
567 skip(
"couldn't create temp file\n");
575 ok(
img !=
NULL,
"ImageLoad unexpectedly failed\n");
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)
585 "MappedAddress doesn't point to IMAGE_DOS_HEADER\n");
587 ok(
img->FileHeader !=
NULL,
"FileHeader != NULL\n");
591 "FileHeader doesn't point to IMAGE_NT_HEADERS32\n");
593 ok(
img->NumberOfSections == 3,
594 "unexpected NumberOfSections, got %ld instead of 3\n",
img->NumberOfSections);
595 if (
img->NumberOfSections >= 3)
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);
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);
614 "unexpected fReadOnly, got %d instead of 1\n",
img->fReadOnly);
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);
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);
static cab_ULONG checksum(const cab_UBYTE *data, cab_UWORD bytes, cab_ULONG csum)
static WCHAR reason[MAX_STRING_RESOURCE_LEN]
#define ERROR_INVALID_PARAMETER
#define INVALID_HANDLE_VALUE
#define CreateFileA(a, b, c, d, e, f, g)
#define HeapFree(x, y, z)
#define FILE_ATTRIBUTE_NORMAL
PLOADED_IMAGE WINAPI ImageLoad(PCSTR dll_name, PCSTR dll_path)
BOOL WINAPI ImageUnload(PLOADED_IMAGE loaded_image)
DWORD WINAPI GetImageUnusedHeaderBytes(PLOADED_IMAGE LoadedImage, LPDWORD SizeUnusedHeaderBytes)
BOOL WINAPI ImageGetDigestStream(HANDLE FileHandle, DWORD DigestLevel, DIGEST_FUNCTION DigestFunction, DIGEST_HANDLE DigestHandle)
BOOL WINAPI DeleteFileA(IN LPCSTR lpFileName)
BOOL WINAPI FlushFileBuffers(IN HANDLE hFile)
BOOL WINAPI WriteFile(_In_ HANDLE hFile, _In_reads_bytes_opt_(nNumberOfBytesToWrite) LPCVOID lpBuffer, _In_ DWORD nNumberOfBytesToWrite, _Out_opt_ LPDWORD lpNumberOfBytesWritten, _Inout_opt_ LPOVERLAPPED lpOverlapped)
HMODULE WINAPI DECLSPEC_HOTPATCH GetModuleHandleA(LPCSTR lpModuleName)
DWORD WINAPI SearchPathA(IN LPCSTR lpPath OPTIONAL, IN LPCSTR lpFileName, IN LPCSTR lpExtension OPTIONAL, IN DWORD nBufferLength, OUT LPSTR lpBuffer, OUT LPSTR *lpFilePart OPTIONAL)
DWORD WINAPI GetTempPathA(IN DWORD nBufferLength, OUT LPSTR lpBuffer)
HRSRC WINAPI FindResourceA(HMODULE hModule, LPCSTR name, LPCSTR type)
DWORD WINAPI SizeofResource(HINSTANCE hModule, HRSRC hRsrc)
LPVOID WINAPI LockResource(HGLOBAL handle)
HGLOBAL WINAPI LoadResource(HINSTANCE hModule, HRSRC hRsrc)
_ACRTIMP int __cdecl memcmp(const void *, const void *, size_t)
_ACRTIMP char *__cdecl strchr(const char *, int)
_ACRTIMP int __cdecl strcmp(const char *, const char *)
static BOOL create_temp_file(FCI_Int *fci, struct temp_file *file)
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
BOOL WINAPI BindImageEx(DWORD flags, const char *module, const char *dll_path, const char *symbol_path, PIMAGEHLP_STATUS_ROUTINE cb)
enum _IMAGEHLP_STATUS_REASON IMAGEHLP_STATUS_REASON
#define BIND_NO_BOUND_IMPORTS
#define CERT_PE_IMAGE_DIGEST_ALL_IMPORT_INFO
#define todo_wine_if(is_todo)
static GLint image_size(GLint width, GLint height, GLenum format, GLenum type)
#define memcpy(s1, s2, n)
#define ERROR_FILE_NOT_FOUND
static const unsigned char text_section[]
static const unsigned char bin64[]
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 CRYPT_DATA_BLOB b4
static const struct update_accum a2
static CRYPT_DATA_BLOB b3[]
static CRYPT_DATA_BLOB b2[]
static void free_updates(struct update_accum *accum)
static CRYPT_DATA_BLOB b1[]
static const struct update_accum a3
static const struct update_accum a4
#define load_resource(a, b, c)
static void test_bind_image_ex(void)
static void test_image_load(void)
static unsigned int got_SHRegGetIntW
static BOOL WINAPI bind_image_cb(IMAGEHLP_STATUS_REASON reason, const char *file, const char *module, ULONG_PTR va, ULONG_PTR param)
static struct image64 bin64
static unsigned int got_GetOpenFileNameA
static void test_get_digest_stream(void)
static DWORD compute_checksum(const WORD *image, DWORD image_size)
static unsigned int got_SysAllocString
struct section sections[2]
#define IMAGE_SCN_MEM_WRITE
struct _IMAGE_OPTIONAL_HEADER64 IMAGE_OPTIONAL_HEADER64
#define IMAGE_NT_OPTIONAL_HDR32_MAGIC
#define IMAGE_SCN_CNT_INITIALIZED_DATA
#define IMAGE_NT_OPTIONAL_HDR64_MAGIC
#define IMAGE_SUBSYSTEM_WINDOWS_GUI
#define IMAGE_SCN_CNT_CODE
#define IMAGE_SCN_MEM_EXECUTE
#define IMAGE_FILE_MACHINE_AMD64
#define IMAGE_SCN_MEM_READ
#define IMAGE_SCN_CNT_UNINITIALIZED_DATA
struct _IMAGE_NT_HEADERS64 IMAGE_NT_HEADERS64
#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_)
const struct expected_blob * updates
IMAGE_NT_HEADERS64 nt_headers
IMAGE_DOS_HEADER dos_header
IMAGE_NT_HEADERS32 nt_headers
struct imports idata_section
unsigned char text_section[FILE_IDATA-FILE_TEXT]
IMAGE_SECTION_HEADER sections[NUM_SECTIONS]
char __alignment1[FILE_PE_START - sizeof(IMAGE_DOS_HEADER)]
char __alignment2[FILE_TEXT - FILE_PE_START - sizeof(IMAGE_NT_HEADERS32) - NUM_SECTIONS *sizeof(IMAGE_SECTION_HEADER)]
IMAGE_DOS_HEADER dos_header
char __alignment3[FILE_TOTAL-FILE_IDATA-sizeof(struct imports)]
IMAGE_THUNK_DATA32 thunks[2]
IMAGE_THUNK_DATA32 original_thunks[2]
IMAGE_IMPORT_DESCRIPTOR descriptors[2]
struct imports::@1921 ibn
CRYPT_DATA_BLOB * updates
#define FIELD_OFFSET(t, f)
DWORD WINAPI GetLastError(void)