PsApiGetModuleFileNameEx Method
Retrieves the fully qualified path for the file containing the specified module.
Namespace: DevCase.Win32.NativeMethodsAssembly: 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
)
<DllImportAttribute("PsApi.dll", CharSet := CharSet.Auto, BestFitMapping := false,
ThrowOnUnmappableChar := true, SetLastError := true>]
Public Shared Function GetModuleFileNameEx (
hProcess As IntPtr,
hModule As IntPtr,
filename As StringBuilder,
size As UInteger
) As UInteger
Dim hProcess As IntPtr
Dim hModule As IntPtr
Dim filename As StringBuilder
Dim size As UInteger
Dim returnValue As UInteger
returnValue = PsApi.GetModuleFileNameEx(hProcess,
hModule, filename, size)
public:
[DllImportAttribute(L"PsApi.dll", CharSet = CharSet::Auto, BestFitMapping = false,
ThrowOnUnmappableChar = true, SetLastError = true)]
static unsigned int GetModuleFileNameEx(
IntPtr hProcess,
IntPtr hModule,
StringBuilder^ filename,
unsigned int size
)
[<DllImportAttribute("PsApi.dll", CharSet = CharSet.Auto, BestFitMapping = false,
ThrowOnUnmappableChar = true, SetLastError = true)>]
static member GetModuleFileNameEx :
hProcess : IntPtr *
hModule : IntPtr *
filename : StringBuilder *
size : uint32 -> uint32
No code example is currently available or this language may not be supported.
- 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.
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.