setupapi: Make do_file_copyW send "target newer" notifications.

This commit is contained in:
Frank Richter 2006-08-25 21:24:43 +02:00 committed by Alexandre Julliard
parent a89b9ca185
commit 8aecf251df
1 changed files with 23 additions and 8 deletions

View File

@ -944,7 +944,8 @@ static BOOL create_full_pathW(const WCHAR *path)
return ret; return ret;
} }
static BOOL do_file_copyW( LPCWSTR source, LPCWSTR target, DWORD style) static BOOL do_file_copyW( LPCWSTR source, LPCWSTR target, DWORD style,
PSP_FILE_CALLBACK_W handler, PVOID context )
{ {
BOOL rc = FALSE; BOOL rc = FALSE;
BOOL docopy = TRUE; BOOL docopy = TRUE;
@ -1011,20 +1012,32 @@ static BOOL do_file_copyW( LPCWSTR source, LPCWSTR target, DWORD style)
if (ret) if (ret)
{ {
FILEPATHS_W filepaths;
TRACE("Versions: Source %li.%li target %li.%li\n", TRACE("Versions: Source %li.%li target %li.%li\n",
SourceInfo->dwFileVersionMS, SourceInfo->dwFileVersionLS, SourceInfo->dwFileVersionMS, SourceInfo->dwFileVersionLS,
TargetInfo->dwFileVersionMS, TargetInfo->dwFileVersionLS); TargetInfo->dwFileVersionMS, TargetInfo->dwFileVersionLS);
/* used in case of notification */
filepaths.Target = target;
filepaths.Source = source;
filepaths.Win32Error = 0;
filepaths.Flags = 0;
if (TargetInfo->dwFileVersionMS > SourceInfo->dwFileVersionMS) if (TargetInfo->dwFileVersionMS > SourceInfo->dwFileVersionMS)
{ {
FIXME("Notify that target version is greater..\n"); if (handler)
docopy = FALSE; docopy = handler (context, SPFILENOTIFY_TARGETNEWER, (UINT_PTR)&filepaths, 0);
else
docopy = FALSE;
} }
else if ((TargetInfo->dwFileVersionMS == SourceInfo->dwFileVersionMS) else if ((TargetInfo->dwFileVersionMS == SourceInfo->dwFileVersionMS)
&& (TargetInfo->dwFileVersionLS > SourceInfo->dwFileVersionLS)) && (TargetInfo->dwFileVersionLS > SourceInfo->dwFileVersionLS))
{ {
FIXME("Notify that target version is greater..\n"); if (handler)
docopy = FALSE; docopy = handler (context, SPFILENOTIFY_TARGETNEWER, (UINT_PTR)&filepaths, 0);
else
docopy = FALSE;
} }
else if ((style & SP_COPY_NEWER_ONLY) && else if ((style & SP_COPY_NEWER_ONLY) &&
(TargetInfo->dwFileVersionMS == (TargetInfo->dwFileVersionMS ==
@ -1032,8 +1045,10 @@ static BOOL do_file_copyW( LPCWSTR source, LPCWSTR target, DWORD style)
&&(TargetInfo->dwFileVersionLS == &&(TargetInfo->dwFileVersionLS ==
SourceInfo->dwFileVersionLS)) SourceInfo->dwFileVersionLS))
{ {
FIXME("Notify that target version is greater..\n"); if (handler)
docopy = FALSE; docopy = handler (context, SPFILENOTIFY_TARGETNEWER, (UINT_PTR)&filepaths, 0);
else
docopy = FALSE;
} }
} }
} }
@ -1169,7 +1184,7 @@ BOOL WINAPI SetupCommitFileQueueW( HWND owner, HSPFILEQ handle, PSP_FILE_CALLBAC
} }
} }
if (do_file_copyW( op_result == FILEOP_NEWPATH ? newpath : paths.Source, if (do_file_copyW( op_result == FILEOP_NEWPATH ? newpath : paths.Source,
paths.Target, op->style )) break; /* success */ paths.Target, op->style, handler, context )) break; /* success */
/* try to extract it from the cabinet file */ /* try to extract it from the cabinet file */
if (op->src_tag) if (op->src_tag)
{ {