msi: Add tests for registering and unregistering class info.

This commit is contained in:
Hans Leidekker 2010-04-02 10:38:35 +02:00 committed by Alexandre Julliard
parent cf75d40dad
commit 90158af2dc
1 changed files with 108 additions and 0 deletions

View File

@ -1696,6 +1696,55 @@ static const CHAR res_install_exec_seq_dat[] = "Action\tCondition\tSequence\n"
"PublishProduct\t\t5200\n" "PublishProduct\t\t5200\n"
"InstallFinalize\t\t6000\n"; "InstallFinalize\t\t6000\n";
static const CHAR rci_file_dat[] = "File\tComponent_\tFileName\tFileSize\tVersion\tLanguage\tAttributes\tSequence\n"
"s72\ts72\tl255\ti4\tS72\tS20\tI2\ti2\n"
"File\tFile\n"
"class.txt\tclass\tclass.txt\t1000\t\t\t8192\t1\n";
static const CHAR rci_feature_dat[] = "Feature\tFeature_Parent\tTitle\tDescription\tDisplay\tLevel\tDirectory_\tAttributes\n"
"s38\tS38\tL64\tL255\tI2\ti2\tS72\ti2\n"
"Feature\tFeature\n"
"class\t\t\tclass feature\t1\t2\tMSITESTDIR\t0\n";
static const CHAR rci_feature_comp_dat[] = "Feature_\tComponent_\n"
"s38\ts72\n"
"FeatureComponents\tFeature_\tComponent_\n"
"class\tclass\n";
static const CHAR rci_component_dat[] = "Component\tComponentId\tDirectory_\tAttributes\tCondition\tKeyPath\n"
"s72\tS38\ts72\ti2\tS255\tS72\n"
"Component\tComponent\n"
"class\t{89A98345-F8A1-422E-A48B-0250B5809F2D}\tMSITESTDIR\t0\t\tclass.txt\n";
static const CHAR rci_appid_dat[] = "AppId\tRemoteServerName\tLocalService\tServiceParameters\tDllSurrogate\tActivateAtStorage\tRunAsInteractiveUser\n"
"s38\tS255\tS255\tS255\tS255\tI2\tI2\n"
"AppId\tAppId\n"
"{CFCC3B38-E683-497D-9AB4-CB40AAFE307F}\t\t\t\t\t\t\n";
static const CHAR rci_class_dat[] = "CLSID\tContext\tComponent_\tProgId_Default\tDescription\tAppId_\tFileTypeMask\tIcon_\tIconIndex\tDefInprocHandler\tArgument\tFeature_\tAttributes\n"
"s38\ts32\ts72\tS255\tL255\tS38\tS255\tS72\tI2\tS32\tS255\ts38\tI2\n"
"Class\tCLSID\tContext\tComponent_\n"
"{110913E7-86D1-4BF3-9922-BA103FCDDDFA}\tLocalServer\tclass\t\tdescription\t{CFCC3B38-E683-497D-9AB4-CB40AAFE307F}\tmask1;mask2\t\t\t2\t\tclass\t\n";
static const CHAR rci_install_exec_seq_dat[] = "Action\tCondition\tSequence\n"
"s72\tS255\tI2\n"
"InstallExecuteSequence\tAction\n"
"LaunchConditions\t\t100\n"
"CostInitialize\t\t800\n"
"FileCost\t\t900\n"
"CostFinalize\t\t1000\n"
"InstallValidate\t\t1400\n"
"InstallInitialize\t\t1500\n"
"ProcessComponents\t\t1600\n"
"RemoveFiles\t\t1700\n"
"InstallFiles\t\t2000\n"
"UnregisterClassInfo\t\t3000\n"
"RegisterClassInfo\t\t4000\n"
"RegisterProduct\t\t5000\n"
"PublishFeatures\t\t5100\n"
"PublishProduct\t\t5200\n"
"InstallFinalize\t\t6000\n";
typedef struct _msi_table typedef struct _msi_table
{ {
const CHAR *filename; const CHAR *filename;
@ -2614,6 +2663,20 @@ static const msi_table res_tables[] =
ADD_TABLE(property) ADD_TABLE(property)
}; };
static const msi_table rci_tables[] =
{
ADD_TABLE(directory),
ADD_TABLE(rci_component),
ADD_TABLE(rci_feature),
ADD_TABLE(rci_feature_comp),
ADD_TABLE(rci_file),
ADD_TABLE(rci_appid),
ADD_TABLE(rci_class),
ADD_TABLE(rci_install_exec_seq),
ADD_TABLE(media),
ADD_TABLE(property)
};
/* cabinet definitions */ /* cabinet definitions */
/* make the max size large so there is only one cab file */ /* make the max size large so there is only one cab file */
@ -8931,6 +8994,50 @@ static void test_remove_env_strings(void)
delete_test_files(); delete_test_files();
} }
static void test_register_class_info(void)
{
UINT r;
LONG res;
HKEY hkey;
create_test_files();
create_file("msitest\\class.txt", 1000);
create_database(msifile, rci_tables, sizeof(rci_tables) / sizeof(msi_table));
MsiSetInternalUI(INSTALLUILEVEL_NONE, NULL);
r = MsiInstallProductA(msifile, NULL);
ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
res = RegOpenKeyA(HKEY_CLASSES_ROOT, "CLSID\\{110913E7-86D1-4BF3-9922-BA103FCDDDFA}", &hkey);
ok(res == ERROR_SUCCESS, "key not created\n");
RegCloseKey(hkey);
res = RegOpenKeyA(HKEY_CLASSES_ROOT, "FileType\\{110913E7-86D1-4BF3-9922-BA103FCDDDFA}", &hkey);
ok(res == ERROR_SUCCESS, "key not created\n");
RegCloseKey(hkey);
res = RegOpenKeyA(HKEY_CLASSES_ROOT, "AppID\\{CFCC3B38-E683-497D-9AB4-CB40AAFE307F}", &hkey);
ok(res == ERROR_SUCCESS, "key not created\n");
RegCloseKey(hkey);
r = MsiInstallProductA(msifile, "REMOVE=ALL");
ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
res = RegOpenKeyA(HKEY_CLASSES_ROOT, "CLSID\\{110913E7-86D1-4BF3-9922-BA103FCDDDFA}", &hkey);
ok(res == ERROR_FILE_NOT_FOUND, "key not removed\n");
res = RegOpenKeyA(HKEY_CLASSES_ROOT, "FileType\\{110913E7-86D1-4BF3-9922-BA103FCDDDFA}", &hkey);
ok(res == ERROR_FILE_NOT_FOUND, "key not removed\n");
res = RegOpenKeyA(HKEY_CLASSES_ROOT, "AppID\\{CFCC3B38-E683-497D-9AB4-CB40AAFE307F}", &hkey);
ok(res == ERROR_FILE_NOT_FOUND, "key not removed\n");
ok(!delete_pf("msitest\\class.txt", TRUE), "file not removed\n");
ok(!delete_pf("msitest", FALSE), "directory not removed\n");
delete_test_files();
}
START_TEST(install) START_TEST(install)
{ {
DWORD len; DWORD len;
@ -9038,6 +9145,7 @@ START_TEST(install)
test_find_related_products(); test_find_related_products();
test_remove_ini_values(); test_remove_ini_values();
test_remove_env_strings(); test_remove_env_strings();
test_register_class_info();
DeleteFileA(log_file); DeleteFileA(log_file);