1
0
mirror of synced 2024-11-23 22:51:02 +01:00

Fuck ASLR, patches working on windows

This commit is contained in:
BroGamer 2022-06-22 09:49:26 +12:00
parent 80f57678aa
commit 3b0d9764bf
3 changed files with 22 additions and 24 deletions

View File

@ -1,25 +1,19 @@
#define BASE_ADDRESS 0x140000000
#include "helpers.h"
HOOK (i32, __stdcall, CrtMain, 0x140666d2c, HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, i32 nShowCmd) {
// Blatantly stolen patches from mon.im
WRITE_MEMORY (0x1400239C0, u8, 0xC3); // Stop error
WRITE_MEMORY (0x140314E8D, u8, 0xB0, 0x01); // Unlock songs
WRITE_MEMORY (0x140692E17, u8, 0xEB); // Shared audio
WRITE_MEMORY (0x140313726, u8, 0x00, 0x7F); // Remove song limit
WRITE_MEMORY (0x140517339, u8, 0xBA, 0x00, 0x00, 0x00, 0x00,
0x90); // Disable VSync
// Save settings cross session
WRITE_MEMORY (0x140B5C528, u8, "./Setting1.bin");
WRITE_MEMORY (0x140B5C538, u8, "./Setting2.bin");
return originalCrtMain (hInstance, hPrevInstance, lpCmdLine, nShowCmd);
}
i32 __stdcall DllMain (HMODULE mod, DWORD cause, void *ctx) {
if (cause != DLL_PROCESS_ATTACH)
return 1;
INSTALL_HOOK(CrtMain);
if (cause != DLL_PROCESS_ATTACH)
return 1;
WRITE_MEMORY (ASLR(0x1400239C0), u8, 0xC3); // Stop error
WRITE_MEMORY (ASLR(0x140314E8D), u8, 0xB0, 0x01); // Unlock songs
WRITE_MEMORY (ASLR(0x140692E17), u8, 0xEB); // Shared audio
WRITE_MEMORY (ASLR(0x140313726), u8, 0x00, 0x7F); // Remove song limit
WRITE_MEMORY (ASLR(0x140517339), u8, 0xBA, 0x00, 0x00, 0x00, 0x00,
0x90); // Disable VSync
// Save settings cross session
WRITE_MEMORY (ASLR(0x140B5C528), u8, "./Setting1.bin");
WRITE_MEMORY (ASLR(0x140B5C538), u8, "./Setting2.bin");
return 1;
return 1;
}

View File

@ -110,7 +110,7 @@ i32 __stdcall DllMain (HMODULE mod, DWORD cause, void *ctx) {
if (cause != DLL_PROCESS_ATTACH) return true;
init_boilerplate ();
// Set current directory to the directory of the executable
// Find all files in the plugins directory that end with .dll
// Call loadlibraryA on those files
@ -126,9 +126,9 @@ i32 __stdcall DllMain (HMODULE mod, DWORD cause, void *ctx) {
do {
if (fd.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) continue;
wchar_t filePath[MAX_PATH];
wcscpy(filePath, path);
wcscat(filePath, L"/plugins/");
wcscat(filePath, fd.cFileName);
wcscpy (filePath, path);
wcscat (filePath, L"/plugins/");
wcscat (filePath, fd.cFileName);
HMODULE hModule = LoadLibraryW (filePath);
if (!hModule) { MessageBoxW (NULL, L"Failed to load plugin", fd.cFileName, MB_ICONERROR); }
} while (FindNextFileW (hFind, &fd));

View File

@ -15,6 +15,10 @@ typedef uint16_t u16;
typedef uint32_t u32;
typedef uint64_t u64;
#ifdef BASE_ADDRESS
#define ASLR(address) ((u64)GetModuleHandle (0) + (u64)address - (u64)BASE_ADDRESS)
#endif
#define FUNCTION_PTR(returnType, callingConvention, function, location, ...) \
returnType (callingConvention *function) (__VA_ARGS__) = (returnType (callingConvention *) (__VA_ARGS__)) (location)