Basic foundation done

This commit is contained in:
Anonymous275
2022-01-19 21:36:52 +02:00
parent 62d5936f71
commit 2b73c120a8
9 changed files with 138 additions and 31 deletions

View File

@@ -1,35 +0,0 @@
///
/// Created by Anonymous275 on 6/17/21
/// Copyright (c) 2021-present Anonymous275 read the LICENSE file for more info.
///
#define WIN32_LEAN_AND_MEAN
#include <string>
#include "Memory.h"
#undef UNICODE
#include <windows.h>
#include <tlhelp32.h>
size_t Memory::GetProcessID(const char* PName) {
SetLastError(0);
PROCESSENTRY32 pe32;
pe32.dwSize = sizeof(PROCESSENTRY32);
HANDLE Snapshot = CreateToolhelp32Snapshot(TH32CS_SNAPPROCESS, 0);
if(Process32First(Snapshot, &pe32)) {
do{
if(std::string(PName) == pe32.szExeFile)break;
}while(Process32Next(Snapshot, &pe32));
}
if(Snapshot != INVALID_HANDLE_VALUE) {
CloseHandle(Snapshot);
}
if(GetLastError() != 0)return 0;
return pe32.th32ProcessID;
}
size_t Memory::GetModuleBase(const char* Name) {
return (size_t)GetModuleHandleA(Name);
}