Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <cstdio>
- #include <windows.h>
- #include <detours\detours.h>
- int main()
- {
- STARTUPINFO si;
- PROCESS_INFORMATION pi;
- ZeroMemory(&si, sizeof(STARTUPINFO));
- ZeroMemory(&pi, sizeof(PROCESS_INFORMATION));
- si.cb = sizeof(STARTUPINFO);
- char* DirPath = new char[MAX_PATH];
- char* DLLPath = new char[MAX_PATH]; //testdll.dll
- char* DetourPath = new char[MAX_PATH]; //detoured.dll
- GetCurrentDirectory(MAX_PATH, DirPath);
- sprintf_s(DLLPath, MAX_PATH, "%s\\testdll.dll", DirPath);
- sprintf_s(DetourPath, MAX_PATH, "%s\\detoured.dll", DirPath);
- DetourCreateProcessWithDll(NULL, "C:\\windows\\notepad.exe", NULL,
- NULL, FALSE, CREATE_DEFAULT_ERROR_MODE, NULL, NULL,
- &si, &pi, DetourPath, DLLPath, NULL);
- delete [] DirPath;
- delete [] DLLPath;
- delete [] DetourPath;
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement