From: Amine Khaldi Date: Wed, 23 Apr 2014 14:49:34 +0000 (+0000) Subject: [MSI_WINETEST] X-Git-Tag: backups/0.3.17@66124~1576 X-Git-Url: https://git.reactos.org/?p=reactos.git;a=commitdiff_plain;h=eb60a4d16e9e126f759190687d56e8a7c1a81daa [MSI_WINETEST] * Sync with Wine 1.7.17. CORE-8080 svn path=/trunk/; revision=62919 --- diff --git a/rostests/winetests/msi/CMakeLists.txt b/rostests/winetests/msi/CMakeLists.txt index 425c0d55f2a..c3f0d0f0e8d 100644 --- a/rostests/winetests/msi/CMakeLists.txt +++ b/rostests/winetests/msi/CMakeLists.txt @@ -1,5 +1,7 @@ -add_definitions(-DUSE_WINE_TODOS) +add_definitions( + -DUSE_WINE_TODOS + -D__WINESRC__) list(APPEND SOURCE action.c diff --git a/rostests/winetests/msi/action.c b/rostests/winetests/msi/action.c index 3019b1429dc..23918b9547b 100644 --- a/rostests/winetests/msi/action.c +++ b/rostests/winetests/msi/action.c @@ -42,6 +42,7 @@ static INSTALLSTATE (WINAPI *pMsiGetComponentPathExA) static UINT (WINAPI *pMsiQueryFeatureStateExA) (LPCSTR, LPCSTR, MSIINSTALLCONTEXT, LPCSTR, INSTALLSTATE *); +static BOOL (WINAPI *pCheckTokenMembership)(HANDLE,PSID,PBOOL); static BOOL (WINAPI *pConvertSidToStringSidA)(PSID, LPSTR *); static BOOL (WINAPI *pOpenProcessToken)(HANDLE, DWORD, PHANDLE); static LONG (WINAPI *pRegDeleteKeyExA)(HKEY, LPCSTR, REGSAM, DWORD); @@ -75,7 +76,8 @@ static const char component_dat[] = "dangler\t{6091DF25-EF96-45F1-B8E9-A9B1420C7A3C}\tTARGETDIR\t4\t\tregdata\n" "component\t\tMSITESTDIR\t0\t1\tfile\n" "service_comp\t{935A0A91-22A3-4F87-BCA8-928FFDFE2353}\tMSITESTDIR\t0\t\tservice_file\n" - "service_comp2\t{3F7B04A4-9521-4649-BDC9-0C8722740A49}\tMSITESTDIR\t0\t\tservice_file2"; + "service_comp2\t{3F7B04A4-9521-4649-BDC9-0C8722740A49}\tMSITESTDIR\t0\t\tservice_file2\n" + "service_comp3\t{DBCD1502-20E3-423F-B53E-F37E263CDC7E}\tMSITESTDIR\t0\t\t\n"; static const char directory_dat[] = "Directory\tDirectory_Parent\tDefaultDir\n" @@ -112,7 +114,8 @@ static const char feature_comp_dat[] = "Two\tTwo\n" "feature\tcomponent\n" "service_feature\tservice_comp\n" - "service_feature\tservice_comp2"; + "service_feature\tservice_comp2\n" + "service_feature\tservice_comp3"; static const char file_dat[] = "File\tComponent_\tFileName\tFileSize\tVersion\tLanguage\tAttributes\tSequence\n" @@ -220,6 +223,14 @@ static const char service_install_dat[] = "TestService\t[SERVNAME]\t[SERVDISP]\t2\t3\t0\t\tservice1[~]+group1[~]service2[~]+group2[~][~]\tTestService\t\t-a arg\tservice_comp\tdescription\n" "TestService2\tSERVNAME2]\t[SERVDISP2]\t2\t3\t0\t\tservice1[~]+group1[~]service2[~]+group2[~][~]\tTestService2\t\t-a arg\tservice_comp2\tdescription"; +static const char service_install2_dat[] = + "ServiceInstall\tName\tDisplayName\tServiceType\tStartType\tErrorControl\t" + "LoadOrderGroup\tDependencies\tStartName\tPassword\tArguments\tComponent_\tDescription\n" + "s72\ts255\tL255\ti4\ti4\ti4\tS255\tS255\tS255\tS255\tS255\ts72\tL255\n" + "ServiceInstall\tServiceInstall\n" + "TestService\tTestService\tTestService\t2\t3\t0\t\t\tTestService\t\t\tservice_comp\t\n" + "TestService4\tTestService4\tTestService4\t2\t3\t0\t\t\tTestService4\t\t\tservice_comp3\t\n"; + static const char service_control_dat[] = "ServiceControl\tName\tEvent\tArguments\tWait\tComponent_\n" "s72\tl255\ti2\tL255\tI2\ts72\n" @@ -1317,6 +1328,95 @@ static const char rei_install_exec_seq_dat[] = "PublishProduct\t\t5200\n" "InstallFinalize\t\t6000\n"; +static const char rpi_file_dat[] = + "File\tComponent_\tFileName\tFileSize\tVersion\tLanguage\tAttributes\tSequence\n" + "s72\ts72\tl255\ti4\tS72\tS20\tI2\ti2\n" + "File\tFile\n" + "progid.txt\tprogid\tprogid.txt\t1000\t\t\t8192\t1\n"; + +static const char rpi_feature_dat[] = + "Feature\tFeature_Parent\tTitle\tDescription\tDisplay\tLevel\tDirectory_\tAttributes\n" + "s38\tS38\tL64\tL255\tI2\ti2\tS72\ti2\n" + "Feature\tFeature\n" + "progid\t\t\tprogid feature\t1\t2\tMSITESTDIR\t0\n"; + +static const char rpi_feature_comp_dat[] = + "Feature_\tComponent_\n" + "s38\ts72\n" + "FeatureComponents\tFeature_\tComponent_\n" + "progid\tprogid\n"; + +static const char rpi_component_dat[] = + "Component\tComponentId\tDirectory_\tAttributes\tCondition\tKeyPath\n" + "s72\tS38\ts72\ti2\tS255\tS72\n" + "Component\tComponent\n" + "progid\t{89A98345-F8A1-422E-A48B-0250B5809F2D}\tMSITESTDIR\t0\t\tprogid.txt\n"; + +static const char rpi_appid_dat[] = + "AppId\tRemoteServerName\tLocalService\tServiceParameters\tDllSurrogate\tActivateAtStorage\tRunAsInteractiveUser\n" + "s38\tS255\tS255\tS255\tS255\tI2\tI2\n" + "AppId\tAppId\n" + "{CFCC3B38-E683-497D-9AB4-CB40AAFE307F}\t\t\t\t\t\t\n"; + +static const char rpi_class_dat[] = + "CLSID\tContext\tComponent_\tProgId_Default\tDescription\tAppId_\tFileTypeMask\tIcon_\tIconIndex\tDefInprocHandler\tArgument\tFeature_\tAttributes\n" + "s38\ts32\ts72\tS255\tL255\tS38\tS255\tS72\tI2\tS32\tS255\ts38\tI2\n" + "Class\tCLSID\tContext\tComponent_\n" + "{110913E7-86D1-4BF3-9922-BA103FCDDDFA}\tLocalServer\tprogid\tWinetest.Class.1\tdescription\t{CFCC3B38-E683-497D-9AB4-CB40AAFE307F}\tmask1;mask2\t\t\t2\t\tprogid\t\n" + "{904E6BC9-F57F-4412-B460-D40DE2F256E2}\tLocalServer\tprogid\tWinetest.VerClass\tdescription\t{CFCC3B38-E683-497D-9AB4-CB40AAFE307F}\tmask1;mask2\t\t\t2\t\tprogid\t\n" + "{57C413FB-CA02-498A-81F6-7E769BDB7C97}\tLocalServer\tprogid\t\tdescription\t{CFCC3B38-E683-497D-9AB4-CB40AAFE307F}\tmask1;mask2\t\t\t2\t\tprogid\t\n"; + +static const char rpi_extension_dat[] = + "Extension\tComponent_\tProgId_\tMIME_\tFeature_\n" + "s255\ts72\tS255\tS64\ts38\n" + "Extension\tExtension\tComponent_\n" + "winetest\tprogid\tWinetest.Extension\t\tprogid\n"; + +static const char rpi_verb_dat[] = + "Extension_\tVerb\tSequence\tCommand\tArgument\n" + "s255\ts32\tI2\tL255\tL255\n" + "Verb\tExtension_\tVerb\n" + "winetest\tOpen\t1\t&Open\t/argument\n"; + +static const char rpi_progid_dat[] = + "ProgId\tProgId_Parent\tClass_\tDescription\tIcon_\tIconIndex\n" + "s255\tS255\tS38\tL255\tS72\tI2\n" + "ProgId\tProgId\n" + "Winetest.Class.1\t\t{110913E7-86D1-4BF3-9922-BA103FCDDDFA}\tdescription\t\t\n" + "Winetest.Class\tWinetest.Class.1\t\tdescription\t\t\n" + "Winetest.Class.2\t\t{110913E7-86D1-4BF3-9922-BA103FCDDDFA}\tdescription\t\t\n" + "Winetest.VerClass.1\t\t{904E6BC9-F57F-4412-B460-D40DE2F256E2}\tdescription\t\t\n" + "Winetest.VerClass\tWinetest.VerClass.1\t\tdescription\t\t\n" + "Winetest.NoProgIdClass.1\t\t{57C413FB-CA02-498A-81F6-7E769BDB7C97}\tdescription\t\t\n" + "Winetest.NoProgIdClass\tWinetest.NoProgIdClass.1\t\tdescription\t\t\n" + "Winetest.Orphaned\t\t\tdescription\t\t\n" + "Winetest.Orphaned2\t\t\tdescription\t\t\n" + "Winetest.Extension\t\t\tdescription\t\t\n"; + +static const char rpi_install_exec_seq_dat[] = + "Action\tCondition\tSequence\n" + "s72\tS255\tI2\n" + "InstallExecuteSequence\tAction\n" + "LaunchConditions\t\t100\n" + "CostInitialize\t\t800\n" + "FileCost\t\t900\n" + "CostFinalize\t\t1000\n" + "InstallValidate\t\t1400\n" + "InstallInitialize\t\t1500\n" + "ProcessComponents\t\t1600\n" + "RemoveFiles\t\t1700\n" + "UnregisterClassInfo\t\t3000\n" + "UnregisterExtensionInfo\t\t3200\n" + "UnregisterProgIdInfo\t\t3400\n" + "InstallFiles\t\t3600\n" + "RegisterClassInfo\t\t4000\n" + "RegisterExtensionInfo\t\t4200\n" + "RegisterProgIdInfo\t\t4400\n" + "RegisterProduct\t\t5000\n" + "PublishFeatures\t\t5100\n" + "PublishProduct\t\t5200\n" + "InstallFinalize\t\t6000\n"; + static const char rmi_file_dat[] = "File\tComponent_\tFileName\tFileSize\tVersion\tLanguage\tAttributes\tSequence\n" "s72\ts72\tl255\ti4\tS72\tS20\tI2\ti2\n" @@ -1678,6 +1778,19 @@ static const msi_table sds_tables[] = ADD_TABLE(property) }; +static const msi_table sis_tables[] = +{ + ADD_TABLE(component), + ADD_TABLE(directory), + ADD_TABLE(feature), + ADD_TABLE(feature_comp), + ADD_TABLE(file), + ADD_TABLE(sds_install_exec_seq), + ADD_TABLE(service_install2), + ADD_TABLE(media), + ADD_TABLE(property) +}; + static const msi_table sr_tables[] = { ADD_TABLE(component), @@ -1868,6 +1981,23 @@ static const msi_table rei_tables[] = ADD_TABLE(property) }; +static const msi_table rpi_tables[] = +{ + ADD_TABLE(directory), + ADD_TABLE(rpi_component), + ADD_TABLE(rpi_feature), + ADD_TABLE(rpi_feature_comp), + ADD_TABLE(rpi_file), + ADD_TABLE(rpi_appid), + ADD_TABLE(rpi_class), + ADD_TABLE(rpi_extension), + ADD_TABLE(rpi_verb), + ADD_TABLE(rpi_progid), + ADD_TABLE(rpi_install_exec_seq), + ADD_TABLE(media), + ADD_TABLE(property) +}; + static const msi_table rmi_tables[] = { ADD_TABLE(directory), @@ -2105,6 +2235,7 @@ static void init_functionpointers(void) GET_PROC(hmsi, MsiGetComponentPathExA); GET_PROC(hmsi, MsiQueryFeatureStateExA); + GET_PROC(hadvapi32, CheckTokenMembership); GET_PROC(hadvapi32, ConvertSidToStringSidA); GET_PROC(hadvapi32, OpenProcessToken); GET_PROC(hadvapi32, RegDeleteKeyExA) @@ -2119,9 +2250,26 @@ static void init_functionpointers(void) static BOOL is_process_limited(void) { + SID_IDENTIFIER_AUTHORITY NtAuthority = {SECURITY_NT_AUTHORITY}; + PSID Group; + BOOL IsInGroup; HANDLE token; - if (!pOpenProcessToken) return FALSE; + if (!pCheckTokenMembership || !pOpenProcessToken) return FALSE; + + if (!AllocateAndInitializeSid(&NtAuthority, 2, SECURITY_BUILTIN_DOMAIN_RID, + DOMAIN_ALIAS_RID_ADMINS, + 0, 0, 0, 0, 0, 0, &Group) || + !pCheckTokenMembership(NULL, Group, &IsInGroup)) + { + trace("Could not check if the current user is an administrator\n"); + return FALSE; + } + if (!IsInGroup) + { + /* Only administrators have enough privileges for these tests */ + return TRUE; + } if (pOpenProcessToken(GetCurrentProcess(), TOKEN_QUERY, &token)) { @@ -2188,8 +2336,8 @@ static INT_PTR CDECL get_open_info(char *pszName, USHORT *pdate, USHORT *ptime, DWORD attrs; BOOL res; - handle = CreateFile(pszName, GENERIC_READ, FILE_SHARE_READ, NULL, - OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL | FILE_FLAG_SEQUENTIAL_SCAN, NULL); + handle = CreateFileA(pszName, GENERIC_READ, FILE_SHARE_READ, NULL, + OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL | FILE_FLAG_SEQUENTIAL_SCAN, NULL); ok(handle != INVALID_HANDLE_VALUE, "Failed to CreateFile %s\n", pszName); @@ -2199,7 +2347,7 @@ static INT_PTR CDECL get_open_info(char *pszName, USHORT *pdate, USHORT *ptime, FileTimeToLocalFileTime(&finfo.ftLastWriteTime, &filetime); FileTimeToDosDateTime(&filetime, pdate, ptime); - attrs = GetFileAttributes(pszName); + attrs = GetFileAttributesA(pszName); ok(attrs != INVALID_FILE_ATTRIBUTES, "Failed to GetFileAttributes\n"); return (INT_PTR)handle; @@ -2254,7 +2402,7 @@ static void create_cab_file(const CHAR *name, DWORD max_size, const CHAR *files) { res = add_file(hfci, ptr, tcompTYPE_MSZIP); ok(res, "Failed to add file: %s\n", ptr); - ptr += lstrlen(ptr) + 1; + ptr += lstrlenA(ptr) + 1; } res = FCIFlushCabinet(hfci, FALSE, get_next_cabinet, progress); @@ -2269,8 +2417,8 @@ static BOOL get_user_dirs(void) HKEY hkey; DWORD type, size; - if (RegOpenKey(HKEY_CURRENT_USER, - "Software\\Microsoft\\Windows\\CurrentVersion\\Explorer\\Shell Folders", &hkey)) + if (RegOpenKeyA(HKEY_CURRENT_USER, + "Software\\Microsoft\\Windows\\CurrentVersion\\Explorer\\Shell Folders", &hkey)) return FALSE; size = MAX_PATH; @@ -2289,8 +2437,8 @@ static BOOL get_system_dirs(void) HKEY hkey; DWORD type, size; - if (RegOpenKey(HKEY_LOCAL_MACHINE, - "Software\\Microsoft\\Windows\\CurrentVersion", &hkey)) + if (RegOpenKeyA(HKEY_LOCAL_MACHINE, + "Software\\Microsoft\\Windows\\CurrentVersion", &hkey)) return FALSE; size = MAX_PATH; @@ -2392,7 +2540,7 @@ static void delete_test_files(void) static void write_file(const CHAR *filename, const char *data, int data_size) { DWORD size; - HANDLE hf = CreateFile(filename, GENERIC_WRITE, 0, NULL, CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL); + HANDLE hf = CreateFileA(filename, GENERIC_WRITE, 0, NULL, CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL); WriteFile(hf, data, data_size, &size, NULL); CloseHandle(hf); } @@ -2440,9 +2588,14 @@ static void create_database_wordcount(const CHAR *name, const msi_table *tables, { MSIHANDLE db; UINT r; - int j; + WCHAR *nameW; + int j, len; - r = MsiOpenDatabaseA(name, MSIDBOPEN_CREATE, &db); + len = MultiByteToWideChar( CP_ACP, 0, name, -1, NULL, 0 ); + if (!(nameW = HeapAlloc( GetProcessHeap(), 0, len * sizeof(WCHAR) ))) return; + MultiByteToWideChar( CP_ACP, 0, name, -1, nameW, len ); + + r = MsiOpenDatabaseW(nameW, MSIDBOPEN_CREATE, &db); ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r); /* import the tables into the database */ @@ -2464,6 +2617,7 @@ static void create_database_wordcount(const CHAR *name, const msi_table *tables, ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r); MsiCloseHandle(db); + HeapFree( GetProcessHeap(), 0, nameW ); } static BOOL notify_system_change(DWORD event_type, STATEMGRSTATUS *status) @@ -2496,7 +2650,7 @@ static LONG delete_key( HKEY key, LPCSTR subkey, REGSAM access ) static BOOL file_exists(LPCSTR file) { - return GetFileAttributes(file) != INVALID_FILE_ATTRIBUTES; + return GetFileAttributesA(file) != INVALID_FILE_ATTRIBUTES; } static BOOL pf_exists(LPCSTR file) @@ -2512,7 +2666,7 @@ static BOOL pf_exists(LPCSTR file) static void delete_pfmsitest_files(void) { - SHFILEOPSTRUCT shfl; + SHFILEOPSTRUCTA shfl; CHAR path[MAX_PATH+11]; lstrcpyA(path, PROG_FILES_DIR); @@ -2525,7 +2679,7 @@ static void delete_pfmsitest_files(void) shfl.pTo = NULL; shfl.fFlags = FOF_FILESONLY | FOF_NOCONFIRMATION | FOF_NORECURSION | FOF_SILENT | FOF_NOERRORUI; - SHFileOperation(&shfl); + SHFileOperationA(&shfl); lstrcpyA(path, PROG_FILES_DIR); lstrcatA(path, "\\msitest"); @@ -2701,7 +2855,7 @@ static void test_register_product(void) return; get_date_str(date); - GetTempPath(MAX_PATH, temp); + GetTempPathA(MAX_PATH, temp); CreateDirectoryA("msitest", NULL); create_file("msitest\\maximus", 500); @@ -2941,14 +3095,28 @@ static void test_register_product(void) RegCloseKey(hkey); error: - DeleteFile(msifile); - DeleteFile("msitest\\maximus"); - RemoveDirectory("msitest"); + DeleteFileA(msifile); + DeleteFileA("msitest\\maximus"); + RemoveDirectoryA("msitest"); HeapFree(GetProcessHeap(), 0, usersid); } static void test_publish_product(void) { + static const char prodpath[] = + "Software\\Microsoft\\Windows\\CurrentVersion\\Installer\\UserData\\%s\\Products" + "\\84A88FD7F6998CE40A22FB59F6B9C2BB"; + static const char cuprodpath[] = + "Software\\Microsoft\\Installer\\Products\\84A88FD7F6998CE40A22FB59F6B9C2BB"; + static const char cuupgrades[] = + "Software\\Microsoft\\Installer\\UpgradeCodes\\51AAE0C44620A5E4788506E91F249BD2"; + static const char badprod[] = + "Software\\Microsoft\\Windows\\CurrentVersion\\Installer\\Products" + "\\84A88FD7F6998CE40A22FB59F6B9C2BB"; + static const char machprod[] = + "Software\\Classes\\Installer\\Products\\84A88FD7F6998CE40A22FB59F6B9C2BB"; + static const char machup[] = + "Software\\Classes\\Installer\\UpgradeCodes\\51AAE0C44620A5E4788506E91F249BD2"; UINT r; LONG res; LPSTR usersid; @@ -2960,19 +3128,6 @@ static void test_publish_product(void) BOOL old_installer = FALSE; REGSAM access = KEY_ALL_ACCESS; - static const CHAR prodpath[] = "Software\\Microsoft\\Windows\\CurrentVersion" - "\\Installer\\UserData\\%s\\Products" - "\\84A88FD7F6998CE40A22FB59F6B9C2BB"; - static const CHAR cuprodpath[] = "Software\\Microsoft\\Installer\\Products" - "\\84A88FD7F6998CE40A22FB59F6B9C2BB"; - static const CHAR cuupgrades[] = "Software\\Microsoft\\Installer\\UpgradeCodes" - "\\51AAE0C44620A5E4788506E91F249BD2"; - static const CHAR badprod[] = "Software\\Microsoft\\Windows\\CurrentVersion" - "\\Installer\\Products" - "\\84A88FD7F6998CE40A22FB59F6B9C2BB"; - static const CHAR machprod[] = "Software\\Classes\\Installer\\Products\\84A88FD7F6998CE40A22FB59F6B9C2BB"; - static const CHAR machup[] = "Software\\Classes\\Installer\\UpgradeCodes\\51AAE0C44620A5E4788506E91F249BD2"; - if (is_process_limited()) { skip("process is limited\n"); @@ -2982,7 +3137,7 @@ static void test_publish_product(void) if (!(usersid = get_user_sid())) return; - GetTempPath(MAX_PATH, temp); + GetTempPathA(MAX_PATH, temp); CreateDirectoryA("msitest", NULL); create_file("msitest\\maximus", 500); @@ -3181,14 +3336,26 @@ machprod: RegCloseKey(hkey); error: - DeleteFile(msifile); - DeleteFile("msitest\\maximus"); - RemoveDirectory("msitest"); + DeleteFileA(msifile); + DeleteFileA("msitest\\maximus"); + RemoveDirectoryA("msitest"); HeapFree(GetProcessHeap(), 0, usersid); } static void test_publish_features(void) { + static const char cupath[] = + "Software\\Microsoft\\Installer\\Features\\84A88FD7F6998CE40A22FB59F6B9C2BB"; + static const char udfeatpath[] = + "Software\\Microsoft\\Windows\\CurrentVersion\\Installer\\UserData\\%s\\Products" + "\\84A88FD7F6998CE40A22FB59F6B9C2BB\\Features"; + static const char udpridpath[] = + "Software\\Microsoft\\Windows\\CurrentVersion\\Installer\\UserData\\%s\\Products" + "\\84A88FD7F6998CE40A22FB59F6B9C2BB"; + static const char featkey[] = + "Software\\Microsoft\\Windows\\CurrentVersion\\Installer\\Features"; + static const char classfeat[] = + "Software\\Classes\\Installer\\Features\\84A88FD7F6998CE40A22FB59F6B9C2BB"; UINT r; LONG res; HKEY hkey; @@ -3196,19 +3363,6 @@ static void test_publish_features(void) CHAR keypath[MAX_PATH]; REGSAM access = KEY_ALL_ACCESS; - static const CHAR cupath[] = "Software\\Microsoft\\Installer\\Features" - "\\84A88FD7F6998CE40A22FB59F6B9C2BB"; - static const CHAR udfeatpath[] = "Software\\Microsoft\\Windows\\CurrentVersion" - "\\Installer\\UserData\\%s\\Products" - "\\84A88FD7F6998CE40A22FB59F6B9C2BB\\Features"; - static const CHAR udpridpath[] = "Software\\Microsoft\\Windows\\CurrentVersion" - "\\Installer\\UserData\\%s\\Products" - "\\84A88FD7F6998CE40A22FB59F6B9C2BB"; - static const CHAR featkey[] = "Software\\Microsoft\\Windows\\CurrentVersion" - "\\Installer\\Features"; - static const CHAR classfeat[] = "Software\\Classes\\Installer\\Features" - "\\84A88FD7F6998CE40A22FB59F6B9C2BB"; - if (is_process_limited()) { skip("process is limited\n"); @@ -3307,9 +3461,9 @@ static void test_publish_features(void) delete_key(HKEY_LOCAL_MACHINE, keypath, access); error: - DeleteFile(msifile); - DeleteFile("msitest\\maximus"); - RemoveDirectory("msitest"); + DeleteFileA(msifile); + DeleteFileA("msitest\\maximus"); + RemoveDirectoryA("msitest"); HeapFree(GetProcessHeap(), 0, usersid); } @@ -3467,14 +3621,18 @@ error: HeapFree(GetProcessHeap(), 0, company); HeapFree(GetProcessHeap(), 0, owner); - DeleteFile(msifile); - DeleteFile("msitest\\maximus"); - RemoveDirectory("msitest"); + DeleteFileA(msifile); + DeleteFileA("msitest\\maximus"); + RemoveDirectoryA("msitest"); LocalFree(usersid); } static void test_process_components(void) { + static const char keyfmt[] = + "Software\\Microsoft\\Windows\\CurrentVersion\\Installer\\UserData\\%s\\Components\\%s"; + static const char compkey[] = + "Software\\Microsoft\\Windows\\CurrentVersion\\Installer\\Components"; UINT r; LONG res; DWORD size; @@ -3485,12 +3643,6 @@ static void test_process_components(void) CHAR program_files_maximus[MAX_PATH]; REGSAM access = KEY_ALL_ACCESS; - static const CHAR keyfmt[] = - "Software\\Microsoft\\Windows\\CurrentVersion\\Installer\\" - "UserData\\%s\\Components\\%s"; - static const CHAR compkey[] = - "Software\\Microsoft\\Windows\\CurrentVersion\\Installer\\Components"; - if (is_process_limited()) { skip("process is limited\n"); @@ -3604,9 +3756,9 @@ static void test_process_components(void) RegCloseKey(comp); error: - DeleteFile(msifile); - DeleteFile("msitest\\maximus"); - RemoveDirectory("msitest"); + DeleteFileA(msifile); + DeleteFileA("msitest\\maximus"); + RemoveDirectoryA("msitest"); LocalFree(usersid); } @@ -3634,7 +3786,7 @@ static void test_publish(void) } get_date_str(date); - GetTempPath(MAX_PATH, temp); + GetTempPathA(MAX_PATH, temp); if (is_wow64) access |= KEY_WOW64_64KEY; @@ -3655,10 +3807,10 @@ static void test_publish(void) MsiSetInternalUI(INSTALLUILEVEL_NONE, NULL); - state = MsiQueryProductState(prodcode); + state = MsiQueryProductStateA(prodcode); ok(state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state); - state = MsiQueryFeatureState(prodcode, "feature"); + state = MsiQueryFeatureStateA(prodcode, "feature"); ok(state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state); state = 0xdead; @@ -3685,10 +3837,10 @@ static void test_publish(void) ok(state == 0xdead, "got %d\n", state); ok(error == ERROR_SUCCESS, "got %u\n", error); - state = MsiQueryFeatureState(prodcode, "feature"); + state = MsiQueryFeatureStateA(prodcode, "feature"); ok(state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state); - state = MsiQueryFeatureState(prodcode, "montecristo"); + state = MsiQueryFeatureStateA(prodcode, "montecristo"); ok(state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state); r = pMsiQueryComponentStateA(prodcode, NULL, MSIINSTALLCONTEXT_USERUNMANAGED, @@ -3710,13 +3862,13 @@ static void test_publish(void) ok(pf_exists("msitest\\maximus"), "File not installed\n"); ok(pf_exists("msitest"), "File not installed\n"); - state = MsiQueryProductState(prodcode); + state = MsiQueryProductStateA(prodcode); ok(state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state); - state = MsiQueryFeatureState(prodcode, "feature"); + state = MsiQueryFeatureStateA(prodcode, "feature"); ok(state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state); - state = MsiQueryFeatureState(prodcode, "montecristo"); + state = MsiQueryFeatureStateA(prodcode, "montecristo"); ok(state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state); r = pMsiQueryComponentStateA(prodcode, NULL, MSIINSTALLCONTEXT_USERUNMANAGED, @@ -3733,13 +3885,13 @@ static void test_publish(void) ok(pf_exists("msitest\\maximus"), "File not installed\n"); ok(pf_exists("msitest"), "File not installed\n"); - state = MsiQueryProductState(prodcode); + state = MsiQueryProductStateA(prodcode); ok(state == INSTALLSTATE_DEFAULT, "Expected INSTALLSTATE_DEFAULT, got %d\n", state); - state = MsiQueryFeatureState(prodcode, "feature"); + state = MsiQueryFeatureStateA(prodcode, "feature"); ok(state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state); - state = MsiQueryFeatureState(prodcode, "montecristo"); + state = MsiQueryFeatureStateA(prodcode, "montecristo"); ok(state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state); r = pMsiQueryComponentStateA(prodcode, NULL, MSIINSTALLCONTEXT_USERUNMANAGED, @@ -3794,13 +3946,13 @@ static void test_publish(void) ok(pf_exists("msitest\\maximus"), "File deleted\n"); ok(pf_exists("msitest"), "File deleted\n"); - state = MsiQueryProductState(prodcode); + state = MsiQueryProductStateA(prodcode); ok(state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state); - state = MsiQueryFeatureState(prodcode, "feature"); + state = MsiQueryFeatureStateA(prodcode, "feature"); ok(state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state); - state = MsiQueryFeatureState(prodcode, "montecristo"); + state = MsiQueryFeatureStateA(prodcode, "montecristo"); ok(state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state); r = pMsiQueryComponentStateA(prodcode, NULL, MSIINSTALLCONTEXT_USERUNMANAGED, @@ -3817,10 +3969,10 @@ static void test_publish(void) ok(pf_exists("msitest\\maximus"), "File not installed\n"); ok(pf_exists("msitest"), "File not installed\n"); - state = MsiQueryProductState(prodcode); + state = MsiQueryProductStateA(prodcode); ok(state == INSTALLSTATE_DEFAULT, "Expected INSTALLSTATE_DEFAULT, got %d\n", state); - state = MsiQueryFeatureState(prodcode, "feature"); + state = MsiQueryFeatureStateA(prodcode, "feature"); ok(state == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", state); state = 0xdead; @@ -3847,7 +3999,7 @@ static void test_publish(void) ok(state == INSTALLSTATE_LOCAL, "got %d\n", state); ok(error == ERROR_SUCCESS, "got %u\n", error); - state = MsiQueryFeatureState(prodcode, "montecristo"); + state = MsiQueryFeatureStateA(prodcode, "montecristo"); ok(state == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", state); r = pMsiQueryComponentStateA(prodcode, NULL, MSIINSTALLCONTEXT_USERUNMANAGED, @@ -3901,13 +4053,13 @@ static void test_publish(void) ok(!pf_exists("msitest\\maximus"), "File not deleted\n"); ok(!pf_exists("msitest"), "Directory not deleted\n"); - state = MsiQueryProductState(prodcode); + state = MsiQueryProductStateA(prodcode); ok(state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state); - state = MsiQueryFeatureState(prodcode, "feature"); + state = MsiQueryFeatureStateA(prodcode, "feature"); ok(state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state); - state = MsiQueryFeatureState(prodcode, "montecristo"); + state = MsiQueryFeatureStateA(prodcode, "montecristo"); ok(state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state); r = pMsiQueryComponentStateA(prodcode, NULL, MSIINSTALLCONTEXT_USERUNMANAGED, @@ -3924,13 +4076,13 @@ static void test_publish(void) ok(pf_exists("msitest\\maximus"), "File not installed\n"); ok(pf_exists("msitest"), "File not installed\n"); - state = MsiQueryProductState(prodcode); + state = MsiQueryProductStateA(prodcode); ok(state == INSTALLSTATE_DEFAULT, "Expected INSTALLSTATE_DEFAULT, got %d\n", state); - state = MsiQueryFeatureState(prodcode, "feature"); + state = MsiQueryFeatureStateA(prodcode, "feature"); ok(state == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", state); - state = MsiQueryFeatureState(prodcode, "montecristo"); + state = MsiQueryFeatureStateA(prodcode, "montecristo"); ok(state == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", state); r = pMsiQueryComponentStateA(prodcode, NULL, MSIINSTALLCONTEXT_USERUNMANAGED, @@ -3984,13 +4136,13 @@ static void test_publish(void) ok(pf_exists("msitest\\maximus"), "File deleted\n"); ok(pf_exists("msitest"), "Directory deleted\n"); - state = MsiQueryProductState(prodcode); + state = MsiQueryProductStateA(prodcode); ok(state == INSTALLSTATE_DEFAULT, "Expected INSTALLSTATE_DEFAULT, got %d\n", state); - state = MsiQueryFeatureState(prodcode, "feature"); + state = MsiQueryFeatureStateA(prodcode, "feature"); ok(state == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", state); - state = MsiQueryFeatureState(prodcode, "montecristo"); + state = MsiQueryFeatureStateA(prodcode, "montecristo"); ok(state == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", state); r = pMsiQueryComponentStateA(prodcode, NULL, MSIINSTALLCONTEXT_USERUNMANAGED, @@ -4044,13 +4196,13 @@ static void test_publish(void) ok(pf_exists("msitest\\maximus"), "File not installed\n"); ok(pf_exists("msitest"), "File not installed\n"); - state = MsiQueryProductState(prodcode); + state = MsiQueryProductStateA(prodcode); ok(state == INSTALLSTATE_DEFAULT, "Expected INSTALLSTATE_DEFAULT, got %d\n", state); - state = MsiQueryFeatureState(prodcode, "feature"); + state = MsiQueryFeatureStateA(prodcode, "feature"); ok(state == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", state); - state = MsiQueryFeatureState(prodcode, "montecristo"); + state = MsiQueryFeatureStateA(prodcode, "montecristo"); ok(state == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", state); r = pMsiQueryComponentStateA(prodcode, NULL, MSIINSTALLCONTEXT_USERUNMANAGED, @@ -4104,13 +4256,13 @@ static void test_publish(void) ok(!pf_exists("msitest\\maximus"), "File not deleted\n"); ok(!pf_exists("msitest"), "Directory not deleted\n"); - state = MsiQueryProductState(prodcode); + state = MsiQueryProductStateA(prodcode); ok(state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state); - state = MsiQueryFeatureState(prodcode, "feature"); + state = MsiQueryFeatureStateA(prodcode, "feature"); ok(state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state); - state = MsiQueryFeatureState(prodcode, "montecristo"); + state = MsiQueryFeatureStateA(prodcode, "montecristo"); ok(state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state); r = pMsiQueryComponentStateA(prodcode, NULL, MSIINSTALLCONTEXT_USERUNMANAGED, @@ -4127,13 +4279,13 @@ static void test_publish(void) ok(pf_exists("msitest\\maximus"), "File not installed\n"); ok(pf_exists("msitest"), "File not installed\n"); - state = MsiQueryProductState(prodcode); + state = MsiQueryProductStateA(prodcode); ok(state == INSTALLSTATE_DEFAULT, "Expected INSTALLSTATE_DEFAULT, got %d\n", state); - state = MsiQueryFeatureState(prodcode, "feature"); + state = MsiQueryFeatureStateA(prodcode, "feature"); ok(state == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", state); - state = MsiQueryFeatureState(prodcode, "montecristo"); + state = MsiQueryFeatureStateA(prodcode, "montecristo"); ok(state == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", state); r = pMsiQueryComponentStateA(prodcode, NULL, MSIINSTALLCONTEXT_USERUNMANAGED, @@ -4187,13 +4339,13 @@ static void test_publish(void) ok(!pf_exists("msitest\\maximus"), "File not deleted\n"); ok(!pf_exists("msitest"), "Directory not deleted\n"); - state = MsiQueryProductState(prodcode); + state = MsiQueryProductStateA(prodcode); ok(state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state); - state = MsiQueryFeatureState(prodcode, "feature"); + state = MsiQueryFeatureStateA(prodcode, "feature"); ok(state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state); - state = MsiQueryFeatureState(prodcode, "montecristo"); + state = MsiQueryFeatureStateA(prodcode, "montecristo"); ok(state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state); r = pMsiQueryComponentStateA(prodcode, NULL, MSIINSTALLCONTEXT_USERUNMANAGED, @@ -4210,9 +4362,9 @@ static void test_publish(void) error: RegCloseKey(uninstall); RegCloseKey(uninstall_32node); - DeleteFile(msifile); - DeleteFile("msitest\\maximus"); - RemoveDirectory("msitest"); + DeleteFileA(msifile); + DeleteFileA("msitest\\maximus"); + RemoveDirectoryA("msitest"); } static void test_publish_sourcelist(void) @@ -4255,7 +4407,7 @@ static void test_publish_sourcelist(void) size = MAX_PATH; lstrcpyA(value, "aaa"); r = pMsiSourceListGetInfoA(prodcode, NULL, MSIINSTALLCONTEXT_USERUNMANAGED, - MSICODE_PRODUCT, INSTALLPROPERTY_PACKAGENAME, value, &size); + MSICODE_PRODUCT, INSTALLPROPERTY_PACKAGENAMEA, value, &size); ok(r == ERROR_UNKNOWN_PRODUCT, "Expected ERROR_UNKNOWN_PRODUCT, got %d\n", r); ok(size == MAX_PATH, "Expected %d, got %d\n", MAX_PATH, size); ok(!lstrcmpA(value, "aaa"), "Expected \"aaa\", got \"%s\"\n", value); @@ -4277,7 +4429,7 @@ static void test_publish_sourcelist(void) size = MAX_PATH; lstrcpyA(value, "aaa"); r = pMsiSourceListGetInfoA(prodcode, NULL, MSIINSTALLCONTEXT_USERUNMANAGED, - MSICODE_PRODUCT, INSTALLPROPERTY_PACKAGENAME, value, &size); + MSICODE_PRODUCT, INSTALLPROPERTY_PACKAGENAMEA, value, &size); ok(r == ERROR_UNKNOWN_PRODUCT, "Expected ERROR_UNKNOWN_PRODUCT, got %d\n", r); ok(size == MAX_PATH, "Expected %d, got %d\n", MAX_PATH, size); ok(!lstrcmpA(value, "aaa"), "Expected \"aaa\", got \"%s\"\n", value); @@ -4299,7 +4451,7 @@ static void test_publish_sourcelist(void) size = MAX_PATH; lstrcpyA(value, "aaa"); r = pMsiSourceListGetInfoA(prodcode, NULL, MSIINSTALLCONTEXT_USERUNMANAGED, - MSICODE_PRODUCT, INSTALLPROPERTY_PACKAGENAME, value, &size); + MSICODE_PRODUCT, INSTALLPROPERTY_PACKAGENAMEA, value, &size); ok(r == ERROR_UNKNOWN_PRODUCT, "Expected ERROR_UNKNOWN_PRODUCT, got %d\n", r); ok(size == MAX_PATH, "Expected %d, got %d\n", MAX_PATH, size); ok(!lstrcmpA(value, "aaa"), "Expected \"aaa\", got \"%s\"\n", value); @@ -4321,7 +4473,7 @@ static void test_publish_sourcelist(void) size = MAX_PATH; lstrcpyA(value, "aaa"); r = pMsiSourceListGetInfoA(prodcode, NULL, MSIINSTALLCONTEXT_USERUNMANAGED, - MSICODE_PRODUCT, INSTALLPROPERTY_PACKAGENAME, value, &size); + MSICODE_PRODUCT, INSTALLPROPERTY_PACKAGENAMEA, value, &size); ok(r == ERROR_UNKNOWN_PRODUCT, "Expected ERROR_UNKNOWN_PRODUCT, got %d\n", r); ok(size == MAX_PATH, "Expected %d, got %d\n", MAX_PATH, size); ok(!lstrcmpA(value, "aaa"), "Expected \"aaa\", got \"%s\"\n", value); @@ -4343,7 +4495,7 @@ static void test_publish_sourcelist(void) size = MAX_PATH; lstrcpyA(value, "aaa"); r = pMsiSourceListGetInfoA(prodcode, NULL, MSIINSTALLCONTEXT_USERUNMANAGED, - MSICODE_PRODUCT, INSTALLPROPERTY_PACKAGENAME, value, &size); + MSICODE_PRODUCT, INSTALLPROPERTY_PACKAGENAMEA, value, &size); ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r); ok(!lstrcmpA(value, "msitest.msi"), "Expected 'msitest.msi', got %s\n", value); ok(size == 11, "Expected 11, got %d\n", size); @@ -4351,7 +4503,7 @@ static void test_publish_sourcelist(void) size = MAX_PATH; lstrcpyA(value, "aaa"); r = pMsiSourceListGetInfoA(prodcode, NULL, MSIINSTALLCONTEXT_USERUNMANAGED, - MSICODE_PRODUCT, INSTALLPROPERTY_MEDIAPACKAGEPATH, value, &size); + MSICODE_PRODUCT, INSTALLPROPERTY_MEDIAPACKAGEPATHA, value, &size); ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r); ok(!lstrcmpA(value, ""), "Expected \"\", got \"%s\"\n", value); ok(size == 0, "Expected 0, got %d\n", size); @@ -4359,7 +4511,7 @@ static void test_publish_sourcelist(void) size = MAX_PATH; lstrcpyA(value, "aaa"); r = pMsiSourceListGetInfoA(prodcode, NULL, MSIINSTALLCONTEXT_USERUNMANAGED, - MSICODE_PRODUCT, INSTALLPROPERTY_DISKPROMPT, value, &size); + MSICODE_PRODUCT, INSTALLPROPERTY_DISKPROMPTA, value, &size); ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r); ok(!lstrcmpA(value, ""), "Expected \"\", got \"%s\"\n", value); ok(size == 0, "Expected 0, got %d\n", size); @@ -4370,7 +4522,7 @@ static void test_publish_sourcelist(void) size = MAX_PATH; lstrcpyA(value, "aaa"); r = pMsiSourceListGetInfoA(prodcode, NULL, MSIINSTALLCONTEXT_USERUNMANAGED, - MSICODE_PRODUCT, INSTALLPROPERTY_LASTUSEDSOURCE, value, &size); + MSICODE_PRODUCT, INSTALLPROPERTY_LASTUSEDSOURCEA, value, &size); ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r); ok(!lstrcmpA(value, path), "Expected \"%s\", got \"%s\"\n", path, value); ok(size == lstrlenA(path), "Expected %d, got %d\n", lstrlenA(path), size); @@ -4378,7 +4530,7 @@ static void test_publish_sourcelist(void) size = MAX_PATH; lstrcpyA(value, "aaa"); r = pMsiSourceListGetInfoA(prodcode, NULL, MSIINSTALLCONTEXT_USERUNMANAGED, - MSICODE_PRODUCT, INSTALLPROPERTY_LASTUSEDTYPE, value, &size); + MSICODE_PRODUCT, INSTALLPROPERTY_LASTUSEDTYPEA, value, &size); ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r); ok(!lstrcmpA(value, "n"), "Expected \"n\", got \"%s\"\n", value); ok(size == 1, "Expected 1, got %d\n", size); @@ -4417,9 +4569,9 @@ static void test_publish_sourcelist(void) delete_pfmsitest_files(); error: - DeleteFile(msifile); - DeleteFile("msitest\\maximus"); - RemoveDirectory("msitest"); + DeleteFileA(msifile); + DeleteFileA("msitest\\maximus"); + RemoveDirectoryA("msitest"); } static void create_pf_data(LPCSTR file, LPCSTR data, BOOL is_file) @@ -4565,11 +4717,11 @@ static void test_remove_files(void) delete_pf("msitest", FALSE); error: - DeleteFile(msifile); - DeleteFile("msitest\\hydrogen"); - DeleteFile("msitest\\helium"); - DeleteFile("msitest\\lithium"); - RemoveDirectory("msitest"); + DeleteFileA(msifile); + DeleteFileA("msitest\\hydrogen"); + DeleteFileA("msitest\\helium"); + DeleteFileA("msitest\\lithium"); + RemoveDirectoryA("msitest"); } static void test_move_files(void) @@ -4690,33 +4842,33 @@ static void test_move_files(void) ok(DeleteFileA("bird"), "File moved\n"); error: - DeleteFile("cameroon"); - DeleteFile("djibouti"); - DeleteFile("egypt"); - DeleteFile("finland"); - DeleteFile("gambai"); - DeleteFile("honduras"); - DeleteFile("japan"); - DeleteFile("kenya"); - DeleteFile("nauru"); - DeleteFile("peru"); - DeleteFile("apple"); - DeleteFile("application"); - DeleteFile("ape"); - DeleteFile("foo"); - DeleteFile("fao"); - DeleteFile("fbod"); - DeleteFile("budding"); - DeleteFile("buddy"); - DeleteFile("bud"); - DeleteFile("bar"); - DeleteFile("bur"); - DeleteFile("bird"); - DeleteFile("msitest\\india"); - DeleteFile("msitest\\augustus"); - RemoveDirectory("latvia"); - RemoveDirectory("msitest"); - DeleteFile(msifile); + DeleteFileA("cameroon"); + DeleteFileA("djibouti"); + DeleteFileA("egypt"); + DeleteFileA("finland"); + DeleteFileA("gambai"); + DeleteFileA("honduras"); + DeleteFileA("japan"); + DeleteFileA("kenya"); + DeleteFileA("nauru"); + DeleteFileA("peru"); + DeleteFileA("apple"); + DeleteFileA("application"); + DeleteFileA("ape"); + DeleteFileA("foo"); + DeleteFileA("fao"); + DeleteFileA("fbod"); + DeleteFileA("budding"); + DeleteFileA("buddy"); + DeleteFileA("bud"); + DeleteFileA("bar"); + DeleteFileA("bur"); + DeleteFileA("bird"); + DeleteFileA("msitest\\india"); + DeleteFileA("msitest\\augustus"); + RemoveDirectoryA("latvia"); + RemoveDirectoryA("msitest"); + DeleteFileA(msifile); } static void test_duplicate_files(void) @@ -4753,9 +4905,9 @@ static void test_duplicate_files(void) ok(delete_pf("msitest", FALSE), "Directory not created\n"); error: - DeleteFile("msitest\\maximus"); - RemoveDirectory("msitest"); - DeleteFile(msifile); + DeleteFileA("msitest\\maximus"); + RemoveDirectoryA("msitest"); + DeleteFileA(msifile); } static void test_write_registry_values(void) @@ -4909,9 +5061,9 @@ static void test_write_registry_values(void) RegDeleteKeyA(HKEY_LOCAL_MACHINE, "SOFTWARE\\Wine\\msitest"); error: - DeleteFile(msifile); - DeleteFile("msitest\\augustus"); - RemoveDirectory("msitest"); + DeleteFileA(msifile); + DeleteFileA("msitest\\augustus"); + RemoveDirectoryA("msitest"); } static void test_envvar(void) @@ -4971,7 +5123,7 @@ static void test_envvar(void) res = RegQueryValueExA(env, "MSITESTVAR1", NULL, &type, (LPBYTE)buffer, &size); ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res); ok(type == REG_SZ, "Expected REG_SZ, got %u\n", type); - ok(!lstrcmp(buffer, "1"), "Expected \"1\", got %s\n", buffer); + ok(!lstrcmpA(buffer, "1"), "Expected \"1\", got %s\n", buffer); res = RegDeleteValueA(env, "MSITESTVAR1"); ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res); @@ -4982,7 +5134,7 @@ static void test_envvar(void) res = RegQueryValueExA(env, "MSITESTVAR2", NULL, &type, (LPBYTE)buffer, &size); ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res); ok(type == REG_SZ, "Expected REG_SZ, got %u\n", type); - ok(!lstrcmp(buffer, "1"), "Expected \"1\", got %s\n", buffer); + ok(!lstrcmpA(buffer, "1"), "Expected \"1\", got %s\n", buffer); res = RegDeleteValueA(env, "MSITESTVAR2"); ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res); @@ -5023,7 +5175,7 @@ static void test_envvar(void) res = RegQueryValueExA(env, name, NULL, &type, (LPBYTE)buffer, &size); ok(res == ERROR_SUCCESS, "%d: Expected ERROR_SUCCESS, got %d\n", i, res); ok(type == REG_SZ, "%d: Expected REG_SZ, got %u\n", i, type); - ok(!lstrcmp(buffer, results[i - 11]), "%d: Expected %s, got %s\n", i, results[i - 11], buffer); + ok(!lstrcmpA(buffer, results[i - 11]), "%d: Expected %s, got %s\n", i, results[i - 11], buffer); res = RegDeleteValueA(env, name); ok(res == ERROR_SUCCESS, "%d: Expected ERROR_SUCCESS, got %d\n", i, res); @@ -5050,7 +5202,7 @@ error: RegCloseKey(env); delete_test_files(); - DeleteFile(msifile); + DeleteFileA(msifile); } static void test_create_remove_folder(void) @@ -5103,7 +5255,7 @@ error: RemoveDirectoryA("msitest\\first"); RemoveDirectoryA("msitest\\second"); RemoveDirectoryA("msitest"); - DeleteFile(msifile); + DeleteFileA(msifile); } static void test_start_services(void) @@ -5113,7 +5265,7 @@ static void test_start_services(void) BOOL ret; DWORD error = ERROR_SUCCESS; - scm = OpenSCManager(NULL, NULL, SC_MANAGER_ALL_ACCESS); + scm = OpenSCManagerA(NULL, NULL, SC_MANAGER_ALL_ACCESS); if (!scm && GetLastError() == ERROR_ACCESS_DENIED) { skip("Not enough rights to perform tests\n"); @@ -5122,7 +5274,7 @@ static void test_start_services(void) ok(scm != NULL, "Failed to open the SC Manager\n"); if (!scm) return; - service = OpenService(scm, "Spooler", SC_MANAGER_ALL_ACCESS); + service = OpenServiceA(scm, "Spooler", SC_MANAGER_ALL_ACCESS); if (!service && GetLastError() == ERROR_SERVICE_DOES_NOT_EXIST) { win_skip("The 'Spooler' service does not exist\n"); @@ -5135,7 +5287,7 @@ static void test_start_services(void) return; } - ret = StartService(service, 0, NULL); + ret = StartServiceA(service, 0, NULL); if (!ret && (error = GetLastError()) != ERROR_SERVICE_ALREADY_RUNNING) { skip("Spooler service not available, skipping test\n"); @@ -5170,14 +5322,14 @@ static void test_start_services(void) ok(delete_pf("msitest", FALSE), "Directory not created\n"); delete_test_files(); - DeleteFile(msifile); + DeleteFileA(msifile); if (error == ERROR_SUCCESS) { SERVICE_STATUS status; - scm = OpenSCManager(NULL, NULL, SC_MANAGER_ALL_ACCESS); - service = OpenService(scm, "Spooler", SC_MANAGER_ALL_ACCESS); + scm = OpenSCManagerA(NULL, NULL, SC_MANAGER_ALL_ACCESS); + service = OpenServiceA(scm, "Spooler", SC_MANAGER_ALL_ACCESS); ret = ControlService(service, SERVICE_CONTROL_STOP, &status); ok(ret, "ControlService failed %u\n", GetLastError()); @@ -5199,7 +5351,7 @@ static void test_delete_services(void) return; } - manager = OpenSCManager(NULL, NULL, SC_MANAGER_ALL_ACCESS); + manager = OpenSCManagerA(NULL, NULL, SC_MANAGER_ALL_ACCESS); ok(manager != NULL, "can't open service manager %u\n", GetLastError()); if (!manager) return; @@ -5224,7 +5376,7 @@ static void test_delete_services(void) } ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r); - manager = OpenSCManager(NULL, NULL, SC_MANAGER_ALL_ACCESS); + manager = OpenSCManagerA(NULL, NULL, SC_MANAGER_ALL_ACCESS); ok(manager != NULL, "can't open service manager\n"); if (!manager) goto error; @@ -5253,7 +5405,79 @@ static void test_delete_services(void) error: delete_test_files(); - DeleteFile(msifile); + DeleteFileA(msifile); +} + +static void test_install_services(void) +{ + UINT r; + SC_HANDLE manager, service; + BOOL ret; + + if (is_process_limited()) + { + skip("process is limited\n"); + return; + } + + create_test_files(); + create_database(msifile, sis_tables, sizeof(sis_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); + + manager = OpenSCManagerA(NULL, NULL, SC_MANAGER_ALL_ACCESS); + ok(manager != NULL, "can't open service manager\n"); + if (!manager) goto error; + + service = OpenServiceA(manager, "TestService", GENERIC_ALL); + ok(service != NULL, "TestService not installed\n"); + CloseServiceHandle(service); + + service = OpenServiceA(manager, "TestService4", GENERIC_ALL); + ok(service == NULL, "TestService4 installed\n"); + CloseServiceHandle(manager); + + r = MsiInstallProductA(msifile, "REMOVE=ALL"); + ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r); + + ok(delete_pf("msitest\\cabout\\new\\five.txt", TRUE), "File not installed\n"); + ok(delete_pf("msitest\\cabout\\new", FALSE), "Directory not created\n"); + ok(delete_pf("msitest\\cabout\\four.txt", TRUE), "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), "Directory not created\n"); + ok(delete_pf("msitest\\first\\two.txt", TRUE), "File not installed\n"); + ok(delete_pf("msitest\\first", FALSE), "Directory not created\n"); + ok(delete_pf("msitest\\filename", TRUE), "File not installed\n"); + ok(delete_pf("msitest\\one.txt", TRUE), "File not installed\n"); + ok(delete_pf("msitest\\service.exe", TRUE), "File not installed\n"); + ok(delete_pf("msitest\\service2.exe", TRUE), "File not installed\n"); + ok(delete_pf("msitest", FALSE), "Directory not created\n"); + + manager = OpenSCManagerA(NULL, NULL, SC_MANAGER_ALL_ACCESS); + ok(manager != NULL, "can't open service manager\n"); + if (!manager) goto error; + + service = OpenServiceA(manager, "TestService", GENERIC_ALL); + ok(service != NULL, "TestService doesn't exist\n"); + + ret = DeleteService( service ); + ok( ret, "failed to delete service %u\n", GetLastError() ); + + CloseServiceHandle(service); + CloseServiceHandle(manager); + +error: + delete_test_files(); + DeleteFileA(msifile); } static void test_self_registration(void) @@ -5295,7 +5519,7 @@ static void test_self_registration(void) error: delete_test_files(); - DeleteFile(msifile); + DeleteFileA(msifile); } static void test_register_font(void) @@ -5351,7 +5575,7 @@ static void test_register_font(void) error: DeleteFileA("msitest\\font.ttf"); delete_test_files(); - DeleteFile(msifile); + DeleteFileA(msifile); } static void test_validate_product_id(void) @@ -5402,7 +5626,7 @@ static void test_validate_product_id(void) error: delete_test_files(); - DeleteFile(msifile); + DeleteFileA(msifile); } static void test_install_remove_odbc(void) @@ -5456,7 +5680,7 @@ error: DeleteFileA("msitest\\ODBCtranslator2.dll"); DeleteFileA("msitest\\ODBCsetup.dll"); delete_test_files(); - DeleteFile(msifile); + DeleteFileA(msifile); } static void test_register_typelib(void) @@ -5495,7 +5719,7 @@ static void test_register_typelib(void) error: DeleteFileA("msitest\\typelib.dll"); delete_test_files(); - DeleteFile(msifile); + DeleteFileA(msifile); } static void test_create_remove_shortcut(void) @@ -5535,12 +5759,12 @@ static void test_create_remove_shortcut(void) error: DeleteFileA("msitest\\target.txt"); delete_test_files(); - DeleteFile(msifile); + DeleteFileA(msifile); } static void test_publish_components(void) { - static char keypath[] = + static const char keypath[] = "Software\\Microsoft\\Installer\\Components\\0CBCFA296AC907244845745CEEB2F8AA"; UINT r; @@ -5586,7 +5810,7 @@ static void test_publish_components(void) error: DeleteFileA("msitest\\english.txt"); delete_test_files(); - DeleteFile(msifile); + DeleteFileA(msifile); } static void test_remove_duplicate_files(void) @@ -5636,7 +5860,7 @@ error: DeleteFileA("msitest\\original2.txt"); DeleteFileA("msitest\\original3.txt"); delete_test_files(); - DeleteFile(msifile); + DeleteFileA(msifile); } static void test_remove_registry_values(void) @@ -5755,7 +5979,7 @@ error: DeleteFileA("msitest\\registry.txt"); delete_test_files(); - DeleteFile(msifile); + DeleteFileA(msifile); } static void test_find_related_products(void) @@ -5795,7 +6019,7 @@ static void test_find_related_products(void) error: DeleteFileA("msitest\\product.txt"); delete_test_files(); - DeleteFile(msifile); + DeleteFileA(msifile); } static void test_remove_ini_values(void) @@ -5861,7 +6085,7 @@ static void test_remove_ini_values(void) error: DeleteFileA("msitest\\inifile.txt"); delete_test_files(); - DeleteFile(msifile); + DeleteFileA(msifile); } static void test_remove_env_strings(void) @@ -5912,7 +6136,7 @@ static void test_remove_env_strings(void) res = RegQueryValueExA(key, "MSITESTVAR1", NULL, &type, (LPBYTE)buffer, &size); ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res); ok(type == REG_SZ, "expected REG_SZ, got %u\n", type); - ok(!lstrcmp(buffer, "1"), "expected \"1\", got \"%s\"\n", buffer); + ok(!lstrcmpA(buffer, "1"), "expected \"1\", got \"%s\"\n", buffer); type = REG_NONE; buffer[0] = 0; @@ -5920,7 +6144,7 @@ static void test_remove_env_strings(void) res = RegQueryValueExA(key, "MSITESTVAR2", NULL, &type, (LPBYTE)buffer, &size); ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res); ok(type == REG_SZ, "expected REG_SZ, got %u\n", type); - ok(!lstrcmp(buffer, "1"), "expected \"1\", got \"%s\"\n", buffer); + ok(!lstrcmpA(buffer, "1"), "expected \"1\", got \"%s\"\n", buffer); type = REG_NONE; buffer[0] = 0; @@ -5928,7 +6152,7 @@ static void test_remove_env_strings(void) res = RegQueryValueExA(key, "MSITESTVAR3", NULL, &type, (LPBYTE)buffer, &size); ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res); ok(type == REG_SZ, "expected REG_SZ, got %u\n", type); - ok(!lstrcmp(buffer, "1"), "expected \"1\", got \"%s\"\n", buffer); + ok(!lstrcmpA(buffer, "1"), "expected \"1\", got \"%s\"\n", buffer); type = REG_NONE; buffer[0] = 0; @@ -5936,7 +6160,7 @@ static void test_remove_env_strings(void) res = RegQueryValueExA(key, "MSITESTVAR4", NULL, &type, (LPBYTE)buffer, &size); ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res); ok(type == REG_SZ, "expected REG_SZ, got %u\n", type); - ok(!lstrcmp(buffer, "1"), "expected \"1\", got \"%s\"\n", buffer); + ok(!lstrcmpA(buffer, "1"), "expected \"1\", got \"%s\"\n", buffer); type = REG_NONE; buffer[0] = 0; @@ -5944,7 +6168,7 @@ static void test_remove_env_strings(void) res = RegQueryValueExA(key, "MSITESTVAR5", NULL, &type, (LPBYTE)buffer, &size); ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res); ok(type == REG_SZ, "expected REG_SZ, got %u\n", type); - ok(!lstrcmp(buffer, "1"), "expected \"1\", got \"%s\"\n", buffer); + ok(!lstrcmpA(buffer, "1"), "expected \"1\", got \"%s\"\n", buffer); RegCloseKey(key); @@ -5966,7 +6190,7 @@ static void test_remove_env_strings(void) res = RegQueryValueExA(key, "MSITESTVAR3", NULL, &type, (LPBYTE)buffer, &size); ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res); ok(type == REG_SZ, "expected REG_SZ, got %u\n", type); - ok(!lstrcmp(buffer, "1"), "expected \"1\", got \"%s\"\n", buffer); + ok(!lstrcmpA(buffer, "1"), "expected \"1\", got \"%s\"\n", buffer); RegDeleteValueA(key, "MSITESTVAR3"); res = RegQueryValueExA(key, "MSITESTVAR4", NULL, NULL, NULL, NULL); @@ -5978,7 +6202,7 @@ static void test_remove_env_strings(void) res = RegQueryValueExA(key, "MSITESTVAR5", NULL, &type, (LPBYTE)buffer, &size); ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res); ok(type == REG_SZ, "expected REG_SZ, got %u\n", type); - ok(!lstrcmp(buffer, "1"), "expected \"1\", got \"%s\"\n", buffer); + ok(!lstrcmpA(buffer, "1"), "expected \"1\", got \"%s\"\n", buffer); RegDeleteValueA(key, "MSITESTVAR5"); ok(!delete_pf("msitest\\envvar.txt", TRUE), "file not removed\n"); @@ -5994,7 +6218,7 @@ error: DeleteFileA("msitest\\envvar.txt"); delete_test_files(); - DeleteFile(msifile); + DeleteFileA(msifile); } static void test_register_class_info(void) @@ -6059,7 +6283,7 @@ static void test_register_class_info(void) error: DeleteFileA("msitest\\class.txt"); delete_test_files(); - DeleteFile(msifile); + DeleteFileA(msifile); } static void test_register_extension_info(void) @@ -6111,7 +6335,133 @@ static void test_register_extension_info(void) error: DeleteFileA("msitest\\extension.txt"); delete_test_files(); - DeleteFile(msifile); + DeleteFileA(msifile); +} + +static void test_register_progid_info(void) +{ + UINT r; + LONG res; + HKEY hkey; + + if (is_process_limited()) + { + skip("process is limited\n"); + return; + } + + create_test_files(); + create_file("msitest\\progid.txt", 1000); + create_database(msifile, rpi_tables, sizeof(rpi_tables) / sizeof(msi_table)); + + res = RegCreateKeyExA(HKEY_CLASSES_ROOT, "Winetest.Orphaned", 0, NULL, 0, + KEY_ALL_ACCESS, NULL, &hkey, NULL); + ok(res == ERROR_SUCCESS, "key not created\n"); + RegCloseKey(hkey); + + 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); + + if (is_64bit) + res = RegOpenKeyA(HKEY_CLASSES_ROOT, "Wow6432Node\\CLSID\\{110913E7-86D1-4BF3-9922-BA103FCDDDFA}", &hkey); + else + res = RegOpenKeyA(HKEY_CLASSES_ROOT, "CLSID\\{110913E7-86D1-4BF3-9922-BA103FCDDDFA}", &hkey); + ok(res == ERROR_SUCCESS, "key not created\n"); + RegCloseKey(hkey); + + res = RegOpenKeyA(HKEY_CLASSES_ROOT, "Winetest.Class.1", &hkey); + ok(res == ERROR_SUCCESS, "key not created\n"); + RegCloseKey(hkey); + + res = RegOpenKeyA(HKEY_CLASSES_ROOT, "Winetest.Class", &hkey); + ok(res == ERROR_SUCCESS, "key not created\n"); + RegCloseKey(hkey); + + res = RegOpenKeyA(HKEY_CLASSES_ROOT, "Winetest.Class.2", &hkey); + ok(res == ERROR_SUCCESS, "key not created\n"); + RegCloseKey(hkey); + + res = RegOpenKeyA(HKEY_CLASSES_ROOT, "Winetest.VerClass.1", &hkey); + ok(res == ERROR_SUCCESS, "key not created\n"); + RegCloseKey(hkey); + + res = RegOpenKeyA(HKEY_CLASSES_ROOT, "Winetest.VerClass", &hkey); + ok(res == ERROR_SUCCESS, "key not created\n"); + RegCloseKey(hkey); + + res = RegOpenKeyA(HKEY_CLASSES_ROOT, "Winetest.NoProgIdClass.1", &hkey); + ok(res == ERROR_FILE_NOT_FOUND, "key created\n"); + if (res == ERROR_SUCCESS) RegCloseKey(hkey); + + res = RegOpenKeyA(HKEY_CLASSES_ROOT, "Winetest.NoProgIdClass", &hkey); + ok(res == ERROR_FILE_NOT_FOUND, "key created\n"); + + res = RegOpenKeyA(HKEY_CLASSES_ROOT, "Winetest.Orphaned", &hkey); + ok(res == ERROR_SUCCESS, "key deleted\n"); + if (res == ERROR_SUCCESS) RegCloseKey(hkey); + + res = RegOpenKeyA(HKEY_CLASSES_ROOT, "Winetest.Orphaned2", &hkey); + ok(res == ERROR_FILE_NOT_FOUND, "key created\n"); + + res = RegOpenKeyA(HKEY_CLASSES_ROOT, "Winetest.Extension", &hkey); + ok(res == ERROR_SUCCESS, "key not created\n"); + RegCloseKey(hkey); + + r = MsiInstallProductA(msifile, "REMOVE=ALL"); + ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r); + + if (is_64bit) + res = RegOpenKeyA(HKEY_CLASSES_ROOT, "Wow6432Node\\CLSID\\{110913E7-86D1-4BF3-9922-BA103FCDDDFA}", &hkey); + else + res = RegOpenKeyA(HKEY_CLASSES_ROOT, "CLSID\\{110913E7-86D1-4BF3-9922-BA103FCDDDFA}", &hkey); + ok(res == ERROR_FILE_NOT_FOUND, "key not removed\n"); + + res = RegOpenKeyA(HKEY_CLASSES_ROOT, "Winetest.Class.1", &hkey); + ok(res == ERROR_FILE_NOT_FOUND, "key not removed\n"); + + res = RegOpenKeyA(HKEY_CLASSES_ROOT, "Winetest.Class", &hkey); + ok(res == ERROR_FILE_NOT_FOUND, "key not removed\n"); + + res = RegOpenKeyA(HKEY_CLASSES_ROOT, "Winetest.Class.2", &hkey); + ok(res == ERROR_FILE_NOT_FOUND, "key not removed\n"); + + res = RegOpenKeyA(HKEY_CLASSES_ROOT, "Winetest.VerClass.1", &hkey); + ok(res == ERROR_FILE_NOT_FOUND, "key not removed\n"); + + res = RegOpenKeyA(HKEY_CLASSES_ROOT, "Winetest.VerClass", &hkey); + ok(res == ERROR_FILE_NOT_FOUND, "key not removed\n"); + + res = RegOpenKeyA(HKEY_CLASSES_ROOT, "Winetest.NoProgIdClass.1", &hkey); + ok(res == ERROR_FILE_NOT_FOUND, "key not removed\n"); + + res = RegOpenKeyA(HKEY_CLASSES_ROOT, "Winetest.NoProgIdClass", &hkey); + ok(res == ERROR_FILE_NOT_FOUND, "key not removed\n"); + + res = RegOpenKeyA(HKEY_CLASSES_ROOT, "Winetest.Orphaned", &hkey); + ok(res == ERROR_SUCCESS, "key deleted\n"); + if (res == ERROR_SUCCESS) RegCloseKey(hkey); + + res = RegOpenKeyA(HKEY_CLASSES_ROOT, "Winetest.Orphaned2", &hkey); + ok(res == ERROR_FILE_NOT_FOUND, "key not removed\n"); + + res = RegOpenKeyA(HKEY_CLASSES_ROOT, "Winetest.Extension", &hkey); + ok(res == ERROR_FILE_NOT_FOUND, "key not removed\n"); + + ok(!delete_pf("msitest\\progid.txt", TRUE), "file not removed\n"); + ok(!delete_pf("msitest", FALSE), "directory not removed\n"); + +error: + DeleteFileA("msitest\\progid.txt"); + delete_test_files(); + DeleteFileA(msifile); + RegDeleteKeyA(HKEY_CLASSES_ROOT, "Winetest.Orphaned"); } static void test_register_mime_info(void) @@ -6156,7 +6506,7 @@ static void test_register_mime_info(void) error: DeleteFileA("msitest\\mime.txt"); delete_test_files(); - DeleteFile(msifile); + DeleteFileA(msifile); } static void test_publish_assemblies(void) @@ -6369,7 +6719,7 @@ done: DeleteFileA("msitest\\application_win32.txt"); DeleteFileA("msitest\\application_dotnet.txt"); delete_test_files(); - DeleteFile(msifile); + DeleteFileA(msifile); } static void test_remove_existing_products(void) @@ -6405,7 +6755,7 @@ static void test_remove_existing_products(void) error: DeleteFileA("msitest\\rep.txt"); delete_test_files(); - DeleteFile(msifile); + DeleteFileA(msifile); } START_TEST(action) @@ -6421,7 +6771,7 @@ START_TEST(action) pIsWow64Process(GetCurrentProcess(), &is_wow64); GetCurrentDirectoryA(MAX_PATH, prev_path); - GetTempPath(MAX_PATH, temp_path); + GetTempPathA(MAX_PATH, temp_path); SetCurrentDirectoryA(temp_path); lstrcpyA(CURR_DIR, temp_path); @@ -6469,6 +6819,7 @@ START_TEST(action) test_create_remove_folder(); test_start_services(); test_delete_services(); + test_install_services(); test_self_registration(); test_register_font(); test_validate_product_id(); @@ -6483,6 +6834,7 @@ START_TEST(action) test_remove_env_strings(); test_register_class_info(); test_register_extension_info(); + test_register_progid_info(); test_register_mime_info(); test_publish_assemblies(); test_remove_existing_products(); diff --git a/rostests/winetests/msi/automation.c b/rostests/winetests/msi/automation.c index c1c1d4ab409..7ffa22aa663 100644 --- a/rostests/winetests/msi/automation.c +++ b/rostests/winetests/msi/automation.c @@ -34,6 +34,8 @@ static BOOL is_wow64; +static BOOL (WINAPI *pCheckTokenMembership)(HANDLE,PSID,PBOOL); +static BOOL (WINAPI *pOpenProcessToken)(HANDLE, DWORD, PHANDLE); static LONG (WINAPI *pRegDeleteKeyExA)(HKEY, LPCSTR, REGSAM, DWORD); static BOOL (WINAPI *pIsWow64Process)(HANDLE, PBOOL); @@ -216,12 +218,50 @@ static void init_functionpointers(void) if(!p ## func) \ trace("GetProcAddress(%s) failed\n", #func); + GET_PROC(hadvapi32, CheckTokenMembership); + GET_PROC(hadvapi32, OpenProcessToken); GET_PROC(hadvapi32, RegDeleteKeyExA) GET_PROC(hkernel32, IsWow64Process) #undef GET_PROC } +static BOOL is_process_limited(void) +{ + SID_IDENTIFIER_AUTHORITY NtAuthority = {SECURITY_NT_AUTHORITY}; + PSID Group; + BOOL IsInGroup; + HANDLE token; + + if (!pCheckTokenMembership || !pOpenProcessToken) return FALSE; + + if (!AllocateAndInitializeSid(&NtAuthority, 2, SECURITY_BUILTIN_DOMAIN_RID, + DOMAIN_ALIAS_RID_ADMINS, + 0, 0, 0, 0, 0, 0, &Group) || + !pCheckTokenMembership(NULL, Group, &IsInGroup)) + { + trace("Could not check if the current user is an administrator\n"); + return FALSE; + } + if (!IsInGroup) + { + /* Only administrators have enough privileges for these tests */ + return TRUE; + } + + if (pOpenProcessToken(GetCurrentProcess(), TOKEN_QUERY, &token)) + { + BOOL ret; + TOKEN_ELEVATION_TYPE type = TokenElevationTypeDefault; + DWORD size; + + ret = GetTokenInformation(token, TokenElevationType, &type, sizeof(type), &size); + CloseHandle(token); + return (ret && type == TokenElevationTypeLimited); + } + return FALSE; +} + static LONG delete_key_portable( HKEY key, LPCSTR subkey, REGSAM access ) { if (pRegDeleteKeyExA) @@ -237,9 +277,8 @@ static void write_file(const CHAR *filename, const char *data, int data_size) { DWORD size; - HANDLE hf = CreateFile(filename, GENERIC_WRITE, 0, NULL, - CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL); - + HANDLE hf = CreateFileA(filename, GENERIC_WRITE, 0, NULL, + CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL); WriteFile(hf, data, data_size, &size, NULL); CloseHandle(hf); } @@ -275,9 +314,14 @@ static void create_database(const CHAR *name, const msi_table *tables, int num_t { MSIHANDLE db; UINT r; - int j; + WCHAR *nameW; + int j, len; + + len = MultiByteToWideChar( CP_ACP, 0, name, -1, NULL, 0 ); + if (!(nameW = HeapAlloc( GetProcessHeap(), 0, len * sizeof(WCHAR) ))) return; + MultiByteToWideChar( CP_ACP, 0, name, -1, nameW, len ); - r = MsiOpenDatabaseA(name, MSIDBOPEN_CREATE, &db); + r = MsiOpenDatabaseW(nameW, MSIDBOPEN_CREATE, &db); ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r); /* import the tables into the database */ @@ -299,6 +343,7 @@ static void create_database(const CHAR *name, const msi_table *tables, int num_t ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r); MsiCloseHandle(db); + HeapFree( GetProcessHeap(), 0, nameW ); } static BOOL create_package(LPWSTR path) @@ -333,13 +378,12 @@ static BOOL get_program_files_dir(LPSTR buf) HKEY hkey; DWORD type = REG_EXPAND_SZ, size; - if (RegOpenKey(HKEY_LOCAL_MACHINE, - "Software\\Microsoft\\Windows\\CurrentVersion", &hkey)) + if (RegOpenKeyA(HKEY_LOCAL_MACHINE, "Software\\Microsoft\\Windows\\CurrentVersion", &hkey)) return FALSE; size = MAX_PATH; - if (RegQueryValueEx(hkey, "ProgramFilesDir (x86)", 0, &type, (LPBYTE)buf, &size) && - RegQueryValueEx(hkey, "ProgramFilesDir", 0, &type, (LPBYTE)buf, &size)) + if (RegQueryValueExA(hkey, "ProgramFilesDir (x86)", 0, &type, (LPBYTE)buf, &size) && + RegQueryValueExA(hkey, "ProgramFilesDir", 0, &type, (LPBYTE)buf, &size)) return FALSE; RegCloseKey(hkey); @@ -356,7 +400,7 @@ static void create_file(const CHAR *name, DWORD size) WriteFile(file, name, strlen(name), &written, NULL); WriteFile(file, "\n", strlen("\n"), &written, NULL); - left = size - lstrlen(name) - 1; + left = size - lstrlenA(name) - 1; SetFilePointer(file, left, NULL, FILE_CURRENT); SetEndOfFile(file); @@ -447,7 +491,7 @@ static CHAR string1[MAX_PATH], string2[MAX_PATH]; ok(0, format, extra, string1, aString); \ /* exception checker */ -static WCHAR szSource[] = {'M','s','i',' ','A','P','I',' ','E','r','r','o','r',0}; +static const WCHAR szSource[] = {'M','s','i',' ','A','P','I',' ','E','r','r','o','r',0}; #define ok_exception(hr, szDescription) \ if (hr == DISP_E_EXCEPTION) \ @@ -590,7 +634,7 @@ static void test_dispid(void) static void test_dispatch(void) { static WCHAR szOpenPackage[] = { 'O','p','e','n','P','a','c','k','a','g','e',0 }; - static WCHAR szOpenPackageException[] = {'O','p','e','n','P','a','c','k','a','g','e',',','P','a','c','k','a','g','e','P','a','t','h',',','O','p','t','i','o','n','s',0}; + static const WCHAR szOpenPackageException[] = {'O','p','e','n','P','a','c','k','a','g','e',',','P','a','c','k','a','g','e','P','a','t','h',',','O','p','t','i','o','n','s',0}; static WCHAR szProductState[] = { 'P','r','o','d','u','c','t','S','t','a','t','e',0 }; HRESULT hr; DISPID dispid; @@ -1683,11 +1727,11 @@ static void test_SummaryInfo(IDispatch *pSummaryInfo, const msi_summary_info *in static void test_Database(IDispatch *pDatabase, BOOL readonly) { - static WCHAR szSql[] = { 'S','E','L','E','C','T',' ','`','F','e','a','t','u','r','e','`',' ','F','R','O','M',' ','`','F','e','a','t','u','r','e','`',' ','W','H','E','R','E',' ','`','F','e','a','t','u','r','e','_','P','a','r','e','n','t','`','=','\'','O','n','e','\'',0 }; - static WCHAR szThree[] = { 'T','h','r','e','e',0 }; - static WCHAR szTwo[] = { 'T','w','o',0 }; - static WCHAR szStringDataField[] = { 'S','t','r','i','n','g','D','a','t','a',',','F','i','e','l','d',0 }; - static WCHAR szModifyModeRecord[] = { 'M','o','d','i','f','y',',','M','o','d','e',',','R','e','c','o','r','d',0 }; + static const WCHAR szSql[] = { 'S','E','L','E','C','T',' ','`','F','e','a','t','u','r','e','`',' ','F','R','O','M',' ','`','F','e','a','t','u','r','e','`',' ','W','H','E','R','E',' ','`','F','e','a','t','u','r','e','_','P','a','r','e','n','t','`','=','\'','O','n','e','\'',0 }; + static const WCHAR szThree[] = { 'T','h','r','e','e',0 }; + static const WCHAR szTwo[] = { 'T','w','o',0 }; + static const WCHAR szStringDataField[] = { 'S','t','r','i','n','g','D','a','t','a',',','F','i','e','l','d',0 }; + static const WCHAR szModifyModeRecord[] = { 'M','o','d','i','f','y',',','M','o','d','e',',','R','e','c','o','r','d',0 }; IDispatch *pView = NULL, *pSummaryInfo = NULL; HRESULT hr; @@ -1796,17 +1840,17 @@ static void test_Database(IDispatch *pDatabase, BOOL readonly) static void test_Session(IDispatch *pSession) { - static WCHAR szProductName[] = { 'P','r','o','d','u','c','t','N','a','m','e',0 }; - static WCHAR szOne[] = { 'O','n','e',0 }; - static WCHAR szOneStateFalse[] = { '!','O','n','e','>','0',0 }; - static WCHAR szOneStateTrue[] = { '!','O','n','e','=','-','1',0 }; - static WCHAR szOneActionFalse[] = { '$','O','n','e','=','-','1',0 }; - static WCHAR szOneActionTrue[] = { '$','O','n','e','>','0',0 }; - static WCHAR szCostInitialize[] = { 'C','o','s','t','I','n','i','t','i','a','l','i','z','e',0 }; - static WCHAR szEmpty[] = { 0 }; - static WCHAR szEquals[] = { '=',0 }; - static WCHAR szPropertyName[] = { 'P','r','o','p','e','r','t','y',',','N','a','m','e',0 }; - static WCHAR szModeFlag[] = { 'M','o','d','e',',','F','l','a','g',0 }; + static const WCHAR szProductName[] = { 'P','r','o','d','u','c','t','N','a','m','e',0 }; + static const WCHAR szOne[] = { 'O','n','e',0 }; + static const WCHAR szOneStateFalse[] = { '!','O','n','e','>','0',0 }; + static const WCHAR szOneStateTrue[] = { '!','O','n','e','=','-','1',0 }; + static const WCHAR szOneActionFalse[] = { '$','O','n','e','=','-','1',0 }; + static const WCHAR szOneActionTrue[] = { '$','O','n','e','>','0',0 }; + static const WCHAR szCostInitialize[] = { 'C','o','s','t','I','n','i','t','i','a','l','i','z','e',0 }; + static const WCHAR szEmpty[] = { 0 }; + static const WCHAR szEquals[] = { '=',0 }; + static const WCHAR szPropertyName[] = { 'P','r','o','p','e','r','t','y',',','N','a','m','e',0 }; + static const WCHAR szModeFlag[] = { 'M','o','d','e',',','F','l','a','g',0 }; WCHAR stringw[MAX_PATH]; CHAR string[MAX_PATH]; UINT len; @@ -2321,7 +2365,7 @@ static UINT delete_registry_key(HKEY hkeyParent, LPCSTR subkey, REGSAM access) HKEY hkey; DWORD dwSize; - ret = RegOpenKeyEx(hkeyParent, subkey, 0, access, &hkey); + ret = RegOpenKeyExA(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; @@ -2348,7 +2392,7 @@ static UINT find_registry_key(HKEY hkeyParent, LPCSTR subkey, LPCSTR findkey, RE *phkey = 0; - ret = RegOpenKeyEx(hkeyParent, subkey, 0, access, &hkey); + ret = RegOpenKeyExA(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; @@ -2382,6 +2426,15 @@ static void test_Installer_InstallProduct(void) IDispatch *pStringList = NULL; REGSAM access = KEY_ALL_ACCESS; + if (is_process_limited()) + { + /* In fact InstallProduct would succeed but then Windows XP + * would not allow us to clean up the registry! + */ + skip("Installer_InstallProduct (insufficient privileges)\n"); + return; + } + if (is_wow64) access |= KEY_WOW64_64KEY; @@ -2525,7 +2578,7 @@ static void test_Installer_InstallProduct(void) 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); + res = RegOpenKeyA(HKEY_CURRENT_USER, "SOFTWARE\\Microsoft\\Installer", &hkey); ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res); res = delete_registry_key(hkey, "Products\\af054738b93a8cb43b12803b397f483b", KEY_ALL_ACCESS); @@ -2542,8 +2595,8 @@ static void test_Installer_InstallProduct(void) static void test_Installer(void) { - static WCHAR szCreateRecordException[] = { 'C','r','e','a','t','e','R','e','c','o','r','d',',','C','o','u','n','t',0 }; - static WCHAR szIntegerDataException[] = { 'I','n','t','e','g','e','r','D','a','t','a',',','F','i','e','l','d',0 }; + static const WCHAR szCreateRecordException[] = { 'C','r','e','a','t','e','R','e','c','o','r','d',',','C','o','u','n','t',0 }; + static const WCHAR szIntegerDataException[] = { 'I','n','t','e','g','e','r','D','a','t','a',',','F','i','e','l','d',0 }; WCHAR szPath[MAX_PATH]; HRESULT hr; IDispatch *pSession = NULL, *pDatabase = NULL, *pRecord = NULL, *pStringList = NULL; @@ -2685,7 +2738,7 @@ START_TEST(automation) GetSystemTimeAsFileTime(&systemtime); GetCurrentDirectoryA(MAX_PATH, prev_path); - GetTempPath(MAX_PATH, temp_path); + GetTempPathA(MAX_PATH, temp_path); SetCurrentDirectoryA(temp_path); lstrcpyA(CURR_DIR, temp_path); diff --git a/rostests/winetests/msi/db.c b/rostests/winetests/msi/db.c index 107502f2b57..89d2c9e1f63 100644 --- a/rostests/winetests/msi/db.c +++ b/rostests/winetests/msi/db.c @@ -35,38 +35,39 @@ static const char *msifile = "winetest-db.msi"; static const char *msifile2 = "winetst2-db.msi"; static const char *mstfile = "winetst-db.mst"; static const WCHAR msifileW[] = {'w','i','n','e','t','e','s','t','-','d','b','.','m','s','i',0}; +static const WCHAR msifile2W[] = {'w','i','n','e','t','s','t','2','-','d','b','.','m','s','i',0}; static void test_msidatabase(void) { MSIHANDLE hdb = 0, hdb2 = 0; UINT res; - DeleteFile(msifile); + DeleteFileW(msifileW); - res = MsiOpenDatabase( msifile, msifile2, &hdb ); + res = MsiOpenDatabaseW( msifileW, msifile2W, &hdb ); ok( res == ERROR_OPEN_FAILED, "expected failure\n"); - res = MsiOpenDatabase( msifile, (LPSTR) 0xff, &hdb ); + res = MsiOpenDatabaseW( msifileW, (LPWSTR)0xff, &hdb ); ok( res == ERROR_INVALID_PARAMETER, "expected failure\n"); res = MsiCloseHandle( hdb ); ok( res == ERROR_SUCCESS , "Failed to close database\n" ); /* create an empty database */ - res = MsiOpenDatabase(msifile, MSIDBOPEN_CREATE, &hdb ); + res = MsiOpenDatabaseW(msifileW, MSIDBOPEN_CREATE, &hdb ); ok( res == ERROR_SUCCESS , "Failed to create database\n" ); res = MsiDatabaseCommit( hdb ); ok( res == ERROR_SUCCESS , "Failed to commit database\n" ); - ok( INVALID_FILE_ATTRIBUTES != GetFileAttributes( msifile ), "database should exist\n"); + ok( GetFileAttributesA( msifile ) != INVALID_FILE_ATTRIBUTES, "database should exist\n"); res = MsiCloseHandle( hdb ); ok( res == ERROR_SUCCESS , "Failed to close database\n" ); - res = MsiOpenDatabase( msifile, msifile2, &hdb2 ); + res = MsiOpenDatabaseW( msifileW, msifile2W, &hdb2 ); ok( res == ERROR_SUCCESS , "Failed to open database\n" ); - ok( INVALID_FILE_ATTRIBUTES != GetFileAttributes( msifile2 ), "database should exist\n"); + ok( GetFileAttributesA( msifile2 ) != INVALID_FILE_ATTRIBUTES, "database should exist\n"); res = MsiDatabaseCommit( hdb2 ); ok( res == ERROR_SUCCESS , "Failed to commit database\n" ); @@ -74,15 +75,15 @@ static void test_msidatabase(void) res = MsiCloseHandle( hdb2 ); ok( res == ERROR_SUCCESS , "Failed to close database\n" ); - res = MsiOpenDatabase( msifile, msifile2, &hdb2 ); + res = MsiOpenDatabaseW( msifileW, msifile2W, &hdb2 ); ok( res == ERROR_SUCCESS , "Failed to open database\n" ); res = MsiCloseHandle( hdb2 ); ok( res == ERROR_SUCCESS , "Failed to close database\n" ); - ok( INVALID_FILE_ATTRIBUTES == GetFileAttributes( msifile2 ), "uncommitted database should not exist\n"); + ok( GetFileAttributesA( msifile2 ) == INVALID_FILE_ATTRIBUTES, "uncommitted database should not exist\n"); - res = MsiOpenDatabase( msifile, msifile2, &hdb2 ); + res = MsiOpenDatabaseW( msifileW, msifile2W, &hdb2 ); ok( res == ERROR_SUCCESS , "Failed to close database\n" ); res = MsiDatabaseCommit( hdb2 ); @@ -91,9 +92,9 @@ static void test_msidatabase(void) res = MsiCloseHandle( hdb2 ); ok( res == ERROR_SUCCESS , "Failed to close database\n" ); - ok( INVALID_FILE_ATTRIBUTES != GetFileAttributes( msifile2 ), "committed database should exist\n"); + ok( GetFileAttributesA( msifile2 ) != INVALID_FILE_ATTRIBUTES, "committed database should exist\n"); - res = MsiOpenDatabase( msifile, MSIDBOPEN_READONLY, &hdb ); + res = MsiOpenDatabaseW( msifileW, MSIDBOPEN_READONLY, &hdb ); ok( res == ERROR_SUCCESS , "Failed to open database\n" ); res = MsiDatabaseCommit( hdb ); @@ -102,45 +103,45 @@ static void test_msidatabase(void) res = MsiCloseHandle( hdb ); ok( res == ERROR_SUCCESS , "Failed to close database\n" ); - res = MsiOpenDatabase( msifile, MSIDBOPEN_DIRECT, &hdb ); + res = MsiOpenDatabaseW( msifileW, MSIDBOPEN_DIRECT, &hdb ); ok( res == ERROR_SUCCESS , "Failed to open database\n" ); res = MsiCloseHandle( hdb ); ok( res == ERROR_SUCCESS , "Failed to close database\n" ); - res = MsiOpenDatabase( msifile, MSIDBOPEN_TRANSACT, &hdb ); + res = MsiOpenDatabaseW( msifileW, MSIDBOPEN_TRANSACT, &hdb ); ok( res == ERROR_SUCCESS , "Failed to open database\n" ); res = MsiCloseHandle( hdb ); ok( res == ERROR_SUCCESS , "Failed to close database\n" ); - ok( INVALID_FILE_ATTRIBUTES != GetFileAttributes( msifile ), "database should exist\n"); + ok( GetFileAttributesA( msifile ) != INVALID_FILE_ATTRIBUTES, "database should exist\n"); /* MSIDBOPEN_CREATE deletes the database if MsiCommitDatabase isn't called */ - res = MsiOpenDatabase( msifile, MSIDBOPEN_CREATE, &hdb ); + res = MsiOpenDatabaseW( msifileW, MSIDBOPEN_CREATE, &hdb ); ok( res == ERROR_SUCCESS , "Failed to open database\n" ); - ok( INVALID_FILE_ATTRIBUTES != GetFileAttributes( msifile ), "database should exist\n"); + ok( GetFileAttributesA( msifile ) != INVALID_FILE_ATTRIBUTES, "database should exist\n"); res = MsiCloseHandle( hdb ); ok( res == ERROR_SUCCESS , "Failed to close database\n" ); - ok( INVALID_FILE_ATTRIBUTES == GetFileAttributes( msifile ), "database should exist\n"); + ok( GetFileAttributesA( msifile ) == INVALID_FILE_ATTRIBUTES, "database should exist\n"); - res = MsiOpenDatabase( msifile, MSIDBOPEN_CREATE, &hdb ); + res = MsiOpenDatabaseW( msifileW, MSIDBOPEN_CREATE, &hdb ); ok( res == ERROR_SUCCESS , "Failed to open database\n" ); res = MsiDatabaseCommit( hdb ); ok( res == ERROR_SUCCESS , "Failed to commit database\n" ); - ok( INVALID_FILE_ATTRIBUTES != GetFileAttributes( msifile ), "database should exist\n"); + ok( GetFileAttributesA( msifile ) != INVALID_FILE_ATTRIBUTES, "database should exist\n"); res = MsiCloseHandle( hdb ); ok( res == ERROR_SUCCESS , "Failed to close database\n" ); - res = DeleteFile( msifile2 ); + res = DeleteFileA( msifile2 ); ok( res == TRUE, "Failed to delete database\n" ); - res = DeleteFile( msifile ); + res = DeleteFileA( msifile ); ok( res == TRUE, "Failed to delete database\n" ); } @@ -153,7 +154,7 @@ static UINT do_query(MSIHANDLE hdb, const char *query, MSIHANDLE *phrec) *phrec = 0; /* open a select query */ - r = MsiDatabaseOpenView(hdb, query, &hview); + r = MsiDatabaseOpenViewA(hdb, query, &hview); if (r != ERROR_SUCCESS) return r; r = MsiViewExecute(hview, 0); @@ -174,7 +175,7 @@ static UINT run_query( MSIHANDLE hdb, MSIHANDLE hrec, const char *query ) MSIHANDLE hview = 0; UINT r; - r = MsiDatabaseOpenView(hdb, query, &hview); + r = MsiDatabaseOpenViewA(hdb, query, &hview); if( r != ERROR_SUCCESS ) return r; @@ -303,17 +304,17 @@ static void test_msiinsert(void) char buf[80]; DWORD sz; - DeleteFile(msifile); + DeleteFileA(msifile); /* just MsiOpenDatabase should not create a file */ - r = MsiOpenDatabase(msifile, MSIDBOPEN_CREATE, &hdb); + r = MsiOpenDatabaseW(msifileW, MSIDBOPEN_CREATE, &hdb); ok(r == ERROR_SUCCESS, "MsiOpenDatabase failed\n"); /* create a table */ query = "CREATE TABLE `phone` ( " "`id` INT, `name` CHAR(32), `number` CHAR(32) " "PRIMARY KEY `id`)"; - r = MsiDatabaseOpenView(hdb, query, &hview); + r = MsiDatabaseOpenViewA(hdb, query, &hview); ok(r == ERROR_SUCCESS, "MsiDatabaseOpenView failed\n"); r = MsiViewExecute(hview, 0); ok(r == ERROR_SUCCESS, "MsiViewExecute failed\n"); @@ -323,7 +324,7 @@ static void test_msiinsert(void) ok(r == ERROR_SUCCESS, "MsiCloseHandle failed\n"); query = "SELECT * FROM phone WHERE number = '8675309'"; - r = MsiDatabaseOpenView(hdb, query, &hview2); + r = MsiDatabaseOpenViewA(hdb, query, &hview2); ok(r == ERROR_SUCCESS, "MsiDatabaseOpenView failed\n"); r = MsiViewExecute(hview2, 0); ok(r == ERROR_SUCCESS, "MsiViewExecute failed\n"); @@ -333,7 +334,7 @@ static void test_msiinsert(void) /* insert a value into it */ query = "INSERT INTO `phone` ( `id`, `name`, `number` )" "VALUES('1', 'Abe', '8675309')"; - r = MsiDatabaseOpenView(hdb, query, &hview); + r = MsiDatabaseOpenViewA(hdb, query, &hview); ok(r == ERROR_SUCCESS, "MsiDatabaseOpenView failed\n"); r = MsiViewExecute(hview, 0); ok(r == ERROR_SUCCESS, "MsiViewExecute failed\n"); @@ -370,11 +371,11 @@ static void test_msiinsert(void) r = MsiRecordGetInteger(hrec, 1); ok(r == 1, "field 1 contents wrong\n"); sz = sizeof buf; - r = MsiRecordGetString(hrec, 2, buf, &sz); + r = MsiRecordGetStringA(hrec, 2, buf, &sz); ok(r == ERROR_SUCCESS, "field 2 content fetch failed\n"); ok(!strcmp(buf,"Abe"), "field 2 content incorrect\n"); sz = sizeof buf; - r = MsiRecordGetString(hrec, 3, buf, &sz); + r = MsiRecordGetStringA(hrec, 3, buf, &sz); ok(r == ERROR_SUCCESS, "field 3 content fetch failed\n"); ok(!strcmp(buf,"8675309"), "field 3 content incorrect\n"); @@ -410,22 +411,22 @@ static void test_msiinsert(void) /* now try a few bad INSERT xqueries */ query = "INSERT INTO `phone` ( `id`, `name`, `number` )" "VALUES(?, ?)"; - r = MsiDatabaseOpenView(hdb, query, &hview); + r = MsiDatabaseOpenViewA(hdb, query, &hview); ok(r == ERROR_BAD_QUERY_SYNTAX, "MsiDatabaseOpenView failed\n"); /* construct a record to insert */ hrec = MsiCreateRecord(4); r = MsiRecordSetInteger(hrec, 1, 2); ok(r == ERROR_SUCCESS, "MsiRecordSetInteger failed\n"); - r = MsiRecordSetString(hrec, 2, "Adam"); + r = MsiRecordSetStringA(hrec, 2, "Adam"); ok(r == ERROR_SUCCESS, "MsiRecordSetString failed\n"); - r = MsiRecordSetString(hrec, 3, "96905305"); + r = MsiRecordSetStringA(hrec, 3, "96905305"); ok(r == ERROR_SUCCESS, "MsiRecordSetString failed\n"); /* insert another value, using a record and wildcards */ query = "INSERT INTO `phone` ( `id`, `name`, `number` )" "VALUES(?, ?, ?)"; - r = MsiDatabaseOpenView(hdb, query, &hview); + r = MsiDatabaseOpenViewA(hdb, query, &hview); ok(r == ERROR_SUCCESS, "MsiDatabaseOpenView failed\n"); if (r == ERROR_SUCCESS) @@ -449,7 +450,7 @@ static void test_msiinsert(void) r = MsiCloseHandle(hdb); ok(r == ERROR_SUCCESS, "MsiCloseHandle failed\n"); - r = DeleteFile(msifile); + r = DeleteFileA(msifile); ok(r == TRUE, "file didn't exist after commit\n"); } @@ -462,7 +463,7 @@ static void test_msidecomposedesc(void) DWORD len; HMODULE hmod; - hmod = GetModuleHandle("msi.dll"); + hmod = GetModuleHandleA("msi.dll"); pMsiDecomposeDescriptorA = (void*)GetProcAddress(hmod, "MsiDecomposeDescriptorA"); if (!pMsiDecomposeDescriptorA) return; @@ -527,7 +528,7 @@ static UINT try_query_param( MSIHANDLE hdb, LPCSTR szQuery, MSIHANDLE hrec ) MSIHANDLE htab = 0; UINT res; - res = MsiDatabaseOpenView( hdb, szQuery, &htab ); + res = MsiDatabaseOpenViewA( hdb, szQuery, &htab ); if(res == ERROR_SUCCESS ) { UINT r; @@ -558,7 +559,7 @@ static UINT try_insert_query( MSIHANDLE hdb, LPCSTR szQuery ) UINT r; hrec = MsiCreateRecord( 1 ); - MsiRecordSetString( hrec, 1, "Hello"); + MsiRecordSetStringA( hrec, 1, "Hello"); r = try_query_param( hdb, szQuery, hrec ); @@ -571,10 +572,10 @@ static void test_msibadqueries(void) MSIHANDLE hdb = 0; UINT r; - DeleteFile(msifile); + DeleteFileA(msifile); /* just MsiOpenDatabase should not create a file */ - r = MsiOpenDatabase(msifile, MSIDBOPEN_CREATE, &hdb); + r = MsiOpenDatabaseW(msifileW, MSIDBOPEN_CREATE, &hdb); ok(r == ERROR_SUCCESS, "MsiOpenDatabase failed\n"); r = MsiDatabaseCommit( hdb ); @@ -584,7 +585,7 @@ static void test_msibadqueries(void) ok(r == ERROR_SUCCESS , "Failed to close database\n"); /* open it readonly */ - r = MsiOpenDatabase(msifile, MSIDBOPEN_READONLY, &hdb ); + r = MsiOpenDatabaseW(msifileW, MSIDBOPEN_READONLY, &hdb ); ok(r == ERROR_SUCCESS , "Failed to open database r/o\n"); /* add a table to it */ @@ -595,7 +596,7 @@ static void test_msibadqueries(void) ok(r == ERROR_SUCCESS , "Failed to close database r/o\n"); /* open it read/write */ - r = MsiOpenDatabase(msifile, MSIDBOPEN_TRANSACT, &hdb ); + r = MsiOpenDatabaseW(msifileW, MSIDBOPEN_TRANSACT, &hdb ); ok(r == ERROR_SUCCESS , "Failed to open database r/w\n"); /* a bunch of test queries that fail with the native MSI */ @@ -781,7 +782,7 @@ static void test_msibadqueries(void) r = MsiCloseHandle( hdb ); ok(r == ERROR_SUCCESS , "Failed to close database transact\n"); - r = DeleteFile( msifile ); + r = DeleteFileA( msifile ); ok(r == TRUE, "file didn't exist after commit\n"); } @@ -794,10 +795,10 @@ static void test_viewmodify(void) char buffer[0x100]; DWORD sz; - DeleteFile(msifile); + DeleteFileA(msifile); /* just MsiOpenDatabase should not create a file */ - r = MsiOpenDatabase(msifile, MSIDBOPEN_CREATE, &hdb); + r = MsiOpenDatabaseW(msifileW, MSIDBOPEN_CREATE, &hdb); ok(r == ERROR_SUCCESS, "MsiOpenDatabase failed\n"); query = "CREATE TABLE `phone` ( " @@ -822,39 +823,39 @@ static void test_viewmodify(void) /* check what the error function reports without doing anything */ sz = 0; /* passing NULL as the 3rd param make function to crash on older platforms */ - err = MsiViewGetError( 0, NULL, &sz ); + err = MsiViewGetErrorA( 0, NULL, &sz ); ok(err == MSIDBERROR_INVALIDARG, "MsiViewGetError return\n"); /* open a view */ query = "SELECT * FROM `phone`"; - r = MsiDatabaseOpenView(hdb, query, &hview); + r = MsiDatabaseOpenViewA(hdb, query, &hview); ok(r == ERROR_SUCCESS, "MsiDatabaseOpenView failed\n"); /* see what happens with a good hview and bad args */ - err = MsiViewGetError( hview, NULL, NULL ); + err = MsiViewGetErrorA( hview, NULL, NULL ); ok(err == MSIDBERROR_INVALIDARG || err == MSIDBERROR_NOERROR, "MsiViewGetError returns %u (expected -3)\n", err); - err = MsiViewGetError( hview, buffer, NULL ); + err = MsiViewGetErrorA( hview, buffer, NULL ); ok(err == MSIDBERROR_INVALIDARG, "MsiViewGetError return\n"); /* see what happens with a zero length buffer */ sz = 0; buffer[0] = 'x'; - err = MsiViewGetError( hview, buffer, &sz ); + err = MsiViewGetErrorA( hview, buffer, &sz ); ok(err == MSIDBERROR_MOREDATA, "MsiViewGetError return\n"); ok(buffer[0] == 'x', "buffer cleared\n"); ok(sz == 0, "size not zero\n"); /* ok this one is strange */ sz = 0; - err = MsiViewGetError( hview, NULL, &sz ); + err = MsiViewGetErrorA( hview, NULL, &sz ); ok(err == MSIDBERROR_NOERROR, "MsiViewGetError return\n"); ok(sz == 0, "size not zero\n"); /* see if it really has an error */ sz = sizeof buffer; buffer[0] = 'x'; - err = MsiViewGetError( hview, buffer, &sz ); + err = MsiViewGetErrorA( hview, buffer, &sz ); ok(err == MSIDBERROR_NOERROR, "MsiViewGetError return\n"); ok(buffer[0] == 0, "buffer not cleared\n"); ok(sz == 0, "size not zero\n"); @@ -875,7 +876,7 @@ static void test_viewmodify(void) sz = sizeof buffer; buffer[0] = 'x'; - err = MsiViewGetError( hview, buffer, &sz ); + err = MsiViewGetErrorA( hview, buffer, &sz ); ok(err == MSIDBERROR_NOERROR, "MsiViewGetError return\n"); ok(buffer[0] == 0, "buffer not cleared\n"); ok(sz == 0, "size not zero\n"); @@ -888,9 +889,9 @@ static void test_viewmodify(void) r = MsiRecordSetInteger(hrec, 1, 1); ok(r == ERROR_SUCCESS, "failed to set integer\n"); - r = MsiRecordSetString(hrec, 2, "bob"); + r = MsiRecordSetStringA(hrec, 2, "bob"); ok(r == ERROR_SUCCESS, "failed to set string\n"); - r = MsiRecordSetString(hrec, 3, "7654321"); + r = MsiRecordSetStringA(hrec, 3, "7654321"); ok(r == ERROR_SUCCESS, "failed to set string\n"); r = MsiViewExecute(hview, 0); @@ -907,7 +908,7 @@ static void test_viewmodify(void) sz = sizeof buffer; buffer[0] = 'x'; - err = MsiViewGetError( hview, buffer, &sz ); + err = MsiViewGetErrorA( hview, buffer, &sz ); ok(err == MSIDBERROR_DUPLICATEKEY, "MsiViewGetError returned %u\n", err); ok(!strcmp(buffer, "id"), "expected \"id\" c, got \"%s\"\n", buffer); ok(sz == 2, "size not 2\n"); @@ -934,9 +935,9 @@ static void test_viewmodify(void) r = MsiRecordSetInteger(hrec, 1, 10); ok(r == ERROR_SUCCESS, "failed to set integer\n"); - r = MsiRecordSetString(hrec, 2, "pepe"); + r = MsiRecordSetStringA(hrec, 2, "pepe"); ok(r == ERROR_SUCCESS, "failed to set string\n"); - r = MsiRecordSetString(hrec, 3, "7654321"); + r = MsiRecordSetStringA(hrec, 3, "7654321"); ok(r == ERROR_SUCCESS, "failed to set string\n"); r = MsiViewModify(hview, MSIMODIFY_MERGE, hrec ); @@ -953,7 +954,7 @@ static void test_viewmodify(void) ok(r == ERROR_SUCCESS, "MsiCloseHandle failed\n"); query = "SELECT * FROM `phone`"; - r = MsiDatabaseOpenView(hdb, query, &hview); + r = MsiDatabaseOpenViewA(hdb, query, &hview); ok(r == ERROR_SUCCESS, "MsiDatabaseOpenView failed\n"); r = MsiViewExecute(hview, 0); @@ -966,17 +967,17 @@ static void test_viewmodify(void) ok(r == 1, "Expected 1, got %d\n", r); sz = sizeof(buffer); - r = MsiRecordGetString(hrec, 2, buffer, &sz); + r = MsiRecordGetStringA(hrec, 2, buffer, &sz); ok(r == ERROR_SUCCESS, "MsiRecordGetString failed\n"); - ok(!lstrcmp(buffer, "bob"), "Expected bob, got %s\n", buffer); + ok(!lstrcmpA(buffer, "bob"), "Expected bob, got %s\n", buffer); sz = sizeof(buffer); - r = MsiRecordGetString(hrec, 3, buffer, &sz); + r = MsiRecordGetStringA(hrec, 3, buffer, &sz); ok(r == ERROR_SUCCESS, "MsiRecordGetString failed\n"); - ok(!lstrcmp(buffer, "7654321"), "Expected 7654321, got %s\n", buffer); + ok(!lstrcmpA(buffer, "7654321"), "Expected 7654321, got %s\n", buffer); /* update the view, non-primary key */ - r = MsiRecordSetString(hrec, 3, "3141592"); + r = MsiRecordSetStringA(hrec, 3, "3141592"); ok(r == ERROR_SUCCESS, "MsiRecordSetString failed\n"); r = MsiViewModify(hview, MSIMODIFY_UPDATE, hrec); @@ -1002,7 +1003,7 @@ static void test_viewmodify(void) ok(r == ERROR_SUCCESS, "MsiCloseHandle failed\n"); query = "SELECT * FROM `phone`"; - r = MsiDatabaseOpenView(hdb, query, &hview); + r = MsiDatabaseOpenViewA(hdb, query, &hview); ok(r == ERROR_SUCCESS, "MsiDatabaseOpenView failed\n"); r = MsiViewExecute(hview, 0); @@ -1015,14 +1016,14 @@ static void test_viewmodify(void) ok(r == 1, "Expected 1, got %d\n", r); sz = sizeof(buffer); - r = MsiRecordGetString(hrec, 2, buffer, &sz); + r = MsiRecordGetStringA(hrec, 2, buffer, &sz); ok(r == ERROR_SUCCESS, "MsiRecordGetString failed\n"); - ok(!lstrcmp(buffer, "bob"), "Expected bob, got %s\n", buffer); + ok(!lstrcmpA(buffer, "bob"), "Expected bob, got %s\n", buffer); sz = sizeof(buffer); - r = MsiRecordGetString(hrec, 3, buffer, &sz); + r = MsiRecordGetStringA(hrec, 3, buffer, &sz); ok(r == ERROR_SUCCESS, "MsiRecordGetString failed\n"); - ok(!lstrcmp(buffer, "3141592"), "Expected 3141592, got %s\n", buffer); + ok(!lstrcmpA(buffer, "3141592"), "Expected 3141592, got %s\n", buffer); r = MsiCloseHandle(hrec); ok(r == ERROR_SUCCESS, "failed to close record\n"); @@ -1033,9 +1034,9 @@ static void test_viewmodify(void) r = MsiRecordSetInteger(hrec, 1, 3); ok(r == ERROR_SUCCESS, "failed to set integer\n"); - r = MsiRecordSetString(hrec, 2, "jane"); + r = MsiRecordSetStringA(hrec, 2, "jane"); ok(r == ERROR_SUCCESS, "failed to set string\n"); - r = MsiRecordSetString(hrec, 3, "112358"); + r = MsiRecordSetStringA(hrec, 3, "112358"); ok(r == ERROR_SUCCESS, "failed to set string\n"); r = MsiViewModify(hview, MSIMODIFY_UPDATE, hrec); @@ -1050,9 +1051,9 @@ static void test_viewmodify(void) r = MsiRecordSetInteger(hrec, 1, 1); ok(r == ERROR_SUCCESS, "failed to set integer\n"); - r = MsiRecordSetString(hrec, 2, "jane"); + r = MsiRecordSetStringA(hrec, 2, "jane"); ok(r == ERROR_SUCCESS, "failed to set string\n"); - r = MsiRecordSetString(hrec, 3, "112358"); + r = MsiRecordSetStringA(hrec, 3, "112358"); ok(r == ERROR_SUCCESS, "failed to set string\n"); r = MsiViewModify(hview, MSIMODIFY_UPDATE, hrec); @@ -1065,9 +1066,9 @@ static void test_viewmodify(void) r = MsiRecordSetInteger(hrec, 1, 2); ok(r == ERROR_SUCCESS, "failed to set integer\n"); - r = MsiRecordSetString(hrec, 2, "nick"); + r = MsiRecordSetStringA(hrec, 2, "nick"); ok(r == ERROR_SUCCESS, "failed to set string\n"); - r = MsiRecordSetString(hrec, 3, "141421"); + r = MsiRecordSetStringA(hrec, 3, "141421"); ok(r == ERROR_SUCCESS, "failed to set string\n"); r = MsiViewExecute(hview, 0); @@ -1083,7 +1084,7 @@ static void test_viewmodify(void) ok(r == ERROR_SUCCESS, "MsiCloseHandle failed\n"); query = "SELECT * FROM `phone` WHERE `id` = 1"; - r = MsiDatabaseOpenView(hdb, query, &hview); + r = MsiDatabaseOpenViewA(hdb, query, &hview); ok(r == ERROR_SUCCESS, "MsiDatabaseOpenView failed\n"); r = MsiViewExecute(hview, 0); ok(r == ERROR_SUCCESS, "MsiViewExecute failed\n"); @@ -1093,7 +1094,7 @@ static void test_viewmodify(void) /* change the id to match the second row */ r = MsiRecordSetInteger(hrec, 1, 2); ok(r == ERROR_SUCCESS, "failed to set integer\n"); - r = MsiRecordSetString(hrec, 2, "jerry"); + r = MsiRecordSetStringA(hrec, 2, "jerry"); ok(r == ERROR_SUCCESS, "failed to set string\n"); r = MsiViewModify(hview, MSIMODIFY_UPDATE, hrec); @@ -1108,7 +1109,7 @@ static void test_viewmodify(void) /* broader search */ query = "SELECT * FROM `phone` ORDER BY `id`"; - r = MsiDatabaseOpenView(hdb, query, &hview); + r = MsiDatabaseOpenViewA(hdb, query, &hview); ok(r == ERROR_SUCCESS, "MsiDatabaseOpenView failed\n"); r = MsiViewExecute(hview, 0); ok(r == ERROR_SUCCESS, "MsiViewExecute failed\n"); @@ -1118,7 +1119,7 @@ static void test_viewmodify(void) /* change the id to match the second row */ r = MsiRecordSetInteger(hrec, 1, 2); ok(r == ERROR_SUCCESS, "failed to set integer\n"); - r = MsiRecordSetString(hrec, 2, "jerry"); + r = MsiRecordSetStringA(hrec, 2, "jerry"); ok(r == ERROR_SUCCESS, "failed to set string\n"); r = MsiViewModify(hview, MSIMODIFY_UPDATE, hrec); @@ -1140,10 +1141,10 @@ static MSIHANDLE create_db(void) MSIHANDLE hdb = 0; UINT res; - DeleteFile(msifile); + DeleteFileW(msifileW); /* create an empty database */ - res = MsiOpenDatabase(msifile, MSIDBOPEN_CREATE, &hdb ); + res = MsiOpenDatabaseW(msifileW, MSIDBOPEN_CREATE, &hdb ); ok( res == ERROR_SUCCESS , "Failed to create database\n" ); if( res != ERROR_SUCCESS ) return hdb; @@ -1166,7 +1167,7 @@ static void test_getcolinfo(void) ok( hdb, "failed to create db\n"); /* tables should be present */ - r = MsiDatabaseOpenView(hdb, "select * from _Tables", &hview); + r = MsiDatabaseOpenViewA(hdb, "select * from _Tables", &hview); ok( r == ERROR_SUCCESS, "failed to open query\n"); r = MsiViewExecute(hview, 0); @@ -1177,7 +1178,7 @@ static void test_getcolinfo(void) r = MsiViewGetColumnInfo( hview, MSICOLINFO_NAMES, &rec ); ok( r == ERROR_SUCCESS, "failed to get names\n"); sz = sizeof buffer; - r = MsiRecordGetString(rec, 1, buffer, &sz ); + r = MsiRecordGetStringA(rec, 1, buffer, &sz ); ok( r == ERROR_SUCCESS, "failed to get string\n"); ok( !strcmp(buffer,"Name"), "_Tables has wrong column name\n"); r = MsiCloseHandle( rec ); @@ -1188,7 +1189,7 @@ static void test_getcolinfo(void) r = MsiViewGetColumnInfo( hview, MSICOLINFO_TYPES, &rec ); ok( r == ERROR_SUCCESS, "failed to get names\n"); sz = sizeof buffer; - r = MsiRecordGetString(rec, 1, buffer, &sz ); + r = MsiRecordGetStringA(rec, 1, buffer, &sz ); ok( r == ERROR_SUCCESS, "failed to get string\n"); ok( !strcmp(buffer,"s64"), "_Tables has wrong column type\n"); r = MsiCloseHandle( rec ); @@ -1219,7 +1220,7 @@ static MSIHANDLE get_column_info(MSIHANDLE hdb, const char *query, MSICOLINFO ty MSIHANDLE hview = 0, rec = 0; UINT r; - r = MsiDatabaseOpenView(hdb, query, &hview); + r = MsiDatabaseOpenViewA(hdb, query, &hview); if( r != ERROR_SUCCESS ) return r; @@ -1241,7 +1242,7 @@ static UINT get_columns_table_type(MSIHANDLE hdb, const char *table, UINT field) sprintf(query, "select * from `_Columns` where `Table` = '%s'", table ); - r = MsiDatabaseOpenView(hdb, query, &hview); + r = MsiDatabaseOpenViewA(hdb, query, &hview); if( r != ERROR_SUCCESS ) return r; @@ -1271,7 +1272,7 @@ static BOOL check_record( MSIHANDLE rec, UINT field, LPCSTR val ) DWORD sz; sz = sizeof buffer; - r = MsiRecordGetString( rec, field, buffer, &sz ); + r = MsiRecordGetStringA( rec, field, buffer, &sz ); return (r == ERROR_SUCCESS ) && !strcmp(val, buffer); } @@ -1397,17 +1398,17 @@ static void test_msiexport(void) "phone\tid\r\n" "1\tAbe\t8675309\r\n"; - DeleteFile(msifile); + DeleteFileW(msifileW); /* just MsiOpenDatabase should not create a file */ - r = MsiOpenDatabase(msifile, MSIDBOPEN_CREATE, &hdb); + r = MsiOpenDatabaseW(msifileW, MSIDBOPEN_CREATE, &hdb); ok(r == ERROR_SUCCESS, "MsiOpenDatabase failed\n"); /* create a table */ query = "CREATE TABLE `phone` ( " "`id` INT, `name` CHAR(32), `number` CHAR(32) " "PRIMARY KEY `id`)"; - r = MsiDatabaseOpenView(hdb, query, &hview); + r = MsiDatabaseOpenViewA(hdb, query, &hview); ok(r == ERROR_SUCCESS, "MsiDatabaseOpenView failed\n"); r = MsiViewExecute(hview, 0); ok(r == ERROR_SUCCESS, "MsiViewExecute failed\n"); @@ -1419,7 +1420,7 @@ static void test_msiexport(void) /* insert a value into it */ query = "INSERT INTO `phone` ( `id`, `name`, `number` )" "VALUES('1', 'Abe', '8675309')"; - r = MsiDatabaseOpenView(hdb, query, &hview); + r = MsiDatabaseOpenViewA(hdb, query, &hview); ok(r == ERROR_SUCCESS, "MsiDatabaseOpenView failed\n"); r = MsiViewExecute(hview, 0); ok(r == ERROR_SUCCESS, "MsiViewExecute failed\n"); @@ -1428,32 +1429,32 @@ static void test_msiexport(void) r = MsiCloseHandle(hview); ok(r == ERROR_SUCCESS, "MsiCloseHandle failed\n"); - GetCurrentDirectory(MAX_PATH, path); + GetCurrentDirectoryA(MAX_PATH, path); - r = MsiDatabaseExport(hdb, "phone", path, file); + r = MsiDatabaseExportA(hdb, "phone", path, file); ok(r == ERROR_SUCCESS, "MsiDatabaseExport failed\n"); MsiCloseHandle(hdb); - lstrcat(path, "\\"); - lstrcat(path, file); + lstrcatA(path, "\\"); + lstrcatA(path, file); /* check the data that was written */ length = 0; memset(buffer, 0, sizeof buffer); - handle = CreateFile(path, GENERIC_READ, 0, NULL, OPEN_EXISTING, 0, NULL); + handle = CreateFileA(path, GENERIC_READ, 0, NULL, OPEN_EXISTING, 0, NULL); if (handle != INVALID_HANDLE_VALUE) { ReadFile(handle, buffer, sizeof buffer, &length, NULL); CloseHandle(handle); - DeleteFile(path); + DeleteFileA(path); } else ok(0, "failed to open file %s\n", path); ok( length == strlen(expected), "length of data wrong\n"); - ok( !lstrcmp(buffer, expected), "data doesn't match\n"); - DeleteFile(msifile); + ok( !lstrcmpA(buffer, expected), "data doesn't match\n"); + DeleteFileA(msifile); } static void test_longstrings(void) @@ -1466,9 +1467,9 @@ static void test_longstrings(void) UINT r; const DWORD STRING_LENGTH = 0x10005; - DeleteFile(msifile); + DeleteFileW(msifileW); /* just MsiOpenDatabase should not create a file */ - r = MsiOpenDatabase(msifile, MSIDBOPEN_CREATE, &hdb); + r = MsiOpenDatabaseW(msifileW, MSIDBOPEN_CREATE, &hdb); ok(r == ERROR_SUCCESS, "MsiOpenDatabase failed\n"); /* create a table */ @@ -1476,7 +1477,7 @@ static void test_longstrings(void) "CREATE TABLE `strings` ( `id` INT, `val` CHAR(0) PRIMARY KEY `id`)"); ok(r == ERROR_SUCCESS, "query failed\n"); - /* try a insert a very long string */ + /* try to insert a very long string */ str = HeapAlloc(GetProcessHeap(), 0, STRING_LENGTH+sizeof insert_query); len = strchr(insert_query, 'Z') - insert_query; strcpy(str, insert_query); @@ -1491,10 +1492,10 @@ static void test_longstrings(void) ok(r == ERROR_SUCCESS, "MsiDatabaseCommit failed\n"); MsiCloseHandle(hdb); - r = MsiOpenDatabase(msifile, MSIDBOPEN_READONLY, &hdb); + r = MsiOpenDatabaseW(msifileW, MSIDBOPEN_READONLY, &hdb); ok(r == ERROR_SUCCESS, "MsiOpenDatabase failed\n"); - r = MsiDatabaseOpenView(hdb, "select * from `strings` where `id` = 1", &hview); + r = MsiDatabaseOpenViewA(hdb, "select * from `strings` where `id` = 1", &hview); ok(r == ERROR_SUCCESS, "MsiDatabaseOpenView failed\n"); r = MsiViewExecute(hview, 0); @@ -1506,13 +1507,13 @@ static void test_longstrings(void) MsiViewClose(hview); MsiCloseHandle(hview); - r = MsiRecordGetString(hrec, 2, NULL, &len); + r = MsiRecordGetStringA(hrec, 2, NULL, &len); ok(r == ERROR_SUCCESS, "MsiViewFetch failed\n"); ok(len == STRING_LENGTH, "string length wrong\n"); MsiCloseHandle(hrec); MsiCloseHandle(hdb); - DeleteFile(msifile); + DeleteFileA(msifile); } static void create_file_data(LPCSTR name, LPCSTR data, DWORD size) @@ -1564,7 +1565,7 @@ static void test_streamtable(void) MsiCloseHandle( hdb ); - r = MsiOpenDatabase(msifile, MSIDBOPEN_TRANSACT, &hdb ); + r = MsiOpenDatabaseW(msifileW, MSIDBOPEN_TRANSACT, &hdb ); ok( r == ERROR_SUCCESS , "Failed to open database\n" ); /* check the column types */ @@ -1585,7 +1586,7 @@ static void test_streamtable(void) MsiCloseHandle( rec ); - r = MsiDatabaseOpenView( hdb, + r = MsiDatabaseOpenViewA( hdb, "SELECT * FROM `_Streams` WHERE `Name` = '\5SummaryInformation'", &view ); ok( r == ERROR_SUCCESS, "Failed to open database view: %u\n", r ); @@ -1611,7 +1612,7 @@ static void test_streamtable(void) MsiCloseHandle( hsi ); - r = MsiDatabaseOpenView( hdb, + r = MsiDatabaseOpenViewA( hdb, "SELECT * FROM `_Streams` WHERE `Name` = '\5SummaryInformation'", &view ); ok( r == ERROR_SUCCESS, "Failed to open database view: %u\n", r ); @@ -1629,14 +1630,14 @@ static void test_streamtable(void) create_file( "test.txt" ); rec = MsiCreateRecord( 2 ); - MsiRecordSetString( rec, 1, "data" ); + MsiRecordSetStringA( rec, 1, "data" ); - r = MsiRecordSetStream( rec, 2, "test.txt" ); + r = MsiRecordSetStreamA( rec, 2, "test.txt" ); ok( r == ERROR_SUCCESS, "Failed to add stream data to the record: %d\n", r); - DeleteFile("test.txt"); + DeleteFileA("test.txt"); - r = MsiDatabaseOpenView( hdb, + r = MsiDatabaseOpenViewA( hdb, "INSERT INTO `_Streams` ( `Name`, `Data` ) VALUES ( ?, ? )", &view ); ok( r == ERROR_SUCCESS, "Failed to open database view: %d\n", r); @@ -1651,14 +1652,14 @@ static void test_streamtable(void) create_file( "test1.txt" ); rec = MsiCreateRecord( 2 ); - MsiRecordSetString( rec, 1, "data1" ); + MsiRecordSetStringA( rec, 1, "data1" ); - r = MsiRecordSetStream( rec, 2, "test1.txt" ); + r = MsiRecordSetStreamA( rec, 2, "test1.txt" ); ok( r == ERROR_SUCCESS, "Failed to add stream data to the record: %d\n", r); - DeleteFile("test1.txt"); + DeleteFileA("test1.txt"); - r = MsiDatabaseOpenView( hdb, + r = MsiDatabaseOpenViewA( hdb, "INSERT INTO `_Streams` ( `Name`, `Data` ) VALUES ( ?, ? )", &view ); ok( r == ERROR_SUCCESS, "Failed to open database view: %d\n", r); @@ -1669,7 +1670,7 @@ static void test_streamtable(void) MsiViewClose( view ); MsiCloseHandle( view ); - r = MsiDatabaseOpenView( hdb, + r = MsiDatabaseOpenViewA( hdb, "SELECT `Name`, `Data` FROM `_Streams` WHERE `Name` = 'data'", &view ); ok( r == ERROR_SUCCESS, "Failed to open database view: %d\n", r); @@ -1680,21 +1681,21 @@ static void test_streamtable(void) ok( r == ERROR_SUCCESS, "Failed to fetch record: %d\n", r); size = MAX_PATH; - r = MsiRecordGetString( rec, 1, file, &size ); + r = MsiRecordGetStringA( rec, 1, file, &size ); ok( r == ERROR_SUCCESS, "Failed to get string: %d\n", r); - ok( !lstrcmp(file, "data"), "Expected 'data', got %s\n", file); + ok( !lstrcmpA(file, "data"), "Expected 'data', got %s\n", file); size = MAX_PATH; memset(buf, 0, MAX_PATH); r = MsiRecordReadStream( rec, 2, buf, &size ); ok( r == ERROR_SUCCESS, "Failed to get stream: %d\n", r); - ok( !lstrcmp(buf, "test.txt\n"), "Expected 'test.txt\\n', got %s\n", buf); + ok( !lstrcmpA(buf, "test.txt\n"), "Expected 'test.txt\\n', got %s\n", buf); MsiCloseHandle( rec ); MsiViewClose( view ); MsiCloseHandle( view ); - r = MsiDatabaseOpenView( hdb, + r = MsiDatabaseOpenViewA( hdb, "SELECT `Name`, `Data` FROM `_Streams` WHERE `Name` = 'data1'", &view ); ok( r == ERROR_SUCCESS, "Failed to open database view: %d\n", r); @@ -1705,15 +1706,15 @@ static void test_streamtable(void) ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r); size = MAX_PATH; - r = MsiRecordGetString( rec, 1, file, &size ); + r = MsiRecordGetStringA( rec, 1, file, &size ); ok( r == ERROR_SUCCESS, "Failed to get string: %d\n", r); - ok( !lstrcmp(file, "data1"), "Expected 'data1', got %s\n", file); + ok( !lstrcmpA(file, "data1"), "Expected 'data1', got %s\n", file); size = MAX_PATH; memset(buf, 0, MAX_PATH); r = MsiRecordReadStream( rec, 2, buf, &size ); ok( r == ERROR_SUCCESS, "Failed to get stream: %d\n", r); - ok( !lstrcmp(buf, "test1.txt\n"), "Expected 'test1.txt\\n', got %s\n", buf); + ok( !lstrcmpA(buf, "test1.txt\n"), "Expected 'test1.txt\\n', got %s\n", buf); MsiCloseHandle( rec ); MsiViewClose( view ); @@ -1723,12 +1724,12 @@ static void test_streamtable(void) create_file( "test2.txt" ); rec = MsiCreateRecord( 1 ); - r = MsiRecordSetStream( rec, 1, "test2.txt" ); + r = MsiRecordSetStreamA( rec, 1, "test2.txt" ); ok( r == ERROR_SUCCESS, "Failed to add stream data to the record: %d\n", r); - DeleteFile("test2.txt"); + DeleteFileA("test2.txt"); - r = MsiDatabaseOpenView( hdb, + r = MsiDatabaseOpenViewA( hdb, "UPDATE `_Streams` SET `Data` = ? WHERE `Name` = 'data1'", &view ); ok( r == ERROR_SUCCESS, "Failed to open database view: %d\n", r); @@ -1739,7 +1740,7 @@ static void test_streamtable(void) MsiViewClose( view ); MsiCloseHandle( view ); - r = MsiDatabaseOpenView( hdb, + r = MsiDatabaseOpenViewA( hdb, "SELECT `Name`, `Data` FROM `_Streams` WHERE `Name` = 'data1'", &view ); ok( r == ERROR_SUCCESS, "Failed to open database view: %d\n", r); @@ -1750,21 +1751,21 @@ static void test_streamtable(void) ok( r == ERROR_SUCCESS, "Failed to fetch record: %d\n", r); size = MAX_PATH; - r = MsiRecordGetString( rec, 1, file, &size ); + r = MsiRecordGetStringA( rec, 1, file, &size ); ok( r == ERROR_SUCCESS, "Failed to get string: %d\n", r); - ok( !lstrcmp(file, "data1"), "Expected 'data1', got %s\n", file); + ok( !lstrcmpA(file, "data1"), "Expected 'data1', got %s\n", file); size = MAX_PATH; memset(buf, 0, MAX_PATH); r = MsiRecordReadStream( rec, 2, buf, &size ); ok( r == ERROR_SUCCESS, "Failed to get stream: %d\n", r); - todo_wine ok( !lstrcmp(buf, "test2.txt\n"), "Expected 'test2.txt\\n', got %s\n", buf); + todo_wine ok( !lstrcmpA(buf, "test2.txt\n"), "Expected 'test2.txt\\n', got %s\n", buf); MsiCloseHandle( rec ); MsiViewClose( view ); MsiCloseHandle( view ); MsiCloseHandle( hdb ); - DeleteFile(msifile); + DeleteFileA(msifile); } static void test_binary(void) @@ -1777,7 +1778,7 @@ static void test_binary(void) UINT r; /* insert a file into the Binary table */ - r = MsiOpenDatabase(msifile, MSIDBOPEN_CREATE, &hdb ); + r = MsiOpenDatabaseW(msifileW, MSIDBOPEN_CREATE, &hdb ); ok( r == ERROR_SUCCESS , "Failed to open database\n" ); query = "CREATE TABLE `Binary` ( `Name` CHAR(72) NOT NULL, `ID` INT NOT NULL, `Data` OBJECT PRIMARY KEY `Name`, `ID`)"; @@ -1786,9 +1787,9 @@ static void test_binary(void) create_file( "test.txt" ); rec = MsiCreateRecord( 1 ); - r = MsiRecordSetStream( rec, 1, "test.txt" ); + r = MsiRecordSetStreamA( rec, 1, "test.txt" ); ok( r == ERROR_SUCCESS, "Failed to add stream data to the record: %d\n", r); - DeleteFile( "test.txt" ); + DeleteFileA( "test.txt" ); query = "INSERT INTO `Binary` ( `Name`, `ID`, `Data` ) VALUES ( 'filename1', 1, ? )"; r = run_query( hdb, rec, query ); @@ -1804,7 +1805,7 @@ static void test_binary(void) ok( r == ERROR_SUCCESS , "Failed to close database\n" ); /* read file from the Stream table */ - r = MsiOpenDatabase( msifile, MSIDBOPEN_READONLY, &hdb ); + r = MsiOpenDatabaseW( msifileW, MSIDBOPEN_READONLY, &hdb ); ok( r == ERROR_SUCCESS , "Failed to open database\n" ); query = "SELECT * FROM `_Streams`"; @@ -1812,15 +1813,15 @@ static void test_binary(void) ok( r == ERROR_SUCCESS, "SELECT query failed: %d\n", r ); size = MAX_PATH; - r = MsiRecordGetString( rec, 1, file, &size ); + r = MsiRecordGetStringA( rec, 1, file, &size ); ok( r == ERROR_SUCCESS, "Failed to get string: %d\n", r ); - ok( !lstrcmp(file, "Binary.filename1.1"), "Expected 'Binary.filename1.1', got %s\n", file ); + ok( !lstrcmpA(file, "Binary.filename1.1"), "Expected 'Binary.filename1.1', got %s\n", file ); size = MAX_PATH; memset( buf, 0, MAX_PATH ); r = MsiRecordReadStream( rec, 2, buf, &size ); ok( r == ERROR_SUCCESS, "Failed to get stream: %d\n", r ); - ok( !lstrcmp(buf, "test.txt\n"), "Expected 'test.txt\\n', got %s\n", buf ); + ok( !lstrcmpA(buf, "test.txt\n"), "Expected 'test.txt\\n', got %s\n", buf ); r = MsiCloseHandle( rec ); ok( r == ERROR_SUCCESS , "Failed to close record handle\n" ); @@ -1831,15 +1832,15 @@ static void test_binary(void) ok( r == ERROR_SUCCESS, "SELECT query failed: %d\n", r ); size = MAX_PATH; - r = MsiRecordGetString( rec, 1, file, &size ); + r = MsiRecordGetStringA( rec, 1, file, &size ); ok( r == ERROR_SUCCESS, "Failed to get string: %d\n", r ); - ok( !lstrcmp(file, "filename1"), "Expected 'filename1', got %s\n", file ); + ok( !lstrcmpA(file, "filename1"), "Expected 'filename1', got %s\n", file ); size = MAX_PATH; memset( buf, 0, MAX_PATH ); r = MsiRecordReadStream( rec, 3, buf, &size ); ok( r == ERROR_SUCCESS, "Failed to get stream: %d\n", r ); - ok( !lstrcmp(buf, "test.txt\n"), "Expected 'test.txt\\n', got %s\n", buf ); + ok( !lstrcmpA(buf, "test.txt\n"), "Expected 'test.txt\\n', got %s\n", buf ); r = MsiCloseHandle( rec ); ok( r == ERROR_SUCCESS , "Failed to close record handle\n" ); @@ -1847,7 +1848,7 @@ static void test_binary(void) r = MsiCloseHandle( hdb ); ok( r == ERROR_SUCCESS , "Failed to close database\n" ); - DeleteFile( msifile ); + DeleteFileA( msifile ); } static void test_where_not_in_selected(void) @@ -1918,7 +1919,7 @@ static void test_where_not_in_selected(void) ok(r == S_OK, "cannot add entry to CATable table:%d\n", r ); query = "Select IESTable.Condition from CATable, IESTable where " "CATable.Action = IESTable.Action and CATable.Type = 32"; - r = MsiDatabaseOpenView(hdb, query, &view); + r = MsiDatabaseOpenViewA(hdb, query, &view); ok( r == ERROR_SUCCESS, "failed to open view: %d\n", r ); r = MsiViewExecute(view, 0); @@ -1940,8 +1941,7 @@ static void test_where_not_in_selected(void) MsiCloseHandle(view); MsiCloseHandle( hdb ); - DeleteFile(msifile); - + DeleteFileA(msifile); } @@ -2001,7 +2001,7 @@ static void test_where(void) MsiCloseHandle( rec ); query = "SELECT `DiskId` FROM `Media` WHERE `LastSequence` >= 1 AND DiskId >= 0"; - r = MsiDatabaseOpenView(hdb, query, &view); + r = MsiDatabaseOpenViewA(hdb, query, &view); ok( r == ERROR_SUCCESS, "failed to open view: %d\n", r ); r = MsiViewExecute(view, 0); @@ -2014,20 +2014,18 @@ static void test_where(void) ok( count == 1, "Expected 1 record fields, got %d\n", count ); size = MAX_PATH; - r = MsiRecordGetString( rec, 1, buf, &size ); + r = MsiRecordGetStringA( rec, 1, buf, &size ); ok( r == ERROR_SUCCESS, "failed to get record string: %d\n", r ); - ok( !lstrcmp( buf, "2" ), - "For (row %d, column 1) expected '%d', got %s\n", 0, 2, buf ); + ok( !lstrcmpA( buf, "2" ), "For (row %d, column 1) expected '%d', got %s\n", 0, 2, buf ); MsiCloseHandle( rec ); r = MsiViewFetch(view, &rec); ok( r == ERROR_SUCCESS, "failed to fetch view: %d\n", r ); size = MAX_PATH; - r = MsiRecordGetString( rec, 1, buf, &size ); + r = MsiRecordGetStringA( rec, 1, buf, &size ); ok( r == ERROR_SUCCESS, "failed to get record string: %d\n", r ); - ok( !lstrcmp( buf, "3" ), - "For (row %d, column 1) expected '%d', got %s\n", 1, 3, buf ); + ok( !lstrcmpA( buf, "3" ), "For (row %d, column 1) expected '%d', got %s\n", 1, 3, buf ); MsiCloseHandle( rec ); r = MsiViewFetch(view, &rec); @@ -2069,10 +2067,10 @@ static void test_where(void) MsiCloseHandle( rec ); rec = MsiCreateRecord(1); - MsiRecordSetString(rec, 1, ""); + MsiRecordSetStringA(rec, 1, ""); query = "SELECT * FROM `Media` WHERE `DiskPrompt` = ?"; - r = MsiDatabaseOpenView(hdb, query, &view); + r = MsiDatabaseOpenViewA(hdb, query, &view); ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r); r = MsiViewExecute(view, rec); ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r); @@ -2087,7 +2085,7 @@ static void test_where(void) MsiCloseHandle(view); MsiCloseHandle( hdb ); - DeleteFile(msifile); + DeleteFileA(msifile); } static CHAR CURR_DIR[MAX_PATH]; @@ -2137,9 +2135,8 @@ static void write_file(const CHAR *filename, const char *data, int data_size) { DWORD size; - HANDLE hf = CreateFile(filename, GENERIC_WRITE, 0, NULL, - CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL); - + HANDLE hf = CreateFileA(filename, GENERIC_WRITE, 0, NULL, + CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL); WriteFile(hf, data, data_size, &size, NULL); CloseHandle(hf); } @@ -2148,7 +2145,7 @@ static UINT add_table_to_db(MSIHANDLE hdb, LPCSTR table_data) { UINT r; - write_file("temp_file", table_data, (lstrlen(table_data) - 1) * sizeof(char)); + write_file("temp_file", table_data, (lstrlenA(table_data) - 1) * sizeof(char)); r = MsiDatabaseImportA(hdb, CURR_DIR, "temp_file"); DeleteFileA("temp_file"); @@ -2166,7 +2163,7 @@ static void test_suminfo_import(void) GetCurrentDirectoryA(MAX_PATH, CURR_DIR); - r = MsiOpenDatabaseA(msifile, MSIDBOPEN_CREATE, &hdb); + r = MsiOpenDatabaseW(msifileW, MSIDBOPEN_CREATE, &hdb); ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r); r = add_table_to_db(hdb, suminfo); @@ -2286,7 +2283,7 @@ static void test_msiimport(void) GetCurrentDirectoryA(MAX_PATH, CURR_DIR); - r = MsiOpenDatabaseA(msifile, MSIDBOPEN_CREATE, &hdb); + r = MsiOpenDatabaseW(msifileW, MSIDBOPEN_CREATE, &hdb); ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r); r = add_table_to_db(hdb, test_data); @@ -2302,7 +2299,7 @@ static void test_msiimport(void) ok(r == ERROR_FUNCTION_FAILED, "Expected ERROR_FUNCTION_FAILED, got %d\n", r); query = "SELECT * FROM `TestTable`"; - r = MsiDatabaseOpenView(hdb, query, &view); + r = MsiDatabaseOpenViewA(hdb, query, &view); ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r); r = MsiViewGetColumnInfo(view, MSICOLINFO_NAMES, &rec); @@ -2363,7 +2360,7 @@ static void test_msiimport(void) MsiCloseHandle(view); query = "SELECT * FROM `TwoPrimary`"; - r = MsiDatabaseOpenView(hdb, query, &view); + r = MsiDatabaseOpenViewA(hdb, query, &view); ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r); r = MsiViewGetColumnInfo(view, MSICOLINFO_NAMES, &rec); @@ -2412,7 +2409,7 @@ static void test_msiimport(void) MsiCloseHandle(view); query = "SELECT * FROM `Table`"; - r = MsiDatabaseOpenView(hdb, query, &view); + r = MsiDatabaseOpenViewA(hdb, query, &view); ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r); r = MsiViewGetColumnInfo(view, MSICOLINFO_NAMES, &rec); @@ -2443,7 +2440,7 @@ static void test_msiimport(void) MsiCloseHandle(view); query = "SELECT * FROM `Table`"; - r = MsiDatabaseOpenView(hdb, query, &view); + r = MsiDatabaseOpenViewA(hdb, query, &view); ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r); r = MsiViewExecute(view, 0); @@ -2499,15 +2496,15 @@ static void test_binary_import(void) /* create files to import */ write_file("bin_import.idt", bin_import_dat, (sizeof(bin_import_dat) - 1) * sizeof(char)); - CreateDirectory("bin_import", NULL); + CreateDirectoryA("bin_import", NULL); create_file_data("bin_import/filename1.ibd", "just some words", 15); /* import files into database */ - r = MsiOpenDatabase(msifile, MSIDBOPEN_CREATE, &hdb); + r = MsiOpenDatabaseW(msifileW, MSIDBOPEN_CREATE, &hdb); ok( r == ERROR_SUCCESS , "Failed to open database\n"); - GetCurrentDirectory(MAX_PATH, path); - r = MsiDatabaseImport(hdb, path, "bin_import.idt"); + GetCurrentDirectoryA(MAX_PATH, path); + r = MsiDatabaseImportA(hdb, path, "bin_import.idt"); ok(r == ERROR_SUCCESS , "Failed to import Binary table\n"); /* read file from the Binary table */ @@ -2516,16 +2513,15 @@ static void test_binary_import(void) ok(r == ERROR_SUCCESS, "SELECT query failed: %d\n", r); size = MAX_PATH; - r = MsiRecordGetString(rec, 1, file, &size); + r = MsiRecordGetStringA(rec, 1, file, &size); ok(r == ERROR_SUCCESS, "Failed to get string: %d\n", r); - ok(!lstrcmp(file, "filename1"), "Expected 'filename1', got %s\n", file); + ok(!lstrcmpA(file, "filename1"), "Expected 'filename1', got %s\n", file); size = MAX_PATH; memset(buf, 0, MAX_PATH); r = MsiRecordReadStream(rec, 2, buf, &size); ok(r == ERROR_SUCCESS, "Failed to get stream: %d\n", r); - ok(!lstrcmp(buf, "just some words"), - "Expected 'just some words', got %s\n", buf); + ok(!lstrcmpA(buf, "just some words"), "Expected 'just some words', got %s\n", buf); r = MsiCloseHandle(rec); ok(r == ERROR_SUCCESS , "Failed to close record handle\n"); @@ -2533,9 +2529,9 @@ static void test_binary_import(void) r = MsiCloseHandle(hdb); ok(r == ERROR_SUCCESS , "Failed to close database\n"); - DeleteFile("bin_import/filename1.ibd"); - RemoveDirectory("bin_import"); - DeleteFile("bin_import.idt"); + DeleteFileA("bin_import/filename1.ibd"); + RemoveDirectoryA("bin_import"); + DeleteFileA("bin_import.idt"); } static void test_markers(void) @@ -2548,9 +2544,9 @@ static void test_markers(void) ok( hdb, "failed to create db\n"); rec = MsiCreateRecord(3); - MsiRecordSetString(rec, 1, "Table"); - MsiRecordSetString(rec, 2, "Apples"); - MsiRecordSetString(rec, 3, "Oranges"); + MsiRecordSetStringA(rec, 1, "Table"); + MsiRecordSetStringA(rec, 2, "Apples"); + MsiRecordSetStringA(rec, 3, "Oranges"); /* try a legit create */ query = "CREATE TABLE `Table` ( `One` SHORT NOT NULL, `Two` CHAR(255) PRIMARY KEY `One`)"; @@ -2560,7 +2556,7 @@ static void test_markers(void) /* try table name as marker */ rec = MsiCreateRecord(1); - MsiRecordSetString(rec, 1, "Fable"); + MsiRecordSetStringA(rec, 1, "Fable"); query = "CREATE TABLE `?` ( `One` SHORT NOT NULL, `Two` CHAR(255) PRIMARY KEY `One`)"; r = run_query(hdb, rec, query); ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r); @@ -2573,13 +2569,13 @@ static void test_markers(void) ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r); /* try table name as marker without backticks */ - MsiRecordSetString(rec, 1, "Mable"); + MsiRecordSetStringA(rec, 1, "Mable"); query = "CREATE TABLE ? ( `One` SHORT NOT NULL, `Two` CHAR(255) PRIMARY KEY `One`)"; r = run_query(hdb, rec, query); ok(r == ERROR_BAD_QUERY_SYNTAX, "Expected ERROR_BAD_QUERY_SYNTAX, got %d\n", r); /* try one column name as marker */ - MsiRecordSetString(rec, 1, "One"); + MsiRecordSetStringA(rec, 1, "One"); query = "CREATE TABLE `Mable` ( `?` SHORT NOT NULL, `Two` CHAR(255) PRIMARY KEY `One`)"; r = run_query(hdb, rec, query); ok(r == ERROR_BAD_QUERY_SYNTAX, "Expected ERROR_BAD_QUERY_SYNTAX, got %d\n", r); @@ -2587,8 +2583,8 @@ static void test_markers(void) /* try column names as markers */ rec = MsiCreateRecord(2); - MsiRecordSetString(rec, 1, "One"); - MsiRecordSetString(rec, 2, "Two"); + MsiRecordSetStringA(rec, 1, "One"); + MsiRecordSetStringA(rec, 2, "Two"); query = "CREATE TABLE `Mable` ( `?` SHORT NOT NULL, `?` CHAR(255) PRIMARY KEY `One`)"; r = run_query(hdb, rec, query); ok(r == ERROR_BAD_QUERY_SYNTAX, "Expected ERROR_BAD_QUERY_SYNTAX, got %d\n", r); @@ -2596,9 +2592,9 @@ static void test_markers(void) /* try names with backticks */ rec = MsiCreateRecord(3); - MsiRecordSetString(rec, 1, "One"); - MsiRecordSetString(rec, 2, "Two"); - MsiRecordSetString(rec, 3, "One"); + MsiRecordSetStringA(rec, 1, "One"); + MsiRecordSetStringA(rec, 2, "Two"); + MsiRecordSetStringA(rec, 3, "One"); query = "CREATE TABLE `Mable` ( `?` SHORT NOT NULL, `?` CHAR(255) PRIMARY KEY `?`)"; r = run_query(hdb, rec, query); ok(r == ERROR_BAD_QUERY_SYNTAX, "Expected ERROR_BAD_QUERY_SYNTAX, got %d\n", r); @@ -2616,7 +2612,7 @@ static void test_markers(void) /* try one long marker */ rec = MsiCreateRecord(1); - MsiRecordSetString(rec, 1, "`One` SHORT NOT NULL, `Two` CHAR(255) PRIMARY KEY `One`"); + MsiRecordSetStringA(rec, 1, "`One` SHORT NOT NULL, `Two` CHAR(255) PRIMARY KEY `One`"); query = "CREATE TABLE `Mable` ( ? )"; r = run_query(hdb, rec, query); ok(r == ERROR_BAD_QUERY_SYNTAX, "Expected ERROR_BAD_QUERY_SYNTAX, got %d\n", r); @@ -2624,10 +2620,10 @@ static void test_markers(void) /* try all names as markers */ rec = MsiCreateRecord(4); - MsiRecordSetString(rec, 1, "Mable"); - MsiRecordSetString(rec, 2, "One"); - MsiRecordSetString(rec, 3, "Two"); - MsiRecordSetString(rec, 4, "One"); + MsiRecordSetStringA(rec, 1, "Mable"); + MsiRecordSetStringA(rec, 2, "One"); + MsiRecordSetStringA(rec, 3, "Two"); + MsiRecordSetStringA(rec, 4, "One"); query = "CREATE TABLE `?` ( `?` SHORT NOT NULL, `?` CHAR(255) PRIMARY KEY `?`)"; r = run_query(hdb, rec, query); ok(r == ERROR_BAD_QUERY_SYNTAX, "Expected ERROR_BAD_QUERY_SYNTAX, got %d\n", r); @@ -2644,7 +2640,7 @@ static void test_markers(void) /* try values as markers */ rec = MsiCreateRecord(2); MsiRecordSetInteger(rec, 1, 4); - MsiRecordSetString(rec, 2, "hi"); + MsiRecordSetStringA(rec, 2, "hi"); query = "INSERT INTO `Table` ( `One`, `Two` ) VALUES ( ?, '?' )"; r = run_query(hdb, rec, query); ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r); @@ -2652,10 +2648,10 @@ static void test_markers(void) /* try column names and values as markers */ rec = MsiCreateRecord(4); - MsiRecordSetString(rec, 1, "One"); - MsiRecordSetString(rec, 2, "Two"); + MsiRecordSetStringA(rec, 1, "One"); + MsiRecordSetStringA(rec, 2, "Two"); MsiRecordSetInteger(rec, 3, 5); - MsiRecordSetString(rec, 4, "hi"); + MsiRecordSetStringA(rec, 4, "hi"); query = "INSERT INTO `Table` ( `?`, `?` ) VALUES ( ?, '?' )"; r = run_query(hdb, rec, query); ok(r == ERROR_BAD_QUERY_SYNTAX, "Expected ERROR_BAD_QUERY_SYNTAX, got %d\n", r); @@ -2663,8 +2659,8 @@ static void test_markers(void) /* try column names as markers */ rec = MsiCreateRecord(2); - MsiRecordSetString(rec, 1, "One"); - MsiRecordSetString(rec, 2, "Two"); + MsiRecordSetStringA(rec, 1, "One"); + MsiRecordSetStringA(rec, 2, "Two"); query = "INSERT INTO `Table` ( `?`, `?` ) VALUES ( 3, 'yellow' )"; r = run_query(hdb, rec, query); ok(r == ERROR_BAD_QUERY_SYNTAX, "Expected ERROR_BAD_QUERY_SYNTAX, got %d\n", r); @@ -2672,7 +2668,7 @@ static void test_markers(void) /* try table name as a marker */ rec = MsiCreateRecord(1); - MsiRecordSetString(rec, 1, "Table"); + MsiRecordSetStringA(rec, 1, "Table"); query = "INSERT INTO `?` ( `One`, `Two` ) VALUES ( 2, 'green' )"; r = run_query(hdb, rec, query); ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r); @@ -2680,9 +2676,9 @@ static void test_markers(void) /* try table name and values as markers */ rec = MsiCreateRecord(3); - MsiRecordSetString(rec, 1, "Table"); + MsiRecordSetStringA(rec, 1, "Table"); MsiRecordSetInteger(rec, 2, 10); - MsiRecordSetString(rec, 3, "haha"); + MsiRecordSetStringA(rec, 3, "haha"); query = "INSERT INTO `?` ( `One`, `Two` ) VALUES ( ?, '?' )"; r = run_query(hdb, rec, query); ok(r == ERROR_FUNCTION_FAILED, "Expected ERROR_FUNCTION_FAILED, got %d\n", r); @@ -2690,11 +2686,11 @@ static void test_markers(void) /* try all markers */ rec = MsiCreateRecord(5); - MsiRecordSetString(rec, 1, "Table"); - MsiRecordSetString(rec, 1, "One"); - MsiRecordSetString(rec, 1, "Two"); + MsiRecordSetStringA(rec, 1, "Table"); + MsiRecordSetStringA(rec, 1, "One"); + MsiRecordSetStringA(rec, 1, "Two"); MsiRecordSetInteger(rec, 2, 10); - MsiRecordSetString(rec, 3, "haha"); + MsiRecordSetStringA(rec, 3, "haha"); query = "INSERT INTO `?` ( `?`, `?` ) VALUES ( ?, '?' )"; r = run_query(hdb, rec, query); ok(r == ERROR_BAD_QUERY_SYNTAX, "Expected ERROR_BAD_QUERY_SYNTAX, got %d\n", r); @@ -2702,8 +2698,8 @@ static void test_markers(void) /* insert an integer as a string */ rec = MsiCreateRecord(2); - MsiRecordSetString(rec, 1, "11"); - MsiRecordSetString(rec, 2, "hi"); + MsiRecordSetStringA(rec, 1, "11"); + MsiRecordSetStringA(rec, 2, "hi"); query = "INSERT INTO `Table` ( `One`, `Two` ) VALUES ( ?, '?' )"; r = run_query(hdb, rec, query); ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r); @@ -2712,7 +2708,7 @@ static void test_markers(void) /* leave off the '' for the string */ rec = MsiCreateRecord(2); MsiRecordSetInteger(rec, 1, 12); - MsiRecordSetString(rec, 2, "hi"); + MsiRecordSetStringA(rec, 2, "hi"); query = "INSERT INTO `Table` ( `One`, `Two` ) VALUES ( ?, ? )"; r = run_query(hdb, rec, query); ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r); @@ -2739,7 +2735,7 @@ static void test_handle_limit(void) for (i=0; i