MCPcopy Create free account
hub / github.com/DarthTon/Xenos / LoadConfig

Method LoadConfig

src/Routines.cpp:8–79  ·  view source on GitHub ↗

Load configuration from file Error code

Source from the content-addressed store, hash-verified

6/// </summary>
7/// <returns>Error code</returns>
8DWORD MainDlg::LoadConfig( const std::wstring& path /*= L""*/ )
9{
10 auto& cfg = _profileMgr.config();
11 if (_profileMgr.Load( path ))
12 {
13 // Image
14 for (auto& path : cfg.images)
15 LoadImageFile( path );
16
17 // Process
18 if (!cfg.procName.empty())
19 {
20 if (cfg.processMode != Existing)
21 {
22 SetActiveProcess( 0, cfg.procName );
23 }
24 else
25 {
26 std::vector<DWORD> pidList = blackbone::Process::EnumByName( cfg.procName );
27 if (!pidList.empty())
28 {
29 cfg.pid = pidList.front();
30
31 auto idx = _procList.Add( cfg.procName + L" (" + std::to_wstring( pidList.front() ) + L")", pidList.front() );
32 _procList.selection( idx );
33
34 SetActiveProcess( pidList.front(), cfg.procName );
35 }
36 }
37 }
38
39 // Process mode
40 _exProc.checked( false );
41 _newProc.checked( false );
42 _autoProc.checked( false );
43 switch (cfg.processMode)
44 {
45 case Existing:
46 _exProc.checked( true );
47 break;
48 case NewProcess:
49 _newProc.checked( true );
50 break;
51 case ManualLaunch:
52 _autoProc.checked( true );
53 break;
54 }
55
56 // Fix injection method
57 if (cfg.injectMode >= Kernel_Thread)
58 {
59 DriverExtract::Instance().Extract();
60 if (!NT_SUCCESS( blackbone::Driver().EnsureLoaded() ))
61 {
62 DriverExtract::Instance().Cleanup();
63 cfg.injectMode = Normal;
64 }
65 }

Callers

nothing calls this directly

Calls 7

LoadMethod · 0.80
AddMethod · 0.80
checkedMethod · 0.80
ExtractMethod · 0.80
CleanupMethod · 0.80
SetTextMethod · 0.80
selectionMethod · 0.45

Tested by

no test coverage detected