summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authormidipix <writeonce@midipix.org>2016-12-14 14:36:25 +0000
committermidipix <writeonce@midipix.org>2016-12-15 01:48:02 -0500
commit3bc37f8fb297f48788ebb34ff7bdbed96566bd2a (patch)
tree721b1c0d9a4d39429e21bc6f01b2ae70b4ff15ed
parent439a91a7b6a3d7384bc5665f86c97d8a06cf43c2 (diff)
downloadntapi-3bc37f8fb297f48788ebb34ff7bdbed96566bd2a.tar.bz2
ntapi-3bc37f8fb297f48788ebb34ff7bdbed96566bd2a.tar.xz
__ntapi_tt_create_thread(): do not alter value of caller's params->reg_context.
-rw-r--r--src/thread/ntapi_tt_create_thread.c14
1 files changed, 10 insertions, 4 deletions
diff --git a/src/thread/ntapi_tt_create_thread.c b/src/thread/ntapi_tt_create_thread.c
index 50a7d2f..f70d66f 100644
--- a/src/thread/ntapi_tt_create_thread.c
+++ b/src/thread/ntapi_tt_create_thread.c
@@ -157,9 +157,15 @@ int32_t __stdcall __ntapi_tt_create_thread(
status);
/* context */
- if (!params->reg_context) {
- params->reg_context = &context;
- __ntapi->tt_aligned_block_memset(&context,0,sizeof(nt_thread_context));
+ if (params->reg_context) {
+ __ntapi->tt_aligned_block_memcpy(
+ (uintptr_t *)&context,
+ (uintptr_t *)params->reg_context,
+ sizeof(context));
+ } else {
+ __ntapi->tt_aligned_block_memset(
+ &context,0,sizeof(context));
+
__INIT_CONTEXT(context);
context.INSTRUCTION_POINTER_REGISTER = (uintptr_t)params->start;
context.STACK_POINTER_REGISTER = (uintptr_t)(stack.expandable_stack_base)
@@ -265,7 +271,7 @@ int32_t __stdcall __ntapi_tt_create_thread(
params->obj_attr,
params->hprocess,
&cid,
- params->reg_context,
+ &context,
&stack,
fsuspended);