server: Store correct entry point for first thread.

This commit is contained in:
Sebastian Lackner 2015-07-30 07:16:36 +02:00 committed by Alexandre Julliard
parent 6e66c12c68
commit 905bf79337
3 changed files with 12 additions and 3 deletions

View File

@ -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,

View File

@ -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 );

View File

@ -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 */
{