From b95b1fc42d371b08aa82fea8e92aa04b2ef5631f Mon Sep 17 00:00:00 2001 From: Amlal El Mahrouss Date: Wed, 21 Aug 2024 23:07:43 +0200 Subject: Kernel+DLL: See below. + Document LPC functions and reworked err_bug_check function to return false when everything is OK. + Added native APIs to SCI as well (threading, loader...) + Update ReadMe(s) of the other DLLs. Signed-off-by: Amlal El Mahrouss --- dev/SCI/Hint.h | 23 ++++++++++++++++++++ dev/SCI/Hint.hxx | 23 -------------------- dev/SCI/ReadMe.md | 4 ++-- dev/SCI/SCIBase.hxx | 60 +++++++++++++++++++++++++++++++++++++---------------- 4 files changed, 67 insertions(+), 43 deletions(-) create mode 100644 dev/SCI/Hint.h delete mode 100644 dev/SCI/Hint.hxx (limited to 'dev/SCI') diff --git a/dev/SCI/Hint.h b/dev/SCI/Hint.h new file mode 100644 index 00000000..c785f953 --- /dev/null +++ b/dev/SCI/Hint.h @@ -0,0 +1,23 @@ +/* ------------------------------------------- + + Copyright ZKA Technologies. + +------------------------------------------- */ + +#ifndef __SCI_HINT_HXX__ +#define __SCI_HINT_HXX__ + +#pragma compiler(hint_manifest) + +#define _Input +#define _Output + +#define _Optional + +#define _StrictCheckInput +#define _StrictCheckOutput + +#define _InOut +#define _StrictInOut + +#endif // ifndef __SCI_HINT_HXX__ diff --git a/dev/SCI/Hint.hxx b/dev/SCI/Hint.hxx deleted file mode 100644 index c785f953..00000000 --- a/dev/SCI/Hint.hxx +++ /dev/null @@ -1,23 +0,0 @@ -/* ------------------------------------------- - - Copyright ZKA Technologies. - -------------------------------------------- */ - -#ifndef __SCI_HINT_HXX__ -#define __SCI_HINT_HXX__ - -#pragma compiler(hint_manifest) - -#define _Input -#define _Output - -#define _Optional - -#define _StrictCheckInput -#define _StrictCheckOutput - -#define _InOut -#define _StrictInOut - -#endif // ifndef __SCI_HINT_HXX__ diff --git a/dev/SCI/ReadMe.md b/dev/SCI/ReadMe.md index 72732c21..00d90c14 100644 --- a/dev/SCI/ReadMe.md +++ b/dev/SCI/ReadMe.md @@ -1,5 +1,5 @@ -# ZKA System Call Interface. +# ZKA's SCI. -System Call Interface and Component Interface. +System Call and Component Interface, used maninly to communicate with kernel and registered objects. ###### (c) ZKA Technologies, all rights reserved. diff --git a/dev/SCI/SCIBase.hxx b/dev/SCI/SCIBase.hxx index 1e79bbbc..982ca950 100644 --- a/dev/SCI/SCIBase.hxx +++ b/dev/SCI/SCIBase.hxx @@ -10,9 +10,7 @@ Purpose: SCI/M core header file (C++) #ifndef __SCI_BASE_HXX__ #define __SCI_BASE_HXX__ -#ifdef __cplusplus - -#include +#include #define IMPORT_CXX extern "C++" #define IMPORT_C extern "C" @@ -96,32 +94,34 @@ typedef VoidPtr NEW_OBJECT; typedef NEW_OBJECT DLL_OBJECT; typedef NEW_OBJECT IO_OBJECT; typedef NEW_OBJECT COMP_OBJECT; +typedef NEW_OBJECT SCM_OBJECT; // ------------------------------------------------------------------------------------------ // // ------------------------------------------------------------------------------------------ // -/// @note Part of NK loader API. +/// @note Part of ZKA loader API. // ------------------------------------------------------------------------------------------ // - /// @brief Get function which is part of the DLL. /// @param symbol the symbol to look for /// @param dll_handle the DLL handle. /// @return the proc pointer. -IMPORT_C VoidPtr RtlGetDLLProc(_Input const Char* symbol, _Input NEW_OBJECT dll_handle); +IMPORT_C NEW_OBJECT LdrGetDLLProc(_Input const Char* symbol, _Input NEW_OBJECT dll_handle); /// @brief Open DLL handle. /// @param path /// @param drv /// @return -IMPORT_C NEW_OBJECT RtlOpenDLL(_Input const Char* path, _Input const Char* drive_letter); +IMPORT_C NEW_OBJECT LdrOpenDLL(_Input const Char* path, _Input const Char* drive_letter); /// @brief Close DLL handle /// @param dll_handle /// @return -IMPORT_C UInt0 RtlCloseDLL(_Input NEW_OBJECT dll_handle); +IMPORT_C UInt0 LdrCloseDLL(_Input NEW_OBJECT dll_handle); -/// @note Part of NK file API. +// ------------------------------------------------------------------------------------------ // +// File API. +// ------------------------------------------------------------------------------------------ // /// @brief Opens a file from a drive. /// @param fs_path the filesystem path. @@ -134,10 +134,18 @@ IMPORT_C NEW_OBJECT RtlOpenFile(const Char* fs_path, const Char* drive_letter); /// @return IMPORT_C UInt0 RtlCloseFile(_Input NEW_OBJECT file_desc); +// ------------------------------------------------------------------------ +// TLS API. +// ------------------------------------------------------------------------ + /// @brief Installs the TIB and GIB inside the current process. -/// @param none +/// @param void. /// @return > 0 error ocurred or already present, = 0 success. -IMPORT_C UInt32 RtlInstallInfoBlocks(UInt0); +IMPORT_C UInt32 TlsInstallIB(UInt0); + +// ------------------------------------------------------------------------ +// SCM API. +// ------------------------------------------------------------------------ /// @brief Allocate new SCM object. /// @tparam TCLS the class type. @@ -157,27 +165,43 @@ SInt32 ScmReleaseClass(_Input TCLS* cls); /// @brief Creates an SCM instance in the process. /// @param handle_instance the SCM handle. /// @param flags the SCM flags. -SInt32 ScmCreateInstance(_Input UInt32 flags, _Output VoidPtr* handle_instance); +IMPORT_C SInt32 ScmCreateInstance(_Input UInt32 flags, _Output SCM_OBJECT* handle_instance); /// @brief Destroys an SCM instance of the process. /// @param handle_instance the SCM handle. -UInt0 ScmDestroyInstance(_Input VoidPtr handle_instance); +IMPORT_C UInt0 ScmDestroyInstance(_Input SCM_OBJECT handle_instance); + +// ------------------------------------------------------------------------ +// Memory Management API. +// ------------------------------------------------------------------------ /// @brief Creates a new heap from the process's address space. /// @param len the length of it. /// @param flags the flags of it. /// @return heap pointer. -VoidPtr RtlCreateHeap(_Input SizeT len, _Input UInt32 flags); +IMPORT_C VoidPtr RtlCreateHeap(_Input SizeT len, _Input UInt32 flags); /// @brief Destroys the pointer /// @param heap the heap itself. /// @return void. -UInt0 RtlDestroyHeap(_Input VoidPtr heap); +IMPORT_C UInt0 RtlDestroyHeap(_Input VoidPtr heap); -#else +// ------------------------------------------------------------------------ +// Error handling API. +// ------------------------------------------------------------------------ + +IMPORT_C SInt32 ErrGetLastError(UInt0); + +// ------------------------------------------------------------------------ +// Threading API. +// ------------------------------------------------------------------------ + +IMPORT_C UInt0 ThrExitCurrentThread(SInt32 exit_code); +IMPORT_C UInt0 ThrExitMainThread(SInt32 exit_code); -#include +IMPORT_C UInt0 ThrExitYieldThread(UInt0); -#endif // ifdef __cplusplus +IMPORT_C UInt0 ThrExitJoinThread(UInt0); +IMPORT_C UInt0 ThrExitDetachThread(UInt0); #endif // ifndef __SCI_BASE_HXX__ -- cgit v1.2.3