RtGetModuleFileName

The RtGetModuleFileName 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

Copy
DWORD RtGetModuleFileName(
    HANDLE hProcess,
    HMODULE hModule,
    LPWSTR lpBaseName,
    DWORD nSize,
);

Parameters

hProcess

A handle to the 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.

lpBaseName

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

nSize

The size of the lpBaseName buffer, in characters.

Return Value

If the function succeeds, it returns the value specifies the length of the string copied to the buffer, in characters. If the function fails, it returns 0 (zero).

To get extended error information, call GetLastError.

Requirements

Minimum supported version Header Library

eRTOS 1.0 SDK

Rtapi.h rtkrnl.lib