From e757bb6a90c98f53995e4828d68eba26a2327540 Mon Sep 17 00:00:00 2001 From: Amlal El Mahrouss Date: Sun, 1 Sep 2024 09:23:10 +0200 Subject: [ IMP ] Found out the issue of ring 3 switch. Signed-off-by: Amlal El Mahrouss --- dev/SCI/sci_base.hxx | 24 ++++++++------ dev/SCI/scm_core.hxx | 87 -------------------------------------------------- dev/SCI/scm_xpcom.idl | 36 --------------------- dev/SCI/xpcom_core.hxx | 85 ++++++++++++++++++++++++++++++++++++++++++++++++ dev/SCI/xpcom_sms.idl | 34 ++++++++++++++++++++ 5 files changed, 134 insertions(+), 132 deletions(-) delete mode 100644 dev/SCI/scm_core.hxx delete mode 100644 dev/SCI/scm_xpcom.idl create mode 100644 dev/SCI/xpcom_core.hxx create mode 100644 dev/SCI/xpcom_sms.idl (limited to 'dev/SCI') diff --git a/dev/SCI/sci_base.hxx b/dev/SCI/sci_base.hxx index 9a3038dc..e3bc39de 100644 --- a/dev/SCI/sci_base.hxx +++ b/dev/SCI/sci_base.hxx @@ -37,7 +37,7 @@ typedef char Char; #include #ifdef __SCI_IMPL__ -#include +#include #else class IUnknown; // Refrenced from an IDB entry. class UnknownUCLSID; // From the IDB, the constructor of the object, e.g: WordUCLSID. @@ -49,10 +49,10 @@ class UUID; /// @param uclsidOfCls /// @return template -TCLS* ScmQueryInterface(UCLSID uclsidOfCls, Args... args); +TCLS* XPCOMQueryInterface(UCLSID uclsidOfCls, Args... args); template -SInt32 ScmReleaseClass(TCLS** cls); +SInt32 XPCOMReleaseClass(TCLS** cls); /// @brief Release SCM class. /// @tparam TCLS @@ -169,23 +169,23 @@ IMPORT_C UInt32 TlsInstallIB(UInt0); /// @param uclsidOfCls UCLS factory class /// @return TCLS interface template -TCLS* ScmQueryInterface(_Input UCLSID* uclsidOfCls, _Input Args&&... args); +TCLS* XPCOMQueryInterface(_Input UCLSID* uclsidOfCls, _Input Args&&... args); /// @brief Release SCM object. /// @tparam TCLS the class type. /// @param cls the class to release. /// @return status code. template -SInt32 ScmReleaseClass(_Input TCLS* cls); +SInt32 XPCOMReleaseClass(_Input TCLS* cls); /// @brief Creates an SCM instance in the process. /// @param handle_instance the SCM handle. /// @param flags the SCM flags. -IMPORT_C SInt32 ScmCreateInstance(_Input UInt32 flags, _Output ZKAObject* handle_instance); +IMPORT_C SInt32 XPCOMCreateInstance(_Input UInt32 flags, _Output ZKAObject* handle_instance); /// @brief Destroys an SCM instance of the process. /// @param handle_instance the SCM handle. -IMPORT_C UInt0 ScmDestroyInstance(_Input ZKAObject handle_instance); +IMPORT_C UInt0 XPCOMDestroyInstance(_Input ZKAObject handle_instance); // ------------------------------------------------------------------------ // Memory Management API. @@ -195,12 +195,18 @@ IMPORT_C UInt0 ScmDestroyInstance(_Input ZKAObject handle_instance); /// @param len the length of it. /// @param flags the flags of it. /// @return heap pointer. -IMPORT_C VoidPtr RtlCreateHeap(_Input SizeT len, _Input UInt32 flags); +IMPORT_C VoidPtr MmCreateHeap(_Input SizeT len, _Input UInt32 flags); /// @brief Destroys the pointer /// @param heap the heap itself. /// @return void. -IMPORT_C UInt0 RtlDestroyHeap(_Input VoidPtr heap); +IMPORT_C UInt0 MmDestroyHeap(_Input VoidPtr heap); + +/// @brief Change protection flags of memory region. +IMPORT_C UInt32 MmChangeHeapFlags(_Input VoidPtr heap, _Input UInt32 flags); + +/// @brief Fill memory region with CRC32. +IMPORT_C UInt32 MmFillCRC32Heap(_Input VoidPtr heap); // ------------------------------------------------------------------------ // Error handling API. diff --git a/dev/SCI/scm_core.hxx b/dev/SCI/scm_core.hxx deleted file mode 100644 index db3b9c69..00000000 --- a/dev/SCI/scm_core.hxx +++ /dev/null @@ -1,87 +0,0 @@ -/* ------------------------------------------- - -Copyright ZKA Technologies. - -File: rt.internal.inl -Purpose: Base code of SCM. - -------------------------------------------- */ - -/// @internal - -#ifndef __NDK__ -#define object class -#define protocol class -#define clsid(X) - -#warning ! You may be using the clang version of the ZKA kit, please be cautious that some thing mayn't be present. ! -#endif // !__NDK__ - -// Interfaces are divided between classes. -// So that they aren't too big. - -protocol IUnknown; // Refrenced from an IDB entry. -protocol UnknownUCLSID; // From the IDB, the constructor of the object, e.g: TextUCLSID. -object UUID; - -protocol clsid("d7c144b6-0792-44b8-b06b-02b227b547df") IUnknown -{ -public: - explicit IUnknown() = default; - virtual ~IUnknown() = default; - - IUnknown& operator=(const IUnknown&) = default; - IUnknown(const IUnknown&) = default; - - virtual SInt32 Release() = 0; - virtual void RemoveRef() = 0; - virtual IUnknown* AddRef() = 0; - virtual VoidPtr QueryInterface(UUID* p_uuid) = 0; -}; - -/// @brief Allocate new SCM object. -/// @tparam TCLS the class type. -/// @tparam UCLSID UCLS factory class type. -/// @param uclsidOfCls UCLS factory class -/// @return TCLS interface -template -inline TCLS* ScmQueryInterface(UCLSID* uclsidOfCls, Args&&... args) -{ - uclsidOfCls->AddRef(); - return uclsidOfCls->QueryInterfaceWithArgs(args...); -} - -/// @brief Release SCM object. -/// @tparam TCLS the class type. -/// @param cls the class to release. -/// @return status code. -template -inline SInt32 ScmReleaseClass(TCLS** cls) -{ - if (!cls) - return -1; - - cls->RemoveRef(); - cls->Release(); - - cls = nullptr; - - return 0; -} - -template -protocol IEventListener : public ClsID -{ -public: - explicit IEventListener() = default; - virtual ~IEventListener() = default; - - IEventListener& operator=(const IEventListener&) = default; - IEventListener(const IEventListener&) = default; - - virtual IEventListener& operator +=(FnSign arg) - { - this->AddEventListener(arg); - return *this; - } -}; diff --git a/dev/SCI/scm_xpcom.idl b/dev/SCI/scm_xpcom.idl deleted file mode 100644 index 1fdbd6c9..00000000 --- a/dev/SCI/scm_xpcom.idl +++ /dev/null @@ -1,36 +0,0 @@ -/* ------------------------------------------- - -Copyright ZKA Technologies. - -File: rt.internal.inl -Purpose: Base code of SCM. - -------------------------------------------- */ - -/// @internal - -#ifndef __NDK__ -#define object class -#define protocol class -#define interface private -#define interface_method -#define CONST const -#define CHAR char -#define INT32 __INT32_TYPE__ -#define SIZE_T __SIZE_TYPE__ -#define _Output -#define _Input -#define clsid(X) - -#warning ! You may be using the clang version of the ZKA kit, please be cautious that some thing mayn't be present. ! -#endif // !__NDK__ - -protocol IPXCOMSocket; - -clsid("0943A614-0201-4107-8F8D-E909DF7F53C9") -protocol IPXCOMSocket -{ -interface: - interface_method INT32 SendMessage(_Input CONST CHAR* bytes, _Input SIZE_T bytes_size); - interface_method INT32 RecvMessage(_Output CONST CHAR** bytes_in, _Input SIZE_T bytes_size); -}; diff --git a/dev/SCI/xpcom_core.hxx b/dev/SCI/xpcom_core.hxx new file mode 100644 index 00000000..f48fd30b --- /dev/null +++ b/dev/SCI/xpcom_core.hxx @@ -0,0 +1,85 @@ +/* ------------------------------------------- + +Copyright ZKA Technologies. + +File: rt.internal.inl +Purpose: Base code of SCM. + +------------------------------------------- */ + +/// @internal + +#ifndef __NDK__ +#define object class +#define protocol class +#define clsid(X) + +#warning ! You may be using the clang version of the ZKA kit, please be cautious that some thing mayn't be present. ! +#endif // !__NDK__ + +protocol IUnknown; // Refrenced from an IDB entry. +protocol UnknownUCLSID; // From the IDB, the constructor of the object, e.g: TextUCLSID. +object UUID; + +/// @brief Unknown XPCOM interface +protocol clsid("d7c144b6-0792-44b8-b06b-02b227b547df") IUnknown +{ +public: + explicit IUnknown() = default; + virtual ~IUnknown() = default; + + IUnknown& operator=(const IUnknown&) = default; + IUnknown(const IUnknown&) = default; + + virtual SInt32 Release() = 0; + virtual void RemoveRef() = 0; + virtual IUnknown* AddRef() = 0; + virtual VoidPtr QueryInterface(UUID* p_uuid) = 0; +}; + +/// @brief Allocate new SCM object. +/// @tparam TCLS the class type. +/// @tparam UCLSID UCLS factory class type. +/// @param uclsidOfCls UCLS factory class +/// @return TCLS interface +template +inline TCLS* XPCOMQueryInterface(UCLSID* uclsidOfCls, Args&&... args) +{ + uclsidOfCls->AddRef(); + return uclsidOfCls->QueryInterfaceWithArgs(args...); +} + +/// @brief Release SCM object. +/// @tparam TCLS the class type. +/// @param cls the class to release. +/// @return status code. +template +inline SInt32 XPCOMReleaseClass(TCLS** cls) +{ + if (!cls) + return -1; + + cls->RemoveRef(); + cls->Release(); + + cls = nullptr; + + return 0; +} + +template +protocol IEventListener : public ClsID +{ +public: + explicit IEventListener() = default; + virtual ~IEventListener() = default; + + IEventListener& operator=(const IEventListener&) = default; + IEventListener(const IEventListener&) = default; + + virtual IEventListener& operator +=(FnSign arg) + { + this->AddEventListener(arg); + return *this; + } +}; diff --git a/dev/SCI/xpcom_sms.idl b/dev/SCI/xpcom_sms.idl new file mode 100644 index 00000000..8c95616b --- /dev/null +++ b/dev/SCI/xpcom_sms.idl @@ -0,0 +1,34 @@ +/* ------------------------------------------- + +Copyright ZKA Technologies. + +File: rt.internal.inl +Purpose: Base code of SCM. + +------------------------------------------- */ + +/// @internal + +#ifndef __NDK__ +#define object class +#define protocol class +#define interface private +#define interface_method +#define CONST const +#define CHAR char +#define INT32 __INT32_TYPE__ +#define SIZE_T __SIZE_TYPE__ +#define _Output +#define _Input +#define clsid(X) + +#warning ! You may be using the clang version of the ZKA kit, please be cautious that some thing mayn't be present. ! +#endif // !__NDK__ + +clsid("0943A614-0201-4107-8F8D-E909DF7F53C9") +protocol ISMS +{ +interface: + interface_method INT32 SendMessage(_Input CONST CHAR* bytes, _Input SIZE_T bytes_size); + interface_method INT32 RecvMessage(_Output CONST CHAR** bytes_in, _Input SIZE_T bytes_size); +}; -- cgit v1.2.3