summaryrefslogtreecommitdiffhomepage
path: root/dev/DLL/RunXPCOM/Sources/LauncherMain.cxx
diff options
context:
space:
mode:
authorAmlal EL Mahrouss <amlalelmahrouss@icloud.com>2024-09-07 10:41:09 +0200
committerAmlal EL Mahrouss <amlalelmahrouss@icloud.com>2024-09-07 10:41:09 +0200
commit5f9761218b0ef9727574aed0dccb482a3d008e66 (patch)
treefe32bf4c5528095683f3c574283dd29472d567fa /dev/DLL/RunXPCOM/Sources/LauncherMain.cxx
parent0b651bfdd60215af58fedcd68ab6ca703988847a (diff)
REFACTOR: Rename RunSCM to RunXPCOM.
Signed-off-by: Amlal EL Mahrouss <amlalelmahrouss@icloud.com>
Diffstat (limited to 'dev/DLL/RunXPCOM/Sources/LauncherMain.cxx')
-rw-r--r--dev/DLL/RunXPCOM/Sources/LauncherMain.cxx28
1 files changed, 28 insertions, 0 deletions
diff --git a/dev/DLL/RunXPCOM/Sources/LauncherMain.cxx b/dev/DLL/RunXPCOM/Sources/LauncherMain.cxx
new file mode 100644
index 00000000..fd68a495
--- /dev/null
+++ b/dev/DLL/RunXPCOM/Sources/LauncherMain.cxx
@@ -0,0 +1,28 @@
+#include <SCI/sci_base.hxx>
+
+typedef SInt32 (*RPCProcKind)(IUnknown*);
+
+/**
+ * @brief Main procedure for DLL runner.
+ */
+int WinMain(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;
+}