PsApiGetModuleFileNameEx Method

Retrieves the fully qualified path for the file containing the specified module.

Definition

Namespace: DevCase.Win32.NativeMethods
Assembly: DevCase.net48 (in DevCase.net48.dll) Version: 6.0.0.0 (6.0)
XMLNS for XAML: Not mapped to an xmlns.
[DllImportAttribute("PsApi.dll", CharSet = CharSet.Auto, BestFitMapping = false, 
	ThrowOnUnmappableChar = true, SetLastError = true)]
public static uint GetModuleFileNameEx(
	IntPtr hProcess,
	IntPtr hModule,
	StringBuilder filename,
	uint size
)

Parameters

hProcess  IntPtr
A handle to the process that contains the module.

The handle must have the QueryInformation and VirtualMemoryRead access rights.

hModule  IntPtr
A handle to the module.

If this parameter is , GetModuleFileNameEx(IntPtr, IntPtr, StringBuilder, UInt32) retrieves the path of the executable file of the process specified in hProcess.

filename  StringBuilder
A pointer to a buffer that receives the fully qualified path to the module.

If the size of the file name is larger than the value of the size parameter, the function succeeds but the file name is truncated and null-terminated.

size  UInt32
The size of the filename buffer.

Return Value

UInt32
If the function succeeds, the return value is the length of the string that is copied to the buffer, in characters, not including the terminating null character.

If the function fails, the return value is 0 (zero).

To get extended error information, call GetLastWin32Error.

Remarks

See Also