mirror of
https://github.com/reactos/reactos.git
synced 2024-11-20 06:15:26 +00:00
[KERNEL32]
- We can now free the fiber activation context stack since RtlFreeActivationContextStack is implemented. - Free the thread activation context stack if we fail at creating a remote thread. svn path=/trunk/; revision=58549
This commit is contained in:
parent
b24c620ea3
commit
b0ef5a574c
2 changed files with 24 additions and 17 deletions
|
@ -15,15 +15,15 @@
|
|||
typedef struct _FIBER /* Field offsets: */
|
||||
{ /* 32 bit 64 bit */
|
||||
/* this must be the first field */
|
||||
LPVOID Parameter; /* 0x00 0x00 */
|
||||
struct _EXCEPTION_REGISTRATION_RECORD * ExceptionList; /* 0x04 0x08 */
|
||||
LPVOID StackBase; /* 0x08 0x10 */
|
||||
LPVOID StackLimit; /* 0x0C 0x18 */
|
||||
LPVOID DeallocationStack; /* 0x10 0x20 */
|
||||
PVOID Parameter; /* 0x00 0x00 */
|
||||
PEXCEPTION_REGISTRATION_RECORD ExceptionList; /* 0x04 0x08 */
|
||||
PVOID StackBase; /* 0x08 0x10 */
|
||||
PVOID StackLimit; /* 0x0C 0x18 */
|
||||
PVOID DeallocationStack; /* 0x10 0x20 */
|
||||
CONTEXT Context; /* 0x14 0x28 */
|
||||
ULONG GuaranteedStackBytes; /* 0x2E0 */
|
||||
PVOID FlsData; /* 0x2E4 */
|
||||
PVOID ActivationContextStack; /* 0x2E8 */
|
||||
PACTIVATION_CONTEXT_STACK ActivationContextStack; /* 0x2E8 */
|
||||
} FIBER, *PFIBER;
|
||||
|
||||
/* PRIVATE FUNCTIONS **********************************************************/
|
||||
|
@ -171,7 +171,7 @@ CreateFiberEx(SIZE_T dwStackCommitSize,
|
|||
PFIBER Fiber;
|
||||
NTSTATUS Status;
|
||||
INITIAL_TEB InitialTeb;
|
||||
PVOID ActivationContextStack = NULL;
|
||||
PACTIVATION_CONTEXT_STACK ActivationContextStack = NULL;
|
||||
DPRINT("Creating Fiber\n");
|
||||
|
||||
/* Check for invalid flags */
|
||||
|
@ -210,9 +210,8 @@ CreateFiberEx(SIZE_T dwStackCommitSize,
|
|||
/* Free the fiber */
|
||||
RtlFreeHeap(GetProcessHeap(), 0, Fiber);
|
||||
|
||||
/* Free the activation context */
|
||||
DPRINT1("Leaking activation stack because nobody implemented free");
|
||||
//RtlFreeActivationContextStack(&ActivationContextStack);
|
||||
/* Free the activation context stack */
|
||||
RtlFreeActivationContextStack(ActivationContextStack);
|
||||
|
||||
/* Failure */
|
||||
BaseSetLastNTError(Status);
|
||||
|
@ -271,9 +270,8 @@ DeleteFiber(LPVOID lpFiber)
|
|||
/* Get rid of FLS */
|
||||
if (Fiber->FlsData) BaseRundownFls(Fiber->FlsData);
|
||||
|
||||
/* Get rid of the activation stack */
|
||||
DPRINT1("Leaking activation stack because nobody implemented free");
|
||||
//RtlFreeActivationContextStack(Fiber->ActivationContextStack);
|
||||
/* Get rid of the activation context stack */
|
||||
RtlFreeActivationContextStack(Fiber->ActivationContextStack);
|
||||
|
||||
/* Free the fiber data */
|
||||
RtlFreeHeap(GetProcessHeap(), 0, lpFiber);
|
||||
|
|
|
@ -171,7 +171,7 @@ CreateRemoteThread(IN HANDLE hProcess,
|
|||
ULONG Dummy;
|
||||
PTEB Teb;
|
||||
THREAD_BASIC_INFORMATION ThreadBasicInfo;
|
||||
PVOID ActivationContextStack = NULL;
|
||||
PACTIVATION_CONTEXT_STACK ActivationContextStack = NULL;
|
||||
ACTIVATION_CONTEXT_BASIC_INFORMATION ActCtxInfo;
|
||||
ULONG_PTR Cookie;
|
||||
ULONG ReturnLength;
|
||||
|
@ -191,7 +191,7 @@ CreateRemoteThread(IN HANDLE hProcess,
|
|||
dwCreationFlags & STACK_SIZE_PARAM_IS_A_RESERVATION ?
|
||||
dwStackSize : 0,
|
||||
&InitialTeb);
|
||||
if(!NT_SUCCESS(Status))
|
||||
if (!NT_SUCCESS(Status))
|
||||
{
|
||||
BaseSetLastNTError(Status);
|
||||
return NULL;
|
||||
|
@ -260,7 +260,7 @@ CreateRemoteThread(IN HANDLE hProcess,
|
|||
Teb->ActivationContextStackPointer = ActivationContextStack;
|
||||
|
||||
/* Query the Context */
|
||||
// WARNING!!! THIS IS USING THE WIN32 FLAG BECAUSE REACTOS CONTINUES TO BE A POS!!! ///
|
||||
// WARNING!!! THIS IS USING THE WIN32 FLAG BECAUSE REACTOS CONTINUES TO BE A POS!!! ///
|
||||
Status = RtlQueryInformationActivationContext(QUERY_ACTCTX_FLAG_USE_ACTIVE_ACTCTX,
|
||||
NULL,
|
||||
0,
|
||||
|
@ -274,6 +274,11 @@ CreateRemoteThread(IN HANDLE hProcess,
|
|||
ERROR_DBGBREAK("SXS: %s - Failing thread create because "
|
||||
"RtlQueryInformationActivationContext() failed with status %08lx\n",
|
||||
__FUNCTION__, Status);
|
||||
|
||||
/* Free the activation context stack */
|
||||
// RtlFreeThreadActivationContextStack();
|
||||
RtlFreeActivationContextStack(Teb->ActivationContextStackPointer);
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
@ -291,6 +296,11 @@ CreateRemoteThread(IN HANDLE hProcess,
|
|||
ERROR_DBGBREAK("SXS: %s - Failing thread create because "
|
||||
"RtlActivateActivationContextEx() failed with status %08lx\n",
|
||||
__FUNCTION__, Status);
|
||||
|
||||
/* Free the activation context stack */
|
||||
// RtlFreeThreadActivationContextStack();
|
||||
RtlFreeActivationContextStack(Teb->ActivationContextStackPointer);
|
||||
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
|
@ -299,7 +309,6 @@ CreateRemoteThread(IN HANDLE hProcess,
|
|||
/* Notify CSR */
|
||||
if (!BaseRunningInServerProcess)
|
||||
{
|
||||
/* Notify CSR */
|
||||
Status = BasepNotifyCsrOfThread(hThread, &ClientId);
|
||||
ASSERT(NT_SUCCESS(Status));
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue