Update memory.cpp

pull/38/head
MisterY52 8 months ago
parent c79f9f2e32
commit 361409e3f9

@ -119,15 +119,32 @@ void Memory::open_proc(const char *name)
printf("Kernel initialized: %p\n", kernel.get()->container.instance.instance); printf("Kernel initialized: %p\n", kernel.get()->container.instance.instance);
} }
if (kernel.get()->process_by_name(name, &proc.hProcess)) ProcessInfo info;
if (kernel.get()->process_info_by_name(name, &info))
{
printf("Can't get process info\n");
return;
}
if (kernel.get()->process_by_info(info, &proc.hProcess))
{ {
status = process_status::NOT_FOUND; status = process_status::NOT_FOUND;
return; return;
} }
ModuleInfo module_info; ModuleInfo module_info;
if (proc.hProcess.module_by_name(name, &module_info))
{
printf("Can't find base module info for process %s. Trying with a new dtb...\n", name);
for (size_t dtb = 0; dtb <= SIZE_MAX; dtb += 0x1000) for (size_t dtb = 0; dtb <= SIZE_MAX; dtb += 0x1000)
{ {
info.dtb1 = dtb;
info.dtb2 = Address_INVALID;
kernel.get()->process_by_info(info, &proc.hProcess);
if (!proc.hProcess.module_by_name(name, &module_info)) if (!proc.hProcess.module_by_name(name, &module_info))
break; break;
@ -137,12 +154,6 @@ void Memory::open_proc(const char *name)
status = process_status::FOUND_NO_ACCESS; status = process_status::FOUND_NO_ACCESS;
return; return;
} }
else
{
if (dtb == 0)
printf("Can't find base module info for process %s. Trying with a new dtb...\n", name);
proc.hProcess.set_dtb(dtb, Address_INVALID);
} }
} }

Loading…
Cancel
Save