MCPcopy Create free account
hub / github.com/BeneficialCode/WinArk / CheckEATHook

Method CheckEATHook

WinArk/ProcessATHookTable.cpp:195–233  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

193}
194
195void CProcessATHookTable::CheckEATHook(const std::shared_ptr<WinSys::ModuleInfo>& m) {
196 PEParser parser(m->Path.c_str());
197 if (!parser.HasExports())
198 return;
199 std::vector<ExportedSymbol> exports = parser.GetExports();
200 void* eat = (byte*)m->Base + parser.GetEAT();
201 SIZE_T size = 0;
202 size = exports.size() * sizeof(DWORD);
203 void* buffer = malloc(size);
204 if (!buffer)
205 return;
206 bool ok = ReadProcessMemory(m_hProcess, eat, buffer, size, &size);
207 if (ok) {
208 PULONG pAddr = (PULONG)buffer;
209 int idx = 0;
210 for (auto& item : exports) {
211 DWORD address = *pAddr;
212 if (address != item.Address) {
213 EATHookInfo info;
214 info.TargetAddress = (ULONG_PTR)m->Base + address;
215 info.Address = item.Address + (ULONG_PTR)m->Base;
216 CString addr;
217 addr.Format(L"0x%p", (ULONG_PTR)eat + idx * 4);
218 info.Name = m->Name;
219 info.Name += L"_" + addr;
220 info.Type = ATHookType::EAT;
221 auto m = GetModuleByAddress(info.TargetAddress);
222 if (m != nullptr) {
223 info.TargetModule = m->Path;
224 }
225 m_Table.data.info.push_back(info);
226 }
227 idx++;
228 pAddr++;
229 }
230 }
231 free(buffer);
232 buffer = nullptr;
233}
234
235std::shared_ptr<WinSys::ModuleInfo> CProcessATHookTable::GetModuleByName(std::wstring name) {
236 for (auto m : m_Modules) {

Callers

nothing calls this directly

Calls 5

GetExportsMethod · 0.80
GetEATMethod · 0.80
push_backMethod · 0.80
HasExportsMethod · 0.45
sizeMethod · 0.45

Tested by

no test coverage detected