| 51 | using unique_handle = std::unique_ptr<HANDLE, HandleDisposer>; |
| 52 | |
| 53 | std::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 | |
| 73 | static ULONG64 get_module_base_address(const char* module_name) |
| 74 | { |
nothing calls this directly
no outgoing calls
no test coverage detected