GetProcessImageFileName

From aldeid
Jump to navigation Jump to search

Description

Retrieves the name of the executable file for the specified process.

Syntax

DWORD WINAPI GetProcessImageFileName(
  _In_  HANDLE hProcess,
  _Out_ LPTSTR lpImageFileName,
  _In_  DWORD  nSize
);

Parameters

hProcess [in]
A handle to the process. The handle must have the PROCESS_QUERY_INFORMATION or PROCESS_QUERY_LIMITED_INFORMATION access right.
Windows Server 2003 and Windows XP: The handle must have the PROCESS_QUERY_INFORMATION access right.
lpImageFileName [out]
A pointer to a buffer that receives the full path to the executable file.
nSize [in]
The size of the lpImageFileName buffer, in characters.

Return value

If the function succeeds, the return value specifies the length of the string copied to the buffer.

If the function fails, the return value is zero. To get extended error information, call GetLastError.