summaryrefslogtreecommitdiffhomepage
path: root/src/thread
diff options
context:
space:
mode:
Diffstat (limited to 'src/thread')
-rw-r--r--src/thread/ntapi_tt_create_thread.c19
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, /**/