[MSI_WINETEST]

Sync msi_winetest.exe with Wine head

svn path=/trunk/; revision=55047
This commit is contained in:
Pierre Schweitzer 2012-01-21 17:21:57 +00:00
parent 0e8f6c0bf8
commit 14c14451f5
14 changed files with 11851 additions and 5602 deletions

View file

@ -4,6 +4,7 @@ add_definitions(
-D_DLL -D__USE_CRTIMP)
list(APPEND SOURCE
action.c
automation.c
db.c
format.c

File diff suppressed because it is too large Load diff

View file

@ -32,16 +32,22 @@
#include "wine/test.h"
static BOOL is_wow64;
static LONG (WINAPI *pRegDeleteKeyExA)(HKEY, LPCSTR, REGSAM, DWORD);
static BOOL (WINAPI *pIsWow64Process)(HANDLE, PBOOL);
DEFINE_GUID(GUID_NULL,0,0,0,0,0,0,0,0,0,0,0);
static const char *msifile = "winetest-automation.msi";
static const WCHAR szMsifile[] = {'w','i','n','e','t','e','s','t','-','a','u','t','o','m','a','t','i','o','n','.','m','s','i',0};
static const WCHAR szMSITEST[] = { 'M','S','I','T','E','S','T',0 };
static const WCHAR szProductCode[] = { '{','F','1','C','3','A','F','5','0','-','8','B','5','6','-','4','A','6','9','-','A','0','0','C','-','0','0','7','7','3','F','E','4','2','F','3','0','}',0 };
static const WCHAR szProductCode[] = { '{','8','3','7','4','5','0','f','a','-','a','3','9','b','-','4','b','c','8','-','b','3','2','1','-','0','8','b','3','9','3','f','7','8','4','b','3','}',0 };
static const WCHAR szUpgradeCode[] = { '{','C','E','0','6','7','E','8','D','-','2','E','1','A','-','4','3','6','7','-','B','7','3','4','-','4','E','B','2','B','D','A','D','6','5','6','5','}',0 };
static const WCHAR szProductInfoException[] = { 'P','r','o','d','u','c','t','I','n','f','o',',','P','r','o','d','u','c','t',',','A','t','t','r','i','b','u','t','e',0 };
static const WCHAR WINE_INSTALLPROPERTY_PACKAGENAMEW[] = {'P','a','c','k','a','g','e','N','a','m','e',0};
static const WCHAR WINE_INSTALLPROPERTY_PRODUCTNAMEW[] = {'P','r','o','d','u','c','t','N','a','m','e',0};
static const WCHAR WINE_INSTALLPROPERTY_LOCALPACKAGEW[] = {'L','o','c','a','l','P','a','c','k','a','g','e',0};
static FILETIME systemtime;
static CHAR CURR_DIR[MAX_PATH];
static EXCEPINFO excepinfo;
@ -74,7 +80,7 @@ static const CHAR directory_dat[] = "Directory\tDirectory_Parent\tDefaultDir\n"
"MSITESTDIR\tProgramFilesFolder\tmsitest\n"
"NEWDIR\tCABOUTDIR\tnew\n"
"ProgramFilesFolder\tTARGETDIR\t.\n"
"TARGETDIR\t\tSourceDir";
"TARGETDIR\t\tSourceDir\n";
static const CHAR feature_dat[] = "Feature\tFeature_Parent\tTitle\tDescription\tDisplay\tLevel\tDirectory_\tAttributes\n"
"s38\tS38\tL64\tL255\tI2\ti2\tS72\ti2\n"
@ -120,7 +126,7 @@ static const CHAR install_exec_seq_dat[] = "Action\tCondition\tSequence\n"
"InstallInitialize\t\t1500\n"
"InstallValidate\t\t1400\n"
"LaunchConditions\t\t100\n"
"WriteRegistryValues\tSourceDir And SOURCEDIR\t5000";
"WriteRegistryValues\tSourceDir And SOURCEDIR\t5000\n";
static const CHAR media_dat[] = "DiskId\tLastSequence\tDiskPrompt\tCabinet\tVolumeLabel\tSource\n"
"i2\ti4\tL64\tS255\tS32\tS72\n"
@ -136,22 +142,23 @@ static const CHAR property_dat[] = "Property\tValue\n"
"InstallMode\tTypical\n"
"Manufacturer\tWine\n"
"PIDTemplate\t12345<###-%%%%%%%>@@@@@\n"
"ProductCode\t{F1C3AF50-8B56-4A69-A00C-00773FE42F30}\n"
"ProductCode\t{837450fa-a39b-4bc8-b321-08b393f784b3}\n"
"ProductID\tnone\n"
"ProductLanguage\t1033\n"
"ProductName\tMSITEST\n"
"ProductVersion\t1.1.1\n"
"PROMPTROLLBACKCOST\tP\n"
"Setup\tSetup\n"
"UpgradeCode\t{CE067E8D-2E1A-4367-B734-4EB2BDAD6565}";
"UpgradeCode\t{CE067E8D-2E1A-4367-B734-4EB2BDAD6565}\n"
"MSIFASTINSTALL\t1\n";
static const CHAR registry_dat[] = "Registry\tRoot\tKey\tName\tValue\tComponent_\n"
"s72\ti2\tl255\tL255\tL0\ts72\n"
"Registry\tRegistry\n"
"Apples\t2\tSOFTWARE\\Wine\\msitest\tName\timaname\tOne\n"
"Oranges\t2\tSOFTWARE\\Wine\\msitest\tnumber\t#314\tTwo\n"
"regdata\t2\tSOFTWARE\\Wine\\msitest\tblah\tbad\tdangler\n"
"OrderTest\t2\tSOFTWARE\\Wine\\msitest\tOrderTestName\tOrderTestValue\tcomponent";
"Apples\t1\tSOFTWARE\\Wine\\msitest\tName\timaname\tOne\n"
"Oranges\t1\tSOFTWARE\\Wine\\msitest\tnumber\t#314\tTwo\n"
"regdata\t1\tSOFTWARE\\Wine\\msitest\tblah\tbad\tdangler\n"
"OrderTest\t1\tSOFTWARE\\Wine\\msitest\tOrderTestName\tOrderTestValue\tcomponent\n";
typedef struct _msi_table
{
@ -199,6 +206,29 @@ static const msi_summary_info summary_info[] =
ADD_INFO_FILETIME(PID_LASTPRINTED, &systemtime)
};
static void init_functionpointers(void)
{
HMODULE hadvapi32 = GetModuleHandleA("advapi32.dll");
HMODULE hkernel32 = GetModuleHandleA("kernel32.dll");
#define GET_PROC(dll, func) \
p ## func = (void *)GetProcAddress(dll, #func); \
if(!p ## func) \
trace("GetProcAddress(%s) failed\n", #func);
GET_PROC(hadvapi32, RegDeleteKeyExA)
GET_PROC(hkernel32, IsWow64Process)
#undef GET_PROC
}
static LONG delete_key_portable( HKEY key, LPCSTR subkey, REGSAM access )
{
if (pRegDeleteKeyExA)
return pRegDeleteKeyExA( key, subkey, access, 0 );
return RegDeleteKeyA( key, subkey );
}
/*
* Database Helpers
*/
@ -273,6 +303,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 */
@ -286,9 +317,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;
}
@ -386,17 +416,6 @@ static void delete_test_files(void)
/* 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) \
\
do { \
@ -460,7 +479,7 @@ static DISPID get_dispid( IDispatch *disp, const char *name )
str = HeapAlloc(GetProcessHeap(), 0, len*sizeof(WCHAR) );
if (str)
{
len = MultiByteToWideChar(CP_ACP, 0, name, -1, str, len );
MultiByteToWideChar(CP_ACP, 0, name, -1, str, len );
r = IDispatch_GetIDsOfNames( disp, &IID_NULL, &str, 1, 0, &id );
HeapFree(GetProcessHeap(), 0, str);
if (r != S_OK)
@ -470,113 +489,79 @@ static DISPID get_dispid( IDispatch *disp, const char *name )
return id;
}
typedef struct {
DISPID did;
const char *name;
BOOL todo;
} get_did_t;
static const get_did_t get_did_data[] = {
{ 1, "CreateRecord" },
{ 2, "OpenPackage" },
{ 3, "OpenProduct" },
{ 4, "OpenDatabase" },
{ 5, "SummaryInformation" },
{ 6, "UILevel" },
{ 7, "EnableLog" },
{ 8, "InstallProduct" },
{ 9, "Version" },
{ 10, "LastErrorRecord" },
{ 11, "RegistryValue" },
{ 12, "Environment" },
{ 13, "FileAttributes" },
{ 15, "FileSize" },
{ 16, "FileVersion" },
{ 17, "ProductState" },
{ 18, "ProductInfo" },
{ 19, "ConfigureProduct", TRUE },
{ 20, "ReinstallProduct", TRUE },
{ 21, "CollectUserInfo", TRUE },
{ 22, "ApplyPatch", TRUE },
{ 23, "FeatureParent", TRUE },
{ 24, "FeatureState", TRUE },
{ 25, "UseFeature", TRUE },
{ 26, "FeatureUsageCount", TRUE },
{ 27, "FeatureUsageDate", TRUE },
{ 28, "ConfigureFeature", TRUE },
{ 29, "ReinstallFeature", TRUE },
{ 30, "ProvideComponent", TRUE },
{ 31, "ComponentPath", TRUE },
{ 32, "ProvideQualifiedComponent", TRUE },
{ 33, "QualifierDescription", TRUE },
{ 34, "ComponentQualifiers", TRUE },
{ 35, "Products" },
{ 36, "Features", TRUE },
{ 37, "Components", TRUE },
{ 38, "ComponentClients", TRUE },
{ 39, "Patches", TRUE },
{ 40, "RelatedProducts" },
{ 41, "PatchInfo", TRUE },
{ 42, "PatchTransforms", TRUE },
{ 43, "AddSource", TRUE },
{ 44, "ClearSourceList", TRUE },
{ 45, "ForceSourceListResolution", TRUE },
{ 46, "ShortcutTarget", TRUE },
{ 47, "FileHash", TRUE },
{ 48, "FileSignatureInfo", TRUE },
{ 0 }
};
static void test_dispid(void)
{
const get_did_t *ptr = get_did_data;
DISPID dispid;
dispid = get_dispid(pInstaller, "CreateRecord");
ok(dispid == 1, "Expected 1, got %d\n", dispid);
dispid = get_dispid(pInstaller, "OpenPackage");
ok(dispid == 2, "Expected 2, got %d\n", dispid);
dispid = get_dispid(pInstaller, "OpenProduct");
ok(dispid == 3, "Expected 3, got %d\n", dispid);
dispid = get_dispid(pInstaller, "OpenDatabase");
ok(dispid == 4, "Expected 4, got %d\n", dispid);
dispid = get_dispid(pInstaller, "SummaryInformation");
ok(dispid == 5, "Expected 5, got %d\n", dispid);
dispid = get_dispid( pInstaller, "UILevel" );
ok(dispid == 6, "Expected 6, got %d\n", dispid);
dispid = get_dispid(pInstaller, "EnableLog");
ok(dispid == 7, "Expected 7, got %d\n", dispid);
dispid = get_dispid(pInstaller, "InstallProduct");
ok(dispid == 8, "Expected 8, got %d\n", dispid);
dispid = get_dispid(pInstaller, "Version");
ok(dispid == 9, "Expected 9, got %d\n", dispid);
dispid = get_dispid(pInstaller, "LastErrorRecord");
ok(dispid == 10, "Expected 10, got %d\n", dispid);
dispid = get_dispid(pInstaller, "RegistryValue");
ok(dispid == 11, "Expected 11, got %d\n", dispid);
dispid = get_dispid(pInstaller, "Environment");
ok(dispid == 12, "Expected 12, got %d\n", dispid);
dispid = get_dispid(pInstaller, "FileAttributes");
ok(dispid == 13, "Expected 13, got %d\n", dispid);
dispid = get_dispid(pInstaller, "FileSize");
ok(dispid == 15, "Expected 15, got %d\n", dispid);
dispid = get_dispid(pInstaller, "FileVersion");
ok(dispid == 16, "Expected 16, got %d\n", dispid);
dispid = get_dispid(pInstaller, "ProductState");
ok(dispid == 17, "Expected 17, got %d\n", dispid);
dispid = get_dispid(pInstaller, "ProductInfo");
ok(dispid == 18, "Expected 18, got %d\n", dispid);
todo_wine
while (ptr->name)
{
dispid = get_dispid(pInstaller, "ConfigureProduct");
ok(dispid == 19, "Expected 19, got %d\n", dispid);
dispid = get_dispid(pInstaller, "ReinstallProduct");
ok(dispid == 20 , "Expected 20, got %d\n", dispid);
dispid = get_dispid(pInstaller, "CollectUserInfo");
ok(dispid == 21, "Expected 21, got %d\n", dispid);
dispid = get_dispid(pInstaller, "ApplyPatch");
ok(dispid == 22, "Expected 22, got %d\n", dispid);
dispid = get_dispid(pInstaller, "FeatureParent");
ok(dispid == 23, "Expected 23, got %d\n", dispid);
dispid = get_dispid(pInstaller, "FeatureState");
ok(dispid == 24, "Expected 24, got %d\n", dispid);
dispid = get_dispid(pInstaller, "UseFeature");
ok(dispid == 25, "Expected 25, got %d\n", dispid);
dispid = get_dispid(pInstaller, "FeatureUsageCount");
ok(dispid == 26, "Expected 26, got %d\n", dispid);
dispid = get_dispid(pInstaller, "FeatureUsageDate");
ok(dispid == 27, "Expected 27, got %d\n", dispid);
dispid = get_dispid(pInstaller, "ConfigureFeature");
ok(dispid == 28, "Expected 28, got %d\n", dispid);
dispid = get_dispid(pInstaller, "ReinstallFeature");
ok(dispid == 29, "Expected 29, got %d\n", dispid);
dispid = get_dispid(pInstaller, "ProvideComponent");
ok(dispid == 30, "Expected 30, got %d\n", dispid);
dispid = get_dispid(pInstaller, "ComponentPath");
ok(dispid == 31, "Expected 31, got %d\n", dispid);
dispid = get_dispid(pInstaller, "ProvideQualifiedComponent");
ok(dispid == 32, "Expected 32, got %d\n", dispid);
dispid = get_dispid(pInstaller, "QualifierDescription");
ok(dispid == 33, "Expected 33, got %d\n", dispid);
dispid = get_dispid(pInstaller, "ComponentQualifiers");
ok(dispid == 34, "Expected 34, got %d\n", dispid);
}
dispid = get_dispid(pInstaller, "Products");
ok(dispid == 35, "Expected 35, got %d\n", dispid);
todo_wine
{
dispid = get_dispid(pInstaller, "Features");
ok(dispid == 36, "Expected 36, got %d\n", dispid);
dispid = get_dispid(pInstaller, "Components");
ok(dispid == 37, "Expected 37, got %d\n", dispid);
dispid = get_dispid(pInstaller, "ComponentClients");
ok(dispid == 38, "Expected 38, got %d\n", dispid);
dispid = get_dispid(pInstaller, "Patches");
ok(dispid == 39, "Expected 39, got %d\n", dispid);
}
dispid = get_dispid(pInstaller, "RelatedProducts");
ok(dispid == 40, "Expected 40, got %d\n", dispid);
todo_wine
{
dispid = get_dispid(pInstaller, "PatchInfo");
ok(dispid == 41, "Expected 41, got %d\n", dispid);
dispid = get_dispid(pInstaller, "PatchTransforms");
ok(dispid == 42, "Expected 42, got %d\n", dispid);
dispid = get_dispid(pInstaller, "AddSource");
ok(dispid == 43, "Expected 43, got %d\n", dispid);
dispid = get_dispid(pInstaller, "ClearSourceList");
ok(dispid == 44, "Expected 44, got %d\n", dispid);
dispid = get_dispid(pInstaller, "ForceSourceListResolution");
ok(dispid == 45, "Expected 45, got %d\n", dispid);
dispid = get_dispid(pInstaller, "ShortcutTarget");
ok(dispid == 46, "Expected 46, got %d\n", dispid);
dispid = get_dispid(pInstaller, "FileHash");
ok(dispid == 47, "Expected 47, got %d\n", dispid);
dispid = get_dispid(pInstaller, "FileSignatureInfo");
ok(dispid == 48, "Expected 48, got %d\n", dispid);
dispid = get_dispid(pInstaller, ptr->name);
if (ptr->todo)
todo_wine
ok(dispid == ptr->did, "%s: expected %d, got %d\n", ptr->name, ptr->did, dispid);
else
ok(dispid == ptr->did, "%s: expected %d, got %d\n", ptr->name, ptr->did, dispid);
ptr++;
}
dispid = get_dispid(pInstaller, "RemovePatches");
ok(dispid == 49 || dispid == -1, "Expected 49 or -1, got %d\n", dispid);
dispid = get_dispid(pInstaller, "ApplyMultiplePatches");
@ -632,10 +617,10 @@ static void test_dispatch(void)
/* Test invoking this function (without parameters passed) */
if (0) /* All of these crash MSI on Windows XP */
{
hr = IDispatch_Invoke(pInstaller, dispid, &IID_NULL, LOCALE_NEUTRAL, DISPATCH_METHOD, NULL, NULL, NULL, NULL);
hr = IDispatch_Invoke(pInstaller, dispid, &IID_NULL, LOCALE_NEUTRAL, DISPATCH_METHOD, NULL, NULL, &excepinfo, NULL);
IDispatch_Invoke(pInstaller, dispid, &IID_NULL, LOCALE_NEUTRAL, DISPATCH_METHOD, NULL, NULL, NULL, NULL);
IDispatch_Invoke(pInstaller, dispid, &IID_NULL, LOCALE_NEUTRAL, DISPATCH_METHOD, NULL, NULL, &excepinfo, NULL);
VariantInit(&varresult);
hr = IDispatch_Invoke(pInstaller, dispid, &IID_NULL, LOCALE_NEUTRAL, DISPATCH_METHOD, NULL, &varresult, &excepinfo, NULL);
IDispatch_Invoke(pInstaller, dispid, &IID_NULL, LOCALE_NEUTRAL, DISPATCH_METHOD, NULL, &varresult, &excepinfo, NULL);
}
/* Try with NULL params */
@ -733,6 +718,12 @@ static void test_dispatch(void)
V_VT(&vararg[0]) = VT_BSTR;
V_BSTR(&vararg[0]) = SysAllocString(path);
hr = IDispatch_Invoke(pInstaller, dispid, &IID_NULL, LOCALE_NEUTRAL, DISPATCH_METHOD, &dispparams, &varresult, &excepinfo, NULL);
if (hr == DISP_E_EXCEPTION)
{
skip("OpenPackage failed, insufficient rights?\n");
DeleteFileW(path);
return;
}
ok(hr == S_OK, "IDispatch::Invoke returned 0x%08x\n", hr);
VariantClear(&vararg[0]);
VariantClear(&varresult);
@ -836,7 +827,7 @@ static HRESULT invoke(IDispatch *pDispatch, LPCSTR szName, WORD wFlags, DISPPARA
len = MultiByteToWideChar(CP_ACP, 0, szName, -1, NULL, 0 );
name = HeapAlloc(GetProcessHeap(), 0, len*sizeof(WCHAR) );
if (!name) return E_FAIL;
len = MultiByteToWideChar(CP_ACP, 0, szName, -1, name, len );
MultiByteToWideChar(CP_ACP, 0, szName, -1, name, len );
hr = IDispatch_GetIDsOfNames(pDispatch, &IID_NULL, &name, 1, LOCALE_USER_DEFAULT, &dispid);
HeapFree(GetProcessHeap(), 0, name);
ok(hr == S_OK, "IDispatch::GetIDsOfNames returned 0x%08x\n", hr);
@ -925,9 +916,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;
}
@ -943,8 +932,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;
}
@ -1035,8 +1023,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;
}
@ -1075,12 +1062,25 @@ 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;
}
static HRESULT Installer_UILevelPut(int level)
{
VARIANT varresult;
VARIANTARG vararg;
DISPID dispid = DISPID_PROPERTYPUT;
DISPPARAMS dispparams = {&vararg, &dispid, sizeof(vararg)/sizeof(VARIANTARG), 1};
VariantInit(&vararg);
V_VT(&vararg) = VT_I4;
V_I4(&vararg) = level;
return invoke(pInstaller, "UILevel", DISPATCH_PROPERTYPUT, &dispparams, &varresult, VT_EMPTY);
}
static HRESULT Session_Installer(IDispatch *pSession, IDispatch **pInst)
{
VARIANT varresult;
@ -1104,8 +1104,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;
}
@ -1404,8 +1403,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;
}
@ -1482,8 +1480,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;
}
@ -1837,7 +1834,7 @@ static void test_Session(IDispatch *pSession)
memset(stringw, 0, sizeof(stringw));
hr = Session_PropertyGet(pSession, szProductName, stringw);
ok(hr == S_OK, "Session_PropertyGet failed, hresult 0x%08x\n", hr);
if (strcmp_ww(stringw, szMSITEST) != 0)
if (lstrcmpW(stringw, szMSITEST) != 0)
{
len = WideCharToMultiByte(CP_ACP, 0, stringw, -1, string, MAX_PATH, NULL, NULL);
ok(len, "WideCharToMultiByteChar returned error %d\n", GetLastError());
@ -1850,7 +1847,7 @@ static void test_Session(IDispatch *pSession)
memset(stringw, 0, sizeof(stringw));
hr = Session_PropertyGet(pSession, szProductName, stringw);
ok(hr == S_OK, "Session_PropertyGet failed, hresult 0x%08x\n", hr);
if (strcmp_ww(stringw, szProductName) != 0)
if (lstrcmpW(stringw, szProductName) != 0)
{
len = WideCharToMultiByte(CP_ACP, 0, stringw, -1, string, MAX_PATH, NULL, NULL);
ok(len, "WideCharToMultiByteChar returned error %d\n", GetLastError());
@ -2054,7 +2051,8 @@ static void test_Installer_RegistryValue(void)
"RegSetValueExW failed\n");
ok(!RegSetValueExW(hkey,szThree,0,REG_BINARY, (const BYTE *)qw, 4),
"RegSetValueExW failed\n");
ok(SetEnvironmentVariableA("MSITEST", "Four"), "SetEnvironmentVariableA failed %d\n", GetLastError());
bRet = SetEnvironmentVariableA("MSITEST", "Four");
ok(bRet, "SetEnvironmentVariableA failed %d\n", GetLastError());
ok(!RegSetValueExW(hkey,szFour,0,REG_EXPAND_SZ, (const BYTE *)szExpand, sizeof(szExpand)),
"RegSetValueExW failed\n");
ok(!RegSetValueExW(hkey,szFive,0,REG_MULTI_SZ, (const BYTE *)szFive, sizeof(szFive)),
@ -2209,7 +2207,7 @@ static void test_Installer_Products(BOOL bProductInstalled)
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 && !strcmp_ww(szString, szProductCode))
if (!bProductFound && !lstrcmpW(szString, szProductCode))
bProductFound = TRUE;
/* IEnumVARIANT::Next */
@ -2239,7 +2237,7 @@ static void test_Installer_Products(BOOL bProductInstalled)
if (0) /* Crashes on Windows XP */
{
/* IEnumVARIANT::Clone, NULL pointer */
hr = IEnumVARIANT_Clone(pEnum, NULL);
IEnumVARIANT_Clone(pEnum, NULL);
}
/* IEnumVARIANT::Clone */
@ -2314,30 +2312,30 @@ static void test_Installer_Products(BOOL bProductInstalled)
/* Delete a registry subkey, including all its subkeys (RegDeleteKey does not work on keys with subkeys without
* deleting the subkeys first) */
static UINT delete_registry_key(HKEY hkeyParent, LPCSTR subkey)
static UINT delete_registry_key(HKEY hkeyParent, LPCSTR subkey, REGSAM access)
{
UINT ret;
CHAR *string = NULL;
HKEY hkey;
DWORD dwSize;
ret = RegOpenKey(hkeyParent, subkey, &hkey);
ret = RegOpenKeyEx(hkeyParent, subkey, 0, access, &hkey);
if (ret != ERROR_SUCCESS) return ret;
ret = RegQueryInfoKeyA(hkey, NULL, NULL, NULL, NULL, &dwSize, NULL, NULL, NULL, NULL, NULL, NULL);
if (ret != ERROR_SUCCESS) return ret;
if (!(string = HeapAlloc(GetProcessHeap(), 0, ++dwSize))) return ERROR_NOT_ENOUGH_MEMORY;
while (RegEnumKeyA(hkey, 0, string, dwSize) == ERROR_SUCCESS)
delete_registry_key(hkey, string);
delete_registry_key(hkey, string, access);
RegCloseKey(hkey);
HeapFree(GetProcessHeap(), 0, string);
RegDeleteKeyA(hkeyParent, subkey);
delete_key_portable(hkeyParent, subkey, access);
return ERROR_SUCCESS;
}
/* Find a specific registry subkey at any depth within the given key and subkey and return its parent key. */
static UINT find_registry_key(HKEY hkeyParent, LPCSTR subkey, LPCSTR findkey, HKEY *phkey)
static UINT find_registry_key(HKEY hkeyParent, LPCSTR subkey, LPCSTR findkey, REGSAM access, HKEY *phkey)
{
UINT ret;
CHAR *string = NULL;
@ -2348,7 +2346,7 @@ static UINT find_registry_key(HKEY hkeyParent, LPCSTR subkey, LPCSTR findkey, HK
*phkey = 0;
ret = RegOpenKey(hkeyParent, subkey, &hkey);
ret = RegOpenKeyEx(hkeyParent, subkey, 0, access, &hkey);
if (ret != ERROR_SUCCESS) return ret;
ret = RegQueryInfoKeyA(hkey, NULL, NULL, NULL, NULL, &dwSize, NULL, NULL, NULL, NULL, NULL, NULL);
if (ret != ERROR_SUCCESS) return ret;
@ -2362,7 +2360,7 @@ static UINT find_registry_key(HKEY hkeyParent, LPCSTR subkey, LPCSTR findkey, HK
*phkey = hkey;
found = TRUE;
}
else if (find_registry_key(hkey, string, findkey, phkey) == ERROR_SUCCESS) found = TRUE;
else if (find_registry_key(hkey, string, findkey, access, phkey) == ERROR_SUCCESS) found = TRUE;
}
if (*phkey != hkey) RegCloseKey(hkey);
@ -2380,14 +2378,22 @@ static void test_Installer_InstallProduct(void)
DWORD num, size, type;
int iValue, iCount;
IDispatch *pStringList = NULL;
REGSAM access = KEY_ALL_ACCESS;
if (is_wow64)
access |= KEY_WOW64_64KEY;
create_test_files();
/* Avoid an interactive dialog in case of insufficient privileges. */
hr = Installer_UILevelPut(INSTALLUILEVEL_NONE);
ok(hr == S_OK, "Expected UILevel property put invoke to return S_OK, got 0x%08x\n", hr);
/* Installer::InstallProduct */
hr = Installer_InstallProduct(szMsifile, NULL);
if (hr == DISP_E_EXCEPTION)
{
skip("Installer object not supported.\n");
skip("InstallProduct failed, insufficient rights?\n");
delete_test_files();
return;
}
@ -2446,20 +2452,24 @@ static void test_Installer_InstallProduct(void)
IDispatch_Release(pStringList);
}
hr = Installer_ProductInfo(szProductCode, WINE_INSTALLPROPERTY_LOCALPACKAGEW, szString);
ok(hr == S_OK, "Installer_ProductInfo failed, hresult 0x%08x\n", hr);
DeleteFileW( szString );
/* Check & clean up installed files & registry keys */
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\\new", FALSE), "Directory not created\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\\cabout", FALSE), "Directory not created\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\\changed", FALSE), "Directory not created\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\\first", FALSE), "Directory not created\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", FALSE), "File not installed\n");
ok(delete_pf("msitest", FALSE), "Directory not created\n");
res = RegOpenKey(HKEY_LOCAL_MACHINE, "SOFTWARE\\Wine\\msitest", &hkey);
res = RegOpenKeyA(HKEY_CURRENT_USER, "SOFTWARE\\Wine\\msitest", &hkey);
ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
size = MAX_PATH;
@ -2487,40 +2497,36 @@ static void test_Installer_InstallProduct(void)
RegCloseKey(hkey);
res = RegDeleteKeyA(HKEY_LOCAL_MACHINE, "SOFTWARE\\Wine\\msitest");
res = RegDeleteKeyA(HKEY_CURRENT_USER, "SOFTWARE\\Wine\\msitest");
ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
/* Remove registry keys written by RegisterProduct standard action */
res = RegDeleteKeyA(HKEY_LOCAL_MACHINE, "SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Uninstall\\{F1C3AF50-8B56-4A69-A00C-00773FE42F30}");
res = delete_key_portable(HKEY_LOCAL_MACHINE,
"SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Uninstall\\{837450fa-a39b-4bc8-b321-08b393f784b3}",
KEY_WOW64_32KEY);
ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
res = RegDeleteKeyA(HKEY_LOCAL_MACHINE, "SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Installer\\UpgradeCodes\\D8E760ECA1E276347B43E42BDBDA5656");
res = delete_key_portable(HKEY_LOCAL_MACHINE,
"SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Installer\\UpgradeCodes\\D8E760ECA1E276347B43E42BDBDA5656", access);
ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
res = find_registry_key(HKEY_LOCAL_MACHINE, "SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Installer\\UserData", "05FA3C1F65B896A40AC00077F34EF203", &hkey);
ok(res == ERROR_SUCCESS ||
broken(res == ERROR_FILE_NOT_FOUND), /* win9x */
"Expected ERROR_SUCCESS, got %d\n", res);
if (res == ERROR_SUCCESS)
{
res = delete_registry_key(hkey, "05FA3C1F65B896A40AC00077F34EF203");
ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
RegCloseKey(hkey);
res = find_registry_key(HKEY_LOCAL_MACHINE,
"SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Installer\\UserData", "af054738b93a8cb43b12803b397f483b", access, &hkey);
ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
res = RegDeleteKeyA(HKEY_LOCAL_MACHINE, "SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Installer\\Products\\05FA3C1F65B896A40AC00077F34EF203");
ok(res == ERROR_FILE_NOT_FOUND, "Expected ERROR_FILE_NOT_FOUND, got %d\n", res);
}
else
{
/* win9x defaults to a per-machine install. */
RegDeleteKeyA(HKEY_LOCAL_MACHINE, "SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Installer\\Products\\05FA3C1F65B896A40AC00077F34EF203");
}
res = delete_registry_key(hkey, "af054738b93a8cb43b12803b397f483b", access);
ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
RegCloseKey(hkey);
res = delete_key_portable(HKEY_LOCAL_MACHINE,
"SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Installer\\Products\\af054738b93a8cb43b12803b397f483b", access);
ok(res == ERROR_FILE_NOT_FOUND, "Expected ERROR_FILE_NOT_FOUND, got %d\n", res);
/* Remove registry keys written by PublishProduct standard action */
res = RegOpenKey(HKEY_CURRENT_USER, "SOFTWARE\\Microsoft\\Installer", &hkey);
ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
res = delete_registry_key(hkey, "Products\\05FA3C1F65B896A40AC00077F34EF203");
res = delete_registry_key(hkey, "Products\\af054738b93a8cb43b12803b397f483b", KEY_ALL_ACCESS);
ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
res = RegDeleteKeyA(hkey, "UpgradeCodes\\D8E760ECA1E276347B43E42BDBDA5656");
@ -2528,7 +2534,7 @@ static void test_Installer_InstallProduct(void)
RegCloseKey(hkey);
/* Delete installation files we installed */
/* Delete installation files we created */
delete_test_files();
}
@ -2592,6 +2598,12 @@ static void test_Installer(void)
/* Installer::OpenPackage */
hr = Installer_OpenPackage(szPath, 0, &pSession);
if (hr == DISP_E_EXCEPTION)
{
skip("OpenPackage failed, insufficient rights?\n");
DeleteFileW(szPath);
return;
}
ok(hr == S_OK, "Installer_OpenPackage failed, hresult 0x%08x\n", hr);
if (hr == S_OK)
{
@ -2663,6 +2675,11 @@ START_TEST(automation)
CLSID clsid;
IUnknown *pUnk;
init_functionpointers();
if (pIsWow64Process)
pIsWow64Process(GetCurrentProcess(), &is_wow64);
GetSystemTimeAsFileTime(&systemtime);
GetCurrentDirectoryA(MAX_PATH, prev_path);

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

File diff suppressed because it is too large Load diff

View file

@ -4,6 +4,7 @@
<module name="msi_winetest" type="win32cui" installbase="bin" installname="msi_winetest.exe" allowwarnings="true">
<include base="msi_winetest">.</include>
<define name="__ROS_LONG64__" />
<file>action.c</file>
<file>automation.c</file>
<file>db.c</file>
<file>format.c</file>

File diff suppressed because it is too large Load diff

View file

@ -35,6 +35,8 @@ static UINT (WINAPI *pMsiGetPatchInfoExA)( LPCSTR, LPCSTR, LPCSTR, MSIINSTALLCON
LPCSTR, LPSTR, DWORD * );
static UINT (WINAPI *pMsiEnumPatchesExA)( LPCSTR, LPCSTR, DWORD, DWORD, DWORD, LPSTR,
LPSTR, MSIINSTALLCONTEXT *, LPSTR, LPDWORD );
static BOOL (WINAPI *pGetTokenInformation)( HANDLE, TOKEN_INFORMATION_CLASS, LPVOID, DWORD, PDWORD );
static BOOL (WINAPI *pOpenProcessToken)( HANDLE, DWORD, PHANDLE );
static const char *msifile = "winetest-patch.msi";
static const char *mspfile = "winetest-patch.msp";
@ -55,7 +57,8 @@ static const char property_dat[] =
"ProductLanguage\t1033\n"
"ProductName\tmsitest\n"
"ProductVersion\t1.1.1\n"
"PATCHNEWSUMMARYSUBJECT\tInstaller Database\n";
"PATCHNEWSUMMARYSUBJECT\tInstaller Database\n"
"MSIFASTINSTALL\t1\n";
static const char media_dat[] =
"DiskId\tLastSequence\tDiskPrompt\tCabinet\tVolumeLabel\tSource\n"
@ -138,6 +141,7 @@ static const struct msi_table tables[] =
static void init_function_pointers( void )
{
HMODULE hmsi = GetModuleHandleA( "msi.dll" );
HMODULE hadvapi32 = GetModuleHandleA( "advapi32.dll" );
#define GET_PROC( mod, func ) \
p ## func = (void *)GetProcAddress( mod, #func ); \
@ -147,9 +151,31 @@ static void init_function_pointers( void )
GET_PROC( hmsi, MsiApplyPatchA );
GET_PROC( hmsi, MsiGetPatchInfoExA );
GET_PROC( hmsi, MsiEnumPatchesExA );
GET_PROC( hadvapi32, GetTokenInformation );
GET_PROC( hadvapi32, OpenProcessToken );
#undef GET_PROC
}
static BOOL is_process_limited(void)
{
HANDLE token;
if (!pOpenProcessToken || !pGetTokenInformation) return FALSE;
if (pOpenProcessToken(GetCurrentProcess(), TOKEN_QUERY, &token))
{
BOOL ret;
TOKEN_ELEVATION_TYPE type = TokenElevationTypeDefault;
DWORD size;
ret = pGetTokenInformation(token, TokenElevationType, &type, sizeof(type), &size);
CloseHandle(token);
return (ret && type == TokenElevationTypeLimited);
}
return FALSE;
}
static BOOL get_program_files_dir( char *buf, char *buf2 )
{
HKEY hkey;
@ -260,7 +286,7 @@ static void set_suminfo( const char *filename )
r = MsiSummaryInfoSetProperty( hsi, 7, VT_LPSTR, 0, NULL, ";1033" );
ok( r == ERROR_SUCCESS, "failed to set summary info %u\n", r );
r = MsiSummaryInfoSetProperty( hsi, 9, VT_LPSTR, 0, NULL, "{913B8D18-FBB6-4CAC-A239-C74C11E3FA74}" );
r = MsiSummaryInfoSetProperty( hsi, 9, VT_LPSTR, 0, NULL, "{E528DDD6-4801-4BEC-BBB6-C5EE0FD097E9}" );
ok( r == ERROR_SUCCESS, "failed to set summary info %u\n", r );
r = MsiSummaryInfoSetProperty( hsi, 14, VT_I4, 100, NULL, NULL );
@ -681,7 +707,7 @@ static void test_simple_patch( void )
{
UINT r;
DWORD size;
char path[MAX_PATH], install_source[MAX_PATH];
char path[MAX_PATH], install_source[MAX_PATH], buffer[32];
const char *query;
MSIHANDLE hpackage, hdb, hview, hrec;
@ -690,6 +716,11 @@ static void test_simple_patch( void )
win_skip("MsiApplyPatchA is not available\n");
return;
}
if (is_process_limited())
{
skip("process is limited\n");
return;
}
CreateDirectoryA( "msitest", NULL );
create_file( "msitest\\patch.txt", 1000 );
@ -700,7 +731,11 @@ static void test_simple_patch( void )
MsiSetInternalUI( INSTALLUILEVEL_NONE, NULL );
r = MsiInstallProductA( msifile, NULL );
ok( r == ERROR_SUCCESS, "expected ERROR_SUCCESS, got %u\n", r );
if (r != ERROR_SUCCESS)
{
skip("Product installation failed with error code %u\n", r);
goto cleanup;
}
size = get_pf_file_size( "msitest\\patch.txt" );
ok( size == 1000, "expected 1000, got %u\n", size );
@ -749,6 +784,12 @@ static void test_simple_patch( void )
MsiViewClose( hview );
MsiCloseHandle( hview );
buffer[0] = 0;
size = sizeof(buffer);
r = MsiGetProperty( hpackage, "PATCHNEWSUMMARYSUBJECT", buffer, &size );
ok( r == ERROR_SUCCESS, "expected ERROR_SUCCESS, got %u\n", r );
ok( !strcmp( buffer, "Installer Database" ), "expected \'Installer Database\', got \'%s\'\n", buffer );
MsiCloseHandle( hdb );
MsiCloseHandle( hpackage );
@ -759,7 +800,7 @@ static void test_simple_patch( void )
if (r == ERROR_PATCH_PACKAGE_INVALID)
{
win_skip("Windows Installer < 3.0 detected\n");
return;
goto uninstall;
}
size = get_pf_file_size( "msitest\\patch.txt" );
@ -801,6 +842,12 @@ static void test_simple_patch( void )
MsiViewClose( hview );
MsiCloseHandle( hview );
buffer[0] = 0;
size = sizeof(buffer);
r = MsiGetProperty( hpackage, "PATCHNEWSUMMARYSUBJECT", buffer, &size );
ok( r == ERROR_SUCCESS, "expected ERROR_SUCCESS, got %u\n", r );
ok( !strcmp( buffer, "Installation Database" ), "expected \'Installation Database\', got \'%s\'\n", buffer );
MsiCloseHandle( hdb );
MsiCloseHandle( hpackage );
@ -827,6 +874,7 @@ static void test_simple_patch( void )
MsiCloseHandle( hview );
MsiCloseHandle( hdb );
uninstall:
size = sizeof(path);
r = MsiGetProductInfoA( "{913B8D18-FBB6-4CAC-A239-C74C11E3FA74}",
"InstallSource", path, &size );
@ -839,8 +887,10 @@ static void test_simple_patch( void )
ok( !delete_pf( "msitest\\patch.txt", TRUE ), "file not removed\n" );
ok( !delete_pf( "msitest", FALSE ), "directory not removed\n" );
cleanup:
DeleteFileA( msifile );
DeleteFileA( mspfile );
DeleteFileA( "msitest\\patch.txt" );
RemoveDirectoryA( "msitest" );
}
@ -907,17 +957,85 @@ static UINT find_entry( MSIHANDLE hdb, const char *table, const char *entry )
return r;
}
static INT get_integer( MSIHANDLE hdb, UINT field, const char *query)
{
UINT r;
INT ret = -1;
MSIHANDLE hview, hrec;
r = MsiDatabaseOpenView( hdb, query, &hview );
ok( r == ERROR_SUCCESS, "expected ERROR_SUCCESS, got %u\n", r );
r = MsiViewExecute( hview, 0 );
ok( r == ERROR_SUCCESS, "expected ERROR_SUCCESS, got %u\n", r );
r = MsiViewFetch( hview, &hrec );
ok( r == ERROR_SUCCESS, "expected ERROR_SUCCESS, got %u\n", r );
if (r == ERROR_SUCCESS)
{
UINT r_tmp;
ret = MsiRecordGetInteger( hrec, field );
MsiCloseHandle( hrec );
r_tmp = MsiViewFetch( hview, &hrec );
ok( r_tmp == ERROR_NO_MORE_ITEMS, "expected ERROR_NO_MORE_ITEMS, got %u\n", r);
}
MsiViewClose( hview );
MsiCloseHandle( hview );
return ret;
}
static char *get_string( MSIHANDLE hdb, UINT field, const char *query)
{
UINT r;
static char ret[MAX_PATH];
MSIHANDLE hview, hrec;
ret[0] = '\0';
r = MsiDatabaseOpenView( hdb, query, &hview );
ok( r == ERROR_SUCCESS, "expected ERROR_SUCCESS, got %u\n", r );
r = MsiViewExecute( hview, 0 );
ok( r == ERROR_SUCCESS, "expected ERROR_SUCCESS, got %u\n", r );
r = MsiViewFetch( hview, &hrec );
ok( r == ERROR_SUCCESS, "expected ERROR_SUCCESS, got %u\n", r );
if (r == ERROR_SUCCESS)
{
UINT size = MAX_PATH;
r = MsiRecordGetStringA( hrec, field, ret, &size );
ok( r == ERROR_SUCCESS, "expected ERROR_SUCCESS, got %u\n", r);
MsiCloseHandle( hrec );
r = MsiViewFetch( hview, &hrec );
ok( r == ERROR_NO_MORE_ITEMS, "expected ERROR_NO_MORE_ITEMS, got %u\n", r);
}
MsiViewClose( hview );
MsiCloseHandle( hview );
return ret;
}
static void test_system_tables( void )
{
UINT r;
char *cr;
const char *query;
MSIHANDLE hproduct, hdb, hview, hrec;
static const char patchsource[] = "MSPSRC0F96CDC04CDF4304B2837B9264889EF7";
if (!pMsiApplyPatchA)
{
win_skip("MsiApplyPatchA is not available\n");
return;
}
if (is_process_limited())
{
skip("process is limited\n");
return;
}
CreateDirectoryA( "msitest", NULL );
create_file( "msitest\\patch.txt", 1000 );
@ -928,7 +1046,11 @@ static void test_system_tables( void )
MsiSetInternalUI( INSTALLUILEVEL_NONE, NULL );
r = MsiInstallProductA( msifile, NULL );
ok( r == ERROR_SUCCESS, "expected ERROR_SUCCESS, got %u\n", r );
if (r != ERROR_SUCCESS)
{
skip("Product installation failed with error code %d\n", r);
goto cleanup;
}
r = MsiOpenProductA( "{913B8D18-FBB6-4CAC-A239-C74C11E3FA74}", &hproduct );
ok( r == ERROR_SUCCESS, "expected ERROR_SUCCESS, got %u\n", r );
@ -973,6 +1095,9 @@ static void test_system_tables( void )
r = find_entry( hdb, "_Tables", "Media" );
ok( r == ERROR_SUCCESS, "failed to find entry %u\n", r );
r = get_integer( hdb, 1, "SELECT * FROM `Media` WHERE `VolumeLabel`=\'DISK1\'");
ok( r == 1, "Got %u\n", r );
r = find_entry( hdb, "_Tables", "_Property" );
ok( r == ERROR_SUCCESS, "failed to find entry %u\n", r );
@ -989,7 +1114,7 @@ static void test_system_tables( void )
if (r == ERROR_PATCH_PACKAGE_INVALID)
{
win_skip("Windows Installer < 3.0 detected\n");
return;
goto uninstall;
}
r = MsiOpenProductA( "{913B8D18-FBB6-4CAC-A239-C74C11E3FA74}", &hproduct );
@ -1047,17 +1172,38 @@ static void test_system_tables( void )
r = find_entry( hdb, "_Tables", "PatchPackage" );
ok( r == ERROR_SUCCESS, "failed to find entry %u\n", r );
cr = get_string( hdb, 6, "SELECT * FROM `Media` WHERE `Source` IS NOT NULL");
todo_wine ok( !strcmp(cr, patchsource), "Expected \"%s\", got \"%s\"\n", patchsource, cr );
r = get_integer( hdb, 1, "SELECT * FROM `Media` WHERE `Source` IS NOT NULL");
todo_wine ok( r == 100, "Got %u\n", r );
r = get_integer( hdb, 2, "SELECT * FROM `Media` WHERE `Source` IS NOT NULL");
todo_wine ok( r == 10000, "Got %u\n", r );
r = get_integer( hdb, 1, "SELECT * FROM `Media` WHERE `VolumeLabel`=\'DISK1\'");
ok( r == 1, "Got %u\n", r );
cr = get_string( hdb, 4, "SELECT * FROM `Media` WHERE `Source` IS NOT NULL");
ok( !strcmp(cr, "#CAB_msitest"), "Expected \"#CAB_msitest\", got \"%s\"\n", cr );
r = get_integer( hdb, 8, "SELECT * FROM `File` WHERE `File` = 'patch.txt'");
ok( r == 10000, "Got %u\n", r );
MsiCloseHandle( hrec );
MsiViewClose( hview );
MsiCloseHandle( hview );
MsiCloseHandle( hdb );
MsiCloseHandle( hproduct );
uninstall:
r = MsiInstallProductA( msifile, "REMOVE=ALL" );
ok( r == ERROR_SUCCESS, "expected ERROR_SUCCESS, got %u\n", r );
cleanup:
DeleteFileA( msifile );
DeleteFileA( mspfile );
DeleteFileA( "msitest\\patch.txt" );
RemoveDirectoryA( "msitest" );
}
@ -1071,6 +1217,11 @@ static void test_patch_registration( void )
win_skip("required functions not available\n");
return;
}
if (is_process_limited())
{
skip("process is limited\n");
return;
}
CreateDirectoryA( "msitest", NULL );
create_file( "msitest\\patch.txt", 1000 );
@ -1081,7 +1232,11 @@ static void test_patch_registration( void )
MsiSetInternalUI( INSTALLUILEVEL_NONE, NULL );
r = MsiInstallProductA( msifile, NULL );
ok( r == ERROR_SUCCESS, "expected ERROR_SUCCESS, got %u\n", r );
if (r != ERROR_SUCCESS)
{
skip("Product installation failed with error code %d\n", r);
goto cleanup;
}
r = MsiApplyPatchA( mspfile, NULL, INSTALLTYPE_DEFAULT, NULL );
ok( r == ERROR_SUCCESS || broken( r == ERROR_PATCH_PACKAGE_INVALID ), /* version 2.0 */
@ -1090,7 +1245,7 @@ static void test_patch_registration( void )
if (r == ERROR_PATCH_PACKAGE_INVALID)
{
win_skip("Windows Installer < 3.0 detected\n");
return;
goto uninstall;
}
buffer[0] = 0;
@ -1135,6 +1290,7 @@ static void test_patch_registration( void )
0, patch_code, NULL, NULL, NULL, NULL );
ok( r == ERROR_NO_MORE_ITEMS, "expected ERROR_NO_MORE_ITEMS, got %u\n", r );
uninstall:
r = MsiInstallProductA( msifile, "REMOVE=ALL" );
ok( r == ERROR_SUCCESS, "expected ERROR_SUCCESS, got %u\n", r );
@ -1146,8 +1302,10 @@ static void test_patch_registration( void )
INSTALLPROPERTY_LOCALPACKAGE, buffer, &size );
ok( r == ERROR_UNKNOWN_PRODUCT, "expected ERROR_UNKNOWN_PRODUCT, got %u\n", r );
cleanup:
DeleteFileA( msifile );
DeleteFileA( mspfile );
DeleteFileA( "msitest\\patch.txt" );
RemoveDirectoryA( "msitest" );
}

