James Hawkins : msi: Add tests for adding properties in a transform.
Alexandre Julliard
julliard at wine.codeweavers.com
Wed Jul 11 07:50:56 CDT 2007
Module: wine
Branch: master
Commit: 1093eb83cd37c57895154afe21706333421fcae8
URL: http://source.winehq.org/git/wine.git/?a=commit;h=1093eb83cd37c57895154afe21706333421fcae8
Author: James Hawkins <truiken at gmail.com>
Date: Wed Jul 11 00:11:10 2007 -0700
msi: Add tests for adding properties in a transform.
---
dlls/msi/tests/db.c | 118 ++++++++++++++++++++++++++++++++++++++++++++++++---
1 files changed, 112 insertions(+), 6 deletions(-)
diff --git a/dlls/msi/tests/db.c b/dlls/msi/tests/db.c
index a6fe5e3..2c76c97 100644
--- a/dlls/msi/tests/db.c
+++ b/dlls/msi/tests/db.c
@@ -1833,6 +1833,15 @@ static void generate_transform(void)
r = run_query(hdb1, 0, query);
ok(r == ERROR_SUCCESS, "failed to modify row\n");
+ query = "CREATE TABLE `Property` ( `Property` CHAR(72) NOT NULL, "
+ "`Value` CHAR(0) PRIMARY KEY `Property`)";
+ r = run_query(hdb1, 0, query);
+ ok(r == ERROR_SUCCESS, "failed to add property table\n");
+
+ query = "INSERT INTO `Property` ( `Property`, `Value` ) VALUES ( 'prop', 'val' )";
+ r = run_query(hdb1, 0, query);
+ ok(r == ERROR_SUCCESS, "failed to add property\n");
+
/* database needs to be committed */
MsiDatabaseCommit(hdb1);
@@ -1856,6 +1865,7 @@ static const WCHAR name5[] = { 0x4840, 0x3f3f, 0x4577, 0x446c, 0x3e6a, 0x44b2, 0
static const WCHAR name6[] = { 0x4840, 0x3e16, 0x4818, 0}; /* MOO */
static const WCHAR name7[] = { 0x4840, 0x3c8b, 0x3a97, 0x409b, 0 }; /* BINARY */
static const WCHAR name8[] = { 0x3c8b, 0x3a97, 0x409b, 0x387e, 0 }; /* BINARY.1 */
+static const WCHAR name9[] = { 0x4840, 0x4559, 0x44f2, 0x4568, 0x4737, 0 }; /* Property */
/* data in each table */
static const WCHAR data1[] = { /* AAR */
@@ -1867,12 +1877,15 @@ static const WCHAR data2[] = { /* _Columns */
0x0401, 0x0001, 0x8004, 0x0003, 0x9502,
0x0401, 0x0005, 0x0000, 0x0006, 0xbdff, /* 0x0401 = add row (1), 4 shorts */
0x0401, 0x0005, 0x0000, 0x0007, 0x8502,
+ 0x0401, 0x000a, 0x0000, 0x000a, 0xad48,
+ 0x0401, 0x000a, 0x0000, 0x000b, 0x9d00,
};
static const WCHAR data3[] = { /* _Tables */
0x0101, 0x0005, /* 0x0101 = add row (1), 1 short */
+ 0x0101, 0x000a,
};
static const char data4[] = /* _StringData */
- "MOOCOWPIGcAARCARBARvwbmw"; /* all the strings squashed together */
+ "MOOCOWPIGcAARCARBARvwbmwPropertyValuepropval"; /* all the strings squashed together */
static const WCHAR data5[] = { /* _StringPool */
/* len, refs */
0, 0, /* string 0 '' */
@@ -1885,6 +1898,10 @@ static const WCHAR data5[] = { /* _StringPool */
3, 1, /* string 7 'BAR' */
2, 1, /* string 8 'vw' */
3, 1, /* string 9 'bmw' */
+ 8, 4, /* string 10 'Property' */
+ 5, 1, /* string 11 'Value' */
+ 4, 1, /* string 12 'prop' */
+ 3, 1, /* string 13 'val' */
};
/* update row, 0x0002 is a bitmask of present column data, keys are excluded */
static const WCHAR data6[] = { /* MOO */
@@ -1899,6 +1916,10 @@ static const WCHAR data7[] = { /* BINARY */
static const char data8[] = /* stream data for the BINARY table */
"naengmyon";
+static const WCHAR data9[] = { /* Property */
+ 0x0201, 0x000c, 0x000d,
+};
+
static const struct {
LPCWSTR name;
const void *data;
@@ -1913,6 +1934,7 @@ static const struct {
{ name6, data6, sizeof data6 },
{ name7, data7, sizeof data7 },
{ name8, data8, sizeof data8 - 1 },
+ { name9, data9, sizeof data9 },
};
#define NUM_TRANSFORM_TABLES (sizeof table_transform_data/sizeof table_transform_data[0])
@@ -1958,21 +1980,94 @@ static void generate_transform_manual(void)
IStorage_Release(stg);
}
+static UINT set_summary_info(MSIHANDLE hdb)
+{
+ UINT res;
+ MSIHANDLE suminfo;
+
+ /* build summmary info */
+ res = MsiGetSummaryInformation(hdb, NULL, 7, &suminfo);
+ ok( res == ERROR_SUCCESS , "Failed to open summaryinfo\n" );
+
+ res = MsiSummaryInfoSetProperty(suminfo,2, VT_LPSTR, 0,NULL,
+ "Installation Database");
+ ok( res == ERROR_SUCCESS , "Failed to set summary info\n" );
+
+ res = MsiSummaryInfoSetProperty(suminfo,3, VT_LPSTR, 0,NULL,
+ "Installation Database");
+ ok( res == ERROR_SUCCESS , "Failed to set summary info\n" );
+
+ res = MsiSummaryInfoSetProperty(suminfo,4, VT_LPSTR, 0,NULL,
+ "Wine Hackers");
+ ok( res == ERROR_SUCCESS , "Failed to set summary info\n" );
+
+ res = MsiSummaryInfoSetProperty(suminfo,7, VT_LPSTR, 0,NULL,
+ ";1033");
+ ok( res == ERROR_SUCCESS , "Failed to set summary info\n" );
+
+ res = MsiSummaryInfoSetProperty(suminfo,9, VT_LPSTR, 0,NULL,
+ "{913B8D18-FBB6-4CAC-A239-C74C11E3FA74}");
+ ok( res == ERROR_SUCCESS , "Failed to set summary info\n" );
+
+ res = MsiSummaryInfoSetProperty(suminfo, 14, VT_I4, 100, NULL, NULL);
+ ok( res == ERROR_SUCCESS , "Failed to set summary info\n" );
+
+ res = MsiSummaryInfoSetProperty(suminfo, 15, VT_I4, 0, NULL, NULL);
+ ok( res == ERROR_SUCCESS , "Failed to set summary info\n" );
+
+ res = MsiSummaryInfoPersist(suminfo);
+ ok( res == ERROR_SUCCESS , "Failed to make summary info persist\n" );
+
+ res = MsiCloseHandle( suminfo);
+ ok( res == ERROR_SUCCESS , "Failed to close suminfo\n" );
+
+ return res;
+}
+
+static MSIHANDLE create_package_db(LPCSTR filename)
+{
+ MSIHANDLE hdb = 0;
+ UINT res;
+
+ DeleteFile(msifile);
+
+ /* create an empty database */
+ res = MsiOpenDatabase(filename, MSIDBOPEN_CREATE, &hdb );
+ ok( res == ERROR_SUCCESS , "Failed to create database\n" );
+ if( res != ERROR_SUCCESS )
+ return hdb;
+
+ res = MsiDatabaseCommit( hdb );
+ ok( res == ERROR_SUCCESS , "Failed to commit database\n" );
+
+ res = set_summary_info(hdb);
+
+ res = run_query( hdb, 0,
+ "CREATE TABLE `Directory` ( "
+ "`Directory` CHAR(255) NOT NULL, "
+ "`Directory_Parent` CHAR(255), "
+ "`DefaultDir` CHAR(255) NOT NULL "
+ "PRIMARY KEY `Directory`)" );
+ ok( res == ERROR_SUCCESS , "Failed to create directory table\n" );
+
+ return hdb;
+}
+
static void test_try_transform(void)
{
- MSIHANDLE hdb, hview, hrec;
+ MSIHANDLE hdb, hview, hrec, hpkg;
LPCSTR query;
UINT r;
DWORD sz;
- char buffer[0x10];
+ char buffer[MAX_PATH];
DeleteFile(msifile);
DeleteFile(msifile2);
DeleteFile(mstfile);
- /* create an empty database */
- r = MsiOpenDatabase(msifile2, MSIDBOPEN_CREATE, &hdb );
- ok( r == ERROR_SUCCESS , "Failed to create database\n" );
+ /* create the database */
+ hdb = create_package_db(msifile2);
+ ok(hdb, "Failed to create package db\n");
query = "CREATE TABLE `MOO` ( `NOO` SHORT NOT NULL, `OOO` CHAR(255) PRIMARY KEY `NOO`)";
r = run_query(hdb, 0, query);
@@ -2134,6 +2229,17 @@ static void test_try_transform(void)
MsiCloseHandle(hview);
MsiCloseHandle(hdb);
+ /* check that the property was added */
+ r = MsiOpenPackage(msifile2, &hpkg);
+ ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
+
+ sz = MAX_PATH;
+ r = MsiGetProperty(hpkg, "prop", buffer, &sz);
+ ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
+ ok(!lstrcmp(buffer, "val"), "Expected val, got %s\n", buffer);
+
+ MsiCloseHandle(hpkg);
+
DeleteFile(msifile);
DeleteFile(msifile2);
DeleteFile(mstfile);
More information about the wine-cvs
mailing list