Jacek Caban : ntdll: Support device paths in LdrGetDllPath.

Alexandre Julliard julliard at winehq.org
Wed Mar 25 17:07:28 CDT 2020


Module: wine
Branch: master
Commit: 1a05b7da6335772af50636a31be6d4f9f58ade16
URL:    https://source.winehq.org/git/wine.git/?a=commit;h=1a05b7da6335772af50636a31be6d4f9f58ade16

Author: Jacek Caban <jacek at codeweavers.com>
Date:   Wed Mar 25 14:15:36 2020 +0100

ntdll: Support device paths in LdrGetDllPath.

Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=48698
Signed-off-by: Jacek Caban <jacek at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>

---

 dlls/kernel32/tests/path.c | 18 ++++++++++++++++++
 dlls/ntdll/loader.c        |  2 +-
 2 files changed, 19 insertions(+), 1 deletion(-)

diff --git a/dlls/kernel32/tests/path.c b/dlls/kernel32/tests/path.c
index 7342a865af..0e45ad44ff 100644
--- a/dlls/kernel32/tests/path.c
+++ b/dlls/kernel32/tests/path.c
@@ -2635,6 +2635,24 @@ static void test_LdrGetDllPath(void)
     ret = pLdrGetDllPath( fooW, LOAD_LIBRARY_SEARCH_DLL_LOAD_DIR, &path, &unknown_ptr );
     ok( ret == STATUS_INVALID_PARAMETER, "LdrGetDllPath failed %x\n", ret );
 
+    lstrcpyW( buffer, L"\\\\?\\" );
+    lstrcatW( buffer, dlldir );
+    p = buffer + lstrlenW(buffer);
+    *p++ = '\\';
+    lstrcpyW( p, fooW );
+    ret = pLdrGetDllPath( buffer, LOAD_LIBRARY_SEARCH_DLL_LOAD_DIR, &path, &unknown_ptr );
+    ok( !ret, "LdrGetDllPath failed %x\n", ret );
+    ok( !unknown_ptr, "unknown ptr %p\n", unknown_ptr );
+    ok( !memcmp( path, L"\\\\?\\", 4 * sizeof(WCHAR) ) && path_equal( path + 4, dlldir ),
+        "got %s expected \\\\?\\%s\n", wine_dbgstr_w(path), wine_dbgstr_w(dlldir));
+    pRtlReleasePath( path );
+
+    ret = pLdrGetDllPath( L"\\\\?\\c:\\test.dll", LOAD_LIBRARY_SEARCH_DLL_LOAD_DIR, &path, &unknown_ptr );
+    ok( !ret, "LdrGetDllPath failed %x\n", ret );
+    ok( !unknown_ptr, "unknown ptr %p\n", unknown_ptr );
+    ok( !lstrcmpW( path, L"\\\\?\\c:" ), "got %s expected \\\\?\\c:\n", wine_dbgstr_w(path));
+    pRtlReleasePath( path );
+
     lstrcpyW( buffer, dlldir );
     p = buffer + lstrlenW(buffer);
     *p++ = '\\';
diff --git a/dlls/ntdll/loader.c b/dlls/ntdll/loader.c
index 85eb297680..1b641f1b9d 100644
--- a/dlls/ntdll/loader.c
+++ b/dlls/ntdll/loader.c
@@ -2204,7 +2204,7 @@ static NTSTATUS get_dll_load_path_search_flags( LPCWSTR module, DWORD flags, WCH
     if (flags & LOAD_LIBRARY_SEARCH_DLL_LOAD_DIR)
     {
         DWORD type = RtlDetermineDosPathNameType_U( module );
-        if (type != ABSOLUTE_DRIVE_PATH && type != ABSOLUTE_PATH)
+        if (type != ABSOLUTE_DRIVE_PATH && type != ABSOLUTE_PATH && type != DEVICE_PATH)
             return STATUS_INVALID_PARAMETER;
         mod_end = get_module_path_end( module );
         len += (mod_end - module) + 1;




More information about the wine-cvs mailing list