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

Function module_has_syhks00

src/Utilities/AresHelper.cpp:29–50  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

27#endif
28
29bool module_has_syhks00(HMODULE hModule)
30{
31 auto* baseAddress = reinterpret_cast<unsigned char*>(hModule);
32
33 auto* dosHeader = reinterpret_cast<IMAGE_DOS_HEADER*>(baseAddress);
34 if (dosHeader->e_magic != IMAGE_DOS_SIGNATURE)
35 return false;
36
37 auto* ntHeaders = reinterpret_cast<IMAGE_NT_HEADERS*>(baseAddress + dosHeader->e_lfanew);
38 if (ntHeaders->Signature != IMAGE_NT_SIGNATURE)
39 return false;
40
41 auto* sectionHeader = IMAGE_FIRST_SECTION(ntHeaders);
42
43 for (int i = 0; i < ntHeaders->FileHeader.NumberOfSections; ++i, ++sectionHeader)
44 {
45 if (strncmp(reinterpret_cast<const char*>(sectionHeader->Name), ".syhks00", IMAGE_SIZEOF_SHORT_NAME) == 0)
46 return true;
47 }
48
49 return false;
50}
51
52void AresHelper::GetGameModulesBaseAddresses()
53{

Callers 1

Calls

no outgoing calls

Tested by

no test coverage detected