Update memory.cpp

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

@ -119,30 +119,41 @@ 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;
for (size_t dtb = 0; dtb <= SIZE_MAX; dtb += 0x1000)
if (proc.hProcess.module_by_name(name, &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);
break;
if (dtb == SIZE_MAX) for (size_t dtb = 0; dtb <= SIZE_MAX; dtb += 0x1000)
{ {
printf("Access error for process %s\n", name); info.dtb1 = dtb;
status = process_status::FOUND_NO_ACCESS; info.dtb2 = Address_INVALID;
return; kernel.get()->process_by_info(info, &proc.hProcess);
}
else if (!proc.hProcess.module_by_name(name, &module_info))
{ break;
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); if (dtb == SIZE_MAX)
{
printf("Access error for process %s\n", name);
status = process_status::FOUND_NO_ACCESS;
return;
}
} }
} }

Loading…
Cancel
Save