summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-rw-r--r--SCIKit/ErrorTypes.hxx49
-rw-r--r--SCIKit/SCIBase.hxx (renamed from SCIKit/SCI.hxx)80
-rw-r--r--SCIKit/SCIErr.cxx (renamed from SCIKit/ErrorTypes.cxx)4
-rw-r--r--SCIKit/SCIErr.hxx49
-rw-r--r--SCIKit/SCIObjRt.cxx8
-rw-r--r--SCIKit/rtl.internal.inl30
6 files changed, 136 insertions, 84 deletions
diff --git a/SCIKit/ErrorTypes.hxx b/SCIKit/ErrorTypes.hxx
deleted file mode 100644
index 35af4d64..00000000
--- a/SCIKit/ErrorTypes.hxx
+++ /dev/null
@@ -1,49 +0,0 @@
-/* -------------------------------------------
-
- Copyright ZKA Technologies
-
-------------------------------------------- */
-
-#pragma once
-
-#include <SCIKit/SCI.hxx>
-
-#define ErrLocalIsOk() (kLastError == kErrorSuccess)
-#define ErrLocalFailed() (kLastError != kErrorSuccess)
-#define ErrLocal() (kLastError)
-
-typedef SInt32 HError;
-
-inline constexpr HError kErrorSuccess = 0;
-inline constexpr HError kErrorExecutable = 33;
-inline constexpr HError kErrorExecutableLib = 34;
-inline constexpr HError kErrorFileNotFound = 35;
-inline constexpr HError kErrorDirectoryNotFound = 36;
-inline constexpr HError kErrorDiskReadOnly = 37;
-inline constexpr HError kErrorDiskIsFull = 38;
-inline constexpr HError kErrorProcessFault = 39;
-inline constexpr HError kErrorSocketHangUp = 40;
-inline constexpr HError kErrorThreadLocalStorage = 41;
-inline constexpr HError kErrorMath = 42;
-inline constexpr HError kErrorNoNetwork = 43;
-inline constexpr HError kErrorHeapOutOfMemory = 44;
-inline constexpr HError kErrorNoSuchDisk = 45;
-inline constexpr HError kErrorFileExists = 46;
-inline constexpr HError kErrorFormatFailed = 47;
-inline constexpr HError kErrorNetworkTimeout = 48;
-inline constexpr HError kErrorInternal = 49;
-inline constexpr HError kErrorForkAlreadyExists = 50;
-inline constexpr HError kErrorOutOfTeamSlot = 51;
-inline constexpr HError kErrorHeapNotPresent = 52;
-inline constexpr HError kErrorNoEntrypoint = 53;
-inline constexpr HError kErrorDiskIsCorrupted = 54;
-inline constexpr HError kErrorDisk = 55;
-inline constexpr HError kErrorInvalidData = 56;
-inline constexpr HError kErrorAsync = 57;
-inline constexpr HError kErrorNonBlocking = 58;
-inline constexpr HError kErrorIPC = 59;
-inline constexpr HError kErrorSign = 60;
-inline constexpr HError kErrorInvalidCreds = 61;
-inline constexpr HError kErrorUnimplemented = 0;
-
-IMPORT_C HError kLastError;
diff --git a/SCIKit/SCI.hxx b/SCIKit/SCIBase.hxx
index 5f819ba1..6e389390 100644
--- a/SCIKit/SCI.hxx
+++ b/SCIKit/SCIBase.hxx
@@ -31,33 +31,32 @@ typedef void* VoidPtr;
typedef __UINTPTR_TYPE__ UIntPtr;
typedef char Char;
-typedef Char UTFChar;
-
-// Interfaces are divided between classes.
-// So that they aren't too big.
-
-class UnknownInterface; // Refrenced from an IDB entry.
-class UnknownUCLSID; // From the IDB, the constructor of the object, e.g: WordUCLSID.
-
-class __attribute__((uuid("d7c144b6-0792-44b8-b06b-02b227b547df"))) UnknownInterface
-{
-public:
- explicit UnknownInterface() = default;
- virtual ~UnknownInterface() = default;
-
- UnknownInterface& operator=(const UnknownInterface&) = default;
- UnknownInterface(const UnknownInterface&) = default;
-
- SInt32 Release()
- {
- delete this;
- return 0;
- }
-};
+inline constexpr auto cSerialAlertSyscall = 0x10;
+inline constexpr auto cTlsSyscall = 0x11;
+inline constexpr auto cTlsInstallSyscall = 0x12;
+inline constexpr auto cNewSyscall = 0x13;
+inline constexpr auto cDeleteSyscall = 0x14;
+inline constexpr auto cExitSyscall = 0x15;
+inline constexpr auto cLastExitSyscall = 0x16;
+inline constexpr auto cCatalogOpenSyscall = 0x17;
+inline constexpr auto cForkReadSyscall = 0x18;
+inline constexpr auto cForkWriteSyscall = 0x19;
+inline constexpr auto cCatalogCloseSyscall = 0x20;
+inline constexpr auto cCatalogRemoveSyscall = 0x21;
+inline constexpr auto cCatalogCreateSyscall = 0x22;
+inline constexpr auto cRebootSyscallSyscall = 0x23;
+inline constexpr auto cShutdownSyscall = 0x24;
+inline constexpr auto cLPCSendMsgSyscall = 0x25;
+inline constexpr auto cLPCOpenMsgSyscall = 0x26;
+inline constexpr auto cLPCCloseMsgSyscall = 0x27;
+inline constexpr auto cLPCSanitizeMsgSyscall = 0x28;
#ifdef __NEWOS_SYMS__
#include <SCIKit/rtl.internal.inl>
#else
+class UnknownInterface; // Refrenced from an IDB entry.
+class UnknownUCLSID; // From the IDB, the constructor of the object, e.g: WordUCLSID.
+class UUID;
/// @brief Allocate new SCM class.
/// @tparam TCLS
@@ -65,14 +64,29 @@ public:
/// @param uclsidOfCls
/// @return
template <typename TCLS, typename UCLSID, typename... Args>
-inline TCLS* RtlGetClassFromCLSID(UCLSID uclsidOfCls, Args... args);
+TCLS* RtlQueryInterface(UCLSID uclsidOfCls, Args... args);
/// @brief Release SCM class.
/// @tparam TCLS
/// @param cls
/// @return
template <typename TCLS>
-inline SInt32 RtlReleaseClass(TCLS* cls);
+SInt32 RtlReleaseClass(TCLS* cls);
+
+class __attribute__((uuid("d7c144b6-0792-44b8-b06b-02b227b547df"))) UnknownInterface
+{
+public:
+ explicit UnknownInterface() = default;
+ virtual ~UnknownInterface() = default;
+
+ UnknownInterface& operator=(const UnknownInterface&) = default;
+ UnknownInterface(const UnknownInterface&) = default;
+
+ virtual SInt32 Release() = 0;
+ virtual void DecrementRef() = 0;
+ virtual UnknownInterface* IncrementRef() = 0;
+ virtual VoidPtr QueryInterface(UUID* p_uuid) = 0;
+};
#endif
@@ -89,10 +103,10 @@ struct HEAP_ALLOC_INFO final
struct THREAD_INFORMATION_BLOCK final
{
Char f_Cookie[3]; // Process cookie.
- UIntPtr f_Code; // Start Address
- UIntPtr f_Data; // Allocation Heap
- UIntPtr f_BSS; // Stack Pointer.
- SInt32 f_ID; // Thread execution ID.
+ UIntPtr f_Code; // Start Address
+ UIntPtr f_Data; // Allocation Heap
+ UIntPtr f_BSS; // Stack Pointer.
+ SInt32 f_ID; // Thread execution ID.
};
struct PROCESS_BLOCK_INFO final
@@ -109,9 +123,13 @@ struct PROCESS_EXIT_INFO final
Char fReason[cReasonLen];
};
-/// @brief Raise system call.
+/// @brief Raise system call.
/// @param id the system call id could be 0x10 for example.
/// @param data the data associated with it.
/// @param data_sz the size of the data associated with it.
/// @return status code.
-IMPORT_C SInt32 RtlRaiseSystemCall(const SInt32 id, VoidPtr data, SizeT data_sz); \ No newline at end of file
+IMPORT_C SInt32 RtlRaiseSystemCall(const SInt32 id, VoidPtr data, SizeT data_sz);
+
+IMPORT_C VoidPtr RtlGetDLLProcedure(const char* symbol, VoidPtr dll_handle);
+IMPORT_C VoidPtr RtOpenDLL(const char* path);
+IMPORT_C void RtCloseDLL(VoidPtr dll_handle); \ No newline at end of file
diff --git a/SCIKit/ErrorTypes.cxx b/SCIKit/SCIErr.cxx
index 7bd4146a..4b145697 100644
--- a/SCIKit/ErrorTypes.cxx
+++ b/SCIKit/SCIErr.cxx
@@ -4,6 +4,6 @@
------------------------------------------- */
-#include <SCIKit/ErrorTypes.hxx>
+#include <SCIKit/SCIErr.hxx>
-HError kLastError = 0; \ No newline at end of file
+NEW_ERROR_TYPE kLastError = 0; \ No newline at end of file
diff --git a/SCIKit/SCIErr.hxx b/SCIKit/SCIErr.hxx
new file mode 100644
index 00000000..3e9619fa
--- /dev/null
+++ b/SCIKit/SCIErr.hxx
@@ -0,0 +1,49 @@
+/* -------------------------------------------
+
+ Copyright ZKA Technologies
+
+------------------------------------------- */
+
+#pragma once
+
+#include <SCIKit/SCIBase.hxx>
+
+#define ErrLocalIsOk() (kLastError == kErrorSuccess)
+#define ErrLocalFailed() (kLastError != kErrorSuccess)
+#define ErrLocal() (kLastError)
+
+typedef SInt32 NEW_ERROR_TYPE;
+
+inline constexpr NEW_ERROR_TYPE kErrorSuccess = 0;
+inline constexpr NEW_ERROR_TYPE kErrorExecutable = 33;
+inline constexpr NEW_ERROR_TYPE kErrorExecutableLib = 34;
+inline constexpr NEW_ERROR_TYPE kErrorFileNotFound = 35;
+inline constexpr NEW_ERROR_TYPE kErrorDirectoryNotFound = 36;
+inline constexpr NEW_ERROR_TYPE kErrorDiskReadOnly = 37;
+inline constexpr NEW_ERROR_TYPE kErrorDiskIsFull = 38;
+inline constexpr NEW_ERROR_TYPE kErrorProcessFault = 39;
+inline constexpr NEW_ERROR_TYPE kErrorSocketHangUp = 40;
+inline constexpr NEW_ERROR_TYPE kErrorThreadLocalStorage = 41;
+inline constexpr NEW_ERROR_TYPE kErrorMath = 42;
+inline constexpr NEW_ERROR_TYPE kErrorNoNetwork = 43;
+inline constexpr NEW_ERROR_TYPE kErrorHeapOutOfMemory = 44;
+inline constexpr NEW_ERROR_TYPE kErrorNoSuchDisk = 45;
+inline constexpr NEW_ERROR_TYPE kErrorFileExists = 46;
+inline constexpr NEW_ERROR_TYPE kErrorFormatFailed = 47;
+inline constexpr NEW_ERROR_TYPE kErrorNetworkTimeout = 48;
+inline constexpr NEW_ERROR_TYPE kErrorInternal = 49;
+inline constexpr NEW_ERROR_TYPE kErrorForkAlreadyExists = 50;
+inline constexpr NEW_ERROR_TYPE kErrorOutOfTeamSlot = 51;
+inline constexpr NEW_ERROR_TYPE kErrorHeapNotPresent = 52;
+inline constexpr NEW_ERROR_TYPE kErrorNoEntrypoint = 53;
+inline constexpr NEW_ERROR_TYPE kErrorDiskIsCorrupted = 54;
+inline constexpr NEW_ERROR_TYPE kErrorDisk = 55;
+inline constexpr NEW_ERROR_TYPE kErrorInvalidData = 56;
+inline constexpr NEW_ERROR_TYPE kErrorAsync = 57;
+inline constexpr NEW_ERROR_TYPE kErrorNonBlocking = 58;
+inline constexpr NEW_ERROR_TYPE kErrorIPC = 59;
+inline constexpr NEW_ERROR_TYPE kErrorSign = 60;
+inline constexpr NEW_ERROR_TYPE kErrorInvalidCreds = 61;
+inline constexpr NEW_ERROR_TYPE kErrorUnimplemented = 0;
+
+IMPORT_C NEW_ERROR_TYPE kLastError;
diff --git a/SCIKit/SCIObjRt.cxx b/SCIKit/SCIObjRt.cxx
new file mode 100644
index 00000000..c8c7300e
--- /dev/null
+++ b/SCIKit/SCIObjRt.cxx
@@ -0,0 +1,8 @@
+/* -------------------------------------------
+
+ Copyright ZKA Technologies
+
+------------------------------------------- */
+
+#include <SCIKit/SCIBase.hxx>
+//#include <SCIKit/SCIObjRt.hxx> \ No newline at end of file
diff --git a/SCIKit/rtl.internal.inl b/SCIKit/rtl.internal.inl
index b0b011cc..f22bc834 100644
--- a/SCIKit/rtl.internal.inl
+++ b/SCIKit/rtl.internal.inl
@@ -7,15 +7,38 @@ Purpose: Internal file for SCM.
------------------------------------------- */
+
+// Interfaces are divided between classes.
+// So that they aren't too big.
+
+class UnknownInterface; // Refrenced from an IDB entry.
+class UnknownUCLSID; // From the IDB, the constructor of the object, e.g: TextUCLSID.
+class UUID;
+
+class __attribute__((uuid("d7c144b6-0792-44b8-b06b-02b227b547df"))) UnknownInterface
+{
+public:
+ explicit UnknownInterface() = default;
+ virtual ~UnknownInterface() = default;
+
+ UnknownInterface& operator=(const UnknownInterface&) = default;
+ UnknownInterface(const UnknownInterface&) = default;
+
+ virtual SInt32 Release() = 0;
+ virtual void DecrementRef() = 0;
+ virtual UnknownInterface* IncrementRef() = 0;
+ virtual VoidPtr QueryInterface(UUID* p_uuid) = 0;
+};
+
/// @brief Allocate new SCM class.
/// @tparam TCLS
/// @tparam UCLSID
/// @param uclsidOfCls
/// @return
template <typename TCLS, typename UCLSID, typename... Args>
-inline TCLS* RtlGetClassFromCLSID(UCLSID* uclsidOfCls, Args&&... args)
+inline TCLS* RtlQueryInterface(UCLSID* uclsidOfCls, Args&&... args)
{
- return uclsidOfCls->QueryObjectWithArgs(args...);
+ return uclsidOfCls->QueryInterfaceWithArgs(args...);
}
/// @brief Release SCM class.
@@ -25,6 +48,9 @@ inline TCLS* RtlGetClassFromCLSID(UCLSID* uclsidOfCls, Args&&... args)
template <typename TCLS>
inline SInt32 RtlReleaseClass(TCLS* cls)
{
+ if (!cls)
+ return -1;
+
cls->DecrementRef();
cls->Release();