Commit bc801f85 authored by Hans Leidekker's avatar Hans Leidekker Committed by Alexandre Julliard

msi: Set the SourceDir and SOURCEDIR properties in MsiGetSourcePath.

parent 4381cabf
...@@ -347,16 +347,10 @@ UINT WINAPI MsiGetTargetPathW( MSIHANDLE hInstall, LPCWSTR szFolder, ...@@ -347,16 +347,10 @@ UINT WINAPI MsiGetTargetPathW( MSIHANDLE hInstall, LPCWSTR szFolder,
return MSI_GetTargetPath( hInstall, szFolder, &path, pcchPathBuf ); return MSI_GetTargetPath( hInstall, szFolder, &path, pcchPathBuf );
} }
static WCHAR *get_source_root( MSIDATABASE *db ) static WCHAR *get_source_root( MSIPACKAGE *package )
{ {
WCHAR *path, *p; msi_set_sourcedir_props( package, FALSE );
return msi_dup_property( package->db, szSourceDir );
if ((path = msi_dup_property( db, szSourceDir ))) return path;
if ((path = msi_dup_property( db, szDatabase )))
{
if ((p = strrchrW( path, '\\' ))) p[1] = 0;
}
return path;
} }
WCHAR *msi_resolve_source_folder( MSIPACKAGE *package, const WCHAR *name, MSIFOLDER **folder ) WCHAR *msi_resolve_source_folder( MSIPACKAGE *package, const WCHAR *name, MSIFOLDER **folder )
...@@ -372,7 +366,7 @@ WCHAR *msi_resolve_source_folder( MSIPACKAGE *package, const WCHAR *name, MSIFOL ...@@ -372,7 +366,7 @@ WCHAR *msi_resolve_source_folder( MSIPACKAGE *package, const WCHAR *name, MSIFOL
/* special resolving for root dir */ /* special resolving for root dir */
if (!strcmpW( name, szTargetDir ) && !f->ResolvedSource) if (!strcmpW( name, szTargetDir ) && !f->ResolvedSource)
{ {
f->ResolvedSource = get_source_root( package->db ); f->ResolvedSource = get_source_root( package );
} }
if (folder) *folder = f; if (folder) *folder = f;
if (f->ResolvedSource) if (f->ResolvedSource)
...@@ -388,7 +382,7 @@ WCHAR *msi_resolve_source_folder( MSIPACKAGE *package, const WCHAR *name, MSIFOL ...@@ -388,7 +382,7 @@ WCHAR *msi_resolve_source_folder( MSIPACKAGE *package, const WCHAR *name, MSIFOL
p = msi_resolve_source_folder( package, parent, NULL ); p = msi_resolve_source_folder( package, parent, NULL );
if (package->WordCount & msidbSumInfoSourceTypeCompressed) if (package->WordCount & msidbSumInfoSourceTypeCompressed)
path = get_source_root( package->db ); path = get_source_root( package );
else if (package->WordCount & msidbSumInfoSourceTypeSFN) else if (package->WordCount & msidbSumInfoSourceTypeSFN)
path = msi_build_directory_name( 3, p, f->SourceShortPath, NULL ); path = msi_build_directory_name( 3, p, f->SourceShortPath, NULL );
else else
......
...@@ -10972,13 +10972,17 @@ static void test_MsiGetSourcePath(void) ...@@ -10972,13 +10972,17 @@ static void test_MsiGetSourcePath(void)
/* source path does not exist, but the property exists */ /* source path does not exist, but the property exists */
size = MAX_PATH; size = MAX_PATH;
lstrcpyA(path, "kiwi"); lstrcpyA(path, "kiwi");
r = MsiGetProperty(hpkg, "SourceDir", path, &size);
ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
ok(!lstrcmpA(path, cwd), "Expected \"%s\", got \"%s\"\n", cwd, path);
ok(size == lstrlenA(cwd), "Expected %d, got %d\n", lstrlenA(cwd), size);
size = MAX_PATH;
lstrcpyA(path, "kiwi");
r = MsiGetProperty(hpkg, "SOURCEDIR", path, &size); r = MsiGetProperty(hpkg, "SOURCEDIR", path, &size);
ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r); ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
todo_wine ok(!lstrcmpA(path, cwd), "Expected \"%s\", got \"%s\"\n", cwd, path);
{ ok(size == lstrlenA(cwd), "Expected %d, got %d\n", lstrlenA(cwd), size);
ok(!lstrcmpA(path, cwd), "Expected \"%s\", got \"%s\"\n", cwd, path);
ok(size == lstrlenA(cwd), "Expected %d, got %d\n", lstrlenA(cwd), size);
}
/* try SubDir after CostInitialize */ /* try SubDir after CostInitialize */
size = MAX_PATH; size = MAX_PATH;
...@@ -11027,6 +11031,13 @@ static void test_MsiGetSourcePath(void) ...@@ -11027,6 +11031,13 @@ static void test_MsiGetSourcePath(void)
/* source path does not exist, but the property exists */ /* source path does not exist, but the property exists */
size = MAX_PATH; size = MAX_PATH;
lstrcpyA(path, "kiwi"); lstrcpyA(path, "kiwi");
r = MsiGetProperty(hpkg, "SourceDir", path, &size);
ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
ok(!lstrcmpA(path, cwd), "Expected \"%s\", got \"%s\"\n", cwd, path);
ok(size == lstrlenA(cwd), "Expected %d, got %d\n", lstrlenA(cwd), size);
size = MAX_PATH;
lstrcpyA(path, "kiwi");
r = MsiGetProperty(hpkg, "SOURCEDIR", path, &size); r = MsiGetProperty(hpkg, "SOURCEDIR", path, &size);
ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r); ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
ok(!lstrcmpA(path, cwd), "Expected \"%s\", got \"%s\"\n", cwd, path); ok(!lstrcmpA(path, cwd), "Expected \"%s\", got \"%s\"\n", cwd, path);
...@@ -11079,6 +11090,13 @@ static void test_MsiGetSourcePath(void) ...@@ -11079,6 +11090,13 @@ static void test_MsiGetSourcePath(void)
/* source path does not exist, but the property exists */ /* source path does not exist, but the property exists */
size = MAX_PATH; size = MAX_PATH;
lstrcpyA(path, "kiwi"); lstrcpyA(path, "kiwi");
r = MsiGetProperty(hpkg, "SourceDir", path, &size);
ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
ok(!lstrcmpA(path, cwd), "Expected \"%s\", got \"%s\"\n", cwd, path);
ok(size == lstrlenA(cwd), "Expected %d, got %d\n", lstrlenA(cwd), size);
size = MAX_PATH;
lstrcpyA(path, "kiwi");
r = MsiGetProperty(hpkg, "SOURCEDIR", path, &size); r = MsiGetProperty(hpkg, "SOURCEDIR", path, &size);
ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r); ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
ok(!lstrcmpA(path, cwd), "Expected \"%s\", got \"%s\"\n", cwd, path); ok(!lstrcmpA(path, cwd), "Expected \"%s\", got \"%s\"\n", cwd, path);
...@@ -11131,6 +11149,13 @@ static void test_MsiGetSourcePath(void) ...@@ -11131,6 +11149,13 @@ static void test_MsiGetSourcePath(void)
/* source path does not exist, but the property exists */ /* source path does not exist, but the property exists */
size = MAX_PATH; size = MAX_PATH;
lstrcpyA(path, "kiwi"); lstrcpyA(path, "kiwi");
r = MsiGetProperty(hpkg, "SourceDir", path, &size);
ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
ok(!lstrcmpA(path, cwd), "Expected \"%s\", got \"%s\"\n", cwd, path);
ok(size == lstrlenA(cwd), "Expected %d, got %d\n", lstrlenA(cwd), size);
size = MAX_PATH;
lstrcpyA(path, "kiwi");
r = MsiGetProperty(hpkg, "SOURCEDIR", path, &size); r = MsiGetProperty(hpkg, "SOURCEDIR", path, &size);
ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r); ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
ok(!lstrcmpA(path, cwd), "Expected \"%s\", got \"%s\"\n", cwd, path); ok(!lstrcmpA(path, cwd), "Expected \"%s\", got \"%s\"\n", cwd, path);
...@@ -11268,6 +11293,13 @@ static void test_MsiGetSourcePath(void) ...@@ -11268,6 +11293,13 @@ static void test_MsiGetSourcePath(void)
/* source path nor the property exist */ /* source path nor the property exist */
size = MAX_PATH; size = MAX_PATH;
lstrcpyA(path, "kiwi"); lstrcpyA(path, "kiwi");
r = MsiGetProperty(hpkg, "SourceDir", path, &size);
ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
ok(!lstrcmpA(path, ""), "Expected \"\", got \"%s\"\n", path);
ok(size == 0, "Expected 0, got %d\n", size);
size = MAX_PATH;
lstrcpyA(path, "kiwi");
r = MsiGetProperty(hpkg, "SOURCEDIR", path, &size); r = MsiGetProperty(hpkg, "SOURCEDIR", path, &size);
ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r); ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
ok(!lstrcmpA(path, ""), "Expected \"\", got \"%s\"\n", path); ok(!lstrcmpA(path, ""), "Expected \"\", got \"%s\"\n", path);
...@@ -11324,13 +11356,17 @@ static void test_MsiGetSourcePath(void) ...@@ -11324,13 +11356,17 @@ static void test_MsiGetSourcePath(void)
/* source path does not exist, but the property exists */ /* source path does not exist, but the property exists */
size = MAX_PATH; size = MAX_PATH;
lstrcpyA(path, "kiwi"); lstrcpyA(path, "kiwi");
r = MsiGetProperty(hpkg, "SourceDir", path, &size);
ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
ok(!lstrcmpA(path, cwd), "Expected \"%s\", got \"%s\"\n", cwd, path);
ok(size == lstrlenA(cwd), "Expected %d, got %d\n", lstrlenA(cwd), size);
size = MAX_PATH;
lstrcpyA(path, "kiwi");
r = MsiGetProperty(hpkg, "SOURCEDIR", path, &size); r = MsiGetProperty(hpkg, "SOURCEDIR", path, &size);
ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r); ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
todo_wine ok(!lstrcmpA(path, cwd), "Expected \"%s\", got \"%s\"\n", cwd, path);
{ ok(size == lstrlenA(cwd), "Expected %d, got %d\n", lstrlenA(cwd), size);
ok(!lstrcmpA(path, cwd), "Expected \"%s\", got \"%s\"\n", cwd, path);
ok(size == lstrlenA(cwd), "Expected %d, got %d\n", lstrlenA(cwd), size);
}
/* try SubDir after CostInitialize */ /* try SubDir after CostInitialize */
size = MAX_PATH; size = MAX_PATH;
...@@ -11381,6 +11417,13 @@ static void test_MsiGetSourcePath(void) ...@@ -11381,6 +11417,13 @@ static void test_MsiGetSourcePath(void)
/* source path and the property exist */ /* source path and the property exist */
size = MAX_PATH; size = MAX_PATH;
lstrcpyA(path, "kiwi"); lstrcpyA(path, "kiwi");
r = MsiGetProperty(hpkg, "SourceDir", path, &size);
ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
ok(!lstrcmpA(path, cwd), "Expected \"%s\", got \"%s\"\n", cwd, path);
ok(size == lstrlenA(cwd), "Expected %d, got %d\n", lstrlenA(cwd), size);
size = MAX_PATH;
lstrcpyA(path, "kiwi");
r = MsiGetProperty(hpkg, "SOURCEDIR", path, &size); r = MsiGetProperty(hpkg, "SOURCEDIR", path, &size);
ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r); ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
ok(!lstrcmpA(path, cwd), "Expected \"%s\", got \"%s\"\n", cwd, path); ok(!lstrcmpA(path, cwd), "Expected \"%s\", got \"%s\"\n", cwd, path);
...@@ -11435,6 +11478,13 @@ static void test_MsiGetSourcePath(void) ...@@ -11435,6 +11478,13 @@ static void test_MsiGetSourcePath(void)
/* source path and the property exist */ /* source path and the property exist */
size = MAX_PATH; size = MAX_PATH;
lstrcpyA(path, "kiwi"); lstrcpyA(path, "kiwi");
r = MsiGetProperty(hpkg, "SourceDir", path, &size);
ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
ok(!lstrcmpA(path, cwd), "Expected \"%s\", got \"%s\"\n", cwd, path);
ok(size == lstrlenA(cwd), "Expected %d, got %d\n", lstrlenA(cwd), size);
size = MAX_PATH;
lstrcpyA(path, "kiwi");
r = MsiGetProperty(hpkg, "SOURCEDIR", path, &size); r = MsiGetProperty(hpkg, "SOURCEDIR", path, &size);
ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r); ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
ok(!lstrcmpA(path, cwd), "Expected \"%s\", got \"%s\"\n", cwd, path); ok(!lstrcmpA(path, cwd), "Expected \"%s\", got \"%s\"\n", cwd, path);
...@@ -11489,6 +11539,13 @@ static void test_MsiGetSourcePath(void) ...@@ -11489,6 +11539,13 @@ static void test_MsiGetSourcePath(void)
/* source path and the property exist */ /* source path and the property exist */
size = MAX_PATH; size = MAX_PATH;
lstrcpyA(path, "kiwi"); lstrcpyA(path, "kiwi");
r = MsiGetProperty(hpkg, "SourceDir", path, &size);
ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
ok(!lstrcmpA(path, cwd), "Expected \"%s\", got \"%s\"\n", cwd, path);
ok(size == lstrlenA(cwd), "Expected %d, got %d\n", lstrlenA(cwd), size);
size = MAX_PATH;
lstrcpyA(path, "kiwi");
r = MsiGetProperty(hpkg, "SOURCEDIR", path, &size); r = MsiGetProperty(hpkg, "SOURCEDIR", path, &size);
ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r); ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
ok(!lstrcmpA(path, cwd), "Expected \"%s\", got \"%s\"\n", cwd, path); ok(!lstrcmpA(path, cwd), "Expected \"%s\", got \"%s\"\n", cwd, path);
......
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