Index: dll/win32/kernel32/client/thread.c =================================================================== --- dll/win32/kernel32/client/thread.c (révision 58549) +++ dll/win32/kernel32/client/thread.c (copie de travail) @@ -241,7 +241,7 @@ ERROR_DBGBREAK("SXS: %s - Failing thread create because " "NtQueryInformationThread() failed with status %08lx\n", __FUNCTION__, Status); - return NULL; + goto Quit; } /* Allocate the Activation Context Stack */ @@ -252,7 +252,7 @@ ERROR_DBGBREAK("SXS: %s - Failing thread create because " "RtlAllocateActivationContextStack() failed with status %08lx\n", __FUNCTION__, Status); - return NULL; + goto Quit; } /* Save it */ @@ -279,7 +279,7 @@ // RtlFreeThreadActivationContextStack(); RtlFreeActivationContextStack(Teb->ActivationContextStackPointer); - return NULL; + goto Quit; } /* Does it need to be activated? */ @@ -301,7 +301,7 @@ // RtlFreeThreadActivationContextStack(); RtlFreeActivationContextStack(Teb->ActivationContextStackPointer); - return NULL; + goto Quit; } } } @@ -310,7 +310,6 @@ if (!BaseRunningInServerProcess) { Status = BasepNotifyCsrOfThread(hThread, &ClientId); - ASSERT(NT_SUCCESS(Status)); } else { @@ -326,19 +325,39 @@ { /* Call it instead of going through LPC */ Status = CsrCreateRemoteThread(hThread, &ClientId); - ASSERT(NT_SUCCESS(Status)); } } } - /* Success */ - if (lpThreadId) *lpThreadId = HandleToUlong(ClientId.UniqueThread); +Quit: + if (NT_SUCCESS(Status)) + { + /* Success */ + if (lpThreadId) *lpThreadId = HandleToUlong(ClientId.UniqueThread); - /* Resume it if asked */ - if (!(dwCreationFlags & CREATE_SUSPENDED)) NtResumeThread(hThread, &Dummy); + /* Resume it if asked */ + if (!(dwCreationFlags & CREATE_SUSPENDED)) NtResumeThread(hThread, &Dummy); - /* Return handle to thread */ - return hThread; + /* Return handle to thread */ + return hThread; + } + else + { + /* Fail */ + Status = STATUS_NO_MEMORY; + + BaseFreeThreadStack(hProcess, &InitialTeb); + + // /* Free the activation context stack */ + // // RtlFreeThreadActivationContextStack(); + // RtlFreeActivationContextStack(Teb->ActivationContextStackPointer); + + NtTerminateThread(hThread, Status); + NtClose(hThread); + + BaseSetLastNTError(Status); + return NULL; + } } /*