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->Tib.FiberData != NULL)
{
RtlFreeHeap(GetProcessHeap(), 0, pTeb->Tib.FiberData);
}
sizeof(FIBER));
/* failure */
- if(pfCurFiber == NULL)
+ if (pfCurFiber == NULL)
{
SetLastError(ERROR_NOT_ENOUGH_MEMORY);
return NULL;
pfCurFiber->GuaranteedStackBytes = pTeb->GuaranteedStackBytes;
pfCurFiber->ActivationContextStack = pTeb->ActivationContextStackPointer;
pfCurFiber->Context.ContextFlags = CONTEXT_FULL;
-
+
/* Save FPU State if requsted */
if (dwFlags & FIBER_FLAG_FLOAT_SWITCH)
{
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;
}