diff options
| author | Amlal <amlal@el-mahrouss-logic.com> | 2024-09-22 17:46:11 +0200 |
|---|---|---|
| committer | Amlal <amlal@el-mahrouss-logic.com> | 2024-09-22 17:46:11 +0200 |
| commit | 8719b4570a2d10dd49a0d3a47e24f5c55bdda85e (patch) | |
| tree | ba095740888f3768e08b2ea058b0ea6da2d0403d /dev/base/RunXPCOM | |
| parent | 45944b3d2dab04b763fcc6d10164fe8069e60b08 (diff) | |
:boom: A big refactor on the filesystem structure.
Signed-off-by: Amlal <amlal@el-mahrouss-logic.com>
Diffstat (limited to 'dev/base/RunXPCOM')
| -rw-r--r-- | dev/base/RunXPCOM/build.json | 19 | ||||
| -rw-r--r-- | dev/base/RunXPCOM/src/LauncherMain.cxx | 28 |
2 files changed, 47 insertions, 0 deletions
diff --git a/dev/base/RunXPCOM/build.json b/dev/base/RunXPCOM/build.json new file mode 100644 index 00000000..a932d733 --- /dev/null +++ b/dev/base/RunXPCOM/build.json @@ -0,0 +1,19 @@ +{ + "compiler_path": "x86_64-w64-mingw32-g++", + "compiler_std": "c++20", + "headers_path": ["../", "./", "../../"], + "sources_path": ["src/*.cxx"], + "output_name": "runxpcom.exe", + "compiler_flags": [ + "-ffreestanding", + "-fno-rtti", + "-fno-exceptions", + " -Wl,--subsystem=17" + ], + "cpp_macros": [ + "__SCM_AMD64__", + "cSCMVersion=0x0100", + "cSCMVersionHighest=0x0100", + "cSCMVersionLowest=0x0100" + ] +} diff --git a/dev/base/RunXPCOM/src/LauncherMain.cxx b/dev/base/RunXPCOM/src/LauncherMain.cxx new file mode 100644 index 00000000..b6047435 --- /dev/null +++ b/dev/base/RunXPCOM/src/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; +} |
