From: Piotr Caban Subject: [PATCH 4/6] msi: Test adding new feature in patch. Message-Id: Date: Wed, 1 Jul 2020 10:43:13 +0200 Signed-off-by: Piotr Caban --- dlls/msi/tests/patch.c | 126 +++++++++++++++++++++++++---------------- 1 file changed, 77 insertions(+), 49 deletions(-) diff --git a/dlls/msi/tests/patch.c b/dlls/msi/tests/patch.c index 3834bd5fdd..6449b7e67a 100644 --- a/dlls/msi/tests/patch.c +++ b/dlls/msi/tests/patch.c @@ -380,20 +380,20 @@ static const WCHAR p_data3[] = { /* _StringPool */ 32, 1, /* string 7 '913B8D18FBB64CACA239C74C11E3FA74' */ }; static const char p_data4[] = { /* CAB_msitest */ - 0x4d, 0x53, 0x43, 0x46, 0x00, 0x00, 0x00, 0x00, 0x98, 0x00, 0x00, + 0x4d, 0x53, 0x43, 0x46, 0x00, 0x00, 0x00, 0x00, 0x94, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x2c, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x03, 0x01, 0x01, 0x00, 0x01, 0x00, 0x00, 0x00, 0x9e, - 0x03, 0x00, 0x00, 0x46, 0x00, 0x00, 0x00, 0x01, 0x00, 0x03, 0x12, + 0x00, 0x00, 0x03, 0x01, 0x01, 0x00, 0x02, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x5f, 0x00, 0x00, 0x00, 0x01, 0x00, 0x01, 0x00, 0xea, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x87, - 0x3c, 0xd4, 0x80, 0x20, 0x00, 0x70, 0x61, 0x74, 0x63, 0x68, 0x2e, - 0x74, 0x78, 0x74, 0x00, 0x0b, 0x3c, 0xd6, 0xc1, 0x4a, 0x00, 0xea, - 0x03, 0x5b, 0x80, 0x80, 0x8d, 0x00, 0x10, 0xa1, 0x3e, 0x00, 0x00, - 0x00, 0x00, 0x03, 0x00, 0x40, 0x30, 0x0c, 0x43, 0xf8, 0xb4, 0x85, - 0x4d, 0x96, 0x08, 0x0a, 0x92, 0xf0, 0x52, 0xfb, 0xbb, 0x82, 0xf9, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x0e, 0x31, 0x7d, - 0x56, 0xdf, 0xf7, 0x48, 0x7c, 0x00, 0x80, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x41, 0x80, 0xdf, 0xf7, 0xd8, 0x72, 0xbf, 0xb9, 0x63, - 0x91, 0x0e, 0x57, 0x1f, 0xfa, 0x1a, 0x66, 0x54, 0x55 + 0x3c, 0xd4, 0xb8, 0x20, 0x00, 0x70, 0x61, 0x74, 0x63, 0x68, 0x2e, + 0x74, 0x78, 0x74, 0x00, 0xe8, 0x03, 0x00, 0x00, 0xea, 0x03, 0x00, + 0x00, 0x00, 0x00, 0xcb, 0x50, 0x17, 0x7e, 0x20, 0x00, 0x66, 0x69, + 0x6c, 0x65, 0x2e, 0x74, 0x78, 0x74, 0x00, 0xb0, 0xb2, 0xb2, 0x25, + 0x2d, 0x00, 0xd2, 0x07, 0x43, 0x4b, 0xcb, 0x2d, 0xce, 0x2c, 0x49, + 0x2d, 0x2e, 0x89, 0x29, 0x48, 0x2c, 0x49, 0xce, 0x48, 0x4d, 0xd1, + 0x2b, 0xa9, 0x28, 0x51, 0x18, 0x05, 0xa3, 0x60, 0x14, 0x0c, 0x37, + 0x90, 0x8b, 0x9c, 0xd3, 0x41, 0xf9, 0x9c, 0x61, 0x14, 0x8c, 0x82, + 0x51, 0x30, 0xdc, 0x00, 0x00 }; static const WCHAR p_data5[] = { /* MsiPatchSequence */ 0x0007, 0x0000, 0x0006, 0x8000 @@ -526,63 +526,75 @@ static const WCHAR t2_name8[] = { 0x4840, 0x3f3f, 0x4577, 0x446c, 0x3e6a, 0x44b2 static const WCHAR t2_name9[] = { 0x0005, 0x0053, 0x0075, 0x006d, 0x006d, 0x0061, 0x0072, 0x0079, 0x0049, 0x006e, 0x0066, 0x006f, 0x0072, 0x006d, 0x0061, 0x0074, 0x0069, 0x006f, 0x006e, 0 }; /* SummaryInformation */ +static const WCHAR t2_name10[] = { 0x4840, 0x420f, 0x45e4, 0x4578, 0x3b28, 0x4432, 0x44b3, + 0x4231, 0x45f1, 0x4836, 0 }; /* FeatureComponents */ +static const WCHAR t2_name11[] = { 0x4840, 0x448c, 0x44f0, 0x4472, 0x4468, 0x4837, 0 }; /* Component */ +static const WCHAR t2_name12[] = { 0x4840, 0x420f, 0x45e4, 0x4578, 0x4828, 0 }; /* Feature */ static const WCHAR t2_data0[] = { /* File */ - 0x00c0, 0x0001, 0x9000, 0x83e8 + 0x00c0, 0x0001, 0x9000, 0x83e8, 0x0801, 0x0002, 0x0003, 0x0002, + 0x03e8, 0x8000, 0x0000, 0x0000, 0x9000, 0x83e9 }; static const WCHAR t2_data1[] = { /* Media */ - 0x0601, 0x8002, 0x03e9, 0x8000, 0x0000, 0x0007, 0x0000, 0x0008 + 0x0601, 0x8002, 0x03e9, 0x8000, 0x0000, 0x000d, 0x0000, 0x000e }; static const WCHAR t2_data2[] = { /* _Columns */ - 0x0401, 0x0009, 0x0000, 0x000a, 0xad48, 0x0401, 0x0009, 0x0000, /* 0x0401 = add row (1), 4 shorts */ - 0x000b, 0xa502, 0x0401, 0x0009, 0x0000, 0x000c, 0x8104, 0x0401, - 0x0009, 0x0000, 0x000d, 0x8502, 0x0401, 0x0009, 0x0000, 0x000e, - 0x9900, 0x0401, 0x0009, 0x0000, 0x000f, 0x9d48, 0x0401, 0x0010, - 0x0000, 0x0011, 0xad26, 0x0401, 0x0010, 0x0000, 0x0012, 0x8502, - 0x0401, 0x0014, 0x0000, 0x0015, 0xad26, 0x0401, 0x0014, 0x0000, - 0x000e, 0x8900 + 0x0401, 0x000f, 0x0000, 0x0010, 0xad48, 0x0401, 0x000f, 0x0000, /* 0x0401 = add row (1), 4 shorts */ + 0x0011, 0xa502, 0x0401, 0x000f, 0x0000, 0x0012, 0x8104, 0x0401, + 0x000f, 0x0000, 0x0013, 0x8502, 0x0401, 0x000f, 0x0000, 0x0014, + 0x9900, 0x0401, 0x000f, 0x0000, 0x0015, 0x9d48, 0x0401, 0x0016, + 0x0000, 0x0017, 0xad26, 0x0401, 0x0016, 0x0000, 0x0018, 0x8502, + 0x0401, 0x001a, 0x0000, 0x001b, 0xad26, 0x0401, 0x001a, 0x0000, + 0x0014, 0x8900 }; static const WCHAR t2_data3[] = { /* _Tables */ - 0x0101, 0x0009, 0x0101, 0x0010, 0x0101, 0x0014 + 0x0101, 0x000f, 0x0101, 0x0016, 0x0101, 0x001a }; static const WCHAR t2_data4[] = { /* Property */ - 0x0201, 0x0002, 0x0003, 0x0201, 0x0004, 0x0005 + 0x0002, 0x0008, 0x0009, 0x0201, 0x000a, 0x000b }; static const WCHAR t2_data5[] = { /* PatchPackage */ - 0x0201, 0x0013, 0x8002 + 0x0201, 0x0019, 0x8002 }; static const WCHAR t2_data6[] = { /* InstallExecuteSequence */ - 0x0301, 0x0006, 0x0000, 0x87d1 + 0x0301, 0x000c, 0x0000, 0x87d1 }; static const char t2_data7[] = { /* _StringData */ - "patch.txtPATCHNEWSUMMARYSUBJECTInstallation DatabasePATCHNEWPACKAGECODE{42A14A82-12F8-4E6D-970E-1B4EE7BE28B0}" - "PatchFiles#CAB_msitestpropPatchFile_SequencePatchSizeAttributesHeaderStreamRef_PatchPackagePatchIdMedia_" + "patch.txtfile.txtfile{327d9640-674f-4b9f-8b8a-547a0f6f8518}MSITESTDIRnewnew featurePATCHNEWSUMMARYSUBJECT" + "Installation DatabasePATCHNEWPACKAGECODE{42A14A82-12F8-4E6D-970E-1B4EE7BE28B0}PatchFiles#CAB_msitestprop" + "PatchFile_SequencePatchSizeAttributesHeaderStreamRef_PatchPackagePatchIdMedia_" "{0F96CDC0-4CDF-4304-B283-7B9264889EF7}MsiPatchHeadersStreamRef" }; static const WCHAR t2_data8[] = { /* _StringPool */ /* len, refs */ 0, 0, /* string 0 '' */ 9, 1, /* string 1 'patch.txt' */ - 22, 1, /* string 2 'PATCHNEWSUMMARYSUBJECT' */ - 21, 1, /* string 3 'Installation Database' */ - 19, 1, /* string 4 'PATCHNEWPACKAGECODE' */ - 38, 1, /* string 5 '{42A14A82-12F8-4E6D-970E-1B4EE7BE28B0}' */ - 10, 1, /* string 6 'PatchFiles' */ - 12, 1, /* string 7 '#CAB_msitest' */ - 4, 1, /* string 8 'prop' */ - 5, 7, /* string 9 'Patch' */ - 5, 1, /* string 10 'File_' */ - 8, 1, /* string 11 'Sequence' */ - 9, 1, /* string 12 'PatchSize' */ - 10, 1, /* string 13 'Attributes' */ - 6, 2, /* string 14 'Header' */ - 10, 1, /* string 15 'StreamRef_' */ - 12, 3, /* string 16 'PatchPackage' */ - 7, 1, /* string 17 'PatchId' */ - 6, 1, /* string 18 'Media_' */ - 38, 1, /* string 19 '{0F96CDC0-4CDF-4304-B283-7B9264889EF7}' */ - 15, 3, /* string 20 'MsiPatchHeaders' */ - 9, 1 /* string 21 'StreamRef' */ + 8, 3, /* string 2 'file.txt' */ + 4, 3, /* string 3 'file' */ + 38, 1, /* string 4 '{327d9640-674f-4b9f-8b8a-547a0f6f8518}' */ + 10, 2, /* string 5 'MSITESTDIR' */ + 3, 2, /* string 6 'new' */ + 11, 1, /* string 7 'new feature' */ + 22, 1, /* string 8 'PATCHNEWSUMMARYSUBJECT' */ + 21, 1, /* string 9 'Installation Database' */ + 19, 1, /* string 10 'PATCHNEWPACKAGECODE' */ + 38, 1, /* string 11 '{42A14A82-12F8-4E6D-970E-1B4EE7BE28B0}' */ + 10, 1, /* string 12 'PatchFiles' */ + 12, 1, /* string 13 '#CAB_msitest' */ + 4, 1, /* string 14 'prop' */ + 5, 7, /* string 15 'Patch' */ + 5, 1, /* string 16 'File_' */ + 8, 1, /* string 17 'Sequence' */ + 9, 1, /* string 18 'PatchSize' */ + 10, 1, /* string 19 'Attributes' */ + 6, 2, /* string 20 'Header' */ + 10, 1, /* string 21 'StreamRef_' */ + 12, 3, /* string 22 'PatchPackage' */ + 7, 1, /* string 23 'PatchId' */ + 6, 1, /* string 24 'Media_' */ + 38, 1, /* string 25 '{0F96CDC0-4CDF-4304-B283-7B9264889EF7}' */ + 15, 3, /* string 26 'MsiPatchHeaders' */ + 9, 1 /* string 27 'StreamRef' */ }; static const char t2_data9[] = { /* SummaryInformation */ 0xfe, 0xff, 0x00, 0x00, 0x05, 0x02, 0x02, 0x00, 0x00, 0x00, 0x00, @@ -622,6 +634,16 @@ static const char t2_data9[] = { /* SummaryInformation */ 0x46, 0x34, 0x33, 0x7d, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x2d, 0x01, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x17, 0x00, 0x27, 0x09 }; +static const WCHAR t2_data10[] = { /* FeatureComponents */ + 0x0201, 0x0006, 0x0003 +}; +static const WCHAR t2_data11[] = { /* Component */ + 0x0601, 0x0003, 0x0004, 0x0005, 0x8000, 0x0000, 0x0002 +}; +static const WCHAR t2_data12[] = { /* Feature */ + 0x0801, 0x0006, 0x0000, 0x0000, 0x0007, 0x8001, 0x8001, 0x0005, + 0x8000 +}; static const struct table_data table_transform2_data[] = { { t2_name0, t2_data0, sizeof t2_data0 }, @@ -633,7 +655,10 @@ static const struct table_data table_transform2_data[] = { { t2_name6, t2_data6, sizeof t2_data6 }, { t2_name7, t2_data7, sizeof t2_data7 - 1 }, { t2_name8, t2_data8, sizeof t2_data8 }, - { t2_name9, t2_data9, sizeof t2_data9 } + { t2_name9, t2_data9, sizeof t2_data9 }, + { t2_name10, t2_data10, sizeof t2_data10 }, + { t2_name11, t2_data11, sizeof t2_data11 }, + { t2_name12, t2_data12, sizeof t2_data12 }, }; static void write_tables( IStorage *stg, const struct table_data *tables, UINT num_tables ) @@ -807,6 +832,8 @@ static void test_simple_patch( void ) size = get_pf_file_size( "msitest\\patch.txt" ); ok( size == 1002, "expected 1002, got %u\n", size ); + size = get_pf_file_size( "msitest\\file.txt" ); + todo_wine ok( size == 1000, "expected 1000, got %u\n", size ); /* show that MsiOpenPackage applies registered patches */ r = MsiOpenPackageA( path, &hpackage ); @@ -888,6 +915,7 @@ uninstall: ok( r == ERROR_SUCCESS, "expected ERROR_SUCCESS, got %u\n", r ); ok( !delete_pf( "msitest\\patch.txt", TRUE ), "file not removed\n" ); + ok( !delete_pf( "msitest\\file.txt", TRUE ), "file not removed\n" ); ok( !delete_pf( "msitest", FALSE ), "directory not removed\n" ); cleanup: @@ -1210,7 +1238,7 @@ static void test_system_tables( void ) todo_wine ok( r == 100, "Got %u\n", r ); r = get_integer( hdb, 2, "SELECT * FROM `Media` WHERE `Source` IS NOT NULL"); - todo_wine ok( r == 10000, "Got %u\n", r ); + todo_wine ok( r == 10001, "Got %u\n", r ); r = get_integer( hdb, 1, "SELECT * FROM `Media` WHERE `VolumeLabel`=\'DISK1\'"); ok( r == 1, "Got %u\n", r );