sync msi to wine 1.1.40

svn path=/trunk/; revision=45909
This commit is contained in:
Christoph von Wittich
2010-03-06 09:05:09 +00:00
parent 812fcd6a3e
commit 67aebd5a4f
12 changed files with 1476 additions and 694 deletions
File diff suppressed because it is too large Load Diff
+11 -5
View File
@@ -1026,13 +1026,15 @@ static UINT ACTION_AppSearchSigName(MSIPACKAGE *package, LPCWSTR sigName,
static UINT iterate_appsearch(MSIRECORD *row, LPVOID param)
{
MSIPACKAGE *package = param;
LPWSTR propName, sigName, value = NULL;
LPCWSTR propName, sigName;
LPWSTR value = NULL;
MSISIGNATURE sig;
MSIRECORD *uirow;
UINT r;
/* get property and signature */
propName = msi_dup_record_field(row,1);
sigName = msi_dup_record_field(row,2);
propName = MSI_RecordGetString(row, 1);
sigName = MSI_RecordGetString(row, 2);
TRACE("%s %s\n", debugstr_w(propName), debugstr_w(sigName));
@@ -1043,8 +1045,12 @@ static UINT iterate_appsearch(MSIRECORD *row, LPVOID param)
msi_free(value);
}
ACTION_FreeSignature(&sig);
msi_free(propName);
msi_free(sigName);
uirow = MSI_CreateRecord( 2 );
MSI_RecordSetStringW( uirow, 1, propName );
MSI_RecordSetStringW( uirow, 2, sigName );
ui_actiondata( package, szAppSearch, uirow );
msiobj_release( &uirow->hdr );
return r;
}
+23 -17
View File
@@ -1120,38 +1120,44 @@ static UINT HANDLE_CustomType50(MSIPACKAGE *package, LPCWSTR source,
static UINT HANDLE_CustomType34(MSIPACKAGE *package, LPCWSTR source,
LPCWSTR target, const INT type, LPCWSTR action)
{
LPWSTR filename, deformated;
LPWSTR workingdir, filename;
STARTUPINFOW si;
PROCESS_INFORMATION info;
BOOL rc;
memset(&si,0,sizeof(STARTUPINFOW));
memset(&si, 0, sizeof(STARTUPINFOW));
filename = resolve_folder(package, source, FALSE, FALSE, TRUE, NULL);
workingdir = resolve_folder(package, source, FALSE, FALSE, TRUE, NULL);
if (!workingdir)
return ERROR_FUNCTION_FAILED;
deformat_string(package, target, &filename);
if (!filename)
{
msi_free(workingdir);
return ERROR_FUNCTION_FAILED;
}
SetCurrentDirectoryW(filename);
msi_free(filename);
TRACE("executing exe %s with working directory %s\n",
debugstr_w(filename), debugstr_w(workingdir));
deformat_string(package,target,&deformated);
if (!deformated)
return ERROR_FUNCTION_FAILED;
TRACE("executing exe %s\n", debugstr_w(deformated));
rc = CreateProcessW(NULL, deformated, NULL, NULL, FALSE, 0, NULL,
c_collen, &si, &info);
rc = CreateProcessW(NULL, filename, NULL, NULL, FALSE, 0, NULL,
workingdir, &si, &info);
if ( !rc )
{
ERR("Unable to execute command %s\n", debugstr_w(deformated));
msi_free(deformated);
ERR("Unable to execute command %s with working directory %s\n",
debugstr_w(filename), debugstr_w(workingdir));
msi_free(filename);
msi_free(workingdir);
return ERROR_SUCCESS;
}
msi_free(deformated);
msi_free(filename);
msi_free(workingdir);
CloseHandle( info.hThread );
return wait_process_handle(package, type, info.hProcess, action);
+44 -17
View File
@@ -801,11 +801,31 @@ static UINT msi_dialog_text_control( msi_dialog *dialog, MSIRECORD *rec )
return ERROR_SUCCESS;
}
/* strip any leading text style label from text field */
static WCHAR *msi_get_binary_name( MSIPACKAGE *package, MSIRECORD *rec )
{
WCHAR *p, *text;
text = msi_get_deformatted_field( package, rec, 10 );
if (!text)
return NULL;
p = text;
while (*p && *p != '{') p++;
if (!*p++) return text;
while (*p && *p != '}') p++;
if (!*p++) return text;
p = strdupW( p );
msi_free( text );
return p;
}
static UINT msi_dialog_button_control( msi_dialog *dialog, MSIRECORD *rec )
{
msi_control *control;
UINT attributes, style;
LPWSTR text;
TRACE("%p %p\n", dialog, rec);
@@ -820,12 +840,19 @@ static UINT msi_dialog_button_control( msi_dialog *dialog, MSIRECORD *rec )
control->handler = msi_dialog_button_handler;
/* set the icon */
text = msi_get_deformatted_field( dialog->package, rec, 10 );
control->hIcon = msi_load_icon( dialog->package->db, text, attributes );
if( attributes & msidbControlAttributesIcon )
SendMessageW( control->hwnd, BM_SETIMAGE, IMAGE_ICON, (LPARAM) control->hIcon );
msi_free( text );
if (attributes & msidbControlAttributesIcon)
{
/* set the icon */
LPWSTR name = msi_get_binary_name( dialog->package, rec );
control->hIcon = msi_load_icon( dialog->package->db, name, attributes );
if (control->hIcon)
{
SendMessageW( control->hwnd, BM_SETIMAGE, IMAGE_ICON, (LPARAM) control->hIcon );
}
else
ERR("Failed to load icon %s\n", debugstr_w(name));
msi_free( name );
}
return ERROR_SUCCESS;
}
@@ -1142,7 +1169,7 @@ static UINT msi_dialog_bitmap_control( msi_dialog *dialog, MSIRECORD *rec )
{
UINT cx, cy, flags, style, attributes;
msi_control *control;
LPWSTR text;
LPWSTR name;
flags = LR_LOADFROMFILE;
style = SS_BITMAP | SS_LEFT | WS_GROUP;
@@ -1160,15 +1187,15 @@ static UINT msi_dialog_bitmap_control( msi_dialog *dialog, MSIRECORD *rec )
cx = msi_dialog_scale_unit( dialog, cx );
cy = msi_dialog_scale_unit( dialog, cy );
text = msi_get_deformatted_field( dialog->package, rec, 10 );
control->hBitmap = msi_load_picture( dialog->package->db, text, cx, cy, flags );
name = msi_get_binary_name( dialog->package, rec );
control->hBitmap = msi_load_picture( dialog->package->db, name, cx, cy, flags );
if( control->hBitmap )
SendMessageW( control->hwnd, STM_SETIMAGE,
IMAGE_BITMAP, (LPARAM) control->hBitmap );
else
ERR("Failed to load bitmap %s\n", debugstr_w(text));
ERR("Failed to load bitmap %s\n", debugstr_w(name));
msi_free( text );
msi_free( name );
return ERROR_SUCCESS;
}
@@ -1177,7 +1204,7 @@ static UINT msi_dialog_icon_control( msi_dialog *dialog, MSIRECORD *rec )
{
msi_control *control;
DWORD attributes;
LPWSTR text;
LPWSTR name;
TRACE("\n");
@@ -1185,13 +1212,13 @@ static UINT msi_dialog_icon_control( msi_dialog *dialog, MSIRECORD *rec )
SS_ICON | SS_CENTERIMAGE | WS_GROUP );
attributes = MSI_RecordGetInteger( rec, 8 );
text = msi_get_deformatted_field( dialog->package, rec, 10 );
control->hIcon = msi_load_icon( dialog->package->db, text, attributes );
name = msi_get_binary_name( dialog->package, rec );
control->hIcon = msi_load_icon( dialog->package->db, name, attributes );
if( control->hIcon )
SendMessageW( control->hwnd, STM_SETICON, (WPARAM) control->hIcon, 0 );
else
ERR("Failed to load bitmap %s\n", debugstr_w(text));
msi_free( text );
ERR("Failed to load bitmap %s\n", debugstr_w(name));
msi_free( name );
return ERROR_SUCCESS;
}
+526 -83
View File
@@ -24,10 +24,10 @@
*
* InstallFiles
* DuplicateFiles
* MoveFiles (TODO)
* MoveFiles
* PatchFiles (TODO)
* RemoveDuplicateFiles(TODO)
* RemoveFiles(TODO)
* RemoveDuplicateFiles
* RemoveFiles
*/
#include <stdarg.h>
@@ -85,23 +85,6 @@ static int msi_compare_file_version(MSIFILE *file)
return lstrcmpW(version, file->Version);
}
static UINT get_file_target(MSIPACKAGE *package, LPCWSTR file_key,
MSIFILE** file)
{
LIST_FOR_EACH_ENTRY( *file, &package->files, MSIFILE, entry )
{
if (lstrcmpW( file_key, (*file)->File )==0)
{
if ((*file)->state >= msifs_overwrite)
return ERROR_SUCCESS;
else
return ERROR_FILE_NOT_FOUND;
}
}
return ERROR_FUNCTION_FAILED;
}
static void schedule_install_files(MSIPACKAGE *package)
{
MSIFILE *file;
@@ -345,15 +328,407 @@ UINT ACTION_InstallFiles(MSIPACKAGE *package)
return rc;
}
#define is_dot_dir(x) ((x[0] == '.') && ((x[1] == 0) || ((x[1] == '.') && (x[2] == 0))))
typedef struct
{
struct list entry;
LPWSTR sourcename;
LPWSTR destname;
LPWSTR source;
LPWSTR dest;
} FILE_LIST;
static BOOL msi_move_file(LPCWSTR source, LPCWSTR dest, int options)
{
BOOL ret;
if (GetFileAttributesW(source) == FILE_ATTRIBUTE_DIRECTORY ||
GetFileAttributesW(dest) == FILE_ATTRIBUTE_DIRECTORY)
{
WARN("Source or dest is directory, not moving\n");
return FALSE;
}
if (options == msidbMoveFileOptionsMove)
{
TRACE("moving %s -> %s\n", debugstr_w(source), debugstr_w(dest));
ret = MoveFileExW(source, dest, MOVEFILE_REPLACE_EXISTING);
if (!ret)
{
WARN("MoveFile failed: %d\n", GetLastError());
return FALSE;
}
}
else
{
TRACE("copying %s -> %s\n", debugstr_w(source), debugstr_w(dest));
ret = CopyFileW(source, dest, FALSE);
if (!ret)
{
WARN("CopyFile failed: %d\n", GetLastError());
return FALSE;
}
}
return TRUE;
}
static LPWSTR wildcard_to_file(LPWSTR wildcard, LPWSTR filename)
{
LPWSTR path, ptr;
DWORD dirlen, pathlen;
ptr = strrchrW(wildcard, '\\');
dirlen = ptr - wildcard + 1;
pathlen = dirlen + lstrlenW(filename) + 1;
path = msi_alloc(pathlen * sizeof(WCHAR));
lstrcpynW(path, wildcard, dirlen + 1);
lstrcatW(path, filename);
return path;
}
static void free_file_entry(FILE_LIST *file)
{
msi_free(file->source);
msi_free(file->dest);
msi_free(file);
}
static void free_list(FILE_LIST *list)
{
while (!list_empty(&list->entry))
{
FILE_LIST *file = LIST_ENTRY(list_head(&list->entry), FILE_LIST, entry);
list_remove(&file->entry);
free_file_entry(file);
}
}
static BOOL add_wildcard(FILE_LIST *files, LPWSTR source, LPWSTR dest)
{
FILE_LIST *new, *file;
LPWSTR ptr, filename;
DWORD size;
new = msi_alloc_zero(sizeof(FILE_LIST));
if (!new)
return FALSE;
new->source = strdupW(source);
ptr = strrchrW(dest, '\\') + 1;
filename = strrchrW(new->source, '\\') + 1;
new->sourcename = filename;
if (*ptr)
new->destname = ptr;
else
new->destname = new->sourcename;
size = (ptr - dest) + lstrlenW(filename) + 1;
new->dest = msi_alloc(size * sizeof(WCHAR));
if (!new->dest)
{
free_file_entry(new);
return FALSE;
}
lstrcpynW(new->dest, dest, ptr - dest + 1);
lstrcatW(new->dest, filename);
if (list_empty(&files->entry))
{
list_add_head(&files->entry, &new->entry);
return TRUE;
}
LIST_FOR_EACH_ENTRY(file, &files->entry, FILE_LIST, entry)
{
if (lstrcmpW(source, file->source) < 0)
{
list_add_before(&file->entry, &new->entry);
return TRUE;
}
}
list_add_after(&file->entry, &new->entry);
return TRUE;
}
static BOOL move_files_wildcard(LPWSTR source, LPWSTR dest, int options)
{
WIN32_FIND_DATAW wfd;
HANDLE hfile;
LPWSTR path;
BOOL res;
FILE_LIST files, *file;
DWORD size;
hfile = FindFirstFileW(source, &wfd);
if (hfile == INVALID_HANDLE_VALUE) return FALSE;
list_init(&files.entry);
for (res = TRUE; res; res = FindNextFileW(hfile, &wfd))
{
if (is_dot_dir(wfd.cFileName)) continue;
path = wildcard_to_file(source, wfd.cFileName);
if (!path)
{
res = FALSE;
goto done;
}
add_wildcard(&files, path, dest);
msi_free(path);
}
/* no files match the wildcard */
if (list_empty(&files.entry))
goto done;
/* only the first wildcard match gets renamed to dest */
file = LIST_ENTRY(list_head(&files.entry), FILE_LIST, entry);
size = (strrchrW(file->dest, '\\') - file->dest) + lstrlenW(file->destname) + 2;
file->dest = msi_realloc(file->dest, size * sizeof(WCHAR));
if (!file->dest)
{
res = FALSE;
goto done;
}
/* file->dest may be shorter after the reallocation, so add a NULL
* terminator. This is needed for the call to strrchrW, as there will no
* longer be a NULL terminator within the bounds of the allocation in this case.
*/
file->dest[size - 1] = '\0';
lstrcpyW(strrchrW(file->dest, '\\') + 1, file->destname);
while (!list_empty(&files.entry))
{
file = LIST_ENTRY(list_head(&files.entry), FILE_LIST, entry);
msi_move_file(file->source, file->dest, options);
list_remove(&file->entry);
free_file_entry(file);
}
res = TRUE;
done:
free_list(&files);
FindClose(hfile);
return res;
}
static UINT ITERATE_MoveFiles( MSIRECORD *rec, LPVOID param )
{
MSIPACKAGE *package = param;
MSIRECORD *uirow;
MSICOMPONENT *comp;
LPCWSTR sourcename, component;
LPWSTR sourcedir, destname = NULL, destdir = NULL, source = NULL, dest = NULL;
int options;
DWORD size;
BOOL ret, wildcards;
component = MSI_RecordGetString(rec, 2);
comp = get_loaded_component(package, component);
if (!comp)
return ERROR_SUCCESS;
if (comp->ActionRequest != INSTALLSTATE_LOCAL && comp->ActionRequest != INSTALLSTATE_SOURCE)
{
TRACE("Component not scheduled for installation: %s\n", debugstr_w(component));
comp->Action = comp->Installed;
return ERROR_SUCCESS;
}
comp->Action = comp->ActionRequest;
sourcename = MSI_RecordGetString(rec, 3);
options = MSI_RecordGetInteger(rec, 7);
sourcedir = msi_dup_property(package, MSI_RecordGetString(rec, 5));
if (!sourcedir)
goto done;
destdir = msi_dup_property(package, MSI_RecordGetString(rec, 6));
if (!destdir)
goto done;
if (!sourcename)
{
if (GetFileAttributesW(sourcedir) == INVALID_FILE_ATTRIBUTES)
goto done;
source = strdupW(sourcedir);
if (!source)
goto done;
}
else
{
size = lstrlenW(sourcedir) + lstrlenW(sourcename) + 2;
source = msi_alloc(size * sizeof(WCHAR));
if (!source)
goto done;
lstrcpyW(source, sourcedir);
if (source[lstrlenW(source) - 1] != '\\')
lstrcatW(source, szBackSlash);
lstrcatW(source, sourcename);
}
wildcards = strchrW(source, '*') || strchrW(source, '?');
if (MSI_RecordIsNull(rec, 4))
{
if (!wildcards)
{
destname = strdupW(sourcename);
if (!destname)
goto done;
}
}
else
{
destname = strdupW(MSI_RecordGetString(rec, 4));
if (destname)
reduce_to_longfilename(destname);
}
size = 0;
if (destname)
size = lstrlenW(destname);
size += lstrlenW(destdir) + 2;
dest = msi_alloc(size * sizeof(WCHAR));
if (!dest)
goto done;
lstrcpyW(dest, destdir);
if (dest[lstrlenW(dest) - 1] != '\\')
lstrcatW(dest, szBackSlash);
if (destname)
lstrcatW(dest, destname);
if (GetFileAttributesW(destdir) == INVALID_FILE_ATTRIBUTES)
{
ret = CreateDirectoryW(destdir, NULL);
if (!ret)
{
WARN("CreateDirectory failed: %d\n", GetLastError());
goto done;
}
}
if (!wildcards)
msi_move_file(source, dest, options);
else
move_files_wildcard(source, dest, options);
done:
uirow = MSI_CreateRecord( 9 );
MSI_RecordSetStringW( uirow, 1, MSI_RecordGetString(rec, 1) );
MSI_RecordSetInteger( uirow, 6, 1 ); /* FIXME */
MSI_RecordSetStringW( uirow, 9, destdir );
ui_actiondata( package, szMoveFiles, uirow );
msiobj_release( &uirow->hdr );
msi_free(sourcedir);
msi_free(destdir);
msi_free(destname);
msi_free(source);
msi_free(dest);
return ERROR_SUCCESS;
}
UINT ACTION_MoveFiles( MSIPACKAGE *package )
{
UINT rc;
MSIQUERY *view;
static const WCHAR ExecSeqQuery[] =
{'S','E','L','E','C','T',' ','*',' ','F','R','O','M',' ',
'`','M','o','v','e','F','i','l','e','`',0};
rc = MSI_DatabaseOpenViewW(package->db, ExecSeqQuery, &view);
if (rc != ERROR_SUCCESS)
return ERROR_SUCCESS;
rc = MSI_IterateRecords(view, NULL, ITERATE_MoveFiles, package);
msiobj_release(&view->hdr);
return rc;
}
static WCHAR *get_duplicate_filename( MSIPACKAGE *package, MSIRECORD *row, const WCHAR *file_key, const WCHAR *src )
{
DWORD len;
WCHAR *dst_name, *dst_path, *dst;
if (MSI_RecordIsNull( row, 4 ))
{
len = strlenW( src ) + 1;
if (!(dst_name = msi_alloc( len * sizeof(WCHAR)))) return NULL;
strcpyW( dst_name, strrchrW( src, '\\' ) + 1 );
}
else
{
MSI_RecordGetStringW( row, 4, NULL, &len );
if (!(dst_name = msi_alloc( ++len * sizeof(WCHAR) ))) return NULL;
MSI_RecordGetStringW( row, 4, dst_name, &len );
reduce_to_longfilename( dst_name );
}
if (MSI_RecordIsNull( row, 5 ))
{
WCHAR *p;
dst_path = strdupW( src );
p = strrchrW( dst_path, '\\' );
if (p) *p = 0;
}
else
{
const WCHAR *dst_key = MSI_RecordGetString( row, 5 );
dst_path = resolve_folder( package, dst_key, FALSE, FALSE, TRUE, NULL );
if (!dst_path)
{
/* try a property */
dst_path = msi_dup_property( package, dst_key );
if (!dst_path)
{
FIXME("Unable to get destination folder, try AppSearch properties\n");
msi_free( dst_name );
return NULL;
}
}
}
dst = build_directory_name( 2, dst_path, dst_name );
create_full_pathW( dst_path );
msi_free( dst_name );
msi_free( dst_path );
return dst;
}
static UINT ITERATE_DuplicateFiles(MSIRECORD *row, LPVOID param)
{
MSIPACKAGE *package = param;
WCHAR dest_name[0x100];
LPWSTR dest_path, dest;
LPWSTR dest;
LPCWSTR file_key, component;
DWORD sz;
DWORD rc;
MSICOMPONENT *comp;
MSIRECORD *uirow;
MSIFILE *file;
component = MSI_RecordGetString(row,2);
@@ -376,70 +751,38 @@ static UINT ITERATE_DuplicateFiles(MSIRECORD *row, LPVOID param)
return ERROR_FUNCTION_FAILED;
}
rc = get_file_target(package,file_key,&file);
if (rc != ERROR_SUCCESS)
file = get_loaded_file( package, file_key );
if (!file)
{
ERR("Original file unknown %s\n",debugstr_w(file_key));
ERR("Original file unknown %s\n", debugstr_w(file_key));
return ERROR_SUCCESS;
}
if (MSI_RecordIsNull(row,4))
strcpyW(dest_name,strrchrW(file->TargetPath,'\\')+1);
else
dest = get_duplicate_filename( package, row, file_key, file->TargetPath );
if (!dest)
{
sz=0x100;
MSI_RecordGetStringW(row,4,dest_name,&sz);
reduce_to_longfilename(dest_name);
WARN("Unable to get duplicate filename\n");
return ERROR_SUCCESS;
}
if (MSI_RecordIsNull(row,5))
TRACE("Duplicating file %s to %s\n", debugstr_w(file->TargetPath), debugstr_w(dest));
if (!CopyFileW( file->TargetPath, dest, TRUE ))
{
LPWSTR p;
dest_path = strdupW(file->TargetPath);
p = strrchrW(dest_path,'\\');
if (p)
*p=0;
WARN("Failed to copy file %s -> %s (%u)\n",
debugstr_w(file->TargetPath), debugstr_w(dest), GetLastError());
}
else
{
LPCWSTR destkey;
destkey = MSI_RecordGetString(row,5);
dest_path = resolve_folder(package, destkey, FALSE, FALSE, TRUE, NULL);
if (!dest_path)
{
/* try a Property */
dest_path = msi_dup_property( package, destkey );
if (!dest_path)
{
FIXME("Unable to get destination folder, try AppSearch properties\n");
return ERROR_SUCCESS;
}
}
}
dest = build_directory_name(2, dest_path, dest_name);
create_full_pathW(dest_path);
TRACE("Duplicating file %s to %s\n",debugstr_w(file->TargetPath),
debugstr_w(dest));
if (strcmpW(file->TargetPath,dest))
rc = !CopyFileW(file->TargetPath,dest,TRUE);
else
rc = ERROR_SUCCESS;
if (rc != ERROR_SUCCESS)
ERR("Failed to copy file %s -> %s, last error %d\n",
debugstr_w(file->TargetPath), debugstr_w(dest_path), GetLastError());
FIXME("We should track these duplicate files as well\n");
msi_free(dest_path);
uirow = MSI_CreateRecord( 9 );
MSI_RecordSetStringW( uirow, 1, MSI_RecordGetString( row, 1 ) );
MSI_RecordSetInteger( uirow, 6, file->FileSize );
MSI_RecordSetStringW( uirow, 9, MSI_RecordGetString( row, 5 ) );
ui_actiondata( package, szDuplicateFiles, uirow );
msiobj_release( &uirow->hdr );
msi_free(dest);
msi_file_update_ui(package, file, szDuplicateFiles);
return ERROR_SUCCESS;
}
@@ -461,6 +804,84 @@ UINT ACTION_DuplicateFiles(MSIPACKAGE *package)
return rc;
}
static UINT ITERATE_RemoveDuplicateFiles( MSIRECORD *row, LPVOID param )
{
MSIPACKAGE *package = param;
LPWSTR dest;
LPCWSTR file_key, component;
MSICOMPONENT *comp;
MSIRECORD *uirow;
MSIFILE *file;
component = MSI_RecordGetString( row, 2 );
comp = get_loaded_component( package, component );
if (!comp)
return ERROR_SUCCESS;
if (comp->ActionRequest != INSTALLSTATE_ABSENT)
{
TRACE("Component not scheduled for removal %s\n", debugstr_w(component));
comp->Action = comp->Installed;
return ERROR_SUCCESS;
}
comp->Action = INSTALLSTATE_ABSENT;
file_key = MSI_RecordGetString( row, 3 );
if (!file_key)
{
ERR("Unable to get file key\n");
return ERROR_FUNCTION_FAILED;
}
file = get_loaded_file( package, file_key );
if (!file)
{
ERR("Original file unknown %s\n", debugstr_w(file_key));
return ERROR_SUCCESS;
}
dest = get_duplicate_filename( package, row, file_key, file->TargetPath );
if (!dest)
{
WARN("Unable to get duplicate filename\n");
return ERROR_SUCCESS;
}
TRACE("Removing duplicate %s of %s\n", debugstr_w(dest), debugstr_w(file->TargetPath));
if (!DeleteFileW( dest ))
{
WARN("Failed to delete duplicate file %s (%u)\n", debugstr_w(dest), GetLastError());
}
uirow = MSI_CreateRecord( 9 );
MSI_RecordSetStringW( uirow, 1, MSI_RecordGetString( row, 1 ) );
MSI_RecordSetStringW( uirow, 9, MSI_RecordGetString( row, 5 ) );
ui_actiondata( package, szRemoveDuplicateFiles, uirow );
msiobj_release( &uirow->hdr );
msi_free(dest);
return ERROR_SUCCESS;
}
UINT ACTION_RemoveDuplicateFiles( MSIPACKAGE *package )
{
UINT rc;
MSIQUERY *view;
static const WCHAR query[] =
{'S','E','L','E','C','T',' ','*',' ','F','R','O','M',' ',
'`','D','u','p','l','i','c','a','t','e','F','i','l','e','`',0};
rc = MSI_DatabaseOpenViewW( package->db, query, &view );
if (rc != ERROR_SUCCESS)
return ERROR_SUCCESS;
rc = MSI_IterateRecords( view, NULL, ITERATE_RemoveDuplicateFiles, package );
msiobj_release( &view->hdr );
return rc;
}
static BOOL verify_comp_for_removal(MSICOMPONENT *comp, UINT install_mode)
{
INSTALLSTATE request = comp->ActionRequest;
@@ -491,6 +912,7 @@ static UINT ITERATE_RemoveFiles(MSIRECORD *row, LPVOID param)
{
MSIPACKAGE *package = param;
MSICOMPONENT *comp;
MSIRECORD *uirow;
LPCWSTR component, filename, dirprop;
UINT install_mode;
LPWSTR dir = NULL, path = NULL;
@@ -529,11 +951,10 @@ static UINT ITERATE_RemoveFiles(MSIRECORD *row, LPVOID param)
goto done;
}
lstrcpyW(path, dir);
PathAddBackslashW(path);
if (filename)
{
lstrcpyW(path, dir);
PathAddBackslashW(path);
lstrcatW(path, filename);
TRACE("Deleting misc file: %s\n", debugstr_w(path));
@@ -541,11 +962,17 @@ static UINT ITERATE_RemoveFiles(MSIRECORD *row, LPVOID param)
}
else
{
TRACE("Removing misc directory: %s\n", debugstr_w(path));
RemoveDirectoryW(path);
TRACE("Removing misc directory: %s\n", debugstr_w(dir));
RemoveDirectoryW(dir);
}
done:
uirow = MSI_CreateRecord( 9 );
MSI_RecordSetStringW( uirow, 1, MSI_RecordGetString(row, 1) );
MSI_RecordSetStringW( uirow, 9, dir );
ui_actiondata( package, szRemoveFiles, uirow );
msiobj_release( &uirow->hdr );
msi_free(path);
msi_free(dir);
return ERROR_SUCCESS;
@@ -560,6 +987,9 @@ UINT ACTION_RemoveFiles( MSIPACKAGE *package )
static const WCHAR query[] = {
'S','E','L','E','C','T',' ','*',' ','F','R','O','M',' ',
'`','R','e','m','o','v','e','F','i','l','e','`',0};
static const WCHAR folder_query[] = {
'S','E','L','E','C','T',' ','*',' ','F','R','O','M',' ',
'`','C','r','e','a','t','e','F','o','l','d','e','r','`',0};
r = MSI_DatabaseOpenViewW(package->db, query, &view);
if (r == ERROR_SUCCESS)
@@ -568,10 +998,14 @@ UINT ACTION_RemoveFiles( MSIPACKAGE *package )
msiobj_release(&view->hdr);
}
r = MSI_DatabaseOpenViewW(package->db, folder_query, &view);
if (r == ERROR_SUCCESS)
msiobj_release(&view->hdr);
LIST_FOR_EACH_ENTRY( file, &package->files, MSIFILE, entry )
{
MSIRECORD *uirow;
LPWSTR uipath, p;
LPWSTR dir, uipath, p;
if ( file->state == msifs_installed )
ERR("removing installed file %s\n", debugstr_w(file->TargetPath));
@@ -587,8 +1021,17 @@ UINT ACTION_RemoveFiles( MSIPACKAGE *package )
continue;
TRACE("removing %s\n", debugstr_w(file->File) );
if ( !DeleteFileW( file->TargetPath ) )
TRACE("failed to delete %s\n", debugstr_w(file->TargetPath));
if (!DeleteFileW( file->TargetPath ))
{
WARN("failed to delete %s\n", debugstr_w(file->TargetPath));
}
/* FIXME: check persistence for each directory */
else if (r && (dir = strdupW( file->TargetPath )))
{
if ((p = strrchrW( dir, '\\' ))) *p = 0;
RemoveDirectoryW( dir );
msi_free( dir );
}
file->state = msifs_missing;
/* the UI chunk */
+1 -20
View File
@@ -156,25 +156,6 @@ MSIFOLDER *get_loaded_folder( MSIPACKAGE *package, LPCWSTR dir )
return NULL;
}
void msi_reset_folders( MSIPACKAGE *package, BOOL source )
{
MSIFOLDER *folder;
LIST_FOR_EACH_ENTRY( folder, &package->folders, MSIFOLDER, entry )
{
if ( source )
{
msi_free( folder->ResolvedSource );
folder->ResolvedSource = NULL;
}
else
{
msi_free( folder->ResolvedTarget );
folder->ResolvedTarget = NULL;
}
}
}
static LPWSTR get_source_root( MSIPACKAGE *package )
{
LPWSTR path, p;
@@ -732,7 +713,7 @@ UINT register_unique_action(MSIPACKAGE *package, LPCWSTR action)
if (!package->script)
return FALSE;
TRACE("Registering Action %s as having fun\n",debugstr_w(action));
TRACE("Registering %s as unique action\n", debugstr_w(action));
count = package->script->UniqueActionsCount;
package->script->UniqueActionsCount++;
+10 -7
View File
@@ -29,28 +29,31 @@ LANGUAGE LANG_NEUTRAL, SUBLANG_NEUTRAL
#include "msi_Bg.rc"
#include "msi_Da.rc"
#include "msi_De.rc"
#include "msi_En.rc"
#include "msi_Eo.rc"
#include "msi_Es.rc"
#include "msi_Fi.rc"
#include "msi_Fr.rc"
#include "msi_Hu.rc"
#include "msi_It.rc"
#include "msi_Ko.rc"
#include "msi_Lt.rc"
#include "msi_Nl.rc"
#include "msi_No.rc"
#include "msi_Pl.rc"
#include "msi_Pt.rc"
#include "msi_Ro.rc"
#include "msi_Ru.rc"
#include "msi_Si.rc"
#include "msi_Sv.rc"
#include "msi_Tr.rc"
#include "msi_Uk.rc"
#include "msi_Zh.rc"
/* UTF-8 */
#include "msi_De.rc"
#include "msi_Fr.rc"
#include "msi_It.rc"
#include "msi_Lt.rc"
#include "msi_Ro.rc"
#include "msi_Ru.rc"
#include "msi_Si.rc"
LANGUAGE LANG_NEUTRAL, SUBLANG_NEUTRAL
/* @makedep: msiserver.tlb */
+10 -1
View File
@@ -955,7 +955,9 @@ extern UINT ACTION_CCPSearch(MSIPACKAGE *package);
extern UINT ACTION_FindRelatedProducts(MSIPACKAGE *package);
extern UINT ACTION_InstallFiles(MSIPACKAGE *package);
extern UINT ACTION_RemoveFiles(MSIPACKAGE *package);
extern UINT ACTION_MoveFiles(MSIPACKAGE *package);
extern UINT ACTION_DuplicateFiles(MSIPACKAGE *package);
extern UINT ACTION_RemoveDuplicateFiles(MSIPACKAGE *package);
extern UINT ACTION_RegisterClassInfo(MSIPACKAGE *package);
extern UINT ACTION_RegisterProgIdInfo(MSIPACKAGE *package);
extern UINT ACTION_RegisterExtensionInfo(MSIPACKAGE *package);
@@ -975,7 +977,6 @@ extern MSICOMPONENT *get_loaded_component( MSIPACKAGE* package, LPCWSTR Componen
extern MSIFEATURE *get_loaded_feature( MSIPACKAGE* package, LPCWSTR Feature );
extern MSIFILE *get_loaded_file( MSIPACKAGE* package, LPCWSTR file );
extern MSIFOLDER *get_loaded_folder( MSIPACKAGE *package, LPCWSTR dir );
extern void msi_reset_folders( MSIPACKAGE *package, BOOL source );
extern int track_tempfile(MSIPACKAGE *package, LPCWSTR path);
extern UINT schedule_action(MSIPACKAGE *package, UINT script, LPCWSTR action);
extern void msi_free_action_script(MSIPACKAGE *package, UINT script);
@@ -1064,6 +1065,7 @@ static const WCHAR szRegisterProgIdInfo[] = {'R','e','g','i','s','t','e','r','P'
static const WCHAR szRegisterExtensionInfo[] = {'R','e','g','i','s','t','e','r','E','x','t','e','n','s','i','o','n','I','n','f','o',0};
static const WCHAR szRegisterMIMEInfo[] = {'R','e','g','i','s','t','e','r','M','I','M','E','I','n','f','o',0};
static const WCHAR szDuplicateFiles[] = {'D','u','p','l','i','c','a','t','e','F','i','l','e','s',0};
static const WCHAR szRemoveDuplicateFiles[] = {'R','e','m','o','v','e','D','u','p','l','i','c','a','t','e','F','i','l','e','s',0};
static const WCHAR szInstallFiles[] = {'I','n','s','t','a','l','l','F','i','l','e','s',0};
static const WCHAR szRemoveFiles[] = {'R','e','m','o','v','e','F','i','l','e','s',0};
static const WCHAR szFindRelatedProducts[] = {'F','i','n','d','R','e','l','a','t','e','d','P','r','o','d','u','c','t','s',0};
@@ -1075,6 +1077,13 @@ static const WCHAR szPIDTemplate[] = {'P','I','D','T','e','m','p','l','a','t','e
static const WCHAR szPIDKEY[] = {'P','I','D','K','E','Y',0};
static const WCHAR szTYPELIB[] = {'T','Y','P','E','L','I','B',0};
static const WCHAR szSumInfo[] = {5 ,'S','u','m','m','a','r','y','I','n','f','o','r','m','a','t','i','o','n',0};
static const WCHAR szHCR[] = {'H','K','E','Y','_','C','L','A','S','S','E','S','_','R','O','O','T','\\',0};
static const WCHAR szHCU[] = {'H','K','E','Y','_','C','U','R','R','E','N','T','_','U','S','E','R','\\',0};
static const WCHAR szHLM[] = {'H','K','E','Y','_','L','O','C','A','L','_','M','A','C','H','I','N','E','\\',0};
static const WCHAR szHU[] = {'H','K','E','Y','_','U','S','E','R','S','\\',0};
static const WCHAR szWindowsFolder[] = {'W','i','n','d','o','w','s','F','o','l','d','e','r',0};
static const WCHAR szAppSearch[] = {'A','p','p','S','e','a','r','c','h',0};
static const WCHAR szMoveFiles[] = {'M','o','v','e','F','i','l','e','s',0};
/* memory allocation macro functions */
static void *msi_alloc( size_t len ) __WINE_ALLOC_SIZE(1);
+19
View File
@@ -1621,6 +1621,25 @@ end:
return r;
}
static void msi_reset_folders( MSIPACKAGE *package, BOOL source )
{
MSIFOLDER *folder;
LIST_FOR_EACH_ENTRY( folder, &package->folders, MSIFOLDER, entry )
{
if ( source )
{
msi_free( folder->ResolvedSource );
folder->ResolvedSource = NULL;
}
else
{
msi_free( folder->ResolvedTarget );
folder->ResolvedTarget = NULL;
}
}
}
UINT MSI_SetPropertyW( MSIPACKAGE *package, LPCWSTR szName, LPCWSTR szValue)
{
MSIQUERY *view;
+2 -2
View File
@@ -527,9 +527,9 @@ static INT add_streams_to_table(MSISTREAMSVIEW *sv)
break;
}
if (!strcmpW(stat.pwcsName, szSumInfo))
/* these streams appear to be unencoded */
if (*stat.pwcsName == 0x0005)
{
/* summary information stream is not encoded */
r = db_get_raw_stream(sv->db, stat.pwcsName, &stream->stream);
}
else
+10 -3
View File
@@ -182,9 +182,10 @@ static UINT ITERATE_FindRelatedProducts(MSIRECORD *rec, LPVOID param)
continue;
}
action_property = MSI_RecordGetString(rec,7);
append_productcode(package,action_property,productid);
ui_actiondata(package,szFindRelatedProducts,uirow);
action_property = MSI_RecordGetString(rec, 7);
append_productcode(package, action_property, productid);
MSI_RecordSetStringW(uirow, 1, productid);
ui_actiondata(package, szFindRelatedProducts, uirow);
}
index ++;
}
@@ -202,6 +203,12 @@ UINT ACTION_FindRelatedProducts(MSIPACKAGE *package)
UINT rc = ERROR_SUCCESS;
MSIQUERY *view;
if (msi_get_property_int(package, szInstalled, 0))
{
TRACE("Skipping FindRelatedProducts action: product already installed\n");
return ERROR_SUCCESS;
}
if (check_unique_action(package,szFindRelatedProducts))
{
TRACE("Skipping FindRelatedProducts action: already done on client side\n");
+9
View File
@@ -222,6 +222,15 @@ enum msidbRemoveFileInstallMode
msidbRemoveFileInstallModeOnBoth = 0x00000003,
};
enum
{
msidbIniFileActionAddLine = 0x00000000,
msidbIniFileActionCreateLine = 0x00000001,
msidbIniFileActionRemoveLine = 0x00000002,
msidbIniFileActionAddTag = 0x00000003,
msidbIniFileActionRemoveTag = 0x00000004
};
/*
* Windows SDK braindamage alert
*