Advertisement
Guest User

Untitled

a guest
Aug 23rd, 2014
279
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.03 KB | None | 0 0
  1. #include <Windows.h>
  2. #include <stdio.h>
  3.  
  4. INT APIENTRY DllMain(HMODULE hDLL, DWORD Reason, LPVOID Reserved) {
  5. /* open file */
  6. FILE *file;
  7. fopen_s(&file, "C:\\temp.txt", "a+");
  8. char processName[255];
  9.  
  10. if(file == NULL) {
  11. return FALSE;
  12. }
  13.  
  14. GetModuleFileNameA(NULL, processName, 255);
  15.  
  16. switch(Reason) {
  17. case DLL_PROCESS_ATTACH:
  18. fprintf(file, "DLL attach function called: %s\n", processName);
  19. break;
  20. case DLL_PROCESS_DETACH:
  21. fprintf(file, "DLL detach function called.\n");
  22. break;
  23. case DLL_THREAD_ATTACH:
  24. fprintf(file, "DLL thread attach function called.\n");
  25. break;
  26. case DLL_THREAD_DETACH:
  27. fprintf(file, "DLL thread detach function called.\n");
  28. break;
  29. }
  30.  
  31. /* close file */
  32. fclose(file);
  33.  
  34. return TRUE;
  35. }
  36.  
  37. extern "C" __declspec(dllexport) int meconnect(int code, WPARAM wParam, LPARAM lParam) {
  38. FILE *file;
  39. fopen_s(&file, "C:\\function.txt", "a+");
  40. fprintf(file, "Function keyboard_hook called.n");
  41. fclose(file);
  42. return(CallNextHookEx(NULL, code, wParam, lParam));
  43. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement