RtEnumProcessModules

The RtEnumProcessModules function retrieves a handle for each module in a specified RTSS process.

NOTE: This function is only supported in the RTSS environment. It cannot be called from a Windows application linked to RTX64.

Syntax

BOOL RtEnumProcessModules(
    HANDLE hProcess,
    HMODULE *lphModule,
    DWORD cb,
    LPDWORD lpcbNeeded,
);

Parameters

hProcess

A handle to the RTSS process.

lphModule

An array that receives the list of module handles.

cb

The size of lphModule array, in bytes.

lpcbNeeded

The number of bytes required to store all module handles in the lphModule array.

Return Value

Returns TRUE if the function succeeds, FALSE if the function fails.

To get extended error information, call GetLastError.

Remarks

The RtEnumProcessModules function is primarily designed for use by debuggers and similar applications that must extract module information from another process. If the module list in the target process is corrupted or not yet initialized, or if the module list changes during the function call as a result of RTDLLs being loaded or unloaded, RtEnumProcessModules may fail or return incorrect information.

It is a good idea to specify a large array of HMODULE values, because it is hard to predict how many modules there will be in the process at the time you call RtEnumProcessModules. To determine if the lphModule array is too small to hold all module handles for the process, compare the value returned in lpcbNeeded with the value specified in cb. If lpcbNeeded is greater than cb, increase the size of the array and call RtEnumProcessModules again.

To determine how many modules were enumerated by the call to RtEnumProcessModules, divide the resulting value in the lpcbNeeded parameter by sizeof(HMODULE).

Do not call RtCloseHandle on any of the handles returned by this function. The information comes from a snapshot, so there are no resources to be freed.

Requirements

Minimum Supported Version RTX64 2013
Header Rtapi.h
Library Rtx_Rtss.lib