DPRINT1("Converting Fiber to Thread\n");
/* the current thread isn't running a fiber: failure */
- if(!pTeb->HasFiberData)
+ if (!pTeb->HasFiberData)
{
SetLastError(ERROR_INVALID_PARAMETER);
return FALSE;
pTeb->HasFiberData = FALSE;
/* free the fiber */
- if(pTeb->Tib.FiberData != NULL)
+ if(pTeb->NtTib.FiberData != NULL)
{
- RtlFreeHeap(GetProcessHeap(), 0, pTeb->Tib.FiberData);
+ RtlFreeHeap(GetProcessHeap(), 0, pTeb->NtTib.FiberData);
}
/* success */
DPRINT1("Converting Thread to Fiber\n");
/* the current thread is already a fiber */
- if(pTeb->HasFiberData && pTeb->Tib.FiberData) return pTeb->Tib.FiberData;
+ if(pTeb->HasFiberData && pTeb->NtTib.FiberData) return pTeb->NtTib.FiberData;
/* allocate the fiber */
pfCurFiber = (PFIBER)RtlAllocateHeap(GetProcessHeap(),
sizeof(FIBER));
/* failure */
- if(pfCurFiber == NULL)
+ if (pfCurFiber == NULL)
{
SetLastError(ERROR_NOT_ENOUGH_MEMORY);
return NULL;
/* copy some contextual data from the thread to the fiber */
pfCurFiber->Parameter = lpParameter;
- pfCurFiber->ExceptionList = pTeb->Tib.ExceptionList;
- pfCurFiber->StackBase = pTeb->Tib.StackBase;
- pfCurFiber->StackLimit = pTeb->Tib.StackLimit;
+ pfCurFiber->ExceptionList = pTeb->NtTib.ExceptionList;
+ pfCurFiber->StackBase = pTeb->NtTib.StackBase;
+ pfCurFiber->StackLimit = pTeb->NtTib.StackLimit;
pfCurFiber->DeallocationStack = pTeb->DeallocationStack;
pfCurFiber->FlsData = pTeb->FlsData;
pfCurFiber->GuaranteedStackBytes = pTeb->GuaranteedStackBytes;
pfCurFiber->ActivationContextStack = pTeb->ActivationContextStackPointer;
pfCurFiber->Context.ContextFlags = CONTEXT_FULL;
-
+
/* Save FPU State if requsted */
if (dwFlags & FIBER_FLAG_FLOAT_SWITCH)
{
}
/* associate the fiber to the current thread */
- pTeb->Tib.FiberData = pfCurFiber;
+ pTeb->NtTib.FiberData = pfCurFiber;
pTeb->HasFiberData = TRUE;
/* success */
PVOID ActivationContextStack = NULL;
DPRINT1("Creating Fiber\n");
- #ifdef SXS_SUPPORT_ENABLED
+#ifdef SXS_SUPPORT_ENABLED
/* Allocate the Activation Context Stack */
nErrCode = RtlAllocateActivationContextStack(&ActivationContextStack);
- #endif
-
+#endif
+
/* Allocate the fiber */
pfCurFiber = (PFIBER)RtlAllocateHeap(GetProcessHeap(),
0,
sizeof(FIBER));
/* Failure */
- if(pfCurFiber == NULL)
+ if (pfCurFiber == NULL)
{
SetLastError(ERROR_NOT_ENOUGH_MEMORY);
return NULL;
SetLastErrorByStatus(nErrCode);
return NULL;
}
-
+
/* Clear the context */
RtlZeroMemory(&pfCurFiber->Context, sizeof(CONTEXT));
-
+
/* copy the data into the fiber */
pfCurFiber->StackBase = usFiberInitialTeb.StackBase;
pfCurFiber->StackLimit = usFiberInitialTeb.StackLimit;
pfCurFiber->FlsData = NULL;
pfCurFiber->ActivationContextStack = ActivationContextStack;
pfCurFiber->Context.ContextFlags = CONTEXT_FULL;
-
+
/* Save FPU State if requsted */
if (dwFlags & FIBER_FLAG_FLOAT_SWITCH)
{
pfCurFiber->Context.ContextFlags |= CONTEXT_FLOATING_POINT;
}
-
+
/* initialize the context for the fiber */
BasepInitializeContext(&ctxFiberContext,
lpParameter,
lpStartAddress,
usFiberInitialTeb.StackBase,
2);
-
+
/* Return the Fiber */
return pfCurFiber;
}
RtlFreeHeap(GetProcessHeap(), 0, lpFiber);
/* the fiber is deleting itself: let the system deallocate the stack */
- if(NtCurrentTeb()->Tib.FiberData == lpFiber) ExitThread(1);
+ if(NtCurrentTeb()->NtTib.FiberData == lpFiber) ExitThread(1);
/* deallocate the stack */
NtFreeVirtualMemory(NtCurrentProcess(),