Rémi Bernon : setupapi: Support installing DLLs with dots in their name.

Alexandre Julliard julliard at winehq.org
Fri Mar 12 14:36:16 CST 2021


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

Author: Rémi Bernon <rbernon at codeweavers.com>
Date:   Fri Mar 12 12:31:07 2021 +0100

setupapi: Support installing DLLs with dots in their name.

Signed-off-by: Rémi Bernon <rbernon at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>

---

 dlls/setupapi/fakedll.c | 25 ++++++++++++++++++-------
 1 file changed, 18 insertions(+), 7 deletions(-)

diff --git a/dlls/setupapi/fakedll.c b/dlls/setupapi/fakedll.c
index cf219916400..3196708a7f7 100644
--- a/dlls/setupapi/fakedll.c
+++ b/dlls/setupapi/fakedll.c
@@ -881,13 +881,18 @@ static int install_fake_dll( WCHAR *dest, WCHAR *file, const WCHAR *ext, BOOL ex
     WCHAR *destname = dest + lstrlenW(dest);
     WCHAR *name = wcsrchr( file, '\\' ) + 1;
     WCHAR *end = name + lstrlenW(name);
+    SIZE_T len = end - name;
 
     if (ext) lstrcpyW( end, ext );
-    if (!(ret = read_file( file, &data, &size, expect_builtin ))) return 0;
+    if (!(ret = read_file( file, &data, &size, expect_builtin )))
+    {
+        *end = 0;
+        return 0;
+    }
 
-    if (end > name + 2 && !wcsncmp( end - 2, L"16", 2 )) end -= 2;  /* remove "16" suffix */
-    memcpy( destname, name, (end - name) * sizeof(WCHAR) );
-    destname[end - name] = 0;
+    if (end > name + 2 && !wcsncmp( end - 2, L"16", 2 )) len -= 2;  /* remove "16" suffix */
+    memcpy( destname, name, len * sizeof(WCHAR) );
+    destname[len] = 0;
     if (!add_handled_dll( destname )) ret = -1;
 
     if (ret != -1)
@@ -906,6 +911,7 @@ static int install_fake_dll( WCHAR *dest, WCHAR *file, const WCHAR *ext, BOOL ex
         }
     }
     *destname = 0;  /* restore it for next file */
+    *end = 0;
     return ret;
 }
 
@@ -965,9 +971,14 @@ static void install_lib_dir( WCHAR *dest, WCHAR *file, const WCHAR *default_ext,
         {
             lstrcatW( name, L"\\" );
             lstrcatW( name, data.name );
-            if (!wcschr( data.name, '.' )) lstrcatW( name, default_ext );
-            if (!install_fake_dll( dest, file, NULL, expect_builtin, &delay_copy ))
-                install_fake_dll( dest, file, L".fake", FALSE, &delay_copy );
+            if (wcschr( data.name, '.' )) /* module possibly already has an extension */
+            {
+                if (install_fake_dll( dest, file, NULL, expect_builtin, &delay_copy )) continue;
+                if (install_fake_dll( dest, file, L".fake", FALSE, &delay_copy )) continue;
+            }
+            lstrcatW( name, default_ext );
+            if (install_fake_dll( dest, file, NULL, expect_builtin, &delay_copy )) continue;
+            if (install_fake_dll( dest, file, L".fake", FALSE, &delay_copy )) continue;
         }
         else install_fake_dll( dest, file, NULL, expect_builtin, &delay_copy );
     }




More information about the wine-cvs mailing list