EnumProcessModules

2014-04-12 01:14:00

EnumProcessModules

该函数枚举获取一个进程的所有模块(比如DLL,THREAD等等)

函数原型

BOOL EnumProcessModules( 
  HANDLE hProcess,   //要枚举的一个进程句柄
  HMODULE* lphModule, //改进程所包含的模块句柄的数组,我们可以定义一个数组来接收该进程所有的模块句柄
  DWORD cb,       //模块数组的大小,以字节为单位
  LPDWORD lpcbNeeded  //改进程的实际模块数量,以字节为单位
  ); 

同EnumProcesses的计算

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 EnumProcessModules.
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 EnumProcessModules again.
posted @ 2014-04-12 01:23  felove  阅读(938)  评论(0)    收藏  举报