From 3799d55d9b629d4733815d73a350e2ee868b98e9 Mon Sep 17 00:00:00 2001 From: Alexandre Julliard Date: Fri, 19 Jul 2013 12:15:15 +0200 Subject: [PATCH] ntdll: Implement RtlExitUserProcess. --- dlls/kernel32/process.c | 20 ++------------------ dlls/ntdll/loader.c | 14 ++++++++++++++ dlls/ntdll/ntdll.spec | 1 + include/winternl.h | 1 + 4 files changed, 18 insertions(+), 18 deletions(-) diff --git a/dlls/kernel32/process.c b/dlls/kernel32/process.c index 6d2f80d9182..6ce43d8f8f9 100644 --- a/dlls/kernel32/process.c +++ b/dlls/kernel32/process.c @@ -2624,30 +2624,14 @@ __ASM_STDCALL_FUNC( ExitProcess, 4, /* Shrinker depend on this particular ExitPr ".byte 0x6A, 0x00\n\t" /* pushl $0 */ ".byte 0x68, 0x00, 0x00, 0x00, 0x00\n\t" /* pushl $0 - 4 bytes immediate */ "pushl 8(%ebp)\n\t" - "call " __ASM_NAME("process_ExitProcess") __ASM_STDCALL(4) "\n\t" + "call " __ASM_NAME("RtlExitUserProcess") __ASM_STDCALL(4) "\n\t" "leave\n\t" "ret $4" ) - -void WINAPI process_ExitProcess( DWORD status ) -{ - ULONG magic; - LdrLockLoaderLock( 0, 0, &magic ); - RtlAcquirePebLock(); - NtTerminateProcess(0, status); - LdrShutdownProcess(); - NtTerminateProcess(GetCurrentProcess(), status); - exit(status); -} - #else void WINAPI ExitProcess( DWORD status ) { - RtlAcquirePebLock(); - NtTerminateProcess(0, status); - LdrShutdownProcess(); - NtTerminateProcess(GetCurrentProcess(), status); - exit(status); + RtlExitUserProcess( status ); } #endif diff --git a/dlls/ntdll/loader.c b/dlls/ntdll/loader.c index c4d7487c9b0..b3abad03a4d 100644 --- a/dlls/ntdll/loader.c +++ b/dlls/ntdll/loader.c @@ -2392,6 +2392,20 @@ void WINAPI LdrShutdownProcess(void) process_detach(); } + +/****************************************************************** + * RtlExitUserProcess (NTDLL.@) + */ +void WINAPI RtlExitUserProcess( DWORD status ) +{ + RtlEnterCriticalSection( &loader_section ); + RtlAcquirePebLock(); + NtTerminateProcess( 0, status ); + LdrShutdownProcess(); + NtTerminateProcess( GetCurrentProcess(), status ); + exit( status ); +} + /****************************************************************** * LdrShutdownThread (NTDLL.@) * diff --git a/dlls/ntdll/ntdll.spec b/dlls/ntdll/ntdll.spec index 3d4fa2ead31..0d4d62debf8 100644 --- a/dlls/ntdll/ntdll.spec +++ b/dlls/ntdll/ntdll.spec @@ -568,6 +568,7 @@ @ stdcall RtlEqualString(ptr ptr long) @ stdcall RtlEqualUnicodeString(ptr ptr long) @ stdcall RtlEraseUnicodeString(ptr) +@ stdcall RtlExitUserProcess(long) @ stdcall RtlExitUserThread(long) @ stdcall RtlExpandEnvironmentStrings_U(ptr ptr ptr ptr) @ stub RtlExtendHeap diff --git a/include/winternl.h b/include/winternl.h index b45a56cccc4..955228aacf6 100644 --- a/include/winternl.h +++ b/include/winternl.h @@ -2347,6 +2347,7 @@ NTSYSAPI BOOL WINAPI RtlEqualPrefixSid(PSID,PSID); NTSYSAPI BOOL WINAPI RtlEqualSid(PSID,PSID); NTSYSAPI BOOLEAN WINAPI RtlEqualString(const STRING*,const STRING*,BOOLEAN); NTSYSAPI BOOLEAN WINAPI RtlEqualUnicodeString(const UNICODE_STRING*,const UNICODE_STRING*,BOOLEAN); +NTSYSAPI void DECLSPEC_NORETURN WINAPI RtlExitUserProcess(ULONG); NTSYSAPI void DECLSPEC_NORETURN WINAPI RtlExitUserThread(ULONG); NTSYSAPI NTSTATUS WINAPI RtlExpandEnvironmentStrings_U(PCWSTR, const UNICODE_STRING*, UNICODE_STRING*, ULONG*); NTSYSAPI NTSTATUS WINAPI RtlFindActivationContextSectionString(ULONG,const GUID*,ULONG,const UNICODE_STRING*,PVOID); -- 2.11.4.GIT