Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Hello can you provide a list of multi-process traversal enumerated KVM #34

Closed
JIUYUE521 opened this issue Dec 27, 2023 · 0 comments
Closed

Comments

@JIUYUE521
Copy link

I need to enumerate more process PID's under Linux
Hope to get your help!

void Memory::open_procc(const wchar_t* name)
{
PROCESSENTRY32 entry;
entry.dwSize = sizeof(PROCESSENTRY32);
HANDLE snapshot = CreateToolhelp32Snapshot(TH32CS_SNAPPROCESS, NULL);

if (Process32First(snapshot, &entry) == TRUE)
{
	while (Process32Next(snapshot, &entry) == TRUE)
	{
		if (wcscmp(entry.szExeFile, name) == 0)
		{
			if (proc.hProcess <= 0)
			{
				proc.hProcess = OpenProcess(PROCESS_ALL_ACCESS, FALSE, entry.th32ProcessID);

				if (proc.hProcess > 0)
				{
					proc.baseaddr = GetModuleBaseAddress(entry.th32ProcessID, name);

					if (proc.baseaddr)
					{
						status = process_status::FOUND_READY;
						proc.pid = entry.th32ProcessID;
					}
					else
					{
						status = process_status::FOUND_NO_ACCESS;
						close_proc();
					}
				}
				else
				{
					status = process_status::FOUND_NO_ACCESS;
					close_proc();
				}
			}

			CloseHandle(snapshot);
			return;
		}
	}
}

status = process_status::NOT_FOUND;
close_proc();

CloseHandle(snapshot);

}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant