From dd1a85ac7ce0c3e2aa16243c73a9aaae7da384fb Mon Sep 17 00:00:00 2001 From: midipix Date: Sun, 29 Jan 2017 01:48:24 +0000 Subject: ldso: added pe_terminate_current_process(). --- src/ldso/pe_terminate_current_process.c | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) create mode 100644 src/ldso/pe_terminate_current_process.c (limited to 'src/ldso') diff --git a/src/ldso/pe_terminate_current_process.c b/src/ldso/pe_terminate_current_process.c new file mode 100644 index 0000000..ce0294d --- /dev/null +++ b/src/ldso/pe_terminate_current_process.c @@ -0,0 +1,27 @@ +/*****************************************************************************/ +/* pemagination: a (virtual) tour into portable bits and executable bytes */ +/* Copyright (C) 2013--2017 Z. Gilboa */ +/* Released under GPLv2 and GPLv3; see COPYING.PEMAGINE. */ +/*****************************************************************************/ + +#include +#include +#include "pe_os.h" + +int32_t pe_terminate_current_process(int32_t estatus) +{ + void * hntdll; + os_zw_terminate_process * zw_terminate_process; + + /* init */ + if (!(hntdll = pe_get_ntdll_module_handle())) + return OS_STATUS_INTERNAL_ERROR; + + if (!(zw_terminate_process = (os_zw_terminate_process *)pe_get_procedure_address( + hntdll,"ZwTerminateProcess"))) + return OS_STATUS_INTERNAL_ERROR; + + return zw_terminate_process( + OS_CURRENT_PROCESS_HANDLE, + estatus); +} -- cgit v1.2.3