Author: cwittich Date: Sat Aug 8 14:48:20 2009 New Revision: 42511
URL: http://svn.reactos.org/svn/reactos?rev=42511&view=rev Log: sync msi winetest with wine 1.1.27
Modified: trunk/rostests/winetests/msi/automation.c trunk/rostests/winetests/msi/db.c trunk/rostests/winetests/msi/install.c trunk/rostests/winetests/msi/source.c
Modified: trunk/rostests/winetests/msi/automation.c URL: http://svn.reactos.org/svn/reactos/trunk/rostests/winetests/msi/automation.c... ============================================================================== --- trunk/rostests/winetests/msi/automation.c [iso-8859-1] (original) +++ trunk/rostests/winetests/msi/automation.c [iso-8859-1] Sat Aug 8 14:48:20 2009 @@ -364,14 +364,25 @@ /* ok-like statement which takes two unicode strings or one unicode and one ANSI string as arguments */ static CHAR string1[MAX_PATH], string2[MAX_PATH];
+/* lstrcmpW is not supported on Win9x */ +static int strcmp_ww(const WCHAR* str1, const WCHAR* str2) +{ + CHAR str1A[MAX_PATH], str2A[MAX_PATH]; + + WideCharToMultiByte(CP_ACP, 0, str1, -1, str1A, MAX_PATH, NULL, NULL); \ + WideCharToMultiByte(CP_ACP, 0, str2, -1, str2A, MAX_PATH, NULL, NULL); \ + + return lstrcmpA(str1A, str2A); +} + #define ok_w2(format, szString1, szString2) \ \ - if (lstrcmpW(szString1, szString2) != 0) \ - { \ - WideCharToMultiByte(CP_ACP, 0, szString1, -1, string1, MAX_PATH, NULL, NULL); \ - WideCharToMultiByte(CP_ACP, 0, szString2, -1, string2, MAX_PATH, NULL, NULL); \ + do { \ + WideCharToMultiByte(CP_ACP, 0, szString1, -1, string1, MAX_PATH, NULL, NULL); \ + WideCharToMultiByte(CP_ACP, 0, szString2, -1, string2, MAX_PATH, NULL, NULL); \ + if (lstrcmpA(string1, string2) != 0) \ ok(0, format, string1, string2); \ - } + } while(0);
#define ok_w2n(format, szString1, szString2, len) \ \ @@ -759,7 +770,9 @@ V_BSTR(&vararg) = SysAllocString(szValue);
hr = Installer_RegistryValue(hkey, szKey, vararg, &varresult, VT_BSTR); - if (V_BSTR(&varresult)) lstrcpyW(szString, V_BSTR(&varresult)); + if (V_BSTR(&varresult)) + /* lstrcpyW is not implemented on Win95 (lstrlenW is though) */ + memcpy(szString, V_BSTR(&varresult), (lstrlenW(V_BSTR(&varresult)) + 1) * sizeof(WCHAR)); VariantClear(&varresult); return hr; } @@ -775,7 +788,8 @@ V_I4(&vararg) = iValue;
hr = Installer_RegistryValue(hkey, szKey, vararg, &varresult, vtResult); - if (SUCCEEDED(hr) && vtResult == VT_BSTR) lstrcpyW(szString, V_BSTR(&varresult)); + if (SUCCEEDED(hr) && vtResult == VT_BSTR) + memcpy(szString, V_BSTR(&varresult), (lstrlenW(V_BSTR(&varresult)) + 1) * sizeof(WCHAR)); VariantClear(&varresult); return hr; } @@ -866,7 +880,8 @@ V_BSTR(&vararg[0]) = SysAllocString(szAttribute);
hr = invoke(pInstaller, "ProductInfo", DISPATCH_PROPERTYGET, &dispparams, &varresult, VT_BSTR); - if (V_BSTR(&varresult)) lstrcpyW(szString, V_BSTR(&varresult)); + if (V_BSTR(&varresult)) + memcpy(szString, V_BSTR(&varresult), (lstrlenW(V_BSTR(&varresult)) + 1) * sizeof(WCHAR)); VariantClear(&varresult); return hr; } @@ -905,7 +920,8 @@ HRESULT hr;
hr = invoke(pInstaller, "Version", DISPATCH_PROPERTYGET, &dispparams, &varresult, VT_BSTR); - if (V_BSTR(&varresult)) lstrcpyW(szVersion, V_BSTR(&varresult)); + if (V_BSTR(&varresult)) + memcpy(szVersion, V_BSTR(&varresult), (lstrlenW(V_BSTR(&varresult)) + 1) * sizeof(WCHAR)); VariantClear(&varresult); return hr; } @@ -933,7 +949,8 @@ V_BSTR(&vararg[0]) = SysAllocString(szName);
hr = invoke(pSession, "Property", DISPATCH_PROPERTYGET, &dispparams, &varresult, VT_BSTR); - if (V_BSTR(&varresult)) lstrcpyW(szReturn, V_BSTR(&varresult)); + if (V_BSTR(&varresult)) + memcpy(szReturn, V_BSTR(&varresult), (lstrlenW(V_BSTR(&varresult)) + 1) * sizeof(WCHAR)); VariantClear(&varresult); return hr; } @@ -1232,7 +1249,8 @@ V_I4(&vararg[0]) = iField;
hr = invoke(pRecord, "StringData", DISPATCH_PROPERTYGET, &dispparams, &varresult, VT_BSTR); - if (V_BSTR(&varresult)) lstrcpyW(szString, V_BSTR(&varresult)); + if (V_BSTR(&varresult)) + memcpy(szString, V_BSTR(&varresult), (lstrlenW(V_BSTR(&varresult)) + 1) * sizeof(WCHAR)); VariantClear(&varresult); return hr; } @@ -1309,7 +1327,8 @@ V_I4(&vararg[0]) = iIndex;
hr = invoke(pStringList, "Item", DISPATCH_PROPERTYGET, &dispparams, &varresult, VT_BSTR); - if (V_BSTR(&varresult)) lstrcpyW(szString, V_BSTR(&varresult)); + if (V_BSTR(&varresult)) + memcpy(szString, V_BSTR(&varresult), (lstrlenW(V_BSTR(&varresult)) + 1) * sizeof(WCHAR)); VariantClear(&varresult); return hr; } @@ -1654,7 +1673,7 @@ memset(stringw, 0, sizeof(stringw)); hr = Session_PropertyGet(pSession, szProductName, stringw); ok(hr == S_OK, "Session_PropertyGet failed, hresult 0x%08x\n", hr); - if (lstrcmpW(stringw, szMSITEST) != 0) + if (strcmp_ww(stringw, szMSITEST) != 0) { len = WideCharToMultiByte(CP_ACP, 0, stringw, -1, string, MAX_PATH, NULL, NULL); ok(len, "WideCharToMultiByteChar returned error %d\n", GetLastError()); @@ -1667,7 +1686,7 @@ memset(stringw, 0, sizeof(stringw)); hr = Session_PropertyGet(pSession, szProductName, stringw); ok(hr == S_OK, "Session_PropertyGet failed, hresult 0x%08x\n", hr); - if (lstrcmpW(stringw, szProductName) != 0) + if (strcmp_ww(stringw, szProductName) != 0) { len = WideCharToMultiByte(CP_ACP, 0, stringw, -1, string, MAX_PATH, NULL, NULL); ok(len, "WideCharToMultiByteChar returned error %d\n", GetLastError()); @@ -2006,7 +2025,7 @@ ok(iValue == INSTALLSTATE_DEFAULT || iValue == INSTALLSTATE_ADVERTISED, "Installer_ProductState returned %d, expected %d or %d\n", iValue, INSTALLSTATE_DEFAULT, INSTALLSTATE_ADVERTISED);
/* Not found our product code yet? Check */ - if (!bProductFound && !lstrcmpW(szString, szProductCode)) + if (!bProductFound && !strcmp_ww(szString, szProductCode)) bProductFound = TRUE;
/* IEnumVARIANT::Next */
Modified: trunk/rostests/winetests/msi/db.c URL: http://svn.reactos.org/svn/reactos/trunk/rostests/winetests/msi/db.c?rev=425... ============================================================================== --- trunk/rostests/winetests/msi/db.c [iso-8859-1] (original) +++ trunk/rostests/winetests/msi/db.c [iso-8859-1] Sat Aug 8 14:48:20 2009 @@ -4295,6 +4295,160 @@ ok(r == ERROR_SUCCESS, "MsiCloseHandle failed\n"); }
+static void test_tables_order(void) +{ + const char *query; + MSIHANDLE hdb = 0, hview = 0, hrec = 0; + UINT r; + char buffer[100]; + DWORD sz; + + r = MsiOpenDatabase(msifile, MSIDBOPEN_CREATE, &hdb); + ok(r == ERROR_SUCCESS, "MsiOpenDatabase failed\n"); + + query = "CREATE TABLE `foo` ( " + "`baz` INT NOT NULL PRIMARY KEY `baz`)"; + r = run_query(hdb, 0, query); + ok(r == ERROR_SUCCESS, "failed to create table\n"); + + query = "CREATE TABLE `bar` ( " + "`foo` INT NOT NULL PRIMARY KEY `foo`)"; + r = run_query(hdb, 0, query); + ok(r == ERROR_SUCCESS, "failed to create table\n"); + + query = "CREATE TABLE `baz` ( " + "`bar` INT NOT NULL, " + "`baz` INT NOT NULL, " + "`foo` INT NOT NULL PRIMARY KEY `bar`)"; + r = run_query(hdb, 0, query); + ok(r == ERROR_SUCCESS, "failed to create table\n"); + + /* The names of the tables in the _Tables table must + be in the same order as these names are created in + the strings table. */ + query = "SELECT * FROM `_Tables`"; + r = MsiDatabaseOpenView(hdb, query, &hview); + ok(r == ERROR_SUCCESS, "MsiDatabaseOpenView failed\n"); + r = MsiViewExecute(hview, 0); + ok(r == ERROR_SUCCESS, "MsiViewExecute failed\n"); + + r = MsiViewFetch(hview, &hrec); + ok(r == ERROR_SUCCESS, "MsiViewFetch failed\n"); + sz = sizeof(buffer); + r = MsiRecordGetString(hrec, 1, buffer, &sz); + ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r); + ok(!lstrcmp(buffer, "foo"), "Expected foo, got %s\n", buffer); + r = MsiCloseHandle(hrec); + ok(r == ERROR_SUCCESS, "failed to close record\n"); + + r = MsiViewFetch(hview, &hrec); + ok(r == ERROR_SUCCESS, "MsiViewFetch failed\n"); + sz = sizeof(buffer); + r = MsiRecordGetString(hrec, 1, buffer, &sz); + ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r); + ok(!lstrcmp(buffer, "baz"), "Expected baz, got %s\n", buffer); + r = MsiCloseHandle(hrec); + ok(r == ERROR_SUCCESS, "failed to close record\n"); + + r = MsiViewFetch(hview, &hrec); + ok(r == ERROR_SUCCESS, "MsiViewFetch failed\n"); + sz = sizeof(buffer); + r = MsiRecordGetString(hrec, 1, buffer, &sz); + ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r); + ok(!lstrcmp(buffer, "bar"), "Expected bar, got %s\n", buffer); + r = MsiCloseHandle(hrec); + ok(r == ERROR_SUCCESS, "failed to close record\n"); + + r = MsiViewClose(hview); + ok(r == ERROR_SUCCESS, "MsiViewClose failed\n"); + r = MsiCloseHandle(hview); + ok(r == ERROR_SUCCESS, "MsiCloseHandle failed\n"); + + /* The names of the tables in the _Columns table must + be in the same order as these names are created in + the strings table. */ + query = "SELECT * FROM `_Columns`"; + r = MsiDatabaseOpenView(hdb, query, &hview); + ok(r == ERROR_SUCCESS, "MsiDatabaseOpenView failed\n"); + r = MsiViewExecute(hview, 0); + ok(r == ERROR_SUCCESS, "MsiViewExecute failed\n"); + + r = MsiViewFetch(hview, &hrec); + ok(r == ERROR_SUCCESS, "MsiViewFetch failed\n"); + sz = sizeof(buffer); + r = MsiRecordGetString(hrec, 1, buffer, &sz); + ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r); + ok(!lstrcmp(buffer, "foo"), "Expected foo, got %s\n", buffer); + sz = sizeof(buffer); + r = MsiRecordGetString(hrec, 3, buffer, &sz); + ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r); + ok(!lstrcmp(buffer, "baz"), "Expected baz, got %s\n", buffer); + r = MsiCloseHandle(hrec); + ok(r == ERROR_SUCCESS, "failed to close record\n"); + + r = MsiViewFetch(hview, &hrec); + ok(r == ERROR_SUCCESS, "MsiViewFetch failed\n"); + sz = sizeof(buffer); + r = MsiRecordGetString(hrec, 1, buffer, &sz); + ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r); + ok(!lstrcmp(buffer, "baz"), "Expected baz, got %s\n", buffer); + sz = sizeof(buffer); + r = MsiRecordGetString(hrec, 3, buffer, &sz); + ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r); + ok(!lstrcmp(buffer, "bar"), "Expected bar, got %s\n", buffer); + r = MsiCloseHandle(hrec); + ok(r == ERROR_SUCCESS, "failed to close record\n"); + + r = MsiViewFetch(hview, &hrec); + ok(r == ERROR_SUCCESS, "MsiViewFetch failed\n"); + sz = sizeof(buffer); + r = MsiRecordGetString(hrec, 1, buffer, &sz); + ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r); + ok(!lstrcmp(buffer, "baz"), "Expected baz, got %s\n", buffer); + sz = sizeof(buffer); + r = MsiRecordGetString(hrec, 3, buffer, &sz); + ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r); + ok(!lstrcmp(buffer, "baz"), "Expected baz, got %s\n", buffer); + r = MsiCloseHandle(hrec); + ok(r == ERROR_SUCCESS, "failed to close record\n"); + + r = MsiViewFetch(hview, &hrec); + ok(r == ERROR_SUCCESS, "MsiViewFetch failed\n"); + sz = sizeof(buffer); + r = MsiRecordGetString(hrec, 1, buffer, &sz); + ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r); + ok(!lstrcmp(buffer, "baz"), "Expected baz, got %s\n", buffer); + sz = sizeof(buffer); + r = MsiRecordGetString(hrec, 3, buffer, &sz); + ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r); + ok(!lstrcmp(buffer, "foo"), "Expected foo, got %s\n", buffer); + r = MsiCloseHandle(hrec); + ok(r == ERROR_SUCCESS, "failed to close record\n"); + + r = MsiViewFetch(hview, &hrec); + ok(r == ERROR_SUCCESS, "MsiViewFetch failed\n"); + sz = sizeof(buffer); + r = MsiRecordGetString(hrec, 1, buffer, &sz); + ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r); + ok(!lstrcmp(buffer, "bar"), "Expected bar, got %s\n", buffer); + sz = sizeof(buffer); + r = MsiRecordGetString(hrec, 3, buffer, &sz); + ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r); + ok(!lstrcmp(buffer, "foo"), "Expected foo, got %s\n", buffer); + r = MsiCloseHandle(hrec); + ok(r == ERROR_SUCCESS, "failed to close record\n"); + + r = MsiViewClose(hview); + ok(r == ERROR_SUCCESS, "MsiViewClose failed\n"); + r = MsiCloseHandle(hview); + ok(r == ERROR_SUCCESS, "MsiCloseHandle failed\n"); + + r = MsiCloseHandle(hdb); + ok(r == ERROR_SUCCESS, "MsiCloseHandle failed\n"); + + DeleteFile(msifile); +} + static void test_select_markers(void) { MSIHANDLE hdb = 0, rec, view, res; @@ -4605,6 +4759,127 @@ r = MsiCloseHandle(hview); ok(r == ERROR_SUCCESS, "MsiCloseHandle failed\n");
+ r = MsiCloseHandle( hdb ); + ok(r == ERROR_SUCCESS, "MsiOpenDatabase close failed\n"); +} + +static void test_viewmodify_assign(void) +{ + MSIHANDLE hdb = 0, hview = 0, hrec = 0; + const char *query; + UINT r; + + /* setup database */ + DeleteFile(msifile); + + r = MsiOpenDatabase(msifile, MSIDBOPEN_CREATE, &hdb); + ok(r == ERROR_SUCCESS, "MsiOpenDatabase failed\n"); + + query = "CREATE TABLE `table` (`A` INT, `B` INT PRIMARY KEY `A`)"; + r = run_query( hdb, 0, query ); + ok(r == ERROR_SUCCESS, "query failed\n"); + + /* assign to view, new primary key */ + query = "SELECT * FROM `table`"; + r = MsiDatabaseOpenView(hdb, query, &hview); + ok(r == ERROR_SUCCESS, "MsiDatabaseOpenView failed\n"); + r = MsiViewExecute(hview, 0); + ok(r == ERROR_SUCCESS, "MsiViewExecute failed\n"); + + hrec = MsiCreateRecord(2); + ok(hrec != 0, "MsiCreateRecord failed\n"); + + r = MsiRecordSetInteger(hrec, 1, 1); + ok(r == ERROR_SUCCESS, "failed to set integer\n"); + r = MsiRecordSetInteger(hrec, 2, 2); + ok(r == ERROR_SUCCESS, "failed to set integer\n"); + + r = MsiViewModify(hview, MSIMODIFY_ASSIGN, hrec); + ok(r == ERROR_SUCCESS, "MsiViewModify failed: %d\n", r); + + r = MsiCloseHandle(hrec); + ok(r == ERROR_SUCCESS, "failed to close record\n"); + + r = MsiViewClose(hview); + ok(r == ERROR_SUCCESS, "MsiViewClose failed\n"); + r = MsiCloseHandle(hview); + ok(r == ERROR_SUCCESS, "MsiCloseHandle failed\n"); + + query = "SELECT * FROM `table`"; + r = MsiDatabaseOpenView(hdb, query, &hview); + ok(r == ERROR_SUCCESS, "MsiDatabaseOpenView failed\n"); + r = MsiViewExecute(hview, 0); + ok(r == ERROR_SUCCESS, "MsiViewExecute failed\n"); + r = MsiViewFetch(hview, &hrec); + ok(r == ERROR_SUCCESS, "MsiViewFetch failed\n"); + + r = MsiRecordGetInteger(hrec, 1); + ok(r == 1, "Expected 1, got %d\n", r); + r = MsiRecordGetInteger(hrec, 2); + ok(r == 2, "Expected 2, got %d\n", r); + + r = MsiCloseHandle(hrec); + ok(r == ERROR_SUCCESS, "failed to close record\n"); + + r = MsiViewFetch(hview, &hrec); + ok(r == ERROR_NO_MORE_ITEMS, "Expected ERROR_NO_MORE_ITEMS, got %d\n", r); + + r = MsiViewClose(hview); + ok(r == ERROR_SUCCESS, "MsiViewClose failed\n"); + r = MsiCloseHandle(hview); + ok(r == ERROR_SUCCESS, "MsiCloseHandle failed\n"); + + /* assign to view, primary key matches */ + query = "SELECT * FROM `table`"; + r = MsiDatabaseOpenView(hdb, query, &hview); + ok(r == ERROR_SUCCESS, "MsiDatabaseOpenView failed\n"); + r = MsiViewExecute(hview, 0); + ok(r == ERROR_SUCCESS, "MsiViewExecute failed\n"); + + hrec = MsiCreateRecord(2); + ok(hrec != 0, "MsiCreateRecord failed\n"); + + r = MsiRecordSetInteger(hrec, 1, 1); + ok(r == ERROR_SUCCESS, "failed to set integer\n"); + r = MsiRecordSetInteger(hrec, 2, 4); + ok(r == ERROR_SUCCESS, "failed to set integer\n"); + + r = MsiViewModify(hview, MSIMODIFY_ASSIGN, hrec); + ok(r == ERROR_SUCCESS, "MsiViewModify failed: %d\n", r); + + r = MsiCloseHandle(hrec); + ok(r == ERROR_SUCCESS, "failed to close record\n"); + + r = MsiViewClose(hview); + ok(r == ERROR_SUCCESS, "MsiViewClose failed\n"); + r = MsiCloseHandle(hview); + ok(r == ERROR_SUCCESS, "MsiCloseHandle failed\n"); + + query = "SELECT * FROM `table`"; + r = MsiDatabaseOpenView(hdb, query, &hview); + ok(r == ERROR_SUCCESS, "MsiDatabaseOpenView failed\n"); + r = MsiViewExecute(hview, 0); + ok(r == ERROR_SUCCESS, "MsiViewExecute failed\n"); + r = MsiViewFetch(hview, &hrec); + ok(r == ERROR_SUCCESS, "MsiViewFetch failed\n"); + + r = MsiRecordGetInteger(hrec, 1); + ok(r == 1, "Expected 1, got %d\n", r); + r = MsiRecordGetInteger(hrec, 2); + ok(r == 4, "Expected 4, got %d\n", r); + + r = MsiCloseHandle(hrec); + ok(r == ERROR_SUCCESS, "failed to close record\n"); + + r = MsiViewFetch(hview, &hrec); + ok(r == ERROR_NO_MORE_ITEMS, "Expected ERROR_NO_MORE_ITEMS, got %d\n", r); + + r = MsiViewClose(hview); + ok(r == ERROR_SUCCESS, "MsiViewClose failed\n"); + r = MsiCloseHandle(hview); + ok(r == ERROR_SUCCESS, "MsiCloseHandle failed\n"); + + /* close database */ r = MsiCloseHandle( hdb ); ok(r == ERROR_SUCCESS, "MsiOpenDatabase close failed\n"); } @@ -7391,6 +7666,43 @@
MsiViewClose(view); MsiCloseHandle(view); + + query = "DELETE FROM `T` WHERE `A` IS NULL"; + r = run_query(hdb, 0, query); + ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r); + + query = "INSERT INTO `T` ( `B`, `C` ) VALUES ( 12, 13 ) TEMPORARY"; + r = run_query(hdb, 0, query); + ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r); + + query = "SELECT * FROM `T`"; + r = MsiDatabaseOpenView(hdb, query, &view); + ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r); + r = MsiViewExecute(view, 0); + ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r); + + for (i = 0; i < 6; i++) + { + r = MsiViewFetch(view, &rec); + ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r); + + r = MsiRecordGetInteger(rec, 1); + ok(r == ordervals[i][0], "Expected %d, got %d\n", ordervals[i][0], r); + + r = MsiRecordGetInteger(rec, 2); + ok(r == ordervals[i][1], "Expected %d, got %d\n", ordervals[i][1], r); + + r = MsiRecordGetInteger(rec, 3); + ok(r == ordervals[i][2], "Expected %d, got %d\n", ordervals[i][2], r); + + MsiCloseHandle(rec); + } + + r = MsiViewFetch(view, &rec); + ok(r == ERROR_NO_MORE_ITEMS, "Expected ERROR_NO_MORE_ITEMS, got %d\n", r); + + MsiViewClose(view); + MsiCloseHandle(view); MsiCloseHandle(hdb); DeleteFileA(msifile); } @@ -7905,8 +8217,10 @@ test_integers(); test_update(); test_special_tables(); + test_tables_order(); test_select_markers(); test_viewmodify_update(); + test_viewmodify_assign(); test_stringtable(); test_viewmodify_delete(); test_defaultdatabase();
Modified: trunk/rostests/winetests/msi/install.c URL: http://svn.reactos.org/svn/reactos/trunk/rostests/winetests/msi/install.c?re... ============================================================================== --- trunk/rostests/winetests/msi/install.c [iso-8859-1] (original) +++ trunk/rostests/winetests/msi/install.c [iso-8859-1] Sat Aug 8 14:48:20 2009 @@ -62,7 +62,7 @@ "Component\tComponent\n" "Five\t{8CC92E9D-14B2-4CA4-B2AA-B11D02078087}\tNEWDIR\t2\t\tfive.txt\n" "Four\t{FD37B4EA-7209-45C0-8917-535F35A2F080}\tCABOUTDIR\t2\t\tfour.txt\n" - "One\t{783B242E-E185-4A56-AF86-C09815EC053C}\tMSITESTDIR\t2\t\tone.txt\n" + "One\t{783B242E-E185-4A56-AF86-C09815EC053C}\tMSITESTDIR\t2\tNOT REINSTALL\tone.txt\n" "Three\t{010B6ADD-B27D-4EDD-9B3D-34C4F7D61684}\tCHANGEDDIR\t2\t\tthree.txt\n" "Two\t{BF03D1A6-20DA-4A65-82F3-6CAC995915CE}\tFIRSTDIR\t2\t\ttwo.txt\n" "dangler\t{6091DF25-EF96-45F1-B8E9-A9B1420C7A3C}\tTARGETDIR\t4\t\tregdata\n" @@ -159,6 +159,74 @@ "SERVNAME\tTestService\n" "SERVDISP\tTestServiceDisp\n";
+static const CHAR up_property_dat[] = "Property\tValue\n" + "s72\tl0\n" + "Property\tProperty\n" + "DefaultUIFont\tDlgFont8\n" + "HASUIRUN\t0\n" + "INSTALLLEVEL\t3\n" + "InstallMode\tTypical\n" + "Manufacturer\tWine\n" + "PIDTemplate\t12345<###-%%%%%%%>@@@@@\n" + "ProductCode\t{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}\n" + "ProductID\tnone\n" + "ProductLanguage\t1033\n" + "ProductName\tMSITEST\n" + "ProductVersion\t1.1.1\n" + "PROMPTROLLBACKCOST\tP\n" + "Setup\tSetup\n" + "UpgradeCode\t{4C0EAA15-0264-4E5A-8758-609EF142B92D}\n" + "AdminProperties\tPOSTADMIN\n" + "ROOTDRIVE\tC:\\n" + "SERVNAME\tTestService\n" + "SERVDISP\tTestServiceDisp\n" + "RemovePreviousVersions\t1\n"; + +static const CHAR up2_property_dat[] = "Property\tValue\n" + "s72\tl0\n" + "Property\tProperty\n" + "DefaultUIFont\tDlgFont8\n" + "HASUIRUN\t0\n" + "INSTALLLEVEL\t3\n" + "InstallMode\tTypical\n" + "Manufacturer\tWine\n" + "PIDTemplate\t12345<###-%%%%%%%>@@@@@\n" + "ProductCode\t{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}\n" + "ProductID\tnone\n" + "ProductLanguage\t1033\n" + "ProductName\tMSITEST\n" + "ProductVersion\t1.1.2\n" + "PROMPTROLLBACKCOST\tP\n" + "Setup\tSetup\n" + "UpgradeCode\t{4C0EAA15-0264-4E5A-8758-609EF142B92D}\n" + "AdminProperties\tPOSTADMIN\n" + "ROOTDRIVE\tC:\\n" + "SERVNAME\tTestService\n" + "SERVDISP\tTestServiceDisp\n"; + +static const CHAR up3_property_dat[] = "Property\tValue\n" + "s72\tl0\n" + "Property\tProperty\n" + "DefaultUIFont\tDlgFont8\n" + "HASUIRUN\t0\n" + "INSTALLLEVEL\t3\n" + "InstallMode\tTypical\n" + "Manufacturer\tWine\n" + "PIDTemplate\t12345<###-%%%%%%%>@@@@@\n" + "ProductCode\t{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}\n" + "ProductID\tnone\n" + "ProductLanguage\t1033\n" + "ProductName\tMSITEST\n" + "ProductVersion\t1.1.2\n" + "PROMPTROLLBACKCOST\tP\n" + "Setup\tSetup\n" + "UpgradeCode\t{4C0EAA15-0264-4E5A-8758-609EF142B92D}\n" + "AdminProperties\tPOSTADMIN\n" + "ROOTDRIVE\tC:\\n" + "SERVNAME\tTestService\n" + "SERVDISP\tTestServiceDisp\n" + "RemovePreviousVersions\t1\n"; + static const CHAR registry_dat[] = "Registry\tRoot\tKey\tName\tValue\tComponent_\n" "s72\ti2\tl255\tL255\tL0\ts72\n" "Registry\tRegistry\n" @@ -807,6 +875,111 @@ ADD_TABLE(service_control) };
+static const msi_table up_tables[] = +{ + ADD_TABLE(component), + ADD_TABLE(directory), + ADD_TABLE(feature), + ADD_TABLE(feature_comp), + ADD_TABLE(file), + ADD_TABLE(install_exec_seq), + ADD_TABLE(media), + ADD_TABLE(up_property), + ADD_TABLE(registry), + ADD_TABLE(service_install), + ADD_TABLE(service_control) +}; + +static const msi_table up2_tables[] = +{ + ADD_TABLE(component), + ADD_TABLE(directory), + ADD_TABLE(feature), + ADD_TABLE(feature_comp), + ADD_TABLE(file), + ADD_TABLE(install_exec_seq), + ADD_TABLE(media), + ADD_TABLE(up2_property), + ADD_TABLE(registry), + ADD_TABLE(service_install), + ADD_TABLE(service_control) +}; + +static const msi_table up3_tables[] = +{ + ADD_TABLE(component), + ADD_TABLE(directory), + ADD_TABLE(feature), + ADD_TABLE(feature_comp), + ADD_TABLE(file), + ADD_TABLE(install_exec_seq), + ADD_TABLE(media), + ADD_TABLE(up3_property), + ADD_TABLE(registry), + ADD_TABLE(service_install), + ADD_TABLE(service_control) +}; + +static const msi_table up4_tables[] = +{ + ADD_TABLE(component), + ADD_TABLE(directory), + ADD_TABLE(feature), + ADD_TABLE(feature_comp), + ADD_TABLE(file), + ADD_TABLE(pp_install_exec_seq), + ADD_TABLE(media), + ADD_TABLE(property), + ADD_TABLE(registry), + ADD_TABLE(service_install), + ADD_TABLE(service_control) +}; + +static const msi_table up5_tables[] = +{ + ADD_TABLE(component), + ADD_TABLE(directory), + ADD_TABLE(feature), + ADD_TABLE(feature_comp), + ADD_TABLE(file), + ADD_TABLE(pp_install_exec_seq), + ADD_TABLE(media), + ADD_TABLE(up_property), + ADD_TABLE(registry), + ADD_TABLE(service_install), + ADD_TABLE(service_control) +}; + +static const msi_table up6_tables[] = +{ + ADD_TABLE(component), + ADD_TABLE(directory), + ADD_TABLE(feature), + ADD_TABLE(feature_comp), + ADD_TABLE(file), + ADD_TABLE(pp_install_exec_seq), + ADD_TABLE(media), + ADD_TABLE(up2_property), + ADD_TABLE(registry), + ADD_TABLE(service_install), + ADD_TABLE(service_control) +}; + +static const msi_table up7_tables[] = +{ + ADD_TABLE(component), + ADD_TABLE(directory), + ADD_TABLE(feature), + ADD_TABLE(feature_comp), + ADD_TABLE(file), + ADD_TABLE(pp_install_exec_seq), + ADD_TABLE(media), + ADD_TABLE(up3_property), + ADD_TABLE(registry), + ADD_TABLE(service_install), + ADD_TABLE(service_control) +}; + static const msi_table cc_tables[] = { ADD_TABLE(cc_component), @@ -1746,6 +1919,7 @@ create_test_files(); create_database(msifile, tables, sizeof(tables) / sizeof(msi_table));
+ /* install, don't publish */ r = MsiInstallProductA(msifile, NULL); ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
@@ -1791,6 +1965,209 @@ check_service_is_installed();
RegDeleteKeyA(HKEY_LOCAL_MACHINE, "SOFTWARE\Wine\msitest"); + + /* not published, reinstall */ + r = MsiInstallProductA(msifile, NULL); + ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r); + + ok(delete_pf("msitest\cabout\new\five.txt", TRUE), "File not installed\n"); + ok(delete_pf("msitest\cabout\new", FALSE), "File not installed\n"); + ok(delete_pf("msitest\cabout\four.txt", TRUE), "File not installed\n"); + ok(delete_pf("msitest\cabout", FALSE), "File not installed\n"); + ok(delete_pf("msitest\changed\three.txt", TRUE), "File not installed\n"); + ok(delete_pf("msitest\changed", FALSE), "File not installed\n"); + ok(delete_pf("msitest\first\two.txt", TRUE), "File not installed\n"); + ok(delete_pf("msitest\first", FALSE), "File not installed\n"); + ok(delete_pf("msitest\one.txt", TRUE), "File not installed\n"); + ok(delete_pf("msitest\filename", TRUE), "File not installed\n"); + ok(delete_pf("msitest\service.exe", TRUE), "File not installed\n"); + ok(delete_pf("msitest", FALSE), "File not installed\n"); + + res = RegOpenKey(HKEY_LOCAL_MACHINE, "SOFTWARE\Wine\msitest", &hkey); + ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res); + RegDeleteKeyA(HKEY_LOCAL_MACHINE, "SOFTWARE\Wine\msitest"); + + create_database(msifile, up_tables, sizeof(up_tables) / sizeof(msi_table)); + + /* not published, RemovePreviousVersions set */ + r = MsiInstallProductA(msifile, NULL); + ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r); + + ok(delete_pf("msitest\cabout\new\five.txt", TRUE), "File not installed\n"); + ok(delete_pf("msitest\cabout\new", FALSE), "File not installed\n"); + ok(delete_pf("msitest\cabout\four.txt", TRUE), "File not installed\n"); + ok(delete_pf("msitest\cabout", FALSE), "File not installed\n"); + ok(delete_pf("msitest\changed\three.txt", TRUE), "File not installed\n"); + ok(delete_pf("msitest\changed", FALSE), "File not installed\n"); + ok(delete_pf("msitest\first\two.txt", TRUE), "File not installed\n"); + ok(delete_pf("msitest\first", FALSE), "File not installed\n"); + ok(delete_pf("msitest\one.txt", TRUE), "File not installed\n"); + ok(delete_pf("msitest\filename", TRUE), "File not installed\n"); + ok(delete_pf("msitest\service.exe", TRUE), "File not installed\n"); + ok(delete_pf("msitest", FALSE), "File not installed\n"); + + res = RegOpenKey(HKEY_LOCAL_MACHINE, "SOFTWARE\Wine\msitest", &hkey); + ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res); + RegDeleteKeyA(HKEY_LOCAL_MACHINE, "SOFTWARE\Wine\msitest"); + + create_database(msifile, up2_tables, sizeof(up2_tables) / sizeof(msi_table)); + + /* not published, version number bumped */ + r = MsiInstallProductA(msifile, NULL); + ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r); + + ok(delete_pf("msitest\cabout\new\five.txt", TRUE), "File not installed\n"); + ok(delete_pf("msitest\cabout\new", FALSE), "File not installed\n"); + ok(delete_pf("msitest\cabout\four.txt", TRUE), "File not installed\n"); + ok(delete_pf("msitest\cabout", FALSE), "File not installed\n"); + ok(delete_pf("msitest\changed\three.txt", TRUE), "File not installed\n"); + ok(delete_pf("msitest\changed", FALSE), "File not installed\n"); + ok(delete_pf("msitest\first\two.txt", TRUE), "File not installed\n"); + ok(delete_pf("msitest\first", FALSE), "File not installed\n"); + ok(delete_pf("msitest\one.txt", TRUE), "File not installed\n"); + ok(delete_pf("msitest\filename", TRUE), "File not installed\n"); + ok(delete_pf("msitest\service.exe", TRUE), "File not installed\n"); + ok(delete_pf("msitest", FALSE), "File not installed\n"); + + res = RegOpenKey(HKEY_LOCAL_MACHINE, "SOFTWARE\Wine\msitest", &hkey); + ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res); + RegDeleteKeyA(HKEY_LOCAL_MACHINE, "SOFTWARE\Wine\msitest"); + + create_database(msifile, up3_tables, sizeof(up3_tables) / sizeof(msi_table)); + + /* not published, RemovePreviousVersions set and version number bumped */ + r = MsiInstallProductA(msifile, NULL); + ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r); + + ok(delete_pf("msitest\cabout\new\five.txt", TRUE), "File not installed\n"); + ok(delete_pf("msitest\cabout\new", FALSE), "File not installed\n"); + ok(delete_pf("msitest\cabout\four.txt", TRUE), "File not installed\n"); + ok(delete_pf("msitest\cabout", FALSE), "File not installed\n"); + ok(delete_pf("msitest\changed\three.txt", TRUE), "File not installed\n"); + ok(delete_pf("msitest\changed", FALSE), "File not installed\n"); + ok(delete_pf("msitest\first\two.txt", TRUE), "File not installed\n"); + ok(delete_pf("msitest\first", FALSE), "File not installed\n"); + ok(delete_pf("msitest\one.txt", TRUE), "File not installed\n"); + ok(delete_pf("msitest\filename", TRUE), "File not installed\n"); + ok(delete_pf("msitest\service.exe", TRUE), "File not installed\n"); + ok(delete_pf("msitest", FALSE), "File not installed\n"); + + res = RegOpenKey(HKEY_LOCAL_MACHINE, "SOFTWARE\Wine\msitest", &hkey); + ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res); + RegDeleteKeyA(HKEY_LOCAL_MACHINE, "SOFTWARE\Wine\msitest"); + + create_database(msifile, up4_tables, sizeof(up4_tables) / sizeof(msi_table)); + + /* install, publish product */ + r = MsiInstallProductA(msifile, "PUBLISH_PRODUCT=1"); + ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r); + + ok(delete_pf("msitest\cabout\new\five.txt", TRUE), "File not installed\n"); + ok(delete_pf("msitest\cabout\new", FALSE), "File not installed\n"); + ok(delete_pf("msitest\cabout\four.txt", TRUE), "File not installed\n"); + ok(delete_pf("msitest\cabout", FALSE), "File not installed\n"); + ok(delete_pf("msitest\changed\three.txt", TRUE), "File not installed\n"); + ok(delete_pf("msitest\changed", FALSE), "File not installed\n"); + ok(delete_pf("msitest\first\two.txt", TRUE), "File not installed\n"); + ok(delete_pf("msitest\first", FALSE), "File not installed\n"); + ok(delete_pf("msitest\one.txt", TRUE), "File not installed\n"); + ok(delete_pf("msitest\filename", TRUE), "File not installed\n"); + ok(delete_pf("msitest\service.exe", TRUE), "File not installed\n"); + ok(delete_pf("msitest", FALSE), "File not installed\n"); + + res = RegOpenKey(HKEY_LOCAL_MACHINE, "SOFTWARE\Wine\msitest", &hkey); + ok(res == ERROR_FILE_NOT_FOUND, "Expected ERROR_FILE_NOT_FOUND, got %d\n", res); + + create_database(msifile, up4_tables, sizeof(up4_tables) / sizeof(msi_table)); + + /* published, reinstall */ + r = MsiInstallProductA(msifile, NULL); + ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r); + + ok(delete_pf("msitest\cabout\new\five.txt", TRUE), "File not installed\n"); + ok(delete_pf("msitest\cabout\new", FALSE), "File not installed\n"); + ok(delete_pf("msitest\cabout\four.txt", TRUE), "File not installed\n"); + ok(delete_pf("msitest\cabout", FALSE), "File not installed\n"); + ok(delete_pf("msitest\changed\three.txt", TRUE), "File not installed\n"); + ok(delete_pf("msitest\changed", FALSE), "File not installed\n"); + ok(delete_pf("msitest\first\two.txt", TRUE), "File not installed\n"); + ok(delete_pf("msitest\first", FALSE), "File not installed\n"); + ok(delete_pf("msitest\one.txt", TRUE), "File not installed\n"); + ok(delete_pf("msitest\filename", TRUE), "File not installed\n"); + ok(delete_pf("msitest\service.exe", TRUE), "File not installed\n"); + ok(delete_pf("msitest", FALSE), "File not installed\n"); + + res = RegOpenKey(HKEY_LOCAL_MACHINE, "SOFTWARE\Wine\msitest", &hkey); + ok(res == ERROR_FILE_NOT_FOUND, "Expected ERROR_FILE_NOT_FOUND, got %d\n", res); + + create_database(msifile, up5_tables, sizeof(up5_tables) / sizeof(msi_table)); + + /* published product, RemovePreviousVersions set */ + r = MsiInstallProductA(msifile, NULL); + ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r); + + ok(delete_pf("msitest\cabout\new\five.txt", TRUE), "File not installed\n"); + ok(delete_pf("msitest\cabout\new", FALSE), "File not installed\n"); + ok(delete_pf("msitest\cabout\four.txt", TRUE), "File not installed\n"); + ok(delete_pf("msitest\cabout", FALSE), "File not installed\n"); + ok(delete_pf("msitest\changed\three.txt", TRUE), "File not installed\n"); + ok(delete_pf("msitest\changed", FALSE), "File not installed\n"); + ok(delete_pf("msitest\first\two.txt", TRUE), "File not installed\n"); + ok(delete_pf("msitest\first", FALSE), "File not installed\n"); + ok(delete_pf("msitest\one.txt", TRUE), "File not installed\n"); + ok(delete_pf("msitest\filename", TRUE), "File not installed\n"); + ok(delete_pf("msitest\service.exe", TRUE), "File not installed\n"); + ok(delete_pf("msitest", FALSE), "File not installed\n"); + + res = RegOpenKey(HKEY_LOCAL_MACHINE, "SOFTWARE\Wine\msitest", &hkey); + ok(res == ERROR_FILE_NOT_FOUND, "Expected ERROR_FILE_NOT_FOUND, got %d\n", res); + + create_database(msifile, up6_tables, sizeof(up6_tables) / sizeof(msi_table)); + + /* published product, version number bumped */ + r = MsiInstallProductA(msifile, NULL); + ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r); + + ok(delete_pf("msitest\cabout\new\five.txt", TRUE), "File not installed\n"); + ok(delete_pf("msitest\cabout\new", FALSE), "File not installed\n"); + ok(delete_pf("msitest\cabout\four.txt", TRUE), "File not installed\n"); + ok(delete_pf("msitest\cabout", FALSE), "File not installed\n"); + ok(delete_pf("msitest\changed\three.txt", TRUE), "File not installed\n"); + ok(delete_pf("msitest\changed", FALSE), "File not installed\n"); + ok(delete_pf("msitest\first\two.txt", TRUE), "File not installed\n"); + ok(delete_pf("msitest\first", FALSE), "File not installed\n"); + ok(delete_pf("msitest\one.txt", TRUE), "File not installed\n"); + ok(delete_pf("msitest\filename", TRUE), "File not installed\n"); + ok(delete_pf("msitest\service.exe", TRUE), "File not installed\n"); + ok(delete_pf("msitest", FALSE), "File not installed\n"); + + res = RegOpenKey(HKEY_LOCAL_MACHINE, "SOFTWARE\Wine\msitest", &hkey); + ok(res == ERROR_FILE_NOT_FOUND, "Expected ERROR_FILE_NOT_FOUND, got %d\n", res); + + create_database(msifile, up7_tables, sizeof(up7_tables) / sizeof(msi_table)); + + /* published product, RemovePreviousVersions set and version number bumped */ + r = MsiInstallProductA(msifile, NULL); + ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r); + + ok(delete_pf("msitest\cabout\new\five.txt", TRUE), "File not installed\n"); + ok(delete_pf("msitest\cabout\new", FALSE), "File not installed\n"); + ok(delete_pf("msitest\cabout\four.txt", TRUE), "File not installed\n"); + ok(delete_pf("msitest\cabout", FALSE), "File not installed\n"); + ok(delete_pf("msitest\changed\three.txt", TRUE), "File not installed\n"); + ok(delete_pf("msitest\changed", FALSE), "File not installed\n"); + ok(delete_pf("msitest\first\two.txt", TRUE), "File not installed\n"); + ok(delete_pf("msitest\first", FALSE), "File not installed\n"); + ok(delete_pf("msitest\one.txt", TRUE), "File not installed\n"); + ok(delete_pf("msitest\filename", TRUE), "File not installed\n"); + ok(delete_pf("msitest\service.exe", TRUE), "File not installed\n"); + ok(delete_pf("msitest", FALSE), "File not installed\n"); + + res = RegOpenKey(HKEY_LOCAL_MACHINE, "SOFTWARE\Wine\msitest", &hkey); + ok(res == ERROR_FILE_NOT_FOUND, "Expected ERROR_FILE_NOT_FOUND, got %d\n", res); + + r = MsiInstallProductA(msifile, "REMOVE=ALL"); + ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
delete_test_files(); } @@ -4009,31 +4386,19 @@
/* build summary info */ r = MsiGetSummaryInformation(0, mstfile, 3, &suminfo); - todo_wine - { - ok(r == ERROR_SUCCESS , "Failed to open summaryinfo\n"); - } + ok(r == ERROR_SUCCESS , "Failed to open summaryinfo\n");
r = MsiSummaryInfoSetProperty(suminfo, PID_TITLE, VT_LPSTR, 0, NULL, "MSITEST"); - todo_wine - { - ok(r == ERROR_SUCCESS, "Failed to set summary info\n"); - } + ok(r == ERROR_SUCCESS, "Failed to set summary info\n");
r = MsiSummaryInfoSetProperty(suminfo, PID_REVNUMBER, VT_LPSTR, 0, NULL, "{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}1.1.1;" "{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}1.1.1;" "{4C0EAA15-0264-4E5A-8758-609EF142B92D}"); - todo_wine - { - ok(r == ERROR_SUCCESS , "Failed to set summary info\n"); - } + ok(r == ERROR_SUCCESS , "Failed to set summary info\n");
r = MsiSummaryInfoSetProperty(suminfo, PID_PAGECOUNT, VT_I4, 100, NULL, NULL); - todo_wine - { - ok(r == ERROR_SUCCESS, "Failed to set summary info\n"); - } + ok(r == ERROR_SUCCESS, "Failed to set summary info\n");
r = MsiSummaryInfoPersist(suminfo); todo_wine @@ -5685,10 +6050,70 @@ RemoveDirectory("msitest"); }
+static void test_int_widths( void ) +{ + static const char int0[] = "int0\ni0\nint0\tint0\n1"; + static const char int1[] = "int1\ni1\nint1\tint1\n1"; + static const char int2[] = "int2\ni2\nint2\tint2\n1"; + static const char int3[] = "int3\ni3\nint3\tint3\n1"; + static const char int4[] = "int4\ni4\nint4\tint4\n1"; + static const char int5[] = "int5\ni5\nint5\tint5\n1"; + static const char int8[] = "int8\ni8\nint8\tint8\n1"; + + static const struct + { + const char *data; + unsigned int size; + UINT ret; + } + tests[] = + { + { int0, sizeof(int0) - 1, ERROR_SUCCESS }, + { int1, sizeof(int1) - 1, ERROR_SUCCESS }, + { int2, sizeof(int2) - 1, ERROR_SUCCESS }, + { int3, sizeof(int3) - 1, ERROR_FUNCTION_FAILED }, + { int4, sizeof(int4) - 1, ERROR_SUCCESS }, + { int5, sizeof(int5) - 1, ERROR_FUNCTION_FAILED }, + { int8, sizeof(int8) - 1, ERROR_FUNCTION_FAILED } + }; + + char tmpdir[MAX_PATH], msitable[MAX_PATH], msidb[MAX_PATH]; + MSIHANDLE db; + UINT r, i; + + GetTempPathA(MAX_PATH, tmpdir); + CreateDirectoryA(tmpdir, NULL); + + strcpy(msitable, tmpdir); + strcat(msitable, "\msitable.idt"); + + strcpy(msidb, tmpdir); + strcat(msidb, "\msitest.msi"); + + r = MsiOpenDatabaseA(msidb, MSIDBOPEN_CREATE, &db); + ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r); + + for (i = 0; i < sizeof(tests)/sizeof(tests[0]); i++) + { + write_file(msitable, tests[i].data, tests[i].size); + + r = MsiDatabaseImportA(db, tmpdir, "msitable.idt"); + ok(r == tests[i].ret, " %u expected %u, got %u\n", i, tests[i].ret, r); + + r = MsiDatabaseCommit(db); + ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r); + DeleteFileA(msitable); + } + + MsiCloseHandle(db); + DeleteFileA(msidb); + RemoveDirectoryA(tmpdir); +} + START_TEST(install) { DWORD len; - char temp_path[MAX_PATH], prev_path[MAX_PATH]; + char temp_path[MAX_PATH], prev_path[MAX_PATH], log_file[MAX_PATH]; STATEMGRSTATUS status; BOOL ret = FALSE;
@@ -5718,9 +6143,13 @@ }
/* Create only one log file and don't append. We have to pass something - * for the log mode for this to work. + * for the log mode for this to work. The logfile needs to have an absolute + * path otherwise we still end up with some extra logfiles as some tests + * change the current directory. */ - MsiEnableLogA(INSTALLLOGMODE_FATALEXIT, "msitest.log", 0); + lstrcpyA(log_file, temp_path); + lstrcatA(log_file, "\msitest.log"); + MsiEnableLogA(INSTALLLOGMODE_FATALEXIT, log_file, 0);
test_MsiInstallProduct(); test_MsiSetComponentState(); @@ -5760,8 +6189,9 @@ test_sourcedirprop(); test_adminimage(); test_propcase(); - - DeleteFileA("msitest.log"); + test_int_widths(); + + DeleteFileA(log_file);
if (pSRSetRestorePointA && ret) {
Modified: trunk/rostests/winetests/msi/source.c URL: http://svn.reactos.org/svn/reactos/trunk/rostests/winetests/msi/source.c?rev... ============================================================================== --- trunk/rostests/winetests/msi/source.c [iso-8859-1] (original) +++ trunk/rostests/winetests/msi/source.c [iso-8859-1] Sat Aug 8 14:48:20 2009 @@ -283,7 +283,7 @@ size = MAX_PATH; r = pMsiSourceListGetInfoA(prodcode, usersid, MSIINSTALLCONTEXT_USERUNMANAGED, MSICODE_PRODUCT, INSTALLPROPERTY_PACKAGENAME, NULL, &size); - ok(r == ERROR_UNKNOWN_PRODUCT || ERROR_INVALID_PARAMETER, + ok(r == ERROR_UNKNOWN_PRODUCT || r == ERROR_INVALID_PARAMETER, "Expected ERROR_UNKNOWN_PRODUCT or ERROR_INVALID_PARAMETER, got %d\n", r);
lstrcpyA(keypath, "Software\Microsoft\Installer\Products\");