MCPcopy Create free account
hub / github.com/FEX-Emu/FEX / WriteModuleRVA

Function WriteModuleRVA

Source/Windows/ARM64EC/Module.cpp:182–194  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

180
181template<typename T>
182void WriteModuleRVA(HMODULE Module, LONG RVA, T Data) {
183 if (!RVA) {
184 return;
185 }
186
187 void* Address = reinterpret_cast<void*>(reinterpret_cast<uintptr_t>(Module) + RVA);
188 void* ProtAddress = Address;
189 SIZE_T ProtSize = sizeof(T);
190 ULONG Prot;
191 NtProtectVirtualMemoryNative(NtCurrentProcess(), &ProtAddress, &ProtSize, PAGE_READWRITE, &Prot);
192 *reinterpret_cast<T*>(Address) = Data;
193 NtProtectVirtualMemoryNative(NtCurrentProcess(), &ProtAddress, &ProtSize, Prot, nullptr);
194}
195
196void PatchCallChecker() {
197 // See the comment for CheckCall in Module.S for why this is necessary

Callers 1

PatchCallCheckerFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected