Rob Shearman : msi: Reduce destination file name used in the MoveFiles action to the long file name .
Alexandre Julliard
julliard at winehq.org
Wed Sep 10 06:01:52 CDT 2008
Module: wine
Branch: master
Commit: ef1b0cacfa47e01d859f1477adc8359343caa65c
URL: http://source.winehq.org/git/wine.git/?a=commit;h=ef1b0cacfa47e01d859f1477adc8359343caa65c
Author: Rob Shearman <robertshearman at gmail.com>
Date: Wed Sep 10 11:01:15 2008 +0100
msi: Reduce destination file name used in the MoveFiles action to the long file name.
Add a test for this behaviour.
---
dlls/msi/action.c | 22 ++++++++++++++++------
dlls/msi/tests/install.c | 4 ++++
2 files changed, 20 insertions(+), 6 deletions(-)
diff --git a/dlls/msi/action.c b/dlls/msi/action.c
index 2208b58..cb43c5d 100644
--- a/dlls/msi/action.c
+++ b/dlls/msi/action.c
@@ -5564,7 +5564,8 @@ static UINT ITERATE_MoveFiles( MSIRECORD *rec, LPVOID param )
{
MSIPACKAGE *package = param;
MSICOMPONENT *comp;
- LPCWSTR sourcename, destname;
+ LPCWSTR sourcename;
+ LPWSTR destname = NULL;
LPWSTR sourcedir = NULL, destdir = NULL;
LPWSTR source = NULL, dest = NULL;
int options;
@@ -5582,7 +5583,6 @@ static UINT ITERATE_MoveFiles( MSIRECORD *rec, LPVOID param )
}
sourcename = MSI_RecordGetString(rec, 3);
- destname = MSI_RecordGetString(rec, 4);
options = MSI_RecordGetInteger(rec, 7);
sourcedir = msi_dup_property(package, MSI_RecordGetString(rec, 5));
@@ -5617,11 +5617,20 @@ static UINT ITERATE_MoveFiles( MSIRECORD *rec, LPVOID param )
wildcards = strchrW(source, '*') || strchrW(source, '?');
- if (!destname && !wildcards)
+ if (MSI_RecordIsNull(rec, 4))
{
- destname = strdupW(sourcename);
- if (!destname)
- goto done;
+ if (!wildcards)
+ {
+ destname = strdupW(sourcename);
+ if (!destname)
+ goto done;
+ }
+ }
+ else
+ {
+ destname = strdupW(MSI_RecordGetString(rec, 4));
+ if (destname)
+ reduce_to_longfilename(destname);
}
size = 0;
@@ -5658,6 +5667,7 @@ static UINT ITERATE_MoveFiles( MSIRECORD *rec, LPVOID param )
done:
msi_free(sourcedir);
msi_free(destdir);
+ msi_free(destname);
msi_free(source);
msi_free(dest);
diff --git a/dlls/msi/tests/install.c b/dlls/msi/tests/install.c
index adfe28e..239abb6 100644
--- a/dlls/msi/tests/install.c
+++ b/dlls/msi/tests/install.c
@@ -575,6 +575,7 @@ static const CHAR mov_move_file_dat[] = "FileKey\tComponent_\tSourceName\tDestNa
"kazakhstan\taugustus\t\tkiribati\tFILEPATHGOOD\tMSITESTDIR\t1\n"
"laos\taugustus\tlatvia\tlebanon\tSourceDir\tMSITESTDIR\t1\n"
"namibia\taugustus\tnauru\tkiribati\tSourceDir\tMSITESTDIR\t1\n"
+ "pakistan\taugustus\tperu\tsfn|poland\tSourceDir\tMSITESTDIR\t1\n"
"wildcard\taugustus\tapp*\twildcard\tSourceDir\tMSITESTDIR\t1\n"
"single\taugustus\tf?o\tsingle\tSourceDir\tMSITESTDIR\t1\n"
"wildcardnodest\taugustus\tbudd*\t\tSourceDir\tMSITESTDIR\t1\n"
@@ -4390,6 +4391,7 @@ static void test_movefiles(void)
create_file("kenya", 100);
CreateDirectoryA("latvia", NULL);
create_file("nauru", 100);
+ create_file("peru", 100);
create_file("apple", 100);
create_file("application", 100);
create_file("ape", 100);
@@ -4430,6 +4432,7 @@ static void test_movefiles(void)
ok(delete_pf("msitest\\kiribati", TRUE), "File not moved\n");
ok(!delete_pf("msitest\\lebanon", TRUE), "File moved\n");
ok(!delete_pf("msitest\\lebanon", FALSE), "Directory moved\n");
+ ok(delete_pf("msitest\\poland", TRUE), "File not moved\n");
/* either apple or application will be moved depending on directory order */
if (!delete_pf("msitest\\apple", TRUE))
ok(delete_pf("msitest\\application", TRUE), "File not moved\n");
@@ -4462,6 +4465,7 @@ static void test_movefiles(void)
ok(!DeleteFileA("kenya"), "File not moved\n");
ok(RemoveDirectoryA("latvia"), "Directory moved\n");
ok(!DeleteFileA("nauru"), "File not moved\n");
+ ok(!DeleteFileA("peru"), "File not moved\n");
ok(!DeleteFileA("apple"), "File not moved\n");
ok(!DeleteFileA("application"), "File not moved\n");
ok(DeleteFileA("ape"), "File moved\n");
More information about the wine-cvs
mailing list