RtGetModuleFileNameEx

The RtGetModuleFileNameEx function retrieves the fully-qualified path for the file that contains the specified module. The module must have been loaded by the current process.

Syntax

DWORD RtGetModuleFileNameEx(
    HANDLE hProcess,
    HMODULE hModule,
    LPWSTR lpPathName,
    DWORD nSize,
);

Parameters

hProcess

A handle to the RTSS process that contains the module. This parameter must not be NULL.

hModule

A handle to the module. If this parameter is NULL, this function returns the name of the file used to create the calling process. In Windows applications, this parameter is ignored, and this function behaves as if this parameter is NULL.

lpPathName

A pointer to the buffer that receives the absolute pathname of the module. If the absolute pathname is longer than maximum number of characters specified by the nSize parameter, the absolute pathname is truncated.

nSize

The size of the lpPathName buffer, in characters. A MAX_PATH buffer guarantees the function will always give the full path.

Return Value

If the function succeeds, the return value specifies the length of the string copied to the buffer, in characters. If the function fails, the return value is zero.

To get extended error information, call GetLastError.

Requirements

Minimum Supported Version RTX64 3.0
Header Rtapi.h
Library RtApi.lib (Windows), Rtx_Rtss.lib (RTSS)