Fixes some test failures with https://gitlab.winehq.org/wine/wine/-/merge_requests/4904, where when the driver is found again for a new device (which has a different VID/PID from the first created device and thus, is not cached yet), the original filename from the .pnf file has been overwritten and the driver modules are incorrectly looked up for relative to the .inf in the `c:\windows\inf` folder.
From: Rémi Bernon rbernon@codeweavers.com
--- dlls/setupapi/misc.c | 23 ++++++++++------------- 1 file changed, 10 insertions(+), 13 deletions(-)
diff --git a/dlls/setupapi/misc.c b/dlls/setupapi/misc.c index 701801f7380..b1083fca665 100644 --- a/dlls/setupapi/misc.c +++ b/dlls/setupapi/misc.c @@ -1068,23 +1068,20 @@ BOOL WINAPI SetupCopyOEMInfW( PCWSTR source, PCWSTR location, if (!(ret = CopyFileW( source, target, TRUE ))) return ret;
+ wcscpy(pnf_path, target); + PathRemoveExtensionW(pnf_path); + PathAddExtensionW(pnf_path, L".pnf"); + if ((pnf_file = _wfopen(pnf_path, L"w"))) + { + fputws(PNF_HEADER, pnf_file); + fputws(source, pnf_file); + fclose(pnf_file); + } + done: if (style & SP_COPY_DELETESOURCE) DeleteFileW( source );
- if (ret) - { - wcscpy(pnf_path, target); - PathRemoveExtensionW(pnf_path); - PathAddExtensionW(pnf_path, L".pnf"); - if ((pnf_file = _wfopen(pnf_path, L"w"))) - { - fputws(PNF_HEADER, pnf_file); - fputws(source, pnf_file); - fclose(pnf_file); - } - } - size = lstrlenW( target ) + 1; if (dest) {