| 11 | |
| 12 | |
| 13 | InjectionCore::~InjectionCore() |
| 14 | { |
| 15 | // |
| 16 | // If at least one process with allocated physical pages exist, prevent driver unload or process will crash |
| 17 | // Although PID can be reused, I'm too lazy to implement more reliable detection |
| 18 | // |
| 19 | std::vector<DWORD> existing = blackbone::Process::EnumByName( L"" ), mutual; |
| 20 | std::sort( existing.begin(), existing.end() ); |
| 21 | std::sort( _criticalProcList.begin(), _criticalProcList.end() ); |
| 22 | std::set_intersection( existing.begin(), existing.end(), _criticalProcList.begin(), _criticalProcList.end(), std::back_inserter( mutual ) ); |
| 23 | if (mutual.empty()) |
| 24 | blackbone::Driver().Unload(); |
| 25 | } |
| 26 | |
| 27 | |
| 28 | /// <summary> |