Commit 905bf793 authored by Sebastian Lackner's avatar Sebastian Lackner Committed by Alexandre Julliard

server: Store correct entry point for first thread.

parent 6e66c12c
......@@ -1713,18 +1713,26 @@ static DWORD WINAPI start_address_thread(void *arg)
static void test_thread_start_address(void)
{
PRTL_THREAD_START_ROUTINE entry;
PRTL_THREAD_START_ROUTINE entry, expected_entry;
IMAGE_NT_HEADERS *nt;
NTSTATUS status;
HANDLE thread;
void *module;
DWORD ret;
module = GetModuleHandleA(0);
ok(module != NULL, "expected non-NULL address for module\n");
nt = RtlImageNtHeader(module);
ok(nt != NULL, "expected non-NULL address for NT header\n");
entry = NULL;
ret = 0xdeadbeef;
status = pNtQueryInformationThread(GetCurrentThread(), ThreadQuerySetWin32StartAddress,
&entry, sizeof(entry), &ret);
ok(status == STATUS_SUCCESS, "expected STATUS_SUCCESS, got %08x\n", status);
ok(ret == sizeof(entry), "NtQueryInformationThread returned %u bytes\n", ret);
ok(entry != NULL, "expected non-NULL entry point\n");
expected_entry = (void *)((char *)module + nt->OptionalHeader.AddressOfEntryPoint);
ok(entry == expected_entry, "expected %p, got %p\n", expected_entry, entry);
entry = (void *)0xdeadbeef;
status = pNtSetInformationThread(GetCurrentThread(), ThreadQuerySetWin32StartAddress,
......
......@@ -1295,6 +1295,7 @@ DECL_HANDLER(init_process_done)
process->ldt_copy = req->ldt_copy;
process->start_time = current_time;
current->entry_point = req->entry;
generate_startup_debug_events( process, req->entry );
set_process_startup_state( process, STARTUP_DONE );
......
......@@ -1287,7 +1287,7 @@ DECL_HANDLER(init_thread)
current->unix_pid = req->unix_pid;
current->unix_tid = req->unix_tid;
current->teb = req->teb;
current->entry_point = req->entry;
current->entry_point = process->peb ? req->entry : 0;
if (!process->peb) /* first thread, initialize the process too */
{
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment