From fb790b07aeba8e22e4190cf3e1834d11ecde6c96 Mon Sep 17 00:00:00 2001 From: Amlal Date: Fri, 25 Apr 2025 13:08:33 +0200 Subject: dev: better .clang-format, ran format command. Signed-off-by: Amlal --- dev/kernel/src/IPEFDylibObject.cc | 93 ++++++++++++++++++--------------------- 1 file changed, 43 insertions(+), 50 deletions(-) (limited to 'dev/kernel/src/IPEFDylibObject.cc') diff --git a/dev/kernel/src/IPEFDylibObject.cc b/dev/kernel/src/IPEFDylibObject.cc index 9b0b1ab8..f064dbac 100644 --- a/dev/kernel/src/IPEFDylibObject.cc +++ b/dev/kernel/src/IPEFDylibObject.cc @@ -1,15 +1,15 @@ /* * ======================================================== * -* NeKernel + * NeKernel * Copyright (C) 2024-2025, Amlal El Mahrouss, all rights reserved. * * ======================================================== */ #include -#include #include +#include #include #include #include @@ -18,15 +18,15 @@ Revision History: - 01/02/24: Reworked dll ABI, expect a rtl_init_dylib_pef and - rtl_fini_dylib_pef (amlel) - - 15/02/24: Breaking changes, changed the name of the + 01/02/24: Reworked dll ABI, expect a rtl_init_dylib_pef and + rtl_fini_dylib_pef (amlel) + + 15/02/24: Breaking changes, changed the name of the routines. (amlel) - 07/28/24: Replace rt_library_free with rtl_fini_dylib_pef + 07/28/24: Replace rt_library_free with rtl_fini_dylib_pef - 10/8/24: FIX: Fix log comment. + 10/8/24: FIX: Fix log comment. ------------------------------------------- */ @@ -41,47 +41,42 @@ using namespace Kernel; /** @brief Library initializer. */ /***********************************************************************************/ -EXTERN_C IDylibRef rtl_init_dylib_pef(USER_PROCESS& process) -{ - IDylibRef dll_obj = tls_new_class(); +EXTERN_C IDylibRef rtl_init_dylib_pef(USER_PROCESS& process) { + IDylibRef dll_obj = tls_new_class(); - if (!dll_obj) - { - process.Crash(); - return nullptr; - } + if (!dll_obj) { + process.Crash(); + return nullptr; + } - dll_obj->Mount(new IPEFDylibObject::DLL_TRAITS()); + dll_obj->Mount(new IPEFDylibObject::DLL_TRAITS()); - if (!dll_obj->Get()) - { - tls_delete_class(dll_obj); - dll_obj = nullptr; + if (!dll_obj->Get()) { + tls_delete_class(dll_obj); + dll_obj = nullptr; - process.Crash(); + process.Crash(); - return nullptr; - } + return nullptr; + } - dll_obj->Get()->ImageObject = - process.Image.fBlob; + dll_obj->Get()->ImageObject = process.Image.fBlob; - if (!dll_obj->Get()->ImageObject) - { - delete dll_obj->Get(); + if (!dll_obj->Get()->ImageObject) { + delete dll_obj->Get(); - tls_delete_class(dll_obj); - dll_obj = nullptr; + tls_delete_class(dll_obj); + dll_obj = nullptr; - process.Crash(); + process.Crash(); - return nullptr; - } + return nullptr; + } - dll_obj->Get()->ImageEntrypointOffset = - dll_obj->Load(kPefStart, rt_string_len(kPefStart, 0), kPefCode); + dll_obj->Get()->ImageEntrypointOffset = + dll_obj->Load(kPefStart, rt_string_len(kPefStart, 0), kPefCode); - return dll_obj; + return dll_obj; } /***********************************************************************************/ @@ -91,21 +86,19 @@ EXTERN_C IDylibRef rtl_init_dylib_pef(USER_PROCESS& process) /** @param successful Reports if successful or not. */ /***********************************************************************************/ -EXTERN_C Void rtl_fini_dylib_pef(USER_PROCESS& process, IDylibRef dll_obj, BOOL* successful) -{ - MUST_PASS(successful); +EXTERN_C Void rtl_fini_dylib_pef(USER_PROCESS& process, IDylibRef dll_obj, BOOL* successful) { + MUST_PASS(successful); - // sanity check (will also trigger a bug check if this fails) - if (dll_obj == nullptr) - { - *successful = false; - process.Crash(); - } + // sanity check (will also trigger a bug check if this fails) + if (dll_obj == nullptr) { + *successful = false; + process.Crash(); + } - delete dll_obj->Get(); - delete dll_obj; + delete dll_obj->Get(); + delete dll_obj; - dll_obj = nullptr; + dll_obj = nullptr; - *successful = true; + *successful = true; } -- cgit v1.2.3