[WINESYNC] msi: Skip publishing a local assembly with no corresponding file.

Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=45735
Signed-off-by: Zebediah Figura <z.figura12@gmail.com>
Signed-off-by: Hans Leidekker <hans@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>

wine commit id 12195e450fea6885eb2d3be05a8ed92dd93752c9 by Zebediah Figura <z.figura12@gmail.com>
This commit is contained in:
winesync 2022-03-12 23:54:38 +01:00 committed by Mark Jansen
parent 3671579f96
commit 9af3c0ad3e
No known key found for this signature in database
GPG key ID: B39240EE84BEAE8B
2 changed files with 39 additions and 0 deletions

View file

@ -687,6 +687,11 @@ UINT ACTION_MsiPublishAssemblies( MSIPACKAGE *package )
if (assembly->application)
{
MSIFILE *file = msi_get_loaded_file( package, assembly->application );
if (!file)
{
WARN("no matching file %s for local assembly\n", debugstr_w(assembly->application));
continue;
}
if ((res = open_local_assembly_key( package->Context, win32, file->TargetPath, &hkey )))
{
WARN("failed to open local assembly key %d\n", res);
@ -744,6 +749,11 @@ UINT ACTION_MsiUnpublishAssemblies( MSIPACKAGE *package )
if (assembly->application)
{
MSIFILE *file = msi_get_loaded_file( package, assembly->application );
if (!file)
{
WARN("no matching file %s for local assembly\n", debugstr_w(assembly->application));
continue;
}
if ((res = delete_local_assembly_key( package->Context, win32, file->TargetPath )))
WARN("failed to delete local assembly key %d\n", res);
}

View file

@ -1785,6 +1785,7 @@ static const char pa_file_dat[] =
"File\tComponent_\tFileName\tFileSize\tVersion\tLanguage\tAttributes\tSequence\n"
"s72\ts72\tl255\ti4\tS72\tS20\tI2\ti2\n"
"File\tFile\n"
"fake_local.txt\tfake_local\tfake_local.txt\t1000\t\t\t8192\t1\n"
"win32.txt\twin32\twin32.txt\t1000\t\t\t8192\t1\n"
"manifest.txt\twin32\tmanifest.txt\t1000\t\t\t8192\t1\n"
"win32_local.txt\twin32_local\twin32_local.txt\t1000\t\t\t8192\t1\n"
@ -1804,6 +1805,7 @@ static const char pa_feature_comp_dat[] =
"Feature_\tComponent_\n"
"s38\ts72\n"
"FeatureComponents\tFeature_\tComponent_\n"
"assembly\tfake_local\n"
"assembly\twin32\n"
"assembly\twin32_local\n"
"assembly\tdotnet\n"
@ -1813,6 +1815,7 @@ static const char pa_component_dat[] =
"Component\tComponentId\tDirectory_\tAttributes\tCondition\tKeyPath\n"
"s72\tS38\ts72\ti2\tS255\tS72\n"
"Component\tComponent\n"
"fake_local\t{F515549D-7E61-425D-AAC1-9BEF2E066D06}\tMSITESTDIR\t0\t\tfake_local.txt\n"
"win32\t{F515549E-7E61-425D-AAC1-9BEF2E066D06}\tMSITESTDIR\t0\t\twin32.txt\n"
"win32_local\t{D34D3FBA-6789-4E57-AD1A-1281297DC201}\tMSITESTDIR\t0\t\twin32_local.txt\n"
"dotnet\t{8943164F-2B31-4C09-A894-493A8CBDE0A4}\tMSITESTDIR\t0\t\tdotnet.txt\n"
@ -1822,6 +1825,7 @@ static const char pa_msi_assembly_dat[] =
"Component_\tFeature_\tFile_Manifest\tFile_Application\tAttributes\n"
"s72\ts38\tS72\tS72\tI2\n"
"MsiAssembly\tComponent_\n"
"fake_local\tassembly\t\tnonexistent.txt\t0\n"
"win32\tassembly\tmanifest.txt\t\t1\n"
"win32_local\tassembly\tmanifest_local.txt\tapplication_win32.txt\t1\n"
"dotnet\tassembly\t\t\t0\n"
@ -1831,6 +1835,11 @@ static const char pa_msi_assembly_name_dat[] =
"Component_\tName\tValue\n"
"s72\ts255\ts255\n"
"MsiAssemblyName\tComponent_\tName\n"
"fake_local\tName\tWine.Fake.Application.Assembly\n"
"fake_local\tprocessorArchitecture\tx86\n"
"fake_local\tpublicKeyToken\tabcdef0123456789\n"
"fake_local\ttype\twin32\n"
"fake_local\tversion\t1.0.0.0\n"
"win32\tName\tWine.Win32.Assembly\n"
"win32\tprocessorArchitecture\tx86\n"
"win32\tpublicKeyToken\tabcdef0123456789\n"
@ -6134,6 +6143,10 @@ static void test_publish_assemblies(void)
"Installer\\Assemblies\\C:|Program Files|msitest|application_dotnet.txt";
static const char classes_path_dotnet_local_wow64[] =
"Installer\\Assemblies\\C:|Program Files (x86)|msitest|application_dotnet.txt";
static const char classes_path_fake_local[] =
"Installer\\Assemblies\\C:|Program Files|msitest|nonexistent.txt";
static const char classes_path_fake_local_wow64[] =
"Installer\\Assemblies\\C:|Program Files (x86)|msitest|nonexistent.txt";
static const char classes_path_win32[] =
"Installer\\Win32Assemblies\\Global";
static const char classes_path_win32_local[] =
@ -6146,6 +6159,10 @@ static void test_publish_assemblies(void)
"Software\\Microsoft\\Installer\\Assemblies\\C:|Program Files|msitest|application_dotnet.txt";
static const char path_dotnet_local_wow64[] =
"Software\\Microsoft\\Installer\\Assemblies\\C:|Program Files (x86)|msitest|application_dotnet.txt";
static const char path_fake_local[] =
"Software\\Microsoft\\Installer\\Assemblies\\C:|Program Files|msitest|nonexistent.txt";
static const char path_fake_local_wow64[] =
"Software\\Microsoft\\Installer\\Assemblies\\C:|Program Files (x86)|msitest|nonexistent.txt";
static const char path_win32[] =
"Software\\Microsoft\\Installer\\Win32Assemblies\\Global";
static const char path_win32_local[] =
@ -6185,6 +6202,7 @@ static void test_publish_assemblies(void)
create_file_data("msitest\\manifest_local.txt", manifest_local, 0);
create_file("msitest\\application_win32.txt", 1000);
create_file("msitest\\application_dotnet.txt", 1000);
create_file("msitest\\fake_local.txt", 1000);
create_database(msifile, pa_tables, ARRAY_SIZE(pa_tables));
MsiSetInternalUI(INSTALLUILEVEL_NONE, NULL);
@ -6219,6 +6237,11 @@ static void test_publish_assemblies(void)
CHECK_REG_STR(hkey, name_win32_local, "rcHQPHq?CA@Uv-XqMI1e>C)Uvlj*53A)u(QQ9=)X!");
RegCloseKey(hkey);
/* No registration is done for a local assembly with no matching file */
path = (is_wow64 || is_64bit) ? path_fake_local_wow64 : path_fake_local;
res = RegOpenKeyA(HKEY_CURRENT_USER, path, &hkey);
ok(res == ERROR_FILE_NOT_FOUND, "got %u\n", res);
r = MsiInstallProductA(msifile, "REMOVE=ALL");
ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
@ -6278,6 +6301,11 @@ static void test_publish_assemblies(void)
CHECK_REG_STR(hkey, name_win32_local, "rcHQPHq?CA@Uv-XqMI1e>C)Uvlj*53A)u(QQ9=)X!");
RegCloseKey(hkey);
/* No registration is done for a local assembly with no matching file */
path = (is_wow64 || is_64bit) ? classes_path_fake_local_wow64 : classes_path_fake_local;
res = RegOpenKeyExA(HKEY_CLASSES_ROOT, path, 0, access, &hkey);
ok(res == ERROR_FILE_NOT_FOUND, "got %u\n", res);
r = MsiInstallProductA(msifile, "REMOVE=ALL ALLUSERS=1");
ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
@ -6314,6 +6342,7 @@ done:
DeleteFileA("msitest\\manifest_local.txt");
DeleteFileA("msitest\\application_win32.txt");
DeleteFileA("msitest\\application_dotnet.txt");
DeleteFileA("msitest\\fake_local.txt");
delete_test_files();
DeleteFileA(msifile);
}