[ros-dev] [ros-diffs] [hbelusca] 58154: [REACTOS] Fix the debugging macros introduced in r58132 (for the _FATAL case): do not use exceptions but instead a breakpoint followed by a process termination procedure (or a bug...

Hermès BÉLUSCA - MAÏTO hermes.belusca at sfr.fr
Sat Jan 12 13:41:46 UTC 2013


I tried to test this with calc, but then you need to explicitly add a
linkage to ntdll (in cmakelists.txt), that I don't want to do.

-----Message d'origine-----
De : ros-dev-bounces at reactos.org [mailto:ros-dev-bounces at reactos.org] De la
part de Timo Kreuzer
Envoyé : vendredi 11 janvier 2013 22:12
À : ros-dev at reactos.org
Objet : Re: [ros-dev] [ros-diffs] [hbelusca] 58154: [REACTOS] Fix the
debugging macros introduced in r58132 (for the _FATAL case): do not use
exceptions but instead a breakpoint followed by a process termination
procedure (or a bug...


Why not use NtTerminateProcess() for non-native apps?

Am 10.01.2013 02:45, schrieb hbelusca at svn.reactos.org:
> +/*
> + * Declare a target-dependent process termination procedure.
> + */
> +#ifndef_NTDDK_              /* User-Mode */
> +    #ifndef NTOS_MODE_USER  /* Should be Win32 */
> +        #ifndef _WIN32
> +            #error "Unsupported target."
> +        #else
> +            #define TerminateCurrentProcess(Status)
TerminateProcess(GetCurrentProcess(), (Status))
> +        #endif
> +    #else   /* Native */
> +        #ifndef _PSFUNCS_H
> +            NTSYSCALLAPI
> +            NTSTATUS
> +            NTAPI
> +            NtTerminateProcess(
> +                IN HANDLE ProcessHandle,
> +                IN NTSTATUS ExitStatus
> +            );
> +        #endif
> +        #ifndef NtCurrentProcess
> +            #define NtCurrentProcess() ((HANDLE)(LONG_PTR)-1)
> +        #endif
> +        #define TerminateCurrentProcess(Status)
NtTerminateProcess(NtCurrentProcess(), (Status))
> +    #endif
> +#else   /* Kernel-Mode */
> +    #include <bugcodes.h>
> +    #define TerminateCurrentProcess(Status) 
> +KeBugCheckEx(CRITICAL_SERVICE_FAILED, (Status), 0, 0, 0) #endif
> +


_______________________________________________
Ros-dev mailing list
Ros-dev at reactos.org
http://www.reactos.org/mailman/listinfo/ros-dev



More information about the Ros-dev mailing list