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;
|
||||
|
||||
typedef struct {
|
||||
typedef struct
|
||||
{
|
||||
PSP_FILE_CALLBACK_A msghandler;
|
||||
PVOID context;
|
||||
CHAR most_recent_cabinet_name[MAX_PATH];
|
||||
CHAR most_recent_target[MAX_PATH];
|
||||
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,53 +248,66 @@ 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;
|
||||
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)
|
||||
if (!file)
|
||||
{
|
||||
SetLastError(ERROR_INVALID_PARAMETER);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
fpnsize = strlen(CabinetFile);
|
||||
if (fpnsize >= MAX_PATH) {
|
||||
if (strlen(file) >= MAX_PATH)
|
||||
{
|
||||
SetLastError(ERROR_BAD_PATHNAME);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
fpnsize = GetFullPathNameA(CabinetFile, MAX_PATH, pszCabPath, &p);
|
||||
if (fpnsize > MAX_PATH) {
|
||||
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);
|
||||
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));
|
||||
|
||||
/* 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;
|
||||
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);
|
||||
|
||||
|
|
|
@ -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);
|
||||
|
|
Loading…
Reference in New Issue