server: Store PE image info in process structure.
Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=51829 Signed-off-by: Paul Gofman <pgofman@codeweavers.com> Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
parent
b6dc839908
commit
8eacd3e507
|
@ -1931,9 +1931,11 @@ static void test_section_access(void)
|
||||||
char temp_path[MAX_PATH];
|
char temp_path[MAX_PATH];
|
||||||
char dll_name[MAX_PATH];
|
char dll_name[MAX_PATH];
|
||||||
SIZE_T size;
|
SIZE_T size;
|
||||||
|
SECTION_IMAGE_INFORMATION image_info;
|
||||||
MEMORY_BASIC_INFORMATION info;
|
MEMORY_BASIC_INFORMATION info;
|
||||||
STARTUPINFOA sti;
|
STARTUPINFOA sti;
|
||||||
PROCESS_INFORMATION pi;
|
PROCESS_INFORMATION pi;
|
||||||
|
NTSTATUS status;
|
||||||
DWORD ret;
|
DWORD ret;
|
||||||
|
|
||||||
/* prevent displaying of the "Unable to load this DLL" message box */
|
/* prevent displaying of the "Unable to load this DLL" message box */
|
||||||
|
@ -2084,6 +2086,19 @@ static void test_section_access(void)
|
||||||
ok(!memcmp(buf, section_data, section.SizeOfRawData), "wrong section data\n");
|
ok(!memcmp(buf, section_data, section.SizeOfRawData), "wrong section data\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
status = NtQueryInformationProcess(pi.hProcess, ProcessImageInformation,
|
||||||
|
&image_info, sizeof(image_info), NULL );
|
||||||
|
ok(!status, "Got unexpected status %#x.\n", status);
|
||||||
|
ok(!(image_info.ImageCharacteristics & IMAGE_FILE_DLL),
|
||||||
|
"Got unexpected characteristics %#x.\n", nt_header.FileHeader.Characteristics);
|
||||||
|
status = NtUnmapViewOfSection(pi.hProcess, info.BaseAddress);
|
||||||
|
ok(!status, "Got unexpected status %#x.\n", status);
|
||||||
|
status = NtQueryInformationProcess(pi.hProcess, ProcessImageInformation,
|
||||||
|
&image_info, sizeof(image_info), NULL );
|
||||||
|
ok(!status, "Got unexpected status %#x.\n", status);
|
||||||
|
ok(!(image_info.ImageCharacteristics & IMAGE_FILE_DLL),
|
||||||
|
"Got unexpected characteristics %#x.\n", nt_header.FileHeader.Characteristics);
|
||||||
|
|
||||||
SetLastError(0xdeadbeef);
|
SetLastError(0xdeadbeef);
|
||||||
ret = TerminateProcess(pi.hProcess, 0);
|
ret = TerminateProcess(pi.hProcess, 0);
|
||||||
ok(ret, "TerminateProcess() error %d\n", GetLastError());
|
ok(ret, "TerminateProcess() error %d\n", GetLastError());
|
||||||
|
|
|
@ -408,6 +408,7 @@ static void add_process_view( struct thread *thread, struct memory_view *view )
|
||||||
process->image = NULL;
|
process->image = NULL;
|
||||||
if (get_view_nt_name( view, &name ) && (process->image = memdup( name.str, name.len )))
|
if (get_view_nt_name( view, &name ) && (process->image = memdup( name.str, name.len )))
|
||||||
process->imagelen = name.len;
|
process->imagelen = name.len;
|
||||||
|
process->image_info = view->image;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -680,6 +680,7 @@ struct process *create_process( int fd, struct process *parent, unsigned int fla
|
||||||
process->trace_data = 0;
|
process->trace_data = 0;
|
||||||
process->rawinput_mouse = NULL;
|
process->rawinput_mouse = NULL;
|
||||||
process->rawinput_kbd = NULL;
|
process->rawinput_kbd = NULL;
|
||||||
|
memset( &process->image_info, 0, sizeof(process->image_info) );
|
||||||
list_init( &process->kernel_object );
|
list_init( &process->kernel_object );
|
||||||
list_init( &process->thread_list );
|
list_init( &process->thread_list );
|
||||||
list_init( &process->locks );
|
list_init( &process->locks );
|
||||||
|
@ -1502,17 +1503,7 @@ DECL_HANDLER(get_process_info)
|
||||||
reply->session_id = process->session_id;
|
reply->session_id = process->session_id;
|
||||||
reply->machine = process->machine;
|
reply->machine = process->machine;
|
||||||
if (get_reply_max_size())
|
if (get_reply_max_size())
|
||||||
{
|
set_reply_data( &process->image_info, min( sizeof(process->image_info), get_reply_max_size() ));
|
||||||
client_ptr_t base;
|
|
||||||
const pe_image_info_t *info;
|
|
||||||
struct memory_view *view = get_exe_view( process );
|
|
||||||
if (view)
|
|
||||||
{
|
|
||||||
if ((info = get_view_image_info( view, &base )))
|
|
||||||
set_reply_data( info, min( sizeof(*info), get_reply_max_size() ));
|
|
||||||
}
|
|
||||||
else set_error( STATUS_PROCESS_IS_TERMINATING );
|
|
||||||
}
|
|
||||||
release_object( process );
|
release_object( process );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -89,6 +89,7 @@ struct process
|
||||||
const struct rawinput_device *rawinput_mouse; /* rawinput mouse device, if any */
|
const struct rawinput_device *rawinput_mouse; /* rawinput mouse device, if any */
|
||||||
const struct rawinput_device *rawinput_kbd; /* rawinput keyboard device, if any */
|
const struct rawinput_device *rawinput_kbd; /* rawinput keyboard device, if any */
|
||||||
struct list kernel_object; /* list of kernel object pointers */
|
struct list kernel_object; /* list of kernel object pointers */
|
||||||
|
pe_image_info_t image_info; /* main exe image info */
|
||||||
};
|
};
|
||||||
|
|
||||||
/* process functions */
|
/* process functions */
|
||||||
|
|
Loading…
Reference in New Issue