Get details about processes or threads. 
  142{
  144    ULONG                                      ReturnedLength;
 
  146    UINT32                                     SizeOfBufferForThreadsAndProcessDetails     = 
NULL;
 
  147    PVOID                                      Entries                                     = 
NULL;
 
  150 
  151    
  152    
  153    
  155 
  156    
  157    
  158    
  159    if (IsProcess)
  160    {
  161        
  162        
  163        
  165    }
  166    else
  167    {
  168        
  169        
  170        
  172    }
  173 
  174    
  175    
  176    
  178 
  179    if (IsProcess)
  180    {
  181        
  182        
  183        
  185                      SymDetailsForProcessList,
  187    }
  188    else
  189    {
  190        
  191        
  192        
  194                      SymDetailsForThreadList,
  196    }
  197 
  198    
  199    
  200    
  201    Status = DeviceIoControl(
  204                                                           
  205        &QueryCountOfActiveThreadsOrProcessesRequest,      
  207        &QueryCountOfActiveThreadsOrProcessesRequest,      
  209                                                           
  210        &ReturnedLength,                                   
  211        NULL                                               
  212    );
  213 
  214    if (!Status)
  215    {
  216        ShowMessages(
"ioctl failed with code 0x%x\n", GetLastError());
 
  218    }
  219 
  220    
  221    
  222    
  224    {
  225        if (QueryCountOfActiveThreadsOrProcessesRequest.
Count == 0)
 
  226        {
  227            ShowMessages(
"err, unable to get count of active processes or threads\n");
 
  228        }
  229        else
  230        {
  231            
  232            
  233            
  234 
  235            
  236            
  237            
  238            QueryCountOfActiveThreadsOrProcessesRequest.
Count = QueryCountOfActiveThreadsOrProcessesRequest.
Count + 5;
 
  239 
  240            
  241            
  242            
  243            if (IsProcess)
  244            {
  245                SizeOfBufferForThreadsAndProcessDetails =
  247            }
  248            else
  249            {
  250                SizeOfBufferForThreadsAndProcessDetails =
  252            }
  253 
  254            Entries = (PVOID)malloc(SizeOfBufferForThreadsAndProcessDetails);
  255 
  256            RtlZeroMemory(Entries, SizeOfBufferForThreadsAndProcessDetails);
  257 
  258            
  259 
  260            if (IsProcess)
  261            {
  263            }
  264            else
  265            {
  267            }
  268 
  269            
  270            
  271            
  272            Status = DeviceIoControl(
  275                &QueryCountOfActiveThreadsOrProcessesRequest,      
  277                Entries,                                           
  278                SizeOfBufferForThreadsAndProcessDetails,           
  279                &ReturnedLength,                                   
  280                NULL                                               
  281            );
  282 
  283            if (!Status)
  284            {
  285                ShowMessages(
"ioctl failed with code 0x%x\n", GetLastError());
 
  287            }
  288 
  289            if (IsProcess)
  290            {
  292            }
  293            else
  294            {
  296 
  300            }
  301 
  302            
  303            
  304            
  305            for (
size_t i = 0; i < QueryCountOfActiveThreadsOrProcessesRequest.
Count; i++)
 
  306            {
  307                
  308                
  309                
  310                if (IsProcess)
  311                {
  312                    if (ProcessEntries[i].Eprocess != NULL)
  313                    {
  314                        ShowMessages(
"PROCESS\t%llx\n\tProcess Id: %04x\tDirBase (Kernel Cr3): %016llx\tImage: %s\n\n",
 
  315                                     ProcessEntries[i].Eprocess,
  316                                     ProcessEntries[i].ProcessId,
  317                                     ProcessEntries[i].Cr3,
  318                                     ProcessEntries[i].ImageFileName);
  319                    }
  320                }
  321                else
  322                {
  323                    if (ThreadEntries[i].Ethread != NULL)
  324                    {
  326                                     ThreadEntries[i].Ethread,
  327                                     ThreadEntries[i].ProcessId,
  328                                     ThreadEntries[i].ThreadId);
  329                    }
  330                }
  331            }
  332        }
  333 
  334        
  335        
  336        
  338    }
  339    else
  340    {
  343    }
  344 
  345    
  346    
  347    
  349}
unsigned int UINT32
Definition BasicTypes.h:48
#define IOCTL_GET_LIST_OF_THREADS_AND_PROCESSES
ioctl, to get list threads/processes
Definition Ioctls.h:254
#define IOCTL_QUERY_COUNT_OF_ACTIVE_PROCESSES_OR_THREADS
ioctl, query count of active threads or processes
Definition Ioctls.h:247
@ DEBUGGER_QUERY_ACTIVE_PROCESSES_OR_THREADS_QUERY_THREAD_COUNT
Definition RequestStructures.h:658
@ DEBUGGER_QUERY_ACTIVE_PROCESSES_OR_THREADS_QUERY_PROCESS_LIST
Definition RequestStructures.h:659
@ DEBUGGER_QUERY_ACTIVE_PROCESSES_OR_THREADS_QUERY_THREAD_LIST
Definition RequestStructures.h:660
@ DEBUGGER_QUERY_ACTIVE_PROCESSES_OR_THREADS_QUERY_PROCESS_COUNT
Definition RequestStructures.h:657
struct _DEBUGGEE_PROCESS_LIST_DETAILS_ENTRY * PDEBUGGEE_PROCESS_LIST_DETAILS_ENTRY
struct _DEBUGGEE_PROCESS_LIST_DETAILS_ENTRY DEBUGGEE_PROCESS_LIST_DETAILS_ENTRY
The structure showing list of processes (details of each entry)
struct _DEBUGGEE_THREAD_LIST_DETAILS_ENTRY DEBUGGEE_THREAD_LIST_DETAILS_ENTRY
The structure showing list of threads (details of each entry)
#define SIZEOF_DEBUGGER_QUERY_ACTIVE_PROCESSES_OR_THREADS
Definition RequestStructures.h:648
struct _DEBUGGEE_THREAD_LIST_DETAILS_ENTRY * PDEBUGGEE_THREAD_LIST_DETAILS_ENTRY
@ DEBUGGER_QUERY_ACTIVE_PROCESSES_OR_THREADS_ACTION_QUERY_COUNT
Definition RequestStructures.h:673
NULL()
Definition test-case-generator.py:530
The structure showing list of processes (details of each entry)
Definition RequestStructures.h:714
The structure of needed information to get the details of the process from nt!_EPROCESS and location ...
Definition RequestStructures.h:684
The structure showing list of threads (details of each entry)
Definition RequestStructures.h:728
UCHAR ImageFileName[15+1]
Definition RequestStructures.h:733
UINT64 Eprocess
Definition RequestStructures.h:729
The structure of needed information to get the details of the thread from nt!_ETHREAD and location of...
Definition RequestStructures.h:698
request for query count of active processes and threads
Definition RequestStructures.h:742
UINT32 Count
Definition RequestStructures.h:747
DEBUGGER_QUERY_ACTIVE_PROCESSES_OR_THREADS_TYPES QueryType
Definition RequestStructures.h:745
DEBUGGEE_THREAD_LIST_NEEDED_DETAILS ThreadListNeededDetails
Definition RequestStructures.h:744
UINT64 Result
Definition RequestStructures.h:748
DEBUGGER_QUERY_ACTIVE_PROCESSES_OR_THREADS_ACTIONS QueryAction
Definition RequestStructures.h:746
DEBUGGEE_PROCESS_LIST_NEEDED_DETAILS ProcessListNeededDetails
Definition RequestStructures.h:743