Blame src/ldso/pe_terminate_current_process.c

dd1a85
/*****************************************************************************/
dd1a85
/*  pemagination: a (virtual) tour into portable bits and executable bytes   */
6dda52
/*  Copyright (C) 2013--2020  SysDeer Technologies, LLC                      */
dd1a85
/*  Released under GPLv2 and GPLv3; see COPYING.PEMAGINE.                    */
dd1a85
/*****************************************************************************/
dd1a85
dd1a85
#include <psxtypes/psxtypes.h>
dd1a85
#include <pemagine/pemagine.h>
dd1a85
#include "pe_os.h"
dd1a85
dd1a85
int32_t pe_terminate_current_process(int32_t estatus)
dd1a85
{
dd1a85
	void *				hntdll;
dd1a85
	os_zw_terminate_process *	zw_terminate_process;
dd1a85
dd1a85
	/* init */
dd1a85
	if (!(hntdll = pe_get_ntdll_module_handle()))
dd1a85
		return OS_STATUS_INTERNAL_ERROR;
dd1a85
dd1a85
	if (!(zw_terminate_process = (os_zw_terminate_process *)pe_get_procedure_address(
dd1a85
			hntdll,"ZwTerminateProcess")))
dd1a85
		return OS_STATUS_INTERNAL_ERROR;
dd1a85
dd1a85
	return zw_terminate_process(
dd1a85
		OS_CURRENT_PROCESS_HANDLE,
dd1a85
		estatus);
dd1a85
}