Module: wine Branch: master Commit: aa76bec2417551952eec9cd8f5d8302dcb72f5bd URL: https://source.winehq.org/git/wine.git/?a=commit;h=aa76bec2417551952eec9cd8f...
Author: Alexandre Julliard julliard@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@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 */