summaryrefslogtreecommitdiffhomepage
path: root/dev/base/RunXPCOM/src/xpcom.cc
diff options
context:
space:
mode:
authorAmlal El Mahrouss <amlal.elmahrouss@icloud.com>2024-10-21 20:23:36 +0200
committerAmlal El Mahrouss <amlal.elmahrouss@icloud.com>2024-10-21 20:23:36 +0200
commitd48cbe75ef29a9c67c9d176bf58e56ea6448fb9e (patch)
tree89cbd6b7e23802f92bf3158868f4dc33c088e516 /dev/base/RunXPCOM/src/xpcom.cc
parent21b3da78f806d6765f9dffa6a84c21346f171cee (diff)
IMP: Major refactor of header and source files extensions.
Signed-off-by: Amlal El Mahrouss <amlal.elmahrouss@icloud.com>
Diffstat (limited to 'dev/base/RunXPCOM/src/xpcom.cc')
-rw-r--r--dev/base/RunXPCOM/src/xpcom.cc32
1 files changed, 32 insertions, 0 deletions
diff --git a/dev/base/RunXPCOM/src/xpcom.cc b/dev/base/RunXPCOM/src/xpcom.cc
new file mode 100644
index 00000000..3fcfc708
--- /dev/null
+++ b/dev/base/RunXPCOM/src/xpcom.cc
@@ -0,0 +1,32 @@
+/*
+ * Copyright (c) 2024 ZKA Web Services Co
+ */
+
+#include <sci/sci_base.h>
+
+typedef SInt32 (*RPCProcKind)(IUnknown*);
+
+/**
+ * @brief Main procedure for DLL runner.
+ */
+int main(int argc, char* argv[])
+{
+ if (argc < 4)
+ return -1;
+
+ auto mainDll = LdrOpenDLL(argv[1], argv[2]);
+
+ IUnknown* interface = (IUnknown*)LdrGetDLLProc(argv[3], mainDll);
+ RPCProcKind dllRpc = (RPCProcKind)LdrGetDLLProc(argv[4], mainDll);
+
+ if (!dllRpc)
+ return -1;
+ if (!interface)
+ return -1;
+
+ auto ret = dllRpc(interface);
+
+ LdrCloseDLL(mainDll);
+
+ return ret;
+}