msi: Set the SourceDir and SOURCEDIR properties in MsiGetSourcePath.
This commit is contained in:
parent
4381cabf9a
commit
bc801f85be
|
@ -347,16 +347,10 @@ UINT WINAPI MsiGetTargetPathW( MSIHANDLE hInstall, LPCWSTR szFolder,
|
|||
return MSI_GetTargetPath( hInstall, szFolder, &path, pcchPathBuf );
|
||||
}
|
||||
|
||||
static WCHAR *get_source_root( MSIDATABASE *db )
|
||||
static WCHAR *get_source_root( MSIPACKAGE *package )
|
||||
{
|
||||
WCHAR *path, *p;
|
||||
|
||||
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;
|
||||
msi_set_sourcedir_props( package, FALSE );
|
||||
return msi_dup_property( package->db, szSourceDir );
|
||||
}
|
||||
|
||||
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
|
|||
/* special resolving for root dir */
|
||||
if (!strcmpW( name, szTargetDir ) && !f->ResolvedSource)
|
||||
{
|
||||
f->ResolvedSource = get_source_root( package->db );
|
||||
f->ResolvedSource = get_source_root( package );
|
||||
}
|
||||
if (folder) *folder = f;
|
||||
if (f->ResolvedSource)
|
||||
|
@ -388,7 +382,7 @@ WCHAR *msi_resolve_source_folder( MSIPACKAGE *package, const WCHAR *name, MSIFOL
|
|||
p = msi_resolve_source_folder( package, parent, NULL );
|
||||
|
||||
if (package->WordCount & msidbSumInfoSourceTypeCompressed)
|
||||
path = get_source_root( package->db );
|
||||
path = get_source_root( package );
|
||||
else if (package->WordCount & msidbSumInfoSourceTypeSFN)
|
||||
path = msi_build_directory_name( 3, p, f->SourceShortPath, NULL );
|
||||
else
|
||||
|
|
|
@ -10970,15 +10970,19 @@ static void test_MsiGetSourcePath(void)
|
|||
ok(size == MAX_PATH, "Expected size to be unchanged, got %d\n", size);
|
||||
|
||||
/* source path does not exist, but the property exists */
|
||||
size = MAX_PATH;
|
||||
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);
|
||||
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 */
|
||||
size = MAX_PATH;
|
||||
|
@ -11025,6 +11029,13 @@ static void test_MsiGetSourcePath(void)
|
|||
ok(size == MAX_PATH, "Expected size to be unchanged, got %d\n", size);
|
||||
|
||||
/* source path does not exist, but the property exists */
|
||||
size = MAX_PATH;
|
||||
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);
|
||||
|
@ -11077,6 +11088,13 @@ static void test_MsiGetSourcePath(void)
|
|||
ok(size == MAX_PATH, "Expected size to be unchanged, got %d\n", size);
|
||||
|
||||
/* source path does not exist, but the property exists */
|
||||
size = MAX_PATH;
|
||||
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);
|
||||
|
@ -11129,6 +11147,13 @@ static void test_MsiGetSourcePath(void)
|
|||
ok(size == MAX_PATH, "Expected size to be unchanged, got %d\n", size);
|
||||
|
||||
/* source path does not exist, but the property exists */
|
||||
size = MAX_PATH;
|
||||
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);
|
||||
|
@ -11266,6 +11291,13 @@ static void test_MsiGetSourcePath(void)
|
|||
ok(size == MAX_PATH, "Expected size to be unchanged, got %d\n", size);
|
||||
|
||||
/* source path nor the property exist */
|
||||
size = MAX_PATH;
|
||||
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);
|
||||
|
@ -11322,15 +11354,19 @@ static void test_MsiGetSourcePath(void)
|
|||
}
|
||||
|
||||
/* source path does not exist, but the property exists */
|
||||
size = MAX_PATH;
|
||||
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);
|
||||
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 */
|
||||
size = MAX_PATH;
|
||||
|
@ -11379,6 +11415,13 @@ static void test_MsiGetSourcePath(void)
|
|||
}
|
||||
|
||||
/* source path and the property exist */
|
||||
size = MAX_PATH;
|
||||
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);
|
||||
|
@ -11433,6 +11476,13 @@ static void test_MsiGetSourcePath(void)
|
|||
}
|
||||
|
||||
/* source path and the property exist */
|
||||
size = MAX_PATH;
|
||||
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);
|
||||
|
@ -11487,6 +11537,13 @@ static void test_MsiGetSourcePath(void)
|
|||
}
|
||||
|
||||
/* source path and the property exist */
|
||||
size = MAX_PATH;
|
||||
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);
|
||||
|
|
Loading…
Reference in New Issue