diff options
author | Michael Smith <mikesmiffy128@gmail.com> | 2024-02-26 22:13:42 +0000 |
---|---|---|
committer | Michael Smith <mikesmiffy128@gmail.com> | 2024-02-26 23:08:38 +0000 |
commit | 21428559de8acaffd6d673c9a43fcccd6c325351 (patch) | |
tree | b0e4a233453ebffd69d4778f7344e3e745a092da /src/wrap.c | |
parent | efd2491a3d19160d9cae2a094e7baa9f2d958196 (diff) |
Remove useless/accidental/duped/leftover codev1.1
Also bump version, for next release (already!).
Would have been nice to just force-push this up and pretend it never
happened but there's already a couple of people with v1.0 binaries, so
let's just avoid any possible confusion.
Diffstat (limited to 'src/wrap.c')
-rw-r--r-- | src/wrap.c | 14 |
1 files changed, 2 insertions, 12 deletions
@@ -97,9 +97,7 @@ _Noreturn void __stdcall WinMainCRTStartup(void) { if (!k32) die(100, L"Couldn't get kernel32 module; everything is on fire!"); void *lladdr = (void *)GetProcAddress(k32, "LoadLibraryW"); int namebytes = (namelen + 1) * sizeof(*name); - int rsize = sizeof("ThreadFixEntryPoint"); - if (namebytes > rsize) rsize = namebytes; - void *rmem = VirtualAllocEx(info.hProcess, 0, rsize, + void *rmem = VirtualAllocEx(info.hProcess, 0, namebytes, MEM_RESERVE | MEM_COMMIT, PAGE_READWRITE); if (!rmem) { TerminateProcess(info.hProcess, -1); @@ -114,7 +112,7 @@ _Noreturn void __stdcall WinMainCRTStartup(void) { } // injectentry will be at the same offset, just a different base void *rfunc = (char *)rdll + ((char *)&injectedentry - (char *)&__ImageBase); - VirtualFreeEx(info.hProcess, rmem, rsize, MEM_RELEASE); + VirtualFreeEx(info.hProcess, rmem, namebytes, MEM_RELEASE); // Fill out the "fake IAT" table and use WPM to copy it to the injected side // of things. See fakeiat.h for more exposition. #define PUTIAT(f) IAT.f = (_iat_##f##_func)GetProcAddress(k32, #f) @@ -122,14 +120,6 @@ _Noreturn void __stdcall WinMainCRTStartup(void) { PUTIAT(FlushInstructionCache); PUTIAT(VirtualProtect); #undef PUTIAT - IAT.GetSystemInfo = (_iat_GetSystemInfo_func)GetProcAddress( - k32, "GetSystemInfo"); - IAT.FlushInstructionCache = (_iat_FlushInstructionCache_func)GetProcAddress( - k32, "FlushInstructionCache"); - IAT.VirtualProtect = (_iat_VirtualProtect_func)GetProcAddress( - k32, "VirtualProtect"); - IAT.FlushInstructionCache = &FlushInstructionCache; - IAT.VirtualProtect = &VirtualProtect; void *riat = (char *)rdll + ((char *)&IAT - (char *)&__ImageBase); WriteProcessMemory(info.hProcess, riat, &IAT, sizeof(IAT), 0); if (!rpc(info.hProcess, rfunc, 0, |