Download Source Code

CTaskList Class Reference

Enumerates running processes. More...

#include <TaskList.h>

Collaboration diagram for CTaskList:

Collaboration graph
[legend]
List of all members.

Public Member Functions

BOOL GetToolhelpInfo (DWORD dwPid, LPTASKINFO pti, BOOL bSubs)
 Retreives task information using toolhelp.
BOOL EnumProcToolhelp ()
 Begins task enumeration using Toolhelp.
BOOL GetTaskInfo (DWORD dwPid, LPTASKINFO pti, BOOL bSubs)
 Retreives task information.
BOOL GetPsapiInfo (DWORD dwPid, LPTASKINFO pti, BOOL bSubs)
 Retreives task info using PSAPI.
BOOL EnumProcPsapi ()
 Enumerates running tasks using Psapi.
BOOL EnumProcesses (DWORD mode=AUTO, BOOL bVdmdbg=TRUE)
 Enumerates tasks.
BOOL EnumModules (LPTASKINFO pti)
 Enumerates sub items in specified task.
LPTASKINFO FindTask (LPCTSTR pFile, LPCTSTR pName)
 Finds a task by specified information.
virtual DWORD GetObjSize ()
 Return size of TASKINFO structure.
 CTaskList ()
 Constructor.
virtual ~CTaskList ()
 Destructor.
BOOL Init (DWORD mode, BOOL bVdmdbg)
 Initialize structure.
CTaskGetTasks ()
 Returns pointer to task list.
DWORD GetNumTasks ()
 Returns total number of running tasks at time of capture.
LPTASKINFO FindByPid (HMODULE hModule)
 Searches for task information based on process ID.
void Destroy ()
 Releases the task list information.
BOOL IsPsapi ()
 Returns non-zero if PSAPI library is loaded.
BOOL IsToolhelp ()
 Returns non-zero if Toolhelp API is loaded.
BOOL IsVdmdbg ()
 Returns non-zero if 16-bit process helper API is loaded.
LPCTSTR GetLastError ()
 Returns a pointer to a string describing the last error.

Static Public Member Functions

static void * GetPreferredBase (DWORD dwPid, void *pModule)
 Gets the preferred base for a module.
static BOOL CALLBACK Enum16Proc (DWORD dwThreadId, WORD hMod16, WORD hTask16, LPSTR pszModName, LPSTR pszFileName, LPARAM lpUserDefined)
 Callback for 16-bit process enumeration.

Detailed Description

Enumerates running processes.

Use this class to retreive information on running processes.


Member Function Documentation

BOOL CALLBACK CTaskList::Enum16Proc DWORD  dwThreadId,
WORD  hMod16,
WORD  hTask16,
LPSTR  pszModName,
LPSTR  pszFileName,
LPARAM  lpUserDefined
[static]
 

Callback for 16-bit process enumeration.

Parameters:
[in] dwThreadId - Thread ID
[in] hMod16 - Module Handle
[in] hTask16 - Task handle
[in] pszModName - Module name
[in] pszFileName - Module filename
[in] lpUserDefined - User defined data value
Returns:
Non-zero to continue enumeration
See also:

BOOL CTaskList::EnumModules LPTASKINFO  pti  )  [inline]
 

Enumerates sub items in specified task.

Parameters:
[in] pti - Task item information structure
Returns:
Non-zero if success
See also:

BOOL CTaskList::EnumProcesses DWORD  mode = AUTO,
BOOL  bVdmdbg = TRUE
 

Enumerates tasks.

Parameters:
[in] mode - Specify what API should be used
[in] bVdmdbg - Enable 16-bit process helper
Returns:
Non-zero if success
See also:

BOOL CTaskList::EnumProcPsapi  ) 
 

Enumerates running tasks using Psapi.

Returns:
Non-zero if success
See also:

BOOL CTaskList::EnumProcToolhelp  ) 
 

Begins task enumeration using Toolhelp.

Returns:
Non-zero if success
See also:

LPTASKINFO CTaskList::FindByPid HMODULE  hModule  ) 
 

Searches for task information based on process ID.

Parameters:
[in] hModule - Handle to module
Returns:
Pointer to task information structure if found, otherwise NULL
See also:

LPTASKINFO CTaskList::FindTask LPCTSTR  pFile,
LPCTSTR  pName
 

Finds a task by specified information.

Parameters:
[in] pFile - Filename of task to find
[in] pName - Name of task to find
Wild cards are permited, such as "Vx*.dll"

Returns:
Pointer to task info structure if found, otherwise NULL
See also:

void * CTaskList::GetPreferredBase DWORD  dwPid,
void *  pModule
[static]
 

Gets the preferred base for a module.

Parameters:
[in] dwPid - Process ID
[in] pModule - Address in module
Returns:
Pointer to preferred base address
See also:

BOOL CTaskList::GetPsapiInfo DWORD  dwPid,
LPTASKINFO  pti,
BOOL  bSubs
 

Retreives task info using PSAPI.

Parameters:
[in] dwPid - Process ID
[in] pti - Receives task information
[in] bSubs - Non-zero to enumerate sub tasks
Returns:
Non-zero if success
See also:

BOOL CTaskList::GetTaskInfo DWORD  dwPid,
LPTASKINFO  pti,
BOOL  bSubs
 

Retreives task information.

Parameters:
[in] dwPid - Process ID
[in] pti - Receives task information
[in] bSubs - Non-zero to enumerate sub tasks
Returns:
Non-zero if success
See also:

BOOL CTaskList::GetToolhelpInfo DWORD  dwPid,
LPTASKINFO  pti,
BOOL  bSubs
 

Retreives task information using toolhelp.

Parameters:
[in] dwPid - Process ID
[in] pti - Receives task information
[in] bSubs - Non-zero to retreive information on sub tasks
Returns:
Non-zero if success
See also:

BOOL CTaskList::Init DWORD  mode,
BOOL  bVdmdbg
 

Initialize structure.

Parameters:
[in] mode - Specify what API should be used
[in] bVdmdbg - Enable 16-bit process helper
Returns:
Non-zero if success
See also:


The documentation for this class was generated from the following files:
  • inc/TaskList.h
  • TaskList.cpp
Copyright Robert Umbehant
This documentation is covered by the LGPL