I try to make a include pattern scanner UAV project
This project successfully build. but when i injector the AVA.exe will crash. i don't know how can fixed this problem.
Code:
#include <Windows.h>
#include <stdio.h>
#include <string>
#ifndef _PSAPI_H_
#include <Psapi.h>
#pragma comment(lib, "psapi.lib")
#endif
#define GOP "\x00\x00\x00\x00\x0E\x42"
#define GOM "xxxxxx"
#define GOO 0x2
#define GNP "\x80\xBB\xB7\x27\x00\x00\x09\x41\x9E"
#define GNM "xxxxxxxxx"
#define GNO 0x4
/*
# ========================================================================================= #
# Environment
# ========================================================================================= #
*/
MODULEINFO GetModuleInfo(LPCSTR lpModuleName)
{
MODULEINFO modinfo = { 0 };
GetModuleInformation(GetCurrentProcess(), GetModuleHandle(lpModuleName), &modinfo, (sizeof modinfo));
return modinfo;
}
/*
# ========================================================================================= #
# PatternScan
# ========================================================================================= #
*/
bool Compare(const BYTE *pData, const BYTE *bMask, const char *szMask)
{
for (; *szMask; ++szMask, ++pData, ++bMask)
if (*szMask == 'x' && *pData != *bMask) return false;
return (*szMask == 0);
}
DWORD FindPattern(LPCSTR lpModuleName, char *bMask, char *szMask)
{
MODULEINFO modinfo = GetModuleInfo(lpModuleName);
DWORD dwBase = (DWORD)modinfo.lpBaseOfDll;
DWORD dwSize = (DWORD)modinfo.SizeOfImage;
for (DWORD i = 0; i < dwSize; i++)
if (Compare((BYTE*)dwBase + i, (BYTE*)bMask, szMask))
return dwBase + i;
}
Pattern Scan GNames :
static TArray< FNameEntry* >* Names()
{
static DWORD GNA = NULL;
if (!GNA )
GNA = *(DWORD*)(FindPattern("ava.exe", GNP, GNM) + GNO);
return (TArray< FNameEntry* >*) GNA ;
};