Commit 547d62da authored by Zebediah Figura's avatar Zebediah Figura Committed by Alexandre Julliard

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

parent 007a9c97
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
......
......@@ -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)
{
......
......@@ -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)
......
......@@ -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\\");
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment