From 0195906a3c5ab41be501cf80d8a3304875fe7d7d Mon Sep 17 00:00:00 2001 From: Christoph von Wittich Date: Sun, 18 Jan 2009 09:03:44 +0000 Subject: [PATCH] sync msi_winetest with wine 1.1.13 svn path=/trunk/; revision=38876 --- rostests/winetests/msi/automation.c | 8 ++++---- rostests/winetests/msi/db.c | 15 +++++++------- rostests/winetests/msi/format.c | 4 ++-- rostests/winetests/msi/install.c | 32 ++++++++++++++--------------- rostests/winetests/msi/msi.c | 19 ++++++++--------- rostests/winetests/msi/package.c | 23 +++++++++++++-------- rostests/winetests/msi/source.c | 4 ++-- 7 files changed, 55 insertions(+), 50 deletions(-) diff --git a/rostests/winetests/msi/automation.c b/rostests/winetests/msi/automation.c index 9568fbf75f4..f831ef494a4 100644 --- a/rostests/winetests/msi/automation.c +++ b/rostests/winetests/msi/automation.c @@ -594,7 +594,7 @@ static void test_dispatch(void) ok(hr == DISP_E_MEMBERNOTFOUND, "IDispatch::Invoke returned 0x%08x\n", hr); /* Test getting ID of a function name that does exist */ - name = (WCHAR *)szOpenPackage; + name = szOpenPackage; hr = IDispatch_GetIDsOfNames(pInstaller, &IID_NULL, &name, 1, LOCALE_USER_DEFAULT, &dispid); ok(hr == S_OK, "IDispatch::GetIDsOfNames returned 0x%08x\n", hr); @@ -638,7 +638,7 @@ static void test_dispatch(void) ok(hr == DISP_E_MEMBERNOTFOUND, "IDispatch::Invoke returned 0x%08x\n", hr); /* Test invoking a read-only property as DISPATCH_PROPERTYPUT or as a DISPATCH_METHOD */ - name = (WCHAR *)szProductState; + name = szProductState; hr = IDispatch_GetIDsOfNames(pInstaller, &IID_NULL, &name, 1, LOCALE_USER_DEFAULT, &dispid); ok(hr == S_OK, "IDispatch::GetIDsOfNames returned 0x%08x\n", hr); @@ -723,7 +723,7 @@ static HRESULT Installer_RegistryValue(HKEY hkey, LPCWSTR szKey, VARIANT vValue, VariantInit(&vararg[2]); V_VT(&vararg[2]) = VT_I4; - V_I4(&vararg[2]) = (int)hkey; + V_I4(&vararg[2]) = (INT_PTR)hkey; VariantInit(&vararg[1]); V_VT(&vararg[1]) = VT_BSTR; V_BSTR(&vararg[1]) = SysAllocString(szKey); @@ -2401,7 +2401,7 @@ static void test_Installer(void) } /* Installer::OpenDatabase */ - hr = Installer_OpenDatabase(szPath, (int)MSIDBOPEN_TRANSACT, &pDatabase); + hr = Installer_OpenDatabase(szPath, (INT_PTR)MSIDBOPEN_TRANSACT, &pDatabase); ok(hr == S_OK, "Installer_OpenDatabase failed, hresult 0x%08x\n", hr); if (hr == S_OK) { diff --git a/rostests/winetests/msi/db.c b/rostests/winetests/msi/db.c index 475b10b970a..d04823ebb6c 100644 --- a/rostests/winetests/msi/db.c +++ b/rostests/winetests/msi/db.c @@ -2347,7 +2347,7 @@ static MSIHANDLE package_from_db(MSIHANDLE hdb) CHAR szPackage[10]; MSIHANDLE hPackage; - sprintf(szPackage,"#%li",hdb); + sprintf(szPackage,"#%i",hdb); res = MsiOpenPackage(szPackage,&hPackage); if (res != ERROR_SUCCESS) return 0; @@ -5742,14 +5742,13 @@ static void test_noquotes(void) static void read_file_data(LPCSTR filename, LPSTR buffer) { - OFSTRUCT ofs; - HFILE file; + HANDLE file; DWORD read; - file = OpenFile(filename, &ofs, OF_READ); + file = CreateFileA( filename, GENERIC_READ, FILE_SHARE_READ, NULL, OPEN_EXISTING, 0, NULL ); ZeroMemory(buffer, MAX_PATH); - ReadFile((HANDLE)file, buffer, MAX_PATH, &read, NULL); - CloseHandle((HANDLE)file); + ReadFile(file, buffer, MAX_PATH, &read, NULL); + CloseHandle(file); } static void test_forcecodepage(void) @@ -6175,7 +6174,7 @@ static void test_dbtopackage(void) r = add_custom_action_entry(hdb, "'SetProp', 51, 'MYPROP', 'grape'"); ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r); - sprintf(package, "#%li", hdb); + sprintf(package, "#%i", hdb); r = MsiOpenPackage(package, &hpkg); ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r); @@ -6234,7 +6233,7 @@ static void test_dbtopackage(void) r = add_custom_action_entry(hdb, "'SetProp', 51, 'MYPROP', 'grape'"); ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r); - sprintf(package, "#%li", hdb); + sprintf(package, "#%i", hdb); r = MsiOpenPackage(package, &hpkg); ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r); diff --git a/rostests/winetests/msi/format.c b/rostests/winetests/msi/format.c index c4be4294650..316eed6b711 100644 --- a/rostests/winetests/msi/format.c +++ b/rostests/winetests/msi/format.c @@ -228,7 +228,7 @@ static MSIHANDLE package_from_db(MSIHANDLE hdb) CHAR szPackage[10]; MSIHANDLE hPackage; - sprintf(szPackage,"#%li",hdb); + sprintf(szPackage,"#%i",hdb); res = MsiOpenPackage(szPackage,&hPackage); ok( res == ERROR_SUCCESS , "Failed to open package\n" ); @@ -303,7 +303,7 @@ static MSIHANDLE helper_createpackage( const char *szName ) res = MsiCloseHandle( suminfo); ok( res == ERROR_SUCCESS , "Failed to close suminfo\n" ); - sprintf(szPackage,"#%li",hdb); + sprintf(szPackage,"#%i",hdb); res = MsiOpenPackage(szPackage,&hPackage); ok( res == ERROR_SUCCESS , "Failed to open package\n" ); diff --git a/rostests/winetests/msi/install.c b/rostests/winetests/msi/install.c index 56d36e1108f..53602845e05 100644 --- a/rostests/winetests/msi/install.c +++ b/rostests/winetests/msi/install.c @@ -1211,34 +1211,34 @@ static const msi_table pc_tables[] = /* the FCI callbacks */ -static void *mem_alloc(ULONG cb) +static void * CDECL mem_alloc(ULONG cb) { return HeapAlloc(GetProcessHeap(), 0, cb); } -static void mem_free(void *memory) +static void CDECL mem_free(void *memory) { HeapFree(GetProcessHeap(), 0, memory); } -static BOOL get_next_cabinet(PCCAB pccab, ULONG cbPrevCab, void *pv) +static BOOL CDECL get_next_cabinet(PCCAB pccab, ULONG cbPrevCab, void *pv) { sprintf(pccab->szCab, pv, pccab->iCab); return TRUE; } -static long progress(UINT typeStatus, ULONG cb1, ULONG cb2, void *pv) +static LONG CDECL progress(UINT typeStatus, ULONG cb1, ULONG cb2, void *pv) { return 0; } -static int file_placed(PCCAB pccab, char *pszFile, long cbFile, - BOOL fContinuation, void *pv) +static int CDECL file_placed(PCCAB pccab, char *pszFile, LONG cbFile, + BOOL fContinuation, void *pv) { return 0; } -static INT_PTR fci_open(char *pszFile, int oflag, int pmode, int *err, void *pv) +static INT_PTR CDECL fci_open(char *pszFile, int oflag, int pmode, int *err, void *pv) { HANDLE handle; DWORD dwAccess = 0; @@ -1262,7 +1262,7 @@ static INT_PTR fci_open(char *pszFile, int oflag, int pmode, int *err, void *pv) return (INT_PTR)handle; } -static UINT fci_read(INT_PTR hf, void *memory, UINT cb, int *err, void *pv) +static UINT CDECL fci_read(INT_PTR hf, void *memory, UINT cb, int *err, void *pv) { HANDLE handle = (HANDLE)hf; DWORD dwRead; @@ -1274,7 +1274,7 @@ static UINT fci_read(INT_PTR hf, void *memory, UINT cb, int *err, void *pv) return dwRead; } -static UINT fci_write(INT_PTR hf, void *memory, UINT cb, int *err, void *pv) +static UINT CDECL fci_write(INT_PTR hf, void *memory, UINT cb, int *err, void *pv) { HANDLE handle = (HANDLE)hf; DWORD dwWritten; @@ -1286,7 +1286,7 @@ static UINT fci_write(INT_PTR hf, void *memory, UINT cb, int *err, void *pv) return dwWritten; } -static int fci_close(INT_PTR hf, int *err, void *pv) +static int CDECL fci_close(INT_PTR hf, int *err, void *pv) { HANDLE handle = (HANDLE)hf; ok(CloseHandle(handle), "Failed to CloseHandle\n"); @@ -1294,7 +1294,7 @@ static int fci_close(INT_PTR hf, int *err, void *pv) return 0; } -static long fci_seek(INT_PTR hf, long dist, int seektype, int *err, void *pv) +static LONG CDECL fci_seek(INT_PTR hf, LONG dist, int seektype, int *err, void *pv) { HANDLE handle = (HANDLE)hf; DWORD ret; @@ -1305,7 +1305,7 @@ static long fci_seek(INT_PTR hf, long dist, int seektype, int *err, void *pv) return ret; } -static int fci_delete(char *pszFile, int *err, void *pv) +static int CDECL fci_delete(char *pszFile, int *err, void *pv) { BOOL ret = DeleteFileA(pszFile); ok(ret, "Failed to DeleteFile %s\n", pszFile); @@ -1362,7 +1362,7 @@ static void get_user_sid(LPSTR *usersid) OpenProcessToken(GetCurrentProcess(), TOKEN_QUERY, &token); size = sizeof(buf); - GetTokenInformation(token, TokenUser, (void *)buf, size, &size); + GetTokenInformation(token, TokenUser, buf, size, &size); user = (PTOKEN_USER)buf; pConvertSidToStringSidA(user->User.Sid, usersid); } @@ -1378,7 +1378,7 @@ static BOOL check_record(MSIHANDLE rec, UINT field, LPCSTR val) return (r == ERROR_SUCCESS ) && !strcmp(val, buffer); } -static BOOL get_temp_file(char *pszTempName, int cbTempName, void *pv) +static BOOL CDECL get_temp_file(char *pszTempName, int cbTempName, void *pv) { LPSTR tempname; @@ -1397,8 +1397,8 @@ static BOOL get_temp_file(char *pszTempName, int cbTempName, void *pv) return FALSE; } -static INT_PTR get_open_info(char *pszName, USHORT *pdate, USHORT *ptime, - USHORT *pattribs, int *err, void *pv) +static INT_PTR CDECL get_open_info(char *pszName, USHORT *pdate, USHORT *ptime, + USHORT *pattribs, int *err, void *pv) { BY_HANDLE_FILE_INFORMATION finfo; FILETIME filetime; diff --git a/rostests/winetests/msi/msi.c b/rostests/winetests/msi/msi.c index 3396f5c5bd4..fba584dca89 100644 --- a/rostests/winetests/msi/msi.c +++ b/rostests/winetests/msi/msi.c @@ -505,7 +505,7 @@ static void create_test_guid(LPSTR prodcode, LPSTR squashed) hr = CoCreateGuid(&guid); ok(hr == S_OK, "Expected S_OK, got %d\n", hr); - size = StringFromGUID2(&guid, (LPOLESTR)guidW, MAX_PATH); + size = StringFromGUID2(&guid, guidW, MAX_PATH); ok(size == 39, "Expected 39, got %d\n", hr); WideCharToMultiByte(CP_ACP, 0, guidW, size, prodcode, MAX_PATH, NULL, NULL); @@ -522,7 +522,7 @@ static void get_user_sid(LPSTR *usersid) OpenProcessToken(GetCurrentProcess(), TOKEN_QUERY, &token); size = sizeof(buf); - GetTokenInformation(token, TokenUser, (void *)buf, size, &size); + GetTokenInformation(token, TokenUser, buf, size, &size); user = (PTOKEN_USER)buf; pConvertSidToStringSidA(user->User.Sid, usersid); } @@ -794,7 +794,7 @@ static void compose_base85_guid(LPSTR component, LPSTR comp_base85, LPSTR squash hr = CoCreateGuid(&guid); ok(hr == S_OK, "Expected S_OK, got %d\n", hr); - size = StringFromGUID2(&guid, (LPOLESTR)guidW, MAX_PATH); + size = StringFromGUID2(&guid, guidW, MAX_PATH); ok(size == 39, "Expected 39, got %d\n", hr); WideCharToMultiByte(CP_ACP, 0, guidW, size, component, MAX_PATH, NULL, NULL); @@ -1760,7 +1760,6 @@ static void test_MsiGetComponentPath(void) RegDeleteKeyA(compkey, ""); RegCloseKey(prodkey); RegCloseKey(compkey); - RegCloseKey(installprop); DeleteFileA("C:\\imapath"); lstrcpyA(keypath, "Software\\Classes\\Installer\\Products\\"); @@ -1923,9 +1922,6 @@ static void test_MsiGetProductCode(void) RegDeleteKeyA(prodkey, ""); RegCloseKey(prodkey); - RegDeleteKeyA(prodkey, ""); - RegCloseKey(prodkey); - lstrcpyA(keypath, "Software\\Microsoft\\Installer\\Products\\"); lstrcatA(keypath, prod_squashed); @@ -7368,9 +7364,12 @@ static void test_MsiOpenProduct(void) /* LocalPackage has just the package name */ hprod = 0xdeadbeef; r = MsiOpenProductA(prodcode, &hprod); - ok(r == ERROR_INSTALL_PACKAGE_OPEN_FAILED, - "Expected ERROR_INSTALL_PACKAGE_OPEN_FAILED, got %d\n", r); - ok(hprod == 0xdeadbeef, "Expected hprod to be unchanged\n"); + ok(r == ERROR_INSTALL_PACKAGE_OPEN_FAILED || r == ERROR_SUCCESS, + "Expected ERROR_INSTALL_PACKAGE_OPEN_FAILED or ERROR_SUCCESS, got %d\n", r); + if (r == ERROR_SUCCESS) + MsiCloseHandle(hprod); + else + ok(hprod == 0xdeadbeef, "Expected hprod to be unchanged\n"); lstrcpyA(val, path); lstrcatA(val, "\\winetest.msi"); diff --git a/rostests/winetests/msi/package.c b/rostests/winetests/msi/package.c index 5ad1d385bd8..66ff3f0ebca 100644 --- a/rostests/winetests/msi/package.c +++ b/rostests/winetests/msi/package.c @@ -48,7 +48,7 @@ static void get_user_sid(LPSTR *usersid) OpenProcessToken(GetCurrentProcess(), TOKEN_QUERY, &token); size = sizeof(buf); - GetTokenInformation(token, TokenUser, (void *)buf, size, &size); + GetTokenInformation(token, TokenUser, buf, size, &size); user = (PTOKEN_USER)buf; pConvertSidToStringSidA(user->User.Sid, usersid); } @@ -160,7 +160,7 @@ static void create_test_guid(LPSTR prodcode, LPSTR squashed) hr = CoCreateGuid(&guid); ok(hr == S_OK, "Expected S_OK, got %d\n", hr); - size = StringFromGUID2(&guid, (LPOLESTR)guidW, MAX_PATH); + size = StringFromGUID2(&guid, guidW, MAX_PATH); ok(size == 39, "Expected 39, got %d\n", hr); WideCharToMultiByte(CP_ACP, 0, guidW, size, prodcode, MAX_PATH, NULL, NULL); @@ -665,7 +665,7 @@ static MSIHANDLE package_from_db(MSIHANDLE hdb) CHAR szPackage[10]; MSIHANDLE hPackage; - sprintf(szPackage,"#%li",hdb); + sprintf(szPackage,"#%i",hdb); res = MsiOpenPackage(szPackage,&hPackage); if (res != ERROR_SUCCESS) return 0; @@ -2116,7 +2116,7 @@ static void test_msipackage(void) ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r); /* database exists, but is emtpy */ - sprintf(name, "#%ld", hdb); + sprintf(name, "#%d", hdb); r = MsiOpenPackage(name, &hpack); ok(r == ERROR_INSTALL_PACKAGE_INVALID, "Expected ERROR_INSTALL_PACKAGE_INVALID, got %d\n", r); @@ -2134,7 +2134,7 @@ static void test_msipackage(void) ok(r == ERROR_SUCCESS, "failed to create InstallExecuteSequence table\n"); /* a few key tables exist */ - sprintf(name, "#%ld", hdb); + sprintf(name, "#%d", hdb); r = MsiOpenPackage(name, &hpack); ok(r == ERROR_INSTALL_PACKAGE_INVALID, "Expected ERROR_INSTALL_PACKAGE_INVALID, got %d\n", r); @@ -2146,7 +2146,7 @@ static void test_msipackage(void) r = MsiOpenDatabase(msifile, MSIDBOPEN_CREATE, &hdb); ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r); - sprintf(name, "#%ld", hdb); + sprintf(name, "#%d", hdb); /* The following summary information props must exist: * - PID_REVNUMBER @@ -8888,7 +8888,7 @@ static void test_sourcedir(void) r = add_directory_entry(hdb, "'TARGETDIR', '', 'SourceDir'"); ok(r == S_OK, "failed\n"); - sprintf(package, "#%li", hdb); + sprintf(package, "#%i", hdb); r = MsiOpenPackage(package, &hpkg); ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r); @@ -8997,7 +8997,7 @@ static void test_sourcedir(void) MsiCloseHandle(hpkg); /* reset the package state */ - sprintf(package, "#%li", hdb); + sprintf(package, "#%i", hdb); r = MsiOpenPackage(package, &hpkg); ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r); @@ -9585,6 +9585,13 @@ static void test_MsiGetProductProperty(void) lstrcatA(keypath, prod_squashed); res = RegCreateKeyA(HKEY_LOCAL_MACHINE, keypath, &userkey); + if (res == ERROR_ACCESS_DENIED) + { + skip("Not enough rights to perform tests\n"); + RegDeleteKeyA(prodkey, ""); + RegCloseKey(prodkey); + return; + } ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res); res = RegCreateKeyA(userkey, "InstallProperties", &props); diff --git a/rostests/winetests/msi/source.c b/rostests/winetests/msi/source.c index 9248b709c17..2eb5f1815ec 100644 --- a/rostests/winetests/msi/source.c +++ b/rostests/winetests/msi/source.c @@ -114,7 +114,7 @@ static void create_test_guid(LPSTR prodcode, LPSTR squashed) hr = CoCreateGuid(&guid); ok(hr == S_OK, "Expected S_OK, got %d\n", hr); - size = StringFromGUID2(&guid, (LPOLESTR)guidW, MAX_PATH); + size = StringFromGUID2(&guid, guidW, MAX_PATH); ok(size == 39, "Expected 39, got %d\n", hr); WideCharToMultiByte(CP_ACP, 0, guidW, size, prodcode, MAX_PATH, NULL, NULL); @@ -136,7 +136,7 @@ static int get_user_sid(LPSTR *usersid) if (!rc && GetLastError() == ERROR_CALL_NOT_IMPLEMENTED) return 0; size = sizeof(buf); - GetTokenInformation(token, TokenUser, (void *)buf, size, &size); + GetTokenInformation(token, TokenUser, buf, size, &size); user = (PTOKEN_USER)buf; pConvertSidToStringSidA(user->User.Sid, usersid); return 1;