ntdll: Don't allow blocking on a critical section during process termination.
As a result HeapLock() no longer blocks process termination since underlying implementation uses a critical section. However this should be considered as a minor side effect because applications shouldn't depend on this behaviour. Signed-off-by: Dmitry Timoshkov <dmitry@baikal.ru> Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
parent
0f99327e78
commit
7def0f200f
|
@ -2169,6 +2169,7 @@ static BOOL WINAPI dll_entry_point(HINSTANCE hinst, DWORD reason, LPVOID param)
|
||||||
* doesn't call the DLL entry point on process detach either.
|
* doesn't call the DLL entry point on process detach either.
|
||||||
*/
|
*/
|
||||||
HeapLock(GetProcessHeap());
|
HeapLock(GetProcessHeap());
|
||||||
|
todo_wine
|
||||||
ok(0, "dll_entry_point: process should already deadlock\n");
|
ok(0, "dll_entry_point: process should already deadlock\n");
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -3023,6 +3024,7 @@ static void test_ExitProcess(void)
|
||||||
ret = CreateProcessA(argv[0], cmdline, NULL, NULL, FALSE, 0, NULL, NULL, &si, &pi);
|
ret = CreateProcessA(argv[0], cmdline, NULL, NULL, FALSE, 0, NULL, NULL, &si, &pi);
|
||||||
ok(ret, "CreateProcess(%s) error %d\n", cmdline, GetLastError());
|
ok(ret, "CreateProcess(%s) error %d\n", cmdline, GetLastError());
|
||||||
ret = WaitForSingleObject(pi.hProcess, 5000);
|
ret = WaitForSingleObject(pi.hProcess, 5000);
|
||||||
|
todo_wine
|
||||||
ok(ret == WAIT_TIMEOUT || broken(ret == WAIT_OBJECT_0) /* XP */, "child process should fail to terminate\n");
|
ok(ret == WAIT_TIMEOUT || broken(ret == WAIT_OBJECT_0) /* XP */, "child process should fail to terminate\n");
|
||||||
if (ret != WAIT_OBJECT_0)
|
if (ret != WAIT_OBJECT_0)
|
||||||
{
|
{
|
||||||
|
@ -3032,6 +3034,7 @@ static void test_ExitProcess(void)
|
||||||
ret = WaitForSingleObject(pi.hProcess, 1000);
|
ret = WaitForSingleObject(pi.hProcess, 1000);
|
||||||
ok(ret == WAIT_OBJECT_0, "child process failed to terminate\n");
|
ok(ret == WAIT_OBJECT_0, "child process failed to terminate\n");
|
||||||
GetExitCodeProcess(pi.hProcess, &ret);
|
GetExitCodeProcess(pi.hProcess, &ret);
|
||||||
|
todo_wine
|
||||||
ok(ret == 201 || broken(ret == 1) /* XP */, "expected exit code 201, got %u\n", ret);
|
ok(ret == 201 || broken(ret == 1) /* XP */, "expected exit code 201, got %u\n", ret);
|
||||||
if (*child_failures)
|
if (*child_failures)
|
||||||
{
|
{
|
||||||
|
@ -3047,7 +3050,6 @@ static void test_ExitProcess(void)
|
||||||
ret = CreateProcessA(argv[0], cmdline, NULL, NULL, FALSE, 0, NULL, NULL, &si, &pi);
|
ret = CreateProcessA(argv[0], cmdline, NULL, NULL, FALSE, 0, NULL, NULL, &si, &pi);
|
||||||
ok(ret, "CreateProcess(%s) error %d\n", cmdline, GetLastError());
|
ok(ret, "CreateProcess(%s) error %d\n", cmdline, GetLastError());
|
||||||
ret = WaitForSingleObject(pi.hProcess, 5000);
|
ret = WaitForSingleObject(pi.hProcess, 5000);
|
||||||
todo_wine
|
|
||||||
ok(ret == WAIT_OBJECT_0, "child process failed to terminate\n");
|
ok(ret == WAIT_OBJECT_0, "child process failed to terminate\n");
|
||||||
if (ret != WAIT_OBJECT_0)
|
if (ret != WAIT_OBJECT_0)
|
||||||
{
|
{
|
||||||
|
|
|
@ -436,6 +436,15 @@ NTSTATUS WINAPI RtlDeleteCriticalSection( RTL_CRITICAL_SECTION *crit )
|
||||||
NTSTATUS WINAPI RtlpWaitForCriticalSection( RTL_CRITICAL_SECTION *crit )
|
NTSTATUS WINAPI RtlpWaitForCriticalSection( RTL_CRITICAL_SECTION *crit )
|
||||||
{
|
{
|
||||||
LONGLONG timeout = NtCurrentTeb()->Peb->CriticalSectionTimeout.QuadPart / -10000000;
|
LONGLONG timeout = NtCurrentTeb()->Peb->CriticalSectionTimeout.QuadPart / -10000000;
|
||||||
|
|
||||||
|
/* Don't allow blocking on a critical section during process termination */
|
||||||
|
if (RtlDllShutdownInProgress())
|
||||||
|
{
|
||||||
|
WARN( "process %s is shutting down, returning STATUS_SUCCESS\n",
|
||||||
|
debugstr_w(NtCurrentTeb()->Peb->ProcessParameters->ImagePathName.Buffer) );
|
||||||
|
return STATUS_SUCCESS;
|
||||||
|
}
|
||||||
|
|
||||||
for (;;)
|
for (;;)
|
||||||
{
|
{
|
||||||
EXCEPTION_RECORD rec;
|
EXCEPTION_RECORD rec;
|
||||||
|
|
Loading…
Reference in New Issue