Zebediah Figura : setupapi: Use the original INF source path if possible when copying files.
Alexandre Julliard
julliard at winehq.org
Tue Nov 10 13:46:21 CST 2020
Module: wine
Branch: stable
Commit: e67cd6901b6ed447ed1355a9366728503b8ca2d9
URL: https://source.winehq.org/git/wine.git/?a=commit;h=e67cd6901b6ed447ed1355a9366728503b8ca2d9
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>
(cherry picked from commit f779f36da3d6bc9b3ae2f223063fc02602fe3dc6)
Signed-off-by: Michael Stefaniuc <mstefani 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 0859739be5d..ed82d750253 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"
@@ -146,6 +147,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
*
@@ -175,7 +199,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