setupapi: Set the Source field to the full cabinet path for SPFILENOTIFY_FILEEXTRACTED.
Signed-off-by: Zebediah Figura <z.figura12@gmail.com> Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
parent
811da7bf1a
commit
b67deb0d2f
|
@ -39,11 +39,13 @@ OSVERSIONINFOW OsVersionInfo;
|
||||||
|
|
||||||
HINSTANCE SETUPAPI_hInstance = 0;
|
HINSTANCE SETUPAPI_hInstance = 0;
|
||||||
|
|
||||||
typedef struct {
|
typedef struct
|
||||||
|
{
|
||||||
PSP_FILE_CALLBACK_A msghandler;
|
PSP_FILE_CALLBACK_A msghandler;
|
||||||
PVOID context;
|
void *context;
|
||||||
CHAR most_recent_cabinet_name[MAX_PATH];
|
char cab_path[MAX_PATH];
|
||||||
CHAR most_recent_target[MAX_PATH];
|
char last_cab[MAX_PATH];
|
||||||
|
char most_recent_target[MAX_PATH];
|
||||||
} SC_HSC_A, *PSC_HSC_A;
|
} SC_HSC_A, *PSC_HSC_A;
|
||||||
|
|
||||||
WINE_DEFAULT_DEBUG_CHANNEL(setupapi);
|
WINE_DEFAULT_DEBUG_CHANNEL(setupapi);
|
||||||
|
@ -204,7 +206,7 @@ static INT_PTR CDECL sc_FNNOTIFY_A(FDINOTIFICATIONTYPE fdint, PFDINOTIFICATION p
|
||||||
}
|
}
|
||||||
case fdintCLOSE_FILE_INFO:
|
case fdintCLOSE_FILE_INFO:
|
||||||
TRACE("File extracted.\n");
|
TRACE("File extracted.\n");
|
||||||
fp.Source = phsc->most_recent_cabinet_name;
|
fp.Source = phsc->last_cab;
|
||||||
fp.Target = phsc->most_recent_target;
|
fp.Target = phsc->most_recent_target;
|
||||||
fp.Win32Error = 0;
|
fp.Win32Error = 0;
|
||||||
fp.Flags = 0;
|
fp.Flags = 0;
|
||||||
|
@ -225,7 +227,7 @@ static INT_PTR CDECL sc_FNNOTIFY_A(FDINOTIFICATIONTYPE fdint, PFDINOTIFICATION p
|
||||||
ci.DiskName = pfdin->psz2;
|
ci.DiskName = pfdin->psz2;
|
||||||
ci.SetId = pfdin->setID;
|
ci.SetId = pfdin->setID;
|
||||||
ci.CabinetNumber = pfdin->iCabinet;
|
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);
|
err = phsc->msghandler(phsc->context, SPFILENOTIFY_NEEDNEWCABINET, (UINT_PTR)&ci, (UINT_PTR)mysterio);
|
||||||
if (err) {
|
if (err) {
|
||||||
SetLastError(err);
|
SetLastError(err);
|
||||||
|
@ -246,53 +248,66 @@ static INT_PTR CDECL sc_FNNOTIFY_A(FDINOTIFICATIONTYPE fdint, PFDINOTIFICATION p
|
||||||
/***********************************************************************
|
/***********************************************************************
|
||||||
* SetupIterateCabinetA (SETUPAPI.@)
|
* SetupIterateCabinetA (SETUPAPI.@)
|
||||||
*/
|
*/
|
||||||
BOOL WINAPI SetupIterateCabinetA(PCSTR CabinetFile, DWORD Reserved,
|
BOOL WINAPI SetupIterateCabinetA(const char *file, DWORD reserved,
|
||||||
PSP_FILE_CALLBACK_A MsgHandler, PVOID Context)
|
PSP_FILE_CALLBACK_A callback, void *context)
|
||||||
{
|
{
|
||||||
|
|
||||||
SC_HSC_A my_hsc;
|
SC_HSC_A my_hsc;
|
||||||
ERF erf;
|
ERF erf;
|
||||||
CHAR pszCabinet[MAX_PATH], pszCabPath[MAX_PATH], *p = NULL;
|
CHAR pszCabinet[MAX_PATH], pszCabPath[MAX_PATH], *filepart = NULL;
|
||||||
|
size_t path_size = 0;
|
||||||
|
const char *p;
|
||||||
DWORD fpnsize;
|
DWORD fpnsize;
|
||||||
HFDI hfdi;
|
HFDI hfdi;
|
||||||
BOOL ret;
|
BOOL ret;
|
||||||
|
|
||||||
TRACE("(CabinetFile == %s, Reserved == %u, MsgHandler == ^%p, Context == ^%p)\n",
|
TRACE("file %s, reserved %#x, callback %p, context %p.\n",
|
||||||
debugstr_a(CabinetFile), Reserved, MsgHandler, Context);
|
debugstr_a(file), reserved, callback, context);
|
||||||
|
|
||||||
if (!CabinetFile)
|
if (!file)
|
||||||
{
|
{
|
||||||
SetLastError(ERROR_INVALID_PARAMETER);
|
SetLastError(ERROR_INVALID_PARAMETER);
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
fpnsize = strlen(CabinetFile);
|
if (strlen(file) >= MAX_PATH)
|
||||||
if (fpnsize >= MAX_PATH) {
|
{
|
||||||
SetLastError(ERROR_BAD_PATHNAME);
|
SetLastError(ERROR_BAD_PATHNAME);
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
fpnsize = GetFullPathNameA(CabinetFile, MAX_PATH, pszCabPath, &p);
|
fpnsize = GetFullPathNameA(file, MAX_PATH, pszCabPath, &filepart);
|
||||||
if (fpnsize > MAX_PATH) {
|
if (fpnsize > MAX_PATH)
|
||||||
|
{
|
||||||
SetLastError(ERROR_BAD_PATHNAME);
|
SetLastError(ERROR_BAD_PATHNAME);
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (p) {
|
if (filepart)
|
||||||
strcpy(pszCabinet, p);
|
{
|
||||||
*p = '\0';
|
strcpy(pszCabinet, filepart);
|
||||||
} else {
|
*filepart = '\0';
|
||||||
strcpy(pszCabinet, CabinetFile);
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
strcpy(pszCabinet, file);
|
||||||
pszCabPath[0] = '\0';
|
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.last_cab, file);
|
||||||
strcpy(my_hsc.most_recent_cabinet_name, pszCabinet);
|
|
||||||
|
|
||||||
my_hsc.msghandler = MsgHandler;
|
my_hsc.msghandler = callback;
|
||||||
my_hsc.context = Context;
|
my_hsc.context = context;
|
||||||
hfdi = FDICreate(sc_cb_alloc, sc_cb_free, sc_cb_open, sc_cb_read,
|
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);
|
sc_cb_write, sc_cb_close, sc_cb_lseek, cpuUNKNOWN, &erf);
|
||||||
|
|
||||||
|
|
|
@ -367,7 +367,7 @@ static UINT CALLBACK simple_callbackA(void *context, UINT message, UINT_PTR para
|
||||||
GetTempPathA(ARRAY_SIZE(temp), temp);
|
GetTempPathA(ARRAY_SIZE(temp), temp);
|
||||||
ok(index < ARRAY_SIZE(expected_files), "%u: Got unexpected file.\n", index);
|
ok(index < ARRAY_SIZE(expected_files), "%u: Got unexpected file.\n", index);
|
||||||
snprintf(path, ARRAY_SIZE(path), "%s/./testcab.cab", temp);
|
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);
|
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(!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);
|
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);
|
GetTempPathW(ARRAY_SIZE(temp), temp);
|
||||||
ok(index < ARRAY_SIZE(expected_files), "%u: Got unexpected file.\n", index);
|
ok(index < ARRAY_SIZE(expected_files), "%u: Got unexpected file.\n", index);
|
||||||
swprintf(path, ARRAY_SIZE(path), L"%s/./testcab.cab", temp);
|
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);
|
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(!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);
|
ok(!info->Win32Error, "%u: Got error %u.\n", index, info->Win32Error);
|
||||||
|
|
Loading…
Reference in New Issue