8 if (hProcess ==
nullptr) {
11 const char err_msg[] =
"Could not enumerate modules. ";
14 if (!EnumProcessModulesEx(hProcess, hMods, hModsMax, &cbNeeded, filters)) {
15 throw std::runtime_error(err_msg);
23 if (!EnumProcessModules(hProcess, hMods, hModsMax, &cbNeeded)) {
24 throw std::runtime_error(err_msg);
28 const size_t modules_count = cbNeeded /
sizeof(HMODULE);