术语 | enumprocessmodulesex |
释义 | EnumProcessModulesEx 语法: C++ BOOL WINAPI EnumProcessModulesEx( __in HANDLE hProcess, __out HMODULE *lphModule, __in DWORD cb, __out LPDWORD lpcbNeeded, __in DWORD dwFilterFlag ); EnumProcessModulesEx功能 检索处理的每个指定的进程,以满足指定筛选条件的模块。 参数 hProcess [in] 句柄的进程。 lphModule [out] 数组接收模块列表的句柄。 文件 [in] 该lphModule数组的大小,以字节为单位。 lpcbNeeded [out] 所需的所有模块存储字节数在lphModule句柄数组。 dwFilterFlag [in] 筛选条件。此参数可以是下列值之一。 ValueMeaning LIST_MODULES_32BIT 0x01List 32位模块。 LIST_MODULES_64BIT 0x02List 64位模块。 LIST_MODULES_ALL 0x03List所有模块。 LIST_MODULES_DEFAULT 0x0Use默认的行为。 返回值 如果函数成功,返回值为非零。 如果函数失败,返回值是零。为了获得更多错误信息,调用GetLastError。 备注 该EnumProcessModulesEx功能主要是用来通过调试器和类似的应用程序必须提取从另一个进程模块信息的使用。如果在目标进程模块列表已损坏或尚未初始化,或者如果在作为结果的DLL函数调用模块列表的变化被加载或卸载,EnumProcessModulesEx可能失败或返回不正确的信息。 这个功能主要是为64位应用程序。如果函数是由32位应用程序在WOW64下运行调用,dwFilterFlag选项被忽略,功能可作为EnumProcessModules功能相同的结果。 这是一个好主意,指定一个HMODULE价值较大的数组,因为它是难以预料的模块,有多少在这个过程中会在您通话时EnumProcessModulesEx。要确定是否lphModule数组太小,不能容纳所有模块的进程处理,比较在文件中指定的值lpcbNeeded返回的值。如果lpcbNeeded大于文件,增加数组的大小,并呼吁EnumProcessModulesEx了。 为了确定有多少模块被调用到EnumProcessModulesEx列举,在分裂的sizeof(HMODULE)lpcbNeeded参数得到的值。 该EnumProcessModulesEx功能不检索处理对那些与LOAD_LIBRARY_AS_DATAFILE标志加载的模块。有关更多信息,请参阅LoadLibraryEx。 不要要求任何CloseHandle的处理这个函数返回。这些信息来自一个快照,所以没有被释放的资源。 采取的具体过程和堆,模块快照,这些进程使用的线程,使用CreateToolhelp32Snapshot函数。 与PSAPI版本的Windows 7和Windows Server 2008 R2的2起,这个函数被定义为K32EnumProcessModulesEx在Psapi.h和Kernel32.lib和Kernel32.dll出口。但是,您应该始终作为EnumProcessModulesEx调用这个函数。为了确保对程序将运行在Windows的早期版本的符号的正确决议,添加Psapi.lib到TARGETLIBS宏和编译程序与- DPSAPI_VERSION = 1。 要求: client最低支持Vista server最低支持 Windows Server 2008 HeaderPsapi.h(头文件:winuser.h) LibraryKernel32.lib在Windows 7和Windows Server 2008 R2的Psapi.lib在Windows Server 2008,Windows Vista中的Windows Server 2003,和Windows XP/2000 DLLKernel32.dll在Windows 7和Windows Server 2008 R2的Psapi.dll在Windows Server 2008,Windows Vista中的Windows Server 2003,和Windows XP/2000 参见 CreateToolhelp32Snapshot EnumProcesses 模块信息 PSAPI函数 如果有任何问题和意见,请发送给微软(wsddocfb@microsoft.com) 生成日期:2009年8月27日 ==英文原文==EnumProcessModulesEx Function Retrieves a handle for each module in the specified process that meets the specified filter criteria. Syntax C++ BOOL WINAPI EnumProcessModulesEx( __in HANDLE hProcess, __out HMODULE *lphModule, __in DWORD cb, __out LPDWORD lpcbNeeded, __in DWORD dwFilterFlag ); Parameters hProcess [in] A handle to the process. lphModule [out] An array that receives the list of module handles. cb [in] The size of the lphModule array, in bytes. lpcbNeeded [out] The number of bytes required to store all module handles in the lphModule array. dwFilterFlag [in] The filter criteria. This parameter can be one of the following values. ValueMeaning LIST_MODULES_32BIT 0x01List the 32-bit modules. LIST_MODULES_64BIT 0x02List the 64-bit modules. LIST_MODULES_ALL 0x03List all modules. LIST_MODULES_DEFAULT 0x0Use the default behavior. Return Value If the function succeeds, the return value is nonzero. If the function fails, the return value is zero. To get extended error information, call GetLastError . Remarks The EnumProcessModulesEx 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 DLLs being loaded or unloaded, EnumProcessModulesEx may fail or return incorrect information. This function is intended primarily for 64-bit applications. If the function is called by a 32-bit application running under WOW64, the dwFilterFlag option is ignored and the function provides the same results as the EnumProcessModules function. 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 EnumProcessModulesEx. 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 EnumProcessModulesEx again. To determine how many modules were enumerated by the call to EnumProcessModulesEx, divide the resulting value in the lpcbNeeded parameter by sizeof(HMODULE). The EnumProcessModulesEx function does not retrieve handles for modules that were loaded with the LOAD_LIBRARY_AS_DATAFILE flag. For more information, see LoadLibraryEx . Do not call CloseHandle on any of the handles returned by this function. The information comes from a snapshot, so there are no resources to be freed. To take a snapshot of specified processes and the heaps, modules, and threads used by these processes, use the CreateToolhelp32Snapshot function. Starting with PSAPI version 2 for Windows 7 and Windows Server 2008 R2, this function is defined as K32EnumProcessModulesEx in Psapi.h and exported in Kernel32.lib and Kernel32.dll. However, you should always call this function as EnumProcessModulesEx. To ensure correct resolution of symbols for programs that will run on earlier versions of Windows, add Psapi.lib to the TARGETLIBS macro and compile the program with –DPSAPI_VERSION=1. Requirements Minimum supported clientWindows Vista Minimum supported serverWindows Server 2008 HeaderPsapi.h (include Windows.h) LibraryKernel32.lib on Windows 7 and Windows Server 2008 R2, Psapi.lib on Windows Server 2008, Windows Vista, Windows Server 2003, and Windows XP/2000 DLLKernel32.dll on Windows 7 and Windows Server 2008 R2, Psapi.dll on Windows Server 2008, Windows Vista, Windows Server 2003, and Windows XP/2000 See Also CreateToolhelp32Snapshot EnumProcesses Module Information PSAPI Functions Send comments about this topic to Microsoft Build date: 8/27/2009 ==原始网址==http://msdn.microsoft.com/en-us/library/ms682633(VS.85).aspx\n |
随便看 |
|
windows api函数参考手册包含2258条windows api函数文档,详细介绍nodejs、java、rust调用windows api的方法技巧,是学习windows api编程的入门中文文档。