// Loads coop_hook.dll into a target process via the classic // CreateRemoteThread(LoadLibraryW) technique. #pragma once #include namespace coop { enum class InjectStatus { Ok, OpenProcessFailed, // insufficient rights (try running the host as admin) BitnessMismatch, // 32-bit target; the x86 hook/helper aren't available DllNotFound, AllocFailed, WriteFailed, RemoteThreadFailed, RemoteLoadFailed, // LoadLibraryW returned null inside the target HelperNotFound, // 32-bit target but coop_inject_x86.exe / coop_hook_x86.dll missing HelperFailed, // the x86 injector helper ran but reported failure }; struct InjectResult { InjectStatus status = InjectStatus::OpenProcessFailed; unsigned long os_error = 0; // GetLastError at the point of failure, if any }; const char* to_string(InjectStatus status); // Injects `dll_path` (absolute, the x64 coop_hook.dll) into `pid`. For a 32-bit // (WOW64) target the x64 host can't inject directly, so it spawns the sibling // coop_inject_x86.exe to load coop_hook_x86.dll (both expected next to dll_path). InjectResult inject_dll(unsigned long pid, const std::wstring& dll_path); } // namespace coop