Initial refactoring (WARNING: largely untested)

This commit is contained in:
nastys
2021-09-18 19:45:08 +02:00
parent ecf9b62298
commit d62855c69a
24 changed files with 1096 additions and 689 deletions
+11 -1
View File
@@ -1,6 +1,16 @@
#include <windows.h>
#include <string>
void InjectCode(void* address, const std::vector<uint8_t> data)
{
const size_t byteCount = data.size() * sizeof(uint8_t);
DWORD oldProtect;
VirtualProtect(address, byteCount, PAGE_EXECUTE_READWRITE, &oldProtect);
memcpy(address, data.data(), byteCount);
VirtualProtect(address, byteCount, oldProtect, nullptr);
}
std::wstring ExePath() {
WCHAR buffer[MAX_PATH];
GetModuleFileNameW(NULL, buffer, MAX_PATH);
@@ -13,5 +23,5 @@ std::wstring DirPath() {
return exepath.substr(0, pos);
}
std::wstring CONFIG_FILE_STRING = DirPath() + L"\\plugins\\DivaWig.ini";
std::wstring CONFIG_FILE_STRING = DirPath() + L"\\plugins\\CustoMixer.ini";
LPCWSTR CONFIG_FILE = CONFIG_FILE_STRING.c_str();