msi/tests: Get rid of workarounds for win9x test failures.

oldstable
Hans Leidekker 2011-03-30 12:30:17 +02:00 committed by Alexandre Julliard
parent e82a4896f3
commit c505c0fe98
5 changed files with 40 additions and 169 deletions

View File

@ -302,6 +302,7 @@ static void create_database(const CHAR *name, const msi_table *tables, int num_t
static BOOL create_package(LPWSTR path)
{
static const WCHAR slashW[] = {'\\',0};
DWORD len;
/* Prepare package */
@ -315,9 +316,8 @@ static BOOL create_package(LPWSTR path)
if (!len)
return FALSE;
/* lstrcatW does not work on win95 */
path[len - 1] = '\\';
memcpy(&path[len], szMsifile, sizeof(szMsifile));
lstrcatW(path, slashW);
lstrcatW(path, szMsifile);
return TRUE;
}
@ -949,9 +949,7 @@ static HRESULT Installer_RegistryValueW(HKEY hkey, LPCWSTR szKey, LPCWSTR szValu
V_BSTR(&vararg) = SysAllocString(szValue);
hr = Installer_RegistryValue(hkey, szKey, vararg, &varresult, VT_BSTR);
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));
if (V_BSTR(&varresult)) lstrcpyW(szString, V_BSTR(&varresult));
VariantClear(&varresult);
return hr;
}
@ -967,8 +965,7 @@ static HRESULT Installer_RegistryValueI(HKEY hkey, LPCWSTR szKey, int iValue, LP
V_I4(&vararg) = iValue;
hr = Installer_RegistryValue(hkey, szKey, vararg, &varresult, vtResult);
if (SUCCEEDED(hr) && vtResult == VT_BSTR)
memcpy(szString, V_BSTR(&varresult), (lstrlenW(V_BSTR(&varresult)) + 1) * sizeof(WCHAR));
if (SUCCEEDED(hr) && vtResult == VT_BSTR) lstrcpyW(szString, V_BSTR(&varresult));
VariantClear(&varresult);
return hr;
}
@ -1059,8 +1056,7 @@ static HRESULT Installer_ProductInfo(LPCWSTR szProduct, LPCWSTR szAttribute, LPW
V_BSTR(&vararg[0]) = SysAllocString(szAttribute);
hr = invoke(pInstaller, "ProductInfo", DISPATCH_PROPERTYGET, &dispparams, &varresult, VT_BSTR);
if (V_BSTR(&varresult))
memcpy(szString, V_BSTR(&varresult), (lstrlenW(V_BSTR(&varresult)) + 1) * sizeof(WCHAR));
if (V_BSTR(&varresult)) lstrcpyW(szString, V_BSTR(&varresult));
VariantClear(&varresult);
return hr;
}
@ -1099,8 +1095,7 @@ static HRESULT Installer_VersionGet(LPWSTR szVersion)
HRESULT hr;
hr = invoke(pInstaller, "Version", DISPATCH_PROPERTYGET, &dispparams, &varresult, VT_BSTR);
if (V_BSTR(&varresult))
memcpy(szVersion, V_BSTR(&varresult), (lstrlenW(V_BSTR(&varresult)) + 1) * sizeof(WCHAR));
if (V_BSTR(&varresult)) lstrcpyW(szVersion, V_BSTR(&varresult));
VariantClear(&varresult);
return hr;
}
@ -1142,8 +1137,7 @@ static HRESULT Session_PropertyGet(IDispatch *pSession, LPCWSTR szName, LPWSTR s
V_BSTR(&vararg[0]) = SysAllocString(szName);
hr = invoke(pSession, "Property", DISPATCH_PROPERTYGET, &dispparams, &varresult, VT_BSTR);
if (V_BSTR(&varresult))
memcpy(szReturn, V_BSTR(&varresult), (lstrlenW(V_BSTR(&varresult)) + 1) * sizeof(WCHAR));
if (V_BSTR(&varresult)) lstrcpyW(szReturn, V_BSTR(&varresult));
VariantClear(&varresult);
return hr;
}
@ -1442,8 +1436,7 @@ static HRESULT Record_StringDataGet(IDispatch *pRecord, int iField, LPWSTR szStr
V_I4(&vararg[0]) = iField;
hr = invoke(pRecord, "StringData", DISPATCH_PROPERTYGET, &dispparams, &varresult, VT_BSTR);
if (V_BSTR(&varresult))
memcpy(szString, V_BSTR(&varresult), (lstrlenW(V_BSTR(&varresult)) + 1) * sizeof(WCHAR));
if (V_BSTR(&varresult)) lstrcpyW(szString, V_BSTR(&varresult));
VariantClear(&varresult);
return hr;
}
@ -1520,8 +1513,7 @@ static HRESULT StringList_Item(IDispatch *pStringList, int iIndex, LPWSTR szStri
V_I4(&vararg[0]) = iIndex;
hr = invoke(pStringList, "Item", DISPATCH_PROPERTYGET, &dispparams, &varresult, VT_BSTR);
if (V_BSTR(&varresult))
memcpy(szString, V_BSTR(&varresult), (lstrlenW(V_BSTR(&varresult)) + 1) * sizeof(WCHAR));
if (V_BSTR(&varresult)) lstrcpyW(szString, V_BSTR(&varresult));
VariantClear(&varresult);
return hr;
}

