From f3e0eb8fe0436c803e2ca02126d48ebd29483166 Mon Sep 17 00:00:00 2001 From: Amine Khaldi Date: Mon, 13 Aug 2012 16:18:14 +0000 Subject: [PATCH] [MSI_WINETEST] * Sync to Wine 1.5.10. svn path=/trunk/; revision=57071 --- rostests/winetests/msi/CMakeLists.txt | 4 +- rostests/winetests/msi/action.c | 217 ++++++++++++++++++++++++-- rostests/winetests/msi/automation.c | 2 +- rostests/winetests/msi/db.c | 11 +- rostests/winetests/msi/install.c | 148 +++++++++++++++++- rostests/winetests/msi/package.c | 8 +- rostests/winetests/msi/patch.c | 6 +- rostests/winetests/msi/suminfo.c | 4 +- 8 files changed, 363 insertions(+), 37 deletions(-) diff --git a/rostests/winetests/msi/CMakeLists.txt b/rostests/winetests/msi/CMakeLists.txt index adacf626d07..2db3d89101a 100644 --- a/rostests/winetests/msi/CMakeLists.txt +++ b/rostests/winetests/msi/CMakeLists.txt @@ -1,7 +1,5 @@ -add_definitions( - -D__ROS_LONG64__ - -D_DLL -D__USE_CRTIMP) +add_definitions(-D__ROS_LONG64__) list(APPEND SOURCE action.c diff --git a/rostests/winetests/msi/action.c b/rostests/winetests/msi/action.c index 2b482df14cd..1fcb82d48e5 100644 --- a/rostests/winetests/msi/action.c +++ b/rostests/winetests/msi/action.c @@ -41,7 +41,6 @@ static INSTALLSTATE (WINAPI *pMsiGetComponentPathExA) (LPCSTR, LPCSTR, LPCSTR, MSIINSTALLCONTEXT, LPSTR, LPDWORD); static BOOL (WINAPI *pConvertSidToStringSidA)(PSID, LPSTR *); -static BOOL (WINAPI *pGetTokenInformation)(HANDLE, TOKEN_INFORMATION_CLASS, LPVOID, DWORD, PDWORD); static BOOL (WINAPI *pOpenProcessToken)(HANDLE, DWORD, PHANDLE); static LONG (WINAPI *pRegDeleteKeyExA)(HKEY, LPCSTR, REGSAM, DWORD); static BOOL (WINAPI *pIsWow64Process)(HANDLE, PBOOL); @@ -487,7 +486,11 @@ static const char wrv_registry_dat[] = "Registry\tRoot\tKey\tName\tValue\tComponent_\n" "s72\ti2\tl255\tL255\tL0\ts72\n" "Registry\tRegistry\n" - "regdata\t2\tSOFTWARE\\Wine\\msitest\tValue\t[~]one[~]two[~]three\taugustus"; + "regdata\t2\tSOFTWARE\\Wine\\msitest\tValue\t[~]one[~]two[~]three\taugustus\n" + "regdata1\t2\tSOFTWARE\\Wine\\msitest\t*\t\taugustus\n" + "regdata2\t2\tSOFTWARE\\Wine\\msitest\t*\t#%\taugustus\n" + "regdata3\t2\tSOFTWARE\\Wine\\msitest\t*\t#x\taugustus\n" + "regdata4\t2\tSOFTWARE\\Wine\\msitest\\VisualStudio\\10.0\\AD7Metrics\\Exception\\{049EC4CC-30D2-4032-9256-EE18EB41B62B}\\Common Language Runtime Exceptions\\System.Workflow.ComponentModel.Serialization\\System.Workflow.ComponentModel.Serialization.WorkflowMarkupSerializationException\tlong\tkey\taugustus\n"; static const char cf_directory_dat[] = "Directory\tDirectory_Parent\tDefaultDir\n" @@ -1458,6 +1461,76 @@ static const char pa_install_exec_seq_dat[] = "PublishProduct\t\t5200\n" "InstallFinalize\t\t6000\n"; +static const char rep_file_dat[] = + "File\tComponent_\tFileName\tFileSize\tVersion\tLanguage\tAttributes\tSequence\n" + "s72\ts72\tl255\ti4\tS72\tS20\tI2\ti2\n" + "File\tFile\n" + "rep.txt\trep\trep.txt\t1000\t\t\t8192\t1\n"; + +static const char rep_feature_dat[] = + "Feature\tFeature_Parent\tTitle\tDescription\tDisplay\tLevel\tDirectory_\tAttributes\n" + "s38\tS38\tL64\tL255\tI2\ti2\tS72\ti2\n" + "Feature\tFeature\n" + "rep\t\t\trep feature\t1\t2\tMSITESTDIR\t0\n"; + +static const char rep_feature_comp_dat[] = + "Feature_\tComponent_\n" + "s38\ts72\n" + "FeatureComponents\tFeature_\tComponent_\n" + "rep\trep\n"; + +static const char rep_component_dat[] = + "Component\tComponentId\tDirectory_\tAttributes\tCondition\tKeyPath\n" + "s72\tS38\ts72\ti2\tS255\tS72\n" + "Component\tComponent\n" + "rep\t{A24FAF2A-3B2E-41EF-AA78-331542E1A29D}\tMSITESTDIR\t0\t\trep.txt\n"; + +static const char rep_upgrade_dat[] = + "UpgradeCode\tVersionMin\tVersionMax\tLanguage\tAttributes\tRemove\tActionProperty\n" + "s38\tS20\tS20\tS255\ti4\tS255\ts72\n" + "Upgrade\tUpgradeCode\tVersionMin\tVersionMax\tLanguage\tAttributes\n" + "{2967C1CC-34D4-42EE-8D96-CD6836F192BF}\t\t\t\t256\t\tPRODUCT\n"; + +static const char rep_property_dat[] = + "Property\tValue\n" + "s72\tl0\n" + "Property\tProperty\n" + "HASUIRUN\t0\n" + "INSTALLLEVEL\t3\n" + "InstallMode\tTypical\n" + "Manufacturer\tWine\n" + "PIDTemplate\t###-#######\n" + "ProductCode\t{1699F0BB-0B61-4A89-AFE4-CFD60DFD76F3}\n" + "ProductLanguage\t1033\n" + "ProductName\tMSITEST\n" + "ProductVersion\t1.1.1\n" + "UpgradeCode\t{2967C1CC-34D4-42EE-8D96-CD6836F192BF}\n" + "PRODUCT\t2F41860D-7B4C-4DA7-BED9-B64F26594C56\n" + "MSIFASTINSTALL\t1\n"; + +static const char rep_install_exec_seq_dat[] = + "Action\tCondition\tSequence\n" + "s72\tS255\tI2\n" + "InstallExecuteSequence\tAction\n" + "FindRelatedProducts\t\t100\n" + "CostInitialize\t\t800\n" + "FileCost\t\t900\n" + "CostFinalize\t\t1000\n" + "InstallValidate\t\t1400\n" + "RemoveExistingProducts\t\t1499\n" + "InstallInitialize\t\t1500\n" + "ProcessComponents\t\t1600\n" + "RemoveFiles\t\t1700\n" + "InstallFiles\t\t2000\n" + "UnregisterExtensionInfo\t\t3000\n" + "UnregisterMIMEInfo\t\t3500\n" + "RegisterExtensionInfo\t\t4000\n" + "RegisterMIMEInfo\t\t4500\n" + "RegisterProduct\t\t5000\n" + "PublishFeatures\t\t5100\n" + "PublishProduct\t\t5200\n" + "InstallFinalize\t\t6000\n"; + typedef struct _msi_table { const char *filename; @@ -1815,6 +1888,88 @@ static const msi_table pa_tables[] = ADD_TABLE(property) }; +static const msi_table rep_tables[] = +{ + ADD_TABLE(directory), + ADD_TABLE(rep_component), + ADD_TABLE(rep_feature), + ADD_TABLE(rep_feature_comp), + ADD_TABLE(rep_file), + ADD_TABLE(rep_upgrade), + ADD_TABLE(rep_property), + ADD_TABLE(rep_install_exec_seq), + ADD_TABLE(media) +}; + +/* based on RegDeleteTreeW from dlls/advapi32/registry.c */ +static LSTATUS action_RegDeleteTreeA(HKEY hKey, LPCSTR lpszSubKey, REGSAM access) +{ + LONG ret; + DWORD dwMaxSubkeyLen, dwMaxValueLen; + DWORD dwMaxLen, dwSize; + char szNameBuf[MAX_PATH], *lpszName = szNameBuf; + HKEY hSubKey = hKey; + + if(lpszSubKey) + { + ret = RegOpenKeyExA(hKey, lpszSubKey, 0, access, &hSubKey); + if (ret) return ret; + } + + ret = RegQueryInfoKeyA(hSubKey, NULL, NULL, NULL, NULL, + &dwMaxSubkeyLen, NULL, NULL, &dwMaxValueLen, NULL, NULL, NULL); + if (ret) goto cleanup; + + dwMaxSubkeyLen++; + dwMaxValueLen++; + dwMaxLen = max(dwMaxSubkeyLen, dwMaxValueLen); + if (dwMaxLen > sizeof(szNameBuf)) + { + /* Name too big: alloc a buffer for it */ + if (!(lpszName = HeapAlloc( GetProcessHeap(), 0, dwMaxLen))) + { + ret = ERROR_NOT_ENOUGH_MEMORY; + goto cleanup; + } + } + + /* Recursively delete all the subkeys */ + while (TRUE) + { + dwSize = dwMaxLen; + if (RegEnumKeyExA(hSubKey, 0, lpszName, &dwSize, NULL, + NULL, NULL, NULL)) break; + + ret = action_RegDeleteTreeA(hSubKey, lpszName, access); + if (ret) goto cleanup; + } + + if (lpszSubKey) + { + if (pRegDeleteKeyExA) + ret = pRegDeleteKeyExA(hKey, lpszSubKey, access, 0); + else + ret = RegDeleteKeyA(hKey, lpszSubKey); + } + else + while (TRUE) + { + dwSize = dwMaxLen; + if (RegEnumValueA(hKey, 0, lpszName, &dwSize, + NULL, NULL, NULL, NULL)) break; + + ret = RegDeleteValueA(hKey, lpszName); + if (ret) goto cleanup; + } + +cleanup: + if (lpszName != szNameBuf) + HeapFree(GetProcessHeap(), 0, lpszName); + if(lpszSubKey) + RegCloseKey(hSubKey); + return ret; +} + /* cabinet definitions */ /* make the max size large so there is only one cab file */ @@ -1941,7 +2096,6 @@ static void init_functionpointers(void) GET_PROC(hmsi, MsiGetComponentPathExA); GET_PROC(hadvapi32, ConvertSidToStringSidA); - GET_PROC(hadvapi32, GetTokenInformation); GET_PROC(hadvapi32, OpenProcessToken); GET_PROC(hadvapi32, RegDeleteKeyExA) GET_PROC(hkernel32, IsWow64Process) @@ -1957,7 +2111,7 @@ static BOOL is_process_limited(void) { HANDLE token; - if (!pOpenProcessToken || !pGetTokenInformation) return FALSE; + if (!pOpenProcessToken) return FALSE; if (pOpenProcessToken(GetCurrentProcess(), TOKEN_QUERY, &token)) { @@ -1965,7 +2119,7 @@ static BOOL is_process_limited(void) TOKEN_ELEVATION_TYPE type = TokenElevationTypeDefault; DWORD size; - ret = pGetTokenInformation(token, TokenElevationType, &type, sizeof(type), &size); + ret = GetTokenInformation(token, TokenElevationType, &type, sizeof(type), &size); CloseHandle(token); return (ret && type == TokenElevationTypeLimited); } @@ -2245,7 +2399,7 @@ static void write_msi_summary_info(MSIHANDLE db, INT version, INT wordcount, con ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r); r = MsiSummaryInfoSetPropertyA(summary, PID_REVNUMBER, VT_LPSTR, 0, NULL, - "{004757CA-5092-49c2-AD20-28E1CE0DF5F2}"); + "{004757CA-5092-49C2-AD20-28E1CE0DF5F2}"); ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r); r = MsiSummaryInfoSetPropertyA(summary, PID_PAGECOUNT, VT_I4, version, NULL, NULL); @@ -2874,7 +3028,7 @@ currentuser: ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res); CHECK_DEL_REG_STR(hkey, "ProductName", "MSITEST"); - CHECK_DEL_REG_STR(hkey, "PackageCode", "AC75740029052c94DA02821EECD05F2F"); + CHECK_DEL_REG_STR(hkey, "PackageCode", "AC75740029052C94DA02821EECD05F2F"); CHECK_DEL_REG_DWORD(hkey, "Language", 1033); CHECK_DEL_REG_DWORD(hkey, "Version", 0x1010001); if (!old_installer) @@ -2955,7 +3109,7 @@ machprod: ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res); CHECK_DEL_REG_STR(hkey, "ProductName", "MSITEST"); - CHECK_DEL_REG_STR(hkey, "PackageCode", "AC75740029052c94DA02821EECD05F2F"); + CHECK_DEL_REG_STR(hkey, "PackageCode", "AC75740029052C94DA02821EECD05F2F"); CHECK_DEL_REG_DWORD(hkey, "Language", 1033); CHECK_DEL_REG_DWORD(hkey, "Version", 0x1010001); if (!old_installer) @@ -4572,7 +4726,7 @@ static void test_write_registry_values(void) ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res); size = MAX_PATH; - type = REG_MULTI_SZ; + type = 0xdeadbeef; memset(path, 'a', MAX_PATH); res = RegQueryValueExA(hkey, "Value", NULL, &type, (LPBYTE)path, &size); ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res); @@ -4580,9 +4734,15 @@ static void test_write_registry_values(void) ok(size == 15, "Expected 15, got %d\n", size); ok(type == REG_MULTI_SZ, "Expected REG_MULTI_SZ, got %d\n", type); + res = RegQueryValueExA(hkey, "", NULL, NULL, NULL, NULL); + ok(res == ERROR_FILE_NOT_FOUND, "Expected ERROR_FILE_NOT_FOUND, got %d\n", res); + + res = action_RegDeleteTreeA(hkey, "VisualStudio", KEY_ALL_ACCESS); + ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res); + RegDeleteValueA(hkey, "Value"); RegCloseKey(hkey); - RegDeleteKeyA(HKEY_CURRENT_USER, "SOFTWARE\\Wine\\msitest"); + RegDeleteKeyA(HKEY_LOCAL_MACHINE, "SOFTWARE\\Wine\\msitest"); error: DeleteFile(msifile); @@ -6048,6 +6208,42 @@ done: DeleteFile(msifile); } +static void test_remove_existing_products(void) +{ + UINT r; + + if (is_process_limited()) + { + skip("process is limited\n"); + return; + } + + create_test_files(); + create_file("msitest\\rep.txt", 1000); + create_database(msifile, rep_tables, sizeof(rep_tables) / sizeof(msi_table)); + + MsiSetInternalUI(INSTALLUILEVEL_NONE, NULL); + + r = MsiInstallProductA(msifile, NULL); + if (r == ERROR_INSTALL_PACKAGE_REJECTED) + { + skip("Not enough rights to perform tests\n"); + goto error; + } + ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r); + + r = MsiInstallProductA(msifile, "REMOVE=ALL"); + ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r); + + ok(!delete_pf("msitest\\rep.txt", TRUE), "file not removed\n"); + ok(!delete_pf("msitest", FALSE), "directory not removed\n"); + +error: + DeleteFileA("msitest\\rep.txt"); + delete_test_files(); + DeleteFile(msifile); +} + START_TEST(action) { DWORD len; @@ -6125,6 +6321,7 @@ START_TEST(action) test_register_extension_info(); test_register_mime_info(); test_publish_assemblies(); + test_remove_existing_products(); DeleteFileA(log_file); diff --git a/rostests/winetests/msi/automation.c b/rostests/winetests/msi/automation.c index 630ff76760b..bc0a63295a6 100644 --- a/rostests/winetests/msi/automation.c +++ b/rostests/winetests/msi/automation.c @@ -199,7 +199,7 @@ typedef struct _msi_summary_info static const msi_summary_info summary_info[] = { ADD_INFO_LPSTR(PID_TEMPLATE, ";1033"), - ADD_INFO_LPSTR(PID_REVNUMBER, "{004757CA-5092-49c2-AD20-28E1CE0DF5F2}"), + ADD_INFO_LPSTR(PID_REVNUMBER, "{004757CA-5092-49C2-AD20-28E1CE0DF5F2}"), ADD_INFO_I4(PID_PAGECOUNT, 100), ADD_INFO_I4(PID_WORDCOUNT, 0), ADD_INFO_FILETIME(PID_CREATE_DTM, &systemtime), diff --git a/rostests/winetests/msi/db.c b/rostests/winetests/msi/db.c index 4c91bd80c7d..107502f2b57 100644 --- a/rostests/winetests/msi/db.c +++ b/rostests/winetests/msi/db.c @@ -453,11 +453,9 @@ static void test_msiinsert(void) ok(r == TRUE, "file didn't exist after commit\n"); } -typedef UINT (WINAPI *fnMsiDecomposeDescriptorA)(LPCSTR, LPCSTR, LPSTR, LPSTR, DWORD *); -static fnMsiDecomposeDescriptorA pMsiDecomposeDescriptorA; - static void test_msidecomposedesc(void) { + UINT (WINAPI *pMsiDecomposeDescriptorA)(LPCSTR, LPCSTR, LPSTR, LPSTR, DWORD *); char prod[MAX_FEATURE_CHARS+1], comp[MAX_FEATURE_CHARS+1], feature[MAX_FEATURE_CHARS+1]; const char *desc; UINT r; @@ -465,8 +463,7 @@ static void test_msidecomposedesc(void) HMODULE hmod; hmod = GetModuleHandle("msi.dll"); - pMsiDecomposeDescriptorA = (fnMsiDecomposeDescriptorA) - GetProcAddress(hmod, "MsiDecomposeDescriptorA"); + pMsiDecomposeDescriptorA = (void*)GetProcAddress(hmod, "MsiDecomposeDescriptorA"); if (!pMsiDecomposeDescriptorA) return; @@ -1490,7 +1487,7 @@ static void test_longstrings(void) HeapFree(GetProcessHeap(), 0, str); - MsiDatabaseCommit(hdb); + r = MsiDatabaseCommit(hdb); ok(r == ERROR_SUCCESS, "MsiDatabaseCommit failed\n"); MsiCloseHandle(hdb); @@ -9345,7 +9342,7 @@ static void test_createtable(void) size = sizeof(buffer); res = MsiRecordGetString(hrec, 1, buffer, &size ); ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res); - todo_wine ok(!strcmp(buffer,"b"), "b != %s\n", buffer); + ok(!strcmp(buffer,"b"), "b != %s\n", buffer); res = MsiCloseHandle( hrec ); ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res); diff --git a/rostests/winetests/msi/install.c b/rostests/winetests/msi/install.c index 8e4e4b79ecc..0cf934769d6 100644 --- a/rostests/winetests/msi/install.c +++ b/rostests/winetests/msi/install.c @@ -46,7 +46,6 @@ static INSTALLSTATE (WINAPI *pMsiGetComponentPathExA) (LPCSTR, LPCSTR, LPCSTR, MSIINSTALLCONTEXT, LPSTR, LPDWORD); static BOOL (WINAPI *pConvertSidToStringSidA)(PSID, LPSTR*); -static BOOL (WINAPI *pGetTokenInformation)( HANDLE, TOKEN_INFORMATION_CLASS, LPVOID, DWORD, PDWORD ); static BOOL (WINAPI *pOpenProcessToken)( HANDLE, DWORD, PHANDLE ); static LONG (WINAPI *pRegDeleteKeyExA)(HKEY, LPCSTR, REGSAM, DWORD); static BOOL (WINAPI *pIsWow64Process)(HANDLE, PBOOL); @@ -1237,6 +1236,53 @@ static const CHAR uc_install_exec_seq_dat[] = "Action\tCondition\tSequence\n" "PublishProduct\t\t1200\n" "InstallFinalize\t\t1300\n"; +static const char mixed_feature_dat[] = + "Feature\tFeature_Parent\tTitle\tDescription\tDisplay\tLevel\tDirectory_\tAttributes\n" + "s38\tS38\tL64\tL255\tI2\ti2\tS72\ti2\n" + "Feature\tFeature\n" + "feature1\t\t\t\t1\t2\tMSITESTDIR\t0\n" + "feature2\t\t\t\t1\t2\tMSITESTDIR\t0\n"; + +static const char mixed_feature_comp_dat[] = + "Feature_\tComponent_\n" + "s38\ts72\n" + "FeatureComponents\tFeature_\tComponent_\n" + "feature1\tcomp1\n" + "feature2\tcomp2\n"; + +static const char mixed_component_dat[] = + "Component\tComponentId\tDirectory_\tAttributes\tCondition\tKeyPath\n" + "s72\tS38\ts72\ti2\tS255\tS72\n" + "Component\tComponent\n" + "comp1\t{DE9F0EF4-0ED3-495A-8105-060C0EA457B8}\tTARGETDIR\t4\t\tregdata1\n" + "comp2\t{4912DBE7-FC3A-4F91-BB5C-88F5C15C19A5}\tTARGETDIR\t260\t\tregdata2\n"; + +static const char mixed_registry_dat[] = + "Registry\tRoot\tKey\tName\tValue\tComponent_\n" + "s72\ti2\tl255\tL255\tL0\ts72\n" + "Registry\tRegistry\n" + "regdata1\t2\tSOFTWARE\\Wine\\msitest\ttest1\t\tcomp1\n" + "regdata2\t2\tSOFTWARE\\Wine\\msitest\ttest2\t\tcomp2\n"; + +static const char mixed_install_exec_seq_dat[] = + "Action\tCondition\tSequence\n" + "s72\tS255\tI2\n" + "InstallExecuteSequence\tAction\n" + "LaunchConditions\t\t100\n" + "CostInitialize\t\t200\n" + "FileCost\t\t300\n" + "CostFinalize\t\t400\n" + "InstallValidate\t\t500\n" + "InstallInitialize\t\t600\n" + "ProcessComponents\t\t700\n" + "UnpublishFeatures\t\t800\n" + "RemoveRegistryValues\t\t900\n" + "WriteRegistryValues\t\t1000\n" + "RegisterProduct\t\t1100\n" + "PublishFeatures\t\t1200\n" + "PublishProduct\t\t1300\n" + "InstallFinalize\t\t1400\n"; + typedef struct _msi_table { const CHAR *filename; @@ -1928,6 +1974,18 @@ static const msi_table uc_tables[] = ADD_TABLE(uc_property) }; +static const msi_table mixed_tables[] = +{ + ADD_TABLE(directory), + ADD_TABLE(mixed_component), + ADD_TABLE(mixed_feature), + ADD_TABLE(mixed_feature_comp), + ADD_TABLE(mixed_install_exec_seq), + ADD_TABLE(mixed_registry), + ADD_TABLE(media), + ADD_TABLE(property) +}; + /* cabinet definitions */ /* make the max size large so there is only one cab file */ @@ -2056,7 +2114,6 @@ static void init_functionpointers(void) GET_PROC(hmsi, MsiGetComponentPathExA); GET_PROC(hadvapi32, ConvertSidToStringSidA); - GET_PROC(hadvapi32, GetTokenInformation); GET_PROC(hadvapi32, OpenProcessToken); GET_PROC(hadvapi32, RegDeleteKeyExA) GET_PROC(hkernel32, IsWow64Process) @@ -2072,7 +2129,7 @@ static BOOL is_process_limited(void) { HANDLE token; - if (!pOpenProcessToken || !pGetTokenInformation) return FALSE; + if (!pOpenProcessToken) return FALSE; if (pOpenProcessToken(GetCurrentProcess(), TOKEN_QUERY, &token)) { @@ -2080,7 +2137,7 @@ static BOOL is_process_limited(void) TOKEN_ELEVATION_TYPE type = TokenElevationTypeDefault; DWORD size; - ret = pGetTokenInformation(token, TokenElevationType, &type, sizeof(type), &size); + ret = GetTokenInformation(token, TokenElevationType, &type, sizeof(type), &size); CloseHandle(token); return (ret && type == TokenElevationTypeLimited); } @@ -2403,7 +2460,7 @@ static void write_msi_summary_info(MSIHANDLE db, INT version, INT wordcount, con ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r); r = MsiSummaryInfoSetPropertyA(summary, PID_REVNUMBER, VT_LPSTR, 0, NULL, - "{004757CA-5092-49c2-AD20-28E1CE0DF5F2}"); + "{004757CA-5092-49C2-AD20-28E1CE0DF5F2}"); ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r); r = MsiSummaryInfoSetPropertyA(summary, PID_PAGECOUNT, VT_I4, version, NULL, NULL); @@ -6618,6 +6675,86 @@ static void test_MsiSetFeatureAttributes(void) DeleteFileA( msifile ); } +static void test_mixed_package(void) +{ + UINT r; + LONG res; + HKEY hkey; + + if (is_process_limited()) + { + skip("process is limited\n"); + return; + } + if (!is_wow64 && !is_64bit) + { + skip("this test must be run on 64-bit\n"); + return; + } + MsiSetInternalUI(INSTALLUILEVEL_NONE, NULL); + create_database_template(msifile, mixed_tables, sizeof(mixed_tables)/sizeof(msi_table), 200, "x64;1033"); + + r = MsiInstallProductA(msifile, NULL); + if (r == ERROR_INSTALL_PACKAGE_REJECTED) + { + skip("Not enough rights to perform tests\n"); + goto error; + } + ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r); + + res = RegOpenKeyExA(HKEY_LOCAL_MACHINE, "Software\\Wine\\msitest", 0, KEY_ALL_ACCESS|KEY_WOW64_32KEY, &hkey); + ok(!res, "can't open 32-bit component key\n"); + res = RegQueryValueExA(hkey, "test1", NULL, NULL, NULL, NULL); + ok(!res, "value test1 not found\n"); + RegCloseKey(hkey); + + res = RegOpenKeyExA(HKEY_LOCAL_MACHINE, "Software\\Wine\\msitest", 0, KEY_ALL_ACCESS|KEY_WOW64_64KEY, &hkey); + ok(!res, "can't open 64-bit component key\n"); + res = RegQueryValueExA(hkey, "test2", NULL, NULL, NULL, NULL); + ok(!res, "value test2 not found\n"); + RegCloseKey(hkey); + + r = MsiInstallProductA(msifile, "REMOVE=ALL"); + ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r); + + res = RegOpenKeyExA(HKEY_LOCAL_MACHINE, "Software\\Wine\\msitest", 0, KEY_ALL_ACCESS|KEY_WOW64_32KEY, &hkey); + ok(res == ERROR_FILE_NOT_FOUND || broken(!res), "32-bit component key not removed\n"); + + res = RegOpenKeyExA(HKEY_LOCAL_MACHINE, "Software\\Wine\\msitest", 0, KEY_ALL_ACCESS|KEY_WOW64_64KEY, &hkey); + ok(res == ERROR_FILE_NOT_FOUND, "64-bit component key not removed\n"); + + DeleteFileA( msifile ); + create_database_template(msifile, mixed_tables, sizeof(mixed_tables)/sizeof(msi_table), 200, "Intel;1033"); + + r = MsiInstallProductA(msifile, NULL); + ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r); + + res = RegOpenKeyExA(HKEY_LOCAL_MACHINE, "Software\\Wine\\msitest", 0, KEY_ALL_ACCESS|KEY_WOW64_32KEY, &hkey); + ok(!res, "can't open 32-bit component key\n"); + res = RegQueryValueExA(hkey, "test1", NULL, NULL, NULL, NULL); + ok(!res, "value test1 not found\n"); + RegCloseKey(hkey); + + res = RegOpenKeyExA(HKEY_LOCAL_MACHINE, "Software\\Wine\\msitest", 0, KEY_ALL_ACCESS|KEY_WOW64_64KEY, &hkey); + ok(!res, "can't open 64-bit component key\n"); + res = RegQueryValueExA(hkey, "test2", NULL, NULL, NULL, NULL); + ok(!res, "value test2 not found\n"); + RegCloseKey(hkey); + + r = MsiInstallProductA(msifile, "REMOVE=ALL"); + ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r); + + res = RegOpenKeyExA(HKEY_LOCAL_MACHINE, "Software\\Wine\\msitest", 0, KEY_ALL_ACCESS|KEY_WOW64_32KEY, &hkey); + ok(res == ERROR_FILE_NOT_FOUND || broken(!res), "32-bit component key not removed\n"); + + res = RegOpenKeyExA(HKEY_LOCAL_MACHINE, "Software\\Wine\\msitest", 0, KEY_ALL_ACCESS|KEY_WOW64_64KEY, &hkey); + ok(res == ERROR_FILE_NOT_FOUND, "64-bit component key not removed\n"); + +error: + DeleteFileA( msifile ); + return; +} + START_TEST(install) { DWORD len; @@ -6709,6 +6846,7 @@ START_TEST(install) test_upgrade_code(); test_MsiGetFeatureInfo(); test_MsiSetFeatureAttributes(); + test_mixed_package(); DeleteFileA(log_file); diff --git a/rostests/winetests/msi/package.c b/rostests/winetests/msi/package.c index 8cf8f27a096..92a0f9a13a0 100644 --- a/rostests/winetests/msi/package.c +++ b/rostests/winetests/msi/package.c @@ -40,7 +40,6 @@ static INSTALLSTATE (WINAPI *pMsiGetComponentPathExA)(LPCSTR, LPCSTR, LPCSTR, MS static HRESULT (WINAPI *pSHGetFolderPathA)(HWND, int, HANDLE, DWORD, LPSTR); static BOOL (WINAPI *pConvertSidToStringSidA)(PSID, LPSTR*); -static BOOL (WINAPI *pGetTokenInformation)( HANDLE, TOKEN_INFORMATION_CLASS, LPVOID, DWORD, PDWORD ); static BOOL (WINAPI *pOpenProcessToken)( HANDLE, DWORD, PHANDLE ); static LONG (WINAPI *pRegDeleteKeyExA)(HKEY, LPCSTR, REGSAM, DWORD); static LONG (WINAPI *pRegDeleteKeyExW)(HKEY, LPCWSTR, REGSAM, DWORD); @@ -68,7 +67,6 @@ static void init_functionpointers(void) GET_PROC(hshell32, SHGetFolderPathA); GET_PROC(hadvapi32, ConvertSidToStringSidA); - GET_PROC(hadvapi32, GetTokenInformation); GET_PROC(hadvapi32, OpenProcessToken); GET_PROC(hadvapi32, RegDeleteKeyExA) GET_PROC(hadvapi32, RegDeleteKeyExW) @@ -87,7 +85,7 @@ static BOOL is_process_limited(void) { HANDLE token; - if (!pOpenProcessToken || !pGetTokenInformation) return FALSE; + if (!pOpenProcessToken) return FALSE; if (pOpenProcessToken(GetCurrentProcess(), TOKEN_QUERY, &token)) { @@ -95,7 +93,7 @@ static BOOL is_process_limited(void) TOKEN_ELEVATION_TYPE type = TokenElevationTypeDefault; DWORD size; - ret = pGetTokenInformation(token, TokenElevationType, &type, sizeof(type), &size); + ret = GetTokenInformation(token, TokenElevationType, &type, sizeof(type), &size); CloseHandle(token); return (ret && type == TokenElevationTypeLimited); } @@ -2445,7 +2443,7 @@ static void test_msipackage(void) ok(r == ERROR_INSTALL_PACKAGE_INVALID, "Expected ERROR_INSTALL_PACKAGE_INVALID, got %d\n", r); - set_summary_str(hdb, PID_REVNUMBER, "{004757CD-5092-49c2-AD20-28E1CE0DF5F2}"); + set_summary_str(hdb, PID_REVNUMBER, "{004757CD-5092-49C2-AD20-28E1CE0DF5F2}"); r = MsiOpenPackage(name, &hpack); ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r); diff --git a/rostests/winetests/msi/patch.c b/rostests/winetests/msi/patch.c index 89d5bd0aae1..81ef949d882 100644 --- a/rostests/winetests/msi/patch.c +++ b/rostests/winetests/msi/patch.c @@ -35,7 +35,6 @@ 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"; @@ -152,7 +151,6 @@ static void init_function_pointers( void ) GET_PROC( hmsi, MsiGetPatchInfoExA ); GET_PROC( hmsi, MsiEnumPatchesExA ); - GET_PROC( hadvapi32, GetTokenInformation ); GET_PROC( hadvapi32, OpenProcessToken ); #undef GET_PROC } @@ -161,7 +159,7 @@ static BOOL is_process_limited(void) { HANDLE token; - if (!pOpenProcessToken || !pGetTokenInformation) return FALSE; + if (!pOpenProcessToken) return FALSE; if (pOpenProcessToken(GetCurrentProcess(), TOKEN_QUERY, &token)) { @@ -169,7 +167,7 @@ static BOOL is_process_limited(void) TOKEN_ELEVATION_TYPE type = TokenElevationTypeDefault; DWORD size; - ret = pGetTokenInformation(token, TokenElevationType, &type, sizeof(type), &size); + ret = GetTokenInformation(token, TokenElevationType, &type, sizeof(type), &size); CloseHandle(token); return (ret && type == TokenElevationTypeLimited); } diff --git a/rostests/winetests/msi/suminfo.c b/rostests/winetests/msi/suminfo.c index 76dac57c4e7..0ae2a3aa6d6 100644 --- a/rostests/winetests/msi/suminfo.c +++ b/rostests/winetests/msi/suminfo.c @@ -254,7 +254,7 @@ static void test_suminfo(void) ok(r == ERROR_SUCCESS, "MsiCloseHandle failed\n"); /* filename, non-zero update count */ - MsiGetSummaryInformation(0, msifile, 1, &hsuminfo); + r = MsiGetSummaryInformation(0, msifile, 1, &hsuminfo); ok(r == ERROR_SUCCESS, "MsiGetSummaryInformation failed\n"); r = MsiSummaryInfoSetProperty(hsuminfo, PID_AUTHOR, VT_LPSTR, 1, &ft, "Mike"); @@ -267,7 +267,7 @@ static void test_suminfo(void) ok(r == ERROR_SUCCESS, "MsiCloseHandle failed %u\n", r); /* filename, zero update count */ - MsiGetSummaryInformation(0, msifile, 0, &hsuminfo); + r = MsiGetSummaryInformation(0, msifile, 0, &hsuminfo); ok(r == ERROR_SUCCESS, "MsiGetSummaryInformation failed %u\n", r); r = MsiSummaryInfoSetProperty(hsuminfo, PID_AUTHOR, VT_LPSTR, 1, &ft, "Mike");