2 * Implementation of the Microsoft Installer (msi.dll)
4 * Copyright 2005 Aric Stewart for CodeWeavers
6 * This library is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Lesser General Public
8 * License as published by the Free Software Foundation; either
9 * version 2.1 of the License, or (at your option) any later version.
11 * This library is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * Lesser General Public License for more details.
16 * You should have received a copy of the GNU Lesser General Public
17 * License along with this library; if not, write to the Free Software
18 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
23 * Actions dealing with files These are
29 * RemoveDuplicateFiles(TODO)
38 #include "wine/debug.h"
42 #include "msvcrt/fcntl.h"
45 #include "wine/unicode.h"
48 WINE_DEFAULT_DEBUG_CHANNEL(msi);
50 extern const WCHAR szInstallFiles[];
51 extern const WCHAR szDuplicateFiles[];
52 extern const WCHAR szMoveFiles[];
53 extern const WCHAR szPatchFiles[];
54 extern const WCHAR szRemoveDuplicateFiles[];
55 extern const WCHAR szRemoveFiles[];
57 static const WCHAR cszTempFolder[]= {'T','e','m','p','F','o','l','d','e','r',0};
59 inline static UINT create_component_directory ( MSIPACKAGE* package, INT component)
61 UINT rc = ERROR_SUCCESS;
65 install_path = resolve_folder(package, package->components[component].Directory,
66 FALSE, FALSE, &folder);
68 return ERROR_FUNCTION_FAILED;
71 if (folder->State == 0)
73 create_full_pathW(install_path);
76 HeapFree(GetProcessHeap(), 0, install_path);
82 * This is a helper function for handling embedded cabinet media
84 static UINT writeout_cabinet_stream(MSIPACKAGE *package, LPCWSTR stream_name,
94 rc = read_raw_stream_data(package->db,stream_name,&data,&size);
95 if (rc != ERROR_SUCCESS)
99 if (MSI_GetPropertyW(package, cszTempFolder, tmp, &write))
100 GetTempPathW(MAX_PATH,tmp);
102 GetTempFileNameW(tmp,stream_name,0,source);
104 track_tempfile(package,strrchrW(source,'\\'), source);
105 the_file = CreateFileW(source, GENERIC_WRITE, 0, NULL, CREATE_ALWAYS,
106 FILE_ATTRIBUTE_NORMAL, NULL);
108 if (the_file == INVALID_HANDLE_VALUE)
110 ERR("Unable to create file %s\n",debugstr_w(source));
111 rc = ERROR_FUNCTION_FAILED;
115 WriteFile(the_file,data,size,&write,NULL);
116 CloseHandle(the_file);
117 TRACE("wrote %li bytes to %s\n",write,debugstr_w(source));
119 HeapFree(GetProcessHeap(),0,data);
124 /* Support functions for FDI functions */
131 static void * cabinet_alloc(ULONG cb)
133 return HeapAlloc(GetProcessHeap(), 0, cb);
136 static void cabinet_free(void *pv)
138 HeapFree(GetProcessHeap(), 0, pv);
141 static INT_PTR cabinet_open(char *pszFile, int oflag, int pmode)
144 DWORD dwShareMode = 0;
145 DWORD dwCreateDisposition = OPEN_EXISTING;
146 switch (oflag & _O_ACCMODE)
149 dwAccess = GENERIC_READ;
150 dwShareMode = FILE_SHARE_READ | FILE_SHARE_DELETE;
153 dwAccess = GENERIC_WRITE;
154 dwShareMode = FILE_SHARE_READ | FILE_SHARE_WRITE | FILE_SHARE_DELETE;
157 dwAccess = GENERIC_READ | GENERIC_WRITE;
158 dwShareMode = FILE_SHARE_READ | FILE_SHARE_WRITE | FILE_SHARE_DELETE;
161 if ((oflag & (_O_CREAT | _O_EXCL)) == (_O_CREAT | _O_EXCL))
162 dwCreateDisposition = CREATE_NEW;
163 else if (oflag & _O_CREAT)
164 dwCreateDisposition = CREATE_ALWAYS;
165 return (INT_PTR)CreateFileA(pszFile, dwAccess, dwShareMode, NULL,
166 dwCreateDisposition, 0, NULL);
169 static UINT cabinet_read(INT_PTR hf, void *pv, UINT cb)
172 if (ReadFile((HANDLE)hf, pv, cb, &dwRead, NULL))
177 static UINT cabinet_write(INT_PTR hf, void *pv, UINT cb)
180 if (WriteFile((HANDLE)hf, pv, cb, &dwWritten, NULL))
185 static int cabinet_close(INT_PTR hf)
187 return CloseHandle((HANDLE)hf) ? 0 : -1;
190 static long cabinet_seek(INT_PTR hf, long dist, int seektype)
192 /* flags are compatible and so are passed straight through */
193 return SetFilePointer((HANDLE)hf, dist, NULL, seektype);
196 static INT_PTR cabinet_notify(FDINOTIFICATIONTYPE fdint, PFDINOTIFICATION pfdin)
202 CabData *data = (CabData*) pfdin->pv;
203 ULONG len = strlen(data->cab_path) + strlen(pfdin->psz1);
209 static const WCHAR tmpprefix[] = {'C','A','B','T','M','P','_',0};
216 given_file = strdupAtoW(pfdin->psz1);
217 index = get_loaded_file(data->package, given_file);
221 ERR("Unknown File in Cabinent (%s)\n",debugstr_w(given_file));
222 HeapFree(GetProcessHeap(),0,given_file);
226 if (!((data->package->files[index].State == 1 ||
227 data->package->files[index].State == 2)))
229 TRACE("Skipping extraction of %s\n",debugstr_w(given_file));
230 HeapFree(GetProcessHeap(),0,given_file);
234 file = cabinet_alloc((len+1)*sizeof(char));
235 strcpy(file, data->cab_path);
236 strcat(file, pfdin->psz1);
238 TRACE("file: %s\n", debugstr_a(file));
240 /* track this file so it can be deleted if not installed */
241 trackpath=strdupAtoW(file);
242 tracknametmp=strdupAtoW(strrchr(file,'\\')+1);
243 trackname = HeapAlloc(GetProcessHeap(),0,(strlenW(tracknametmp) +
244 strlenW(tmpprefix)+1) * sizeof(WCHAR));
246 strcpyW(trackname,tmpprefix);
247 strcatW(trackname,tracknametmp);
249 track_tempfile(data->package, trackname, trackpath);
251 HeapFree(GetProcessHeap(),0,trackpath);
252 HeapFree(GetProcessHeap(),0,trackname);
253 HeapFree(GetProcessHeap(),0,tracknametmp);
256 uirow=MSI_CreateRecord(9);
257 MSI_RecordSetStringW(uirow,1,data->package->files[index].File);
258 uipath = strdupW(data->package->files[index].TargetPath);
259 *(strrchrW(uipath,'\\')+1)=0;
260 MSI_RecordSetStringW(uirow,9,uipath);
261 MSI_RecordSetInteger(uirow,6,data->package->files[index].FileSize);
262 ui_actiondata(data->package,szInstallFiles,uirow);
263 msiobj_release( &uirow->hdr );
264 HeapFree(GetProcessHeap(),0,uipath);
266 ui_progress(data->package,2,data->package->files[index].FileSize,0,0);
268 return cabinet_open(file, _O_WRONLY | _O_CREAT, 0);
270 case fdintCLOSE_FILE_INFO:
274 if (!DosDateTimeToFileTime(pfdin->date, pfdin->time, &ft))
276 if (!LocalFileTimeToFileTime(&ft, &ftLocal))
278 if (!SetFileTime((HANDLE)pfdin->hf, &ftLocal, 0, &ftLocal))
281 cabinet_close(pfdin->hf);
289 /***********************************************************************
290 * extract_cabinet_file
292 * Extract files from a cab file.
294 static BOOL extract_cabinet_file(MSIPACKAGE* package, LPCWSTR source,
304 TRACE("Extracting %s to %s\n",debugstr_w(source), debugstr_w(path));
306 hfdi = FDICreate(cabinet_alloc,
317 ERR("FDICreate failed\n");
321 if (!(cabinet = strdupWtoA( source )))
326 if (!(cab_path = strdupWtoA( path )))
329 HeapFree(GetProcessHeap(), 0, cabinet);
333 data.package = package;
334 data.cab_path = cab_path;
336 ret = FDICopy(hfdi, cabinet, "", 0, cabinet_notify, NULL, &data);
339 ERR("FDICopy failed\n");
343 HeapFree(GetProcessHeap(), 0, cabinet);
344 HeapFree(GetProcessHeap(), 0, cab_path);
349 static VOID set_file_source(MSIPACKAGE* package, MSIFILE* file, MSICOMPONENT*
352 if (file->Attributes & msidbFileAttributesNoncompressed)
355 p = resolve_folder(package, comp->Directory, TRUE, FALSE, NULL);
356 file->SourcePath = build_directory_name(2, p, file->ShortName);
357 HeapFree(GetProcessHeap(),0,p);
360 file->SourcePath = build_directory_name(2, path, file->File);
363 static BOOL check_volume(LPCWSTR path, LPCWSTR want_volume, LPWSTR volume,
367 WCHAR name[MAX_PATH];
370 if (!(path[0] && path[1] == ':'))
377 TRACE("Checking volume %s .. (%s)\n",debugstr_w(drive), debugstr_w(want_volume));
378 type = GetDriveTypeW(drive);
379 TRACE("drive is of type %x\n",type);
381 if (type == DRIVE_UNKNOWN || type == DRIVE_NO_ROOT_DIR ||
382 type == DRIVE_FIXED || type == DRIVE_RAMDISK)
385 GetVolumeInformationW(drive, name, MAX_PATH, NULL, NULL, NULL, NULL, 0);
386 TRACE("Drive contains %s\n", debugstr_w(name));
387 volume = strdupW(name);
390 return (strcmpiW(want_volume,name)==0);
393 static BOOL check_for_sourcefile(LPCWSTR source)
395 DWORD attrib = GetFileAttributesW(source);
396 return (!(attrib == INVALID_FILE_ATTRIBUTES));
399 static UINT ready_volume(MSIPACKAGE* package, LPCWSTR path, LPWSTR last_volume,
400 MSIRECORD *row,UINT *type )
402 LPWSTR volume = NULL;
403 LPCWSTR want_volume = MSI_RecordGetString(row, 5);
404 BOOL ok = check_volume(path, want_volume, volume, type);
406 TRACE("Readying Volume for %s (%s, %s)\n",debugstr_w(path), debugstr_w(want_volume), debugstr_w(last_volume));
408 if (check_for_sourcefile(path) && !ok)
410 FIXME("Found the Sourcefile but not on the correct volume.(%s,%s,%s)\n",
411 debugstr_w(path),debugstr_w(want_volume), debugstr_w(volume));
412 return ERROR_SUCCESS;
421 prompt = MSI_RecordGetString(row,3);
422 msg = generate_error_string(package, 1302, 1, prompt);
423 rc = MessageBoxW(NULL,msg,NULL,MB_OKCANCEL);
424 HeapFree(GetProcessHeap(),0,volume);
425 HeapFree(GetProcessHeap(),0,msg);
427 ok = check_for_sourcefile(path);
429 return ERROR_INSTALL_USEREXIT;
432 HeapFree(GetProcessHeap(),0,last_volume);
433 last_volume = strdupW(volume);
434 return ERROR_SUCCESS;
437 static UINT ready_media_for_file(MSIPACKAGE *package, int fileindex,
440 UINT rc = ERROR_SUCCESS;
442 static WCHAR source[MAX_PATH];
443 static const WCHAR ExecSeqQuery[] =
444 {'S','E','L','E','C','T',' ','*',' ', 'F','R','O','M',' ',
445 '`','M','e','d','i','a','`',' ','W','H','E','R','E',' ',
446 '`','L','a','s','t','S','e','q','u','e','n','c','e','`',' ','>','=',
447 ' ','%', 'i',' ','O','R','D','E','R',' ','B','Y',' ',
448 '`','L','a','s','t','S','e','q','u','e','n','c','e','`',0};
452 static UINT last_sequence = 0;
453 static LPWSTR last_volume = NULL;
454 static LPWSTR last_path = NULL;
455 MSIFILE* file = NULL;
458 static DWORD count = 0;
463 HeapFree(GetProcessHeap(),0,last_path);
464 HeapFree(GetProcessHeap(),0,last_volume);
469 memset(source,0,sizeof(source));
470 return ERROR_SUCCESS;
473 file = &package->files[fileindex];
475 if (file->Sequence <= last_sequence)
477 set_file_source(package,file,comp,last_path);
478 TRACE("Media already ready (%u, %u)\n",file->Sequence,last_sequence);
479 return ERROR_SUCCESS;
483 row = MSI_QueryGetRecord(package->db, ExecSeqQuery, file->Sequence);
486 TRACE("Unable to query row\n");
487 return ERROR_FUNCTION_FAILED;
490 seq = MSI_RecordGetInteger(row,2);
493 volume = MSI_RecordGetString(row, 5);
494 prompt = MSI_RecordGetString(row, 3);
496 HeapFree(GetProcessHeap(),0,last_path);
499 if (file->Attributes & msidbFileAttributesNoncompressed)
501 last_path = resolve_folder(package, comp->Directory, TRUE, FALSE, NULL);
502 set_file_source(package,file,comp,last_path);
503 rc = ready_volume(package, file->SourcePath, last_volume, row,&type);
505 MsiSourceListAddMediaDiskW(package->ProductCode, NULL,
506 MSIINSTALLCONTEXT_USERMANAGED, MSICODE_PRODUCT, count, volume,
509 if (type == DRIVE_REMOVABLE || type == DRIVE_CDROM ||
510 type == DRIVE_RAMDISK)
511 MsiSourceListSetInfoW(package->ProductCode, NULL,
512 MSIINSTALLCONTEXT_USERMANAGED,
513 MSICODE_PRODUCT|MSISOURCETYPE_MEDIA,
514 INSTALLPROPERTY_LASTUSEDSOURCEW, last_path);
516 MsiSourceListSetInfoW(package->ProductCode, NULL,
517 MSIINSTALLCONTEXT_USERMANAGED,
518 MSICODE_PRODUCT|MSISOURCETYPE_NETWORK,
519 INSTALLPROPERTY_LASTUSEDSOURCEW, last_path);
520 msiobj_release(&row->hdr);
524 cab = MSI_RecordGetString(row,4);
527 TRACE("Source is CAB %s\n",debugstr_w(cab));
528 /* the stream does not contain the # character */
533 writeout_cabinet_stream(package,&cab[1],source);
534 last_path = strdupW(source);
535 *(strrchrW(last_path,'\\')+1)=0;
537 path = load_dynamic_property(package,cszSourceDir,NULL);
539 MsiSourceListAddMediaDiskW(package->ProductCode, NULL,
540 MSIINSTALLCONTEXT_USERMANAGED, MSICODE_PRODUCT, count,
543 MsiSourceListSetInfoW(package->ProductCode, NULL,
544 MSIINSTALLCONTEXT_USERMANAGED,
545 MSICODE_PRODUCT|MSISOURCETYPE_NETWORK,
546 INSTALLPROPERTY_LASTUSEDSOURCEW, path);
548 HeapFree(GetProcessHeap(),0,path);
553 last_path = HeapAlloc(GetProcessHeap(),0,MAX_PATH*sizeof(WCHAR));
554 if (MSI_GetPropertyW(package, cszSourceDir, source, &sz))
556 ERR("No Source dir defined \n");
557 rc = ERROR_FUNCTION_FAILED;
561 strcpyW(last_path,source);
564 rc = ready_volume(package, source, last_volume, row, &type);
565 if (type == DRIVE_REMOVABLE || type == DRIVE_CDROM ||
566 type == DRIVE_RAMDISK)
567 MsiSourceListSetInfoW(package->ProductCode, NULL,
568 MSIINSTALLCONTEXT_USERMANAGED,
569 MSICODE_PRODUCT|MSISOURCETYPE_MEDIA,
570 INSTALLPROPERTY_LASTUSEDSOURCEW, last_path);
572 MsiSourceListSetInfoW(package->ProductCode, NULL,
573 MSIINSTALLCONTEXT_USERMANAGED,
574 MSICODE_PRODUCT|MSISOURCETYPE_NETWORK,
575 INSTALLPROPERTY_LASTUSEDSOURCEW, last_path);
577 /* extract the cab file into a folder in the temp folder */
579 if (MSI_GetPropertyW(package, cszTempFolder,last_path, &sz)
581 GetTempPathW(MAX_PATH,last_path);
584 rc = !extract_cabinet_file(package, source, last_path);
585 /* reaquire file ptr */
586 file = &package->files[fileindex];
591 last_path = HeapAlloc(GetProcessHeap(),0,MAX_PATH*sizeof(WCHAR));
592 MSI_GetPropertyW(package,cszSourceDir,source,&sz);
593 strcpyW(last_path,source);
594 rc = ready_volume(package, last_path, last_volume, row, &type);
596 if (type == DRIVE_REMOVABLE || type == DRIVE_CDROM ||
597 type == DRIVE_RAMDISK)
598 MsiSourceListSetInfoW(package->ProductCode, NULL,
599 MSIINSTALLCONTEXT_USERMANAGED,
600 MSICODE_PRODUCT|MSISOURCETYPE_MEDIA,
601 INSTALLPROPERTY_LASTUSEDSOURCEW, last_path);
603 MsiSourceListSetInfoW(package->ProductCode, NULL,
604 MSIINSTALLCONTEXT_USERMANAGED,
605 MSICODE_PRODUCT|MSISOURCETYPE_NETWORK,
606 INSTALLPROPERTY_LASTUSEDSOURCEW, last_path);
608 set_file_source(package, file, comp, last_path);
610 MsiSourceListAddMediaDiskW(package->ProductCode, NULL,
611 MSIINSTALLCONTEXT_USERMANAGED, MSICODE_PRODUCT, count, volume,
614 msiobj_release(&row->hdr);
619 inline static UINT get_file_target(MSIPACKAGE *package, LPCWSTR file_key,
625 return ERROR_INVALID_HANDLE;
627 for (index = 0; index < package->loaded_files; index ++)
629 if (strcmpW(file_key,package->files[index].File)==0)
631 if (package->files[index].State >= 2)
633 *file_source = strdupW(package->files[index].TargetPath);
634 return ERROR_SUCCESS;
637 return ERROR_FILE_NOT_FOUND;
641 return ERROR_FUNCTION_FAILED;
645 * In order to make this work more effeciencly I am going to do this in 2
647 * Pass 1) Correct all the TargetPaths and determin what files are to be
649 * Pass 2) Extract Cabinents and copy files.
651 UINT ACTION_InstallFiles(MSIPACKAGE *package)
653 UINT rc = ERROR_SUCCESS;
658 return ERROR_INVALID_HANDLE;
660 /* increment progress bar each time action data is sent */
661 ui_progress(package,1,1,0,0);
663 /* handle the keys for the SouceList */
664 ptr = strrchrW(package->PackagePath,'\\');
668 MsiSourceListSetInfoW(package->ProductCode, NULL,
669 MSIINSTALLCONTEXT_USERMANAGED,
671 INSTALLPROPERTY_PACKAGENAMEW, ptr);
673 FIXME("Write DiskPrompt\n");
676 for (index = 0; index < package->loaded_files; index++)
679 MSICOMPONENT* comp = NULL;
681 file = &package->files[index];
686 if (!ACTION_VerifyComponentForAction(package, file->ComponentIndex,
689 ui_progress(package,2,file->FileSize,0,0);
690 TRACE("File %s is not scheduled for install\n",
691 debugstr_w(file->File));
697 if ((file->State == 1) || (file->State == 2))
701 TRACE("Pass 1: %s\n",debugstr_w(file->File));
703 create_component_directory( package, file->ComponentIndex);
705 /* recalculate file paths because things may have changed */
707 if (file->ComponentIndex >= 0)
708 comp = &package->components[file->ComponentIndex];
711 ERR("No Component for file\n");
715 p = resolve_folder(package, comp->Directory, FALSE, FALSE, NULL);
716 HeapFree(GetProcessHeap(),0,file->TargetPath);
718 file->TargetPath = build_directory_name(2, p, file->FileName);
719 HeapFree(GetProcessHeap(),0,p);
724 for (index = 0; index < package->loaded_files; index++)
727 MSICOMPONENT* comp = NULL;
729 file = &package->files[index];
734 if ((file->State == 1) || (file->State == 2))
736 TRACE("Pass 2: %s\n",debugstr_w(file->File));
738 if (file->ComponentIndex >= 0)
739 comp = &package->components[file->ComponentIndex];
741 rc = ready_media_for_file(package, index, comp);
742 if (rc != ERROR_SUCCESS)
744 ERR("Unable to ready media\n");
745 rc = ERROR_FUNCTION_FAILED;
751 * our file table could change here because a new temp file
752 * may have been created. So reaquire our ptr.
754 file = &package->files[index];
756 TRACE("file paths %s to %s\n",debugstr_w(file->SourcePath),
757 debugstr_w(file->TargetPath));
759 if (file->Attributes & msidbFileAttributesNoncompressed)
760 rc = CopyFileW(file->SourcePath,file->TargetPath,FALSE);
762 rc = MoveFileW(file->SourcePath, file->TargetPath);
767 ERR("Unable to move/copy file (%s -> %s) (error %d)\n",
768 debugstr_w(file->SourcePath), debugstr_w(file->TargetPath),
770 if (rc == ERROR_ALREADY_EXISTS && file->State == 2)
772 if (!CopyFileW(file->SourcePath,file->TargetPath,FALSE))
773 ERR("Unable to copy file (%s -> %s) (error %ld)\n",
774 debugstr_w(file->SourcePath),
775 debugstr_w(file->TargetPath), GetLastError());
776 if (!(file->Attributes & msidbFileAttributesNoncompressed))
777 DeleteFileW(file->SourcePath);
780 else if (rc == ERROR_FILE_NOT_FOUND)
782 ERR("Source File Not Found! Continuing\n");
785 else if (file->Attributes & msidbFileAttributesVital)
787 ERR("Ignoring Error and continuing (nonvital file)...\n");
800 ready_media_for_file(NULL, 0, NULL);
804 static UINT ITERATE_DuplicateFiles(MSIRECORD *row, LPVOID param)
806 MSIPACKAGE *package = (MSIPACKAGE*)param;
807 WCHAR *file_source = NULL;
808 WCHAR dest_name[0x100];
809 LPWSTR dest_path, dest;
810 LPCWSTR file_key, component;
815 component = MSI_RecordGetString(row,2);
816 component_index = get_loaded_component(package,component);
818 if (!ACTION_VerifyComponentForAction(package, component_index,
821 TRACE("Skipping copy due to disabled component %s\n",
822 debugstr_w(component));
824 /* the action taken was the same as the current install state */
825 package->components[component_index].Action =
826 package->components[component_index].Installed;
828 return ERROR_SUCCESS;
831 package->components[component_index].Action = INSTALLSTATE_LOCAL;
833 file_key = MSI_RecordGetString(row,3);
836 ERR("Unable to get file key\n");
837 return ERROR_FUNCTION_FAILED;
840 rc = get_file_target(package,file_key,&file_source);
842 if (rc != ERROR_SUCCESS)
844 ERR("Original file unknown %s\n",debugstr_w(file_key));
845 HeapFree(GetProcessHeap(),0,file_source);
846 return ERROR_SUCCESS;
849 if (MSI_RecordIsNull(row,4))
850 strcpyW(dest_name,strrchrW(file_source,'\\')+1);
854 MSI_RecordGetStringW(row,4,dest_name,&sz);
855 reduce_to_longfilename(dest_name);
858 if (MSI_RecordIsNull(row,5))
861 dest_path = strdupW(file_source);
862 p = strrchrW(dest_path,'\\');
869 destkey = MSI_RecordGetString(row,5);
870 dest_path = resolve_folder(package, destkey, FALSE,FALSE,NULL);
874 dest_path = load_dynamic_property(package, destkey, NULL);
877 FIXME("Unable to get destination folder, try AppSearch properties\n");
878 HeapFree(GetProcessHeap(),0,file_source);
879 return ERROR_SUCCESS;
884 dest = build_directory_name(2, dest_path, dest_name);
886 TRACE("Duplicating file %s to %s\n",debugstr_w(file_source),
889 if (strcmpW(file_source,dest))
890 rc = !CopyFileW(file_source,dest,TRUE);
894 if (rc != ERROR_SUCCESS)
895 ERR("Failed to copy file %s -> %s, last error %ld\n", debugstr_w(file_source), debugstr_w(dest_path), GetLastError());
897 FIXME("We should track these duplicate files as well\n");
899 HeapFree(GetProcessHeap(),0,dest_path);
900 HeapFree(GetProcessHeap(),0,dest);
901 HeapFree(GetProcessHeap(),0,file_source);
903 return ERROR_SUCCESS;
906 UINT ACTION_DuplicateFiles(MSIPACKAGE *package)
910 static const WCHAR ExecSeqQuery[] =
911 {'S','E','L','E','C','T',' ','*',' ','F','R','O','M',' ',
912 '`','D','u','p','l','i','c','a','t','e','F','i','l','e','`',0};
915 return ERROR_INVALID_HANDLE;
917 rc = MSI_DatabaseOpenViewW(package->db, ExecSeqQuery, &view);
918 if (rc != ERROR_SUCCESS)
919 return ERROR_SUCCESS;
921 rc = MSI_IterateRecords(view, NULL, ITERATE_DuplicateFiles, package);
922 msiobj_release(&view->hdr);