函数参考


_WinAPI_EnumProcessModules

Retrieves a handle and name for each module in the specified process.

#Include <WinAPIEx.au3>
_WinAPI_EnumProcessModules ( [$PID [, $iFlag]] )

参数

$PID [可选参数] The PID of the process. Default (0) is the current process.
$iFlag [可选参数] The filter criteria. This parameter is valid only for Windows Vista and later, and can be one of the
following values.

$LIST_MODULES_32BIT
$LIST_MODULES_64BIT
$LIST_MODULES_ALL
$LIST_MODULES_DEFAULT

返回值

Success The 2D array containing the following information:
[0][0] Number of rows in array (n)
[0][1] Unused
[n][0] Handle to the module.
[n][1] The path to the file that contains the module.
失败: 返回 0 并设置 @error 标志为非 0 值.

注意/说明

This function does not retrieve handles for modules that were loaded with the $LOAD_LIBRARY_AS_DATAFILE flag.
For more information, see _WinAPI_LoadLibraryEx().

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

相关

详情参考

在MSDN中搜索


示例/演示


#Include <Array.au3>
#Include <WinAPIEx.au3>

Opt('MustDeclareVars', 1)

If (_WinAPI_GetVersion() < '6.0') And (@AutoItX64) Then
    MsgBox(16, 'Error', 'This example works from a 64-bit system only in Windows Vista or later.')
    Exit
EndIf

Global $Data = _WinAPI_EnumProcessModules()

_ArrayDisplay($Data, '_WinAPI_EnumProcessModules')