MCPcopy Create free account
hub / github.com/Vector35/debugger / GetProcessList

Method GetProcessList

core/adapters/dbgengadapter.cpp:658–706  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

656}
657
658std::vector<DebugProcess> DbgEngAdapter::GetProcessList()
659{
660 // we need to start dbgserver in order to get process list
661
662 if (!m_debugActive)
663 {
664 if (!Start())
665 return {};
666 }
667
668 ULONG Count = 0;
669 if (m_debugClient->GetRunningProcessSystemIds(m_server, 0, 0, &Count) != S_OK)
670 {
671 LogError("Failed to get system process count.");
672 return {};
673 }
674
675 auto procIds = std::make_unique<unsigned long[]>(Count);
676 if (m_debugClient->GetRunningProcessSystemIds(m_server, procIds.get(), Count, &Count) != S_OK)
677 {
678 LogError("Failed to get system process ids.");
679 return {};
680 }
681
682 std::vector<DebugProcess> debug_processes {};
683 for (int i = 0; i < Count; i++)
684 {
685 char processName[MAX_PATH];
686 ZeroMemory(processName, MAX_PATH);
687
688 if (m_debugClient->GetRunningProcessDescription(
689 m_server,
690 procIds[i],
691 DEBUG_PROC_DESC_DEFAULT,
692 processName,
693 sizeof(processName),
694 NULL,
695 NULL,
696 0,
697 NULL) != S_OK)
698 {
699 strcpy_s(processName, MAX_PATH, "<could not get process name>");
700 }
701
702 debug_processes.emplace_back(procIds[i], processName);
703 }
704
705 return debug_processes;
706}
707
708std::vector<DebugThread> DbgEngAdapter::GetThreadList()
709{

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected