diff --git a/dll/ntdll/def/ntdll.spec b/dll/ntdll/def/ntdll.spec
index 63fd851dc8..ce7da269cb 100644
--- a/dll/ntdll/def/ntdll.spec
+++ b/dll/ntdll/def/ntdll.spec
@@ -1158,6 +1158,7 @@
 @ stub -version=0x600+ RtlSetProcessDebugInformation
 @ cdecl RtlSetProcessIsCritical(long ptr long)
 @ stdcall RtlSetSaclSecurityDescriptor(ptr long ptr long)
+@ stdcall RtlSetSearchPathMode(long)
 @ stdcall RtlSetSecurityDescriptorRMControl(ptr ptr)
 @ stdcall RtlSetSecurityObject(long ptr ptr ptr ptr)
 @ stdcall RtlSetSecurityObjectEx(long ptr ptr long ptr ptr)
diff --git a/dll/win32/kernel32/client/path.c b/dll/win32/kernel32/client/path.c
index 1db908212f..85d4110c4e 100644
--- a/dll/win32/kernel32/client/path.c
+++ b/dll/win32/kernel32/client/path.c
@@ -4,6 +4,7 @@
  * FILE:            dll/win32/kernel32/client/path.c
  * PURPOSE:         Handles path APIs
  * PROGRAMMERS:     Alex Ionescu (alex.ionescu@reactos.org)
+ *                  Oleg Dubinskiy (oleg.dubinskij2013@yandex.ua)
  */
 
 /* INCLUDES *******************************************************************/
@@ -1114,6 +1115,26 @@ GetFullPathNameW(IN LPCWSTR lpFileName,
                                 lpFilePart) / sizeof(WCHAR);
 }
 
+/*
+ * @implemented
+ */
+BOOL
+WINAPI
+SetSearchPathMode(DWORD dwFlags)
+{
+    NTSTATUS Status;
+
+    /* Call Rtl to do the work */
+    Status = RtlSetSearchPathMode(dwFlags);
+    if (!NT_SUCCESS(Status))
+    {
+        SetLastError(RtlNtStatusToDosError(Status));
+        return FALSE;
+    }
+
+    return NT_SUCCESS(Status);
+}
+
 /*
  * @implemented
  */
diff --git a/dll/win32/kernel32/kernel32.spec b/dll/win32/kernel32/kernel32.spec
index 1b8dd416be..9fe19de859 100644
--- a/dll/win32/kernel32/kernel32.spec
+++ b/dll/win32/kernel32/kernel32.spec
@@ -1060,6 +1060,7 @@
 @ stdcall SetProcessShutdownParameters(long long)
 @ stdcall SetProcessWorkingSetSize(long long long)
 @ stdcall SetProcessWorkingSetSizeEx(long long long long)
+@ stdcall SetSearchPathMode(long)
 @ stdcall SetStdHandle(long long)
 @ stub -version=0x600+ SetStdHandleEx
 @ stdcall SetSystemFileCacheSize(long long long)
diff --git a/sdk/include/ndk/rtlfuncs.h b/sdk/include/ndk/rtlfuncs.h
index 513fc195b5..8e74ebd102 100644
--- a/sdk/include/ndk/rtlfuncs.h
+++ b/sdk/include/ndk/rtlfuncs.h
@@ -4825,6 +4825,16 @@ RtlStatMemoryStream(
     _In_ ULONG Flags
 );
 
+//
+// Search functions
+//
+NTSYSAPI
+NTSTATUS
+NTAPI
+RtlSetSearchPathMode(
+    _In_ ULONG Flags
+);
+
 // Dummy functions
 NTSYSAPI
 HRESULT
diff --git a/sdk/include/psdk/winbase.h b/sdk/include/psdk/winbase.h
index 1e7071fda0..6b45ffbe38 100644
--- a/sdk/include/psdk/winbase.h
+++ b/sdk/include/psdk/winbase.h
@@ -3166,6 +3166,7 @@ BOOL WINAPI SetProcessAffinityMask(_In_ HANDLE, _In_ DWORD_PTR);
 BOOL WINAPI SetProcessPriorityBoost(_In_ HANDLE, _In_ BOOL);
 BOOL WINAPI SetProcessShutdownParameters(DWORD,DWORD);
 BOOL WINAPI SetProcessWorkingSetSize(_In_ HANDLE, _In_ SIZE_T, _In_ SIZE_T);
+BOOL WINAPI SetSearchPathMode(DWORD);
 #if (_WIN32_WINNT >= 0x0600)
 VOID WINAPI SetSecurityAccessMask(SECURITY_INFORMATION,LPDWORD);
 #endif
diff --git a/sdk/lib/rtl/path.c b/sdk/lib/rtl/path.c
index 360c68df73..140f5c4bc6 100644
--- a/sdk/lib/rtl/path.c
+++ b/sdk/lib/rtl/path.c
@@ -8,6 +8,7 @@
  *                  Gunnar Dalsnes
  *                  Alex Ionescu (alex.ionescu@reactos.org)
  *                  Pierre Schweitzer (pierre@reactos.org)
+ *                  Oleg Dubinskiy (oleg.dubinskij2013@yandex.ua)
  */
 
 /* INCLUDES *******************************************************************/
@@ -51,6 +52,7 @@ static const UNICODE_STRING RtlpDefaultExtension = RTL_CONSTANT_STRING(L".DLL");
 static const UNICODE_STRING RtlpDotLocal = RTL_CONSTANT_STRING(L".Local\\");
 static const UNICODE_STRING RtlpPathDividers = RTL_CONSTANT_STRING(L"\\/");
 
+static LONG RtlPathSafeMode = 0;
 
 PRTLP_CURDIR_REF RtlpCurDirRef;
 
@@ -2160,6 +2162,44 @@ NTSTATUS NTAPI RtlNtPathNameToDosPathName(IN ULONG Flags,
     return STATUS_SUCCESS;
 }
 
+/*
+ * @implemented
+ */
+NTSTATUS
+NTAPI
+RtlSetSearchPathMode(IN ULONG Flags)
+{
+    LONG RetVal;
+
+    switch (Flags)
+    {
+    case BASE_SEARCH_PATH_ENABLE_SAFE_SEARCHMODE:
+        RetVal = 1;
+        break;
+    case BASE_SEARCH_PATH_DISABLE_SAFE_SEARCHMODE:
+        RetVal = 0;
+        break;
+    case BASE_SEARCH_PATH_ENABLE_SAFE_SEARCHMODE | BASE_SEARCH_PATH_PERMANENT:
+        InterlockedExchange((LONG *)&RtlPathSafeMode, 2);
+        return STATUS_SUCCESS;
+    default:
+        return STATUS_INVALID_PARAMETER;
+    }
+
+    for (;;)
+    {
+        LONG PrevVal = RtlPathSafeMode;
+
+        if (PrevVal == 2)
+            break;  /* Permanently set */
+
+        if (InterlockedCompareExchange((LONG *)&RtlPathSafeMode, RetVal, PrevVal) == PrevVal)
+            return STATUS_SUCCESS;
+    }
+
+    return STATUS_ACCESS_DENIED;
+}
+
 /*
  * @implemented
  */
