Alexandre Julliard : setupapi: Support a WineSourceDirs section to copy files from the Wine build or data dir.

Alexandre Julliard julliard at winehq.org
Tue Feb 11 15:44:54 CST 2020


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

Author: Alexandre Julliard <julliard at winehq.org>
Date:   Tue Feb 11 09:00:43 2020 +0100

setupapi: Support a WineSourceDirs section to copy files from the Wine build or data dir.

Signed-off-by: Alexandre Julliard <julliard at winehq.org>

---

 dlls/setupapi/install.c | 22 ++++++++++++++++++++--
 1 file changed, 20 insertions(+), 2 deletions(-)

diff --git a/dlls/setupapi/install.c b/dlls/setupapi/install.c
index f458e8d2e9..730beba721 100644
--- a/dlls/setupapi/install.c
+++ b/dlls/setupapi/install.c
@@ -119,13 +119,31 @@ static WCHAR *dup_section_line_field( HINF hinf, const WCHAR *section, const WCH
  */
 static BOOL copy_files_callback( HINF hinf, PCWSTR field, void *arg )
 {
+    INFCONTEXT context;
     struct files_callback_info *info = arg;
     WCHAR src_root[MAX_PATH], *p;
 
     if (!info->src_root)
     {
-        lstrcpyW( src_root, PARSER_get_inf_filename( hinf ) );
-        if ((p = wcsrchr( src_root, '\\' ))) *p = 0;
+        const WCHAR *build_dir = _wgetenv( L"WINEBUILDDIR" );
+        const WCHAR *data_dir = _wgetenv( L"WINEDATADIR" );
+
+        if ((build_dir || data_dir) && SetupFindFirstLineW( hinf, L"WineSourceDirs", field, &context ))
+        {
+            lstrcpyW( src_root, build_dir ? build_dir : data_dir );
+            src_root[1] = '\\';  /* change \??\ to \\?\ */
+            p = src_root + lstrlenW(src_root);
+            *p++ = '\\';
+            if (!build_dir || !SetupGetStringFieldW( &context, 2, p, MAX_PATH - (p - src_root), NULL ))
+            {
+                if (!SetupGetStringFieldW( &context, 1, p, MAX_PATH - (p - src_root), NULL )) p[-1] = 0;
+            }
+        }
+        else
+        {
+            lstrcpyW( src_root, PARSER_get_inf_filename( hinf ) );
+            if ((p = wcsrchr( src_root, '\\' ))) *p = 0;
+        }
     }
 
     if (field[0] == '@')  /* special case: copy single file */




More information about the wine-cvs mailing list