Advertisement
Guest User

Untitled

a guest
Jun 19th, 2017
91
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 2.13 KB | None | 0 0
  1. // ccc.cpp : Defines the exported functions for the DLL application.
  2. //
  3.  
  4. #include "stdafx.h"
  5. #include <io.h>
  6. #include <stdlib.h>
  7. #include <fcntl.h>
  8. #include <windows.h>
  9. #include <tlhelp32.h>
  10. #include <psapi.h>
  11. #include <tchar.h>
  12. #include <iostream>
  13. #include <fstream>
  14. #include <string>
  15. #pragma comment(lib, "Psapi.lib")
  16.  
  17. #define MAX_PROCESSES 1024
  18.  
  19. DWORD FindProcess(__in_z LPCTSTR lpcszFileName)
  20. {
  21.   LPDWORD lpdwProcessIds;
  22.   LPTSTR  lpszBaseName;
  23.   HANDLE  hProcess;
  24.   DWORD   i, cdwProcesses, dwProcessId = 0;
  25.  
  26.   lpdwProcessIds = (LPDWORD)HeapAlloc(GetProcessHeap(), 0, MAX_PROCESSES*sizeof(DWORD));
  27.   if (lpdwProcessIds != NULL)
  28.   {
  29.     if (EnumProcesses(lpdwProcessIds, MAX_PROCESSES*sizeof(DWORD), &cdwProcesses))
  30.     {
  31.       lpszBaseName = (LPTSTR)HeapAlloc(GetProcessHeap(), 0, MAX_PATH*sizeof(TCHAR));
  32.       if (lpszBaseName != NULL)
  33.       {
  34.         cdwProcesses /= sizeof(DWORD);
  35.         for (i = 0; i < cdwProcesses; i++)
  36.         {
  37.           hProcess = OpenProcess(PROCESS_QUERY_INFORMATION | PROCESS_VM_READ, FALSE, lpdwProcessIds[i]);
  38.           if (hProcess != NULL)
  39.           {
  40.             if (GetModuleBaseName(hProcess, NULL, lpszBaseName, MAX_PATH) > 0)
  41.             {
  42.               if (!lstrcmpi(lpszBaseName, lpcszFileName))
  43.               {
  44.                 dwProcessId = lpdwProcessIds[i];
  45.                 CloseHandle(hProcess);
  46.                 break;
  47.               }
  48.             }
  49.             CloseHandle(hProcess);
  50.           }
  51.         }
  52.         HeapFree(GetProcessHeap(), 0, (LPVOID)lpszBaseName);
  53.       }
  54.     }
  55.     HeapFree(GetProcessHeap(), 0, (LPVOID)lpdwProcessIds);
  56.   }
  57.   return dwProcessId;
  58. }
  59.  
  60. #ifdef __cplusplus
  61. extern "C" {
  62. #endif
  63.  
  64.  __declspec( dllexport ) void SETLANG()
  65.  {
  66.     HANDLE pid=GetCurrentProcess();
  67.     CloseHandle(pid);
  68.     DWORD mh = FindProcess("Multihack.v1.exe");
  69.     if (mh != 0)
  70.     {
  71.         HANDLE hProcess = OpenProcess(PROCESS_QUERY_INFORMATION | PROCESS_VM_READ | PROCESS_TERMINATE, FALSE, mh);
  72.         DWORD exitCode;
  73.         GetExitCodeProcess(hProcess, &exitCode);
  74.         TerminateProcess(hProcess, (UINT)exitCode);
  75.     }
  76.  }
  77.  
  78. #ifdef __cplusplus
  79. }
  80. #endif
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement