Export (0) Print
Expand All
3 out of 3 rated this helpful - Rate this topic

GetModuleInformation function

Retrieves information about the specified module in the MODULEINFO structure.

Syntax


BOOL WINAPI GetModuleInformation(
  _In_   HANDLE hProcess,
  _In_   HMODULE hModule,
  _Out_  LPMODULEINFO lpmodinfo,
  _In_   DWORD cb
);

Parameters

hProcess [in]

A handle to the process that contains the module.

The handle must have the PROCESS_QUERY_INFORMATION and PROCESS_VM_READ access rights. For more information, see Process Security and Access Rights.

hModule [in]

A handle to the module.

lpmodinfo [out]

A pointer to the MODULEINFO structure that receives information about the module.

cb [in]

The size of the MODULEINFO structure, in bytes.

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

To get information for the calling process, pass the handle returned by GetCurrentProcess.

The GetModuleInformation function does not retrieve information for modules that were loaded with the LOAD_LIBRARY_AS_DATAFILE flag. For more information, see LoadLibraryEx.

Starting with Windows 7 and Windows Server 2008 R2, Psapi.h establishes version numbers for the PSAPI functions. The PSAPI version number affects the name used to call the function and the library that a program must load.

If PSAPI_VERSION is 2 or greater, this function is defined as K32GetModuleInformation in Psapi.h and exported in Kernel32.lib and Kernel32.dll. If PSAPI_VERSION is 1, this function is defined as K32GetModuleInformation in Psapi.h and exported in Psapi.lib and Psapi.dll as a wrapper that calls K32GetModuleInformation.

Programs that must run on earlier versions of Windows as well as Windows 7 and later versions should always call this function as K32GetModuleInformation. To ensure correct resolution of symbols, add Psapi.lib to the TARGETLIBS macro and compile the program with -DPSAPI_VERSION=1. To use run-time dynamic linking, load Psapi.dll.

Requirements

Minimum supported client

Windows XP [desktop apps only]

Minimum supported server

Windows Server 2003 [desktop apps only]

Header

Psapi.h

Library

Kernel32.lib on Windows 7 and Windows Server 2008 R2;
Psapi.lib (if PSAPI_VERSION=1) on Windows 7 and Windows Server 2008 R2;
Psapi.lib on Windows Server 2008, Windows Vista, Windows Server 2003, and Windows XP

DLL

Kernel32.dll on Windows 7 and Windows Server 2008 R2;
Psapi.dll (if PSAPI_VERSION=1) on Windows 7 and Windows Server 2008 R2;
Psapi.dll on Windows Server 2008, Windows Vista, Windows Server 2003, and Windows XP

See also

EnumProcesses
Module Information
MODULEINFO
PSAPI Functions

 

 

Did you find this helpful?
(1500 characters remaining)
Thank you for your feedback

Community Additions

ADD
Show:
© 2014 Microsoft. All rights reserved.