MCPcopy Create free account
hub / github.com/NullTerminatorr/NullHook / get_process_id

Function get_process_id

KernelCheatUM/main.cpp:53–71  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

51using unique_handle = std::unique_ptr<HANDLE, HandleDisposer>;
52
53std::uint32_t get_process_id(std::string_view process_name)
54{
55 PROCESSENTRY32 processentry;
56 const unique_handle snapshot_handle(CreateToolhelp32Snapshot(TH32CS_SNAPPROCESS, NULL));
57
58 if (snapshot_handle.get() == INVALID_HANDLE_VALUE)
59 return NULL;
60
61 processentry.dwSize = sizeof(MODULEENTRY32);
62
63 while (Process32Next(snapshot_handle.get(), &processentry) == TRUE)
64 {
65 if (process_name.compare(processentry.szExeFile) == NULL)
66 {
67 return processentry.th32ProcessID;
68 }
69 }
70 return NULL;
71}
72
73static ULONG64 get_module_base_address(const char* module_name)
74{

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected