ArgxFindExecutable function¶
Given the first element of an argument vector, attempts to locate an executable according to the rules specified in the ArgxCreateProcess documentation.
Syntax¶
LPTSTR ArgxFindExecutable(LPCTSTR lpszArgv0);
Parameters¶
lpszArgv0
The name of the executable to find. This is processed as follows:
- If
lpszArgv0
contains path delimiters, it will be treated as a literal path and used directly; otherwise, - If
lpszArgv0
does not have an extension, the extension “.exe” will be appended automatically. - The function will then try to find the executable by looking in
the following places:
- The directory from which the calling application loaded.
- The current directory.
- The Windows System32 directory (as returned by the GetSystemDirectory API).
- The 16-bit Windows System directory, if present.
- The Windows directory (as returned by the GetWindowsDirectory API).
- The directories listed in the
PATH
environment variable.
- If
Return value¶
If the function succeeds, it returns a string containing the path to the executable found according to the rules above. This string should be released when no longer required, using the LocalFree function.
If the function fails to find a match, it returns NULL
.