mirror of
https://github.com/reactos/reactos.git
synced 2025-02-25 01:39:30 +00:00
[KERNEL32]
Bug #43: ConvertFiberToThread should return ERROR_ALREADY_THREAD, not ERROR_INVALID_PARAMETER in case of failure. Bug #44: ConvertFiberToThread should set FiberData to NULL in the TEB, after doing the conversion. Thanks, Winetests, for saying "0 failures", when this API was broken. svn path=/trunk/; revision=52803
This commit is contained in:
parent
e6a3064cd7
commit
01a08c5e47
1 changed files with 13 additions and 10 deletions
|
@ -59,24 +59,27 @@ BOOL
|
||||||
WINAPI
|
WINAPI
|
||||||
ConvertFiberToThread(VOID)
|
ConvertFiberToThread(VOID)
|
||||||
{
|
{
|
||||||
PTEB pTeb = NtCurrentTeb();
|
PTEB Teb;
|
||||||
|
PFIBER FiberData;
|
||||||
DPRINT1("Converting Fiber to Thread\n");
|
DPRINT1("Converting Fiber to Thread\n");
|
||||||
|
|
||||||
/* the current thread isn't running a fiber: failure */
|
/* Check if the thread is already not a fiber */
|
||||||
if (!pTeb->HasFiberData)
|
Teb = NtCurrentTeb();
|
||||||
|
if (!Teb->HasFiberData)
|
||||||
{
|
{
|
||||||
SetLastError(ERROR_INVALID_PARAMETER);
|
/* Fail */
|
||||||
|
SetLastError(ERROR_ALREADY_THREAD);
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* this thread won't run a fiber anymore */
|
/* this thread won't run a fiber anymore */
|
||||||
pTeb->HasFiberData = FALSE;
|
Teb->HasFiberData = FALSE;
|
||||||
|
FiberData = Teb->NtTib.FiberData;
|
||||||
|
Teb->NtTib.FiberData = NULL;
|
||||||
|
|
||||||
/* free the fiber */
|
/* Free the fiber */
|
||||||
if(pTeb->NtTib.FiberData != NULL)
|
ASSERT(FiberData != NULL);
|
||||||
{
|
RtlFreeHeap(GetProcessHeap(), 0, FiberData);
|
||||||
RtlFreeHeap(GetProcessHeap(), 0, pTeb->NtTib.FiberData);
|
|
||||||
}
|
|
||||||
|
|
||||||
/* success */
|
/* success */
|
||||||
return TRUE;
|
return TRUE;
|
||||||
|
|
Loading…
Reference in a new issue