sync msi winetest to wine 1.1.11

svn path=/trunk/; revision=38406
This commit is contained in:
Christoph von Wittich 2008-12-28 10:25:32 +00:00
parent e970a33b95
commit 4e0fcb2fa5
8 changed files with 11040 additions and 1058 deletions

View file

@ -23,6 +23,7 @@
#include <stdio.h>
#include <initguid.h>
#include <windows.h>
#include <msiquery.h>
#include <msidefs.h>
@ -31,6 +32,8 @@
#include "wine/test.h"
DEFINE_GUID(GUID_NULL,0,0,0,0,0,0,0,0,0,0,0);
static const char *msifile = "winetest.msi";
static const WCHAR szMsifile[] = {'w','i','n','e','t','e','s','t','.','m','s','i',0};
static const WCHAR szMSITEST[] = { 'M','S','I','T','E','S','T',0 };
@ -60,8 +63,7 @@ static const CHAR component_dat[] = "Component\tComponentId\tDirectory_\tAttribu
"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"
"component\t\tMSITESTDIR\t0\t1\tfile\n"
"service_comp\t\tMSITESTDIR\t0\t1\tservice_file";
"component\t\tMSITESTDIR\t0\t1\tfile\n";
static const CHAR directory_dat[] = "Directory\tDirectory_Parent\tDefaultDir\n"
"s72\tS72\tl255\n"
@ -82,8 +84,7 @@ static const CHAR feature_dat[] = "Feature\tFeature_Parent\tTitle\tDescription\t
"One\t\tOne\tThe One Feature\t1\t3\tMSITESTDIR\t0\n"
"Three\tOne\tThree\tThe Three Feature\t3\t3\tCHANGEDDIR\t0\n"
"Two\tOne\tTwo\tThe Two Feature\t2\t3\tFIRSTDIR\t0\n"
"feature\t\t\t\t2\t1\tTARGETDIR\t0\n"
"service_feature\t\t\t\t2\t1\tTARGETDIR\t0";
"feature\t\t\t\t2\t1\tTARGETDIR\t0\n";
static const CHAR feature_comp_dat[] = "Feature_\tComponent_\n"
"s38\ts72\n"
@ -93,8 +94,7 @@ static const CHAR feature_comp_dat[] = "Feature_\tComponent_\n"
"One\tOne\n"
"Three\tThree\n"
"Two\tTwo\n"
"feature\tcomponent\n"
"service_feature\tservice_comp\n";
"feature\tcomponent\n";
static const CHAR file_dat[] = "File\tComponent_\tFileName\tFileSize\tVersion\tLanguage\tAttributes\tSequence\n"
"s72\ts72\tl255\ti4\tS72\tS20\tI2\ti2\n"
@ -104,8 +104,7 @@ static const CHAR file_dat[] = "File\tComponent_\tFileName\tFileSize\tVersion\tL
"one.txt\tOne\tone.txt\t1000\t\t\t0\t1\n"
"three.txt\tThree\tthree.txt\t1000\t\t\t0\t3\n"
"two.txt\tTwo\ttwo.txt\t1000\t\t\t0\t2\n"
"file\tcomponent\tfilename\t100\t\t\t8192\t1\n"
"service_file\tservice_comp\tservice.exe\t100\t\t\t8192\t1";
"file\tcomponent\tfilename\t100\t\t\t8192\t1\n";
static const CHAR install_exec_seq_dat[] = "Action\tCondition\tSequence\n"
"s72\tS255\tI2\n"
@ -115,7 +114,6 @@ static const CHAR install_exec_seq_dat[] = "Action\tCondition\tSequence\n"
"CostInitialize\t\t800\n"
"FileCost\t\t900\n"
"InstallFiles\t\t4000\n"
"InstallServices\t\t5000\n"
"RegisterProduct\t\t6100\n"
"PublishProduct\t\t6400\n"
"InstallFinalize\t\t6600\n"
@ -155,17 +153,6 @@ static const CHAR registry_dat[] = "Registry\tRoot\tKey\tName\tValue\tComponent_
"regdata\t2\tSOFTWARE\\Wine\\msitest\tblah\tbad\tdangler\n"
"OrderTest\t2\tSOFTWARE\\Wine\\msitest\tOrderTestName\tOrderTestValue\tcomponent";
static const CHAR service_install_dat[] = "ServiceInstall\tName\tDisplayName\tServiceType\tStartType\tErrorControl\t"
"LoadOrderGroup\tDependencies\tStartName\tPassword\tArguments\tComponent_\tDescription\n"
"s72\ts255\tL255\ti4\ti4\ti4\tS255\tS255\tS255\tS255\tS255\ts72\tL255\n"
"ServiceInstall\tServiceInstall\n"
"TestService\tTestService\tTestService\t2\t3\t0\t\t\tTestService\t\t\tservice_comp\t\t";
static const CHAR service_control_dat[] = "ServiceControl\tName\tEvent\tArguments\tWait\tComponent_\n"
"s72\tl255\ti2\tL255\tI2\ts72\n"
"ServiceControl\tServiceControl\n"
"ServiceControl\tTestService\t8\t\t0\tservice_comp";
typedef struct _msi_table
{
const CHAR *filename;
@ -185,9 +172,7 @@ static const msi_table tables[] =
ADD_TABLE(install_exec_seq),
ADD_TABLE(media),
ADD_TABLE(property),
ADD_TABLE(registry),
ADD_TABLE(service_install),
ADD_TABLE(service_control)
ADD_TABLE(registry)
};
typedef struct _msi_summary_info
@ -340,7 +325,6 @@ static void create_test_files(void)
CreateDirectoryA("msitest\\cabout\\new",NULL);
create_file("msitest\\cabout\\new\\five.txt", 100);
create_file("msitest\\filename", 100);
create_file("msitest\\service.exe", 100);
}
static BOOL delete_pf(const CHAR *rel_path, BOOL is_file)
@ -365,7 +349,6 @@ static void delete_test_files(void)
DeleteFileA("msitest\\second\\three.txt");
DeleteFileA("msitest\\first\\two.txt");
DeleteFileA("msitest\\one.txt");
DeleteFileA("msitest\\service.exe");
DeleteFileA("msitest\\filename");
RemoveDirectoryA("msitest\\cabout\\new");
RemoveDirectoryA("msitest\\cabout");
@ -374,24 +357,6 @@ static void delete_test_files(void)
RemoveDirectoryA("msitest");
}
static void check_service_is_installed(void)
{
SC_HANDLE scm, service;
BOOL res;
scm = OpenSCManager(NULL, NULL, SC_MANAGER_ALL_ACCESS);
ok(scm != NULL, "Failed to open the SC Manager\n");
service = OpenService(scm, "TestService", SC_MANAGER_ALL_ACCESS);
ok(service != NULL, "Failed to open TestService\n");
res = DeleteService(service);
ok(res, "Failed to delete TestService\n");
CloseServiceHandle(service);
CloseServiceHandle(scm);
}
/*
* Automation helpers and tests
*/
@ -408,6 +373,15 @@ static CHAR string1[MAX_PATH], string2[MAX_PATH];
ok(0, format, string1, string2); \
}
#define ok_w2n(format, szString1, szString2, len) \
\
if (memcmp(szString1, szString2, len * sizeof(WCHAR)) != 0) \
{ \
WideCharToMultiByte(CP_ACP, 0, szString1, -1, string1, MAX_PATH, NULL, NULL); \
WideCharToMultiByte(CP_ACP, 0, szString2, -1, string2, MAX_PATH, NULL, NULL); \
ok(0, format, string1, string2); \
}
#define ok_aw(format, aString, wString) \
\
WideCharToMultiByte(CP_ACP, 0, wString, -1, string1, MAX_PATH, NULL, NULL); \
@ -801,7 +775,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 (vtResult == VT_BSTR) lstrcpyW(szString, V_BSTR(&varresult));
if (SUCCEEDED(hr) && vtResult == VT_BSTR) lstrcpyW(szString, V_BSTR(&varresult));
VariantClear(&varresult);
return hr;
}
@ -1072,6 +1046,27 @@ static HRESULT Session_EvaluateCondition(IDispatch *pSession, LPCWSTR szConditio
return hr;
}
static HRESULT Session_Message(IDispatch *pSession, long kind, IDispatch *record, int *ret)
{
VARIANT varresult;
VARIANTARG vararg[2];
DISPPARAMS dispparams = {vararg, NULL, sizeof(vararg)/sizeof(VARIANTARG), 0};
HRESULT hr;
VariantInit(&varresult);
V_VT(vararg) = VT_DISPATCH;
V_DISPATCH(vararg) = record;
V_VT(vararg+1) = VT_I4;
V_I4(vararg+1) = kind;
hr = invoke(pSession, "Message", DISPATCH_METHOD, &dispparams, &varresult, VT_I4);
ok(V_VT(&varresult) == VT_I4, "V_VT(varresult) = %d\n", V_VT(&varresult));
*ret = V_I4(&varresult);
return hr;
}
static HRESULT Session_SetInstallLevel(IDispatch *pSession, long iInstallLevel)
{
VARIANT varresult;
@ -1646,7 +1641,7 @@ static void test_Session(IDispatch *pSession)
UINT len;
BOOL bool;
int myint;
IDispatch *pDatabase = NULL, *pInst = NULL;
IDispatch *pDatabase = NULL, *pInst = NULL, *record = NULL;
HRESULT hr;
/* Session::Installer */
@ -1743,6 +1738,13 @@ static void test_Session(IDispatch *pSession)
ok(hr == S_OK, "Session_FeatureCurrentState failed, hresult 0x%08x\n", hr);
ok(myint == INSTALLSTATE_UNKNOWN, "Feature current state was %d but expected %d\n", myint, INSTALLSTATE_UNKNOWN);
/* Session::Message */
hr = Installer_CreateRecord(0, &record);
ok(hr == S_OK, "Installer_CreateRecord failed: %08x\n", hr);
hr = Session_Message(pSession, INSTALLMESSAGE_INFO, record, &myint);
ok(hr == S_OK, "Session_Message failed: %08x\n", hr);
ok(myint == 0, "Session_Message returned %x\n", myint);
/* Session::EvaluateCondition */
hr = Session_EvaluateCondition(pSession, szOneStateFalse, &myint);
ok(hr == S_OK, "Session_EvaluateCondition failed, hresult 0x%08x\n", hr);
@ -1814,9 +1816,18 @@ static void test_Installer_RegistryValue(void)
HKEY curr_user = (HKEY)1;
HRESULT hr;
BOOL bRet;
LONG lRet;
/* Delete keys */
if (!RegOpenKeyW( HKEY_CURRENT_USER, szKey, &hkey )) delete_key( hkey );
SetLastError(0xdeadbeef);
lRet = RegOpenKeyW( HKEY_CURRENT_USER, szKey, &hkey );
if (!lRet && GetLastError() == ERROR_CALL_NOT_IMPLEMENTED)
{
win_skip("Needed W-functions are not implemented\n");
return;
}
if (!lRet)
delete_key( hkey );
/* Does our key exist? Shouldn't; check with all three possible value parameter types */
hr = Installer_RegistryValueE(curr_user, szKey, &bRet);
@ -1847,7 +1858,7 @@ static void test_Installer_RegistryValue(void)
"RegSetValueExW failed\n");
ok(!RegSetValueExW(hkey,szSix,0,REG_QWORD, (const BYTE *)qw, 8),
"RegSetValueExW failed\n");
ok(!RegSetValueExW(hkey,szSeven,0,REG_NONE, (const BYTE *)NULL, 0),
ok(!RegSetValueExW(hkey,szSeven,0,REG_NONE, NULL, 0),
"RegSetValueExW failed\n");
ok(!RegSetValueExW(hkey,NULL,0,REG_SZ, (const BYTE *)szOne, sizeof(szOne)),
@ -1895,10 +1906,12 @@ static void test_Installer_RegistryValue(void)
ok(hr == S_OK, "Installer_RegistryValueW failed, hresult 0x%08x\n", hr);
ok_w2("Registry value \"%s\" does not match expected \"%s\"\n", szString, szFour);
/* Vista does not NULL-terminate this case */
memset(szString, 0, sizeof(szString));
hr = Installer_RegistryValueW(curr_user, szKey, szFive, szString);
ok(hr == S_OK, "Installer_RegistryValueW failed, hresult 0x%08x\n", hr);
ok_w2("Registry value \"%s\" does not match expected \"%s\"\n", szString, szFiveHi);
ok_w2n("Registry value \"%s\" does not match expected \"%s\"\n",
szString, szFiveHi, lstrlenW(szFiveHi));
memset(szString, 0, sizeof(szString));
hr = Installer_RegistryValueW(curr_user, szKey, szSix, szString);
@ -2241,7 +2254,6 @@ static void test_Installer_InstallProduct(void)
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);
@ -2275,8 +2287,6 @@ static void test_Installer_InstallProduct(void)
res = RegDeleteKeyA(HKEY_LOCAL_MACHINE, "SOFTWARE\\Wine\\msitest");
ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
check_service_is_installed();
/* Remove registry keys written by RegisterProduct standard action */
res = RegDeleteKeyA(HKEY_LOCAL_MACHINE, "SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Uninstall\\{F1C3AF50-8B56-4A69-A00C-00773FE42F30}");
ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);

