Advertisement
Guest User

Untitled

a guest
Feb 5th, 2012
683
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.85 KB | None | 0 0
  1. #include <cstdio>
  2. #include <windows.h>
  3. #include <detours\detours.h>
  4.  
  5. int main()
  6. {
  7. STARTUPINFO si;
  8. PROCESS_INFORMATION pi;
  9. ZeroMemory(&si, sizeof(STARTUPINFO));
  10. ZeroMemory(&pi, sizeof(PROCESS_INFORMATION));
  11. si.cb = sizeof(STARTUPINFO);
  12. char* DirPath = new char[MAX_PATH];
  13. char* DLLPath = new char[MAX_PATH]; //testdll.dll
  14. char* DetourPath = new char[MAX_PATH]; //detoured.dll
  15. GetCurrentDirectory(MAX_PATH, DirPath);
  16. sprintf_s(DLLPath, MAX_PATH, "%s\\testdll.dll", DirPath);
  17. sprintf_s(DetourPath, MAX_PATH, "%s\\detoured.dll", DirPath);
  18. DetourCreateProcessWithDll(NULL, "C:\\windows\\notepad.exe", NULL,
  19. NULL, FALSE, CREATE_DEFAULT_ERROR_MODE, NULL, NULL,
  20. &si, &pi, DetourPath, DLLPath, NULL);
  21. delete [] DirPath;
  22. delete [] DLLPath;
  23. delete [] DetourPath;
  24. return 0;
  25. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement