Commit b67deb0d authored by Zebediah Figura's avatar Zebediah Figura Committed by Alexandre Julliard

setupapi: Set the Source field to the full cabinet path for SPFILENOTIFY_FILEEXTRACTED.

parent 811da7bf
......@@ -39,11 +39,13 @@ OSVERSIONINFOW OsVersionInfo;
HINSTANCE SETUPAPI_hInstance = 0;
typedef struct {
PSP_FILE_CALLBACK_A msghandler;
PVOID context;
CHAR most_recent_cabinet_name[MAX_PATH];
CHAR most_recent_target[MAX_PATH];
typedef struct
{
PSP_FILE_CALLBACK_A msghandler;
void *context;
char cab_path[MAX_PATH];
char last_cab[MAX_PATH];
char most_recent_target[MAX_PATH];
} SC_HSC_A, *PSC_HSC_A;
WINE_DEFAULT_DEBUG_CHANNEL(setupapi);
......@@ -204,7 +206,7 @@ static INT_PTR CDECL sc_FNNOTIFY_A(FDINOTIFICATIONTYPE fdint, PFDINOTIFICATION p
}
case fdintCLOSE_FILE_INFO:
TRACE("File extracted.\n");
fp.Source = phsc->most_recent_cabinet_name;
fp.Source = phsc->last_cab;
fp.Target = phsc->most_recent_target;
fp.Win32Error = 0;
fp.Flags = 0;
......@@ -225,7 +227,7 @@ static INT_PTR CDECL sc_FNNOTIFY_A(FDINOTIFICATIONTYPE fdint, PFDINOTIFICATION p
ci.DiskName = pfdin->psz2;
ci.SetId = pfdin->setID;
ci.CabinetNumber = pfdin->iCabinet;
strcpy(phsc->most_recent_cabinet_name, pfdin->psz1);
sprintf(phsc->last_cab, "%s%s", phsc->cab_path, ci.CabinetFile);
err = phsc->msghandler(phsc->context, SPFILENOTIFY_NEEDNEWCABINET, (UINT_PTR)&ci, (UINT_PTR)mysterio);
if (err) {
SetLastError(err);
......@@ -246,62 +248,75 @@ static INT_PTR CDECL sc_FNNOTIFY_A(FDINOTIFICATIONTYPE fdint, PFDINOTIFICATION p
/***********************************************************************
* SetupIterateCabinetA (SETUPAPI.@)
*/
BOOL WINAPI SetupIterateCabinetA(PCSTR CabinetFile, DWORD Reserved,
PSP_FILE_CALLBACK_A MsgHandler, PVOID Context)
BOOL WINAPI SetupIterateCabinetA(const char *file, DWORD reserved,
PSP_FILE_CALLBACK_A callback, void *context)
{
SC_HSC_A my_hsc;
ERF erf;
CHAR pszCabinet[MAX_PATH], pszCabPath[MAX_PATH], *p = NULL;
DWORD fpnsize;
HFDI hfdi;
BOOL ret;
SC_HSC_A my_hsc;
ERF erf;
CHAR pszCabinet[MAX_PATH], pszCabPath[MAX_PATH], *filepart = NULL;
size_t path_size = 0;
const char *p;
DWORD fpnsize;
HFDI hfdi;
BOOL ret;
TRACE("(CabinetFile == %s, Reserved == %u, MsgHandler == ^%p, Context == ^%p)\n",
debugstr_a(CabinetFile), Reserved, MsgHandler, Context);
TRACE("file %s, reserved %#x, callback %p, context %p.\n",
debugstr_a(file), reserved, callback, context);
if (!CabinetFile)
{
SetLastError(ERROR_INVALID_PARAMETER);
return FALSE;
}
if (!file)
{
SetLastError(ERROR_INVALID_PARAMETER);
return FALSE;
}
fpnsize = strlen(CabinetFile);
if (fpnsize >= MAX_PATH) {
SetLastError(ERROR_BAD_PATHNAME);
return FALSE;
}
if (strlen(file) >= MAX_PATH)
{
SetLastError(ERROR_BAD_PATHNAME);
return FALSE;
}
fpnsize = GetFullPathNameA(CabinetFile, MAX_PATH, pszCabPath, &p);
if (fpnsize > MAX_PATH) {
SetLastError(ERROR_BAD_PATHNAME);
return FALSE;
}
fpnsize = GetFullPathNameA(file, MAX_PATH, pszCabPath, &filepart);
if (fpnsize > MAX_PATH)
{
SetLastError(ERROR_BAD_PATHNAME);
return FALSE;
}
if (p) {
strcpy(pszCabinet, p);
*p = '\0';
} else {
strcpy(pszCabinet, CabinetFile);
pszCabPath[0] = '\0';
}
if (filepart)
{
strcpy(pszCabinet, filepart);
*filepart = '\0';
}
else
{
strcpy(pszCabinet, file);
pszCabPath[0] = '\0';
}
for (p = file; *p; ++p)
{
if (*p == '/' || *p == '\\')
path_size = p - file;
}
memcpy(my_hsc.cab_path, file, path_size);
my_hsc.cab_path[path_size] = 0;
TRACE("path: %s, cabfile: %s\n", debugstr_a(pszCabPath), debugstr_a(pszCabinet));
TRACE("path: %s, cabfile: %s\n", debugstr_a(pszCabPath), debugstr_a(pszCabinet));
/* remember the cabinet name */
strcpy(my_hsc.most_recent_cabinet_name, pszCabinet);
strcpy(my_hsc.last_cab, file);
my_hsc.msghandler = MsgHandler;
my_hsc.context = Context;
hfdi = FDICreate(sc_cb_alloc, sc_cb_free, sc_cb_open, sc_cb_read,
sc_cb_write, sc_cb_close, sc_cb_lseek, cpuUNKNOWN, &erf);
my_hsc.msghandler = callback;
my_hsc.context = context;
hfdi = FDICreate(sc_cb_alloc, sc_cb_free, sc_cb_open, sc_cb_read,
sc_cb_write, sc_cb_close, sc_cb_lseek, cpuUNKNOWN, &erf);
if (!hfdi) return FALSE;
if (!hfdi) return FALSE;
ret = FDICopy(hfdi, pszCabinet, pszCabPath, 0, sc_FNNOTIFY_A, NULL, &my_hsc);
ret = FDICopy(hfdi, pszCabinet, pszCabPath, 0, sc_FNNOTIFY_A, NULL, &my_hsc);
FDIDestroy(hfdi);
return ret;
FDIDestroy(hfdi);
return ret;
}
struct iterate_wtoa_ctx
......
......@@ -367,7 +367,7 @@ static UINT CALLBACK simple_callbackA(void *context, UINT message, UINT_PTR para
GetTempPathA(ARRAY_SIZE(temp), temp);
ok(index < ARRAY_SIZE(expected_files), "%u: Got unexpected file.\n", index);
snprintf(path, ARRAY_SIZE(path), "%s/./testcab.cab", temp);
todo_wine ok(!strcmp(info->Source, path), "%u: Got source %s.\n", index, debugstr_a(info->Source));
ok(!strcmp(info->Source, path), "%u: Got source %s.\n", index, debugstr_a(info->Source));
snprintf(path, ARRAY_SIZE(path), "%s\\%s", temp, expected_files[index].nameA);
ok(!strcmp(info->Target, path), "%u: Got target %s.\n", index, debugstr_a(info->Target));
ok(!info->Win32Error, "%u: Got error %u.\n", index, info->Win32Error);
......@@ -475,7 +475,7 @@ static UINT CALLBACK simple_callbackW(void *context, UINT message, UINT_PTR para
GetTempPathW(ARRAY_SIZE(temp), temp);
ok(index < ARRAY_SIZE(expected_files), "%u: Got unexpected file.\n", index);
swprintf(path, ARRAY_SIZE(path), L"%s/./testcab.cab", temp);
todo_wine ok(!wcscmp(info->Source, path), "%u: Got source %s.\n", index, debugstr_w(info->Source));
ok(!wcscmp(info->Source, path), "%u: Got source %s.\n", index, debugstr_w(info->Source));
swprintf(path, ARRAY_SIZE(path), L"%s\\%s", temp, expected_files[index].nameW);
ok(!wcscmp(info->Target, path), "%u: Got target %s.\n", index, debugstr_w(info->Target));
ok(!info->Win32Error, "%u: Got error %u.\n", index, info->Win32Error);
......
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