File diff suppressed because it is too large Load diff

View file

@ -108,97 +108,46 @@ static UINT create_custom_action_table( MSIHANDLE hdb )
"PRIMARY KEY `Action`)" );
}
static UINT add_feature_entry( MSIHANDLE hdb, const char *values )
{
char insert[] = "INSERT INTO `Feature` (`Feature`, `Feature_Parent`, "
"`Title`, `Description`, `Display`, `Level`, `Directory_`, `Attributes`) VALUES( %s )";
char *query;
UINT sz, r;
#define make_add_entry(type, qtext) \
static UINT add##_##type##_##entry( MSIHANDLE hdb, const char *values ) \
{ \
char insert[] = qtext; \
char *query; \
UINT sz, r; \
sz = strlen(values) + sizeof insert; \
query = HeapAlloc(GetProcessHeap(),0,sz); \
sprintf(query,insert,values); \
r = run_query( hdb, query ); \
HeapFree(GetProcessHeap(), 0, query); \
return r; \
}
sz = strlen(values) + sizeof insert;
query = HeapAlloc(GetProcessHeap(),0,sz);
sprintf(query,insert,values);
r = run_query( hdb, query );
HeapFree(GetProcessHeap(), 0, query);
return r;
}
make_add_entry(feature,
"INSERT INTO `Feature` "
"(`Feature`, `Feature_Parent`, `Title`, `Description`, "
"`Display`, `Level`, `Directory_`, `Attributes`) VALUES( %s )")
static UINT add_component_entry( MSIHANDLE hdb, const char *values )
{
char insert[] = "INSERT INTO `Component` "
"(`Component`, `ComponentId`, `Directory_`, `Attributes`, `Condition`, `KeyPath`) "
"VALUES( %s )";
char *query;
UINT sz, r;
make_add_entry(component,
"INSERT INTO `Component` "
"(`Component`, `ComponentId`, `Directory_`, "
"`Attributes`, `Condition`, `KeyPath`) VALUES( %s )")
sz = strlen(values) + sizeof insert;
query = HeapAlloc(GetProcessHeap(),0,sz);
sprintf(query,insert,values);
r = run_query( hdb, query );
HeapFree(GetProcessHeap(), 0, query);
return r;
}
make_add_entry(feature_components,
"INSERT INTO `FeatureComponents` "
"(`Feature_`, `Component_`) VALUES( %s )")
static UINT add_feature_components_entry( MSIHANDLE hdb, const char *values )
{
char insert[] = "INSERT INTO `FeatureComponents` "
"(`Feature_`, `Component_`) "
"VALUES( %s )";
char *query;
UINT sz, r;
make_add_entry(file,
"INSERT INTO `File` "
"(`File`, `Component_`, `FileName`, `FileSize`, "
"`Version`, `Language`, `Attributes`, `Sequence`) VALUES( %s )")
sz = strlen(values) + sizeof insert;
query = HeapAlloc(GetProcessHeap(),0,sz);
sprintf(query,insert,values);
r = run_query( hdb, query );
HeapFree(GetProcessHeap(), 0, query);
return r;
}
make_add_entry(directory,
"INSERT INTO `Directory` "
"(`Directory`,`Directory_Parent`,`DefaultDir`) VALUES( %s )")
static UINT add_file_entry( MSIHANDLE hdb, const char *values )
{
char insert[] = "INSERT INTO `File` "
"(`File`, `Component_`, `FileName`, `FileSize`, `Version`, `Language`, `Attributes`, `Sequence`) "
"VALUES( %s )";
char *query;
UINT sz, r;
sz = strlen(values) + sizeof insert;
query = HeapAlloc(GetProcessHeap(),0,sz);
sprintf(query,insert,values);
r = run_query( hdb, query );
HeapFree(GetProcessHeap(), 0, query);
return r;
}
static UINT add_directory_entry( MSIHANDLE hdb, const char *values )
{
char insert[] = "INSERT INTO `Directory` (`Directory`,`Directory_Parent`,`DefaultDir`) VALUES( %s )";
char *query;
UINT sz, r;
sz = strlen(values) + sizeof insert;
query = HeapAlloc(GetProcessHeap(),0,sz);
sprintf(query,insert,values);
r = run_query( hdb, query );
HeapFree(GetProcessHeap(), 0, query);
return r;
}
static UINT add_custom_action_entry( MSIHANDLE hdb, const char *values )
{
char insert[] = "INSERT INTO `CustomAction` (`Action`, `Type`, `Source`, "
"`Target`) VALUES( %s )";
char *query;
UINT sz, r;
sz = strlen(values) + sizeof insert;
query = HeapAlloc(GetProcessHeap(),0,sz);
sprintf(query,insert,values);
r = run_query( hdb, query );
HeapFree(GetProcessHeap(), 0, query);
return r;
}
make_add_entry(custom_action,
"INSERT INTO `CustomAction` "
"(`Action`, `Type`, `Source`, `Target`) VALUES( %s )")
static UINT set_summary_info(MSIHANDLE hdb)
{

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

View file

@ -361,6 +361,11 @@ static void test_MsiRecordGetString(void)
rec = MsiCreateRecord(2);
ok(rec != 0, "Expected a valid handle\n");
sz = MAX_PATH;
r = MsiRecordGetString(rec, 1, NULL, &sz);
ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n",r);
ok(sz == 0, "Expected 0, got %d\n",sz);
sz = MAX_PATH;
lstrcpyA(buf, "apple");
r = MsiRecordGetString(rec, 1, buf, &sz);
@ -376,10 +381,71 @@ static void test_MsiRecordGetString(void)
ok(sz == 0, "Expected 0, got %d\n", sz);
MsiCloseHandle(rec);
rec = MsiCreateRecord(1);
ok(rec != 0, "Expected a valid handle\n");
r = MsiRecordSetInteger(rec, 1, 5);
ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
sz = MAX_PATH;
r = MsiRecordGetString(rec, 1, NULL, &sz);
ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n",r);
ok(sz == 1, "Expected 1, got %d\n",sz);
sz = MAX_PATH;
lstrcpyA(buf, "apple");
r = MsiRecordGetString(rec, 1, buf, &sz);
ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
ok(!lstrcmpA(buf, "5"), "Expected \"5\", got \"%s\"\n", buf);
ok(sz == 1, "Expectd 1, got %d\n", sz);
r = MsiRecordSetInteger(rec, 1, -5);
ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
sz = MAX_PATH;
lstrcpyA(buf, "apple");
r = MsiRecordGetString(rec, 1, buf, &sz);
ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
ok(!lstrcmpA(buf, "-5"), "Expected \"-5\", got \"%s\"\n", buf);
ok(sz == 2, "Expectd 2, got %d\n", sz);
MsiCloseHandle(rec);
}
static void test_MsiRecordGetInteger(void)
{
MSIHANDLE rec;
INT val;
UINT r;
rec = MsiCreateRecord(1);
ok(rec != 0, "Expected a valid handle\n");
r = MsiRecordSetString(rec, 1, "5");
ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
val = MsiRecordGetInteger(rec, 1);
ok(val == 5, "Expected 5, got %d\n", val);
r = MsiRecordSetString(rec, 1, "-5");
ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
val = MsiRecordGetInteger(rec, 1);
ok(val == -5, "Expected -5, got %d\n", val);
r = MsiRecordSetString(rec, 1, "5apple");
ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
val = MsiRecordGetInteger(rec, 1);
ok(val == MSI_NULL_INTEGER, "Expected MSI_NULL_INTEGER, got %d\n", val);
MsiCloseHandle(rec);
}
START_TEST(record)
{
test_msirecord();
test_MsiRecordGetString();
test_MsiRecordGetInteger();
}

