Description
Enumerates processes on a system and calls a callback function for each process found.Function Signature
Parameters
The callback function that will receive the current process in the enumeration and an extra argument. This function should return
LM_TRUE to continue the enumeration, or LM_FALSE to stop it.Callback Signature:The user-defined data structure that will be passed to the callback function along with the
lm_process_t structure. This allows you to pass additional context or data to your callback without using global variables.Return Value
Returns
LM_TRUE on success, or LM_FALSE on failure.Process Structure
The callback receives a pointer tolm_process_t with the following fields:
Example
Basic Process Enumeration
Find Specific Process
Count Processes
Notes
- The callback function is called for each running process on the system
- Return
LM_FALSEfrom the callback to stop the enumeration early - The
argparameter allows passing custom data to your callback without globals - On some systems, you may need elevated privileges to enumerate all processes
- The process information in the callback is only valid during the callback execution
See Also
- LM_FindProcess - Find a specific process by name
- LM_GetProcess - Get information about the current process
- LM_IsProcessAlive - Check if a process is alive