View File

@ -2186,18 +2186,10 @@ static void test_msiimport(void)
ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
r = add_table_to_db(hdb, endlines1);
if (r == ERROR_FUNCTION_FAILED)
{
/* win9x doesn't handle this case */
skip("endlines not handled correctly.\n");
MsiCloseHandle(hdb);
DeleteFileA(msifile);
return;
}
ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
r = add_table_to_db(hdb, endlines2);
ok(r == ERROR_FUNCTION_FAILED,
"Expected ERROR_FUNCTION_FAILED, got %d\n", r);
ok(r == ERROR_FUNCTION_FAILED, "Expected ERROR_FUNCTION_FAILED, got %d\n", r);
query = "SELECT * FROM `TestTable`";
r = MsiDatabaseOpenView(hdb, query, &view);
@ -4984,7 +4976,6 @@ static void test_collation(void)
static const WCHAR letter_D[] = {'D',0};
static const WCHAR letter_a_ring[] = {'a',0x30a,0};
static const WCHAR letter_a_with_ring[] = {0xe5,0};
static const WCHAR letter_a_broken[] = {'a',0xb0,0};
const char *query;
MSIHANDLE hdb = 0, hview = 0, hrec = 0;
UINT r;
@ -5063,8 +5054,7 @@ static void test_collation(void)
sz = sizeof(bufferW) / sizeof(bufferW[0]);
r = MsiRecordGetStringW(hrec, 1, bufferW, &sz);
ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
ok(!memcmp(bufferW, letter_a_ring, sizeof(letter_a_ring)) ||
broken(!memcmp(bufferW, letter_a_broken, sizeof(letter_a_broken))) /* win9x */,
ok(!memcmp(bufferW, letter_a_ring, sizeof(letter_a_ring)),
"Expected %s, got %s\n", wine_dbgstr_w(letter_a_ring), wine_dbgstr_w(bufferW));
sz = sizeof(bufferW) / sizeof(bufferW[0]);
r = MsiRecordGetStringW(hrec, 2, bufferW, &sz);

View File

@ -55,7 +55,6 @@ static HMODULE hsrclient = 0;
static BOOL (WINAPI *pSRRemoveRestorePoint)(DWORD);
static BOOL (WINAPI *pSRSetRestorePointA)(RESTOREPOINTINFOA*, STATEMGRSTATUS*);
static BOOL on_win9x = FALSE;
static BOOL is_wow64;
static const BOOL is_64bit = sizeof(void *) > sizeof(int);
@ -2088,19 +2087,6 @@ static BOOL is_process_limited(void)
return FALSE;
}
static BOOL check_win9x(void)
{
SC_HANDLE scm;
scm = OpenSCManager(NULL, NULL, GENERIC_ALL);
if (!scm && (GetLastError() == ERROR_CALL_NOT_IMPLEMENTED))
return TRUE;
CloseServiceHandle(scm);
return FALSE;
}
static BOOL check_record(MSIHANDLE rec, UINT field, LPCSTR val)
{
CHAR buffer[0x20];
@ -2529,11 +2515,6 @@ static void test_MsiInstallProduct(void)
DWORD num, size, type;
REGSAM access = KEY_ALL_ACCESS;
if (on_win9x)
{
win_skip("Services are not implemented on Win9x and WinMe\n");
return;
}
if (is_process_limited())
{
skip("process is limited\n");
@ -3002,14 +2983,11 @@ static void test_continuouscabs(void)
MsiSetInternalUI(INSTALLUILEVEL_NONE, NULL);
r = MsiInstallProductA(msifile, NULL);
if (r == ERROR_SUCCESS) /* win9x has a problem with this */
{
ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
ok(delete_pf("msitest\\augustus", TRUE), "File not installed\n");
ok(delete_pf("msitest\\caesar", TRUE), "File not installed\n");
ok(delete_pf("msitest\\maximus", TRUE), "File not installed\n");
ok(delete_pf("msitest", FALSE), "File not installed\n");
}
ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
ok(delete_pf("msitest\\augustus", TRUE), "File not installed\n");
ok(delete_pf("msitest\\caesar", TRUE), "File not installed\n");
ok(delete_pf("msitest\\maximus", TRUE), "File not installed\n");
ok(delete_pf("msitest", FALSE), "File not installed\n");
delete_cab_files();
DeleteFile(msifile);
@ -3176,14 +3154,11 @@ static void test_samesequence(void)
MsiSetInternalUI(INSTALLUILEVEL_NONE, NULL);
r = MsiInstallProductA(msifile, NULL);
if (r == ERROR_SUCCESS) /* win9x has a problem with this */
{
ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
ok(delete_pf("msitest\\augustus", TRUE), "File not installed\n");
ok(delete_pf("msitest\\caesar", TRUE), "File not installed\n");
ok(delete_pf("msitest\\maximus", TRUE), "File not installed\n");
ok(delete_pf("msitest", FALSE), "File not installed\n");
}
ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
ok(delete_pf("msitest\\augustus", TRUE), "File not installed\n");
ok(delete_pf("msitest\\caesar", TRUE), "File not installed\n");
ok(delete_pf("msitest\\maximus", TRUE), "File not installed\n");
ok(delete_pf("msitest", FALSE), "File not installed\n");
delete_cab_files();
DeleteFile(msifile);
@ -3199,14 +3174,11 @@ static void test_uiLevelFlags(void)
MsiSetInternalUI(INSTALLUILEVEL_NONE | INSTALLUILEVEL_SOURCERESONLY, NULL);
r = MsiInstallProductA(msifile, NULL);
if (r == ERROR_SUCCESS) /* win9x has a problem with this */
{
ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
ok(!delete_pf("msitest\\maximus", TRUE), "UI install occurred, but execute-only was requested.\n");
ok(delete_pf("msitest\\caesar", TRUE), "File not installed\n");
ok(delete_pf("msitest\\augustus", TRUE), "File not installed\n");
ok(delete_pf("msitest", FALSE), "File not installed\n");
}
ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
ok(!delete_pf("msitest\\maximus", TRUE), "UI install occurred, but execute-only was requested.\n");
ok(delete_pf("msitest\\caesar", TRUE), "File not installed\n");
ok(delete_pf("msitest\\augustus", TRUE), "File not installed\n");
ok(delete_pf("msitest", FALSE), "File not installed\n");
delete_cab_files();
DeleteFile(msifile);
@ -4172,14 +4144,9 @@ static void test_missingcab(void)
skip("Not enough rights to perform tests\n");
goto error;
}
ok(r == ERROR_SUCCESS ||
broken(r == ERROR_INSTALL_FAILURE), /* win9x */
"Expected ERROR_SUCCESS, got %u\n", r);
if (r == ERROR_SUCCESS)
{
ok(delete_pf("msitest\\augustus", TRUE), "File not installed\n");
ok(delete_pf("msitest\\maximus", TRUE), "File not installed\n");
}
ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
ok(delete_pf("msitest\\augustus", TRUE), "File not installed\n");
ok(delete_pf("msitest\\maximus", TRUE), "File not installed\n");
ok(delete_pf("msitest\\caesar", TRUE), "File not installed\n");
ok(compare_pf_data("msitest\\tiberius", "abcdefgh", sizeof("abcdefgh")), "Wrong file contents\n");
ok(delete_pf("msitest\\tiberius", TRUE), "File not installed\n");
@ -4790,11 +4757,6 @@ static void test_MsiConfigureProductEx(void)
CHAR keypath[MAX_PATH * 2], localpack[MAX_PATH];
REGSAM access = KEY_ALL_ACCESS;
if (on_win9x)
{
win_skip("Different registry keys on Win9x and WinMe\n");
return;
}
if (is_process_limited())
{
skip("process is limited\n");
@ -5578,31 +5540,7 @@ static void test_allusers_prop(void)
/* ALLUSERS property set to 2, conditioned on ALLUSERS = 1 */
r = MsiInstallProductA(msifile, "FULL=1");
if (r == ERROR_SUCCESS)
{
/* Win9x/WinMe */
win_skip("Win9x and WinMe act differently with respect to ALLUSERS\n");
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\\filename", TRUE), "File not installed\n");
ok(delete_pf("msitest\\one.txt", TRUE), "File installed\n");
ok(delete_pf("msitest\\service.exe", TRUE), "File not installed\n");
ok(delete_pf("msitest", FALSE), "File not installed\n");
r = MsiInstallProductA(msifile, "REMOVE=ALL");
ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
delete_test_files();
}
else
ok(r == ERROR_INSTALL_FAILURE, "Expected ERROR_INSTALL_FAILURE, got %u\n", r);
ok(r == ERROR_INSTALL_FAILURE, "Expected ERROR_INSTALL_FAILURE, got %u\n", r);
error:
delete_test_files();
@ -5707,11 +5645,6 @@ static void test_file_in_use(void)
HKEY hkey;
char path[MAX_PATH];
if (on_win9x)
{
win_skip("Pending file renaming is implemented differently on Win9x and WinMe\n");
return;
}
if (is_process_limited())
{
skip("process is limited\n");
@ -5771,11 +5704,6 @@ static void test_file_in_use_cab(void)
HKEY hkey;
char path[MAX_PATH];
if (on_win9x)
{
win_skip("Pending file renaming is implemented differently on Win9x and WinMe\n");
return;
}
if (is_process_limited())
{
skip("process is limited\n");
@ -5996,7 +5924,7 @@ static void test_icon_table(void)
MSIHANDLE hdb = 0, record;
LPCSTR query;
UINT res;
CHAR path[MAX_PATH], win9xpath[MAX_PATH];
CHAR path[MAX_PATH];
static const char prodcode[] = "{7DF88A49-996F-4EC8-A022-BF956F9B2CBB}";
if (is_process_limited())
@ -6027,7 +5955,6 @@ static void test_icon_table(void)
res = MsiCloseHandle(record);
ok(res == ERROR_SUCCESS, "Failed to close record handle: %d\n", res);
/* Delete the icon file after the handle is closed to make sure it's deleted on Win9x */
DeleteFileA("icon.ico");
res = MsiDatabaseCommit(hdb);
ok(res == ERROR_SUCCESS, "Failed to commit database: %d\n", res);
@ -6058,20 +5985,12 @@ static void test_icon_table(void)
res = MsiInstallProductA(msifile, "PUBLISH_PRODUCT=1 ALLUSERS=1");
ok(res == ERROR_SUCCESS, "Failed to system-wide install: %d\n", res);
/* win9x with MSI 2.0 installs the icon to a different folder, same as above */
lstrcpyA(win9xpath, APP_DATA_DIR);
lstrcatA(win9xpath, "\\");
lstrcatA(win9xpath, "Microsoft\\Installer\\");
lstrcatA(win9xpath, prodcode);
lstrcatA(win9xpath, "\\testicon");
lstrcpyA(path, WINDOWS_DIR);
lstrcatA(path, "\\");
lstrcatA(path, "Installer\\");
lstrcatA(path, prodcode);
lstrcatA(path, "\\testicon");
ok(file_exists(path) || file_exists(win9xpath),
"System-wide icon file isn't where it's expected (%s)\n", path);
ok(file_exists(path), "System-wide icon file isn't where it's expected (%s)\n", path);
res = MsiInstallProductA(msifile, "REMOVE=ALL");
ok(res == ERROR_SUCCESS, "Failed to uninstall system-wide\n");
@ -6084,11 +6003,6 @@ static void test_sourcedir_props(void)
{
UINT r;
if (on_win9x)
{
win_skip("skipping sourcedir tests on win9x\n");
return;
}
if (is_process_limited())
{
skip("process is limited\n");
@ -6473,8 +6387,6 @@ START_TEST(install)
init_functionpointers();
on_win9x = check_win9x();
if (pIsWow64Process)
pIsWow64Process(GetCurrentProcess(), &is_wow64);

View File

@ -484,9 +484,7 @@ static void test_MsiGetFileHash(void)
ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
ret = memcmp(&hash, &hash_data[i].hash, HASHSIZE);
ok(ret == 0 ||
broken(ret != 0), /* win95 */
"Hash incorrect\n");
ok(!ret, "Hash incorrect\n");
DeleteFile(name);
}

View File

@ -8754,12 +8754,6 @@ static void test_appsearch_reglocator(void)
if (S(U(si)).wProcessorArchitecture == PROCESSOR_ARCHITECTURE_INTEL)
{
size = ExpandEnvironmentStringsA("%PATH%", NULL, 0);
if (size == 0 && GetLastError() == ERROR_INVALID_PARAMETER)
{
/* Workaround for Win95 */
CHAR tempbuf[1];
size = ExpandEnvironmentStringsA("%PATH%", tempbuf, 0);
}
pathvar = HeapAlloc(GetProcessHeap(), 0, size);
ExpandEnvironmentStringsA("%PATH%", pathvar, size);
@ -10044,14 +10038,10 @@ static void test_installprops(void)
RegQueryValueEx(hkey2, "RegisteredOwner", NULL, &type, (LPBYTE)path, &size);
}
/* win9x doesn't set this */
if (*path)
{
size = MAX_PATH;
r = MsiGetProperty(hpkg, "USERNAME", buf, &size);
ok( r == ERROR_SUCCESS, "failed to get property: %d\n", r);
ok( !lstrcmp(buf, path), "Expected %s, got %s\n", path, buf);
}
size = MAX_PATH;
r = MsiGetProperty(hpkg, "USERNAME", buf, &size);
ok( r == ERROR_SUCCESS, "failed to get property: %d\n", r);
ok( !lstrcmp(buf, path), "Expected %s, got %s\n", path, buf);
size = MAX_PATH;
type = REG_SZ;
@ -12304,9 +12294,7 @@ static void _test_file_access(LPCSTR file, const struct access_res *ares, DWORD
line, idx, ares[idx].gothandle,
(hfile != INVALID_HANDLE_VALUE));
ok(lasterr == ares[idx].lasterr ||
lasterr == 0xdeadbeef, /* win9x */
"(%d, lasterr, %d): Expected %d, got %d\n",
ok(lasterr == ares[idx].lasterr, "(%d, lasterr, %d): Expected %d, got %d\n",
line, idx, ares[idx].lasterr, lasterr);
CloseHandle(hfile);
@ -12529,17 +12517,8 @@ static void test_MsiGetProductProperty(void)
DWORD size;
LONG res;
UINT r;
SC_HANDLE scm;
REGSAM access = KEY_ALL_ACCESS;
scm = OpenSCManager(NULL, NULL, SC_MANAGER_CONNECT);
if (!scm && (GetLastError() == ERROR_CALL_NOT_IMPLEMENTED))
{
win_skip("Different registry keys on Win9x and WinMe\n");
return;
}
CloseServiceHandle(scm);
GetCurrentDirectoryA(MAX_PATH, path);
lstrcatA(path, "\\");