View file

@ -130,6 +130,8 @@ static int get_user_sid(LPSTR *usersid)
PTOKEN_USER user;
BOOL rc;
if (!pConvertSidToStringSidA)
return 0;
rc=OpenProcessToken(GetCurrentProcess(), TOKEN_QUERY, &token);
if (!rc && GetLastError() == ERROR_CALL_NOT_IMPLEMENTED)
return 0;
@ -2864,13 +2866,10 @@ static void test_MsiSourceListEnumMediaDisks(void)
prompt, &promptsz);
ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
ok(id == 1, "Expected 1, got %d\n", id);
todo_wine
{
ok(!lstrcmpA(label, "#42"), "Expected \"#42\", got \"%s\"\n", label);
ok(labelsz == 3, "Expected 3, got %d\n", labelsz);
ok(!lstrcmpA(prompt, "#42"), "Expected \"#42\", got \"%s\"\n", prompt);
ok(promptsz == 3, "Expected 3, got %d\n", promptsz);
}
ok(!lstrcmpA(label, "#42"), "Expected \"#42\", got \"%s\"\n", label);
ok(labelsz == 3, "Expected 3, got %d\n", labelsz);
ok(!lstrcmpA(prompt, "#42"), "Expected \"#42\", got \"%s\"\n", prompt);
ok(promptsz == 3, "Expected 3, got %d\n", promptsz);
RegDeleteValueA(media, "1");
RegDeleteValueA(media, "2");