Author: hbelusca
Date: Sun Mar 17 22:50:51 2013
New Revision: 58549
URL:
http://svn.reactos.org/svn/reactos?rev=58549&view=rev
Log:
[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.
Modified:
trunk/reactos/dll/win32/kernel32/client/fiber.c
trunk/reactos/dll/win32/kernel32/client/thread.c
Modified: trunk/reactos/dll/win32/kernel32/client/fiber.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/kernel32/client/…
==============================================================================
--- trunk/reactos/dll/win32/kernel32/client/fiber.c [iso-8859-1] (original)
+++ trunk/reactos/dll/win32/kernel32/client/fiber.c [iso-8859-1] Sun Mar 17 22:50:51 2013
@@ -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 @@
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 @@
/* 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 @@
/* 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);
Modified: trunk/reactos/dll/win32/kernel32/client/thread.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/kernel32/client/…
==============================================================================
--- trunk/reactos/dll/win32/kernel32/client/thread.c [iso-8859-1] (original)
+++ trunk/reactos/dll/win32/kernel32/client/thread.c [iso-8859-1] Sun Mar 17 22:50:51
2013
@@ -171,7 +171,7 @@
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 @@
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 @@
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 @@
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 @@
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 @@
/* Notify CSR */
if (!BaseRunningInServerProcess)
{
- /* Notify CSR */
Status = BasepNotifyCsrOfThread(hThread, &ClientId);
ASSERT(NT_SUCCESS(Status));
}