Signed-off-by: Zebediah Figura z.figura12@gmail.com --- dlls/msi/tests/action.c | 469 +---------------------------------------- dlls/msi/tests/install.c | 72 +++---- dlls/msi/tests/msi.c | 527 +++-------------------------------------------- dlls/msi/tests/utils.h | 60 ++++++ 4 files changed, 117 insertions(+), 1011 deletions(-) create mode 100644 dlls/msi/tests/utils.h
diff --git a/dlls/msi/tests/action.c b/dlls/msi/tests/action.c index 31cc981..8e72ff4 100644 --- a/dlls/msi/tests/action.c +++ b/dlls/msi/tests/action.c @@ -34,6 +34,7 @@ #include <winsvc.h>
#include "wine/test.h" +#include "utils.h"
static UINT (WINAPI *pMsiQueryComponentStateA) (LPCSTR, LPCSTR, MSIINSTALLCONTEXT, LPCSTR, INSTALLSTATE *); @@ -46,9 +47,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); static BOOL (WINAPI *pIsWow64Process)(HANDLE, PBOOL);
@@ -60,11 +59,6 @@ static BOOL is_wow64; static const BOOL is_64bit = sizeof(void *) > sizeof(int);
static const char *msifile = "msitest.msi"; -static CHAR CURR_DIR[MAX_PATH]; -static CHAR PROG_FILES_DIR[MAX_PATH]; -static CHAR COMMON_FILES_DIR[MAX_PATH]; -static CHAR APP_DATA_DIR[MAX_PATH]; -static CHAR WINDOWS_DIR[MAX_PATH];
/* msi database data */
@@ -1679,15 +1673,6 @@ static const char rep_install_exec_seq_dat[] = "PublishProduct\t\t5200\n" "InstallFinalize\t\t6000\n";
-typedef struct _msi_table -{ - const char *filename; - const char *data; - unsigned int size; -} msi_table; - -#define ADD_TABLE(x) {#x".idt", x##_dat, sizeof(x##_dat)} - static const msi_table env_tables[] = { ADD_TABLE(component), @@ -2152,110 +2137,6 @@ cleanup:
/* make the max size large so there is only one cab file */ #define MEDIA_SIZE 0x7FFFFFFF -#define FOLDER_THRESHOLD 900000 - -/* the FCI callbacks */ - -static void * CDECL mem_alloc(ULONG cb) -{ - return HeapAlloc(GetProcessHeap(), 0, cb); -} - -static void CDECL mem_free(void *memory) -{ - HeapFree(GetProcessHeap(), 0, memory); -} - -static BOOL CDECL get_next_cabinet(PCCAB pccab, ULONG cbPrevCab, void *pv) -{ - sprintf(pccab->szCab, pv, pccab->iCab); - return TRUE; -} - -static LONG CDECL progress(UINT typeStatus, ULONG cb1, ULONG cb2, void *pv) -{ - return 0; -} - -static int CDECL file_placed(PCCAB pccab, char *pszFile, LONG cbFile, - BOOL fContinuation, void *pv) -{ - return 0; -} - -static INT_PTR CDECL fci_open(char *pszFile, int oflag, int pmode, int *err, void *pv) -{ - HANDLE handle; - DWORD dwAccess = 0; - DWORD dwShareMode = 0; - DWORD dwCreateDisposition = OPEN_EXISTING; - - dwAccess = GENERIC_READ | GENERIC_WRITE; - dwShareMode = FILE_SHARE_READ | FILE_SHARE_WRITE | FILE_SHARE_DELETE; - - if (GetFileAttributesA(pszFile) != INVALID_FILE_ATTRIBUTES) - dwCreateDisposition = OPEN_EXISTING; - else - dwCreateDisposition = CREATE_NEW; - - handle = CreateFileA(pszFile, dwAccess, dwShareMode, NULL, - dwCreateDisposition, 0, NULL); - - ok(handle != INVALID_HANDLE_VALUE, "Failed to CreateFile %s\n", pszFile); - - return (INT_PTR)handle; -} - -static UINT CDECL fci_read(INT_PTR hf, void *memory, UINT cb, int *err, void *pv) -{ - HANDLE handle = (HANDLE)hf; - DWORD dwRead; - BOOL res; - - res = ReadFile(handle, memory, cb, &dwRead, NULL); - ok(res, "Failed to ReadFile\n"); - - return dwRead; -} - -static UINT CDECL fci_write(INT_PTR hf, void *memory, UINT cb, int *err, void *pv) -{ - HANDLE handle = (HANDLE)hf; - DWORD dwWritten; - BOOL res; - - res = WriteFile(handle, memory, cb, &dwWritten, NULL); - ok(res, "Failed to WriteFile\n"); - - return dwWritten; -} - -static int CDECL fci_close(INT_PTR hf, int *err, void *pv) -{ - HANDLE handle = (HANDLE)hf; - ok(CloseHandle(handle), "Failed to CloseHandle\n"); - - return 0; -} - -static LONG CDECL fci_seek(INT_PTR hf, LONG dist, int seektype, int *err, void *pv) -{ - HANDLE handle = (HANDLE)hf; - DWORD ret; - - ret = SetFilePointer(handle, dist, NULL, seektype); - ok(ret != INVALID_SET_FILE_POINTER, "Failed to SetFilePointer\n"); - - return ret; -} - -static int CDECL fci_delete(char *pszFile, int *err, void *pv) -{ - BOOL ret = DeleteFileA(pszFile); - ok(ret, "Failed to DeleteFile %s\n", pszFile); - - return 0; -}
static void init_functionpointers(void) { @@ -2274,9 +2155,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) GET_PROC(hkernel32, IsWow64Process)
@@ -2287,44 +2166,6 @@ static void init_functionpointers(void) #undef GET_PROC }
-static BOOL is_process_limited(void) -{ - SID_IDENTIFIER_AUTHORITY NtAuthority = {SECURITY_NT_AUTHORITY}; - PSID Group = NULL; - 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"); - FreeSid(Group); - return FALSE; - } - FreeSid(Group); - - 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 char *get_user_sid(void) { HANDLE token; @@ -2349,185 +2190,6 @@ static char *get_user_sid(void) return usersid; }
-static BOOL CDECL get_temp_file(char *pszTempName, int cbTempName, void *pv) -{ - LPSTR tempname; - - tempname = HeapAlloc(GetProcessHeap(), 0, MAX_PATH); - GetTempFileNameA(".", "xx", 0, tempname); - - if (tempname && (strlen(tempname) < (unsigned)cbTempName)) - { - lstrcpyA(pszTempName, tempname); - HeapFree(GetProcessHeap(), 0, tempname); - return TRUE; - } - - HeapFree(GetProcessHeap(), 0, tempname); - - return FALSE; -} - -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; - HANDLE handle; - DWORD attrs; - BOOL res; - - 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); - - res = GetFileInformationByHandle(handle, &finfo); - ok(res, "Expected GetFileInformationByHandle to succeed\n"); - - FileTimeToLocalFileTime(&finfo.ftLastWriteTime, &filetime); - FileTimeToDosDateTime(&filetime, pdate, ptime); - - attrs = GetFileAttributesA(pszName); - ok(attrs != INVALID_FILE_ATTRIBUTES, "Failed to GetFileAttributes\n"); - - return (INT_PTR)handle; -} - -static BOOL add_file(HFCI hfci, const char *file, TCOMP compress) -{ - char path[MAX_PATH]; - char filename[MAX_PATH]; - - lstrcpyA(path, CURR_DIR); - lstrcatA(path, "\"); - lstrcatA(path, file); - - lstrcpyA(filename, file); - - return FCIAddFile(hfci, path, filename, FALSE, get_next_cabinet, - progress, get_open_info, compress); -} - -static void set_cab_parameters(PCCAB pCabParams, const CHAR *name, DWORD max_size) -{ - ZeroMemory(pCabParams, sizeof(CCAB)); - - pCabParams->cb = max_size; - pCabParams->cbFolderThresh = FOLDER_THRESHOLD; - pCabParams->setID = 0xbeef; - pCabParams->iCab = 1; - lstrcpyA(pCabParams->szCabPath, CURR_DIR); - lstrcatA(pCabParams->szCabPath, "\"); - lstrcpyA(pCabParams->szCab, name); -} - -static void create_cab_file(const CHAR *name, DWORD max_size, const CHAR *files) -{ - CCAB cabParams; - LPCSTR ptr; - HFCI hfci; - ERF erf; - BOOL res; - - set_cab_parameters(&cabParams, name, max_size); - - hfci = FCICreate(&erf, file_placed, mem_alloc, mem_free, fci_open, - fci_read, fci_write, fci_close, fci_seek, fci_delete, - get_temp_file, &cabParams, NULL); - - ok(hfci != NULL, "Failed to create an FCI context\n"); - - ptr = files; - while (*ptr) - { - res = add_file(hfci, ptr, tcompTYPE_MSZIP); - ok(res, "Failed to add file: %s\n", ptr); - ptr += lstrlenA(ptr) + 1; - } - - res = FCIFlushCabinet(hfci, FALSE, get_next_cabinet, progress); - ok(res, "Failed to flush the cabinet\n"); - - res = FCIDestroy(hfci); - ok(res, "Failed to destroy the cabinet\n"); -} - -static BOOL get_user_dirs(void) -{ - HKEY hkey; - DWORD type, size; - - if (RegOpenKeyA(HKEY_CURRENT_USER, - "Software\Microsoft\Windows\CurrentVersion\Explorer\Shell Folders", &hkey)) - return FALSE; - - size = MAX_PATH; - if (RegQueryValueExA(hkey, "AppData", 0, &type, (LPBYTE)APP_DATA_DIR, &size)) - { - RegCloseKey(hkey); - return FALSE; - } - - RegCloseKey(hkey); - return TRUE; -} - -static BOOL get_system_dirs(void) -{ - HKEY hkey; - DWORD type, size; - - if (RegOpenKeyA(HKEY_LOCAL_MACHINE, - "Software\Microsoft\Windows\CurrentVersion", &hkey)) - return FALSE; - - size = MAX_PATH; - if (RegQueryValueExA(hkey, "ProgramFilesDir (x86)", 0, &type, (LPBYTE)PROG_FILES_DIR, &size) && - RegQueryValueExA(hkey, "ProgramFilesDir", 0, &type, (LPBYTE)PROG_FILES_DIR, &size)) - { - RegCloseKey(hkey); - return FALSE; - } - - size = MAX_PATH; - if (RegQueryValueExA(hkey, "CommonFilesDir (x86)", 0, &type, (LPBYTE)COMMON_FILES_DIR, &size) && - RegQueryValueExA(hkey, "CommonFilesDir", 0, &type, (LPBYTE)COMMON_FILES_DIR, &size)) - { - RegCloseKey(hkey); - return FALSE; - } - - RegCloseKey(hkey); - - if (!GetWindowsDirectoryA(WINDOWS_DIR, MAX_PATH)) - return FALSE; - - return TRUE; -} - -static void create_file_data(LPCSTR name, LPCSTR data, DWORD size) -{ - HANDLE file; - DWORD written; - - file = CreateFileA(name, GENERIC_WRITE, 0, NULL, CREATE_ALWAYS, 0, NULL); - if (file == INVALID_HANDLE_VALUE) - return; - - WriteFile(file, data, strlen(data), &written, NULL); - - if (size) - { - SetFilePointer(file, size, NULL, FILE_BEGIN); - SetEndOfFile(file); - } - - CloseHandle(file); -} - -#define create_file(name, size) create_file_data(name, name, size) - static void create_test_files(void) { CreateDirectoryA("msitest", NULL); @@ -2549,20 +2211,6 @@ static void create_test_files(void) DeleteFileA("five.txt"); }
-static BOOL delete_pf(const CHAR *rel_path, BOOL is_file) -{ - CHAR path[MAX_PATH]; - - lstrcpyA(path, PROG_FILES_DIR); - lstrcatA(path, "\"); - lstrcatA(path, rel_path); - - if (is_file) - return DeleteFileA(path); - else - return RemoveDirectoryA(path); -} - static void delete_test_files(void) { DeleteFileA("msitest.msi"); @@ -2578,89 +2226,6 @@ static void delete_test_files(void) RemoveDirectoryA("msitest"); }
-static void write_file(const CHAR *filename, const char *data, int data_size) -{ - DWORD size; - HANDLE hf = CreateFileA(filename, GENERIC_WRITE, 0, NULL, CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL); - WriteFile(hf, data, data_size, &size, NULL); - CloseHandle(hf); -} - -static void write_msi_summary_info(MSIHANDLE db, INT version, INT wordcount, const char *template) -{ - MSIHANDLE summary; - UINT r; - - r = MsiGetSummaryInformationA(db, NULL, 5, &summary); - ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r); - - r = MsiSummaryInfoSetPropertyA(summary, PID_TEMPLATE, VT_LPSTR, 0, NULL, template); - ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r); - - r = MsiSummaryInfoSetPropertyA(summary, PID_REVNUMBER, VT_LPSTR, 0, NULL, - "{004757CA-5092-49C2-AD20-28E1CE0DF5F2}"); - ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r); - - r = MsiSummaryInfoSetPropertyA(summary, PID_PAGECOUNT, VT_I4, version, NULL, NULL); - ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r); - - r = MsiSummaryInfoSetPropertyA(summary, PID_WORDCOUNT, VT_I4, wordcount, NULL, NULL); - ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r); - - r = MsiSummaryInfoSetPropertyA(summary, PID_TITLE, VT_LPSTR, 0, NULL, "MSITEST"); - ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r); - - /* write the summary changes back to the stream */ - r = MsiSummaryInfoPersist(summary); - ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r); - - MsiCloseHandle(summary); -} - -#define create_database(name, tables, num_tables) \ - create_database_wordcount(name, tables, num_tables, 100, 0, ";1033"); - -#define create_database_template(name, tables, num_tables, version, template) \ - create_database_wordcount(name, tables, num_tables, version, 0, template); - -static void create_database_wordcount(const CHAR *name, const msi_table *tables, - int num_tables, INT version, INT wordcount, - const char *template) -{ - MSIHANDLE db; - UINT r; - 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 = MsiOpenDatabaseW(nameW, MSIDBOPEN_CREATE, &db); - ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r); - - /* import the tables into the database */ - for (j = 0; j < num_tables; j++) - { - const msi_table *table = &tables[j]; - - write_file(table->filename, table->data, (table->size - 1) * sizeof(char)); - - r = MsiDatabaseImportA(db, CURR_DIR, table->filename); - ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r); - - DeleteFileA(table->filename); - } - - write_msi_summary_info(db, version, wordcount, template); - - r = MsiDatabaseCommit(db); - 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) { RESTOREPOINTINFOA spec; @@ -2689,22 +2254,6 @@ static LONG delete_key( HKEY key, LPCSTR subkey, REGSAM access ) return RegDeleteKeyA( key, subkey ); }
-static BOOL file_exists(LPCSTR file) -{ - return GetFileAttributesA(file) != INVALID_FILE_ATTRIBUTES; -} - -static BOOL pf_exists(LPCSTR file) -{ - CHAR path[MAX_PATH]; - - lstrcpyA(path, PROG_FILES_DIR); - lstrcatA(path, "\"); - lstrcatA(path, file); - - return file_exists(path); -} - static void delete_pfmsitest_files(void) { SHFILEOPSTRUCTA shfl; @@ -4615,22 +4164,6 @@ error: RemoveDirectoryA("msitest"); }
-static void create_pf_data(LPCSTR file, LPCSTR data, BOOL is_file) -{ - CHAR path[MAX_PATH]; - - lstrcpyA(path, PROG_FILES_DIR); - lstrcatA(path, "\"); - lstrcatA(path, file); - - if (is_file) - create_file_data(path, data, 500); - else - CreateDirectoryA(path, NULL); -} - -#define create_pf(file, is_file) create_pf_data(file, file, is_file) - static void test_remove_files(void) { UINT r; diff --git a/dlls/msi/tests/install.c b/dlls/msi/tests/install.c index ac2c837..a2b95d1 100644 --- a/dlls/msi/tests/install.c +++ b/dlls/msi/tests/install.c @@ -35,6 +35,7 @@ #include <shellapi.h>
#include "wine/test.h" +#include "utils.h"
static UINT (WINAPI *pMsiQueryComponentStateA) (LPCSTR, LPCSTR, MSIINSTALLCONTEXT, LPCSTR, INSTALLSTATE*); @@ -43,9 +44,7 @@ static UINT (WINAPI *pMsiSourceListEnumSourcesA) static INSTALLSTATE (WINAPI *pMsiGetComponentPathExA) (LPCSTR, LPCSTR, LPCSTR, MSIINSTALLCONTEXT, LPSTR, LPDWORD);
-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); static BOOL (WINAPI *pIsWow64Process)(HANDLE, PBOOL); static BOOL (WINAPI *pWow64DisableWow64FsRedirection)(void **); @@ -65,12 +64,12 @@ static const char *mstfile = "winetest.mst"; static const WCHAR msifileW[] = {'m','s','i','t','e','s','t','.','m','s','i',0}; static const WCHAR msifile2W[] = {'w','i','n','e','t','e','s','t','2','.','m','s','i',0};
-static CHAR CURR_DIR[MAX_PATH]; -static CHAR PROG_FILES_DIR[MAX_PATH]; -static CHAR PROG_FILES_DIR_NATIVE[MAX_PATH]; -static CHAR COMMON_FILES_DIR[MAX_PATH]; -static CHAR APP_DATA_DIR[MAX_PATH]; -static CHAR WINDOWS_DIR[MAX_PATH]; +char CURR_DIR[MAX_PATH]; +char PROG_FILES_DIR[MAX_PATH]; +char PROG_FILES_DIR_NATIVE[MAX_PATH]; +char COMMON_FILES_DIR[MAX_PATH]; +char APP_DATA_DIR[MAX_PATH]; +char WINDOWS_DIR[MAX_PATH];
static const char *customdll;
@@ -1348,15 +1347,6 @@ static const CHAR x64_directory_dat[] = "ProgramFiles64Folder\tTARGETDIR\t.\n" "TARGETDIR\t\tSourceDir";
-typedef struct _msi_table -{ - const CHAR *filename; - const CHAR *data; - int size; -} msi_table; - -#define ADD_TABLE(x) {#x".idt", x##_dat, sizeof(x##_dat)} - static const msi_table tables[] = { ADD_TABLE(component), @@ -2084,8 +2074,7 @@ static INT_PTR CDECL fci_open(char *pszFile, int oflag, int pmode, int *err, voi DWORD dwCreateDisposition = OPEN_EXISTING;
dwAccess = GENERIC_READ | GENERIC_WRITE; - /* FILE_SHARE_DELETE is not supported by Windows Me/98/95 */ - dwShareMode = FILE_SHARE_READ | FILE_SHARE_WRITE; + dwShareMode = FILE_SHARE_READ | FILE_SHARE_WRITE | FILE_SHARE_DELETE;
if (GetFileAttributesA(pszFile) != INVALID_FILE_ATTRIBUTES) dwCreateDisposition = OPEN_EXISTING; @@ -2166,9 +2155,7 @@ static void init_functionpointers(void) GET_PROC(hmsi, MsiSourceListEnumSourcesA); GET_PROC(hmsi, MsiGetComponentPathExA);
- GET_PROC(hadvapi32, CheckTokenMembership); GET_PROC(hadvapi32, ConvertSidToStringSidA); - GET_PROC(hadvapi32, OpenProcessToken); GET_PROC(hadvapi32, RegDeleteKeyExA) GET_PROC(hkernel32, IsWow64Process) GET_PROC(hkernel32, Wow64DisableWow64FsRedirection); @@ -2181,18 +2168,16 @@ static void init_functionpointers(void) #undef GET_PROC }
-static BOOL is_process_limited(void) +BOOL is_process_limited(void) { SID_IDENTIFIER_AUTHORITY NtAuthority = {SECURITY_NT_AUTHORITY}; PSID Group = NULL; 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)) + !CheckTokenMembership(NULL, Group, &IsInGroup)) { trace("Could not check if the current user is an administrator\n"); FreeSid(Group); @@ -2206,7 +2191,7 @@ static BOOL is_process_limited(void) return TRUE; }
- if (pOpenProcessToken(GetCurrentProcess(), TOKEN_QUERY, &token)) + if (OpenProcessToken(GetCurrentProcess(), TOKEN_QUERY, &token)) { BOOL ret; TOKEN_ELEVATION_TYPE type = TokenElevationTypeDefault; @@ -2303,7 +2288,7 @@ static void set_cab_parameters(PCCAB pCabParams, const CHAR *name, DWORD max_siz lstrcpyA(pCabParams->szCab, name); }
-static void create_cab_file(const CHAR *name, DWORD max_size, const CHAR *files) +void create_cab_file(const CHAR *name, DWORD max_size, const CHAR *files) { CCAB cabParams; LPCSTR ptr; @@ -2334,7 +2319,7 @@ static void create_cab_file(const CHAR *name, DWORD max_size, const CHAR *files) ok(res, "Failed to destroy the cabinet\n"); }
-static BOOL get_user_dirs(void) +BOOL get_user_dirs(void) { HKEY hkey; DWORD type, size; @@ -2353,7 +2338,7 @@ static BOOL get_user_dirs(void) return TRUE; }
-static BOOL get_system_dirs(void) +BOOL get_system_dirs(void) { HKEY hkey; DWORD type, size; @@ -2390,7 +2375,7 @@ static BOOL get_system_dirs(void) return TRUE; }
-static void create_file_data(LPCSTR name, LPCSTR data, DWORD size) +void create_file_data(LPCSTR name, LPCSTR data, DWORD size) { HANDLE file; DWORD written; @@ -2410,8 +2395,6 @@ static void create_file_data(LPCSTR name, LPCSTR data, DWORD size) CloseHandle(file); }
-#define create_file(name, size) create_file_data(name, name, size) - static void create_test_files(void) { CreateDirectoryA("msitest", NULL); @@ -2432,7 +2415,7 @@ static void create_test_files(void) DeleteFileA("five.txt"); }
-static BOOL delete_pf(const CHAR *rel_path, BOOL is_file) +BOOL delete_pf(const CHAR *rel_path, BOOL is_file) { CHAR path[MAX_PATH];
@@ -2568,17 +2551,8 @@ static void write_msi_summary_info(MSIHANDLE db, INT version, INT wordcount, MsiCloseHandle(summary); }
-#define create_database(name, tables, num_tables) \ - create_database_wordcount(name, tables, num_tables, 100, 0, ";1033", \ - "{004757CA-5092-49C2-AD20-28E1CE0DF5F2}"); - -#define create_database_template(name, tables, num_tables, version, template) \ - create_database_wordcount(name, tables, num_tables, version, 0, template, \ - "{004757CA-5092-49C2-AD20-28E1CE0DF5F2}"); - -static void create_database_wordcount(const CHAR *name, const msi_table *tables, - int num_tables, INT version, INT wordcount, - const char *template, const char *packagecode) +void create_database_wordcount(const CHAR *name, const msi_table *tables, int num_tables, + INT version, INT wordcount, const char *template, const char *packagecode) { MSIHANDLE db; UINT r; @@ -3018,7 +2992,7 @@ static void create_cc_test_files(void) DeleteFileA("caesar"); }
-static void delete_cab_files(void) +void delete_cab_files(void) { SHFILEOPSTRUCTA shfl; CHAR path[MAX_PATH+10]; @@ -3536,12 +3510,12 @@ error: RemoveDirectoryA("msitest"); }
-static BOOL file_exists(LPCSTR file) +BOOL file_exists(const char *file) { return GetFileAttributesA(file) != INVALID_FILE_ATTRIBUTES; }
-static BOOL pf_exists(LPCSTR file) +BOOL pf_exists(const char *file) { CHAR path[MAX_PATH];
@@ -3574,7 +3548,7 @@ static void delete_pfmsitest_files(void) RemoveDirectoryA(path); }
-static UINT run_query(MSIHANDLE hdb, MSIHANDLE hrec, const char *query) +UINT run_query(MSIHANDLE hdb, MSIHANDLE hrec, const char *query) { MSIHANDLE hview = 0; UINT r; @@ -3976,7 +3950,7 @@ error: RemoveDirectoryA("msitest"); }
-static void create_pf_data(LPCSTR file, LPCSTR data, BOOL is_file) +void create_pf_data(LPCSTR file, LPCSTR data, BOOL is_file) { CHAR path[MAX_PATH];
diff --git a/dlls/msi/tests/msi.c b/dlls/msi/tests/msi.c index 85ab7ba..3778019 100644 --- a/dlls/msi/tests/msi.c +++ b/dlls/msi/tests/msi.c @@ -32,19 +32,13 @@ #include <objidl.h>
#include "wine/test.h" +#include "utils.h"
static BOOL is_wow64; static const char msifile[] = "winetest.msi"; static const WCHAR msifileW[] = {'w','i','n','e','t','e','s','t','.','m','s','i',0}; -static char CURR_DIR[MAX_PATH]; -static char PROG_FILES_DIR[MAX_PATH]; -static char PROG_FILES_DIR_NATIVE[MAX_PATH]; -static char COMMON_FILES_DIR[MAX_PATH]; -static char WINDOWS_DIR[MAX_PATH];
-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); static BOOL (WINAPI *pIsWow64Process)(HANDLE, PBOOL);
@@ -110,328 +104,19 @@ static void init_functionpointers(void) GET_PROC(hmsi, MsiEnumComponentsExA) GET_PROC(hmsi, MsiSourceListGetInfoA)
- GET_PROC(hadvapi32, CheckTokenMembership); GET_PROC(hadvapi32, ConvertSidToStringSidA) - GET_PROC(hadvapi32, OpenProcessToken); GET_PROC(hadvapi32, RegDeleteKeyExA) GET_PROC(hkernel32, IsWow64Process)
#undef GET_PROC }
-static BOOL get_system_dirs(void) -{ - HKEY hkey; - DWORD type, size; - - if (RegOpenKeyA(HKEY_LOCAL_MACHINE, "Software\Microsoft\Windows\CurrentVersion", &hkey)) - return FALSE; - - size = MAX_PATH; - if (RegQueryValueExA(hkey, "ProgramFilesDir (x86)", 0, &type, (LPBYTE)PROG_FILES_DIR, &size) && - RegQueryValueExA(hkey, "ProgramFilesDir", 0, &type, (LPBYTE)PROG_FILES_DIR, &size)) - { - RegCloseKey(hkey); - return FALSE; - } - size = MAX_PATH; - if (RegQueryValueExA(hkey, "CommonFilesDir (x86)", 0, &type, (LPBYTE)COMMON_FILES_DIR, &size) && - RegQueryValueExA(hkey, "CommonFilesDir", 0, &type, (LPBYTE)COMMON_FILES_DIR, &size)) - { - RegCloseKey(hkey); - return FALSE; - } - size = MAX_PATH; - if (RegQueryValueExA(hkey, "ProgramFilesDir", 0, &type, (LPBYTE)PROG_FILES_DIR_NATIVE, &size)) - { - RegCloseKey(hkey); - return FALSE; - } - RegCloseKey(hkey); - if (!GetWindowsDirectoryA(WINDOWS_DIR, MAX_PATH)) return FALSE; - return TRUE; -} - -static BOOL file_exists(const char *file) -{ - return GetFileAttributesA(file) != INVALID_FILE_ATTRIBUTES; -} - -static BOOL pf_exists(const char *file) -{ - char path[MAX_PATH]; - - lstrcpyA(path, PROG_FILES_DIR); - lstrcatA(path, "\"); - lstrcatA(path, file); - return file_exists(path); -} - -static BOOL delete_pf(const char *rel_path, BOOL is_file) -{ - char path[MAX_PATH]; - - lstrcpyA(path, PROG_FILES_DIR); - lstrcatA(path, "\"); - lstrcatA(path, rel_path); - - if (is_file) - return DeleteFileA(path); - else - return RemoveDirectoryA(path); -} - -static BOOL is_process_limited(void) -{ - SID_IDENTIFIER_AUTHORITY NtAuthority = {SECURITY_NT_AUTHORITY}; - PSID Group = NULL; - 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"); - FreeSid(Group); - return FALSE; - } - FreeSid(Group); - - 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; -} - /* cabinet definitions */
/* make the max size large so there is only one cab file */ #define MEDIA_SIZE 0x7FFFFFFF #define FOLDER_THRESHOLD 900000
-/* the FCI callbacks */ - -static void * CDECL mem_alloc(ULONG cb) -{ - return HeapAlloc(GetProcessHeap(), 0, cb); -} - -static void CDECL mem_free(void *memory) -{ - HeapFree(GetProcessHeap(), 0, memory); -} - -static BOOL CDECL get_next_cabinet(PCCAB pccab, ULONG cbPrevCab, void *pv) -{ - sprintf(pccab->szCab, pv, pccab->iCab); - return TRUE; -} - -static LONG CDECL progress(UINT typeStatus, ULONG cb1, ULONG cb2, void *pv) -{ - return 0; -} - -static int CDECL file_placed(PCCAB pccab, char *pszFile, LONG cbFile, - BOOL fContinuation, void *pv) -{ - return 0; -} - -static INT_PTR CDECL fci_open(char *pszFile, int oflag, int pmode, int *err, void *pv) -{ - HANDLE handle; - DWORD dwAccess = 0; - DWORD dwShareMode = 0; - DWORD dwCreateDisposition = OPEN_EXISTING; - - dwAccess = GENERIC_READ | GENERIC_WRITE; - /* FILE_SHARE_DELETE is not supported by Windows Me/98/95 */ - dwShareMode = FILE_SHARE_READ | FILE_SHARE_WRITE; - - if (GetFileAttributesA(pszFile) != INVALID_FILE_ATTRIBUTES) - dwCreateDisposition = OPEN_EXISTING; - else - dwCreateDisposition = CREATE_NEW; - - handle = CreateFileA(pszFile, dwAccess, dwShareMode, NULL, - dwCreateDisposition, 0, NULL); - - ok(handle != INVALID_HANDLE_VALUE, "Failed to CreateFile %s\n", pszFile); - - return (INT_PTR)handle; -} - -static UINT CDECL fci_read(INT_PTR hf, void *memory, UINT cb, int *err, void *pv) -{ - HANDLE handle = (HANDLE)hf; - DWORD dwRead; - BOOL res; - - res = ReadFile(handle, memory, cb, &dwRead, NULL); - ok(res, "Failed to ReadFile\n"); - - return dwRead; -} - -static UINT CDECL fci_write(INT_PTR hf, void *memory, UINT cb, int *err, void *pv) -{ - HANDLE handle = (HANDLE)hf; - DWORD dwWritten; - BOOL res; - - res = WriteFile(handle, memory, cb, &dwWritten, NULL); - ok(res, "Failed to WriteFile\n"); - - return dwWritten; -} - -static int CDECL fci_close(INT_PTR hf, int *err, void *pv) -{ - HANDLE handle = (HANDLE)hf; - ok(CloseHandle(handle), "Failed to CloseHandle\n"); - - return 0; -} - -static LONG CDECL fci_seek(INT_PTR hf, LONG dist, int seektype, int *err, void *pv) -{ - HANDLE handle = (HANDLE)hf; - DWORD ret; - - ret = SetFilePointer(handle, dist, NULL, seektype); - ok(ret != INVALID_SET_FILE_POINTER, "Failed to SetFilePointer\n"); - - return ret; -} - -static int CDECL fci_delete(char *pszFile, int *err, void *pv) -{ - BOOL ret = DeleteFileA(pszFile); - ok(ret, "Failed to DeleteFile %s\n", pszFile); - - return 0; -} - -static BOOL CDECL get_temp_file(char *pszTempName, int cbTempName, void *pv) -{ - LPSTR tempname; - - tempname = HeapAlloc(GetProcessHeap(), 0, MAX_PATH); - GetTempFileNameA(".", "xx", 0, tempname); - - if (tempname && (strlen(tempname) < (unsigned)cbTempName)) - { - lstrcpyA(pszTempName, tempname); - HeapFree(GetProcessHeap(), 0, tempname); - return TRUE; - } - - HeapFree(GetProcessHeap(), 0, tempname); - - return FALSE; -} - -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; - HANDLE handle; - DWORD attrs; - BOOL res; - - 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); - - res = GetFileInformationByHandle(handle, &finfo); - ok(res, "Expected GetFileInformationByHandle to succeed\n"); - - FileTimeToLocalFileTime(&finfo.ftLastWriteTime, &filetime); - FileTimeToDosDateTime(&filetime, pdate, ptime); - - attrs = GetFileAttributesA(pszName); - ok(attrs != INVALID_FILE_ATTRIBUTES, "Failed to GetFileAttributes\n"); - - return (INT_PTR)handle; -} - -static BOOL add_file(HFCI hfci, const char *file, TCOMP compress) -{ - char path[MAX_PATH]; - char filename[MAX_PATH]; - - lstrcpyA(path, CURR_DIR); - lstrcatA(path, "\"); - lstrcatA(path, file); - - lstrcpyA(filename, file); - - return FCIAddFile(hfci, path, filename, FALSE, get_next_cabinet, - progress, get_open_info, compress); -} - -static void set_cab_parameters(PCCAB pCabParams, const CHAR *name, DWORD max_size) -{ - ZeroMemory(pCabParams, sizeof(CCAB)); - - pCabParams->cb = max_size; - pCabParams->cbFolderThresh = FOLDER_THRESHOLD; - pCabParams->setID = 0xbeef; - pCabParams->iCab = 1; - lstrcpyA(pCabParams->szCabPath, CURR_DIR); - lstrcatA(pCabParams->szCabPath, "\"); - lstrcpyA(pCabParams->szCab, name); -} - -static void create_cab_file(const CHAR *name, DWORD max_size, const CHAR *files) -{ - CCAB cabParams; - LPCSTR ptr; - HFCI hfci; - ERF erf; - BOOL res; - - set_cab_parameters(&cabParams, name, max_size); - - hfci = FCICreate(&erf, file_placed, mem_alloc, mem_free, fci_open, - fci_read, fci_write, fci_close, fci_seek, fci_delete, - get_temp_file, &cabParams, NULL); - - ok(hfci != NULL, "Failed to create an FCI context\n"); - - ptr = files; - while (*ptr) - { - res = add_file(hfci, ptr, tcompTYPE_MSZIP); - ok(res, "Failed to add file: %s\n", ptr); - ptr += lstrlenA(ptr) + 1; - } - - res = FCIFlushCabinet(hfci, FALSE, get_next_cabinet, progress); - ok(res, "Failed to flush the cabinet\n"); - - res = FCIDestroy(hfci); - ok(res, "Failed to destroy the cabinet\n"); -} - static BOOL add_cabinet_storage(LPCSTR db, LPCSTR cabinet) { WCHAR dbW[MAX_PATH], cabinetW[MAX_PATH]; @@ -469,24 +154,6 @@ static BOOL add_cabinet_storage(LPCSTR db, LPCSTR cabinet) return TRUE; }
-static void delete_cab_files(void) -{ - SHFILEOPSTRUCTA shfl; - CHAR path[MAX_PATH+10]; - - lstrcpyA(path, CURR_DIR); - lstrcatA(path, "\*.cab"); - path[strlen(path) + 1] = '\0'; - - shfl.hwnd = NULL; - shfl.wFunc = FO_DELETE; - shfl.pFrom = path; - shfl.pTo = NULL; - shfl.fFlags = FOF_FILESONLY | FOF_NOCONFIRMATION | FOF_NORECURSION | FOF_SILENT; - - SHFileOperationA(&shfl); -} - /* msi database data */
static const char directory_dat[] = @@ -908,15 +575,6 @@ static const char cl_install_exec_seq_dat[] = "InstallValidate\t\t1400\n" "InstallFinalize\t\t5000\n";
-typedef struct _msi_table -{ - const CHAR *filename; - const CHAR *data; - int size; -} msi_table; - -#define ADD_TABLE(x) {#x".idt", x##_dat, sizeof(x##_dat)} - static const msi_table tables[] = { ADD_TABLE(directory), @@ -1043,107 +701,6 @@ static const msi_table cl_tables[] = ADD_TABLE(property) };
-static void write_file(const CHAR *filename, const char *data, int data_size) -{ - DWORD size; - - HANDLE hf = CreateFileA(filename, GENERIC_WRITE, 0, NULL, - CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL); - WriteFile(hf, data, data_size, &size, NULL); - CloseHandle(hf); -} - -static void write_msi_summary_info(MSIHANDLE db, INT version, INT wordcount, const char *template) -{ - MSIHANDLE summary; - UINT r; - - r = MsiGetSummaryInformationA(db, NULL, 5, &summary); - ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r); - - r = MsiSummaryInfoSetPropertyA(summary, PID_TEMPLATE, VT_LPSTR, 0, NULL, template); - ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r); - - r = MsiSummaryInfoSetPropertyA(summary, PID_REVNUMBER, VT_LPSTR, 0, NULL, - "{004757CA-5092-49C2-AD20-28E1CE0DF5F2}"); - ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r); - - r = MsiSummaryInfoSetPropertyA(summary, PID_PAGECOUNT, VT_I4, version, NULL, NULL); - ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r); - - r = MsiSummaryInfoSetPropertyA(summary, PID_WORDCOUNT, VT_I4, wordcount, NULL, NULL); - ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r); - - r = MsiSummaryInfoSetPropertyA(summary, PID_TITLE, VT_LPSTR, 0, NULL, "MSITEST"); - ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r); - - /* write the summary changes back to the stream */ - r = MsiSummaryInfoPersist(summary); - ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r); - - MsiCloseHandle(summary); -} - -#define create_database(name, tables, num_tables) \ - create_database_wordcount(name, tables, num_tables, 100, 0, ";1033"); - -#define create_database_template(name, tables, num_tables, version, template) \ - create_database_wordcount(name, tables, num_tables, version, 0, template); - -static void create_database_wordcount(const CHAR *name, const msi_table *tables, - int num_tables, INT version, INT wordcount, - const char *template) -{ - MSIHANDLE db; - UINT r; - 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 = MsiOpenDatabaseW(nameW, MSIDBOPEN_CREATE, &db); - ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r); - - /* import the tables into the database */ - for (j = 0; j < num_tables; j++) - { - const msi_table *table = &tables[j]; - - write_file(table->filename, table->data, (table->size - 1) * sizeof(char)); - - r = MsiDatabaseImportA(db, CURR_DIR, table->filename); - ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r); - - DeleteFileA(table->filename); - } - - write_msi_summary_info(db, version, wordcount, template); - - r = MsiDatabaseCommit(db); - ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r); - - MsiCloseHandle(db); - HeapFree( GetProcessHeap(), 0, nameW ); -} - -static UINT run_query(MSIHANDLE hdb, const char *query) -{ - MSIHANDLE hview = 0; - UINT r; - - r = MsiDatabaseOpenViewA(hdb, query, &hview); - if (r != ERROR_SUCCESS) - return r; - - r = MsiViewExecute(hview, 0); - if (r == ERROR_SUCCESS) - r = MsiViewClose(hview); - MsiCloseHandle(hview); - return r; -} - static UINT set_summary_info(MSIHANDLE hdb, LPSTR prodcode) { UINT res; @@ -1207,7 +764,7 @@ static MSIHANDLE create_package_db(LPSTR prodcode)
set_summary_info(hdb, prodcode);
- res = run_query(hdb, + res = run_query(hdb, 0, "CREATE TABLE `Directory` ( " "`Directory` CHAR(255) NOT NULL, " "`Directory_Parent` CHAR(255), " @@ -1215,7 +772,7 @@ static MSIHANDLE create_package_db(LPSTR prodcode) "PRIMARY KEY `Directory`)"); ok(res == ERROR_SUCCESS , "Failed to create directory table\n");
- res = run_query(hdb, + res = run_query(hdb, 0, "CREATE TABLE `Property` ( " "`Property` CHAR(72) NOT NULL, " "`Value` CHAR(255) " @@ -1225,7 +782,7 @@ static MSIHANDLE create_package_db(LPSTR prodcode) sprintf(query, "INSERT INTO `Property` " "(`Property`, `Value`) " "VALUES( 'ProductCode', '%s' )", prodcode); - res = run_query(hdb, query); + res = run_query(hdb, 0, query); ok(res == ERROR_SUCCESS , "Failed\n");
res = MsiDatabaseCommit(hdb); @@ -1428,39 +985,21 @@ static void test_getcomponentpath(void) ok( r == INSTALLSTATE_UNKNOWN, "wrong return value\n"); }
-static void create_file(LPCSTR name, LPCSTR data, DWORD size) -{ - HANDLE file; - DWORD written; - - file = CreateFileA(name, GENERIC_WRITE, 0, NULL, CREATE_ALWAYS, 0, NULL); - ok(file != INVALID_HANDLE_VALUE, "Failure to open file %s\n", name); - WriteFile(file, data, strlen(data), &written, NULL); - - if (size) - { - SetFilePointer(file, size, NULL, FILE_BEGIN); - SetEndOfFile(file); - } - - CloseHandle(file); -} - static void create_test_files(void) { CreateDirectoryA("msitest", NULL); - create_file("msitest\one.txt", "msitest\one.txt", 100); + create_file("msitest\one.txt", 100); CreateDirectoryA("msitest\first", NULL); - create_file("msitest\first\two.txt", "msitest\first\two.txt", 100); + create_file("msitest\first\two.txt", 100); CreateDirectoryA("msitest\second", NULL); - create_file("msitest\second\three.txt", "msitest\second\three.txt", 100); + create_file("msitest\second\three.txt", 100);
- create_file("four.txt", "four.txt", 100); - create_file("five.txt", "five.txt", 100); + create_file("four.txt", 100); + create_file("five.txt", 100); create_cab_file("msitest.cab", MEDIA_SIZE, "four.txt\0five.txt\0");
- create_file("msitest\filename", "msitest\filename", 100); - create_file("msitest\service.exe", "msitest\service.exe", 100); + create_file("msitest\filename", 100); + create_file("msitest\service.exe", 100);
DeleteFileA("four.txt"); DeleteFileA("five.txt"); @@ -1559,7 +1098,7 @@ static void test_MsiGetFileHash(void) { int ret;
- create_file(name, hash_data[i].data, hash_data[i].size); + create_file_data(name, hash_data[i].data, hash_data[i].size);
memset(&hash, 0, sizeof(MSIFILEHASHINFO)); hash.dwFileHashInfoSize = sizeof(MSIFILEHASHINFO); @@ -3030,7 +2569,7 @@ static void test_MsiGetComponentPath(void) ok(!lstrcmpA(path, "C:\imapath"), "Expected C:\imapath, got %s\n", path); ok(size == 10, "Expected 10, got %d\n", size);
- create_file("C:\imapath", "C:\imapath", 11); + create_file("C:\imapath", 11);
/* file exists */ path[0] = 'a'; @@ -3134,7 +2673,7 @@ static void test_MsiGetComponentPath(void) ok(!lstrcmpA(path, "C:\imapath"), "Expected C:\imapath, got %s\n", path); ok(size == 10, "Expected 10, got %d\n", size);
- create_file("C:\imapath", "C:\imapath", 11); + create_file("C:\imapath", 11);
/* file exists */ path[0] = 0; @@ -3244,7 +2783,7 @@ static void test_MsiGetComponentPath(void) ok(!lstrcmpA(path, "C:\imapath"), "Expected C:\imapath, got %s\n", path); ok(size == 10, "Expected 10, got %d\n", size);
- create_file("C:\imapath", "C:\imapath", 11); + create_file("C:\imapath", 11);
/* file exists */ path[0] = 0; @@ -3326,7 +2865,7 @@ static void test_MsiGetComponentPath(void) ok(!lstrcmpA(path, "C:\imapath"), "Expected C:\imapath, got %s\n", path); ok(size == 10, "Expected 10, got %d\n", size);
- create_file("C:\imapath", "C:\imapath", 11); + create_file("C:\imapath", 11);
/* file exists */ path[0] = 0; @@ -3403,7 +2942,7 @@ static void test_MsiGetComponentPath(void) ok(!lstrcmpA(path, "C:\imapath"), "Expected C:\imapath, got %s\n", path); ok(size == 10, "Expected 10, got %d\n", size);
- create_file("C:\imapath", "C:\imapath", 11); + create_file("C:\imapath", 11);
/* file exists */ path[0] = 0; @@ -3537,7 +3076,7 @@ static void test_MsiGetComponentPathEx(void) ok( !lstrcmpA( path, "c:\testcomponentpath"), "got %s\n", path ); ok( size == 20, "got %u\n", size );
- create_file( "c:\testcomponentpath", "c:\testcomponentpath", 21 ); + create_file( "c:\testcomponentpath", 21 );
/* file exists */ path[0] = 0; @@ -3600,7 +3139,7 @@ static void test_MsiGetComponentPathEx(void) ok( !lstrcmpA( path, "c:\testcomponentpath"), "got %s\n", path ); ok( size == 20, "got %u\n", size );
- create_file( "c:\testcomponentpath", "c:\testcomponentpath", 21 ); + create_file( "c:\testcomponentpath", 21 );
/* file exists */ path[0] = 0; @@ -3676,7 +3215,7 @@ static void test_MsiGetComponentPathEx(void) ok( !lstrcmpA( path, "c:\testcomponentpath" ), "got %s\n", path ); ok( size == 20, "got %u\n", size );
- create_file( "c:\testcomponentpath", "C:\testcomponentpath", 21 ); + create_file( "c:\testcomponentpath", 21 );
/* file exists */ path[0] = 0; @@ -3731,7 +3270,7 @@ static void test_MsiGetComponentPathEx(void) ok( !lstrcmpA( path, "c:\testcomponentpath" ), "got %s\n", path ); ok( size == 20, "got %u\n", size );
- create_file( "c:\testcomponentpath", "c:\testcomponentpath", 21 ); + create_file( "c:\testcomponentpath", 21 );
/* file exists */ path[0] = 0; @@ -3773,7 +3312,7 @@ static void test_MsiProvideComponent(void) }
create_test_files(); - create_file("msitest\sourcedir.txt", "msitest\sourcedir.txt", 1000); + create_file("msitest\sourcedir.txt", 1000); create_database(msifile, sd_tables, sizeof(sd_tables) / sizeof(msi_table));
MsiSetInternalUI(INSTALLUILEVEL_NONE, NULL); @@ -3957,7 +3496,7 @@ static void test_MsiProvideQualifiedComponentEx(void) lstrcatA( path, "\msitest" ); CreateDirectoryA( path, NULL ); lstrcatA( path, "\test.txt" ); - create_file( path, "test", 100 ); + create_file_data( path, "test", 100 );
res = RegSetValueExA( hkey5, prod_squashed, 0, REG_SZ, (const BYTE *)path, lstrlenA(path) + 1 ); ok( res == ERROR_SUCCESS, "got %d\n", res ); @@ -4600,7 +4139,7 @@ static void test_MsiGetFileVersion(void) ok(r == ERROR_FILE_NOT_FOUND, "Expected ERROR_FILE_NOT_FOUND, got %d\n", r);
- create_file("ver.txt", "ver.txt", 20); + create_file("ver.txt", 20);
/* file exists, no version information */ r = MsiGetFileVersionA("ver.txt", NULL, NULL, NULL, NULL); @@ -13543,7 +13082,7 @@ static void test_MsiGetFileSignatureInformation(void) hr = MsiGetFileSignatureInformationA( "signature.bin", 0, &cert, NULL, &len ); todo_wine ok(hr == CRYPT_E_FILE_ERROR, "expected CRYPT_E_FILE_ERROR got 0x%08x\n", hr);
- create_file( "signature.bin", "signature", sizeof("signature") ); + create_file_data( "signature.bin", "signature", sizeof("signature") );
hr = MsiGetFileSignatureInformationA( "signature.bin", 0, NULL, NULL, NULL ); ok(hr == E_INVALIDARG, "expected E_INVALIDARG got 0x%08x\n", hr); @@ -13901,9 +13440,9 @@ static void test_MsiConfigureProductEx(void) }
CreateDirectoryA("msitest", NULL); - create_file("msitest\hydrogen", "hydrogen", 500); - create_file("msitest\helium", "helium", 500); - create_file("msitest\lithium", "lithium", 500); + create_file_data("msitest\hydrogen", "hydrogen", 500); + create_file_data("msitest\helium", "helium", 500); + create_file_data("msitest\lithium", "lithium", 500);
create_database(msifile, mcp_tables, sizeof(mcp_tables) / sizeof(msi_table));
@@ -14444,7 +13983,7 @@ static void test_lastusedsource(void) }
CreateDirectoryA("msitest", NULL); - create_file("maximus", "maximus", 500); + create_file("maximus", 500); create_cab_file("test1.cab", MEDIA_SIZE, "maximus\0"); DeleteFileA("maximus");
@@ -14568,7 +14107,7 @@ static void test_setpropertyfolder(void) lstrcatA(path, "\msitest\added");
CreateDirectoryA("msitest", NULL); - create_file("msitest\maximus", "msitest\maximus", 500); + create_file("msitest\maximus", 500);
create_database(msifile, spf_tables, sizeof(spf_tables) / sizeof(msi_table));
@@ -14612,7 +14151,7 @@ static void test_sourcedir_props(void) }
create_test_files(); - create_file("msitest\sourcedir.txt", "msitest\sourcedir.txt", 1000); + create_file("msitest\sourcedir.txt", 1000); create_database(msifile, sd_tables, sizeof(sd_tables) / sizeof(msi_table));
MsiSetInternalUI(INSTALLUILEVEL_FULL, NULL); @@ -14677,8 +14216,8 @@ static void test_concurrentinstall(void)
CreateDirectoryA("msitest", NULL); CreateDirectoryA("msitest\msitest", NULL); - create_file("msitest\maximus", "msitest\maximus", 500); - create_file("msitest\msitest\augustus", "msitest\msitest\augustus", 500); + create_file("msitest\maximus", 500); + create_file("msitest\msitest\augustus", 500);
create_database(msifile, ci_tables, sizeof(ci_tables) / sizeof(msi_table));
diff --git a/dlls/msi/tests/utils.h b/dlls/msi/tests/utils.h new file mode 100644 index 0000000..f16e2d5 --- /dev/null +++ b/dlls/msi/tests/utils.h @@ -0,0 +1,60 @@ +/* + * Copyright 2018 Zebediah Figura + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA + */ + +char PROG_FILES_DIR[MAX_PATH]; +char PROG_FILES_DIR_NATIVE[MAX_PATH]; +char COMMON_FILES_DIR[MAX_PATH]; +char APP_DATA_DIR[MAX_PATH]; +char WINDOWS_DIR[MAX_PATH]; +char CURR_DIR[MAX_PATH]; + +BOOL get_system_dirs(void); +BOOL get_user_dirs(void); + +typedef struct _msi_table +{ + const char *filename; + const char *data; + int size; +} msi_table; + +#define ADD_TABLE(x) {#x".idt", x##_dat, sizeof(x##_dat)} + +/* in install.c */ +void create_database_wordcount(const char *name, const msi_table *tables, int num_tables, + int version, int wordcount, const char *template, const char *packagecode); + +#define create_database(name, tables, num_tables) \ + create_database_wordcount(name, tables, num_tables, 100, 0, ";1033", \ + "{004757CA-5092-49C2-AD20-28E1CE0DF5F2}"); + +#define create_database_template(name, tables, num_tables, version, template) \ + create_database_wordcount(name, tables, num_tables, version, 0, template, \ + "{004757CA-5092-49C2-AD20-28E1CE0DF5F2}"); + +void create_cab_file(const char *name, DWORD max_size, const char *files); +void create_file_data(const char *name, const char *data, DWORD size); +#define create_file(name, size) create_file_data(name, name, size) +void create_pf_data(const char *file, const char *data, BOOL is_file); +#define create_pf(file, is_file) create_pf_data(file, file, is_file) +void delete_cab_files(void); +BOOL delete_pf(const char *rel_path, BOOL is_file); +BOOL file_exists(const char *file); +BOOL pf_exists(const char *file); +BOOL is_process_limited(void); +UINT run_query(MSIHANDLE hdb, MSIHANDLE hrec, const char *query);
Signed-off-by: Zebediah Figura z.figura12@gmail.com --- dlls/msi/tests/action.c | 109 ++++++++++-------------------------------------- 1 file changed, 22 insertions(+), 87 deletions(-)
diff --git a/dlls/msi/tests/action.c b/dlls/msi/tests/action.c index 8e72ff4..3b15d14 100644 --- a/dlls/msi/tests/action.c +++ b/dlls/msi/tests/action.c @@ -2321,45 +2321,6 @@ static void check_reg_dword(HKEY prodkey, LPCSTR name, DWORD expected, DWORD lin ok_(__FILE__, line)(val == expected, "Expected %d, got %d\n", expected, val); }
-static void check_reg_dword4(HKEY prodkey, LPCSTR name, DWORD expected1, DWORD expected2, DWORD expected3, - DWORD expected4, DWORD line) -{ - DWORD val, size, type; - LONG res; - - size = sizeof(DWORD); - res = RegQueryValueExA(prodkey, name, NULL, &type, (LPBYTE)&val, &size); - - if (res != ERROR_SUCCESS || type != REG_DWORD) - { - ok_(__FILE__, line)(FALSE, "Key doesn't exist or wrong type\n"); - return; - } - - ok_(__FILE__, line)(val == expected1 || val == expected2 || val == expected3 || val == expected4, - "Expected %d, %d, %d or %d, got %d\n", expected1, expected2, expected3, expected4, val); -} - -static void check_reg_dword5(HKEY prodkey, LPCSTR name, DWORD expected1, DWORD expected2, DWORD expected3, - DWORD expected4, DWORD expected5, DWORD line) -{ - DWORD val, size, type; - LONG res; - - size = sizeof(DWORD); - res = RegQueryValueExA(prodkey, name, NULL, &type, (LPBYTE)&val, &size); - - if (res != ERROR_SUCCESS || type != REG_DWORD) - { - ok_(__FILE__, line)(FALSE, "Key doesn't exist or wrong type\n"); - return; - } - - ok_(__FILE__, line)(val == expected1 || val == expected2 || val == expected3 || val == expected4 || - val == expected5, - "Expected %d, %d, %d, %d or %d, got %d\n", expected1, expected2, expected3, expected4, expected5, val); -} - #define CHECK_REG_STR(prodkey, name, expected) \ check_reg_str(prodkey, name, expected, TRUE, __LINE__);
@@ -2387,24 +2348,6 @@ static void check_reg_dword5(HKEY prodkey, LPCSTR name, DWORD expected1, DWORD e RegDeleteValueA(prodkey, name); \ } while(0)
-#define CHECK_REG_DWORD2(prodkey, name, expected1, expected2) \ - check_reg_dword2(prodkey, name, expected1, expected2, __LINE__); - -#define CHECK_DEL_REG_DWORD2(prodkey, name, expected1, expected2) \ - do { \ - check_reg_dword2(prodkey, name, expected1, expected2, __LINE__); \ - RegDeleteValueA(prodkey, name); \ - } while(0) - -#define CHECK_REG_DWORD4(prodkey, name, expected1, expected2, expected3, expected4) \ - check_reg_dword4(prodkey, name, expected1, expected2, expected3, expected4, __LINE__); - -#define CHECK_DEL_REG_DWORD5(prodkey, name, expected1, expected2, expected3, expected4 ,expected5) \ - do { \ - check_reg_dword5(prodkey, name, expected1, expected2, expected3, expected4, expected5, __LINE__); \ - RegDeleteValueA(prodkey, name); \ - } while(0) - static void get_date_str(LPSTR date) { SYSTEMTIME systime; @@ -2414,6 +2357,18 @@ static void get_date_str(LPSTR date) sprintf(date, date_fmt, systime.wYear, systime.wMonth, systime.wDay); }
+/* EstimatedSize is the size in KiB of .msi + installed files, rounded up to page size. */ +static DWORD get_estimated_size(void) +{ + HANDLE file; + DWORD size; + + file = CreateFileA(msifile, GENERIC_READ, 0, NULL, OPEN_EXISTING, 0, NULL); + size = (((GetFileSize(file, NULL) + 4095) & ~4095) / 1024) + 4; + CloseHandle(file); + return size; +} + static void test_register_product(void) { UINT r; @@ -2505,9 +2460,7 @@ static void test_register_product(void) CHECK_DEL_REG_DWORD(hkey, "VersionMinor", 1); CHECK_DEL_REG_DWORD(hkey, "WindowsInstaller", 1); todo_wine - { - CHECK_DEL_REG_DWORD5(hkey, "EstimatedSize", 12, -12, 4, 10, 24); - } + CHECK_DEL_REG_DWORD(hkey, "EstimatedSize", get_estimated_size());
delete_key(hkey, "", access); RegCloseKey(hkey); @@ -2547,9 +2500,7 @@ static void test_register_product(void) CHECK_DEL_REG_DWORD(props, "VersionMinor", 1); CHECK_DEL_REG_DWORD(props, "WindowsInstaller", 1); todo_wine - { - CHECK_DEL_REG_DWORD5(props, "EstimatedSize", 12, -12, 4, 10, 24); - } + CHECK_DEL_REG_DWORD(props, "EstimatedSize", get_estimated_size());
delete_key(props, "", access); RegCloseKey(props); @@ -2616,9 +2567,7 @@ static void test_register_product(void) CHECK_DEL_REG_DWORD(hkey, "VersionMinor", 1); CHECK_DEL_REG_DWORD(hkey, "WindowsInstaller", 1); todo_wine - { - CHECK_DEL_REG_DWORD5(hkey, "EstimatedSize", 12, -12, 4, 10, 24); - } + CHECK_DEL_REG_DWORD(hkey, "EstimatedSize", get_estimated_size());
delete_key(hkey, "", access); RegCloseKey(hkey); @@ -2658,9 +2607,7 @@ static void test_register_product(void) CHECK_DEL_REG_DWORD(props, "VersionMinor", 1); CHECK_DEL_REG_DWORD(props, "WindowsInstaller", 1); todo_wine - { - CHECK_DEL_REG_DWORD5(props, "EstimatedSize", 12, -12, 4, 10, 24); - } + CHECK_DEL_REG_DWORD(props, "EstimatedSize", get_estimated_size());
delete_key(props, "", access); RegCloseKey(props); @@ -3525,9 +3472,7 @@ static void test_publish(void) CHECK_REG_DWORD(prodkey, "VersionMinor", 1); CHECK_REG_DWORD(prodkey, "WindowsInstaller", 1); todo_wine - { - CHECK_REG_DWORD4(prodkey, "EstimatedSize", 12, -12, 10, 24); - } + CHECK_REG_DWORD(prodkey, "EstimatedSize", get_estimated_size());
RegCloseKey(prodkey);
@@ -3631,9 +3576,7 @@ static void test_publish(void) CHECK_REG_DWORD(prodkey, "VersionMinor", 1); CHECK_REG_DWORD(prodkey, "WindowsInstaller", 1); todo_wine - { - CHECK_REG_DWORD4(prodkey, "EstimatedSize", 12, -12, 10, 24); - } + CHECK_REG_DWORD(prodkey, "EstimatedSize", get_estimated_size());
RegCloseKey(prodkey);
@@ -3714,9 +3657,7 @@ static void test_publish(void) CHECK_REG_DWORD(prodkey, "VersionMinor", 1); CHECK_REG_DWORD(prodkey, "WindowsInstaller", 1); todo_wine - { - CHECK_REG_DWORD4(prodkey, "EstimatedSize", 12, -12, 10, 24); - } + CHECK_REG_DWORD(prodkey, "EstimatedSize", get_estimated_size());
RegCloseKey(prodkey);
@@ -3774,9 +3715,7 @@ static void test_publish(void) CHECK_REG_DWORD(prodkey, "VersionMinor", 1); CHECK_REG_DWORD(prodkey, "WindowsInstaller", 1); todo_wine - { - CHECK_REG_DWORD4(prodkey, "EstimatedSize", 12, -12, 10, 24); - } + CHECK_REG_DWORD(prodkey, "EstimatedSize", get_estimated_size());
RegCloseKey(prodkey);
@@ -3834,9 +3773,7 @@ static void test_publish(void) CHECK_REG_DWORD(prodkey, "VersionMinor", 1); CHECK_REG_DWORD(prodkey, "WindowsInstaller", 1); todo_wine - { - CHECK_REG_DWORD4(prodkey, "EstimatedSize", 12, -20, 10, 24); - } + CHECK_REG_DWORD(prodkey, "EstimatedSize", get_estimated_size());
RegCloseKey(prodkey);
@@ -3917,9 +3854,7 @@ static void test_publish(void) CHECK_REG_DWORD(prodkey, "VersionMinor", 1); CHECK_REG_DWORD(prodkey, "WindowsInstaller", 1); todo_wine - { - CHECK_REG_DWORD4(prodkey, "EstimatedSize", 12, -12, 10, 24); - } + CHECK_REG_DWORD(prodkey, "EstimatedSize", get_estimated_size());
RegCloseKey(prodkey);
On Mon, 2018-05-14 at 00:28 -0500, Zebediah Figura wrote:
+/* EstimatedSize is the size in KiB of .msi + installed files, rounded up to page size. */ +static DWORD get_estimated_size(void) +{ + HANDLE file; + DWORD size;
+ file = CreateFileA(msifile, GENERIC_READ, 0, NULL, OPEN_EXISTING, 0, NULL); + size = (((GetFileSize(file, NULL) + 4095) & ~4095) / 1024) + 4;
This should query the page size.
The change to msi.c is necessary since this sets the UI handler.
Signed-off-by: Zebediah Figura z.figura12@gmail.com --- dlls/msi/tests/install.c | 142 +++++++++++++++++++++++------------------------ dlls/msi/tests/msi.c | 2 +- 2 files changed, 69 insertions(+), 75 deletions(-)
diff --git a/dlls/msi/tests/install.c b/dlls/msi/tests/install.c index a2b95d1..f0e4857 100644 --- a/dlls/msi/tests/install.c +++ b/dlls/msi/tests/install.c @@ -2551,6 +2551,73 @@ static void write_msi_summary_info(MSIHANDLE db, INT version, INT wordcount, MsiCloseHandle(summary); }
+static char *load_resource(const char *name) +{ + static char path[MAX_PATH]; + DWORD written; + HANDLE file; + HRSRC res; + void *ptr; + + GetTempFileNameA(".", name, 0, path); + + file = CreateFileA(path, GENERIC_READ|GENERIC_WRITE, 0, NULL, CREATE_ALWAYS, 0, 0); + ok(file != INVALID_HANDLE_VALUE, "file creation failed, at %s, error %d\n", path, GetLastError()); + + res = FindResourceA(NULL, name, "TESTDLL"); + ok( res != 0, "couldn't find resource\n" ); + ptr = LockResource( LoadResource( GetModuleHandleA(NULL), res )); + WriteFile( file, ptr, SizeofResource( GetModuleHandleA(NULL), res ), &written, NULL ); + ok( written == SizeofResource( GetModuleHandleA(NULL), res ), "couldn't write resource\n" ); + CloseHandle( file ); + + return path; +} + +static INT CALLBACK ok_callback(void *context, UINT message_type, MSIHANDLE record) +{ + if (message_type == INSTALLMESSAGE_USER) + { + char file[200]; + char msg[2000]; + DWORD len; + + len = sizeof(file); + MsiRecordGetStringA(record, 2, file, &len); + len = sizeof(msg); + MsiRecordGetStringA(record, 5, msg, &len); + + todo_wine_if(MsiRecordGetInteger(record, 1)) + ok_(file, MsiRecordGetInteger(record, 3)) (MsiRecordGetInteger(record, 4), "%s", msg); + + return 1; + } + return 0; +} + +static void add_custom_dll(MSIHANDLE hdb) +{ + MSIHANDLE record; + UINT res; + + if (!customdll) + customdll = load_resource("custom.dll"); + + MsiSetExternalUIRecord(ok_callback, INSTALLLOGMODE_USER, NULL, NULL); + + res = run_query(hdb, 0, "CREATE TABLE `Binary` (`Name` CHAR(72) NOT NULL, `Data` OBJECT NOT NULL PRIMARY KEY `Name`)"); + ok(res == ERROR_SUCCESS, "failed to create Binary table: %u\n", res); + + record = MsiCreateRecord(1); + res = MsiRecordSetStreamA(record, 1, customdll); + ok(res == ERROR_SUCCESS, "failed to add %s to stream: %u\n", customdll, res); + + res = run_query(hdb, record, "INSERT INTO `Binary` (`Name`, `Data`) VALUES ('custom.dll', ?)"); + ok(res == ERROR_SUCCESS, "failed to insert into Binary table: %u\n", res); + + MsiCloseHandle(record); +} + void create_database_wordcount(const CHAR *name, const msi_table *tables, int num_tables, INT version, INT wordcount, const char *template, const char *packagecode) { @@ -2580,6 +2647,7 @@ void create_database_wordcount(const CHAR *name, const msi_table *tables, int nu }
write_msi_summary_info(db, version, wordcount, template, packagecode); + add_custom_dll(db);
r = MsiDatabaseCommit(db); ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r); @@ -2634,29 +2702,6 @@ static LONG delete_key( HKEY key, LPCSTR subkey, REGSAM access ) return RegDeleteKeyA( key, subkey ); }
-static char *load_resource(const char *name) -{ - static char path[MAX_PATH]; - DWORD written; - HANDLE file; - HRSRC res; - void *ptr; - - GetTempFileNameA(".", name, 0, path); - - file = CreateFileA(path, GENERIC_READ|GENERIC_WRITE, 0, NULL, CREATE_ALWAYS, 0, 0); - ok(file != INVALID_HANDLE_VALUE, "file creation failed, at %s, error %d\n", path, GetLastError()); - - res = FindResourceA(NULL, name, "TESTDLL"); - ok( res != 0, "couldn't find resource\n" ); - ptr = LockResource( LoadResource( GetModuleHandleA(NULL), res )); - WriteFile( file, ptr, SizeofResource( GetModuleHandleA(NULL), res ), &written, NULL ); - ok( written == SizeofResource( GetModuleHandleA(NULL), res ), "couldn't write resource\n" ); - CloseHandle( file ); - - return path; -} - static void test_MsiInstallProduct(void) { UINT r; @@ -4082,52 +4127,6 @@ error: DeleteFileA("augustus"); }
-static void add_custom_dll(void) -{ - MSIHANDLE hdb = 0, record; - UINT res; - - res = MsiOpenDatabaseW(msifileW, MSIDBOPEN_TRANSACT, &hdb); - ok(res == ERROR_SUCCESS, "failed to open db: %u\n", res); - - res = run_query(hdb, 0, "CREATE TABLE `Binary` (`Name` CHAR(72) NOT NULL, `Data` OBJECT NOT NULL PRIMARY KEY `Name`)"); - ok(res == ERROR_SUCCESS, "failed to create Binary table: %u\n", res); - - record = MsiCreateRecord(1); - res = MsiRecordSetStreamA(record, 1, customdll); - ok(res == ERROR_SUCCESS, "failed to add %s to stream: %u\n", customdll, res); - - res = run_query(hdb, record, "INSERT INTO `Binary` (`Name`, `Data`) VALUES ('custom.dll', ?)"); - ok(res == ERROR_SUCCESS, "failed to insert into Binary table: %u\n", res); - - res = MsiDatabaseCommit(hdb); - ok(res == ERROR_SUCCESS, "failed to commit database: %u\n", res); - - MsiCloseHandle(record); - MsiCloseHandle(hdb); -} - -static INT CALLBACK ok_callback(void *context, UINT message_type, MSIHANDLE record) -{ - if (message_type == INSTALLMESSAGE_USER) - { - char file[200]; - char msg[2000]; - DWORD len; - - len = sizeof(file); - MsiRecordGetStringA(record, 2, file, &len); - len = sizeof(msg); - MsiRecordGetStringA(record, 5, msg, &len); - - todo_wine_if(MsiRecordGetInteger(record, 1)) - ok_(file, MsiRecordGetInteger(record, 3)) (MsiRecordGetInteger(record, 4), "%s", msg); - - return 1; - } - return 0; -} - static void test_customaction1(void) { MSIHANDLE hdb, record; @@ -4135,7 +4134,6 @@ static void test_customaction1(void)
create_test_files(); create_database(msifile, ca1_tables, sizeof(ca1_tables) / sizeof(msi_table)); - add_custom_dll();
/* create a test table */ MsiOpenDatabaseW(msifileW, MSIDBOPEN_TRANSACT, &hdb); @@ -6106,7 +6104,6 @@ static void test_deferred_action(void) sprintf(buffer, "TESTPATH="%s"", file);
create_database(msifile, da_tables, sizeof(da_tables) / sizeof(da_tables[0])); - add_custom_dll();
MsiSetInternalUI(INSTALLUILEVEL_NONE, NULL);
@@ -6234,9 +6231,6 @@ START_TEST(install) lstrcatA(log_file, "\msitest.log"); MsiEnableLogA(INSTALLLOGMODE_FATALEXIT, log_file, 0);
- customdll = load_resource("custom.dll"); - MsiSetExternalUIRecord(ok_callback, INSTALLLOGMODE_USER, NULL, NULL); - if (pSRSetRestorePointA) /* test has side-effects on win2k3 that cause failures in following tests */ test_MsiInstallProduct(); test_MsiSetComponentState(); diff --git a/dlls/msi/tests/msi.c b/dlls/msi/tests/msi.c index 3778019..21a0358 100644 --- a/dlls/msi/tests/msi.c +++ b/dlls/msi/tests/msi.c @@ -14442,6 +14442,7 @@ START_TEST(msi) test_getcomponentpath(); test_MsiGetFileHash(); test_MsiSetInternalUI(); + test_MsiSetExternalUI();
if (!pConvertSidToStringSidA) win_skip("ConvertSidToStringSidA not implemented\n"); @@ -14474,7 +14475,6 @@ START_TEST(msi) test_MsiConfigureProductEx(); test_MsiSetFeatureAttributes(); test_MsiGetFeatureInfo(); - test_MsiSetExternalUI(); test_lastusedsource(); test_setpropertyfolder(); test_sourcedir_props();
Hi,
While running your changed tests on Windows, I think I found new failures. Being a bot and all I'm not very good at pattern recognition, so I might be wrong, but could you please double-check? Full results can be found at https://testbot.winehq.org/JobDetails.pl?Key=38358
Your paranoid android.
=== wxppro (32 bit install) === msi:install contains a misplaced failure message for custom
Signed-off-by: Hans Leidekker hans@codeweavers.com
Signed-off-by: Zebediah Figura z.figura12@gmail.com --- dlls/msi/tests/Makefile.in | 2 +- dlls/msi/tests/action.c | 14 ++++++++ dlls/msi/tests/custom.c | 87 ++++++++++++++++++++++++++++++++++++++++------ dlls/msi/tests/custom.spec | 2 ++ 4 files changed, 93 insertions(+), 12 deletions(-)
diff --git a/dlls/msi/tests/Makefile.in b/dlls/msi/tests/Makefile.in index 9c991d6..248439a 100644 --- a/dlls/msi/tests/Makefile.in +++ b/dlls/msi/tests/Makefile.in @@ -1,7 +1,7 @@ TESTDLL = msi.dll IMPORTS = cabinet msi shell32 ole32 oleaut32 user32 advapi32 version
-custom_IMPORTS = uuid msi ole32 +custom_IMPORTS = uuid msi ole32 shell32
SOURCES = \ action.c \ diff --git a/dlls/msi/tests/action.c b/dlls/msi/tests/action.c index 3b15d14..19159d5 100644 --- a/dlls/msi/tests/action.c +++ b/dlls/msi/tests/action.c @@ -596,7 +596,11 @@ static const char cf_install_exec_seq_dat[] = "FileCost\t\t900\n" "RemoveFiles\t\t3500\n" "CreateFolders\t\t3700\n" + "cf_immediate\tNOT REMOVE\t3701\n" + "cf_deferred\tNOT REMOVE\t3702\n" "RemoveFolders\t\t3800\n" + "rf_immediate\tREMOVE\t3801\n" + "rf_deferred\tREMOVE\t3802\n" "InstallFiles\t\t4000\n" "RegisterUser\t\t6000\n" "RegisterProduct\t\t6100\n" @@ -609,6 +613,15 @@ static const char cf_install_exec_seq_dat[] = "InstallValidate\t\t1400\n" "LaunchConditions\t\t100\n";
+static const char cf_custom_action_dat[] = + "Action\tType\tSource\tTarget\n" + "s72\ti2\tS64\tS0\n" + "CustomAction\tAction\n" + "cf_immediate\t1\tcustom.dll\tcf_absent\n" + "cf_deferred\t1025\tcustom.dll\tcf_present\n" + "rf_immediate\t1\tcustom.dll\tcf_present\n" + "rf_deferred\t1025\tcustom.dll\tcf_absent\n"; + static const char sr_selfreg_dat[] = "File_\tCost\n" "s72\tI2\n" @@ -1771,6 +1784,7 @@ static const msi_table cf_tables[] = ADD_TABLE(cf_file), ADD_TABLE(cf_create_folders), ADD_TABLE(cf_install_exec_seq), + ADD_TABLE(cf_custom_action), ADD_TABLE(media), ADD_TABLE(property) }; diff --git a/dlls/msi/tests/custom.c b/dlls/msi/tests/custom.c index ff1be9b..aeee98e 100644 --- a/dlls/msi/tests/custom.c +++ b/dlls/msi/tests/custom.c @@ -24,10 +24,13 @@ #include <windef.h> #include <winbase.h> #define COBJMACROS +#include <shlobj.h> #include <msxml.h> #include <msi.h> #include <msiquery.h>
+static int todo_level, todo_do_loop; + static void ok_(MSIHANDLE hinst, int todo, const char *file, int line, int condition, const char *msg, ...) { static char buffer[2000]; @@ -47,8 +50,30 @@ static void ok_(MSIHANDLE hinst, int todo, const char *file, int line, int condi MsiProcessMessage(hinst, INSTALLMESSAGE_USER, record); MsiCloseHandle(record); } -#define ok(hinst, condition, ...) ok_(hinst, 0, __FILE__, __LINE__, condition, __VA_ARGS__) -#define todo_wine_ok(hinst, condition, ...) ok_(hinst, 1, __FILE__, __LINE__, condition, __VA_ARGS__) + +static void winetest_start_todo( int is_todo ) +{ + todo_level = (todo_level << 1) | (is_todo != 0); + todo_do_loop=1; +} + +static int winetest_loop_todo(void) +{ + int do_loop=todo_do_loop; + todo_do_loop=0; + return do_loop; +} + +static void winetest_end_todo(void) +{ + todo_level >>= 1; +} + +#define ok(hinst, condition, ...) ok_(hinst, todo_level, __FILE__, __LINE__, condition, __VA_ARGS__) +#define todo_wine_if(is_todo) for (winetest_start_todo(is_todo); \ + winetest_loop_todo(); \ + winetest_end_todo()) +#define todo_wine todo_wine_if(1)
static const char *dbgstr_w(WCHAR *str) { @@ -886,7 +911,8 @@ static void test_costs(MSIHANDLE hinst) cost = 0xdead; r = MsiGetFeatureCostA(hinst, NULL, MSICOSTTREE_CHILDREN, INSTALLSTATE_LOCAL, &cost); ok(hinst, r == ERROR_INVALID_PARAMETER, "got %u\n", r); - todo_wine_ok(hinst, !cost, "got %d\n", cost); + todo_wine + ok(hinst, !cost, "got %d\n", cost);
r = MsiGetFeatureCostA(hinst, "One", MSICOSTTREE_CHILDREN, INSTALLSTATE_LOCAL, NULL); ok(hinst, r == RPC_X_NULL_REF_POINTER, "got %u\n", r); @@ -894,7 +920,8 @@ static void test_costs(MSIHANDLE hinst) cost = 0xdead; r = MsiGetFeatureCostA(hinst, "One", MSICOSTTREE_CHILDREN, INSTALLSTATE_LOCAL, &cost); ok(hinst, !r, "got %u\n", r); - todo_wine_ok(hinst, cost == 8, "got %d\n", cost); + todo_wine + ok(hinst, cost == 8, "got %d\n", cost);
sz = cost = temp = 0xdead; r = MsiEnumComponentCostsA(hinst, "One", 0, INSTALLSTATE_LOCAL, NULL, &sz, &cost, &temp); @@ -946,7 +973,8 @@ static void test_costs(MSIHANDLE hinst) r = MsiEnumComponentCostsA(hinst, "One", 0, INSTALLSTATE_LOCAL, buffer, &sz, &cost, &temp); ok(hinst, r == ERROR_MORE_DATA, "got %u\n", r); ok(hinst, !strcmp(buffer, "q"), "got "%s"\n", buffer); - todo_wine_ok(hinst, sz == 4, "got size %u\n", sz); + todo_wine + ok(hinst, sz == 4, "got size %u\n", sz); ok(hinst, cost == 8, "got cost %d\n", cost); ok(hinst, !temp, "got temp %d\n", temp);
@@ -954,15 +982,19 @@ static void test_costs(MSIHANDLE hinst) strcpy(buffer,"x"); r = MsiEnumComponentCostsA(hinst, "One", 0, INSTALLSTATE_LOCAL, buffer, &sz, &cost, &temp); ok(hinst, r == ERROR_MORE_DATA, "got %u\n", r); - todo_wine_ok(hinst, !buffer[0], "got "%s"\n", buffer); - todo_wine_ok(hinst, sz == 4, "got size %u\n", sz); + todo_wine { + ok(hinst, !buffer[0], "got "%s"\n", buffer); + ok(hinst, sz == 4, "got size %u\n", sz); + }
sz = 2; strcpy(buffer,"x"); r = MsiEnumComponentCostsA(hinst, "One", 0, INSTALLSTATE_LOCAL, buffer, &sz, &cost, &temp); ok(hinst, r == ERROR_MORE_DATA, "got %u\n", r); - todo_wine_ok(hinst, !strcmp(buffer, "C"), "got "%s"\n", buffer); - todo_wine_ok(hinst, sz == 4, "got size %u\n", sz); + todo_wine { + ok(hinst, !strcmp(buffer, "C"), "got "%s"\n", buffer); + ok(hinst, sz == 4, "got size %u\n", sz); + }
sz = 3; strcpy(buffer,"x"); @@ -1021,7 +1053,8 @@ UINT WINAPI main_test(MSIHANDLE hinst)
/* Test MsiGetDatabaseState() */ res = MsiGetDatabaseState(hinst); - todo_wine_ok(hinst, res == MSIDBSTATE_ERROR, "expected MSIDBSTATE_ERROR, got %u\n", res); + todo_wine + ok(hinst, res == MSIDBSTATE_ERROR, "expected MSIDBSTATE_ERROR, got %u\n", res);
test_props(hinst); test_db(hinst); @@ -1101,7 +1134,8 @@ UINT WINAPI da_deferred(MSIHANDLE hinst) len = sizeof(prop); r = MsiGetPropertyA(hinst, "TESTPATH", prop, &len); ok(hinst, r == ERROR_SUCCESS, "got %u\n", r); - todo_wine_ok(hinst, !prop[0], "got %s\n", prop); + todo_wine + ok(hinst, !prop[0], "got %s\n", prop);
/* Test modes */ ok(hinst, MsiGetMode(hinst, MSIRUNMODE_SCHEDULED), "should be scheduled\n"); @@ -1113,3 +1147,34 @@ UINT WINAPI da_deferred(MSIHANDLE hinst)
return ERROR_SUCCESS; } + +static BOOL pf_exists(const char *file) +{ + char path[MAX_PATH]; + + if (FAILED(SHGetFolderPathA(NULL, CSIDL_PROGRAM_FILESX86, NULL, 0, path))) + SHGetFolderPathA(NULL, CSIDL_PROGRAM_FILES, NULL, 0, path); + strcat(path, "\"); + strcat(path, file); + return GetFileAttributesA(path) != INVALID_FILE_ATTRIBUTES; +} + +UINT WINAPI cf_present(MSIHANDLE hinst) +{ +todo_wine_if(!MsiGetMode(hinst, MSIRUNMODE_SCHEDULED)) { + ok(hinst, pf_exists("msitest\first"), "folder absent\n"); + ok(hinst, pf_exists("msitest\second"), "folder absent\n"); + ok(hinst, pf_exists("msitest\third"), "folder absent\n"); +} + return ERROR_SUCCESS; +} + +UINT WINAPI cf_absent(MSIHANDLE hinst) +{ +todo_wine_if(!MsiGetMode(hinst, MSIRUNMODE_SCHEDULED)) { + ok(hinst, !pf_exists("msitest\first"), "folder present\n"); + ok(hinst, !pf_exists("msitest\second"), "folder present\n"); + ok(hinst, !pf_exists("msitest\third"), "folder present\n"); +} + return ERROR_SUCCESS; +} diff --git a/dlls/msi/tests/custom.spec b/dlls/msi/tests/custom.spec index 51bb60e..cac0f85 100644 --- a/dlls/msi/tests/custom.spec +++ b/dlls/msi/tests/custom.spec @@ -3,3 +3,5 @@ @ stdcall da_immediate(long) @ stdcall da_deferred(long) @ stdcall nested(long) +@ stdcall cf_present(long) +@ stdcall cf_absent(long)
Hi,
While running your changed tests on Windows, I think I found new failures. Being a bot and all I'm not very good at pattern recognition, so I might be wrong, but could you please double-check? Full results can be found at https://testbot.winehq.org/JobDetails.pl?Key=38359
Your paranoid android.
=== build (build) === Make failed
On Mon, 2018-05-14 at 00:29 -0500, Zebediah Figura wrote:
diff --git a/dlls/msi/tests/custom.c b/dlls/msi/tests/custom.c index ff1be9b..aeee98e 100644 --- a/dlls/msi/tests/custom.c +++ b/dlls/msi/tests/custom.c @@ -24,10 +24,13 @@ #include <windef.h> #include <winbase.h> #define COBJMACROS +#include <shlobj.h> #include <msxml.h> #include <msi.h> #include <msiquery.h>
+static int todo_level, todo_do_loop;
static void ok_(MSIHANDLE hinst, int todo, const char *file, int line, int condition, const char *msg, ...) { static char buffer[2000]; @@ -47,8 +50,30 @@ static void ok_(MSIHANDLE hinst, int todo, const char *file, int line, int condi MsiProcessMessage(hinst, INSTALLMESSAGE_USER, record); MsiCloseHandle(record); } -#define ok(hinst, condition, ...) ok_(hinst, 0, __FILE__, __LINE__, condition, __VA_ARGS__) -#define todo_wine_ok(hinst, condition, ...) ok_(hinst, 1, __FILE__, __LINE__, condition, __VA_ARGS__)
+static void winetest_start_todo( int is_todo ) +{
- todo_level = (todo_level << 1) | (is_todo != 0);
- todo_do_loop=1;
+}
+static int winetest_loop_todo(void) +{
- int do_loop=todo_do_loop;
- todo_do_loop=0;
- return do_loop;
+}
+static void winetest_end_todo(void) +{
- todo_level >>= 1;
+}
+#define ok(hinst, condition, ...) ok_(hinst, todo_level, __FILE__, __LINE__, condition, __VA_ARGS__) +#define todo_wine_if(is_todo) for (winetest_start_todo(is_todo); \
winetest_loop_todo(); \
winetest_end_todo())
+#define todo_wine todo_wine_if(1)
static const char *dbgstr_w(WCHAR *str) { @@ -886,7 +911,8 @@ static void test_costs(MSIHANDLE hinst) cost = 0xdead; r = MsiGetFeatureCostA(hinst, NULL, MSICOSTTREE_CHILDREN, INSTALLSTATE_LOCAL, &cost); ok(hinst, r == ERROR_INVALID_PARAMETER, "got %u\n", r);
- todo_wine_ok(hinst, !cost, "got %d\n", cost);
todo_wine
ok(hinst, !cost, "got %d\n", cost);
r = MsiGetFeatureCostA(hinst, "One", MSICOSTTREE_CHILDREN, INSTALLSTATE_LOCAL, NULL); ok(hinst, r == RPC_X_NULL_REF_POINTER, "got %u\n", r);
@@ -894,7 +920,8 @@ static void test_costs(MSIHANDLE hinst) cost = 0xdead; r = MsiGetFeatureCostA(hinst, "One", MSICOSTTREE_CHILDREN, INSTALLSTATE_LOCAL, &cost); ok(hinst, !r, "got %u\n", r);
- todo_wine_ok(hinst, cost == 8, "got %d\n", cost);
todo_wine
ok(hinst, cost == 8, "got %d\n", cost);
sz = cost = temp = 0xdead; r = MsiEnumComponentCostsA(hinst, "One", 0, INSTALLSTATE_LOCAL, NULL, &sz, &cost, &temp);
@@ -946,7 +973,8 @@ static void test_costs(MSIHANDLE hinst) r = MsiEnumComponentCostsA(hinst, "One", 0, INSTALLSTATE_LOCAL, buffer, &sz, &cost, &temp); ok(hinst, r == ERROR_MORE_DATA, "got %u\n", r); ok(hinst, !strcmp(buffer, "q"), "got "%s"\n", buffer);
- todo_wine_ok(hinst, sz == 4, "got size %u\n", sz);
- todo_wine
- ok(hinst, sz == 4, "got size %u\n", sz); ok(hinst, cost == 8, "got cost %d\n", cost); ok(hinst, !temp, "got temp %d\n", temp);
@@ -954,15 +982,19 @@ static void test_costs(MSIHANDLE hinst) strcpy(buffer,"x"); r = MsiEnumComponentCostsA(hinst, "One", 0, INSTALLSTATE_LOCAL, buffer, &sz, &cost, &temp); ok(hinst, r == ERROR_MORE_DATA, "got %u\n", r);
- todo_wine_ok(hinst, !buffer[0], "got "%s"\n", buffer);
- todo_wine_ok(hinst, sz == 4, "got size %u\n", sz);
todo_wine {
ok(hinst, !buffer[0], "got "%s"\n", buffer);
ok(hinst, sz == 4, "got size %u\n", sz);
}
sz = 2; strcpy(buffer,"x"); r = MsiEnumComponentCostsA(hinst, "One", 0, INSTALLSTATE_LOCAL, buffer, &sz, &cost, &temp); ok(hinst, r == ERROR_MORE_DATA, "got %u\n", r);
- todo_wine_ok(hinst, !strcmp(buffer, "C"), "got "%s"\n", buffer);
- todo_wine_ok(hinst, sz == 4, "got size %u\n", sz);
todo_wine {
ok(hinst, !strcmp(buffer, "C"), "got "%s"\n", buffer);
ok(hinst, sz == 4, "got size %u\n", sz);
}
sz = 3; strcpy(buffer,"x");
@@ -1021,7 +1053,8 @@ UINT WINAPI main_test(MSIHANDLE hinst)
/* Test MsiGetDatabaseState() */ res = MsiGetDatabaseState(hinst);
- todo_wine_ok(hinst, res == MSIDBSTATE_ERROR, "expected MSIDBSTATE_ERROR, got %u\n", res);
todo_wine
ok(hinst, res == MSIDBSTATE_ERROR, "expected MSIDBSTATE_ERROR, got %u\n", res);
test_props(hinst); test_db(hinst);
@@ -1101,7 +1134,8 @@ UINT WINAPI da_deferred(MSIHANDLE hinst) len = sizeof(prop); r = MsiGetPropertyA(hinst, "TESTPATH", prop, &len); ok(hinst, r == ERROR_SUCCESS, "got %u\n", r);
- todo_wine_ok(hinst, !prop[0], "got %s\n", prop);
todo_wine
ok(hinst, !prop[0], "got %s\n", prop);
/* Test modes */ ok(hinst, MsiGetMode(hinst, MSIRUNMODE_SCHEDULED), "should be scheduled\n");
@@ -1113,3 +1147,34 @@ UINT WINAPI da_deferred(MSIHANDLE hinst)
return ERROR_SUCCESS;
}
+static BOOL pf_exists(const char *file) +{
- char path[MAX_PATH];
- if (FAILED(SHGetFolderPathA(NULL, CSIDL_PROGRAM_FILESX86, NULL, 0, path)))
SHGetFolderPathA(NULL, CSIDL_PROGRAM_FILES, NULL, 0, path);
- strcat(path, "\");
- strcat(path, file);
- return GetFileAttributesA(path) != INVALID_FILE_ATTRIBUTES;
+}
This fails to build:
custom.c: In function ‘test_props’: custom.c:196:5: warning: implicit declaration of function ‘todo_wine_ok’ [-Wimplicit-function-declaration] todo_wine_ok(hinst, sz == 6, "got size %u\n", sz);
On 14/05/18 03:56, Hans Leidekker wrote:
This fails to build:
custom.c: In function ‘test_props’: custom.c:196:5: warning: implicit declaration of function ‘todo_wine_ok’ [-Wimplicit-function-declaration] todo_wine_ok(hinst, sz == 6, "got size %u\n", sz);
Whoops, I forgot I had these on some other patches. I'll send those in first.
Signed-off-by: Zebediah Figura z.figura12@gmail.com --- dlls/msi/tests/action.c | 14 ++++++++++++++ dlls/msi/tests/custom.c | 14 ++++++++++++++ dlls/msi/tests/custom.spec | 2 ++ 3 files changed, 30 insertions(+)
diff --git a/dlls/msi/tests/action.c b/dlls/msi/tests/action.c index 19159d5..78a21b7 100644 --- a/dlls/msi/tests/action.c +++ b/dlls/msi/tests/action.c @@ -917,12 +917,25 @@ static const char crs_install_exec_seq_dat[] = "RemoveFiles\t\t1700\n" "InstallFiles\t\t2000\n" "RemoveShortcuts\t\t3000\n" + "rs_immediate\tREMOVE\t3001\n" + "rs_deferred\tREMOVE\t3002\n" "CreateShortcuts\t\t3100\n" + "cs_immediate\tNOT REMOVE\t3101\n" + "cs_deferred\tNOT REMOVE\t3102\n" "RegisterProduct\t\t5000\n" "PublishFeatures\t\t5100\n" "PublishProduct\t\t5200\n" "InstallFinalize\t\t6000\n";
+static const char crs_custom_action_dat[] = + "Action\tType\tSource\tTarget\n" + "s72\ti2\tS64\tS0\n" + "CustomAction\tAction\n" + "cs_immediate\t1\tcustom.dll\tcrs_absent\n" + "cs_deferred\t1025\tcustom.dll\tcrs_present\n" + "rs_immediate\t1\tcustom.dll\tcrs_present\n" + "rs_deferred\t1025\tcustom.dll\tcrs_absent\n"; + static const char pub_file_dat[] = "File\tComponent_\tFileName\tFileSize\tVersion\tLanguage\tAttributes\tSequence\n" "s72\ts72\tl255\ti4\tS72\tS20\tI2\ti2\n" @@ -1905,6 +1918,7 @@ static const msi_table crs_tables[] = ADD_TABLE(crs_file), ADD_TABLE(crs_shortcut), ADD_TABLE(crs_install_exec_seq), + ADD_TABLE(crs_custom_action), ADD_TABLE(media), ADD_TABLE(property) }; diff --git a/dlls/msi/tests/custom.c b/dlls/msi/tests/custom.c index aeee98e..db6d612 100644 --- a/dlls/msi/tests/custom.c +++ b/dlls/msi/tests/custom.c @@ -1178,3 +1178,17 @@ todo_wine_if(!MsiGetMode(hinst, MSIRUNMODE_SCHEDULED)) { } return ERROR_SUCCESS; } + +UINT WINAPI crs_present(MSIHANDLE hinst) +{ +todo_wine_if(!MsiGetMode(hinst, MSIRUNMODE_SCHEDULED)) + ok(hinst, pf_exists("msitest\shortcut.lnk"), "shortcut absent\n"); + return ERROR_SUCCESS; +} + +UINT WINAPI crs_absent(MSIHANDLE hinst) +{ +todo_wine_if(!MsiGetMode(hinst, MSIRUNMODE_SCHEDULED)) + ok(hinst, !pf_exists("msitest\shortcut.lnk"), "shortcut present\n"); + return ERROR_SUCCESS; +} diff --git a/dlls/msi/tests/custom.spec b/dlls/msi/tests/custom.spec index cac0f85..774f77b 100644 --- a/dlls/msi/tests/custom.spec +++ b/dlls/msi/tests/custom.spec @@ -5,3 +5,5 @@ @ stdcall nested(long) @ stdcall cf_present(long) @ stdcall cf_absent(long) +@ stdcall crs_present(long) +@ stdcall crs_absent(long)
Hi,
While running your changed tests on Windows, I think I found new failures. Being a bot and all I'm not very good at pattern recognition, so I might be wrong, but could you please double-check? Full results can be found at https://testbot.winehq.org/JobDetails.pl?Key=38360
Your paranoid android.
=== build (build) === Make failed
Hi,
While running your changed tests on Windows, I think I found new failures. Being a bot and all I'm not very good at pattern recognition, so I might be wrong, but could you please double-check? Full results can be found at https://testbot.winehq.org/JobDetails.pl?Key=38356
Your paranoid android.
=== wxppro (32 bit install) === msi:install contains a misplaced failure message for custom
=== w7u (32 bit install) === The task timed out
=== w7u (32 bit msi) === The task timed out
=== w7u (32 bit action) === The task timed out
=== w7pro64 (32 bit custom) === The previous 1 run(s) terminated abnormally
=== w7pro64 (64 bit custom) === The previous 1 run(s) terminated abnormally