Commit ef1b0cac authored by Rob Shearman's avatar Rob Shearman Committed by Alexandre Julliard

msi: Reduce destination file name used in the MoveFiles action to the long file name.

Add a test for this behaviour.
parent e738f614
...@@ -5564,7 +5564,8 @@ static UINT ITERATE_MoveFiles( MSIRECORD *rec, LPVOID param ) ...@@ -5564,7 +5564,8 @@ static UINT ITERATE_MoveFiles( MSIRECORD *rec, LPVOID param )
{ {
MSIPACKAGE *package = param; MSIPACKAGE *package = param;
MSICOMPONENT *comp; MSICOMPONENT *comp;
LPCWSTR sourcename, destname; LPCWSTR sourcename;
LPWSTR destname = NULL;
LPWSTR sourcedir = NULL, destdir = NULL; LPWSTR sourcedir = NULL, destdir = NULL;
LPWSTR source = NULL, dest = NULL; LPWSTR source = NULL, dest = NULL;
int options; int options;
...@@ -5582,7 +5583,6 @@ static UINT ITERATE_MoveFiles( MSIRECORD *rec, LPVOID param ) ...@@ -5582,7 +5583,6 @@ static UINT ITERATE_MoveFiles( MSIRECORD *rec, LPVOID param )
} }
sourcename = MSI_RecordGetString(rec, 3); sourcename = MSI_RecordGetString(rec, 3);
destname = MSI_RecordGetString(rec, 4);
options = MSI_RecordGetInteger(rec, 7); options = MSI_RecordGetInteger(rec, 7);
sourcedir = msi_dup_property(package, MSI_RecordGetString(rec, 5)); sourcedir = msi_dup_property(package, MSI_RecordGetString(rec, 5));
...@@ -5617,11 +5617,20 @@ static UINT ITERATE_MoveFiles( MSIRECORD *rec, LPVOID param ) ...@@ -5617,11 +5617,20 @@ static UINT ITERATE_MoveFiles( MSIRECORD *rec, LPVOID param )
wildcards = strchrW(source, '*') || strchrW(source, '?'); wildcards = strchrW(source, '*') || strchrW(source, '?');
if (!destname && !wildcards) if (MSI_RecordIsNull(rec, 4))
{ {
destname = strdupW(sourcename); if (!wildcards)
if (!destname) {
goto done; destname = strdupW(sourcename);
if (!destname)
goto done;
}
}
else
{
destname = strdupW(MSI_RecordGetString(rec, 4));
if (destname)
reduce_to_longfilename(destname);
} }
size = 0; size = 0;
...@@ -5658,6 +5667,7 @@ static UINT ITERATE_MoveFiles( MSIRECORD *rec, LPVOID param ) ...@@ -5658,6 +5667,7 @@ static UINT ITERATE_MoveFiles( MSIRECORD *rec, LPVOID param )
done: done:
msi_free(sourcedir); msi_free(sourcedir);
msi_free(destdir); msi_free(destdir);
msi_free(destname);
msi_free(source); msi_free(source);
msi_free(dest); msi_free(dest);
......
...@@ -575,6 +575,7 @@ static const CHAR mov_move_file_dat[] = "FileKey\tComponent_\tSourceName\tDestNa ...@@ -575,6 +575,7 @@ static const CHAR mov_move_file_dat[] = "FileKey\tComponent_\tSourceName\tDestNa
"kazakhstan\taugustus\t\tkiribati\tFILEPATHGOOD\tMSITESTDIR\t1\n" "kazakhstan\taugustus\t\tkiribati\tFILEPATHGOOD\tMSITESTDIR\t1\n"
"laos\taugustus\tlatvia\tlebanon\tSourceDir\tMSITESTDIR\t1\n" "laos\taugustus\tlatvia\tlebanon\tSourceDir\tMSITESTDIR\t1\n"
"namibia\taugustus\tnauru\tkiribati\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" "wildcard\taugustus\tapp*\twildcard\tSourceDir\tMSITESTDIR\t1\n"
"single\taugustus\tf?o\tsingle\tSourceDir\tMSITESTDIR\t1\n" "single\taugustus\tf?o\tsingle\tSourceDir\tMSITESTDIR\t1\n"
"wildcardnodest\taugustus\tbudd*\t\tSourceDir\tMSITESTDIR\t1\n" "wildcardnodest\taugustus\tbudd*\t\tSourceDir\tMSITESTDIR\t1\n"
...@@ -4390,6 +4391,7 @@ static void test_movefiles(void) ...@@ -4390,6 +4391,7 @@ static void test_movefiles(void)
create_file("kenya", 100); create_file("kenya", 100);
CreateDirectoryA("latvia", NULL); CreateDirectoryA("latvia", NULL);
create_file("nauru", 100); create_file("nauru", 100);
create_file("peru", 100);
create_file("apple", 100); create_file("apple", 100);
create_file("application", 100); create_file("application", 100);
create_file("ape", 100); create_file("ape", 100);
...@@ -4430,6 +4432,7 @@ static void test_movefiles(void) ...@@ -4430,6 +4432,7 @@ static void test_movefiles(void)
ok(delete_pf("msitest\\kiribati", TRUE), "File not moved\n"); ok(delete_pf("msitest\\kiribati", TRUE), "File not moved\n");
ok(!delete_pf("msitest\\lebanon", TRUE), "File moved\n"); ok(!delete_pf("msitest\\lebanon", TRUE), "File moved\n");
ok(!delete_pf("msitest\\lebanon", FALSE), "Directory 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 */ /* either apple or application will be moved depending on directory order */
if (!delete_pf("msitest\\apple", TRUE)) if (!delete_pf("msitest\\apple", TRUE))
ok(delete_pf("msitest\\application", TRUE), "File not moved\n"); ok(delete_pf("msitest\\application", TRUE), "File not moved\n");
...@@ -4462,6 +4465,7 @@ static void test_movefiles(void) ...@@ -4462,6 +4465,7 @@ static void test_movefiles(void)
ok(!DeleteFileA("kenya"), "File not moved\n"); ok(!DeleteFileA("kenya"), "File not moved\n");
ok(RemoveDirectoryA("latvia"), "Directory moved\n"); ok(RemoveDirectoryA("latvia"), "Directory moved\n");
ok(!DeleteFileA("nauru"), "File not 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("apple"), "File not moved\n");
ok(!DeleteFileA("application"), "File not moved\n"); ok(!DeleteFileA("application"), "File not moved\n");
ok(DeleteFileA("ape"), "File moved\n"); ok(DeleteFileA("ape"), "File moved\n");
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment