Permalink
Switch branches/tags
Nothing to show
Find file Copy path
Fetching contributors…
Cannot retrieve contributors at this time
executable file 33 lines (27 sloc) 1008 Bytes
draft toc comments categories tags title wip snippet
false
false
false
Random
Windows
SearchPath
Windows SearchPath
false
Notes about Windows SearchPath.

A while ago I was playing with the Windows API SearchPath. It will search for a specific file in PATH.

DWORD WINAPI SearchPath(
    _In_opt_  LPCTSTR lpPath,
    _In_      LPCTSTR lpFileName,
    _In_opt_  LPCTSTR lpExtension,
    _In_      DWORD   nBufferLength,
    _Out_     LPTSTR  lpBuffer,
    _Out_opt_ LPTSTR  *lpFilePart
);

Note this quirk from the "Remarks" section. When lpPath is NULL (which usually is). It looks up the following registry key. If the value is 1 it will first search in PATH then in current working directory and vice versa if 0. Default is 0.

  • HKLM\SYSTEM\CurrentControlSet\Control\Session Manager\SafeProcessSearchMode