#include #include #include #include #include #include #include #include #include #include int wmain(int argc, WCHAR* argv[]) { if (argc < 3) { std::wcout << argv[0] << " dll command_line\n"; return 1; } std::wstring dllToInject (argv[1]); std::wstring exe (argv[2]); exe = exe.substr (0, exe.find (' ')); std::wstring command_line (argv[2]); command_line = command_line.substr (command_line.find (' ') + 1); ULONG pid; NTSTATUS nt = RhCreateAndInject ( const_cast (exe.c_str()) , const_cast (command_line.c_str()) , 0 , EASYHOOK_INJECT_DEFAULT , const_cast (dllToInject.c_str()) , nullptr , nullptr , 0 , &pid ); if (nt != 0) { std::wcout << "RhCreateAndInject failed with error code = " << nt << "\n " << RtlGetLastErrorString() << "\n"; return 1; } return 0; }