Skip to content

Commit

Permalink
Add files via upload
Browse files Browse the repository at this point in the history
  • Loading branch information
nothanley authored Jul 6, 2023
1 parent ddcf318 commit 02aceb7
Show file tree
Hide file tree
Showing 5 changed files with 479 additions and 225 deletions.
59 changes: 39 additions & 20 deletions AEW_Launcher.cpp
Original file line number Diff line number Diff line change
@@ -1,19 +1,18 @@
// AEW_Launcher.cpp : Contains main logic, memory override for AEW v1.0 @ runtime //
#include "ProcessMain.h"
#include "ProcessUtils.h"
//#include <iostream>
#include "ReaderUtils.h"
#include <iostream>
#pragma comment(linker, "/SUBSYSTEM:windows /ENTRY:mainCRTStartup") // Hide Console
#pragma once

using namespace std;
ProcessMain::ProcessMeta pMeta = { 0,0,0 };
char moduleName[] = "AEWFightForever-Win64-Shipping.exe";

void UpdateAEWModule() {
// (As of 7/5 update)
DWORD64 integFunctionPtr = pMeta.clientBase + 0x10360D4; /* Original ASM terminates if AntiCheat interface is disabled */
DWORD64 packFunctionPtr = pMeta.clientBase + 0x2C45D6F; /* Original ASM defines external PAK mounts */
DWORD64 sigFunctionPtr = pMeta.clientBase + 0x15FE912; /* Original ASM skips PAK if no SIG file is found */
void UpdateAEWModule( DWORD integRVA, DWORD packRVA, DWORD sigRVA ) {
DWORD64 integFunctionPtr = pMeta.clientBase + integRVA; /* Original ASM terminates if AntiCheat interface is disabled */
DWORD64 packFunctionPtr = pMeta.clientBase + packRVA; /* Original ASM defines external PAK mounts */
DWORD64 sigFunctionPtr = pMeta.clientBase + sigRVA; /* Original ASM skips PAK if no SIG file is found */

// Custom Assembly
uint8_t asmDataAntiCheat;
Expand All @@ -22,8 +21,8 @@ void UpdateAEWModule() {

// Integrity Override
ReadProcessMemory(pMeta.pHandle, (LPCVOID)(integFunctionPtr), &asmDataAntiCheat, sizeof(asmDataAntiCheat), NULL);
if (asmDataAntiCheat == 0x75) {
asmDataAntiCheat = 0x74; // Changes "JNE" instruction to "JE"
if (asmDataAntiCheat == 0x75 || asmDataAntiCheat == 0x74) {
asmDataAntiCheat = 0xEB; // Changes "JNE" instruction to "JE"
WriteProcessMemory(pMeta.pHandle, (LPVOID)(integFunctionPtr), &asmDataAntiCheat, sizeof(asmDataAntiCheat), NULL);
}

Expand All @@ -45,16 +44,6 @@ void UpdateAEWModule() {
}


void PatchAEWProcess() {
//Get Base Address
while (pMeta.clientBase == 0x0) {
pMeta.clientBase = dwGetModuleBaseAddress(_T(moduleName), pMeta.processID);
}

// Overrides process terminate functions
UpdateAEWModule();
}


void GetAEWProcess() {
DWORD pID = 0x0;
Expand All @@ -77,8 +66,38 @@ void GetAEWProcess() {
}





int main()
{
// Search for local offsets
DWORD interfaceOffset = ReaderUtils::GetInterfaceOffset(moduleName);
DWORD packOffset = ReaderUtils::GetPackOffset(moduleName);
DWORD sigOffset = ReaderUtils::GetSigOffset(moduleName);

if (interfaceOffset == 0x0 || packOffset == 0x0 || sigOffset == 0x0) {
return 0;
}

// Collect all RVA's using offset
interfaceOffset = GetRVAFromFileOffset(moduleName, interfaceOffset);
packOffset = GetRVAFromFileOffset(moduleName, packOffset);
sigOffset = GetRVAFromFileOffset(moduleName, sigOffset);

std::cout << "\n\nRVA: " << std::hex << interfaceOffset << std::endl;
std::cout << "RVA: " << std::hex << packOffset << std::endl;
std::cout << "RVA: " << std::hex << sigOffset << std::endl;

// Launch process and acquire handle
GetAEWProcess();
PatchAEWProcess();

//Get Base Address
while (pMeta.clientBase == 0x0) {
pMeta.clientBase = dwGetModuleBaseAddress(_T(moduleName), pMeta.processID);
}

// Overrides process terminate functions
UpdateAEWModule( interfaceOffset, packOffset, sigOffset );

}
178 changes: 89 additions & 89 deletions ProcessMain.h
Original file line number Diff line number Diff line change
@@ -1,90 +1,90 @@
/* Launches process and retrieves process metadata */
#include "ProcessUtils.h"
#pragma once

class ProcessMain {

public:

struct ProcessMeta {
DWORD processID;
HANDLE pHandle;
DWORD64 clientBase;
};

static ProcessMeta LaunchProcessHandle(LPCSTR lpApplicationName)
{
// additional information
STARTUPINFOA si;
PROCESS_INFORMATION pi;

// set the size of the structures
ZeroMemory(&si, sizeof(si));
si.cb = sizeof(si);
ZeroMemory(&pi, sizeof(pi));

// start the program up
CreateProcessA
(
lpApplicationName, // the path
NULL, // Command line
NULL, // Process handle not inheritable
NULL, // Thread handle not inheritable
FALSE, // Set handle inheritance to FALSE
CREATE_NEW_CONSOLE, // Opens file in a separate console
NULL, // Use parent's environment block
NULL, // Use parent's starting directory
&si, // Pointer to STARTUPINFO structure
&pi // Pointer to PROCESS_INFORMATION structure
);

HANDLE pHandle = pi.hProcess;
DWORD processId = pi.dwProcessId;

ProcessMeta pMeta{ processId, pHandle, 0 };

return pMeta;
}

static ProcessMeta GetProcessIdFromExeName(const char* exeName)
{
DWORD processId = 0;
ProcessMeta pMeta = ProcessMeta{ 0, 0, 0 };
HANDLE hSnapshot = CreateToolhelp32Snapshot(TH32CS_SNAPPROCESS, 0);
if (hSnapshot != INVALID_HANDLE_VALUE)
{
PROCESSENTRY32 processEntry;
processEntry.dwSize = sizeof(PROCESSENTRY32);

if (Process32First(hSnapshot, &processEntry))
{
while (Process32Next(hSnapshot, &processEntry))
{
const char* processExeName = strrchr(processEntry.szExeFile, '\\');
if (processExeName != nullptr)
processExeName++; // Move past the backslash
else
processExeName = processEntry.szExeFile; // No backslash found, use the full name

if (_stricmp(processExeName, exeName) == 0)
{
processId = processEntry.th32ProcessID;
pMeta = ProcessMeta{ processId, hSnapshot, 0 };
break;
}
}
}

CloseHandle(hSnapshot);
}

return pMeta;
}

static HANDLE GetProcessHandle(DWORD processId, DWORD dwDesiredAccess)
{
HANDLE hProcess = OpenProcess(dwDesiredAccess, FALSE, processId);
return hProcess;
}

/* Launches process and retrieves process metadata */
#include "ProcessUtils.h"
#pragma once

class ProcessMain {

public:

struct ProcessMeta {
DWORD processID;
HANDLE pHandle;
DWORD64 clientBase;
};

static ProcessMeta LaunchProcessHandle(LPCSTR lpApplicationName)
{
// additional information
STARTUPINFOA si;
PROCESS_INFORMATION pi;

// set the size of the structures
ZeroMemory(&si, sizeof(si));
si.cb = sizeof(si);
ZeroMemory(&pi, sizeof(pi));

// start the program up
CreateProcessA
(
lpApplicationName, // the path
NULL, // Command line
NULL, // Process handle not inheritable
NULL, // Thread handle not inheritable
FALSE, // Set handle inheritance to FALSE
CREATE_NEW_CONSOLE, // Opens file in a separate console
NULL, // Use parent's environment block
NULL, // Use parent's starting directory
&si, // Pointer to STARTUPINFO structure
&pi // Pointer to PROCESS_INFORMATION structure
);

HANDLE pHandle = pi.hProcess;
DWORD processId = pi.dwProcessId;

ProcessMeta pMeta{ processId, pHandle, 0 };

return pMeta;
}

static ProcessMeta GetProcessIdFromExeName(const char* exeName)
{
DWORD processId = 0;
ProcessMeta pMeta = ProcessMeta{ 0, 0, 0 };
HANDLE hSnapshot = CreateToolhelp32Snapshot(TH32CS_SNAPPROCESS, 0);
if (hSnapshot != INVALID_HANDLE_VALUE)
{
PROCESSENTRY32 processEntry;
processEntry.dwSize = sizeof(PROCESSENTRY32);

if (Process32First(hSnapshot, &processEntry))
{
while (Process32Next(hSnapshot, &processEntry))
{
const char* processExeName = strrchr(processEntry.szExeFile, '\\');
if (processExeName != nullptr)
processExeName++; // Move past the backslash
else
processExeName = processEntry.szExeFile; // No backslash found, use the full name

if (_stricmp(processExeName, exeName) == 0)
{
processId = processEntry.th32ProcessID;
pMeta = ProcessMeta{ processId, hSnapshot, 0 };
break;
}
}
}

CloseHandle(hSnapshot);
}

return pMeta;
}

static HANDLE GetProcessHandle(DWORD processId, DWORD dwDesiredAccess)
{
HANDLE hProcess = OpenProcess(dwDesiredAccess, FALSE, processId);
return hProcess;
}

};
Loading

0 comments on commit 02aceb7

Please sign in to comment.