SetSearchPathMode function (winbase.h)
Sets the per-process mode that the SearchPath function uses when locating files.
BOOL SetSearchPathMode( DWORD Flags );
The search mode to use.
If the operation completes successfully, the SetSearchPathMode function returns a nonzero value.
If the operation fails, the SetSearchPathMode function returns zero. To get extended error information, call the GetLastError function.
If the SetSearchPathMode function fails because a parameter value is not valid, the value returned by the GetLastError function will be ERROR_INVALID_PARAMETER.
If the SetSearchPathMode function fails because the combination of current state and parameter value is not valid, the value returned by the GetLastError function will be ERROR_ACCESS_DENIED. For more information, see the Remarks section.
If the SetSearchPathMode function has not been successfully called for the current process, the search mode used by the SearchPath function is obtained from the system registry. For more information, see SearchPath.
After the SetSearchPathMode function has been successfully called for the current process, the setting in the system registry is ignored in favor of the mode most recently set successfully.
If the SetSearchPathMode function has been
successfully called for the current process with Flags set to
(BASE_SEARCH_PATH_ENABLE_SAFE_SEARCHMODE | BASE_SEARCH_PATH_PERMANENT),
safe mode is set permanently for the calling process. Any subsequent calls to the
SetSearchPathMode function from within that process
that attempt to change the search mode will fail with ERROR_ACCESS_DENIED from the
This function does not modify the system registry.
In Windows 8 and Windows Server 2012, this function is supported by the following technologies.
|Server Message Block (SMB) 3.0 protocol||Yes|
|SMB 3.0 Transparent Failover (TFO)||Yes|
|SMB 3.0 with Scale-out File Shares (SO)||Yes|
|Cluster Shared Volume File System (CsvFS)||Yes|
|Resilient File System (ReFS)||Yes|
|Minimum supported client||Windows 7 [desktop apps only]|
|Minimum supported server||Windows Server 2008 R2 [desktop apps only]|
|Header||winbase.h (include Windows.h)|
|Redistributable||KB959426 on Windows XP with SP2 and later and Windows Server 2003 with SP1 and later|