Zebediah Figura : setupapi: Use the original INF source path if possible when copying files.

Alexandre Julliard julliard at winehq.org
Thu Jun 11 15:26:47 CDT 2020


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

Author: Zebediah Figura <z.figura12 at gmail.com>
Date:   Thu Jun 11 11:16:32 2020 -0500

setupapi: Use the original INF source path if possible when copying files.

Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=35903
Signed-off-by: Zebediah Figura <z.figura12 at gmail.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>

---

 dlls/setupapi/install.c | 26 +++++++++++++++++++++++++-
 1 file changed, 25 insertions(+), 1 deletion(-)

diff --git a/dlls/setupapi/install.c b/dlls/setupapi/install.c
index 730beba721..56a9d4f36c 100644
--- a/dlls/setupapi/install.c
+++ b/dlls/setupapi/install.c
@@ -32,6 +32,7 @@
 #include "winnls.h"
 #include "winsvc.h"
 #include "shlobj.h"
+#include "shlwapi.h"
 #include "objidl.h"
 #include "objbase.h"
 #include "setupapi.h"
@@ -112,6 +113,29 @@ static WCHAR *dup_section_line_field( HINF hinf, const WCHAR *section, const WCH
     return buffer;
 }
 
+static void get_inf_src_path( HINF hinf, WCHAR *path )
+{
+    const WCHAR *inf_path = PARSER_get_inf_filename( hinf );
+    WCHAR pnf_path[MAX_PATH];
+    FILE *pnf;
+
+    wcscpy( pnf_path, inf_path );
+    PathRemoveExtensionW( pnf_path );
+    PathAddExtensionW( pnf_path, L".pnf" );
+    if ((pnf = _wfopen( pnf_path, L"r" )))
+    {
+        if (fgetws( path, MAX_PATH, pnf ) && !wcscmp( path, PNF_HEADER ))
+        {
+            fgetws( path, MAX_PATH, pnf );
+            TRACE("using original source path %s\n", debugstr_w(path));
+            fclose( pnf );
+            return;
+        }
+        fclose( pnf );
+    }
+    wcscpy( path, inf_path );
+}
+
 /***********************************************************************
  *            copy_files_callback
  *
@@ -141,7 +165,7 @@ static BOOL copy_files_callback( HINF hinf, PCWSTR field, void *arg )
         }
         else
         {
-            lstrcpyW( src_root, PARSER_get_inf_filename( hinf ) );
+            get_inf_src_path( hinf, src_root );
             if ((p = wcsrchr( src_root, '\\' ))) *p = 0;
         }
     }




More information about the wine-cvs mailing list