View file

@ -589,6 +589,9 @@ static void test_fieldzero(void)
MsiCloseHandle(rec);
r = MsiDatabaseGetPrimaryKeysA(hdb, "nosuchtable", &rec);
ok(r == ERROR_INVALID_TABLE, "Expected ERROR_INVALID_TABLE, got %d\n", r);
query = "SELECT * FROM `drone` WHERE `id` = 1";
r = MsiDatabaseOpenView(hdb, query, &hview);
ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);

View file

@ -31,8 +31,13 @@
#include "wine/test.h"
static BOOL is_wow64;
static BOOL (WINAPI *pConvertSidToStringSidA)(PSID, LPSTR*);
static LONG (WINAPI *pRegDeleteKeyExA)(HKEY, LPCSTR, REGSAM, DWORD);
static BOOLEAN (WINAPI *pGetUserNameExA)(EXTENDED_NAME_FORMAT, LPSTR, PULONG);
static BOOL (WINAPI *pIsWow64Process)(HANDLE, PBOOL);
static UINT (WINAPI *pMsiSourceListAddMediaDiskA)
(LPCSTR, LPCSTR, MSIINSTALLCONTEXT, DWORD, DWORD, LPCSTR, LPCSTR);
static UINT (WINAPI *pMsiSourceListAddSourceExA)
@ -53,6 +58,7 @@ static void init_functionpointers(void)
{
HMODULE hmsi = GetModuleHandleA("msi.dll");
HMODULE hadvapi32 = GetModuleHandleA("advapi32.dll");
HMODULE hkernel32 = GetModuleHandleA("kernel32.dll");
HMODULE hsecur32 = LoadLibraryA("secur32.dll");
#define GET_PROC(dll, func) \
@ -69,7 +75,8 @@ static void init_functionpointers(void)
GET_PROC(hmsi, MsiSourceListAddSourceA)
GET_PROC(hadvapi32, ConvertSidToStringSidA)
GET_PROC(hadvapi32, RegDeleteKeyExA)
GET_PROC(hkernel32, IsWow64Process)
GET_PROC(hsecur32, GetUserNameExA)
#undef GET_PROC
@ -127,25 +134,28 @@ static void create_test_guid(LPSTR prodcode, LPSTR squashed)
WideCharToMultiByte(CP_ACP, 0, squashedW, -1, squashed, MAX_PATH, NULL, NULL);
}
static int get_user_sid(LPSTR *usersid)
static char *get_user_sid(void)
{
HANDLE token;
BYTE buf[1024];
DWORD size;
PTOKEN_USER user;
BOOL rc;
DWORD size = 0;
TOKEN_USER *user;
char *usersid = NULL;
if (!pConvertSidToStringSidA)
return 0;
rc=OpenProcessToken(GetCurrentProcess(), TOKEN_QUERY, &token);
if (!rc && GetLastError() == ERROR_CALL_NOT_IMPLEMENTED)
return 0;
size = sizeof(buf);
GetTokenInformation(token, TokenUser, buf, size, &size);
user = (PTOKEN_USER)buf;
pConvertSidToStringSidA(user->User.Sid, usersid);
{
win_skip("ConvertSidToStringSidA is not available\n");
return NULL;
}
OpenProcessToken(GetCurrentProcess(), TOKEN_QUERY, &token);
GetTokenInformation(token, TokenUser, NULL, size, &size);
user = HeapAlloc(GetProcessHeap(), 0, size);
GetTokenInformation(token, TokenUser, user, size, &size);
pConvertSidToStringSidA(user->User.Sid, &usersid);
HeapFree(GetProcessHeap(), 0, user);
CloseHandle(token);
return 1;
return usersid;
}
static void check_reg_str(HKEY prodkey, LPCSTR name, LPCSTR expected, BOOL bcase, DWORD line)
@ -198,7 +208,7 @@ static void test_MsiSourceListGetInfo(void)
}
create_test_guid(prodcode, prod_squashed);
if (!get_user_sid(&usersid))
if (!(usersid = get_user_sid()))
{
skip("User SID not available -> skipping MsiSourceListGetInfoA tests\n");
return;
@ -219,11 +229,6 @@ static void test_MsiSourceListGetInfo(void)
MSICODE_PRODUCT, INSTALLPROPERTY_PACKAGENAME, NULL, NULL);
ok(r == ERROR_INVALID_PARAMETER, "Expected ERROR_INVALID_PARAMETER, got %d\n", r);
/* szProductCodeOrPatchCode */
r = pMsiSourceListGetInfoA("garbage", usersid, MSIINSTALLCONTEXT_USERUNMANAGED,
MSICODE_PRODUCT, INSTALLPROPERTY_PACKAGENAME, NULL, NULL);
ok(r == ERROR_INVALID_PARAMETER, "Expected ERROR_INVALID_PARAMETER, got %d\n", r);
/* guid without brackets */
r = pMsiSourceListGetInfoA("51CD2AD5-0482-4C46-8DDD-0ED1022AA1AA", usersid, MSIINSTALLCONTEXT_USERUNMANAGED,
MSICODE_PRODUCT, INSTALLPROPERTY_PACKAGENAME, NULL, NULL);
@ -631,6 +636,13 @@ static void test_MsiSourceListGetInfo(void)
LocalFree(usersid);
}
static LONG delete_key( HKEY key, LPCSTR subkey, REGSAM access )
{
if (pRegDeleteKeyExA)
return pRegDeleteKeyExA( key, subkey, access, 0 );
return RegDeleteKeyA( key, subkey );
}
static void test_MsiSourceListAddSourceEx(void)
{
CHAR prodcode[MAX_PATH];
@ -640,9 +652,9 @@ static void test_MsiSourceListAddSourceEx(void)
LPSTR usersid;
LONG res;
UINT r;
HKEY prodkey, userkey, hkey;
HKEY url, net;
HKEY prodkey, userkey, hkey, url, net;
DWORD size;
REGSAM access = KEY_ALL_ACCESS;
if (!pMsiSourceListAddSourceExA)
{
@ -651,12 +663,15 @@ static void test_MsiSourceListAddSourceEx(void)
}
create_test_guid(prodcode, prod_squashed);
if (!get_user_sid(&usersid))
if (!(usersid = get_user_sid()))
{
skip("User SID not available -> skipping MsiSourceListAddSourceExA tests\n");
return;
}
if (is_wow64)
access |= KEY_WOW64_64KEY;
/* GetLastError is not set by the function */
/* NULL szProductCodeOrPatchCode */
@ -900,8 +915,12 @@ static void test_MsiSourceListAddSourceEx(void)
lstrcatA(keypath, "\\Installer\\Products\\");
lstrcatA(keypath, prod_squashed);
res = RegCreateKeyA(HKEY_LOCAL_MACHINE, keypath, &prodkey);
ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
res = RegCreateKeyExA(HKEY_LOCAL_MACHINE, keypath, 0, NULL, 0, access, NULL, &prodkey, NULL);
if (res != ERROR_SUCCESS)
{
skip("Product key creation failed with error code %u\n", res);
goto machine_tests;
}
/* product key exists */
r = pMsiSourceListAddSourceExA(prodcode, usersid,
@ -909,7 +928,7 @@ static void test_MsiSourceListAddSourceEx(void)
MSICODE_PRODUCT | MSISOURCETYPE_URL, "C:\\source", 0);
ok(r == ERROR_BAD_CONFIGURATION, "Expected ERROR_BAD_CONFIGURATION, got %d\n", r);
res = RegCreateKeyA(prodkey, "SourceList", &hkey);
res = RegCreateKeyExA(prodkey, "SourceList", 0, NULL, 0, access, NULL, &hkey, NULL);
ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
RegCloseKey(hkey);
@ -919,7 +938,7 @@ static void test_MsiSourceListAddSourceEx(void)
MSICODE_PRODUCT | MSISOURCETYPE_URL, "C:\\source", 0);
ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
res = RegOpenKeyA(prodkey, "SourceList\\URL", &url);
res = RegOpenKeyExA(prodkey, "SourceList\\URL", 0, access, &url);
ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
size = MAX_PATH;
@ -937,7 +956,7 @@ static void test_MsiSourceListAddSourceEx(void)
MSICODE_PRODUCT | MSISOURCETYPE_URL, "another", 0);
ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
res = RegOpenKeyA(prodkey, "SourceList\\URL", &url);
res = RegOpenKeyExA(prodkey, "SourceList\\URL", 0, access, &url);
ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
size = MAX_PATH;
@ -957,6 +976,7 @@ static void test_MsiSourceListAddSourceEx(void)
/* MSIINSTALLCONTEXT_MACHINE */
machine_tests:
/* szUserSid must be NULL for MSIINSTALLCONTEXT_MACHINE */
r = pMsiSourceListAddSourceExA(prodcode, usersid,
MSIINSTALLCONTEXT_MACHINE,
@ -971,8 +991,13 @@ static void test_MsiSourceListAddSourceEx(void)
lstrcpyA(keypath, "Software\\Classes\\Installer\\Products\\");
lstrcatA(keypath, prod_squashed);
res = RegCreateKeyA(HKEY_LOCAL_MACHINE, keypath, &prodkey);
ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
res = RegCreateKeyExA(HKEY_LOCAL_MACHINE, keypath, 0, NULL, 0, access, NULL, &prodkey, NULL);
if (res != ERROR_SUCCESS)
{
skip("Product key creation failed with error code %u\n", res);
LocalFree(usersid);
return;
}
/* product key exists */
r = pMsiSourceListAddSourceExA(prodcode, NULL,
@ -980,7 +1005,7 @@ static void test_MsiSourceListAddSourceEx(void)
MSICODE_PRODUCT | MSISOURCETYPE_URL, "C:\\source", 0);
ok(r == ERROR_BAD_CONFIGURATION, "Expected ERROR_BAD_CONFIGURATION, got %d\n", r);
res = RegCreateKeyA(prodkey, "SourceList", &hkey);
res = RegCreateKeyExA(prodkey, "SourceList", 0, NULL, 0, access, NULL, &hkey, NULL);
ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
RegCloseKey(hkey);
@ -990,7 +1015,7 @@ static void test_MsiSourceListAddSourceEx(void)
MSICODE_PRODUCT | MSISOURCETYPE_URL, "C:\\source", 0);
ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
res = RegOpenKeyA(prodkey, "SourceList\\URL", &url);
res = RegOpenKeyExA(prodkey, "SourceList\\URL", 0, access, &url);
ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
size = MAX_PATH;
@ -1001,7 +1026,7 @@ static void test_MsiSourceListAddSourceEx(void)
RegCloseKey(url);
RegCloseKey(prodkey);
HeapFree(GetProcessHeap(), 0, usersid);
LocalFree(usersid);
}
static void test_MsiSourceListEnumSources(void)
@ -1016,6 +1041,7 @@ static void test_MsiSourceListEnumSources(void)
HKEY prodkey, userkey;
HKEY url, net, source;
DWORD size;
REGSAM access = KEY_ALL_ACCESS;
if (!pMsiSourceListEnumSourcesA)
{
@ -1024,12 +1050,15 @@ static void test_MsiSourceListEnumSources(void)
}
create_test_guid(prodcode, prod_squashed);
if (!get_user_sid(&usersid))
if (!(usersid = get_user_sid()))
{
skip("User SID not available -> skipping MsiSourceListEnumSourcesA tests\n");
return;
}
if (is_wow64)
access |= KEY_WOW64_64KEY;
/* GetLastError is not set by the function */
/* NULL szProductCodeOrPatchCode */
@ -1362,8 +1391,12 @@ static void test_MsiSourceListEnumSources(void)
lstrcatA(keypath, "\\Installer\\Products\\");
lstrcatA(keypath, prod_squashed);
res = RegCreateKeyA(HKEY_LOCAL_MACHINE, keypath, &userkey);
ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
res = RegCreateKeyExA(HKEY_LOCAL_MACHINE, keypath, 0, NULL, 0, access, NULL, &userkey, NULL);
if (res != ERROR_SUCCESS)
{
skip("Product key creation failed with error code %u\n", res);
goto machine_tests;
}
/* user product key exists */
size = MAX_PATH;
@ -1375,7 +1408,7 @@ static void test_MsiSourceListEnumSources(void)
ok(!lstrcmpA(value, "aaa"), "Expected value to be unchanged, got %s\n", value);
ok(size == MAX_PATH, "Expected MAX_PATH, got %d\n", size);
res = RegCreateKeyA(userkey, "SourceList", &source);
res = RegCreateKeyExA(userkey, "SourceList", 0, NULL, 0, access, NULL, &source, NULL);
ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
/* SourceList key exists */
@ -1388,7 +1421,7 @@ static void test_MsiSourceListEnumSources(void)
ok(!lstrcmpA(value, "aaa"), "Expected value to be unchanged, got %s\n", value);
ok(size == MAX_PATH, "Expected MAX_PATH, got %d\n", size);
res = RegCreateKeyA(source, "URL", &url);
res = RegCreateKeyExA(source, "URL", 0, NULL, 0, access, NULL, &url, NULL);
ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
/* URL key exists */
@ -1425,7 +1458,7 @@ static void test_MsiSourceListEnumSources(void)
ok(size == 5, "Expected 5, got %d\n", size);
RegDeleteValueA(url, "1");
RegDeleteKeyA(url, "");
delete_key(url, "", access);
RegCloseKey(url);
/* SourceList key exists */
@ -1438,7 +1471,7 @@ static void test_MsiSourceListEnumSources(void)
ok(!lstrcmpA(value, "aaa"), "Expected value to be unchanged, got %s\n", value);
ok(size == MAX_PATH, "Expected MAX_PATH, got %d\n", size);
res = RegCreateKeyA(source, "Net", &net);
res = RegCreateKeyExA(source, "Net", 0, NULL, 0, access, NULL, &net, NULL);
ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
/* Net key exists */
@ -1465,15 +1498,16 @@ static void test_MsiSourceListEnumSources(void)
ok(size == 5, "Expected 5, got %d\n", size);
RegDeleteValueA(net, "1");
RegDeleteKeyA(net, "");
delete_key(net, "", access);
RegCloseKey(net);
RegDeleteKeyA(source, "");
delete_key(source, "", access);
RegCloseKey(source);
RegDeleteKeyA(userkey, "");
delete_key(userkey, "", access);
RegCloseKey(userkey);
/* MSIINSTALLCONTEXT_MACHINE */
machine_tests:
/* szUserSid is non-NULL */
size = MAX_PATH;
lstrcpyA(value, "aaa");
@ -1484,7 +1518,7 @@ static void test_MsiSourceListEnumSources(void)
ok(!lstrcmpA(value, "aaa"), "Expected value to be unchanged, got %s\n", value);
ok(size == MAX_PATH, "Expected MAX_PATH, got %d\n", size);
/* szUserSid is non-NULL */
/* szUserSid is NULL */
size = MAX_PATH;
lstrcpyA(value, "aaa");
r = pMsiSourceListEnumSourcesA(prodcode, NULL,
@ -1497,8 +1531,13 @@ static void test_MsiSourceListEnumSources(void)
lstrcpyA(keypath, "Software\\Classes\\Installer\\Products\\");
lstrcatA(keypath, prod_squashed);
res = RegCreateKeyA(HKEY_LOCAL_MACHINE, keypath, &prodkey);
ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
res = RegCreateKeyExA(HKEY_LOCAL_MACHINE, keypath, 0, NULL, 0, access, NULL, &prodkey, NULL);
if (res != ERROR_SUCCESS)
{
skip("Product key creation failed with error code %u\n", res);
LocalFree(usersid);
return;
}
/* user product key exists */
size = MAX_PATH;
@ -1510,7 +1549,7 @@ static void test_MsiSourceListEnumSources(void)
ok(!lstrcmpA(value, "aaa"), "Expected value to be unchanged, got %s\n", value);
ok(size == MAX_PATH, "Expected MAX_PATH, got %d\n", size);
res = RegCreateKeyA(prodkey, "SourceList", &source);
res = RegCreateKeyExA(prodkey, "SourceList", 0, NULL, 0, access, NULL, &source, NULL);
ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
/* SourceList key exists */
@ -1523,7 +1562,7 @@ static void test_MsiSourceListEnumSources(void)
ok(!lstrcmpA(value, "aaa"), "Expected value to be unchanged, got %s\n", value);
ok(size == MAX_PATH, "Expected MAX_PATH, got %d\n", size);
res = RegCreateKeyA(source, "URL", &url);
res = RegCreateKeyExA(source, "URL", 0, NULL, 0, access, NULL, &url, NULL);
ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
/* URL key exists */
@ -1560,7 +1599,7 @@ static void test_MsiSourceListEnumSources(void)
ok(size == 5, "Expected 5, got %d\n", size);
RegDeleteValueA(url, "1");
RegDeleteKeyA(url, "");
delete_key(url, "", access);
RegCloseKey(url);
/* SourceList key exists */
@ -1573,7 +1612,7 @@ static void test_MsiSourceListEnumSources(void)
ok(!lstrcmpA(value, "aaa"), "Expected value to be unchanged, got %s\n", value);
ok(size == MAX_PATH, "Expected MAX_PATH, got %d\n", size);
res = RegCreateKeyA(source, "Net", &net);
res = RegCreateKeyExA(source, "Net", 0, NULL, 0, access, NULL, &net, NULL);
ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
/* Net key exists */
@ -1600,11 +1639,11 @@ static void test_MsiSourceListEnumSources(void)
ok(size == 5, "Expected 5, got %d\n", size);
RegDeleteValueA(net, "1");
RegDeleteKeyA(net, "");
delete_key(net, "", access);
RegCloseKey(net);
RegDeleteKeyA(source, "");
delete_key(source, "", access);
RegCloseKey(source);
RegDeleteKeyA(prodkey, "");
delete_key(prodkey, "", access);
RegCloseKey(prodkey);
LocalFree(usersid);
}
@ -1619,6 +1658,7 @@ static void test_MsiSourceListSetInfo(void)
LPSTR usersid;
LONG res;
UINT r;
REGSAM access = KEY_ALL_ACCESS;
if (!pMsiSourceListSetInfoA)
{
@ -1627,12 +1667,15 @@ static void test_MsiSourceListSetInfo(void)
}
create_test_guid(prodcode, prod_squashed);
if (!get_user_sid(&usersid))
if (!(usersid = get_user_sid()))
{
skip("User SID not available -> skipping MsiSourceListSetInfoA tests\n");
return;
}
if (is_wow64)
access |= KEY_WOW64_64KEY;
/* GetLastError is not set by the function */
/* NULL szProductCodeOrPatchCode */
@ -1942,8 +1985,12 @@ static void test_MsiSourceListSetInfo(void)
lstrcatA(keypath, "\\Installer\\Products\\");
lstrcatA(keypath, prod_squashed);
res = RegCreateKeyA(HKEY_LOCAL_MACHINE, keypath, &userkey);
ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
res = RegCreateKeyExA(HKEY_LOCAL_MACHINE, keypath, 0, NULL, 0, access, NULL, &userkey, NULL);
if (res != ERROR_SUCCESS)
{
skip("Product key creation failed with error code %u\n", res);
goto machine_tests;
}
/* user product key exists */
r = pMsiSourceListSetInfoA(prodcode, NULL,
@ -1952,7 +1999,7 @@ static void test_MsiSourceListSetInfo(void)
ok(r == ERROR_BAD_CONFIGURATION,
"Expected ERROR_BAD_CONFIGURATION, got %d\n", r);
res = RegCreateKeyA(userkey, "SourceList", &source);
res = RegCreateKeyExA(userkey, "SourceList", 0, NULL, 0, access, NULL, &source, NULL);
ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
/* SourceList key exists, no source type */
@ -1962,25 +2009,31 @@ static void test_MsiSourceListSetInfo(void)
ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
/* Media key is created by MsiSourceListSetInfo */
res = RegOpenKeyA(source, "Media", &media);
res = RegOpenKeyExA(source, "Media", 0, access, &media);
ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
CHECK_REG_STR(media, "MediaPackage", "path");
RegDeleteValueA(media, "MediaPackage");
RegDeleteKeyA(media, "");
delete_key(media, "", access);
RegCloseKey(media);
RegDeleteKeyA(source, "");
delete_key(source, "", access);
RegCloseKey(source);
RegDeleteKeyA(userkey, "");
delete_key(userkey, "", access);
RegCloseKey(userkey);
/* MSIINSTALLCONTEXT_MACHINE */
machine_tests:
lstrcpyA(keypath, "Software\\Classes\\Installer\\Products\\");
lstrcatA(keypath, prod_squashed);
res = RegCreateKeyA(HKEY_LOCAL_MACHINE, keypath, &prodkey);
ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
res = RegCreateKeyExA(HKEY_LOCAL_MACHINE, keypath, 0, NULL, 0, access, NULL, &prodkey, NULL);
if (res != ERROR_SUCCESS)
{
skip("Product key creation failed with error code %u\n", res);
LocalFree(usersid);
return;
}
/* user product key exists */
r = pMsiSourceListSetInfoA(prodcode, NULL,
@ -1989,7 +2042,7 @@ static void test_MsiSourceListSetInfo(void)
ok(r == ERROR_BAD_CONFIGURATION,
"Expected ERROR_BAD_CONFIGURATION, got %d\n", r);
res = RegCreateKeyA(prodkey, "SourceList", &source);
res = RegCreateKeyExA(prodkey, "SourceList", 0, NULL, 0, access, NULL, &source, NULL);
ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
/* SourceList key exists, no source type */
@ -1999,7 +2052,7 @@ static void test_MsiSourceListSetInfo(void)
ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
/* Media key is created by MsiSourceListSetInfo */
res = RegOpenKeyA(source, "Media", &media);
res = RegOpenKeyExA(source, "Media", 0, access, &media);
ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
CHECK_REG_STR(media, "MediaPackage", "path");
@ -2011,11 +2064,11 @@ static void test_MsiSourceListSetInfo(void)
"Expected ERROR_INVALID_PARAMETER, got %d\n", r);
RegDeleteValueA(media, "MediaPackage");
RegDeleteKeyA(media, "");
delete_key(media, "", access);
RegCloseKey(media);
RegDeleteKeyA(source, "");
delete_key(source, "", access);
RegCloseKey(source);
RegDeleteKeyA(prodkey, "");
delete_key(prodkey, "", access);
RegCloseKey(prodkey);
LocalFree(usersid);
}
@ -2030,6 +2083,7 @@ static void test_MsiSourceListAddMediaDisk(void)
LPSTR usersid;
LONG res;
UINT r;
REGSAM access = KEY_ALL_ACCESS;
if (!pMsiSourceListAddMediaDiskA)
{
@ -2038,12 +2092,15 @@ static void test_MsiSourceListAddMediaDisk(void)
}
create_test_guid(prodcode, prod_squashed);
if (!get_user_sid(&usersid))
if (!(usersid = get_user_sid()))
{
skip("User SID not available -> skipping MsiSourceListAddMediaDiskA tests\n");
return;
}
if (is_wow64)
access |= KEY_WOW64_64KEY;
/* GetLastError is not set by the function */
/* NULL szProductCodeOrPatchCode */
@ -2238,8 +2295,12 @@ static void test_MsiSourceListAddMediaDisk(void)
lstrcatA(keypath, "\\Installer\\Products\\");
lstrcatA(keypath, prod_squashed);
res = RegCreateKeyA(HKEY_LOCAL_MACHINE, keypath, &userkey);
ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
res = RegCreateKeyExA(HKEY_LOCAL_MACHINE, keypath, 0, NULL, 0, access, NULL, &userkey, NULL);
if (res != ERROR_SUCCESS)
{
skip("Product key creation failed with error code %u\n", res);
goto machine_tests;
}
/* user product key exists */
r = pMsiSourceListAddMediaDiskA(prodcode, usersid,
@ -2248,7 +2309,7 @@ static void test_MsiSourceListAddMediaDisk(void)
ok(r == ERROR_BAD_CONFIGURATION,
"Expected ERROR_BAD_CONFIGURATION, got %d\n", r);
res = RegCreateKeyA(userkey, "SourceList", &source);
res = RegCreateKeyExA(userkey, "SourceList", 0, NULL, 0, access, NULL, &source, NULL);
ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
/* SourceList key exists */
@ -2258,26 +2319,32 @@ static void test_MsiSourceListAddMediaDisk(void)
ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
/* Media subkey is created by MsiSourceListAddMediaDisk */
res = RegOpenKeyA(source, "Media", &media);
res = RegOpenKeyExA(source, "Media", 0, access, &media);
ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
CHECK_REG_STR(media, "1", "label;prompt");
RegDeleteValueA(media, "1");
RegDeleteKeyA(media, "");
delete_key(media, "", access);
RegCloseKey(media);
RegDeleteKeyA(source, "");
delete_key(source, "", access);
RegCloseKey(source);
RegDeleteKeyA(userkey, "");
delete_key(userkey, "", access);
RegCloseKey(userkey);
/* MSIINSTALLCONTEXT_MACHINE */
machine_tests:
lstrcpyA(keypath, "Software\\Classes\\Installer\\Products\\");
lstrcatA(keypath, prod_squashed);
res = RegCreateKeyA(HKEY_LOCAL_MACHINE, keypath, &prodkey);
ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
res = RegCreateKeyExA(HKEY_LOCAL_MACHINE, keypath, 0, NULL, 0, access, NULL, &prodkey, NULL);
if (res != ERROR_SUCCESS)
{
skip("Product key creation failed with error code %u\n", res);
LocalFree(usersid);
return;
}
/* machine product key exists */
r = pMsiSourceListAddMediaDiskA(prodcode, NULL,
@ -2286,7 +2353,7 @@ static void test_MsiSourceListAddMediaDisk(void)
ok(r == ERROR_BAD_CONFIGURATION,
"Expected ERROR_BAD_CONFIGURATION, got %d\n", r);
res = RegCreateKeyA(prodkey, "SourceList", &source);
res = RegCreateKeyExA(prodkey, "SourceList", 0, NULL, 0, access, NULL, &source, NULL);
ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
/* SourceList key exists */
@ -2296,7 +2363,7 @@ static void test_MsiSourceListAddMediaDisk(void)
ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
/* Media subkey is created by MsiSourceListAddMediaDisk */
res = RegOpenKeyA(source, "Media", &media);
res = RegOpenKeyExA(source, "Media", 0, access, &media);
ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
CHECK_REG_STR(media, "1", "label;prompt");
@ -2309,11 +2376,11 @@ static void test_MsiSourceListAddMediaDisk(void)
"Expected ERROR_INVALID_PARAMETER, got %d\n", r);
RegDeleteValueA(media, "1");
RegDeleteKeyA(media, "");
delete_key(media, "", access);
RegCloseKey(media);
RegDeleteKeyA(source, "");
delete_key(source, "", access);
RegCloseKey(source);
RegDeleteKeyA(prodkey, "");
delete_key(prodkey, "", access);
RegCloseKey(prodkey);
LocalFree(usersid);
}
@ -2325,14 +2392,12 @@ static void test_MsiSourceListEnumMediaDisks(void)
CHAR keypath[MAX_PATH*2];
CHAR label[MAX_PATH];
CHAR prompt[MAX_PATH];
HKEY prodkey, userkey;
HKEY media, source;
DWORD labelsz, promptsz;
HKEY prodkey, userkey, media, source;
DWORD labelsz, promptsz, val, id;
LPSTR usersid;
DWORD val;
DWORD id;
LONG res;
UINT r;
REGSAM access = KEY_ALL_ACCESS;
if (!pMsiSourceListEnumMediaDisksA)
{
@ -2341,12 +2406,15 @@ static void test_MsiSourceListEnumMediaDisks(void)
}
create_test_guid(prodcode, prod_squashed);
if (!get_user_sid(&usersid))
if (!(usersid = get_user_sid()))
{
skip("User SID not available -> skipping MsiSourceListEnumMediaDisksA tests\n");
return;
}
if (is_wow64)
access |= KEY_WOW64_64KEY;
/* GetLastError is not set by the function */
/* NULL szProductCodeOrPatchCode */
@ -2943,8 +3011,12 @@ static void test_MsiSourceListEnumMediaDisks(void)
lstrcatA(keypath, "\\Installer\\Products\\");
lstrcatA(keypath, prod_squashed);
res = RegCreateKeyA(HKEY_LOCAL_MACHINE, keypath, &userkey);
ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
res = RegCreateKeyExA(HKEY_LOCAL_MACHINE, keypath, 0, NULL, 0, access, NULL, &userkey, NULL);
if (res != ERROR_SUCCESS)
{
skip("Product key creation failed with error code %u\n", res);
goto machine_tests;
}
/* user product key exists */
r = pMsiSourceListEnumMediaDisksA(prodcode, usersid, MSIINSTALLCONTEXT_USERMANAGED,
@ -2953,7 +3025,7 @@ static void test_MsiSourceListEnumMediaDisks(void)
ok(r == ERROR_BAD_CONFIGURATION,
"Expected ERROR_BAD_CONFIGURATION, got %d\n", r);
res = RegCreateKeyA(userkey, "SourceList", &source);
res = RegCreateKeyExA(userkey, "SourceList", 0, NULL, 0, access, NULL, &source, NULL);
ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
/* SourceList key exists */
@ -2973,7 +3045,7 @@ static void test_MsiSourceListEnumMediaDisks(void)
ok(!lstrcmpA(prompt, "bbb"), "Expected \"bbb\", got \"%s\"\n", prompt);
ok(promptsz == 0xdeadbeef, "Expected 0xdeadbeef, got %d\n", promptsz);
res = RegCreateKeyA(source, "Media", &media);
res = RegCreateKeyExA(source, "Media", 0, NULL, 0, access, NULL, &media, NULL);
ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
/* Media key exists */
@ -3013,20 +3085,26 @@ static void test_MsiSourceListEnumMediaDisks(void)
ok(promptsz == 6, "Expected 6, got %d\n", promptsz);
RegDeleteValueA(media, "2");
RegDeleteKeyA(media, "");
delete_key(media, "", access);
RegCloseKey(media);
RegDeleteKeyA(source, "");
delete_key(source, "", access);
RegCloseKey(source);
RegDeleteKeyA(userkey, "");
delete_key(userkey, "", access);
RegCloseKey(userkey);
/* MSIINSTALLCONTEXT_MACHINE */
machine_tests:
lstrcpyA(keypath, "Software\\Classes\\Installer\\Products\\");
lstrcatA(keypath, prod_squashed);
res = RegCreateKeyA(HKEY_LOCAL_MACHINE, keypath, &prodkey);
ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
res = RegCreateKeyExA(HKEY_LOCAL_MACHINE, keypath, 0, NULL, 0, access, NULL, &prodkey, NULL);
if (res != ERROR_SUCCESS)
{
skip("Product key creation failed with error code %u\n", res);
LocalFree(usersid);
return;
}
/* machine product key exists */
r = pMsiSourceListEnumMediaDisksA(prodcode, NULL, MSIINSTALLCONTEXT_MACHINE,
@ -3035,7 +3113,7 @@ static void test_MsiSourceListEnumMediaDisks(void)
ok(r == ERROR_BAD_CONFIGURATION,
"Expected ERROR_BAD_CONFIGURATION, got %d\n", r);
res = RegCreateKeyA(prodkey, "SourceList", &source);
res = RegCreateKeyExA(prodkey, "SourceList", 0, NULL, 0, access, NULL, &source, NULL);
ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
/* SourceList key exists */
@ -3055,7 +3133,7 @@ static void test_MsiSourceListEnumMediaDisks(void)
ok(!lstrcmpA(prompt, "bbb"), "Expected \"bbb\", got \"%s\"\n", prompt);
ok(promptsz == 0xdeadbeef, "Expected 0xdeadbeef, got %d\n", promptsz);
res = RegCreateKeyA(source, "Media", &media);
res = RegCreateKeyExA(source, "Media", 0, NULL, 0, access, NULL, &media, NULL);
ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
/* Media key exists */
@ -3112,11 +3190,11 @@ static void test_MsiSourceListEnumMediaDisks(void)
ok(promptsz == MAX_PATH, "Expected MAX_PATH, got %d\n", promptsz);
RegDeleteValueA(media, "2");
RegDeleteKeyA(media, "");
delete_key(media, "", access);
RegCloseKey(media);
RegDeleteKeyA(source, "");
delete_key(source, "", access);
RegCloseKey(source);
RegDeleteKeyA(prodkey, "");
delete_key(prodkey, "", access);
RegCloseKey(prodkey);
LocalFree(usersid);
}
@ -3130,9 +3208,9 @@ static void test_MsiSourceListAddSource(void)
LPSTR usersid, ptr;
LONG res;
UINT r;
HKEY prodkey, userkey;
HKEY net, source;
HKEY prodkey, userkey, net, source;
DWORD size;
REGSAM access = KEY_ALL_ACCESS;
if (!pMsiSourceListAddSourceA)
{
@ -3141,7 +3219,7 @@ static void test_MsiSourceListAddSource(void)
}
create_test_guid(prodcode, prod_squashed);
if (!get_user_sid(&usersid))
if (!(usersid = get_user_sid()))
{
skip("User SID not available -> skipping MsiSourceListAddSourceA tests\n");
return;
@ -3161,6 +3239,9 @@ static void test_MsiSourceListAddSource(void)
}
trace("username: %s\n", username);
if (is_wow64)
access |= KEY_WOW64_64KEY;
/* GetLastError is not set by the function */
/* NULL szProduct */
@ -3205,14 +3286,18 @@ static void test_MsiSourceListAddSource(void)
lstrcatA(keypath, "\\Installer\\Products\\");
lstrcatA(keypath, prod_squashed);
res = RegCreateKeyA(HKEY_LOCAL_MACHINE, keypath, &userkey);
ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
res = RegCreateKeyExA(HKEY_LOCAL_MACHINE, keypath, 0, NULL, 0, access, NULL, &userkey, NULL);
if (res != ERROR_SUCCESS)
{
skip("Product key creation failed with error code %u\n", res);
goto userunmanaged_tests;
}
/* user product key exists */
r = pMsiSourceListAddSourceA(prodcode, username, 0, "source");
ok(r == ERROR_BAD_CONFIGURATION, "Expected ERROR_BAD_CONFIGURATION, got %d\n", r);
res = RegCreateKeyA(userkey, "SourceList", &source);
res = RegCreateKeyExA(userkey, "SourceList", 0, NULL, 0, access, NULL, &source, NULL);
ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
/* SourceList key exists */
@ -3220,7 +3305,7 @@ static void test_MsiSourceListAddSource(void)
ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
/* Net key is created */
res = RegOpenKeyA(source, "Net", &net);
res = RegOpenKeyExA(source, "Net", 0, access, &net);
ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
/* LastUsedSource does not exist and it is not created */
@ -3230,7 +3315,7 @@ static void test_MsiSourceListAddSource(void)
CHECK_REG_STR(net, "1", "source\\");
RegDeleteValueA(net, "1");
RegDeleteKeyA(net, "");
delete_key(net, "", access);
RegCloseKey(net);
res = RegSetValueExA(source, "LastUsedSource", 0, REG_SZ, (LPBYTE)"blah", 5);
@ -3241,14 +3326,14 @@ static void test_MsiSourceListAddSource(void)
ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
/* Net key is created */
res = RegOpenKeyA(source, "Net", &net);
res = RegOpenKeyExA(source, "Net", 0, access, &net);
ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
CHECK_REG_STR(source, "LastUsedSource", "blah");
CHECK_REG_STR(net, "1", "source\\");
RegDeleteValueA(net, "1");
RegDeleteKeyA(net, "");
delete_key(net, "", access);
RegCloseKey(net);
res = RegSetValueExA(source, "LastUsedSource", 0, REG_SZ, (LPBYTE)"5", 2);
@ -3259,7 +3344,7 @@ static void test_MsiSourceListAddSource(void)
ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
/* Net key is created */
res = RegOpenKeyA(source, "Net", &net);
res = RegOpenKeyExA(source, "Net", 0, access, &net);
ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
CHECK_REG_STR(source, "LastUsedSource", "5");
@ -3288,15 +3373,16 @@ static void test_MsiSourceListAddSource(void)
RegDeleteValueA(net, "1");
RegDeleteValueA(net, "2");
RegDeleteValueA(net, "3");
RegDeleteKeyA(net, "");
delete_key(net, "", access);
RegCloseKey(net);
RegDeleteKeyA(source, "");
delete_key(source, "", access);
RegCloseKey(source);
RegDeleteKeyA(userkey, "");
delete_key(userkey, "", access);
RegCloseKey(userkey);
/* MSIINSTALLCONTEXT_USERUNMANAGED */
userunmanaged_tests:
r = pMsiSourceListAddSourceA(prodcode, username, 0, "source");
ok(r == ERROR_UNKNOWN_PRODUCT, "Expected ERROR_UNKNOWN_PRODUCT, got %d\n", r);
@ -3304,7 +3390,11 @@ static void test_MsiSourceListAddSource(void)
lstrcatA(keypath, prod_squashed);
res = RegCreateKeyA(HKEY_CURRENT_USER, keypath, &userkey);
ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
if (res != ERROR_SUCCESS)
{
skip("Product key creation failed with error code %u\n", res);
goto machine_tests;
}
/* user product key exists */
r = pMsiSourceListAddSourceA(prodcode, username, 0, "source");
@ -3333,20 +3423,26 @@ static void test_MsiSourceListAddSource(void)
/* MSIINSTALLCONTEXT_MACHINE */
machine_tests:
r = pMsiSourceListAddSourceA(prodcode, NULL, 0, "source");
ok(r == ERROR_UNKNOWN_PRODUCT, "Expected ERROR_UNKNOWN_PRODUCT, got %d\n", r);
lstrcpyA(keypath, "Software\\Classes\\Installer\\Products\\");
lstrcatA(keypath, prod_squashed);
res = RegCreateKeyA(HKEY_LOCAL_MACHINE, keypath, &prodkey);
ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
res = RegCreateKeyExA(HKEY_LOCAL_MACHINE, keypath, 0, NULL, 0, access, NULL, &prodkey, NULL);
if (res != ERROR_SUCCESS)
{
skip("Product key creation failed with error code %u\n", res);
LocalFree(usersid);
return;
}
/* machine product key exists */
r = pMsiSourceListAddSourceA(prodcode, NULL, 0, "source");
ok(r == ERROR_BAD_CONFIGURATION, "Expected ERROR_BAD_CONFIGURATION, got %d\n", r);
res = RegCreateKeyA(prodkey, "SourceList", &source);
res = RegCreateKeyExA(prodkey, "SourceList", 0, NULL, 0, access, NULL, &source, NULL);
ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
/* SourceList key exists */
@ -3354,7 +3450,7 @@ static void test_MsiSourceListAddSource(void)
ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
/* Net key is created */
res = RegOpenKeyA(source, "Net", &net);
res = RegOpenKeyExA(source, "Net", 0, access, &net);
ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
CHECK_REG_STR(net, "1", "source\\");
@ -3368,11 +3464,11 @@ static void test_MsiSourceListAddSource(void)
RegDeleteValueA(net, "2");
RegDeleteValueA(net, "1");
RegDeleteKeyA(net, "");
delete_key(net, "", access);
RegCloseKey(net);
RegDeleteKeyA(source, "");
delete_key(source, "", access);
RegCloseKey(source);
RegDeleteKeyA(prodkey, "");
delete_key(prodkey, "", access);
RegCloseKey(prodkey);
LocalFree(usersid);
}
@ -3381,6 +3477,9 @@ START_TEST(source)
{
init_functionpointers();
if (pIsWow64Process)
pIsWow64Process(GetCurrentProcess(), &is_wow64);
test_MsiSourceListGetInfo();
test_MsiSourceListAddSourceEx();
test_MsiSourceListEnumSources();

View file

@ -63,7 +63,7 @@
#define PID_MSISOURCE PID_WORDCOUNT
#define PID_MSIRESTRICT PID_CHARCOUNT
const char *msifile = "winetest-suminfo.msi";
static const char *msifile = "winetest-suminfo.msi";
static const WCHAR msifileW[] = {
'w','i','n','e','t','e','s','t','-','s','u','m','i','n','f','o','.','m','s','i',0 };
@ -86,7 +86,18 @@ static void test_suminfo(void)
ok(r == ERROR_INVALID_PARAMETER, "MsiGetSummaryInformation wrong error\n");
r = MsiGetSummaryInformation(hdb, NULL, 0, &hsuminfo);
ok(r == ERROR_SUCCESS, "MsiGetSummaryInformation failed\n");
ok(r == ERROR_SUCCESS, "MsiGetSummaryInformation failed %u\n", r);
r = MsiCloseHandle(hsuminfo);
ok(r == ERROR_SUCCESS, "MsiCloseHandle failed\n");
r = MsiGetSummaryInformation(0, "", 0, &hsuminfo);
todo_wine
ok(r == ERROR_INSTALL_PACKAGE_INVALID || r == ERROR_INSTALL_PACKAGE_OPEN_FAILED,
"MsiGetSummaryInformation failed %u\n", r);
r = MsiGetSummaryInformation(hdb, "", 0, &hsuminfo);
ok(r == ERROR_SUCCESS, "MsiGetSummaryInformation failed %u\n", r);
r = MsiSummaryInfoGetPropertyCount(0, NULL);
ok(r == ERROR_INVALID_HANDLE, "getpropcount failed\n");

View file

@ -6,6 +6,7 @@
#define STANDALONE
#include "wine/test.h"
extern void func_action(void);
extern void func_automation(void);
extern void func_db(void);
extern void func_format(void);
@ -17,9 +18,9 @@ extern void func_record(void);
extern void func_source(void);
extern void func_suminfo(void);
const struct test winetest_testlist[] =
{
{ "action", func_action },
{ "automation", func_automation },
{ "db", func_db },
{ "format", func_format },