Guest User

いいゾ^~

a guest
Apr 23rd, 2015
645
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.45 KB | None | 0 0
  1. #pragma warning(disable:4996)
  2. #include <windows.h>
  3. #include <psapi.h>
  4. #include <stdio.h>
  5. #include <TlHelp32.h>
  6. #include <vector>
  7. #include <stdlib.h>
  8. #include <string>
  9. #include <thread>
  10. using namespace std;
  11.  
  12.  
  13. DWORD GetProcessByName(char* name)
  14. {
  15. DWORD pid = 0;
  16.  
  17. HANDLE snapshot = CreateToolhelp32Snapshot(TH32CS_SNAPPROCESS, 0);
  18. PROCESSENTRY32 process;
  19. ZeroMemory(&process, sizeof(process));
  20. process.dwSize = sizeof(process);
  21.  
  22. if (Process32First(snapshot, &process))
  23. {
  24. do
  25. {
  26. if (strstr(process.szExeFile, name) != NULL)
  27. {
  28. pid = process.th32ProcessID;
  29. break;
  30. }
  31. } while (Process32Next(snapshot, &process));
  32. }
  33.  
  34. CloseHandle(snapshot);
  35.  
  36. if (pid != 0)
  37. {
  38. return pid;
  39. }
  40.  
  41. return NULL;
  42. }
  43.  
  44. int main()
  45.  
  46. {
  47. __int64 hash, result;
  48. printf("enter Native Hash\n");
  49. scanf("%llx", &hash);
  50.  
  51. INT Address = 0x00000000;
  52. INT i, p;
  53. CHAR *MemoryBuff = new CHAR[4096];
  54. DWORD PPID = GetProcessByName("GTA5");
  55.  
  56. HANDLE hProcess = OpenProcess(PROCESS_ALL_ACCESS, FALSE, PPID);
  57.  
  58. for (i = 0; i < 0x9FFF9840; i++)
  59. {
  60. ReadProcessMemory(hProcess, (LPVOID)Address, (LPVOID)MemoryBuff, 4096, NULL);
  61. for (p = 0; p < 4096; p++)
  62. {
  63. Address++;
  64. MemoryBuff++;
  65.  
  66. if (memcmp(MemoryBuff, &hash, sizeof(hash)) ==0)
  67. {
  68. ReadProcessMemory(hProcess, (LPVOID)(Address - 0x40), &result, sizeof(result), 0);
  69. printf("result:%llX\n", result);
  70. exit(0);
  71. }
  72.  
  73. }
  74. MemoryBuff = MemoryBuff - 4096;
  75. }
  76. }
Advertisement
Add Comment
Please, Sign In to add comment