diff options
author | midipix <writeonce@midipix.org> | 2016-10-22 18:27:02 -0400 |
---|---|---|
committer | midipix <writeonce@midipix.org> | 2016-10-23 01:00:38 -0400 |
commit | 656c604e5e206b1abd5932e910f7686dc324f3ab (patch) | |
tree | dbd11ce5a2e56e654a6826abd6a96a6edd852ed3 | |
parent | 6c2ba1325ddcb52d44cd2ffccbdf6a4bb2853365 (diff) | |
download | ntapi-656c604e5e206b1abd5932e910f7686dc324f3ab.tar.bz2 ntapi-656c604e5e206b1abd5932e910f7686dc324f3ab.tar.xz |
__ntapi_tt_create_thread(): retain proper value of params->stack_size_commit.
-rw-r--r-- | src/thread/ntapi_tt_create_thread.c | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/src/thread/ntapi_tt_create_thread.c b/src/thread/ntapi_tt_create_thread.c index 9105ec0..a76fec9 100644 --- a/src/thread/ntapi_tt_create_thread.c +++ b/src/thread/ntapi_tt_create_thread.c @@ -52,6 +52,8 @@ int32_t __stdcall __ntapi_tt_create_thread( nt_user_stack stack __attr_aligned__(0x10); uintptr_t fsuspended; uintptr_t * parg; + size_t size; + size_t commit; if (!(params->stack_size_commit)) return NT_STATUS_INVALID_PARAMETER; @@ -119,17 +121,17 @@ int32_t __stdcall __ntapi_tt_create_thread( - params->stack_size_commit); /* guard page */ - params->stack_size_commit += __PAGE_SIZE; + commit = params->stack_size_commit + __PAGE_SIZE; stack_system_limit = (void *)((intptr_t)stack.expandable_stack_base - - params->stack_size_commit); + - commit); /* then we commit */ status = __ntapi->zw_allocate_virtual_memory( params->hprocess, &stack_system_limit, 0, - ¶ms->stack_size_commit, + &commit, NT_MEM_COMMIT, NT_PAGE_READWRITE); @@ -140,11 +142,11 @@ int32_t __stdcall __ntapi_tt_create_thread( status); /* finally we protect the guard page */ - params->stack_size_commit = __PAGE_SIZE; + size = __PAGE_SIZE; status = __ntapi->zw_protect_virtual_memory( params->hprocess, &stack_system_limit, - ¶ms->stack_size_commit, + &size, NT_PAGE_READWRITE | NT_MEM_PAGE_GUARD, &protect_type_old); |