diff options
author | midipix <writeonce@midipix.org> | 2018-05-15 19:22:24 +0000 |
---|---|---|
committer | midipix <writeonce@midipix.org> | 2018-05-15 18:40:05 -0400 |
commit | 80236ad5d20fbed5fc375d79a7aabcef0137553c (patch) | |
tree | e12c1cdeacbd5dadfccc6447313ec1d0167a0fa3 /src/thread | |
parent | e29bcec693268225f9e66aaa13d1e3a54f55c18f (diff) | |
download | ntapi-80236ad5d20fbed5fc375d79a7aabcef0137553c.tar.bz2 ntapi-80236ad5d20fbed5fc375d79a7aabcef0137553c.tar.xz |
local thread creation: extended argument: sync via atomic memory access.
Diffstat (limited to 'src/thread')
-rw-r--r-- | src/thread/ntapi_tt_create_thread.c | 19 |
1 files changed, 13 insertions, 6 deletions
diff --git a/src/thread/ntapi_tt_create_thread.c b/src/thread/ntapi_tt_create_thread.c index 2d46996..b40af7a 100644 --- a/src/thread/ntapi_tt_create_thread.c +++ b/src/thread/ntapi_tt_create_thread.c @@ -12,6 +12,7 @@ #include <ntapi/nt_thread.h> #include <ntapi/nt_process.h> #include <ntapi/nt_string.h> +#include <ntapi/nt_atomic.h> #include <ntapi/ntapi.h> #include "ntapi_impl.h" @@ -216,7 +217,7 @@ int32_t __stdcall __ntapi_tt_create_thread(nt_thread_params * params) /* */ /* A "RAPUNZEL" TOP-OF-STACK, VARIABLE-SIZE ENTRY-ROUTINE CONTEXT */ /* */ -/* COPYRIGHT (C) 2013,2014,2015 ZVI GILBOA */ +/* COPYRIGHT (C) 2013--2018 ZVI GILBOA */ /* */ /* */ /* */ @@ -225,12 +226,17 @@ int32_t __stdcall __ntapi_tt_create_thread(nt_thread_params * params) /**/ context.STACK_POINTER_REGISTER -= params->ext_ctx_size; /**/ /**/ params->arg = (void *)context.STACK_POINTER_REGISTER; /**/ /**/ /**/ -/**/ if (params->creation_flags & NT_CREATE_LOCAL_THREAD) /**/ +/**/ if (params->creation_flags & NT_CREATE_LOCAL_THREAD) { /**/ /**/ __ntapi->tt_aligned_block_memcpy( /**/ /**/ (uintptr_t *)params->arg, /**/ /**/ (uintptr_t *)params->ext_ctx, /**/ /**/ params->ext_ctx_size); /**/ -/**/ else { /**/ +/**/ /**/ +/**/ __ntapi->tt_aligned_block_memlock( /**/ +/**/ (uintptr_t *)params->arg, /**/ +/**/ params->ext_ctx_size); /**/ +/**/ /**/ +/**/ } else { /**/ /**/ status = __ntapi->zw_write_virtual_memory( /**/ /**/ params->hprocess, /**/ /**/ params->arg, /**/ @@ -257,9 +263,10 @@ int32_t __stdcall __ntapi_tt_create_thread(nt_thread_params * params) /**/ /**/ /**/ /**/ /* write entry-routine argument */ -/**/ if ((sizeof(size_t) == 8) /**/ -/**/ || (params->creation_flags&NT_CREATE_LOCAL_THREAD))/**/ -/**/ *parg = (uintptr_t)params->arg; /**/ +/**/ if (params->creation_flags & NT_CREATE_LOCAL_THREAD) /**/ +/**/ at_store( /**/ +/**/ (intptr_t *)parg, /**/ +/**/ (intptr_t)params->arg); /**/ /**/ else { /**/ /**/ status = __ntapi->zw_write_virtual_memory( /**/ /**/ params->hprocess, /**/ |