setupapi: Store the original INF file path in a .pnf file.

Signed-off-by: Zebediah Figura <z.figura12@gmail.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
feature/deterministic
Zebediah Figura 2020-06-11 11:16:31 -05:00 committed by Alexandre Julliard
parent 007a9c9726
commit 547d62da22
4 changed files with 21 additions and 4 deletions

View File

@ -1,7 +1,7 @@
EXTRADEFS = -D_SETUPAPI_
MODULE = setupapi.dll
IMPORTLIB = setupapi
IMPORTS = uuid version advapi32 rpcrt4
IMPORTS = uuid version advapi32 rpcrt4 kernelbase
DELAYIMPORTS = shell32 wintrust ole32 winspool.drv comdlg32 user32
EXTRADLLFLAGS = -mno-cygwin

View File

@ -31,6 +31,7 @@
#include "softpub.h"
#include "mscat.h"
#include "shlobj.h"
#include "shlwapi.h"
#include "wine/debug.h"
@ -962,10 +963,11 @@ BOOL WINAPI SetupCopyOEMInfW( PCWSTR source, PCWSTR location,
DWORD buffer_size, DWORD *required_size, WCHAR **filepart )
{
BOOL ret = FALSE;
WCHAR target[MAX_PATH], catalog_file[MAX_PATH], *p;
WCHAR target[MAX_PATH], catalog_file[MAX_PATH], pnf_path[MAX_PATH], *p;
static const WCHAR inf[] = { '\\','i','n','f','\\',0 };
static const WCHAR wszVersion[] = { 'V','e','r','s','i','o','n',0 };
static const WCHAR wszCatalogFile[] = { 'C','a','t','a','l','o','g','F','i','l','e',0 };
FILE *pnf_file;
unsigned int i;
DWORD size;
HINF hinf;
@ -1069,6 +1071,19 @@ 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)
{

View File

@ -43,6 +43,8 @@
#define REGPART_RENAME "\\Rename"
#define REG_VERSIONCONFLICT "Software\\Microsoft\\VersionConflictManager"
#define PNF_HEADER L"Wine PNF header\n"
extern HINSTANCE SETUPAPI_hInstance DECLSPEC_HIDDEN;
static inline void * __WINE_ALLOC_SIZE(2) heap_realloc_zero(void *mem, size_t len)

View File

@ -320,7 +320,7 @@ static void test_SetupCopyOEMInf(void)
DeleteFileA(dest);
strcpy(pnf, dest);
*(strrchr(pnf, '.') + 1) = 'p';
ok(!file_exists(pnf), "Expected pnf '%s' to not exist\n", pnf);
todo_wine ok(!file_exists(pnf), "Expected pnf '%s' to not exist\n", pnf);
res = SetupUninstallOEMInfA(strrchr(orig_dest, '\\') + 1, 0, NULL);
ok(res, "Failed to uninstall '%s', error %u.\n", orig_dest, GetLastError());
@ -328,7 +328,7 @@ static void test_SetupCopyOEMInf(void)
DeleteFileA(orig_dest);
strcpy(pnf, dest);
*(strrchr(pnf, '.') + 1) = 'p';
ok(!file_exists(pnf), "Expected pnf '%s' to not exist\n", pnf);
todo_wine ok(!file_exists(pnf), "Expected pnf '%s' to not exist\n", pnf);
GetWindowsDirectoryA(orig_dest, sizeof(orig_dest));
strcat(orig_dest, "\\inf\\");