mirror of
https://github.com/reactos/reactos.git
synced 2024-09-15 15:19:37 +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
|
@ -15,15 +15,15 @@
|
||||||
typedef struct _FIBER /* Field offsets: */
|
typedef struct _FIBER /* Field offsets: */
|
||||||
{ /* 32 bit 64 bit */
|
{ /* 32 bit 64 bit */
|
||||||
/* this must be the first field */
|
/* this must be the first field */
|
||||||
LPVOID Parameter; /* 0x00 0x00 */
|
PVOID Parameter; /* 0x00 0x00 */
|
||||||
struct _EXCEPTION_REGISTRATION_RECORD * ExceptionList; /* 0x04 0x08 */
|
PEXCEPTION_REGISTRATION_RECORD ExceptionList; /* 0x04 0x08 */
|
||||||
LPVOID StackBase; /* 0x08 0x10 */
|
PVOID StackBase; /* 0x08 0x10 */
|
||||||
LPVOID StackLimit; /* 0x0C 0x18 */
|
PVOID StackLimit; /* 0x0C 0x18 */
|
||||||
LPVOID DeallocationStack; /* 0x10 0x20 */
|
PVOID DeallocationStack; /* 0x10 0x20 */
|
||||||
CONTEXT Context; /* 0x14 0x28 */
|
CONTEXT Context; /* 0x14 0x28 */
|
||||||
ULONG GuaranteedStackBytes; /* 0x2E0 */
|
ULONG GuaranteedStackBytes; /* 0x2E0 */
|
||||||
PVOID FlsData; /* 0x2E4 */
|
PVOID FlsData; /* 0x2E4 */
|
||||||
PVOID ActivationContextStack; /* 0x2E8 */
|
PACTIVATION_CONTEXT_STACK ActivationContextStack; /* 0x2E8 */
|
||||||
} FIBER, *PFIBER;
|
} FIBER, *PFIBER;
|
||||||
|
|
||||||
/* PRIVATE FUNCTIONS **********************************************************/
|
/* PRIVATE FUNCTIONS **********************************************************/
|
||||||
|
@ -171,7 +171,7 @@ CreateFiberEx(SIZE_T dwStackCommitSize,
|
||||||
PFIBER Fiber;
|
PFIBER Fiber;
|
||||||
NTSTATUS Status;
|
NTSTATUS Status;
|
||||||
INITIAL_TEB InitialTeb;
|
INITIAL_TEB InitialTeb;
|
||||||
PVOID ActivationContextStack = NULL;
|
PACTIVATION_CONTEXT_STACK ActivationContextStack = NULL;
|
||||||
DPRINT("Creating Fiber\n");
|
DPRINT("Creating Fiber\n");
|
||||||
|
|
||||||
/* Check for invalid flags */
|
/* Check for invalid flags */
|
||||||
|
@ -210,9 +210,8 @@ CreateFiberEx(SIZE_T dwStackCommitSize,
|
||||||
/* Free the fiber */
|
/* Free the fiber */
|
||||||
RtlFreeHeap(GetProcessHeap(), 0, Fiber);
|
RtlFreeHeap(GetProcessHeap(), 0, Fiber);
|
||||||
|
|
||||||
/* Free the activation context */
|
/* Free the activation context stack */
|
||||||
DPRINT1("Leaking activation stack because nobody implemented free");
|
RtlFreeActivationContextStack(ActivationContextStack);
|
||||||
//RtlFreeActivationContextStack(&ActivationContextStack);
|
|
||||||
|
|
||||||
/* Failure */
|
/* Failure */
|
||||||
BaseSetLastNTError(Status);
|
BaseSetLastNTError(Status);
|
||||||
|
@ -271,9 +270,8 @@ DeleteFiber(LPVOID lpFiber)
|
||||||
/* Get rid of FLS */
|
/* Get rid of FLS */
|
||||||
if (Fiber->FlsData) BaseRundownFls(Fiber->FlsData);
|
if (Fiber->FlsData) BaseRundownFls(Fiber->FlsData);
|
||||||
|
|
||||||
/* Get rid of the activation stack */
|
/* Get rid of the activation context stack */
|
||||||
DPRINT1("Leaking activation stack because nobody implemented free");
|
RtlFreeActivationContextStack(Fiber->ActivationContextStack);
|
||||||
//RtlFreeActivationContextStack(Fiber->ActivationContextStack);
|
|
||||||
|
|
||||||
/* Free the fiber data */
|
/* Free the fiber data */
|
||||||
RtlFreeHeap(GetProcessHeap(), 0, lpFiber);
|
RtlFreeHeap(GetProcessHeap(), 0, lpFiber);
|
||||||
|
|
|
@ -171,7 +171,7 @@ CreateRemoteThread(IN HANDLE hProcess,
|
||||||
ULONG Dummy;
|
ULONG Dummy;
|
||||||
PTEB Teb;
|
PTEB Teb;
|
||||||
THREAD_BASIC_INFORMATION ThreadBasicInfo;
|
THREAD_BASIC_INFORMATION ThreadBasicInfo;
|
||||||
PVOID ActivationContextStack = NULL;
|
PACTIVATION_CONTEXT_STACK ActivationContextStack = NULL;
|
||||||
ACTIVATION_CONTEXT_BASIC_INFORMATION ActCtxInfo;
|
ACTIVATION_CONTEXT_BASIC_INFORMATION ActCtxInfo;
|
||||||
ULONG_PTR Cookie;
|
ULONG_PTR Cookie;
|
||||||
ULONG ReturnLength;
|
ULONG ReturnLength;
|
||||||
|
@ -274,6 +274,11 @@ CreateRemoteThread(IN HANDLE hProcess,
|
||||||
ERROR_DBGBREAK("SXS: %s - Failing thread create because "
|
ERROR_DBGBREAK("SXS: %s - Failing thread create because "
|
||||||
"RtlQueryInformationActivationContext() failed with status %08lx\n",
|
"RtlQueryInformationActivationContext() failed with status %08lx\n",
|
||||||
__FUNCTION__, Status);
|
__FUNCTION__, Status);
|
||||||
|
|
||||||
|
/* Free the activation context stack */
|
||||||
|
// RtlFreeThreadActivationContextStack();
|
||||||
|
RtlFreeActivationContextStack(Teb->ActivationContextStackPointer);
|
||||||
|
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -291,6 +296,11 @@ CreateRemoteThread(IN HANDLE hProcess,
|
||||||
ERROR_DBGBREAK("SXS: %s - Failing thread create because "
|
ERROR_DBGBREAK("SXS: %s - Failing thread create because "
|
||||||
"RtlActivateActivationContextEx() failed with status %08lx\n",
|
"RtlActivateActivationContextEx() failed with status %08lx\n",
|
||||||
__FUNCTION__, Status);
|
__FUNCTION__, Status);
|
||||||
|
|
||||||
|
/* Free the activation context stack */
|
||||||
|
// RtlFreeThreadActivationContextStack();
|
||||||
|
RtlFreeActivationContextStack(Teb->ActivationContextStackPointer);
|
||||||
|
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -299,7 +309,6 @@ CreateRemoteThread(IN HANDLE hProcess,
|
||||||
/* Notify CSR */
|
/* Notify CSR */
|
||||||
if (!BaseRunningInServerProcess)
|
if (!BaseRunningInServerProcess)
|
||||||
{
|
{
|
||||||
/* Notify CSR */
|
|
||||||
Status = BasepNotifyCsrOfThread(hThread, &ClientId);
|
Status = BasepNotifyCsrOfThread(hThread, &ClientId);
|
||||||
ASSERT(NT_SUCCESS(Status));
|
ASSERT(NT_SUCCESS(Status));
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue