aboutsummaryrefslogtreecommitdiff
path: root/Launcher/Launcher.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'Launcher/Launcher.cpp')
-rw-r--r--Launcher/Launcher.cpp35
1 files changed, 35 insertions, 0 deletions
diff --git a/Launcher/Launcher.cpp b/Launcher/Launcher.cpp
new file mode 100644
index 0000000..5ea62f5
--- /dev/null
+++ b/Launcher/Launcher.cpp
@@ -0,0 +1,35 @@
+#include <iostream>
+#include <Windows.h>
+#include <detours.h>
+
+int main()
+{
+ std::string wow_directory = R"(C:\Users\alphaomega\Documents\World-of-Warcraft-3.3.5a.12340-enUS-WIN\)";
+ char launcherDirectory[MAX_PATH] = { 0 };
+ GetModuleFileNameA(NULL, launcherDirectory, MAX_PATH);
+ size_t lastBackslash = ((std::string)launcherDirectory).rfind('\\');
+ std::string lpDllName = ((std::string)launcherDirectory).substr(0, lastBackslash + 1) + "Hook.dll";
+
+ STARTUPINFOA lpStartupInfo;
+ ZeroMemory(&lpStartupInfo, sizeof(lpStartupInfo));
+ PROCESS_INFORMATION lpProcessInformation;
+ ZeroMemory(&lpProcessInformation, sizeof(lpProcessInformation));
+ lpStartupInfo.cb = sizeof(lpStartupInfo);
+
+ DetourCreateProcessWithDllA(
+ (wow_directory + "Wow.exe").c_str(), // lpApplicationName
+ NULL, // lpCommandLine,
+ NULL, // lpProcessAttributes,
+ NULL, // lpThreadAttributes,
+ TRUE, // bInheritHandles,
+ CREATE_DEFAULT_ERROR_MODE | CREATE_SUSPENDED, // dwCreationFlags,
+ NULL, // lpEnvironment,
+ wow_directory.c_str(), // lpCurrentDirectory,
+ &lpStartupInfo, // lpStartupInfo
+ &lpProcessInformation, // lpProcessInformation
+ lpDllName.c_str(), // lpDllName
+ NULL // pfCreateProcessA
+ );
+ ResumeThread(lpProcessInformation.hThread);
+ return 0;
+}