| 43 | } |
| 44 | |
| 45 | bool ProfileMgr::Load( const std::wstring& path /*= L""*/ ) |
| 46 | { |
| 47 | try |
| 48 | { |
| 49 | auto filepath = path.empty() ? (blackbone::Utils::GetExeDirectory() + CURRENT_PROFILE) : path; |
| 50 | if (!acut::file_exists( filepath )) |
| 51 | return false; |
| 52 | |
| 53 | acut::XmlDoc<wchar_t> xml; |
| 54 | xml.read_from_file( filepath ); |
| 55 | |
| 56 | // Load images in a safe way |
| 57 | if(xml.has( L"XenosConfig.imagePath" )) |
| 58 | { |
| 59 | auto nodes = xml.all_nodes_named( L"XenosConfig.imagePath" ); |
| 60 | for (auto& node : nodes) |
| 61 | _config.images.emplace_back( node.value() ); |
| 62 | } |
| 63 | |
| 64 | xml.get_if_present( L"XenosConfig.manualMapFlags", _config.mmapFlags ); |
| 65 | xml.get_if_present( L"XenosConfig.procName", _config.procName ); |
| 66 | xml.get_if_present( L"XenosConfig.hijack", _config.hijack ); |
| 67 | xml.get_if_present( L"XenosConfig.unlink", _config.unlink ); |
| 68 | xml.get_if_present( L"XenosConfig.erasePE", _config.erasePE ); |
| 69 | xml.get_if_present( L"XenosConfig.close", _config.close ); |
| 70 | xml.get_if_present( L"XenosConfig.krnHandle", _config.krnHandle ); |
| 71 | xml.get_if_present( L"XenosConfig.injIndef", _config.injIndef ); |
| 72 | xml.get_if_present( L"XenosConfig.processMode", _config.processMode ); |
| 73 | xml.get_if_present( L"XenosConfig.injectMode", _config.injectMode ); |
| 74 | xml.get_if_present( L"XenosConfig.delay", _config.delay ); |
| 75 | xml.get_if_present( L"XenosConfig.period", _config.period ); |
| 76 | xml.get_if_present( L"XenosConfig.skip", _config.skipProc ); |
| 77 | xml.get_if_present( L"XenosConfig.procCmdLine", _config.procCmdLine ); |
| 78 | xml.get_if_present( L"XenosConfig.initRoutine", _config.initRoutine ); |
| 79 | xml.get_if_present( L"XenosConfig.initArgs", _config.initArgs ); |
| 80 | |
| 81 | return true; |
| 82 | } |
| 83 | catch (const std::runtime_error&) |
| 84 | { |
| 85 | return false; |
| 86 | } |
| 87 | } |
no test coverage detected