From 5f9761218b0ef9727574aed0dccb482a3d008e66 Mon Sep 17 00:00:00 2001 From: Amlal EL Mahrouss Date: Sat, 7 Sep 2024 10:41:09 +0200 Subject: REFACTOR: Rename RunSCM to RunXPCOM. Signed-off-by: Amlal EL Mahrouss --- dev/DLL/RunSCM/Sources/LauncherMain.cxx | 25 ------------------------- dev/DLL/RunSCM/Sources/compile_flags.txt | 1 - dev/DLL/RunSCM/build.json | 19 ------------------- dev/DLL/RunXPCOM/Sources/LauncherMain.cxx | 28 ++++++++++++++++++++++++++++ dev/DLL/RunXPCOM/Sources/compile_flags.txt | 1 + dev/DLL/RunXPCOM/build.json | 19 +++++++++++++++++++ 6 files changed, 48 insertions(+), 45 deletions(-) delete mode 100644 dev/DLL/RunSCM/Sources/LauncherMain.cxx delete mode 100644 dev/DLL/RunSCM/Sources/compile_flags.txt delete mode 100644 dev/DLL/RunSCM/build.json create mode 100644 dev/DLL/RunXPCOM/Sources/LauncherMain.cxx create mode 100644 dev/DLL/RunXPCOM/Sources/compile_flags.txt create mode 100644 dev/DLL/RunXPCOM/build.json diff --git a/dev/DLL/RunSCM/Sources/LauncherMain.cxx b/dev/DLL/RunSCM/Sources/LauncherMain.cxx deleted file mode 100644 index 51894df1..00000000 --- a/dev/DLL/RunSCM/Sources/LauncherMain.cxx +++ /dev/null @@ -1,25 +0,0 @@ -#include - -typedef int (*rpc_call_t)(IUnknown*); - -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); - rpc_call_t dllRpc = (rpc_call_t)LdrGetDLLProc(argv[4], mainDll); - - if (!dllRpc) - return -1; - if (!interface) - return -1; - - auto ret = dllRpc(interface); - - LdrCloseDLL(mainDll); - - return ret; -} diff --git a/dev/DLL/RunSCM/Sources/compile_flags.txt b/dev/DLL/RunSCM/Sources/compile_flags.txt deleted file mode 100644 index 53118879..00000000 --- a/dev/DLL/RunSCM/Sources/compile_flags.txt +++ /dev/null @@ -1 +0,0 @@ --I../../SCI diff --git a/dev/DLL/RunSCM/build.json b/dev/DLL/RunSCM/build.json deleted file mode 100644 index e1294f74..00000000 --- a/dev/DLL/RunSCM/build.json +++ /dev/null @@ -1,19 +0,0 @@ -{ - "compiler_path": "x86_64-w64-mingw32-g++", - "compiler_std": "c++20", - "headers_path": ["../", "./", "../../"], - "sources_path": ["Sources/*.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/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 + +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; +} diff --git a/dev/DLL/RunXPCOM/Sources/compile_flags.txt b/dev/DLL/RunXPCOM/Sources/compile_flags.txt new file mode 100644 index 00000000..53118879 --- /dev/null +++ b/dev/DLL/RunXPCOM/Sources/compile_flags.txt @@ -0,0 +1 @@ +-I../../SCI diff --git a/dev/DLL/RunXPCOM/build.json b/dev/DLL/RunXPCOM/build.json new file mode 100644 index 00000000..e1294f74 --- /dev/null +++ b/dev/DLL/RunXPCOM/build.json @@ -0,0 +1,19 @@ +{ + "compiler_path": "x86_64-w64-mingw32-g++", + "compiler_std": "c++20", + "headers_path": ["../", "./", "../../"], + "sources_path": ["Sources/*.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" + ] +} -- cgit v1.2.3