MCPcopy Create free account
hub / github.com/Phobos-developers/Phobos / GetSection

Function GetSection

src/Utilities/Patch.cpp:5–21  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

3#include <Phobos.h>
4
5int GetSection(const char* sectionName, void** pVirtualAddress)
6{
7 auto hInstance = Phobos::hInstance;
8 auto pHeader = reinterpret_cast<PIMAGE_NT_HEADERS>(((PIMAGE_DOS_HEADER)hInstance)->e_lfanew + (long)hInstance);
9
10 for (int i = 0; i < pHeader->FileHeader.NumberOfSections; i++)
11 {
12 auto sct_hdr = IMAGE_FIRST_SECTION(pHeader) + i;
13
14 if (strncmp(sectionName, (char*)sct_hdr->Name, 8) == 0)
15 {
16 *pVirtualAddress = (void*)((DWORD)hInstance + sct_hdr->VirtualAddress);
17 return sct_hdr->Misc.VirtualSize;
18 }
19 }
20 return 0;
21}
22
23void Patch::ApplyStatic()
24{

Callers 1

ApplyStaticMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected