Advertisement
Guest User

Untitled

a guest
Oct 8th, 2014
454
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. /*
  2. -----------------------------------------
  3. * Game hacking QTS ( Quickie Tip Series )
  4. * no. 31 - Hiding your strings in your hack
  5. -----------------------------------------
  6. * Author: SEGnosis  
  7. * Thanks to:
  8. * bitterbanana      - No known site
  9. * Drunken Cheetah   - No known site
  10. * fatboy88      - No known site
  11. * Geek4Ever         - No known site
  12. * learn_more        - www.uc-forum.com
  13. * Novocaine         - http://ilsken.net/blog/?page_id=64
  14. * Philly0494        - No known site
  15. * Roverturbo        - www.uc-forum.com
  16. * SilentKarma       - www.halocoders.com - offline
  17. * Strife        - www.uc-forum.com
  18. * Wieter20      - No known site
  19. */
  20.  
  21.  
  22. //----------------------------------//
  23.  
  24.  
  25. BOOL CALLBACK MyEnumWindowsProc(HWND hWnd, LPARAM lParam)
  26. {
  27.     RECT rect;
  28.    
  29.     DWORD* pParams;
  30.  
  31.     DWORD lpdwProcessId;
  32.  
  33.     char szBuffer[MAX_PATH];
  34.  
  35.    
  36.     pParams = (DWORD*)lParam;
  37.     GetWindowThreadProcessId(hWnd, &lpdwProcessId);
  38.  
  39.     if(pParams[0] == lpdwProcessId)
  40.     {
  41.         GetClientRect(hWnd, &rect);
  42.  
  43.         GetClassName(hWnd, szBuffer, sizeof(szBuffer));
  44.  
  45.         if(strcmp(szBuffer, "ConsoleWindowClass") != 0 && rect.right > 1)
  46.             pParams[1] = (DWORD)hWnd;
  47.     }
  48.  
  49.     return TRUE;
  50. }
  51.  
  52. HWND GetWindowByProcessId(int iProcessId, bool bWaitForHandle)
  53. {
  54.     DWORD dwParams[2];
  55.  
  56.     HWND hWndResult;
  57.  
  58.    
  59.     do
  60.     {
  61.         dwParams[0] = iProcessId;
  62.         dwParams[1] = NULL;
  63.  
  64.         EnumWindows(MyEnumWindowsProc, (LPARAM)&dwParams);
  65.  
  66.         hWndResult = (HWND)dwParams[1];
  67.  
  68.         if(hWndResult == NULL)
  69.             Sleep(10);
  70.  
  71.     }while(hWndResult == NULL && bWaitForHandle == true);
  72.  
  73.     return hWndResult;
  74. }
  75.  
  76. //----------------------------------//
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement