• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 599
  • Last Modified:

C++ source to Delphi

convert it please to Delphi
##########################################
AntiHack.cpp
##########################################
// ----------------------------------------------------
// File name: AntiHack.cpp
// Date: 2008-06-26
// Author: f1x 
// ----------------------------------------------------
#ifndef PDC_ANTIHACK_H
#define PDC_ANTIHACK_H
#define MAX_DUMP_OFFSETS 2
#define MAX_DUMP_SIZE 32
#define MAX_PROCESS_DUMP 2
typedef struct ANITHACK_PROCDUMP {
 unsigned int m_aOffset;
 unsigned char m_aMemDump[MAX_DUMP_SIZE];
} *PANITHACK_PROCDUMP;
extern ANITHACK_PROCDUMP g_ProcessesDumps[MAX_PROCESS_DUMP];
void SystemProcessesScan();
bool ScanProcessMemory(HANDLE hProcess);
 
#endif //PDC_ANTIHACK_H
//---------------------------------------------------------------------------------------------
// ----------------------------------------------------
// File name: AntiHack.cpp
// Date: 2008-06-26
// Author: f1x / f1ksiu@hotmail.com
// ----------------------------------------------------
#include "stdafx.h"
#include "AntiHack.h"
#include <windows.h>
#include <tlhelp32.h>
#include <stdlib.h>
ANITHACK_PROCDUMP g_ProcessesDumps[MAX_PROCESS_DUMP] = {
            {0x4C8259, {0xA1, 0x38, 0xBD, 0x4C, 0x00, 0x8B, 0x00, 0x8B, 0x4D, 0xFC, 0xBA, 0xC0, 0x82, 0x4C, 0x00, 0xE8, 0x1F, 0xF1, 0xFF, 0xFF, 0x33, 0xDB, 0xE8, 0xF8, 0xBE, 0xF3, 0xFF, 0x33, 0xC0, 0x5A, 0x59, 0x59}}, //Catastrophe
            {0x4C5F31, {0x7C, 0x23, 0x8B, 0x45, 0xFC, 0x80, 0x38, 0xC1, 0x75, 0x1B, 0x8B, 0x45, 0xFC, 0x80, 0x78, 0x02, 0xF3, 0x75, 0x12, 0x8B, 0x45, 0xFC, 0x80, 0x78, 0x03, 0x00, 0x75, 0x09, 0x8B, 0x45, 0xFC, 0x80}} // Catastrophe
                };
void SystemProcessesScan() {
 HANDLE hProcessSnap = CreateToolhelp32Snapshot(TH32CS_SNAPPROCESS, 0);
 if(hProcessSnap != INVALID_HANDLE_VALUE)
 {
  PROCESSENTRY32 pe32;
  pe32.dwSize = sizeof(PROCESSENTRY32);
  if(Process32First(hProcessSnap, &pe32))
  {
   do
   {
    HANDLE hProcess = OpenProcess(PROCESS_ALL_ACCESS, FALSE, pe32.th32ProcessID);
    if(hProcess != NULL)
    {
     if(ScanProcessMemory(hProcess))
     {
      MessageBoxA(0, "Found hack software in your system.\n\nHint: Close all illegal programs and run application again.", "Software guard", MB_OK | MB_ICONSTOP);
      ExitProcess(0);
     }
    }
   }
   while(Process32Next(hProcessSnap, &pe32));
  }
 }
 CloseHandle(hProcessSnap);
}
bool ScanProcessMemory(HANDLE hProcess) {
 for(int i = 0; i < MAX_PROCESS_DUMP; i++)
 {
  char aTmpBuffer[MAX_DUMP_SIZE];
  SIZE_T aBytesRead = 0;
  ReadProcessMemory(hProcess, (LPCVOID)g_ProcessesDumps[i].m_aOffset, (LPVOID)aTmpBuffer, sizeof(aTmpBuffer), &aBytesRead);
  if(memcmp(aTmpBuffer, g_ProcessesDumps[i].m_aMemDump, MAX_DUMP_SIZE) == 0)
  {
   return true;
   break;
  }
 }
 return false;
}
 
############################################################
here is AntiHack.h
#############################################################
// ----------------------------------------------------
//      Nazwa pliku:            AntiHack.h
//      Data utworzenia:        2008-06-26
//      Autor:                          f1x 
// ----------------------------------------------------
 
#ifndef ANTIHACK_ANTIHACK_H
#define ANTIHACK_ANTIHACK_H
 
#define MAX_DUMP_OFFSETS 2
#define MAX_DUMP_SIZE 32
#define MAX_PROCESS_DUMP 2
 
typedef struct ANITHACK_PROCDUMP {
        unsigned int m_aOffset;
        unsigned char m_aMemDump[MAX_DUMP_SIZE];
} *PANITHACK_PROCDUMP;
 
extern ANITHACK_PROCDUMP g_ProcessesDumps[MAX_PROCESS_DUMP];
 
void SystemProcessesScan();
bool ScanProcessMemory(HANDLE hProcess);
 
 
#endif //ANTIHACK_ANTIHACK_H

Open in new window

0
loliks
Asked:
loliks
1 Solution
 
loliksAuthor Commented:
where all experts is?
0
 
6748222Commented:
Sended
0

Featured Post

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now