sync jscript and msi winetests with wine 1.1.23

svn path=/trunk/; revision=41309
This commit is contained in:
Christoph von Wittich 2009-06-06 15:59:11 +00:00
parent f30d5ea76f
commit 2f98b5a4c4
7 changed files with 994 additions and 75 deletions

View file

@ -618,6 +618,12 @@ ok(tmp === 2, "Math.pow(2, 2) = " + tmp);
tmp = Math.pow(2, 2, 3);
ok(tmp === 4, "Math.pow(2, 2, 3) = " + tmp);
tmp = Math.pow(2);
ok(isNaN(tmp), "Math.pow(2) is not NaN");
tmp = Math.pow();
ok(isNaN(tmp), "Math.pow() is not NaN");
tmp = Math.random();
ok(typeof(tmp) == "number", "typeof(tmp) = " + typeof(tmp));
ok(0 <= tmp && tmp <= 1, "Math.random() = " + tmp);
@ -626,6 +632,285 @@ tmp = Math.random(100);
ok(typeof(tmp) == "number", "typeof(tmp) = " + typeof(tmp));
ok(0 <= tmp && tmp <= 1, "Math.random(100) = " + tmp);
tmp = Math.acos(0);
ok(Math.floor(tmp*100) === 157, "Math.acos(0) = " + tmp);
tmp = Math.acos(1);
ok(Math.floor(tmp*100) === 0, "Math.acos(1) = " + tmp);
tmp = Math.acos(-1);
ok(Math.floor(tmp*100) === 314, "Math.acos(-1) = " + tmp);
tmp = Math.acos(Math.PI/4, 2);
ok(Math.floor(tmp*100) === 66, "Math.acos(Math.PI/4, 2) = " + tmp);
tmp = Math.acos(true);
ok(Math.floor(tmp*100) === 0, "Math.acos(true) = " + tmp);
tmp = Math.acos(false);
ok(Math.floor(tmp*100) === 157, "Math.acos(false) = " + tmp);
tmp = Math.acos(1.1);
ok(isNaN(tmp), "Math.acos(1.1) is not NaN");
tmp = Math.acos();
ok(isNaN(tmp), "Math.acos() is not NaN");
tmp = Math.acos(NaN);
ok(isNaN(tmp), "Math.acos(NaN) is not NaN");
tmp = Math.acos(Infinity);
ok(isNaN(tmp), "Math.acos(Infinity) is not NaN");
tmp = Math.acos(-Infinity);
ok(isNaN(tmp), "Math.acos(-Infinity) is not NaN");
tmp = Math.asin(0);
ok(Math.floor(tmp*100) === 0, "Math.asin(0) = " + tmp);
tmp = Math.asin(1);
ok(Math.floor(tmp*100) === 157, "Math.asin(1) = " + tmp);
tmp = Math.asin(-1);
ok(Math.floor(tmp*100) === -158, "Math.asin(-1) = " + tmp);
tmp = Math.asin(Math.PI/4, 2);
ok(Math.floor(tmp*100) === 90, "Math.asin(Math.PI/4, 2) = " + tmp);
tmp = Math.asin(true);
ok(Math.floor(tmp*100) === 157, "Math.asin(true) = " + tmp);
tmp = Math.asin(false);
ok(Math.floor(tmp*100) === 0, "Math.asin(false) = " + tmp);
tmp = Math.asin(1.1);
ok(isNaN(tmp), "Math.asin(1.1) is not NaN");
tmp = Math.asin();
ok(isNaN(tmp), "Math.asin() is not NaN");
tmp = Math.asin(NaN);
ok(isNaN(tmp), "Math.asin(NaN) is not NaN");
tmp = Math.asin(Infinity);
ok(isNaN(tmp), "Math.asin(Infinity) is not NaN");
tmp = Math.asin(-Infinity);
ok(isNaN(tmp), "Math.asin(-Infinity) is not NaN");
tmp = Math.atan(0);
ok(Math.floor(tmp*100) === 0, "Math.atan(0) = " + tmp);
tmp = Math.atan(1);
ok(Math.floor(tmp*100) === 78, "Math.atan(1) = " + tmp);
tmp = Math.atan(-1);
ok(Math.floor(tmp*100) === -79, "Math.atan(-1) = " + tmp);
tmp = Math.atan(true);
ok(Math.floor(tmp*100) === 78, "Math.atan(true) = " + tmp);
tmp = Math.atan(false);
ok(Math.floor(tmp*100) === 0, "Math.atan(false) = " + tmp);
tmp = Math.atan();
ok(isNaN(tmp), "Math.atan() is not NaN");
tmp = Math.atan(NaN);
ok(isNaN(tmp), "Math.atan(NaN) is not NaN");
tmp = Math.atan(Infinity);
ok(Math.floor(tmp*100) === 157, "Math.atan(Infinity) = " + tmp);
tmp = Math.atan(-Infinity);
ok(Math.floor(tmp*100) === -158, "Math.atan(Infinity) = " + tmp);
tmp = Math.atan2(0, 0);
ok(Math.floor(tmp*100) === 0, "Math.atan2(0, 0) = " + tmp);
tmp = Math.atan2(0, 1);
ok(Math.floor(tmp*100) === 0, "Math.atan2(0, 1) = " + tmp);
tmp = Math.atan2(0, Infinity);
ok(Math.floor(tmp*100) === 0, "Math.atan2(0, Infinity) = " + tmp);
tmp = Math.atan2(0, -1);
ok(Math.floor(tmp*100) === 314, "Math.atan2(0, -1) = " + tmp);
tmp = Math.atan2(0, -Infinity);
ok(Math.floor(tmp*100) === 314, "Math.atan2(0, -Infinity) = " + tmp);
tmp = Math.atan2(1, 0);
ok(Math.floor(tmp*100) === 157, "Math.atan2(1, 0) = " + tmp);
tmp = Math.atan2(Infinity, 0);
ok(Math.floor(tmp*100) === 157, "Math.atan2(Infinity, 0) = " + tmp);
tmp = Math.atan2(-1, 0);
ok(Math.floor(tmp*100) === -158, "Math.atan2(-1, 0) = " + tmp);
tmp = Math.atan2(-Infinity, 0);
ok(Math.floor(tmp*100) === -158, "Math.atan2(-Infinity, 0) = " + tmp);
tmp = Math.atan2(1, 1);
ok(Math.floor(tmp*100) === 78, "Math.atan2(1, 1) = " + tmp);
tmp = Math.atan2(-1, -1);
ok(Math.floor(tmp*100) === -236, "Math.atan2(-1, -1) = " + tmp);
tmp = Math.atan2(-1, 1);
ok(Math.floor(tmp*100) === -79, "Math.atan2(-1, 1) = " + tmp);
tmp = Math.atan2(Infinity, Infinity);
ok(Math.floor(tmp*100) === 78, "Math.atan2(Infinity, Infinity) = " + tmp);
tmp = Math.atan2(Infinity, -Infinity, 1);
ok(Math.floor(tmp*100) === 235, "Math.atan2(Infinity, -Infinity, 1) = " + tmp);
tmp = Math.atan2();
ok(isNaN(tmp), "Math.atan2() is not NaN");
tmp = Math.atan2(1);
ok(isNaN(tmp), "Math.atan2(1) is not NaN");
tmp = Math.exp(0);
ok(tmp === 1, "Math.exp(0) = " + tmp);
tmp = Math.exp(1);
ok(Math.floor(tmp*100) === 271, "Math.exp(1) = " + tmp);
tmp = Math.exp(-1);
ok(Math.floor(tmp*100) === 36, "Math.exp(-1) = " + tmp);
tmp = Math.exp(true);
ok(Math.floor(tmp*100) === 271, "Math.exp(true) = " + tmp);
tmp = Math.exp(1, 1);
ok(Math.floor(tmp*100) === 271, "Math.exp(1, 1) = " + tmp);
tmp = Math.exp();
ok(isNaN(tmp), "Math.exp() is not NaN");
tmp = Math.exp(NaN);
ok(isNaN(tmp), "Math.exp(NaN) is not NaN");
tmp = Math.exp(Infinity);
ok(tmp === Infinity, "Math.exp(Infinity) = " + tmp);
tmp = Math.exp(-Infinity);
ok(tmp === 0, "Math.exp(-Infinity) = " + tmp);
tmp = Math.log(1);
ok(Math.floor(tmp*100) === 0, "Math.log(1) = " + tmp);
tmp = Math.log(-1);
ok(isNaN(tmp), "Math.log(-1) is not NaN");
tmp = Math.log(true);
ok(Math.floor(tmp*100) === 0, "Math.log(true) = " + tmp);
tmp = Math.log(1, 1);
ok(Math.floor(tmp*100) === 0, "Math.log(1, 1) = " + tmp);
tmp = Math.log();
ok(isNaN(tmp), "Math.log() is not NaN");
tmp = Math.log(NaN);
ok(isNaN(tmp), "Math.log(NaN) is not NaN");
tmp = Math.log(Infinity);
ok(tmp === Infinity, "Math.log(Infinity) = " + tmp);
tmp = Math.log(-Infinity);
ok(isNaN(tmp), "Math.log(-Infinity) is not NaN");
tmp = Math.sin(0);
ok(tmp === 0, "Math.sin(0) = " + tmp);
tmp = Math.sin(Math.PI/2);
ok(tmp === 1, "Math.sin(Math.PI/2) = " + tmp);
tmp = Math.sin(-Math.PI/2);
ok(tmp === -1, "Math.sin(-Math.PI/2) = " + tmp);
tmp = Math.sin(Math.PI/3, 2);
ok(Math.floor(tmp*100) === 86, "Math.sin(Math.PI/3, 2) = " + tmp);
tmp = Math.sin(true);
ok(Math.floor(tmp*100) === 84, "Math.sin(true) = " + tmp);
tmp = Math.sin(false);
ok(tmp === 0, "Math.sin(false) = " + tmp);
tmp = Math.sin();
ok(isNaN(tmp), "Math.sin() is not NaN");
tmp = Math.sin(NaN);
ok(isNaN(tmp), "Math.sin(NaN) is not NaN");
tmp = Math.sin(Infinity);
ok(isNaN(tmp), "Math.sin(Infinity) is not NaN");
tmp = Math.sin(-Infinity);
ok(isNaN(tmp), "Math.sin(-Infinity) is not NaN");
tmp = Math.sqrt(0);
ok(tmp === 0, "Math.sqrt(0) = " + tmp);
tmp = Math.sqrt(4);
ok(tmp === 2, "Math.sqrt(4) = " + tmp);
tmp = Math.sqrt(-1);
ok(isNaN(tmp), "Math.sqrt(-1) is not NaN");
tmp = Math.sqrt(2, 2);
ok(Math.floor(tmp*100) === 141, "Math.sqrt(2, 2) = " + tmp);
tmp = Math.sqrt(true);
ok(tmp === 1, "Math.sqrt(true) = " + tmp);
tmp = Math.sqrt(false);
ok(tmp === 0, "Math.sqrt(false) = " + tmp);
tmp = Math.sqrt();
ok(isNaN(tmp), "Math.sqrt() is not NaN");
tmp = Math.sqrt(NaN);
ok(isNaN(tmp), "Math.sqrt(NaN) is not NaN");
tmp = Math.sqrt(Infinity);
ok(tmp === Infinity, "Math.sqrt(Infinity) = " + tmp);
tmp = Math.sqrt(-Infinity);
ok(isNaN(tmp), "Math.sqrt(-Infinity) is not NaN");
tmp = Math.tan(0);
ok(tmp === 0, "Math.tan(0) = " + tmp);
tmp = Math.tan(Math.PI);
ok(Math.floor(tmp*100) === -1, "Math.tan(Math.PI) = " + tmp);
tmp = Math.tan(2, 2);
ok(Math.floor(tmp*100) === -219, "Math.tan(2, 2) = " + tmp);
tmp = Math.tan(true);
ok(Math.floor(tmp*100) === 155, "Math.tan(true) = " + tmp);
tmp = Math.tan(false);
ok(tmp === 0, "Math.tan(false) = " + tmp);
tmp = Math.tan();
ok(isNaN(tmp), "Math.tan() is not NaN");
tmp = Math.tan(NaN);
ok(isNaN(tmp), "Math.tan(NaN) is not NaN");
tmp = Math.tan(Infinity);
ok(isNaN(tmp), "Math.tan(Infinity) is not NaN");
tmp = Math.tan(-Infinity);
ok(isNaN(tmp), "Math.tan(-Infinity) is not NaN");
var func = function (a) {
var a = 1;
if(a) return;
@ -649,6 +934,16 @@ var date = new Date();
date = new Date(100);
ok(date.getTime() === 100, "date.getTime() = " + date.getTime());
ok(Date.prototype.getTime() === 0, "date.prototype.getTime() = " + Date.prototype.getTime());
date = new Date(8.64e15);
ok(date.getTime() === 8.64e15, "date.getTime() = " + date.getTime());
date = new Date(8.64e15+1);
ok(isNaN(0+date.getTime()), "date.getTime() is not NaN");
date = new Date(Infinity);
ok(isNaN(0+date.getTime()), "date.getTime() is not NaN");
ok(date.setTime(123) === 123, "date.setTime(123) !== 123");
ok(date.setTime("123", NaN) === 123, "date.setTime(\"123\") !== 123");
ok(isNaN(date.setTime(NaN)), "date.setTime(NaN) is not NaN");
ok(typeof(Math.PI) === "number", "typeof(Math.PI) = " + typeof(Math.PI));
ok(Math.floor(Math.PI*100) === 314, "Math.PI = " + Math.PI);
@ -675,4 +970,19 @@ ok(Math.floor(Math.LN2*100) === 69, "Math.LN2 = " + Math.LN2);
Math.LN2 = "test";
ok(Math.floor(Math.LN2*100) === 69, "modified Math.LN2 = " + Math.LN2);
ok(typeof(Math.LN10) === "number", "typeof(Math.LN10) = " + typeof(Math.LN10));
ok(Math.floor(Math.LN10*100) === 230, "Math.LN10 = " + Math.LN10);
Math.LN10 = "test";
ok(Math.floor(Math.LN10*100) === 230, "modified Math.LN10 = " + Math.LN10);
ok(typeof(Math.SQRT2) === "number", "typeof(Math.SQRT2) = " + typeof(Math.SQRT2));
ok(Math.floor(Math.SQRT2*100) === 141, "Math.SQRT2 = " + Math.SQRT2);
Math.SQRT2 = "test";
ok(Math.floor(Math.SQRT2*100) === 141, "modified Math.SQRT2 = " + Math.SQRT2);
ok(typeof(Math.SQRT1_2) === "number", "typeof(Math.SQRT1_2) = " + typeof(Math.SQRT1_2));
ok(Math.floor(Math.SQRT1_2*100) === 70, "Math.SQRT1_2 = " + Math.SQRT1_2);
Math.SQRT1_2 = "test";
ok(Math.floor(Math.SQRT1_2*100) === 70, "modified Math.SQRT1_2 = " + Math.SQRT1_2);
reportSuccess();

View file

@ -33,6 +33,10 @@ ok(true === true, "true === true is false");
ok(null === null, "null === null is false");
ok(undefined === undefined, "undefined === undefined is false");
ok(!(undefined === null), "!(undefined === null) is false");
ok(1E0 === 1, "1E0 === 1 is false");
ok(1000000*1000000 === 1000000000000, "1000000*1000000 === 1000000000000 is false");
ok(8.64e15 === 8640000000000000, "8.64e15 !== 8640000000000000"+8.64e15);
ok(1e2147483648 === Infinity, "1e2147483648 !== Infinity");
ok(1 !== 2, "1 !== 2 is false");
ok(null !== undefined, "null !== undefined is false");

View file

@ -24,6 +24,7 @@
#include <windows.h>
#include <msi.h>
#include <msidefs.h>
#include <msiquery.h>
#include <objidl.h>
@ -1482,6 +1483,89 @@ static void test_streamtable(void)
DeleteFile(msifile);
}
static void test_binary(void)
{
MSIHANDLE hdb = 0, rec;
char file[MAX_PATH];
char buf[MAX_PATH];
DWORD size;
LPCSTR query;
UINT r;
/* insert a file into the Binary table */
r = MsiOpenDatabase(msifile, MSIDBOPEN_CREATE, &hdb );
ok( r == ERROR_SUCCESS , "Failed to open database\n" );
query = "CREATE TABLE `Binary` ( `Name` CHAR(72) NOT NULL, `ID` INT NOT NULL, `Data` OBJECT PRIMARY KEY `Name`, `ID`)";
r = run_query( hdb, 0, query );
ok( r == ERROR_SUCCESS, "Cannot create Binary table: %d\n", r );
create_file( "test.txt" );
rec = MsiCreateRecord( 1 );
r = MsiRecordSetStream( rec, 1, "test.txt" );
ok( r == ERROR_SUCCESS, "Failed to add stream data to the record: %d\n", r);
DeleteFile( "test.txt" );
query = "INSERT INTO `Binary` ( `Name`, `ID`, `Data` ) VALUES ( 'filename1', 1, ? )";
r = run_query( hdb, rec, query );
ok( r == ERROR_SUCCESS, "Insert into Binary table failed: %d\n", r );
r = MsiCloseHandle( rec );
ok( r == ERROR_SUCCESS , "Failed to close record handle\n" );
r = MsiDatabaseCommit( hdb );
ok( r == ERROR_SUCCESS , "Failed to commit database\n" );
r = MsiCloseHandle( hdb );
ok( r == ERROR_SUCCESS , "Failed to close database\n" );
/* read file from the Stream table */
r = MsiOpenDatabase( msifile, MSIDBOPEN_READONLY, &hdb );
ok( r == ERROR_SUCCESS , "Failed to open database\n" );
query = "SELECT * FROM `_Streams`";
r = do_query( hdb, query, &rec );
ok( r == ERROR_SUCCESS, "SELECT query failed: %d\n", r );
size = MAX_PATH;
r = MsiRecordGetString( rec, 1, file, &size );
ok( r == ERROR_SUCCESS, "Failed to get string: %d\n", r );
ok( !lstrcmp(file, "Binary.filename1.1"), "Expected 'Binary.filename1.1', got %s\n", file );
size = MAX_PATH;
memset( buf, 0, MAX_PATH );
r = MsiRecordReadStream( rec, 2, buf, &size );
ok( r == ERROR_SUCCESS, "Failed to get stream: %d\n", r );
ok( !lstrcmp(buf, "test.txt\n"), "Expected 'test.txt\\n', got %s\n", buf );
r = MsiCloseHandle( rec );
ok( r == ERROR_SUCCESS , "Failed to close record handle\n" );
/* read file from the Binary table */
query = "SELECT * FROM `Binary`";
r = do_query( hdb, query, &rec );
ok( r == ERROR_SUCCESS, "SELECT query failed: %d\n", r );
size = MAX_PATH;
r = MsiRecordGetString( rec, 1, file, &size );
ok( r == ERROR_SUCCESS, "Failed to get string: %d\n", r );
ok( !lstrcmp(file, "filename1"), "Expected 'filename1', got %s\n", file );
size = MAX_PATH;
memset( buf, 0, MAX_PATH );
r = MsiRecordReadStream( rec, 3, buf, &size );
ok( r == ERROR_SUCCESS, "Failed to get stream: %d\n", r );
ok( !lstrcmp(buf, "test.txt\n"), "Expected 'test.txt\\n', got %s\n", buf );
r = MsiCloseHandle( rec );
ok( r == ERROR_SUCCESS , "Failed to close record handle\n" );
r = MsiCloseHandle( hdb );
ok( r == ERROR_SUCCESS , "Failed to close database\n" );
DeleteFile( msifile );
}
static void test_where(void)
{
MSIHANDLE hdb = 0, rec, view;
@ -1628,6 +1712,24 @@ static const CHAR endlines2[] = "A\tB\tC\tD\tE\tF\r"
"a\tb\tc\td\te\tf\n"
"g\th\ti\tj\tk\tl\r\n";
static const CHAR suminfo[] = "PropertyId\tValue\n"
"i2\tl255\n"
"_SummaryInformation\tPropertyId\n"
"1\t1252\n"
"2\tInstaller Database\n"
"3\tInstaller description\n"
"4\tWineHQ\n"
"5\tInstaller\n"
"6\tInstaller comments\n"
"7\tIntel;1033\n"
"9\t{12345678-1234-1234-1234-123456789012}\n"
"12\t2009/04/12 15:46:11\n"
"13\t2009/04/12 15:46:11\n"
"14\t200\n"
"15\t2\n"
"18\tVim\n"
"19\t2\n";
static void write_file(const CHAR *filename, const char *data, int data_size)
{
DWORD size;
@ -1650,6 +1752,128 @@ static UINT add_table_to_db(MSIHANDLE hdb, LPCSTR table_data)
return r;
}
static void test_suminfo_import(void)
{
MSIHANDLE hdb, hsi, view = 0;
LPCSTR query;
UINT r, count, size, type;
char str_value[50];
INT int_value;
FILETIME ft_value;
GetCurrentDirectoryA(MAX_PATH, CURR_DIR);
r = MsiOpenDatabaseA(msifile, MSIDBOPEN_CREATE, &hdb);
ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
r = add_table_to_db(hdb, suminfo);
ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
/* _SummaryInformation is not imported as a regular table... */
query = "SELECT * FROM `_SummaryInformation`";
r = MsiDatabaseOpenViewA(hdb, query, &view);
ok(r == ERROR_BAD_QUERY_SYNTAX, "Expected ERROR_BAD_QUERY_SYNTAX, got %u\n", r);
MsiCloseHandle(view);
/* ...its data is added to the special summary information stream */
r = MsiGetSummaryInformationA(hdb, NULL, 0, &hsi);
ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
r = MsiSummaryInfoGetPropertyCount(hsi, &count);
ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
ok(count == 14, "Expected 14, got %u\n", count);
r = MsiSummaryInfoGetPropertyA(hsi, PID_CODEPAGE, &type, &int_value, NULL, NULL, NULL);
ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
ok(type == VT_I2, "Expected VT_I2, got %u\n", type);
ok(int_value == 1252, "Expected 1252, got %d\n", int_value);
size = sizeof(str_value);
r = MsiSummaryInfoGetPropertyA(hsi, PID_TITLE, &type, NULL, NULL, str_value, &size);
ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
ok(type == VT_LPSTR, "Expected VT_LPSTR, got %u\n", type);
ok(size == 18, "Expected 18, got %u\n", size);
ok(!strcmp(str_value, "Installer Database"),
"Expected \"Installer Database\", got %s\n", str_value);
size = sizeof(str_value);
r = MsiSummaryInfoGetPropertyA(hsi, PID_SUBJECT, &type, NULL, NULL, str_value, &size);
ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
ok(type == VT_LPSTR, "Expected VT_LPSTR, got %u\n", type);
ok(!strcmp(str_value, "Installer description"),
"Expected \"Installer description\", got %s\n", str_value);
size = sizeof(str_value);
r = MsiSummaryInfoGetPropertyA(hsi, PID_AUTHOR, &type, NULL, NULL, str_value, &size);
ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
ok(type == VT_LPSTR, "Expected VT_LPSTR, got %u\n", type);
ok(!strcmp(str_value, "WineHQ"),
"Expected \"WineHQ\", got %s\n", str_value);
size = sizeof(str_value);
r = MsiSummaryInfoGetPropertyA(hsi, PID_KEYWORDS, &type, NULL, NULL, str_value, &size);
ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
ok(type == VT_LPSTR, "Expected VT_LPSTR, got %u\n", type);
ok(!strcmp(str_value, "Installer"),
"Expected \"Installer\", got %s\n", str_value);
size = sizeof(str_value);
r = MsiSummaryInfoGetPropertyA(hsi, PID_COMMENTS, &type, NULL, NULL, str_value, &size);
ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
ok(type == VT_LPSTR, "Expected VT_LPSTR, got %u\n", type);
ok(!strcmp(str_value, "Installer comments"),
"Expected \"Installer comments\", got %s\n", str_value);
size = sizeof(str_value);
r = MsiSummaryInfoGetPropertyA(hsi, PID_TEMPLATE, &type, NULL, NULL, str_value, &size);
ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
ok(type == VT_LPSTR, "Expected VT_LPSTR, got %u\n", type);
ok(!strcmp(str_value, "Intel;1033"),
"Expected \"Intel;1033\", got %s\n", str_value);
size = sizeof(str_value);
r = MsiSummaryInfoGetPropertyA(hsi, PID_REVNUMBER, &type, NULL, NULL, str_value, &size);
ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
ok(type == VT_LPSTR, "Expected VT_LPSTR, got %u\n", type);
ok(!strcmp(str_value, "{12345678-1234-1234-1234-123456789012}"),
"Expected \"{12345678-1234-1234-1234-123456789012}\", got %s\n", str_value);
r = MsiSummaryInfoGetPropertyA(hsi, PID_CREATE_DTM, &type, NULL, &ft_value, NULL, NULL);
ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
ok(type == VT_FILETIME, "Expected VT_FILETIME, got %u\n", type);
r = MsiSummaryInfoGetPropertyA(hsi, PID_LASTSAVE_DTM, &type, NULL, &ft_value, NULL, NULL);
ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
ok(type == VT_FILETIME, "Expected VT_FILETIME, got %u\n", type);
r = MsiSummaryInfoGetPropertyA(hsi, PID_PAGECOUNT, &type, &int_value, NULL, NULL, NULL);
ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
ok(type == VT_I4, "Expected VT_I4, got %u\n", type);
ok(int_value == 200, "Expected 200, got %d\n", int_value);
r = MsiSummaryInfoGetPropertyA(hsi, PID_WORDCOUNT, &type, &int_value, NULL, NULL, NULL);
ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
ok(type == VT_I4, "Expected VT_I4, got %u\n", type);
ok(int_value == 2, "Expected 2, got %d\n", int_value);
r = MsiSummaryInfoGetPropertyA(hsi, PID_SECURITY, &type, &int_value, NULL, NULL, NULL);
ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
ok(type == VT_I4, "Expected VT_I4, got %u\n", type);
ok(int_value == 2, "Expected 2, got %d\n", int_value);
size = sizeof(str_value);
r = MsiSummaryInfoGetPropertyA(hsi, PID_APPNAME, &type, NULL, NULL, str_value, &size);
ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
ok(type == VT_LPSTR, "Expected VT_LPSTR, got %u\n", type);
ok(!strcmp(str_value, "Vim"), "Expected \"Vim\", got %s\n", str_value);
MsiCloseHandle(hsi);
MsiCloseHandle(hdb);
DeleteFileA(msifile);
}
static void test_msiimport(void)
{
MSIHANDLE hdb, view, rec;
@ -1856,6 +2080,63 @@ static void test_msiimport(void)
DeleteFileA(msifile);
}
static const CHAR bin_import_dat[] = "Name\tData\r\n"
"s72\tV0\r\n"
"Binary\tName\r\n"
"filename1\tfilename1.ibd\r\n";
static void test_binary_import(void)
{
MSIHANDLE hdb = 0, rec;
char file[MAX_PATH];
char buf[MAX_PATH];
char path[MAX_PATH];
DWORD size;
LPCSTR query;
UINT r;
/* create files to import */
write_file("bin_import.idt", bin_import_dat,
(sizeof(bin_import_dat) - 1) * sizeof(char));
CreateDirectory("bin_import", NULL);
create_file_data("bin_import/filename1.ibd", "just some words", 15);
/* import files into database */
r = MsiOpenDatabase(msifile, MSIDBOPEN_CREATE, &hdb);
ok( r == ERROR_SUCCESS , "Failed to open database\n");
GetCurrentDirectory(MAX_PATH, path);
r = MsiDatabaseImport(hdb, path, "bin_import.idt");
ok(r == ERROR_SUCCESS , "Failed to import Binary table\n");
/* read file from the Binary table */
query = "SELECT * FROM `Binary`";
r = do_query(hdb, query, &rec);
ok(r == ERROR_SUCCESS, "SELECT query failed: %d\n", r);
size = MAX_PATH;
r = MsiRecordGetString(rec, 1, file, &size);
ok(r == ERROR_SUCCESS, "Failed to get string: %d\n", r);
ok(!lstrcmp(file, "filename1"), "Expected 'filename1', got %s\n", file);
size = MAX_PATH;
memset(buf, 0, MAX_PATH);
r = MsiRecordReadStream(rec, 2, buf, &size);
ok(r == ERROR_SUCCESS, "Failed to get stream: %d\n", r);
ok(!lstrcmp(buf, "just some words"),
"Expected 'just some words', got %s\n", buf);
r = MsiCloseHandle(rec);
ok(r == ERROR_SUCCESS , "Failed to close record handle\n");
r = MsiCloseHandle(hdb);
ok(r == ERROR_SUCCESS , "Failed to close database\n");
DeleteFile("bin_import/filename1.ibd");
RemoveDirectory("bin_import");
DeleteFile("bin_import.idt");
}
static void test_markers(void)
{
MSIHANDLE hdb, rec;
@ -6804,6 +7085,92 @@ static void test_dbmerge(void)
r = run_query(hdb, 0, query);
ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
query = "DROP TABLE `One`";
r = run_query(hdb, 0, query);
ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
query = "DROP TABLE `One`";
r = run_query(href, 0, query);
ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
query = "CREATE TABLE `One` ( `A` INT, `B` CHAR(72) PRIMARY KEY `A` )";
r = run_query(href, 0, query);
ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
query = "INSERT INTO `One` ( `A`, `B` ) VALUES ( 1, 'hi' )";
r = run_query(href, 0, query);
ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
/* table from merged database is not in target database */
r = MsiDatabaseMergeA(hdb, href, "MergeErrors");
ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
query = "SELECT * FROM `One`";
r = do_query(hdb, query, &hrec);
ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
r = MsiRecordGetInteger(hrec, 1);
ok(r == 1, "Expected 1, got %d\n", r);
size = MAX_PATH;
r = MsiRecordGetStringA(hrec, 2, buf, &size);
ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
ok(!lstrcmpA(buf, "hi"), "Expected \"hi\", got \"%s\"\n", buf);
MsiCloseHandle(hrec);
/* nothing in MergeErrors */
query = "SELECT * FROM `MergeErrors`";
r = do_query(hdb, query, &hrec);
ok(r == ERROR_BAD_QUERY_SYNTAX,
"Expected ERROR_BAD_QUERY_SYNTAX, got %d\n", r);
query = "DROP TABLE `One`";
r = run_query(hdb, 0, query);
ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
query = "DROP TABLE `One`";
r = run_query(href, 0, query);
ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
query = "CREATE TABLE `One` ( "
"`A` CHAR(72), `B` INT PRIMARY KEY `A` )";
r = run_query(hdb, 0, query);
ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
query = "CREATE TABLE `One` ( "
"`A` CHAR(72), `B` INT PRIMARY KEY `A` )";
r = run_query(href, 0, query);
ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
query = "INSERT INTO `One` ( `A`, `B` ) VALUES ( 'hi', 1 )";
r = run_query(href, 0, query);
ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
/* primary key is string */
r = MsiDatabaseMergeA(hdb, href, "MergeErrors");
ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
query = "SELECT * FROM `One`";
r = do_query(hdb, query, &hrec);
ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
size = MAX_PATH;
r = MsiRecordGetStringA(hrec, 1, buf, &size);
ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
ok(!lstrcmpA(buf, "hi"), "Expected \"hi\", got \"%s\"\n", buf);
r = MsiRecordGetInteger(hrec, 2);
ok(r == 1, "Expected 1, got %d\n", r);
MsiCloseHandle(hrec);
/* nothing in MergeErrors */
query = "SELECT * FROM `MergeErrors`";
r = do_query(hdb, query, &hrec);
ok(r == ERROR_BAD_QUERY_SYNTAX,
"Expected ERROR_BAD_QUERY_SYNTAX, got %d\n", r);
create_file_data("codepage.idt", "\r\n\r\n850\t_ForceCodepage\r\n", 0);
GetCurrentDirectoryA(MAX_PATH, buf);
@ -6899,12 +7266,9 @@ static void test_dbmerge(void)
size = MAX_PATH;
ZeroMemory(buf, MAX_PATH);
r = MsiRecordReadStream(hrec, 2, buf, &size);
todo_wine
{
ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
ok(!lstrcmpA(buf, "binary.dat\n"),
"Expected \"binary.dat\\n\", got \"%s\"\n", buf);
}
ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
ok(!lstrcmpA(buf, "binary.dat\n"),
"Expected \"binary.dat\\n\", got \"%s\"\n", buf);
MsiCloseHandle(hrec);
@ -7528,8 +7892,10 @@ START_TEST(db)
test_msiexport();
test_longstrings();
test_streamtable();
test_binary();
test_where();
test_msiimport();
test_binary_import();
test_markers();
test_handle_limit();
test_try_transform();
@ -7559,4 +7925,5 @@ START_TEST(db)
test_dbmerge();
test_insertorder();
test_columnorder();
test_suminfo_import();
}

View file

@ -40,6 +40,8 @@ static UINT (WINAPI *pMsiSourceListEnumSourcesA)
static UINT (WINAPI *pMsiSourceListGetInfoA)
(LPCSTR, LPCSTR, MSIINSTALLCONTEXT, DWORD, LPCSTR, LPSTR, LPDWORD);
static BOOL (WINAPI *pConvertSidToStringSidA)(PSID, LPSTR*);
static HMODULE hsrclient = 0;
static BOOL (WINAPI *pSRRemoveRestorePoint)(DWORD);
static BOOL (WINAPI *pSRSetRestorePointA)(RESTOREPOINTINFOA*, STATEMGRSTATUS*);
@ -1316,6 +1318,7 @@ static int CDECL fci_delete(char *pszFile, int *err, void *pv)
static void init_functionpointers(void)
{
HMODULE hmsi = GetModuleHandleA("msi.dll");
HMODULE hadvapi32 = GetModuleHandleA("advapi32.dll");
#define GET_PROC(mod, func) \
p ## func = (void*)GetProcAddress(mod, #func); \
@ -1326,6 +1329,8 @@ static void init_functionpointers(void)
GET_PROC(hmsi, MsiSourceListEnumSourcesA);
GET_PROC(hmsi, MsiSourceListGetInfoA);
GET_PROC(hadvapi32, ConvertSidToStringSidA);
hsrclient = LoadLibraryA("srclient.dll");
GET_PROC(hsrclient, SRRemoveRestorePoint);
GET_PROC(hsrclient, SRSetRestorePointA);
@ -1346,26 +1351,28 @@ static BOOL check_win9x(void)
return FALSE;
}
static void get_user_sid(LPSTR *usersid)
static LPSTR get_user_sid(LPSTR *usersid)
{
HANDLE token;
BYTE buf[1024];
DWORD size;
PTOKEN_USER user;
HMODULE hadvapi32 = GetModuleHandleA("advapi32.dll");
static BOOL (WINAPI *pConvertSidToStringSidA)(PSID, LPSTR*);
if (!pConvertSidToStringSidA)
{
win_skip("ConvertSidToStringSidA is not available\n");
return NULL;
}
*usersid = NULL;
pConvertSidToStringSidA = (void *)GetProcAddress(hadvapi32, "ConvertSidToStringSidA");
if (!pConvertSidToStringSidA)
return;
OpenProcessToken(GetCurrentProcess(), TOKEN_QUERY, &token);
size = sizeof(buf);
GetTokenInformation(token, TokenUser, buf, size, &size);
user = (PTOKEN_USER)buf;
pConvertSidToStringSidA(user->User.Sid, usersid);
ok(*usersid != NULL, "pConvertSidToStringSidA failed lre=%d\n", GetLastError());
CloseHandle(token);
return *usersid;
}
static BOOL check_record(MSIHANDLE rec, UINT field, LPCSTR val)
@ -2511,12 +2518,8 @@ static void test_publish_registerproduct(void)
static const CHAR userugkey[] = "Software\\Microsoft\\Installer\\UpgradeCodes"
"\\51AAE0C44620A5E4788506E91F249BD2";
get_user_sid(&usersid);
if (!usersid)
{
skip("ConvertSidToStringSidA is not available\n");
if (!get_user_sid(&usersid))
return;
}
get_date_str(date);
GetTempPath(MAX_PATH, temp);
@ -2756,12 +2759,8 @@ static void test_publish_publishproduct(void)
static const CHAR machprod[] = "Installer\\Products\\84A88FD7F6998CE40A22FB59F6B9C2BB";
static const CHAR machup[] = "Installer\\UpgradeCodes\\51AAE0C44620A5E4788506E91F249BD2";
get_user_sid(&usersid);
if (!usersid)
{
skip("ConvertSidToStringSidA is not available\n");
if (!get_user_sid(&usersid))
return;
}
GetTempPath(MAX_PATH, temp);
@ -2952,12 +2951,8 @@ static void test_publish_publishfeatures(void)
static const CHAR classfeat[] = "Software\\Classes\\Installer\\Features"
"\\84A88FD7F6998CE40A22FB59F6B9C2BB";
get_user_sid(&usersid);
if (!usersid)
{
skip("ConvertSidToStringSidA is not available\n");
if (!get_user_sid(&usersid))
return;
}
CreateDirectoryA("msitest", NULL);
create_file("msitest\\maximus", 500);
@ -3114,12 +3109,8 @@ static void test_publish_registeruser(void)
"Software\\Microsoft\\Windows\\CurrentVersion\\Installer\\"
"UserData\\%s\\Products\\84A88FD7F6998CE40A22FB59F6B9C2BB\\InstallProperties";
get_user_sid(&usersid);
if (!usersid)
{
skip("ConvertSidToStringSidA is not available\n");
if (!get_user_sid(&usersid))
return;
}
get_owner_company(&owner, &company);
@ -3197,12 +3188,8 @@ static void test_publish_processcomponents(void)
static const CHAR compkey[] =
"Software\\Microsoft\\Windows\\CurrentVersion\\Installer\\Components";
get_user_sid(&usersid);
if (!usersid)
{
skip("ConvertSidToStringSidA is not available\n");
if (!get_user_sid(&usersid))
return;
}
CreateDirectoryA("msitest", NULL);
create_file("msitest\\maximus", 500);
@ -3322,7 +3309,7 @@ static void test_publish(void)
if (!pMsiQueryComponentStateA)
{
skip("MsiQueryComponentStateA is not available\n");
win_skip("MsiQueryComponentStateA is not available\n");
return;
}
@ -3810,7 +3797,7 @@ static void test_publishsourcelist(void)
if (!pMsiSourceListEnumSourcesA || !pMsiSourceListGetInfoA)
{
skip("MsiSourceListEnumSourcesA and/or MsiSourceListGetInfoA are not available\n");
win_skip("MsiSourceListEnumSourcesA and/or MsiSourceListGetInfoA are not available\n");
return;
}

View file

@ -190,7 +190,7 @@ static void test_usefeature(void)
if (!pMsiUseFeatureExA)
{
skip("MsiUseFeatureExA not implemented\n");
win_skip("MsiUseFeatureExA not implemented\n");
return;
}
@ -408,7 +408,7 @@ static void test_MsiGetFileHash(void)
if (!pMsiGetFileHashA)
{
skip("MsiGetFileHash not implemented\n");
win_skip("MsiGetFileHash not implemented\n");
return;
}
@ -1221,7 +1221,7 @@ static void test_MsiQueryComponentState(void)
if (!pMsiQueryComponentStateA)
{
skip("MsiQueryComponentStateA not implemented\n");
win_skip("MsiQueryComponentStateA not implemented\n");
return;
}
@ -3864,7 +3864,7 @@ static void test_MsiGetProductInfoEx(void)
if (!pMsiGetProductInfoExA)
{
skip("MsiGetProductInfoExA is not available\n");
win_skip("MsiGetProductInfoExA is not available\n");
return;
}
@ -10958,7 +10958,7 @@ START_TEST(msi)
test_MsiGetFileHash();
if (!pConvertSidToStringSidA)
skip("ConvertSidToStringSidA not implemented\n");
win_skip("ConvertSidToStringSidA not implemented\n");
else
{
/* These tests rely on get_user_sid that needs ConvertSidToStringSidA */

View file

@ -34,26 +34,46 @@ char CURR_DIR[MAX_PATH];
static UINT (WINAPI *pMsiApplyMultiplePatchesA)(LPCSTR, LPCSTR, LPCSTR);
static void get_user_sid(LPSTR *usersid)
static BOOL (WINAPI *pConvertSidToStringSidA)(PSID, LPSTR*);
static void init_functionpointers(void)
{
HMODULE hmsi = GetModuleHandleA("msi.dll");
HMODULE hadvapi32 = GetModuleHandleA("advapi32.dll");
#define GET_PROC(mod, func) \
p ## func = (void*)GetProcAddress(mod, #func);
GET_PROC(hmsi, MsiApplyMultiplePatchesA);
GET_PROC(hadvapi32, ConvertSidToStringSidA);
#undef GET_PROC
}
static LPSTR get_user_sid(LPSTR *usersid)
{
HANDLE token;
BYTE buf[1024];
DWORD size;
PTOKEN_USER user;
HMODULE hadvapi32 = GetModuleHandleA("advapi32.dll");
static BOOL (WINAPI *pConvertSidToStringSidA)(PSID, LPSTR*);
if (!pConvertSidToStringSidA)
{
win_skip("ConvertSidToStringSidA is not available\n");
return NULL;
}
*usersid = NULL;
pConvertSidToStringSidA = (void *)GetProcAddress(hadvapi32, "ConvertSidToStringSidA");
if (!pConvertSidToStringSidA)
return;
OpenProcessToken(GetCurrentProcess(), TOKEN_QUERY, &token);
size = sizeof(buf);
GetTokenInformation(token, TokenUser, buf, size, &size);
user = (PTOKEN_USER)buf;
pConvertSidToStringSidA(user->User.Sid, usersid);
ok(*usersid != NULL, "pConvertSidToStringSidA failed lre=%d\n", GetLastError());
CloseHandle(token);
return *usersid;
}
/* RegDeleteTreeW from dlls/advapi32/registry.c */
@ -919,6 +939,7 @@ static void test_settargetpath(void)
sz = sizeof tempdir - 1;
r = MsiGetTargetPath( hpkg, "TARGETDIR", tempdir, &sz );
sprintf( file, "%srootfile.txt", tempdir );
buffer[0] = 0;
query_file_path( hpkg, "[#RootFile]", buffer );
ok( r == ERROR_SUCCESS, "failed to get target path: %d\n", r);
ok( !lstrcmp(buffer, file), "Expected %s, got %s\n", file, buffer );
@ -959,13 +980,13 @@ static void test_settargetpath(void)
ok( r == ERROR_SUCCESS, "MsiSetTargetPath returned %d\n", r );
query_file_path( hpkg, "[#TestFile]", buffer );
ok( !lstrcmp(buffer, "C:\\one\\two\\TestDir\\testfile.txt"),
ok( !lstrcmpi(buffer, "C:\\one\\two\\TestDir\\testfile.txt"),
"Expected C:\\one\\two\\TestDir\\testfile.txt, got %s\n", buffer );
sz = sizeof buffer - 1;
r = MsiGetTargetPath( hpkg, "TestParent", buffer, &sz );
ok( r == ERROR_SUCCESS, "failed to get target path: %d\n", r);
ok( !lstrcmp(buffer, "C:\\one\\two\\"), "Expected C:\\one\\two\\, got %s\n", buffer);
ok( !lstrcmpi(buffer, "C:\\one\\two\\"), "Expected C:\\one\\two\\, got %s\n", buffer);
MsiCloseHandle( hpkg );
}
@ -7336,12 +7357,8 @@ static void test_appsearch_complocator(void)
DWORD size;
UINT r;
get_user_sid(&usersid);
if (!usersid)
{
skip("ConvertSidToStringSidA is not available\n");
if (!get_user_sid(&usersid))
return;
}
create_test_file("FileName1");
create_test_file("FileName4");
@ -8773,7 +8790,7 @@ static void test_appsearch_drlocator(void)
search_absolute_directory(path, CURR_DIR + 3);
r = MsiGetPropertyA(hpkg, "SIGPROP3", prop, &size);
ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
ok(!lstrcmpA(prop, path), "Expected \"%s\", got \"%s\"\n", path, prop);
ok(!lstrcmpiA(prop, path), "Expected \"%s\", got \"%s\"\n", path, prop);
size = MAX_PATH;
r = MsiGetPropertyA(hpkg, "SIGPROP4", prop, &size);
@ -8820,7 +8837,7 @@ static void test_appsearch_drlocator(void)
search_absolute_directory(path, "");
r = MsiGetPropertyA(hpkg, "SIGPROP11", prop, &size);
ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
ok(!lstrcmpA(prop, path), "Expected \"%s\", got \"%s\"\n", path, prop);
ok(!lstrcmpiA(prop, path), "Expected \"%s\", got \"%s\"\n", path, prop);
DeleteFileA("FileName1");
DeleteFileA("FileName3.dll");
@ -10045,6 +10062,14 @@ static void test_MsiGetSourcePath(void)
"Expected path to be unchanged, got \"%s\"\n", path);
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);
/* try SubDir after FileCost */
size = MAX_PATH;
lstrcpyA(path, "kiwi");
@ -10089,6 +10114,14 @@ static void test_MsiGetSourcePath(void)
"Expected path to be unchanged, got \"%s\"\n", path);
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);
/* try SubDir after CostFinalize */
size = MAX_PATH;
lstrcpyA(path, "kiwi");
@ -10166,10 +10199,224 @@ static void test_MsiGetSourcePath(void)
hpkg = package_from_db(hdb);
ok(hpkg, "failed to create package\n");
/* try TARGETDIR */
size = MAX_PATH;
lstrcpyA(path, "kiwi");
r = MsiGetSourcePath(hpkg, "TARGETDIR", path, &size);
ok(r == ERROR_DIRECTORY, "Expected ERROR_DIRECTORY, got %d\n", r);
ok(!lstrcmpA(path, "kiwi"),
"Expected path to be unchanged, got \"%s\"\n", path);
ok(size == MAX_PATH, "Expected size to be unchanged, got %d\n", size);
/* try SourceDir */
size = MAX_PATH;
lstrcpyA(path, "kiwi");
r = MsiGetSourcePath(hpkg, "SourceDir", path, &size);
ok(r == ERROR_DIRECTORY, "Expected ERROR_DIRECTORY, got %d\n", r);
ok(!lstrcmpA(path, "kiwi"),
"Expected path to be unchanged, got \"%s\"\n", path);
ok(size == MAX_PATH, "Expected size to be unchanged, got %d\n", size);
/* try SOURCEDIR */
size = MAX_PATH;
lstrcpyA(path, "kiwi");
r = MsiGetSourcePath(hpkg, "SOURCEDIR", path, &size);
ok(r == ERROR_DIRECTORY, "Expected ERROR_DIRECTORY, got %d\n", r);
ok(!lstrcmpA(path, "kiwi"),
"Expected path to be unchanged, got \"%s\"\n", path);
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);
/* try SubDir */
size = MAX_PATH;
lstrcpyA(path, "kiwi");
r = MsiGetSourcePath(hpkg, "SubDir", path, &size);
ok(r == ERROR_DIRECTORY, "Expected ERROR_DIRECTORY, got %d\n", r);
ok(!lstrcmpA(path, "kiwi"),
"Expected path to be unchanged, got \"%s\"\n", path);
ok(size == MAX_PATH, "Expected size to be unchanged, got %d\n", size);
/* try SubDir2 */
size = MAX_PATH;
lstrcpyA(path, "kiwi");
r = MsiGetSourcePath(hpkg, "SubDir2", path, &size);
ok(r == ERROR_DIRECTORY, "Expected ERROR_DIRECTORY, got %d\n", r);
ok(!lstrcmpA(path, "kiwi"),
"Expected path to be unchanged, got \"%s\"\n", path);
ok(size == MAX_PATH, "Expected size to be unchanged, got %d\n", size);
r = MsiDoAction(hpkg, "CostInitialize");
ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
/* try TARGETDIR after CostInitialize */
size = MAX_PATH;
lstrcpyA(path, "kiwi");
r = MsiGetSourcePath(hpkg, "TARGETDIR", 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);
/* try SourceDir after CostInitialize */
size = MAX_PATH;
lstrcpyA(path, "kiwi");
r = MsiGetSourcePath(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);
/* try SOURCEDIR after CostInitialize */
size = MAX_PATH;
lstrcpyA(path, "kiwi");
r = MsiGetSourcePath(hpkg, "SOURCEDIR", path, &size);
todo_wine
{
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);
}
/* 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);
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);
}
/* try SubDir after CostInitialize */
size = MAX_PATH;
lstrcpyA(path, "kiwi");
r = MsiGetSourcePath(hpkg, "SubDir", 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);
/* try SubDir2 after CostInitialize */
size = MAX_PATH;
lstrcpyA(path, "kiwi");
r = MsiGetSourcePath(hpkg, "SubDir2", 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);
r = MsiDoAction(hpkg, "ResolveSource");
ok(r == ERROR_SUCCESS, "file cost failed\n");
/* try TARGETDIR after ResolveSource */
size = MAX_PATH;
lstrcpyA(path, "kiwi");
r = MsiGetSourcePath(hpkg, "TARGETDIR", 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);
/* try SourceDir after ResolveSource */
size = MAX_PATH;
lstrcpyA(path, "kiwi");
r = MsiGetSourcePath(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);
/* try SOURCEDIR after ResolveSource */
size = MAX_PATH;
lstrcpyA(path, "kiwi");
r = MsiGetSourcePath(hpkg, "SOURCEDIR", path, &size);
todo_wine
{
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);
}
/* 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);
/* try SubDir after ResolveSource */
size = MAX_PATH;
lstrcpyA(path, "kiwi");
r = MsiGetSourcePath(hpkg, "SubDir", 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);
/* try SubDir2 after ResolveSource */
size = MAX_PATH;
lstrcpyA(path, "kiwi");
r = MsiGetSourcePath(hpkg, "SubDir2", 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);
r = MsiDoAction(hpkg, "FileCost");
ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
/* try TARGETDIR after CostFinalize */
size = MAX_PATH;
lstrcpyA(path, "kiwi");
r = MsiGetSourcePath(hpkg, "TARGETDIR", 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);
/* try SourceDir after CostFinalize */
size = MAX_PATH;
lstrcpyA(path, "kiwi");
r = MsiGetSourcePath(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);
/* try SOURCEDIR after CostFinalize */
size = MAX_PATH;
lstrcpyA(path, "kiwi");
r = MsiGetSourcePath(hpkg, "SOURCEDIR", path, &size);
todo_wine
{
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);
}
/* 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);
/* try SubDir after CostFinalize */
size = MAX_PATH;
lstrcpyA(path, "kiwi");
r = MsiGetSourcePath(hpkg, "SubDir", 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);
/* try SubDir2 after CostFinalize */
size = MAX_PATH;
lstrcpyA(path, "kiwi");
r = MsiGetSourcePath(hpkg, "SubDir2", 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);
r = MsiDoAction(hpkg, "CostFinalize");
ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
@ -10200,6 +10447,14 @@ static void test_MsiGetSourcePath(void)
ok(size == lstrlenA(cwd), "Expected %d, got %d\n", lstrlenA(cwd), size);
}
/* 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);
/* try SubDir after CostFinalize */
size = MAX_PATH;
lstrcpyA(path, "kiwi");
@ -11041,8 +11296,8 @@ static void test_access(void)
static void test_emptypackage(void)
{
MSIHANDLE hpkg, hdb, hsuminfo;
MSIHANDLE hview, hrec;
MSIHANDLE hpkg = 0, hdb = 0, hsuminfo = 0;
MSIHANDLE hview = 0, hrec = 0;
MSICONDITION condition;
CHAR buffer[MAX_PATH];
DWORD size;
@ -11208,7 +11463,6 @@ static void test_MsiGetProductProperty(void)
CHAR prodcode[MAX_PATH];
CHAR prod_squashed[MAX_PATH];
HKEY prodkey, userkey, props;
LPSTR usersid;
DWORD size;
LONG res;
UINT r;
@ -11226,7 +11480,6 @@ static void test_MsiGetProductProperty(void)
lstrcatA(path, "\\");
create_test_guid(prodcode, prod_squashed);
get_user_sid(&usersid);
r = MsiOpenDatabase(msifile, MSIDBOPEN_CREATE, &hdb);
ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
@ -11617,9 +11870,7 @@ static void test_MsiApplyPatch(void)
START_TEST(package)
{
HMODULE hmsi = GetModuleHandleA("msi.dll");
pMsiApplyMultiplePatchesA = (void *)GetProcAddress(hmsi, "MsiApplyMultiplePatchesA");
init_functionpointers();
GetCurrentDirectoryA(MAX_PATH, CURR_DIR);

View file

@ -193,7 +193,7 @@ static void test_MsiSourceListGetInfo(void)
if (!pMsiSourceListGetInfoA)
{
skip("Skipping MsiSourceListGetInfoA tests\n");
win_skip("Skipping MsiSourceListGetInfoA tests\n");
return;
}
@ -645,7 +645,7 @@ static void test_MsiSourceListAddSourceEx(void)
if (!pMsiSourceListAddSourceExA)
{
skip("Skipping MsiSourceListAddSourceExA tests\n");
win_skip("Skipping MsiSourceListAddSourceExA tests\n");
return;
}
@ -1018,7 +1018,7 @@ static void test_MsiSourceListEnumSources(void)
if (!pMsiSourceListEnumSourcesA)
{
skip("MsiSourceListEnumSourcesA is not available\n");
win_skip("MsiSourceListEnumSourcesA is not available\n");
return;
}
@ -1620,7 +1620,7 @@ static void test_MsiSourceListSetInfo(void)
if (!pMsiSourceListSetInfoA)
{
skip("MsiSourceListSetInfoA is not available\n");
win_skip("MsiSourceListSetInfoA is not available\n");
return;
}
@ -2030,7 +2030,7 @@ static void test_MsiSourceListAddMediaDisk(void)
if (!pMsiSourceListAddMediaDiskA)
{
skip("MsiSourceListAddMediaDiskA is not available\n");
win_skip("MsiSourceListAddMediaDiskA is not available\n");
return;
}
@ -2332,7 +2332,7 @@ static void test_MsiSourceListEnumMediaDisks(void)
if (!pMsiSourceListEnumMediaDisksA)
{
skip("MsiSourceListEnumMediaDisksA is not available\n");
win_skip("MsiSourceListEnumMediaDisksA is not available\n");
return;
}
@ -3131,7 +3131,7 @@ static void test_MsiSourceListAddSource(void)
if (!pMsiSourceListAddSourceA)
{
skip("Skipping MsiSourceListAddSourceA tests\n");
win_skip("Skipping MsiSourceListAddSourceA tests\n");
return;
}