diff --git a/base/system/msiexec/msiexec.c b/base/system/msiexec/msiexec.c index 4fca26551316c..24c24792450e5 100644 --- a/base/system/msiexec/msiexec.c +++ b/base/system/msiexec/msiexec.c @@ -26,10 +26,9 @@ #include #include #include -#include #include "wine/debug.h" -#include "wine/heap.h" +#include "msiexec_internal.h" #include "initguid.h" DEFINE_GUID(GUID_NULL,0,0,0,0,0,0,0,0,0,0,0); @@ -40,6 +39,7 @@ typedef HRESULT (WINAPI *DLLREGISTERSERVER)(void); typedef HRESULT (WINAPI *DLLUNREGISTERSERVER)(void); DWORD DoService(void); +static BOOL silent; struct string_list { @@ -47,6 +47,21 @@ struct string_list WCHAR str[1]; }; +void report_error(const char* msg, ...) +{ + char buffer[2048]; + va_list va_args; + + va_start(va_args, msg); + vsnprintf(buffer, sizeof(buffer), msg, va_args); + va_end(va_args); + + if (silent) + MESSAGE("%s", buffer); + else + MsiMessageBoxA(NULL, buffer, "MsiExec", 0, GetUserDefaultLangID(), 0); +} + static void ShowUsage(int ExitCode) { WCHAR msiexec_version[40]; @@ -73,8 +88,8 @@ static void ShowUsage(int ExitCode) No typo: The LPWSTR parameter must be a LPWSTR * for this mode */ len = LoadStringW(hmsi, 10, (LPWSTR) &msi_res, 0); - msi_res = HeapAlloc(GetProcessHeap(), 0, (len + 1) * sizeof(WCHAR)); - msiexec_help = HeapAlloc(GetProcessHeap(), 0, (len + 1) * sizeof(WCHAR) + sizeof(msiexec_version)); + msi_res = malloc((len + 1) * sizeof(WCHAR)); + msiexec_help = malloc((len + 1) * sizeof(WCHAR) + sizeof(msiexec_version)); if (msi_res && msiexec_help) { *msi_res = 0; LoadStringW(hmsi, 10, msi_res, len + 1); @@ -82,8 +97,8 @@ static void ShowUsage(int ExitCode) swprintf(msiexec_help, len + 1 + ARRAY_SIZE(msiexec_version), msi_res, msiexec_version); MsiMessageBoxW(0, msiexec_help, NULL, 0, GetUserDefaultLangID(), 0); } - HeapFree(GetProcessHeap(), 0, msi_res); - HeapFree(GetProcessHeap(), 0, msiexec_help); + free(msi_res); + free(msiexec_help); ExitProcess(ExitCode); } @@ -101,7 +116,7 @@ static VOID StringListAppend(struct string_list **list, LPCWSTR str) { struct string_list *entry; - entry = HeapAlloc(GetProcessHeap(), 0, FIELD_OFFSET(struct string_list, str[lstrlenW(str) + 1])); + entry = malloc(FIELD_OFFSET(struct string_list, str[wcslen(str) + 1])); if(!entry) { WINE_ERR("Out of memory!\n"); @@ -134,7 +149,7 @@ static LPWSTR build_properties(struct string_list *property_list) for(list = property_list; list; list = list->next) len += lstrlenW(list->str) + 3; - ret = HeapAlloc( GetProcessHeap(), 0, len*sizeof(WCHAR) ); + ret = malloc(len * sizeof(WCHAR)); /* add a space before each string, and quote the value */ p = ret; @@ -178,7 +193,7 @@ static LPWSTR build_transforms(struct string_list *transform_list) for(list = transform_list; list; list = list->next) len += lstrlenW(list->str) + 1; - ret = HeapAlloc( GetProcessHeap(), 0, len*sizeof(WCHAR) ); + ret = malloc(len * sizeof(WCHAR)); /* add all the transforms with a semicolon between each one */ p = ret; @@ -218,10 +233,10 @@ static BOOL msi_strequal(LPCWSTR str1, LPCSTR str2) return FALSE; if( lstrlenW(str1) != (len-1) ) return FALSE; - strW = HeapAlloc(GetProcessHeap(), 0, sizeof(WCHAR)*len); + strW = malloc(sizeof(WCHAR) * len); MultiByteToWideChar( CP_ACP, 0, str2, -1, strW, len); ret = CompareStringW(GetThreadLocale(), NORM_IGNORECASE, str1, len, strW, len); - HeapFree(GetProcessHeap(), 0, strW); + free(strW); return (ret == CSTR_EQUAL); } @@ -246,10 +261,10 @@ static BOOL msi_strprefix(LPCWSTR str1, LPCSTR str2) return FALSE; if( lstrlenW(str1) < (len-1) ) return FALSE; - strW = HeapAlloc(GetProcessHeap(), 0, sizeof(WCHAR)*len); + strW = malloc(sizeof(WCHAR) * len); MultiByteToWideChar( CP_ACP, 0, str2, -1, strW, len); ret = CompareStringW(GetThreadLocale(), NORM_IGNORECASE, str1, len-1, strW, len-1); - HeapFree(GetProcessHeap(), 0, strW); + free(strW); return (ret == CSTR_EQUAL); } @@ -270,14 +285,14 @@ static VOID *LoadProc(LPCWSTR DllName, LPCSTR ProcName, HMODULE* DllHandle) *DllHandle = LoadLibraryExW(DllName, NULL, LOAD_WITH_ALTERED_SEARCH_PATH); if(!*DllHandle) { - fprintf(stderr, "Unable to load dll %s\n", wine_dbgstr_w(DllName)); + report_error("Unable to load dll %s\n", wine_dbgstr_w(DllName)); ExitProcess(1); } proc = (VOID *) GetProcAddress(*DllHandle, ProcName); if(!proc) { - fprintf(stderr, "Dll %s does not implement function %s\n", - wine_dbgstr_w(DllName), ProcName); + report_error("Dll %s does not implement function %s\n", + wine_dbgstr_w(DllName), ProcName); FreeLibrary(*DllHandle); ExitProcess(1); } @@ -296,10 +311,10 @@ static DWORD DoDllRegisterServer(LPCWSTR DllName) hr = pfDllRegisterServer(); if(FAILED(hr)) { - fprintf(stderr, "Failed to register dll %s\n", wine_dbgstr_w(DllName)); + report_error("Failed to register dll %s\n", wine_dbgstr_w(DllName)); return 1; } - printf("Successfully registered dll %s\n", wine_dbgstr_w(DllName)); + MESSAGE("Successfully registered dll %s\n", wine_dbgstr_w(DllName)); if(DllHandle) FreeLibrary(DllHandle); return 0; @@ -316,10 +331,10 @@ static DWORD DoDllUnregisterServer(LPCWSTR DllName) hr = pfDllUnregisterServer(); if(FAILED(hr)) { - fprintf(stderr, "Failed to unregister dll %s\n", wine_dbgstr_w(DllName)); + report_error("Failed to unregister dll %s\n", wine_dbgstr_w(DllName)); return 1; } - printf("Successfully unregistered dll %s\n", wine_dbgstr_w(DllName)); + MESSAGE("Successfully unregistered dll %s\n", wine_dbgstr_w(DllName)); if(DllHandle) FreeLibrary(DllHandle); return 0; @@ -333,7 +348,7 @@ static DWORD DoRegServer(void) if (!(scm = OpenSCManagerW(NULL, SERVICES_ACTIVE_DATABASEW, SC_MANAGER_CREATE_SERVICE))) { - fprintf(stderr, "Failed to open the service control manager.\n"); + report_error("Failed to open the service control manager.\n"); return 1; } len = GetSystemDirectoryW(path, MAX_PATH); @@ -346,7 +361,7 @@ static DWORD DoRegServer(void) } else if (GetLastError() != ERROR_SERVICE_EXISTS) { - fprintf(stderr, "Failed to create MSI service\n"); + report_error("Failed to create MSI service\n"); ret = 1; } CloseServiceHandle(scm); @@ -360,21 +375,21 @@ static DWORD DoUnregServer(void) if (!(scm = OpenSCManagerW(NULL, SERVICES_ACTIVE_DATABASEW, SC_MANAGER_CONNECT))) { - fprintf(stderr, "Failed to open service control manager\n"); + report_error("Failed to open service control manager\n"); return 1; } if ((service = OpenServiceW(scm, L"MSIServer", DELETE))) { if (!DeleteService(service)) { - fprintf(stderr, "Failed to delete MSI service\n"); + report_error("Failed to delete MSI service\n"); ret = 1; } CloseServiceHandle(service); } else if (GetLastError() != ERROR_SERVICE_DOES_NOT_EXIST) { - fprintf(stderr, "Failed to open MSI service\n"); + report_error("Failed to open MSI service\n"); ret = 1; } CloseServiceHandle(scm); @@ -388,7 +403,7 @@ static DWORD client_pid; static DWORD CALLBACK custom_action_thread(void *arg) { GUID guid = *(GUID *)arg; - heap_free(arg); + free(arg); return __wine_msi_call_dll_function(client_pid, &guid); } @@ -429,7 +444,7 @@ static int custom_action_server(const WCHAR *arg) return 0; } - thread_guid = heap_alloc(sizeof(GUID)); + thread_guid = malloc(sizeof(GUID)); memcpy(thread_guid, &guid, sizeof(GUID)); thread = CreateThread(NULL, 0, custom_action_thread, thread_guid, 0, NULL); @@ -533,13 +548,13 @@ static void process_args( WCHAR *cmdline, int *pargc, WCHAR ***pargv ) *pargv = NULL; count = chomp( cmdline, NULL ); - if (!(p = HeapAlloc( GetProcessHeap(), 0, (lstrlenW(cmdline) + count + 1) * sizeof(WCHAR) ))) + if (!(p = malloc( (wcslen(cmdline) + count + 1) * sizeof(WCHAR) ))) return; count = chomp( cmdline, p ); - if (!(argv = HeapAlloc( GetProcessHeap(), 0, (count + 1) * sizeof(WCHAR *) ))) + if (!(argv = malloc( (count + 1) * sizeof(WCHAR *) ))) { - HeapFree( GetProcessHeap(), 0, p ); + free( p ); return; } for (i = 0; i < count; i++) @@ -569,7 +584,7 @@ static BOOL process_args_from_reg( const WCHAR *ident, int *pargc, WCHAR ***parg if(r == ERROR_SUCCESS && type == REG_SZ) { int len = lstrlenW( *pargv[0] ); - if (!(buf = HeapAlloc( GetProcessHeap(), 0, sz + (len + 1) * sizeof(WCHAR) ))) + if (!(buf = malloc( (len + 1) * sizeof(WCHAR) ))) { RegCloseKey( hkey ); return FALSE; @@ -582,7 +597,7 @@ static BOOL process_args_from_reg( const WCHAR *ident, int *pargc, WCHAR ***parg process_args(buf, pargc, pargv); ret = TRUE; } - HeapFree(GetProcessHeap(), 0, buf); + free(buf); } RegCloseKey(hkey); return ret; @@ -594,7 +609,7 @@ static WCHAR *get_path_with_extension(const WCHAR *package_name) unsigned int p; WCHAR *path; - if (!(path = heap_alloc(lstrlenW(package_name) * sizeof(WCHAR) + sizeof(ext)))) + if (!(path = malloc(wcslen(package_name) * sizeof(WCHAR) + sizeof(ext)))) { WINE_ERR("No memory.\n"); return NULL; @@ -606,7 +621,7 @@ static WCHAR *get_path_with_extension(const WCHAR *package_name) --p; if (path[p] == '.') { - heap_free(path); + free(path); return NULL; } lstrcatW(path, ext); @@ -766,7 +781,7 @@ int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine RepairMode |= REINSTALLMODE_PACKAGE; break; default: - fprintf(stderr, "Unknown option \"%c\" in Repair mode\n", argvW[i][j]); + report_error("Unknown option \"%c\" in Repair mode\n", argvW[i][j]); break; } } @@ -816,7 +831,7 @@ int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine AdvertiseMode = ADVERTISEFLAGS_MACHINEASSIGN; break; default: - fprintf(stderr, "Unknown option \"%c\" in Advertise mode\n", argvW[i][j]); + report_error("Unknown option \"%c\" in Advertise mode\n", argvW[i][j]); break; } } @@ -948,8 +963,8 @@ int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine LogFileName = argvW[i]; if(MsiEnableLogW(LogMode, LogFileName, LogAttributes) != ERROR_SUCCESS) { - fprintf(stderr, "Logging in %s (0x%08x, %u) failed\n", - wine_dbgstr_w(LogFileName), LogMode, LogAttributes); + report_error("Logging in %s (0x%08lx, %lu) failed\n", + wine_dbgstr_w(LogFileName), LogMode, LogAttributes); ExitProcess(1); } } @@ -967,6 +982,7 @@ int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine if(lstrlenW(argvW[i]) == 2 || msi_strequal(argvW[i]+2, "n") || msi_strequal(argvW[i] + 2, "uiet")) { + silent = TRUE; InstallUILevel = INSTALLUILEVEL_NONE; } else if(msi_strequal(argvW[i]+2, "r")) @@ -1003,8 +1019,8 @@ int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine } else { - fprintf(stderr, "Unknown option \"%s\" for UI level\n", - wine_dbgstr_w(argvW[i]+2)); + report_error("Unknown option \"%s\" for UI level\n", + wine_dbgstr_w(argvW[i]+2)); } } else if(msi_option_equal(argvW[i], "passive")) @@ -1071,7 +1087,7 @@ int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine && (path = get_path_with_extension(PackageName))) { ReturnCode = MsiInstallProductW(path, Properties); - heap_free(path); + free(path); } } } @@ -1085,7 +1101,7 @@ int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine && (path = get_path_with_extension(PackageName))) { ReturnCode = MsiReinstallProductW(path, RepairMode); - heap_free(path); + free(path); } } } diff --git a/base/system/msiexec/msiexec_internal.h b/base/system/msiexec/msiexec_internal.h new file mode 100644 index 0000000000000..ac58c6baf94ac --- /dev/null +++ b/base/system/msiexec/msiexec_internal.h @@ -0,0 +1,25 @@ +/* + * msiexec.exe internal definitions + * + * Copyright 2023 Eric Pouech for CodeWeavers + * + * 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 + */ + +#ifdef __WINE_CRT_PRINTF_ATTR +extern void report_error(const char* msg, ...) __WINE_CRT_PRINTF_ATTR(1, 2); +#else +extern void report_error(const char* msg, ...); +#endif diff --git a/base/system/msiexec/service.c b/base/system/msiexec/service.c index d48912a8e5f43..ee81da1bfcd55 100644 --- a/base/system/msiexec/service.c +++ b/base/system/msiexec/service.c @@ -20,11 +20,11 @@ #define WIN32_LEAN_AND_MEAN -#include #include #include #include "wine/debug.h" +#include "msiexec_internal.h" WINE_DEFAULT_DEBUG_CHANNEL(msiexec); @@ -73,7 +73,7 @@ static BOOL UpdateSCMStatus(DWORD dwCurrentState, DWORD dwWin32ExitCode, if (!SetServiceStatus(hstatus, &status)) { - fprintf(stderr, "Failed to set service status\n"); + report_error("Failed to set service status\n"); KillService(); return FALSE; } @@ -83,7 +83,7 @@ static BOOL UpdateSCMStatus(DWORD dwCurrentState, DWORD dwWin32ExitCode, static void WINAPI ServiceCtrlHandler(DWORD code) { - WINE_TRACE("%u\n", code); + WINE_TRACE("%ld\n", code); switch (code) { @@ -93,7 +93,7 @@ static void WINAPI ServiceCtrlHandler(DWORD code) KillService(); break; default: - fprintf(stderr, "Unhandled service control code: %u\n", code); + report_error("Unhandled service control code: %ld\n", code); UpdateSCMStatus(SERVICE_RUNNING, NO_ERROR, 0); break; } @@ -113,7 +113,7 @@ static BOOL StartServiceThread(void) thread = CreateThread(0, 0, ServiceExecutionThread, 0, 0, &id); if (!thread) { - fprintf(stderr, "Failed to create thread\n"); + report_error("Failed to create thread\n"); return FALSE; } @@ -125,7 +125,7 @@ static void WINAPI ServiceMain(DWORD argc, LPSTR *argv) hstatus = RegisterServiceCtrlHandlerA("MSIServer", ServiceCtrlHandler); if (!hstatus) { - fprintf(stderr, "Failed to register service ctrl handler\n"); + report_error("Failed to register service ctrl handler\n"); return; } @@ -134,7 +134,7 @@ static void WINAPI ServiceMain(DWORD argc, LPSTR *argv) kill_event = CreateEventW(0, TRUE, FALSE, 0); if (!kill_event) { - fprintf(stderr, "Failed to create event\n"); + report_error("Failed to create event\n"); KillService(); UpdateSCMStatus(SERVICE_STOPPED, NO_ERROR, 0); return; @@ -166,7 +166,7 @@ DWORD DoService(void) if (!StartServiceCtrlDispatcherA(service)) { - fprintf(stderr, "Failed to start MSIServer service\n"); + report_error("Failed to start MSIServer service\n"); return 1; } diff --git a/dll/win32/msi/action.c b/dll/win32/msi/action.c index 403643fa5c81c..8548a537fe37c 100644 --- a/dll/win32/msi/action.c +++ b/dll/win32/msi/action.c @@ -76,8 +76,7 @@ static INT ui_actionstart(MSIPACKAGE *package, LPCWSTR action, LPCWSTR descripti return rc; } -static void ui_actioninfo(MSIPACKAGE *package, LPCWSTR action, BOOL start, - INT rc) +static void ui_actioninfo(MSIPACKAGE *package, const WCHAR *action, BOOL start, INT rc) { MSIRECORD *row; WCHAR *template; @@ -87,7 +86,7 @@ static void ui_actioninfo(MSIPACKAGE *package, LPCWSTR action, BOOL start, row = MSI_CreateRecord(2); if (!row) { - msi_free(template); + free(template); return; } MSI_RecordSetStringW(row, 0, template); @@ -95,7 +94,7 @@ static void ui_actioninfo(MSIPACKAGE *package, LPCWSTR action, BOOL start, MSI_RecordSetInteger(row, 2, start ? package->LastActionResult : rc); MSI_ProcessMessage(package, INSTALLMESSAGE_INFO, row); msiobj_release(&row->hdr); - msi_free(template); + free(template); if (!start) package->LastActionResult = rc; } @@ -237,7 +236,7 @@ UINT msi_parse_command_line( MSIPACKAGE *package, LPCWSTR szCommandLine, while (ptr[len - 1] == ' ') len--; - prop = msi_alloc( (len + 1) * sizeof(WCHAR) ); + prop = malloc( (len + 1) * sizeof(WCHAR) ); memcpy( prop, ptr, len * sizeof(WCHAR) ); prop[len] = 0; if (!preserve_case) wcsupr( prop ); @@ -246,13 +245,13 @@ UINT msi_parse_command_line( MSIPACKAGE *package, LPCWSTR szCommandLine, while (*ptr2 == ' ') ptr2++; num_quotes = 0; - val = msi_alloc( (lstrlenW( ptr2 ) + 1) * sizeof(WCHAR) ); + val = malloc( (wcslen( ptr2 ) + 1) * sizeof(WCHAR) ); len = parse_prop( ptr2, val, &num_quotes ); if (num_quotes % 2) { WARN("unbalanced quotes\n"); - msi_free( val ); - msi_free( prop ); + free( val ); + free( prop ); return ERROR_INVALID_COMMAND_LINE; } remove_quotes( val ); @@ -262,8 +261,8 @@ UINT msi_parse_command_line( MSIPACKAGE *package, LPCWSTR szCommandLine, if (r == ERROR_SUCCESS && !wcscmp( prop, L"SourceDir" )) msi_reset_source_folders( package ); - msi_free( val ); - msi_free( prop ); + free( val ); + free( prop ); ptr = ptr2 + len; } @@ -320,8 +319,7 @@ WCHAR **msi_split_string( const WCHAR *str, WCHAR sep ) } /* allocate space for an array of substring pointers and the substrings */ - ret = msi_alloc( (count+1) * sizeof (LPWSTR) + - (lstrlenW(str)+1) * sizeof(WCHAR) ); + ret = malloc( (count + 1) * sizeof(WCHAR *) + (wcslen(str) + 1) * sizeof(WCHAR) ); if (!ret) return ret; @@ -361,13 +359,13 @@ UINT msi_set_sourcedir_props(MSIPACKAGE *package, BOOL replace) if (!(p = wcsrchr( db, '\\' )) && !(p = wcsrchr( db, '/' ))) { - msi_free(db); + free(db); return ERROR_SUCCESS; } len = p - db + 2; - source = msi_alloc( len * sizeof(WCHAR) ); + source = malloc( len * sizeof(WCHAR) ); lstrcpynW( source, db, len ); - msi_free( db ); + free( db ); check = msi_dup_property( package->db, L"SourceDir" ); if (!check || replace) @@ -376,14 +374,14 @@ UINT msi_set_sourcedir_props(MSIPACKAGE *package, BOOL replace) if (r == ERROR_SUCCESS) msi_reset_source_folders( package ); } - msi_free( check ); + free( check ); check = msi_dup_property( package->db, L"SOURCEDIR" ); if (!check || replace) msi_set_property( package->db, L"SOURCEDIR", source, -1 ); - msi_free( check ); - msi_free( source ); + free( check ); + free( source ); return ERROR_SUCCESS; } @@ -781,7 +779,7 @@ static UINT load_component( MSIRECORD *row, LPVOID param ) MSIPACKAGE *package = param; MSICOMPONENT *comp; - comp = msi_alloc_zero( sizeof(MSICOMPONENT) ); + comp = calloc( 1, sizeof(MSICOMPONENT) ); if (!comp) return ERROR_FUNCTION_FAILED; @@ -823,16 +821,11 @@ UINT msi_load_all_components( MSIPACKAGE *package ) return r; } -typedef struct { - MSIPACKAGE *package; - MSIFEATURE *feature; -} _ilfs; - static UINT add_feature_component( MSIFEATURE *feature, MSICOMPONENT *comp ) { ComponentList *cl; - cl = msi_alloc( sizeof (*cl) ); + cl = malloc( sizeof(*cl) ); if ( !cl ) return ERROR_NOT_ENOUGH_MEMORY; cl->component = comp; @@ -845,7 +838,7 @@ static UINT add_feature_child( MSIFEATURE *parent, MSIFEATURE *child ) { FeatureList *fl; - fl = msi_alloc( sizeof(*fl) ); + fl = malloc( sizeof(*fl) ); if ( !fl ) return ERROR_NOT_ENOUGH_MEMORY; fl->feature = child; @@ -854,22 +847,28 @@ static UINT add_feature_child( MSIFEATURE *parent, MSIFEATURE *child ) return ERROR_SUCCESS; } +struct package_feature +{ + MSIPACKAGE *package; + MSIFEATURE *feature; +}; + static UINT iterate_load_featurecomponents(MSIRECORD *row, LPVOID param) { - _ilfs* ilfs = param; + struct package_feature *package_feature = param; LPCWSTR component; MSICOMPONENT *comp; component = MSI_RecordGetString(row,1); /* check to see if the component is already loaded */ - comp = msi_get_loaded_component( ilfs->package, component ); + comp = msi_get_loaded_component( package_feature->package, component ); if (!comp) { WARN("ignoring unknown component %s\n", debugstr_w(component)); return ERROR_SUCCESS; } - add_feature_component( ilfs->feature, comp ); + add_feature_component( package_feature->feature, comp ); comp->Enabled = TRUE; return ERROR_SUCCESS; @@ -880,12 +879,12 @@ static UINT load_feature(MSIRECORD *row, LPVOID param) MSIPACKAGE *package = param; MSIFEATURE *feature; MSIQUERY *view; - _ilfs ilfs; + struct package_feature package_feature; UINT rc; /* fill in the data */ - feature = msi_alloc_zero( sizeof (MSIFEATURE) ); + feature = calloc( 1, sizeof(MSIFEATURE) ); if (!feature) return ERROR_NOT_ENOUGH_MEMORY; @@ -920,10 +919,10 @@ static UINT load_feature(MSIRECORD *row, LPVOID param) if (rc != ERROR_SUCCESS) return ERROR_SUCCESS; - ilfs.package = package; - ilfs.feature = feature; + package_feature.package = package; + package_feature.feature = feature; - rc = MSI_IterateRecords(view, NULL, iterate_load_featurecomponents , &ilfs); + rc = MSI_IterateRecords(view, NULL, iterate_load_featurecomponents, &package_feature); msiobj_release(&view->hdr); return rc; } @@ -1037,7 +1036,7 @@ static UINT load_file(MSIRECORD *row, LPVOID param) /* fill in the data */ - file = msi_alloc_zero( sizeof (MSIFILE) ); + file = calloc( 1, sizeof(MSIFILE) ); if (!file) return ERROR_NOT_ENOUGH_MEMORY; @@ -1049,8 +1048,8 @@ static UINT load_file(MSIRECORD *row, LPVOID param) if (!file->Component) { WARN("Component not found: %s\n", debugstr_w(component)); - msi_free(file->File); - msi_free(file); + free(file->File); + free(file); return ERROR_SUCCESS; } @@ -1058,7 +1057,7 @@ static UINT load_file(MSIRECORD *row, LPVOID param) msi_reduce_to_long_filename( file->FileName ); file->ShortName = msi_dup_record_field( row, 3 ); - file->LongName = strdupW( folder_split_path(file->ShortName, '|')); + file->LongName = wcsdup( folder_split_path(file->ShortName, '|') ); file->FileSize = MSI_RecordGetInteger( row, 4 ); file->Version = msi_dup_record_field( row, 5 ); @@ -1159,7 +1158,7 @@ static UINT load_patch(MSIRECORD *row, LPVOID param) MSIFILEPATCH *patch; const WCHAR *file_key; - patch = msi_alloc_zero( sizeof (MSIFILEPATCH) ); + patch = calloc( 1, sizeof(MSIFILEPATCH) ); if (!patch) return ERROR_NOT_ENOUGH_MEMORY; @@ -1168,7 +1167,7 @@ static UINT load_patch(MSIRECORD *row, LPVOID param) if (!patch->File) { ERR("Failed to find target for patch in File table\n"); - msi_free(patch); + free(patch); return ERROR_FUNCTION_FAILED; } @@ -1280,7 +1279,7 @@ static UINT load_folder( MSIRECORD *row, LPVOID param ) LPWSTR p, tgt_short, tgt_long, src_short, src_long; MSIFOLDER *folder; - if (!(folder = msi_alloc_zero( sizeof(*folder) ))) return ERROR_NOT_ENOUGH_MEMORY; + if (!(folder = calloc( 1, sizeof(*folder) ))) return ERROR_NOT_ENOUGH_MEMORY; list_init( &folder->children ); folder->Directory = msi_dup_record_field( row, 1 ); folder->Parent = msi_dup_record_field( row, 2 ); @@ -1314,10 +1313,10 @@ static UINT load_folder( MSIRECORD *row, LPVOID param ) src_long = src_short; /* FIXME: use the target short path too */ - folder->TargetDefault = strdupW(tgt_long); - folder->SourceShortPath = strdupW(src_short); - folder->SourceLongPath = strdupW(src_long); - msi_free(p); + folder->TargetDefault = wcsdup(tgt_long); + folder->SourceShortPath = wcsdup(src_short); + folder->SourceLongPath = wcsdup(src_long); + free(p); TRACE("TargetDefault = %s\n",debugstr_w( folder->TargetDefault )); TRACE("SourceLong = %s\n", debugstr_w( folder->SourceLongPath )); @@ -1333,7 +1332,7 @@ static UINT add_folder_child( MSIFOLDER *parent, MSIFOLDER *child ) { FolderList *fl; - if (!(fl = msi_alloc( sizeof(*fl) ))) return ERROR_NOT_ENOUGH_MEMORY; + if (!(fl = malloc( sizeof(*fl) ))) return ERROR_NOT_ENOUGH_MEMORY; fl->folder = child; list_add_tail( &parent->children, &fl->entry ); return ERROR_SUCCESS; @@ -1562,7 +1561,7 @@ static BOOL process_state_property(MSIPACKAGE* package, int level, } } } - msi_free(override); + free(override); return TRUE; } @@ -1967,16 +1966,16 @@ static WCHAR *create_temp_dir( MSIDATABASE *db ) { GetTempPathW( MAX_PATH, tmp ); } - if (!(db->tempfolder = strdupW( tmp ))) return NULL; + if (!(db->tempfolder = wcsdup( tmp ))) return NULL; } - if ((ret = msi_alloc( (lstrlenW( db->tempfolder ) + 20) * sizeof(WCHAR) ))) + if ((ret = malloc( (wcslen( db->tempfolder ) + 20) * sizeof(WCHAR) ))) { for (;;) { if (!GetTempFileNameW( db->tempfolder, L"msi", ++id, ret )) { - msi_free( ret ); + free( ret ); return NULL; } if (CreateDirectoryW( ret, NULL )) break; @@ -2019,7 +2018,7 @@ WCHAR * WINAPIV msi_build_directory_name( DWORD count, ... ) } va_end( va ); - dir = msi_alloc( sz * sizeof(WCHAR) ); + dir = malloc( sz * sizeof(WCHAR) ); dir[0] = 0; va_start( va, count ); @@ -2041,7 +2040,7 @@ BOOL msi_is_global_assembly( MSICOMPONENT *comp ) static void set_target_path( MSIPACKAGE *package, MSIFILE *file ) { - msi_free( file->TargetPath ); + free( file->TargetPath ); if (msi_is_global_assembly( file->Component )) { MSIASSEMBLY *assembly = file->Component->assembly; @@ -2076,10 +2075,9 @@ static UINT calculate_file_cost( MSIPACKAGE *package ) set_target_path( package, file ); - if ((comp->assembly && !comp->assembly->installed) || - msi_get_file_attributes( package, file->TargetPath ) == INVALID_FILE_ATTRIBUTES) + if (msi_get_file_attributes( package, file->TargetPath ) == INVALID_FILE_ATTRIBUTES) { - comp->Cost += file->FileSize; + comp->cost += cost_from_size( file->FileSize ); continue; } file_size = msi_get_disk_file_size( package, file->TargetPath ); @@ -2091,24 +2089,24 @@ static UINT calculate_file_cost( MSIPACKAGE *package ) { if (msi_compare_file_versions( file_version, file->Version ) < 0) { - comp->Cost += file->FileSize - file_size; + comp->cost += cost_from_size( file->FileSize - file_size ); } - msi_free( file_version ); + free( file_version ); continue; } else if ((font_version = msi_get_font_file_version( package, file->TargetPath ))) { if (msi_compare_font_versions( font_version, file->Version ) < 0) { - comp->Cost += file->FileSize - file_size; + comp->cost += cost_from_size( file->FileSize - file_size ); } - msi_free( font_version ); + free( font_version ); continue; } } if (file_size != file->FileSize) { - comp->Cost += file->FileSize - file_size; + comp->cost += cost_from_size( file->FileSize - file_size ); } } @@ -2121,7 +2119,7 @@ WCHAR *msi_normalize_path( const WCHAR *in ) WCHAR *q, *ret; int n, len = lstrlenW( in ) + 2; - if (!(q = ret = msi_alloc( len * sizeof(WCHAR) ))) return NULL; + if (!(q = ret = malloc( len * sizeof(WCHAR) ))) return NULL; len = 0; while (1) @@ -2168,7 +2166,7 @@ static WCHAR *get_install_location( MSIPACKAGE *package ) if (MSIREG_OpenInstallProps( package->ProductCode, package->Context, NULL, &hkey, FALSE )) return NULL; if ((path = msi_reg_get_val_str( hkey, L"InstallLocation" )) && !path[0]) { - msi_free( path ); + free( path ); path = NULL; } RegCloseKey( hkey ); @@ -2206,9 +2204,9 @@ void msi_resolve_target_folder( MSIPACKAGE *package, const WCHAR *name, BOOL loa normalized_path = msi_normalize_path( path ); msi_set_property( package->db, folder->Directory, normalized_path, -1 ); - msi_free( path ); + free( path ); - msi_free( folder->ResolvedTarget ); + free( folder->ResolvedTarget ); folder->ResolvedTarget = normalized_path; LIST_FOR_EACH_ENTRY( fl, &folder->children, FolderList, entry ) @@ -2226,7 +2224,7 @@ static ULONGLONG get_volume_space_required( MSIPACKAGE *package ) LIST_FOR_EACH_ENTRY( comp, &package->components, MSICOMPONENT, entry ) { - if (comp->Action == INSTALLSTATE_LOCAL) ret += comp->Cost; + if (comp->Action == INSTALLSTATE_LOCAL) ret += comp->cost; } return ret; } @@ -2279,7 +2277,7 @@ static UINT ACTION_CostFinalize(MSIPACKAGE *package) /* set default run level if not set */ level = msi_dup_property( package->db, L"INSTALLLEVEL" ); if (!level) msi_set_property( package->db, L"INSTALLLEVEL", L"1", -1 ); - msi_free(level); + free(level); if ((rc = MSI_SetFeatureStates( package ))) return rc; @@ -2306,23 +2304,23 @@ static UINT ACTION_CostFinalize(MSIPACKAGE *package) } required = get_volume_space_required( package ); #ifdef __REACTOS__ - swprintf( buf, ARRAY_SIZE(buf), L"%I64u", required / 512 ); + swprintf( buf, ARRAY_SIZE(buf), L"%I64u", required ); #else - swprintf( buf, ARRAY_SIZE(buf), L"%lu", required / 512 ); + swprintf( buf, ARRAY_SIZE(buf), L"%lu", required ); #endif msi_set_property( package->db, L"PrimaryVolumeSpaceRequired", buf, -1 ); #ifdef __REACTOS__ - swprintf( buf, ARRAY_SIZE(buf), L"%I64u", (free.QuadPart - required) / 512 ); + swprintf( buf, ARRAY_SIZE(buf), L"%I64u", (free.QuadPart / 512) - required ); #else - swprintf( buf, ARRAY_SIZE(buf), L"%lu", (free.QuadPart - required) / 512 ); + swprintf( buf, ARRAY_SIZE(buf), L"%lu", (free.QuadPart / 512) - required ); #endif msi_set_property( package->db, L"PrimaryVolumeSpaceRemaining", buf, -1 ); msi_set_property( package->db, L"PrimaryVolumePath", primary_folder, 2 ); } - msi_free( primary_folder ); + free( primary_folder ); } - msi_free( primary_key ); + free( primary_key ); } /* FIXME: check volume disk space */ @@ -2340,7 +2338,7 @@ static BYTE *parse_value( MSIPACKAGE *package, const WCHAR *value, DWORD len, DW { *size = sizeof(WCHAR); *type = REG_SZ; - if ((data = msi_alloc( *size ))) *(WCHAR *)data = 0; + if ((data = malloc( *size ))) *(WCHAR *)data = 0; return data; } if (value[0]=='#' && value[1]!='#' && value[1]!='%') @@ -2362,7 +2360,7 @@ static BYTE *parse_value( MSIPACKAGE *package, const WCHAR *value, DWORD len, DW else *size = lstrlenW(ptr)/2; - data = msi_alloc(*size); + data = malloc(*size); byte[0] = '0'; byte[1] = 'x'; @@ -2387,7 +2385,7 @@ static BYTE *parse_value( MSIPACKAGE *package, const WCHAR *value, DWORD len, DW data[count] = (BYTE)strtol(byte,NULL,0); count ++; } - msi_free(deformated); + free(deformated); TRACE( "data %lu bytes(%u)\n", *size, count ); } @@ -2400,7 +2398,7 @@ static BYTE *parse_value( MSIPACKAGE *package, const WCHAR *value, DWORD len, DW *type=REG_DWORD; *size = sizeof(DWORD); - data = msi_alloc(*size); + data = malloc(*size); p = deformated; if (*p == '-') p++; @@ -2417,7 +2415,7 @@ static BYTE *parse_value( MSIPACKAGE *package, const WCHAR *value, DWORD len, DW *(DWORD *)data = d; TRACE( "DWORD %lu\n", *(DWORD *)data); - msi_free(deformated); + free(deformated); } } else @@ -2499,7 +2497,7 @@ static HKEY open_key( const MSICOMPONENT *comp, HKEY root, const WCHAR *path, BO access |= get_registry_view( comp ); - if (!(subkey = strdupW( path ))) return NULL; + if (!(subkey = wcsdup( path ))) return NULL; p = subkey; if ((q = wcschr( p, '\\' ))) *q = 0; if (create) @@ -2509,7 +2507,7 @@ static HKEY open_key( const MSICOMPONENT *comp, HKEY root, const WCHAR *path, BO if (res) { TRACE( "failed to open key %s (%ld)\n", debugstr_w(subkey), res ); - msi_free( subkey ); + free( subkey ); return NULL; } if (q && q[1]) @@ -2518,7 +2516,7 @@ static HKEY open_key( const MSICOMPONENT *comp, HKEY root, const WCHAR *path, BO RegCloseKey( hkey ); } else ret = hkey; - msi_free( subkey ); + free( subkey ); return ret; } @@ -2540,14 +2538,14 @@ static WCHAR **split_multi_string_values( const WCHAR *str, DWORD len, DWORD *co p += lstrlenW( p ) + 1; (*count)++; } - if (!(ret = msi_alloc( *count * sizeof(WCHAR *) ))) return NULL; + if (!(ret = malloc( *count * sizeof(WCHAR *) ))) return NULL; p = str; while ((p - str) < len) { - if (!(ret[i] = strdupW( p ))) + if (!(ret[i] = wcsdup( p ))) { - for (; i >= 0; i--) msi_free( ret[i] ); - msi_free( ret ); + for (; i >= 0; i--) free( ret[i] ); + free( ret ); return NULL; } p += lstrlenW( p ) + 1; @@ -2566,7 +2564,7 @@ static WCHAR *flatten_multi_string_values( WCHAR **left, DWORD left_count, for (i = 0; i < left_count; i++) *size += (lstrlenW( left[i] ) + 1) * sizeof(WCHAR); for (i = 0; i < right_count; i++) *size += (lstrlenW( right[i] ) + 1) * sizeof(WCHAR); - if (!(ret = p = msi_alloc( *size ))) return NULL; + if (!(ret = p = malloc( *size ))) return NULL; for (i = 0; i < left_count; i++) { @@ -2594,7 +2592,7 @@ static DWORD remove_duplicate_values( WCHAR **old, DWORD old_count, { if (old[j] && !wcscmp( new[i], old[j] )) { - msi_free( old[j] ); + free( old[j] ); for (k = j; k < old_count - 1; k++) { old[k] = old[k + 1]; } old[k] = NULL; ret--; @@ -2673,10 +2671,10 @@ static BYTE *build_multi_string_value( BYTE *old_value, DWORD old_size, old = split_multi_string_values( old_ptr, old_len, &old_count ); } ret = (BYTE *)join_multi_string_values( op, old, old_count, new, new_count, size ); - for (i = 0; i < old_count; i++) msi_free( old[i] ); - for (i = 0; i < new_count; i++) msi_free( new[i] ); - msi_free( old ); - msi_free( new ); + for (i = 0; i < old_count; i++) free( old[i] ); + for (i = 0; i < new_count; i++) free( new[i] ); + free( old ); + free( new ); return ret; } @@ -2684,7 +2682,7 @@ static BYTE *reg_get_value( HKEY hkey, const WCHAR *name, DWORD *type, DWORD *si { BYTE *ret; if (RegQueryValueExW( hkey, name, NULL, NULL, NULL, size )) return NULL; - if (!(ret = msi_alloc( *size ))) return NULL; + if (!(ret = malloc( *size ))) return NULL; RegQueryValueExW( hkey, name, NULL, type, ret, size ); return ret; } @@ -2735,23 +2733,23 @@ static UINT ITERATE_WriteRegistryValues(MSIRECORD *row, LPVOID param) return ERROR_SUCCESS; deformat_string(package, key , &deformated); - uikey = msi_alloc( (lstrlenW(deformated) + lstrlenW(szRoot) + 1) * sizeof(WCHAR) ); + uikey = malloc( (wcslen(deformated) + wcslen(szRoot) + 1) * sizeof(WCHAR) ); lstrcpyW(uikey,szRoot); lstrcatW(uikey,deformated); if (!(hkey = open_key( comp, root_key, deformated, TRUE, KEY_QUERY_VALUE | KEY_SET_VALUE ))) { ERR("Could not create key %s\n", debugstr_w(deformated)); - msi_free(uikey); - msi_free(deformated); + free(uikey); + free(deformated); return ERROR_FUNCTION_FAILED; } - msi_free( deformated ); + free( deformated ); str = msi_record_get_string( row, 5, NULL ); len = deformat_string( package, str, &deformated ); new_value = parse_value( package, deformated, len, &type, &new_size ); - msi_free( deformated ); + free( deformated ); deformat_string(package, name, &deformated); if (!is_special_entry( name )) @@ -2762,12 +2760,12 @@ static UINT ITERATE_WriteRegistryValues(MSIRECORD *row, LPVOID param) BYTE *new; if (old_value && old_type != REG_MULTI_SZ) { - msi_free( old_value ); + free( old_value ); old_value = NULL; old_size = 0; } new = build_multi_string_value( old_value, old_size, new_value, new_size, &new_size ); - msi_free( new_value ); + free( new_value ); new_value = new; } if (!check_first) @@ -2795,10 +2793,10 @@ static UINT ITERATE_WriteRegistryValues(MSIRECORD *row, LPVOID param) MSI_ProcessMessage(package, INSTALLMESSAGE_ACTIONDATA, uirow); msiobj_release( &uirow->hdr ); - msi_free(new_value); - msi_free(old_value); - msi_free(deformated); - msi_free(uikey); + free(new_value); + free(old_value); + free(deformated); + free(uikey); return ERROR_SUCCESS; } @@ -2842,7 +2840,7 @@ static void delete_key( const MSICOMPONENT *comp, HKEY root, const WCHAR *path ) WCHAR *subkey, *p; HKEY hkey; - if (!(subkey = strdupW( path ))) return; + if (!(subkey = wcsdup( path ))) return; do { if ((p = wcsrchr( subkey, '\\' ))) @@ -2867,7 +2865,7 @@ static void delete_key( const MSICOMPONENT *comp, HKEY root, const WCHAR *path ) break; } } while (p); - msi_free( subkey ); + free( subkey ); } static void delete_value( const MSICOMPONENT *comp, HKEY root, const WCHAR *path, const WCHAR *value ) @@ -2948,7 +2946,7 @@ static UINT ITERATE_RemoveRegistryValuesOnUninstall( MSIRECORD *row, LPVOID para deformat_string( package, key_str, &deformated_key ); size = lstrlenW( deformated_key ) + lstrlenW( root_key_str ) + 1; - ui_key_str = msi_alloc( size * sizeof(WCHAR) ); + ui_key_str = malloc( size * sizeof(WCHAR) ); lstrcpyW( ui_key_str, root_key_str ); lstrcatW( ui_key_str, deformated_key ); @@ -2956,7 +2954,7 @@ static UINT ITERATE_RemoveRegistryValuesOnUninstall( MSIRECORD *row, LPVOID para if (delete_key) delete_tree( comp, hkey_root, deformated_key ); else delete_value( comp, hkey_root, deformated_key, deformated_name ); - msi_free( deformated_key ); + free( deformated_key ); uirow = MSI_CreateRecord( 2 ); MSI_RecordSetStringW( uirow, 1, ui_key_str ); @@ -2964,8 +2962,8 @@ static UINT ITERATE_RemoveRegistryValuesOnUninstall( MSIRECORD *row, LPVOID para MSI_ProcessMessage(package, INSTALLMESSAGE_ACTIONDATA, uirow); msiobj_release( &uirow->hdr ); - msi_free( ui_key_str ); - msi_free( deformated_name ); + free( ui_key_str ); + free( deformated_name ); return ERROR_SUCCESS; } @@ -3011,7 +3009,7 @@ static UINT ITERATE_RemoveRegistryValuesOnInstall( MSIRECORD *row, LPVOID param deformat_string( package, key_str, &deformated_key ); size = lstrlenW( deformated_key ) + lstrlenW( root_key_str ) + 1; - ui_key_str = msi_alloc( size * sizeof(WCHAR) ); + ui_key_str = malloc( size * sizeof(WCHAR) ); lstrcpyW( ui_key_str, root_key_str ); lstrcatW( ui_key_str, deformated_key ); @@ -3019,7 +3017,7 @@ static UINT ITERATE_RemoveRegistryValuesOnInstall( MSIRECORD *row, LPVOID param if (delete_key) delete_tree( comp, hkey_root, deformated_key ); else delete_value( comp, hkey_root, deformated_key, deformated_name ); - msi_free( deformated_key ); + free( deformated_key ); uirow = MSI_CreateRecord( 2 ); MSI_RecordSetStringW( uirow, 1, ui_key_str ); @@ -3027,8 +3025,8 @@ static UINT ITERATE_RemoveRegistryValuesOnInstall( MSIRECORD *row, LPVOID param MSI_ProcessMessage(package, INSTALLMESSAGE_ACTIONDATA, uirow); msiobj_release( &uirow->hdr ); - msi_free( ui_key_str ); - msi_free( deformated_name ); + free( ui_key_str ); + free( deformated_name ); return ERROR_SUCCESS; } @@ -3118,7 +3116,7 @@ static UINT ITERATE_LaunchConditions(MSIRECORD *row, LPVOID param) message = MSI_RecordGetString(row, 2); deformat_string(package, message, &deformated); MessageBoxW(NULL, deformated, L"Install Failed", MB_OK); - msi_free(deformated); + free(deformated); } return ERROR_INSTALL_FAILURE; @@ -3147,7 +3145,7 @@ static LPWSTR resolve_keypath( MSIPACKAGE* package, MSICOMPONENT *cmp ) { if (!cmp->KeyPath) - return strdupW( msi_get_target_folder( package, cmp->Directory ) ); + return wcsdup( msi_get_target_folder( package, cmp->Directory ) ); if (cmp->Attributes & msidbComponentAttributesRegistryKeyPath) { @@ -3170,15 +3168,15 @@ static LPWSTR resolve_keypath( MSIPACKAGE* package, MSICOMPONENT *cmp ) if (deformated_name) len+=lstrlenW(deformated_name); - buffer = msi_alloc( len *sizeof(WCHAR)); + buffer = malloc(len * sizeof(WCHAR)); if (deformated_name) swprintf(buffer, len, L"%02d:\\%s\\%s", root, deformated, deformated_name); else swprintf(buffer, len, L"%02d:\\%s\\", root, deformated); - msi_free(deformated); - msi_free(deformated_name); + free(deformated); + free(deformated_name); msiobj_release(&row->hdr); return buffer; @@ -3193,7 +3191,7 @@ static LPWSTR resolve_keypath( MSIPACKAGE* package, MSICOMPONENT *cmp ) MSIFILE *file = msi_get_loaded_file( package, cmp->KeyPath ); if (file) - return strdupW( file->TargetPath ); + return wcsdup( file->TargetPath ); } return NULL; } @@ -3298,7 +3296,7 @@ static WCHAR *build_full_keypath( MSIPACKAGE *package, MSICOMPONENT *comp ) if (comp->assembly) { DWORD len = lstrlenW( L"<\\" ) + lstrlenW( comp->assembly->display_name ); - WCHAR *keypath = msi_alloc( (len + 1) * sizeof(WCHAR) ); + WCHAR *keypath = malloc( (len + 1) * sizeof(WCHAR) ); if (keypath) { @@ -3336,7 +3334,7 @@ static UINT ACTION_ProcessComponents(MSIPACKAGE *package) continue; squash_guid( comp->ComponentId, squashed_cc ); - msi_free( comp->FullKeypath ); + free( comp->FullKeypath ); comp->FullKeypath = build_full_keypath( package, comp ); refcount_component( package, comp ); @@ -3391,7 +3389,7 @@ static UINT ACTION_ProcessComponents(MSIPACKAGE *package) sourcepath = msi_resolve_file_source(package, file); ptr = sourcepath + lstrlenW(base); lstrcpyW(ptr2, ptr); - msi_free(sourcepath); + free(sourcepath); msi_reg_set_val_str( hkey, squashed_pc, source ); } @@ -3439,19 +3437,19 @@ static UINT ACTION_ProcessComponents(MSIPACKAGE *package) return ERROR_SUCCESS; } -typedef struct { +struct typelib +{ CLSID clsid; LPWSTR source; - LPWSTR path; ITypeLib *ptLib; -} typelib_struct; +}; static BOOL CALLBACK Typelib_EnumResNameProc( HMODULE hModule, LPCWSTR lpszType, LPWSTR lpszName, LONG_PTR lParam) { TLIBATTR *attr; - typelib_struct *tl_struct = (typelib_struct*) lParam; + struct typelib *tl_struct = (struct typelib *)lParam; int sz; HRESULT res; @@ -3464,10 +3462,10 @@ static BOOL CALLBACK Typelib_EnumResNameProc( HMODULE hModule, LPCWSTR lpszType, sz = lstrlenW(tl_struct->source)+4; if ((INT_PTR)lpszName == 1) - tl_struct->path = strdupW(tl_struct->source); + tl_struct->path = wcsdup(tl_struct->source); else { - tl_struct->path = msi_alloc(sz * sizeof(WCHAR)); + tl_struct->path = malloc(sz * sizeof(WCHAR)); #ifdef __REACTOS__ swprintf(tl_struct->path, sz, L"%s\\%d", tl_struct->source, (WORD)(INT_PTR)lpszName); #else @@ -3479,7 +3477,7 @@ static BOOL CALLBACK Typelib_EnumResNameProc( HMODULE hModule, LPCWSTR lpszType, res = LoadTypeLib(tl_struct->path,&tl_struct->ptLib); if (FAILED(res)) { - msi_free(tl_struct->path); + free(tl_struct->path); tl_struct->path = NULL; return TRUE; @@ -3492,7 +3490,7 @@ static BOOL CALLBACK Typelib_EnumResNameProc( HMODULE hModule, LPCWSTR lpszType, return FALSE; } - msi_free(tl_struct->path); + free(tl_struct->path); tl_struct->path = NULL; ITypeLib_ReleaseTLibAttr(tl_struct->ptLib, attr); @@ -3501,7 +3499,7 @@ static BOOL CALLBACK Typelib_EnumResNameProc( HMODULE hModule, LPCWSTR lpszType, return TRUE; } -static HMODULE msi_load_library( MSIPACKAGE *package, const WCHAR *filename, DWORD flags ) +static HMODULE load_library( MSIPACKAGE *package, const WCHAR *filename, DWORD flags ) { HMODULE module; msi_disable_fs_redirection( package ); @@ -3510,7 +3508,7 @@ static HMODULE msi_load_library( MSIPACKAGE *package, const WCHAR *filename, DWO return module; } -static HRESULT msi_load_typelib( MSIPACKAGE *package, const WCHAR *filename, REGKIND kind, ITypeLib **lib ) +static HRESULT load_typelib( MSIPACKAGE *package, const WCHAR *filename, REGKIND kind, ITypeLib **lib ) { HRESULT hr; msi_disable_fs_redirection( package ); @@ -3525,7 +3523,7 @@ static UINT ITERATE_RegisterTypeLibraries(MSIRECORD *row, LPVOID param) LPCWSTR component; MSICOMPONENT *comp; MSIFILE *file; - typelib_struct tl_struct; + struct typelib tl_struct; ITypeLib *tlib; HMODULE module; HRESULT hr; @@ -3549,13 +3547,13 @@ static UINT ITERATE_RegisterTypeLibraries(MSIRECORD *row, LPVOID param) } MSI_ProcessMessage(package, INSTALLMESSAGE_ACTIONDATA, row); - module = msi_load_library( package, file->TargetPath, LOAD_LIBRARY_AS_DATAFILE ); + module = load_library( package, file->TargetPath, LOAD_LIBRARY_AS_DATAFILE ); if (module) { LPCWSTR guid; guid = MSI_RecordGetString(row,1); CLSIDFromString( guid, &tl_struct.clsid); - tl_struct.source = strdupW( file->TargetPath ); + tl_struct.source = wcsdup( file->TargetPath ); tl_struct.path = NULL; EnumResourceNamesW(module, L"TYPELIB", Typelib_EnumResNameProc, @@ -3577,16 +3575,16 @@ static UINT ITERATE_RegisterTypeLibraries(MSIRECORD *row, LPVOID param) TRACE("Registered %s\n", debugstr_w(tl_struct.path)); ITypeLib_Release(tl_struct.ptLib); - msi_free(tl_struct.path); + free(tl_struct.path); } else ERR("Failed to load type library %s\n", debugstr_w(tl_struct.source)); FreeLibrary(module); - msi_free(tl_struct.source); + free(tl_struct.source); } else { - hr = msi_load_typelib( package, file->TargetPath, REGKIND_REGISTER, &tlib ); + hr = load_typelib( package, file->TargetPath, REGKIND_REGISTER, &tlib ); if (FAILED(hr)) { ERR( "failed to load type library: %#lx\n", hr ); @@ -3680,7 +3678,7 @@ static UINT ACTION_UnregisterTypeLibraries( MSIPACKAGE *package ) static WCHAR *get_link_file( MSIPACKAGE *package, MSIRECORD *row ) { LPCWSTR directory, extension, link_folder; - LPWSTR link_file, filename; + WCHAR *link_file = NULL, *filename, *new_filename; directory = MSI_RecordGetString( row, 2 ); link_folder = msi_get_target_folder( package, directory ); @@ -3693,18 +3691,22 @@ static WCHAR *get_link_file( MSIPACKAGE *package, MSIRECORD *row ) msi_create_full_path( package, link_folder ); filename = msi_dup_record_field( row, 3 ); + if (!filename) return NULL; msi_reduce_to_long_filename( filename ); extension = wcsrchr( filename, '.' ); if (!extension || wcsicmp( extension, L".lnk" )) { int len = lstrlenW( filename ); - filename = msi_realloc( filename, len * sizeof(WCHAR) + sizeof(L".lnk") ); + new_filename = realloc( filename, len * sizeof(WCHAR) + sizeof(L".lnk") ); + if (!new_filename) goto done; + filename = new_filename; memcpy( filename + len, L".lnk", sizeof(L".lnk") ); } link_file = msi_build_directory_name( 2, link_folder, filename ); - msi_free( filename ); +done: + free( filename ); return link_file; } @@ -3718,13 +3720,13 @@ WCHAR *msi_build_icon_path( MSIPACKAGE *package, const WCHAR *icon_name ) { WCHAR *appdata = msi_dup_property( package->db, L"AppDataFolder" ); folder = msi_build_directory_name( 2, appdata, L"Microsoft\\" ); - msi_free( appdata ); + free( appdata ); } dest = msi_build_directory_name( 3, folder, L"Installer\\", package->ProductCode ); msi_create_full_path( package, dest ); path = msi_build_directory_name( 2, dest, icon_name ); - msi_free( folder ); - msi_free( dest ); + free( folder ); + free( dest ); return path; } @@ -3773,14 +3775,14 @@ static UINT ITERATE_CreateShortcuts(MSIRECORD *row, LPVOID param) deformat_string( package, target, &path ); TRACE("target path is %s\n", debugstr_w(path)); IShellLinkW_SetPath( sl, path ); - msi_free( path ); + free( path ); } else { FIXME("poorly handled shortcut format, advertised shortcut\n"); path = resolve_keypath( package, comp ); IShellLinkW_SetPath( sl, path ); - msi_free( path ); + free( path ); } if (!MSI_RecordIsNull(row,6)) @@ -3788,7 +3790,7 @@ static UINT ITERATE_CreateShortcuts(MSIRECORD *row, LPVOID param) LPCWSTR arguments = MSI_RecordGetString(row, 6); deformat_string(package, arguments, &deformated); IShellLinkW_SetArguments(sl,deformated); - msi_free(deformated); + free(deformated); } if (!MSI_RecordIsNull(row,7)) @@ -3813,7 +3815,7 @@ static UINT ITERATE_CreateShortcuts(MSIRECORD *row, LPVOID param) index = 0; IShellLinkW_SetIconLocation(sl, path, index); - msi_free(path); + free(path); } if (!MSI_RecordIsNull(row,11)) @@ -3833,7 +3835,7 @@ static UINT ITERATE_CreateShortcuts(MSIRECORD *row, LPVOID param) IPersistFile_Save(pf, link_file, FALSE); msi_revert_fs_redirection( package ); - msi_free(link_file); + free(link_file); err: if (pf) @@ -3889,7 +3891,7 @@ static UINT ITERATE_RemoveShortcuts( MSIRECORD *row, LPVOID param ) link_file = get_link_file( package, row ); TRACE("Removing shortcut file %s\n", debugstr_w( link_file )); if (!msi_delete_file( package, link_file )) WARN( "failed to remove shortcut file %lu\n", GetLastError() ); - msi_free( link_file ); + free( link_file ); return ERROR_SUCCESS; } @@ -3936,7 +3938,7 @@ static UINT ITERATE_PublishIcon(MSIRECORD *row, LPVOID param) if (handle == INVALID_HANDLE_VALUE) { ERR("Unable to create file %s\n", debugstr_w(icon_path)); - msi_free( icon_path ); + free( icon_path ); return ERROR_SUCCESS; } @@ -3954,13 +3956,13 @@ static UINT ITERATE_PublishIcon(MSIRECORD *row, LPVOID param) WriteFile( handle, buffer, sz, &count, NULL ); } while (sz == 1024); - msi_free( icon_path ); + free( icon_path ); CloseHandle( handle ); return ERROR_SUCCESS; } -static UINT msi_publish_icons(MSIPACKAGE *package) +static UINT publish_icons(MSIPACKAGE *package) { MSIQUERY *view; UINT r; @@ -3976,7 +3978,7 @@ static UINT msi_publish_icons(MSIPACKAGE *package) return ERROR_SUCCESS; } -static UINT msi_publish_sourcelist(MSIPACKAGE *package, HKEY hkey) +static UINT publish_sourcelist(MSIPACKAGE *package, HKEY hkey) { UINT r; HKEY source; @@ -4030,14 +4032,14 @@ static UINT msi_publish_sourcelist(MSIPACKAGE *package, HKEY hkey) return ERROR_SUCCESS; } -static UINT msi_publish_product_properties(MSIPACKAGE *package, HKEY hkey) +static UINT publish_product_properties(MSIPACKAGE *package, HKEY hkey) { WCHAR *buffer, *ptr, *guids, packcode[SQUASHED_GUID_SIZE]; DWORD langid; buffer = msi_dup_property(package->db, INSTALLPROPERTY_PRODUCTNAMEW); msi_reg_set_val_str(hkey, INSTALLPROPERTY_PRODUCTNAMEW, buffer); - msi_free(buffer); + free(buffer); langid = msi_get_property_int(package->db, L"ProductLanguage", 0); msi_reg_set_val_dword(hkey, INSTALLPROPERTY_LANGUAGEW, langid); @@ -4050,8 +4052,8 @@ static UINT msi_publish_product_properties(MSIPACKAGE *package, HKEY hkey) { LPWSTR path = msi_build_icon_path(package, buffer); msi_reg_set_val_str(hkey, INSTALLPROPERTY_PRODUCTICONW, path); - msi_free(path); - msi_free(buffer); + free(path); + free(buffer); } buffer = msi_dup_property(package->db, L"ProductVersion"); @@ -4059,7 +4061,7 @@ static UINT msi_publish_product_properties(MSIPACKAGE *package, HKEY hkey) { DWORD verdword = msi_version_str_to_dword(buffer); msi_reg_set_val_dword(hkey, INSTALLPROPERTY_VERSIONW, verdword); - msi_free(buffer); + free(buffer); } msi_reg_set_val_dword(hkey, L"Assignment", 0); @@ -4070,13 +4072,13 @@ static UINT msi_publish_product_properties(MSIPACKAGE *package, HKEY hkey) if (!(guids = msi_get_package_code(package->db))) return ERROR_OUTOFMEMORY; if ((ptr = wcschr(guids, ';'))) *ptr = 0; squash_guid(guids, packcode); - msi_free( guids); + free(guids); msi_reg_set_val_str(hkey, INSTALLPROPERTY_PACKAGECODEW, packcode); return ERROR_SUCCESS; } -static UINT msi_publish_upgrade_code(MSIPACKAGE *package) +static UINT publish_upgrade_code(MSIPACKAGE *package) { UINT r; HKEY hkey; @@ -4094,17 +4096,17 @@ static UINT msi_publish_upgrade_code(MSIPACKAGE *package) if (r != ERROR_SUCCESS) { WARN("failed to open upgrade code key\n"); - msi_free(upgrade); + free(upgrade); return ERROR_SUCCESS; } squash_guid(package->ProductCode, squashed_pc); msi_reg_set_val_str(hkey, squashed_pc, NULL); RegCloseKey(hkey); - msi_free(upgrade); + free(upgrade); return ERROR_SUCCESS; } -static BOOL msi_check_publish(MSIPACKAGE *package) +static BOOL check_publish(MSIPACKAGE *package) { MSIFEATURE *feature; @@ -4118,7 +4120,7 @@ static BOOL msi_check_publish(MSIPACKAGE *package) return FALSE; } -static BOOL msi_check_unpublish(MSIPACKAGE *package) +static BOOL check_unpublish(MSIPACKAGE *package) { MSIFEATURE *feature; @@ -4132,7 +4134,7 @@ static BOOL msi_check_unpublish(MSIPACKAGE *package) return TRUE; } -static UINT msi_publish_patches( MSIPACKAGE *package ) +static UINT publish_patches( MSIPACKAGE *package ) { WCHAR patch_squashed[GUID_SIZE]; HKEY patches_key = NULL, product_patches_key = NULL, product_key; @@ -4163,7 +4165,7 @@ static UINT msi_publish_patches( MSIPACKAGE *package ) len += lstrlenW( patch_squashed ) + 1; } - p = all_patches = msi_alloc( (len + 1) * sizeof(WCHAR) ); + p = all_patches = malloc( (len + 1) * sizeof(WCHAR) ); if (!all_patches) goto done; @@ -4230,7 +4232,7 @@ static UINT msi_publish_patches( MSIPACKAGE *package ) RegCloseKey( product_patches_key ); RegCloseKey( patches_key ); RegCloseKey( product_key ); - msi_free( all_patches ); + free( all_patches ); return r; } @@ -4246,7 +4248,7 @@ static UINT ACTION_PublishProduct(MSIPACKAGE *package) if (!list_empty(&package->patches)) { - rc = msi_publish_patches(package); + rc = publish_patches(package); if (rc != ERROR_SUCCESS) goto end; } @@ -4268,19 +4270,19 @@ static UINT ACTION_PublishProduct(MSIPACKAGE *package) WCHAR packed[SQUASHED_GUID_SIZE]; squash_guid(guid, packed); - msi_free(guid); + free(guid); if (!wcscmp(packed, package_code)) { TRACE("re-publishing product - new package\n"); republish = TRUE; } } - msi_free(package_code); + free(package_code); } } /* FIXME: also need to publish if the product is in advertise mode */ - if (!republish && !msi_check_publish(package)) + if (!republish && !check_publish(package)) { if (hukey) RegCloseKey(hukey); @@ -4300,19 +4302,19 @@ static UINT ACTION_PublishProduct(MSIPACKAGE *package) if (rc != ERROR_SUCCESS) goto end; - rc = msi_publish_upgrade_code(package); + rc = publish_upgrade_code(package); if (rc != ERROR_SUCCESS) goto end; - rc = msi_publish_product_properties(package, hukey); + rc = publish_product_properties(package, hukey); if (rc != ERROR_SUCCESS) goto end; - rc = msi_publish_sourcelist(package, hukey); + rc = publish_sourcelist(package, hukey); if (rc != ERROR_SUCCESS) goto end; - rc = msi_publish_icons(package); + rc = publish_icons(package); end: uirow = MSI_CreateRecord( 1 ); @@ -4339,7 +4341,7 @@ static WCHAR *get_ini_file_name( MSIPACKAGE *package, MSIRECORD *row ) dirprop = MSI_RecordGetString( row, 3 ); if (dirprop) { - folder = strdupW( msi_get_target_folder( package, dirprop ) ); + folder = wcsdup( msi_get_target_folder( package, dirprop ) ); if (!folder) folder = msi_dup_property( package->db, dirprop ); } else @@ -4348,14 +4350,14 @@ static WCHAR *get_ini_file_name( MSIPACKAGE *package, MSIRECORD *row ) if (!folder) { ERR("Unable to resolve folder %s\n", debugstr_w(dirprop)); - msi_free( filename ); + free( filename ); return NULL; } ret = msi_build_directory_name( 2, folder, ptr ); - msi_free( filename ); - msi_free( folder ); + free( filename ); + free( folder ); return ret; } @@ -4426,10 +4428,10 @@ static UINT ITERATE_WriteIniValues(MSIRECORD *row, LPVOID param) MSI_ProcessMessage(package, INSTALLMESSAGE_ACTIONDATA, uirow); msiobj_release( &uirow->hdr ); - msi_free(fullname); - msi_free(deformated_key); - msi_free(deformated_value); - msi_free(deformated_section); + free(fullname); + free(deformated_key); + free(deformated_value); + free(deformated_section); return ERROR_SUCCESS; } @@ -4492,7 +4494,7 @@ static UINT ITERATE_RemoveIniValuesOnUninstall( MSIRECORD *row, LPVOID param ) { WARN( "unable to remove key %lu\n", GetLastError() ); } - msi_free( filename ); + free( filename ); } else FIXME("Unsupported action %d\n", action); @@ -4506,9 +4508,9 @@ static UINT ITERATE_RemoveIniValuesOnUninstall( MSIRECORD *row, LPVOID param ) MSI_ProcessMessage(package, INSTALLMESSAGE_ACTIONDATA, uirow); msiobj_release( &uirow->hdr ); - msi_free( deformated_key ); - msi_free( deformated_value ); - msi_free( deformated_section ); + free( deformated_key ); + free( deformated_value ); + free( deformated_section ); return ERROR_SUCCESS; } @@ -4554,7 +4556,7 @@ static UINT ITERATE_RemoveIniValuesOnInstall( MSIRECORD *row, LPVOID param ) { WARN( "unable to remove key %lu\n", GetLastError() ); } - msi_free( filename ); + free( filename ); } else FIXME("Unsupported action %d\n", action); @@ -4567,9 +4569,9 @@ static UINT ITERATE_RemoveIniValuesOnInstall( MSIRECORD *row, LPVOID param ) MSI_ProcessMessage(package, INSTALLMESSAGE_ACTIONDATA, uirow); msiobj_release( &uirow->hdr ); - msi_free( deformated_key ); - msi_free( deformated_value ); - msi_free( deformated_section ); + free( deformated_key ); + free( deformated_value ); + free( deformated_section ); return ERROR_SUCCESS; } @@ -4602,18 +4604,13 @@ static UINT ACTION_RemoveIniValues( MSIPACKAGE *package ) static void register_dll( const WCHAR *dll, BOOL unregister ) { -#ifdef __REACTOS__ static const WCHAR regW[] = L"regsvr32.exe /s \"%s\""; static const WCHAR unregW[] = L"regsvr32.exe /s /u \"%s\""; -#else /* __REACTOS__ */ - static const WCHAR regW[] = L"regsvr32.exe \"%s\""; - static const WCHAR unregW[] = L"regsvr32.exe /u \"%s\""; -#endif /* __REACTOS__ */ PROCESS_INFORMATION pi; STARTUPINFOW si; WCHAR *cmd; - if (!(cmd = msi_alloc( lstrlenW(dll) * sizeof(WCHAR) + sizeof(unregW) ))) return; + if (!(cmd = malloc( wcslen(dll) * sizeof(WCHAR) + sizeof(unregW) ))) return; if (unregister) swprintf( cmd, lstrlenW(dll) + ARRAY_SIZE(unregW), unregW, dll ); else swprintf( cmd, lstrlenW(dll) + ARRAY_SIZE(unregW), regW, dll ); @@ -4625,7 +4622,7 @@ static void register_dll( const WCHAR *dll, BOOL unregister ) msi_dialog_check_messages( pi.hProcess ); CloseHandle( pi.hProcess ); } - msi_free( cmd ); + free( cmd ); } static UINT ITERATE_SelfRegModules(MSIRECORD *row, LPVOID param) @@ -4737,7 +4734,7 @@ static UINT ACTION_PublishFeatures(MSIPACKAGE *package) if (package->script == SCRIPT_NONE) return msi_schedule_action(package, SCRIPT_INSTALL, L"PublishFeatures"); - if (!msi_check_publish(package)) + if (!check_publish(package)) return ERROR_SUCCESS; rc = MSIREG_OpenFeaturesKey(package->ProductCode, NULL, package->Context, @@ -4776,7 +4773,7 @@ static UINT ACTION_PublishFeatures(MSIPACKAGE *package) if (feature->Feature_Parent) size += lstrlenW( feature->Feature_Parent )+2; - data = msi_alloc(size * sizeof(WCHAR)); + data = malloc(size * sizeof(WCHAR)); data[0] = 0; LIST_FOR_EACH_ENTRY( cl, &feature->Components, ComponentList, entry ) @@ -4802,7 +4799,7 @@ static UINT ACTION_PublishFeatures(MSIPACKAGE *package) } msi_reg_set_val_str( userdata, feature->Feature, data ); - msi_free(data); + free(data); size = 0; if (feature->Feature_Parent) @@ -4816,14 +4813,14 @@ static UINT ACTION_PublishFeatures(MSIPACKAGE *package) else { size += 2*sizeof(WCHAR); - data = msi_alloc(size); + data = malloc(size); data[0] = 0x6; data[1] = 0; if (feature->Feature_Parent) lstrcpyW( &data[1], feature->Feature_Parent ); RegSetValueExW(hkey,feature->Feature,0,REG_SZ, (LPBYTE)data,size); - msi_free(data); + free(data); } /* the UI chunk */ @@ -4840,7 +4837,7 @@ static UINT ACTION_PublishFeatures(MSIPACKAGE *package) return rc; } -static UINT msi_unpublish_feature(MSIPACKAGE *package, MSIFEATURE *feature) +static UINT unpublish_feature(MSIPACKAGE *package, MSIFEATURE *feature) { UINT r; HKEY hkey; @@ -4879,18 +4876,18 @@ static UINT ACTION_UnpublishFeatures(MSIPACKAGE *package) if (package->script == SCRIPT_NONE) return msi_schedule_action(package, SCRIPT_INSTALL, L"UnpublishFeatures"); - if (!msi_check_unpublish(package)) + if (!check_unpublish(package)) return ERROR_SUCCESS; LIST_FOR_EACH_ENTRY(feature, &package->features, MSIFEATURE, entry) { - msi_unpublish_feature(package, feature); + unpublish_feature(package, feature); } return ERROR_SUCCESS; } -static UINT msi_publish_install_properties(MSIPACKAGE *package, HKEY hkey) +static UINT publish_install_properties(MSIPACKAGE *package, HKEY hkey) { static const WCHAR *propval[] = { @@ -4921,7 +4918,7 @@ static UINT msi_publish_install_properties(MSIPACKAGE *package, HKEY hkey) key = *p++; val = msi_dup_property(package->db, prop); msi_reg_set_val_str(hkey, key, val); - msi_free(val); + free(val); } msi_reg_set_val_dword(hkey, L"WindowsInstaller", 1); @@ -4950,7 +4947,7 @@ static UINT msi_publish_install_properties(MSIPACKAGE *package, HKEY hkey) size = deformat_string(package, fmt, &buffer) * sizeof(WCHAR); RegSetValueExW(hkey, L"ModifyPath", 0, REG_EXPAND_SZ, (LPBYTE)buffer, size); RegSetValueExW(hkey, L"UninstallString", 0, REG_EXPAND_SZ, (LPBYTE)buffer, size); - msi_free(buffer); + free(buffer); } /* FIXME: Write real Estimated Size when we have it */ @@ -4972,7 +4969,7 @@ static UINT msi_publish_install_properties(MSIPACKAGE *package, HKEY hkey) msi_reg_set_val_dword(hkey, INSTALLPROPERTY_VERSIONW, verdword); msi_reg_set_val_dword(hkey, INSTALLPROPERTY_VERSIONMAJORW, verdword >> 24); msi_reg_set_val_dword(hkey, INSTALLPROPERTY_VERSIONMINORW, (verdword >> 16) & 0xFF); - msi_free(buffer); + free(buffer); } return ERROR_SUCCESS; @@ -4989,8 +4986,7 @@ static UINT ACTION_RegisterProduct(MSIPACKAGE *package) return msi_schedule_action(package, SCRIPT_INSTALL, L"RegisterProduct"); /* FIXME: also need to publish if the product is in advertise mode */ - if (!msi_get_property_int( package->db, L"ProductToBeRegistered", 0 ) - && !msi_check_publish(package)) + if (!msi_get_property_int( package->db, L"ProductToBeRegistered", 0 ) && !check_publish(package)) return ERROR_SUCCESS; rc = MSIREG_OpenUninstallKey(package->ProductCode, package->platform, &hkey, TRUE); @@ -5001,11 +4997,11 @@ static UINT ACTION_RegisterProduct(MSIPACKAGE *package) if (rc != ERROR_SUCCESS) goto done; - rc = msi_publish_install_properties(package, hkey); + rc = publish_install_properties(package, hkey); if (rc != ERROR_SUCCESS) goto done; - rc = msi_publish_install_properties(package, props); + rc = publish_install_properties(package, props); if (rc != ERROR_SUCCESS) goto done; @@ -5019,7 +5015,7 @@ static UINT ACTION_RegisterProduct(MSIPACKAGE *package) msi_reg_set_val_str( upgrade_key, squashed_pc, NULL ); RegCloseKey( upgrade_key ); } - msi_free( upgrade_code ); + free( upgrade_code ); } msi_reg_set_val_str( props, INSTALLPROPERTY_LOCALPACKAGEW, package->localfile ); package->delete_on_close = FALSE; @@ -5055,12 +5051,12 @@ static UINT ITERATE_UnpublishIcon( MSIRECORD *row, LPVOID param ) *p = 0; msi_remove_directory( package, icon_path ); } - msi_free( icon_path ); + free( icon_path ); } return ERROR_SUCCESS; } -static UINT msi_unpublish_icons( MSIPACKAGE *package ) +static UINT unpublish_icons( MSIPACKAGE *package ) { MSIQUERY *view; UINT r; @@ -5111,7 +5107,7 @@ static void remove_product_upgrade_code( MSIPACKAGE *package ) if (!res && !count) MSIREG_DeleteClassesUpgradeCodesKey( code ); } - msi_free( code ); + free( code ); } static UINT ACTION_UnpublishProduct(MSIPACKAGE *package) @@ -5142,7 +5138,7 @@ static UINT ACTION_UnpublishProduct(MSIPACKAGE *package) TRACE("removing local package %s\n", debugstr_w(package->localfile)); package->delete_on_close = TRUE; - msi_unpublish_icons( package ); + unpublish_icons( package ); return ERROR_SUCCESS; } @@ -5163,12 +5159,52 @@ static BOOL is_full_uninstall( MSIPACKAGE *package ) static UINT ACTION_InstallFinalize(MSIPACKAGE *package) { UINT rc; + MSIFILE *file; + MSIFILEPATCH *patch; /* first do the same as an InstallExecute */ rc = execute_script(package, SCRIPT_INSTALL); if (rc != ERROR_SUCCESS) return rc; + /* install global assemblies */ + LIST_FOR_EACH_ENTRY( file, &package->files, MSIFILE, entry ) + { + MSICOMPONENT *comp = file->Component; + + if (!msi_is_global_assembly( comp ) || (file->state != msifs_missing && file->state != msifs_overwrite)) + continue; + + rc = msi_install_assembly( package, comp ); + if (rc != ERROR_SUCCESS) + { + ERR("Failed to install assembly\n"); + return ERROR_INSTALL_FAILURE; + } + file->state = msifs_installed; + } + + /* patch global assemblies */ + LIST_FOR_EACH_ENTRY( patch, &package->filepatches, MSIFILEPATCH, entry ) + { + MSICOMPONENT *comp = patch->File->Component; + + if (!msi_is_global_assembly( comp ) || !patch->path) continue; + + rc = msi_patch_assembly( package, comp->assembly, patch ); + if (rc && !(patch->Attributes & msidbPatchAttributesNonVital)) + { + ERR("Failed to apply patch to file: %s\n", debugstr_w(patch->File->File)); + return rc; + } + + if ((rc = msi_install_assembly( package, comp ))) + { + ERR("Failed to install patched assembly\n"); + return rc; + } + } + /* then handle commit actions */ rc = execute_script(package, SCRIPT_COMMIT); if (rc != ERROR_SUCCESS) @@ -5233,26 +5269,30 @@ static UINT ACTION_ResolveSource(MSIPACKAGE* package) INSTALLPROPERTY_DISKPROMPTW,NULL,&size); if (rc == ERROR_MORE_DATA) { - prompt = msi_alloc(size * sizeof(WCHAR)); + prompt = malloc(size * sizeof(WCHAR)); MsiSourceListGetInfoW(package->ProductCode, NULL, package->Context, MSICODE_PRODUCT, INSTALLPROPERTY_DISKPROMPTW,prompt,&size); } else - prompt = strdupW(package->db->path); + prompt = wcsdup(package->db->path); record = MSI_CreateRecord(2); MSI_RecordSetInteger(record, 1, MSIERR_INSERTDISK); MSI_RecordSetStringW(record, 2, prompt); - msi_free(prompt); + free(prompt); while(attrib == INVALID_FILE_ATTRIBUTES) { MSI_RecordSetStringW(record, 0, NULL); rc = MSI_ProcessMessage(package, INSTALLMESSAGE_ERROR, record); if (rc == IDCANCEL) + { + msiobj_release(&record->hdr); return ERROR_INSTALL_USEREXIT; + } attrib = GetFileAttributesW(package->db->path); } + msiobj_release(&record->hdr); rc = ERROR_SUCCESS; } else @@ -5285,7 +5325,7 @@ static UINT ACTION_RegisterUser(MSIPACKAGE *package) if (package->script == SCRIPT_NONE) return msi_schedule_action(package, SCRIPT_INSTALL, L"RegisterUser"); - if (msi_check_unpublish(package)) + if (check_unpublish(package)) { MSIREG_DeleteUserDataProductKey(package->ProductCode, package->Context); goto end; @@ -5304,7 +5344,7 @@ static UINT ACTION_RegisterUser(MSIPACKAGE *package) { buffer = msi_dup_property( package->db, szPropKeys[i] ); msi_reg_set_val_str( hkey, szRegKeys[i], buffer ); - msi_free( buffer ); + free( buffer ); } end: @@ -5313,7 +5353,7 @@ static UINT ACTION_RegisterUser(MSIPACKAGE *package) MSI_ProcessMessage(package, INSTALLMESSAGE_ACTIONDATA, uirow); msiobj_release( &uirow->hdr ); - msi_free(productid); + free(productid); RegCloseKey(hkey); return rc; } @@ -5363,7 +5403,7 @@ static UINT ACTION_ExecuteAction(MSIPACKAGE *package) } info_template = msi_get_error_message(package->db, MSIERR_INFO_LOGGINGSTART); MSI_RecordSetStringW(uirow_info, 0, info_template); - msi_free(info_template); + free(info_template); MSI_ProcessMessage(package, INSTALLMESSAGE_INFO|MB_ICONHAND, uirow_info); msiobj_release(&uirow_info->hdr); } @@ -5445,8 +5485,8 @@ static UINT ACTION_ExecuteAction(MSIPACKAGE *package) msiobj_release(&uirow->hdr); end: - msi_free(productname); - msi_free(action); + free(productname); + free(action); return rc; } @@ -5485,7 +5525,7 @@ WCHAR *msi_create_component_advertise_string( MSIPACKAGE *package, MSICOMPONENT debugstr_w(component_85)); sz = 20 + lstrlenW( feature ) + 20 + 3; - ret = msi_alloc_zero( sz * sizeof(WCHAR) ); + ret = calloc( 1, sz * sizeof(WCHAR) ); if (ret) swprintf( ret, sz, L"%s%s%c%s", productid_85, feature, component ? '>' : '<', component_85 ); return ret; } @@ -5533,10 +5573,10 @@ static UINT ITERATE_PublishComponent(MSIRECORD *rec, LPVOID param) text = MSI_RecordGetString( rec, 4 ); if (text) { - p = msi_alloc( (lstrlenW( advertise ) + lstrlenW( text ) + 1) * sizeof(WCHAR) ); + p = malloc( (wcslen( advertise ) + wcslen( text ) + 1) * sizeof(WCHAR) ); lstrcpyW( p, advertise ); lstrcatW( p, text ); - msi_free( advertise ); + free( advertise ); advertise = p; } existing = msi_reg_get_val_str( hkey, qualifier ); @@ -5550,7 +5590,7 @@ static UINT ITERATE_PublishComponent(MSIRECORD *rec, LPVOID param) if (wcscmp( advertise, p )) sz += len; } } - if (!(output = msi_alloc( (sz + 1) * sizeof(WCHAR) ))) + if (!(output = malloc( (sz + 1) * sizeof(WCHAR) ))) { rc = ERROR_OUTOFMEMORY; goto end; @@ -5575,9 +5615,9 @@ static UINT ITERATE_PublishComponent(MSIRECORD *rec, LPVOID param) end: RegCloseKey(hkey); - msi_free( output ); - msi_free( advertise ); - msi_free( existing ); + free( output ); + free( advertise ); + free( existing ); /* the UI chunk */ uirow = MSI_CreateRecord( 2 ); @@ -5758,7 +5798,7 @@ static UINT ITERATE_InstallService(MSIRECORD *rec, LPVOID param) else { int len = lstrlenW(file->TargetPath) + lstrlenW(args) + 2; - if (!(image_path = msi_alloc(len * sizeof(WCHAR)))) + if (!(image_path = malloc(len * sizeof(WCHAR)))) { ret = ERROR_OUTOFMEMORY; goto done; @@ -5788,18 +5828,18 @@ static UINT ITERATE_InstallService(MSIRECORD *rec, LPVOID param) WARN( "failed to set service description %lu\n", GetLastError() ); } - if (image_path != file->TargetPath) msi_free(image_path); + if (image_path != file->TargetPath) free(image_path); done: if (service) CloseServiceHandle(service); if (hscm) CloseServiceHandle(hscm); - msi_free(name); - msi_free(disp); - msi_free(sd.lpDescription); - msi_free(load_order); - msi_free(serv_name); - msi_free(pass); - msi_free(depends); - msi_free(args); + free(name); + free(disp); + free(sd.lpDescription); + free(load_order); + free(serv_name); + free(pass); + free(depends); + free(args); return ret; } @@ -5822,7 +5862,7 @@ static UINT ACTION_InstallServices( MSIPACKAGE *package ) } /* converts arg1[~]arg2[~]arg3 to a list of ptrs to the strings */ -static LPCWSTR *msi_service_args_to_vector(LPWSTR args, DWORD *numargs) +static const WCHAR **service_args_to_vector(WCHAR *args, DWORD *numargs) { LPCWSTR *vector, *temp_vector; LPWSTR p, q; @@ -5834,7 +5874,7 @@ static LPCWSTR *msi_service_args_to_vector(LPWSTR args, DWORD *numargs) if (!args) return NULL; - vector = msi_alloc(sizeof(LPWSTR)); + vector = malloc(sizeof(WCHAR *)); if (!vector) return NULL; @@ -5848,10 +5888,10 @@ static LPCWSTR *msi_service_args_to_vector(LPWSTR args, DWORD *numargs) { *q = '\0'; - temp_vector = msi_realloc(vector, (*numargs + 1) * sizeof(LPWSTR)); + temp_vector = realloc(vector, (*numargs + 1) * sizeof(WCHAR *)); if (!temp_vector) { - msi_free(vector); + free(vector); return NULL; } vector = temp_vector; @@ -5889,7 +5929,7 @@ static UINT ITERATE_StartService(MSIRECORD *rec, LPVOID param) !(comp->Action == INSTALLSTATE_ABSENT && (event & msidbServiceControlEventUninstallStart))) { TRACE("not starting %s\n", debugstr_w(name)); - msi_free( name ); + free(name); return ERROR_SUCCESS; } @@ -5907,7 +5947,7 @@ static UINT ITERATE_StartService(MSIRECORD *rec, LPVOID param) if (!GetServiceDisplayNameW( scm, name, NULL, &len ) && GetLastError() == ERROR_INSUFFICIENT_BUFFER) { - if ((display_name = msi_alloc( ++len * sizeof(WCHAR )))) + if ((display_name = malloc(++len * sizeof(WCHAR)))) GetServiceDisplayNameW( scm, name, display_name, &len ); } @@ -5918,7 +5958,7 @@ static UINT ITERATE_StartService(MSIRECORD *rec, LPVOID param) goto done; } - vector = msi_service_args_to_vector(args, &numargs); + vector = service_args_to_vector(args, &numargs); if (!StartServiceW(service, numargs, vector) && GetLastError() != ERROR_SERVICE_ALREADY_RUNNING) @@ -5966,10 +6006,10 @@ static UINT ITERATE_StartService(MSIRECORD *rec, LPVOID param) if (service) CloseServiceHandle(service); if (scm) CloseServiceHandle(scm); - msi_free(name); - msi_free(args); - msi_free(vector); - msi_free(display_name); + free(name); + free(args); + free(vector); + free(display_name); return r; } @@ -6005,7 +6045,7 @@ static BOOL stop_service_dependents(SC_HANDLE scm, SC_HANDLE service) if (GetLastError() != ERROR_MORE_DATA) return FALSE; - dependencies = msi_alloc(needed); + dependencies = malloc(needed); if (!dependencies) return FALSE; @@ -6029,7 +6069,7 @@ static BOOL stop_service_dependents(SC_HANDLE scm, SC_HANDLE service) ret = TRUE; done: - msi_free(dependencies); + free(dependencies); return ret; } @@ -6098,7 +6138,7 @@ static UINT ITERATE_StopService( MSIRECORD *rec, LPVOID param ) !(comp->Action == INSTALLSTATE_ABSENT && (event & msidbServiceControlEventUninstallStop))) { TRACE("not stopping %s\n", debugstr_w(name)); - msi_free( name ); + free( name ); return ERROR_SUCCESS; } @@ -6113,7 +6153,7 @@ static UINT ITERATE_StopService( MSIRECORD *rec, LPVOID param ) if (!GetServiceDisplayNameW( scm, name, NULL, &len ) && GetLastError() == ERROR_INSUFFICIENT_BUFFER) { - if ((display_name = msi_alloc( ++len * sizeof(WCHAR )))) + if ((display_name = malloc( ++len * sizeof(WCHAR )))) GetServiceDisplayNameW( scm, name, display_name, &len ); } CloseServiceHandle( scm ); @@ -6127,8 +6167,8 @@ static UINT ITERATE_StopService( MSIRECORD *rec, LPVOID param ) MSI_ProcessMessage(package, INSTALLMESSAGE_ACTIONDATA, uirow); msiobj_release( &uirow->hdr ); - msi_free( name ); - msi_free( display_name ); + free( name ); + free( display_name ); return ERROR_SUCCESS; } @@ -6170,7 +6210,7 @@ static UINT ITERATE_DeleteService( MSIRECORD *rec, LPVOID param ) !(comp->Action == INSTALLSTATE_ABSENT && (event & msidbServiceControlEventUninstallDelete))) { TRACE("service %s not scheduled for removal\n", debugstr_w(name)); - msi_free( name ); + free( name ); return ERROR_SUCCESS; } stop_service( name ); @@ -6186,7 +6226,7 @@ static UINT ITERATE_DeleteService( MSIRECORD *rec, LPVOID param ) if (!GetServiceDisplayNameW( scm, name, NULL, &len ) && GetLastError() == ERROR_INSUFFICIENT_BUFFER) { - if ((display_name = msi_alloc( ++len * sizeof(WCHAR )))) + if ((display_name = malloc( ++len * sizeof(WCHAR )))) GetServiceDisplayNameW( scm, name, display_name, &len ); } @@ -6209,8 +6249,8 @@ static UINT ITERATE_DeleteService( MSIRECORD *rec, LPVOID param ) if (service) CloseServiceHandle( service ); if (scm) CloseServiceHandle( scm ); - msi_free( name ); - msi_free( display_name ); + free( name ); + free( display_name ); return ERROR_SUCCESS; } @@ -6274,7 +6314,7 @@ static UINT ITERATE_InstallODBCDriver( MSIRECORD *rec, LPVOID param ) len += lstrlenW(L"Setup=%s") + lstrlenW(setup_file->FileName); len += lstrlenW(L"FileUsage=1") + 2; /* \0\0 */ - driver = msi_alloc(len * sizeof(WCHAR)); + driver = malloc(len * sizeof(WCHAR)); if (!driver) return ERROR_OUTOFMEMORY; @@ -6300,7 +6340,7 @@ static UINT ITERATE_InstallODBCDriver( MSIRECORD *rec, LPVOID param ) const WCHAR *dir = msi_get_target_folder( package, driver_file->Component->Directory ); driver_file->TargetPath = msi_build_directory_name( 2, dir, driver_file->FileName ); } - driver_path = strdupW(driver_file->TargetPath); + driver_path = wcsdup(driver_file->TargetPath); ptr = wcsrchr(driver_path, '\\'); if (ptr) *ptr = '\0'; @@ -6318,8 +6358,8 @@ static UINT ITERATE_InstallODBCDriver( MSIRECORD *rec, LPVOID param ) MSI_ProcessMessage(package, INSTALLMESSAGE_ACTIONDATA, uirow); msiobj_release( &uirow->hdr ); - msi_free(driver); - msi_free(driver_path); + free(driver); + free(driver_path); return r; } @@ -6365,7 +6405,7 @@ static UINT ITERATE_InstallODBCTranslator( MSIRECORD *rec, LPVOID param ) if (setup_file) len += lstrlenW(L"Setup=%s") + lstrlenW(setup_file->FileName); - translator = msi_alloc(len * sizeof(WCHAR)); + translator = malloc(len * sizeof(WCHAR)); if (!translator) return ERROR_OUTOFMEMORY; @@ -6383,7 +6423,7 @@ static UINT ITERATE_InstallODBCTranslator( MSIRECORD *rec, LPVOID param ) } *ptr = '\0'; - translator_path = strdupW(translator_file->TargetPath); + translator_path = wcsdup(translator_file->TargetPath); ptr = wcsrchr(translator_path, '\\'); if (ptr) *ptr = '\0'; @@ -6401,8 +6441,8 @@ static UINT ITERATE_InstallODBCTranslator( MSIRECORD *rec, LPVOID param ) MSI_ProcessMessage(package, INSTALLMESSAGE_ACTIONDATA, uirow); msiobj_release( &uirow->hdr ); - msi_free(translator); - msi_free(translator_path); + free(translator); + free(translator_path); return r; } @@ -6439,7 +6479,7 @@ static UINT ITERATE_InstallODBCDataSource( MSIRECORD *rec, LPVOID param ) else if (registration == msidbODBCDataSourceRegistrationPerUser) request = ODBC_ADD_DSN; len = lstrlenW(L"DSN=%s") + lstrlenW(desc) + 2; /* \0\0 */ - attrs = msi_alloc(len * sizeof(WCHAR)); + attrs = malloc(len * sizeof(WCHAR)); if (!attrs) return ERROR_OUTOFMEMORY; @@ -6456,7 +6496,7 @@ static UINT ITERATE_InstallODBCDataSource( MSIRECORD *rec, LPVOID param ) MSI_ProcessMessage(package, INSTALLMESSAGE_ACTIONDATA, uirow); msiobj_release( &uirow->hdr ); - msi_free(attrs); + free(attrs); return r; } @@ -6605,7 +6645,7 @@ static UINT ITERATE_RemoveODBCDataSource( MSIRECORD *rec, LPVOID param ) else if (registration == msidbODBCDataSourceRegistrationPerUser) request = ODBC_REMOVE_DSN; len = lstrlenW( L"DSN=%s" ) + lstrlenW( desc ) + 2; /* \0\0 */ - attrs = msi_alloc( len * sizeof(WCHAR) ); + attrs = malloc( len * sizeof(WCHAR) ); if (!attrs) return ERROR_OUTOFMEMORY; @@ -6618,7 +6658,7 @@ static UINT ITERATE_RemoveODBCDataSource( MSIRECORD *rec, LPVOID param ) { WARN("Failed to remove ODBC data source\n"); } - msi_free( attrs ); + free( attrs ); uirow = MSI_CreateRecord( 3 ); MSI_RecordSetStringW( uirow, 1, desc ); @@ -6869,7 +6909,7 @@ static UINT ITERATE_WriteEnvironmentString( MSIRECORD *rec, LPVOID param ) goto done; } size = (lstrlenW(value) + 1) * sizeof(WCHAR); - newval = strdupW(value); + newval = wcsdup(value); if (!newval) { res = ERROR_OUTOFMEMORY; @@ -6887,9 +6927,9 @@ static UINT ITERATE_WriteEnvironmentString( MSIRECORD *rec, LPVOID param ) goto done; } - if (!(p = q = data = msi_alloc( size ))) + if (!(p = q = data = malloc( size ))) { - msi_free(deformatted); + free(deformatted); RegCloseKey(env); return ERROR_OUTOFMEMORY; } @@ -6928,7 +6968,7 @@ static UINT ITERATE_WriteEnvironmentString( MSIRECORD *rec, LPVOID param ) } size = (len_value + 1 + lstrlenW( data ) + 1) * sizeof(WCHAR); - if (!(p = newval = msi_alloc( size ))) + if (!(p = newval = malloc( size ))) { res = ERROR_OUTOFMEMORY; goto done; @@ -6968,9 +7008,9 @@ static UINT ITERATE_WriteEnvironmentString( MSIRECORD *rec, LPVOID param ) msiobj_release( &uirow->hdr ); if (env) RegCloseKey(env); - msi_free(deformatted); - msi_free(data); - msi_free(newval); + free(deformatted); + free(data); + free(newval); return res; } @@ -7076,7 +7116,7 @@ static UINT ITERATE_RemoveEnvironmentString( MSIRECORD *rec, LPVOID param ) if (res != ERROR_SUCCESS || (type != REG_SZ && type != REG_EXPAND_SZ)) goto done; - if (!(new_value = msi_alloc( size ))) goto done; + if (!(new_value = malloc( size ))) goto done; res = RegQueryValueExW( env, name, NULL, &type, (BYTE *)new_value, &size ); if (res != ERROR_SUCCESS) @@ -7123,8 +7163,8 @@ static UINT ITERATE_RemoveEnvironmentString( MSIRECORD *rec, LPVOID param ) msiobj_release( &uirow->hdr ); if (env) RegCloseKey( env ); - msi_free( deformatted ); - msi_free( new_value ); + free( deformatted ); + free( new_value ); return r; } @@ -7153,7 +7193,7 @@ UINT msi_validate_product_id( MSIPACKAGE *package ) id = msi_dup_property( package->db, L"ProductID" ); if (id) { - msi_free( id ); + free( id ); return ERROR_SUCCESS; } template = msi_dup_property( package->db, L"PIDTemplate" ); @@ -7167,8 +7207,8 @@ UINT msi_validate_product_id( MSIPACKAGE *package ) r = msi_set_property( package->db, L"ProductID", key, -1 ); #endif } - msi_free( template ); - msi_free( key ); + free( template ); + free( key ); return r; } @@ -7264,19 +7304,19 @@ static UINT ITERATE_RemoveExistingProducts( MSIRECORD *rec, LPVOID param ) else len += ARRAY_SIZE( L"ALL" ); - if (!(cmd = msi_alloc( len * sizeof(WCHAR) ))) + if (!(cmd = malloc( len * sizeof(WCHAR) ))) { - msi_free( product ); - msi_free( features ); + free( product ); + free( features ); return ERROR_OUTOFMEMORY; } swprintf( cmd, len, L"msiexec /qn /i %s REMOVE=%s", product, features ? features : L"ALL" ); - msi_free( product ); - msi_free( features ); + free( product ); + free( features ); memset( &si, 0, sizeof(STARTUPINFOW) ); ret = CreateProcessW( NULL, cmd, NULL, NULL, FALSE, 0, NULL, NULL, &si, &info ); - msi_free( cmd ); + free( cmd ); if (!ret) return GetLastError(); CloseHandle( info.hThread ); @@ -7362,21 +7402,11 @@ static UINT ACTION_MigrateFeatureStates( MSIPACKAGE *package ) return ERROR_SUCCESS; } -static BOOL msi_bind_image( MSIPACKAGE *package, const char *filename, const char *path ) +static void bind_image( MSIPACKAGE *package, const char *filename, const char *path ) { - BOOL ret; msi_disable_fs_redirection( package ); - ret = BindImage( filename, path, NULL ); + if (!BindImage( filename, path, NULL )) WARN( "failed to bind image %lu\n", GetLastError() ); msi_revert_fs_redirection( package ); - return ret; -} - -static void bind_image( MSIPACKAGE *package, const char *filename, const char *path ) -{ - if (!msi_bind_image( package, filename, path )) - { - WARN( "failed to bind image %lu\n", GetLastError() ); - } } static UINT ITERATE_BindImage( MSIRECORD *rec, LPVOID param ) @@ -7406,13 +7436,13 @@ static UINT ITERATE_BindImage( MSIRECORD *rec, LPVOID param ) if ((pathA = strdupWtoA( pathW ))) { bind_image( package, filenameA, pathA ); - msi_free( pathA ); + free( pathA ); } - msi_free( pathW ); + free( pathW ); } } - msi_free( path_list ); - msi_free( filenameA ); + free( path_list ); + free( filenameA ); return ERROR_SUCCESS; } @@ -7431,7 +7461,7 @@ static UINT ACTION_BindImage( MSIPACKAGE *package ) return ERROR_SUCCESS; } -static UINT msi_unimplemented_action_stub( MSIPACKAGE *package, LPCSTR action, LPCWSTR table ) +static UINT unimplemented_action_stub( MSIPACKAGE *package, LPCSTR action, LPCWSTR table ) { MSIQUERY *view; DWORD count = 0; @@ -7451,27 +7481,27 @@ static UINT msi_unimplemented_action_stub( MSIPACKAGE *package, LPCSTR action, L static UINT ACTION_IsolateComponents( MSIPACKAGE *package ) { - return msi_unimplemented_action_stub( package, "IsolateComponents", L"IsolateComponent" ); + return unimplemented_action_stub( package, "IsolateComponents", L"IsolateComponent" ); } static UINT ACTION_RMCCPSearch( MSIPACKAGE *package ) { - return msi_unimplemented_action_stub( package, "RMCCPSearch", L"CCPSearch" ); + return unimplemented_action_stub( package, "RMCCPSearch", L"CCPSearch" ); } static UINT ACTION_RegisterComPlus( MSIPACKAGE *package ) { - return msi_unimplemented_action_stub( package, "RegisterComPlus", L"Complus" ); + return unimplemented_action_stub( package, "RegisterComPlus", L"Complus" ); } static UINT ACTION_UnregisterComPlus( MSIPACKAGE *package ) { - return msi_unimplemented_action_stub( package, "UnregisterComPlus", L"Complus" ); + return unimplemented_action_stub( package, "UnregisterComPlus", L"Complus" ); } static UINT ACTION_InstallSFPCatalogFile( MSIPACKAGE *package ) { - return msi_unimplemented_action_stub( package, "InstallSFPCatalogFile", L"SFPCatalog" ); + return unimplemented_action_stub( package, "InstallSFPCatalogFile", L"SFPCatalog" ); } static const struct @@ -7720,7 +7750,7 @@ UINT MSI_InstallPackage( MSIPACKAGE *package, LPCWSTR szPackagePath, LPWSTR p, dir; LPCWSTR file; - dir = strdupW(szPackagePath); + dir = wcsdup(szPackagePath); p = wcsrchr(dir, '\\'); if (p) { @@ -7729,24 +7759,24 @@ UINT MSI_InstallPackage( MSIPACKAGE *package, LPCWSTR szPackagePath, } else { - msi_free(dir); - dir = msi_alloc(MAX_PATH * sizeof(WCHAR)); + free(dir); + dir = malloc(MAX_PATH * sizeof(WCHAR)); GetCurrentDirectoryW(MAX_PATH, dir); lstrcatW(dir, L"\\"); file = szPackagePath; } - msi_free( package->PackagePath ); - package->PackagePath = msi_alloc((lstrlenW(dir) + lstrlenW(file) + 1) * sizeof(WCHAR)); + free(package->PackagePath); + package->PackagePath = malloc((wcslen(dir) + wcslen(file) + 1) * sizeof(WCHAR)); if (!package->PackagePath) { - msi_free(dir); + free(dir); return ERROR_OUTOFMEMORY; } lstrcpyW(package->PackagePath, dir); lstrcatW(package->PackagePath, file); - msi_free(dir); + free(dir); msi_set_sourcedir_props(package, FALSE); } @@ -7774,10 +7804,10 @@ UINT MSI_InstallPackage( MSIPACKAGE *package, LPCWSTR szPackagePath, if (wcsicmp( productcode, package->ProductCode )) { TRACE( "product code changed %s -> %s\n", debugstr_w(package->ProductCode), debugstr_w(productcode) ); - msi_free( package->ProductCode ); + free( package->ProductCode ); package->ProductCode = productcode; } - else msi_free( productcode ); + else free( productcode ); if (msi_get_property_int( package->db, L"DISABLEROLLBACK", 0 )) { @@ -7813,8 +7843,8 @@ UINT MSI_InstallPackage( MSIPACKAGE *package, LPCWSTR szPackagePath, WARN("installation failed, running rollback script\n"); execute_script( package, SCRIPT_ROLLBACK ); } - msi_free( reinstall ); - msi_free( action ); + free( reinstall ); + free( action ); if (rc == ERROR_SUCCESS && package->need_reboot_at_end) return ERROR_SUCCESS_REBOOT_REQUIRED; diff --git a/dll/win32/msi/alter.c b/dll/win32/msi/alter.c index 7d272118537f1..0b2b3cf5bc98a 100644 --- a/dll/win32/msi/alter.c +++ b/dll/win32/msi/alter.c @@ -34,18 +34,18 @@ WINE_DEFAULT_DEBUG_CHANNEL(msidb); -typedef struct tagMSIALTERVIEW +struct alter_view { MSIVIEW view; MSIDATABASE *db; MSIVIEW *table; column_info *colinfo; INT hold; -} MSIALTERVIEW; +}; static UINT ALTER_fetch_int( struct tagMSIVIEW *view, UINT row, UINT col, UINT *val ) { - MSIALTERVIEW *av = (MSIALTERVIEW*)view; + struct alter_view *av = (struct alter_view *)view; TRACE("%p %d %d %p\n", av, row, col, val ); @@ -54,7 +54,7 @@ static UINT ALTER_fetch_int( struct tagMSIVIEW *view, UINT row, UINT col, UINT * static UINT ALTER_fetch_stream( struct tagMSIVIEW *view, UINT row, UINT col, IStream **stm) { - MSIALTERVIEW *av = (MSIALTERVIEW*)view; + struct alter_view *av = (struct alter_view *)view; TRACE("%p %d %d %p\n", av, row, col, stm ); @@ -63,7 +63,7 @@ static UINT ALTER_fetch_stream( struct tagMSIVIEW *view, UINT row, UINT col, ISt static UINT ALTER_execute( struct tagMSIVIEW *view, MSIRECORD *record ) { - MSIALTERVIEW *av = (MSIALTERVIEW*)view; + struct alter_view *av = (struct alter_view *)view; UINT ref; TRACE("%p %p\n", av, record); @@ -86,7 +86,7 @@ static UINT ALTER_execute( struct tagMSIVIEW *view, MSIRECORD *record ) static UINT ALTER_close( struct tagMSIVIEW *view ) { - MSIALTERVIEW *av = (MSIALTERVIEW*)view; + struct alter_view *av = (struct alter_view *)view; TRACE("%p\n", av ); @@ -95,7 +95,7 @@ static UINT ALTER_close( struct tagMSIVIEW *view ) static UINT ALTER_get_dimensions( struct tagMSIVIEW *view, UINT *rows, UINT *cols ) { - MSIALTERVIEW *av = (MSIALTERVIEW*)view; + struct alter_view *av = (struct alter_view *)view; TRACE("%p %p %p\n", av, rows, cols ); @@ -105,7 +105,7 @@ static UINT ALTER_get_dimensions( struct tagMSIVIEW *view, UINT *rows, UINT *col static UINT ALTER_get_column_info( struct tagMSIVIEW *view, UINT n, LPCWSTR *name, UINT *type, BOOL *temporary, LPCWSTR *table_name ) { - MSIALTERVIEW *av = (MSIALTERVIEW*)view; + struct alter_view *av = (struct alter_view *)view; TRACE("%p %d %p %p %p %p\n", av, n, name, type, temporary, table_name ); @@ -115,7 +115,7 @@ static UINT ALTER_get_column_info( struct tagMSIVIEW *view, UINT n, LPCWSTR *nam static UINT ALTER_modify( struct tagMSIVIEW *view, MSIMODIFY eModifyMode, MSIRECORD *rec, UINT row ) { - MSIALTERVIEW *av = (MSIALTERVIEW*)view; + struct alter_view *av = (struct alter_view *)view; TRACE("%p %d %p\n", av, eModifyMode, rec ); @@ -124,12 +124,12 @@ static UINT ALTER_modify( struct tagMSIVIEW *view, MSIMODIFY eModifyMode, static UINT ALTER_delete( struct tagMSIVIEW *view ) { - MSIALTERVIEW *av = (MSIALTERVIEW*)view; + struct alter_view *av = (struct alter_view *)view; TRACE("%p\n", av ); if (av->table) av->table->ops->delete( av->table ); - msi_free( av ); + free( av ); return ERROR_SUCCESS; } @@ -159,19 +159,19 @@ static const MSIVIEWOPS alter_ops = UINT ALTER_CreateView( MSIDATABASE *db, MSIVIEW **view, LPCWSTR name, column_info *colinfo, int hold ) { - MSIALTERVIEW *av; + struct alter_view *av; UINT r; TRACE("%p %p %s %d\n", view, colinfo, debugstr_w(name), hold ); - av = msi_alloc_zero( sizeof *av ); + av = calloc( 1, sizeof *av ); if( !av ) return ERROR_FUNCTION_FAILED; r = TABLE_CreateView( db, name, &av->table ); if (r != ERROR_SUCCESS) { - msi_free( av ); + free( av ); return r; } diff --git a/dll/win32/msi/appsearch.c b/dll/win32/msi/appsearch.c index 77b12156ca8d0..381e74317fee7 100644 --- a/dll/win32/msi/appsearch.c +++ b/dll/win32/msi/appsearch.c @@ -34,7 +34,7 @@ WINE_DEFAULT_DEBUG_CHANNEL(msi); -typedef struct tagMSISIGNATURE +struct signature { LPCWSTR Name; /* NOT owned by this structure */ LPWSTR File; @@ -47,7 +47,7 @@ typedef struct tagMSISIGNATURE FILETIME MinTime; FILETIME MaxTime; LPWSTR Languages; -}MSISIGNATURE; +}; void msi_parse_version_string(LPCWSTR verStr, PDWORD ms, PDWORD ls) { @@ -80,7 +80,7 @@ void msi_parse_version_string(LPCWSTR verStr, PDWORD ms, PDWORD ls) * Returns ERROR_SUCCESS upon success (where not finding the record counts as * success), something else on error. */ -static UINT get_signature( MSIPACKAGE *package, MSISIGNATURE *sig, const WCHAR *name ) +static UINT get_signature( MSIPACKAGE *package, struct signature *sig, const WCHAR *name ) { WCHAR *minVersion, *maxVersion, *p; MSIRECORD *row; @@ -109,13 +109,13 @@ static UINT get_signature( MSIPACKAGE *package, MSISIGNATURE *sig, const WCHAR * if (minVersion) { msi_parse_version_string( minVersion, &sig->MinVersionMS, &sig->MinVersionLS ); - msi_free( minVersion ); + free( minVersion ); } maxVersion = msi_dup_record_field(row,4); if (maxVersion) { msi_parse_version_string( maxVersion, &sig->MaxVersionMS, &sig->MaxVersionLS ); - msi_free( maxVersion ); + free( maxVersion ); } sig->MinSize = MSI_RecordGetInteger(row,5); if (sig->MinSize == MSI_NULL_INTEGER) @@ -148,13 +148,13 @@ static UINT get_signature( MSIPACKAGE *package, MSISIGNATURE *sig, const WCHAR * } /* Frees any memory allocated in sig */ -static void free_signature( MSISIGNATURE *sig ) +static void free_signature( struct signature *sig ) { - msi_free(sig->File); - msi_free(sig->Languages); + free(sig->File); + free(sig->Languages); } -static WCHAR *search_file( MSIPACKAGE *package, WCHAR *path, MSISIGNATURE *sig ) +static WCHAR *search_file( MSIPACKAGE *package, WCHAR *path, struct signature *sig ) { VS_FIXEDFILEINFO *info; DWORD attr; @@ -169,7 +169,7 @@ static WCHAR *search_file( MSIPACKAGE *package, WCHAR *path, MSISIGNATURE *sig ) attr = msi_get_file_attributes( package, path ); if (attr != INVALID_FILE_ATTRIBUTES && (attr & FILE_ATTRIBUTE_DIRECTORY)) - return strdupW(path); + return wcsdup(path); return NULL; } @@ -180,9 +180,9 @@ static WCHAR *search_file( MSIPACKAGE *package, WCHAR *path, MSISIGNATURE *sig ) size = msi_get_file_version_info( package, path, 0, NULL ); if (!size) - return strdupW(path); + return wcsdup(path); - buffer = msi_alloc(size); + buffer = malloc(size); if (!buffer) return NULL; @@ -213,14 +213,14 @@ static WCHAR *search_file( MSIPACKAGE *package, WCHAR *path, MSISIGNATURE *sig ) goto done; } - val = strdupW(path); + val = wcsdup(path); done: - msi_free(buffer); + free(buffer); return val; } -static UINT search_components( MSIPACKAGE *package, WCHAR **appValue, MSISIGNATURE *sig ) +static UINT search_components( MSIPACKAGE *package, WCHAR **appValue, struct signature *sig ) { MSIRECORD *row, *rec; LPCWSTR signature, guid; @@ -276,7 +276,7 @@ static UINT search_components( MSIPACKAGE *package, WCHAR **appValue, MSISIGNATU else PathAddBackslashW(path); - *appValue = strdupW(path); + *appValue = wcsdup(path); } else if (sigpresent) { @@ -285,7 +285,7 @@ static UINT search_components( MSIPACKAGE *package, WCHAR **appValue, MSISIGNATU attr = msi_get_file_attributes( package, path ); if (attr != INVALID_FILE_ATTRIBUTES && !(attr & FILE_ATTRIBUTE_DIRECTORY)) - *appValue = strdupW(path); + *appValue = wcsdup(path); } done: @@ -305,13 +305,13 @@ static void convert_reg_value( DWORD regType, const BYTE *value, DWORD sz, WCHAR if (*(LPCWSTR)value == '#') { /* escape leading pound with another */ - *appValue = msi_alloc(sz + sizeof(WCHAR)); + *appValue = malloc(sz + sizeof(WCHAR)); (*appValue)[0] = '#'; lstrcpyW(*appValue + 1, (LPCWSTR)value); } else { - *appValue = msi_alloc(sz); + *appValue = malloc(sz); lstrcpyW(*appValue, (LPCWSTR)value); } break; @@ -319,17 +319,17 @@ static void convert_reg_value( DWORD regType, const BYTE *value, DWORD sz, WCHAR /* 7 chars for digits, 1 for NULL, 1 for #, and 1 for sign * char if needed */ - *appValue = msi_alloc(10 * sizeof(WCHAR)); + *appValue = malloc(10 * sizeof(WCHAR)); swprintf(*appValue, 10, L"#%d", *(const DWORD *)value); break; case REG_EXPAND_SZ: sz = ExpandEnvironmentStringsW((LPCWSTR)value, NULL, 0); - *appValue = msi_alloc(sz * sizeof(WCHAR)); + *appValue = malloc(sz * sizeof(WCHAR)); ExpandEnvironmentStringsW((LPCWSTR)value, *appValue, sz); break; case REG_BINARY: /* #x\0 */ - *appValue = msi_alloc((sz * 2 + 3) * sizeof(WCHAR)); + *appValue = malloc((sz * 2 + 3) * sizeof(WCHAR)); lstrcpyW(*appValue, L"#x"); ptr = *appValue + lstrlenW(L"#x"); for (i = 0; i < sz; i++, ptr += 2) @@ -341,9 +341,9 @@ static void convert_reg_value( DWORD regType, const BYTE *value, DWORD sz, WCHAR } } -static UINT search_directory( MSIPACKAGE *, MSISIGNATURE *, const WCHAR *, int, WCHAR ** ); +static UINT search_directory( MSIPACKAGE *, struct signature *, const WCHAR *, int, WCHAR ** ); -static UINT search_reg( MSIPACKAGE *package, WCHAR **appValue, MSISIGNATURE *sig ) +static UINT search_reg( MSIPACKAGE *package, WCHAR **appValue, struct signature *sig ) { const WCHAR *keyPath, *valueName; WCHAR *deformatted = NULL, *ptr = NULL, *end; @@ -401,7 +401,7 @@ static UINT search_reg( MSIPACKAGE *package, WCHAR **appValue, MSISIGNATURE *sig goto end; } - msi_free(deformatted); + free(deformatted); deformat_string(package, valueName, &deformatted); rc = RegQueryValueExW(key, deformatted, NULL, NULL, NULL, &sz); @@ -413,7 +413,7 @@ static UINT search_reg( MSIPACKAGE *package, WCHAR **appValue, MSISIGNATURE *sig /* FIXME: sanity-check sz before allocating (is there an upper-limit * on the value of a property?) */ - value = msi_alloc( sz ); + value = malloc(sz); rc = RegQueryValueExW(key, deformatted, NULL, ®Type, value, &sz); if (rc) { @@ -431,9 +431,9 @@ static UINT search_reg( MSIPACKAGE *package, WCHAR **appValue, MSISIGNATURE *sig sz = ExpandEnvironmentStringsW((LPCWSTR)value, NULL, 0); if (sz) { - LPWSTR buf = msi_alloc(sz * sizeof(WCHAR)); + WCHAR *buf = malloc(sz * sizeof(WCHAR)); ExpandEnvironmentStringsW((LPCWSTR)value, buf, sz); - msi_free(value); + free(value); value = (LPBYTE)buf; } } @@ -460,9 +460,9 @@ static UINT search_reg( MSIPACKAGE *package, WCHAR **appValue, MSISIGNATURE *sig type, debugstr_w(keyPath), debugstr_w(valueName)); } end: - msi_free( value ); + free( value ); RegCloseKey( key ); - msi_free( deformatted ); + free( deformatted ); msiobj_release(&row->hdr); return ERROR_SUCCESS; @@ -474,7 +474,7 @@ static LPWSTR get_ini_field(LPWSTR buf, int field) int i = 1; if (field == 0) - return strdupW(buf); + return wcsdup(buf); beg = buf; while ((end = wcschr(beg, ',')) && i < field) @@ -491,10 +491,10 @@ static LPWSTR get_ini_field(LPWSTR buf, int field) end = beg + lstrlenW(beg); *end = '\0'; - return strdupW(beg); + return wcsdup(beg); } -static UINT search_ini( MSIPACKAGE *package, WCHAR **appValue, MSISIGNATURE *sig ) +static UINT search_ini( MSIPACKAGE *package, WCHAR **appValue, struct signature *sig ) { MSIRECORD *row; LPWSTR fileName, section, key; @@ -539,9 +539,9 @@ static UINT search_ini( MSIPACKAGE *package, WCHAR **appValue, MSISIGNATURE *sig } } - msi_free(fileName); - msi_free(section); - msi_free(key); + free(fileName); + free(section); + free(key); msiobj_release(&row->hdr); @@ -578,27 +578,27 @@ static void expand_any_path( MSIPACKAGE *package, WCHAR *src, WCHAR *dst, size_t deformat_string(package, ptr, &deformatted); if (!deformatted || lstrlenW(deformatted) > len - 1) { - msi_free(deformatted); + free(deformatted); return; } lstrcpyW(dst, deformatted); dst[lstrlenW(deformatted)] = '\0'; - msi_free(deformatted); + free(deformatted); } static LANGID *parse_languages( const WCHAR *languages, DWORD *num_ids ) { UINT i, count = 1; - WCHAR *str = strdupW( languages ), *p, *q; + WCHAR *str = wcsdup( languages ), *p, *q; LANGID *ret; if (!str) return NULL; for (p = q = str; (q = wcschr( q, ',' )); q++) count++; - if (!(ret = msi_alloc( count * sizeof(LANGID) ))) + if (!(ret = malloc( count * sizeof(LANGID) ))) { - msi_free( str ); + free( str ); return NULL; } i = 0; @@ -611,7 +611,7 @@ static LANGID *parse_languages( const WCHAR *languages, DWORD *num_ids ) p = q + 1; i++; } - msi_free( str ); + free( str ); *num_ids = count; return ret; } @@ -643,7 +643,7 @@ static BOOL match_languages( const void *version, const WCHAR *languages ) } done: - msi_free( ids ); + free( ids ); return found; } @@ -652,7 +652,7 @@ static BOOL match_languages( const void *version, const WCHAR *languages ) * Return ERROR_SUCCESS in case of success (whether or not the file matches), * something else if an install-halting error occurs. */ -static UINT file_version_matches( MSIPACKAGE *package, const MSISIGNATURE *sig, const WCHAR *filePath, +static UINT file_version_matches( MSIPACKAGE *package, const struct signature *sig, const WCHAR *filePath, BOOL *matches ) { UINT len; @@ -663,7 +663,7 @@ static UINT file_version_matches( MSIPACKAGE *package, const MSISIGNATURE *sig, *matches = FALSE; if (!size) return ERROR_SUCCESS; - if (!(version = msi_alloc( size ))) return ERROR_OUTOFMEMORY; + if (!(version = malloc( size ))) return ERROR_OUTOFMEMORY; if (msi_get_file_version_info( package, filePath, size, version )) VerQueryValueW( version, L"\\", (void **)&info, &len ); @@ -702,7 +702,7 @@ static UINT file_version_matches( MSIPACKAGE *package, const MSISIGNATURE *sig, } else *matches = TRUE; } - msi_free( version ); + free( version ); return ERROR_SUCCESS; } @@ -712,7 +712,7 @@ static UINT file_version_matches( MSIPACKAGE *package, const MSISIGNATURE *sig, * Return ERROR_SUCCESS in case of success (whether or not the file matches), * something else if an install-halting error occurs. */ -static UINT file_matches_sig( MSIPACKAGE *package, const MSISIGNATURE *sig, const WIN32_FIND_DATAW *findData, +static UINT file_matches_sig( MSIPACKAGE *package, const struct signature *sig, const WIN32_FIND_DATAW *findData, const WCHAR *fullFilePath, BOOL *matches ) { UINT rc = ERROR_SUCCESS; @@ -757,7 +757,7 @@ static UINT file_matches_sig( MSIPACKAGE *package, const MSISIGNATURE *sig, cons * Returns ERROR_SUCCESS on success (which may include non-critical errors), * something else on failures which should halt the install. */ -static UINT recurse_search_directory( MSIPACKAGE *package, WCHAR **appValue, MSISIGNATURE *sig, const WCHAR *dir, +static UINT recurse_search_directory( MSIPACKAGE *package, WCHAR **appValue, struct signature *sig, const WCHAR *dir, int depth ) { HANDLE hFind; @@ -779,7 +779,7 @@ static UINT recurse_search_directory( MSIPACKAGE *package, WCHAR **appValue, MSI * isn't backslash-terminated. */ len = dirLen + max(fileLen, lstrlenW(L"*.*")) + 2; - buf = msi_alloc(len * sizeof(WCHAR)); + buf = malloc(len * sizeof(WCHAR)); if (!buf) return ERROR_OUTOFMEMORY; @@ -839,7 +839,7 @@ static UINT recurse_search_directory( MSIPACKAGE *package, WCHAR **appValue, MSI } if (*appValue != buf) - msi_free(buf); + free(buf); return rc; } @@ -851,7 +851,7 @@ static UINT check_directory( MSIPACKAGE *package, const WCHAR *dir, WCHAR **appV if (attr != INVALID_FILE_ATTRIBUTES && (attr & FILE_ATTRIBUTE_DIRECTORY)) { TRACE("directory exists, returning %s\n", debugstr_w(dir)); - *appValue = strdupW(dir); + *appValue = wcsdup(dir); } return ERROR_SUCCESS; @@ -871,11 +871,11 @@ static BOOL is_full_path( const WCHAR *path ) return ret; } -static UINT search_directory( MSIPACKAGE *package, MSISIGNATURE *sig, const WCHAR *path, int depth, WCHAR **appValue ) +static UINT search_directory( MSIPACKAGE *package, struct signature *sig, const WCHAR *path, int depth, WCHAR **appValue ) { UINT rc; DWORD attr; - LPWSTR val = NULL; + WCHAR *val = NULL, *new_val; TRACE("%p, %p, %s, %d, %p\n", package, sig, debugstr_w(path), depth, appValue); @@ -920,11 +920,18 @@ static UINT search_directory( MSIPACKAGE *package, MSISIGNATURE *sig, const WCHA if (attr != INVALID_FILE_ATTRIBUTES && (attr & FILE_ATTRIBUTE_DIRECTORY) && val && val[lstrlenW(val) - 1] != '\\') { - val = msi_realloc(val, (lstrlenW(val) + 2) * sizeof(WCHAR)); - if (!val) + new_val = realloc(val, (wcslen(val) + 2) * sizeof(WCHAR)); + if (!new_val) + { + free(val); + val = NULL; rc = ERROR_OUTOFMEMORY; + } else + { + val = new_val; PathAddBackslashW(val); + } } *appValue = val; @@ -933,9 +940,9 @@ static UINT search_directory( MSIPACKAGE *package, MSISIGNATURE *sig, const WCHA return rc; } -static UINT search_sig_name( MSIPACKAGE *, const WCHAR *, MSISIGNATURE *, WCHAR ** ); +static UINT search_sig_name( MSIPACKAGE *, const WCHAR *, struct signature *, WCHAR ** ); -static UINT search_dr( MSIPACKAGE *package, WCHAR **appValue, MSISIGNATURE *sig ) +static UINT search_dr( MSIPACKAGE *package, WCHAR **appValue, struct signature *sig ) { LPWSTR parent = NULL; LPCWSTR parentName; @@ -961,7 +968,7 @@ static UINT search_dr( MSIPACKAGE *package, WCHAR **appValue, MSISIGNATURE *sig parentName = MSI_RecordGetString(row, 2); if (parentName) { - MSISIGNATURE parentSig; + struct signature parentSig; search_sig_name( package, parentName, &parentSig, &parent ); free_signature( &parentSig ); @@ -1004,13 +1011,13 @@ static UINT search_dr( MSIPACKAGE *package, WCHAR **appValue, MSISIGNATURE *sig rc = search_directory( package, sig, path, depth, appValue ); - msi_free(parent); + free(parent); msiobj_release(&row->hdr); TRACE("returning %d\n", rc); return rc; } -static UINT search_sig_name( MSIPACKAGE *package, const WCHAR *sigName, MSISIGNATURE *sig, WCHAR **appValue ) +static UINT search_sig_name( MSIPACKAGE *package, const WCHAR *sigName, struct signature *sig, WCHAR **appValue ) { UINT rc; @@ -1038,7 +1045,7 @@ static UINT ITERATE_AppSearch(MSIRECORD *row, LPVOID param) MSIPACKAGE *package = param; LPCWSTR propName, sigName; LPWSTR value = NULL; - MSISIGNATURE sig; + struct signature sig; MSIRECORD *uirow; UINT r; @@ -1055,7 +1062,7 @@ static UINT ITERATE_AppSearch(MSIRECORD *row, LPVOID param) if (r == ERROR_SUCCESS && !wcscmp( propName, L"SourceDir" )) msi_reset_source_folders( package ); - msi_free(value); + free(value); } free_signature( &sig ); @@ -1095,7 +1102,7 @@ static UINT ITERATE_CCPSearch(MSIRECORD *row, LPVOID param) MSIPACKAGE *package = param; LPCWSTR signature; LPWSTR value = NULL; - MSISIGNATURE sig; + struct signature sig; UINT r = ERROR_SUCCESS; signature = MSI_RecordGetString(row, 1); @@ -1107,7 +1114,7 @@ static UINT ITERATE_CCPSearch(MSIRECORD *row, LPVOID param) { TRACE("Found signature %s\n", debugstr_w(signature)); msi_set_property( package->db, L"CCP_Success", L"1", -1 ); - msi_free(value); + free(value); r = ERROR_NO_MORE_ITEMS; } diff --git a/dll/win32/msi/assembly.c b/dll/win32/msi/assembly.c index 9f75a9c028152..47e8071502c83 100644 --- a/dll/win32/msi/assembly.c +++ b/dll/win32/msi/assembly.c @@ -30,55 +30,52 @@ WINE_DEFAULT_DEBUG_CHANNEL(msi); -static BOOL load_fusion_dlls( MSIPACKAGE *package ) +static void load_fusion_dlls( MSIPACKAGE *package ) { HRESULT (WINAPI *pLoadLibraryShim)( const WCHAR *, const WCHAR *, void *, HMODULE * ); WCHAR path[MAX_PATH]; DWORD len = GetSystemDirectoryW( path, MAX_PATH ); lstrcpyW( path + len, L"\\mscoree.dll" ); - if (package->hmscoree || !(package->hmscoree = LoadLibraryW( path ))) return TRUE; + if (!package->hmscoree && !(package->hmscoree = LoadLibraryW( path ))) return; if (!(pLoadLibraryShim = (void *)GetProcAddress( package->hmscoree, "LoadLibraryShim" ))) { FreeLibrary( package->hmscoree ); package->hmscoree = NULL; - return TRUE; + return; } - pLoadLibraryShim( L"fusion.dll", L"v1.0.3705", NULL, &package->hfusion10 ); - pLoadLibraryShim( L"fusion.dll", L"v1.1.4322", NULL, &package->hfusion11 ); - pLoadLibraryShim( L"fusion.dll", L"v2.0.50727", NULL, &package->hfusion20 ); - pLoadLibraryShim( L"fusion.dll", L"v4.0.30319", NULL, &package->hfusion40 ); - - return TRUE; + if (!package->hfusion10) pLoadLibraryShim( L"fusion.dll", L"v1.0.3705", NULL, &package->hfusion10 ); + if (!package->hfusion11) pLoadLibraryShim( L"fusion.dll", L"v1.1.4322", NULL, &package->hfusion11 ); + if (!package->hfusion20) pLoadLibraryShim( L"fusion.dll", L"v2.0.50727", NULL, &package->hfusion20 ); + if (!package->hfusion40) pLoadLibraryShim( L"fusion.dll", L"v4.0.30319", NULL, &package->hfusion40 ); } -BOOL msi_init_assembly_caches( MSIPACKAGE *package ) +static BOOL init_assembly_caches( MSIPACKAGE *package ) { HRESULT (WINAPI *pCreateAssemblyCache)( IAssemblyCache **, DWORD ); - if (package->cache_sxs) return TRUE; - if (CreateAssemblyCache( &package->cache_sxs, 0 ) != S_OK) return FALSE; + if (!package->cache_sxs && CreateAssemblyCache( &package->cache_sxs, 0 ) != S_OK) return FALSE; - if (!load_fusion_dlls( package )) return FALSE; + load_fusion_dlls( package ); package->pGetFileVersion = (void *)GetProcAddress( package->hmscoree, "GetFileVersion" ); /* missing from v1.0.3705 */ - if (package->hfusion10) + if (package->hfusion10 && !package->cache_net[CLR_VERSION_V10]) { pCreateAssemblyCache = (void *)GetProcAddress( package->hfusion10, "CreateAssemblyCache" ); pCreateAssemblyCache( &package->cache_net[CLR_VERSION_V10], 0 ); } - if (package->hfusion11) + if (package->hfusion11 && !package->cache_net[CLR_VERSION_V11]) { pCreateAssemblyCache = (void *)GetProcAddress( package->hfusion11, "CreateAssemblyCache" ); pCreateAssemblyCache( &package->cache_net[CLR_VERSION_V11], 0 ); } - if (package->hfusion20) + if (package->hfusion20 && !package->cache_net[CLR_VERSION_V20]) { pCreateAssemblyCache = (void *)GetProcAddress( package->hfusion20, "CreateAssemblyCache" ); pCreateAssemblyCache( &package->cache_net[CLR_VERSION_V20], 0 ); } - if (package->hfusion40) + if (package->hfusion40 && !package->cache_net[CLR_VERSION_V40]) { pCreateAssemblyCache = (void *)GetProcAddress( package->hfusion40, "CreateAssemblyCache" ); pCreateAssemblyCache( &package->cache_net[CLR_VERSION_V40], 0 ); @@ -164,7 +161,7 @@ static UINT get_assembly_name_attribute( MSIRECORD *rec, LPVOID param ) const WCHAR *value = MSI_RecordGetString( rec, 3 ); int len = lstrlenW( L"%s=\"%s\"" ) + lstrlenW( attr ) + lstrlenW( value ); - if (!(name->attrs[name->index] = msi_alloc( len * sizeof(WCHAR) ))) + if (!(name->attrs[name->index] = malloc( len * sizeof(WCHAR) ))) return ERROR_OUTOFMEMORY; if (!wcsicmp( attr, L"name" )) lstrcpyW( name->attrs[name->index++], value ); @@ -190,7 +187,7 @@ static WCHAR *get_assembly_display_name( MSIDATABASE *db, const WCHAR *comp, MSI MSI_IterateRecords( view, &name.count, NULL, NULL ); if (!name.count) goto done; - name.attrs = msi_alloc( name.count * sizeof(WCHAR *) ); + name.attrs = malloc( name.count * sizeof(WCHAR *) ); if (!name.attrs) goto done; MSI_IterateRecords( view, NULL, get_assembly_name_attribute, &name ); @@ -198,7 +195,7 @@ static WCHAR *get_assembly_display_name( MSIDATABASE *db, const WCHAR *comp, MSI len = 0; for (i = 0; i < name.count; i++) len += lstrlenW( name.attrs[i] ) + 1; - display_name = msi_alloc( (len + 1) * sizeof(WCHAR) ); + display_name = malloc( (len + 1) * sizeof(WCHAR) ); if (display_name) { display_name[0] = 0; @@ -213,49 +210,31 @@ static WCHAR *get_assembly_display_name( MSIDATABASE *db, const WCHAR *comp, MSI msiobj_release( &view->hdr ); if (name.attrs) { - for (i = 0; i < name.count; i++) msi_free( name.attrs[i] ); - msi_free( name.attrs ); + for (i = 0; i < name.count; i++) free( name.attrs[i] ); + free( name.attrs ); } return display_name; } -static BOOL is_assembly_installed( IAssemblyCache *cache, const WCHAR *display_name ) -{ - HRESULT hr; - ASSEMBLY_INFO info; - - if (!cache) return FALSE; - - memset( &info, 0, sizeof(info) ); - info.cbAssemblyInfo = sizeof(info); - hr = IAssemblyCache_QueryAssemblyInfo( cache, 0, display_name, &info ); - if (hr == S_OK /* sxs version */ || hr == E_NOT_SUFFICIENT_BUFFER) - { - return (info.dwAssemblyFlags == ASSEMBLYINFO_FLAG_INSTALLED); - } - TRACE( "QueryAssemblyInfo returned %#lx\n", hr ); - return FALSE; -} - WCHAR *msi_get_assembly_path( MSIPACKAGE *package, const WCHAR *displayname ) { HRESULT hr; ASSEMBLY_INFO info; - IAssemblyCache *cache = package->cache_net[CLR_VERSION_V40]; + IAssemblyCache *cache; - if (!cache) return NULL; + if (!init_assembly_caches( package ) || !(cache = package->cache_net[CLR_VERSION_V40])) return NULL; memset( &info, 0, sizeof(info) ); info.cbAssemblyInfo = sizeof(info); hr = IAssemblyCache_QueryAssemblyInfo( cache, 0, displayname, &info ); if (hr != E_NOT_SUFFICIENT_BUFFER) return NULL; - if (!(info.pszCurrentAssemblyPathBuf = msi_alloc( info.cchBuf * sizeof(WCHAR) ))) return NULL; + if (!(info.pszCurrentAssemblyPathBuf = malloc( info.cchBuf * sizeof(WCHAR) ))) return NULL; hr = IAssemblyCache_QueryAssemblyInfo( cache, 0, displayname, &info ); if (FAILED( hr )) { - msi_free( info.pszCurrentAssemblyPathBuf ); + free( info.pszCurrentAssemblyPathBuf ); return NULL; } TRACE("returning %s\n", debugstr_w(info.pszCurrentAssemblyPathBuf)); @@ -270,13 +249,14 @@ IAssemblyEnum *msi_create_assembly_enum( MSIPACKAGE *package, const WCHAR *displ WCHAR *str; DWORD len = 0; - if (!package->pCreateAssemblyNameObject || !package->pCreateAssemblyEnum) return NULL; + if (!init_assembly_caches( package ) || !package->pCreateAssemblyNameObject || !package->pCreateAssemblyEnum) + return NULL; hr = package->pCreateAssemblyNameObject( &name, displayname, CANOF_PARSE_DISPLAY_NAME, NULL ); if (FAILED( hr )) return NULL; hr = IAssemblyName_GetName( name, &len, NULL ); - if (hr != E_NOT_SUFFICIENT_BUFFER || !(str = msi_alloc( len * sizeof(WCHAR) ))) + if (hr != E_NOT_SUFFICIENT_BUFFER || !(str = malloc( len * sizeof(WCHAR) ))) { IAssemblyName_Release( name ); return NULL; @@ -286,12 +266,12 @@ IAssemblyEnum *msi_create_assembly_enum( MSIPACKAGE *package, const WCHAR *displ IAssemblyName_Release( name ); if (FAILED( hr )) { - msi_free( str ); + free( str ); return NULL; } hr = package->pCreateAssemblyNameObject( &name, str, 0, NULL ); - msi_free( str ); + free( str ); if (FAILED( hr )) return NULL; hr = package->pCreateAssemblyEnum( &ret, NULL, name, ASM_CACHE_GAC, NULL ); @@ -309,31 +289,24 @@ static const WCHAR *clr_version[] = L"v4.0.30319" }; -static const WCHAR *get_clr_version_str( enum clr_version version ) -{ - if (version >= ARRAY_SIZE( clr_version )) return L"unknown"; - return clr_version[version]; -} - -/* assembly caches must be initialized */ MSIASSEMBLY *msi_load_assembly( MSIPACKAGE *package, MSICOMPONENT *comp ) { MSIRECORD *rec; MSIASSEMBLY *a; if (!(rec = get_assembly_record( package, comp->Component ))) return NULL; - if (!(a = msi_alloc_zero( sizeof(MSIASSEMBLY) ))) + if (!(a = calloc( 1, sizeof(MSIASSEMBLY) ))) { msiobj_release( &rec->hdr ); return NULL; } - a->feature = strdupW( MSI_RecordGetString( rec, 2 ) ); + a->feature = wcsdup( MSI_RecordGetString( rec, 2 ) ); TRACE("feature %s\n", debugstr_w(a->feature)); - a->manifest = strdupW( MSI_RecordGetString( rec, 3 ) ); + a->manifest = wcsdup( MSI_RecordGetString( rec, 3 ) ); TRACE("manifest %s\n", debugstr_w(a->manifest)); - a->application = strdupW( MSI_RecordGetString( rec, 4 ) ); + a->application = wcsdup( MSI_RecordGetString( rec, 4 ) ); TRACE("application %s\n", debugstr_w(a->application)); a->attributes = MSI_RecordGetInteger( rec, 5 ); @@ -343,42 +316,14 @@ MSIASSEMBLY *msi_load_assembly( MSIPACKAGE *package, MSICOMPONENT *comp ) { WARN("can't get display name\n"); msiobj_release( &rec->hdr ); - msi_free( a->feature ); - msi_free( a->manifest ); - msi_free( a->application ); - msi_free( a ); + free( a->feature ); + free( a->manifest ); + free( a->application ); + free( a ); return NULL; } TRACE("display name %s\n", debugstr_w(a->display_name)); - if (a->application) - { - /* We can't check the manifest here because the target path may still change. - So we assume that the assembly is not installed and lean on the InstallFiles - action to determine which files need to be installed. - */ - a->installed = FALSE; - } - else - { - if (a->attributes == msidbAssemblyAttributesWin32) - a->installed = is_assembly_installed( package->cache_sxs, a->display_name ); - else - { - UINT i; - for (i = 0; i < CLR_VERSION_MAX; i++) - { - a->clr_version[i] = is_assembly_installed( package->cache_net[i], a->display_name ); - if (a->clr_version[i]) - { - TRACE("runtime version %s\n", debugstr_w(get_clr_version_str( i ))); - a->installed = TRUE; - break; - } - } - } - } - TRACE("assembly is %s\n", a->installed ? "installed" : "not installed"); msiobj_release( &rec->hdr ); return a; } @@ -394,7 +339,7 @@ static enum clr_version get_clr_version( MSIPACKAGE *package, const WCHAR *filen hr = package->pGetFileVersion( filename, NULL, 0, &len ); if (hr != E_NOT_SUFFICIENT_BUFFER) return CLR_VERSION_V11; - if ((strW = msi_alloc( len * sizeof(WCHAR) ))) + if ((strW = malloc( len * sizeof(WCHAR) ))) { hr = package->pGetFileVersion( filename, strW, len, &len ); if (hr == S_OK) @@ -403,7 +348,7 @@ static enum clr_version get_clr_version( MSIPACKAGE *package, const WCHAR *filen for (i = 0; i < CLR_VERSION_MAX; i++) if (!wcscmp( strW, clr_version[i] )) version = i; } - msi_free( strW ); + free( strW ); } return version; } @@ -416,6 +361,8 @@ UINT msi_install_assembly( MSIPACKAGE *package, MSICOMPONENT *comp ) MSIASSEMBLY *assembly = comp->assembly; MSIFEATURE *feature = NULL; + if (!init_assembly_caches( package )) return ERROR_FUNCTION_FAILED; + if (comp->assembly->feature) feature = msi_get_loaded_feature( package, comp->assembly->feature ); @@ -449,7 +396,6 @@ UINT msi_install_assembly( MSIPACKAGE *package, MSICOMPONENT *comp ) return ERROR_FUNCTION_FAILED; } if (feature) feature->Action = INSTALLSTATE_LOCAL; - assembly->installed = TRUE; return ERROR_SUCCESS; } @@ -460,6 +406,8 @@ UINT msi_uninstall_assembly( MSIPACKAGE *package, MSICOMPONENT *comp ) MSIASSEMBLY *assembly = comp->assembly; MSIFEATURE *feature = NULL; + if (!init_assembly_caches( package )) return ERROR_FUNCTION_FAILED; + if (comp->assembly->feature) feature = msi_get_loaded_feature( package, comp->assembly->feature ); @@ -491,7 +439,6 @@ UINT msi_uninstall_assembly( MSIPACKAGE *package, MSICOMPONENT *comp ) } } if (feature) feature->Action = INSTALLSTATE_ABSENT; - assembly->installed = FALSE; return ERROR_SUCCESS; } @@ -500,7 +447,7 @@ static WCHAR *build_local_assembly_path( const WCHAR *filename ) UINT i; WCHAR *ret; - if (!(ret = msi_alloc( (lstrlenW( filename ) + 1) * sizeof(WCHAR) ))) + if (!(ret = malloc( (wcslen( filename ) + 1) * sizeof(WCHAR) ))) return NULL; for (i = 0; filename[i]; i++) @@ -543,12 +490,12 @@ static LONG open_local_assembly_key( UINT context, BOOL win32, const WCHAR *file if ((res = open_assemblies_key( context, win32, &root ))) { - msi_free( path ); + free( path ); return res; } res = RegCreateKeyW( root, path, hkey ); RegCloseKey( root ); - msi_free( path ); + free( path ); return res; } @@ -563,12 +510,12 @@ static LONG delete_local_assembly_key( UINT context, BOOL win32, const WCHAR *fi if ((res = open_assemblies_key( context, win32, &root ))) { - msi_free( path ); + free( path ); return res; } res = RegDeleteKeyW( root, path ); RegCloseKey( root ); - msi_free( path ); + free( path ); return res; } diff --git a/dll/win32/msi/automation.c b/dll/win32/msi/automation.c index f8fd8cc14498b..36891cc62dad1 100644 --- a/dll/win32/msi/automation.c +++ b/dll/win32/msi/automation.c @@ -41,33 +41,30 @@ WINE_DEFAULT_DEBUG_CHANNEL(msi); #define REG_INDEX_CLASSES_ROOT 0 #define REG_INDEX_DYN_DATA 6 -typedef struct AutomationObject AutomationObject; +struct automation_object; -/* function that is called from AutomationObject::Invoke, specific to this type of object */ -typedef HRESULT (*auto_invoke_func)(AutomationObject* This, - DISPID dispIdMember, REFIID riid, LCID lcid, WORD flags, DISPPARAMS* pDispParams, - VARIANT* result, EXCEPINFO* ei, UINT* arg_err); -/* function that is called from AutomationObject::Release when the object is being freed - to free any private data structures (or NULL) */ -typedef void (*auto_free_func)(AutomationObject* This); - -typedef struct { +struct tid_id +{ REFIID riid; - auto_invoke_func fn_invoke; - auto_free_func fn_free; -} tid_id_t; - + /* function that is called from AutomationObject::Invoke, specific to this type of object */ + HRESULT (*fn_invoke)(struct automation_object *, DISPID, REFIID, LCID, WORD, DISPPARAMS *, VARIANT *, + EXCEPINFO *, UINT *); + /* function that is called from AutomationObject::Release when the object is being freed + to free any private data structures (or NULL) */ + void (*fn_free)(struct automation_object *); +}; -static HRESULT database_invoke(AutomationObject*,DISPID,REFIID,LCID,WORD,DISPPARAMS*,VARIANT*,EXCEPINFO*,UINT*); -static HRESULT installer_invoke(AutomationObject*,DISPID,REFIID,LCID,WORD,DISPPARAMS*,VARIANT*,EXCEPINFO*,UINT*); -static HRESULT record_invoke(AutomationObject*,DISPID,REFIID,LCID,WORD,DISPPARAMS*,VARIANT*,EXCEPINFO*,UINT*); -static HRESULT session_invoke(AutomationObject*,DISPID,REFIID,LCID,WORD,DISPPARAMS*,VARIANT*,EXCEPINFO*,UINT*); -static HRESULT list_invoke(AutomationObject*,DISPID,REFIID,LCID,WORD,DISPPARAMS*,VARIANT*,EXCEPINFO*,UINT*); -static void list_free(AutomationObject*); -static HRESULT summaryinfo_invoke(AutomationObject*,DISPID,REFIID,LCID,WORD,DISPPARAMS*,VARIANT*,EXCEPINFO*,UINT*); -static HRESULT view_invoke(AutomationObject*,DISPID,REFIID,LCID,WORD,DISPPARAMS*,VARIANT*,EXCEPINFO*,UINT*); +static HRESULT database_invoke(struct automation_object*,DISPID,REFIID,LCID,WORD,DISPPARAMS*,VARIANT*,EXCEPINFO*,UINT*); +static HRESULT installer_invoke(struct automation_object*,DISPID,REFIID,LCID,WORD,DISPPARAMS*,VARIANT*,EXCEPINFO*,UINT*); +static HRESULT record_invoke(struct automation_object*,DISPID,REFIID,LCID,WORD,DISPPARAMS*,VARIANT*,EXCEPINFO*,UINT*); +static HRESULT session_invoke(struct automation_object*,DISPID,REFIID,LCID,WORD,DISPPARAMS*,VARIANT*,EXCEPINFO*,UINT*); +static HRESULT list_invoke(struct automation_object*,DISPID,REFIID,LCID,WORD,DISPPARAMS*,VARIANT*,EXCEPINFO*,UINT*); +static void list_free(struct automation_object*); +static HRESULT summaryinfo_invoke(struct automation_object*,DISPID,REFIID,LCID,WORD,DISPPARAMS*,VARIANT*,EXCEPINFO*,UINT*); +static HRESULT view_invoke(struct automation_object*,DISPID,REFIID,LCID,WORD,DISPPARAMS*,VARIANT*,EXCEPINFO*,UINT*); -static tid_id_t tid_ids[] = { +static struct tid_id tid_ids[] = +{ { &DIID_Database, database_invoke }, { &DIID_Installer, installer_invoke }, { &DIID_Record, record_invoke }, @@ -137,10 +134,11 @@ void release_typelib(void) } /* - * AutomationObject - "base" class for all automation objects. For each interface, we implement Invoke function - * called from AutomationObject::Invoke. + * struct automation_object - "base" class for all automation objects. For each interface, we implement Invoke + * function called from AutomationObject::Invoke. */ -struct AutomationObject { +struct automation_object +{ IDispatch IDispatch_iface; IProvideMultipleClassInfo IProvideMultipleClassInfo_iface; LONG ref; @@ -152,46 +150,49 @@ struct AutomationObject { MSIHANDLE msiHandle; }; -typedef struct { - AutomationObject autoobj; +struct list_object +{ + struct automation_object autoobj; int count; VARIANT *data; -} ListObject; +}; static HRESULT create_database(MSIHANDLE, IDispatch**); -static HRESULT create_list_enumerator(ListObject*, void**); +static HRESULT create_list_enumerator(struct list_object *, void **); static HRESULT create_summaryinfo(MSIHANDLE, IDispatch**); static HRESULT create_view(MSIHANDLE, IDispatch**); -/* ListEnumerator - IEnumVARIANT implementation for MSI automation lists */ -typedef struct { +/* struct list_enumerator - IEnumVARIANT implementation for MSI automation lists */ +struct list_enumerator +{ IEnumVARIANT IEnumVARIANT_iface; LONG ref; - /* Current position and pointer to AutomationObject that stores actual data */ + /* Current position and pointer to struct automation_object that stores actual data */ ULONG pos; - ListObject *list; -} ListEnumerator; + struct list_object *list; +}; -typedef struct { - AutomationObject autoobj; +struct session_object +{ + struct automation_object autoobj; IDispatch *installer; -} SessionObject; +}; -static inline AutomationObject *impl_from_IProvideMultipleClassInfo( IProvideMultipleClassInfo *iface ) +static inline struct automation_object *impl_from_IProvideMultipleClassInfo( IProvideMultipleClassInfo *iface ) { - return CONTAINING_RECORD(iface, AutomationObject, IProvideMultipleClassInfo_iface); + return CONTAINING_RECORD(iface, struct automation_object, IProvideMultipleClassInfo_iface); } -static inline AutomationObject *impl_from_IDispatch( IDispatch *iface ) +static inline struct automation_object *impl_from_IDispatch( IDispatch *iface ) { - return CONTAINING_RECORD(iface, AutomationObject, IDispatch_iface); + return CONTAINING_RECORD(iface, struct automation_object, IDispatch_iface); } /* AutomationObject methods */ static HRESULT WINAPI AutomationObject_QueryInterface(IDispatch* iface, REFIID riid, void** ppvObject) { - AutomationObject *This = impl_from_IDispatch(iface); + struct automation_object *This = impl_from_IDispatch(iface); TRACE("(%p/%p)->(%s,%p)\n", iface, This, debugstr_guid(riid), ppvObject); @@ -221,7 +222,7 @@ static HRESULT WINAPI AutomationObject_QueryInterface(IDispatch* iface, REFIID r static ULONG WINAPI AutomationObject_AddRef(IDispatch* iface) { - AutomationObject *This = impl_from_IDispatch(iface); + struct automation_object *This = impl_from_IDispatch(iface); TRACE("(%p/%p)\n", iface, This); @@ -230,7 +231,7 @@ static ULONG WINAPI AutomationObject_AddRef(IDispatch* iface) static ULONG WINAPI AutomationObject_Release(IDispatch* iface) { - AutomationObject *This = impl_from_IDispatch(iface); + struct automation_object *This = impl_from_IDispatch(iface); ULONG ref = InterlockedDecrement(&This->ref); TRACE("(%p/%p)\n", iface, This); @@ -239,7 +240,7 @@ static ULONG WINAPI AutomationObject_Release(IDispatch* iface) { if (tid_ids[This->tid].fn_free) tid_ids[This->tid].fn_free(This); MsiCloseHandle(This->msiHandle); - msi_free(This); + free(This); } return ref; @@ -249,7 +250,7 @@ static HRESULT WINAPI AutomationObject_GetTypeInfoCount( IDispatch* iface, UINT* pctinfo) { - AutomationObject *This = impl_from_IDispatch(iface); + struct automation_object *This = impl_from_IDispatch(iface); TRACE("(%p/%p)->(%p)\n", iface, This, pctinfo); *pctinfo = 1; @@ -262,7 +263,7 @@ static HRESULT WINAPI AutomationObject_GetTypeInfo( LCID lcid, ITypeInfo** ppTInfo) { - AutomationObject *This = impl_from_IDispatch(iface); + struct automation_object *This = impl_from_IDispatch(iface); HRESULT hr; TRACE( "(%p/%p)->(%u, %ld, %p)\n", iface, This, iTInfo, lcid, ppTInfo ); @@ -283,7 +284,7 @@ static HRESULT WINAPI AutomationObject_GetIDsOfNames( LCID lcid, DISPID* rgDispId) { - AutomationObject *This = impl_from_IDispatch(iface); + struct automation_object *This = impl_from_IDispatch(iface); ITypeInfo *ti; HRESULT hr; @@ -324,7 +325,7 @@ static HRESULT WINAPI AutomationObject_Invoke( EXCEPINFO* pExcepInfo, UINT* puArgErr) { - AutomationObject *This = impl_from_IDispatch(iface); + struct automation_object *This = impl_from_IDispatch(iface); HRESULT hr; unsigned int uArgErr; VARIANT varResultDummy; @@ -437,25 +438,25 @@ static HRESULT WINAPI ProvideMultipleClassInfo_QueryInterface( REFIID riid, VOID** ppvoid) { - AutomationObject *This = impl_from_IProvideMultipleClassInfo(iface); + struct automation_object *This = impl_from_IProvideMultipleClassInfo(iface); return IDispatch_QueryInterface(&This->IDispatch_iface, riid, ppvoid); } static ULONG WINAPI ProvideMultipleClassInfo_AddRef(IProvideMultipleClassInfo* iface) { - AutomationObject *This = impl_from_IProvideMultipleClassInfo(iface); + struct automation_object *This = impl_from_IProvideMultipleClassInfo(iface); return IDispatch_AddRef(&This->IDispatch_iface); } static ULONG WINAPI ProvideMultipleClassInfo_Release(IProvideMultipleClassInfo* iface) { - AutomationObject *This = impl_from_IProvideMultipleClassInfo(iface); + struct automation_object *This = impl_from_IProvideMultipleClassInfo(iface); return IDispatch_Release(&This->IDispatch_iface); } static HRESULT WINAPI ProvideMultipleClassInfo_GetClassInfo(IProvideMultipleClassInfo* iface, ITypeInfo** ppTI) { - AutomationObject *This = impl_from_IProvideMultipleClassInfo(iface); + struct automation_object *This = impl_from_IProvideMultipleClassInfo(iface); HRESULT hr; TRACE("(%p/%p)->(%p)\n", iface, This, ppTI); @@ -469,7 +470,7 @@ static HRESULT WINAPI ProvideMultipleClassInfo_GetClassInfo(IProvideMultipleClas static HRESULT WINAPI ProvideMultipleClassInfo_GetGUID(IProvideMultipleClassInfo* iface, DWORD dwGuidKind, GUID* pGUID) { - AutomationObject *This = impl_from_IProvideMultipleClassInfo(iface); + struct automation_object *This = impl_from_IProvideMultipleClassInfo(iface); TRACE("(%p/%p)->(%lu, %s)\n", iface, This, dwGuidKind, debugstr_guid(pGUID)); if (dwGuidKind != GUIDKIND_DEFAULT_SOURCE_DISP_IID) @@ -482,7 +483,7 @@ static HRESULT WINAPI ProvideMultipleClassInfo_GetGUID(IProvideMultipleClassInfo static HRESULT WINAPI ProvideMultipleClassInfo_GetMultiTypeInfoCount(IProvideMultipleClassInfo* iface, ULONG* pcti) { - AutomationObject *This = impl_from_IProvideMultipleClassInfo(iface); + struct automation_object *This = impl_from_IProvideMultipleClassInfo(iface); TRACE("(%p/%p)->(%p)\n", iface, This, pcti); *pcti = 1; @@ -498,7 +499,7 @@ static HRESULT WINAPI ProvideMultipleClassInfo_GetInfoOfIndex(IProvideMultipleCl IID* piidPrimary, IID* piidSource) { - AutomationObject *This = impl_from_IProvideMultipleClassInfo(iface); + struct automation_object *This = impl_from_IProvideMultipleClassInfo(iface); TRACE("(%p/%p)->(%lu, %#lx, %p, %p, %p, %p, %p)\n", iface, This, iti, dwFlags, ti, pdwTIFlags, pcdispidReserved, piidPrimary, piidSource); @@ -541,7 +542,7 @@ static const IProvideMultipleClassInfoVtbl ProvideMultipleClassInfoVtbl = ProvideMultipleClassInfo_GetInfoOfIndex }; -static void init_automation_object(AutomationObject *This, MSIHANDLE msiHandle, tid_t tid) +static void init_automation_object(struct automation_object *This, MSIHANDLE msiHandle, tid_t tid) { TRACE("%p, %lu, %s\n", This, msiHandle, debugstr_guid(get_riid_from_tid(tid))); @@ -556,15 +557,15 @@ static void init_automation_object(AutomationObject *This, MSIHANDLE msiHandle, * ListEnumerator methods */ -static inline ListEnumerator *impl_from_IEnumVARIANT(IEnumVARIANT* iface) +static inline struct list_enumerator *impl_from_IEnumVARIANT(IEnumVARIANT* iface) { - return CONTAINING_RECORD(iface, ListEnumerator, IEnumVARIANT_iface); + return CONTAINING_RECORD(iface, struct list_enumerator, IEnumVARIANT_iface); } static HRESULT WINAPI ListEnumerator_QueryInterface(IEnumVARIANT* iface, REFIID riid, void** ppvObject) { - ListEnumerator *This = impl_from_IEnumVARIANT(iface); + struct list_enumerator *This = impl_from_IEnumVARIANT(iface); TRACE("(%p/%p)->(%s,%p)\n", iface, This, debugstr_guid(riid), ppvObject); @@ -590,7 +591,7 @@ static HRESULT WINAPI ListEnumerator_QueryInterface(IEnumVARIANT* iface, REFIID static ULONG WINAPI ListEnumerator_AddRef(IEnumVARIANT* iface) { - ListEnumerator *This = impl_from_IEnumVARIANT(iface); + struct list_enumerator *This = impl_from_IEnumVARIANT(iface); TRACE("(%p/%p)\n", iface, This); @@ -599,7 +600,7 @@ static ULONG WINAPI ListEnumerator_AddRef(IEnumVARIANT* iface) static ULONG WINAPI ListEnumerator_Release(IEnumVARIANT* iface) { - ListEnumerator *This = impl_from_IEnumVARIANT(iface); + struct list_enumerator *This = impl_from_IEnumVARIANT(iface); ULONG ref = InterlockedDecrement(&This->ref); TRACE("(%p/%p)\n", iface, This); @@ -607,7 +608,7 @@ static ULONG WINAPI ListEnumerator_Release(IEnumVARIANT* iface) if (!ref) { if (This->list) IDispatch_Release(&This->list->autoobj.IDispatch_iface); - msi_free(This); + free(This); } return ref; @@ -616,7 +617,7 @@ static ULONG WINAPI ListEnumerator_Release(IEnumVARIANT* iface) static HRESULT WINAPI ListEnumerator_Next(IEnumVARIANT* iface, ULONG celt, VARIANT* rgVar, ULONG* fetched) { - ListEnumerator *This = impl_from_IEnumVARIANT(iface); + struct list_enumerator *This = impl_from_IEnumVARIANT(iface); ULONG i, local; TRACE("%p, %lu, %p, %p\n", iface, celt, rgVar, fetched); @@ -640,7 +641,7 @@ static HRESULT WINAPI ListEnumerator_Next(IEnumVARIANT* iface, ULONG celt, VARIA static HRESULT WINAPI ListEnumerator_Skip(IEnumVARIANT* iface, ULONG celt) { - ListEnumerator *This = impl_from_IEnumVARIANT(iface); + struct list_enumerator *This = impl_from_IEnumVARIANT(iface); TRACE("%p, %lu\n", iface, celt); @@ -656,7 +657,7 @@ static HRESULT WINAPI ListEnumerator_Skip(IEnumVARIANT* iface, ULONG celt) static HRESULT WINAPI ListEnumerator_Reset(IEnumVARIANT* iface) { - ListEnumerator *This = impl_from_IEnumVARIANT(iface); + struct list_enumerator *This = impl_from_IEnumVARIANT(iface); TRACE("(%p)\n", iface); @@ -666,7 +667,7 @@ static HRESULT WINAPI ListEnumerator_Reset(IEnumVARIANT* iface) static HRESULT WINAPI ListEnumerator_Clone(IEnumVARIANT* iface, IEnumVARIANT **ppEnum) { - ListEnumerator *This = impl_from_IEnumVARIANT(iface); + struct list_enumerator *This = impl_from_IEnumVARIANT(iface); HRESULT hr; TRACE("(%p,%p)\n", iface, ppEnum); @@ -697,13 +698,13 @@ static const struct IEnumVARIANTVtbl ListEnumerator_Vtbl = }; /* Create a list enumerator, placing the result in the pointer ppObj. */ -static HRESULT create_list_enumerator(ListObject *list, void **ppObj) +static HRESULT create_list_enumerator(struct list_object *list, void **ppObj) { - ListEnumerator *object; + struct list_enumerator *object; TRACE("(%p, %p)\n", list, ppObj); - object = msi_alloc(sizeof(ListEnumerator)); + object = malloc(sizeof(*object)); /* Set all the VTable references */ object->IEnumVARIANT_iface.lpVtbl = &ListEnumerator_Vtbl; @@ -752,7 +753,7 @@ static HRESULT DispGetParam_CopyOnly( } static HRESULT summaryinfo_invoke( - AutomationObject* This, + struct automation_object *This, DISPID dispIdMember, REFIID riid, LCID lcid, @@ -807,7 +808,7 @@ static HRESULT summaryinfo_invoke( break; case VT_LPSTR: - if (!(str = msi_alloc(++size * sizeof(WCHAR)))) + if (!(str = malloc(++size * sizeof(WCHAR)))) ERR("Out of memory\n"); else if ((ret = MsiSummaryInfoGetPropertyW(This->msiHandle, V_I4(&varg0), &type, NULL, NULL, str, &size)) != ERROR_SUCCESS) @@ -817,7 +818,7 @@ static HRESULT summaryinfo_invoke( V_VT(pVarResult) = VT_BSTR; V_BSTR(pVarResult) = SysAllocString(str); } - msi_free(str); + free(str); break; case VT_FILETIME: @@ -904,7 +905,7 @@ static HRESULT summaryinfo_invoke( } static HRESULT record_invoke( - AutomationObject* This, + struct automation_object *This, DISPID dispIdMember, REFIID riid, LCID lcid, @@ -941,11 +942,11 @@ static HRESULT record_invoke( V_BSTR(pVarResult) = NULL; if ((ret = MsiRecordGetStringW(This->msiHandle, V_I4(&varg0), NULL, &dwLen)) == ERROR_SUCCESS) { - if (!(szString = msi_alloc((++dwLen)*sizeof(WCHAR)))) + if (!(szString = malloc((++dwLen) * sizeof(WCHAR)))) ERR("Out of memory\n"); else if ((ret = MsiRecordGetStringW(This->msiHandle, V_I4(&varg0), szString, &dwLen)) == ERROR_SUCCESS) V_BSTR(pVarResult) = SysAllocString(szString); - msi_free(szString); + free(szString); } if (ret != ERROR_SUCCESS) ERR("MsiRecordGetString returned %d\n", ret); @@ -996,9 +997,9 @@ static HRESULT record_invoke( static HRESULT create_record(MSIHANDLE msiHandle, IDispatch **disp) { - AutomationObject *record; + struct automation_object *record; - record = msi_alloc(sizeof(*record)); + record = malloc(sizeof(*record)); if (!record) return E_OUTOFMEMORY; init_automation_object(record, msiHandle, Record_tid); @@ -1009,7 +1010,7 @@ static HRESULT create_record(MSIHANDLE msiHandle, IDispatch **disp) } static HRESULT list_invoke( - AutomationObject* This, + struct automation_object *This, DISPID dispIdMember, REFIID riid, LCID lcid, @@ -1019,7 +1020,7 @@ static HRESULT list_invoke( EXCEPINFO* pExcepInfo, UINT* puArgErr) { - ListObject *list = CONTAINING_RECORD(This, ListObject, autoobj); + struct list_object *list = CONTAINING_RECORD(This, struct list_object, autoobj); IUnknown *pUnk = NULL; HRESULT hr; @@ -1065,14 +1066,14 @@ static HRESULT list_invoke( return S_OK; } -static void list_free(AutomationObject *This) +static void list_free(struct automation_object *This) { - ListObject *list = CONTAINING_RECORD(This, ListObject, autoobj); + struct list_object *list = CONTAINING_RECORD(This, struct list_object, autoobj); int i; for (i = 0; i < list->count; i++) VariantClear(&list->data[i]); - msi_free(list->data); + free(list->data); } static HRESULT get_products_count(const WCHAR *product, int *len) @@ -1105,11 +1106,11 @@ static HRESULT get_products_count(const WCHAR *product, int *len) static HRESULT create_list(const WCHAR *product, IDispatch **dispatch) { - ListObject *list; + struct list_object *list; HRESULT hr; int i; - list = msi_alloc_zero(sizeof(ListObject)); + list = calloc(1, sizeof(*list)); if (!list) return E_OUTOFMEMORY; init_automation_object(&list->autoobj, 0, StringList_tid); @@ -1123,7 +1124,7 @@ static HRESULT create_list(const WCHAR *product, IDispatch **dispatch) return hr; } - list->data = msi_alloc(list->count*sizeof(VARIANT)); + list->data = malloc(list->count * sizeof(VARIANT)); if (!list->data) { IDispatch_Release(*dispatch); @@ -1151,7 +1152,7 @@ static HRESULT create_list(const WCHAR *product, IDispatch **dispatch) } static HRESULT view_invoke( - AutomationObject* This, + struct automation_object *This, DISPID dispIdMember, REFIID riid, LCID lcid, @@ -1176,7 +1177,7 @@ static HRESULT view_invoke( { hr = DispGetParam(pDispParams, 0, VT_DISPATCH, &varg0, puArgErr); if (SUCCEEDED(hr) && V_DISPATCH(&varg0) != NULL) - MsiViewExecute(This->msiHandle, ((AutomationObject *)V_DISPATCH(&varg0))->msiHandle); + MsiViewExecute(This->msiHandle, ((struct automation_object *)V_DISPATCH(&varg0))->msiHandle); else MsiViewExecute(This->msiHandle, 0); } @@ -1211,7 +1212,8 @@ static HRESULT view_invoke( hr = DispGetParam(pDispParams, 1, VT_DISPATCH, &varg1, puArgErr); if (FAILED(hr)) return hr; if (!V_DISPATCH(&varg1)) return DISP_E_EXCEPTION; - if ((ret = MsiViewModify(This->msiHandle, V_I4(&varg0), ((AutomationObject *)V_DISPATCH(&varg1))->msiHandle)) != ERROR_SUCCESS) + if ((ret = MsiViewModify(This->msiHandle, V_I4(&varg0), + ((struct automation_object *)V_DISPATCH(&varg1))->msiHandle)) != ERROR_SUCCESS) { VariantClear(&varg1); ERR("MsiViewModify returned %d\n", ret); @@ -1255,7 +1257,7 @@ static HRESULT DatabaseImpl_LastErrorRecord(WORD wFlags, } HRESULT database_invoke( - AutomationObject* This, + struct automation_object *This, DISPID dispIdMember, REFIID riid, LCID lcid, @@ -1340,7 +1342,7 @@ HRESULT database_invoke( } static HRESULT session_invoke( - AutomationObject* This, + struct automation_object *This, DISPID dispIdMember, REFIID riid, LCID lcid, @@ -1350,7 +1352,7 @@ static HRESULT session_invoke( EXCEPINFO* pExcepInfo, UINT* puArgErr) { - SessionObject *session = CONTAINING_RECORD(This, SessionObject, autoobj); + struct session_object *session = CONTAINING_RECORD(This, struct session_object, autoobj); WCHAR *szString; DWORD dwLen = 0; MSIHANDLE msiHandle; @@ -1382,11 +1384,11 @@ static HRESULT session_invoke( V_BSTR(pVarResult) = NULL; if ((ret = MsiGetPropertyW(This->msiHandle, V_BSTR(&varg0), NULL, &dwLen)) == ERROR_SUCCESS) { - if (!(szString = msi_alloc((++dwLen)*sizeof(WCHAR)))) + if (!(szString = malloc((++dwLen) * sizeof(WCHAR)))) ERR("Out of memory\n"); else if ((ret = MsiGetPropertyW(This->msiHandle, V_BSTR(&varg0), szString, &dwLen)) == ERROR_SUCCESS) V_BSTR(pVarResult) = SysAllocString(szString); - msi_free(szString); + free(szString); } if (ret != ERROR_SUCCESS) ERR("MsiGetProperty returned %d\n", ret); @@ -1521,7 +1523,7 @@ static HRESULT session_invoke( V_VT(pVarResult) = VT_I4; V_I4(pVarResult) = - MsiProcessMessage(This->msiHandle, V_I4(&varg0), ((AutomationObject *)V_DISPATCH(&varg1))->msiHandle); + MsiProcessMessage(This->msiHandle, V_I4(&varg0), ((struct automation_object *)V_DISPATCH(&varg1))->msiHandle); break; case DISPID_SESSION_SETINSTALLLEVEL: @@ -1619,7 +1621,7 @@ static void variant_from_registry_value(VARIANT *pVarResult, DWORD dwType, LPBYT case REG_EXPAND_SZ: if (!(dwNewSize = ExpandEnvironmentStringsW(szString, szNewString, dwNewSize))) ERR("ExpandEnvironmentStrings returned error %lu\n", GetLastError()); - else if (!(szNewString = msi_alloc(dwNewSize * sizeof(WCHAR)))) + else if (!(szNewString = malloc(dwNewSize * sizeof(WCHAR)))) ERR("Out of memory\n"); else if (!(dwNewSize = ExpandEnvironmentStringsW(szString, szNewString, dwNewSize))) ERR("ExpandEnvironmentStrings returned error %lu\n", GetLastError()); @@ -1628,7 +1630,7 @@ static void variant_from_registry_value(VARIANT *pVarResult, DWORD dwType, LPBYT V_VT(pVarResult) = VT_BSTR; V_BSTR(pVarResult) = SysAllocStringLen(szNewString, dwNewSize); } - msi_free(szNewString); + free(szNewString); break; case REG_DWORD: @@ -1682,7 +1684,7 @@ static HRESULT InstallerImpl_CreateRecord(WORD wFlags, return create_record(hrec, &V_DISPATCH(pVarResult)); } -static HRESULT InstallerImpl_OpenPackage(AutomationObject* This, +static HRESULT InstallerImpl_OpenPackage(struct automation_object *This, WORD wFlags, DISPPARAMS* pDispParams, VARIANT* pVarResult, @@ -2047,7 +2049,7 @@ static HRESULT InstallerImpl_RegistryValue(WORD wFlags, goto done; } - szString = msi_alloc(size); + szString = malloc(size); if (!szString) { hr = E_OUTOFMEMORY; @@ -2058,14 +2060,14 @@ static HRESULT InstallerImpl_RegistryValue(WORD wFlags, &type, (LPBYTE)szString, &size); if (ret != ERROR_SUCCESS) { - msi_free(szString); + free(szString); hr = DISP_E_BADINDEX; goto done; } variant_from_registry_value(pVarResult, type, (LPBYTE)szString, size); - msi_free(szString); + free(szString); break; /* Try to make it into VT_I4, can use VariantChangeType for this. */ @@ -2093,7 +2095,7 @@ static HRESULT InstallerImpl_RegistryValue(WORD wFlags, if (ret != ERROR_SUCCESS) goto done; - szString = msi_alloc(++size * sizeof(WCHAR)); + szString = malloc(++size * sizeof(WCHAR)); if (!szString) { hr = E_OUTOFMEMORY; @@ -2115,7 +2117,7 @@ static HRESULT InstallerImpl_RegistryValue(WORD wFlags, V_BSTR(pVarResult) = SysAllocString(szString); } - msi_free(szString); + free(szString); } done: @@ -2245,7 +2247,7 @@ static HRESULT InstallerImpl_ProductInfo(WORD wFlags, goto done; } - str = msi_alloc(++size * sizeof(WCHAR)); + str = malloc(++size * sizeof(WCHAR)); if (!str) { hr = E_OUTOFMEMORY; @@ -2263,7 +2265,7 @@ static HRESULT InstallerImpl_ProductInfo(WORD wFlags, hr = S_OK; done: - msi_free(str); + free(str); VariantClear(&varg0); VariantClear(&varg1); return hr; @@ -2319,7 +2321,7 @@ static HRESULT InstallerImpl_RelatedProducts(WORD flags, } static HRESULT installer_invoke( - AutomationObject* This, + struct automation_object *This, DISPID dispIdMember, REFIID riid, LCID lcid, @@ -2420,14 +2422,14 @@ static HRESULT installer_invoke( HRESULT create_msiserver(IUnknown *outer, void **ppObj) { - AutomationObject *installer; + struct automation_object *installer; TRACE("(%p %p)\n", outer, ppObj); if (outer) return CLASS_E_NOAGGREGATION; - installer = msi_alloc(sizeof(AutomationObject)); + installer = malloc(sizeof(*installer)); if (!installer) return E_OUTOFMEMORY; init_automation_object(installer, 0, Installer_tid); @@ -2439,9 +2441,9 @@ HRESULT create_msiserver(IUnknown *outer, void **ppObj) HRESULT create_session(MSIHANDLE msiHandle, IDispatch *installer, IDispatch **disp) { - SessionObject *session; + struct session_object *session; - session = msi_alloc(sizeof(SessionObject)); + session = malloc(sizeof(*session)); if (!session) return E_OUTOFMEMORY; init_automation_object(&session->autoobj, msiHandle, Session_tid); @@ -2454,11 +2456,11 @@ HRESULT create_session(MSIHANDLE msiHandle, IDispatch *installer, IDispatch **di static HRESULT create_database(MSIHANDLE msiHandle, IDispatch **dispatch) { - AutomationObject *database; + struct automation_object *database; TRACE("%lu %p\n", msiHandle, dispatch); - database = msi_alloc(sizeof(AutomationObject)); + database = malloc(sizeof(*database)); if (!database) return E_OUTOFMEMORY; init_automation_object(database, msiHandle, Database_tid); @@ -2470,11 +2472,11 @@ static HRESULT create_database(MSIHANDLE msiHandle, IDispatch **dispatch) static HRESULT create_view(MSIHANDLE msiHandle, IDispatch **dispatch) { - AutomationObject *view; + struct automation_object *view; TRACE("%lu %p\n", msiHandle, dispatch); - view = msi_alloc(sizeof(AutomationObject)); + view = malloc(sizeof(*view)); if (!view) return E_OUTOFMEMORY; init_automation_object(view, msiHandle, View_tid); @@ -2486,9 +2488,9 @@ static HRESULT create_view(MSIHANDLE msiHandle, IDispatch **dispatch) static HRESULT create_summaryinfo(MSIHANDLE msiHandle, IDispatch **disp) { - AutomationObject *info; + struct automation_object *info; - info = msi_alloc(sizeof(*info)); + info = malloc(sizeof(*info)); if (!info) return E_OUTOFMEMORY; init_automation_object(info, msiHandle, SummaryInfo_tid); diff --git a/dll/win32/msi/classes.c b/dll/win32/msi/classes.c index b2c94fa0ff596..ca0e59170e630 100644 --- a/dll/win32/msi/classes.c +++ b/dll/win32/msi/classes.c @@ -49,7 +49,7 @@ static MSIAPPID *load_appid( MSIPACKAGE* package, MSIRECORD *row ) /* fill in the data */ - appid = msi_alloc_zero( sizeof(MSIAPPID) ); + appid = calloc( 1, sizeof(MSIAPPID) ); if (!appid) return NULL; @@ -108,7 +108,7 @@ static MSIPROGID *load_progid( MSIPACKAGE* package, MSIRECORD *row ) /* fill in the data */ - progid = msi_alloc_zero( sizeof(MSIPROGID) ); + progid = calloc( 1, sizeof(MSIPROGID) ); if (!progid) return NULL; @@ -137,9 +137,9 @@ static MSIPROGID *load_progid( MSIPACKAGE* package, MSIRECORD *row ) FilePath = msi_build_icon_path(package, FileName); - progid->IconPath = msi_alloc( (lstrlenW(FilePath) + 10) * sizeof(WCHAR) ); + progid->IconPath = malloc( (wcslen(FilePath) + 10) * sizeof(WCHAR) ); swprintf( progid->IconPath, lstrlenW(FilePath) + 10, L"%s,%d", FilePath, icon_index ); - msi_free(FilePath); + free(FilePath); } else { @@ -203,7 +203,7 @@ static MSICLASS *load_class( MSIPACKAGE* package, MSIRECORD *row ) /* fill in the data */ - cls = msi_alloc_zero( sizeof(MSICLASS) ); + cls = calloc( 1, sizeof(MSICLASS) ); if (!cls) return NULL; @@ -235,9 +235,9 @@ static MSICLASS *load_class( MSIPACKAGE* package, MSIRECORD *row ) FilePath = msi_build_icon_path(package, FileName); - cls->IconPath = msi_alloc( (lstrlenW(FilePath) + 5) * sizeof(WCHAR) ); + cls->IconPath = malloc( (wcslen(FilePath) + 5) * sizeof(WCHAR) ); swprintf( cls->IconPath, lstrlenW(FilePath) + 5, L"%s,%d", FilePath, icon_index ); - msi_free(FilePath); + free(FilePath); } else { @@ -254,14 +254,14 @@ static MSICLASS *load_class( MSIPACKAGE* package, MSIRECORD *row ) switch(i) { case 1: - cls->DefInprocHandler = strdupW(L"ole2.dll"); + cls->DefInprocHandler = wcsdup(L"ole2.dll"); break; case 2: - cls->DefInprocHandler32 = strdupW(L"ole32.dll"); + cls->DefInprocHandler32 = wcsdup(L"ole32.dll"); break; case 3: - cls->DefInprocHandler = strdupW(L"ole2.dll"); - cls->DefInprocHandler32 = strdupW(L"ole32.dll"); + cls->DefInprocHandler = wcsdup(L"ole2.dll"); + cls->DefInprocHandler32 = wcsdup(L"ole32.dll"); break; } } @@ -324,7 +324,7 @@ static MSIMIME *load_mime( MSIPACKAGE* package, MSIRECORD *row ) /* fill in the data */ - mt = msi_alloc_zero( sizeof(MSIMIME) ); + mt = calloc( 1, sizeof(MSIMIME) ); if (!mt) return mt; @@ -333,7 +333,7 @@ static MSIMIME *load_mime( MSIPACKAGE* package, MSIRECORD *row ) extension = MSI_RecordGetString( row, 2 ); mt->Extension = load_given_extension( package, extension ); - mt->suffix = strdupW( extension ); + mt->suffix = wcsdup( extension ); mt->clsid = msi_dup_record_field( row, 3 ); mt->Class = load_given_class( package, mt->clsid ); @@ -377,7 +377,7 @@ static MSIEXTENSION *load_extension( MSIPACKAGE* package, MSIRECORD *row ) /* fill in the data */ - ext = msi_alloc_zero( sizeof(MSIEXTENSION) ); + ext = calloc( 1, sizeof(MSIEXTENSION) ); if (!ext) return NULL; @@ -454,7 +454,7 @@ static UINT iterate_load_verb(MSIRECORD *row, LPVOID param) /* fill in the data */ - verb = msi_alloc_zero( sizeof(MSIVERB) ); + verb = calloc( 1, sizeof(MSIVERB) ); if (!verb) return ERROR_OUTOFMEMORY; @@ -768,7 +768,7 @@ UINT ACTION_RegisterClassInfo(MSIPACKAGE *package) if (cls->Argument) size += lstrlenW(cls->Argument)+1; - argument = msi_alloc( size * sizeof(WCHAR) ); + argument = malloc( size * sizeof(WCHAR) ); lstrcpyW( argument, file->TargetPath ); if (cls->Argument) @@ -778,7 +778,7 @@ UINT ACTION_RegisterClassInfo(MSIPACKAGE *package) } msi_reg_set_val_str( hkey3, NULL, argument ); - msi_free(argument); + free(argument); RegCloseKey(hkey3); @@ -829,12 +829,12 @@ UINT ACTION_RegisterClassInfo(MSIPACKAGE *package) ptr2 = wcschr(ptr,';'); if (ptr2) *ptr2 = 0; - keyname = msi_alloc( (lstrlenW(L"FileType\\%s\\%d") + lstrlenW(cls->clsid) + 4) * sizeof(WCHAR)); + keyname = malloc( sizeof(L"FileType\\%s\\%d") + (wcslen(cls->clsid) + 3) * sizeof(WCHAR) ); swprintf( keyname, lstrlenW(L"FileType\\%s\\%d") + lstrlenW(cls->clsid) + 4, L"FileType\\%s\\%d", cls->clsid, index ); msi_reg_set_subkey_val( HKEY_CLASSES_ROOT, keyname, NULL, ptr ); - msi_free(keyname); + free( keyname ); if (ptr2) ptr = ptr2+1; @@ -926,13 +926,13 @@ UINT ACTION_UnregisterClassInfo( MSIPACKAGE *package ) } if (cls->FileTypeMask) { - filetype = msi_alloc( (lstrlenW( L"FileType\\" ) + lstrlenW( cls->clsid ) + 1) * sizeof(WCHAR) ); + filetype = malloc( sizeof( L"FileType\\" ) + wcslen( cls->clsid ) * sizeof(WCHAR) ); if (filetype) { lstrcpyW( filetype, L"FileType\\" ); lstrcatW( filetype, cls->clsid ); res = RegDeleteTreeW( HKEY_CLASSES_ROOT, filetype ); - msi_free( filetype ); + free( filetype ); if (res != ERROR_SUCCESS) WARN("failed to delete file type %ld\n", res); @@ -1140,14 +1140,14 @@ static UINT register_verb(MSIPACKAGE *package, LPCWSTR progid, size += lstrlenW(verb->Argument); size += 4; - command = msi_alloc(size * sizeof (WCHAR)); + command = malloc(size * sizeof(WCHAR)); if (verb->Argument) swprintf(command, size, L"\"%s\" %s", component->FullKeypath, verb->Argument); else swprintf(command, size, L"\"%s\"", component->FullKeypath); msi_reg_set_val_str( key, NULL, command ); - msi_free(command); + free(command); advertise = msi_create_component_advertise_string(package, component, extension->Feature->Feature); @@ -1157,7 +1157,7 @@ static UINT register_verb(MSIPACKAGE *package, LPCWSTR progid, size += lstrlenW(verb->Argument); size += 4; - command = msi_alloc_zero(size * sizeof (WCHAR)); + command = calloc(size, sizeof(WCHAR)); lstrcpyW(command,advertise); if (verb->Argument) @@ -1169,15 +1169,15 @@ static UINT register_verb(MSIPACKAGE *package, LPCWSTR progid, msi_reg_set_val_multi_str( key, L"command", command ); RegCloseKey(key); - msi_free(keyname); - msi_free(advertise); - msi_free(command); + free(keyname); + free(advertise); + free(command); if (verb->Command) { keyname = msi_build_directory_name( 3, progid, L"shell", verb->Verb ); msi_reg_set_subkey_val( HKEY_CLASSES_ROOT, keyname, NULL, verb->Command ); - msi_free(keyname); + free(keyname); } if (verb->Sequence != MSI_NULL_INTEGER) @@ -1187,7 +1187,7 @@ static UINT register_verb(MSIPACKAGE *package, LPCWSTR progid, *Sequence = verb->Sequence; keyname = msi_build_directory_name( 2, progid, L"shell" ); msi_reg_set_subkey_val( HKEY_CLASSES_ROOT, keyname, NULL, verb->Verb ); - msi_free(keyname); + free(keyname); } } return ERROR_SUCCESS; @@ -1248,13 +1248,13 @@ UINT ACTION_RegisterExtensionInfo(MSIPACKAGE *package) ext->action = INSTALLSTATE_LOCAL; - extension = msi_alloc( (lstrlenW( ext->Extension ) + 2) * sizeof(WCHAR) ); + extension = malloc( (wcslen( ext->Extension ) + 2) * sizeof(WCHAR) ); if (extension) { extension[0] = '.'; lstrcpyW( extension + 1, ext->Extension ); res = RegCreateKeyW( HKEY_CLASSES_ROOT, extension, &hkey ); - msi_free( extension ); + free( extension ); if (res != ERROR_SUCCESS) WARN("failed to create extension key %ld\n", res); } @@ -1277,14 +1277,14 @@ UINT ACTION_RegisterExtensionInfo(MSIPACKAGE *package) msi_reg_set_val_str( hkey, NULL, progid ); - newkey = msi_alloc( (lstrlenW(progid) + lstrlenW(L"\\ShellNew") + 1) * sizeof(WCHAR)); + newkey = malloc( wcslen(progid) * sizeof(WCHAR) + sizeof(L"\\ShellNew") ); lstrcpyW(newkey, progid); lstrcatW(newkey, L"\\ShellNew"); RegCreateKeyW(hkey, newkey, &hkey2); RegCloseKey(hkey2); - msi_free(newkey); + free(newkey); /* do all the verbs */ LIST_FOR_EACH_ENTRY( verb, &ext->verbs, MSIVERB, entry ) @@ -1347,13 +1347,13 @@ UINT ACTION_UnregisterExtensionInfo( MSIPACKAGE *package ) ext->action = INSTALLSTATE_ABSENT; - extension = msi_alloc( (lstrlenW( ext->Extension ) + 2) * sizeof(WCHAR) ); + extension = malloc( (wcslen( ext->Extension ) + 2) * sizeof(WCHAR) ); if (extension) { extension[0] = '.'; lstrcpyW( extension + 1, ext->Extension ); res = RegDeleteTreeW( HKEY_CLASSES_ROOT, extension ); - msi_free( extension ); + free( extension ); if (res != ERROR_SUCCESS) WARN("failed to delete extension key %ld\n", res); } @@ -1368,13 +1368,13 @@ UINT ACTION_UnregisterExtensionInfo( MSIPACKAGE *package ) else progid = ext->ProgIDText; - progid_shell = msi_alloc( (lstrlenW( progid ) + lstrlenW( L"\\shell" ) + 1) * sizeof(WCHAR) ); + progid_shell = malloc( wcslen( progid ) * sizeof(WCHAR) + sizeof( L"\\shell" ) ); if (progid_shell) { lstrcpyW( progid_shell, progid ); lstrcatW( progid_shell, L"\\shell" ); res = RegDeleteTreeW( HKEY_CLASSES_ROOT, progid_shell ); - msi_free( progid_shell ); + free( progid_shell ); if (res != ERROR_SUCCESS) WARN("failed to delete shell key %ld\n", res); RegDeleteKeyW( HKEY_CLASSES_ROOT, progid ); @@ -1419,9 +1419,9 @@ UINT ACTION_RegisterMIMEInfo(MSIPACKAGE *package) TRACE("Registering MIME type %s\n", debugstr_w(mt->ContentType)); - if (mt->Extension) extension = msi_alloc( (lstrlenW( mt->Extension->Extension ) + 2) * sizeof(WCHAR) ); - key = msi_alloc( (lstrlenW( mt->ContentType ) + - lstrlenW( L"MIME\\Database\\Content Type\\" ) + 1) * sizeof(WCHAR) ); + if (mt->Extension) extension = malloc( (wcslen( mt->Extension->Extension ) + 2) * sizeof(WCHAR) ); + key = malloc( sizeof( L"MIME\\Database\\Content Type\\" ) + + wcslen( mt->ContentType ) * sizeof(WCHAR) ); if (extension && key) { @@ -1435,8 +1435,8 @@ UINT ACTION_RegisterMIMEInfo(MSIPACKAGE *package) if (mt->clsid) msi_reg_set_subkey_val( HKEY_CLASSES_ROOT, key, L"CLSID", mt->clsid ); } - msi_free( extension ); - msi_free( key ); + free( extension ); + free( key ); uirow = MSI_CreateRecord( 2 ); MSI_RecordSetStringW( uirow, 1, mt->ContentType ); @@ -1474,8 +1474,8 @@ UINT ACTION_UnregisterMIMEInfo( MSIPACKAGE *package ) TRACE("Unregistering MIME type %s\n", debugstr_w(mime->ContentType)); - mime_key = msi_alloc( (lstrlenW( L"MIME\\Database\\Content Type\\" ) + - lstrlenW( mime->ContentType ) + 1) * sizeof(WCHAR) ); + mime_key = malloc( sizeof( L"MIME\\Database\\Content Type\\" ) + + wcslen( mime->ContentType ) * sizeof(WCHAR) ); if (mime_key) { lstrcpyW( mime_key, L"MIME\\Database\\Content Type\\" ); @@ -1483,7 +1483,7 @@ UINT ACTION_UnregisterMIMEInfo( MSIPACKAGE *package ) res = RegDeleteKeyW( HKEY_CLASSES_ROOT, mime_key ); if (res != ERROR_SUCCESS) WARN("failed to delete MIME key %ld\n", res); - msi_free( mime_key ); + free( mime_key ); } uirow = MSI_CreateRecord( 2 ); diff --git a/dll/win32/msi/cond.y b/dll/win32/msi/cond.y index 17df0a4248c22..adc9e581c461d 100644 --- a/dll/win32/msi/cond.y +++ b/dll/win32/msi/cond.y @@ -414,13 +414,13 @@ static int COND_IsNumber( WCHAR x ) static WCHAR *strstriW( const WCHAR *str, const WCHAR *sub ) { LPWSTR strlower, sublower, r; - strlower = CharLowerW( strdupW( str ) ); - sublower = CharLowerW( strdupW( sub ) ); + strlower = CharLowerW( wcsdup( str ) ); + sublower = CharLowerW( wcsdup( sub ) ); r = wcsstr( strlower, sublower ); if (r) r = (LPWSTR)str + (r - strlower); - msi_free( strlower ); - msi_free( sublower ); + free( strlower ); + free( sublower ); return r; } @@ -756,7 +756,7 @@ static void *cond_alloc( COND_input *cond, unsigned int sz ) { struct list *mem; - mem = msi_alloc( sizeof (struct list) + sz ); + mem = malloc( sizeof (struct list) + sz ); if( !mem ) return NULL; @@ -774,12 +774,12 @@ static void *cond_track_mem( COND_input *cond, void *ptr, unsigned int sz ) new_ptr = cond_alloc( cond, sz ); if( !new_ptr ) { - msi_free( ptr ); + free( ptr ); return NULL; } memcpy( new_ptr, ptr, sz ); - msi_free( ptr ); + free( ptr ); return new_ptr; } @@ -790,7 +790,7 @@ static void cond_free( void *ptr ) if( ptr ) { list_remove( mem ); - msi_free( mem ); + free( mem ); } } @@ -879,6 +879,6 @@ MSICONDITION WINAPI MsiEvaluateConditionA( MSIHANDLE hInstall, LPCSTR szConditio return MSICONDITION_ERROR; r = MsiEvaluateConditionW( hInstall, szwCond ); - msi_free( szwCond ); + free( szwCond ); return r; } diff --git a/dll/win32/msi/create.c b/dll/win32/msi/create.c index 3d6c5189f2bfb..0202a67ca183b 100644 --- a/dll/win32/msi/create.c +++ b/dll/win32/msi/create.c @@ -38,7 +38,7 @@ WINE_DEFAULT_DEBUG_CHANNEL(msidb); /* below is the query interface to a table */ -typedef struct tagMSICREATEVIEW +struct create_view { MSIVIEW view; MSIDATABASE *db; @@ -46,11 +46,11 @@ typedef struct tagMSICREATEVIEW BOOL bIsTemp; BOOL hold; column_info *col_info; -} MSICREATEVIEW; +}; static UINT CREATE_fetch_int( struct tagMSIVIEW *view, UINT row, UINT col, UINT *val ) { - MSICREATEVIEW *cv = (MSICREATEVIEW*)view; + struct create_view *cv = (struct create_view *)view; TRACE("%p %d %d %p\n", cv, row, col, val ); @@ -59,7 +59,7 @@ static UINT CREATE_fetch_int( struct tagMSIVIEW *view, UINT row, UINT col, UINT static UINT CREATE_execute( struct tagMSIVIEW *view, MSIRECORD *record ) { - MSICREATEVIEW *cv = (MSICREATEVIEW*)view; + struct create_view *cv = (struct create_view *)view; BOOL persist = (cv->bIsTemp) ? MSICONDITION_FALSE : MSICONDITION_TRUE; TRACE("%p Table %s (%s)\n", cv, debugstr_w(cv->name), @@ -73,7 +73,7 @@ static UINT CREATE_execute( struct tagMSIVIEW *view, MSIRECORD *record ) static UINT CREATE_close( struct tagMSIVIEW *view ) { - MSICREATEVIEW *cv = (MSICREATEVIEW*)view; + struct create_view *cv = (struct create_view *)view; TRACE("%p\n", cv); @@ -82,7 +82,7 @@ static UINT CREATE_close( struct tagMSIVIEW *view ) static UINT CREATE_get_dimensions( struct tagMSIVIEW *view, UINT *rows, UINT *cols ) { - MSICREATEVIEW *cv = (MSICREATEVIEW*)view; + struct create_view *cv = (struct create_view *)view; TRACE("%p %p %p\n", cv, rows, cols ); @@ -92,7 +92,7 @@ static UINT CREATE_get_dimensions( struct tagMSIVIEW *view, UINT *rows, UINT *co static UINT CREATE_get_column_info( struct tagMSIVIEW *view, UINT n, LPCWSTR *name, UINT *type, BOOL *temporary, LPCWSTR *table_name ) { - MSICREATEVIEW *cv = (MSICREATEVIEW*)view; + struct create_view *cv = (struct create_view *)view; TRACE("%p %d %p %p %p %p\n", cv, n, name, type, temporary, table_name ); @@ -102,7 +102,7 @@ static UINT CREATE_get_column_info( struct tagMSIVIEW *view, UINT n, LPCWSTR *na static UINT CREATE_modify( struct tagMSIVIEW *view, MSIMODIFY eModifyMode, MSIRECORD *rec, UINT row) { - MSICREATEVIEW *cv = (MSICREATEVIEW*)view; + struct create_view *cv = (struct create_view *)view; TRACE("%p %d %p\n", cv, eModifyMode, rec ); @@ -111,12 +111,12 @@ static UINT CREATE_modify( struct tagMSIVIEW *view, MSIMODIFY eModifyMode, static UINT CREATE_delete( struct tagMSIVIEW *view ) { - MSICREATEVIEW *cv = (MSICREATEVIEW*)view; + struct create_view *cv = (struct create_view *)view; TRACE("%p\n", cv ); msiobj_release( &cv->db->hdr ); - msi_free( cv ); + free( cv ); return ERROR_SUCCESS; } @@ -160,7 +160,7 @@ static UINT check_columns( const column_info *col_info ) UINT CREATE_CreateView( MSIDATABASE *db, MSIVIEW **view, LPCWSTR table, column_info *col_info, BOOL hold ) { - MSICREATEVIEW *cv = NULL; + struct create_view *cv = NULL; UINT r; column_info *col; BOOL temp = TRUE; @@ -172,7 +172,7 @@ UINT CREATE_CreateView( MSIDATABASE *db, MSIVIEW **view, LPCWSTR table, if( r != ERROR_SUCCESS ) return r; - cv = msi_alloc_zero( sizeof *cv ); + cv = calloc( 1, sizeof *cv ); if( !cv ) return ERROR_FUNCTION_FAILED; @@ -189,7 +189,7 @@ UINT CREATE_CreateView( MSIDATABASE *db, MSIVIEW **view, LPCWSTR table, if ( !temp && tempprim ) { - msi_free( cv ); + free( cv ); return ERROR_FUNCTION_FAILED; } diff --git a/dll/win32/msi/custom.c b/dll/win32/msi/custom.c index b9637f4f95b34..6e660233444ae 100644 --- a/dll/win32/msi/custom.c +++ b/dll/win32/msi/custom.c @@ -50,27 +50,27 @@ WINE_DEFAULT_DEBUG_CHANNEL(msi); #define CUSTOM_ACTION_TYPE_MASK 0x3F -typedef struct tagMSIRUNNINGACTION +struct running_action { struct list entry; HANDLE handle; BOOL process; LPWSTR name; -} MSIRUNNINGACTION; +}; typedef UINT (WINAPI *MsiCustomActionEntryPoint)( MSIHANDLE ); -static CRITICAL_SECTION msi_custom_action_cs; -static CRITICAL_SECTION_DEBUG msi_custom_action_cs_debug = +static CRITICAL_SECTION custom_action_cs; +static CRITICAL_SECTION_DEBUG custom_action_cs_debug = { - 0, 0, &msi_custom_action_cs, - { &msi_custom_action_cs_debug.ProcessLocksList, - &msi_custom_action_cs_debug.ProcessLocksList }, - 0, 0, { (DWORD_PTR)(__FILE__ ": msi_custom_action_cs") } + 0, 0, &custom_action_cs, + { &custom_action_cs_debug.ProcessLocksList, + &custom_action_cs_debug.ProcessLocksList }, + 0, 0, { (DWORD_PTR)(__FILE__ ": custom_action_cs") } }; -static CRITICAL_SECTION msi_custom_action_cs = { &msi_custom_action_cs_debug, -1, 0, 0, 0, 0 }; +static CRITICAL_SECTION custom_action_cs = { &custom_action_cs_debug, -1, 0, 0, 0, 0 }; -static struct list msi_pending_custom_actions = LIST_INIT( msi_pending_custom_actions ); +static struct list pending_custom_actions = LIST_INIT( pending_custom_actions ); void __RPC_FAR * __RPC_USER MIDL_user_allocate(SIZE_T len) { @@ -101,11 +101,11 @@ UINT msi_schedule_action( MSIPACKAGE *package, UINT script, const WCHAR *action count = package->script_actions_count[script]; package->script_actions_count[script]++; - if (count != 0) newbuf = msi_realloc( package->script_actions[script], - package->script_actions_count[script] * sizeof(WCHAR *) ); - else newbuf = msi_alloc( sizeof(WCHAR *) ); + if (count != 0) newbuf = realloc( package->script_actions[script], + package->script_actions_count[script] * sizeof(WCHAR *) ); + else newbuf = malloc( sizeof(WCHAR *) ); - newbuf[count] = strdupW( action ); + newbuf[count] = wcsdup( action ); package->script_actions[script] = newbuf; return ERROR_SUCCESS; } @@ -119,11 +119,11 @@ UINT msi_register_unique_action( MSIPACKAGE *package, const WCHAR *action ) count = package->unique_actions_count; package->unique_actions_count++; - if (count != 0) newbuf = msi_realloc( package->unique_actions, - package->unique_actions_count * sizeof(WCHAR *) ); - else newbuf = msi_alloc( sizeof(WCHAR *) ); + if (count != 0) newbuf = realloc( package->unique_actions, + package->unique_actions_count * sizeof(WCHAR *) ); + else newbuf = malloc( sizeof(WCHAR *) ); - newbuf[count] = strdupW( action ); + newbuf[count] = wcsdup( action ); package->unique_actions = newbuf; return ERROR_SUCCESS; } @@ -178,19 +178,19 @@ static BOOL check_execution_scheduling_options(MSIPACKAGE *package, LPCWSTR acti * * [CustomActionData<=>UserSID<=>ProductCode]Action */ -static LPWSTR msi_get_deferred_action(LPCWSTR action, LPCWSTR actiondata, - LPCWSTR usersid, LPCWSTR prodcode) +static WCHAR *get_deferred_action(const WCHAR *action, const WCHAR *actiondata, const WCHAR *usersid, + const WCHAR *prodcode) { LPWSTR deferred; DWORD len; if (!actiondata) - return strdupW(action); + return wcsdup(action); len = lstrlenW(action) + lstrlenW(actiondata) + lstrlenW(usersid) + lstrlenW(prodcode) + lstrlenW(L"[%s<=>%s<=>%s]%s") - 7; - deferred = msi_alloc(len * sizeof(WCHAR)); + deferred = malloc(len * sizeof(WCHAR)); swprintf(deferred, len, L"[%s<=>%s<=>%s]%s", actiondata, usersid, prodcode, action); return deferred; @@ -226,14 +226,14 @@ WCHAR *msi_create_temp_file( MSIDATABASE *db ) { GetTempPathW( MAX_PATH, tmp ); } - if (!(db->tempfolder = strdupW( tmp ))) return NULL; + if (!(db->tempfolder = wcsdup( tmp ))) return NULL; } - if ((ret = msi_alloc( (lstrlenW( db->tempfolder ) + 20) * sizeof(WCHAR) ))) + if ((ret = malloc( (wcslen( db->tempfolder ) + 20) * sizeof(WCHAR) ))) { if (!GetTempFileNameW( db->tempfolder, L"msi", 0, ret )) { - msi_free( ret ); + free( ret ); return NULL; } } @@ -254,7 +254,7 @@ static MSIBINARY *create_temp_binary(MSIPACKAGE *package, LPCWSTR source) if (!(tmpfile = msi_create_temp_file( package->db ))) return NULL; if (!(row = MSI_QueryGetRecord( package->db, L"SELECT * FROM `Binary` WHERE `Name` = '%s'", source ))) goto error; - if (!(binary = msi_alloc_zero( sizeof(MSIBINARY) ))) goto error; + if (!(binary = calloc( 1, sizeof(MSIBINARY) ))) goto error; file = CreateFileW( tmpfile, GENERIC_WRITE, 0, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL ); if (file == INVALID_HANDLE_VALUE) goto error; @@ -274,7 +274,7 @@ static MSIBINARY *create_temp_binary(MSIPACKAGE *package, LPCWSTR source) CloseHandle( file ); if (r != ERROR_SUCCESS) goto error; - binary->source = strdupW( source ); + binary->source = wcsdup( source ); binary->tmpfile = tmpfile; list_add_tail( &package->binaries, &binary->entry ); @@ -284,8 +284,8 @@ static MSIBINARY *create_temp_binary(MSIPACKAGE *package, LPCWSTR source) error: if (row) msiobj_release( &row->hdr ); DeleteFileW( tmpfile ); - msi_free( tmpfile ); - msi_free( binary ); + free( tmpfile ); + free( binary ); return NULL; } @@ -305,13 +305,13 @@ static MSIBINARY *get_temp_binary(MSIPACKAGE *package, LPCWSTR source) static void file_running_action(MSIPACKAGE* package, HANDLE Handle, BOOL process, LPCWSTR name) { - MSIRUNNINGACTION *action; + struct running_action *action; - action = msi_alloc( sizeof(MSIRUNNINGACTION) ); + action = malloc( sizeof(*action) ); action->handle = Handle; action->process = process; - action->name = strdupW(name); + action->name = wcsdup(name); list_add_tail( &package->RunningActions, &action->entry ); } @@ -380,7 +380,8 @@ static UINT wait_process_handle(MSIPACKAGE* package, UINT type, return rc; } -typedef struct _msi_custom_action_info { +typedef struct +{ struct list entry; MSIPACKAGE *package; LPWSTR source; @@ -390,25 +391,25 @@ typedef struct _msi_custom_action_info { INT type; GUID guid; DWORD arch; -} msi_custom_action_info; +} custom_action_info; -static void free_custom_action_data( msi_custom_action_info *info ) +static void free_custom_action_data( custom_action_info *info ) { - EnterCriticalSection( &msi_custom_action_cs ); + EnterCriticalSection( &custom_action_cs ); list_remove( &info->entry ); if (info->handle) CloseHandle( info->handle ); - msi_free( info->action ); - msi_free( info->source ); - msi_free( info->target ); + free( info->action ); + free( info->source ); + free( info->target ); msiobj_release( &info->package->hdr ); - msi_free( info ); + free( info ); - LeaveCriticalSection( &msi_custom_action_cs ); + LeaveCriticalSection( &custom_action_cs ); } -static UINT wait_thread_handle( msi_custom_action_info *info ) +static UINT wait_thread_handle( custom_action_info *info ) { UINT rc = ERROR_SUCCESS; @@ -431,14 +432,14 @@ static UINT wait_thread_handle( msi_custom_action_info *info ) return rc; } -static msi_custom_action_info *find_action_by_guid( const GUID *guid ) +static custom_action_info *find_action_by_guid( const GUID *guid ) { - msi_custom_action_info *info; + custom_action_info *info; BOOL found = FALSE; - EnterCriticalSection( &msi_custom_action_cs ); + EnterCriticalSection( &custom_action_cs ); - LIST_FOR_EACH_ENTRY( info, &msi_pending_custom_actions, msi_custom_action_info, entry ) + LIST_FOR_EACH_ENTRY( info, &pending_custom_actions, custom_action_info, entry ) { if (IsEqualGUID( &info->guid, guid )) { @@ -447,7 +448,7 @@ static msi_custom_action_info *find_action_by_guid( const GUID *guid ) } } - LeaveCriticalSection( &msi_custom_action_cs ); + LeaveCriticalSection( &custom_action_cs ); if (!found) return NULL; @@ -690,7 +691,7 @@ void custom_stop_server(HANDLE process, HANDLE pipe) static DWORD WINAPI custom_client_thread(void *arg) { - msi_custom_action_info *info = arg; + custom_action_info *info = arg; DWORD64 thread64; HANDLE process; HANDLE thread; @@ -711,23 +712,23 @@ static DWORD WINAPI custom_client_thread(void *arg) pipe = info->package->custom_server_64_pipe; } - EnterCriticalSection(&msi_custom_action_cs); + EnterCriticalSection(&custom_action_cs); if (!WriteFile(pipe, &info->guid, sizeof(info->guid), &size, NULL) || size != sizeof(info->guid)) { ERR("failed to write to custom action client pipe: %lu\n", GetLastError()); - LeaveCriticalSection(&msi_custom_action_cs); + LeaveCriticalSection(&custom_action_cs); return GetLastError(); } if (!ReadFile(pipe, &thread64, sizeof(thread64), &size, NULL) || size != sizeof(thread64)) { ERR("failed to read from custom action client pipe: %lu\n", GetLastError()); - LeaveCriticalSection(&msi_custom_action_cs); + LeaveCriticalSection(&custom_action_cs); return GetLastError(); } - LeaveCriticalSection(&msi_custom_action_cs); + LeaveCriticalSection(&custom_action_cs); if (DuplicateHandle(process, (HANDLE)(DWORD_PTR)thread64, GetCurrentProcess(), &thread, 0, FALSE, DUPLICATE_SAME_ACCESS | DUPLICATE_CLOSE_SOURCE)) @@ -788,28 +789,28 @@ static BOOL get_binary_type( const WCHAR *name, DWORD *type ) } } -static msi_custom_action_info *do_msidbCustomActionTypeDll( +static custom_action_info *do_msidbCustomActionTypeDll( MSIPACKAGE *package, INT type, LPCWSTR source, LPCWSTR target, LPCWSTR action ) { - msi_custom_action_info *info; + custom_action_info *info; RPC_STATUS status; BOOL ret; - info = msi_alloc( sizeof *info ); + info = malloc( sizeof *info ); if (!info) return NULL; msiobj_addref( &package->hdr ); info->package = package; info->type = type; - info->target = strdupW( target ); - info->source = strdupW( source ); - info->action = strdupW( action ); + info->target = wcsdup( target ); + info->source = wcsdup( source ); + info->action = wcsdup( action ); CoCreateGuid( &info->guid ); - EnterCriticalSection( &msi_custom_action_cs ); - list_add_tail( &msi_pending_custom_actions, &info->entry ); - LeaveCriticalSection( &msi_custom_action_cs ); + EnterCriticalSection( &custom_action_cs ); + list_add_tail( &pending_custom_actions, &info->entry ); + LeaveCriticalSection( &custom_action_cs ); if (!package->rpc_server_started) { @@ -861,7 +862,7 @@ static msi_custom_action_info *do_msidbCustomActionTypeDll( static UINT HANDLE_CustomType1( MSIPACKAGE *package, const WCHAR *source, const WCHAR *target, INT type, const WCHAR *action ) { - msi_custom_action_info *info; + custom_action_info *info; MSIBINARY *binary; if (!(binary = get_temp_binary(package, source))) @@ -897,25 +898,25 @@ static HANDLE execute_command( const WCHAR *app, WCHAR *arg, const WCHAR *dir ) int len_arg = 0; DWORD len_exe; - if (!(exe = msi_alloc( MAX_PATH * sizeof(WCHAR) ))) return INVALID_HANDLE_VALUE; + if (!(exe = malloc( MAX_PATH * sizeof(WCHAR) ))) return INVALID_HANDLE_VALUE; len_exe = SearchPathW( NULL, app, L".exe", MAX_PATH, exe, NULL ); if (len_exe >= MAX_PATH) { - msi_free( exe ); - if (!(exe = msi_alloc( len_exe * sizeof(WCHAR) ))) return INVALID_HANDLE_VALUE; + free( exe ); + if (!(exe = malloc( len_exe * sizeof(WCHAR) ))) return INVALID_HANDLE_VALUE; len_exe = SearchPathW( NULL, app, L".exe", len_exe, exe, NULL ); } if (!len_exe) { ERR("can't find executable %lu\n", GetLastError()); - msi_free( exe ); + free( exe ); return INVALID_HANDLE_VALUE; } if (arg) len_arg = lstrlenW( arg ); - if (!(cmd = msi_alloc( (len_exe + len_arg + 4) * sizeof(WCHAR) ))) + if (!(cmd = malloc( (len_exe + len_arg + 4) * sizeof(WCHAR) ))) { - msi_free( exe ); + free( exe ); return INVALID_HANDLE_VALUE; } p = cmd; @@ -941,8 +942,8 @@ static HANDLE execute_command( const WCHAR *app, WCHAR *arg, const WCHAR *dir ) } memset( &si, 0, sizeof(STARTUPINFOW) ); ret = CreateProcessW( exe, exe ? cmd : arg, NULL, NULL, FALSE, 0, NULL, dir, &si, &info ); - msi_free( cmd ); - msi_free( exe ); + free( cmd ); + free( exe ); if (!ret) { ERR("unable to execute command %lu\n", GetLastError()); @@ -966,7 +967,7 @@ static UINT HANDLE_CustomType2( MSIPACKAGE *package, const WCHAR *source, const TRACE("exe %s arg %s\n", debugstr_w(binary->tmpfile), debugstr_w(arg)); handle = execute_command( binary->tmpfile, arg, L"C:\\" ); - msi_free( arg ); + free( arg ); if (handle == INVALID_HANDLE_VALUE) return ERROR_SUCCESS; return wait_process_handle( package, type, handle, action ); } @@ -974,7 +975,7 @@ static UINT HANDLE_CustomType2( MSIPACKAGE *package, const WCHAR *source, const static UINT HANDLE_CustomType17( MSIPACKAGE *package, const WCHAR *source, const WCHAR *target, INT type, const WCHAR *action ) { - msi_custom_action_info *info; + custom_action_info *info; MSIFILE *file; TRACE("%s %s\n", debugstr_w(source), debugstr_w(target)); @@ -1015,7 +1016,7 @@ static UINT HANDLE_CustomType18( MSIPACKAGE *package, const WCHAR *source, const TRACE("exe %s arg %s\n", debugstr_w(file->TargetPath), debugstr_w(arg)); handle = execute_command( file->TargetPath, arg, L"C:\\" ); - msi_free( arg ); + free( arg ); if (handle == INVALID_HANDLE_VALUE) return ERROR_SUCCESS; return wait_process_handle( package, type, handle, action ); } @@ -1040,7 +1041,7 @@ static UINT HANDLE_CustomType19( MSIPACKAGE *package, const WCHAR *source, const else if ((package->ui_level & INSTALLUILEVEL_MASK) != INSTALLUILEVEL_NONE) MessageBoxW( NULL, deformated, NULL, MB_OK ); - msi_free( deformated ); + free( deformated ); return ERROR_INSTALL_FAILURE; } @@ -1051,7 +1052,7 @@ static WCHAR *build_msiexec_args( const WCHAR *filename, const WCHAR *params ) UINT len = ARRAY_SIZE(L"/qb /i ") - 1; WCHAR *ret; - if (!(ret = msi_alloc( (len + len_filename + len_params + 4) * sizeof(WCHAR) ))) return NULL; + if (!(ret = malloc( (len + len_filename + len_params + 4) * sizeof(WCHAR) ))) return NULL; memcpy( ret, L"/qb /i ", sizeof(L"/qb /i ") ); ret[len++] = '"'; memcpy( ret + len, filename, len_filename * sizeof(WCHAR) ); @@ -1072,14 +1073,14 @@ static UINT HANDLE_CustomType23( MSIPACKAGE *package, const WCHAR *source, const if (!(dir = msi_dup_property( package->db, L"OriginalDatabase" ))) return ERROR_OUTOFMEMORY; if (!(p = wcsrchr( dir, '\\' )) && !(p = wcsrchr( dir, '/' ))) { - msi_free( dir ); + free( dir ); return ERROR_FUNCTION_FAILED; } *p = 0; len_dir = p - dir; - if (!(filename = msi_alloc( (len_dir + len_source + 2) * sizeof(WCHAR) ))) + if (!(filename = malloc( (len_dir + len_source + 2) * sizeof(WCHAR) ))) { - msi_free( dir ); + free( dir ); return ERROR_OUTOFMEMORY; } memcpy( filename, dir, len_dir * sizeof(WCHAR) ); @@ -1089,15 +1090,17 @@ static UINT HANDLE_CustomType23( MSIPACKAGE *package, const WCHAR *source, const if (!(args = build_msiexec_args( filename, target ))) { - msi_free( dir ); + free( dir ); + free( filename ); return ERROR_OUTOFMEMORY; } TRACE("installing %s concurrently\n", debugstr_w(source)); handle = execute_command( L"msiexec", args, dir ); - msi_free( dir ); - msi_free( args ); + free( dir ); + free( filename ); + free( args ); if (handle == INVALID_HANDLE_VALUE) return ERROR_SUCCESS; return wait_process_handle( package, type, handle, action ); } @@ -1155,7 +1158,7 @@ static UINT HANDLE_CustomType7( MSIPACKAGE *package, const WCHAR *source, const if (r != ERROR_SUCCESS) goto error; - if (!(binary = msi_alloc( sizeof(*binary) ))) goto error; + if (!(binary = malloc( sizeof(*binary) ))) goto error; binary->source = NULL; binary->tmpfile = tmpfile; list_add_tail( &package->binaries, &binary->entry ); @@ -1165,13 +1168,13 @@ static UINT HANDLE_CustomType7( MSIPACKAGE *package, const WCHAR *source, const TRACE("installing %s concurrently\n", debugstr_w(source)); handle = execute_command( L"msiexec", args, L"C:\\" ); - msi_free( args ); + free( args ); if (handle == INVALID_HANDLE_VALUE) return ERROR_SUCCESS; return wait_process_handle( package, type, handle, action ); error: DeleteFileW( tmpfile ); - msi_free( tmpfile ); + free( tmpfile ); return ERROR_FUNCTION_FAILED; } @@ -1187,8 +1190,8 @@ static UINT HANDLE_CustomType50( MSIPACKAGE *package, const WCHAR *source, const TRACE("exe %s arg %s\n", debugstr_w(exe), debugstr_w(arg)); handle = execute_command( exe, arg, L"C:\\" ); - msi_free( exe ); - msi_free( arg ); + free( exe ); + free( arg ); if (handle == INVALID_HANDLE_VALUE) return ERROR_SUCCESS; return wait_process_handle( package, type, handle, action ); } @@ -1211,14 +1214,14 @@ static UINT HANDLE_CustomType34( MSIPACKAGE *package, const WCHAR *source, const TRACE("cmd %s dir %s\n", debugstr_w(cmd), debugstr_w(workingdir)); handle = execute_command( NULL, cmd, workingdir ); - msi_free( cmd ); + free( cmd ); if (handle == INVALID_HANDLE_VALUE) return ERROR_SUCCESS; return wait_process_handle( package, type, handle, action ); } static DWORD ACTION_CallScript( const GUID *guid ) { - msi_custom_action_info *info; + custom_action_info *info; MSIHANDLE hPackage; UINT r = ERROR_FUNCTION_FAILED; @@ -1259,26 +1262,26 @@ static DWORD WINAPI ScriptThread( LPVOID arg ) return rc; } -static msi_custom_action_info *do_msidbCustomActionTypeScript( +static custom_action_info *do_msidbCustomActionTypeScript( MSIPACKAGE *package, INT type, LPCWSTR script, LPCWSTR function, LPCWSTR action ) { - msi_custom_action_info *info; + custom_action_info *info; - info = msi_alloc( sizeof *info ); + info = malloc( sizeof *info ); if (!info) return NULL; msiobj_addref( &package->hdr ); info->package = package; info->type = type; - info->target = strdupW( function ); - info->source = strdupW( script ); - info->action = strdupW( action ); + info->target = wcsdup( function ); + info->source = wcsdup( script ); + info->action = wcsdup( action ); CoCreateGuid( &info->guid ); - EnterCriticalSection( &msi_custom_action_cs ); - list_add_tail( &msi_pending_custom_actions, &info->entry ); - LeaveCriticalSection( &msi_custom_action_cs ); + EnterCriticalSection( &custom_action_cs ); + list_add_tail( &pending_custom_actions, &info->entry ); + LeaveCriticalSection( &custom_action_cs ); info->handle = CreateThread( NULL, 0, ScriptThread, &info->guid, 0, NULL ); if (!info->handle) @@ -1293,7 +1296,7 @@ static msi_custom_action_info *do_msidbCustomActionTypeScript( static UINT HANDLE_CustomType37_38( MSIPACKAGE *package, const WCHAR *source, const WCHAR *target, INT type, const WCHAR *action ) { - msi_custom_action_info *info; + custom_action_info *info; TRACE("%s %s\n", debugstr_w(source), debugstr_w(target)); @@ -1305,7 +1308,7 @@ static UINT HANDLE_CustomType5_6( MSIPACKAGE *package, const WCHAR *source, cons INT type, const WCHAR *action ) { MSIRECORD *row = NULL; - msi_custom_action_info *info; + custom_action_info *info; CHAR *buffer = NULL; WCHAR *bufferw = NULL; DWORD sz = 0; @@ -1320,7 +1323,7 @@ static UINT HANDLE_CustomType5_6( MSIPACKAGE *package, const WCHAR *source, cons r = MSI_RecordReadStream(row, 2, NULL, &sz); if (r != ERROR_SUCCESS) goto done; - buffer = msi_alloc( sz + 1 ); + buffer = malloc( sz + 1 ); if (!buffer) { r = ERROR_FUNCTION_FAILED; @@ -1343,8 +1346,8 @@ static UINT HANDLE_CustomType5_6( MSIPACKAGE *package, const WCHAR *source, cons r = wait_thread_handle( info ); done: - msi_free(bufferw); - msi_free(buffer); + free(bufferw); + free(buffer); msiobj_release(&row->hdr); return r; } @@ -1352,7 +1355,7 @@ static UINT HANDLE_CustomType5_6( MSIPACKAGE *package, const WCHAR *source, cons static UINT HANDLE_CustomType21_22( MSIPACKAGE *package, const WCHAR *source, const WCHAR *target, INT type, const WCHAR *action ) { - msi_custom_action_info *info; + custom_action_info *info; MSIFILE *file; HANDLE hFile; DWORD sz, szHighWord = 0, read; @@ -1379,7 +1382,7 @@ static UINT HANDLE_CustomType21_22( MSIPACKAGE *package, const WCHAR *source, co CloseHandle(hFile); return ERROR_FUNCTION_FAILED; } - buffer = msi_alloc( sz + 1 ); + buffer = malloc( sz + 1 ); if (!buffer) { CloseHandle(hFile); @@ -1403,15 +1406,15 @@ static UINT HANDLE_CustomType21_22( MSIPACKAGE *package, const WCHAR *source, co r = wait_thread_handle( info ); done: - msi_free(bufferw); - msi_free(buffer); + free(bufferw); + free(buffer); return r; } static UINT HANDLE_CustomType53_54( MSIPACKAGE *package, const WCHAR *source, const WCHAR *target, INT type, const WCHAR *action ) { - msi_custom_action_info *info; + custom_action_info *info; WCHAR *prop; TRACE("%s %s\n", debugstr_w(source), debugstr_w(target)); @@ -1420,7 +1423,7 @@ static UINT HANDLE_CustomType53_54( MSIPACKAGE *package, const WCHAR *source, co if (!prop) return ERROR_SUCCESS; info = do_msidbCustomActionTypeScript( package, type, prop, NULL, action ); - msi_free(prop); + free(prop); return wait_thread_handle( info ); } @@ -1447,13 +1450,13 @@ static UINT defer_custom_action( MSIPACKAGE *package, const WCHAR *action, UINT WCHAR *actiondata = msi_dup_property( package->db, action ); WCHAR *usersid = msi_dup_property( package->db, L"UserSID" ); WCHAR *prodcode = msi_dup_property( package->db, L"ProductCode" ); - WCHAR *deferred = msi_get_deferred_action( action, actiondata, usersid, prodcode ); + WCHAR *deferred = get_deferred_action( action, actiondata, usersid, prodcode ); if (!deferred) { - msi_free( actiondata ); - msi_free( usersid ); - msi_free( prodcode ); + free( actiondata ); + free( usersid ); + free( prodcode ); return ERROR_OUTOFMEMORY; } if (type & msidbCustomActionTypeCommit) @@ -1472,10 +1475,10 @@ static UINT defer_custom_action( MSIPACKAGE *package, const WCHAR *action, UINT msi_schedule_action( package, SCRIPT_INSTALL, deferred ); } - msi_free( actiondata ); - msi_free( usersid ); - msi_free( prodcode ); - msi_free( deferred ); + free( actiondata ); + free( usersid ); + free( prodcode ); + free( deferred ); return ERROR_SUCCESS; } @@ -1540,7 +1543,7 @@ UINT ACTION_CustomAction(MSIPACKAGE *package, const WCHAR *action) else msi_set_property( package->db, L"CustomActionData", L"", -1 ); - msi_free(actiondata); + free(actiondata); } } else if (!check_execution_scheduling_options(package,action,type)) @@ -1564,7 +1567,7 @@ UINT ACTION_CustomAction(MSIPACKAGE *package, const WCHAR *action) case 7: /* Concurrent install from substorage */ deformat_string( package, target, &deformated ); rc = HANDLE_CustomType7( package, source, target, type, action ); - msi_free( deformated ); + free( deformated ); break; case 17: rc = HANDLE_CustomType17( package, source, target, type, action ); @@ -1582,7 +1585,7 @@ UINT ACTION_CustomAction(MSIPACKAGE *package, const WCHAR *action) case 23: /* Installs another package in the source tree */ deformat_string( package, target, &deformated ); rc = HANDLE_CustomType23( package, source, deformated, type, action ); - msi_free( deformated ); + free( deformated ); break; case 34: /* EXE to be run in specified directory */ rc = HANDLE_CustomType34( package, source, target, type, action ); @@ -1590,7 +1593,7 @@ UINT ACTION_CustomAction(MSIPACKAGE *package, const WCHAR *action) case 35: /* Directory set with formatted text */ deformat_string( package, target, &deformated ); MSI_SetTargetPathW( package, source, deformated ); - msi_free( deformated ); + free( deformated ); break; case 37: /* JScript/VBScript text stored in target column */ case 38: @@ -1604,7 +1607,7 @@ UINT ACTION_CustomAction(MSIPACKAGE *package, const WCHAR *action) len = deformat_string( package, target, &deformated ); rc = msi_set_property( package->db, source, deformated, len ); if (rc == ERROR_SUCCESS && !wcscmp( source, L"SourceDir" )) msi_reset_source_folders( package ); - msi_free( deformated ); + free( deformated ); break; case 53: /* JScript/VBScript text specified by a property value */ case 54: @@ -1628,11 +1631,11 @@ void ACTION_FinishCustomActions(const MSIPACKAGE* package) struct list *item; HANDLE *wait_handles; unsigned int handle_count, i; - msi_custom_action_info *info, *cursor; + custom_action_info *info, *cursor; while ((item = list_head( &package->RunningActions ))) { - MSIRUNNINGACTION *action = LIST_ENTRY( item, MSIRUNNINGACTION, entry ); + struct running_action *action = LIST_ENTRY( item, struct running_action, entry ); list_remove( &action->entry ); @@ -1640,17 +1643,17 @@ void ACTION_FinishCustomActions(const MSIPACKAGE* package) msi_dialog_check_messages( action->handle ); CloseHandle( action->handle ); - msi_free( action->name ); - msi_free( action ); + free( action->name ); + free( action ); } - EnterCriticalSection( &msi_custom_action_cs ); + EnterCriticalSection( &custom_action_cs ); - handle_count = list_count( &msi_pending_custom_actions ); - wait_handles = msi_alloc( handle_count * sizeof(HANDLE) ); + handle_count = list_count( &pending_custom_actions ); + wait_handles = malloc( handle_count * sizeof(HANDLE) ); handle_count = 0; - LIST_FOR_EACH_ENTRY_SAFE( info, cursor, &msi_pending_custom_actions, msi_custom_action_info, entry ) + LIST_FOR_EACH_ENTRY_SAFE( info, cursor, &pending_custom_actions, custom_action_info, entry ) { if (info->package == package ) { @@ -1659,36 +1662,36 @@ void ACTION_FinishCustomActions(const MSIPACKAGE* package) } } - LeaveCriticalSection( &msi_custom_action_cs ); + LeaveCriticalSection( &custom_action_cs ); for (i = 0; i < handle_count; i++) { msi_dialog_check_messages( wait_handles[i] ); CloseHandle( wait_handles[i] ); } - msi_free( wait_handles ); + free( wait_handles ); - EnterCriticalSection( &msi_custom_action_cs ); - LIST_FOR_EACH_ENTRY_SAFE( info, cursor, &msi_pending_custom_actions, msi_custom_action_info, entry ) + EnterCriticalSection( &custom_action_cs ); + LIST_FOR_EACH_ENTRY_SAFE( info, cursor, &pending_custom_actions, custom_action_info, entry ) { if (info->package == package) free_custom_action_data( info ); } - LeaveCriticalSection( &msi_custom_action_cs ); + LeaveCriticalSection( &custom_action_cs ); } UINT __cdecl s_remote_GetActionInfo(const GUID *guid, WCHAR **name, int *type, WCHAR **dll, char **func, MSIHANDLE *hinst) { - msi_custom_action_info *info; + custom_action_info *info; info = find_action_by_guid(guid); if (!info) return ERROR_INVALID_DATA; - *name = strdupW(info->action); + *name = wcsdup(info->action); *type = info->type; *hinst = alloc_msihandle(&info->package->hdr); - *dll = strdupW(info->source); + *dll = wcsdup(info->source); *func = strdupWtoA(info->target); return ERROR_SUCCESS; diff --git a/dll/win32/msi/database.c b/dll/win32/msi/database.c index f7305e661efd7..a39321a18bb55 100644 --- a/dll/win32/msi/database.c +++ b/dll/win32/msi/database.c @@ -59,7 +59,7 @@ static void free_transforms( MSIDATABASE *db ) MSITRANSFORM *t = LIST_ENTRY( list_head( &db->transforms ), MSITRANSFORM, entry ); list_remove( &t->entry ); IStorage_Release( t->stg ); - msi_free( t ); + free( t ); } } @@ -70,14 +70,14 @@ static void free_streams( MSIDATABASE *db ) { if (db->streams[i].stream) IStream_Release( db->streams[i].stream ); } - msi_free( db->streams ); + free( db->streams ); } void append_storage_to_db( MSIDATABASE *db, IStorage *stg ) { MSITRANSFORM *t; - t = msi_alloc( sizeof *t ); + t = malloc( sizeof *t ); t->stg = stg; IStorage_AddRef( stg ); list_add_head( &db->transforms, &t->entry ); @@ -87,7 +87,7 @@ static VOID MSI_CloseDatabase( MSIOBJECTHDR *arg ) { MSIDATABASE *db = (MSIDATABASE *) arg; - msi_free(db->path); + free( db->path ); free_streams( db ); free_cached_tables( db ); free_transforms( db ); @@ -96,9 +96,9 @@ static VOID MSI_CloseDatabase( MSIOBJECTHDR *arg ) if (db->deletefile) { DeleteFileW( db->deletefile ); - msi_free( db->deletefile ); + free( db->deletefile ); } - msi_free( db->tempfolder ); + free( db->tempfolder ); } static HRESULT db_initialize( IStorage *stg, const GUID *clsid ) @@ -262,7 +262,7 @@ UINT MSI_OpenDatabaseW(LPCWSTR szDBPath, LPCWSTR szPersist, MSIDATABASE **pdb) else lstrcpyW( path, save_path ); - db->path = strdupW( path ); + db->path = wcsdup( path ); db->media_transform_offset = MSI_INITIAL_MEDIA_TRANSFORM_OFFSET; db->media_transform_disk_id = MSI_INITIAL_MEDIA_TRANSFORM_DISKID; @@ -272,7 +272,7 @@ UINT MSI_OpenDatabaseW(LPCWSTR szDBPath, LPCWSTR szPersist, MSIDATABASE **pdb) db->storage = stg; db->mode = mode; if (created) - db->deletefile = strdupW( szDBPath ); + db->deletefile = wcsdup( szDBPath ); list_init( &db->tables ); list_init( &db->transforms ); @@ -341,13 +341,13 @@ UINT WINAPI MsiOpenDatabaseA(LPCSTR szDBPath, LPCSTR szPersist, MSIHANDLE *phDB) end: if( !IS_INTMSIDBOPEN(szPersist) ) - msi_free( szwPersist ); - msi_free( szwDBPath ); + free( szwPersist ); + free( szwDBPath ); return r; } -static LPWSTR msi_read_text_archive(LPCWSTR path, DWORD *len) +static WCHAR *read_text_archive(const WCHAR *path, DWORD *len) { HANDLE file; LPSTR data = NULL; @@ -359,13 +359,13 @@ static LPWSTR msi_read_text_archive(LPCWSTR path, DWORD *len) return NULL; size = GetFileSize( file, NULL ); - if (!(data = msi_alloc( size ))) goto done; + if (!(data = malloc( size ))) goto done; if (!ReadFile( file, data, size, &read, NULL ) || read != size) goto done; while (!data[size - 1]) size--; *len = MultiByteToWideChar( CP_ACP, 0, data, size, NULL, 0 ); - if ((wdata = msi_alloc( (*len + 1) * sizeof(WCHAR) ))) + if ((wdata = malloc( (*len + 1) * sizeof(WCHAR) ))) { MultiByteToWideChar( CP_ACP, 0, data, size, wdata, *len ); wdata[*len] = 0; @@ -373,11 +373,11 @@ static LPWSTR msi_read_text_archive(LPCWSTR path, DWORD *len) done: CloseHandle( file ); - msi_free( data ); + free( data ); return wdata; } -static void msi_parse_line(LPWSTR *line, LPWSTR **entries, DWORD *num_entries, DWORD *len) +static UINT parse_line(WCHAR **line, WCHAR ***entries, DWORD *num_entries, DWORD *len) { LPWSTR ptr = *line, save; DWORD i, count = 1, chars_left = *len; @@ -395,9 +395,16 @@ static void msi_parse_line(LPWSTR *line, LPWSTR **entries, DWORD *num_entries, D chars_left--; } - *entries = msi_alloc(count * sizeof(LPWSTR)); + /* + * make sure this line has the same number of entries as there are columns + * which are indicated by the first line. + */ + if (*num_entries && *num_entries != count) + return ERROR_FUNCTION_FAILED; + + *entries = malloc(count * sizeof(WCHAR *)); if (!*entries) - return; + return ERROR_OUTOFMEMORY; /* store pointers into the data */ chars_left = *len; @@ -442,17 +449,19 @@ static void msi_parse_line(LPWSTR *line, LPWSTR **entries, DWORD *num_entries, D /* move to the next line if there's more, else EOF */ *line = ptr; *len = chars_left; - if (num_entries) + if (!*num_entries) *num_entries = count; + + return ERROR_SUCCESS; } -static LPWSTR msi_build_createsql_prelude(LPWSTR table) +static WCHAR *build_createsql_prelude(const WCHAR *table) { LPWSTR prelude; DWORD size; size = ARRAY_SIZE(L"CREATE TABLE `%s` ( ") + lstrlenW(table) - 2; - prelude = msi_alloc(size * sizeof(WCHAR)); + prelude = malloc(size * sizeof(WCHAR)); if (!prelude) return NULL; @@ -460,7 +469,7 @@ static LPWSTR msi_build_createsql_prelude(LPWSTR table) return prelude; } -static LPWSTR msi_build_createsql_columns(LPWSTR *columns_data, LPWSTR *types, DWORD num_columns) +static WCHAR *build_createsql_columns(WCHAR **columns_data, WCHAR **types, DWORD num_columns) { LPWSTR columns, p; LPCWSTR type; @@ -468,7 +477,7 @@ static LPWSTR msi_build_createsql_columns(LPWSTR *columns_data, LPWSTR *types, D WCHAR expanded[128], *ptr; WCHAR size[10], comma[2], extra[30]; - columns = msi_alloc_zero(sql_size * sizeof(WCHAR)); + columns = calloc(sql_size, sizeof(WCHAR)); if (!columns) return NULL; @@ -514,7 +523,7 @@ static LPWSTR msi_build_createsql_columns(LPWSTR *columns_data, LPWSTR *types, D else { WARN("invalid int width %lu\n", len); - msi_free(columns); + free(columns); return NULL; } break; @@ -526,17 +535,17 @@ static LPWSTR msi_build_createsql_columns(LPWSTR *columns_data, LPWSTR *types, D break; default: ERR("Unknown type: %c\n", types[i][0]); - msi_free(columns); + free(columns); return NULL; } swprintf(expanded, ARRAY_SIZE(expanded), L"`%s` %s%s%s%s ", columns_data[i], type, size, extra, comma); sql_size += lstrlenW(expanded); - p = msi_realloc(columns, sql_size * sizeof(WCHAR)); + p = realloc(columns, sql_size * sizeof(WCHAR)); if (!p) { - msi_free(columns); + free(columns); return NULL; } columns = p; @@ -547,7 +556,7 @@ static LPWSTR msi_build_createsql_columns(LPWSTR *columns_data, LPWSTR *types, D return columns; } -static LPWSTR msi_build_createsql_postlude(LPWSTR *primary_keys, DWORD num_keys) +static WCHAR *build_createsql_postlude(WCHAR **primary_keys, DWORD num_keys) { LPWSTR postlude, keys, ptr; DWORD size, i; @@ -555,7 +564,7 @@ static LPWSTR msi_build_createsql_postlude(LPWSTR *primary_keys, DWORD num_keys) for (i = 0, size = 1; i < num_keys; i++) size += lstrlenW(L"`%s`, ") + lstrlenW(primary_keys[i]) - 2; - keys = msi_alloc(size * sizeof(WCHAR)); + keys = malloc(size * sizeof(WCHAR)); if (!keys) return NULL; @@ -568,18 +577,19 @@ static LPWSTR msi_build_createsql_postlude(LPWSTR *primary_keys, DWORD num_keys) *(ptr - 2) = '\0'; size = lstrlenW(L"PRIMARY KEY %s)") + size - 1; - postlude = msi_alloc(size * sizeof(WCHAR)); + postlude = malloc(size * sizeof(WCHAR)); if (!postlude) goto done; swprintf(postlude, size, L"PRIMARY KEY %s)", keys); done: - msi_free(keys); + free(keys); return postlude; } -static UINT msi_add_table_to_db(MSIDATABASE *db, LPWSTR *columns, LPWSTR *types, LPWSTR *labels, DWORD num_labels, DWORD num_columns) +static UINT add_table_to_db(MSIDATABASE *db, WCHAR **columns, WCHAR **types, WCHAR **labels, DWORD num_labels, + DWORD num_columns) { UINT r = ERROR_OUTOFMEMORY; DWORD size; @@ -587,15 +597,15 @@ static UINT msi_add_table_to_db(MSIDATABASE *db, LPWSTR *columns, LPWSTR *types, LPWSTR create_sql = NULL; LPWSTR prelude, columns_sql, postlude; - prelude = msi_build_createsql_prelude(labels[0]); - columns_sql = msi_build_createsql_columns(columns, types, num_columns); - postlude = msi_build_createsql_postlude(labels + 1, num_labels - 1); /* skip over table name */ + prelude = build_createsql_prelude(labels[0]); + columns_sql = build_createsql_columns(columns, types, num_columns); + postlude = build_createsql_postlude(labels + 1, num_labels - 1); /* skip over table name */ if (!prelude || !columns_sql || !postlude) goto done; size = lstrlenW(prelude) + lstrlenW(columns_sql) + lstrlenW(postlude) + 1; - create_sql = msi_alloc(size * sizeof(WCHAR)); + create_sql = malloc(size * sizeof(WCHAR)); if (!create_sql) goto done; @@ -612,20 +622,20 @@ static UINT msi_add_table_to_db(MSIDATABASE *db, LPWSTR *columns, LPWSTR *types, msiobj_release(&view->hdr); done: - msi_free(prelude); - msi_free(columns_sql); - msi_free(postlude); - msi_free(create_sql); + free(prelude); + free(columns_sql); + free(postlude); + free(create_sql); return r; } -static LPWSTR msi_import_stream_filename(LPCWSTR path, LPCWSTR name) +static WCHAR *import_stream_filename(const WCHAR *path, const WCHAR *name) { DWORD len; LPWSTR fullname, ptr; len = lstrlenW(path) + lstrlenW(name) + 1; - fullname = msi_alloc(len*sizeof(WCHAR)); + fullname = malloc(len * sizeof(WCHAR)); if (!fullname) return NULL; @@ -635,7 +645,7 @@ static LPWSTR msi_import_stream_filename(LPCWSTR path, LPCWSTR name) ptr = wcsrchr(fullname, '.'); if (!ptr) { - msi_free (fullname); + free(fullname); return NULL; } *ptr++ = '\\'; @@ -667,12 +677,12 @@ static UINT construct_record(DWORD num_columns, LPWSTR *types, if (*data[i]) { UINT r; - LPWSTR file = msi_import_stream_filename(path, data[i]); + WCHAR *file = import_stream_filename(path, data[i]); if (!file) return ERROR_FUNCTION_FAILED; r = MSI_RecordSetStreamFromFileW(*rec, i + 1, file); - msi_free (file); + free (file); if (r != ERROR_SUCCESS) return ERROR_FUNCTION_FAILED; } @@ -687,10 +697,8 @@ static UINT construct_record(DWORD num_columns, LPWSTR *types, return ERROR_SUCCESS; } -static UINT msi_add_records_to_table(MSIDATABASE *db, LPWSTR *columns, LPWSTR *types, - LPWSTR *labels, LPWSTR **records, - int num_columns, int num_records, - LPWSTR path) +static UINT add_records_to_table(MSIDATABASE *db, WCHAR **columns, WCHAR **types, WCHAR **labels, WCHAR ***records, + int num_columns, int num_records, WCHAR *path) { UINT r; int i; @@ -733,7 +741,7 @@ static UINT msi_add_records_to_table(MSIDATABASE *db, LPWSTR *columns, LPWSTR *t static UINT MSI_DatabaseImport(MSIDATABASE *db, LPCWSTR folder, LPCWSTR file) { UINT r; - DWORD len, i, num_labels, num_types, num_columns, num_records = 0; + DWORD len, i, num_labels = 0, num_types = 0, num_columns = 0, num_records = 0; WCHAR **columns, **types, **labels, *path, *ptr, *data, ***records = NULL, ***temp_records; TRACE("%p %s %s\n", db, debugstr_w(folder), debugstr_w(file) ); @@ -742,7 +750,7 @@ static UINT MSI_DatabaseImport(MSIDATABASE *db, LPCWSTR folder, LPCWSTR file) return ERROR_INVALID_PARAMETER; len = lstrlenW(folder) + lstrlenW(L"\\") + lstrlenW(file) + 1; - path = msi_alloc( len * sizeof(WCHAR) ); + path = malloc( len * sizeof(WCHAR) ); if (!path) return ERROR_OUTOFMEMORY; @@ -750,17 +758,17 @@ static UINT MSI_DatabaseImport(MSIDATABASE *db, LPCWSTR folder, LPCWSTR file) lstrcatW( path, L"\\" ); lstrcatW( path, file ); - data = msi_read_text_archive( path, &len ); + data = read_text_archive( path, &len ); if (!data) { - msi_free(path); + free(path); return ERROR_FUNCTION_FAILED; } ptr = data; - msi_parse_line( &ptr, &columns, &num_columns, &len ); - msi_parse_line( &ptr, &types, &num_types, &len ); - msi_parse_line( &ptr, &labels, &num_labels, &len ); + parse_line( &ptr, &columns, &num_columns, &len ); + parse_line( &ptr, &types, &num_types, &len ); + parse_line( &ptr, &labels, &num_labels, &len ); if (num_columns == 1 && !columns[0][0] && num_labels == 1 && !labels[0][0] && num_types == 2 && !wcscmp( types[1], L"_ForceCodepage" )) @@ -775,7 +783,7 @@ static UINT MSI_DatabaseImport(MSIDATABASE *db, LPCWSTR folder, LPCWSTR file) goto done; } - records = msi_alloc(sizeof(WCHAR **)); + records = malloc(sizeof(WCHAR **)); if (!records) { r = ERROR_OUTOFMEMORY; @@ -785,10 +793,12 @@ static UINT MSI_DatabaseImport(MSIDATABASE *db, LPCWSTR folder, LPCWSTR file) /* read in the table records */ while (len) { - msi_parse_line( &ptr, &records[num_records], NULL, &len ); + r = parse_line( &ptr, &records[num_records], &num_columns, &len ); + if (r != ERROR_SUCCESS) + goto done; num_records++; - temp_records = msi_realloc(records, (num_records + 1) * sizeof(WCHAR **)); + temp_records = realloc(records, (num_records + 1) * sizeof(WCHAR **)); if (!temp_records) { r = ERROR_OUTOFMEMORY; @@ -810,7 +820,7 @@ static UINT MSI_DatabaseImport(MSIDATABASE *db, LPCWSTR folder, LPCWSTR file) { if (!TABLE_Exists(db, labels[0])) { - r = msi_add_table_to_db( db, columns, types, labels, num_labels, num_columns ); + r = add_table_to_db( db, columns, types, labels, num_labels, num_columns ); if (r != ERROR_SUCCESS) { r = ERROR_FUNCTION_FAILED; @@ -818,20 +828,20 @@ static UINT MSI_DatabaseImport(MSIDATABASE *db, LPCWSTR folder, LPCWSTR file) } } - r = msi_add_records_to_table( db, columns, types, labels, records, num_columns, num_records, path ); + r = add_records_to_table( db, columns, types, labels, records, num_columns, num_records, path ); } done: - msi_free(path); - msi_free(data); - msi_free(columns); - msi_free(types); - msi_free(labels); + free(path); + free(data); + free(columns); + free(types); + free(labels); for (i = 0; i < num_records; i++) - msi_free(records[i]); + free(records[i]); - msi_free(records); + free(records); return r; } @@ -874,20 +884,20 @@ UINT WINAPI MsiDatabaseImportA( MSIHANDLE handle, const char *szFolder, const ch r = MsiDatabaseImportW( handle, path, file ); end: - msi_free( path ); - msi_free( file ); + free( path ); + free( file ); return r; } -static UINT msi_export_field( HANDLE handle, MSIRECORD *row, UINT field ) +static UINT export_field( HANDLE handle, MSIRECORD *row, UINT field ) { - char *buffer; + char *buffer, *ptr; BOOL ret; DWORD sz = 0x100; UINT r; - buffer = msi_alloc( sz ); + buffer = malloc( sz ); if (!buffer) return ERROR_OUTOFMEMORY; @@ -897,10 +907,10 @@ static UINT msi_export_field( HANDLE handle, MSIRECORD *row, UINT field ) char *tmp; sz++; /* leave room for NULL terminator */ - tmp = msi_realloc( buffer, sz ); + tmp = realloc( buffer, sz ); if (!tmp) { - msi_free( buffer ); + free( buffer ); return ERROR_OUTOFMEMORY; } buffer = tmp; @@ -908,22 +918,38 @@ static UINT msi_export_field( HANDLE handle, MSIRECORD *row, UINT field ) r = MSI_RecordGetStringA( row, field, buffer, &sz ); if (r != ERROR_SUCCESS) { - msi_free( buffer ); + free( buffer ); return r; } } else if (r != ERROR_SUCCESS) { - msi_free( buffer ); + free( buffer ); return r; } + ptr = buffer; + while( *ptr ) + { + if (*ptr == '\r' && *( ptr + 1 ) == '\n') + { + *ptr++ = '\x11'; + *ptr++ = '\x19'; + continue; + } + + if (*ptr == '\n') + *ptr = '\x19'; + + ptr++; + } + ret = WriteFile( handle, buffer, sz, &sz, NULL ); - msi_free( buffer ); + free( buffer ); return ret ? ERROR_SUCCESS : ERROR_FUNCTION_FAILED; } -static UINT msi_export_stream( const WCHAR *folder, const WCHAR *table, MSIRECORD *row, UINT field, UINT start ) +static UINT export_stream( const WCHAR *folder, const WCHAR *table, MSIRECORD *row, UINT field, UINT start ) { WCHAR stream[MAX_STREAM_NAME_LEN + 1], *path; DWORD sz, read_size, write_size; @@ -937,13 +963,13 @@ static UINT msi_export_stream( const WCHAR *folder, const WCHAR *table, MSIRECOR return r; len = sz + lstrlenW( folder ) + lstrlenW( table ) + ARRAY_SIZE( L"%s\\%s" ) + 1; - if (!(path = msi_alloc( len * sizeof(WCHAR) ))) + if (!(path = malloc( len * sizeof(WCHAR) ))) return ERROR_OUTOFMEMORY; len = swprintf( path, len, L"%s\\%s", folder, table ); if (!CreateDirectoryW( path, NULL ) && GetLastError() != ERROR_ALREADY_EXISTS) { - msi_free( path ); + free( path ); return ERROR_FUNCTION_FAILED; } @@ -951,7 +977,7 @@ static UINT msi_export_stream( const WCHAR *folder, const WCHAR *table, MSIRECOR lstrcpyW( path + len, stream ); file = CreateFileW( path, GENERIC_WRITE, FILE_SHARE_READ | FILE_SHARE_WRITE, NULL, CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL ); - msi_free( path ); + free( path ); if (file == INVALID_HANDLE_VALUE) return ERROR_FUNCTION_FAILED; @@ -981,7 +1007,7 @@ struct row_export_info const WCHAR *table; }; -static UINT msi_export_record( struct row_export_info *row_export_info, MSIRECORD *row, UINT start ) +static UINT export_record( struct row_export_info *row_export_info, MSIRECORD *row, UINT start ) { HANDLE handle = row_export_info->handle; UINT i, count, r = ERROR_SUCCESS; @@ -991,15 +1017,15 @@ static UINT msi_export_record( struct row_export_info *row_export_info, MSIRECOR count = MSI_RecordGetFieldCount( row ); for (i = start; i <= count; i++) { - r = msi_export_field( handle, row, i ); + r = export_field( handle, row, i ); if (r == ERROR_INVALID_PARAMETER) { - r = msi_export_stream( row_export_info->folder, row_export_info->table, row, i, start ); + r = export_stream( row_export_info->folder, row_export_info->table, row, i, start ); if (r != ERROR_SUCCESS) return r; /* exporting a binary stream, repeat the "Name" field */ - r = msi_export_field( handle, row, start ); + r = export_field( handle, row, start ); if (r != ERROR_SUCCESS) return r; } @@ -1013,12 +1039,12 @@ static UINT msi_export_record( struct row_export_info *row_export_info, MSIRECOR return r; } -static UINT msi_export_row( MSIRECORD *row, void *arg ) +static UINT export_row( MSIRECORD *row, void *arg ) { - return msi_export_record( arg, row, 1 ); + return export_record( arg, row, 1 ); } -static UINT msi_export_forcecodepage( HANDLE handle, UINT codepage ) +static UINT export_forcecodepage( HANDLE handle, UINT codepage ) { static const char fmt[] = "\r\n\r\n%u\t_ForceCodepage\r\n"; char data[sizeof(fmt) + 10]; @@ -1030,7 +1056,7 @@ static UINT msi_export_forcecodepage( HANDLE handle, UINT codepage ) return ERROR_SUCCESS; } -static UINT msi_export_summaryinformation( MSIDATABASE *db, HANDLE handle ) +static UINT export_summaryinformation( MSIDATABASE *db, HANDLE handle ) { static const char header[] = "PropertyId\tValue\r\n" "i2\tl255\r\n" @@ -1058,7 +1084,7 @@ static UINT MSI_DatabaseExport( MSIDATABASE *db, LPCWSTR table, LPCWSTR folder, return ERROR_INVALID_PARAMETER; len = lstrlenW(folder) + lstrlenW(file) + 2; - filename = msi_alloc(len * sizeof (WCHAR)); + filename = malloc(len * sizeof(WCHAR)); if (!filename) return ERROR_OUTOFMEMORY; @@ -1068,20 +1094,20 @@ static UINT MSI_DatabaseExport( MSIDATABASE *db, LPCWSTR table, LPCWSTR folder, handle = CreateFileW( filename, GENERIC_READ | GENERIC_WRITE, 0, NULL, CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL ); - msi_free( filename ); + free( filename ); if (handle == INVALID_HANDLE_VALUE) return ERROR_FUNCTION_FAILED; if (!wcscmp( table, L"_ForceCodepage" )) { UINT codepage = msi_get_string_table_codepage( db->strings ); - r = msi_export_forcecodepage( handle, codepage ); + r = export_forcecodepage( handle, codepage ); goto done; } if (!wcscmp( table, L"_SummaryInformation" )) { - r = msi_export_summaryinformation( db, handle ); + r = export_summaryinformation( db, handle ); goto done; } @@ -1094,7 +1120,7 @@ static UINT MSI_DatabaseExport( MSIDATABASE *db, LPCWSTR table, LPCWSTR folder, r = MSI_ViewGetColumnInfo(view, MSICOLINFO_NAMES, &rec); if (r == ERROR_SUCCESS) { - msi_export_record( &row_export_info, rec, 1 ); + export_record( &row_export_info, rec, 1 ); msiobj_release( &rec->hdr ); } @@ -1102,7 +1128,7 @@ static UINT MSI_DatabaseExport( MSIDATABASE *db, LPCWSTR table, LPCWSTR folder, r = MSI_ViewGetColumnInfo(view, MSICOLINFO_TYPES, &rec); if (r == ERROR_SUCCESS) { - msi_export_record( &row_export_info, rec, 1 ); + export_record( &row_export_info, rec, 1 ); msiobj_release( &rec->hdr ); } @@ -1111,12 +1137,12 @@ static UINT MSI_DatabaseExport( MSIDATABASE *db, LPCWSTR table, LPCWSTR folder, if (r == ERROR_SUCCESS) { MSI_RecordSetStringW( rec, 0, table ); - msi_export_record( &row_export_info, rec, 0 ); + export_record( &row_export_info, rec, 0 ); msiobj_release( &rec->hdr ); } /* write out row 4 onwards, the data */ - r = MSI_IterateRecords( view, 0, msi_export_row, &row_export_info ); + r = MSI_IterateRecords( view, 0, export_row, &row_export_info ); msiobj_release( &view->hdr ); } @@ -1186,9 +1212,9 @@ UINT WINAPI MsiDatabaseExportA( MSIHANDLE handle, const char *szTable, const cha r = MsiDatabaseExportW( handle, table, path, file ); end: - msi_free( table ); - msi_free( path ); - msi_free( file ); + free( table ); + free( path ); + free( file ); return r; } @@ -1203,11 +1229,11 @@ UINT WINAPI MsiDatabaseMergeA( MSIHANDLE hDatabase, MSIHANDLE hDatabaseMerge, co table = strdupAtoW(szTableName); r = MsiDatabaseMergeW(hDatabase, hDatabaseMerge, table); - msi_free(table); + free(table); return r; } -typedef struct _tagMERGETABLE +struct merge_table { struct list entry; struct list rows; @@ -1219,22 +1245,22 @@ typedef struct _tagMERGETABLE DWORD numtypes; LPWSTR *labels; DWORD numlabels; -} MERGETABLE; +}; -typedef struct _tagMERGEROW +struct merge_row { struct list entry; MSIRECORD *data; -} MERGEROW; +}; -typedef struct _tagMERGEDATA +struct merge_data { MSIDATABASE *db; MSIDATABASE *merge; - MERGETABLE *curtable; + struct merge_table *curtable; MSIQUERY *curview; struct list *tabledata; -} MERGEDATA; +}; static BOOL merge_type_match(LPCWSTR type1, LPCWSTR type2) { @@ -1367,7 +1393,7 @@ static LPWSTR get_key_value(MSIQUERY *view, LPCWSTR key, MSIRECORD *rec) { str = msi_dup_record_field(colnames, ++i); cmp = wcscmp( key, str ); - msi_free(str); + free(str); } while (cmp); msiobj_release(&colnames->hdr); @@ -1381,7 +1407,7 @@ static LPWSTR get_key_value(MSIQUERY *view, LPCWSTR key, MSIRECORD *rec) { /* quote string record fields */ sz += 2; - val = msi_alloc(sz * sizeof(WCHAR)); + val = malloc(sz * sizeof(WCHAR)); if (!val) return NULL; @@ -1392,7 +1418,7 @@ static LPWSTR get_key_value(MSIQUERY *view, LPCWSTR key, MSIRECORD *rec) else { /* do not quote integer record fields */ - val = msi_alloc(sz * sizeof(WCHAR)); + val = malloc(sz * sizeof(WCHAR)); if (!val) return NULL; @@ -1402,7 +1428,7 @@ static LPWSTR get_key_value(MSIQUERY *view, LPCWSTR key, MSIRECORD *rec) if (r != ERROR_SUCCESS) { ERR("failed to get string!\n"); - msi_free(val); + free(val); return NULL; } @@ -1412,7 +1438,7 @@ static LPWSTR get_key_value(MSIQUERY *view, LPCWSTR key, MSIRECORD *rec) static LPWSTR create_diff_row_query(MSIDATABASE *merge, MSIQUERY *view, LPWSTR table, MSIRECORD *rec) { - LPWSTR query = NULL, clause = NULL, val; + WCHAR *query = NULL, *clause = NULL, *new_clause, *val; LPCWSTR setptr, key; DWORD size, oldsize; MSIRECORD *keys; @@ -1422,10 +1448,6 @@ static LPWSTR create_diff_row_query(MSIDATABASE *merge, MSIQUERY *view, if (r != ERROR_SUCCESS) return NULL; - clause = msi_alloc_zero(sizeof(WCHAR)); - if (!clause) - goto done; - size = 1; count = MSI_RecordGetFieldCount(keys); for (i = 1; i <= count; i++) @@ -1440,35 +1462,36 @@ static LPWSTR create_diff_row_query(MSIDATABASE *merge, MSIQUERY *view, oldsize = size; size += lstrlenW(setptr) + lstrlenW(key) + lstrlenW(val) - 4; - clause = msi_realloc(clause, size * sizeof (WCHAR)); - if (!clause) + new_clause = realloc(clause, size * sizeof(WCHAR)); + if (!new_clause) { - msi_free(val); + free(val); goto done; } + clause = new_clause; swprintf(clause + oldsize - 1, size - (oldsize - 1), setptr, key, val); - msi_free(val); + free(val); } size = lstrlenW(L"SELECT * FROM `%s` WHERE %s") + lstrlenW(table) + lstrlenW(clause) + 1; - query = msi_alloc(size * sizeof(WCHAR)); + query = malloc(size * sizeof(WCHAR)); if (!query) goto done; swprintf(query, size, L"SELECT * FROM `%s` WHERE %s", table, clause); done: - msi_free(clause); + free(clause); msiobj_release(&keys->hdr); return query; } static UINT merge_diff_row(MSIRECORD *rec, LPVOID param) { - MERGEDATA *data = param; - MERGETABLE *table = data->curtable; - MERGEROW *mergerow; + struct merge_data *data = param; + struct merge_table *table = data->curtable; + struct merge_row *mergerow; MSIQUERY *dbview = NULL; MSIRECORD *row = NULL; LPWSTR query = NULL; @@ -1500,7 +1523,7 @@ static UINT merge_diff_row(MSIRECORD *rec, LPVOID param) r = ERROR_SUCCESS; } - mergerow = msi_alloc(sizeof(MERGEROW)); + mergerow = malloc(sizeof(*mergerow)); if (!mergerow) { r = ERROR_OUTOFMEMORY; @@ -1511,20 +1534,20 @@ static UINT merge_diff_row(MSIRECORD *rec, LPVOID param) if (!mergerow->data) { r = ERROR_OUTOFMEMORY; - msi_free(mergerow); + free(mergerow); goto done; } list_add_tail(&table->rows, &mergerow->entry); done: - msi_free(query); + free(query); msiobj_release(&row->hdr); msiobj_release(&dbview->hdr); return r; } -static UINT msi_get_table_labels(MSIDATABASE *db, LPCWSTR table, LPWSTR **labels, DWORD *numlabels) +static UINT get_table_labels(MSIDATABASE *db, const WCHAR *table, WCHAR ***labels, DWORD *numlabels) { UINT r, i, count; MSIRECORD *prec = NULL; @@ -1535,17 +1558,17 @@ static UINT msi_get_table_labels(MSIDATABASE *db, LPCWSTR table, LPWSTR **labels count = MSI_RecordGetFieldCount(prec); *numlabels = count + 1; - *labels = msi_alloc((*numlabels)*sizeof(LPWSTR)); + *labels = malloc((*numlabels) * sizeof(WCHAR *)); if (!*labels) { r = ERROR_OUTOFMEMORY; goto end; } - (*labels)[0] = strdupW(table); + (*labels)[0] = wcsdup(table); for (i=1; i<=count; i++ ) { - (*labels)[i] = strdupW(MSI_RecordGetString(prec, i)); + (*labels)[i] = wcsdup(MSI_RecordGetString(prec, i)); } end: @@ -1553,7 +1576,7 @@ static UINT msi_get_table_labels(MSIDATABASE *db, LPCWSTR table, LPWSTR **labels return r; } -static UINT msi_get_query_columns(MSIQUERY *query, LPWSTR **columns, DWORD *numcolumns) +static UINT get_query_columns(MSIQUERY *query, WCHAR ***columns, DWORD *numcolumns) { UINT r, i, count; MSIRECORD *prec = NULL; @@ -1563,7 +1586,7 @@ static UINT msi_get_query_columns(MSIQUERY *query, LPWSTR **columns, DWORD *numc return r; count = MSI_RecordGetFieldCount(prec); - *columns = msi_alloc(count*sizeof(LPWSTR)); + *columns = malloc(count * sizeof(WCHAR *)); if (!*columns) { r = ERROR_OUTOFMEMORY; @@ -1572,7 +1595,7 @@ static UINT msi_get_query_columns(MSIQUERY *query, LPWSTR **columns, DWORD *numc for (i=1; i<=count; i++ ) { - (*columns)[i-1] = strdupW(MSI_RecordGetString(prec, i)); + (*columns)[i-1] = wcsdup(MSI_RecordGetString(prec, i)); } *numcolumns = count; @@ -1582,7 +1605,7 @@ static UINT msi_get_query_columns(MSIQUERY *query, LPWSTR **columns, DWORD *numc return r; } -static UINT msi_get_query_types(MSIQUERY *query, LPWSTR **types, DWORD *numtypes) +static UINT get_query_types(MSIQUERY *query, WCHAR ***types, DWORD *numtypes) { UINT r, i, count; MSIRECORD *prec = NULL; @@ -1592,7 +1615,7 @@ static UINT msi_get_query_types(MSIQUERY *query, LPWSTR **types, DWORD *numtypes return r; count = MSI_RecordGetFieldCount(prec); - *types = msi_alloc(count*sizeof(LPWSTR)); + *types = malloc(count * sizeof(WCHAR *)); if (!*types) { r = ERROR_OUTOFMEMORY; @@ -1602,7 +1625,7 @@ static UINT msi_get_query_types(MSIQUERY *query, LPWSTR **types, DWORD *numtypes *numtypes = count; for (i=1; i<=count; i++ ) { - (*types)[i-1] = strdupW(MSI_RecordGetString(prec, i)); + (*types)[i-1] = wcsdup(MSI_RecordGetString(prec, i)); } end: @@ -1610,68 +1633,68 @@ static UINT msi_get_query_types(MSIQUERY *query, LPWSTR **types, DWORD *numtypes return r; } -static void merge_free_rows(MERGETABLE *table) +static void merge_free_rows(struct merge_table *table) { struct list *item, *cursor; LIST_FOR_EACH_SAFE(item, cursor, &table->rows) { - MERGEROW *row = LIST_ENTRY(item, MERGEROW, entry); + struct merge_row *row = LIST_ENTRY(item, struct merge_row, entry); list_remove(&row->entry); msiobj_release(&row->data->hdr); - msi_free(row); + free(row); } } -static void free_merge_table(MERGETABLE *table) +static void free_merge_table(struct merge_table *table) { UINT i; if (table->labels != NULL) { for (i = 0; i < table->numlabels; i++) - msi_free(table->labels[i]); + free(table->labels[i]); - msi_free(table->labels); + free(table->labels); } if (table->columns != NULL) { for (i = 0; i < table->numcolumns; i++) - msi_free(table->columns[i]); + free(table->columns[i]); - msi_free(table->columns); + free(table->columns); } if (table->types != NULL) { for (i = 0; i < table->numtypes; i++) - msi_free(table->types[i]); + free(table->types[i]); - msi_free(table->types); + free(table->types); } - msi_free(table->name); + free(table->name); merge_free_rows(table); - msi_free(table); + free(table); } -static UINT msi_get_merge_table (MSIDATABASE *db, LPCWSTR name, MERGETABLE **ptable) +static UINT get_merge_table(MSIDATABASE *db, const WCHAR *name, struct merge_table **ptable) { UINT r; - MERGETABLE *table; + struct merge_table *table; MSIQUERY *mergeview = NULL; - table = msi_alloc_zero(sizeof(MERGETABLE)); + table = calloc(1, sizeof(*table)); if (!table) { *ptable = NULL; return ERROR_OUTOFMEMORY; } - r = msi_get_table_labels(db, name, &table->labels, &table->numlabels); + r = get_table_labels(db, name, &table->labels, &table->numlabels); if (r != ERROR_SUCCESS) goto err; @@ -1679,17 +1702,17 @@ static UINT msi_get_merge_table (MSIDATABASE *db, LPCWSTR name, MERGETABLE **pta if (r != ERROR_SUCCESS) goto err; - r = msi_get_query_columns(mergeview, &table->columns, &table->numcolumns); + r = get_query_columns(mergeview, &table->columns, &table->numcolumns); if (r != ERROR_SUCCESS) goto err; - r = msi_get_query_types(mergeview, &table->types, &table->numtypes); + r = get_query_types(mergeview, &table->types, &table->numtypes); if (r != ERROR_SUCCESS) goto err; list_init(&table->rows); - table->name = strdupW(name); + table->name = wcsdup(name); table->numconflicts = 0; msiobj_release(&mergeview->hdr); @@ -1705,8 +1728,8 @@ static UINT msi_get_merge_table (MSIDATABASE *db, LPCWSTR name, MERGETABLE **pta static UINT merge_diff_tables(MSIRECORD *rec, LPVOID param) { - MERGEDATA *data = param; - MERGETABLE *table; + struct merge_data *data = param; + struct merge_table *table; MSIQUERY *dbview = NULL; MSIQUERY *mergeview = NULL; LPCWSTR name; @@ -1733,7 +1756,7 @@ static UINT merge_diff_tables(MSIRECORD *rec, LPVOID param) goto done; } - r = msi_get_merge_table(data->merge, name, &table); + r = get_merge_table(data->merge, name, &table); if (r != ERROR_SUCCESS) goto done; @@ -1758,7 +1781,7 @@ static UINT gather_merge_data(MSIDATABASE *db, MSIDATABASE *merge, struct list *tabledata) { MSIQUERY *view; - MERGEDATA data; + struct merge_data data; UINT r; r = MSI_DatabaseOpenViewW(merge, L"SELECT * FROM `_Tables`", &view); @@ -1773,21 +1796,20 @@ static UINT gather_merge_data(MSIDATABASE *db, MSIDATABASE *merge, return r; } -static UINT merge_table(MSIDATABASE *db, MERGETABLE *table) +static UINT merge_table(MSIDATABASE *db, struct merge_table *table) { UINT r; - MERGEROW *row; + struct merge_row *row; MSIVIEW *tv; if (!TABLE_Exists(db, table->name)) { - r = msi_add_table_to_db(db, table->columns, table->types, - table->labels, table->numlabels, table->numcolumns); + r = add_table_to_db(db, table->columns, table->types, table->labels, table->numlabels, table->numcolumns); if (r != ERROR_SUCCESS) return ERROR_FUNCTION_FAILED; } - LIST_FOR_EACH_ENTRY(row, &table->rows, MERGEROW, entry) + LIST_FOR_EACH_ENTRY(row, &table->rows, struct merge_row, entry) { r = TABLE_CreateView(db, table->name, &tv); if (r != ERROR_SUCCESS) @@ -1837,7 +1859,7 @@ UINT WINAPI MsiDatabaseMergeW( MSIHANDLE hDatabase, MSIHANDLE hDatabaseMerge, co struct list tabledata = LIST_INIT(tabledata); struct list *item, *cursor; MSIDATABASE *db, *merge; - MERGETABLE *table; + struct merge_table *table; BOOL conflicts; UINT r; @@ -1859,7 +1881,7 @@ UINT WINAPI MsiDatabaseMergeW( MSIHANDLE hDatabase, MSIHANDLE hDatabaseMerge, co goto done; conflicts = FALSE; - LIST_FOR_EACH_ENTRY(table, &tabledata, MERGETABLE, entry) + LIST_FOR_EACH_ENTRY(table, &tabledata, struct merge_table, entry) { if (table->numconflicts) { @@ -1880,7 +1902,7 @@ UINT WINAPI MsiDatabaseMergeW( MSIHANDLE hDatabase, MSIHANDLE hDatabaseMerge, co LIST_FOR_EACH_SAFE(item, cursor, &tabledata) { - MERGETABLE *table = LIST_ENTRY(item, MERGETABLE, entry); + struct merge_table *table = LIST_ENTRY(item, struct merge_table, entry); list_remove(&table->entry); free_merge_table(table); } diff --git a/dll/win32/msi/delete.c b/dll/win32/msi/delete.c index c101b56c2310c..1d80dce8d87fb 100644 --- a/dll/win32/msi/delete.c +++ b/dll/win32/msi/delete.c @@ -48,16 +48,16 @@ WINE_DEFAULT_DEBUG_CHANNEL(msidb); * that's a bug in the way I'm running the query, or a just a bug. */ -typedef struct tagMSIDELETEVIEW +struct delete_view { MSIVIEW view; MSIDATABASE *db; MSIVIEW *table; -} MSIDELETEVIEW; +}; static UINT DELETE_fetch_int( struct tagMSIVIEW *view, UINT row, UINT col, UINT *val ) { - MSIDELETEVIEW *dv = (MSIDELETEVIEW*)view; + struct delete_view *dv = (struct delete_view *)view; TRACE("%p %d %d %p\n", dv, row, col, val ); @@ -66,7 +66,7 @@ static UINT DELETE_fetch_int( struct tagMSIVIEW *view, UINT row, UINT col, UINT static UINT DELETE_fetch_stream( struct tagMSIVIEW *view, UINT row, UINT col, IStream **stm) { - MSIDELETEVIEW *dv = (MSIDELETEVIEW*)view; + struct delete_view *dv = (struct delete_view *)view; TRACE("%p %d %d %p\n", dv, row, col, stm ); @@ -75,7 +75,7 @@ static UINT DELETE_fetch_stream( struct tagMSIVIEW *view, UINT row, UINT col, IS static UINT DELETE_execute( struct tagMSIVIEW *view, MSIRECORD *record ) { - MSIDELETEVIEW *dv = (MSIDELETEVIEW*)view; + struct delete_view *dv = (struct delete_view *)view; UINT r, i, rows = 0, cols = 0; TRACE("%p %p\n", dv, record); @@ -102,7 +102,7 @@ static UINT DELETE_execute( struct tagMSIVIEW *view, MSIRECORD *record ) static UINT DELETE_close( struct tagMSIVIEW *view ) { - MSIDELETEVIEW *dv = (MSIDELETEVIEW*)view; + struct delete_view *dv = (struct delete_view *)view; TRACE("%p\n", dv ); @@ -114,7 +114,7 @@ static UINT DELETE_close( struct tagMSIVIEW *view ) static UINT DELETE_get_dimensions( struct tagMSIVIEW *view, UINT *rows, UINT *cols ) { - MSIDELETEVIEW *dv = (MSIDELETEVIEW*)view; + struct delete_view *dv = (struct delete_view *)view; TRACE("%p %p %p\n", dv, rows, cols ); @@ -129,7 +129,7 @@ static UINT DELETE_get_dimensions( struct tagMSIVIEW *view, UINT *rows, UINT *co static UINT DELETE_get_column_info( struct tagMSIVIEW *view, UINT n, LPCWSTR *name, UINT *type, BOOL *temporary, LPCWSTR *table_name ) { - MSIDELETEVIEW *dv = (MSIDELETEVIEW*)view; + struct delete_view *dv = (struct delete_view *)view; TRACE("%p %d %p %p %p %p\n", dv, n, name, type, temporary, table_name ); @@ -143,7 +143,7 @@ static UINT DELETE_get_column_info( struct tagMSIVIEW *view, UINT n, LPCWSTR *na static UINT DELETE_modify( struct tagMSIVIEW *view, MSIMODIFY eModifyMode, MSIRECORD *rec, UINT row ) { - MSIDELETEVIEW *dv = (MSIDELETEVIEW*)view; + struct delete_view *dv = (struct delete_view *)view; TRACE("%p %d %p\n", dv, eModifyMode, rec ); @@ -152,14 +152,14 @@ static UINT DELETE_modify( struct tagMSIVIEW *view, MSIMODIFY eModifyMode, static UINT DELETE_delete( struct tagMSIVIEW *view ) { - MSIDELETEVIEW *dv = (MSIDELETEVIEW*)view; + struct delete_view *dv = (struct delete_view *)view; TRACE("%p\n", dv ); if( dv->table ) dv->table->ops->delete( dv->table ); - msi_free( dv ); + free( dv ); return ERROR_SUCCESS; } @@ -189,11 +189,11 @@ static const MSIVIEWOPS delete_ops = UINT DELETE_CreateView( MSIDATABASE *db, MSIVIEW **view, MSIVIEW *table ) { - MSIDELETEVIEW *dv = NULL; + struct delete_view *dv = NULL; TRACE("%p\n", dv ); - dv = msi_alloc_zero( sizeof *dv ); + dv = calloc( 1, sizeof *dv ); if( !dv ) return ERROR_FUNCTION_FAILED; diff --git a/dll/win32/msi/dialog.c b/dll/win32/msi/dialog.c index 97257636e5e2a..9b72b1ed7cca2 100644 --- a/dll/win32/msi/dialog.c +++ b/dll/win32/msi/dialog.c @@ -20,7 +20,6 @@ */ #define COBJMACROS -#define NONAMELESSUNION #include @@ -49,19 +48,12 @@ WINE_DEFAULT_DEBUG_CHANNEL(msi); extern HINSTANCE msi_hInstance; -struct msi_control_tag; -typedef struct msi_control_tag msi_control; -typedef UINT (*msi_handler)( msi_dialog *, msi_control *, WPARAM ); -typedef void (*msi_update)( msi_dialog *, msi_control * ); -typedef UINT (*control_event_handler)( msi_dialog *, const WCHAR *, const WCHAR * ); -typedef UINT (*event_handler)( msi_dialog *, const WCHAR * ); - -struct msi_control_tag +struct control { struct list entry; HWND hwnd; - msi_handler handler; - msi_update update; + UINT (*handler)( msi_dialog *, struct control *, WPARAM ); + void (*update)( msi_dialog *, struct control * ); LPWSTR property; LPWSTR value; HBITMAP hBitmap; @@ -77,19 +69,19 @@ struct msi_control_tag WCHAR name[1]; }; -typedef struct msi_font_tag +struct font { struct list entry; HFONT hfont; COLORREF color; WCHAR name[1]; -} msi_font; +}; struct msi_dialog_tag { MSIPACKAGE *package; msi_dialog *parent; - control_event_handler event_handler; + UINT (*event_handler)( msi_dialog *, const WCHAR *, const WCHAR * ); BOOL finished; INT scale; DWORD attributes; @@ -101,7 +93,7 @@ struct msi_dialog_tag HWND hWndFocus; LPWSTR control_default; LPWSTR control_cancel; - event_handler pending_event; + UINT (*pending_event)( msi_dialog *, const WCHAR * ); LPWSTR pending_argument; INT retval; WCHAR name[1]; @@ -116,19 +108,18 @@ struct subscriber WCHAR *attribute; }; -typedef UINT (*msi_dialog_control_func)( msi_dialog *dialog, MSIRECORD *rec ); struct control_handler { LPCWSTR control_type; - msi_dialog_control_func func; + UINT (*func)( msi_dialog *dialog, MSIRECORD *rec ); }; -typedef struct +struct radio_button_group_descr { - msi_dialog* dialog; - msi_control *parent; - LPWSTR propval; -} radio_button_group_descr; + msi_dialog *dialog; + struct control *parent; + WCHAR *propval; +}; /* dialog sequencing */ @@ -140,71 +131,74 @@ typedef struct static DWORD uiThreadId; static HWND hMsiHiddenWindow; -static LPWSTR msi_get_window_text( HWND hwnd ) +static WCHAR *get_window_text( HWND hwnd ) { UINT sz, r; - LPWSTR buf; + WCHAR *buf, *new_buf; sz = 0x20; - buf = msi_alloc( sz*sizeof(WCHAR) ); + buf = malloc( sz * sizeof(WCHAR) ); while ( buf ) { r = GetWindowTextW( hwnd, buf, sz ); if ( r < (sz - 1) ) break; sz *= 2; - buf = msi_realloc( buf, sz*sizeof(WCHAR) ); + new_buf = realloc( buf, sz * sizeof(WCHAR) ); + if ( !new_buf ) + free( buf ); + buf = new_buf; } return buf; } -static INT msi_dialog_scale_unit( msi_dialog *dialog, INT val ) +static INT dialog_scale_unit( msi_dialog *dialog, INT val ) { return MulDiv( val, dialog->scale, 12 ); } -static msi_control *msi_dialog_find_control( msi_dialog *dialog, LPCWSTR name ) +static struct control *dialog_find_control( msi_dialog *dialog, const WCHAR *name ) { - msi_control *control; + struct control *control; if( !name ) return NULL; if( !dialog->hwnd ) return NULL; - LIST_FOR_EACH_ENTRY( control, &dialog->controls, msi_control, entry ) + LIST_FOR_EACH_ENTRY( control, &dialog->controls, struct control, entry ) if( !wcscmp( control->name, name ) ) /* FIXME: case sensitive? */ return control; return NULL; } -static msi_control *msi_dialog_find_control_by_type( msi_dialog *dialog, LPCWSTR type ) +static struct control *dialog_find_control_by_type( msi_dialog *dialog, const WCHAR *type ) { - msi_control *control; + struct control *control; if( !type ) return NULL; if( !dialog->hwnd ) return NULL; - LIST_FOR_EACH_ENTRY( control, &dialog->controls, msi_control, entry ) + LIST_FOR_EACH_ENTRY( control, &dialog->controls, struct control, entry ) if( !wcscmp( control->type, type ) ) /* FIXME: case sensitive? */ return control; return NULL; } -static msi_control *msi_dialog_find_control_by_hwnd( msi_dialog *dialog, HWND hwnd ) +static struct control *dialog_find_control_by_hwnd( msi_dialog *dialog, HWND hwnd ) { - msi_control *control; + struct control *control; if( !dialog->hwnd ) return NULL; - LIST_FOR_EACH_ENTRY( control, &dialog->controls, msi_control, entry ) + LIST_FOR_EACH_ENTRY( control, &dialog->controls, struct control, entry ) if( hwnd == control->hwnd ) return control; return NULL; } -static LPWSTR msi_get_deformatted_field( MSIPACKAGE *package, MSIRECORD *rec, int field ) +static WCHAR *get_deformatted_field( MSIPACKAGE *package, MSIRECORD *rec, int field ) { LPCWSTR str = MSI_RecordGetString( rec, field ); LPWSTR ret = NULL; @@ -214,7 +208,7 @@ static LPWSTR msi_get_deformatted_field( MSIPACKAGE *package, MSIRECORD *rec, in return ret; } -static LPWSTR msi_dialog_dup_property( msi_dialog *dialog, LPCWSTR property, BOOL indirect ) +static WCHAR *dialog_dup_property( msi_dialog *dialog, const WCHAR *property, BOOL indirect ) { LPWSTR prop = NULL; @@ -225,18 +219,18 @@ static LPWSTR msi_dialog_dup_property( msi_dialog *dialog, LPCWSTR property, BOO prop = msi_dup_property( dialog->package->db, property ); if (!prop) - prop = strdupW( property ); + prop = wcsdup( property ); return prop; } /* - * msi_dialog_get_style + * dialog_get_style * * Extract the {\style} string from the front of the text to display and * update the pointer. Only the last style in a list is applied. */ -static LPWSTR msi_dialog_get_style( LPCWSTR p, LPCWSTR *rest ) +static WCHAR *dialog_get_style( const WCHAR *p, const WCHAR **rest ) { LPWSTR ret; LPCWSTR q, i, first; @@ -265,7 +259,7 @@ static LPWSTR msi_dialog_get_style( LPCWSTR p, LPCWSTR *rest ) *rest = ++q; len = q - p; - ret = msi_alloc( len*sizeof(WCHAR) ); + ret = malloc( len * sizeof(WCHAR) ); if( !ret ) return ret; memcpy( ret, p, len*sizeof(WCHAR) ); @@ -273,10 +267,10 @@ static LPWSTR msi_dialog_get_style( LPCWSTR p, LPCWSTR *rest ) return ret; } -static UINT msi_dialog_add_font( MSIRECORD *rec, LPVOID param ) +static UINT dialog_add_font( MSIRECORD *rec, void *param ) { msi_dialog *dialog = param; - msi_font *font; + struct font *font; LPCWSTR face, name; LOGFONTW lf; INT style; @@ -284,7 +278,7 @@ static UINT msi_dialog_add_font( MSIRECORD *rec, LPVOID param ) /* create a font and add it to the list */ name = MSI_RecordGetString( rec, 1 ); - font = msi_alloc( FIELD_OFFSET( msi_font, name[lstrlenW( name ) + 1] )); + font = malloc( offsetof( struct font, name[wcslen( name ) + 1] ) ); lstrcpyW( font->name, name ); list_add_head( &dialog->fonts, &font->entry ); @@ -319,22 +313,22 @@ static UINT msi_dialog_add_font( MSIRECORD *rec, LPVOID param ) return ERROR_SUCCESS; } -static msi_font *msi_dialog_find_font( msi_dialog *dialog, LPCWSTR name ) +static struct font *dialog_find_font( msi_dialog *dialog, const WCHAR *name ) { - msi_font *font = NULL; + struct font *font = NULL; - LIST_FOR_EACH_ENTRY( font, &dialog->fonts, msi_font, entry ) + LIST_FOR_EACH_ENTRY( font, &dialog->fonts, struct font, entry ) if( !wcscmp( font->name, name ) ) /* FIXME: case sensitive? */ break; return font; } -static UINT msi_dialog_set_font( msi_dialog *dialog, HWND hwnd, LPCWSTR name ) +static UINT dialog_set_font( msi_dialog *dialog, HWND hwnd, const WCHAR *name ) { - msi_font *font; + struct font *font; - font = msi_dialog_find_font( dialog, name ); + font = dialog_find_font( dialog, name ); if( font ) SendMessageW( hwnd, WM_SETFONT, (WPARAM) font->hfont, TRUE ); else @@ -342,7 +336,7 @@ static UINT msi_dialog_set_font( msi_dialog *dialog, HWND hwnd, LPCWSTR name ) return ERROR_SUCCESS; } -static UINT msi_dialog_build_font_list( msi_dialog *dialog ) +static UINT dialog_build_font_list( msi_dialog *dialog ) { MSIQUERY *view; UINT r; @@ -353,42 +347,42 @@ static UINT msi_dialog_build_font_list( msi_dialog *dialog ) if( r != ERROR_SUCCESS ) return r; - r = MSI_IterateRecords( view, NULL, msi_dialog_add_font, dialog ); + r = MSI_IterateRecords( view, NULL, dialog_add_font, dialog ); msiobj_release( &view->hdr ); return r; } -static void msi_destroy_control( msi_control *t ) +static void destroy_control( struct control *t ) { list_remove( &t->entry ); /* leave dialog->hwnd - destroying parent destroys child windows */ - msi_free( t->property ); - msi_free( t->value ); + free( t->property ); + free( t->value ); if( t->hBitmap ) DeleteObject( t->hBitmap ); if( t->hIcon ) DestroyIcon( t->hIcon ); if ( t->hImageList ) ImageList_Destroy( t->hImageList ); - msi_free( t->tabnext ); - msi_free( t->type ); + free( t->tabnext ); + free( t->type ); if (t->hDll) FreeLibrary( t->hDll ); - msi_free( t ); + free( t ); } -static msi_control *dialog_create_window( msi_dialog *dialog, MSIRECORD *rec, DWORD exstyle, - const WCHAR *szCls, const WCHAR *name, const WCHAR *text, - DWORD style, HWND parent ) +static struct control *dialog_create_window( msi_dialog *dialog, MSIRECORD *rec, DWORD exstyle, + const WCHAR *szCls, const WCHAR *name, const WCHAR *text, + DWORD style, HWND parent ) { DWORD x, y, width, height; LPWSTR font = NULL, title_font = NULL; LPCWSTR title = NULL; - msi_control *control; + struct control *control; style |= WS_CHILD; - control = msi_alloc( FIELD_OFFSET( msi_control, name[lstrlenW( name ) + 1] )); + control = malloc( offsetof( struct control, name[wcslen( name ) + 1] ) ); if (!control) return NULL; @@ -402,8 +396,8 @@ static msi_control *dialog_create_window( msi_dialog *dialog, MSIRECORD *rec, DW control->hIcon = NULL; control->hImageList = NULL; control->hDll = NULL; - control->tabnext = strdupW( MSI_RecordGetString( rec, 11) ); - control->type = strdupW( MSI_RecordGetString( rec, 3 ) ); + control->tabnext = wcsdup( MSI_RecordGetString( rec, 11 ) ); + control->type = wcsdup( MSI_RecordGetString( rec, 3 ) ); control->progress_current = 0; control->progress_max = 100; control->progress_backwards = FALSE; @@ -413,46 +407,47 @@ static msi_control *dialog_create_window( msi_dialog *dialog, MSIRECORD *rec, DW width = MSI_RecordGetInteger( rec, 6 ); height = MSI_RecordGetInteger( rec, 7 ); - x = msi_dialog_scale_unit( dialog, x ); - y = msi_dialog_scale_unit( dialog, y ); - width = msi_dialog_scale_unit( dialog, width ); - height = msi_dialog_scale_unit( dialog, height ); + x = dialog_scale_unit( dialog, x ); + y = dialog_scale_unit( dialog, y ); + width = dialog_scale_unit( dialog, width ); + height = dialog_scale_unit( dialog, height ); if( text ) { deformat_string( dialog->package, text, &title_font ); - font = msi_dialog_get_style( title_font, &title ); + font = dialog_get_style( title_font, &title ); } + if (!wcsicmp( MSI_RecordGetString( rec, 3 ), L"Line" )) + height = 2; /* line is exactly 2 units in height */ + control->hwnd = CreateWindowExW( exstyle, szCls, title, style, x, y, width, height, parent, NULL, NULL, NULL ); TRACE("Dialog %s control %s hwnd %p\n", debugstr_w(dialog->name), debugstr_w(text), control->hwnd ); - msi_dialog_set_font( dialog, control->hwnd, - font ? font : dialog->default_font ); + dialog_set_font( dialog, control->hwnd, font ? font : dialog->default_font ); - msi_free( title_font ); - msi_free( font ); + free( title_font ); + free( font ); return control; } -static LPWSTR msi_dialog_get_uitext( msi_dialog *dialog, LPCWSTR key ) +static WCHAR *dialog_get_uitext( msi_dialog *dialog, const WCHAR *key ) { MSIRECORD *rec; LPWSTR text; rec = MSI_QueryGetRecord( dialog->package->db, L"SELECT * FROM `UIText` WHERE `Key` = '%s'", key ); if (!rec) return NULL; - text = strdupW( MSI_RecordGetString( rec, 2 ) ); + text = wcsdup( MSI_RecordGetString( rec, 2 ) ); msiobj_release( &rec->hdr ); return text; } -static HANDLE msi_load_image( MSIDATABASE *db, LPCWSTR name, UINT type, - UINT cx, UINT cy, UINT flags ) +static HANDLE load_image( MSIDATABASE *db, const WCHAR *name, UINT type, UINT cx, UINT cy, UINT flags ) { MSIRECORD *rec; HANDLE himage = NULL; @@ -475,11 +470,11 @@ static HANDLE msi_load_image( MSIDATABASE *db, LPCWSTR name, UINT type, } DeleteFileW( tmp ); - msi_free( tmp ); + free( tmp ); return himage; } -static HICON msi_load_icon( MSIDATABASE *db, LPCWSTR text, UINT attributes ) +static HICON load_icon( MSIDATABASE *db, const WCHAR *text, UINT attributes ) { DWORD cx = 0, cy = 0, flags; @@ -499,39 +494,39 @@ static HICON msi_load_icon( MSIDATABASE *db, LPCWSTR text, UINT attributes ) } /* msidbControlAttributesIconSize48 handled by above logic */ } - return msi_load_image( db, text, IMAGE_ICON, cx, cy, flags ); + return load_image( db, text, IMAGE_ICON, cx, cy, flags ); } -static void msi_dialog_update_controls( msi_dialog *dialog, LPCWSTR property ) +static void dialog_update_controls( msi_dialog *dialog, const WCHAR *property ) { - msi_control *control; + struct control *control; - LIST_FOR_EACH_ENTRY( control, &dialog->controls, msi_control, entry ) + LIST_FOR_EACH_ENTRY( control, &dialog->controls, struct control, entry ) { if ( control->property && !wcscmp( control->property, property ) && control->update ) control->update( dialog, control ); } } -static void msi_dialog_update_all_controls( msi_dialog *dialog ) +static void dialog_update_all_controls( msi_dialog *dialog ) { - msi_control *control; + struct control *control; - LIST_FOR_EACH_ENTRY( control, &dialog->controls, msi_control, entry ) + LIST_FOR_EACH_ENTRY( control, &dialog->controls, struct control, entry ) { if ( control->property && control->update ) control->update( dialog, control ); } } -static void msi_dialog_set_property( MSIPACKAGE *package, LPCWSTR property, LPCWSTR value ) +static void dialog_set_property( MSIPACKAGE *package, const WCHAR *property, const WCHAR *value ) { UINT r = msi_set_property( package->db, property, value, -1 ); if (r == ERROR_SUCCESS && !wcscmp( property, L"SourceDir" )) msi_reset_source_folders( package ); } -static MSIFEATURE *msi_seltree_feature_from_item( HWND hwnd, HTREEITEM hItem ) +static MSIFEATURE *seltree_feature_from_item( HWND hwnd, HTREEITEM hItem ) { TVITEMW tvi; @@ -551,18 +546,17 @@ struct msi_selection_tree_info HTREEITEM selected; }; -static MSIFEATURE *msi_seltree_get_selected_feature( msi_control *control ) +static MSIFEATURE *seltree_get_selected_feature( struct control *control ) { struct msi_selection_tree_info *info = GetPropW( control->hwnd, L"MSIDATA" ); - return msi_seltree_feature_from_item( control->hwnd, info->selected ); + return seltree_feature_from_item( control->hwnd, info->selected ); } -static void dialog_handle_event( msi_dialog *dialog, const WCHAR *control, - const WCHAR *attribute, MSIRECORD *rec ) +static void dialog_handle_event( msi_dialog *dialog, const WCHAR *control, const WCHAR *attribute, MSIRECORD *rec ) { - msi_control* ctrl; + struct control* ctrl; - ctrl = msi_dialog_find_control( dialog, control ); + ctrl = dialog_find_control( dialog, control ); if (!ctrl) return; if( !wcscmp( attribute, L"Text" ) ) @@ -571,15 +565,15 @@ static void dialog_handle_event( msi_dialog *dialog, const WCHAR *control, WCHAR *font, *text_fmt = NULL; font_text = MSI_RecordGetString( rec , 1 ); - font = msi_dialog_get_style( font_text, &text ); + font = dialog_get_style( font_text, &text ); deformat_string( dialog->package, text, &text_fmt ); if (text_fmt) text = text_fmt; else text = L""; SetWindowTextW( ctrl->hwnd, text ); - msi_free( font ); - msi_free( text_fmt ); + free( font ); + free( text_fmt ); msi_dialog_check_messages( NULL ); } else if( !wcscmp( attribute, L"Progress" ) ) @@ -639,16 +633,16 @@ static void dialog_handle_event( msi_dialog *dialog, const WCHAR *control, } else if ( !wcscmp( attribute, L"Property" ) ) { - MSIFEATURE *feature = msi_seltree_get_selected_feature( ctrl ); - if (feature) msi_dialog_set_property( dialog->package, ctrl->property, feature->Directory ); + MSIFEATURE *feature = seltree_get_selected_feature( ctrl ); + if (feature) dialog_set_property( dialog->package, ctrl->property, feature->Directory ); } else if ( !wcscmp( attribute, L"SelectionPath" ) ) { BOOL indirect = ctrl->attributes & msidbControlAttributesIndirect; - LPWSTR path = msi_dialog_dup_property( dialog, ctrl->property, indirect ); + WCHAR *path = dialog_dup_property( dialog, ctrl->property, indirect ); if (!path) return; SetWindowTextW( ctrl->hwnd, path ); - msi_free(path); + free( path ); } else { @@ -675,11 +669,11 @@ static void event_subscribe( msi_dialog *dialog, const WCHAR *event, const WCHAR return; }; } - if (!(sub = msi_alloc( sizeof(*sub) ))) return; + if (!(sub = malloc( sizeof(*sub) ))) return; sub->dialog = dialog; - sub->event = strdupW( event ); - sub->control = strdupW( control ); - sub->attribute = strdupW( attribute ); + sub->event = wcsdup( event ); + sub->control = wcsdup( control ); + sub->attribute = wcsdup( attribute ); list_add_tail( &dialog->package->subscriptions, &sub->entry ); } @@ -718,8 +712,7 @@ static void dialog_map_events( msi_dialog *dialog, const WCHAR *control ) } /* everything except radio buttons */ -static msi_control *msi_dialog_add_control( msi_dialog *dialog, - MSIRECORD *rec, LPCWSTR szCls, DWORD style ) +static struct control *dialog_add_control( msi_dialog *dialog, MSIRECORD *rec, const WCHAR *szCls, DWORD style ) { DWORD attributes; const WCHAR *text = NULL, *name, *control_type; @@ -746,7 +739,7 @@ static msi_control *msi_dialog_add_control( msi_dialog *dialog, struct msi_text_info { - msi_font *font; + struct font *font; WNDPROC oldproc; DWORD attributes; }; @@ -755,7 +748,7 @@ struct msi_text_info * we don't erase our own background, * so we have to make sure that the parent window redraws first */ -static void msi_text_on_settext( HWND hWnd ) +static void text_on_settext( HWND hWnd ) { HWND hParent; RECT rc; @@ -766,8 +759,7 @@ static void msi_text_on_settext( HWND hWnd ) InvalidateRect( hParent, &rc, TRUE ); } -static LRESULT WINAPI -MSIText_WndProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam) +static LRESULT WINAPI MSIText_WndProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam) { struct msi_text_info *info; LRESULT r = 0; @@ -790,10 +782,10 @@ MSIText_WndProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam) switch( msg ) { case WM_SETTEXT: - msi_text_on_settext( hWnd ); + text_on_settext( hWnd ); break; case WM_NCDESTROY: - msi_free( info ); + free( info ); RemovePropW( hWnd, L"MSIDATA" ); break; } @@ -801,32 +793,32 @@ MSIText_WndProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam) return r; } -static UINT msi_dialog_text_control( msi_dialog *dialog, MSIRECORD *rec ) +static UINT dialog_text_control( msi_dialog *dialog, MSIRECORD *rec ) { - msi_control *control; + struct control *control; struct msi_text_info *info; LPCWSTR text, ptr, prop, control_name; LPWSTR font_name; TRACE("%p %p\n", dialog, rec); - control = msi_dialog_add_control( dialog, rec, L"Static", SS_LEFT | WS_GROUP ); + control = dialog_add_control( dialog, rec, L"Static", SS_LEFT | WS_GROUP ); if( !control ) return ERROR_FUNCTION_FAILED; - info = msi_alloc( sizeof *info ); + info = malloc( sizeof *info ); if( !info ) return ERROR_SUCCESS; control_name = MSI_RecordGetString( rec, 2 ); control->attributes = MSI_RecordGetInteger( rec, 8 ); prop = MSI_RecordGetString( rec, 9 ); - control->property = msi_dialog_dup_property( dialog, prop, FALSE ); + control->property = dialog_dup_property( dialog, prop, FALSE ); text = MSI_RecordGetString( rec, 10 ); - font_name = msi_dialog_get_style( text, &ptr ); - info->font = ( font_name ) ? msi_dialog_find_font( dialog, font_name ) : NULL; - msi_free( font_name ); + font_name = dialog_get_style( text, &ptr ); + info->font = ( font_name ) ? dialog_find_font( dialog, font_name ) : NULL; + free( font_name ); info->attributes = MSI_RecordGetInteger( rec, 8 ); if( info->attributes & msidbControlAttributesTransparent ) @@ -841,11 +833,11 @@ static UINT msi_dialog_text_control( msi_dialog *dialog, MSIRECORD *rec ) } /* strip any leading text style label from text field */ -static WCHAR *msi_get_binary_name( MSIPACKAGE *package, MSIRECORD *rec ) +static WCHAR *get_binary_name( MSIPACKAGE *package, MSIRECORD *rec ) { WCHAR *p, *text; - text = msi_get_deformatted_field( package, rec, 10 ); + text = get_deformatted_field( package, rec, 10 ); if (!text) return NULL; @@ -856,34 +848,34 @@ static WCHAR *msi_get_binary_name( MSIPACKAGE *package, MSIRECORD *rec ) while (*p && *p != '}') p++; if (!*p++) return text; - p = strdupW( p ); - msi_free( text ); + p = wcsdup( p ); + free( text ); return p; } -static UINT msi_dialog_set_property_event( msi_dialog *dialog, LPCWSTR event, LPCWSTR arg ) +static UINT dialog_set_property_event( msi_dialog *dialog, const WCHAR *event, const WCHAR *arg ) { LPWSTR p, prop, arg_fmt = NULL; UINT len; len = lstrlenW( event ); - prop = msi_alloc( len * sizeof(WCHAR) ); + prop = malloc( len * sizeof(WCHAR) ); lstrcpyW( prop, &event[1] ); p = wcschr( prop, ']' ); if (p && (p[1] == 0 || p[1] == ' ')) { *p = 0; if (wcscmp( L"{}", arg )) deformat_string( dialog->package, arg, &arg_fmt ); - msi_dialog_set_property( dialog->package, prop, arg_fmt ); - msi_dialog_update_controls( dialog, prop ); - msi_free( arg_fmt ); + dialog_set_property( dialog->package, prop, arg_fmt ); + dialog_update_controls( dialog, prop ); + free( arg_fmt ); } else ERR("Badly formatted property string - what happens?\n"); - msi_free( prop ); + free( prop ); return ERROR_SUCCESS; } -static UINT msi_dialog_send_event( msi_dialog *dialog, LPCWSTR event, LPCWSTR arg ) +static UINT dialog_send_event( msi_dialog *dialog, const WCHAR *event, const WCHAR *arg ) { LPWSTR event_fmt = NULL, arg_fmt = NULL; @@ -894,13 +886,13 @@ static UINT msi_dialog_send_event( msi_dialog *dialog, LPCWSTR event, LPCWSTR ar dialog->event_handler( dialog, event_fmt, arg_fmt ); - msi_free( event_fmt ); - msi_free( arg_fmt ); + free( event_fmt ); + free( arg_fmt ); return ERROR_SUCCESS; } -static UINT msi_dialog_control_event( MSIRECORD *rec, LPVOID param ) +static UINT dialog_control_event( MSIRECORD *rec, void *param ) { msi_dialog *dialog = param; LPCWSTR condition, event, arg; @@ -913,14 +905,14 @@ static UINT msi_dialog_control_event( MSIRECORD *rec, LPVOID param ) event = MSI_RecordGetString( rec, 3 ); arg = MSI_RecordGetString( rec, 4 ); if (event[0] == '[') - msi_dialog_set_property_event( dialog, event, arg ); + dialog_set_property_event( dialog, event, arg ); else - msi_dialog_send_event( dialog, event, arg ); + dialog_send_event( dialog, event, arg ); } return ERROR_SUCCESS; } -static UINT msi_dialog_button_handler( msi_dialog *dialog, msi_control *control, WPARAM param ) +static UINT dialog_button_handler( msi_dialog *dialog, struct control *control, WPARAM param ) { MSIQUERY *view; UINT r; @@ -936,7 +928,7 @@ static UINT msi_dialog_button_handler( msi_dialog *dialog, msi_control *control, ERR("query failed\n"); return ERROR_SUCCESS; } - r = MSI_IterateRecords( view, 0, msi_dialog_control_event, dialog ); + r = MSI_IterateRecords( view, 0, dialog_control_event, dialog ); msiobj_release( &view->hdr ); /* dialog control events must be processed last regardless of ordering */ @@ -944,14 +936,14 @@ static UINT msi_dialog_button_handler( msi_dialog *dialog, msi_control *control, { r = dialog->pending_event( dialog, dialog->pending_argument ); - msi_free( dialog->pending_argument ); + free( dialog->pending_argument ); dialog->pending_event = NULL; dialog->pending_argument = NULL; } return r; } -static HBITMAP msi_load_picture( MSIDATABASE *db, const WCHAR *name, INT cx, INT cy, DWORD flags ) +static HBITMAP load_picture( MSIDATABASE *db, const WCHAR *name, INT cx, INT cy, DWORD flags ) { HBITMAP hOleBitmap = 0, hBitmap = 0, hOldSrcBitmap, hOldDestBitmap; MSIRECORD *rec = NULL; @@ -1015,9 +1007,9 @@ static HBITMAP msi_load_picture( MSIDATABASE *db, const WCHAR *name, INT cx, INT return hBitmap; } -static UINT msi_dialog_button_control( msi_dialog *dialog, MSIRECORD *rec ) +static UINT dialog_button_control( msi_dialog *dialog, MSIRECORD *rec ) { - msi_control *control; + struct control *control; UINT attributes, style, cx = 0, cy = 0, flags = 0; WCHAR *name = NULL; @@ -1032,21 +1024,21 @@ static UINT msi_dialog_button_control( msi_dialog *dialog, MSIRECORD *rec ) if (attributes & msidbControlAttributesFixedSize) flags |= LR_DEFAULTSIZE; else { - cx = msi_dialog_scale_unit( dialog, MSI_RecordGetInteger(rec, 6) ); - cy = msi_dialog_scale_unit( dialog, MSI_RecordGetInteger(rec, 7) ); + cx = dialog_scale_unit( dialog, MSI_RecordGetInteger(rec, 6) ); + cy = dialog_scale_unit( dialog, MSI_RecordGetInteger(rec, 7) ); } } - control = msi_dialog_add_control( dialog, rec, L"BUTTON", style ); + control = dialog_add_control( dialog, rec, L"BUTTON", style ); if (!control) return ERROR_FUNCTION_FAILED; - control->handler = msi_dialog_button_handler; + control->handler = dialog_button_handler; if (attributes & msidbControlAttributesIcon) { - name = msi_get_binary_name( dialog->package, rec ); - control->hIcon = msi_load_icon( dialog->package->db, name, attributes ); + name = get_binary_name( dialog->package, rec ); + control->hIcon = load_icon( dialog->package->db, name, attributes ); if (control->hIcon) { SendMessageW( control->hwnd, BM_SETIMAGE, IMAGE_ICON, (LPARAM) control->hIcon ); @@ -1055,8 +1047,8 @@ static UINT msi_dialog_button_control( msi_dialog *dialog, MSIRECORD *rec ) } else if (attributes & msidbControlAttributesBitmap) { - name = msi_get_binary_name( dialog->package, rec ); - control->hBitmap = msi_load_picture( dialog->package->db, name, cx, cy, flags ); + name = get_binary_name( dialog->package, rec ); + control->hBitmap = load_picture( dialog->package->db, name, cx, cy, flags ); if (control->hBitmap) { SendMessageW( control->hwnd, BM_SETIMAGE, IMAGE_BITMAP, (LPARAM) control->hBitmap ); @@ -1064,11 +1056,11 @@ static UINT msi_dialog_button_control( msi_dialog *dialog, MSIRECORD *rec ) else ERR("Failed to load bitmap %s\n", debugstr_w(name)); } - msi_free( name ); + free( name ); return ERROR_SUCCESS; } -static LPWSTR msi_get_checkbox_value( msi_dialog *dialog, LPCWSTR prop ) +static WCHAR *get_checkbox_value( msi_dialog *dialog, const WCHAR *prop ) { MSIRECORD *rec = NULL; LPWSTR ret = NULL; @@ -1078,10 +1070,10 @@ static LPWSTR msi_get_checkbox_value( msi_dialog *dialog, LPCWSTR prop ) if (!rec) return ret; - ret = msi_get_deformatted_field( dialog->package, rec, 2 ); + ret = get_deformatted_field( dialog->package, rec, 2 ); if( ret && !ret[0] ) { - msi_free( ret ); + free( ret ); ret = NULL; } msiobj_release( &rec->hdr ); @@ -1091,14 +1083,14 @@ static LPWSTR msi_get_checkbox_value( msi_dialog *dialog, LPCWSTR prop ) ret = msi_dup_property( dialog->package->db, prop ); if( ret && !ret[0] ) { - msi_free( ret ); + free( ret ); ret = NULL; } return ret; } -static UINT msi_dialog_get_checkbox_state( msi_dialog *dialog, msi_control *control ) +static UINT dialog_get_checkbox_state( msi_dialog *dialog, struct control *control ) { WCHAR state[2] = {0}; DWORD sz = 2; @@ -1107,14 +1099,14 @@ static UINT msi_dialog_get_checkbox_state( msi_dialog *dialog, msi_control *cont return state[0] ? 1 : 0; } -static void msi_dialog_set_checkbox_state( msi_dialog *dialog, msi_control *control, UINT state ) +static void dialog_set_checkbox_state( msi_dialog *dialog, struct control *control, UINT state ) { LPCWSTR val; /* if uncheck then the property is set to NULL */ if (!state) { - msi_dialog_set_property( dialog->package, control->property, NULL ); + dialog_set_property( dialog->package, control->property, NULL ); return; } @@ -1124,16 +1116,16 @@ static void msi_dialog_set_checkbox_state( msi_dialog *dialog, msi_control *cont else val = L"1"; - msi_dialog_set_property( dialog->package, control->property, val ); + dialog_set_property( dialog->package, control->property, val ); } -static void msi_dialog_checkbox_sync_state( msi_dialog *dialog, msi_control *control ) +static void dialog_checkbox_sync_state( msi_dialog *dialog, struct control *control ) { - UINT state = msi_dialog_get_checkbox_state( dialog, control ); + UINT state = dialog_get_checkbox_state( dialog, control ); SendMessageW( control->hwnd, BM_SETCHECK, state ? BST_CHECKED : BST_UNCHECKED, 0 ); } -static UINT msi_dialog_checkbox_handler( msi_dialog *dialog, msi_control *control, WPARAM param ) +static UINT dialog_checkbox_handler( msi_dialog *dialog, struct control *control, WPARAM param ) { UINT state; @@ -1142,91 +1134,39 @@ static UINT msi_dialog_checkbox_handler( msi_dialog *dialog, msi_control *contro TRACE("clicked checkbox %s, set %s\n", debugstr_w(control->name), debugstr_w(control->property)); - state = msi_dialog_get_checkbox_state( dialog, control ); + state = dialog_get_checkbox_state( dialog, control ); state = state ? 0 : 1; - msi_dialog_set_checkbox_state( dialog, control, state ); - msi_dialog_checkbox_sync_state( dialog, control ); + dialog_set_checkbox_state( dialog, control, state ); + dialog_checkbox_sync_state( dialog, control ); - return msi_dialog_button_handler( dialog, control, param ); + return dialog_button_handler( dialog, control, param ); } -static UINT msi_dialog_checkbox_control( msi_dialog *dialog, MSIRECORD *rec ) +static UINT dialog_checkbox_control( msi_dialog *dialog, MSIRECORD *rec ) { - msi_control *control; + struct control *control; LPCWSTR prop; TRACE("%p %p\n", dialog, rec); - control = msi_dialog_add_control( dialog, rec, L"BUTTON", BS_CHECKBOX | BS_MULTILINE | WS_TABSTOP ); - control->handler = msi_dialog_checkbox_handler; - control->update = msi_dialog_checkbox_sync_state; + control = dialog_add_control( dialog, rec, L"BUTTON", BS_CHECKBOX | BS_MULTILINE | WS_TABSTOP ); + control->handler = dialog_checkbox_handler; + control->update = dialog_checkbox_sync_state; prop = MSI_RecordGetString( rec, 9 ); if (prop) { - control->property = strdupW( prop ); - control->value = msi_get_checkbox_value( dialog, prop ); + control->property = wcsdup( prop ); + control->value = get_checkbox_value( dialog, prop ); TRACE("control %s value %s\n", debugstr_w(control->property), debugstr_w(control->value)); } - msi_dialog_checkbox_sync_state( dialog, control ); + dialog_checkbox_sync_state( dialog, control ); return ERROR_SUCCESS; } -static UINT msi_dialog_line_control( msi_dialog *dialog, MSIRECORD *rec ) +static UINT dialog_line_control( msi_dialog *dialog, MSIRECORD *rec ) { - DWORD attributes; - LPCWSTR name; - DWORD style, exstyle = 0; - DWORD x, y, width, height; - msi_control *control; - - TRACE("%p %p\n", dialog, rec); - - style = WS_CHILD | SS_ETCHEDHORZ | SS_SUNKEN; - - name = MSI_RecordGetString( rec, 2 ); - attributes = MSI_RecordGetInteger( rec, 8 ); - - if( attributes & msidbControlAttributesVisible ) - style |= WS_VISIBLE; - if( ~attributes & msidbControlAttributesEnabled ) - style |= WS_DISABLED; - if( attributes & msidbControlAttributesSunken ) - exstyle |= WS_EX_CLIENTEDGE; - - dialog_map_events( dialog, name ); - - control = msi_alloc( FIELD_OFFSET(msi_control, name[lstrlenW( name ) + 1] )); - if (!control) - return ERROR_OUTOFMEMORY; - - lstrcpyW( control->name, name ); - list_add_head( &dialog->controls, &control->entry ); - control->handler = NULL; - control->property = NULL; - control->value = NULL; - control->hBitmap = NULL; - control->hIcon = NULL; - control->hDll = NULL; - control->tabnext = strdupW( MSI_RecordGetString( rec, 11) ); - control->type = strdupW( MSI_RecordGetString( rec, 3 ) ); - control->progress_current = 0; - control->progress_max = 100; - control->progress_backwards = FALSE; - - x = MSI_RecordGetInteger( rec, 4 ); - y = MSI_RecordGetInteger( rec, 5 ); - width = MSI_RecordGetInteger( rec, 6 ); - - x = msi_dialog_scale_unit( dialog, x ); - y = msi_dialog_scale_unit( dialog, y ); - width = msi_dialog_scale_unit( dialog, width ); - height = 2; /* line is exactly 2 units in height */ - - control->hwnd = CreateWindowExW( exstyle, L"Static", NULL, style, - x, y, width, height, dialog->hwnd, NULL, NULL, NULL ); - - TRACE("Dialog %s control %s hwnd %p\n", - debugstr_w(dialog->name), debugstr_w(name), control->hwnd ); + if (!dialog_add_control( dialog, rec, L"Static", SS_ETCHEDHORZ | SS_SUNKEN)) + return ERROR_FUNCTION_FAILED; return ERROR_SUCCESS; } @@ -1236,12 +1176,11 @@ static UINT msi_dialog_line_control( msi_dialog *dialog, MSIRECORD *rec ) struct msi_scrolltext_info { msi_dialog *dialog; - msi_control *control; + struct control *control; WNDPROC oldproc; }; -static LRESULT WINAPI -MSIScrollText_WndProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam) +static LRESULT WINAPI MSIScrollText_WndProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam) { struct msi_scrolltext_info *info; HRESULT r; @@ -1257,12 +1196,12 @@ MSIScrollText_WndProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam) case WM_GETDLGCODE: return DLGC_WANTARROWS; case WM_NCDESTROY: - msi_free( info ); + free( info ); RemovePropW( hWnd, L"MSIDATA" ); break; case WM_PAINT: /* native MSI sets a wait cursor here */ - msi_dialog_button_handler( info->dialog, info->control, BN_CLICKED ); + dialog_button_handler( info->dialog, info->control, BN_CLICKED ); break; } return r; @@ -1275,8 +1214,7 @@ struct msi_streamin_info DWORD length; }; -static DWORD CALLBACK -msi_richedit_stream_in( DWORD_PTR arg, LPBYTE buffer, LONG count, LONG *pcb ) +static DWORD CALLBACK richedit_stream_in( DWORD_PTR arg, BYTE *buffer, LONG count, LONG *pcb ) { struct msi_streamin_info *info = (struct msi_streamin_info*) arg; @@ -1291,7 +1229,7 @@ msi_richedit_stream_in( DWORD_PTR arg, LPBYTE buffer, LONG count, LONG *pcb ) return 0; } -static void msi_scrolltext_add_text( msi_control *control, LPCWSTR text ) +static void scrolltext_add_text( struct control *control, const WCHAR *text ) { struct msi_streamin_info info; EDITSTREAM es; @@ -1302,22 +1240,22 @@ static void msi_scrolltext_add_text( msi_control *control, LPCWSTR text ) es.dwCookie = (DWORD_PTR) &info; es.dwError = 0; - es.pfnCallback = msi_richedit_stream_in; + es.pfnCallback = richedit_stream_in; SendMessageW( control->hwnd, EM_STREAMIN, SF_RTF, (LPARAM) &es ); - msi_free( info.string ); + free( info.string ); } -static UINT msi_dialog_scrolltext_control( msi_dialog *dialog, MSIRECORD *rec ) +static UINT dialog_scrolltext_control( msi_dialog *dialog, MSIRECORD *rec ) { struct msi_scrolltext_info *info; - msi_control *control; + struct control *control; HMODULE hRichedit; LPCWSTR text; DWORD style; - info = msi_alloc( sizeof *info ); + info = malloc( sizeof *info ); if (!info) return ERROR_FUNCTION_FAILED; @@ -1325,11 +1263,11 @@ static UINT msi_dialog_scrolltext_control( msi_dialog *dialog, MSIRECORD *rec ) style = WS_BORDER | ES_MULTILINE | WS_VSCROLL | ES_READONLY | ES_AUTOVSCROLL | WS_TABSTOP; - control = msi_dialog_add_control( dialog, rec, L"RichEdit20W", style ); + control = dialog_add_control( dialog, rec, L"RichEdit20W", style ); if (!control) { FreeLibrary( hRichedit ); - msi_free( info ); + free( info ); return ERROR_FUNCTION_FAILED; } @@ -1346,16 +1284,16 @@ static UINT msi_dialog_scrolltext_control( msi_dialog *dialog, MSIRECORD *rec ) /* add the text into the richedit */ text = MSI_RecordGetString( rec, 10 ); if (text) - msi_scrolltext_add_text( control, text ); + scrolltext_add_text( control, text ); return ERROR_SUCCESS; } -static UINT msi_dialog_bitmap_control( msi_dialog *dialog, MSIRECORD *rec ) +static UINT dialog_bitmap_control( msi_dialog *dialog, MSIRECORD *rec ) { UINT cx, cy, flags, style, attributes; - msi_control *control; + struct control *control; LPWSTR name; flags = LR_LOADFROMFILE; @@ -1368,44 +1306,43 @@ static UINT msi_dialog_bitmap_control( msi_dialog *dialog, MSIRECORD *rec ) style |= SS_CENTERIMAGE; } - control = msi_dialog_add_control( dialog, rec, L"Static", style ); + control = dialog_add_control( dialog, rec, L"Static", style ); cx = MSI_RecordGetInteger( rec, 6 ); cy = MSI_RecordGetInteger( rec, 7 ); - cx = msi_dialog_scale_unit( dialog, cx ); - cy = msi_dialog_scale_unit( dialog, cy ); + cx = dialog_scale_unit( dialog, cx ); + cy = dialog_scale_unit( dialog, cy ); - name = msi_get_binary_name( dialog->package, rec ); - control->hBitmap = msi_load_picture( dialog->package->db, name, cx, cy, flags ); + name = get_binary_name( dialog->package, rec ); + control->hBitmap = load_picture( dialog->package->db, name, cx, cy, flags ); if( control->hBitmap ) SendMessageW( control->hwnd, STM_SETIMAGE, IMAGE_BITMAP, (LPARAM) control->hBitmap ); else ERR("Failed to load bitmap %s\n", debugstr_w(name)); - msi_free( name ); + free( name ); return ERROR_SUCCESS; } -static UINT msi_dialog_icon_control( msi_dialog *dialog, MSIRECORD *rec ) +static UINT dialog_icon_control( msi_dialog *dialog, MSIRECORD *rec ) { - msi_control *control; + struct control *control; DWORD attributes; LPWSTR name; TRACE("\n"); - control = msi_dialog_add_control( dialog, rec, L"Static", - SS_ICON | SS_CENTERIMAGE | WS_GROUP ); + control = dialog_add_control( dialog, rec, L"Static", SS_ICON | SS_CENTERIMAGE | WS_GROUP ); attributes = MSI_RecordGetInteger( rec, 8 ); - name = msi_get_binary_name( dialog->package, rec ); - control->hIcon = msi_load_icon( dialog->package->db, name, attributes ); + name = get_binary_name( dialog->package, rec ); + control->hIcon = load_icon( dialog->package->db, name, attributes ); if( control->hIcon ) SendMessageW( control->hwnd, STM_SETICON, (WPARAM) control->hIcon, 0 ); else ERR("Failed to load bitmap %s\n", debugstr_w(name)); - msi_free( name ); + free( name ); return ERROR_SUCCESS; } @@ -1439,9 +1376,9 @@ static LRESULT WINAPI MSIComboBox_WndProc(HWND hWnd, UINT msg, WPARAM wParam, LP { case WM_NCDESTROY: for (j = 0; j < info->num_items; j++) - msi_free( info->items[j] ); - msi_free( info->items ); - msi_free( info ); + free( info->items[j] ); + free( info->items ); + free( info ); RemovePropW( hWnd, L"MSIDATA" ); break; } @@ -1449,7 +1386,7 @@ static LRESULT WINAPI MSIComboBox_WndProc(HWND hWnd, UINT msg, WPARAM wParam, LP return r; } -static UINT msi_combobox_add_item( MSIRECORD *rec, LPVOID param ) +static UINT combobox_add_item( MSIRECORD *rec, void *param ) { struct msi_combobox_info *info = param; LPCWSTR value, text; @@ -1458,7 +1395,7 @@ static UINT msi_combobox_add_item( MSIRECORD *rec, LPVOID param ) value = MSI_RecordGetString( rec, 3 ); text = MSI_RecordGetString( rec, 4 ); - info->items[info->addpos_items] = strdupW( value ); + info->items[info->addpos_items] = wcsdup( value ); pos = SendMessageW( info->hwnd, CB_ADDSTRING, 0, (LPARAM)text ); SendMessageW( info->hwnd, CB_SETITEMDATA, pos, (LPARAM)info->items[info->addpos_items] ); @@ -1467,7 +1404,7 @@ static UINT msi_combobox_add_item( MSIRECORD *rec, LPVOID param ) return ERROR_SUCCESS; } -static UINT msi_combobox_add_items( struct msi_combobox_info *info, LPCWSTR property ) +static UINT combobox_add_items( struct msi_combobox_info *info, const WCHAR *property ) { MSIQUERY *view; DWORD count; @@ -1487,17 +1424,17 @@ static UINT msi_combobox_add_items( struct msi_combobox_info *info, LPCWSTR prop return r; } info->num_items = count; - info->items = msi_alloc( sizeof(*info->items) * count ); + info->items = malloc( sizeof(*info->items) * count ); - r = MSI_IterateRecords( view, NULL, msi_combobox_add_item, info ); + r = MSI_IterateRecords( view, NULL, combobox_add_item, info ); msiobj_release( &view->hdr ); return r; } -static UINT msi_dialog_set_control_condition( MSIRECORD *rec, LPVOID param ) +static UINT dialog_set_control_condition( MSIRECORD *rec, void *param ) { msi_dialog *dialog = param; - msi_control *control; + struct control *control; LPCWSTR name, action, condition; UINT r; @@ -1505,7 +1442,7 @@ static UINT msi_dialog_set_control_condition( MSIRECORD *rec, LPVOID param ) action = MSI_RecordGetString( rec, 3 ); condition = MSI_RecordGetString( rec, 4 ); r = MSI_EvaluateConditionW( dialog->package, condition ); - control = msi_dialog_find_control( dialog, name ); + control = dialog_find_control( dialog, name ); if (r == MSICONDITION_TRUE && control) { TRACE("%s control %s\n", debugstr_w(action), debugstr_w(name)); @@ -1527,7 +1464,7 @@ static UINT msi_dialog_set_control_condition( MSIRECORD *rec, LPVOID param ) return ERROR_SUCCESS; } -static UINT msi_dialog_evaluate_control_conditions( msi_dialog *dialog ) +static UINT dialog_evaluate_control_conditions( msi_dialog *dialog ) { UINT r; MSIQUERY *view; @@ -1540,12 +1477,12 @@ static UINT msi_dialog_evaluate_control_conditions( msi_dialog *dialog ) if (r != ERROR_SUCCESS) return ERROR_SUCCESS; - r = MSI_IterateRecords( view, 0, msi_dialog_set_control_condition, dialog ); + r = MSI_IterateRecords( view, 0, dialog_set_control_condition, dialog ); msiobj_release( &view->hdr ); return r; } -static UINT msi_dialog_combobox_handler( msi_dialog *dialog, msi_control *control, WPARAM param ) +static UINT dialog_combobox_handler( msi_dialog *dialog, struct control *control, WPARAM param ) { struct msi_combobox_info *info; int index; @@ -1557,20 +1494,20 @@ static UINT msi_dialog_combobox_handler( msi_dialog *dialog, msi_control *contro info = GetPropW( control->hwnd, L"MSIDATA" ); index = SendMessageW( control->hwnd, CB_GETCURSEL, 0, 0 ); if (index == CB_ERR) - value = msi_get_window_text( control->hwnd ); + value = get_window_text( control->hwnd ); else value = (LPWSTR) SendMessageW( control->hwnd, CB_GETITEMDATA, index, 0 ); - msi_dialog_set_property( info->dialog->package, control->property, value ); - msi_dialog_evaluate_control_conditions( info->dialog ); + dialog_set_property( info->dialog->package, control->property, value ); + dialog_evaluate_control_conditions( info->dialog ); if (index == CB_ERR) - msi_free( value ); + free( value ); return ERROR_SUCCESS; } -static void msi_dialog_combobox_update( msi_dialog *dialog, msi_control *control ) +static void dialog_combobox_update( msi_dialog *dialog, struct control *control ) { struct msi_combobox_info *info; LPWSTR value, tmp; @@ -1602,17 +1539,17 @@ static void msi_dialog_combobox_update( msi_dialog *dialog, msi_control *control SetWindowTextW( control->hwnd, value ); } - msi_free(value); + free( value ); } -static UINT msi_dialog_combo_control( msi_dialog *dialog, MSIRECORD *rec ) +static UINT dialog_combo_control( msi_dialog *dialog, MSIRECORD *rec ) { struct msi_combobox_info *info; - msi_control *control; + struct control *control; DWORD attributes, style; LPCWSTR prop; - info = msi_alloc( sizeof *info ); + info = malloc( sizeof *info ); if (!info) return ERROR_FUNCTION_FAILED; @@ -1625,18 +1562,18 @@ static UINT msi_dialog_combo_control( msi_dialog *dialog, MSIRECORD *rec ) else style |= CBS_DROPDOWN; - control = msi_dialog_add_control( dialog, rec, WC_COMBOBOXW, style ); + control = dialog_add_control( dialog, rec, WC_COMBOBOXW, style ); if (!control) { - msi_free( info ); + free( info ); return ERROR_FUNCTION_FAILED; } - control->handler = msi_dialog_combobox_handler; - control->update = msi_dialog_combobox_update; + control->handler = dialog_combobox_handler; + control->update = dialog_combobox_update; prop = MSI_RecordGetString( rec, 9 ); - control->property = msi_dialog_dup_property( dialog, prop, FALSE ); + control->property = dialog_dup_property( dialog, prop, FALSE ); /* subclass */ info->dialog = dialog; @@ -1648,14 +1585,14 @@ static UINT msi_dialog_combo_control( msi_dialog *dialog, MSIRECORD *rec ) SetPropW( control->hwnd, L"MSIDATA", info ); if (control->property) - msi_combobox_add_items( info, control->property ); + combobox_add_items( info, control->property ); - msi_dialog_combobox_update( dialog, control ); + dialog_combobox_update( dialog, control ); return ERROR_SUCCESS; } -static UINT msi_dialog_edit_handler( msi_dialog *dialog, msi_control *control, WPARAM param ) +static UINT dialog_edit_handler( msi_dialog *dialog, struct control *control, WPARAM param ) { LPWSTR buf; @@ -1664,9 +1601,9 @@ static UINT msi_dialog_edit_handler( msi_dialog *dialog, msi_control *control, W TRACE("edit %s contents changed, set %s\n", debugstr_w(control->name), debugstr_w(control->property)); - buf = msi_get_window_text( control->hwnd ); - msi_dialog_set_property( dialog->package, control->property, buf ); - msi_free( buf ); + buf = get_window_text( control->hwnd ); + dialog_set_property( dialog->package, control->property, buf ); + free( buf ); return ERROR_SUCCESS; } @@ -1674,17 +1611,16 @@ static UINT msi_dialog_edit_handler( msi_dialog *dialog, msi_control *control, W /* length of 2^32 + 1 */ #define MAX_NUM_DIGITS 11 -static UINT msi_dialog_edit_control( msi_dialog *dialog, MSIRECORD *rec ) +static UINT dialog_edit_control( msi_dialog *dialog, MSIRECORD *rec ) { - msi_control *control; + struct control *control; LPCWSTR prop, text; LPWSTR val, begin, end; WCHAR num[MAX_NUM_DIGITS]; DWORD limit; - control = msi_dialog_add_control( dialog, rec, L"Edit", - WS_BORDER | WS_TABSTOP | ES_AUTOHSCROLL ); - control->handler = msi_dialog_edit_handler; + control = dialog_add_control( dialog, rec, L"Edit", WS_BORDER | WS_TABSTOP | ES_AUTOHSCROLL ); + control->handler = dialog_edit_handler; text = MSI_RecordGetString( rec, 10 ); if ( text ) @@ -1705,11 +1641,11 @@ static UINT msi_dialog_edit_control( msi_dialog *dialog, MSIRECORD *rec ) prop = MSI_RecordGetString( rec, 9 ); if( prop ) - control->property = strdupW( prop ); + control->property = wcsdup( prop ); val = msi_dup_property( dialog->package->db, control->property ); SetWindowTextW( control->hwnd, val ); - msi_free( val ); + free( val ); return ERROR_SUCCESS; } @@ -1736,7 +1672,7 @@ struct msi_maskedit_info struct msi_mask_group group[MASK_MAX_GROUPS]; }; -static BOOL msi_mask_editable( WCHAR type ) +static BOOL mask_editable( WCHAR type ) { switch (type) { @@ -1751,18 +1687,18 @@ static BOOL msi_mask_editable( WCHAR type ) return FALSE; } -static void msi_mask_control_change( struct msi_maskedit_info *info ) +static void mask_control_change( struct msi_maskedit_info *info ) { LPWSTR val; UINT i, n, r; - val = msi_alloc( (info->num_chars+1)*sizeof(WCHAR) ); + val = malloc( (info->num_chars + 1) * sizeof(WCHAR) ); for( i=0, n=0; inum_groups; i++ ) { if (info->group[i].len == ~0u) { UINT len = SendMessageW( info->group[i].hwnd, WM_GETTEXTLENGTH, 0, 0 ); - val = msi_realloc( val, (len + 1) * sizeof(WCHAR) ); + val = realloc( val, (len + 1) * sizeof(WCHAR) ); GetWindowTextW( info->group[i].hwnd, val, len + 1 ); } else @@ -1772,7 +1708,7 @@ static void msi_mask_control_change( struct msi_maskedit_info *info ) ERR("can't fit control %d text into template\n",i); break; } - if (!msi_mask_editable(info->group[i].type)) + if (!mask_editable(info->group[i].type)) { for(r=0; rgroup[i].len; r++) val[n+r] = info->group[i].type; @@ -1793,14 +1729,14 @@ static void msi_mask_control_change( struct msi_maskedit_info *info ) if( i == info->num_groups ) { TRACE("Set property %s to %s\n", debugstr_w(info->prop), debugstr_w(val)); - msi_dialog_set_property( info->dialog->package, info->prop, val ); - msi_dialog_evaluate_control_conditions( info->dialog ); + dialog_set_property( info->dialog->package, info->prop, val ); + dialog_evaluate_control_conditions( info->dialog ); } - msi_free( val ); + free( val ); } /* now move to the next control if necessary */ -static VOID msi_mask_next_control( struct msi_maskedit_info *info, HWND hWnd ) +static void mask_next_control( struct msi_maskedit_info *info, HWND hWnd ) { HWND hWndNext; UINT len, i; @@ -1821,8 +1757,7 @@ static VOID msi_mask_next_control( struct msi_maskedit_info *info, HWND hWnd ) SetFocus( hWndNext ); } -static LRESULT WINAPI -MSIMaskedEdit_WndProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam) +static LRESULT WINAPI MSIMaskedEdit_WndProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam) { struct msi_maskedit_info *info; HRESULT r; @@ -1838,13 +1773,13 @@ MSIMaskedEdit_WndProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam) case WM_COMMAND: if (HIWORD(wParam) == EN_CHANGE) { - msi_mask_control_change( info ); - msi_mask_next_control( info, (HWND) lParam ); + mask_control_change( info ); + mask_next_control( info, (HWND) lParam ); } break; case WM_NCDESTROY: - msi_free( info->prop ); - msi_free( info ); + free( info->prop ); + free( info ); RemovePropW( hWnd, L"MSIDATA" ); break; } @@ -1853,8 +1788,7 @@ MSIMaskedEdit_WndProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam) } /* fish the various bits of the property out and put them in the control */ -static void -msi_maskedit_set_text( struct msi_maskedit_info *info, LPCWSTR text ) +static void maskedit_set_text( struct msi_maskedit_info *info, const WCHAR *text ) { LPCWSTR p; UINT i; @@ -1864,10 +1798,10 @@ msi_maskedit_set_text( struct msi_maskedit_info *info, LPCWSTR text ) { if( info->group[i].len < lstrlenW( p ) ) { - LPWSTR chunk = strdupW( p ); + WCHAR *chunk = wcsdup( p ); chunk[ info->group[i].len ] = 0; SetWindowTextW( info->group[i].hwnd, chunk ); - msi_free( chunk ); + free( chunk ); } else { @@ -1878,7 +1812,7 @@ msi_maskedit_set_text( struct msi_maskedit_info *info, LPCWSTR text ) } } -static struct msi_maskedit_info * msi_dialog_parse_groups( LPCWSTR mask ) +static struct msi_maskedit_info *dialog_parse_groups( const WCHAR *mask ) { struct msi_maskedit_info *info; int i = 0, n = 0, total = 0; @@ -1889,7 +1823,7 @@ static struct msi_maskedit_info * msi_dialog_parse_groups( LPCWSTR mask ) if( !mask ) return NULL; - info = msi_alloc_zero( sizeof *info ); + info = calloc( 1, sizeof *info ); if( !info ) return info; @@ -1939,8 +1873,7 @@ static struct msi_maskedit_info * msi_dialog_parse_groups( LPCWSTR mask ) return info; } -static void -msi_maskedit_create_children( struct msi_maskedit_info *info, LPCWSTR font ) +static void maskedit_create_children( struct msi_maskedit_info *info, const WCHAR *font ) { DWORD width, height, style, wx, ww; RECT rect; @@ -1956,7 +1889,7 @@ msi_maskedit_create_children( struct msi_maskedit_info *info, LPCWSTR font ) for( i = 0; i < info->num_groups; i++ ) { - if (!msi_mask_editable( info->group[i].type )) + if (!mask_editable( info->group[i].type )) continue; if (info->num_chars) { @@ -1978,8 +1911,7 @@ msi_maskedit_create_children( struct msi_maskedit_info *info, LPCWSTR font ) SendMessageW( hwnd, EM_LIMITTEXT, info->group[i].len, 0 ); - msi_dialog_set_font( info->dialog, hwnd, - font?font:info->dialog->default_font ); + dialog_set_font( info->dialog, hwnd, font?font:info->dialog->default_font ); info->group[i].hwnd = hwnd; } } @@ -1989,25 +1921,25 @@ msi_maskedit_create_children( struct msi_maskedit_info *info, LPCWSTR font ) * delphi 7 uses "" and "" * filemaker pro 7 uses "<^^^^=^^^^=^^^^=^^^^=^^^^=^^^^=^^^^^>" */ -static UINT msi_dialog_maskedit_control( msi_dialog *dialog, MSIRECORD *rec ) +static UINT dialog_maskedit_control( msi_dialog *dialog, MSIRECORD *rec ) { LPWSTR font_mask, val = NULL, font; struct msi_maskedit_info *info = NULL; UINT ret = ERROR_SUCCESS; - msi_control *control; + struct control *control; LPCWSTR prop, mask; TRACE("\n"); - font_mask = msi_get_deformatted_field( dialog->package, rec, 10 ); - font = msi_dialog_get_style( font_mask, &mask ); + font_mask = get_deformatted_field( dialog->package, rec, 10 ); + font = dialog_get_style( font_mask, &mask ); if( !mask ) { WARN("mask template is empty\n"); goto end; } - info = msi_dialog_parse_groups( mask ); + info = dialog_parse_groups( mask ); if( !info ) { ERR("template %s is invalid\n", debugstr_w(mask)); @@ -2016,8 +1948,7 @@ static UINT msi_dialog_maskedit_control( msi_dialog *dialog, MSIRECORD *rec ) info->dialog = dialog; - control = msi_dialog_add_control( dialog, rec, L"Static", - SS_OWNERDRAW | WS_GROUP | WS_VISIBLE ); + control = dialog_add_control( dialog, rec, L"Static", SS_OWNERDRAW | WS_GROUP | WS_VISIBLE ); if( !control ) { ERR("Failed to create maskedit container\n"); @@ -2035,33 +1966,33 @@ static UINT msi_dialog_maskedit_control( msi_dialog *dialog, MSIRECORD *rec ) prop = MSI_RecordGetString( rec, 9 ); if( prop ) - info->prop = strdupW( prop ); + info->prop = wcsdup( prop ); - msi_maskedit_create_children( info, font ); + maskedit_create_children( info, font ); if( prop ) { val = msi_dup_property( dialog->package->db, prop ); if( val ) { - msi_maskedit_set_text( info, val ); - msi_free( val ); + maskedit_set_text( info, val ); + free( val ); } } end: if( ret != ERROR_SUCCESS ) - msi_free( info ); - msi_free( font_mask ); - msi_free( font ); + free( info ); + free( font_mask ); + free( font ); return ret; } /******************** Progress Bar *****************************************/ -static UINT msi_dialog_progress_bar( msi_dialog *dialog, MSIRECORD *rec ) +static UINT dialog_progress_bar( msi_dialog *dialog, MSIRECORD *rec ) { - msi_control *control; + struct control *control; DWORD attributes, style; style = WS_VISIBLE; @@ -2069,7 +2000,7 @@ static UINT msi_dialog_progress_bar( msi_dialog *dialog, MSIRECORD *rec ) if( !(attributes & msidbControlAttributesProgress95) ) style |= PBS_SMOOTH; - control = msi_dialog_add_control( dialog, rec, PROGRESS_CLASSW, style ); + control = dialog_add_control( dialog, rec, PROGRESS_CLASSW, style ); if( !control ) return ERROR_FUNCTION_FAILED; @@ -2082,35 +2013,35 @@ static UINT msi_dialog_progress_bar( msi_dialog *dialog, MSIRECORD *rec ) struct msi_pathedit_info { msi_dialog *dialog; - msi_control *control; + struct control *control; WNDPROC oldproc; }; -static WCHAR *get_path_property( msi_dialog *dialog, msi_control *control ) +static WCHAR *get_path_property( msi_dialog *dialog, struct control *control ) { WCHAR *prop, *path; BOOL indirect = control->attributes & msidbControlAttributesIndirect; - if (!(prop = msi_dialog_dup_property( dialog, control->property, indirect ))) return NULL; - path = msi_dialog_dup_property( dialog, prop, TRUE ); - msi_free( prop ); + if (!(prop = dialog_dup_property( dialog, control->property, indirect ))) return NULL; + path = dialog_dup_property( dialog, prop, TRUE ); + free( prop ); return path; } -static void msi_dialog_update_pathedit( msi_dialog *dialog, msi_control *control ) +static void dialog_update_pathedit( msi_dialog *dialog, struct control *control ) { WCHAR *path; - if (!control && !(control = msi_dialog_find_control_by_type( dialog, L"PathEdit" ))) + if (!control && !(control = dialog_find_control_by_type( dialog, L"PathEdit" ))) return; if (!(path = get_path_property( dialog, control ))) return; SetWindowTextW( control->hwnd, path ); SendMessageW( control->hwnd, EM_SETSEL, 0, -1 ); - msi_free( path ); + free( path ); } /* FIXME: test when this should fail */ -static BOOL msi_dialog_verify_path( LPWSTR path ) +static BOOL dialog_verify_path( const WCHAR *path ) { if ( !path[0] ) return FALSE; @@ -2122,18 +2053,18 @@ static BOOL msi_dialog_verify_path( LPWSTR path ) } /* returns TRUE if the path is valid, FALSE otherwise */ -static BOOL msi_dialog_onkillfocus( msi_dialog *dialog, msi_control *control ) +static BOOL dialog_onkillfocus( msi_dialog *dialog, struct control *control ) { LPWSTR buf, prop; BOOL indirect; BOOL valid; indirect = control->attributes & msidbControlAttributesIndirect; - prop = msi_dialog_dup_property( dialog, control->property, indirect ); + prop = dialog_dup_property( dialog, control->property, indirect ); - buf = msi_get_window_text( control->hwnd ); + buf = get_window_text( control->hwnd ); - if ( !msi_dialog_verify_path( buf ) ) + if ( !dialog_verify_path( buf ) ) { /* FIXME: display an error message box */ ERR("Invalid path %s\n", debugstr_w( buf )); @@ -2143,16 +2074,16 @@ static BOOL msi_dialog_onkillfocus( msi_dialog *dialog, msi_control *control ) else { valid = TRUE; - msi_dialog_set_property( dialog->package, prop, buf ); + dialog_set_property( dialog->package, prop, buf ); } - msi_dialog_update_pathedit( dialog, control ); + dialog_update_pathedit( dialog, control ); TRACE("edit %s contents changed, set %s\n", debugstr_w(control->name), debugstr_w(prop)); - msi_free( buf ); - msi_free( prop ); + free( buf ); + free( prop ); return valid; } @@ -2167,7 +2098,7 @@ static LRESULT WINAPI MSIPathEdit_WndProc(HWND hWnd, UINT msg, WPARAM wParam, LP if ( msg == WM_KILLFOCUS ) { /* if the path is invalid, don't handle this message */ - if ( !msi_dialog_onkillfocus( info->dialog, info->control ) ) + if ( !dialog_onkillfocus( info->dialog, info->control ) ) return 0; } @@ -2175,29 +2106,28 @@ static LRESULT WINAPI MSIPathEdit_WndProc(HWND hWnd, UINT msg, WPARAM wParam, LP if ( msg == WM_NCDESTROY ) { - msi_free( info ); + free( info ); RemovePropW( hWnd, L"MSIDATA" ); } return r; } -static UINT msi_dialog_pathedit_control( msi_dialog *dialog, MSIRECORD *rec ) +static UINT dialog_pathedit_control( msi_dialog *dialog, MSIRECORD *rec ) { struct msi_pathedit_info *info; - msi_control *control; + struct control *control; LPCWSTR prop; - info = msi_alloc( sizeof *info ); + info = malloc( sizeof *info ); if (!info) return ERROR_FUNCTION_FAILED; - control = msi_dialog_add_control( dialog, rec, L"Edit", - WS_BORDER | WS_TABSTOP ); + control = dialog_add_control( dialog, rec, L"Edit", WS_BORDER | WS_TABSTOP ); control->attributes = MSI_RecordGetInteger( rec, 8 ); prop = MSI_RecordGetString( rec, 9 ); - control->property = msi_dialog_dup_property( dialog, prop, FALSE ); - control->update = msi_dialog_update_pathedit; + control->property = dialog_dup_property( dialog, prop, FALSE ); + control->update = dialog_update_pathedit; info->dialog = dialog; info->control = control; @@ -2205,29 +2135,29 @@ static UINT msi_dialog_pathedit_control( msi_dialog *dialog, MSIRECORD *rec ) (LONG_PTR)MSIPathEdit_WndProc ); SetPropW( control->hwnd, L"MSIDATA", info ); - msi_dialog_update_pathedit( dialog, control ); + dialog_update_pathedit( dialog, control ); return ERROR_SUCCESS; } -static UINT msi_dialog_radiogroup_handler( msi_dialog *dialog, msi_control *control, WPARAM param ) +static UINT dialog_radiogroup_handler( msi_dialog *dialog, struct control *control, WPARAM param ) { if (HIWORD(param) != BN_CLICKED) return ERROR_SUCCESS; TRACE("clicked radio button %s, set %s\n", debugstr_w(control->name), debugstr_w(control->property)); - msi_dialog_set_property( dialog->package, control->property, control->name ); + dialog_set_property( dialog->package, control->property, control->name ); - return msi_dialog_button_handler( dialog, control, param ); + return dialog_button_handler( dialog, control, param ); } /* radio buttons are a bit different from normal controls */ -static UINT msi_dialog_create_radiobutton( MSIRECORD *rec, LPVOID param ) +static UINT dialog_create_radiobutton( MSIRECORD *rec, void *param ) { - radio_button_group_descr *group = param; + struct radio_button_group_descr *group = param; msi_dialog *dialog = group->dialog; - msi_control *control; + struct control *control; LPCWSTR prop, text, name; DWORD style = WS_CHILD | WS_VISIBLE | WS_TABSTOP | BS_AUTORADIOBUTTON | BS_MULTILINE; @@ -2238,19 +2168,19 @@ static UINT msi_dialog_create_radiobutton( MSIRECORD *rec, LPVOID param ) group->parent->hwnd ); if (!control) return ERROR_FUNCTION_FAILED; - control->handler = msi_dialog_radiogroup_handler; + control->handler = dialog_radiogroup_handler; if (group->propval && !wcscmp( control->name, group->propval )) SendMessageW(control->hwnd, BM_SETCHECK, BST_CHECKED, 0); prop = MSI_RecordGetString( rec, 1 ); if( prop ) - control->property = strdupW( prop ); + control->property = wcsdup( prop ); return ERROR_SUCCESS; } -static BOOL CALLBACK msi_radioground_child_enum( HWND hWnd, LPARAM lParam ) +static BOOL CALLBACK radioground_child_enum( HWND hWnd, LPARAM lParam ) { EnableWindow( hWnd, lParam ); return TRUE; @@ -2270,18 +2200,18 @@ static LRESULT WINAPI MSIRadioGroup_WndProc( HWND hWnd, UINT msg, WPARAM wParam, /* make sure the radio buttons show as disabled if the parent is disabled */ if (msg == WM_ENABLE) - EnumChildWindows( hWnd, msi_radioground_child_enum, wParam ); + EnumChildWindows( hWnd, radioground_child_enum, wParam ); return r; } -static UINT msi_dialog_radiogroup_control( msi_dialog *dialog, MSIRECORD *rec ) +static UINT dialog_radiogroup_control( msi_dialog *dialog, MSIRECORD *rec ) { UINT r; LPCWSTR prop; - msi_control *control; + struct control *control; MSIQUERY *view; - radio_button_group_descr group; + struct radio_button_group_descr group; MSIPACKAGE *package = dialog->package; WNDPROC oldproc; DWORD attr, style = WS_GROUP; @@ -2301,7 +2231,7 @@ static UINT msi_dialog_radiogroup_control( msi_dialog *dialog, MSIRECORD *rec ) style |= BS_OWNERDRAW; /* Create parent group box to hold radio buttons */ - control = msi_dialog_add_control( dialog, rec, L"BUTTON", style ); + control = dialog_add_control( dialog, rec, L"BUTTON", style ); if( !control ) return ERROR_FUNCTION_FAILED; @@ -2311,7 +2241,7 @@ static UINT msi_dialog_radiogroup_control( msi_dialog *dialog, MSIRECORD *rec ) SetWindowLongPtrW( control->hwnd, GWL_EXSTYLE, WS_EX_CONTROLPARENT ); if( prop ) - control->property = strdupW( prop ); + control->property = wcsdup( prop ); /* query the Radio Button table for all control in this group */ r = MSI_OpenQuery( package->db, &view, L"SELECT * FROM `RadioButton` WHERE `Property` = '%s'", prop ); @@ -2326,14 +2256,13 @@ static UINT msi_dialog_radiogroup_control( msi_dialog *dialog, MSIRECORD *rec ) group.parent = control; group.propval = msi_dup_property( dialog->package->db, control->property ); - r = MSI_IterateRecords( view, 0, msi_dialog_create_radiobutton, &group ); + r = MSI_IterateRecords( view, 0, dialog_create_radiobutton, &group ); msiobj_release( &view->hdr ); - msi_free( group.propval ); + free( group.propval ); return r; } -static void -msi_seltree_sync_item_state( HWND hwnd, MSIFEATURE *feature, HTREEITEM hItem ) +static void seltree_sync_item_state( HWND hwnd, MSIFEATURE *feature, HTREEITEM hItem ) { TVITEMW tvi; DWORD index = feature->ActionRequest; @@ -2352,8 +2281,7 @@ msi_seltree_sync_item_state( HWND hwnd, MSIFEATURE *feature, HTREEITEM hItem ) SendMessageW( hwnd, TVM_SETITEMW, 0, (LPARAM) &tvi ); } -static UINT -msi_seltree_popup_menu( HWND hwnd, INT x, INT y ) +static UINT seltree_popup_menu( HWND hwnd, INT x, INT y ) { HMENU hMenu; INT r; @@ -2372,18 +2300,16 @@ msi_seltree_popup_menu( HWND hwnd, INT x, INT y ) return r; } -static void -msi_seltree_update_feature_installstate( HWND hwnd, HTREEITEM hItem, - MSIPACKAGE *package, MSIFEATURE *feature, INSTALLSTATE state ) +static void seltree_update_feature_installstate( HWND hwnd, HTREEITEM hItem, MSIPACKAGE *package, + MSIFEATURE *feature, INSTALLSTATE state ) { feature->ActionRequest = state; - msi_seltree_sync_item_state( hwnd, feature, hItem ); + seltree_sync_item_state( hwnd, feature, hItem ); ACTION_UpdateComponentStates( package, feature ); } -static void -msi_seltree_update_siblings_and_children_installstate( HWND hwnd, HTREEITEM curr, - MSIPACKAGE *package, INSTALLSTATE state) +static void seltree_update_siblings_and_children_installstate( HWND hwnd, HTREEITEM curr, MSIPACKAGE *package, + INSTALLSTATE state ) { /* update all siblings */ do @@ -2391,20 +2317,18 @@ msi_seltree_update_siblings_and_children_installstate( HWND hwnd, HTREEITEM curr MSIFEATURE *feature; HTREEITEM child; - feature = msi_seltree_feature_from_item( hwnd, curr ); - msi_seltree_update_feature_installstate( hwnd, curr, package, feature, state ); + feature = seltree_feature_from_item( hwnd, curr ); + seltree_update_feature_installstate( hwnd, curr, package, feature, state ); /* update this sibling's children */ child = (HTREEITEM)SendMessageW( hwnd, TVM_GETNEXTITEM, (WPARAM)TVGN_CHILD, (LPARAM)curr ); if (child) - msi_seltree_update_siblings_and_children_installstate( hwnd, child, - package, state ); + seltree_update_siblings_and_children_installstate( hwnd, child, package, state ); } while ((curr = (HTREEITEM)SendMessageW( hwnd, TVM_GETNEXTITEM, (WPARAM)TVGN_NEXT, (LPARAM)curr ))); } -static LRESULT -msi_seltree_menu( HWND hwnd, HTREEITEM hItem ) +static LRESULT seltree_menu( HWND hwnd, HTREEITEM hItem ) { struct msi_selection_tree_info *info; MSIFEATURE *feature; @@ -2419,7 +2343,7 @@ msi_seltree_menu( HWND hwnd, HTREEITEM hItem ) info = GetPropW(hwnd, L"MSIDATA"); package = info->dialog->package; - feature = msi_seltree_feature_from_item( hwnd, hItem ); + feature = seltree_feature_from_item( hwnd, hItem ); if (!feature) { ERR("item %p feature was NULL\n", hItem); @@ -2431,7 +2355,7 @@ msi_seltree_menu( HWND hwnd, HTREEITEM hItem ) SendMessageW( hwnd, TVM_GETITEMRECT, 0, (LPARAM) &u.rc ); MapWindowPoints( hwnd, NULL, u.pt, 2 ); - r = msi_seltree_popup_menu( hwnd, u.rc.left, u.rc.top ); + r = seltree_popup_menu( hwnd, u.rc.left, u.rc.top ); switch (r) { @@ -2444,19 +2368,18 @@ msi_seltree_menu( HWND hwnd, HTREEITEM hItem ) HTREEITEM child; child = (HTREEITEM)SendMessageW( hwnd, TVM_GETNEXTITEM, (WPARAM)TVGN_CHILD, (LPARAM)hItem ); if (child) - msi_seltree_update_siblings_and_children_installstate( hwnd, child, package, r ); + seltree_update_siblings_and_children_installstate( hwnd, child, package, r ); } /* fall-through */ case INSTALLSTATE_LOCAL: - msi_seltree_update_feature_installstate( hwnd, hItem, package, feature, r ); + seltree_update_feature_installstate( hwnd, hItem, package, feature, r ); break; } return 0; } -static LRESULT WINAPI -MSISelectionTree_WndProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam) +static LRESULT WINAPI MSISelectionTree_WndProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam) { struct msi_selection_tree_info *info; TVHITTESTINFO tvhti; @@ -2475,7 +2398,7 @@ MSISelectionTree_WndProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam) tvhti.hItem = 0; CallWindowProcW(info->oldproc, hWnd, TVM_HITTEST, 0, (LPARAM) &tvhti ); if (tvhti.flags & TVHT_ONITEMSTATEICON) - return msi_seltree_menu( hWnd, tvhti.hItem ); + return seltree_menu( hWnd, tvhti.hItem ); break; } r = CallWindowProcW(info->oldproc, hWnd, msg, wParam, lParam); @@ -2483,16 +2406,14 @@ MSISelectionTree_WndProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam) switch( msg ) { case WM_NCDESTROY: - msi_free( info ); + free( info ); RemovePropW( hWnd, L"MSIDATA" ); break; } return r; } -static void -msi_seltree_add_child_features( MSIPACKAGE *package, HWND hwnd, - LPCWSTR parent, HTREEITEM hParent ) +static void seltree_add_child_features( MSIPACKAGE *package, HWND hwnd, const WCHAR *parent, HTREEITEM hParent ) { struct msi_selection_tree_info *info = GetPropW( hwnd, L"MSIDATA" ); MSIFEATURE *feature; @@ -2517,9 +2438,9 @@ msi_seltree_add_child_features( MSIPACKAGE *package, HWND hwnd, memset( &tvis, 0, sizeof tvis ); tvis.hParent = hParent; tvis.hInsertAfter = TVI_LAST; - tvis.u.item.mask = TVIF_TEXT | TVIF_PARAM; - tvis.u.item.pszText = feature->Title; - tvis.u.item.lParam = (LPARAM) feature; + tvis.item.mask = TVIF_TEXT | TVIF_PARAM; + tvis.item.pszText = feature->Title; + tvis.item.lParam = (LPARAM) feature; hitem = (HTREEITEM) SendMessageW( hwnd, TVM_INSERTITEMW, 0, (LPARAM) &tvis ); if (!hitem) @@ -2528,8 +2449,8 @@ msi_seltree_add_child_features( MSIPACKAGE *package, HWND hwnd, if (!hfirst) hfirst = hitem; - msi_seltree_sync_item_state( hwnd, feature, hitem ); - msi_seltree_add_child_features( package, hwnd, + seltree_sync_item_state( hwnd, feature, hitem ); + seltree_add_child_features( package, hwnd, feature->Feature, hitem ); /* the node is expanded if Display is odd */ @@ -2542,7 +2463,7 @@ msi_seltree_add_child_features( MSIPACKAGE *package, HWND hwnd, info->selected = hfirst; } -static void msi_seltree_create_imagelist( HWND hwnd ) +static void seltree_create_imagelist( HWND hwnd ) { const int bm_width = 32, bm_height = 16, bm_count = 3; const int bm_resource = 0x1001; @@ -2579,8 +2500,7 @@ static void msi_seltree_create_imagelist( HWND hwnd ) SendMessageW( hwnd, TVM_SETIMAGELIST, TVSIL_STATE, (LPARAM)himl ); } -static UINT msi_dialog_seltree_handler( msi_dialog *dialog, - msi_control *control, WPARAM param ) +static UINT dialog_seltree_handler( msi_dialog *dialog, struct control *control, WPARAM param ) { struct msi_selection_tree_info *info = GetPropW( control->hwnd, L"MSIDATA" ); LPNMTREEVIEWW tv = (LPNMTREEVIEWW)param; @@ -2597,7 +2517,7 @@ static UINT msi_dialog_seltree_handler( msi_dialog *dialog, if (!(tv->itemNew.mask & TVIF_TEXT)) { - feature = msi_seltree_feature_from_item( control->hwnd, tv->itemNew.hItem ); + feature = seltree_feature_from_item( control->hwnd, tv->itemNew.hItem ); if (feature) title = feature->Title; } @@ -2636,33 +2556,33 @@ static UINT msi_dialog_seltree_handler( msi_dialog *dialog, return r; } -static UINT msi_dialog_selection_tree( msi_dialog *dialog, MSIRECORD *rec ) +static UINT dialog_selection_tree( msi_dialog *dialog, MSIRECORD *rec ) { - msi_control *control; + struct control *control; LPCWSTR prop, control_name; MSIPACKAGE *package = dialog->package; DWORD style; struct msi_selection_tree_info *info; - info = msi_alloc( sizeof *info ); + info = malloc( sizeof *info ); if (!info) return ERROR_FUNCTION_FAILED; /* create the treeview control */ style = TVS_HASLINES | TVS_HASBUTTONS | TVS_LINESATROOT; style |= WS_GROUP | WS_VSCROLL | WS_TABSTOP; - control = msi_dialog_add_control( dialog, rec, WC_TREEVIEWW, style ); + control = dialog_add_control( dialog, rec, WC_TREEVIEWW, style ); if (!control) { - msi_free(info); + free(info); return ERROR_FUNCTION_FAILED; } - control->handler = msi_dialog_seltree_handler; + control->handler = dialog_seltree_handler; control_name = MSI_RecordGetString( rec, 2 ); control->attributes = MSI_RecordGetInteger( rec, 8 ); prop = MSI_RecordGetString( rec, 9 ); - control->property = msi_dialog_dup_property( dialog, prop, FALSE ); + control->property = dialog_dup_property( dialog, prop, FALSE ); /* subclass */ info->dialog = dialog; @@ -2674,21 +2594,21 @@ static UINT msi_dialog_selection_tree( msi_dialog *dialog, MSIRECORD *rec ) event_subscribe( dialog, L"SelectionPath", control_name, L"Property" ); /* initialize it */ - msi_seltree_create_imagelist( control->hwnd ); - msi_seltree_add_child_features( package, control->hwnd, NULL, NULL ); + seltree_create_imagelist( control->hwnd ); + seltree_add_child_features( package, control->hwnd, NULL, NULL ); return ERROR_SUCCESS; } /******************** Group Box ***************************************/ -static UINT msi_dialog_group_box( msi_dialog *dialog, MSIRECORD *rec ) +static UINT dialog_group_box( msi_dialog *dialog, MSIRECORD *rec ) { - msi_control *control; + struct control *control; DWORD style; style = BS_GROUPBOX | WS_CHILD | WS_GROUP; - control = msi_dialog_add_control( dialog, rec, WC_BUTTONW, style ); + control = dialog_add_control( dialog, rec, WC_BUTTONW, style ); if (!control) return ERROR_FUNCTION_FAILED; @@ -2725,9 +2645,9 @@ static LRESULT WINAPI MSIListBox_WndProc(HWND hWnd, UINT msg, WPARAM wParam, LPA { case WM_NCDESTROY: for (j = 0; j < info->num_items; j++) - msi_free( info->items[j] ); - msi_free( info->items ); - msi_free( info ); + free( info->items[j] ); + free( info->items ); + free( info ); RemovePropW( hWnd, L"MSIDATA" ); break; } @@ -2735,7 +2655,7 @@ static LRESULT WINAPI MSIListBox_WndProc(HWND hWnd, UINT msg, WPARAM wParam, LPA return r; } -static UINT msi_listbox_add_item( MSIRECORD *rec, LPVOID param ) +static UINT listbox_add_item( MSIRECORD *rec, void *param ) { struct msi_listbox_info *info = param; LPCWSTR value, text; @@ -2744,7 +2664,7 @@ static UINT msi_listbox_add_item( MSIRECORD *rec, LPVOID param ) value = MSI_RecordGetString( rec, 3 ); text = MSI_RecordGetString( rec, 4 ); - info->items[info->addpos_items] = strdupW( value ); + info->items[info->addpos_items] = wcsdup( value ); pos = SendMessageW( info->hwnd, LB_ADDSTRING, 0, (LPARAM)text ); SendMessageW( info->hwnd, LB_SETITEMDATA, pos, (LPARAM)info->items[info->addpos_items] ); @@ -2752,7 +2672,7 @@ static UINT msi_listbox_add_item( MSIRECORD *rec, LPVOID param ) return ERROR_SUCCESS; } -static UINT msi_listbox_add_items( struct msi_listbox_info *info, LPCWSTR property ) +static UINT listbox_add_items( struct msi_listbox_info *info, const WCHAR *property ) { MSIQUERY *view; DWORD count; @@ -2772,15 +2692,14 @@ static UINT msi_listbox_add_items( struct msi_listbox_info *info, LPCWSTR proper return r; } info->num_items = count; - info->items = msi_alloc( sizeof(*info->items) * count ); + info->items = malloc( sizeof(*info->items) * count ); - r = MSI_IterateRecords( view, NULL, msi_listbox_add_item, info ); + r = MSI_IterateRecords( view, NULL, listbox_add_item, info ); msiobj_release( &view->hdr ); return r; } -static UINT msi_dialog_listbox_handler( msi_dialog *dialog, - msi_control *control, WPARAM param ) +static UINT dialog_listbox_handler( msi_dialog *dialog, struct control *control, WPARAM param ) { struct msi_listbox_info *info; int index; @@ -2793,20 +2712,20 @@ static UINT msi_dialog_listbox_handler( msi_dialog *dialog, index = SendMessageW( control->hwnd, LB_GETCURSEL, 0, 0 ); value = (LPCWSTR) SendMessageW( control->hwnd, LB_GETITEMDATA, index, 0 ); - msi_dialog_set_property( info->dialog->package, control->property, value ); - msi_dialog_evaluate_control_conditions( info->dialog ); + dialog_set_property( info->dialog->package, control->property, value ); + dialog_evaluate_control_conditions( info->dialog ); return ERROR_SUCCESS; } -static UINT msi_dialog_list_box( msi_dialog *dialog, MSIRECORD *rec ) +static UINT dialog_list_box( msi_dialog *dialog, MSIRECORD *rec ) { struct msi_listbox_info *info; - msi_control *control; + struct control *control; DWORD attributes, style; LPCWSTR prop; - info = msi_alloc( sizeof *info ); + info = malloc( sizeof *info ); if (!info) return ERROR_FUNCTION_FAILED; @@ -2815,17 +2734,17 @@ static UINT msi_dialog_list_box( msi_dialog *dialog, MSIRECORD *rec ) if (~attributes & msidbControlAttributesSorted) style |= LBS_SORT; - control = msi_dialog_add_control( dialog, rec, WC_LISTBOXW, style ); + control = dialog_add_control( dialog, rec, WC_LISTBOXW, style ); if (!control) { - msi_free(info); + free(info); return ERROR_FUNCTION_FAILED; } - control->handler = msi_dialog_listbox_handler; + control->handler = dialog_listbox_handler; prop = MSI_RecordGetString( rec, 9 ); - control->property = msi_dialog_dup_property( dialog, prop, FALSE ); + control->property = dialog_dup_property( dialog, prop, FALSE ); /* subclass */ info->dialog = dialog; @@ -2837,18 +2756,18 @@ static UINT msi_dialog_list_box( msi_dialog *dialog, MSIRECORD *rec ) SetPropW( control->hwnd, L"MSIDATA", info ); if ( control->property ) - msi_listbox_add_items( info, control->property ); + listbox_add_items( info, control->property ); return ERROR_SUCCESS; } /******************** Directory Combo ***************************************/ -static void msi_dialog_update_directory_combo( msi_dialog *dialog, msi_control *control ) +static void dialog_update_directory_combo( msi_dialog *dialog, struct control *control ) { WCHAR *path; - if (!control && !(control = msi_dialog_find_control_by_type( dialog, L"DirectoryCombo" ))) + if (!control && !(control = dialog_find_control_by_type( dialog, L"DirectoryCombo" ))) return; if (!(path = get_path_property( dialog, control ))) return; @@ -2858,41 +2777,41 @@ static void msi_dialog_update_directory_combo( msi_dialog *dialog, msi_control * SendMessageW( control->hwnd, CB_INSERTSTRING, 0, (LPARAM)path ); SendMessageW( control->hwnd, CB_SETCURSEL, 0, 0 ); - msi_free( path ); + free( path ); } -static UINT msi_dialog_directory_combo( msi_dialog *dialog, MSIRECORD *rec ) +static UINT dialog_directory_combo( msi_dialog *dialog, MSIRECORD *rec ) { - msi_control *control; + struct control *control; LPCWSTR prop; DWORD style; /* FIXME: use CBS_OWNERDRAWFIXED and add owner draw code */ style = CBS_DROPDOWNLIST | CBS_HASSTRINGS | WS_CHILD | WS_GROUP | WS_TABSTOP | WS_VSCROLL; - control = msi_dialog_add_control( dialog, rec, WC_COMBOBOXW, style ); + control = dialog_add_control( dialog, rec, WC_COMBOBOXW, style ); if (!control) return ERROR_FUNCTION_FAILED; control->attributes = MSI_RecordGetInteger( rec, 8 ); prop = MSI_RecordGetString( rec, 9 ); - control->property = msi_dialog_dup_property( dialog, prop, FALSE ); + control->property = dialog_dup_property( dialog, prop, FALSE ); - msi_dialog_update_directory_combo( dialog, control ); + dialog_update_directory_combo( dialog, control ); return ERROR_SUCCESS; } /******************** Directory List ***************************************/ -static void msi_dialog_update_directory_list( msi_dialog *dialog, msi_control *control ) +static void dialog_update_directory_list( msi_dialog *dialog, struct control *control ) { WCHAR dir_spec[MAX_PATH], *path; WIN32_FIND_DATAW wfd; LVITEMW item; HANDLE file; - if (!control && !(control = msi_dialog_find_control_by_type( dialog, L"DirectoryList" ))) + if (!control && !(control = dialog_find_control_by_type( dialog, L"DirectoryList" ))) return; /* clear the list-view */ @@ -2905,7 +2824,7 @@ static void msi_dialog_update_directory_list( msi_dialog *dialog, msi_control *c file = FindFirstFileW( dir_spec, &wfd ); if (file == INVALID_HANDLE_VALUE) { - msi_free( path ); + free( path ); return; } @@ -2926,20 +2845,20 @@ static void msi_dialog_update_directory_list( msi_dialog *dialog, msi_control *c SendMessageW( control->hwnd, LVM_INSERTITEMW, 0, (LPARAM)&item ); } while ( FindNextFileW( file, &wfd ) ); - msi_free( path ); + free( path ); FindClose( file ); } -static UINT msi_dialog_directorylist_up( msi_dialog *dialog ) +static UINT dialog_directorylist_up( msi_dialog *dialog ) { - msi_control *control; + struct control *control; LPWSTR prop, path, ptr; BOOL indirect; - control = msi_dialog_find_control_by_type( dialog, L"DirectoryList" ); + control = dialog_find_control_by_type( dialog, L"DirectoryList" ); indirect = control->attributes & msidbControlAttributesIndirect; - prop = msi_dialog_dup_property( dialog, control->property, indirect ); - path = msi_dialog_dup_property( dialog, prop, TRUE ); + prop = dialog_dup_property( dialog, control->property, indirect ); + path = dialog_dup_property( dialog, prop, TRUE ); /* strip off the last directory */ ptr = PathFindFileNameW( path ); @@ -2949,14 +2868,14 @@ static UINT msi_dialog_directorylist_up( msi_dialog *dialog ) PathAddBackslashW( path ); } - msi_dialog_set_property( dialog->package, prop, path ); + dialog_set_property( dialog->package, prop, path ); - msi_dialog_update_directory_list( dialog, NULL ); - msi_dialog_update_directory_combo( dialog, NULL ); - msi_dialog_update_pathedit( dialog, NULL ); + dialog_update_directory_list( dialog, NULL ); + dialog_update_directory_combo( dialog, NULL ); + dialog_update_pathedit( dialog, NULL ); - msi_free( path ); - msi_free( prop ); + free( path ); + free( prop ); return ERROR_SUCCESS; } @@ -2968,7 +2887,7 @@ static WCHAR *get_unique_folder_name( const WCHAR *root, int *ret_len ) len = LoadStringW( msi_hInstance, IDS_NEWFOLDER, newfolder, ARRAY_SIZE(newfolder) ); len += lstrlenW(root) + 1; - if (!(path = msi_alloc( (len + 4) * sizeof(WCHAR) ))) return NULL; + if (!(path = malloc( (len + 4) * sizeof(WCHAR) ))) return NULL; lstrcpyW( path, root ); lstrcatW( path, newfolder ); @@ -2977,7 +2896,7 @@ static WCHAR *get_unique_folder_name( const WCHAR *root, int *ret_len ) if (GetFileAttributesW( path ) == INVALID_FILE_ATTRIBUTES) break; if (count > 99) { - msi_free( path ); + free( path ); return NULL; } swprintf( path, len + 4, L"%s%s %u", root, newfolder, count++ ); @@ -2989,14 +2908,14 @@ static WCHAR *get_unique_folder_name( const WCHAR *root, int *ret_len ) return path; } -static UINT msi_dialog_directorylist_new( msi_dialog *dialog ) +static UINT dialog_directorylist_new( msi_dialog *dialog ) { - msi_control *control; + struct control *control; WCHAR *path; LVITEMW item; int index; - control = msi_dialog_find_control_by_type( dialog, L"DirectoryList" ); + control = dialog_find_control_by_type( dialog, L"DirectoryList" ); if (!(path = get_path_property( dialog, control ))) return ERROR_OUTOFMEMORY; @@ -3009,12 +2928,12 @@ static UINT msi_dialog_directorylist_new( msi_dialog *dialog ) SendMessageW( control->hwnd, LVM_ENSUREVISIBLE, index, 0 ); SendMessageW( control->hwnd, LVM_EDITLABELW, index, -1 ); - msi_free( path ); - msi_free( item.pszText ); + free( path ); + free( item.pszText ); return ERROR_SUCCESS; } -static UINT msi_dialog_dirlist_handler( msi_dialog *dialog, msi_control *control, WPARAM param ) +static UINT dialog_dirlist_handler( msi_dialog *dialog, struct control *control, WPARAM param ) { NMHDR *nmhdr = (NMHDR *)param; WCHAR text[MAX_PATH], *new_path, *path, *prop; @@ -3052,13 +2971,13 @@ static UINT msi_dialog_dirlist_handler( msi_dialog *dialog, msi_control *control } indirect = control->attributes & msidbControlAttributesIndirect; - prop = msi_dialog_dup_property( dialog, control->property, indirect ); - path = msi_dialog_dup_property( dialog, prop, TRUE ); + prop = dialog_dup_property( dialog, control->property, indirect ); + path = dialog_dup_property( dialog, prop, TRUE ); - if (!(new_path = msi_alloc( (lstrlenW(path) + lstrlenW(text) + 2) * sizeof(WCHAR) ))) + if (!(new_path = malloc( (wcslen(path) + wcslen(text) + 2) * sizeof(WCHAR) ))) { - msi_free( prop ); - msi_free( path ); + free( prop ); + free( path ); return ERROR_OUTOFMEMORY; } lstrcpyW( new_path, path ); @@ -3066,42 +2985,42 @@ static UINT msi_dialog_dirlist_handler( msi_dialog *dialog, msi_control *control if (nmhdr->code == LVN_ENDLABELEDITW) CreateDirectoryW( new_path, NULL ); lstrcatW( new_path, L"\\" ); - msi_dialog_set_property( dialog->package, prop, new_path ); + dialog_set_property( dialog->package, prop, new_path ); - msi_dialog_update_directory_list( dialog, NULL ); - msi_dialog_update_directory_combo( dialog, NULL ); - msi_dialog_update_pathedit( dialog, NULL ); + dialog_update_directory_list( dialog, NULL ); + dialog_update_directory_combo( dialog, NULL ); + dialog_update_pathedit( dialog, NULL ); - msi_free( prop ); - msi_free( path ); - msi_free( new_path ); + free( prop ); + free( path ); + free( new_path ); return ERROR_SUCCESS; } -static UINT msi_dialog_directory_list( msi_dialog *dialog, MSIRECORD *rec ) +static UINT dialog_directory_list( msi_dialog *dialog, MSIRECORD *rec ) { - msi_control *control; + struct control *control; LPCWSTR prop; DWORD style; style = LVS_LIST | WS_VSCROLL | LVS_SHAREIMAGELISTS | LVS_EDITLABELS | LVS_AUTOARRANGE | LVS_SINGLESEL | WS_BORDER | LVS_SORTASCENDING | WS_CHILD | WS_GROUP | WS_TABSTOP; - control = msi_dialog_add_control( dialog, rec, WC_LISTVIEWW, style ); + control = dialog_add_control( dialog, rec, WC_LISTVIEWW, style ); if (!control) return ERROR_FUNCTION_FAILED; control->attributes = MSI_RecordGetInteger( rec, 8 ); - control->handler = msi_dialog_dirlist_handler; + control->handler = dialog_dirlist_handler; prop = MSI_RecordGetString( rec, 9 ); - control->property = msi_dialog_dup_property( dialog, prop, FALSE ); + control->property = dialog_dup_property( dialog, prop, FALSE ); /* double click to activate an item in the list */ SendMessageW( control->hwnd, LVM_SETEXTENDEDLISTVIEWSTYLE, 0, LVS_EX_TWOCLICKACTIVATE ); - msi_dialog_update_directory_list( dialog, control ); + dialog_update_directory_list( dialog, control ); return ERROR_SUCCESS; } @@ -3128,7 +3047,7 @@ static const WCHAR column_keys[][80] = L"VolumeCostDifference", }; -static void msi_dialog_vcl_add_columns( msi_dialog *dialog, msi_control *control, MSIRECORD *rec ) +static void dialog_vcl_add_columns( msi_dialog *dialog, struct control *control, MSIRECORD *rec ) { LPCWSTR text = MSI_RecordGetString( rec, 10 ); LPCWSTR begin = text, end; @@ -3143,7 +3062,7 @@ static void msi_dialog_vcl_add_columns( msi_dialog *dialog, msi_control *control if (!(end = wcschr( begin, '}' ))) return; - num = msi_alloc( (end-begin+1)*sizeof(WCHAR) ); + num = malloc( (end - begin + 1) * sizeof(WCHAR) ); if (!num) return; @@ -3154,7 +3073,7 @@ static void msi_dialog_vcl_add_columns( msi_dialog *dialog, msi_control *control if ( !num[0] || !wcscmp( num, L"0" ) ) { count++; - msi_free( num ); + free( num ); continue; } @@ -3167,26 +3086,26 @@ static void msi_dialog_vcl_add_columns( msi_dialog *dialog, msi_control *control if (count == 0 && (!wcsncmp(num, L"\\", 1) || !wcsncmp(num, L"&", 1))) { FIXME("Style prefix not supported\n"); - msi_free(num); + free(num); continue; } #endif - msi_free( num ); + free( num ); return; } ZeroMemory( &lvc, sizeof(lvc) ); lvc.mask = LVCF_TEXT | LVCF_WIDTH | LVCF_SUBITEM; lvc.cx = wcstol( num, NULL, 10 ); - lvc.pszText = msi_dialog_get_uitext( dialog, column_keys[count] ); + lvc.pszText = dialog_get_uitext( dialog, column_keys[count] ); SendMessageW( control->hwnd, LVM_INSERTCOLUMNW, count++, (LPARAM)&lvc ); - msi_free( lvc.pszText ); - msi_free( num ); + free( lvc.pszText ); + free( num ); } } -static LONGLONG msi_vcl_get_cost( msi_dialog *dialog ) +static LONGLONG vcl_get_cost( msi_dialog *dialog ) { MSIFEATURE *feature; INT each_cost; @@ -3197,22 +3116,20 @@ static LONGLONG msi_vcl_get_cost( msi_dialog *dialog ) if (ERROR_SUCCESS == (MSI_GetFeatureCost(dialog->package, feature, MSICOSTTREE_SELFONLY, INSTALLSTATE_LOCAL, &each_cost))) { - /* each_cost is in 512-byte units */ - total_cost += ((LONGLONG)each_cost) * 512; + total_cost += each_cost; } if (ERROR_SUCCESS == (MSI_GetFeatureCost(dialog->package, feature, MSICOSTTREE_SELFONLY, INSTALLSTATE_ABSENT, &each_cost))) { - /* each_cost is in 512-byte units */ - total_cost -= ((LONGLONG)each_cost) * 512; + total_cost -= each_cost; } } return total_cost; } -static void msi_dialog_vcl_add_drives( msi_dialog *dialog, msi_control *control ) +static void dialog_vcl_add_drives( msi_dialog *dialog, struct control *control ) { - ULARGE_INTEGER total, free; + ULARGE_INTEGER total, unused; LONGLONG difference, cost; WCHAR size_text[MAX_PATH]; WCHAR cost_text[MAX_PATH]; @@ -3225,13 +3142,13 @@ static void msi_dialog_vcl_add_drives( msi_dialog *dialog, msi_control *control #endif int i = 0; - cost = msi_vcl_get_cost(dialog); + cost = vcl_get_cost(dialog) * 512; StrFormatByteSizeW(cost, cost_text, MAX_PATH); size = GetLogicalDriveStringsW( 0, NULL ); if ( !size ) return; - drives = msi_alloc( (size + 1) * sizeof(WCHAR) ); + drives = malloc( (size + 1) * sizeof(WCHAR) ); if ( !drives ) return; GetLogicalDriveStringsW( size, drives ); @@ -3257,8 +3174,8 @@ static void msi_dialog_vcl_add_drives( msi_dialog *dialog, msi_control *control lvitem.cchTextMax = lstrlenW(ptr) + 1; SendMessageW( control->hwnd, LVM_INSERTITEMW, 0, (LPARAM)&lvitem ); - GetDiskFreeSpaceExW(ptr, &free, &total, NULL); - difference = free.QuadPart - cost; + GetDiskFreeSpaceExW(ptr, &unused, &total, NULL); + difference = unused.QuadPart - cost; StrFormatByteSizeW(total.QuadPart, size_text, MAX_PATH); lvitem.iSubItem = 1; @@ -3266,7 +3183,7 @@ static void msi_dialog_vcl_add_drives( msi_dialog *dialog, msi_control *control lvitem.cchTextMax = lstrlenW(size_text) + 1; SendMessageW( control->hwnd, LVM_SETITEMW, 0, (LPARAM)&lvitem ); - StrFormatByteSizeW(free.QuadPart, size_text, MAX_PATH); + StrFormatByteSizeW(unused.QuadPart, size_text, MAX_PATH); lvitem.iSubItem = 2; lvitem.pszText = size_text; lvitem.cchTextMax = lstrlenW(size_text) + 1; @@ -3287,31 +3204,30 @@ static void msi_dialog_vcl_add_drives( msi_dialog *dialog, msi_control *control i++; } - msi_free( drives ); + free( drives ); } -static UINT msi_dialog_volumecost_list( msi_dialog *dialog, MSIRECORD *rec ) +static UINT dialog_volumecost_list( msi_dialog *dialog, MSIRECORD *rec ) { - msi_control *control; + struct control *control; DWORD style; style = LVS_REPORT | WS_VSCROLL | WS_HSCROLL | LVS_SHAREIMAGELISTS | LVS_AUTOARRANGE | LVS_SINGLESEL | WS_BORDER | WS_CHILD | WS_TABSTOP | WS_GROUP; - control = msi_dialog_add_control( dialog, rec, WC_LISTVIEWW, style ); + control = dialog_add_control( dialog, rec, WC_LISTVIEWW, style ); if (!control) return ERROR_FUNCTION_FAILED; - msi_dialog_vcl_add_columns( dialog, control, rec ); - msi_dialog_vcl_add_drives( dialog, control ); + dialog_vcl_add_columns( dialog, control, rec ); + dialog_vcl_add_drives( dialog, control ); return ERROR_SUCCESS; } /******************** VolumeSelect Combo ***************************************/ -static UINT msi_dialog_volsel_handler( msi_dialog *dialog, - msi_control *control, WPARAM param ) +static UINT dialog_volsel_handler( msi_dialog *dialog, struct control *control, WPARAM param ) { WCHAR text[MAX_PATH]; LPWSTR prop; @@ -3331,15 +3247,15 @@ static UINT msi_dialog_volsel_handler( msi_dialog *dialog, SendMessageW( control->hwnd, CB_GETLBTEXT, index, (LPARAM)text ); indirect = control->attributes & msidbControlAttributesIndirect; - prop = msi_dialog_dup_property( dialog, control->property, indirect ); + prop = dialog_dup_property( dialog, control->property, indirect ); - msi_dialog_set_property( dialog->package, prop, text ); + dialog_set_property( dialog->package, prop, text ); - msi_free( prop ); + free( prop ); return ERROR_SUCCESS; } -static void msi_dialog_vsc_add_drives( msi_dialog *dialog, msi_control *control ) +static void dialog_vsc_add_drives( msi_dialog *dialog, struct control *control ) { LPWSTR drives, ptr; DWORD size; @@ -3347,7 +3263,7 @@ static void msi_dialog_vsc_add_drives( msi_dialog *dialog, msi_control *control size = GetLogicalDriveStringsW( 0, NULL ); if ( !size ) return; - drives = msi_alloc( (size + 1) * sizeof(WCHAR) ); + drives = malloc( (size + 1) * sizeof(WCHAR) ); if ( !drives ) return; GetLogicalDriveStringsW( size, drives ); @@ -3359,12 +3275,12 @@ static void msi_dialog_vsc_add_drives( msi_dialog *dialog, msi_control *control ptr += lstrlenW(ptr) + 1; } - msi_free( drives ); + free( drives ); } -static UINT msi_dialog_volumeselect_combo( msi_dialog *dialog, MSIRECORD *rec ) +static UINT dialog_volumeselect_combo( msi_dialog *dialog, MSIRECORD *rec ) { - msi_control *control; + struct control *control; LPCWSTR prop; DWORD style; @@ -3372,21 +3288,21 @@ static UINT msi_dialog_volumeselect_combo( msi_dialog *dialog, MSIRECORD *rec ) style = WS_CHILD | WS_VISIBLE | WS_GROUP | WS_TABSTOP | CBS_DROPDOWNLIST | CBS_SORT | CBS_HASSTRINGS | WS_EX_LEFT | WS_EX_LTRREADING | WS_EX_RIGHTSCROLLBAR; - control = msi_dialog_add_control( dialog, rec, WC_COMBOBOXW, style ); + control = dialog_add_control( dialog, rec, WC_COMBOBOXW, style ); if (!control) return ERROR_FUNCTION_FAILED; control->attributes = MSI_RecordGetInteger( rec, 8 ); - control->handler = msi_dialog_volsel_handler; + control->handler = dialog_volsel_handler; prop = MSI_RecordGetString( rec, 9 ); - control->property = msi_dialog_dup_property( dialog, prop, FALSE ); + control->property = dialog_dup_property( dialog, prop, FALSE ); - msi_dialog_vsc_add_drives( dialog, control ); + dialog_vsc_add_drives( dialog, control ); return ERROR_SUCCESS; } -static UINT msi_dialog_hyperlink_handler( msi_dialog *dialog, msi_control *control, WPARAM param ) +static UINT dialog_hyperlink_handler( msi_dialog *dialog, struct control *control, WPARAM param ) { int len, len_href = ARRAY_SIZE( L"href" ) - 1; const WCHAR *p, *q; @@ -3431,20 +3347,20 @@ static UINT msi_dialog_hyperlink_handler( msi_dialog *dialog, msi_control *contr return ERROR_SUCCESS; } -static UINT msi_dialog_hyperlink( msi_dialog *dialog, MSIRECORD *rec ) +static UINT dialog_hyperlink( msi_dialog *dialog, MSIRECORD *rec ) { - msi_control *control; + struct control *control; DWORD style = WS_CHILD | WS_TABSTOP | WS_GROUP; const WCHAR *text = MSI_RecordGetString( rec, 10 ); int len = lstrlenW( text ); LITEM item; - control = msi_dialog_add_control( dialog, rec, WC_LINK, style ); + control = dialog_add_control( dialog, rec, WC_LINK, style ); if (!control) return ERROR_FUNCTION_FAILED; control->attributes = MSI_RecordGetInteger( rec, 8 ); - control->handler = msi_dialog_hyperlink_handler; + control->handler = dialog_hyperlink_handler; item.mask = LIF_ITEMINDEX | LIF_STATE | LIF_URL; item.iLink = 0; @@ -3463,10 +3379,10 @@ static UINT msi_dialog_hyperlink( msi_dialog *dialog, MSIRECORD *rec ) struct listview_param { msi_dialog *dialog; - msi_control *control; + struct control *control; }; -static UINT msi_dialog_listview_handler( msi_dialog *dialog, msi_control *control, WPARAM param ) +static UINT dialog_listview_handler( msi_dialog *dialog, struct control *control, WPARAM param ) { NMHDR *nmhdr = (NMHDR *)param; @@ -3475,7 +3391,7 @@ static UINT msi_dialog_listview_handler( msi_dialog *dialog, msi_control *contro return ERROR_SUCCESS; } -static UINT msi_listview_add_item( MSIRECORD *rec, LPVOID param ) +static UINT listview_add_item( MSIRECORD *rec, void *param ) { struct listview_param *lv_param = (struct listview_param *)param; LPCWSTR text, binary; @@ -3484,7 +3400,7 @@ static UINT msi_listview_add_item( MSIRECORD *rec, LPVOID param ) text = MSI_RecordGetString( rec, 4 ); binary = MSI_RecordGetString( rec, 5 ); - hIcon = msi_load_icon( lv_param->dialog->package->db, binary, 0 ); + hIcon = load_icon( lv_param->dialog->package->db, binary, 0 ); TRACE("Adding: text %s, binary %s, icon %p\n", debugstr_w(text), debugstr_w(binary), hIcon); @@ -3500,7 +3416,7 @@ static UINT msi_listview_add_item( MSIRECORD *rec, LPVOID param ) return ERROR_SUCCESS; } -static UINT msi_listview_add_items( msi_dialog *dialog, msi_control *control ) +static UINT listview_add_items( msi_dialog *dialog, struct control *control ) { MSIQUERY *view; struct listview_param lv_param = { dialog, control }; @@ -3508,16 +3424,16 @@ static UINT msi_listview_add_items( msi_dialog *dialog, msi_control *control ) if (MSI_OpenQuery( dialog->package->db, &view, L"SELECT * FROM `ListView` WHERE `Property` = '%s' ORDER BY `Order`", control->property ) == ERROR_SUCCESS) { - MSI_IterateRecords( view, NULL, msi_listview_add_item, &lv_param ); + MSI_IterateRecords( view, NULL, listview_add_item, &lv_param ); msiobj_release( &view->hdr ); } return ERROR_SUCCESS; } -static UINT msi_dialog_listview( msi_dialog *dialog, MSIRECORD *rec ) +static UINT dialog_listview( msi_dialog *dialog, MSIRECORD *rec ) { - msi_control *control; + struct control *control; LPCWSTR prop; DWORD style, attributes; LVCOLUMNW col; @@ -3528,12 +3444,12 @@ static UINT msi_dialog_listview( msi_dialog *dialog, MSIRECORD *rec ) attributes = MSI_RecordGetInteger( rec, 8 ); if ( ~attributes & msidbControlAttributesSorted ) style |= LVS_SORTASCENDING; - control = msi_dialog_add_control( dialog, rec, WC_LISTVIEWW, style ); + control = dialog_add_control( dialog, rec, WC_LISTVIEWW, style ); if (!control) return ERROR_FUNCTION_FAILED; prop = MSI_RecordGetString( rec, 9 ); - control->property = msi_dialog_dup_property( dialog, prop, FALSE ); + control->property = dialog_dup_property( dialog, prop, FALSE ); control->hImageList = ImageList_Create( 16, 16, ILC_COLOR32, 0, 1); SendMessageW( control->hwnd, LVM_SETIMAGELIST, LVSIL_SMALL, (LPARAM)control->hImageList ); @@ -3548,40 +3464,40 @@ static UINT msi_dialog_listview( msi_dialog *dialog, MSIRECORD *rec ) SendMessageW( control->hwnd, LVM_INSERTCOLUMNW, 0, (LPARAM)&col ); if (control->property) - msi_listview_add_items( dialog, control ); + listview_add_items( dialog, control ); - control->handler = msi_dialog_listview_handler; + control->handler = dialog_listview_handler; return ERROR_SUCCESS; } static const struct control_handler msi_dialog_handler[] = { - { L"Text", msi_dialog_text_control }, - { L"PushButton", msi_dialog_button_control }, - { L"Line", msi_dialog_line_control }, - { L"Bitmap", msi_dialog_bitmap_control }, - { L"CheckBox", msi_dialog_checkbox_control }, - { L"ScrollableText", msi_dialog_scrolltext_control }, - { L"ComboBox", msi_dialog_combo_control }, - { L"Edit", msi_dialog_edit_control }, - { L"MaskedEdit", msi_dialog_maskedit_control }, - { L"PathEdit", msi_dialog_pathedit_control }, - { L"ProgressBar", msi_dialog_progress_bar }, - { L"RadioButtonGroup", msi_dialog_radiogroup_control }, - { L"Icon", msi_dialog_icon_control }, - { L"SelectionTree", msi_dialog_selection_tree }, - { L"GroupBox", msi_dialog_group_box }, - { L"ListBox", msi_dialog_list_box }, - { L"DirectoryCombo", msi_dialog_directory_combo }, - { L"DirectoryList", msi_dialog_directory_list }, - { L"VolumeCostList", msi_dialog_volumecost_list }, - { L"VolumeSelectCombo", msi_dialog_volumeselect_combo }, - { L"HyperLink", msi_dialog_hyperlink }, - { L"ListView", msi_dialog_listview } + { L"Text", dialog_text_control }, + { L"PushButton", dialog_button_control }, + { L"Line", dialog_line_control }, + { L"Bitmap", dialog_bitmap_control }, + { L"CheckBox", dialog_checkbox_control }, + { L"ScrollableText", dialog_scrolltext_control }, + { L"ComboBox", dialog_combo_control }, + { L"Edit", dialog_edit_control }, + { L"MaskedEdit", dialog_maskedit_control }, + { L"PathEdit", dialog_pathedit_control }, + { L"ProgressBar", dialog_progress_bar }, + { L"RadioButtonGroup", dialog_radiogroup_control }, + { L"Icon", dialog_icon_control }, + { L"SelectionTree", dialog_selection_tree }, + { L"GroupBox", dialog_group_box }, + { L"ListBox", dialog_list_box }, + { L"DirectoryCombo", dialog_directory_combo }, + { L"DirectoryList", dialog_directory_list }, + { L"VolumeCostList", dialog_volumecost_list }, + { L"VolumeSelectCombo", dialog_volumeselect_combo }, + { L"HyperLink", dialog_hyperlink }, + { L"ListView", dialog_listview } }; -static UINT msi_dialog_create_controls( MSIRECORD *rec, LPVOID param ) +static UINT dialog_create_controls( MSIRECORD *rec, void *param ) { msi_dialog *dialog = param; LPCWSTR control_type; @@ -3600,7 +3516,7 @@ static UINT msi_dialog_create_controls( MSIRECORD *rec, LPVOID param ) return ERROR_SUCCESS; } -static UINT msi_dialog_fill_controls( msi_dialog *dialog ) +static UINT dialog_fill_controls( msi_dialog *dialog ) { UINT r; MSIQUERY *view; @@ -3616,19 +3532,19 @@ static UINT msi_dialog_fill_controls( msi_dialog *dialog ) return ERROR_INVALID_PARAMETER; } - r = MSI_IterateRecords( view, 0, msi_dialog_create_controls, dialog ); + r = MSI_IterateRecords( view, 0, dialog_create_controls, dialog ); msiobj_release( &view->hdr ); return r; } -static UINT msi_dialog_reset( msi_dialog *dialog ) +static UINT dialog_reset( msi_dialog *dialog ) { /* FIXME: should restore the original values of any properties we changed */ - return msi_dialog_evaluate_control_conditions( dialog ); + return dialog_evaluate_control_conditions( dialog ); } /* figure out the height of 10 point MS Sans Serif */ -static INT msi_dialog_get_sans_serif_height( HWND hwnd ) +static INT dialog_get_sans_serif_height( HWND hwnd ) { LOGFONTW lf; TEXTMETRICW tm; @@ -3659,7 +3575,7 @@ static INT msi_dialog_get_sans_serif_height( HWND hwnd ) } /* fetch the associated record from the Dialog table */ -static MSIRECORD *msi_get_dialog_record( msi_dialog *dialog ) +static MSIRECORD *get_dialog_record( msi_dialog *dialog ) { MSIPACKAGE *package = dialog->package; MSIRECORD *rec = NULL; @@ -3673,7 +3589,7 @@ static MSIRECORD *msi_get_dialog_record( msi_dialog *dialog ) return rec; } -static void msi_dialog_adjust_dialog_pos( msi_dialog *dialog, MSIRECORD *rec, LPRECT pos ) +static void dialog_adjust_dialog_pos( msi_dialog *dialog, MSIRECORD *rec, RECT *pos ) { UINT xres, yres; POINT center; @@ -3686,8 +3602,8 @@ static void msi_dialog_adjust_dialog_pos( msi_dialog *dialog, MSIRECORD *rec, LP sz.cx = MSI_RecordGetInteger( rec, 4 ); sz.cy = MSI_RecordGetInteger( rec, 5 ); - sz.cx = msi_dialog_scale_unit( dialog, sz.cx ); - sz.cy = msi_dialog_scale_unit( dialog, sz.cy ); + sz.cx = dialog_scale_unit( dialog, sz.cx ); + sz.cy = dialog_scale_unit( dialog, sz.cy ); xres = msi_get_property_int( dialog->package->db, L"ScreenX", 0 ); yres = msi_get_property_int( dialog->package->db, L"ScreenY", 0 ); @@ -3724,14 +3640,14 @@ static void msi_dialog_adjust_dialog_pos( msi_dialog *dialog, MSIRECORD *rec, LP AdjustWindowRect( pos, style, FALSE ); } -static void msi_dialog_set_tab_order( msi_dialog *dialog, LPCWSTR first ) +static void dialog_set_tab_order( msi_dialog *dialog, const WCHAR *first ) { struct list tab_chain; - msi_control *control; + struct control *control; HWND prev = HWND_TOP; list_init( &tab_chain ); - if (!(control = msi_dialog_find_control( dialog, first ))) return; + if (!(control = dialog_find_control( dialog, first ))) return; dialog->hWndFocus = control->hwnd; while (control) @@ -3739,10 +3655,10 @@ static void msi_dialog_set_tab_order( msi_dialog *dialog, LPCWSTR first ) list_remove( &control->entry ); list_add_tail( &tab_chain, &control->entry ); if (!control->tabnext) break; - control = msi_dialog_find_control( dialog, control->tabnext ); + control = dialog_find_control( dialog, control->tabnext ); } - LIST_FOR_EACH_ENTRY( control, &tab_chain, msi_control, entry ) + LIST_FOR_EACH_ENTRY( control, &tab_chain, struct control, entry ) { SetWindowPos( control->hwnd, prev, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOOWNERZORDER | SWP_NOREDRAW | @@ -3754,7 +3670,7 @@ static void msi_dialog_set_tab_order( msi_dialog *dialog, LPCWSTR first ) list_move_head( &dialog->controls, &tab_chain ); } -static LRESULT msi_dialog_oncreate( HWND hwnd, LPCREATESTRUCTW cs ) +static LRESULT dialog_oncreate( HWND hwnd, CREATESTRUCTW *cs ) { msi_dialog *dialog = cs->lpCreateParams; MSIRECORD *rec = NULL; @@ -3766,23 +3682,23 @@ static LRESULT msi_dialog_oncreate( HWND hwnd, LPCREATESTRUCTW cs ) dialog->hwnd = hwnd; SetWindowLongPtrW( hwnd, GWLP_USERDATA, (LONG_PTR) dialog ); - rec = msi_get_dialog_record( dialog ); + rec = get_dialog_record( dialog ); if( !rec ) { TRACE("No record found for dialog %s\n", debugstr_w(dialog->name)); return -1; } - dialog->scale = msi_dialog_get_sans_serif_height(dialog->hwnd); + dialog->scale = dialog_get_sans_serif_height(dialog->hwnd); - msi_dialog_adjust_dialog_pos( dialog, rec, &pos ); + dialog_adjust_dialog_pos( dialog, rec, &pos ); dialog->attributes = MSI_RecordGetInteger( rec, 6 ); dialog->default_font = msi_dup_property( dialog->package->db, L"DefaultUIFont" ); if (!dialog->default_font) { - dialog->default_font = strdupW( L"MS Shell Dlg" ); + dialog->default_font = wcsdup( L"MS Shell Dlg" ); if (!dialog->default_font) { msiobj_release( &rec->hdr ); @@ -3790,39 +3706,39 @@ static LRESULT msi_dialog_oncreate( HWND hwnd, LPCREATESTRUCTW cs ) } } - title = msi_get_deformatted_field( dialog->package, rec, 7 ); + title = get_deformatted_field( dialog->package, rec, 7 ); SetWindowTextW( hwnd, title ); - msi_free( title ); + free( title ); SetWindowPos( hwnd, 0, pos.left, pos.top, pos.right - pos.left, pos.bottom - pos.top, SWP_NOACTIVATE | SWP_NOZORDER | SWP_NOREDRAW ); - msi_dialog_build_font_list( dialog ); - msi_dialog_fill_controls( dialog ); - msi_dialog_evaluate_control_conditions( dialog ); - msi_dialog_set_tab_order( dialog, MSI_RecordGetString( rec, 8 ) ); + dialog_build_font_list( dialog ); + dialog_fill_controls( dialog ); + dialog_evaluate_control_conditions( dialog ); + dialog_set_tab_order( dialog, MSI_RecordGetString( rec, 8 ) ); msiobj_release( &rec->hdr ); return 0; } -static LRESULT msi_dialog_oncommand( msi_dialog *dialog, WPARAM param, HWND hwnd ) +static LRESULT dialog_oncommand( msi_dialog *dialog, WPARAM param, HWND hwnd ) { - msi_control *control = NULL; + struct control *control = NULL; TRACE( "%p, %#Ix, %p\n", dialog, param, hwnd ); switch (param) { case 1: /* enter */ - control = msi_dialog_find_control( dialog, dialog->control_default ); + control = dialog_find_control( dialog, dialog->control_default ); break; case 2: /* escape */ - control = msi_dialog_find_control( dialog, dialog->control_cancel ); + control = dialog_find_control( dialog, dialog->control_cancel ); break; default: - control = msi_dialog_find_control_by_hwnd( dialog, hwnd ); + control = dialog_find_control_by_hwnd( dialog, hwnd ); } if( control ) @@ -3830,17 +3746,17 @@ static LRESULT msi_dialog_oncommand( msi_dialog *dialog, WPARAM param, HWND hwnd if( control->handler ) { control->handler( dialog, control, param ); - msi_dialog_evaluate_control_conditions( dialog ); + dialog_evaluate_control_conditions( dialog ); } } return 0; } -static LRESULT msi_dialog_onnotify( msi_dialog *dialog, LPARAM param ) +static LRESULT dialog_onnotify( msi_dialog *dialog, LPARAM param ) { LPNMHDR nmhdr = (LPNMHDR) param; - msi_control *control = msi_dialog_find_control_by_hwnd( dialog, nmhdr->hwndFrom ); + struct control *control = dialog_find_control_by_hwnd( dialog, nmhdr->hwndFrom ); TRACE("%p %p\n", dialog, nmhdr->hwndFrom); @@ -3875,14 +3791,14 @@ static LRESULT WINAPI MSIDialog_WndProc( HWND hwnd, UINT msg, break; case WM_CREATE: - return msi_dialog_oncreate( hwnd, (LPCREATESTRUCTW)lParam ); + return dialog_oncreate( hwnd, (LPCREATESTRUCTW)lParam ); case WM_COMMAND: - return msi_dialog_oncommand( dialog, wParam, (HWND)lParam ); + return dialog_oncommand( dialog, wParam, (HWND)lParam ); case WM_CLOSE: /* Simulate escape press */ - return msi_dialog_oncommand(dialog, 2, NULL); + return dialog_oncommand(dialog, 2, NULL); case WM_ACTIVATE: if( LOWORD(wParam) == WA_INACTIVE ) @@ -3903,7 +3819,7 @@ static LRESULT WINAPI MSIDialog_WndProc( HWND hwnd, UINT msg, dialog->hwnd = NULL; return 0; case WM_NOTIFY: - return msi_dialog_onnotify( dialog, lParam ); + return dialog_onnotify( dialog, lParam ); } return DefWindowProcW(hwnd, msg, wParam, lParam); } @@ -3964,8 +3880,7 @@ static UINT dialog_run_message_loop( msi_dialog *dialog ) return ERROR_SUCCESS; } -static LRESULT WINAPI MSIHiddenWindowProc( HWND hwnd, UINT msg, - WPARAM wParam, LPARAM lParam ) +static LRESULT WINAPI MSIHiddenWindowProc( HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam ) { msi_dialog *dialog = (msi_dialog*) lParam; @@ -4015,7 +3930,7 @@ static BOOL dialog_register_class( void ) } static msi_dialog *dialog_create( MSIPACKAGE *package, const WCHAR *name, msi_dialog *parent, - control_event_handler event_handler ) + UINT (*event_handler)(msi_dialog *, const WCHAR *, const WCHAR *) ) { MSIRECORD *rec = NULL; msi_dialog *dialog; @@ -4025,7 +3940,7 @@ static msi_dialog *dialog_create( MSIPACKAGE *package, const WCHAR *name, msi_di if (!hMsiHiddenWindow) dialog_register_class(); /* allocate the structure for the dialog to use */ - dialog = msi_alloc_zero( FIELD_OFFSET( msi_dialog, name[lstrlenW( name ) + 1] )); + dialog = calloc( 1, offsetof( msi_dialog, name[wcslen( name ) + 1] ) ); if( !dialog ) return NULL; lstrcpyW( dialog->name, name ); @@ -4037,15 +3952,15 @@ static msi_dialog *dialog_create( MSIPACKAGE *package, const WCHAR *name, msi_di list_init( &dialog->fonts ); /* verify that the dialog exists */ - rec = msi_get_dialog_record( dialog ); + rec = get_dialog_record( dialog ); if( !rec ) { - msi_free( dialog ); + free( dialog ); return NULL; } dialog->attributes = MSI_RecordGetInteger( rec, 6 ); - dialog->control_default = strdupW( MSI_RecordGetString( rec, 9 ) ); - dialog->control_cancel = strdupW( MSI_RecordGetString( rec, 10 ) ); + dialog->control_default = wcsdup( MSI_RecordGetString( rec, 9 ) ); + dialog->control_cancel = wcsdup( MSI_RecordGetString( rec, 10 ) ); msiobj_release( &rec->hdr ); rec = MSI_CreateRecord(2); @@ -4062,7 +3977,7 @@ static msi_dialog *dialog_create( MSIPACKAGE *package, const WCHAR *name, msi_di return dialog; } -static void msi_dialog_end_dialog( msi_dialog *dialog ) +static void dialog_end_dialog( msi_dialog *dialog ) { TRACE("%p\n", dialog); dialog->finished = 1; @@ -4117,10 +4032,10 @@ static void dialog_do_preview( msi_dialog *dialog ) static void free_subscriber( struct subscriber *sub ) { - msi_free( sub->event ); - msi_free( sub->control ); - msi_free( sub->attribute ); - msi_free( sub ); + free( sub->event ); + free( sub->control ); + free( sub->attribute ); + free( sub ); } static void event_cleanup_subscriptions( MSIPACKAGE *package, const WCHAR *dialog ) @@ -4139,7 +4054,7 @@ static void event_cleanup_subscriptions( MSIPACKAGE *package, const WCHAR *dialo void msi_dialog_destroy( msi_dialog *dialog ) { - msi_font *font, *next; + struct font *font, *next; if( uiThreadId != GetCurrentThreadId() ) { @@ -4159,26 +4074,25 @@ void msi_dialog_destroy( msi_dialog *dialog ) /* destroy the list of controls */ while( !list_empty( &dialog->controls ) ) { - msi_control *t; + struct control *t; - t = LIST_ENTRY( list_head( &dialog->controls ), - msi_control, entry ); - msi_destroy_control( t ); + t = LIST_ENTRY( list_head( &dialog->controls ), struct control, entry ); + destroy_control( t ); } /* destroy the list of fonts */ - LIST_FOR_EACH_ENTRY_SAFE( font, next, &dialog->fonts, msi_font, entry ) + LIST_FOR_EACH_ENTRY_SAFE( font, next, &dialog->fonts, struct font, entry ) { list_remove( &font->entry ); DeleteObject( font->hfont ); - msi_free( font ); + free( font ); } - msi_free( dialog->default_font ); + free( dialog->default_font ); - msi_free( dialog->control_default ); - msi_free( dialog->control_cancel ); + free( dialog->control_default ); + free( dialog->control_cancel ); dialog->package = NULL; - msi_free( dialog ); + free( dialog ); } void msi_dialog_unregister_class( void ) @@ -4308,7 +4222,7 @@ UINT WINAPI MsiPreviewDialogA( MSIHANDLE hPreview, LPCSTR szDialogName ) return ERROR_OUTOFMEMORY; } r = MsiPreviewDialogW( hPreview, strW ); - msi_free( strW ); + free( strW ); return r; } @@ -4327,7 +4241,7 @@ UINT WINAPI MsiPreviewBillboardA( MSIHANDLE hPreview, const char *szControlName, struct control_event { const WCHAR *event; - event_handler handler; + UINT (*handler)( msi_dialog *, const WCHAR * ); }; static UINT dialog_event_handler( msi_dialog *, const WCHAR *, const WCHAR * ); @@ -4384,15 +4298,15 @@ static UINT event_end_dialog( msi_dialog *dialog, const WCHAR *argument ) dialog->retval = IDABORT; } event_cleanup_subscriptions( dialog->package, dialog->name ); - msi_dialog_end_dialog( dialog ); + dialog_end_dialog( dialog ); return ERROR_SUCCESS; } static UINT pending_event_end_dialog( msi_dialog *dialog, const WCHAR *argument ) { dialog->pending_event = event_end_dialog; - msi_free( dialog->pending_argument ); - dialog->pending_argument = strdupW( argument ); + free( dialog->pending_argument ); + dialog->pending_argument = wcsdup( argument ); return ERROR_SUCCESS; } @@ -4400,17 +4314,17 @@ static UINT pending_event_end_dialog( msi_dialog *dialog, const WCHAR *argument static UINT event_new_dialog( msi_dialog *dialog, const WCHAR *argument ) { /* store the name of the next dialog, and signal this one to end */ - dialog->package->next_dialog = strdupW( argument ); + dialog->package->next_dialog = wcsdup( argument ); msi_event_cleanup_all_subscriptions( dialog->package ); - msi_dialog_end_dialog( dialog ); + dialog_end_dialog( dialog ); return ERROR_SUCCESS; } static UINT pending_event_new_dialog( msi_dialog *dialog, const WCHAR *argument ) { dialog->pending_event = event_new_dialog; - msi_free( dialog->pending_argument ); - dialog->pending_argument = strdupW( argument ); + free( dialog->pending_argument ); + dialog->pending_argument = wcsdup( argument ); return ERROR_SUCCESS; } @@ -4423,10 +4337,10 @@ static UINT event_spawn_dialog( msi_dialog *dialog, const WCHAR *argument ) if (r != 0) { dialog->retval = r; - msi_dialog_end_dialog( dialog ); + dialog_end_dialog( dialog ); } else - msi_dialog_update_all_controls(dialog); + dialog_update_all_controls(dialog); return ERROR_SUCCESS; } @@ -4434,8 +4348,8 @@ static UINT event_spawn_dialog( msi_dialog *dialog, const WCHAR *argument ) static UINT pending_event_spawn_dialog( msi_dialog *dialog, const WCHAR *argument ) { dialog->pending_event = event_spawn_dialog; - msi_free( dialog->pending_argument ); - dialog->pending_argument = strdupW( argument ); + free( dialog->pending_argument ); + dialog->pending_argument = wcsdup( argument ); return ERROR_SUCCESS; } @@ -4525,15 +4439,15 @@ static UINT event_set_target_path( msi_dialog *dialog, const WCHAR *argument ) { /* failure to set the path halts the executing of control events */ r = MSI_SetTargetPathW( dialog->package, argument, path ); - msi_free( path ); + free( path ); } - msi_free( &rec->hdr ); + msiobj_release( &rec->hdr ); return r; } static UINT event_reset( msi_dialog *dialog, const WCHAR *argument ) { - msi_dialog_reset( dialog ); + dialog_reset( dialog ); return ERROR_SUCCESS; } @@ -4584,7 +4498,7 @@ INT ACTION_DialogBox( MSIPACKAGE *package, const WCHAR *dialog ) package->next_dialog = NULL; r = event_do_dialog( package, name, NULL, TRUE ); - msi_free( name ); + free( name ); } return r; } @@ -4599,12 +4513,12 @@ static UINT event_set_install_level( msi_dialog *dialog, const WCHAR *argument ) static UINT event_directory_list_up( msi_dialog *dialog, const WCHAR *argument ) { - return msi_dialog_directorylist_up( dialog ); + return dialog_directorylist_up( dialog ); } static UINT event_directory_list_new( msi_dialog *dialog, const WCHAR *argument ) { - return msi_dialog_directorylist_new( dialog ); + return dialog_directorylist_new( dialog ); } static UINT event_reinstall_mode( msi_dialog *dialog, const WCHAR *argument ) diff --git a/dll/win32/msi/distinct.c b/dll/win32/msi/distinct.c index b97b8c90efc68..d1b99f9ca647a 100644 --- a/dll/win32/msi/distinct.c +++ b/dll/win32/msi/distinct.c @@ -35,25 +35,25 @@ WINE_DEFAULT_DEBUG_CHANNEL(msidb); -typedef struct tagDISTINCTSET +struct distinct_set { UINT val; UINT count; UINT row; - struct tagDISTINCTSET *nextrow; - struct tagDISTINCTSET *nextcol; -} DISTINCTSET; + struct distinct_set *nextrow; + struct distinct_set *nextcol; +}; -typedef struct tagMSIDISTINCTVIEW +struct distinct_view { MSIVIEW view; MSIDATABASE *db; MSIVIEW *table; UINT row_count; UINT *translation; -} MSIDISTINCTVIEW; +}; -static DISTINCTSET ** distinct_insert( DISTINCTSET **x, UINT val, UINT row ) +static struct distinct_set **distinct_insert( struct distinct_set **x, UINT val, UINT row ) { /* horrible O(n) find */ while( *x ) @@ -67,7 +67,7 @@ static DISTINCTSET ** distinct_insert( DISTINCTSET **x, UINT val, UINT row ) } /* nothing found, so add one */ - *x = msi_alloc( sizeof (DISTINCTSET) ); + *x = malloc( sizeof(**x) ); if( *x ) { (*x)->val = val; @@ -79,20 +79,20 @@ static DISTINCTSET ** distinct_insert( DISTINCTSET **x, UINT val, UINT row ) return x; } -static void distinct_free( DISTINCTSET *x ) +static void distinct_free( struct distinct_set *x ) { while( x ) { - DISTINCTSET *next = x->nextrow; + struct distinct_set *next = x->nextrow; distinct_free( x->nextcol ); - msi_free( x ); + free( x ); x = next; } } static UINT DISTINCT_fetch_int( struct tagMSIVIEW *view, UINT row, UINT col, UINT *val ) { - MSIDISTINCTVIEW *dv = (MSIDISTINCTVIEW*)view; + struct distinct_view *dv = (struct distinct_view *)view; TRACE("%p %d %d %p\n", dv, row, col, val ); @@ -109,9 +109,9 @@ static UINT DISTINCT_fetch_int( struct tagMSIVIEW *view, UINT row, UINT col, UIN static UINT DISTINCT_execute( struct tagMSIVIEW *view, MSIRECORD *record ) { - MSIDISTINCTVIEW *dv = (MSIDISTINCTVIEW*)view; + struct distinct_view *dv = (struct distinct_view *)view; UINT r, i, j, r_count, c_count; - DISTINCTSET *rowset = NULL; + struct distinct_set *rowset = NULL; TRACE("%p %p\n", dv, record); @@ -126,14 +126,14 @@ static UINT DISTINCT_execute( struct tagMSIVIEW *view, MSIRECORD *record ) if( r != ERROR_SUCCESS ) return r; - dv->translation = msi_alloc( r_count*sizeof(UINT) ); + dv->translation = malloc( r_count * sizeof(UINT) ); if( !dv->translation ) return ERROR_FUNCTION_FAILED; /* build it */ for( i=0; itable ) return ERROR_FUNCTION_FAILED; - msi_free( dv->translation ); + free( dv->translation ); dv->translation = NULL; dv->row_count = 0; @@ -187,7 +187,7 @@ static UINT DISTINCT_close( struct tagMSIVIEW *view ) static UINT DISTINCT_get_dimensions( struct tagMSIVIEW *view, UINT *rows, UINT *cols ) { - MSIDISTINCTVIEW *dv = (MSIDISTINCTVIEW*)view; + struct distinct_view *dv = (struct distinct_view *)view; TRACE("%p %p %p\n", dv, rows, cols ); @@ -207,7 +207,7 @@ static UINT DISTINCT_get_dimensions( struct tagMSIVIEW *view, UINT *rows, UINT * static UINT DISTINCT_get_column_info( struct tagMSIVIEW *view, UINT n, LPCWSTR *name, UINT *type, BOOL *temporary, LPCWSTR *table_name ) { - MSIDISTINCTVIEW *dv = (MSIDISTINCTVIEW*)view; + struct distinct_view *dv = (struct distinct_view *)view; TRACE("%p %d %p %p %p %p\n", dv, n, name, type, temporary, table_name ); @@ -221,7 +221,7 @@ static UINT DISTINCT_get_column_info( struct tagMSIVIEW *view, UINT n, LPCWSTR * static UINT DISTINCT_modify( struct tagMSIVIEW *view, MSIMODIFY eModifyMode, MSIRECORD *rec, UINT row ) { - MSIDISTINCTVIEW *dv = (MSIDISTINCTVIEW*)view; + struct distinct_view *dv = (struct distinct_view *)view; TRACE("%p %d %p\n", dv, eModifyMode, rec ); @@ -233,16 +233,16 @@ static UINT DISTINCT_modify( struct tagMSIVIEW *view, MSIMODIFY eModifyMode, static UINT DISTINCT_delete( struct tagMSIVIEW *view ) { - MSIDISTINCTVIEW *dv = (MSIDISTINCTVIEW*)view; + struct distinct_view *dv = (struct distinct_view *)view; TRACE("%p\n", dv ); if( dv->table ) dv->table->ops->delete( dv->table ); - msi_free( dv->translation ); + free( dv->translation ); msiobj_release( &dv->db->hdr ); - msi_free( dv ); + free( dv ); return ERROR_SUCCESS; } @@ -272,7 +272,7 @@ static const MSIVIEWOPS distinct_ops = UINT DISTINCT_CreateView( MSIDATABASE *db, MSIVIEW **view, MSIVIEW *table ) { - MSIDISTINCTVIEW *dv = NULL; + struct distinct_view *dv = NULL; UINT count = 0, r; TRACE("%p\n", dv ); @@ -284,7 +284,7 @@ UINT DISTINCT_CreateView( MSIDATABASE *db, MSIVIEW **view, MSIVIEW *table ) return r; } - dv = msi_alloc_zero( sizeof *dv ); + dv = calloc( 1, sizeof *dv ); if( !dv ) return ERROR_FUNCTION_FAILED; diff --git a/dll/win32/msi/drop.c b/dll/win32/msi/drop.c index 89fac9dfc7c40..9c7fc0ca0ea5b 100644 --- a/dll/win32/msi/drop.c +++ b/dll/win32/msi/drop.c @@ -34,18 +34,18 @@ WINE_DEFAULT_DEBUG_CHANNEL(msidb); -typedef struct tagMSIDROPVIEW +struct drop_view { MSIVIEW view; MSIDATABASE *db; MSIVIEW *table; column_info *colinfo; INT hold; -} MSIDROPVIEW; +}; static UINT DROP_execute(struct tagMSIVIEW *view, MSIRECORD *record) { - MSIDROPVIEW *dv = (MSIDROPVIEW*)view; + struct drop_view *dv = (struct drop_view *)view; UINT r; TRACE("%p %p\n", dv, record); @@ -62,7 +62,7 @@ static UINT DROP_execute(struct tagMSIVIEW *view, MSIRECORD *record) static UINT DROP_close(struct tagMSIVIEW *view) { - MSIDROPVIEW *dv = (MSIDROPVIEW*)view; + struct drop_view *dv = (struct drop_view *)view; TRACE("%p\n", dv); @@ -71,7 +71,7 @@ static UINT DROP_close(struct tagMSIVIEW *view) static UINT DROP_get_dimensions(struct tagMSIVIEW *view, UINT *rows, UINT *cols) { - MSIDROPVIEW *dv = (MSIDROPVIEW*)view; + struct drop_view *dv = (struct drop_view *)view; TRACE("%p %p %p\n", dv, rows, cols); @@ -80,14 +80,14 @@ static UINT DROP_get_dimensions(struct tagMSIVIEW *view, UINT *rows, UINT *cols) static UINT DROP_delete( struct tagMSIVIEW *view ) { - MSIDROPVIEW *dv = (MSIDROPVIEW*)view; + struct drop_view *dv = (struct drop_view *)view; TRACE("%p\n", dv ); if( dv->table ) dv->table->ops->delete( dv->table ); - msi_free( dv ); + free( dv ); return ERROR_SUCCESS; } @@ -117,19 +117,19 @@ static const MSIVIEWOPS drop_ops = UINT DROP_CreateView(MSIDATABASE *db, MSIVIEW **view, LPCWSTR name) { - MSIDROPVIEW *dv; + struct drop_view *dv; UINT r; TRACE("%p %s\n", view, debugstr_w(name)); - dv = msi_alloc_zero(sizeof *dv); + dv = calloc(1, sizeof *dv); if(!dv) return ERROR_FUNCTION_FAILED; r = TABLE_CreateView(db, name, &dv->table); if (r != ERROR_SUCCESS) { - msi_free( dv ); + free( dv ); return r; } diff --git a/dll/win32/msi/files.c b/dll/win32/msi/files.c index 1b8e4fd7d906e..96c6c5eaa4b93 100644 --- a/dll/win32/msi/files.c +++ b/dll/win32/msi/files.c @@ -48,6 +48,15 @@ WINE_DEFAULT_DEBUG_CHANNEL(msi); +BOOL msi_get_temp_file_name( MSIPACKAGE *package, const WCHAR *tmp_path, const WCHAR *prefix, WCHAR *tmp_filename ) +{ + BOOL ret; + msi_disable_fs_redirection( package ); + ret = GetTempFileNameW( tmp_path, prefix, 0, tmp_filename ); + msi_revert_fs_redirection( package ); + return ret; +} + HANDLE msi_create_file( MSIPACKAGE *package, const WCHAR *filename, DWORD access, DWORD sharing, DWORD creation, DWORD flags ) { @@ -58,7 +67,7 @@ HANDLE msi_create_file( MSIPACKAGE *package, const WCHAR *filename, DWORD access return handle; } -static BOOL msi_copy_file( MSIPACKAGE *package, const WCHAR *src, const WCHAR *dst, BOOL fail_if_exists ) +static BOOL copy_file( MSIPACKAGE *package, const WCHAR *src, const WCHAR *dst, BOOL fail_if_exists ) { BOOL ret; msi_disable_fs_redirection( package ); @@ -76,7 +85,7 @@ BOOL msi_delete_file( MSIPACKAGE *package, const WCHAR *filename ) return ret; } -static BOOL msi_create_directory( MSIPACKAGE *package, const WCHAR *path ) +static BOOL create_directory( MSIPACKAGE *package, const WCHAR *path ) { BOOL ret; msi_disable_fs_redirection( package ); @@ -139,7 +148,7 @@ BOOL msi_move_file( MSIPACKAGE *package, const WCHAR *from, const WCHAR *to, DWO return ret; } -static BOOL msi_apply_filepatch( MSIPACKAGE *package, const WCHAR *patch, const WCHAR *old, const WCHAR *new ) +static BOOL apply_filepatch( MSIPACKAGE *package, const WCHAR *patch, const WCHAR *old, const WCHAR *new ) { BOOL ret; msi_disable_fs_redirection( package ); @@ -166,24 +175,24 @@ VS_FIXEDFILEINFO *msi_get_disk_file_version( MSIPACKAGE *package, const WCHAR *f void *version; if (!(version_size = msi_get_file_version_info( package, filename, 0, NULL ))) return NULL; - if (!(version = msi_alloc( version_size ))) return NULL; + if (!(version = malloc( version_size ))) return NULL; msi_get_file_version_info( package, filename, version_size, version ); if (!VerQueryValueW( version, L"\\", (void **)&ptr, &size )) { - msi_free( version ); + free( version ); return NULL; } - if (!(ret = msi_alloc( size ))) + if (!(ret = malloc( size ))) { - msi_free( version ); + free( version ); return NULL; } memcpy( ret, ptr, size ); - msi_free( version ); + free( version ); return ret; } @@ -205,13 +214,13 @@ BOOL msi_create_full_path( MSIPACKAGE *package, const WCHAR *path ) WCHAR *new_path; int len; - if (!(new_path = msi_alloc( (lstrlenW( path ) + 1) * sizeof(WCHAR) ))) return FALSE; + if (!(new_path = malloc( (wcslen( path ) + 1) * sizeof(WCHAR) ))) return FALSE; lstrcpyW( new_path, path ); while ((len = lstrlenW( new_path )) && new_path[len - 1] == '\\') new_path[len - 1] = 0; - while (!msi_create_directory( package, new_path )) + while (!create_directory( package, new_path )) { WCHAR *slash; DWORD last_error = GetLastError(); @@ -235,11 +244,11 @@ BOOL msi_create_full_path( MSIPACKAGE *package, const WCHAR *path ) } new_path[len] = '\\'; } - msi_free( new_path ); + free( new_path ); return ret; } -static void msi_file_update_ui( MSIPACKAGE *package, MSIFILE *f, const WCHAR *action ) +static void file_update_ui( MSIPACKAGE *package, MSIFILE *f, const WCHAR *action ) { MSIRECORD *uirow; @@ -296,7 +305,7 @@ static msi_file_state calculate_install_state( MSIPACKAGE *package, MSIFILE *fil DWORD size; comp->Action = msi_get_component_action( package, comp ); - if (!comp->Enabled || comp->Action != INSTALLSTATE_LOCAL || (comp->assembly && comp->assembly->installed)) + if (!comp->Enabled || comp->Action != INSTALLSTATE_LOCAL) { TRACE("skipping %s (not scheduled for install)\n", debugstr_w(file->File)); return msifs_skipped; @@ -306,8 +315,7 @@ static msi_file_state calculate_install_state( MSIPACKAGE *package, MSIFILE *fil TRACE("skipping %s (obsoleted by patch)\n", debugstr_w(file->File)); return msifs_skipped; } - if ((msi_is_global_assembly( comp ) && !comp->assembly->installed) || - msi_get_file_attributes( package, file->TargetPath ) == INVALID_FILE_ATTRIBUTES) + if (msi_get_file_attributes( package, file->TargetPath ) == INVALID_FILE_ATTRIBUTES) { TRACE("installing %s (missing)\n", debugstr_w(file->File)); return msifs_missing; @@ -332,7 +340,7 @@ static msi_file_state calculate_install_state( MSIPACKAGE *package, MSIFILE *fil HIWORD(file_version->dwFileVersionLS), LOWORD(file_version->dwFileVersionLS)); state = msifs_present; } - msi_free( file_version ); + free( file_version ); return state; } else if ((font_version = msi_get_font_file_version( package, file->TargetPath ))) @@ -349,7 +357,7 @@ static msi_file_state calculate_install_state( MSIPACKAGE *package, MSIFILE *fil debugstr_w(file->File), debugstr_w(file->Version), debugstr_w(font_version)); state = msifs_present; } - msi_free( font_version ); + free( font_version ); return state; } } @@ -393,11 +401,11 @@ static void schedule_install_files(MSIPACKAGE *package) } } -static UINT copy_file( MSIPACKAGE *package, MSIFILE *file, WCHAR *source ) +static UINT copy_file_attributes( MSIPACKAGE *package, MSIFILE *file, WCHAR *source ) { BOOL ret; - ret = msi_copy_file( package, source, file->TargetPath, FALSE ); + ret = copy_file( package, source, file->TargetPath, FALSE ); if (!ret) return GetLastError(); @@ -411,7 +419,7 @@ static UINT copy_install_file(MSIPACKAGE *package, MSIFILE *file, LPWSTR source) TRACE("Copying %s to %s\n", debugstr_w(source), debugstr_w(file->TargetPath)); - gle = copy_file( package, file, source ); + gle = copy_file_attributes( package, file, source ); if (gle == ERROR_SUCCESS) return gle; @@ -424,7 +432,7 @@ static UINT copy_install_file(MSIPACKAGE *package, MSIFILE *file, LPWSTR source) { msi_set_file_attributes( package, file->TargetPath, FILE_ATTRIBUTE_NORMAL ); - gle = copy_file( package, file, source ); + gle = copy_file_attributes( package, file, source ); TRACE("Overwriting existing file: %d\n", gle); } if (gle == ERROR_SHARING_VIOLATION || gle == ERROR_USER_MAPPED_FILE) @@ -434,18 +442,18 @@ static UINT copy_install_file(MSIPACKAGE *package, MSIFILE *file, LPWSTR source) TRACE("file in use, scheduling rename operation\n"); - if (!(pathW = strdupW( file->TargetPath ))) return ERROR_OUTOFMEMORY; + if (!(pathW = wcsdup( file->TargetPath ))) return ERROR_OUTOFMEMORY; if ((p = wcsrchr(pathW, '\\'))) *p = 0; len = lstrlenW( pathW ) + 16; - if (!(tmpfileW = msi_alloc(len * sizeof(WCHAR)))) + if (!(tmpfileW = malloc(len * sizeof(WCHAR)))) { - msi_free( pathW ); + free( pathW ); return ERROR_OUTOFMEMORY; } if (!GetTempFileNameW( pathW, L"msi", 0, tmpfileW )) tmpfileW[0] = 0; - msi_free( pathW ); + free( pathW ); - if (msi_copy_file( package, source, tmpfileW, FALSE ) && + if (copy_file( package, source, tmpfileW, FALSE ) && msi_move_file( package, file->TargetPath, NULL, MOVEFILE_DELAY_UNTIL_REBOOT ) && msi_move_file( package, tmpfileW, file->TargetPath, MOVEFILE_DELAY_UNTIL_REBOOT )) { @@ -458,13 +466,13 @@ static UINT copy_install_file(MSIPACKAGE *package, MSIFILE *file, LPWSTR source) WARN("failed to schedule rename operation: %d)\n", gle); DeleteFileW( tmpfileW ); } - msi_free(tmpfileW); + free(tmpfileW); } return gle; } -static UINT create_directory( MSIPACKAGE *package, const WCHAR *dir ) +static UINT create_folder( MSIPACKAGE *package, const WCHAR *dir ) { MSIFOLDER *folder; const WCHAR *install_path; @@ -511,9 +519,9 @@ static BOOL installfiles_cb(MSIPACKAGE *package, LPCWSTR filename, DWORD action, if (!msi_is_global_assembly( file->Component )) { - create_directory( package, file->Component->Directory ); + create_folder( package, file->Component->Directory ); } - *path = strdupW( file->TargetPath ); + *path = wcsdup( file->TargetPath ); *attrs = file->Attributes; *(MSIFILE **)user = file; } @@ -538,10 +546,10 @@ WCHAR *msi_resolve_file_source( MSIPACKAGE *package, MSIFILE *file ) if (file->LongName && msi_get_file_attributes( package, path ) == INVALID_FILE_ATTRIBUTES) { - msi_free( path ); + free( path ); path = msi_build_directory_name( 2, p, file->LongName ); } - msi_free( p ); + free( p ); TRACE("file %s source resolves to %s\n", debugstr_w(file->File), debugstr_w(path)); return path; } @@ -565,13 +573,13 @@ UINT ACTION_InstallFiles(MSIPACKAGE *package) return msi_schedule_action(package, SCRIPT_INSTALL, L"InstallFiles"); schedule_install_files(package); - mi = msi_alloc_zero( sizeof(MSIMEDIAINFO) ); + mi = calloc(1, sizeof(MSIMEDIAINFO)); LIST_FOR_EACH_ENTRY( file, &package->files, MSIFILE, entry ) { BOOL is_global_assembly = msi_is_global_assembly( file->Component ); - msi_file_update_ui( package, file, L"InstallFiles" ); + file_update_ui( package, file, L"InstallFiles" ); rc = msi_load_media_info( package, file->Sequence, mi ); if (rc != ERROR_SUCCESS) @@ -620,18 +628,18 @@ UINT ACTION_InstallFiles(MSIPACKAGE *package) if (!is_global_assembly) { - create_directory(package, file->Component->Directory); + create_folder(package, file->Component->Directory); } rc = copy_install_file(package, file, source); if (rc != ERROR_SUCCESS) { ERR("Failed to copy %s to %s (%u)\n", debugstr_w(source), debugstr_w(file->TargetPath), rc); rc = ERROR_INSTALL_FAILURE; - msi_free(source); + free(source); goto done; } if (!is_global_assembly) file->state = msifs_installed; - msi_free(source); + free(source); } else if (!is_global_assembly && file->state != msifs_installed && !(file->Attributes & msidbFileAttributesPatchAdded)) @@ -641,22 +649,6 @@ UINT ACTION_InstallFiles(MSIPACKAGE *package) goto done; } } - LIST_FOR_EACH_ENTRY( file, &package->files, MSIFILE, entry ) - { - MSICOMPONENT *comp = file->Component; - - if (!msi_is_global_assembly( comp ) || comp->assembly->installed || - (file->state != msifs_missing && file->state != msifs_overwrite)) continue; - - rc = msi_install_assembly( package, comp ); - if (rc != ERROR_SUCCESS) - { - ERR("Failed to install assembly\n"); - rc = ERROR_INSTALL_FAILURE; - break; - } - file->state = msifs_installed; - } done: msi_free_media_info(mi); @@ -697,7 +689,7 @@ static BOOL patchfiles_cb(MSIPACKAGE *package, LPCWSTR file, DWORD action, } patch->path = msi_create_temp_file( package->db ); - *path = strdupW( patch->path ); + *path = wcsdup( patch->path ); *attrs = patch->File->Attributes; *(MSIFILEPATCH **)user = patch; } @@ -715,7 +707,7 @@ static UINT patch_file( MSIPACKAGE *package, MSIFILEPATCH *patch ) WCHAR *tmpfile = msi_create_temp_file( package->db ); if (!tmpfile) return ERROR_INSTALL_FAILURE; - if (msi_apply_filepatch( package, patch->path, patch->File->TargetPath, tmpfile )) + if (apply_filepatch( package, patch->path, patch->File->TargetPath, tmpfile )) { msi_delete_file( package, patch->File->TargetPath ); msi_move_file( package, tmpfile, patch->File->TargetPath, 0 ); @@ -727,11 +719,11 @@ static UINT patch_file( MSIPACKAGE *package, MSIFILEPATCH *patch ) } DeleteFileW( patch->path ); DeleteFileW( tmpfile ); - msi_free( tmpfile ); + free( tmpfile ); return r; } -static UINT patch_assembly( MSIPACKAGE *package, MSIASSEMBLY *assembly, MSIFILEPATCH *patch ) +UINT msi_patch_assembly( MSIPACKAGE *package, MSIASSEMBLY *assembly, MSIFILEPATCH *patch ) { UINT r = ERROR_FUNCTION_FAILED; IAssemblyName *name; @@ -747,32 +739,32 @@ static UINT patch_assembly( MSIPACKAGE *package, MSIASSEMBLY *assembly, MSIFILEP HRESULT hr; hr = IAssemblyName_GetDisplayName( name, NULL, &len, 0 ); - if (hr != E_NOT_SUFFICIENT_BUFFER || !(displayname = msi_alloc( len * sizeof(WCHAR) ))) + if (hr != E_NOT_SUFFICIENT_BUFFER || !(displayname = malloc( len * sizeof(WCHAR) ))) break; hr = IAssemblyName_GetDisplayName( name, displayname, &len, 0 ); if (FAILED( hr )) { - msi_free( displayname ); + free( displayname ); break; } if ((path = msi_get_assembly_path( package, displayname ))) { - if (!msi_copy_file( package, path, patch->File->TargetPath, FALSE )) + if (!copy_file( package, path, patch->File->TargetPath, FALSE )) { ERR( "failed to copy file %s -> %s (%lu)\n", debugstr_w(path), debugstr_w(patch->File->TargetPath), GetLastError() ); - msi_free( path ); - msi_free( displayname ); + free( path ); + free( displayname ); IAssemblyName_Release( name ); break; } r = patch_file( package, patch ); - msi_free( path ); + free( path ); } - msi_free( displayname ); + free( displayname ); IAssemblyName_Release( name ); if (r == ERROR_SUCCESS) break; } @@ -792,7 +784,7 @@ UINT ACTION_PatchFiles( MSIPACKAGE *package ) if (package->script == SCRIPT_NONE) return msi_schedule_action(package, SCRIPT_INSTALL, L"PatchFiles"); - mi = msi_alloc_zero( sizeof(MSIMEDIAINFO) ); + mi = calloc( 1, sizeof(MSIMEDIAINFO) ); TRACE("extracting files\n"); @@ -842,27 +834,14 @@ UINT ACTION_PatchFiles( MSIPACKAGE *package ) { MSICOMPONENT *comp = patch->File->Component; - if (!patch->path) continue; - - if (msi_is_global_assembly( comp )) - rc = patch_assembly( package, comp->assembly, patch ); - else - rc = patch_file( package, patch ); + if (msi_is_global_assembly( comp ) || !patch->path) continue; + rc = patch_file( package, patch ); if (rc && !(patch->Attributes & msidbPatchAttributesNonVital)) { ERR("Failed to apply patch to file: %s\n", debugstr_w(patch->File->File)); break; } - - if (msi_is_global_assembly( comp )) - { - if ((rc = msi_install_assembly( package, comp ))) - { - ERR("Failed to install patched assembly\n"); - break; - } - } } done: @@ -872,14 +851,14 @@ UINT ACTION_PatchFiles( MSIPACKAGE *package ) #define is_dot_dir(x) ((x[0] == '.') && ((x[1] == 0) || ((x[1] == '.') && (x[2] == 0)))) -typedef struct +struct file_list { struct list entry; LPWSTR sourcename; LPWSTR destname; LPWSTR source; LPWSTR dest; -} FILE_LIST; +}; static BOOL move_file( MSIPACKAGE *package, const WCHAR *source, const WCHAR *dest, int options ) { @@ -905,10 +884,10 @@ static BOOL move_file( MSIPACKAGE *package, const WCHAR *source, const WCHAR *de else { TRACE("copying %s -> %s\n", debugstr_w(source), debugstr_w(dest)); - ret = msi_copy_file( package, source, dest, FALSE ); + ret = copy_file( package, source, dest, FALSE ); if (!ret) { - WARN( "msi_copy_file failed: %lu\n", GetLastError() ); + WARN( "copy_file failed: %lu\n", GetLastError() ); return FALSE; } } @@ -926,7 +905,7 @@ static WCHAR *wildcard_to_file( const WCHAR *wildcard, const WCHAR *filename ) dirlen = ptr - wildcard + 1; pathlen = dirlen + lstrlenW(filename) + 1; - if (!(path = msi_alloc(pathlen * sizeof(WCHAR)))) return NULL; + if (!(path = malloc(pathlen * sizeof(WCHAR)))) return NULL; lstrcpynW(path, wildcard, dirlen + 1); lstrcatW(path, filename); @@ -934,35 +913,35 @@ static WCHAR *wildcard_to_file( const WCHAR *wildcard, const WCHAR *filename ) return path; } -static void free_file_entry(FILE_LIST *file) +static void free_file_entry(struct file_list *file) { - msi_free(file->source); - msi_free(file->dest); - msi_free(file); + free(file->source); + free(file->dest); + free(file); } -static void free_list(FILE_LIST *list) +static void free_list(struct file_list *list) { while (!list_empty(&list->entry)) { - FILE_LIST *file = LIST_ENTRY(list_head(&list->entry), FILE_LIST, entry); + struct file_list *file = LIST_ENTRY(list_head(&list->entry), struct file_list, entry); list_remove(&file->entry); free_file_entry(file); } } -static BOOL add_wildcard( FILE_LIST *files, const WCHAR *source, WCHAR *dest ) +static BOOL add_wildcard( struct file_list *files, const WCHAR *source, WCHAR *dest ) { - FILE_LIST *new, *file; + struct file_list *new, *file; WCHAR *ptr, *filename; DWORD size; - new = msi_alloc_zero(sizeof(FILE_LIST)); + new = calloc(1, sizeof(*new)); if (!new) return FALSE; - new->source = strdupW(source); + new->source = wcsdup(source); ptr = wcsrchr(dest, '\\') + 1; filename = wcsrchr(new->source, '\\') + 1; @@ -974,7 +953,7 @@ static BOOL add_wildcard( FILE_LIST *files, const WCHAR *source, WCHAR *dest ) new->destname = new->sourcename; size = (ptr - dest) + lstrlenW(filename) + 1; - new->dest = msi_alloc(size * sizeof(WCHAR)); + new->dest = malloc(size * sizeof(WCHAR)); if (!new->dest) { free_file_entry(new); @@ -990,7 +969,7 @@ static BOOL add_wildcard( FILE_LIST *files, const WCHAR *source, WCHAR *dest ) return TRUE; } - LIST_FOR_EACH_ENTRY(file, &files->entry, FILE_LIST, entry) + LIST_FOR_EACH_ENTRY(file, &files->entry, struct file_list, entry) { if (wcscmp( source, file->source ) < 0) { @@ -1009,7 +988,7 @@ static BOOL move_files_wildcard( MSIPACKAGE *package, const WCHAR *source, WCHAR HANDLE hfile; LPWSTR path; BOOL res; - FILE_LIST files, *file; + struct file_list files, *file; DWORD size; hfile = msi_find_first_file( package, source, &wfd ); @@ -1029,7 +1008,7 @@ static BOOL move_files_wildcard( MSIPACKAGE *package, const WCHAR *source, WCHAR } add_wildcard(&files, path, dest); - msi_free(path); + free(path); } /* no files match the wildcard */ @@ -1037,9 +1016,9 @@ static BOOL move_files_wildcard( MSIPACKAGE *package, const WCHAR *source, WCHAR goto done; /* only the first wildcard match gets renamed to dest */ - file = LIST_ENTRY(list_head(&files.entry), FILE_LIST, entry); + file = LIST_ENTRY(list_head(&files.entry), struct file_list, entry); size = (wcsrchr(file->dest, '\\') - file->dest) + lstrlenW(file->destname) + 2; - file->dest = msi_realloc(file->dest, size * sizeof(WCHAR)); + file->dest = realloc(file->dest, size * sizeof(WCHAR)); if (!file->dest) { res = FALSE; @@ -1055,7 +1034,7 @@ static BOOL move_files_wildcard( MSIPACKAGE *package, const WCHAR *source, WCHAR while (!list_empty(&files.entry)) { - file = LIST_ENTRY(list_head(&files.entry), FILE_LIST, entry); + file = LIST_ENTRY(list_head(&files.entry), struct file_list, entry); move_file( package, file->source, file->dest, options ); @@ -1116,14 +1095,14 @@ static UINT ITERATE_MoveFiles( MSIRECORD *rec, LPVOID param ) if (msi_get_file_attributes( package, sourcedir ) == INVALID_FILE_ATTRIBUTES) goto done; - source = strdupW(sourcedir); + source = wcsdup(sourcedir); if (!source) goto done; } else { size = lstrlenW(sourcedir) + lstrlenW(sourcename) + 2; - source = msi_alloc(size * sizeof(WCHAR)); + source = malloc(size * sizeof(WCHAR)); if (!source) goto done; @@ -1141,18 +1120,18 @@ static UINT ITERATE_MoveFiles( MSIRECORD *rec, LPVOID param ) { WCHAR *p; if (sourcename) - destname = strdupW(sourcename); + destname = wcsdup(sourcename); else if ((p = wcsrchr(sourcedir, '\\'))) - destname = strdupW(p + 1); + destname = wcsdup(p + 1); else - destname = strdupW(sourcedir); + destname = wcsdup(sourcedir); if (!destname) goto done; } } else { - destname = strdupW(MSI_RecordGetString(rec, 4)); + destname = wcsdup(MSI_RecordGetString(rec, 4)); if (destname) msi_reduce_to_long_filename(destname); } @@ -1161,7 +1140,7 @@ static UINT ITERATE_MoveFiles( MSIRECORD *rec, LPVOID param ) size = lstrlenW(destname); size += lstrlenW(destdir) + 2; - dest = msi_alloc(size * sizeof(WCHAR)); + dest = malloc(size * sizeof(WCHAR)); if (!dest) goto done; @@ -1194,11 +1173,11 @@ static UINT ITERATE_MoveFiles( MSIRECORD *rec, LPVOID param ) MSI_ProcessMessage(package, INSTALLMESSAGE_ACTIONDATA, uirow); msiobj_release( &uirow->hdr ); - msi_free(sourcedir); - msi_free(destdir); - msi_free(destname); - msi_free(source); - msi_free(dest); + free(sourcedir); + free(destdir); + free(destname); + free(source); + free(dest); return ERROR_SUCCESS; } @@ -1228,13 +1207,13 @@ static WCHAR *get_duplicate_filename( MSIPACKAGE *package, MSIRECORD *row, const if (MSI_RecordIsNull( row, 4 )) { len = lstrlenW( src ) + 1; - if (!(dst_name = msi_alloc( len * sizeof(WCHAR)))) return NULL; + if (!(dst_name = malloc( len * sizeof(WCHAR)))) return NULL; lstrcpyW( dst_name, wcsrchr( src, '\\' ) + 1 ); } else { MSI_RecordGetStringW( row, 4, NULL, &len ); - if (!(dst_name = msi_alloc( ++len * sizeof(WCHAR) ))) return NULL; + if (!(dst_name = malloc( ++len * sizeof(WCHAR) ))) return NULL; MSI_RecordGetStringW( row, 4, dst_name, &len ); msi_reduce_to_long_filename( dst_name ); } @@ -1242,7 +1221,7 @@ static WCHAR *get_duplicate_filename( MSIPACKAGE *package, MSIRECORD *row, const if (MSI_RecordIsNull( row, 5 )) { WCHAR *p; - dst_path = strdupW( src ); + dst_path = wcsdup( src ); p = wcsrchr( dst_path, '\\' ); if (p) *p = 0; } @@ -1250,7 +1229,7 @@ static WCHAR *get_duplicate_filename( MSIPACKAGE *package, MSIRECORD *row, const { const WCHAR *dst_key = MSI_RecordGetString( row, 5 ); - dst_path = strdupW( msi_get_target_folder( package, dst_key ) ); + dst_path = wcsdup( msi_get_target_folder( package, dst_key ) ); if (!dst_path) { /* try a property */ @@ -1258,7 +1237,7 @@ static WCHAR *get_duplicate_filename( MSIPACKAGE *package, MSIRECORD *row, const if (!dst_path) { FIXME("Unable to get destination folder, try AppSearch properties\n"); - msi_free( dst_name ); + free( dst_name ); return NULL; } } @@ -1267,8 +1246,8 @@ static WCHAR *get_duplicate_filename( MSIPACKAGE *package, MSIRECORD *row, const dst = msi_build_directory_name( 2, dst_path, dst_name ); msi_create_full_path( package, dst_path ); - msi_free( dst_name ); - msi_free( dst_path ); + free( dst_name ); + free( dst_path ); return dst; } @@ -1315,7 +1294,7 @@ static UINT ITERATE_DuplicateFiles(MSIRECORD *row, LPVOID param) } TRACE("Duplicating file %s to %s\n", debugstr_w(file->TargetPath), debugstr_w(dest)); - if (!msi_copy_file( package, file->TargetPath, dest, TRUE )) + if (!copy_file( package, file->TargetPath, dest, TRUE )) { WARN( "failed to copy file %s -> %s (%lu)\n", debugstr_w(file->TargetPath), debugstr_w(dest), GetLastError() ); @@ -1329,7 +1308,7 @@ static UINT ITERATE_DuplicateFiles(MSIRECORD *row, LPVOID param) MSI_ProcessMessage(package, INSTALLMESSAGE_ACTIONDATA, uirow); msiobj_release( &uirow->hdr ); - msi_free(dest); + free(dest); return ERROR_SUCCESS; } @@ -1404,7 +1383,7 @@ static UINT ITERATE_RemoveDuplicateFiles( MSIRECORD *row, LPVOID param ) MSI_ProcessMessage(package, INSTALLMESSAGE_ACTIONDATA, uirow); msiobj_release( &uirow->hdr ); - msi_free(dest); + free(dest); return ERROR_SUCCESS; } @@ -1491,13 +1470,13 @@ static UINT ITERATE_RemoveFiles(MSIRECORD *row, LPVOID param) return ERROR_SUCCESS; } size = 0; - if ((filename = strdupW( MSI_RecordGetString(row, 3) ))) + if ((filename = wcsdup( MSI_RecordGetString(row, 3) ))) { msi_reduce_to_long_filename( filename ); size = lstrlenW( filename ); } size += lstrlenW(dir) + 2; - path = msi_alloc(size * sizeof(WCHAR)); + path = malloc(size * sizeof(WCHAR)); if (!path) { ret = ERROR_OUTOFMEMORY; @@ -1526,9 +1505,9 @@ static UINT ITERATE_RemoveFiles(MSIRECORD *row, LPVOID param) MSI_ProcessMessage(package, INSTALLMESSAGE_ACTIONDATA, uirow); msiobj_release( &uirow->hdr ); - msi_free(filename); - msi_free(path); - msi_free(dir); + free(filename); + free(path); + free(dir); return ret; } @@ -1571,7 +1550,7 @@ UINT ACTION_RemoveFiles( MSIPACKAGE *package ) VS_FIXEDFILEINFO *ver; comp = file->Component; - msi_file_update_ui( package, file, L"RemoveFiles" ); + file_update_ui( package, file, L"RemoveFiles" ); comp->Action = msi_get_component_action( package, comp ); if (comp->Action != INSTALLSTATE_ABSENT || comp->Installed == INSTALLSTATE_SOURCE) @@ -1592,10 +1571,10 @@ UINT ACTION_RemoveFiles( MSIPACKAGE *package ) if (ver && msi_compare_file_versions( ver, file->Version ) > 0) { TRACE("newer version detected, not removing file\n"); - msi_free( ver ); + free( ver ); continue; } - msi_free( ver ); + free( ver ); } if (file->state == msifs_installed) diff --git a/dll/win32/msi/font.c b/dll/win32/msi/font.c index 78d384b1654c0..6a4057f69018c 100644 --- a/dll/win32/msi/font.c +++ b/dll/win32/msi/font.c @@ -28,40 +28,43 @@ WINE_DEFAULT_DEBUG_CHANNEL(msi); -typedef struct _tagTT_OFFSET_TABLE { +struct offset_table +{ USHORT uMajorVersion; USHORT uMinorVersion; USHORT uNumOfTables; USHORT uSearchRange; USHORT uEntrySelector; USHORT uRangeShift; -} TT_OFFSET_TABLE; +}; -typedef struct _tagTT_TABLE_DIRECTORY { +struct table_directory +{ char szTag[4]; /* table name */ ULONG uCheckSum; /* Check sum */ ULONG uOffset; /* Offset from beginning of file */ ULONG uLength; /* length of the table in bytes */ -} TT_TABLE_DIRECTORY; +}; -typedef struct _tagTT_NAME_TABLE_HEADER { +struct name_table_header +{ USHORT uFSelector; /* format selector. Always 0 */ USHORT uNRCount; /* Name Records count */ - USHORT uStorageOffset; /* Offset for strings storage, - * from start of the table */ -} TT_NAME_TABLE_HEADER; + USHORT uStorageOffset; /* Offset for strings storage from start of the table */ +}; #define NAME_ID_FULL_FONT_NAME 4 #define NAME_ID_VERSION 5 -typedef struct _tagTT_NAME_RECORD { +struct name_record +{ USHORT uPlatformID; USHORT uEncodingID; USHORT uLanguageID; USHORT uNameID; USHORT uStringLength; USHORT uStringOffset; /* from start of storage area */ -} TT_NAME_RECORD; +}; #define SWAPWORD(x) MAKEWORD(HIBYTE(x), LOBYTE(x)) #define SWAPLONG(x) MAKELONG(SWAPWORD(HIWORD(x)), SWAPWORD(LOWORD(x))) @@ -72,11 +75,11 @@ typedef struct _tagTT_NAME_RECORD { */ static WCHAR *load_ttf_name_id( MSIPACKAGE *package, const WCHAR *filename, DWORD id ) { - TT_TABLE_DIRECTORY tblDir; + struct table_directory tblDir; BOOL bFound = FALSE; - TT_OFFSET_TABLE ttOffsetTable; - TT_NAME_TABLE_HEADER ttNTHeader; - TT_NAME_RECORD ttRecord; + struct offset_table ttOffsetTable; + struct name_table_header ttNTHeader; + struct name_record ttRecord; DWORD dwRead; HANDLE handle; LPWSTR ret = NULL; @@ -92,7 +95,7 @@ static WCHAR *load_ttf_name_id( MSIPACKAGE *package, const WCHAR *filename, DWOR return NULL; } - if (!ReadFile(handle,&ttOffsetTable, sizeof(TT_OFFSET_TABLE),&dwRead,NULL)) + if (!ReadFile(handle,&ttOffsetTable, sizeof(struct offset_table),&dwRead,NULL)) goto end; ttOffsetTable.uNumOfTables = SWAPWORD(ttOffsetTable.uNumOfTables); @@ -105,7 +108,7 @@ static WCHAR *load_ttf_name_id( MSIPACKAGE *package, const WCHAR *filename, DWOR for (i=0; i< ttOffsetTable.uNumOfTables; i++) { - if (!ReadFile(handle,&tblDir, sizeof(TT_TABLE_DIRECTORY),&dwRead,NULL)) + if (!ReadFile(handle, &tblDir, sizeof(tblDir), &dwRead, NULL)) break; if (memcmp(tblDir.szTag,"name",4)==0) { @@ -120,14 +123,14 @@ static WCHAR *load_ttf_name_id( MSIPACKAGE *package, const WCHAR *filename, DWOR goto end; SetFilePointer(handle, tblDir.uOffset, NULL, FILE_BEGIN); - if (!ReadFile(handle,&ttNTHeader, sizeof(TT_NAME_TABLE_HEADER), &dwRead,NULL)) + if (!ReadFile(handle, &ttNTHeader, sizeof(ttNTHeader), &dwRead, NULL)) goto end; ttNTHeader.uNRCount = SWAPWORD(ttNTHeader.uNRCount); ttNTHeader.uStorageOffset = SWAPWORD(ttNTHeader.uStorageOffset); for(i=0; iTargetPath); } - msi_free(name); + free(name); RegCloseKey(hkey1); RegCloseKey(hkey2); /* the UI chunk */ uirow = MSI_CreateRecord( 1 ); - uipath = strdupW( file->TargetPath ); + uipath = wcsdup( file->TargetPath ); p = wcsrchr(uipath,'\\'); if (p) p++; else p = uipath; MSI_RecordSetStringW( uirow, 1, p ); MSI_ProcessMessage(package, INSTALLMESSAGE_ACTIONDATA, uirow); msiobj_release( &uirow->hdr ); - msi_free( uipath ); + free( uipath ); /* FIXME: call msi_ui_progress? */ return ERROR_SUCCESS; @@ -335,20 +338,20 @@ static UINT ITERATE_UnregisterFonts( MSIRECORD *row, LPVOID param ) RegDeleteValueW( hkey2, name ); } - msi_free( name ); + free( name ); RegCloseKey( hkey1 ); RegCloseKey( hkey2 ); /* the UI chunk */ uirow = MSI_CreateRecord( 1 ); - uipath = strdupW( file->TargetPath ); + uipath = wcsdup( file->TargetPath ); p = wcsrchr( uipath,'\\' ); if (p) p++; else p = uipath; MSI_RecordSetStringW( uirow, 1, p ); MSI_ProcessMessage(package, INSTALLMESSAGE_ACTIONDATA, uirow); msiobj_release( &uirow->hdr ); - msi_free( uipath ); + free( uipath ); /* FIXME: call msi_ui_progress? */ return ERROR_SUCCESS; diff --git a/dll/win32/msi/format.c b/dll/win32/msi/format.c index 38bd187626bfd..e229d1e6dba48 100644 --- a/dll/win32/msi/format.c +++ b/dll/win32/msi/format.c @@ -54,7 +54,7 @@ WINE_DEFAULT_DEBUG_CHANNEL(msi); #define left_type(x) (x & 0xF0) -typedef struct _tagFORMAT +struct format { MSIPACKAGE *package; MSIRECORD *record; @@ -64,9 +64,9 @@ typedef struct _tagFORMAT BOOL propfailed; BOOL groupfailed; int groups; -} FORMAT; +}; -typedef struct _tagFORMSTR +struct form_str { struct list entry; int n; @@ -74,54 +74,54 @@ typedef struct _tagFORMSTR int type; BOOL propfound; BOOL nonprop; -} FORMSTR; +}; -typedef struct _tagSTACK +struct stack { struct list items; -} STACK; +}; -static STACK *create_stack(void) +static struct stack *create_stack(void) { - STACK *stack = msi_alloc(sizeof(STACK)); + struct stack *stack = malloc(sizeof(*stack)); list_init(&stack->items); return stack; } -static void free_stack(STACK *stack) +static void free_stack(struct stack *stack) { while (!list_empty(&stack->items)) { - FORMSTR *str = LIST_ENTRY(list_head(&stack->items), FORMSTR, entry); + struct form_str *str = LIST_ENTRY(list_head(&stack->items), struct form_str, entry); list_remove(&str->entry); - msi_free(str); + free(str); } - msi_free(stack); + free(stack); } -static void stack_push(STACK *stack, FORMSTR *str) +static void stack_push(struct stack *stack, struct form_str *str) { list_add_head(&stack->items, &str->entry); } -static FORMSTR *stack_pop(STACK *stack) +static struct form_str *stack_pop(struct stack *stack) { - FORMSTR *ret; + struct form_str *ret; if (list_empty(&stack->items)) return NULL; - ret = LIST_ENTRY(list_head(&stack->items), FORMSTR, entry); + ret = LIST_ENTRY(list_head(&stack->items), struct form_str, entry); list_remove(&ret->entry); return ret; } -static FORMSTR *stack_find(STACK *stack, int type) +static struct form_str *stack_find(struct stack *stack, int type) { - FORMSTR *str; + struct form_str *str; - LIST_FOR_EACH_ENTRY(str, &stack->items, FORMSTR, entry) + LIST_FOR_EACH_ENTRY(str, &stack->items, struct form_str, entry) { if (str->type == type) return str; @@ -130,22 +130,22 @@ static FORMSTR *stack_find(STACK *stack, int type) return NULL; } -static FORMSTR *stack_peek(STACK *stack) +static struct form_str *stack_peek(struct stack *stack) { - return LIST_ENTRY(list_head(&stack->items), FORMSTR, entry); + return LIST_ENTRY(list_head(&stack->items), struct form_str, entry); } -static LPCWSTR get_formstr_data(FORMAT *format, FORMSTR *str) +static const WCHAR *get_formstr_data(struct format *format, struct form_str *str) { return &format->deformatted[str->n]; } -static WCHAR *dup_formstr( FORMAT *format, FORMSTR *str, int *ret_len ) +static WCHAR *dup_formstr( struct format *format, struct form_str *str, int *ret_len ) { WCHAR *val; if (!str->len) return NULL; - if ((val = msi_alloc( (str->len + 1) * sizeof(WCHAR) ))) + if ((val = malloc( (str->len + 1) * sizeof(WCHAR) ))) { memcpy( val, get_formstr_data(format, str), str->len * sizeof(WCHAR) ); val[str->len] = 0; @@ -154,128 +154,128 @@ static WCHAR *dup_formstr( FORMAT *format, FORMSTR *str, int *ret_len ) return val; } -static WCHAR *deformat_index( FORMAT *format, FORMSTR *str, int *ret_len ) +static WCHAR *deformat_index( struct format *format, struct form_str *str, int *ret_len ) { WCHAR *val, *ret; DWORD len; int field; - if (!(val = msi_alloc( (str->len + 1) * sizeof(WCHAR) ))) return NULL; + if (!(val = malloc( (str->len + 1) * sizeof(WCHAR) ))) return NULL; lstrcpynW(val, get_formstr_data(format, str), str->len + 1); field = wcstol( val, NULL, 10 ); - msi_free( val ); + free( val ); if (MSI_RecordIsNull( format->record, field ) || MSI_RecordGetStringW( format->record, field, NULL, &len )) return NULL; len++; - if (!(ret = msi_alloc( len * sizeof(WCHAR) ))) return NULL; + if (!(ret = malloc( len * sizeof(WCHAR) ))) return NULL; ret[0] = 0; if (MSI_RecordGetStringW( format->record, field, ret, &len )) { - msi_free( ret ); + free( ret ); return NULL; } *ret_len = len; return ret; } -static WCHAR *deformat_property( FORMAT *format, FORMSTR *str, int *ret_len ) +static WCHAR *deformat_property( struct format *format, struct form_str *str, int *ret_len ) { WCHAR *prop, *ret; DWORD len = 0; UINT r; - if (!(prop = msi_alloc( (str->len + 1) * sizeof(WCHAR) ))) return NULL; + if (!(prop = malloc( (str->len + 1) * sizeof(WCHAR) ))) return NULL; lstrcpynW( prop, get_formstr_data(format, str), str->len + 1 ); r = msi_get_property( format->package->db, prop, NULL, &len ); if (r != ERROR_SUCCESS && r != ERROR_MORE_DATA) { - msi_free( prop ); + free( prop ); return NULL; } len++; - if ((ret = msi_alloc( len * sizeof(WCHAR) ))) + if ((ret = malloc( len * sizeof(WCHAR) ))) msi_get_property( format->package->db, prop, ret, &len ); - msi_free( prop ); + free( prop ); *ret_len = len; return ret; } -static WCHAR *deformat_component( FORMAT *format, FORMSTR *str, int *ret_len ) +static WCHAR *deformat_component( struct format *format, struct form_str *str, int *ret_len ) { WCHAR *key, *ret; MSICOMPONENT *comp; - if (!(key = msi_alloc( (str->len + 1) * sizeof(WCHAR) ))) return NULL; + if (!(key = malloc( (str->len + 1) * sizeof(WCHAR) ))) return NULL; lstrcpynW(key, get_formstr_data(format, str), str->len + 1); if (!(comp = msi_get_loaded_component( format->package, key ))) { - msi_free( key ); + free( key ); return NULL; } if (comp->Action == INSTALLSTATE_SOURCE) ret = msi_resolve_source_folder( format->package, comp->Directory, NULL ); else - ret = strdupW( msi_get_target_folder( format->package, comp->Directory ) ); + ret = wcsdup( msi_get_target_folder( format->package, comp->Directory ) ); if (ret) *ret_len = lstrlenW( ret ); else *ret_len = 0; - msi_free( key ); + free( key ); return ret; } -static WCHAR *deformat_file( FORMAT *format, FORMSTR *str, BOOL shortname, int *ret_len ) +static WCHAR *deformat_file( struct format *format, struct form_str *str, BOOL shortname, int *ret_len ) { WCHAR *key, *ret = NULL; const MSIFILE *file; DWORD len = 0; - if (!(key = msi_alloc( (str->len + 1) * sizeof(WCHAR) ))) return NULL; + if (!(key = malloc( (str->len + 1) * sizeof(WCHAR) ))) return NULL; lstrcpynW(key, get_formstr_data(format, str), str->len + 1); if (!(file = msi_get_loaded_file( format->package, key ))) goto done; if (!shortname) { - if ((ret = strdupW( file->TargetPath ))) len = lstrlenW( ret ); + if ((ret = wcsdup( file->TargetPath ))) len = lstrlenW( ret ); goto done; } if (!(len = GetShortPathNameW(file->TargetPath, NULL, 0))) { - if ((ret = strdupW( file->TargetPath ))) len = lstrlenW( ret ); + if ((ret = wcsdup( file->TargetPath ))) len = lstrlenW( ret ); goto done; } len++; - if ((ret = msi_alloc( len * sizeof(WCHAR) ))) + if ((ret = malloc( len * sizeof(WCHAR) ))) len = GetShortPathNameW( file->TargetPath, ret, len ); done: - msi_free( key ); + free( key ); *ret_len = len; return ret; } -static WCHAR *deformat_environment( FORMAT *format, FORMSTR *str, int *ret_len ) +static WCHAR *deformat_environment( struct format *format, struct form_str *str, int *ret_len ) { WCHAR *key, *ret = NULL; DWORD len; - if (!(key = msi_alloc((str->len + 1) * sizeof(WCHAR)))) return NULL; + if (!(key = malloc((str->len + 1) * sizeof(WCHAR)))) return NULL; lstrcpynW(key, get_formstr_data(format, str), str->len + 1); if ((len = GetEnvironmentVariableW( key, NULL, 0 ))) { len++; - if ((ret = msi_alloc( len * sizeof(WCHAR) ))) + if ((ret = malloc( len * sizeof(WCHAR) ))) *ret_len = GetEnvironmentVariableW( key, ret, len ); } - msi_free( key ); + free( key ); return ret; } -static WCHAR *deformat_literal( FORMAT *format, FORMSTR *str, BOOL *propfound, +static WCHAR *deformat_literal( struct format *format, struct form_str *str, BOOL *propfound, int *type, int *len ) { LPCWSTR data = get_formstr_data(format, str); @@ -300,7 +300,7 @@ static WCHAR *deformat_literal( FORMAT *format, FORMSTR *str, BOOL *propfound, { if (str->len != 1) replaced = NULL; - else if ((replaced = msi_alloc( sizeof(WCHAR) ))) + else if ((replaced = malloc( sizeof(WCHAR) ))) { *replaced = 0; *len = 0; @@ -345,15 +345,15 @@ static WCHAR *build_default_format( const MSIRECORD *record ) WCHAR *ret, *tmp, buf[26]; DWORD size = 1; - if (!(ret = msi_alloc( sizeof(*ret) ))) return NULL; + if (!(ret = malloc( sizeof(*ret) ))) return NULL; ret[0] = 0; for (i = 1; i <= count; i++) { size += swprintf( buf, ARRAY_SIZE(buf), L"%d: [%d] ", i, i ); - if (!(tmp = msi_realloc( ret, size * sizeof(*ret) ))) + if (!(tmp = realloc( ret, size * sizeof(*ret) ))) { - msi_free( ret ); + free( ret ); return NULL; } ret = tmp; @@ -389,10 +389,10 @@ static BOOL format_is_literal(WCHAR x) return (format_is_alpha(x) || format_is_number(x)); } -static int format_lex(FORMAT *format, FORMSTR **out) +static int format_lex(struct format *format, struct form_str **out) { int type, len = 1; - FORMSTR *str; + struct form_str *str; LPCWSTR data; WCHAR ch; @@ -401,7 +401,7 @@ static int format_lex(FORMAT *format, FORMSTR **out) if (!format->deformatted) return FORMAT_NULL; - *out = msi_alloc_zero(sizeof(FORMSTR)); + *out = calloc(1, sizeof(**out)); if (!*out) return FORMAT_FAIL; @@ -473,10 +473,10 @@ static int format_lex(FORMAT *format, FORMSTR **out) return type; } -static FORMSTR *format_replace( FORMAT *format, BOOL propfound, BOOL nonprop, - int oldsize, int type, WCHAR *replace, int len ) +static struct form_str *format_replace( struct format *format, BOOL propfound, BOOL nonprop, + int oldsize, int type, WCHAR *replace, int len ) { - FORMSTR *ret; + struct form_str *ret; LPWSTR str, ptr; DWORD size = 0; int n; @@ -494,13 +494,13 @@ static FORMSTR *format_replace( FORMAT *format, BOOL propfound, BOOL nonprop, if (size <= 1) { - msi_free(format->deformatted); + free(format->deformatted); format->deformatted = NULL; format->len = 0; return NULL; } - str = msi_alloc(size * sizeof(WCHAR)); + str = malloc(size * sizeof(WCHAR)); if (!str) return NULL; @@ -522,7 +522,7 @@ static FORMSTR *format_replace( FORMAT *format, BOOL propfound, BOOL nonprop, ptr = &format->deformatted[format->n + oldsize]; memcpy(&str[n], ptr, (lstrlenW(ptr) + 1) * sizeof(WCHAR)); - msi_free(format->deformatted); + free(format->deformatted); format->deformatted = str; format->len = size - 1; @@ -533,7 +533,7 @@ static FORMSTR *format_replace( FORMAT *format, BOOL propfound, BOOL nonprop, if (!replace) return NULL; - ret = msi_alloc_zero(sizeof(FORMSTR)); + ret = calloc(1, sizeof(*ret)); if (!ret) return NULL; @@ -546,12 +546,12 @@ static FORMSTR *format_replace( FORMAT *format, BOOL propfound, BOOL nonprop, return ret; } -static WCHAR *replace_stack_group( FORMAT *format, STACK *values, +static WCHAR *replace_stack_group( struct format *format, struct stack *values, BOOL *propfound, BOOL *nonprop, int *oldsize, int *type, int *len ) { WCHAR *replaced; - FORMSTR *content, *node; + struct form_str *content, *node; int n; *nonprop = FALSE; @@ -560,7 +560,7 @@ static WCHAR *replace_stack_group( FORMAT *format, STACK *values, node = stack_pop(values); n = node->n; *oldsize = node->len; - msi_free(node); + free(node); while ((node = stack_pop(values))) { @@ -572,10 +572,10 @@ static WCHAR *replace_stack_group( FORMAT *format, STACK *values, if (node->propfound) *propfound = TRUE; - msi_free(node); + free(node); } - content = msi_alloc_zero(sizeof(FORMSTR)); + content = calloc(1, sizeof(*content)); content->n = n; content->len = *oldsize; content->type = FORMAT_LITERAL; @@ -583,7 +583,7 @@ static WCHAR *replace_stack_group( FORMAT *format, STACK *values, if (!format->groupfailed && (*oldsize == 2 || (format->propfailed && !*nonprop))) { - msi_free(content); + free(content); return NULL; } else if (format->deformatted[content->n + 1] == '{' && @@ -608,7 +608,7 @@ static WCHAR *replace_stack_group( FORMAT *format, STACK *values, replaced = dup_formstr( format, content, len ); *type = content->type; - msi_free(content); + free(content); if (format->groups == 0) format->propfailed = FALSE; @@ -616,12 +616,12 @@ static WCHAR *replace_stack_group( FORMAT *format, STACK *values, return replaced; } -static WCHAR *replace_stack_prop( FORMAT *format, STACK *values, +static WCHAR *replace_stack_prop( struct format *format, struct stack *values, BOOL *propfound, BOOL *nonprop, int *oldsize, int *type, int *len ) { WCHAR *replaced; - FORMSTR *content, *node; + struct form_str *content, *node; int n; *propfound = FALSE; @@ -631,7 +631,7 @@ static WCHAR *replace_stack_prop( FORMAT *format, STACK *values, n = node->n; *oldsize = node->len; *type = stack_peek(values)->type; - msi_free(node); + free(node); while ((node = stack_pop(values))) { @@ -641,10 +641,10 @@ static WCHAR *replace_stack_prop( FORMAT *format, STACK *values, stack_peek(values) && node->type != *type) *type = FORMAT_LITERAL; - msi_free(node); + free(node); } - content = msi_alloc_zero(sizeof(FORMSTR)); + content = calloc(1, sizeof(*content)); content->n = n + 1; content->len = *oldsize - 2; content->type = *type; @@ -672,14 +672,14 @@ static WCHAR *replace_stack_prop( FORMAT *format, STACK *values, content->len += 2; replaced = dup_formstr( format, content, len ); } - msi_free(content); + free(content); return replaced; } -static UINT replace_stack(FORMAT *format, STACK *stack, STACK *values) +static UINT replace_stack(struct format *format, struct stack *stack, struct stack *values) { WCHAR *replaced = NULL; - FORMSTR *beg, *top, *node; + struct form_str *beg, *top, *node; BOOL propfound = FALSE, nonprop = FALSE, group = FALSE; int type, n, len = 0, oldsize = 0; @@ -699,7 +699,7 @@ static UINT replace_stack(FORMAT *format, STACK *stack, STACK *values) format->n = n; beg = format_replace( format, propfound, nonprop, oldsize, type, replaced, len ); - msi_free(replaced); + free(replaced); if (!beg) return ERROR_SUCCESS; @@ -724,7 +724,7 @@ static UINT replace_stack(FORMAT *format, STACK *stack, STACK *values) if (beg->propfound) top->propfound = TRUE; - msi_free(beg); + free(beg); return ERROR_SUCCESS; } } @@ -757,10 +757,10 @@ static DWORD deformat_string_internal(MSIPACKAGE *package, LPCWSTR ptr, WCHAR** data, DWORD *len, MSIRECORD* record) { - FORMAT format; - FORMSTR *str = NULL; - STACK *stack, *temp; - FORMSTR *node; + struct format format; + struct form_str *str = NULL; + struct stack *stack, *temp; + struct form_str *node; int type; if (!ptr) @@ -770,10 +770,10 @@ static DWORD deformat_string_internal(MSIPACKAGE *package, LPCWSTR ptr, return ERROR_SUCCESS; } - *data = strdupW(ptr); + *data = wcsdup(ptr); *len = lstrlenW(ptr); - ZeroMemory(&format, sizeof(FORMAT)); + ZeroMemory(&format, sizeof(format)); format.package = package; format.record = record; format.deformatted = *data; @@ -828,7 +828,7 @@ static DWORD deformat_string_internal(MSIPACKAGE *package, LPCWSTR ptr, *data = format.deformatted; *len = format.len; - msi_free(str); + free(str); free_stack(stack); free_stack(temp); @@ -864,7 +864,7 @@ UINT MSI_FormatRecordW( MSIPACKAGE* package, MSIRECORD* record, LPWSTR buffer, { deformat_string_internal(package, MSI_RecordGetString(record, i), &deformated, &len, NULL); MSI_RecordSetStringW(record_deformated, i, deformated); - msi_free(deformated); + free(deformated); } } @@ -892,8 +892,8 @@ UINT MSI_FormatRecordW( MSIPACKAGE* package, MSIRECORD* record, LPWSTR buffer, *size = len; msiobj_release(&record_deformated->hdr); end: - msi_free( format ); - msi_free( deformated ); + free( format ); + free( deformated ); return rc; } @@ -997,7 +997,7 @@ UINT WINAPI MsiFormatRecordA(MSIHANDLE hinst, MSIHANDLE hrec, char *buf, DWORD * if (r != ERROR_SUCCESS) return r; - value = msi_alloc(++len * sizeof(WCHAR)); + value = malloc(++len * sizeof(WCHAR)); if (!value) goto done; @@ -1005,7 +1005,7 @@ UINT WINAPI MsiFormatRecordA(MSIHANDLE hinst, MSIHANDLE hrec, char *buf, DWORD * if (!r) r = msi_strncpyWtoA(value, len, buf, sz, FALSE); - msi_free(value); + free(value); done: msiobj_release(&rec->hdr); if (package) msiobj_release(&package->hdr); @@ -1024,7 +1024,7 @@ DWORD deformat_string( MSIPACKAGE *package, const WCHAR *fmt, WCHAR **data ) MSI_RecordSetStringW( rec, 0, fmt ); MSI_FormatRecordW( package, rec, NULL, &len ); - if (!(*data = msi_alloc( ++len * sizeof(WCHAR) ))) + if (!(*data = malloc( ++len * sizeof(WCHAR) ))) { msiobj_release( &rec->hdr ); return 0; diff --git a/dll/win32/msi/handle.c b/dll/win32/msi/handle.c index c1f290652df80..a96c27783f745 100644 --- a/dll/win32/msi/handle.c +++ b/dll/win32/msi/handle.c @@ -35,27 +35,27 @@ WINE_DEFAULT_DEBUG_CHANNEL(msi); -static CRITICAL_SECTION MSI_handle_cs; -static CRITICAL_SECTION_DEBUG MSI_handle_cs_debug = +static CRITICAL_SECTION handle_cs; +static CRITICAL_SECTION_DEBUG handle_cs_debug = { - 0, 0, &MSI_handle_cs, - { &MSI_handle_cs_debug.ProcessLocksList, - &MSI_handle_cs_debug.ProcessLocksList }, - 0, 0, { (DWORD_PTR)(__FILE__ ": MSI_handle_cs") } + 0, 0, &handle_cs, + { &handle_cs_debug.ProcessLocksList, + &handle_cs_debug.ProcessLocksList }, + 0, 0, { (DWORD_PTR)(__FILE__ ": handle_cs") } }; -static CRITICAL_SECTION MSI_handle_cs = { &MSI_handle_cs_debug, -1, 0, 0, 0, 0 }; +static CRITICAL_SECTION handle_cs = { &handle_cs_debug, -1, 0, 0, 0, 0 }; -static CRITICAL_SECTION MSI_object_cs; -static CRITICAL_SECTION_DEBUG MSI_object_cs_debug = +static CRITICAL_SECTION object_cs; +static CRITICAL_SECTION_DEBUG object_cs_debug = { - 0, 0, &MSI_object_cs, - { &MSI_object_cs_debug.ProcessLocksList, - &MSI_object_cs_debug.ProcessLocksList }, - 0, 0, { (DWORD_PTR)(__FILE__ ": MSI_object_cs") } + 0, 0, &object_cs, + { &object_cs_debug.ProcessLocksList, + &object_cs_debug.ProcessLocksList }, + 0, 0, { (DWORD_PTR)(__FILE__ ": object_cs") } }; -static CRITICAL_SECTION MSI_object_cs = { &MSI_object_cs_debug, -1, 0, 0, 0, 0 }; +static CRITICAL_SECTION object_cs = { &object_cs_debug, -1, 0, 0, 0, 0 }; -typedef struct msi_handle_info_t +struct handle_info { BOOL remote; union { @@ -63,18 +63,18 @@ typedef struct msi_handle_info_t MSIHANDLE rem; } u; DWORD dwThreadId; -} msi_handle_info; +}; -static msi_handle_info *msihandletable = NULL; -static unsigned int msihandletable_size = 0; +static struct handle_info *handle_table = NULL; +static unsigned int handle_table_size = 0; void msi_free_handle_table(void) { - msi_free( msihandletable ); - msihandletable = NULL; - msihandletable_size = 0; - DeleteCriticalSection(&MSI_handle_cs); - DeleteCriticalSection(&MSI_object_cs); + free( handle_table ); + handle_table = NULL; + handle_table_size = 0; + DeleteCriticalSection(&handle_cs); + DeleteCriticalSection(&object_cs); } static MSIHANDLE alloc_handle_table_entry(void) @@ -82,50 +82,50 @@ static MSIHANDLE alloc_handle_table_entry(void) UINT i; /* find a slot */ - for(i=0; iu.obj = obj; entry->dwThreadId = GetCurrentThreadId(); entry->remote = FALSE; } - LeaveCriticalSection( &MSI_handle_cs ); + LeaveCriticalSection( &handle_cs ); TRACE( "%p -> %lu\n", obj, ret ); @@ -134,21 +134,21 @@ MSIHANDLE alloc_msihandle( MSIOBJECTHDR *obj ) MSIHANDLE alloc_msi_remote_handle(MSIHANDLE remote) { - msi_handle_info *entry; + struct handle_info *entry; MSIHANDLE ret; - EnterCriticalSection( &MSI_handle_cs ); + EnterCriticalSection( &handle_cs ); ret = alloc_handle_table_entry(); if (ret) { - entry = &msihandletable[ ret - 1 ]; + entry = &handle_table[ ret - 1 ]; entry->u.rem = remote; entry->dwThreadId = GetCurrentThreadId(); entry->remote = TRUE; } - LeaveCriticalSection( &MSI_handle_cs ); + LeaveCriticalSection( &handle_cs ); TRACE( "%lu -> %lu\n", remote, ret ); @@ -159,23 +159,23 @@ void *msihandle2msiinfo(MSIHANDLE handle, UINT type) { MSIOBJECTHDR *ret = NULL; - EnterCriticalSection( &MSI_handle_cs ); + EnterCriticalSection( &handle_cs ); handle--; - if( handle >= msihandletable_size ) + if (handle >= handle_table_size) goto out; - if( msihandletable[handle].remote) + if (handle_table[handle].remote) goto out; - if( !msihandletable[handle].u.obj ) + if (!handle_table[handle].u.obj) goto out; - if( msihandletable[handle].u.obj->magic != MSIHANDLE_MAGIC ) + if (handle_table[handle].u.obj->magic != MSIHANDLE_MAGIC) goto out; - if( type && (msihandletable[handle].u.obj->type != type) ) + if (type && (handle_table[handle].u.obj->type != type)) goto out; - ret = msihandletable[handle].u.obj; + ret = handle_table[handle].u.obj; msiobj_addref( ret ); out: - LeaveCriticalSection( &MSI_handle_cs ); + LeaveCriticalSection( &handle_cs ); return ret; } @@ -184,16 +184,16 @@ MSIHANDLE msi_get_remote( MSIHANDLE handle ) { MSIHANDLE ret = 0; - EnterCriticalSection( &MSI_handle_cs ); + EnterCriticalSection( &handle_cs ); handle--; - if( handle>=msihandletable_size ) + if (handle >= handle_table_size) goto out; - if( !msihandletable[handle].remote) + if (!handle_table[handle].remote) goto out; - ret = msihandletable[handle].u.rem; + ret = handle_table[handle].u.rem; out: - LeaveCriticalSection( &MSI_handle_cs ); + LeaveCriticalSection( &handle_cs ); return ret; } @@ -202,7 +202,7 @@ void *alloc_msiobject(UINT type, UINT size, msihandledestructor destroy ) { MSIOBJECTHDR *info; - info = msi_alloc_zero( size ); + info = calloc( 1, size ); if( info ) { info->magic = MSIHANDLE_MAGIC; @@ -230,12 +230,12 @@ void msiobj_addref( MSIOBJECTHDR *info ) void msiobj_lock( MSIOBJECTHDR *info ) { - EnterCriticalSection( &MSI_object_cs ); + EnterCriticalSection( &object_cs ); } void msiobj_unlock( MSIOBJECTHDR *info ) { - LeaveCriticalSection( &MSI_object_cs ); + LeaveCriticalSection( &object_cs ); } int msiobj_release( MSIOBJECTHDR *info ) @@ -256,8 +256,8 @@ int msiobj_release( MSIOBJECTHDR *info ) { if( info->destructor ) info->destructor( info ); - msi_free( info ); TRACE("object %p destroyed\n", info); + free( info ); } return ret; @@ -276,19 +276,19 @@ UINT WINAPI MsiCloseHandle(MSIHANDLE handle) if (!handle) return ERROR_SUCCESS; - EnterCriticalSection( &MSI_handle_cs ); + EnterCriticalSection( &handle_cs ); handle--; - if (handle >= msihandletable_size) + if (handle >= handle_table_size) goto out; - if (msihandletable[handle].remote) + if (handle_table[handle].remote) { - remote_CloseHandle( msihandletable[handle].u.rem ); + remote_CloseHandle( handle_table[handle].u.rem ); } else { - info = msihandletable[handle].u.obj; + info = handle_table[handle].u.obj; if( !info ) goto out; @@ -299,15 +299,15 @@ UINT WINAPI MsiCloseHandle(MSIHANDLE handle) } } - msihandletable[handle].u.obj = NULL; - msihandletable[handle].remote = 0; - msihandletable[handle].dwThreadId = 0; + handle_table[handle].u.obj = NULL; + handle_table[handle].remote = 0; + handle_table[handle].dwThreadId = 0; ret = ERROR_SUCCESS; TRACE( "handle %lu destroyed\n", handle + 1 ); out: - LeaveCriticalSection( &MSI_handle_cs ); + LeaveCriticalSection( &handle_cs ); if( info ) msiobj_release( info ); @@ -328,18 +328,18 @@ UINT WINAPI MsiCloseAllHandles(void) TRACE("\n"); - EnterCriticalSection( &MSI_handle_cs ); - for(i=0; iops->delete( sv ); msiobj_release( &iv->db->hdr ); - msi_free( iv ); + free( iv ); return ERROR_SUCCESS; } @@ -351,7 +351,7 @@ static UINT count_column_info( const column_info *ci ) UINT INSERT_CreateView( MSIDATABASE *db, MSIVIEW **view, LPCWSTR table, column_info *columns, column_info *values, BOOL temp ) { - MSIINSERTVIEW *iv = NULL; + struct insert_view *iv = NULL; UINT r; MSIVIEW *tv = NULL, *sv = NULL; @@ -373,7 +373,7 @@ UINT INSERT_CreateView( MSIDATABASE *db, MSIVIEW **view, LPCWSTR table, return r; } - iv = msi_alloc_zero( sizeof *iv ); + iv = calloc( 1, sizeof *iv ); if( !iv ) return ERROR_FUNCTION_FAILED; diff --git a/dll/win32/msi/install.c b/dll/win32/msi/install.c index 997f365555612..b43391a94c987 100644 --- a/dll/win32/msi/install.c +++ b/dll/win32/msi/install.c @@ -54,7 +54,7 @@ UINT WINAPI MsiDoActionA( MSIHANDLE hInstall, LPCSTR szAction ) return ERROR_FUNCTION_FAILED; ret = MsiDoActionW( hInstall, szwAction ); - msi_free( szwAction ); + free( szwAction ); return ret; } @@ -113,7 +113,7 @@ UINT WINAPI MsiSequenceA( MSIHANDLE hInstall, LPCSTR szTable, INT iSequenceMode return ERROR_FUNCTION_FAILED; ret = MsiSequenceW( hInstall, szwTable, iSequenceMode ); - msi_free( szwTable ); + free( szwTable ); return ret; } @@ -379,7 +379,7 @@ WCHAR *msi_resolve_source_folder( MSIPACKAGE *package, const WCHAR *name, MSIFOL if (folder) *folder = f; if (f->ResolvedSource) { - path = strdupW( f->ResolvedSource ); + path = wcsdup( f->ResolvedSource ); TRACE(" already resolved to %s\n", debugstr_w(path)); return path; } @@ -397,8 +397,8 @@ WCHAR *msi_resolve_source_folder( MSIPACKAGE *package, const WCHAR *name, MSIFOL path = msi_build_directory_name( 3, p, f->SourceLongPath, NULL ); TRACE("-> %s\n", debugstr_w(path)); - f->ResolvedSource = strdupW( path ); - msi_free( p ); + f->ResolvedSource = wcsdup( path ); + free( p ); return path; } @@ -533,8 +533,8 @@ UINT WINAPI MsiSetTargetPathA( MSIHANDLE hInstall, LPCSTR szFolder, rc = MsiSetTargetPathW( hInstall, szwFolder, szwFolderPath ); end: - msi_free(szwFolder); - msi_free(szwFolderPath); + free(szwFolder); + free(szwFolderPath); return rc; } @@ -548,7 +548,7 @@ static void set_target_path( MSIPACKAGE *package, MSIFOLDER *folder, const WCHAR if (!(target_path = msi_normalize_path( path ))) return; if (wcscmp( target_path, folder->ResolvedTarget )) { - msi_free( folder->ResolvedTarget ); + free( folder->ResolvedTarget ); folder->ResolvedTarget = target_path; msi_set_property( package->db, folder->Directory, folder->ResolvedTarget, -1 ); @@ -558,7 +558,7 @@ static void set_target_path( MSIPACKAGE *package, MSIFOLDER *folder, const WCHAR msi_resolve_target_folder( package, child->Directory, FALSE ); } } - else msi_free( target_path ); + else free( target_path ); } UINT MSI_SetTargetPathW( MSIPACKAGE *package, LPCWSTR szFolder, LPCWSTR szFolderPath ) @@ -588,7 +588,7 @@ UINT MSI_SetTargetPathW( MSIPACKAGE *package, LPCWSTR szFolder, LPCWSTR szFolder if (!comp->Enabled || msi_is_global_assembly( comp )) continue; dir = msi_get_target_folder( package, comp->Directory ); - msi_free( file->TargetPath ); + free( file->TargetPath ); file->TargetPath = msi_build_directory_name( 2, dir, file->FileName ); } return ERROR_SUCCESS; @@ -824,7 +824,7 @@ UINT WINAPI MsiSetFeatureStateA(MSIHANDLE hInstall, LPCSTR szFeature, rc = MsiSetFeatureStateW(hInstall,szwFeature, iState); - msi_free(szwFeature); + free(szwFeature); return rc; } @@ -995,7 +995,7 @@ UINT WINAPI MsiSetFeatureAttributesA( MSIHANDLE handle, LPCSTR feature, DWORD at if (feature && !(featureW = strdupAtoW( feature ))) return ERROR_OUTOFMEMORY; r = MsiSetFeatureAttributesW( handle, featureW, attrs ); - msi_free( featureW ); + free( featureW ); return r; } @@ -1031,11 +1031,11 @@ UINT WINAPI MsiSetFeatureAttributesW( MSIHANDLE handle, LPCWSTR name, DWORD attr costing = msi_dup_property( package->db, L"CostingComplete" ); if (!costing || !wcscmp( costing, L"1" )) { - msi_free( costing ); + free( costing ); msiobj_release( &package->hdr ); return ERROR_FUNCTION_FAILED; } - msi_free( costing ); + free( costing ); if (!(feature = msi_get_loaded_feature( package, name ))) { msiobj_release( &package->hdr ); @@ -1058,7 +1058,7 @@ UINT WINAPI MsiGetFeatureStateA(MSIHANDLE hInstall, LPCSTR szFeature, if (szFeature && !(szwFeature = strdupAtoW(szFeature))) return ERROR_OUTOFMEMORY; rc = MsiGetFeatureStateW(hInstall, szwFeature, piInstalled, piAction); - msi_free( szwFeature); + free(szwFeature); return rc; } @@ -1135,7 +1135,7 @@ UINT WINAPI MsiGetFeatureCostA(MSIHANDLE hInstall, LPCSTR szFeature, rc = MsiGetFeatureCostW(hInstall, szwFeature, iCostTree, iState, piCost); - msi_free(szwFeature); + free(szwFeature); return rc; } @@ -1147,7 +1147,7 @@ static INT feature_cost( MSIFEATURE *feature ) LIST_FOR_EACH_ENTRY( cl, &feature->Components, ComponentList, entry ) { - cost += cl->component->Cost; + cost += cl->component->cost; } return cost; } @@ -1197,7 +1197,6 @@ UINT MSI_GetFeatureCost( MSIPACKAGE *package, MSIFEATURE *feature, MSICOSTTREE t break; } - *cost /= 512; return ERROR_SUCCESS; } @@ -1268,15 +1267,15 @@ UINT WINAPI MsiGetFeatureInfoA( MSIHANDLE handle, const char *feature, DWORD *at if (feature && !(featureW = strdupAtoW( feature ))) return ERROR_OUTOFMEMORY; - if (title && title_len && !(titleW = msi_alloc( *title_len * sizeof(WCHAR) ))) + if (title && title_len && !(titleW = malloc( *title_len * sizeof(WCHAR) ))) { - msi_free( featureW ); + free( featureW ); return ERROR_OUTOFMEMORY; } - if (help && help_len && !(helpW = msi_alloc( *help_len * sizeof(WCHAR) ))) + if (help && help_len && !(helpW = malloc( *help_len * sizeof(WCHAR) ))) { - msi_free( featureW ); - msi_free( titleW ); + free( featureW ); + free( titleW ); return ERROR_OUTOFMEMORY; } r = MsiGetFeatureInfoW( handle, featureW, attrs, titleW, title_len, helpW, help_len ); @@ -1285,9 +1284,9 @@ UINT WINAPI MsiGetFeatureInfoA( MSIHANDLE handle, const char *feature, DWORD *at if (titleW) WideCharToMultiByte( CP_ACP, 0, titleW, -1, title, *title_len + 1, NULL, NULL ); if (helpW) WideCharToMultiByte( CP_ACP, 0, helpW, -1, help, *help_len + 1, NULL, NULL ); } - msi_free( titleW ); - msi_free( helpW ); - msi_free( featureW ); + free( titleW ); + free( helpW ); + free( featureW ); return r; } @@ -1385,7 +1384,7 @@ UINT WINAPI MsiSetComponentStateA(MSIHANDLE hInstall, LPCSTR szComponent, rc = MsiSetComponentStateW(hInstall, szwComponent, iState); - msi_free(szwComponent); + free(szwComponent); return rc; } @@ -1403,7 +1402,7 @@ UINT WINAPI MsiGetComponentStateA(MSIHANDLE hInstall, LPCSTR szComponent, rc = MsiGetComponentStateW(hInstall,szwComponent,piInstalled, piAction); - msi_free( szwComponent); + free(szwComponent); return rc; } @@ -1648,6 +1647,6 @@ UINT WINAPI MsiGetFeatureValidStatesA( MSIHANDLE hInstall, const char *szFeature UINT ret; WCHAR *szwFeature = strdupAtoW(szFeature); ret = MsiGetFeatureValidStatesW(hInstall, szwFeature, pInstallState); - msi_free(szwFeature); + free(szwFeature); return ret; } diff --git a/dll/win32/msi/media.c b/dll/win32/msi/media.c index 6aeb948de5185..ecc51e60a4e69 100644 --- a/dll/win32/msi/media.c +++ b/dll/win32/msi/media.c @@ -18,6 +18,7 @@ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA */ +#include #include #define COBJMACROS @@ -35,23 +36,6 @@ WINE_DEFAULT_DEBUG_CHANNEL(msi); -/* from msvcrt/fcntl.h */ -#define _O_RDONLY 0 -#define _O_WRONLY 1 -#define _O_RDWR 2 -#define _O_ACCMODE (_O_RDONLY|_O_WRONLY|_O_RDWR) -#define _O_APPEND 0x0008 -#define _O_RANDOM 0x0010 -#define _O_SEQUENTIAL 0x0020 -#define _O_TEMPORARY 0x0040 -#define _O_NOINHERIT 0x0080 -#define _O_CREAT 0x0100 -#define _O_TRUNC 0x0200 -#define _O_EXCL 0x0400 -#define _O_SHORT_LIVED 0x1000 -#define _O_TEXT 0x4000 -#define _O_BINARY 0x8000 - static BOOL source_matches_volume(MSIMEDIAINFO *mi, LPCWSTR source_root) { WCHAR volume_name[MAX_PATH + 1], root[MAX_PATH + 1]; @@ -76,7 +60,7 @@ static BOOL source_matches_volume(MSIMEDIAINFO *mi, LPCWSTR source_root) return !wcsicmp( mi->volume_label, p ); } -static UINT msi_change_media(MSIPACKAGE *package, MSIMEDIAINFO *mi) +static UINT change_media(MSIPACKAGE *package, MSIMEDIAINFO *mi) { MSIRECORD *record; LPWSTR source_dir; @@ -94,12 +78,12 @@ static UINT msi_change_media(MSIPACKAGE *package, MSIMEDIAINFO *mi) } msiobj_release(&record->hdr); - msi_free(source_dir); + free(source_dir); return r == IDRETRY ? ERROR_SUCCESS : ERROR_INSTALL_SOURCE_ABSENT; } -static MSICABINETSTREAM *msi_get_cabinet_stream( MSIPACKAGE *package, UINT disk_id ) +static MSICABINETSTREAM *get_cabinet_stream( MSIPACKAGE *package, UINT disk_id ) { MSICABINETSTREAM *cab; @@ -112,12 +96,12 @@ static MSICABINETSTREAM *msi_get_cabinet_stream( MSIPACKAGE *package, UINT disk_ static void * CDECL cabinet_alloc(ULONG cb) { - return msi_alloc(cb); + return malloc(cb); } static void CDECL cabinet_free(void *pv) { - msi_free(pv); + free(pv); } static INT_PTR CDECL cabinet_open(char *pszFile, int oflag, int pmode) @@ -125,6 +109,8 @@ static INT_PTR CDECL cabinet_open(char *pszFile, int oflag, int pmode) DWORD dwAccess = 0; DWORD dwShareMode = 0; DWORD dwCreateDisposition = OPEN_EXISTING; + HANDLE handle; + WCHAR *path; switch (oflag & _O_ACCMODE) { @@ -147,8 +133,10 @@ static INT_PTR CDECL cabinet_open(char *pszFile, int oflag, int pmode) else if (oflag & _O_CREAT) dwCreateDisposition = CREATE_ALWAYS; - return (INT_PTR)CreateFileA(pszFile, dwAccess, dwShareMode, NULL, - dwCreateDisposition, 0, NULL); + path = strdupUtoW(pszFile); + handle = CreateFileW(path, dwAccess, dwShareMode, NULL, dwCreateDisposition, 0, NULL); + free(path); + return (INT_PTR)handle; } static UINT CDECL cabinet_read(INT_PTR hf, void *pv, UINT cb) @@ -199,7 +187,7 @@ static INT_PTR CDECL cabinet_open_stream( char *pszFile, int oflag, int pmode ) MSICABINETSTREAM *cab; IStream *stream; - if (!(cab = msi_get_cabinet_stream( package_disk.package, package_disk.id ))) + if (!(cab = get_cabinet_stream( package_disk.package, package_disk.id ))) { WARN("failed to get cabinet stream\n"); return -1; @@ -224,7 +212,7 @@ static INT_PTR CDECL cabinet_open_stream( char *pszFile, int oflag, int pmode ) return -1; } hr = IStorage_OpenStream( cab->storage, encoded, NULL, STGM_READ|STGM_SHARE_EXCLUSIVE, 0, &stream ); - msi_free( encoded ); + free( encoded ); if (FAILED(hr)) { WARN( "failed to open stream %#lx\n", hr ); @@ -271,7 +259,7 @@ static LONG CDECL cabinet_seek_stream( INT_PTR hf, LONG dist, int seektype ) return -1; } -static UINT msi_media_get_disk_info(MSIPACKAGE *package, MSIMEDIAINFO *mi) +static UINT media_get_disk_info(MSIPACKAGE *package, MSIMEDIAINFO *mi) { MSIRECORD *row; @@ -282,9 +270,9 @@ static UINT msi_media_get_disk_info(MSIPACKAGE *package, MSIMEDIAINFO *mi) return ERROR_FUNCTION_FAILED; } - mi->disk_prompt = strdupW(MSI_RecordGetString(row, 3)); - mi->cabinet = strdupW(MSI_RecordGetString(row, 4)); - mi->volume_label = strdupW(MSI_RecordGetString(row, 5)); + mi->disk_prompt = wcsdup(MSI_RecordGetString(row, 3)); + mi->cabinet = wcsdup(MSI_RecordGetString(row, 4)); + mi->volume_label = wcsdup(MSI_RecordGetString(row, 5)); msiobj_release(&row->hdr); return ERROR_SUCCESS; @@ -304,7 +292,7 @@ static WCHAR *get_cabinet_filename(MSIMEDIAINFO *mi) WCHAR *ret; len = lstrlenW(mi->sourcedir) + lstrlenW(mi->cabinet) + 1; - if (!(ret = msi_alloc(len * sizeof(WCHAR)))) return NULL; + if (!(ret = malloc(len * sizeof(WCHAR)))) return NULL; lstrcpyW(ret, mi->sourcedir); lstrcatW(ret, mi->cabinet); return ret; @@ -319,9 +307,9 @@ static INT_PTR cabinet_next_cabinet(FDINOTIFICATIONTYPE fdint, INT_PTR res = -1; UINT rc; - msi_free(mi->disk_prompt); - msi_free(mi->cabinet); - msi_free(mi->volume_label); + free(mi->disk_prompt); + free(mi->cabinet); + free(mi->volume_label); mi->disk_prompt = NULL; mi->cabinet = NULL; mi->volume_label = NULL; @@ -329,7 +317,7 @@ static INT_PTR cabinet_next_cabinet(FDINOTIFICATIONTYPE fdint, mi->disk_id++; mi->is_continuous = TRUE; - rc = msi_media_get_disk_info(data->package, mi); + rc = media_get_disk_info(data->package, mi); if (rc != ERROR_SUCCESS) { ERR("Failed to get next cabinet information: %d\n", rc); @@ -350,7 +338,7 @@ static INT_PTR cabinet_next_cabinet(FDINOTIFICATIONTYPE fdint, if (length > 256) { WARN( "cannot update next cabinet filename with a string size %lu > 256\n", length ); - msi_free(next_cab); + free(next_cab); goto done; } else @@ -360,7 +348,7 @@ static INT_PTR cabinet_next_cabinet(FDINOTIFICATIONTYPE fdint, } /* Path psz3 and cabinet psz1 are concatenated by FDI so just reset psz1 */ *pfdin->psz1 = 0; - msi_free(next_cab); + free(next_cab); } if (!(cabinet_file = get_cabinet_filename(mi))) @@ -371,13 +359,13 @@ static INT_PTR cabinet_next_cabinet(FDINOTIFICATIONTYPE fdint, res = 0; if (GetFileAttributesW(cabinet_file) == INVALID_FILE_ATTRIBUTES) { - if (msi_change_media(data->package, mi) != ERROR_SUCCESS) + if (change_media(data->package, mi) != ERROR_SUCCESS) res = -1; } done: - msi_free(cab); - msi_free(cabinet_file); + free(cab); + free(cabinet_file); return res; } @@ -388,9 +376,9 @@ static INT_PTR cabinet_next_cabinet_stream( FDINOTIFICATIONTYPE fdint, MSIMEDIAINFO *mi = data->mi; UINT rc; - msi_free( mi->disk_prompt ); - msi_free( mi->cabinet ); - msi_free( mi->volume_label ); + free( mi->disk_prompt ); + free( mi->cabinet ); + free( mi->volume_label ); mi->disk_prompt = NULL; mi->cabinet = NULL; mi->volume_label = NULL; @@ -398,7 +386,7 @@ static INT_PTR cabinet_next_cabinet_stream( FDINOTIFICATIONTYPE fdint, mi->disk_id++; mi->is_continuous = TRUE; - rc = msi_media_get_disk_info( data->package, mi ); + rc = media_get_disk_info( data->package, mi ); if (rc != ERROR_SUCCESS) { ERR("Failed to get next cabinet information: %u\n", rc); @@ -423,7 +411,7 @@ static INT_PTR cabinet_copy_file(FDINOTIFICATIONTYPE fdint, &attrs, data->user)) { /* We're not extracting this file, so free the filename. */ - msi_free(data->curfile); + free(data->curfile); data->curfile = NULL; goto done; } @@ -460,18 +448,18 @@ static INT_PTR cabinet_copy_file(FDINOTIFICATIONTYPE fdint, TRACE("file in use, scheduling rename operation\n"); - if (!(tmppathW = strdupW( path ))) return ERROR_OUTOFMEMORY; + if (!(tmppathW = wcsdup(path))) return ERROR_OUTOFMEMORY; if ((p = wcsrchr(tmppathW, '\\'))) *p = 0; len = lstrlenW( tmppathW ) + 16; - if (!(tmpfileW = msi_alloc(len * sizeof(WCHAR)))) + if (!(tmpfileW = malloc(len * sizeof(WCHAR)))) { - msi_free( tmppathW ); + free( tmppathW ); return ERROR_OUTOFMEMORY; } - if (!GetTempFileNameW(tmppathW, L"msi", 0, tmpfileW)) tmpfileW[0] = 0; - msi_free( tmppathW ); + if (!msi_get_temp_file_name( data->package, tmppathW, L"msi", tmpfileW )) tmpfileW[0] = 0; + free( tmppathW ); - handle = CreateFileW(tmpfileW, GENERIC_READ | GENERIC_WRITE, 0, NULL, CREATE_ALWAYS, attrs, NULL); + handle = msi_create_file( data->package, tmpfileW, GENERIC_READ | GENERIC_WRITE, 0, CREATE_ALWAYS, attrs ); if (handle != INVALID_HANDLE_VALUE && msi_move_file( data->package, path, NULL, MOVEFILE_DELAY_UNTIL_REBOOT ) && @@ -482,15 +470,15 @@ static INT_PTR cabinet_copy_file(FDINOTIFICATIONTYPE fdint, else { WARN( "failed to schedule rename operation %s (error %lu)\n", debugstr_w(path), GetLastError() ); - DeleteFileW( tmpfileW ); + msi_delete_file( data->package, tmpfileW ); } - msi_free(tmpfileW); + free(tmpfileW); } else WARN( "failed to create %s (error %lu)\n", debugstr_w(path), err ); } done: - msi_free(path); + free(path); return (INT_PTR)handle; } @@ -524,7 +512,7 @@ static INT_PTR cabinet_close_file_info(FDINOTIFICATIONTYPE fdint, CloseHandle(handle); data->cb(data->package, data->curfile, MSICABEXTRACT_FILEEXTRACTED, NULL, NULL, data->user); - msi_free(data->curfile); + free(data->curfile); data->curfile = NULL; return 1; @@ -593,11 +581,11 @@ static BOOL extract_cabinet( MSIPACKAGE* package, MSIMEDIAINFO *mi, LPVOID data return FALSE; } - cabinet = strdupWtoA( mi->cabinet ); + cabinet = strdupWtoU( mi->cabinet ); if (!cabinet) goto done; - cab_path = strdupWtoA( mi->sourcedir ); + cab_path = strdupWtoU( mi->sourcedir ); if (!cab_path) goto done; @@ -607,8 +595,8 @@ static BOOL extract_cabinet( MSIPACKAGE* package, MSIMEDIAINFO *mi, LPVOID data done: FDIDestroy( hfdi ); - msi_free(cabinet ); - msi_free( cab_path ); + free( cabinet ); + free( cab_path ); if (ret) mi->is_extracted = TRUE; @@ -660,11 +648,11 @@ BOOL msi_cabextract(MSIPACKAGE* package, MSIMEDIAINFO *mi, LPVOID data) void msi_free_media_info(MSIMEDIAINFO *mi) { - msi_free(mi->disk_prompt); - msi_free(mi->cabinet); - msi_free(mi->volume_label); - msi_free(mi->last_volume); - msi_free(mi); + free(mi->disk_prompt); + free(mi->cabinet); + free(mi->volume_label); + free(mi->last_volume); + free(mi); } static UINT get_drive_type(const WCHAR *path) @@ -681,8 +669,8 @@ static UINT get_drive_type(const WCHAR *path) static WCHAR *get_base_url( MSIDATABASE *db ) { WCHAR *p, *ret = NULL, *orig_db = msi_dup_property( db, L"OriginalDatabase" ); - if (UrlIsW( orig_db, URLIS_URL ) && (ret = strdupW( orig_db )) && (p = wcsrchr( ret, '/'))) p[1] = 0; - msi_free( orig_db ); + if (UrlIsW( orig_db, URLIS_URL ) && (ret = wcsdup( orig_db )) && (p = wcsrchr( ret, '/' ))) p[1] = 0; + free( orig_db ); return ret; } @@ -705,12 +693,12 @@ UINT msi_load_media_info(MSIPACKAGE *package, UINT Sequence, MSIMEDIAINFO *mi) mi->is_extracted = FALSE; mi->disk_id = MSI_RecordGetInteger(row, 1); mi->last_sequence = MSI_RecordGetInteger(row, 2); - msi_free(mi->disk_prompt); - mi->disk_prompt = strdupW(MSI_RecordGetString(row, 3)); - msi_free(mi->cabinet); - mi->cabinet = strdupW(MSI_RecordGetString(row, 4)); - msi_free(mi->volume_label); - mi->volume_label = strdupW(MSI_RecordGetString(row, 5)); + free(mi->disk_prompt); + mi->disk_prompt = wcsdup(MSI_RecordGetString(row, 3)); + free(mi->cabinet); + mi->cabinet = wcsdup(MSI_RecordGetString(row, 4)); + free(mi->volume_label); + mi->volume_label = wcsdup(MSI_RecordGetString(row, 5)); msiobj_release(&row->hdr); msi_set_sourcedir_props(package, FALSE); @@ -745,8 +733,8 @@ UINT msi_load_media_info(MSIPACKAGE *package, UINT Sequence, MSIMEDIAINFO *mi) TRACE("sequence %u -> cabinet %s disk id %u\n", Sequence, debugstr_w(mi->cabinet), mi->disk_id); - msi_free(base_url); - msi_free(source_dir); + free(base_url); + free(source_dir); return ERROR_SUCCESS; } @@ -826,12 +814,12 @@ static UINT find_published_source(MSIPACKAGE *package, MSIMEDIAINFO *mi) volume, &volumesz, prompt, &promptsz) == ERROR_SUCCESS) { mi->disk_id = id; - msi_free( mi->volume_label ); - if (!(mi->volume_label = msi_alloc( ++volumesz * sizeof(WCHAR) ))) return ERROR_OUTOFMEMORY; + free( mi->volume_label ); + if (!(mi->volume_label = malloc( ++volumesz * sizeof(WCHAR) ))) return ERROR_OUTOFMEMORY; lstrcpyW( mi->volume_label, volume ); - msi_free( mi->disk_prompt ); - if (!(mi->disk_prompt = msi_alloc( ++promptsz * sizeof(WCHAR) ))) return ERROR_OUTOFMEMORY; + free( mi->disk_prompt ); + if (!(mi->disk_prompt = malloc( ++promptsz * sizeof(WCHAR) ))) return ERROR_OUTOFMEMORY; lstrcpyW( mi->disk_prompt, prompt ); if (source_matches_volume(mi, source)) @@ -870,26 +858,26 @@ UINT ready_media( MSIPACKAGE *package, BOOL compressed, MSIMEDIAINFO *mi ) { WCHAR temppath[MAX_PATH], *p, *url; - msi_free( cabinet_file ); - if (!(url = msi_alloc( (lstrlenW( base_url ) + lstrlenW( mi->cabinet ) + 1) * sizeof(WCHAR) ))) + free( cabinet_file ); + if (!(url = realloc( base_url, (wcslen( base_url ) + wcslen( mi->cabinet ) + 1) * sizeof(WCHAR) ))) { + free( base_url ); return ERROR_OUTOFMEMORY; } - lstrcpyW( url, base_url ); lstrcatW( url, mi->cabinet ); if ((rc = msi_download_file( url, temppath )) != ERROR_SUCCESS) { ERR("failed to download %s (%u)\n", debugstr_w(url), rc); - msi_free( url ); + free( url ); return rc; } if ((p = wcsrchr( temppath, '\\' ))) *p = 0; lstrcpyW( mi->sourcedir, temppath ); PathAddBackslashW( mi->sourcedir ); - msi_free( mi->cabinet ); - mi->cabinet = strdupW( p + 1 ); + free( mi->cabinet ); + mi->cabinet = wcsdup( p + 1 ); - msi_free( url ); + free( url ); return ERROR_SUCCESS; } } @@ -901,20 +889,20 @@ UINT ready_media( MSIPACKAGE *package, BOOL compressed, MSIMEDIAINFO *mi ) { WCHAR *source = msi_dup_property( package->db, L"SourceDir" ); BOOL match = source_matches_volume( mi, source ); - msi_free( source ); + free( source ); if (!match && (mi->type == DRIVE_CDROM || mi->type == DRIVE_REMOVABLE)) { - if ((rc = msi_change_media( package, mi )) != ERROR_SUCCESS) + if ((rc = change_media( package, mi )) != ERROR_SUCCESS) { - msi_free( cabinet_file ); + free( cabinet_file ); return rc; } } } - msi_free(mi->last_volume); - mi->last_volume = strdupW(mi->volume_label); + free(mi->last_volume); + mi->last_volume = wcsdup(mi->volume_label); } if (mi->cabinet) { @@ -923,12 +911,12 @@ UINT ready_media( MSIPACKAGE *package, BOOL compressed, MSIMEDIAINFO *mi ) if ((rc = find_published_source( package, mi )) != ERROR_SUCCESS) { ERR("cabinet not found: %s\n", debugstr_w(cabinet_file)); - msi_free( cabinet_file ); + free( cabinet_file ); return ERROR_INSTALL_FAILURE; } } } - msi_free( cabinet_file ); + free( cabinet_file ); return ERROR_SUCCESS; } @@ -946,10 +934,10 @@ UINT msi_add_cabinet_stream( MSIPACKAGE *package, UINT disk_id, IStorage *storag return ERROR_FUNCTION_FAILED; } } - if (!(cab = msi_alloc( sizeof(*cab) ))) return ERROR_OUTOFMEMORY; - if (!(cab->stream = msi_alloc( (lstrlenW( name ) + 1) * sizeof(WCHAR ) ))) + if (!(cab = malloc( sizeof(*cab) ))) return ERROR_OUTOFMEMORY; + if (!(cab->stream = malloc( (wcslen( name ) + 1) * sizeof(WCHAR) ))) { - msi_free( cab ); + free( cab ); return ERROR_OUTOFMEMORY; } lstrcpyW( cab->stream, name ); diff --git a/dll/win32/msi/msi.c b/dll/win32/msi/msi.c index 7f198f3fd2e60..f8949fbfe3f4d 100644 --- a/dll/win32/msi/msi.c +++ b/dll/win32/msi/msi.c @@ -21,8 +21,6 @@ #include #define COBJMACROS -#define NONAMELESSUNION - #include "windef.h" #include "winbase.h" #include "winreg.h" @@ -95,7 +93,7 @@ UINT WINAPI MsiOpenProductA(LPCSTR szProduct, MSIHANDLE *phProduct) r = MsiOpenProductW( szwProd, phProduct ); - msi_free( szwProd ); + free( szwProd ); return r; } @@ -137,7 +135,7 @@ static UINT MSI_OpenProductW(LPCWSTR szProduct, MSIPACKAGE **package) done: RegCloseKey(props); - msi_free(path); + free(path); return r; } @@ -221,8 +219,8 @@ UINT WINAPI MsiInstallProductA(LPCSTR szPackagePath, LPCSTR szCommandLine) r = MsiInstallProductW( szwPath, szwCommand ); end: - msi_free( szwPath ); - msi_free( szwCommand ); + free( szwPath ); + free( szwCommand ); return r; } @@ -274,7 +272,7 @@ UINT WINAPI MsiReinstallProductA( const char *szProduct, DWORD dwReinstallMode ) wszProduct = strdupAtoW(szProduct); rc = MsiReinstallProductW(wszProduct, dwReinstallMode); - msi_free(wszProduct); + free(wszProduct); return rc; } @@ -308,9 +306,9 @@ UINT WINAPI MsiApplyPatchA(LPCSTR szPatchPackage, LPCSTR szInstallPackage, r = MsiApplyPatchW(patch_package, install_package, eInstallType, command_line); done: - msi_free(patch_package); - msi_free(install_package); - msi_free(command_line); + free(patch_package); + free(install_package); + free(command_line); return r; } @@ -340,7 +338,7 @@ static UINT get_patch_product_codes( LPCWSTR szPatchPackage, WCHAR ***product_co goto done; } - codes = msi_alloc( ++size * sizeof(WCHAR) ); + codes = malloc( ++size * sizeof(WCHAR) ); if (!codes) { r = ERROR_OUTOFMEMORY; @@ -354,7 +352,7 @@ static UINT get_patch_product_codes( LPCWSTR szPatchPackage, WCHAR ***product_co done: MsiCloseHandle( info ); MsiCloseHandle( patch ); - msi_free( codes ); + free( codes ); return r; } @@ -376,10 +374,10 @@ static UINT MSI_ApplyPatchW(LPCWSTR szPatchPackage, LPCWSTR szProductCode, LPCWS cmd_ptr = L""; size = lstrlenW(cmd_ptr) + lstrlenW(L"%s PATCH=\"%s\"") + lstrlenW(szPatchPackage) + 1; - cmd = msi_alloc(size * sizeof(WCHAR)); + cmd = malloc(size * sizeof(WCHAR)); if (!cmd) { - msi_free(codes); + free(codes); return ERROR_OUTOFMEMORY; } swprintf(cmd, size, L"%s PATCH=\"%s\"", cmd_ptr, szPatchPackage); @@ -402,8 +400,8 @@ static UINT MSI_ApplyPatchW(LPCWSTR szPatchPackage, LPCWSTR szProductCode, LPCWS r = ERROR_SUCCESS; } - msi_free(cmd); - msi_free(codes); + free(cmd); + free(codes); return r; } @@ -449,9 +447,9 @@ UINT WINAPI MsiApplyMultiplePatchesA(LPCSTR szPatchPackages, r = MsiApplyMultiplePatchesW(patch_packages, product_code, properties_list); done: - msi_free(patch_packages); - msi_free(product_code); - msi_free(properties_list); + free(patch_packages); + free(product_code); + free(properties_list); return r; } @@ -482,7 +480,7 @@ UINT WINAPI MsiApplyMultiplePatchesW(LPCWSTR szPatchPackages, if (!len) return ERROR_INVALID_NAME; - patch = msi_alloc((len + 1) * sizeof(WCHAR)); + patch = malloc((len + 1) * sizeof(WCHAR)); if (!patch) return ERROR_OUTOFMEMORY; @@ -490,7 +488,7 @@ UINT WINAPI MsiApplyMultiplePatchesW(LPCWSTR szPatchPackages, patch[len] = '\0'; r = MSI_ApplyPatchW(patch, szProductCode, szPropertiesList); - msi_free(patch); + free(patch); if (r != ERROR_SUCCESS || !*end) break; @@ -503,8 +501,8 @@ UINT WINAPI MsiApplyMultiplePatchesW(LPCWSTR szPatchPackages, static void free_patchinfo( DWORD count, MSIPATCHSEQUENCEINFOW *info ) { DWORD i; - for (i = 0; i < count; i++) msi_free( (WCHAR *)info[i].szPatchData ); - msi_free( info ); + for (i = 0; i < count; i++) free( (WCHAR *)info[i].szPatchData ); + free( info ); } static MSIPATCHSEQUENCEINFOW *patchinfoAtoW( DWORD count, const MSIPATCHSEQUENCEINFOA *info ) @@ -512,7 +510,7 @@ static MSIPATCHSEQUENCEINFOW *patchinfoAtoW( DWORD count, const MSIPATCHSEQUENCE DWORD i; MSIPATCHSEQUENCEINFOW *ret; - if (!(ret = msi_alloc( count * sizeof(MSIPATCHSEQUENCEINFOW) ))) return NULL; + if (!(ret = malloc( count * sizeof(MSIPATCHSEQUENCEINFOW) ))) return NULL; for (i = 0; i < count; i++) { if (info[i].szPatchData && !(ret[i].szPatchData = strdupAtoW( info[i].szPatchData ))) @@ -541,7 +539,7 @@ UINT WINAPI MsiDetermineApplicablePatchesA( const char *szProductPackagePath, DW if (!(psi = patchinfoAtoW( cPatchInfo, pPatchInfo ))) { - msi_free( package_path ); + free( package_path ); return ERROR_OUTOFMEMORY; } r = MsiDetermineApplicablePatchesW( package_path, cPatchInfo, psi ); @@ -553,7 +551,7 @@ UINT WINAPI MsiDetermineApplicablePatchesA( const char *szProductPackagePath, DW pPatchInfo[i].uStatus = psi[i].uStatus; } } - msi_free( package_path ); + free( package_path ); free_patchinfo( cPatchInfo, psi ); return r; } @@ -626,7 +624,7 @@ static UINT MSI_ApplicablePatchXML( MSIPACKAGE *package, IXMLDOMDocument *desc ) if (r != ERROR_SUCCESS) TRACE("patch not applicable\n"); - msi_free( product_code ); + free( product_code ); return r; } @@ -757,13 +755,13 @@ UINT WINAPI MsiDeterminePatchSequenceA( const char *product, const char *usersid if (!(productW = strdupAtoW( product ))) return ERROR_OUTOFMEMORY; if (usersid && !(usersidW = strdupAtoW( usersid ))) { - msi_free( productW ); + free( productW ); return ERROR_OUTOFMEMORY; } if (!(patchinfoW = patchinfoAtoW( count, patchinfo ))) { - msi_free( productW ); - msi_free( usersidW ); + free( productW ); + free( usersidW ); return ERROR_OUTOFMEMORY; } r = MsiDeterminePatchSequenceW( productW, usersidW, context, count, patchinfoW ); @@ -775,8 +773,8 @@ UINT WINAPI MsiDeterminePatchSequenceA( const char *product, const char *usersid patchinfo[i].uStatus = patchinfoW[i].uStatus; } } - msi_free( productW ); - msi_free( usersidW ); + free( productW ); + free( usersidW ); free_patchinfo( count, patchinfoW ); return r; } @@ -794,7 +792,7 @@ static UINT open_package( const WCHAR *product, const WCHAR *usersid, if ((localpath = msi_reg_get_val_str( props, L"LocalPackage" ))) { lstrcpyW( sourcepath, localpath ); - msi_free( localpath ); + free( localpath ); } RegCloseKey( props ); if (!localpath || GetFileAttributesW( sourcepath ) == INVALID_FILE_ATTRIBUTES) @@ -875,7 +873,7 @@ UINT WINAPI MsiConfigureProductExW(LPCWSTR szProduct, int iInstallLevel, if (context == MSIINSTALLCONTEXT_MACHINE) sz += lstrlenW(L" ALLUSERS=1"); - commandline = msi_alloc(sz * sizeof(WCHAR)); + commandline = malloc(sz * sizeof(WCHAR)); if (!commandline) { r = ERROR_OUTOFMEMORY; @@ -907,7 +905,7 @@ UINT WINAPI MsiConfigureProductExW(LPCWSTR szProduct, int iInstallLevel, r = MSI_InstallPackage( package, sourcepath, commandline ); - msi_free(commandline); + free(commandline); end: msiobj_release( &package->hdr ); @@ -939,8 +937,8 @@ UINT WINAPI MsiConfigureProductExA(LPCSTR szProduct, int iInstallLevel, r = MsiConfigureProductExW( szwProduct, iInstallLevel, eInstallState, szwCommandLine ); end: - msi_free( szwProduct ); - msi_free( szwCommandLine); + free( szwProduct ); + free( szwCommandLine); return r; } @@ -961,7 +959,7 @@ UINT WINAPI MsiConfigureProductA(LPCSTR szProduct, int iInstallLevel, } r = MsiConfigureProductW( szwProduct, iInstallLevel, eInstallState ); - msi_free( szwProduct ); + free( szwProduct ); return r; } @@ -993,7 +991,7 @@ UINT WINAPI MsiGetProductCodeA(LPCSTR szComponent, LPSTR szBuffer) if(*szwBuffer) WideCharToMultiByte(CP_ACP, 0, szwBuffer, -1, szBuffer, GUID_SIZE, NULL, NULL); - msi_free( szwComponent ); + free( szwComponent ); return r; } @@ -1080,7 +1078,7 @@ static WCHAR *reg_get_value( HKEY hkey, const WCHAR *name, DWORD *type ) if (!msi_reg_get_val_dword( hkey, name, &val )) return NULL; swprintf( temp, ARRAY_SIZE(temp), L"%u", val ); - return strdupW( temp ); + return wcsdup( temp ); } ERR( "unhandled value type %lu\n", *type ); @@ -1209,8 +1207,8 @@ static UINT MSI_GetProductInfo(LPCWSTR szProduct, LPCWSTR szAttribute, else { unsquash_guid(val, packagecode); - msi_free(val); - val = strdupW(packagecode); + free(val); + val = wcsdup(packagecode); } } } @@ -1246,7 +1244,7 @@ static UINT MSI_GetProductInfo(LPCWSTR szProduct, LPCWSTR szAttribute, r = ERROR_BAD_CONFIGURATION; if (val != empty) - msi_free(val); + free(val); done: RegCloseKey(prodkey); @@ -1278,8 +1276,8 @@ UINT WINAPI MsiGetProductInfoA(LPCSTR szProduct, LPCSTR szAttribute, &buffer, pcchValueBuf ); end: - msi_free( szwProduct ); - msi_free( szwAttribute ); + free( szwProduct ); + free( szwAttribute ); return r; } @@ -1326,7 +1324,7 @@ UINT WINAPI MsiGetProductInfoExA(LPCSTR szProductCode, LPCSTR szUserSid, if (r != ERROR_SUCCESS) goto done; - value = msi_alloc(++len * sizeof(WCHAR)); + value = malloc(++len * sizeof(WCHAR)); if (!value) { r = ERROR_OUTOFMEMORY; @@ -1357,15 +1355,15 @@ UINT WINAPI MsiGetProductInfoExA(LPCSTR szProductCode, LPCSTR szUserSid, *pcchValue = len - 1; done: - msi_free(product); - msi_free(usersid); - msi_free(property); - msi_free(value); + free(product); + free(usersid); + free(property); + free(value); return r; } -static UINT msi_copy_outval(LPWSTR val, LPWSTR out, LPDWORD size) +static UINT copy_outval(const WCHAR *val, WCHAR *out, DWORD *size) { UINT r = ERROR_SUCCESS; @@ -1479,7 +1477,7 @@ UINT WINAPI MsiGetProductInfoExW(LPCWSTR szProductCode, LPCWSTR szUserSid, goto done; } - msi_free(val); + free(val); if (!wcscmp( szProperty, INSTALLPROPERTY_INSTALLEDPRODUCTNAMEW )) szProperty = L"DisplayName"; @@ -1488,9 +1486,9 @@ UINT WINAPI MsiGetProductInfoExW(LPCWSTR szProductCode, LPCWSTR szUserSid, val = reg_get_value(props, szProperty, &type); if (!val) - val = strdupW(L""); + val = wcsdup(L""); - r = msi_copy_outval(val, szValue, pcchValue); + r = copy_outval(val, szValue, pcchValue); } else if (!wcscmp( szProperty, INSTALLPROPERTY_TRANSFORMSW ) || !wcscmp( szProperty, INSTALLPROPERTY_LANGUAGEW ) || @@ -1513,9 +1511,9 @@ UINT WINAPI MsiGetProductInfoExW(LPCWSTR szProductCode, LPCWSTR szUserSid, val = reg_get_value(hkey, szProperty, &type); if (!val) - val = strdupW(L""); + val = wcsdup(L""); - r = msi_copy_outval(val, szValue, pcchValue); + r = copy_outval(val, szValue, pcchValue); } else if (!wcscmp( szProperty, INSTALLPROPERTY_PRODUCTSTATEW )) { @@ -1527,29 +1525,29 @@ UINT WINAPI MsiGetProductInfoExW(LPCWSTR szProductCode, LPCWSTR szUserSid, if (!val) goto done; - msi_free(val); - val = strdupW(L"5"); + free(val); + val = wcsdup(L"5"); } else - val = strdupW(L"1"); + val = wcsdup(L"1"); - r = msi_copy_outval(val, szValue, pcchValue); + r = copy_outval(val, szValue, pcchValue); goto done; } else if (props && (val = reg_get_value(props, package, &type))) { - msi_free(val); - val = strdupW(L"5"); - r = msi_copy_outval(val, szValue, pcchValue); + free(val); + val = wcsdup(L"5"); + r = copy_outval(val, szValue, pcchValue); goto done; } if (prod || managed) - val = strdupW(L"1"); + val = wcsdup(L"1"); else goto done; - r = msi_copy_outval(val, szValue, pcchValue); + r = copy_outval(val, szValue, pcchValue); } else if (!wcscmp( szProperty, INSTALLPROPERTY_ASSIGNMENTTYPEW )) { @@ -1557,8 +1555,8 @@ UINT WINAPI MsiGetProductInfoExW(LPCWSTR szProductCode, LPCWSTR szUserSid, goto done; /* FIXME */ - val = strdupW(L""); - r = msi_copy_outval(val, szValue, pcchValue); + val = wcsdup(L""); + r = copy_outval(val, szValue, pcchValue); } else r = ERROR_UNKNOWN_PROPERTY; @@ -1568,7 +1566,7 @@ UINT WINAPI MsiGetProductInfoExW(LPCWSTR szProductCode, LPCWSTR szUserSid, RegCloseKey(prod); RegCloseKey(managed); RegCloseKey(classes); - msi_free(val); + free(val); return r; } @@ -1616,7 +1614,7 @@ UINT WINAPI MsiGetPatchInfoExA(LPCSTR szPatchCode, LPCSTR szProductCode, if (r != ERROR_SUCCESS) goto done; - val = msi_alloc(++len * sizeof(WCHAR)); + val = malloc(++len * sizeof(WCHAR)); if (!val) { r = ERROR_OUTOFMEMORY; @@ -1647,11 +1645,11 @@ UINT WINAPI MsiGetPatchInfoExA(LPCSTR szPatchCode, LPCSTR szProductCode, *pcchValue = len; done: - msi_free(val); - msi_free(patch); - msi_free(product); - msi_free(usersid); - msi_free(property); + free(val); + free(patch); + free(product); + free(usersid); + free(property); return r; } @@ -1760,7 +1758,7 @@ UINT WINAPI MsiGetPatchInfoExW(LPCWSTR szPatchCode, LPCWSTR szProductCode, val = reg_get_value(datakey, szProperty, &type); if (!val) - val = strdupW(L""); + val = wcsdup(L""); r = ERROR_SUCCESS; @@ -1782,7 +1780,7 @@ UINT WINAPI MsiGetPatchInfoExW(LPCWSTR szPatchCode, LPCWSTR szProductCode, *pcchValue = len; done: - msi_free(val); + free(val); RegCloseKey(prodpatches); RegCloseKey(prod); RegCloseKey(patch); @@ -1817,7 +1815,7 @@ UINT WINAPI MsiGetPatchInfoA( LPCSTR patch, LPCSTR attr, LPSTR buffer, LPDWORD b goto done; size++; - if (!(bufferW = msi_alloc( size * sizeof(WCHAR) ))) + if (!(bufferW = malloc( size * sizeof(WCHAR) ))) { r = ERROR_OUTOFMEMORY; goto done; @@ -1836,9 +1834,9 @@ UINT WINAPI MsiGetPatchInfoA( LPCSTR patch, LPCSTR attr, LPSTR buffer, LPDWORD b } done: - msi_free( patchW ); - msi_free( attrW ); - msi_free( bufferW ); + free( patchW ); + free( attrW ); + free( bufferW ); return r; } @@ -1895,7 +1893,7 @@ UINT WINAPI MsiEnableLogA( DWORD dwLogMode, const char *szLogFile, DWORD attribu return ERROR_OUTOFMEMORY; } r = MsiEnableLogW( dwLogMode, szwLogFile, attributes ); - msi_free( szwLogFile ); + free( szwLogFile ); return r; } @@ -1903,7 +1901,7 @@ UINT WINAPI MsiEnableLogW( DWORD dwLogMode, const WCHAR *szLogFile, DWORD attrib { TRACE( "%#lx, %s, %#lx\n", dwLogMode, debugstr_w(szLogFile), attributes ); - msi_free(gszLogFile); + free(gszLogFile); gszLogFile = NULL; if (szLogFile) { @@ -1915,7 +1913,7 @@ UINT WINAPI MsiEnableLogW( DWORD dwLogMode, const WCHAR *szLogFile, DWORD attrib FILE_ATTRIBUTE_NORMAL, NULL); if (file != INVALID_HANDLE_VALUE) { - gszLogFile = strdupW(szLogFile); + gszLogFile = wcsdup(szLogFile); CloseHandle(file); } else ERR( "unable to enable log %s (%lu)\n", debugstr_w(szLogFile), GetLastError() ); @@ -1938,9 +1936,9 @@ UINT WINAPI MsiEnumComponentCostsA( MSIHANDLE handle, const char *component, DWO if (component && !(componentW = strdupAtoW( component ))) return ERROR_OUTOFMEMORY; len = *buflen; - if (!(driveW = msi_alloc( len * sizeof(WCHAR) ))) + if (!(driveW = malloc( len * sizeof(WCHAR) ))) { - msi_free( componentW ); + free( componentW ); return ERROR_OUTOFMEMORY; } r = MsiEnumComponentCostsW( handle, componentW, index, state, driveW, buflen, cost, temp ); @@ -1948,8 +1946,8 @@ UINT WINAPI MsiEnumComponentCostsA( MSIHANDLE handle, const char *component, DWO { WideCharToMultiByte( CP_ACP, 0, driveW, -1, drive, len, NULL, NULL ); } - msi_free( componentW ); - msi_free( driveW ); + free( componentW ); + free( driveW ); return r; } @@ -2030,7 +2028,7 @@ UINT WINAPI MsiEnumComponentCostsW( MSIHANDLE handle, const WCHAR *component, DW GetWindowsDirectoryW( path, MAX_PATH ); if (component && component[0]) { - if (msi_is_global_assembly( comp )) *temp = comp->Cost; + if (msi_is_global_assembly( comp )) *temp = comp->cost; if (!comp->Enabled || !comp->KeyPath) { *cost = 0; @@ -2039,14 +2037,14 @@ UINT WINAPI MsiEnumComponentCostsW( MSIHANDLE handle, const WCHAR *component, DW } else if ((file = msi_get_loaded_file( package, comp->KeyPath ))) { - *cost = max( 8, comp->Cost / 512 ); + *cost = comp->cost; *buflen = set_drive( drive, file->TargetPath[0] ); r = ERROR_SUCCESS; } } else if (IStorage_Stat( package->db->storage, &stat, STATFLAG_NONAME ) == S_OK) { - *temp = max( 8, stat.cbSize.QuadPart / 512 ); + *temp = cost_from_size( stat.cbSize.QuadPart ); *buflen = set_drive( drive, path[0] ); r = ERROR_SUCCESS; } @@ -2075,14 +2073,14 @@ UINT WINAPI MsiQueryComponentStateA(LPCSTR szProductCode, r = MsiQueryComponentStateW(prodcode, usersid, dwContext, comp, pdwState); - msi_free(prodcode); - msi_free(usersid); - msi_free(comp); + free(prodcode); + free(usersid); + free(comp); return r; } -static BOOL msi_comp_find_prod_key(LPCWSTR prodcode, MSIINSTALLCONTEXT context) +static BOOL comp_find_prod_key(const WCHAR *prodcode, MSIINSTALLCONTEXT context) { UINT r; HKEY hkey = NULL; @@ -2092,7 +2090,7 @@ static BOOL msi_comp_find_prod_key(LPCWSTR prodcode, MSIINSTALLCONTEXT context) return (r == ERROR_SUCCESS); } -static BOOL msi_comp_find_package(LPCWSTR prodcode, MSIINSTALLCONTEXT context) +static BOOL comp_find_package(const WCHAR *prodcode, MSIINSTALLCONTEXT context) { LPCWSTR package; HKEY hkey; @@ -2116,9 +2114,8 @@ static BOOL msi_comp_find_package(LPCWSTR prodcode, MSIINSTALLCONTEXT context) return (res == ERROR_SUCCESS); } -static UINT msi_comp_find_prodcode(WCHAR *squashed_pc, - MSIINSTALLCONTEXT context, - LPCWSTR comp, LPWSTR val, DWORD *sz) +static UINT comp_find_prodcode(const WCHAR *squashed_pc, MSIINSTALLCONTEXT context, const WCHAR *comp, WCHAR *val, + DWORD *sz) { HKEY hkey; LONG res; @@ -2160,9 +2157,9 @@ UINT WINAPI MsiQueryComponentStateW(LPCWSTR szProductCode, if (!squash_guid( szProductCode, squashed_pc )) return ERROR_INVALID_PARAMETER; - found = msi_comp_find_prod_key(szProductCode, dwContext); + found = comp_find_prod_key(szProductCode, dwContext); - if (!msi_comp_find_package(szProductCode, dwContext)) + if (!comp_find_package(szProductCode, dwContext)) { if (found) { @@ -2176,7 +2173,7 @@ UINT WINAPI MsiQueryComponentStateW(LPCWSTR szProductCode, *pdwState = INSTALLSTATE_UNKNOWN; sz = 0; - if (msi_comp_find_prodcode( squashed_pc, dwContext, szComponent, NULL, &sz )) + if (comp_find_prodcode( squashed_pc, dwContext, szComponent, NULL, &sz )) return ERROR_UNKNOWN_COMPONENT; if (sz == 0) @@ -2186,10 +2183,10 @@ UINT WINAPI MsiQueryComponentStateW(LPCWSTR szProductCode, WCHAR *val; UINT r; - if (!(val = msi_alloc( sz ))) return ERROR_OUTOFMEMORY; - if ((r = msi_comp_find_prodcode( squashed_pc, dwContext, szComponent, val, &sz ))) + if (!(val = malloc( sz ))) return ERROR_OUTOFMEMORY; + if ((r = comp_find_prodcode( squashed_pc, dwContext, szComponent, val, &sz ))) { - msi_free(val); + free(val); return r; } @@ -2200,7 +2197,7 @@ UINT WINAPI MsiQueryComponentStateW(LPCWSTR szProductCode, } else *pdwState = INSTALLSTATE_LOCAL; - msi_free( val ); + free( val ); } TRACE("-> %d\n", *pdwState); @@ -2219,7 +2216,7 @@ INSTALLSTATE WINAPI MsiQueryProductStateA(LPCSTR szProduct) return ERROR_OUTOFMEMORY; } r = MsiQueryProductStateW( szwProduct ); - msi_free( szwProduct ); + free( szwProduct ); return r; } @@ -2404,7 +2401,7 @@ LANGID WINAPI MsiLoadStringA( MSIHANDLE handle, UINT id, LPSTR lpBuffer, LANGID r; INT len; - bufW = msi_alloc(nBufferMax*sizeof(WCHAR)); + bufW = malloc(nBufferMax * sizeof(WCHAR)); r = MsiLoadStringW(handle, id, bufW, nBufferMax, lang); if( r ) { @@ -2415,7 +2412,7 @@ LANGID WINAPI MsiLoadStringA( MSIHANDLE handle, UINT id, LPSTR lpBuffer, else r = 0; } - msi_free(bufW); + free(bufW); return r; } @@ -2521,7 +2518,7 @@ HRESULT WINAPI MsiGetFileSignatureInformationA( const char *path, DWORD flags, P if (path && !(pathW = strdupAtoW( path ))) return E_OUTOFMEMORY; r = MsiGetFileSignatureInformationW( pathW, flags, cert, hash, hashlen ); - msi_free( pathW ); + free( pathW ); return r; } @@ -2544,18 +2541,15 @@ HRESULT WINAPI MsiGetFileSignatureInformationW( const WCHAR *path, DWORD flags, info.hFile = NULL; info.pgKnownSubject = NULL; + memset( &data, 0, sizeof(data) ); data.cbStruct = sizeof(data); - data.pPolicyCallbackData = NULL; - data.pSIPClientData = NULL; data.dwUIChoice = WTD_UI_NONE; data.fdwRevocationChecks = WTD_REVOKE_WHOLECHAIN; data.dwUnionChoice = WTD_CHOICE_FILE; - data.u.pFile = &info; + data.pFile = &info; data.dwStateAction = WTD_STATEACTION_VERIFY; - data.hWVTStateData = NULL; - data.pwszURLReference = NULL; - data.dwProvFlags = 0; data.dwUIContext = WTD_UICONTEXT_INSTALL; + hr = WinVerifyTrustEx( INVALID_HANDLE_VALUE, &generic_verify_v2, &data ); *cert = NULL; if (FAILED(hr)) goto done; @@ -2618,7 +2612,7 @@ UINT WINAPI MsiGetProductPropertyA( MSIHANDLE hProduct, const char *szProperty, goto done; } - val = msi_alloc(++len * sizeof(WCHAR)); + val = malloc(++len * sizeof(WCHAR)); if (!val) { r = ERROR_OUTOFMEMORY; @@ -2644,8 +2638,8 @@ UINT WINAPI MsiGetProductPropertyA( MSIHANDLE hProduct, const char *szProperty, } done: - msi_free(prop); - msi_free(val); + free(prop); + free(val); return r; } @@ -2737,7 +2731,7 @@ UINT WINAPI MsiVerifyPackageA( LPCSTR szPackage ) r = MsiVerifyPackageW( szPack ); - msi_free( szPack ); + free( szPack ); return r; } @@ -2822,7 +2816,7 @@ static INSTALLSTATE MSI_GetComponentPath( const WCHAR *szProduct, const WCHAR *s if (open_userdata_comp_key( szComponent, szUserSid, ctx, &hkey )) { - msi_free(path); + free(path); path = msi_reg_get_val_str( hkey, squashed_pc ); RegCloseKey(hkey); @@ -2842,7 +2836,7 @@ static INSTALLSTATE MSI_GetComponentPath( const WCHAR *szProduct, const WCHAR *s if (msi_strcpy_to_awstring(path, -1, lpPathBuf, pcchBuf) == ERROR_MORE_DATA) state = INSTALLSTATE_MOREDATA; - msi_free(path); + free(path); return state; } @@ -2883,9 +2877,9 @@ INSTALLSTATE WINAPI MsiGetComponentPathExA( LPCSTR product, LPCSTR comp, LPCSTR r = MSI_GetComponentPath( productW, compW, usersidW, ctx, &path, buflen ); end: - msi_free( productW ); - msi_free( compW ); - msi_free( usersidW ); + free( productW ); + free( compW ); + free( usersidW ); return r; } @@ -2926,7 +2920,7 @@ static UINT query_feature_state( const WCHAR *product, const WCHAR *squashed, co if (!parent) return ERROR_UNKNOWN_FEATURE; *state = (parent[0] == 6) ? INSTALLSTATE_ABSENT : INSTALLSTATE_LOCAL; - msi_free( parent ); + free( parent ); if (*state == INSTALLSTATE_ABSENT) return ERROR_SUCCESS; @@ -2951,7 +2945,7 @@ static UINT query_feature_state( const WCHAR *product, const WCHAR *squashed, co if (!decode_base85_guid( p, &guid )) { if (p != components) break; - msi_free( components ); + free( components ); *state = INSTALLSTATE_BADCONFIG; return ERROR_BAD_CONFIGURATION; } @@ -2963,7 +2957,7 @@ static UINT query_feature_state( const WCHAR *product, const WCHAR *squashed, co if (r != ERROR_SUCCESS) { - msi_free( components ); + free( components ); *state = INSTALLSTATE_ADVERTISED; return ERROR_SUCCESS; } @@ -2975,9 +2969,9 @@ static UINT query_feature_state( const WCHAR *product, const WCHAR *squashed, co { source = TRUE; } - msi_free( path ); + free( path ); } - msi_free( components ); + free( components ); if (missing) *state = INSTALLSTATE_ADVERTISED; @@ -2999,19 +2993,19 @@ UINT WINAPI MsiQueryFeatureStateExA( LPCSTR product, LPCSTR usersid, MSIINSTALLC if (product && !(productW = strdupAtoW( product ))) return ERROR_OUTOFMEMORY; if (usersid && !(usersidW = strdupAtoW( usersid ))) { - msi_free( productW ); + free( productW ); return ERROR_OUTOFMEMORY; } if (feature && !(featureW = strdupAtoW( feature ))) { - msi_free( productW ); - msi_free( usersidW ); + free( productW ); + free( usersidW ); return ERROR_OUTOFMEMORY; } r = MsiQueryFeatureStateExW( productW, usersidW, ctx, featureW, state ); - msi_free( productW ); - msi_free( usersidW ); - msi_free( featureW ); + free( productW ); + free( usersidW ); + free( featureW ); return r; } @@ -3042,8 +3036,8 @@ INSTALLSTATE WINAPI MsiQueryFeatureStateA(LPCSTR szProduct, LPCSTR szFeature) rc = MsiQueryFeatureStateW(szwProduct, szwFeature); end: - msi_free( szwProduct); - msi_free( szwFeature); + free(szwProduct); + free(szwFeature); return rc; } @@ -3110,14 +3104,14 @@ UINT WINAPI MsiGetFileVersionA(LPCSTR szFilePath, LPSTR lpVersionBuf, if( lpVersionBuf && pcchVersionBuf && *pcchVersionBuf ) { - lpwVersionBuff = msi_alloc(*pcchVersionBuf*sizeof(WCHAR)); + lpwVersionBuff = malloc(*pcchVersionBuf * sizeof(WCHAR)); if( !lpwVersionBuff ) goto end; } if( lpLangBuf && pcchLangBuf && *pcchLangBuf ) { - lpwLangBuff = msi_alloc(*pcchLangBuf*sizeof(WCHAR)); + lpwLangBuff = malloc(*pcchLangBuf * sizeof(WCHAR)); if( !lpwLangBuff ) goto end; } @@ -3133,9 +3127,9 @@ UINT WINAPI MsiGetFileVersionA(LPCSTR szFilePath, LPSTR lpVersionBuf, lpLangBuf, *pcchLangBuf + 1, NULL, NULL); end: - msi_free(szwFilePath); - msi_free(lpwVersionBuff); - msi_free(lpwLangBuff); + free(szwFilePath); + free(lpwVersionBuff); + free(lpwLangBuff); return ret; } @@ -3158,15 +3152,15 @@ static UINT get_file_version( const WCHAR *path, WCHAR *verbuf, DWORD *verlen, if (error == ERROR_RESOURCE_DATA_NOT_FOUND) return ERROR_FILE_INVALID; return error; } - if (!(version = msi_alloc( len ))) return ERROR_OUTOFMEMORY; + if (!(version = malloc( len ))) return ERROR_OUTOFMEMORY; if (!GetFileVersionInfoW( path, 0, len, version )) { - msi_free( version ); + free( version ); return GetLastError(); } if (!verbuf && !verlen && !langbuf && !langlen) { - msi_free( version ); + free( version ); return ERROR_SUCCESS; } if (verlen) @@ -3203,7 +3197,7 @@ static UINT get_file_version( const WCHAR *path, WCHAR *verbuf, DWORD *verlen, *langlen = 0; } } - msi_free( version ); + free( version ); return ret; } @@ -3234,7 +3228,7 @@ UINT WINAPI MsiGetFileVersionW( const WCHAR *path, WCHAR *verbuf, DWORD *verlen, ret = ERROR_SUCCESS; } *verlen = len; - msi_free( version ); + free( version ); } return ret; } @@ -3273,8 +3267,8 @@ UINT WINAPI MsiGetFeatureUsageA( LPCSTR szProduct, LPCSTR szFeature, ret = MsiGetFeatureUsageW( prod, feat, pdwUseCount, pwDateUsed ); end: - msi_free( prod ); - msi_free( feat ); + free( prod ); + free( feat ); return ret; } @@ -3325,8 +3319,8 @@ INSTALLSTATE WINAPI MsiUseFeatureExA( const char *szProduct, const char *szFeatu ret = MsiUseFeatureExW( prod, feat, dwInstallMode, dwReserved ); end: - msi_free( prod ); - msi_free( feat ); + free( prod ); + free( feat ); return ret; } @@ -3352,7 +3346,7 @@ static WCHAR *reg_get_multisz( HKEY hkey, const WCHAR *name ) WCHAR *ret; DWORD len, type; if (RegQueryValueExW( hkey, name, NULL, &type, NULL, &len ) || type != REG_MULTI_SZ) return NULL; - if ((ret = msi_alloc( len ))) RegQueryValueExW( hkey, name, NULL, NULL, (BYTE *)ret, &len ); + if ((ret = malloc( len ))) RegQueryValueExW( hkey, name, NULL, NULL, (BYTE *)ret, &len ); return ret; } @@ -3361,7 +3355,7 @@ static WCHAR *reg_get_sz( HKEY hkey, const WCHAR *name ) WCHAR *ret; DWORD len, type; if (RegQueryValueExW( hkey, name, NULL, &type, NULL, &len ) || type != REG_SZ) return NULL; - if ((ret = msi_alloc( len ))) RegQueryValueExW( hkey, name, NULL, NULL, (BYTE *)ret, &len ); + if ((ret = malloc( len ))) RegQueryValueExW( hkey, name, NULL, NULL, (BYTE *)ret, &len ); return ret; } @@ -3390,7 +3384,7 @@ static UINT MSI_ProvideQualifiedComponentEx(LPCWSTR szComponent, /* FIXME: handle multiple descriptors */ ret = MsiDecomposeDescriptorW( desc, product, feature, comp, &size ); - msi_free( desc ); + free( desc ); if (ret != ERROR_SUCCESS) return ret; if (!szProduct) szProduct = product; @@ -3412,10 +3406,10 @@ static UINT MSI_ProvideQualifiedComponentEx(LPCWSTR szComponent, if (lstrlenW( components ) < BASE85_SIZE || !decode_base85_guid( components, &guid )) { - msi_free( components ); + free( components ); return ERROR_FILE_NOT_FOUND; } - msi_free( components ); + free( components ); StringFromGUID2( &guid, comp, ARRAY_SIZE( comp )); } @@ -3478,9 +3472,9 @@ UINT WINAPI MsiProvideQualifiedComponentExA( const char *szComponent, const char dwInstallMode, szwProduct, Unused1, Unused2, &path, pcchPathBuf); end: - msi_free(szwProduct); - msi_free(szwComponent); - msi_free(szwQualifier); + free(szwProduct); + free(szwComponent); + free(szwQualifier); return r; } @@ -3601,9 +3595,9 @@ static USERINFOSTATE MSI_GetUserInfo(LPCWSTR szProduct, } done: - msi_free(user); - msi_free(org); - msi_free(serial); + free(user); + free(org); + free(serial); return state; } @@ -3664,7 +3658,7 @@ USERINFOSTATE WINAPI MsiGetUserInfoA(LPCSTR szProduct, &org, pcchOrgNameBuf, &serial, pcchSerialBuf ); - msi_free( prod ); + free( prod ); return r; } @@ -3740,8 +3734,8 @@ UINT WINAPI MsiConfigureFeatureA(LPCSTR szProduct, LPCSTR szFeature, INSTALLSTAT r = MsiConfigureFeatureW(prod, feat, eInstallState); end: - msi_free(feat); - msi_free(prod); + free(feat); + free(prod); return r; } @@ -3855,7 +3849,7 @@ UINT WINAPI MsiGetShortcutTargetA( LPCSTR szShortcutTarget, feature[0] = 0; component[0] = 0; r = MsiGetShortcutTargetW( target, product, feature, component ); - msi_free( target ); + free( target ); if (r == ERROR_SUCCESS) { WideCharToMultiByte( CP_ACP, 0, product, -1, szProductCode, len, NULL, NULL ); @@ -3978,7 +3972,7 @@ UINT WINAPI MsiReinstallFeatureW( const WCHAR *szProduct, const WCHAR *szFeature sz = (lstrlenW( L"%s=%s %s=%s" ) + lstrlenW( L"REINSTALLMODE" ) + lstrlenW( reinstallmode )) * sizeof(WCHAR); sz += (lstrlenW( L"REINSTALL" ) + lstrlenW( szFeature )) * sizeof(WCHAR); - if (!(cmdline = msi_alloc( sz ))) + if (!(cmdline = malloc( sz ))) { msiobj_release( &package->hdr ); return ERROR_OUTOFMEMORY; @@ -3987,7 +3981,7 @@ UINT WINAPI MsiReinstallFeatureW( const WCHAR *szProduct, const WCHAR *szFeature r = MSI_InstallPackage( package, sourcepath, cmdline ); msiobj_release( &package->hdr ); - msi_free( cmdline ); + free( cmdline ); return r; } @@ -4004,22 +3998,22 @@ UINT WINAPI MsiReinstallFeatureA( const char *szProduct, const char *szFeature, rc = MsiReinstallFeatureW(wszProduct, wszFeature, dwReinstallMode); - msi_free(wszProduct); - msi_free(wszFeature); + free(wszProduct); + free(wszFeature); return rc; } -typedef struct +struct md5_ctx { unsigned int i[2]; unsigned int buf[4]; unsigned char in[64]; unsigned char digest[16]; -} MD5_CTX; +}; -extern VOID WINAPI MD5Init( MD5_CTX *); -extern VOID WINAPI MD5Update( MD5_CTX *, const unsigned char *, unsigned int ); -extern VOID WINAPI MD5Final( MD5_CTX *); +extern void WINAPI MD5Init( struct md5_ctx * ); +extern void WINAPI MD5Update( struct md5_ctx *, const unsigned char *, unsigned int ); +extern void WINAPI MD5Final( struct md5_ctx * ); UINT msi_get_filehash( MSIPACKAGE *package, const WCHAR *path, MSIFILEHASHINFO *hash ) { @@ -4043,7 +4037,7 @@ UINT msi_get_filehash( MSIPACKAGE *package, const WCHAR *path, MSIFILEHASHINFO * { if ((p = MapViewOfFile( mapping, FILE_MAP_READ, 0, 0, length ))) { - MD5_CTX ctx; + struct md5_ctx ctx; MD5Init( &ctx ); MD5Update( &ctx, p, length ); @@ -4105,7 +4099,7 @@ UINT WINAPI MsiGetFileHashA( const char *szFilePath, DWORD dwOptions, MSIFILEHAS return ERROR_OUTOFMEMORY; r = MsiGetFileHashW( file, dwOptions, pHash ); - msi_free( file ); + free( file ); return r; } @@ -4182,13 +4176,13 @@ UINT WINAPI MsiInstallMissingComponentA( LPCSTR product, LPCSTR component, INSTA if (component && !(componentW = strdupAtoW( component ))) { - msi_free( productW ); + free( productW ); return ERROR_OUTOFMEMORY; } r = MsiInstallMissingComponentW( productW, componentW, state ); - msi_free( productW ); - msi_free( componentW ); + free( productW ); + free( componentW ); return r; } @@ -4220,7 +4214,7 @@ UINT WINAPI MsiProvideComponentA( const char *product, const char *feature, cons if (r != ERROR_SUCCESS) goto done; - if (!(bufW = msi_alloc( ++lenW * sizeof(WCHAR) ))) + if (!(bufW = malloc( ++lenW * sizeof(WCHAR) ))) { r = ERROR_OUTOFMEMORY; goto done; @@ -4242,10 +4236,10 @@ UINT WINAPI MsiProvideComponentA( const char *product, const char *feature, cons *buflen = len - 1; done: - msi_free( productW ); - msi_free( featureW ); - msi_free( componentW ); - msi_free( bufW ); + free( productW ); + free( featureW ); + free( componentW ); + free( bufW ); return r; } @@ -4306,7 +4300,7 @@ UINT WINAPI MsiBeginTransactionA( const char *name, DWORD attrs, MSIHANDLE *id, return ERROR_OUTOFMEMORY; r = MsiBeginTransactionW( nameW, attrs, id, event ); - msi_free( nameW ); + free( nameW ); return r; } diff --git a/dll/win32/msi/msi_main.c b/dll/win32/msi/msi_main.c index 738d9272cd9a3..a2b6b6a05035d 100644 --- a/dll/win32/msi/msi_main.c +++ b/dll/win32/msi/msi_main.c @@ -80,27 +80,28 @@ BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved) if (lpvReserved) break; msi_dialog_unregister_class(); msi_free_handle_table(); - msi_free( gszLogFile ); + free( gszLogFile ); release_typelib(); break; } return TRUE; } -typedef struct tagIClassFactoryImpl { +struct class_factory +{ IClassFactory IClassFactory_iface; - HRESULT (*create_object)( IUnknown*, LPVOID* ); -} IClassFactoryImpl; + HRESULT (*create_object)( IUnknown *, void ** ); +}; -static inline IClassFactoryImpl *impl_from_IClassFactory(IClassFactory *iface) +static inline struct class_factory *impl_from_IClassFactory(IClassFactory *iface) { - return CONTAINING_RECORD(iface, IClassFactoryImpl, IClassFactory_iface); + return CONTAINING_RECORD(iface, struct class_factory, IClassFactory_iface); } static HRESULT WINAPI MsiCF_QueryInterface(LPCLASSFACTORY iface, REFIID riid,LPVOID *ppobj) { - IClassFactoryImpl *This = impl_from_IClassFactory(iface); + struct class_factory *This = impl_from_IClassFactory(iface); TRACE("%p %s %p\n",This,debugstr_guid(riid),ppobj); @@ -129,7 +130,7 @@ static ULONG WINAPI MsiCF_Release(LPCLASSFACTORY iface) static HRESULT WINAPI MsiCF_CreateInstance(LPCLASSFACTORY iface, LPUNKNOWN pOuter, REFIID riid, LPVOID *ppobj) { - IClassFactoryImpl *This = impl_from_IClassFactory(iface); + struct class_factory *This = impl_from_IClassFactory(iface); IUnknown *unk = NULL; HRESULT r; @@ -165,7 +166,7 @@ static const IClassFactoryVtbl MsiCF_Vtbl = MsiCF_LockServer }; -static IClassFactoryImpl MsiServer_CF = { { &MsiCF_Vtbl }, create_msiserver }; +static struct class_factory MsiServer_CF = { { &MsiCF_Vtbl }, create_msiserver }; /****************************************************************** * DllGetClassObject [MSI.@] diff --git a/dll/win32/msi/msipriv.h b/dll/win32/msi/msipriv.h index 7a86b32d6babd..24a4f7ccef6ec 100644 --- a/dll/win32/msi/msipriv.h +++ b/dll/win32/msi/msipriv.h @@ -42,7 +42,7 @@ #include "winemsi_s.h" static const BOOL is_64bit = sizeof(void *) > sizeof(int); -extern BOOL is_wow64 DECLSPEC_HIDDEN; +extern BOOL is_wow64; #define MSI_DATASIZEMASK 0x00ff #define MSITYPE_VALID 0x0100 @@ -456,7 +456,7 @@ typedef struct tagMSIPACKAGE float center_y; UINT WordCount; - UINT Context; + MSIINSTALLCONTEXT Context; struct list subscriptions; @@ -515,7 +515,6 @@ typedef struct tagMSIASSEMBLY DWORD attributes; LPWSTR display_name; LPWSTR tempdir; - BOOL installed; BOOL clr_version[CLR_VERSION_MAX]; } MSIASSEMBLY; @@ -533,7 +532,8 @@ typedef struct tagMSICOMPONENT INSTALLSTATE Action; BOOL ForceLocalState; BOOL Enabled; - INT Cost; + /* Cost is in 512-byte units, as returned from MsiEnumComponentCosts() et al. */ + int cost; INT RefCount; LPWSTR FullKeypath; LPWSTR AdvertiseString; @@ -752,223 +752,225 @@ typedef struct { } str; } awcstring; -UINT msi_strcpy_to_awstring(const WCHAR *, int, awstring *, DWORD *) DECLSPEC_HIDDEN; +UINT msi_strcpy_to_awstring(const WCHAR *, int, awstring *, DWORD *); /* msi server interface */ -extern MSIHANDLE msi_get_remote(MSIHANDLE handle) DECLSPEC_HIDDEN; -extern LONG WINAPI rpc_filter(EXCEPTION_POINTERS *eptr) DECLSPEC_HIDDEN; +extern MSIHANDLE msi_get_remote(MSIHANDLE handle); +extern LONG WINAPI rpc_filter(EXCEPTION_POINTERS *eptr); /* handle functions */ -extern void *msihandle2msiinfo(MSIHANDLE handle, UINT type) DECLSPEC_HIDDEN; -extern MSIHANDLE alloc_msihandle( MSIOBJECTHDR * ) DECLSPEC_HIDDEN; -extern MSIHANDLE alloc_msi_remote_handle(MSIHANDLE remote) DECLSPEC_HIDDEN; -extern void *alloc_msiobject(UINT type, UINT size, msihandledestructor destroy ) DECLSPEC_HIDDEN; -extern void msiobj_addref(MSIOBJECTHDR *) DECLSPEC_HIDDEN; -extern int msiobj_release(MSIOBJECTHDR *) DECLSPEC_HIDDEN; -extern void msiobj_lock(MSIOBJECTHDR *) DECLSPEC_HIDDEN; -extern void msiobj_unlock(MSIOBJECTHDR *) DECLSPEC_HIDDEN; -extern void msi_free_handle_table(void) DECLSPEC_HIDDEN; +extern void *msihandle2msiinfo(MSIHANDLE handle, UINT type); +extern MSIHANDLE alloc_msihandle( MSIOBJECTHDR * ); +extern MSIHANDLE alloc_msi_remote_handle(MSIHANDLE remote); +extern void *alloc_msiobject(UINT type, UINT size, msihandledestructor destroy ); +extern void msiobj_addref(MSIOBJECTHDR *); +extern int msiobj_release(MSIOBJECTHDR *); +extern void msiobj_lock(MSIOBJECTHDR *); +extern void msiobj_unlock(MSIOBJECTHDR *); +extern void msi_free_handle_table(void); -extern void free_cached_tables( MSIDATABASE *db ) DECLSPEC_HIDDEN; -extern UINT MSI_CommitTables( MSIDATABASE *db ) DECLSPEC_HIDDEN; -extern UINT msi_commit_streams( MSIDATABASE *db ) DECLSPEC_HIDDEN; +extern void free_cached_tables( MSIDATABASE *db ); +extern UINT MSI_CommitTables( MSIDATABASE *db ); +extern UINT msi_commit_streams( MSIDATABASE *db ); /* string table functions */ -extern BOOL msi_add_string( string_table *st, const WCHAR *data, int len, BOOL persistent ) DECLSPEC_HIDDEN; -extern UINT msi_string2id( const string_table *st, const WCHAR *data, int len, UINT *id ) DECLSPEC_HIDDEN; -extern VOID msi_destroy_stringtable( string_table *st ) DECLSPEC_HIDDEN; -extern const WCHAR *msi_string_lookup( const string_table *st, UINT id, int *len ) DECLSPEC_HIDDEN; -extern HRESULT msi_init_string_table( IStorage *stg ) DECLSPEC_HIDDEN; -extern string_table *msi_load_string_table( IStorage *stg, UINT *bytes_per_strref ) DECLSPEC_HIDDEN; -extern UINT msi_save_string_table( const string_table *st, IStorage *storage, UINT *bytes_per_strref ) DECLSPEC_HIDDEN; -extern UINT msi_get_string_table_codepage( const string_table *st ) DECLSPEC_HIDDEN; -extern UINT msi_set_string_table_codepage( string_table *st, UINT codepage ) DECLSPEC_HIDDEN; -extern WCHAR *msi_strdupW( const WCHAR *value, int len ) DECLSPEC_HIDDEN; - -extern BOOL TABLE_Exists( MSIDATABASE *db, LPCWSTR name ) DECLSPEC_HIDDEN; -extern MSICONDITION MSI_DatabaseIsTablePersistent( MSIDATABASE *db, LPCWSTR table ) DECLSPEC_HIDDEN; +extern BOOL msi_add_string( string_table *st, const WCHAR *data, int len, BOOL persistent ); +extern UINT msi_string2id( const string_table *st, const WCHAR *data, int len, UINT *id ); +extern VOID msi_destroy_stringtable( string_table *st ); +extern const WCHAR *msi_string_lookup( const string_table *st, UINT id, int *len ); +extern HRESULT msi_init_string_table( IStorage *stg ); +extern string_table *msi_load_string_table( IStorage *stg, UINT *bytes_per_strref ); +extern UINT msi_save_string_table( const string_table *st, IStorage *storage, UINT *bytes_per_strref ); +extern UINT msi_get_string_table_codepage( const string_table *st ); +extern UINT msi_set_string_table_codepage( string_table *st, UINT codepage ); +extern WCHAR *msi_strdupW( const WCHAR *value, int len ); + +extern BOOL TABLE_Exists( MSIDATABASE *db, LPCWSTR name ); +extern MSICONDITION MSI_DatabaseIsTablePersistent( MSIDATABASE *db, LPCWSTR table ); extern UINT read_stream_data( IStorage *stg, LPCWSTR stname, BOOL table, - BYTE **pdata, UINT *psz ) DECLSPEC_HIDDEN; + BYTE **pdata, UINT *psz ); extern UINT write_stream_data( IStorage *stg, LPCWSTR stname, - LPCVOID data, UINT sz, BOOL bTable ) DECLSPEC_HIDDEN; + LPCVOID data, UINT sz, BOOL bTable ); /* transform functions */ -extern UINT msi_table_apply_transform( MSIDATABASE *db, IStorage *stg, int err_cond ) DECLSPEC_HIDDEN; +extern UINT msi_table_apply_transform( MSIDATABASE *db, IStorage *stg, int err_cond ); extern UINT MSI_DatabaseApplyTransformW( MSIDATABASE *db, - LPCWSTR szTransformFile, int iErrorCond ) DECLSPEC_HIDDEN; -extern void append_storage_to_db( MSIDATABASE *db, IStorage *stg ) DECLSPEC_HIDDEN; -extern UINT msi_apply_transforms( MSIPACKAGE *package ) DECLSPEC_HIDDEN; + LPCWSTR szTransformFile, int iErrorCond ); +extern void append_storage_to_db( MSIDATABASE *db, IStorage *stg ); +extern UINT msi_apply_transforms( MSIPACKAGE *package ); /* patch functions */ -extern UINT msi_check_patch_applicable( MSIPACKAGE *package, MSISUMMARYINFO *si ) DECLSPEC_HIDDEN; -extern UINT msi_apply_patches( MSIPACKAGE *package ) DECLSPEC_HIDDEN; -extern UINT msi_apply_registered_patch( MSIPACKAGE *package, LPCWSTR patch_code ) DECLSPEC_HIDDEN; -extern void msi_free_patchinfo( MSIPATCHINFO *patch ) DECLSPEC_HIDDEN; +extern UINT msi_check_patch_applicable( MSIPACKAGE *package, MSISUMMARYINFO *si ); +extern UINT msi_apply_patches( MSIPACKAGE *package ); +extern UINT msi_apply_registered_patch( MSIPACKAGE *package, LPCWSTR patch_code ); +extern void msi_free_patchinfo( MSIPATCHINFO *patch ); +extern UINT msi_patch_assembly( MSIPACKAGE *, MSIASSEMBLY *, MSIFILEPATCH * ); /* action internals */ -extern UINT MSI_InstallPackage( MSIPACKAGE *, LPCWSTR, LPCWSTR ) DECLSPEC_HIDDEN; -extern INT ACTION_ShowDialog( MSIPACKAGE*, LPCWSTR) DECLSPEC_HIDDEN; -extern INT ACTION_DialogBox( MSIPACKAGE*, LPCWSTR) DECLSPEC_HIDDEN; -extern UINT ACTION_ForceReboot(MSIPACKAGE *package) DECLSPEC_HIDDEN; -extern UINT MSI_Sequence( MSIPACKAGE *package, LPCWSTR szTable ) DECLSPEC_HIDDEN; -extern UINT MSI_SetFeatureStates( MSIPACKAGE *package ) DECLSPEC_HIDDEN; -extern UINT msi_parse_command_line( MSIPACKAGE *package, LPCWSTR szCommandLine, BOOL preserve_case ) DECLSPEC_HIDDEN; -extern const WCHAR *msi_get_command_line_option( const WCHAR *cmd, const WCHAR *option, UINT *len ) DECLSPEC_HIDDEN; -extern UINT msi_schedule_action( MSIPACKAGE *package, UINT script, const WCHAR *action ) DECLSPEC_HIDDEN; -extern INSTALLSTATE msi_get_component_action( MSIPACKAGE *package, MSICOMPONENT *comp ) DECLSPEC_HIDDEN; -extern INSTALLSTATE msi_get_feature_action( MSIPACKAGE *package, MSIFEATURE *feature ) DECLSPEC_HIDDEN; -extern UINT msi_load_all_components( MSIPACKAGE *package ) DECLSPEC_HIDDEN; -extern UINT msi_load_all_features( MSIPACKAGE *package ) DECLSPEC_HIDDEN; -extern UINT msi_validate_product_id( MSIPACKAGE *package ) DECLSPEC_HIDDEN; +extern UINT MSI_InstallPackage( MSIPACKAGE *, LPCWSTR, LPCWSTR ); +extern INT ACTION_ShowDialog( MSIPACKAGE*, LPCWSTR); +extern INT ACTION_DialogBox( MSIPACKAGE*, LPCWSTR); +extern UINT ACTION_ForceReboot(MSIPACKAGE *package); +extern UINT MSI_Sequence( MSIPACKAGE *package, LPCWSTR szTable ); +extern UINT MSI_SetFeatureStates( MSIPACKAGE *package ); +extern UINT msi_parse_command_line( MSIPACKAGE *package, LPCWSTR szCommandLine, BOOL preserve_case ); +extern const WCHAR *msi_get_command_line_option( const WCHAR *cmd, const WCHAR *option, UINT *len ); +extern UINT msi_schedule_action( MSIPACKAGE *package, UINT script, const WCHAR *action ); +extern INSTALLSTATE msi_get_component_action( MSIPACKAGE *package, MSICOMPONENT *comp ); +extern INSTALLSTATE msi_get_feature_action( MSIPACKAGE *package, MSIFEATURE *feature ); +extern UINT msi_load_all_components( MSIPACKAGE *package ); +extern UINT msi_load_all_features( MSIPACKAGE *package ); +extern UINT msi_validate_product_id( MSIPACKAGE *package ); /* record internals */ -extern void MSI_CloseRecord( MSIOBJECTHDR * ) DECLSPEC_HIDDEN; -extern UINT MSI_RecordSetIStream( MSIRECORD *, UINT, IStream *) DECLSPEC_HIDDEN; -extern UINT MSI_RecordGetIStream( MSIRECORD *, UINT, IStream **) DECLSPEC_HIDDEN; -extern const WCHAR *MSI_RecordGetString( const MSIRECORD *, UINT ) DECLSPEC_HIDDEN; -extern MSIRECORD *MSI_CreateRecord( UINT ) DECLSPEC_HIDDEN; -extern UINT MSI_RecordSetInteger( MSIRECORD *, UINT, int ) DECLSPEC_HIDDEN; -extern UINT MSI_RecordSetStringW( MSIRECORD *, UINT, LPCWSTR ) DECLSPEC_HIDDEN; -extern BOOL MSI_RecordIsNull( MSIRECORD *, UINT ) DECLSPEC_HIDDEN; -extern UINT MSI_RecordGetStringW( MSIRECORD * , UINT, LPWSTR, LPDWORD) DECLSPEC_HIDDEN; -extern UINT MSI_RecordGetStringA( MSIRECORD *, UINT, LPSTR, LPDWORD) DECLSPEC_HIDDEN; -extern int MSI_RecordGetInteger( MSIRECORD *, UINT ) DECLSPEC_HIDDEN; -extern UINT MSI_RecordReadStream( MSIRECORD *, UINT, char *, LPDWORD) DECLSPEC_HIDDEN; -extern UINT MSI_RecordSetStream(MSIRECORD *, UINT, IStream *) DECLSPEC_HIDDEN; -extern UINT MSI_RecordGetFieldCount( const MSIRECORD *rec ) DECLSPEC_HIDDEN; -extern UINT MSI_RecordStreamToFile( MSIRECORD *, UINT, LPCWSTR ) DECLSPEC_HIDDEN; -extern UINT MSI_RecordSetStreamFromFileW( MSIRECORD *, UINT, LPCWSTR ) DECLSPEC_HIDDEN; -extern UINT MSI_RecordCopyField( MSIRECORD *, UINT, MSIRECORD *, UINT ) DECLSPEC_HIDDEN; -extern MSIRECORD *MSI_CloneRecord( MSIRECORD * ) DECLSPEC_HIDDEN; -extern BOOL MSI_RecordsAreEqual( MSIRECORD *, MSIRECORD * ) DECLSPEC_HIDDEN; -extern BOOL MSI_RecordsAreFieldsEqual(MSIRECORD *a, MSIRECORD *b, UINT field) DECLSPEC_HIDDEN; -extern UINT msi_record_set_string(MSIRECORD *, UINT, const WCHAR *, int) DECLSPEC_HIDDEN; -extern const WCHAR *msi_record_get_string(const MSIRECORD *, UINT, int *) DECLSPEC_HIDDEN; -extern void dump_record(MSIRECORD *) DECLSPEC_HIDDEN; -extern UINT unmarshal_record(const struct wire_record *in, MSIHANDLE *out) DECLSPEC_HIDDEN; -extern struct wire_record *marshal_record(MSIHANDLE handle) DECLSPEC_HIDDEN; -extern void free_remote_record(struct wire_record *rec) DECLSPEC_HIDDEN; -extern UINT copy_remote_record(const struct wire_record *rec, MSIHANDLE handle) DECLSPEC_HIDDEN; +extern void MSI_CloseRecord( MSIOBJECTHDR * ); +extern UINT MSI_RecordSetIStream( MSIRECORD *, UINT, IStream *); +extern UINT MSI_RecordGetIStream( MSIRECORD *, UINT, IStream **); +extern const WCHAR *MSI_RecordGetString( const MSIRECORD *, UINT ); +extern MSIRECORD *MSI_CreateRecord( UINT ); +extern UINT MSI_RecordSetInteger( MSIRECORD *, UINT, int ); +extern UINT MSI_RecordSetStringW( MSIRECORD *, UINT, LPCWSTR ); +extern BOOL MSI_RecordIsNull( MSIRECORD *, UINT ); +extern UINT MSI_RecordGetStringW( MSIRECORD * , UINT, LPWSTR, LPDWORD); +extern UINT MSI_RecordGetStringA( MSIRECORD *, UINT, LPSTR, LPDWORD); +extern int MSI_RecordGetInteger( MSIRECORD *, UINT ); +extern UINT MSI_RecordReadStream( MSIRECORD *, UINT, char *, LPDWORD); +extern UINT MSI_RecordSetStream(MSIRECORD *, UINT, IStream *); +extern UINT MSI_RecordGetFieldCount( const MSIRECORD *rec ); +extern UINT MSI_RecordStreamToFile( MSIRECORD *, UINT, LPCWSTR ); +extern UINT MSI_RecordSetStreamFromFileW( MSIRECORD *, UINT, LPCWSTR ); +extern UINT MSI_RecordCopyField( MSIRECORD *, UINT, MSIRECORD *, UINT ); +extern MSIRECORD *MSI_CloneRecord( MSIRECORD * ); +extern BOOL MSI_RecordsAreEqual( MSIRECORD *, MSIRECORD * ); +extern BOOL MSI_RecordsAreFieldsEqual(MSIRECORD *a, MSIRECORD *b, UINT field); +extern UINT msi_record_set_string(MSIRECORD *, UINT, const WCHAR *, int); +extern const WCHAR *msi_record_get_string(const MSIRECORD *, UINT, int *); +extern void dump_record(MSIRECORD *); +extern UINT unmarshal_record(const struct wire_record *in, MSIHANDLE *out); +extern struct wire_record *marshal_record(MSIHANDLE handle); +extern void free_remote_record(struct wire_record *rec); +extern UINT copy_remote_record(const struct wire_record *rec, MSIHANDLE handle); /* stream internals */ -extern void enum_stream_names( IStorage *stg ) DECLSPEC_HIDDEN; -extern LPWSTR encode_streamname(BOOL bTable, LPCWSTR in) DECLSPEC_HIDDEN; -extern BOOL decode_streamname(LPCWSTR in, LPWSTR out) DECLSPEC_HIDDEN; +extern void enum_stream_names( IStorage *stg ); +extern WCHAR *encode_streamname(BOOL is_table, const WCHAR *in); +extern BOOL decode_streamname(LPCWSTR in, LPWSTR out); /* database internals */ -extern UINT msi_get_stream( MSIDATABASE *, const WCHAR *, IStream ** ) DECLSPEC_HIDDEN; -extern UINT MSI_OpenDatabaseW( LPCWSTR, LPCWSTR, MSIDATABASE ** ) DECLSPEC_HIDDEN; -extern UINT MSI_DatabaseOpenViewW(MSIDATABASE *, LPCWSTR, MSIQUERY ** ) DECLSPEC_HIDDEN; -extern UINT WINAPIV MSI_OpenQuery( MSIDATABASE *, MSIQUERY **, LPCWSTR, ... ) DECLSPEC_HIDDEN; +extern UINT msi_get_stream( MSIDATABASE *, const WCHAR *, IStream ** ); +extern UINT MSI_OpenDatabaseW( LPCWSTR, LPCWSTR, MSIDATABASE ** ); +extern UINT MSI_DatabaseOpenViewW(MSIDATABASE *, LPCWSTR, MSIQUERY ** ); +extern UINT WINAPIV MSI_OpenQuery( MSIDATABASE *, MSIQUERY **, LPCWSTR, ... ); typedef UINT (*record_func)( MSIRECORD *, LPVOID ); -extern UINT MSI_IterateRecords( MSIQUERY *, LPDWORD, record_func, LPVOID ) DECLSPEC_HIDDEN; -extern MSIRECORD * WINAPIV MSI_QueryGetRecord( MSIDATABASE *db, LPCWSTR query, ... ) DECLSPEC_HIDDEN; -extern UINT MSI_DatabaseGetPrimaryKeys( MSIDATABASE *, LPCWSTR, MSIRECORD ** ) DECLSPEC_HIDDEN; +extern UINT MSI_IterateRecords( MSIQUERY *, LPDWORD, record_func, LPVOID ); +extern MSIRECORD * WINAPIV MSI_QueryGetRecord( MSIDATABASE *db, LPCWSTR query, ... ); +extern UINT MSI_DatabaseGetPrimaryKeys( MSIDATABASE *, LPCWSTR, MSIRECORD ** ); /* view internals */ -extern UINT MSI_ViewExecute( MSIQUERY*, MSIRECORD * ) DECLSPEC_HIDDEN; -extern UINT MSI_ViewFetch( MSIQUERY*, MSIRECORD ** ) DECLSPEC_HIDDEN; -extern UINT MSI_ViewClose( MSIQUERY* ) DECLSPEC_HIDDEN; -extern UINT MSI_ViewGetColumnInfo(MSIQUERY *, MSICOLINFO, MSIRECORD **) DECLSPEC_HIDDEN; -extern UINT MSI_ViewModify( MSIQUERY *, MSIMODIFY, MSIRECORD * ) DECLSPEC_HIDDEN; -extern UINT VIEW_find_column( MSIVIEW *, LPCWSTR, LPCWSTR, UINT * ) DECLSPEC_HIDDEN; -extern UINT msi_view_get_row(MSIDATABASE *, MSIVIEW *, UINT, MSIRECORD **) DECLSPEC_HIDDEN; +extern UINT MSI_ViewExecute( MSIQUERY*, MSIRECORD * ); +extern UINT MSI_ViewFetch( MSIQUERY*, MSIRECORD ** ); +extern UINT MSI_ViewClose( MSIQUERY* ); +extern UINT MSI_ViewGetColumnInfo(MSIQUERY *, MSICOLINFO, MSIRECORD **); +extern UINT MSI_ViewModify( MSIQUERY *, MSIMODIFY, MSIRECORD * ); +extern UINT VIEW_find_column( MSIVIEW *, LPCWSTR, LPCWSTR, UINT * ); +extern UINT msi_view_get_row(MSIDATABASE *, MSIVIEW *, UINT, MSIRECORD **); /* install internals */ -extern UINT MSI_SetInstallLevel( MSIPACKAGE *package, int iInstallLevel ) DECLSPEC_HIDDEN; +extern UINT MSI_SetInstallLevel( MSIPACKAGE *package, int iInstallLevel ); /* package internals */ #define WINE_OPENPACKAGEFLAGS_RECACHE 0x80000000 -extern MSIPACKAGE *MSI_CreatePackage( MSIDATABASE * ) DECLSPEC_HIDDEN; -extern UINT MSI_OpenPackageW( LPCWSTR szPackage, DWORD dwOptions, MSIPACKAGE **pPackage ) DECLSPEC_HIDDEN; -extern UINT MSI_SetTargetPathW( MSIPACKAGE *, LPCWSTR, LPCWSTR ) DECLSPEC_HIDDEN; -extern INT MSI_ProcessMessageVerbatim( MSIPACKAGE *, INSTALLMESSAGE, MSIRECORD * ) DECLSPEC_HIDDEN; -extern INT MSI_ProcessMessage( MSIPACKAGE *, INSTALLMESSAGE, MSIRECORD * ) DECLSPEC_HIDDEN; -extern MSICONDITION MSI_EvaluateConditionW( MSIPACKAGE *, LPCWSTR ) DECLSPEC_HIDDEN; -extern UINT MSI_GetComponentStateW( MSIPACKAGE *, LPCWSTR, INSTALLSTATE *, INSTALLSTATE * ) DECLSPEC_HIDDEN; -extern UINT MSI_GetFeatureStateW( MSIPACKAGE *, LPCWSTR, INSTALLSTATE *, INSTALLSTATE * ) DECLSPEC_HIDDEN; -extern UINT MSI_SetFeatureStateW(MSIPACKAGE*, LPCWSTR, INSTALLSTATE ) DECLSPEC_HIDDEN; -extern UINT msi_download_file( LPCWSTR szUrl, LPWSTR filename ) DECLSPEC_HIDDEN; -extern UINT msi_package_add_info(MSIPACKAGE *, DWORD, DWORD, LPCWSTR, LPWSTR) DECLSPEC_HIDDEN; -extern UINT msi_package_add_media_disk(MSIPACKAGE *, DWORD, DWORD, DWORD, LPWSTR, LPWSTR) DECLSPEC_HIDDEN; -extern UINT msi_clone_properties(MSIDATABASE *) DECLSPEC_HIDDEN; -extern UINT msi_set_context(MSIPACKAGE *) DECLSPEC_HIDDEN; -extern void msi_adjust_privilege_properties(MSIPACKAGE *) DECLSPEC_HIDDEN; -extern UINT MSI_GetFeatureCost(MSIPACKAGE *, MSIFEATURE *, MSICOSTTREE, INSTALLSTATE, LPINT) DECLSPEC_HIDDEN; +extern MSIPACKAGE *MSI_CreatePackage( MSIDATABASE * ); +extern UINT MSI_OpenPackageW( LPCWSTR szPackage, DWORD dwOptions, MSIPACKAGE **pPackage ); +extern UINT MSI_SetTargetPathW( MSIPACKAGE *, LPCWSTR, LPCWSTR ); +extern INT MSI_ProcessMessageVerbatim( MSIPACKAGE *, INSTALLMESSAGE, MSIRECORD * ); +extern INT MSI_ProcessMessage( MSIPACKAGE *, INSTALLMESSAGE, MSIRECORD * ); +extern MSICONDITION MSI_EvaluateConditionW( MSIPACKAGE *, LPCWSTR ); +extern UINT MSI_GetComponentStateW( MSIPACKAGE *, LPCWSTR, INSTALLSTATE *, INSTALLSTATE * ); +extern UINT MSI_GetFeatureStateW( MSIPACKAGE *, LPCWSTR, INSTALLSTATE *, INSTALLSTATE * ); +extern UINT MSI_SetFeatureStateW(MSIPACKAGE*, LPCWSTR, INSTALLSTATE ); +extern UINT msi_download_file( LPCWSTR szUrl, LPWSTR filename ); +extern UINT msi_package_add_info(MSIPACKAGE *, DWORD, DWORD, LPCWSTR, LPWSTR); +extern UINT msi_package_add_media_disk(MSIPACKAGE *, DWORD, DWORD, DWORD, LPWSTR, LPWSTR); +extern UINT msi_clone_properties(MSIDATABASE *); +extern UINT msi_set_context(MSIPACKAGE *); +extern void msi_adjust_privilege_properties(MSIPACKAGE *); +extern UINT MSI_GetFeatureCost(MSIPACKAGE *, MSIFEATURE *, MSICOSTTREE, INSTALLSTATE, LPINT); /* for deformating */ -extern UINT MSI_FormatRecordW( MSIPACKAGE *, MSIRECORD *, LPWSTR, LPDWORD ) DECLSPEC_HIDDEN; +extern UINT MSI_FormatRecordW( MSIPACKAGE *, MSIRECORD *, LPWSTR, LPDWORD ); /* registry data encoding/decoding functions */ -extern BOOL unsquash_guid(LPCWSTR in, LPWSTR out) DECLSPEC_HIDDEN; -extern BOOL squash_guid(LPCWSTR in, LPWSTR out) DECLSPEC_HIDDEN; -extern BOOL encode_base85_guid(GUID *,LPWSTR) DECLSPEC_HIDDEN; -extern BOOL decode_base85_guid(LPCWSTR,GUID*) DECLSPEC_HIDDEN; -extern UINT MSIREG_OpenUninstallKey(const WCHAR *, enum platform, HKEY *, BOOL) DECLSPEC_HIDDEN; -extern UINT MSIREG_DeleteUninstallKey(const WCHAR *, enum platform) DECLSPEC_HIDDEN; +extern BOOL unsquash_guid(LPCWSTR in, LPWSTR out); +extern BOOL squash_guid(LPCWSTR in, LPWSTR out); +extern BOOL encode_base85_guid(GUID *,LPWSTR); +extern BOOL decode_base85_guid(LPCWSTR,GUID*); +extern UINT MSIREG_OpenUninstallKey(const WCHAR *, enum platform, HKEY *, BOOL); +extern UINT MSIREG_DeleteUninstallKey(const WCHAR *, enum platform); extern UINT MSIREG_OpenProductKey(LPCWSTR szProduct, LPCWSTR szUserSid, - MSIINSTALLCONTEXT context, HKEY* key, BOOL create) DECLSPEC_HIDDEN; + MSIINSTALLCONTEXT context, HKEY* key, BOOL create); extern UINT MSIREG_OpenFeaturesKey(LPCWSTR szProduct, LPCWSTR szUserSid, MSIINSTALLCONTEXT context, - HKEY *key, BOOL create) DECLSPEC_HIDDEN; -extern UINT MSIREG_OpenUserPatchesKey(LPCWSTR szPatch, HKEY* key, BOOL create) DECLSPEC_HIDDEN; + HKEY *key, BOOL create); +extern UINT MSIREG_OpenUserPatchesKey(LPCWSTR szPatch, HKEY* key, BOOL create); UINT MSIREG_OpenUserDataFeaturesKey(LPCWSTR szProduct, LPCWSTR szUserSid, MSIINSTALLCONTEXT context, - HKEY *key, BOOL create) DECLSPEC_HIDDEN; -extern UINT MSIREG_OpenUserComponentsKey(LPCWSTR szComponent, HKEY* key, BOOL create) DECLSPEC_HIDDEN; + HKEY *key, BOOL create); +extern UINT MSIREG_OpenUserComponentsKey(LPCWSTR szComponent, HKEY* key, BOOL create); extern UINT MSIREG_OpenUserDataComponentKey(LPCWSTR szComponent, LPCWSTR szUserSid, - HKEY *key, BOOL create) DECLSPEC_HIDDEN; -extern UINT MSIREG_OpenPatchesKey(LPCWSTR szPatch, HKEY* key, BOOL create) DECLSPEC_HIDDEN; + HKEY *key, BOOL create); +extern UINT MSIREG_OpenPatchesKey(LPCWSTR szPatch, HKEY* key, BOOL create); extern UINT MSIREG_OpenUserDataProductKey(LPCWSTR szProduct, MSIINSTALLCONTEXT dwContext, - LPCWSTR szUserSid, HKEY *key, BOOL create) DECLSPEC_HIDDEN; + LPCWSTR szUserSid, HKEY *key, BOOL create); extern UINT MSIREG_OpenUserDataPatchKey(LPCWSTR szPatch, MSIINSTALLCONTEXT dwContext, - HKEY *key, BOOL create) DECLSPEC_HIDDEN; + HKEY *key, BOOL create); extern UINT MSIREG_OpenUserDataProductPatchesKey(LPCWSTR product, MSIINSTALLCONTEXT context, - HKEY *key, BOOL create) DECLSPEC_HIDDEN; + HKEY *key, BOOL create); extern UINT MSIREG_OpenInstallProps(LPCWSTR szProduct, MSIINSTALLCONTEXT dwContext, - LPCWSTR szUserSid, HKEY *key, BOOL create) DECLSPEC_HIDDEN; -extern UINT MSIREG_OpenUpgradeCodesKey(LPCWSTR szProduct, HKEY* key, BOOL create) DECLSPEC_HIDDEN; -extern UINT MSIREG_OpenUserUpgradeCodesKey(LPCWSTR szProduct, HKEY* key, BOOL create) DECLSPEC_HIDDEN; -extern UINT MSIREG_DeleteProductKey(LPCWSTR szProduct) DECLSPEC_HIDDEN; -extern UINT MSIREG_DeleteUserProductKey(LPCWSTR szProduct) DECLSPEC_HIDDEN; -extern UINT MSIREG_DeleteUserDataPatchKey(LPCWSTR patch, MSIINSTALLCONTEXT context) DECLSPEC_HIDDEN; -extern UINT MSIREG_DeleteUserDataProductKey(LPCWSTR, MSIINSTALLCONTEXT) DECLSPEC_HIDDEN; -extern UINT MSIREG_DeleteUserFeaturesKey(LPCWSTR szProduct) DECLSPEC_HIDDEN; -extern UINT MSIREG_DeleteUserDataComponentKey(LPCWSTR szComponent, LPCWSTR szUserSid) DECLSPEC_HIDDEN; -extern UINT MSIREG_DeleteUserUpgradeCodesKey(LPCWSTR szUpgradeCode) DECLSPEC_HIDDEN; -extern UINT MSIREG_DeleteUpgradeCodesKey(const WCHAR *) DECLSPEC_HIDDEN; -extern UINT MSIREG_DeleteClassesUpgradeCodesKey(LPCWSTR szUpgradeCode) DECLSPEC_HIDDEN; -extern UINT MSIREG_OpenClassesUpgradeCodesKey(LPCWSTR szUpgradeCode, HKEY* key, BOOL create) DECLSPEC_HIDDEN; -extern UINT MSIREG_DeleteLocalClassesProductKey(LPCWSTR szProductCode) DECLSPEC_HIDDEN; -extern UINT MSIREG_DeleteLocalClassesFeaturesKey(LPCWSTR szProductCode) DECLSPEC_HIDDEN; -extern UINT msi_locate_product(LPCWSTR szProduct, MSIINSTALLCONTEXT *context) DECLSPEC_HIDDEN; -extern LPWSTR msi_reg_get_val_str( HKEY hkey, LPCWSTR name ) DECLSPEC_HIDDEN; -extern BOOL msi_reg_get_val_dword( HKEY hkey, LPCWSTR name, DWORD *val) DECLSPEC_HIDDEN; - -extern DWORD msi_version_str_to_dword(LPCWSTR p) DECLSPEC_HIDDEN; -extern void msi_parse_version_string(LPCWSTR, PDWORD, PDWORD) DECLSPEC_HIDDEN; -extern int msi_compare_file_versions(VS_FIXEDFILEINFO *, const WCHAR *) DECLSPEC_HIDDEN; -extern int msi_compare_font_versions(const WCHAR *, const WCHAR *) DECLSPEC_HIDDEN; - -extern LONG msi_reg_set_val_str( HKEY hkey, LPCWSTR name, LPCWSTR value ) DECLSPEC_HIDDEN; -extern LONG msi_reg_set_val_multi_str( HKEY hkey, LPCWSTR name, LPCWSTR value ) DECLSPEC_HIDDEN; -extern LONG msi_reg_set_val_dword( HKEY hkey, LPCWSTR name, DWORD val ) DECLSPEC_HIDDEN; -extern LONG msi_reg_set_subkey_val( HKEY hkey, LPCWSTR path, LPCWSTR name, LPCWSTR val ) DECLSPEC_HIDDEN; + LPCWSTR szUserSid, HKEY *key, BOOL create); +extern UINT MSIREG_OpenUpgradeCodesKey(LPCWSTR szProduct, HKEY* key, BOOL create); +extern UINT MSIREG_OpenUserUpgradeCodesKey(LPCWSTR szProduct, HKEY* key, BOOL create); +extern UINT MSIREG_DeleteProductKey(LPCWSTR szProduct); +extern UINT MSIREG_DeleteUserProductKey(LPCWSTR szProduct); +extern UINT MSIREG_DeleteUserDataPatchKey(LPCWSTR patch, MSIINSTALLCONTEXT context); +extern UINT MSIREG_DeleteUserDataProductKey(LPCWSTR, MSIINSTALLCONTEXT); +extern UINT MSIREG_DeleteUserFeaturesKey(LPCWSTR szProduct); +extern UINT MSIREG_DeleteUserDataComponentKey(LPCWSTR szComponent, LPCWSTR szUserSid); +extern UINT MSIREG_DeleteUserUpgradeCodesKey(LPCWSTR szUpgradeCode); +extern UINT MSIREG_DeleteUpgradeCodesKey(const WCHAR *); +extern UINT MSIREG_DeleteClassesUpgradeCodesKey(LPCWSTR szUpgradeCode); +extern UINT MSIREG_OpenClassesUpgradeCodesKey(LPCWSTR szUpgradeCode, HKEY* key, BOOL create); +extern UINT MSIREG_DeleteLocalClassesProductKey(LPCWSTR szProductCode); +extern UINT MSIREG_DeleteLocalClassesFeaturesKey(LPCWSTR szProductCode); +extern UINT msi_locate_product(LPCWSTR szProduct, MSIINSTALLCONTEXT *context); +extern WCHAR *msi_reg_get_val_str( HKEY hkey, const WCHAR *name ); +extern BOOL msi_reg_get_val_dword( HKEY hkey, LPCWSTR name, DWORD *val); + +extern DWORD msi_version_str_to_dword(LPCWSTR p); +extern void msi_parse_version_string(LPCWSTR, PDWORD, PDWORD); +extern int msi_compare_file_versions(VS_FIXEDFILEINFO *, const WCHAR *); +extern int msi_compare_font_versions(const WCHAR *, const WCHAR *); + +extern LONG msi_reg_set_val_str( HKEY hkey, LPCWSTR name, LPCWSTR value ); +extern LONG msi_reg_set_val_multi_str( HKEY hkey, LPCWSTR name, LPCWSTR value ); +extern LONG msi_reg_set_val_dword( HKEY hkey, LPCWSTR name, DWORD val ); +extern LONG msi_reg_set_subkey_val( HKEY hkey, LPCWSTR path, LPCWSTR name, LPCWSTR val ); /* msi dialog interface */ -extern void msi_dialog_check_messages( HANDLE ) DECLSPEC_HIDDEN; -extern void msi_dialog_destroy( msi_dialog* ) DECLSPEC_HIDDEN; -extern void msi_dialog_unregister_class( void ) DECLSPEC_HIDDEN; +extern void msi_dialog_check_messages( HANDLE ); +extern void msi_dialog_destroy( msi_dialog* ); +extern void msi_dialog_unregister_class( void ); /* summary information */ -extern UINT msi_get_suminfo( IStorage *stg, UINT uiUpdateCount, MSISUMMARYINFO **si ) DECLSPEC_HIDDEN; -extern UINT msi_get_db_suminfo( MSIDATABASE *db, UINT uiUpdateCount, MSISUMMARYINFO **si ) DECLSPEC_HIDDEN; -extern LPWSTR msi_suminfo_dup_string( MSISUMMARYINFO *si, UINT uiProperty ) DECLSPEC_HIDDEN; -extern INT msi_suminfo_get_int32( MSISUMMARYINFO *si, UINT uiProperty ) DECLSPEC_HIDDEN; -extern LPWSTR msi_get_suminfo_product( IStorage *stg ) DECLSPEC_HIDDEN; -extern UINT msi_add_suminfo( MSIDATABASE *db, LPWSTR **records, int num_records, int num_columns ) DECLSPEC_HIDDEN; -extern UINT msi_export_suminfo( MSIDATABASE *db, HANDLE handle ) DECLSPEC_HIDDEN; -extern UINT msi_load_suminfo_properties( MSIPACKAGE *package ) DECLSPEC_HIDDEN; +extern UINT msi_get_suminfo( IStorage *stg, UINT uiUpdateCount, MSISUMMARYINFO **si ); +extern UINT msi_get_db_suminfo( MSIDATABASE *db, UINT uiUpdateCount, MSISUMMARYINFO **si ); +extern WCHAR *msi_suminfo_dup_string( MSISUMMARYINFO *si, + UINT property ); +extern INT msi_suminfo_get_int32( MSISUMMARYINFO *si, UINT uiProperty ); +extern WCHAR *msi_get_suminfo_product( IStorage *stg ); +extern UINT msi_add_suminfo( MSIDATABASE *db, LPWSTR **records, int num_records, int num_columns ); +extern UINT msi_export_suminfo( MSIDATABASE *db, HANDLE handle ); +extern UINT msi_load_suminfo_properties( MSIPACKAGE *package ); /* undocumented functions */ UINT WINAPI MsiCreateAndVerifyInstallerDirectory( DWORD ); @@ -978,91 +980,93 @@ LANGID WINAPI MsiLoadStringW( MSIHANDLE, UINT, LPWSTR, int, LANGID ); LANGID WINAPI MsiLoadStringA( MSIHANDLE, UINT, LPSTR, int, LANGID ); /* UI globals */ -extern INSTALLUILEVEL gUILevel DECLSPEC_HIDDEN; -extern HWND gUIhwnd DECLSPEC_HIDDEN; -extern INSTALLUI_HANDLERA gUIHandlerA DECLSPEC_HIDDEN; -extern INSTALLUI_HANDLERW gUIHandlerW DECLSPEC_HIDDEN; -extern INSTALLUI_HANDLER_RECORD gUIHandlerRecord DECLSPEC_HIDDEN; -extern DWORD gUIFilter DECLSPEC_HIDDEN; -extern DWORD gUIFilterRecord DECLSPEC_HIDDEN; -extern LPVOID gUIContext DECLSPEC_HIDDEN; -extern LPVOID gUIContextRecord DECLSPEC_HIDDEN; -extern WCHAR *gszLogFile DECLSPEC_HIDDEN; -extern HINSTANCE msi_hInstance DECLSPEC_HIDDEN; +extern INSTALLUILEVEL gUILevel; +extern HWND gUIhwnd; +extern INSTALLUI_HANDLERA gUIHandlerA; +extern INSTALLUI_HANDLERW gUIHandlerW; +extern INSTALLUI_HANDLER_RECORD gUIHandlerRecord; +extern DWORD gUIFilter; +extern DWORD gUIFilterRecord; +extern LPVOID gUIContext; +extern LPVOID gUIContextRecord; +extern WCHAR *gszLogFile; +extern HINSTANCE msi_hInstance; /* action related functions */ -extern UINT ACTION_PerformAction(MSIPACKAGE *package, const WCHAR *action) DECLSPEC_HIDDEN; -extern void ACTION_FinishCustomActions( const MSIPACKAGE* package) DECLSPEC_HIDDEN; -extern UINT ACTION_CustomAction(MSIPACKAGE *package, const WCHAR *action) DECLSPEC_HIDDEN; -extern void custom_stop_server(HANDLE process, HANDLE pipe) DECLSPEC_HIDDEN; +extern UINT ACTION_PerformAction(MSIPACKAGE *package, const WCHAR *action); +extern void ACTION_FinishCustomActions( const MSIPACKAGE* package); +extern UINT ACTION_CustomAction(MSIPACKAGE *package, const WCHAR *action); +extern void custom_stop_server(HANDLE process, HANDLE pipe); /* actions in other modules */ -extern UINT ACTION_AppSearch(MSIPACKAGE *package) DECLSPEC_HIDDEN; -extern UINT ACTION_CCPSearch(MSIPACKAGE *package) DECLSPEC_HIDDEN; -extern UINT ACTION_FindRelatedProducts(MSIPACKAGE *package) DECLSPEC_HIDDEN; -extern UINT ACTION_InstallFiles(MSIPACKAGE *package) DECLSPEC_HIDDEN; -extern UINT ACTION_PatchFiles( MSIPACKAGE *package ) DECLSPEC_HIDDEN; -extern UINT ACTION_RemoveFiles(MSIPACKAGE *package) DECLSPEC_HIDDEN; -extern UINT ACTION_MoveFiles(MSIPACKAGE *package) DECLSPEC_HIDDEN; -extern UINT ACTION_DuplicateFiles(MSIPACKAGE *package) DECLSPEC_HIDDEN; -extern UINT ACTION_RemoveDuplicateFiles(MSIPACKAGE *package) DECLSPEC_HIDDEN; -extern UINT ACTION_RegisterClassInfo(MSIPACKAGE *package) DECLSPEC_HIDDEN; -extern UINT ACTION_RegisterProgIdInfo(MSIPACKAGE *package) DECLSPEC_HIDDEN; -extern UINT ACTION_RegisterExtensionInfo(MSIPACKAGE *package) DECLSPEC_HIDDEN; -extern UINT ACTION_RegisterMIMEInfo(MSIPACKAGE *package) DECLSPEC_HIDDEN; -extern UINT ACTION_RegisterFonts(MSIPACKAGE *package) DECLSPEC_HIDDEN; -extern UINT ACTION_UnregisterClassInfo(MSIPACKAGE *package) DECLSPEC_HIDDEN; -extern UINT ACTION_UnregisterExtensionInfo(MSIPACKAGE *package) DECLSPEC_HIDDEN; -extern UINT ACTION_UnregisterFonts(MSIPACKAGE *package) DECLSPEC_HIDDEN; -extern UINT ACTION_UnregisterMIMEInfo(MSIPACKAGE *package) DECLSPEC_HIDDEN; -extern UINT ACTION_UnregisterProgIdInfo(MSIPACKAGE *package) DECLSPEC_HIDDEN; -extern UINT ACTION_MsiPublishAssemblies(MSIPACKAGE *package) DECLSPEC_HIDDEN; -extern UINT ACTION_MsiUnpublishAssemblies(MSIPACKAGE *package) DECLSPEC_HIDDEN; +extern UINT ACTION_AppSearch(MSIPACKAGE *package); +extern UINT ACTION_CCPSearch(MSIPACKAGE *package); +extern UINT ACTION_FindRelatedProducts(MSIPACKAGE *package); +extern UINT ACTION_InstallFiles(MSIPACKAGE *package); +extern UINT ACTION_PatchFiles( MSIPACKAGE *package ); +extern UINT ACTION_RemoveFiles(MSIPACKAGE *package); +extern UINT ACTION_MoveFiles(MSIPACKAGE *package); +extern UINT ACTION_DuplicateFiles(MSIPACKAGE *package); +extern UINT ACTION_RemoveDuplicateFiles(MSIPACKAGE *package); +extern UINT ACTION_RegisterClassInfo(MSIPACKAGE *package); +extern UINT ACTION_RegisterProgIdInfo(MSIPACKAGE *package); +extern UINT ACTION_RegisterExtensionInfo(MSIPACKAGE *package); +extern UINT ACTION_RegisterMIMEInfo(MSIPACKAGE *package); +extern UINT ACTION_RegisterFonts(MSIPACKAGE *package); +extern UINT ACTION_UnregisterClassInfo(MSIPACKAGE *package); +extern UINT ACTION_UnregisterExtensionInfo(MSIPACKAGE *package); +extern UINT ACTION_UnregisterFonts(MSIPACKAGE *package); +extern UINT ACTION_UnregisterMIMEInfo(MSIPACKAGE *package); +extern UINT ACTION_UnregisterProgIdInfo(MSIPACKAGE *package); +extern UINT ACTION_MsiPublishAssemblies(MSIPACKAGE *package); +extern UINT ACTION_MsiUnpublishAssemblies(MSIPACKAGE *package); /* Helpers */ -extern DWORD deformat_string(MSIPACKAGE *package, LPCWSTR ptr, WCHAR** data ) DECLSPEC_HIDDEN; -extern WCHAR *msi_dup_record_field(MSIRECORD *row, INT index) DECLSPEC_HIDDEN; -extern LPWSTR msi_dup_property( MSIDATABASE *db, LPCWSTR prop ) DECLSPEC_HIDDEN; -extern UINT msi_set_property( MSIDATABASE *, const WCHAR *, const WCHAR *, int ) DECLSPEC_HIDDEN; -extern UINT msi_get_property( MSIDATABASE *, LPCWSTR, LPWSTR, LPDWORD ) DECLSPEC_HIDDEN; -extern int msi_get_property_int( MSIDATABASE *package, LPCWSTR prop, int def ) DECLSPEC_HIDDEN; -extern WCHAR *msi_resolve_source_folder(MSIPACKAGE *package, const WCHAR *name, MSIFOLDER **folder) DECLSPEC_HIDDEN; -extern void msi_resolve_target_folder(MSIPACKAGE *package, const WCHAR *name, BOOL load_prop) DECLSPEC_HIDDEN; -extern WCHAR *msi_normalize_path(const WCHAR *) DECLSPEC_HIDDEN; -extern WCHAR *msi_resolve_file_source(MSIPACKAGE *package, MSIFILE *file) DECLSPEC_HIDDEN; -extern const WCHAR *msi_get_target_folder(MSIPACKAGE *package, const WCHAR *name) DECLSPEC_HIDDEN; -extern void msi_reset_source_folders( MSIPACKAGE *package ) DECLSPEC_HIDDEN; -extern MSICOMPONENT *msi_get_loaded_component(MSIPACKAGE *package, const WCHAR *Component) DECLSPEC_HIDDEN; -extern MSIFEATURE *msi_get_loaded_feature(MSIPACKAGE *package, const WCHAR *Feature) DECLSPEC_HIDDEN; -extern MSIFILE *msi_get_loaded_file(MSIPACKAGE *package, const WCHAR *file) DECLSPEC_HIDDEN; -extern MSIFOLDER *msi_get_loaded_folder(MSIPACKAGE *package, const WCHAR *dir) DECLSPEC_HIDDEN; -extern WCHAR *msi_create_temp_file(MSIDATABASE *db) DECLSPEC_HIDDEN; -extern void msi_free_action_script(MSIPACKAGE *package, UINT script) DECLSPEC_HIDDEN; -extern WCHAR *msi_build_icon_path(MSIPACKAGE *, const WCHAR *) DECLSPEC_HIDDEN; -extern WCHAR * WINAPIV msi_build_directory_name(DWORD , ...) DECLSPEC_HIDDEN; -extern void msi_reduce_to_long_filename(WCHAR *) DECLSPEC_HIDDEN; -extern WCHAR *msi_create_component_advertise_string(MSIPACKAGE *, MSICOMPONENT *, const WCHAR *) DECLSPEC_HIDDEN; -extern void ACTION_UpdateComponentStates(MSIPACKAGE *package, MSIFEATURE *feature) DECLSPEC_HIDDEN; -extern UINT msi_register_unique_action(MSIPACKAGE *, const WCHAR *) DECLSPEC_HIDDEN; -extern BOOL msi_action_is_unique(const MSIPACKAGE *, const WCHAR *) DECLSPEC_HIDDEN; +extern DWORD deformat_string(MSIPACKAGE *package, LPCWSTR ptr, WCHAR** data ); +extern WCHAR *msi_dup_record_field( MSIRECORD *row, INT index ); +extern WCHAR *msi_dup_property( MSIDATABASE *db, const WCHAR *prop ); +extern UINT msi_set_property( MSIDATABASE *, const WCHAR *, const WCHAR *, int ); +extern UINT msi_get_property( MSIDATABASE *, LPCWSTR, LPWSTR, LPDWORD ); +extern int msi_get_property_int( MSIDATABASE *package, LPCWSTR prop, int def ); +extern WCHAR *msi_resolve_source_folder(MSIPACKAGE *package, const WCHAR *name, + MSIFOLDER **folder); +extern void msi_resolve_target_folder(MSIPACKAGE *package, const WCHAR *name, BOOL load_prop); +extern WCHAR *msi_normalize_path(const WCHAR *); +extern WCHAR *msi_resolve_file_source(MSIPACKAGE *package, + MSIFILE *file); +extern const WCHAR *msi_get_target_folder(MSIPACKAGE *package, const WCHAR *name); +extern void msi_reset_source_folders( MSIPACKAGE *package ); +extern MSICOMPONENT *msi_get_loaded_component(MSIPACKAGE *package, const WCHAR *Component); +extern MSIFEATURE *msi_get_loaded_feature(MSIPACKAGE *package, const WCHAR *Feature); +extern MSIFILE *msi_get_loaded_file(MSIPACKAGE *package, const WCHAR *file); +extern MSIFOLDER *msi_get_loaded_folder(MSIPACKAGE *package, const WCHAR *dir); +extern WCHAR *msi_create_temp_file(MSIDATABASE *db); +extern void msi_free_action_script(MSIPACKAGE *package, UINT script); +extern WCHAR *msi_build_icon_path(MSIPACKAGE *, const WCHAR *); +extern WCHAR * WINAPIV msi_build_directory_name(DWORD , ...); +extern void msi_reduce_to_long_filename(WCHAR *); +extern WCHAR *msi_create_component_advertise_string(MSIPACKAGE *, MSICOMPONENT *, + const WCHAR *); +extern void ACTION_UpdateComponentStates(MSIPACKAGE *package, MSIFEATURE *feature); +extern UINT msi_register_unique_action(MSIPACKAGE *, const WCHAR *); +extern BOOL msi_action_is_unique(const MSIPACKAGE *, const WCHAR *); extern UINT msi_set_last_used_source(LPCWSTR product, LPCWSTR usersid, - MSIINSTALLCONTEXT context, DWORD options, LPCWSTR value) DECLSPEC_HIDDEN; -extern UINT msi_create_empty_local_file(LPWSTR path, LPCWSTR suffix) DECLSPEC_HIDDEN; -extern UINT msi_set_sourcedir_props(MSIPACKAGE *package, BOOL replace) DECLSPEC_HIDDEN; -extern MSIASSEMBLY *msi_load_assembly(MSIPACKAGE *, MSICOMPONENT *) DECLSPEC_HIDDEN; -extern UINT msi_install_assembly(MSIPACKAGE *, MSICOMPONENT *) DECLSPEC_HIDDEN; -extern UINT msi_uninstall_assembly(MSIPACKAGE *, MSICOMPONENT *) DECLSPEC_HIDDEN; -extern BOOL msi_init_assembly_caches(MSIPACKAGE *) DECLSPEC_HIDDEN; -extern void msi_destroy_assembly_caches(MSIPACKAGE *) DECLSPEC_HIDDEN; -extern BOOL msi_is_global_assembly(MSICOMPONENT *) DECLSPEC_HIDDEN; -extern IAssemblyEnum *msi_create_assembly_enum(MSIPACKAGE *, const WCHAR *) DECLSPEC_HIDDEN; -extern WCHAR *msi_get_assembly_path(MSIPACKAGE *, const WCHAR *) DECLSPEC_HIDDEN; -extern WCHAR **msi_split_string(const WCHAR *, WCHAR) DECLSPEC_HIDDEN; -extern UINT msi_set_original_database_property(MSIDATABASE *, const WCHAR *) DECLSPEC_HIDDEN; -extern WCHAR *msi_get_error_message(MSIDATABASE *, int) DECLSPEC_HIDDEN; -extern UINT msi_strncpyWtoA(const WCHAR *str, int len, char *buf, DWORD *sz, BOOL remote) DECLSPEC_HIDDEN; -extern UINT msi_strncpyW(const WCHAR *str, int len, WCHAR *buf, DWORD *sz) DECLSPEC_HIDDEN; -extern WCHAR *msi_get_package_code(MSIDATABASE *db) DECLSPEC_HIDDEN; + MSIINSTALLCONTEXT context, DWORD options, LPCWSTR value); +extern UINT msi_create_empty_local_file(LPWSTR path, LPCWSTR suffix); +extern UINT msi_set_sourcedir_props(MSIPACKAGE *package, BOOL replace); +extern MSIASSEMBLY *msi_load_assembly(MSIPACKAGE *, MSICOMPONENT *); +extern UINT msi_install_assembly(MSIPACKAGE *, MSICOMPONENT *); +extern UINT msi_uninstall_assembly(MSIPACKAGE *, MSICOMPONENT *); +extern void msi_destroy_assembly_caches(MSIPACKAGE *); +extern BOOL msi_is_global_assembly(MSICOMPONENT *); +extern IAssemblyEnum *msi_create_assembly_enum(MSIPACKAGE *, const WCHAR *); +extern WCHAR *msi_get_assembly_path(MSIPACKAGE *, const WCHAR *); +extern WCHAR **msi_split_string(const WCHAR *, WCHAR); +extern UINT msi_set_original_database_property(MSIDATABASE *, const WCHAR *); +extern WCHAR *msi_get_error_message(MSIDATABASE *, int); +extern UINT msi_strncpyWtoA(const WCHAR *str, int len, char *buf, DWORD *sz, BOOL remote); +extern UINT msi_strncpyW(const WCHAR *str, int len, WCHAR *buf, DWORD *sz); +extern WCHAR *msi_get_package_code(MSIDATABASE *db); /* wrappers for filesystem functions */ static inline void msi_disable_fs_redirection( MSIPACKAGE *package ) @@ -1073,20 +1077,22 @@ static inline void msi_revert_fs_redirection( MSIPACKAGE *package ) { if (is_wow64 && package->platform == PLATFORM_X64) Wow64RevertWow64FsRedirection( package->cookie ); } -extern HANDLE msi_create_file( MSIPACKAGE *, const WCHAR *, DWORD, DWORD, DWORD, DWORD ) DECLSPEC_HIDDEN; -extern BOOL msi_delete_file( MSIPACKAGE *, const WCHAR * ) DECLSPEC_HIDDEN; -extern BOOL msi_remove_directory( MSIPACKAGE *, const WCHAR * ) DECLSPEC_HIDDEN; -extern DWORD msi_get_file_attributes( MSIPACKAGE *, const WCHAR * ) DECLSPEC_HIDDEN; -extern BOOL msi_set_file_attributes( MSIPACKAGE *, const WCHAR *, DWORD ) DECLSPEC_HIDDEN; -extern HANDLE msi_find_first_file( MSIPACKAGE *, const WCHAR *, WIN32_FIND_DATAW * ) DECLSPEC_HIDDEN; -extern BOOL msi_find_next_file( MSIPACKAGE *, HANDLE, WIN32_FIND_DATAW * ) DECLSPEC_HIDDEN; -extern BOOL msi_move_file( MSIPACKAGE *, const WCHAR *, const WCHAR *, DWORD ) DECLSPEC_HIDDEN; -extern DWORD msi_get_file_version_info( MSIPACKAGE *, const WCHAR *, DWORD, BYTE * ) DECLSPEC_HIDDEN; -extern BOOL msi_create_full_path( MSIPACKAGE *, const WCHAR * ) DECLSPEC_HIDDEN; -extern DWORD msi_get_disk_file_size( MSIPACKAGE *, const WCHAR * ) DECLSPEC_HIDDEN; -extern VS_FIXEDFILEINFO *msi_get_disk_file_version( MSIPACKAGE *, const WCHAR * ) DECLSPEC_HIDDEN; -extern UINT msi_get_filehash( MSIPACKAGE *, const WCHAR *, MSIFILEHASHINFO * ) DECLSPEC_HIDDEN; -extern WCHAR *msi_get_font_file_version( MSIPACKAGE *, const WCHAR * ) DECLSPEC_HIDDEN; +extern BOOL msi_get_temp_file_name( MSIPACKAGE *, const WCHAR *, const WCHAR *, WCHAR * ); +extern HANDLE msi_create_file( MSIPACKAGE *, const WCHAR *, DWORD, DWORD, DWORD, DWORD ); +extern BOOL msi_delete_file( MSIPACKAGE *, const WCHAR * ); +extern BOOL msi_remove_directory( MSIPACKAGE *, const WCHAR * ); +extern DWORD msi_get_file_attributes( MSIPACKAGE *, const WCHAR * ); +extern BOOL msi_set_file_attributes( MSIPACKAGE *, const WCHAR *, DWORD ); +extern HANDLE msi_find_first_file( MSIPACKAGE *, const WCHAR *, WIN32_FIND_DATAW * ); +extern BOOL msi_find_next_file( MSIPACKAGE *, HANDLE, WIN32_FIND_DATAW * ); +extern BOOL msi_move_file( MSIPACKAGE *, const WCHAR *, const WCHAR *, DWORD ); +extern DWORD msi_get_file_version_info( MSIPACKAGE *, const WCHAR *, DWORD, BYTE * ); +extern BOOL msi_create_full_path( MSIPACKAGE *, const WCHAR * ); +extern DWORD msi_get_disk_file_size( MSIPACKAGE *, const WCHAR * ); +extern VS_FIXEDFILEINFO *msi_get_disk_file_version( MSIPACKAGE *, const WCHAR * ); +extern UINT msi_get_filehash( MSIPACKAGE *, const WCHAR *, MSIFILEHASHINFO * ); +extern WCHAR *msi_get_font_file_version( MSIPACKAGE *, + const WCHAR * ); /* media */ @@ -1104,15 +1110,15 @@ typedef struct PVOID user; } MSICABDATA; -extern UINT ready_media(MSIPACKAGE *package, BOOL compressed, MSIMEDIAINFO *mi) DECLSPEC_HIDDEN; -extern UINT msi_load_media_info(MSIPACKAGE *package, UINT Sequence, MSIMEDIAINFO *mi) DECLSPEC_HIDDEN; -extern void msi_free_media_info(MSIMEDIAINFO *mi) DECLSPEC_HIDDEN; -extern BOOL msi_cabextract(MSIPACKAGE* package, MSIMEDIAINFO *mi, LPVOID data) DECLSPEC_HIDDEN; -extern UINT msi_add_cabinet_stream(MSIPACKAGE *, UINT, IStorage *, const WCHAR *) DECLSPEC_HIDDEN; +extern UINT ready_media(MSIPACKAGE *package, BOOL compressed, MSIMEDIAINFO *mi); +extern UINT msi_load_media_info(MSIPACKAGE *package, UINT Sequence, MSIMEDIAINFO *mi); +extern void msi_free_media_info(MSIMEDIAINFO *mi); +extern BOOL msi_cabextract(MSIPACKAGE* package, MSIMEDIAINFO *mi, LPVOID data); +extern UINT msi_add_cabinet_stream(MSIPACKAGE *, UINT, IStorage *, const WCHAR *); /* control event stuff */ -extern void msi_event_fire(MSIPACKAGE *, const WCHAR *, MSIRECORD *) DECLSPEC_HIDDEN; -extern void msi_event_cleanup_all_subscriptions( MSIPACKAGE * ) DECLSPEC_HIDDEN; +extern void msi_event_fire(MSIPACKAGE *, const WCHAR *, MSIRECORD *); +extern void msi_event_cleanup_all_subscriptions( MSIPACKAGE * ); /* OLE automation */ typedef enum tid_t { @@ -1126,75 +1132,74 @@ typedef enum tid_t { LAST_tid } tid_t; -extern HRESULT create_msiserver(IUnknown *pOuter, LPVOID *ppObj) DECLSPEC_HIDDEN; -extern HRESULT create_session(MSIHANDLE msiHandle, IDispatch *pInstaller, IDispatch **pDispatch) DECLSPEC_HIDDEN; -extern HRESULT get_typeinfo(tid_t tid, ITypeInfo **ti) DECLSPEC_HIDDEN; -extern void release_typelib(void) DECLSPEC_HIDDEN; +extern HRESULT create_msiserver(IUnknown *pOuter, LPVOID *ppObj); +extern HRESULT create_session(MSIHANDLE msiHandle, IDispatch *pInstaller, IDispatch **pDispatch); +extern HRESULT get_typeinfo(tid_t tid, ITypeInfo **ti); +extern void release_typelib(void); /* Scripting */ -extern DWORD call_script(MSIHANDLE hPackage, INT type, LPCWSTR script, LPCWSTR function, LPCWSTR action) DECLSPEC_HIDDEN; +extern DWORD call_script(MSIHANDLE hPackage, INT type, LPCWSTR script, LPCWSTR function, LPCWSTR action); /* User interface messages from the actions */ -extern void msi_ui_progress(MSIPACKAGE *, int, int, int, int) DECLSPEC_HIDDEN; +extern void msi_ui_progress(MSIPACKAGE *, int, int, int, int); -/* memory allocation macro functions */ -static void *msi_alloc( size_t len ) __WINE_ALLOC_SIZE(1); -static inline void *msi_alloc( size_t len ) +static inline char *strdupWtoA( LPCWSTR str ) { - return malloc( len ); -} + LPSTR ret = NULL; + DWORD len; -static void *msi_alloc_zero( size_t len ) __WINE_ALLOC_SIZE(1); -static inline void *msi_alloc_zero( size_t len ) -{ - return calloc( 1, len ); + if (!str) return ret; + len = WideCharToMultiByte( CP_ACP, 0, str, -1, NULL, 0, NULL, NULL); + ret = malloc( len ); + if (ret) + WideCharToMultiByte( CP_ACP, 0, str, -1, ret, len, NULL, NULL ); + return ret; } -static void *msi_realloc( void *mem, size_t len ) __WINE_ALLOC_SIZE(2); -static inline void *msi_realloc( void *mem, size_t len ) +static inline LPWSTR strdupAtoW( LPCSTR str ) { - return realloc( mem, len ); -} + LPWSTR ret = NULL; + DWORD len; -static inline void msi_free( void *mem ) -{ - free( mem ); + if (!str) return ret; + len = MultiByteToWideChar( CP_ACP, 0, str, -1, NULL, 0 ); + ret = malloc( len * sizeof(WCHAR) ); + if (ret) + MultiByteToWideChar( CP_ACP, 0, str, -1, ret, len ); + return ret; } -static inline char *strdupWtoA( LPCWSTR str ) +static inline char *strdupWtoU( LPCWSTR str ) { LPSTR ret = NULL; DWORD len; if (!str) return ret; - len = WideCharToMultiByte( CP_ACP, 0, str, -1, NULL, 0, NULL, NULL); - ret = msi_alloc( len ); + len = WideCharToMultiByte( CP_UTF8, 0, str, -1, NULL, 0, NULL, NULL); + ret = malloc( len ); if (ret) - WideCharToMultiByte( CP_ACP, 0, str, -1, ret, len, NULL, NULL ); + WideCharToMultiByte( CP_UTF8, 0, str, -1, ret, len, NULL, NULL ); return ret; } -static inline LPWSTR strdupAtoW( LPCSTR str ) +static inline LPWSTR strdupUtoW( LPCSTR str ) { LPWSTR ret = NULL; DWORD len; if (!str) return ret; - len = MultiByteToWideChar( CP_ACP, 0, str, -1, NULL, 0 ); - ret = msi_alloc( len * sizeof(WCHAR) ); + len = MultiByteToWideChar( CP_UTF8, 0, str, -1, NULL, 0 ); + ret = malloc( len * sizeof(WCHAR) ); if (ret) - MultiByteToWideChar( CP_ACP, 0, str, -1, ret, len ); + MultiByteToWideChar( CP_UTF8, 0, str, -1, ret, len ); return ret; } -static inline LPWSTR strdupW( LPCWSTR src ) +static inline int cost_from_size( int size ) { - LPWSTR dest; - if (!src) return NULL; - dest = msi_alloc( (lstrlenW(src)+1)*sizeof(WCHAR) ); - if (dest) - lstrcpyW(dest, src); - return dest; + /* Cost is size rounded up to the nearest 4096 bytes, + * expressed in units of 512 bytes. */ + return ((size + 4095) & ~4095) / 512; } #endif /* __WINE_MSI_PRIVATE__ */ diff --git a/dll/win32/msi/msiquery.c b/dll/win32/msi/msiquery.c index a8585f20af254..28065ca4da0b4 100644 --- a/dll/win32/msi/msiquery.c +++ b/dll/win32/msi/msiquery.c @@ -52,7 +52,7 @@ static void MSI_CloseView( MSIOBJECTHDR *arg ) LIST_FOR_EACH_SAFE( ptr, t, &query->mem ) { - msi_free( ptr ); + free( ptr ); } } @@ -103,7 +103,7 @@ UINT WINAPI MsiDatabaseOpenViewA( MSIHANDLE hdb, const char *szQuery, MSIHANDLE r = MsiDatabaseOpenViewW( hdb, szwQuery, phView); - msi_free( szwQuery ); + free( szwQuery ); return r; } @@ -145,18 +145,18 @@ UINT WINAPIV MSI_OpenQuery( MSIDATABASE *db, MSIQUERY **view, LPCWSTR fmt, ... ) for (;;) { va_list va; - query = msi_alloc( size*sizeof(WCHAR) ); + query = malloc(size * sizeof(WCHAR)); va_start(va, fmt); res = vswprintf(query, size, fmt, va); va_end(va); if (res == -1) size *= 2; else if (res >= size) size = res + 1; else break; - msi_free( query ); + free(query); } /* perform the query */ r = MSI_DatabaseOpenViewW(db, query, view); - msi_free(query); + free(query); return r; } @@ -210,18 +210,18 @@ MSIRECORD * WINAPIV MSI_QueryGetRecord( MSIDATABASE *db, LPCWSTR fmt, ... ) for (;;) { va_list va; - query = msi_alloc( size*sizeof(WCHAR) ); + query = malloc(size * sizeof(WCHAR)); va_start(va, fmt); res = vswprintf(query, size, fmt, va); va_end(va); if (res == -1) size *= 2; else if (res >= size) size = res + 1; else break; - msi_free( query ); + free(query); } /* perform the query */ r = MSI_DatabaseOpenViewW(db, query, &view); - msi_free(query); + free(query); if( r == ERROR_SUCCESS ) { @@ -564,8 +564,7 @@ UINT WINAPI MsiViewExecute( MSIHANDLE hView, MSIHANDLE hRec ) return ret; } -static UINT msi_set_record_type_string( MSIRECORD *rec, UINT field, - UINT type, BOOL temporary ) +static UINT set_record_type_string( MSIRECORD *rec, UINT field, UINT type, BOOL temporary ) { WCHAR szType[0x10]; @@ -633,7 +632,7 @@ UINT MSI_ViewGetColumnInfo( MSIQUERY *query, MSICOLINFO info, MSIRECORD **prec ) if (info == MSICOLINFO_NAMES) MSI_RecordSetStringW( rec, i+1, name ); else - msi_set_record_type_string( rec, i+1, type, temporary ); + set_record_type_string( rec, i+1, type, temporary ); } *prec = rec; return ERROR_SUCCESS; @@ -942,7 +941,7 @@ UINT WINAPI MsiDatabaseApplyTransformA( MSIHANDLE hdb, const char *transform, in return ERROR_NOT_ENOUGH_MEMORY; ret = MsiDatabaseApplyTransformW( hdb, wstr, error_cond ); - msi_free( wstr ); + free( wstr ); return ret; } @@ -1002,22 +1001,22 @@ UINT WINAPI MsiDatabaseCommit( MSIHANDLE hdb ) if (r == ERROR_SUCCESS) { - msi_free( db->deletefile ); + free( db->deletefile ); db->deletefile = NULL; } return r; } -struct msi_primary_key_record_info +struct primary_key_record_info { DWORD n; MSIRECORD *rec; }; -static UINT msi_primary_key_iterator( MSIRECORD *rec, LPVOID param ) +static UINT primary_key_iterator( MSIRECORD *rec, void *param ) { - struct msi_primary_key_record_info *info = param; + struct primary_key_record_info *info = param; LPCWSTR name, table; DWORD type; @@ -1041,10 +1040,9 @@ static UINT msi_primary_key_iterator( MSIRECORD *rec, LPVOID param ) return ERROR_SUCCESS; } -UINT MSI_DatabaseGetPrimaryKeys( MSIDATABASE *db, - LPCWSTR table, MSIRECORD **prec ) +UINT MSI_DatabaseGetPrimaryKeys( MSIDATABASE *db, const WCHAR *table, MSIRECORD **prec ) { - struct msi_primary_key_record_info info; + struct primary_key_record_info info; MSIQUERY *query = NULL; UINT r; @@ -1058,7 +1056,7 @@ UINT MSI_DatabaseGetPrimaryKeys( MSIDATABASE *db, /* count the number of primary key records */ info.n = 0; info.rec = 0; - r = MSI_IterateRecords( query, 0, msi_primary_key_iterator, &info ); + r = MSI_IterateRecords( query, 0, primary_key_iterator, &info ); if( r == ERROR_SUCCESS ) { TRACE( "found %lu primary keys\n", info.n ); @@ -1066,7 +1064,7 @@ UINT MSI_DatabaseGetPrimaryKeys( MSIDATABASE *db, /* allocate a record and fill in the names of the tables */ info.rec = MSI_CreateRecord( info.n ); info.n = 0; - r = MSI_IterateRecords( query, 0, msi_primary_key_iterator, &info ); + r = MSI_IterateRecords( query, 0, primary_key_iterator, &info ); if( r == ERROR_SUCCESS ) *prec = info.rec; else @@ -1140,7 +1138,7 @@ UINT WINAPI MsiDatabaseGetPrimaryKeysA( MSIHANDLE hdb, const char *table, MSIHAN return ERROR_OUTOFMEMORY; } r = MsiDatabaseGetPrimaryKeysW( hdb, szwTable, phRec ); - msi_free( szwTable ); + free( szwTable ); return r; } @@ -1159,7 +1157,7 @@ MSICONDITION WINAPI MsiDatabaseIsTablePersistentA( MSIHANDLE hDatabase, const ch return MSICONDITION_ERROR; } r = MsiDatabaseIsTablePersistentW( hDatabase, szwTableName ); - msi_free( szwTableName ); + free( szwTableName ); return r; } diff --git a/dll/win32/msi/package.c b/dll/win32/msi/package.c index c2c3eb496fbec..40c52c02d650a 100644 --- a/dll/win32/msi/package.c +++ b/dll/win32/msi/package.c @@ -18,9 +18,8 @@ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA */ -#define NONAMELESSUNION -#define NONAMELESSSTRUCT #define COBJMACROS + #ifdef __REACTOS__ #define WIN32_NO_STATUS #endif @@ -67,21 +66,21 @@ static void free_feature( MSIFEATURE *feature ) { FeatureList *fl = LIST_ENTRY( item, FeatureList, entry ); list_remove( &fl->entry ); - msi_free( fl ); + free( fl ); } LIST_FOR_EACH_SAFE( item, cursor, &feature->Components ) { ComponentList *cl = LIST_ENTRY( item, ComponentList, entry ); list_remove( &cl->entry ); - msi_free( cl ); + free( cl ); } - msi_free( feature->Feature ); - msi_free( feature->Feature_Parent ); - msi_free( feature->Directory ); - msi_free( feature->Description ); - msi_free( feature->Title ); - msi_free( feature ); + free( feature->Feature ); + free( feature->Feature_Parent ); + free( feature->Directory ); + free( feature->Description ); + free( feature->Title ); + free( feature ); } static void free_folder( MSIFOLDER *folder ) @@ -92,16 +91,16 @@ static void free_folder( MSIFOLDER *folder ) { FolderList *fl = LIST_ENTRY( item, FolderList, entry ); list_remove( &fl->entry ); - msi_free( fl ); + free( fl ); } - msi_free( folder->Parent ); - msi_free( folder->Directory ); - msi_free( folder->TargetDefault ); - msi_free( folder->SourceLongPath ); - msi_free( folder->SourceShortPath ); - msi_free( folder->ResolvedTarget ); - msi_free( folder->ResolvedSource ); - msi_free( folder ); + free( folder->Parent ); + free( folder->Directory ); + free( folder->TargetDefault ); + free( folder->SourceLongPath ); + free( folder->SourceShortPath ); + free( folder->ResolvedTarget ); + free( folder->ResolvedSource ); + free( folder ); } static void free_extension( MSIEXTENSION *ext ) @@ -113,35 +112,35 @@ static void free_extension( MSIEXTENSION *ext ) MSIVERB *verb = LIST_ENTRY( item, MSIVERB, entry ); list_remove( &verb->entry ); - msi_free( verb->Verb ); - msi_free( verb->Command ); - msi_free( verb->Argument ); - msi_free( verb ); + free( verb->Verb ); + free( verb->Command ); + free( verb->Argument ); + free( verb ); } - msi_free( ext->Extension ); - msi_free( ext->ProgIDText ); - msi_free( ext ); + free( ext->Extension ); + free( ext->ProgIDText ); + free( ext ); } static void free_assembly( MSIASSEMBLY *assembly ) { - msi_free( assembly->feature ); - msi_free( assembly->manifest ); - msi_free( assembly->application ); - msi_free( assembly->display_name ); + free( assembly->feature ); + free( assembly->manifest ); + free( assembly->application ); + free( assembly->display_name ); if (assembly->tempdir) RemoveDirectoryW( assembly->tempdir ); - msi_free( assembly->tempdir ); - msi_free( assembly ); + free( assembly->tempdir ); + free( assembly ); } void msi_free_action_script( MSIPACKAGE *package, UINT script ) { UINT i; for (i = 0; i < package->script_actions_count[script]; i++) - msi_free( package->script_actions[script][i] ); + free( package->script_actions[script][i] ); - msi_free( package->script_actions[script] ); + free( package->script_actions[script] ); package->script_actions[script] = NULL; package->script_actions_count[script] = 0; } @@ -170,15 +169,15 @@ static void free_package_structures( MSIPACKAGE *package ) MSIFILE *file = LIST_ENTRY( item, MSIFILE, entry ); list_remove( &file->entry ); - msi_free( file->File ); - msi_free( file->FileName ); - msi_free( file->ShortName ); - msi_free( file->LongName ); - msi_free( file->Version ); - msi_free( file->Language ); + free( file->File ); + free( file->FileName ); + free( file->ShortName ); + free( file->LongName ); + free( file->Version ); + free( file->Language ); if (msi_is_global_assembly( file->Component )) DeleteFileW( file->TargetPath ); - msi_free( file->TargetPath ); - msi_free( file ); + free( file->TargetPath ); + free( file ); } LIST_FOR_EACH_SAFE( item, cursor, &package->components ) @@ -186,14 +185,14 @@ static void free_package_structures( MSIPACKAGE *package ) MSICOMPONENT *comp = LIST_ENTRY( item, MSICOMPONENT, entry ); list_remove( &comp->entry ); - msi_free( comp->Component ); - msi_free( comp->ComponentId ); - msi_free( comp->Directory ); - msi_free( comp->Condition ); - msi_free( comp->KeyPath ); - msi_free( comp->FullKeypath ); + free( comp->Component ); + free( comp->ComponentId ); + free( comp->Directory ); + free( comp->Condition ); + free( comp->KeyPath ); + free( comp->FullKeypath ); if (comp->assembly) free_assembly( comp->assembly ); - msi_free( comp ); + free( comp ); } LIST_FOR_EACH_SAFE( item, cursor, &package->filepatches ) @@ -201,8 +200,8 @@ static void free_package_structures( MSIPACKAGE *package ) MSIFILEPATCH *patch = LIST_ENTRY( item, MSIFILEPATCH, entry ); list_remove( &patch->entry ); - msi_free( patch->path ); - msi_free( patch ); + free( patch->path ); + free( patch ); } /* clean up extension, progid, class and verb structures */ @@ -211,16 +210,16 @@ static void free_package_structures( MSIPACKAGE *package ) MSICLASS *cls = LIST_ENTRY( item, MSICLASS, entry ); list_remove( &cls->entry ); - msi_free( cls->clsid ); - msi_free( cls->Context ); - msi_free( cls->Description ); - msi_free( cls->FileTypeMask ); - msi_free( cls->IconPath ); - msi_free( cls->DefInprocHandler ); - msi_free( cls->DefInprocHandler32 ); - msi_free( cls->Argument ); - msi_free( cls->ProgIDText ); - msi_free( cls ); + free( cls->clsid ); + free( cls->Context ); + free( cls->Description ); + free( cls->FileTypeMask ); + free( cls->IconPath ); + free( cls->DefInprocHandler ); + free( cls->DefInprocHandler32 ); + free( cls->Argument ); + free( cls->ProgIDText ); + free( cls ); } LIST_FOR_EACH_SAFE( item, cursor, &package->extensions ) @@ -236,10 +235,10 @@ static void free_package_structures( MSIPACKAGE *package ) MSIPROGID *progid = LIST_ENTRY( item, MSIPROGID, entry ); list_remove( &progid->entry ); - msi_free( progid->ProgID ); - msi_free( progid->Description ); - msi_free( progid->IconPath ); - msi_free( progid ); + free( progid->ProgID ); + free( progid->Description ); + free( progid->IconPath ); + free( progid ); } LIST_FOR_EACH_SAFE( item, cursor, &package->mimes ) @@ -247,10 +246,10 @@ static void free_package_structures( MSIPACKAGE *package ) MSIMIME *mt = LIST_ENTRY( item, MSIMIME, entry ); list_remove( &mt->entry ); - msi_free( mt->suffix ); - msi_free( mt->clsid ); - msi_free( mt->ContentType ); - msi_free( mt ); + free( mt->suffix ); + free( mt->clsid ); + free( mt->ContentType ); + free( mt ); } LIST_FOR_EACH_SAFE( item, cursor, &package->appids ) @@ -258,12 +257,12 @@ static void free_package_structures( MSIPACKAGE *package ) MSIAPPID *appid = LIST_ENTRY( item, MSIAPPID, entry ); list_remove( &appid->entry ); - msi_free( appid->AppID ); - msi_free( appid->RemoteServerName ); - msi_free( appid->LocalServer ); - msi_free( appid->ServiceParameters ); - msi_free( appid->DllSurrogate ); - msi_free( appid ); + free( appid->AppID ); + free( appid->RemoteServerName ); + free( appid->LocalServer ); + free( appid->ServiceParameters ); + free( appid->DllSurrogate ); + free( appid ); } LIST_FOR_EACH_SAFE( item, cursor, &package->sourcelist_info ) @@ -271,8 +270,8 @@ static void free_package_structures( MSIPACKAGE *package ) MSISOURCELISTINFO *info = LIST_ENTRY( item, MSISOURCELISTINFO, entry ); list_remove( &info->entry ); - msi_free( info->value ); - msi_free( info ); + free( info->value ); + free( info ); } LIST_FOR_EACH_SAFE( item, cursor, &package->sourcelist_media ) @@ -280,17 +279,17 @@ static void free_package_structures( MSIPACKAGE *package ) MSIMEDIADISK *info = LIST_ENTRY( item, MSIMEDIADISK, entry ); list_remove( &info->entry ); - msi_free( info->volume_label ); - msi_free( info->disk_prompt ); - msi_free( info ); + free( info->volume_label ); + free( info->disk_prompt ); + free( info ); } for (i = 0; i < SCRIPT_MAX; i++) msi_free_action_script( package, i ); for (i = 0; i < package->unique_actions_count; i++) - msi_free( package->unique_actions[i] ); - msi_free( package->unique_actions); + free( package->unique_actions[i] ); + free( package->unique_actions ); LIST_FOR_EACH_SAFE( item, cursor, &package->binaries ) { @@ -299,9 +298,9 @@ static void free_package_structures( MSIPACKAGE *package ) list_remove( &binary->entry ); if (!DeleteFileW( binary->tmpfile )) ERR( "failed to delete %s (%lu)\n", debugstr_w(binary->tmpfile), GetLastError() ); - msi_free( binary->source ); - msi_free( binary->tmpfile ); - msi_free( binary ); + free( binary->source ); + free( binary->tmpfile ); + free( binary ); } LIST_FOR_EACH_SAFE( item, cursor, &package->cabinet_streams ) @@ -310,8 +309,8 @@ static void free_package_structures( MSIPACKAGE *package ) list_remove( &cab->entry ); IStorage_Release( cab->storage ); - msi_free( cab->stream ); - msi_free( cab ); + free( cab->stream ); + free( cab ); } LIST_FOR_EACH_SAFE( item, cursor, &package->patches ) @@ -326,12 +325,12 @@ static void free_package_structures( MSIPACKAGE *package ) msi_free_patchinfo( patch ); } - msi_free( package->PackagePath ); - msi_free( package->ProductCode ); - msi_free( package->ActionFormat ); - msi_free( package->LastAction ); - msi_free( package->LastActionTemplate ); - msi_free( package->langids ); + free( package->PackagePath ); + free( package->ProductCode ); + free( package->ActionFormat ); + free( package->LastAction ); + free( package->LastActionTemplate ); + free( package->langids ); /* cleanup control event subscriptions */ msi_event_cleanup_all_subscriptions( package ); @@ -359,7 +358,7 @@ static void MSI_FreePackage( MSIOBJECTHDR *arg) custom_stop_server(package->custom_server_64_process, package->custom_server_64_pipe); if (package->delete_on_close) DeleteFileW( package->localfile ); - msi_free( package->localfile ); + free( package->localfile ); MSI_ProcessMessage(NULL, INSTALLMESSAGE_TERMINATE, 0); } @@ -483,7 +482,7 @@ static UINT set_user_sid_prop( MSIPACKAGE *package ) size = 0; GetUserNameW( NULL, &size ); - user_name = msi_alloc( (size + 1) * sizeof(WCHAR) ); + user_name = malloc( (size + 1) * sizeof(WCHAR) ); if (!user_name) return ERROR_OUTOFMEMORY; @@ -494,8 +493,8 @@ static UINT set_user_sid_prop( MSIPACKAGE *package ) dom_size = 0; LookupAccountNameW( NULL, user_name, NULL, &size, NULL, &dom_size, &use ); - psid = msi_alloc( size ); - dom = msi_alloc( dom_size*sizeof (WCHAR) ); + psid = malloc( size ); + dom = malloc( dom_size * sizeof (WCHAR) ); if (!psid || !dom) { r = ERROR_OUTOFMEMORY; @@ -512,9 +511,9 @@ static UINT set_user_sid_prop( MSIPACKAGE *package ) done: LocalFree( sid_str ); - msi_free( dom ); - msi_free( psid ); - msi_free( user_name ); + free( dom ); + free( psid ); + free( user_name ); return r; } @@ -537,7 +536,7 @@ static LPWSTR get_fusion_filename(MSIPACKAGE *package) if (!RegQueryValueExW(hkey, L"InstallPath", NULL, &type, (BYTE *)path, &size)) { len = lstrlenW(path) + lstrlenW(L"fusion.dll") + 2; - if (!(filename = msi_alloc(len * sizeof(WCHAR)))) return NULL; + if (!(filename = malloc(len * sizeof(WCHAR)))) return NULL; lstrcpyW(filename, path); lstrcatW(filename, L"\\"); @@ -559,8 +558,8 @@ static LPWSTR get_fusion_filename(MSIPACKAGE *package) GetWindowsDirectoryW(windir, MAX_PATH); len = lstrlenW(windir) + lstrlenW(L"Microsoft.NET\\Framework\\") + lstrlenW(L"v2.0.50727") + lstrlenW(L"fusion.dll") + 3; - msi_free(filename); - if (!(filename = msi_alloc(len * sizeof(WCHAR)))) return NULL; + free(filename); + if (!(filename = malloc(len * sizeof(WCHAR)))) return NULL; lstrcpyW(filename, windir); lstrcatW(filename, L"\\"); @@ -580,11 +579,11 @@ static LPWSTR get_fusion_filename(MSIPACKAGE *package) return filename; } -typedef struct tagLANGANDCODEPAGE +struct lang_codepage { WORD wLanguage; WORD wCodePage; -} LANGANDCODEPAGE; +}; static void set_msi_assembly_prop(MSIPACKAGE *package) { @@ -593,7 +592,7 @@ static void set_msi_assembly_prop(MSIPACKAGE *package) LPVOID version = NULL; WCHAR buf[MAX_PATH]; LPWSTR fusion, verstr; - LANGANDCODEPAGE *translate; + struct lang_codepage *translate; fusion = get_fusion_filename(package); if (!fusion) @@ -603,7 +602,7 @@ static void set_msi_assembly_prop(MSIPACKAGE *package) if (!size) goto done; - version = msi_alloc(size); + version = malloc(size); if (!version) goto done; @@ -625,8 +624,8 @@ static void set_msi_assembly_prop(MSIPACKAGE *package) msi_set_property( package->db, L"MsiNetAssemblySupport", verstr, -1 ); done: - msi_free(fusion); - msi_free(version); + free(fusion); + free(version); } static VOID set_installer_properties(MSIPACKAGE *package) @@ -783,7 +782,7 @@ static VOID set_installer_properties(MSIPACKAGE *package) GetNativeSystemInfo( &sys_info ); len = swprintf( bufstr, ARRAY_SIZE(bufstr), L"%d", sys_info.wProcessorLevel ); msi_set_property( package->db, L"Intel", bufstr, len ); - if (sys_info.u.s.wProcessorArchitecture == PROCESSOR_ARCHITECTURE_INTEL) + if (sys_info.wProcessorArchitecture == PROCESSOR_ARCHITECTURE_INTEL) { GetSystemDirectoryW( pth, MAX_PATH ); PathAddBackslashW( pth ); @@ -799,7 +798,7 @@ static VOID set_installer_properties(MSIPACKAGE *package) PathAddBackslashW( pth ); msi_set_property( package->db, L"CommonFilesFolder", pth, -1 ); } - else if (sys_info.u.s.wProcessorArchitecture == PROCESSOR_ARCHITECTURE_AMD64) + else if (sys_info.wProcessorArchitecture == PROCESSOR_ARCHITECTURE_AMD64) { msi_set_property( package->db, L"MsiAMD64", bufstr, -1 ); msi_set_property( package->db, L"Msix64", bufstr, -1 ); @@ -873,8 +872,8 @@ static VOID set_installer_properties(MSIPACKAGE *package) msi_set_property( package->db, L"COMPANYNAME", companyname, -1 ); CloseHandle( hkey ); } - msi_free( username ); - msi_free( companyname ); + free( username ); + free( companyname ); if ( set_user_sid_prop( package ) != ERROR_SUCCESS) ERR("Failed to set the UserSID property\n"); @@ -896,27 +895,27 @@ static VOID set_installer_properties(MSIPACKAGE *package) if (!GetUserNameW( NULL, &len ) && GetLastError() == ERROR_INSUFFICIENT_BUFFER) { WCHAR *username; - if ((username = msi_alloc( len * sizeof(WCHAR) ))) + if ((username = malloc( len * sizeof(WCHAR) ))) { if (GetUserNameW( username, &len )) msi_set_property( package->db, L"LogonUser", username, len - 1 ); - msi_free( username ); + free( username ); } } len = 0; if (!GetComputerNameW( NULL, &len ) && GetLastError() == ERROR_BUFFER_OVERFLOW) { WCHAR *computername; - if ((computername = msi_alloc( len * sizeof(WCHAR) ))) + if ((computername = malloc( len * sizeof(WCHAR) ))) { if (GetComputerNameW( computername, &len )) msi_set_property( package->db, L"ComputerName", computername, len ); - msi_free( computername ); + free( computername ); } } } -static MSIPACKAGE *msi_alloc_package( void ) +static MSIPACKAGE *alloc_package( void ) { MSIPACKAGE *package; @@ -947,7 +946,7 @@ static MSIPACKAGE *msi_alloc_package( void ) return package; } -static UINT msi_load_admin_properties(MSIPACKAGE *package) +static UINT load_admin_properties(MSIPACKAGE *package) { BYTE *data; UINT r, sz; @@ -958,7 +957,7 @@ static UINT msi_load_admin_properties(MSIPACKAGE *package) r = msi_parse_command_line(package, (WCHAR *)data, TRUE); - msi_free(data); + free(data); return r; } @@ -984,7 +983,7 @@ MSIPACKAGE *MSI_CreatePackage( MSIDATABASE *db ) TRACE("%p\n", db); - package = msi_alloc_package(); + package = alloc_package(); if (package) { msiobj_addref( &db->hdr ); @@ -994,7 +993,7 @@ MSIPACKAGE *MSI_CreatePackage( MSIDATABASE *db ) package->LastActionTemplate = NULL; package->LastActionResult = MSI_NULL_INTEGER; package->WordCount = 0; - package->PackagePath = strdupW( db->path ); + package->PackagePath = wcsdup( db->path ); create_temp_property_table( package ); msi_clone_properties( package->db ); @@ -1016,7 +1015,7 @@ MSIPACKAGE *MSI_CreatePackage( MSIDATABASE *db ) } if (package->WordCount & msidbSumInfoSourceTypeAdminImage) - msi_load_admin_properties( package ); + load_admin_properties( package ); package->log_file = INVALID_HANDLE_VALUE; package->script = SCRIPT_NONE; @@ -1037,16 +1036,16 @@ UINT msi_download_file( LPCWSTR szUrl, LPWSTR filename ) GetUrlCacheEntryInfoW( szUrl, NULL, &size ); if ( GetLastError() != ERROR_FILE_NOT_FOUND ) { - cache_entry = msi_alloc( size ); + cache_entry = malloc( size ); if ( !GetUrlCacheEntryInfoW( szUrl, cache_entry, &size ) ) { UINT error = GetLastError(); - msi_free( cache_entry ); + free( cache_entry ); return error; } lstrcpyW( filename, cache_entry->lpszLocalFileName ); - msi_free( cache_entry ); + free( cache_entry ); return ERROR_SUCCESS; } @@ -1118,7 +1117,7 @@ static UINT parse_suminfo( MSISUMMARYINFO *si, MSIPACKAGE *package ) if (!p) { WARN("invalid template string %s\n", debugstr_w(template)); - msi_free( template ); + free( template ); return ERROR_PATCH_PACKAGE_INVALID; } *p = 0; @@ -1134,22 +1133,22 @@ static UINT parse_suminfo( MSISUMMARYINFO *si, MSIPACKAGE *package ) if (package->platform == PLATFORM_UNRECOGNIZED) { WARN("unknown platform %s\n", debugstr_w(template)); - msi_free( template ); + free( template ); return ERROR_INSTALL_PLATFORM_UNSUPPORTED; } p++; if (!*p) { - msi_free( template ); + free( template ); return ERROR_SUCCESS; } count = 1; for (q = p; (q = wcschr( q, ',' )); q++) count++; - package->langids = msi_alloc( count * sizeof(LANGID) ); + package->langids = malloc( count * sizeof(LANGID) ); if (!package->langids) { - msi_free( template ); + free( template ); return ERROR_OUTOFMEMORY; } @@ -1165,7 +1164,7 @@ static UINT parse_suminfo( MSISUMMARYINFO *si, MSIPACKAGE *package ) } package->num_langids = i + 1; - msi_free( template ); + free( template ); return ERROR_SUCCESS; } @@ -1232,7 +1231,7 @@ static WCHAR *get_property( MSIDATABASE *db, const WCHAR *prop ) } if (MSI_ViewFetch( view, &rec ) == ERROR_SUCCESS) { - ret = strdupW( MSI_RecordGetString( rec, 1 ) ); + ret = wcsdup( MSI_RecordGetString( rec, 1 ) ); msiobj_release( &rec->hdr ); } MSI_ViewClose( view ); @@ -1271,7 +1270,7 @@ static UINT get_registered_local_package( const WCHAR *product, WCHAR *localfile return ERROR_FUNCTION_FAILED; lstrcpyW( localfile, filename ); - msi_free( filename ); + free( filename ); return ERROR_SUCCESS; } @@ -1304,7 +1303,7 @@ static UINT get_local_package( MSIDATABASE *db, WCHAR *localfile ) if (!(product_code = get_product_code( db ))) return ERROR_INSTALL_PACKAGE_INVALID; r = get_registered_local_package( product_code, localfile ); - msi_free( product_code ); + free( product_code ); return r; } @@ -1322,10 +1321,10 @@ UINT msi_set_original_database_property( MSIDATABASE *db, const WCHAR *package ) WCHAR *path; if (!(len = GetFullPathNameW( package, 0, NULL, NULL ))) return GetLastError(); - if (!(path = msi_alloc( len * sizeof(WCHAR) ))) return ERROR_OUTOFMEMORY; + if (!(path = malloc( len * sizeof(WCHAR) ))) return ERROR_OUTOFMEMORY; len = GetFullPathNameW( package, len, path, NULL ); r = msi_set_property( db, L"OriginalDatabase", path, len ); - msi_free( path ); + free( path ); } return r; } @@ -1474,7 +1473,10 @@ UINT MSI_OpenPackageW(LPCWSTR szPackage, DWORD dwOptions, MSIPACKAGE **pPackage) TRACE("opening package %s\n", debugstr_w( localfile )); r = MSI_OpenDatabaseW( localfile, MSIDBOPEN_TRANSACT, &db ); if (r != ERROR_SUCCESS) + { + free( product_version ); return r; + } if (product_version) { @@ -1483,18 +1485,18 @@ UINT MSI_OpenPackageW(LPCWSTR szPackage, DWORD dwOptions, MSIPACKAGE **pPackage) (product_version && wcscmp(product_version, cache_version))) { msiobj_release( &db->hdr ); - msi_free(product_version); - msi_free(cache_version); + free( product_version ); + free( cache_version ); return ERROR_PRODUCT_VERSION; } - msi_free(product_version); - msi_free(cache_version); + free( product_version ); + free( cache_version ); } } package = MSI_CreatePackage( db ); msiobj_release( &db->hdr ); if (!package) return ERROR_INSTALL_PACKAGE_INVALID; - package->localfile = strdupW( localfile ); + package->localfile = wcsdup( localfile ); package->delete_on_close = delete_on_close; r = msi_get_suminfo( db->storage, 0, &si ); @@ -1532,7 +1534,7 @@ UINT MSI_OpenPackageW(LPCWSTR szPackage, DWORD dwOptions, MSIPACKAGE **pPackage) TRACE("product already registered\n"); msi_set_property( package->db, L"ProductToBeRegistered", L"1", -1 ); } - msi_free(product_code); + free( product_code ); while (1) { @@ -1565,13 +1567,6 @@ UINT MSI_OpenPackageW(LPCWSTR szPackage, DWORD dwOptions, MSIPACKAGE **pPackage) package->log_file = CreateFileW( gszLogFile, GENERIC_WRITE, FILE_SHARE_WRITE, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL ); - if (!msi_init_assembly_caches( package )) - { - ERR("can't initialize assembly caches\n"); - msiobj_release( &package->hdr ); - return ERROR_FUNCTION_FAILED; - } - /* FIXME: when should these messages be sent? */ data_row = MSI_CreateRecord(3); if (!data_row) @@ -1590,7 +1585,7 @@ UINT MSI_OpenPackageW(LPCWSTR szPackage, DWORD dwOptions, MSIPACKAGE **pPackage) } info_template = msi_get_error_message(package->db, MSIERR_INFO_LOGGINGSTART); MSI_RecordSetStringW(info_row, 0, info_template); - msi_free(info_template); + free(info_template); MSI_ProcessMessage(package, INSTALLMESSAGE_INFO|MB_ICONHAND, info_row); MSI_ProcessMessage(package, INSTALLMESSAGE_COMMONDATA, data_row); @@ -1601,7 +1596,7 @@ UINT MSI_OpenPackageW(LPCWSTR szPackage, DWORD dwOptions, MSIPACKAGE **pPackage) MSI_RecordSetStringW(data_row, 3, NULL); MSI_ProcessMessage(package, INSTALLMESSAGE_COMMONDATA, data_row); - msi_free(productname); + free(productname); msiobj_release(&info_row->hdr); msiobj_release(&data_row->hdr); @@ -1661,7 +1656,7 @@ UINT WINAPI MsiOpenPackageExA(LPCSTR szPackage, DWORD dwOptions, MSIHANDLE *phPa ret = MsiOpenPackageExW( szwPack, dwOptions, phPackage ); - msi_free( szwPack ); + free( szwPack ); return ret; } @@ -1738,7 +1733,7 @@ static INT internal_ui_handler(MSIPACKAGE *package, INSTALLMESSAGE eMessageType, { LPWSTR dialog = msi_dup_record_field(record, 0); INT rc = ACTION_DialogBox(package, dialog); - msi_free(dialog); + free(dialog); return rc; } case INSTALLMESSAGE_ACTIONSTART: @@ -1750,7 +1745,7 @@ static INT internal_ui_handler(MSIPACKAGE *package, INSTALLMESSAGE eMessageType, MSI_RecordSetStringW(uirow, 1, deformatted); msi_event_fire(package, L"ActionText", uirow); - msi_free(deformatted); + free(deformatted); msiobj_release(&uirow->hdr); return 1; } @@ -1835,7 +1830,7 @@ LPWSTR msi_get_error_message(MSIDATABASE *db, int error) int len = LoadStringW(msi_hInstance, IDS_ERROR_BASE + error, (LPWSTR) &ret, 0); if (len) { - ret = msi_alloc((len + 1) * sizeof(WCHAR)); + ret = malloc((len + 1) * sizeof(WCHAR)); LoadStringW(msi_hInstance, IDS_ERROR_BASE + error, ret, len + 1); } else @@ -1864,14 +1859,14 @@ INT MSI_ProcessMessageVerbatim(MSIPACKAGE *package, INSTALLMESSAGE eMessageType, if (res != ERROR_SUCCESS && res != ERROR_MORE_DATA) return res; len++; - message = msi_alloc(len * sizeof(WCHAR)); + message = malloc(len * sizeof(WCHAR)); if (!message) return ERROR_OUTOFMEMORY; MSI_FormatRecordW(package, record, message, &len); } /* convert it to ANSI */ len = WideCharToMultiByte( CP_ACP, 0, message, -1, NULL, 0, NULL, NULL ); - msg = msi_alloc( len ); + msg = malloc( len ); WideCharToMultiByte( CP_ACP, 0, message, -1, msg, len, NULL, NULL ); if (gUIHandlerRecord && (gUIFilterRecord & log_type)) @@ -1905,8 +1900,8 @@ INT MSI_ProcessMessageVerbatim(MSIPACKAGE *package, INSTALLMESSAGE eMessageType, WriteFile( package->log_file, msg, len - 1, &written, NULL ); WriteFile( package->log_file, "\n", 1, &written, NULL ); } - msi_free( msg ); - msi_free( message ); + free( msg ); + free( message ); return rc; } @@ -1946,7 +1941,7 @@ INT MSI_ProcessMessage( MSIPACKAGE *package, INSTALLMESSAGE eMessageType, MSIREC template_rec = msi_get_error_message(package->db, MSIERR_INSTALLERROR); MSI_RecordSetStringW(record, 0, template_rec); MSI_ProcessMessageVerbatim(package, eMessageType, record); - msi_free(template_rec); + free(template_rec); return 0; } } @@ -1955,39 +1950,44 @@ INT MSI_ProcessMessage( MSIPACKAGE *package, INSTALLMESSAGE eMessageType, MSIREC template_rec = msi_dup_record_field(record, 0); template_prefix = msi_get_error_message(package->db, eMessageType >> 24); - if (!template_prefix) template_prefix = strdupW(L""); + if (!template_prefix) template_prefix = wcsdup(L""); if (!template_rec) { /* always returns 0 */ MSI_RecordSetStringW(record, 0, template_prefix); MSI_ProcessMessageVerbatim(package, eMessageType, record); - msi_free(template_prefix); + free(template_prefix); return 0; } - template = msi_alloc((lstrlenW(template_rec) + lstrlenW(template_prefix) + 1) * sizeof(WCHAR)); - if (!template) return ERROR_OUTOFMEMORY; + template = malloc((wcslen(template_rec) + wcslen(template_prefix) + 1) * sizeof(WCHAR)); + if (!template) + { + free(template_prefix); + free(template_rec); + return ERROR_OUTOFMEMORY; + } lstrcpyW(template, template_prefix); lstrcatW(template, template_rec); MSI_RecordSetStringW(record, 0, template); - msi_free(template_prefix); - msi_free(template_rec); - msi_free(template); + free(template_prefix); + free(template_rec); + free(template); } break; case INSTALLMESSAGE_ACTIONSTART: { WCHAR *template = msi_get_error_message(package->db, MSIERR_ACTIONSTART); MSI_RecordSetStringW(record, 0, template); - msi_free(template); + free(template); - msi_free(package->LastAction); - msi_free(package->LastActionTemplate); + free(package->LastAction); + free(package->LastActionTemplate); package->LastAction = msi_dup_record_field(record, 1); - if (!package->LastAction) package->LastAction = strdupW(L""); + if (!package->LastAction) package->LastAction = wcsdup(L""); package->LastActionTemplate = msi_dup_record_field(record, 3); break; } @@ -1995,18 +1995,18 @@ INT MSI_ProcessMessage( MSIPACKAGE *package, INSTALLMESSAGE eMessageType, MSIREC if (package->LastAction && package->LastActionTemplate) { size_t len = lstrlenW(package->LastAction) + lstrlenW(package->LastActionTemplate) + 7; - WCHAR *template = msi_alloc(len * sizeof(WCHAR)); + WCHAR *template = malloc(len * sizeof(WCHAR)); if (!template) return ERROR_OUTOFMEMORY; swprintf(template, len, L"{{%s: }}%s", package->LastAction, package->LastActionTemplate); MSI_RecordSetStringW(record, 0, template); - msi_free(template); + free(template); } break; case INSTALLMESSAGE_COMMONDATA: { WCHAR *template = msi_get_error_message(package->db, MSIERR_COMMONDATA); MSI_RecordSetStringW(record, 0, template); - msi_free(template); + free(template); } break; } @@ -2080,8 +2080,8 @@ UINT WINAPI MsiSetPropertyA( MSIHANDLE hInstall, LPCSTR szName, LPCSTR szValue ) r = MsiSetPropertyW( hInstall, szwName, szwValue); end: - msi_free( szwName ); - msi_free( szwValue ); + free( szwName ); + free( szwValue ); return r; } @@ -2092,7 +2092,7 @@ void msi_reset_source_folders( MSIPACKAGE *package ) LIST_FOR_EACH_ENTRY( folder, &package->folders, MSIFOLDER, entry ) { - msi_free( folder->ResolvedSource ); + free( folder->ResolvedSource ); folder->ResolvedSource = NULL; } } @@ -2180,7 +2180,7 @@ UINT WINAPI MsiSetPropertyW( MSIHANDLE hInstall, LPCWSTR szName, LPCWSTR szValue return ret; } -static MSIRECORD *msi_get_property_row( MSIDATABASE *db, LPCWSTR name ) +static MSIRECORD *get_property_row( MSIDATABASE *db, const WCHAR *name ) { MSIRECORD *rec, *row = NULL; MSIQUERY *view; @@ -2196,17 +2196,17 @@ static MSIRECORD *msi_get_property_row( MSIDATABASE *db, LPCWSTR name ) length = GetDateFormatW(LOCALE_USER_DEFAULT, DATE_SHORTDATE, NULL, NULL, NULL, 0); if (!length) return NULL; - buffer = msi_alloc(length * sizeof(WCHAR)); + buffer = malloc(length * sizeof(WCHAR)); GetDateFormatW(LOCALE_USER_DEFAULT, DATE_SHORTDATE, NULL, NULL, buffer, length); row = MSI_CreateRecord(1); if (!row) { - msi_free(buffer); + free(buffer); return NULL; } MSI_RecordSetStringW(row, 1, buffer); - msi_free(buffer); + free(buffer); return row; } else if (!wcscmp(name, L"Time")) @@ -2214,17 +2214,17 @@ static MSIRECORD *msi_get_property_row( MSIDATABASE *db, LPCWSTR name ) length = GetTimeFormatW(LOCALE_USER_DEFAULT, TIME_NOTIMEMARKER, NULL, NULL, NULL, 0); if (!length) return NULL; - buffer = msi_alloc(length * sizeof(WCHAR)); + buffer = malloc(length * sizeof(WCHAR)); GetTimeFormatW(LOCALE_USER_DEFAULT, TIME_NOTIMEMARKER, NULL, NULL, buffer, length); row = MSI_CreateRecord(1); if (!row) { - msi_free(buffer); + free(buffer); return NULL; } MSI_RecordSetStringW(row, 1, buffer); - msi_free(buffer); + free(buffer); return row; } @@ -2255,7 +2255,7 @@ UINT msi_get_property( MSIDATABASE *db, LPCWSTR szName, TRACE("%p %s %p %p\n", db, debugstr_w(szName), szValueBuf, pchValueBuf); - row = msi_get_property_row( db, szName ); + row = get_property_row( db, szName ); if (*pchValueBuf > 0) szValueBuf[0] = 0; @@ -2291,11 +2291,11 @@ LPWSTR msi_dup_property(MSIDATABASE *db, LPCWSTR prop) return NULL; sz++; - str = msi_alloc(sz * sizeof(WCHAR)); + str = malloc(sz * sizeof(WCHAR)); r = msi_get_property(db, prop, str, &sz); if (r != ERROR_SUCCESS) { - msi_free(str); + free(str); str = NULL; } @@ -2306,7 +2306,7 @@ int msi_get_property_int( MSIDATABASE *db, LPCWSTR prop, int def ) { LPWSTR str = msi_dup_property( db, prop ); int val = str ? wcstol(str, NULL, 10) : def; - msi_free(str); + free(str); return val; } @@ -2370,7 +2370,7 @@ UINT WINAPI MsiGetPropertyA(MSIHANDLE hinst, const char *name, char *buf, DWORD return r; } - row = msi_get_property_row(package->db, nameW); + row = get_property_row(package->db, nameW); if (row) value = msi_record_get_string(row, 1, &len); @@ -2433,7 +2433,7 @@ UINT WINAPI MsiGetPropertyW(MSIHANDLE hinst, const WCHAR *name, WCHAR *buf, DWOR return r; } - row = msi_get_property_row(package->db, name); + row = get_property_row(package->db, name); if (row) value = msi_record_get_string(row, 1, &len); @@ -2632,14 +2632,14 @@ UINT msi_package_add_info(MSIPACKAGE *package, DWORD context, DWORD options, if (!wcscmp( info->value, value )) return ERROR_SUCCESS; } - info = msi_alloc(sizeof(MSISOURCELISTINFO)); + info = malloc(sizeof(MSISOURCELISTINFO)); if (!info) return ERROR_OUTOFMEMORY; info->context = context; info->options = options; info->property = property; - info->value = strdupW(value); + info->value = wcsdup(value); list_add_head(&package->sourcelist_info, &info->entry); return ERROR_SUCCESS; @@ -2655,15 +2655,15 @@ UINT msi_package_add_media_disk(MSIPACKAGE *package, DWORD context, DWORD option if (disk->disk_id == disk_id) return ERROR_SUCCESS; } - disk = msi_alloc(sizeof(MSIMEDIADISK)); + disk = malloc(sizeof(MSIMEDIADISK)); if (!disk) return ERROR_OUTOFMEMORY; disk->context = context; disk->options = options; disk->disk_id = disk_id; - disk->volume_label = strdupW(volume_label); - disk->disk_prompt = strdupW(disk_prompt); + disk->volume_label = wcsdup(volume_label); + disk->disk_prompt = wcsdup(disk_prompt); list_add_head(&package->sourcelist_media, &disk->entry); return ERROR_SUCCESS; diff --git a/dll/win32/msi/patch.c b/dll/win32/msi/patch.c index 35b2784ba8573..3b8a4eef0333d 100644 --- a/dll/win32/msi/patch.c +++ b/dll/win32/msi/patch.c @@ -54,12 +54,12 @@ struct transform_desc static void free_transform_desc( struct transform_desc *desc ) { - msi_free( desc->product_code_from ); - msi_free( desc->product_code_to ); - msi_free( desc->version_from ); - msi_free( desc->version_to ); - msi_free( desc->upgrade_code ); - msi_free( desc ); + free( desc->product_code_from ); + free( desc->product_code_to ); + free( desc->version_from ); + free( desc->version_to ); + free( desc->upgrade_code ); + free( desc ); } static struct transform_desc *parse_transform_desc( const WCHAR *str ) @@ -68,20 +68,20 @@ static struct transform_desc *parse_transform_desc( const WCHAR *str ) const WCHAR *p = str, *q; UINT len; - if (!(ret = msi_alloc_zero( sizeof(*ret) ))) return NULL; + if (!(ret = calloc( 1, sizeof(*ret) ))) return NULL; q = wcschr( p, '}' ); if (*p != '{' || !q) goto error; len = q - p + 1; - if (!(ret->product_code_from = msi_alloc( (len + 1) * sizeof(WCHAR) ))) goto error; + if (!(ret->product_code_from = malloc( (len + 1) * sizeof(WCHAR) ))) goto error; memcpy( ret->product_code_from, p, len * sizeof(WCHAR) ); ret->product_code_from[len] = 0; p = q + 1; if (!(q = wcschr( p, ';' ))) goto error; len = q - p; - if (!(ret->version_from = msi_alloc( (len + 1) * sizeof(WCHAR) ))) goto error; + if (!(ret->version_from = malloc( (len + 1) * sizeof(WCHAR) ))) goto error; memcpy( ret->version_from, p, len * sizeof(WCHAR) ); ret->version_from[len] = 0; @@ -90,14 +90,14 @@ static struct transform_desc *parse_transform_desc( const WCHAR *str ) if (*p != '{' || !q) goto error; len = q - p + 1; - if (!(ret->product_code_to = msi_alloc( (len + 1) * sizeof(WCHAR) ))) goto error; + if (!(ret->product_code_to = malloc( (len + 1) * sizeof(WCHAR) ))) goto error; memcpy( ret->product_code_to, p, len * sizeof(WCHAR) ); ret->product_code_to[len] = 0; p = q + 1; if (!(q = wcschr( p, ';' ))) goto error; len = q - p; - if (!(ret->version_to = msi_alloc( (len + 1) * sizeof(WCHAR) ))) goto error; + if (!(ret->version_to = malloc( (len + 1) * sizeof(WCHAR) ))) goto error; memcpy( ret->version_to, p, len * sizeof(WCHAR) ); ret->version_to[len] = 0; @@ -106,7 +106,7 @@ static struct transform_desc *parse_transform_desc( const WCHAR *str ) if (*p != '{' || !q) goto error; len = q - p + 1; - if (!(ret->upgrade_code = msi_alloc( (len + 1) * sizeof(WCHAR) ))) goto error; + if (!(ret->upgrade_code = malloc( (len + 1) * sizeof(WCHAR) ))) goto error; memcpy( ret->upgrade_code, p, len * sizeof(WCHAR) ); ret->upgrade_code[len] = 0; @@ -157,18 +157,18 @@ static UINT check_transform_applicable( MSIPACKAGE *package, IStorage *transform if (!(product = msi_get_suminfo_product( transform ))) { WARN("no product property!\n"); - msi_free( template ); + free( template ); msiobj_release( &si->hdr ); return ERROR_FUNCTION_FAILED; } TRACE("product property: %s\n", debugstr_w(product)); if (!(desc = parse_transform_desc( product ))) { - msi_free( template ); + free( template ); msiobj_release( &si->hdr ); return ERROR_FUNCTION_FAILED; } - msi_free( product ); + free( product ); if (wanted_flags & MSITRANSFORM_VALIDATE_LANGUAGE) { @@ -183,7 +183,7 @@ static UINT check_transform_applicable( MSIPACKAGE *package, IStorage *transform if (!product_code_installed) { - msi_free( template ); + free( template ); free_transform_desc( desc ); msiobj_release( &si->hdr ); return ERROR_INSTALL_PACKAGE_INVALID; @@ -192,9 +192,9 @@ static UINT check_transform_applicable( MSIPACKAGE *package, IStorage *transform { valid_flags |= MSITRANSFORM_VALIDATE_PRODUCT; } - msi_free( product_code_installed ); + free( product_code_installed ); } - msi_free( template ); + free( template ); if (wanted_flags & MSITRANSFORM_VALIDATE_MAJORVERSION) { WCHAR *product_version_installed = msi_dup_property( package->db, L"ProductVersion" ); @@ -214,7 +214,7 @@ static UINT check_transform_applicable( MSIPACKAGE *package, IStorage *transform valid_flags |= MSITRANSFORM_VALIDATE_MAJORVERSION; wanted_flags &= ~MSITRANSFORM_VALIDATE_MINORVERSION; } - msi_free( product_version_installed ); + free( product_version_installed ); } else if (wanted_flags & MSITRANSFORM_VALIDATE_MINORVERSION) { @@ -232,7 +232,7 @@ static UINT check_transform_applicable( MSIPACKAGE *package, IStorage *transform if (major_installed == major && minor_installed == minor) valid_flags |= MSITRANSFORM_VALIDATE_MINORVERSION; - msi_free( product_version_installed ); + free( product_version_installed ); } if (wanted_flags & MSITRANSFORM_VALIDATE_UPGRADECODE) { @@ -246,7 +246,7 @@ static UINT check_transform_applicable( MSIPACKAGE *package, IStorage *transform } if (!wcscmp( desc->upgrade_code, upgrade_code_installed )) valid_flags |= MSITRANSFORM_VALIDATE_UPGRADECODE; - msi_free( upgrade_code_installed ); + free( upgrade_code_installed ); } free_transform_desc( desc ); @@ -309,38 +309,38 @@ UINT msi_check_patch_applicable( MSIPACKAGE *package, MSISUMMARYINFO *si ) { if (!wcscmp( guids[i], product_code )) ret = ERROR_SUCCESS; } - msi_free( guids ); - msi_free( guid_list ); - msi_free( product_code ); + free( guids ); + free( guid_list ); + free( product_code ); return ret; } -static UINT msi_parse_patch_summary( MSISUMMARYINFO *si, MSIPATCHINFO **patch ) +static UINT parse_patch_summary( MSISUMMARYINFO *si, MSIPATCHINFO **patch ) { MSIPATCHINFO *pi; UINT r = ERROR_SUCCESS; WCHAR *p; - if (!(pi = msi_alloc_zero( sizeof(MSIPATCHINFO) ))) + if (!(pi = calloc( 1, sizeof(MSIPATCHINFO) ))) { return ERROR_OUTOFMEMORY; } if (!(pi->patchcode = msi_suminfo_dup_string( si, PID_REVNUMBER ))) { - msi_free( pi ); + free( pi ); return ERROR_OUTOFMEMORY; } p = pi->patchcode; if (*p != '{') { - msi_free( pi->patchcode ); - msi_free( pi ); + free( pi->patchcode ); + free( pi ); return ERROR_PATCH_PACKAGE_INVALID; } if (!(p = wcschr( p + 1, '}' ))) { - msi_free( pi->patchcode ); - msi_free( pi ); + free( pi->patchcode ); + free( pi ); return ERROR_PATCH_PACKAGE_INVALID; } if (p[1]) @@ -351,15 +351,15 @@ static UINT msi_parse_patch_summary( MSISUMMARYINFO *si, MSIPATCHINFO **patch ) TRACE("patch code %s\n", debugstr_w(pi->patchcode)); if (!(pi->products = msi_suminfo_dup_string( si, PID_TEMPLATE ))) { - msi_free( pi->patchcode ); - msi_free( pi ); + free( pi->patchcode ); + free( pi ); return ERROR_OUTOFMEMORY; } if (!(pi->transforms = msi_suminfo_dup_string( si, PID_LASTAUTHOR ))) { - msi_free( pi->patchcode ); - msi_free( pi->products ); - msi_free( pi ); + free( pi->patchcode ); + free( pi->products ); + free( pi ); return ERROR_OUTOFMEMORY; } *patch = pi; @@ -387,7 +387,7 @@ static UINT patch_set_media_source_prop( MSIPACKAGE *package ) property = MSI_RecordGetString( rec, 1 ); patch = msi_dup_property( package->db, L"PATCH" ); msi_set_property( package->db, property, patch, -1 ); - msi_free( patch ); + free( patch ); msiobj_release( &rec->hdr ); } @@ -413,7 +413,7 @@ struct patch_offset_list static struct patch_offset_list *patch_offset_list_create( void ) { - struct patch_offset_list *pos = msi_alloc( sizeof(struct patch_offset_list) ); + struct patch_offset_list *pos = malloc( sizeof(struct patch_offset_list) ); list_init( &pos->files ); list_init( &pos->patches ); pos->count = pos->max = 0; @@ -427,15 +427,15 @@ static void patch_offset_list_free( struct patch_offset_list *pos ) LIST_FOR_EACH_ENTRY_SAFE( po, po2, &pos->files, struct patch_offset, entry ) { - msi_free( po->name ); - msi_free( po ); + free( po->name ); + free( po ); } LIST_FOR_EACH_ENTRY_SAFE( po, po2, &pos->patches, struct patch_offset, entry ) { - msi_free( po->name ); - msi_free( po ); + free( po->name ); + free( po ); } - msi_free( pos ); + free( pos ); } static void patch_offset_get_filepatches( MSIDATABASE *db, UINT last_sequence, struct patch_offset_list *pos ) @@ -458,7 +458,7 @@ static void patch_offset_get_filepatches( MSIDATABASE *db, UINT last_sequence, s while (MSI_ViewFetch( view, &rec ) == ERROR_SUCCESS) { - struct patch_offset *po = msi_alloc( sizeof(struct patch_offset) ); + struct patch_offset *po = malloc( sizeof(struct patch_offset) ); po->name = msi_dup_record_field( rec, 1 ); po->sequence = MSI_RecordGetInteger( rec, 2 ); @@ -495,7 +495,7 @@ static void patch_offset_get_files( MSIDATABASE *db, UINT last_sequence, struct UINT attributes = MSI_RecordGetInteger( rec, 7 ); if (attributes & msidbFileAttributesPatchAdded) { - struct patch_offset *po = msi_alloc( sizeof(struct patch_offset) ); + struct patch_offset *po = malloc( sizeof(struct patch_offset) ); po->name = msi_dup_record_field( rec, 1 ); po->sequence = MSI_RecordGetInteger( rec, 8 ); @@ -669,7 +669,7 @@ static UINT patch_add_media( MSIPACKAGE *package, IStorage *storage, MSIPATCHINF msiobj_release( &rec->hdr ); continue; } - if (!(media = msi_alloc( sizeof( *media )))) + if (!(media = malloc( sizeof( *media )))) { msiobj_release( &rec->hdr ); goto done; @@ -739,11 +739,11 @@ static UINT patch_add_media( MSIPACKAGE *package, IStorage *storage, MSIPATCHINF LIST_FOR_EACH_ENTRY_SAFE( media, next, &media_list, struct patch_media, entry ) { list_remove( &media->entry ); - msi_free( media->prompt ); - msi_free( media->cabinet ); - msi_free( media->volume ); - msi_free( media->source ); - msi_free( media ); + free( media->prompt ); + free( media->cabinet ); + free( media->volume ); + free( media->source ); + free( media ); } return r; } @@ -831,7 +831,7 @@ static DWORD is_uninstallable( MSIDATABASE *db ) return ret; } -static UINT msi_apply_patch_db( MSIPACKAGE *package, MSIDATABASE *patch_db, MSIPATCHINFO *patch ) +static UINT apply_patch_db( MSIPACKAGE *package, MSIDATABASE *patch_db, MSIPATCHINFO *patch ) { UINT i, r = ERROR_SUCCESS; WCHAR **substorage; @@ -848,7 +848,7 @@ static UINT msi_apply_patch_db( MSIPACKAGE *package, MSIDATABASE *patch_db, MSIP r = patch_add_media( package, patch_db->storage, patch ); } } - msi_free( substorage ); + free( substorage ); if (r != ERROR_SUCCESS) return r; @@ -864,15 +864,15 @@ static UINT msi_apply_patch_db( MSIPACKAGE *package, MSIDATABASE *patch_db, MSIP void msi_free_patchinfo( MSIPATCHINFO *patch ) { - msi_free( patch->patchcode ); - msi_free( patch->products ); - msi_free( patch->transforms ); - msi_free( patch->filename ); - msi_free( patch->localfile ); - msi_free( patch ); + free( patch->patchcode ); + free( patch->products ); + free( patch->transforms ); + free( patch->filename ); + free( patch->localfile ); + free( patch ); } -static UINT msi_apply_patch_package( MSIPACKAGE *package, const WCHAR *file ) +static UINT apply_patch_package( MSIPACKAGE *package, const WCHAR *file ) { MSIDATABASE *patch_db = NULL; WCHAR localfile[MAX_PATH]; @@ -901,7 +901,7 @@ static UINT msi_apply_patch_package( MSIPACKAGE *package, const WCHAR *file ) r = ERROR_SUCCESS; goto done; } - r = msi_parse_patch_summary( si, &patch ); + r = parse_patch_summary( si, &patch ); if ( r != ERROR_SUCCESS ) goto done; @@ -911,10 +911,10 @@ static UINT msi_apply_patch_package( MSIPACKAGE *package, const WCHAR *file ) r = ERROR_OUTOFMEMORY; patch->registered = FALSE; - if (!(patch->filename = strdupW( file ))) goto done; - if (!(patch->localfile = strdupW( localfile ))) goto done; + if (!(patch->filename = wcsdup( file ))) goto done; + if (!(patch->localfile = wcsdup( localfile ))) goto done; - r = msi_apply_patch_db( package, patch_db, patch ); + r = apply_patch_db( package, patch_db, patch ); if (r != ERROR_SUCCESS) WARN("patch failed to apply %u\n", r); done: @@ -940,10 +940,10 @@ UINT msi_apply_patches( MSIPACKAGE *package ) patches = msi_split_string( patch_list, ';' ); for (i = 0; patches && patches[i] && r == ERROR_SUCCESS; i++) - r = msi_apply_patch_package( package, patches[i] ); + r = apply_patch_package( package, patches[i] ); - msi_free( patches ); - msi_free( patch_list ); + free( patches ); + free( patch_list ); return r; } @@ -969,21 +969,21 @@ UINT msi_apply_transforms( MSIPACKAGE *package ) WCHAR *p = wcsrchr( package->PackagePath, '\\' ); DWORD len = p - package->PackagePath + 1; - if (!(transform = msi_alloc( (len + lstrlenW( xforms[i] ) + 1) * sizeof(WCHAR)) )) + if (!(transform = malloc( (len + wcslen( xforms[i] ) + 1) * sizeof(WCHAR)) )) { - msi_free( xforms ); - msi_free( xform_list ); + free( xforms ); + free( xform_list ); return ERROR_OUTOFMEMORY; } memcpy( transform, package->PackagePath, len * sizeof(WCHAR) ); memcpy( transform + len, xforms[i], (lstrlenW( xforms[i] ) + 1) * sizeof(WCHAR) ); } r = MSI_DatabaseApplyTransformW( package->db, transform, 0 ); - if (transform != xforms[i]) msi_free( transform ); + if (transform != xforms[i]) free( transform ); } } - msi_free( xforms ); - msi_free( xform_list ); + free( xforms ); + free( xform_list ); return r; } @@ -1018,7 +1018,7 @@ UINT msi_apply_registered_patch( MSIPACKAGE *package, LPCWSTR patch_code ) msiobj_release( &patch_db->hdr ); return r; } - r = msi_parse_patch_summary( si, &patch_info ); + r = parse_patch_summary( si, &patch_info ); msiobj_release( &si->hdr ); if (r != ERROR_SUCCESS) { @@ -1027,14 +1027,14 @@ UINT msi_apply_registered_patch( MSIPACKAGE *package, LPCWSTR patch_code ) return r; } patch_info->registered = TRUE; - patch_info->localfile = strdupW( patch_file ); + patch_info->localfile = wcsdup( patch_file ); if (!patch_info->localfile) { msiobj_release( &patch_db->hdr ); msi_free_patchinfo( patch_info ); return ERROR_OUTOFMEMORY; } - r = msi_apply_patch_db( package, patch_db, patch_info ); + r = apply_patch_db( package, patch_db, patch_info ); msiobj_release( &patch_db->hdr ); if (r != ERROR_SUCCESS) { diff --git a/dll/win32/msi/precomp.h b/dll/win32/msi/precomp.h index 47defd80631ae..99a1cabfcab8f 100644 --- a/dll/win32/msi/precomp.h +++ b/dll/win32/msi/precomp.h @@ -13,8 +13,6 @@ #endif #define COBJMACROS -#define NONAMELESSUNION -#define NONAMELESSSTRUCT #include "msipriv.h" #include "query.h" diff --git a/dll/win32/msi/query.h b/dll/win32/msi/query.h index 5e5f3906f4f8a..1997b50e932e3 100644 --- a/dll/win32/msi/query.h +++ b/dll/win32/msi/query.h @@ -68,7 +68,6 @@ struct complex_expr struct expr *right; }; -struct tagJOINTABLE; union ext_column { struct @@ -79,7 +78,7 @@ union ext_column struct { UINT column; - struct tagJOINTABLE *table; + struct join_table *table; } parsed; }; @@ -109,50 +108,46 @@ typedef struct struct list *mem; } SQL_input; -UINT MSI_ParseSQL( MSIDATABASE *db, LPCWSTR command, MSIVIEW **phview, - struct list *mem ) DECLSPEC_HIDDEN; +UINT MSI_ParseSQL( MSIDATABASE *db, LPCWSTR command, MSIVIEW **phview, struct list *mem ); -UINT TABLE_CreateView( MSIDATABASE *db, LPCWSTR name, MSIVIEW **view ) DECLSPEC_HIDDEN; +UINT TABLE_CreateView( MSIDATABASE *db, LPCWSTR name, MSIVIEW **view ); -UINT SELECT_CreateView( MSIDATABASE *db, MSIVIEW **view, MSIVIEW *table, - const column_info *columns ) DECLSPEC_HIDDEN; +UINT SELECT_CreateView( MSIDATABASE *db, MSIVIEW **view, MSIVIEW *table, const column_info *columns ); -UINT DISTINCT_CreateView( MSIDATABASE *db, MSIVIEW **view, MSIVIEW *table ) DECLSPEC_HIDDEN; +UINT DISTINCT_CreateView( MSIDATABASE *db, MSIVIEW **view, MSIVIEW *table ); -UINT ORDER_CreateView( MSIDATABASE *db, MSIVIEW **view, MSIVIEW *table, - column_info *columns ) DECLSPEC_HIDDEN; +UINT ORDER_CreateView( MSIDATABASE *db, MSIVIEW **view, MSIVIEW *table, column_info *columns ); -UINT WHERE_CreateView( MSIDATABASE *db, MSIVIEW **view, LPWSTR tables, - struct expr *cond ) DECLSPEC_HIDDEN; +UINT WHERE_CreateView( MSIDATABASE *db, MSIVIEW **view, LPWSTR tables, struct expr *cond ); UINT CREATE_CreateView( MSIDATABASE *db, MSIVIEW **view, LPCWSTR table, - column_info *col_info, BOOL hold ) DECLSPEC_HIDDEN; + column_info *col_info, BOOL hold ); UINT INSERT_CreateView( MSIDATABASE *db, MSIVIEW **view, LPCWSTR table, - column_info *columns, column_info *values, BOOL temp ) DECLSPEC_HIDDEN; + column_info *columns, column_info *values, BOOL temp ); UINT UPDATE_CreateView( MSIDATABASE *db, MSIVIEW **view, LPWSTR table, - column_info *list, struct expr *expr ) DECLSPEC_HIDDEN; + column_info *list, struct expr *expr ); -UINT DELETE_CreateView( MSIDATABASE *db, MSIVIEW **view, MSIVIEW *table ) DECLSPEC_HIDDEN; +UINT DELETE_CreateView( MSIDATABASE *db, MSIVIEW **view, MSIVIEW *table ); -UINT ALTER_CreateView( MSIDATABASE *db, MSIVIEW **view, LPCWSTR name, column_info *colinfo, int hold ) DECLSPEC_HIDDEN; +UINT ALTER_CreateView( MSIDATABASE *db, MSIVIEW **view, LPCWSTR name, column_info *colinfo, int hold ); -UINT STREAMS_CreateView( MSIDATABASE *db, MSIVIEW **view ) DECLSPEC_HIDDEN; +UINT STREAMS_CreateView( MSIDATABASE *db, MSIVIEW **view ); -UINT STORAGES_CreateView( MSIDATABASE *db, MSIVIEW **view ) DECLSPEC_HIDDEN; +UINT STORAGES_CreateView( MSIDATABASE *db, MSIVIEW **view ); -UINT DROP_CreateView( MSIDATABASE *db, MSIVIEW **view, LPCWSTR name ) DECLSPEC_HIDDEN; +UINT DROP_CreateView( MSIDATABASE *db, MSIVIEW **view, LPCWSTR name ); -int sqliteGetToken(const WCHAR *z, int *tokenType, int *skip) DECLSPEC_HIDDEN; +int sqliteGetToken(const WCHAR *z, int *tokenType, int *skip); -MSIRECORD *msi_query_merge_record( UINT fields, const column_info *vl, MSIRECORD *rec ) DECLSPEC_HIDDEN; +MSIRECORD *msi_query_merge_record( UINT fields, const column_info *vl, MSIRECORD *rec ); UINT msi_create_table( MSIDATABASE *db, LPCWSTR name, column_info *col_info, - MSICONDITION persistent, BOOL hold ) DECLSPEC_HIDDEN; + MSICONDITION persistent, BOOL hold ); -UINT msi_select_update( MSIVIEW *view, MSIRECORD *rec, UINT row ) DECLSPEC_HIDDEN; +UINT msi_select_update( MSIVIEW *view, MSIRECORD *rec, UINT row ); -UINT msi_view_refresh_row( MSIDATABASE *db, MSIVIEW *view, UINT row, MSIRECORD *rec ) DECLSPEC_HIDDEN; +UINT msi_view_refresh_row( MSIDATABASE *db, MSIVIEW *view, UINT row, MSIRECORD *rec ); #endif /* __WINE_MSI_QUERY_H */ diff --git a/dll/win32/msi/record.c b/dll/win32/msi/record.c index 9e11752cc9789..3671133ac4c17 100644 --- a/dll/win32/msi/record.c +++ b/dll/win32/msi/record.c @@ -54,7 +54,7 @@ static void MSI_FreeField( MSIFIELD *field ) case MSIFIELD_INT: break; case MSIFIELD_WSTR: - msi_free( field->u.szwVal); + free( field->u.szwVal); break; case MSIFIELD_STREAM: IStream_Release( field->u.stream ); @@ -157,7 +157,7 @@ WCHAR *msi_strdupW( const WCHAR *value, int len ) WCHAR *ret; if (!value) return NULL; - if (!(ret = msi_alloc( (len + 1) * sizeof(WCHAR) ))) return NULL; + if (!(ret = malloc( (len + 1) * sizeof(WCHAR) ))) return NULL; memcpy( ret, value, len * sizeof(WCHAR) ); ret[len] = 0; return ret; @@ -497,7 +497,7 @@ UINT WINAPI MsiRecordGetStringW( MSIHANDLE handle, UINT iField, WCHAR *szValue, return ret; } -static UINT msi_get_stream_size( IStream *stm ) +static UINT get_stream_size( IStream *stm ) { STATSTG stat; HRESULT r; @@ -524,7 +524,7 @@ static UINT MSI_RecordDataSize(MSIRECORD *rec, UINT iField) case MSIFIELD_NULL: break; case MSIFIELD_STREAM: - return msi_get_stream_size( rec->fields[iField].u.stream ); + return get_stream_size( rec->fields[iField].u.stream ); } return 0; } @@ -559,14 +559,14 @@ UINT WINAPI MsiRecordSetStringA( MSIHANDLE handle, UINT iField, const char *szVa rec = msihandle2msiinfo( handle, MSIHANDLETYPE_RECORD ); if( !rec ) { - msi_free( valueW ); + free( valueW ); return ERROR_INVALID_HANDLE; } msiobj_lock( &rec->hdr ); ret = MSI_RecordSetStringW( rec, iField, valueW ); msiobj_unlock( &rec->hdr ); msiobj_release( &rec->hdr ); - msi_free( valueW ); + free( valueW ); return ret; } @@ -735,7 +735,7 @@ UINT WINAPI MsiRecordSetStreamA( MSIHANDLE hRecord, UINT iField, const char *szF return ERROR_OUTOFMEMORY; } ret = MsiRecordSetStreamW(hRecord, iField, wstr); - msi_free(wstr); + free(wstr); return ret; } @@ -865,7 +865,7 @@ UINT MSI_RecordGetIStream( MSIRECORD *rec, UINT iField, IStream **pstm) return ERROR_SUCCESS; } -static UINT msi_dump_stream_to_file( IStream *stm, LPCWSTR name ) +static UINT dump_stream_to_file( IStream *stm, const WCHAR *name ) { ULARGE_INTEGER size; LARGE_INTEGER pos; @@ -909,7 +909,7 @@ UINT MSI_RecordStreamToFile( MSIRECORD *rec, UINT iField, LPCWSTR name ) r = MSI_RecordGetIStream( rec, iField, &stm ); if( r == ERROR_SUCCESS ) { - r = msi_dump_stream_to_file( stm, name ); + r = dump_stream_to_file( stm, name ); IStream_Release( stm ); } @@ -1012,14 +1012,14 @@ WCHAR *msi_dup_record_field( MSIRECORD *rec, INT field ) return NULL; sz++; - str = msi_alloc( sz * sizeof(WCHAR) ); + str = malloc( sz * sizeof(WCHAR) ); if (!str) return NULL; str[0] = 0; r = MSI_RecordGetStringW( rec, field, str, &sz ); if (r != ERROR_SUCCESS) { ERR("failed to get string!\n"); - msi_free( str ); + free( str ); return NULL; } return str; @@ -1129,7 +1129,7 @@ struct wire_record *marshal_record(MSIHANDLE handle) ret->fields[i].u.iVal = rec->fields[i].u.iVal; break; case MSIFIELD_WSTR: - ret->fields[i].u.szwVal = strdupW(rec->fields[i].u.szwVal); + ret->fields[i].u.szwVal = wcsdup(rec->fields[i].u.szwVal); break; case MSIFIELD_STREAM: IStream_AddRef(rec->fields[i].u.stream); diff --git a/dll/win32/msi/registry.c b/dll/win32/msi/registry.c index 877b889ef42fd..149f9cf994553 100644 --- a/dll/win32/msi/registry.c +++ b/dll/win32/msi/registry.c @@ -251,7 +251,7 @@ LPWSTR msi_reg_get_val_str( HKEY hkey, LPCWSTR name ) return NULL; len += sizeof (WCHAR); - val = msi_alloc( len ); + val = malloc( len ); if (!val) return NULL; val[0] = 0; @@ -274,15 +274,15 @@ static WCHAR *get_user_sid(void) WCHAR *ret; if (!OpenProcessToken( GetCurrentProcess(), TOKEN_QUERY, &token )) return NULL; - if (!(user = msi_alloc( size ))) + if (!(user = malloc( size ))) { CloseHandle( token ); return NULL; } if (!GetTokenInformation( token, TokenUser, user, size, &size )) { - msi_free( user ); - if (GetLastError() != ERROR_INSUFFICIENT_BUFFER || !(user = msi_alloc( size ))) + free( user ); + if (GetLastError() != ERROR_INSUFFICIENT_BUFFER || !(user = malloc( size ))) { CloseHandle( token ); return NULL; @@ -292,10 +292,10 @@ static WCHAR *get_user_sid(void) CloseHandle( token ); if (!ConvertSidToStringSidW( user->User.Sid, &ret )) { - msi_free( user ); + free( user ); return NULL; } - msi_free( user ); + free( user ); return ret; } @@ -1016,7 +1016,7 @@ UINT WINAPI MsiDecomposeDescriptorA( LPCSTR szDescriptor, LPSTR szProduct, szComponent, MAX_FEATURE_CHARS+1, NULL, NULL ); } - msi_free( str ); + free( str ); return r; } @@ -1070,7 +1070,7 @@ UINT WINAPI MsiEnumFeaturesA( const char *szProduct, DWORD index, char *szFeatur WideCharToMultiByte(CP_ACP, 0, szwParent, -1, szParent, GUID_SIZE, NULL, NULL); } - msi_free( szwProduct); + free(szwProduct); return r; } @@ -1132,9 +1132,9 @@ UINT WINAPI MsiEnumComponentsExA( const char *user_sid, DWORD ctx, DWORD index, if (sid && !sid_len) return ERROR_INVALID_PARAMETER; if (user_sid && !(user_sidW = strdupAtoW( user_sid ))) return ERROR_OUTOFMEMORY; - if (sid && !(sidW = msi_alloc( *sid_len * sizeof(WCHAR) ))) + if (sid && !(sidW = malloc( *sid_len * sizeof(WCHAR) ))) { - msi_free( user_sidW ); + free( user_sidW ); return ERROR_OUTOFMEMORY; } r = MsiEnumComponentsExW( user_sidW, ctx, index, guidW, installed_ctx, sidW, sid_len ); @@ -1143,8 +1143,8 @@ UINT WINAPI MsiEnumComponentsExA( const char *user_sid, DWORD ctx, DWORD index, if (guid) WideCharToMultiByte( CP_ACP, 0, guidW, GUID_SIZE, guid, GUID_SIZE, NULL, NULL ); if (sid) WideCharToMultiByte( CP_ACP, 0, sidW, *sid_len + 1, sid, *sid_len + 1, NULL, NULL ); } - msi_free( user_sidW ); - msi_free( sidW ); + free( user_sidW ); + free( sidW ); return r; } @@ -1347,7 +1347,7 @@ UINT WINAPI MsiEnumClientsA( const char *szComponent, DWORD index, char *szProdu if( r == ERROR_SUCCESS ) WideCharToMultiByte(CP_ACP, 0, szwProduct, -1, szProduct, GUID_SIZE, NULL, NULL); - msi_free( szwComponent); + free(szwComponent); return r; } @@ -1429,13 +1429,13 @@ static UINT MSI_EnumComponentQualifiers( const WCHAR *szComponent, DWORD iIndex, /* figure out how big the name is we want to return */ name_max = 0x10; r = ERROR_OUTOFMEMORY; - name = msi_alloc( name_max * sizeof(WCHAR) ); + name = malloc( name_max * sizeof(WCHAR) ); if (!name) goto end; val_max = 0x10; r = ERROR_OUTOFMEMORY; - val = msi_alloc( val_max ); + val = malloc( val_max ); if (!val) goto end; @@ -1460,8 +1460,8 @@ static UINT MSI_EnumComponentQualifiers( const WCHAR *szComponent, DWORD iIndex, if (name_sz + 1 >= name_max) { name_max *= 2; - msi_free( name ); - name = msi_alloc( name_max * sizeof (WCHAR) ); + free( name ); + name = malloc( name_max * sizeof (WCHAR) ); if (!name) goto end; continue; @@ -1469,8 +1469,8 @@ static UINT MSI_EnumComponentQualifiers( const WCHAR *szComponent, DWORD iIndex, if (val_sz > val_max) { val_max = val_sz + sizeof (WCHAR); - msi_free( val ); - val = msi_alloc( val_max * sizeof (WCHAR) ); + free( val ); + val = malloc( val_max * sizeof (WCHAR) ); if (!val) goto end; continue; @@ -1493,8 +1493,8 @@ static UINT MSI_EnumComponentQualifiers( const WCHAR *szComponent, DWORD iIndex, r = r2; end: - msi_free(val); - msi_free(name); + free(val); + free(name); RegCloseKey(key); return r; } @@ -1525,7 +1525,7 @@ UINT WINAPI MsiEnumComponentQualifiersA( const char *szComponent, DWORD iIndex, r = MSI_EnumComponentQualifiers( comp, iIndex, &qual, pcchQualifierBuf, &appdata, pcchApplicationDataBuf ); - msi_free( comp ); + free( comp ); return r; } @@ -1608,7 +1608,7 @@ UINT WINAPI MsiEnumRelatedProductsA( const char *szUpgradeCode, DWORD dwReserved WideCharToMultiByte( CP_ACP, 0, productW, GUID_SIZE, lpProductBuf, GUID_SIZE, NULL, NULL ); } - msi_free( szwUpgradeCode); + free( szwUpgradeCode ); return r; } @@ -1654,7 +1654,7 @@ UINT WINAPI MsiEnumPatchesExA( const char *szProductCode, const char *szUserSid, goto done; } - targsid = msi_alloc(++len * sizeof(WCHAR)); + targsid = malloc(++len * sizeof(WCHAR)); if (!targsid) { r = ERROR_OUTOFMEMORY; @@ -1680,16 +1680,15 @@ UINT WINAPI MsiEnumPatchesExA( const char *szProductCode, const char *szUserSid, *pcchTargetUserSid = len; done: - msi_free(prodcode); - msi_free(usersid); - msi_free(targsid); + free(prodcode); + free(usersid); + free(targsid); return r; } -static UINT msi_get_patch_state(LPCWSTR prodcode, LPCWSTR usersid, - MSIINSTALLCONTEXT context, - LPWSTR patch, MSIPATCHSTATE *state) +static UINT get_patch_state(const WCHAR *prodcode, const WCHAR *usersid, MSIINSTALLCONTEXT context, + WCHAR *patch, MSIPATCHSTATE *state) { DWORD type, val, size; HKEY prod, hkey = 0; @@ -1732,10 +1731,9 @@ static UINT msi_get_patch_state(LPCWSTR prodcode, LPCWSTR usersid, return r; } -static UINT msi_check_product_patches(LPCWSTR prodcode, LPCWSTR usersid, - MSIINSTALLCONTEXT context, DWORD filter, DWORD index, DWORD *idx, - LPWSTR patch, LPWSTR targetprod, MSIINSTALLCONTEXT *targetctx, - LPWSTR targetsid, DWORD *sidsize, LPWSTR *transforms) +static UINT check_product_patches(const WCHAR *prodcode, const WCHAR *usersid, MSIINSTALLCONTEXT context, + DWORD filter, DWORD index, DWORD *idx, WCHAR *patch, WCHAR *targetprod, + MSIINSTALLCONTEXT *targetctx, WCHAR *targetsid, DWORD *sidsize, WCHAR **transforms) { MSIPATCHSTATE state = MSIPATCHSTATE_INVALID; LPWSTR ptr, patches = NULL; @@ -1761,7 +1759,7 @@ static UINT msi_check_product_patches(LPCWSTR prodcode, LPCWSTR usersid, goto done; } - patches = msi_alloc(size); + patches = malloc(size); if (!patches) { r = ERROR_OUTOFMEMORY; @@ -1789,7 +1787,7 @@ static UINT msi_check_product_patches(LPCWSTR prodcode, LPCWSTR usersid, if (transforms) { - *transforms = msi_alloc(size); + *transforms = malloc(size); if (!*transforms) { r = ERROR_OUTOFMEMORY; @@ -1806,8 +1804,7 @@ static UINT msi_check_product_patches(LPCWSTR prodcode, LPCWSTR usersid, { if (!(filter & MSIPATCHSTATE_APPLIED)) { - temp = msi_get_patch_state(prodcode, usersid, context, - ptr, &state); + temp = get_patch_state(prodcode, usersid, context, ptr, &state); if (temp == ERROR_BAD_CONFIGURATION) { r = ERROR_BAD_CONFIGURATION; @@ -1822,8 +1819,7 @@ static UINT msi_check_product_patches(LPCWSTR prodcode, LPCWSTR usersid, { if (!(filter & MSIPATCHSTATE_APPLIED)) { - temp = msi_get_patch_state(prodcode, usersid, context, - ptr, &state); + temp = get_patch_state(prodcode, usersid, context, ptr, &state); if (temp == ERROR_BAD_CONFIGURATION) { r = ERROR_BAD_CONFIGURATION; @@ -1896,16 +1892,15 @@ static UINT msi_check_product_patches(LPCWSTR prodcode, LPCWSTR usersid, done: RegCloseKey(prod); - msi_free(patches); + free(patches); return r; } -static UINT msi_enum_patches(LPCWSTR szProductCode, LPCWSTR szUserSid, - DWORD dwContext, DWORD dwFilter, DWORD dwIndex, DWORD *idx, - LPWSTR szPatchCode, LPWSTR szTargetProductCode, - MSIINSTALLCONTEXT *pdwTargetProductContext, LPWSTR szTargetUserSid, - LPDWORD pcchTargetUserSid, LPWSTR *szTransforms) +static UINT enum_patches(const WCHAR *szProductCode, const WCHAR *szUserSid, DWORD dwContext, DWORD dwFilter, + DWORD dwIndex, DWORD *idx, WCHAR *szPatchCode, WCHAR *szTargetProductCode, + MSIINSTALLCONTEXT *pdwTargetProductContext, WCHAR *szTargetUserSid, DWORD *pcchTargetUserSid, + WCHAR **szTransforms) { LPWSTR usersid = NULL; UINT r = ERROR_INVALID_PARAMETER; @@ -1918,36 +1913,27 @@ static UINT msi_enum_patches(LPCWSTR szProductCode, LPCWSTR szUserSid, if (dwContext & MSIINSTALLCONTEXT_USERMANAGED) { - r = msi_check_product_patches(szProductCode, szUserSid, - MSIINSTALLCONTEXT_USERMANAGED, dwFilter, - dwIndex, idx, szPatchCode, - szTargetProductCode, - pdwTargetProductContext, szTargetUserSid, - pcchTargetUserSid, szTransforms); + r = check_product_patches(szProductCode, szUserSid, MSIINSTALLCONTEXT_USERMANAGED, dwFilter, dwIndex, idx, + szPatchCode, szTargetProductCode, pdwTargetProductContext, szTargetUserSid, + pcchTargetUserSid, szTransforms); if (r != ERROR_NO_MORE_ITEMS) goto done; } if (dwContext & MSIINSTALLCONTEXT_USERUNMANAGED) { - r = msi_check_product_patches(szProductCode, szUserSid, - MSIINSTALLCONTEXT_USERUNMANAGED, dwFilter, - dwIndex, idx, szPatchCode, - szTargetProductCode, - pdwTargetProductContext, szTargetUserSid, - pcchTargetUserSid, szTransforms); + r = check_product_patches(szProductCode, szUserSid, MSIINSTALLCONTEXT_USERUNMANAGED, dwFilter, dwIndex, idx, + szPatchCode, szTargetProductCode, pdwTargetProductContext, szTargetUserSid, + pcchTargetUserSid, szTransforms); if (r != ERROR_NO_MORE_ITEMS) goto done; } if (dwContext & MSIINSTALLCONTEXT_MACHINE) { - r = msi_check_product_patches(szProductCode, szUserSid, - MSIINSTALLCONTEXT_MACHINE, dwFilter, - dwIndex, idx, szPatchCode, - szTargetProductCode, - pdwTargetProductContext, szTargetUserSid, - pcchTargetUserSid, szTransforms); + r = check_product_patches(szProductCode, szUserSid, MSIINSTALLCONTEXT_MACHINE, dwFilter, dwIndex, idx, + szPatchCode, szTargetProductCode, pdwTargetProductContext, szTargetUserSid, + pcchTargetUserSid, szTransforms); if (r != ERROR_NO_MORE_ITEMS) goto done; } @@ -1997,10 +1983,8 @@ UINT WINAPI MsiEnumPatchesExW( const WCHAR *szProductCode, const WCHAR *szUserSi if (dwIndex == 0) last_index = 0; - r = msi_enum_patches(szProductCode, szUserSid, dwContext, dwFilter, - dwIndex, &idx, szPatchCode, szTargetProductCode, - pdwTargetProductContext, szTargetUserSid, - pcchTargetUserSid, NULL); + r = enum_patches(szProductCode, szUserSid, dwContext, dwFilter, dwIndex, &idx, szPatchCode, szTargetProductCode, + pdwTargetProductContext, szTargetUserSid, pcchTargetUserSid, NULL); if (r == ERROR_SUCCESS) last_index = dwIndex; @@ -2031,7 +2015,7 @@ UINT WINAPI MsiEnumPatchesA( const char *szProduct, DWORD iPatchIndex, char *lpP return ERROR_OUTOFMEMORY; len = *pcchTransformsBuf; - transforms = msi_alloc( len * sizeof(WCHAR) ); + transforms = malloc(len * sizeof(WCHAR)); if (!transforms) { r = ERROR_OUTOFMEMORY; @@ -2058,8 +2042,8 @@ UINT WINAPI MsiEnumPatchesA( const char *szProduct, DWORD iPatchIndex, char *lpP *pcchTransformsBuf = strlen( lpTransformsBuf ); done: - msi_free(transforms); - msi_free(product); + free(transforms); + free(product); return r; } @@ -2094,9 +2078,8 @@ UINT WINAPI MsiEnumPatchesW( const WCHAR *szProduct, DWORD iPatchIndex, WCHAR *l RegCloseKey(prod); - r = msi_enum_patches(szProduct, NULL, MSIINSTALLCONTEXT_ALL, - MSIPATCHSTATE_ALL, iPatchIndex, &idx, lpPatchBuf, - NULL, NULL, NULL, NULL, &transforms); + r = enum_patches(szProduct, NULL, MSIINSTALLCONTEXT_ALL, MSIPATCHSTATE_ALL, iPatchIndex, &idx, lpPatchBuf, NULL, + NULL, NULL, NULL, &transforms); if (r != ERROR_SUCCESS) goto done; @@ -2110,7 +2093,7 @@ UINT WINAPI MsiEnumPatchesW( const WCHAR *szProduct, DWORD iPatchIndex, WCHAR *l *pcchTransformsBuf = lstrlenW(transforms); done: - msi_free(transforms); + free(transforms); return r; } @@ -2128,13 +2111,13 @@ UINT WINAPI MsiEnumProductsExA( const char *product, const char *usersid, DWORD if (product && !(productW = strdupAtoW( product ))) return ERROR_OUTOFMEMORY; if (usersid && !(usersidW = strdupAtoW( usersid ))) { - msi_free( productW ); + free( productW ); return ERROR_OUTOFMEMORY; } - if (sid && !(sidW = msi_alloc( *sid_len * sizeof(WCHAR) ))) + if (sid && !(sidW = malloc( *sid_len * sizeof(WCHAR) ))) { - msi_free( usersidW ); - msi_free( productW ); + free( usersidW ); + free( productW ); return ERROR_OUTOFMEMORY; } r = MsiEnumProductsExW( productW, usersidW, ctx, index, installed_productW, @@ -2145,9 +2128,9 @@ UINT WINAPI MsiEnumProductsExA( const char *product, const char *usersid, DWORD installed_product, GUID_SIZE, NULL, NULL ); if (sid) WideCharToMultiByte( CP_ACP, 0, sidW, *sid_len + 1, sid, *sid_len + 1, NULL, NULL ); } - msi_free( productW ); - msi_free( usersidW ); - msi_free( sidW ); + free( productW ); + free( usersidW ); + free( sidW ); return r; } diff --git a/dll/win32/msi/script.c b/dll/win32/msi/script.c index 26dcddc041e7d..f355918b07d73 100644 --- a/dll/win32/msi/script.c +++ b/dll/win32/msi/script.c @@ -50,18 +50,19 @@ WINE_DEFAULT_DEBUG_CHANNEL(msi); #endif /* - * MsiActiveScriptSite - Our IActiveScriptSite implementation. + * struct script_site - Our IActiveScriptSite implementation. */ -typedef struct { +struct script_site +{ IActiveScriptSite IActiveScriptSite_iface; IDispatch *installer; IDispatch *session; LONG ref; -} MsiActiveScriptSite; +}; -static inline MsiActiveScriptSite *impl_from_IActiveScriptSite( IActiveScriptSite *iface ) +static inline struct script_site *impl_from_IActiveScriptSite( IActiveScriptSite *iface ) { - return CONTAINING_RECORD(iface, MsiActiveScriptSite, IActiveScriptSite_iface); + return CONTAINING_RECORD(iface, struct script_site, IActiveScriptSite_iface); } /* @@ -69,7 +70,7 @@ static inline MsiActiveScriptSite *impl_from_IActiveScriptSite( IActiveScriptSit */ static HRESULT WINAPI MsiActiveScriptSite_QueryInterface(IActiveScriptSite* iface, REFIID riid, void** obj) { - MsiActiveScriptSite *This = impl_from_IActiveScriptSite(iface); + struct script_site *This = impl_from_IActiveScriptSite(iface); TRACE("(%p)->(%s, %p)\n", This, debugstr_guid(riid), obj); @@ -88,7 +89,7 @@ static HRESULT WINAPI MsiActiveScriptSite_QueryInterface(IActiveScriptSite* ifac static ULONG WINAPI MsiActiveScriptSite_AddRef(IActiveScriptSite* iface) { - MsiActiveScriptSite *This = impl_from_IActiveScriptSite(iface); + struct script_site *This = impl_from_IActiveScriptSite(iface); ULONG ref = InterlockedIncrement(&This->ref); TRACE( "(%p)->(%lu)\n", This, ref ); return ref; @@ -96,27 +97,27 @@ static ULONG WINAPI MsiActiveScriptSite_AddRef(IActiveScriptSite* iface) static ULONG WINAPI MsiActiveScriptSite_Release(IActiveScriptSite* iface) { - MsiActiveScriptSite *This = impl_from_IActiveScriptSite(iface); + struct script_site *This = impl_from_IActiveScriptSite(iface); ULONG ref = InterlockedDecrement(&This->ref); TRACE( "(%p)->(%lu)\n", This, ref ); if (!ref) - msi_free(This); + free(This); return ref; } static HRESULT WINAPI MsiActiveScriptSite_GetLCID(IActiveScriptSite* iface, LCID* plcid) { - MsiActiveScriptSite *This = impl_from_IActiveScriptSite(iface); + struct script_site *This = impl_from_IActiveScriptSite(iface); TRACE("(%p)->(%p)\n", This, plcid); return E_NOTIMPL; /* Script will use system-defined locale */ } static HRESULT WINAPI MsiActiveScriptSite_GetItemInfo(IActiveScriptSite* iface, LPCOLESTR pstrName, DWORD dwReturnMask, IUnknown** ppiunkItem, ITypeInfo** ppti) { - MsiActiveScriptSite *This = impl_from_IActiveScriptSite(iface); + struct script_site *This = impl_from_IActiveScriptSite(iface); TRACE( "(%p)->(%p, %lu, %p, %p)\n", This, pstrName, dwReturnMask, ppiunkItem, ppti ); @@ -149,14 +150,14 @@ static HRESULT WINAPI MsiActiveScriptSite_GetItemInfo(IActiveScriptSite* iface, static HRESULT WINAPI MsiActiveScriptSite_GetDocVersionString(IActiveScriptSite* iface, BSTR* pbstrVersion) { - MsiActiveScriptSite *This = impl_from_IActiveScriptSite(iface); + struct script_site *This = impl_from_IActiveScriptSite(iface); TRACE("(%p)->(%p)\n", This, pbstrVersion); return E_NOTIMPL; } static HRESULT WINAPI MsiActiveScriptSite_OnScriptTerminate(IActiveScriptSite* iface, const VARIANT* pvarResult, const EXCEPINFO* pexcepinfo) { - MsiActiveScriptSite *This = impl_from_IActiveScriptSite(iface); + struct script_site *This = impl_from_IActiveScriptSite(iface); TRACE("(%p)->(%p, %p)\n", This, pvarResult, pexcepinfo); return S_OK; } @@ -198,7 +199,7 @@ static HRESULT WINAPI MsiActiveScriptSite_OnStateChange(IActiveScriptSite* iface static HRESULT WINAPI MsiActiveScriptSite_OnScriptError(IActiveScriptSite* iface, IActiveScriptError* pscripterror) { - MsiActiveScriptSite *This = impl_from_IActiveScriptSite(iface); + struct script_site *This = impl_from_IActiveScriptSite(iface); EXCEPINFO exception; HRESULT hr; @@ -219,14 +220,14 @@ static HRESULT WINAPI MsiActiveScriptSite_OnScriptError(IActiveScriptSite* iface static HRESULT WINAPI MsiActiveScriptSite_OnEnterScript(IActiveScriptSite* iface) { - MsiActiveScriptSite *This = impl_from_IActiveScriptSite(iface); + struct script_site *This = impl_from_IActiveScriptSite(iface); TRACE("(%p)\n", This); return S_OK; } static HRESULT WINAPI MsiActiveScriptSite_OnLeaveScript(IActiveScriptSite* iface) { - MsiActiveScriptSite *This = impl_from_IActiveScriptSite(iface); + struct script_site *This = impl_from_IActiveScriptSite(iface); TRACE("(%p)\n", This); return S_OK; } @@ -246,15 +247,15 @@ static const struct IActiveScriptSiteVtbl activescriptsitevtbl = MsiActiveScriptSite_OnLeaveScript }; -static HRESULT create_activescriptsite(MsiActiveScriptSite **obj) +static HRESULT create_activescriptsite(struct script_site **obj) { - MsiActiveScriptSite* object; + struct script_site *object; TRACE("(%p)\n", obj); *obj = NULL; - object = msi_alloc( sizeof(MsiActiveScriptSite) ); + object = malloc(sizeof(*object)); if (!object) return E_OUTOFMEMORY; @@ -290,7 +291,7 @@ DWORD call_script(MSIHANDLE hPackage, INT type, LPCWSTR script, LPCWSTR function HRESULT hr; IActiveScript *pActiveScript = NULL; IActiveScriptParse *pActiveScriptParse = NULL; - MsiActiveScriptSite *scriptsite; + struct script_site *scriptsite; IDispatch *pDispatch = NULL; DISPPARAMS dispparamsNoArgs = {NULL, NULL, 0, 0}; DISPID dispid; diff --git a/dll/win32/msi/select.c b/dll/win32/msi/select.c index d5a8e1fde23b1..975d2b8e06686 100644 --- a/dll/win32/msi/select.c +++ b/dll/win32/msi/select.c @@ -20,6 +20,8 @@ #include +#define COBJMACROS + #include "windef.h" #include "winbase.h" #include "winerror.h" @@ -38,7 +40,7 @@ WINE_DEFAULT_DEBUG_CHANNEL(msidb); /* below is the query interface to a table */ -typedef struct tagMSISELECTVIEW +struct select_view { MSIVIEW view; MSIDATABASE *db; @@ -46,9 +48,9 @@ typedef struct tagMSISELECTVIEW UINT num_cols; UINT max_cols; UINT cols[1]; -} MSISELECTVIEW; +}; -static UINT translate_record( MSISELECTVIEW *sv, MSIRECORD *in, MSIRECORD **out ) +static UINT translate_record( struct select_view *sv, MSIRECORD *in, MSIRECORD **out ) { UINT r, col_count, i; MSIRECORD *object; @@ -74,7 +76,7 @@ static UINT translate_record( MSISELECTVIEW *sv, MSIRECORD *in, MSIRECORD **out static UINT SELECT_fetch_int( struct tagMSIVIEW *view, UINT row, UINT col, UINT *val ) { - MSISELECTVIEW *sv = (MSISELECTVIEW*)view; + struct select_view *sv = (struct select_view *)view; TRACE("%p %d %d %p\n", sv, row, col, val ); @@ -95,7 +97,7 @@ static UINT SELECT_fetch_int( struct tagMSIVIEW *view, UINT row, UINT col, UINT static UINT SELECT_fetch_stream( struct tagMSIVIEW *view, UINT row, UINT col, IStream **stm) { - MSISELECTVIEW *sv = (MSISELECTVIEW*)view; + struct select_view *sv = (struct select_view *)view; TRACE("%p %d %d %p\n", sv, row, col, stm ); @@ -116,7 +118,7 @@ static UINT SELECT_fetch_stream( struct tagMSIVIEW *view, UINT row, UINT col, IS static UINT SELECT_set_row( struct tagMSIVIEW *view, UINT row, MSIRECORD *rec, UINT mask ) { - MSISELECTVIEW *sv = (MSISELECTVIEW*)view; + struct select_view *sv = (struct select_view *)view; UINT i, expanded_mask = 0, r = ERROR_SUCCESS, col_count = 0; MSIRECORD *expanded; @@ -158,7 +160,7 @@ static UINT SELECT_set_row( struct tagMSIVIEW *view, UINT row, MSIRECORD *rec, U static UINT SELECT_insert_row( struct tagMSIVIEW *view, MSIRECORD *record, UINT row, BOOL temporary ) { - MSISELECTVIEW *sv = (MSISELECTVIEW*)view; + struct select_view *sv = (struct select_view *)view; UINT table_cols, r; MSIRECORD *outrec; @@ -183,7 +185,7 @@ static UINT SELECT_insert_row( struct tagMSIVIEW *view, MSIRECORD *record, UINT static UINT SELECT_execute( struct tagMSIVIEW *view, MSIRECORD *record ) { - MSISELECTVIEW *sv = (MSISELECTVIEW*)view; + struct select_view *sv = (struct select_view *)view; TRACE("%p %p\n", sv, record); @@ -195,7 +197,7 @@ static UINT SELECT_execute( struct tagMSIVIEW *view, MSIRECORD *record ) static UINT SELECT_close( struct tagMSIVIEW *view ) { - MSISELECTVIEW *sv = (MSISELECTVIEW*)view; + struct select_view *sv = (struct select_view *)view; TRACE("%p\n", sv ); @@ -207,7 +209,7 @@ static UINT SELECT_close( struct tagMSIVIEW *view ) static UINT SELECT_get_dimensions( struct tagMSIVIEW *view, UINT *rows, UINT *cols ) { - MSISELECTVIEW *sv = (MSISELECTVIEW*)view; + struct select_view *sv = (struct select_view *)view; TRACE("%p %p %p\n", sv, rows, cols ); @@ -223,7 +225,7 @@ static UINT SELECT_get_dimensions( struct tagMSIVIEW *view, UINT *rows, UINT *co static UINT SELECT_get_column_info( struct tagMSIVIEW *view, UINT n, LPCWSTR *name, UINT *type, BOOL *temporary, LPCWSTR *table_name ) { - MSISELECTVIEW *sv = (MSISELECTVIEW*)view; + struct select_view *sv = (struct select_view *)view; TRACE("%p %d %p %p %p %p\n", sv, n, name, type, temporary, table_name ); @@ -248,7 +250,7 @@ static UINT SELECT_get_column_info( struct tagMSIVIEW *view, UINT n, LPCWSTR *na UINT msi_select_update(MSIVIEW *view, MSIRECORD *rec, UINT row) { - MSISELECTVIEW *sv = (MSISELECTVIEW*)view; + struct select_view *sv = (struct select_view *)view; UINT r, i, col, type, val; IStream *stream; LPCWSTR str; @@ -269,6 +271,7 @@ UINT msi_select_update(MSIVIEW *view, MSIRECORD *rec, UINT row) if (MSI_RecordGetIStream(rec, i + 1, &stream)) return ERROR_FUNCTION_FAILED; r = sv->table->ops->set_stream(sv->table, row, col, stream); + IStream_Release(stream); } else if (type & MSITYPE_STRING) { @@ -295,7 +298,7 @@ UINT msi_select_update(MSIVIEW *view, MSIRECORD *rec, UINT row) static UINT SELECT_modify( struct tagMSIVIEW *view, MSIMODIFY mode, MSIRECORD *rec, UINT row ) { - MSISELECTVIEW *sv = (MSISELECTVIEW*)view; + struct select_view *sv = (struct select_view *)view; MSIRECORD *table_rec; UINT r; @@ -336,7 +339,7 @@ static UINT SELECT_modify( struct tagMSIVIEW *view, MSIMODIFY mode, static UINT SELECT_delete( struct tagMSIVIEW *view ) { - MSISELECTVIEW *sv = (MSISELECTVIEW*)view; + struct select_view *sv = (struct select_view *)view; TRACE("%p\n", sv ); @@ -344,7 +347,7 @@ static UINT SELECT_delete( struct tagMSIVIEW *view ) sv->table->ops->delete( sv->table ); sv->table = NULL; - msi_free( sv ); + free( sv ); return ERROR_SUCCESS; } @@ -372,8 +375,7 @@ static const MSIVIEWOPS select_ops = NULL, }; -static UINT SELECT_AddColumn( MSISELECTVIEW *sv, LPCWSTR name, - LPCWSTR table_name ) +static UINT SELECT_AddColumn( struct select_view *sv, const WCHAR *name, const WCHAR *table_name ) { UINT r, n; MSIVIEW *table; @@ -423,14 +425,14 @@ static int select_count_columns( const column_info *col ) UINT SELECT_CreateView( MSIDATABASE *db, MSIVIEW **view, MSIVIEW *table, const column_info *columns ) { - MSISELECTVIEW *sv = NULL; + struct select_view *sv = NULL; UINT count = 0, r = ERROR_SUCCESS; TRACE("%p\n", sv ); count = select_count_columns( columns ); - sv = msi_alloc_zero( FIELD_OFFSET( MSISELECTVIEW, cols[count] )); + sv = calloc( 1, offsetof( struct select_view, cols[count] ) ); if( !sv ) return ERROR_FUNCTION_FAILED; @@ -452,7 +454,7 @@ UINT SELECT_CreateView( MSIDATABASE *db, MSIVIEW **view, MSIVIEW *table, if( r == ERROR_SUCCESS ) *view = &sv->view; else - msi_free( sv ); + free( sv ); return r; } diff --git a/dll/win32/msi/source.c b/dll/win32/msi/source.c index 7ed0aabf142d2..d67a16ab4a3ad 100644 --- a/dll/win32/msi/source.c +++ b/dll/win32/msi/source.c @@ -42,13 +42,13 @@ WINE_DEFAULT_DEBUG_CHANNEL(msi); * These apis are defined in MSI 3.0 */ -typedef struct tagMediaInfo +struct media_info { struct list entry; LPWSTR path; WCHAR szIndex[10]; DWORD index; -} media_info; +}; static UINT OpenSourceKey(LPCWSTR szProduct, HKEY* key, DWORD dwOptions, MSIINSTALLCONTEXT context, BOOL create) @@ -162,10 +162,10 @@ UINT WINAPI MsiSourceListEnumMediaDisksA( const char *szProductCodeOrPatchCode, /* FIXME: add tests for an invalid format */ if (pcchVolumeLabel) - volume = msi_alloc(*pcchVolumeLabel * sizeof(WCHAR)); + volume = malloc(*pcchVolumeLabel * sizeof(WCHAR)); if (pcchDiskPrompt) - prompt = msi_alloc(*pcchDiskPrompt * sizeof(WCHAR)); + prompt = malloc(*pcchDiskPrompt * sizeof(WCHAR)); if (volume) *volume = '\0'; if (prompt) *prompt = '\0'; @@ -184,10 +184,10 @@ UINT WINAPI MsiSourceListEnumMediaDisksA( const char *szProductCodeOrPatchCode, *pcchDiskPrompt + 1, NULL, NULL); done: - msi_free(product); - msi_free(usersid); - msi_free(volume); - msi_free(prompt); + free(product); + free(usersid); + free(volume); + free(prompt); return r; } @@ -249,8 +249,8 @@ UINT WINAPI MsiSourceListEnumMediaDisksW( const WCHAR *szProductCodeOrPatchCode, goto done; } - value = msi_alloc(++valuesz * sizeof(WCHAR)); - data = msi_alloc(++datasz * sizeof(WCHAR)); + value = malloc(++valuesz * sizeof(WCHAR)); + data = malloc(++datasz * sizeof(WCHAR)); if (!value || !data) { r = ERROR_OUTOFMEMORY; @@ -316,8 +316,8 @@ UINT WINAPI MsiSourceListEnumMediaDisksW( const WCHAR *szProductCodeOrPatchCode, index++; done: - msi_free(value); - msi_free(data); + free(value); + free(data); RegCloseKey(source); return r; @@ -355,7 +355,7 @@ UINT WINAPI MsiSourceListEnumSourcesA( const char *szProductCodeOrPatch, const c if (r != ERROR_SUCCESS) goto done; - source = msi_alloc(++len * sizeof(WCHAR)); + source = malloc(++len * sizeof(WCHAR)); if (!source) { r = ERROR_OUTOFMEMORY; @@ -378,9 +378,9 @@ UINT WINAPI MsiSourceListEnumSourcesA( const char *szProductCodeOrPatch, const c *pcchSource = len - 1; done: - msi_free(product); - msi_free(usersid); - msi_free(source); + free(product); + free(usersid); + free(source); if (r == ERROR_SUCCESS) { @@ -491,7 +491,7 @@ UINT WINAPI MsiSourceListGetInfoA( LPCSTR szProduct, LPCSTR szUserSid, if (ret != ERROR_SUCCESS) goto done; - value = msi_alloc(++len * sizeof(WCHAR)); + value = malloc(++len * sizeof(WCHAR)); if (!value) return ERROR_OUTOFMEMORY; @@ -510,10 +510,10 @@ UINT WINAPI MsiSourceListGetInfoA( LPCSTR szProduct, LPCSTR szUserSid, *pcchValue = len - 1; done: - msi_free(product); - msi_free(usersid); - msi_free(property); - msi_free(value); + free(product); + free(usersid); + free(property); + free(value); return ret; } @@ -583,13 +583,13 @@ UINT WINAPI MsiSourceListGetInfoW( LPCWSTR szProduct, LPCWSTR szUserSid, goto output_out; } - source = msi_alloc(size); + source = malloc(size); RegQueryValueExW(sourcekey, INSTALLPROPERTY_LASTUSEDSOURCEW, 0, 0, (LPBYTE)source, &size); if (!*source) { - msi_free(source); + free(source); RegCloseKey(sourcekey); return ERROR_SUCCESS; } @@ -598,7 +598,7 @@ UINT WINAPI MsiSourceListGetInfoW( LPCWSTR szProduct, LPCWSTR szUserSid, { if (*source != 'n' && *source != 'u' && *source != 'm') { - msi_free(source); + free(source); RegCloseKey(sourcekey); return ERROR_SUCCESS; } @@ -624,7 +624,7 @@ UINT WINAPI MsiSourceListGetInfoW( LPCWSTR szProduct, LPCWSTR szUserSid, } *pcchValue = lstrlenW(ptr); - msi_free(source); + free(source); } else if (!wcscmp( szProperty, INSTALLPROPERTY_PACKAGENAMEW )) { @@ -675,10 +675,10 @@ UINT WINAPI MsiSourceListSetInfoA(LPCSTR szProduct, LPCSTR szUserSid, ret = MsiSourceListSetInfoW(product, usersid, dwContext, dwOptions, property, value); - msi_free(product); - msi_free(usersid); - msi_free(property); - msi_free(value); + free(product); + free(usersid); + free(property); + free(value); return ret; } @@ -720,14 +720,14 @@ UINT msi_set_last_used_source(LPCWSTR product, LPCWSTR usersid, } size = lstrlenW(L"%c;%d;%s") + lstrlenW(value) + 7; - buffer = msi_alloc(size * sizeof(WCHAR)); + buffer = malloc(size * sizeof(WCHAR)); if (!buffer) return ERROR_OUTOFMEMORY; r = OpenSourceKey(product, &source, MSICODE_PRODUCT, context, FALSE); if (r != ERROR_SUCCESS) { - msi_free(buffer); + free(buffer); return r; } @@ -736,7 +736,7 @@ UINT msi_set_last_used_source(LPCWSTR product, LPCWSTR usersid, size = (lstrlenW(buffer) + 1) * sizeof(WCHAR); r = RegSetValueExW(source, INSTALLPROPERTY_LASTUSEDSOURCEW, 0, REG_SZ, (LPBYTE)buffer, size); - msi_free(buffer); + free(buffer); RegCloseKey(source); return r; @@ -851,12 +851,12 @@ UINT WINAPI MsiSourceListAddSourceW( LPCWSTR szProduct, LPCWSTR szUserName, { if (LookupAccountNameW(NULL, szUserName, NULL, &sidsize, NULL, &domsize, NULL)) { - PSID psid = msi_alloc(sidsize); + PSID psid = malloc(sidsize); if (LookupAccountNameW(NULL, szUserName, psid, &sidsize, NULL, &domsize, NULL)) ConvertSidToStringSidW(psid, &sidstr); - msi_free(psid); + free(psid); } r = MSIREG_OpenProductKey(szProduct, NULL, @@ -903,9 +903,9 @@ UINT WINAPI MsiSourceListAddSourceA( LPCSTR szProduct, LPCSTR szUserName, ret = MsiSourceListAddSourceW(szwproduct, szwusername, dwReserved, szwsource); - msi_free(szwproduct); - msi_free(szwusername); - msi_free(szwsource); + free(szwproduct); + free(szwusername); + free(szwsource); return ret; } @@ -926,9 +926,9 @@ UINT WINAPI MsiSourceListAddSourceExA(LPCSTR szProduct, LPCSTR szUserSid, ret = MsiSourceListAddSourceExW(product, usersid, dwContext, dwOptions, source, dwIndex); - msi_free(product); - msi_free(usersid); - msi_free(source); + free(product); + free(usersid); + free(source); return ret; } @@ -937,17 +937,16 @@ static void free_source_list(struct list *sourcelist) { while (!list_empty(sourcelist)) { - media_info *info = LIST_ENTRY(list_head(sourcelist), media_info, entry); + struct media_info *info = LIST_ENTRY(list_head(sourcelist), struct media_info, entry); list_remove(&info->entry); - msi_free(info->path); - msi_free(info); + free(info->path); + free(info); } } -static void add_source_to_list(struct list *sourcelist, media_info *info, - DWORD *index) +static void add_source_to_list(struct list *sourcelist, struct media_info *info, DWORD *index) { - media_info *iter; + struct media_info *iter; BOOL found = FALSE; if (index) *index = 0; @@ -958,7 +957,7 @@ static void add_source_to_list(struct list *sourcelist, media_info *info, return; } - LIST_FOR_EACH_ENTRY(iter, sourcelist, media_info, entry) + LIST_FOR_EACH_ENTRY(iter, sourcelist, struct media_info, entry) { if (!found && info->index < iter->index) { @@ -983,7 +982,7 @@ static UINT fill_source_list(struct list *sourcelist, HKEY sourcekey, DWORD *cou DWORD index = 0; WCHAR name[10]; DWORD size, val_size; - media_info *entry; + struct media_info *entry; *count = 0; @@ -994,14 +993,14 @@ static UINT fill_source_list(struct list *sourcelist, HKEY sourcekey, DWORD *cou if (r != ERROR_SUCCESS) return r; - entry = msi_alloc(sizeof(media_info)); + entry = malloc(sizeof(*entry)); if (!entry) goto error; - entry->path = msi_alloc(val_size); + entry->path = malloc(val_size); if (!entry->path) { - msi_free(entry); + free(entry); goto error; } @@ -1013,8 +1012,8 @@ static UINT fill_source_list(struct list *sourcelist, HKEY sourcekey, DWORD *cou NULL, (LPBYTE)entry->path, &val_size); if (r != ERROR_SUCCESS) { - msi_free(entry->path); - msi_free(entry); + free(entry->path); + free(entry); goto error; } @@ -1037,7 +1036,7 @@ UINT WINAPI MsiSourceListAddSourceExW( const WCHAR *szProduct, const WCHAR *szUs HKEY sourcekey, typekey; UINT rc; struct list sourcelist; - media_info *info; + struct media_info *info; WCHAR *source, squashed_pc[SQUASHED_GUID_SIZE], name[10]; LPCWSTR postfix; DWORD size, count, index; @@ -1088,11 +1087,11 @@ UINT WINAPI MsiSourceListAddSourceExW( const WCHAR *szProduct, const WCHAR *szUs postfix = (dwOptions & MSISOURCETYPE_NETWORK) ? L"\\" : L"/"; if (szSource[lstrlenW(szSource) - 1] == *postfix) - source = strdupW(szSource); + source = wcsdup(szSource); else { size = lstrlenW(szSource) + 2; - source = msi_alloc(size * sizeof(WCHAR)); + source = malloc(size * sizeof(WCHAR)); lstrcpyW(source, szSource); lstrcatW(source, postfix); } @@ -1118,19 +1117,19 @@ UINT WINAPI MsiSourceListAddSourceExW( const WCHAR *szProduct, const WCHAR *szUs else { swprintf(name, ARRAY_SIZE(name), L"%d", dwIndex); - info = msi_alloc(sizeof(media_info)); + info = malloc(sizeof(*info)); if (!info) { rc = ERROR_OUTOFMEMORY; goto done; } - info->path = strdupW(source); + info->path = wcsdup(source); lstrcpyW(info->szIndex, name); info->index = dwIndex; add_source_to_list(&sourcelist, info, &index); - LIST_FOR_EACH_ENTRY(info, &sourcelist, media_info, entry) + LIST_FOR_EACH_ENTRY(info, &sourcelist, struct media_info, entry) { if (info->index < index) continue; @@ -1145,7 +1144,7 @@ UINT WINAPI MsiSourceListAddSourceExW( const WCHAR *szProduct, const WCHAR *szUs done: free_source_list(&sourcelist); - msi_free(source); + free(source); RegCloseKey(typekey); RegCloseKey(sourcekey); return rc; @@ -1172,10 +1171,10 @@ UINT WINAPI MsiSourceListAddMediaDiskA(LPCSTR szProduct, LPCSTR szUserSid, r = MsiSourceListAddMediaDiskW(product, usersid, dwContext, dwOptions, dwDiskId, volume, prompt); - msi_free(product); - msi_free(usersid); - msi_free(volume); - msi_free(prompt); + free(product); + free(usersid); + free(volume); + free(prompt); return r; } @@ -1226,7 +1225,7 @@ UINT WINAPI MsiSourceListAddMediaDiskW( const WCHAR *szProduct, const WCHAR *szU if (szDiskPrompt) size += lstrlenW(szDiskPrompt); size *= sizeof(WCHAR); - buffer = msi_alloc(size); + buffer = malloc(size); *buffer = '\0'; if (szVolumeLabel) lstrcpyW(buffer, szVolumeLabel); @@ -1234,7 +1233,7 @@ UINT WINAPI MsiSourceListAddMediaDiskW( const WCHAR *szProduct, const WCHAR *szU if (szDiskPrompt) lstrcatW(buffer, szDiskPrompt); RegSetValueExW(mediakey, szIndex, 0, REG_SZ, (LPBYTE)buffer, size); - msi_free(buffer); + free(buffer); RegCloseKey(sourcekey); RegCloseKey(mediakey); diff --git a/dll/win32/msi/sql.y b/dll/win32/msi/sql.y index 885593a9d18d9..43425fa4afcf6 100644 --- a/dll/win32/msi/sql.y +++ b/dll/win32/msi/sql.y @@ -759,7 +759,7 @@ static void *parser_alloc( void *info, unsigned int sz ) SQL_input* sql = (SQL_input*) info; struct list *mem; - mem = msi_alloc( sizeof (struct list) + sz ); + mem = malloc( sizeof (struct list) + sz ); list_add_tail( sql->mem, mem ); return &mem[1]; } diff --git a/dll/win32/msi/storages.c b/dll/win32/msi/storages.c index 8262f601693d8..94415035842aa 100644 --- a/dll/win32/msi/storages.c +++ b/dll/win32/msi/storages.c @@ -40,28 +40,28 @@ WINE_DEFAULT_DEBUG_CHANNEL(msidb); #define NUM_STORAGES_COLS 2 #define MAX_STORAGES_NAME_LEN 62 -typedef struct tabSTORAGE +struct storage { UINT str_index; IStorage *storage; } STORAGE; -typedef struct tagMSISTORAGESVIEW +struct storages_view { MSIVIEW view; MSIDATABASE *db; - STORAGE *storages; + struct storage *storages; UINT max_storages; UINT num_rows; UINT row_size; -} MSISTORAGESVIEW; +}; -static BOOL storages_set_table_size(MSISTORAGESVIEW *sv, UINT size) +static BOOL storages_set_table_size(struct storages_view *sv, UINT size) { if (size >= sv->max_storages) { sv->max_storages *= 2; - sv->storages = msi_realloc(sv->storages, sv->max_storages * sizeof(*sv->storages)); + sv->storages = realloc(sv->storages, sv->max_storages * sizeof(*sv->storages)); if (!sv->storages) return FALSE; } @@ -71,7 +71,7 @@ static BOOL storages_set_table_size(MSISTORAGESVIEW *sv, UINT size) static UINT STORAGES_fetch_int(struct tagMSIVIEW *view, UINT row, UINT col, UINT *val) { - MSISTORAGESVIEW *sv = (MSISTORAGESVIEW *)view; + struct storages_view *sv = (struct storages_view *)view; TRACE("(%p, %d, %d, %p)\n", view, row, col, val); @@ -88,7 +88,7 @@ static UINT STORAGES_fetch_int(struct tagMSIVIEW *view, UINT row, UINT col, UINT static UINT STORAGES_fetch_stream(struct tagMSIVIEW *view, UINT row, UINT col, IStream **stm) { - MSISTORAGESVIEW *sv = (MSISTORAGESVIEW *)view; + struct storages_view *sv = (struct storages_view *)view; TRACE("(%p, %d, %d, %p)\n", view, row, col, stm); @@ -124,7 +124,7 @@ static HRESULT stream_to_storage(IStream *stm, IStorage **stg) } size = stat.cbSize.QuadPart; - data = msi_alloc(size); + data = malloc(size); if (!data) return E_OUTOFMEMORY; @@ -148,14 +148,14 @@ static HRESULT stream_to_storage(IStream *stm, IStorage **stg) goto done; done: - msi_free(data); + free(data); if (lockbytes) ILockBytes_Release(lockbytes); return hr; } static UINT STORAGES_set_stream( MSIVIEW *view, UINT row, UINT col, IStream *stream ) { - MSISTORAGESVIEW *sv = (MSISTORAGESVIEW *)view; + struct storages_view *sv = (struct storages_view *)view; IStorage *stg, *substg, *prev; const WCHAR *name; HRESULT hr; @@ -195,7 +195,7 @@ static UINT STORAGES_set_stream( MSIVIEW *view, UINT row, UINT col, IStream *str static UINT STORAGES_set_row(struct tagMSIVIEW *view, UINT row, MSIRECORD *rec, UINT mask) { - MSISTORAGESVIEW *sv = (MSISTORAGESVIEW *)view; + struct storages_view *sv = (struct storages_view *)view; IStorage *stg, *substg = NULL, *prev; IStream *stm; LPWSTR name = NULL; @@ -218,7 +218,7 @@ static UINT STORAGES_set_row(struct tagMSIVIEW *view, UINT row, MSIRECORD *rec, return r; } - name = strdupW(MSI_RecordGetString(rec, 1)); + name = wcsdup(MSI_RecordGetString(rec, 1)); if (!name) { r = ERROR_OUTOFMEMORY; @@ -248,7 +248,7 @@ static UINT STORAGES_set_row(struct tagMSIVIEW *view, UINT row, MSIRECORD *rec, if (prev) IStorage_Release(prev); done: - msi_free(name); + free(name); if (substg) IStorage_Release(substg); IStorage_Release(stg); @@ -259,7 +259,7 @@ static UINT STORAGES_set_row(struct tagMSIVIEW *view, UINT row, MSIRECORD *rec, static UINT STORAGES_insert_row(struct tagMSIVIEW *view, MSIRECORD *rec, UINT row, BOOL temporary) { - MSISTORAGESVIEW *sv = (MSISTORAGESVIEW *)view; + struct storages_view *sv = (struct storages_view *)view; if (!storages_set_table_size(sv, ++sv->num_rows)) return ERROR_FUNCTION_FAILED; @@ -294,7 +294,7 @@ static UINT STORAGES_close(struct tagMSIVIEW *view) static UINT STORAGES_get_dimensions(struct tagMSIVIEW *view, UINT *rows, UINT *cols) { - MSISTORAGESVIEW *sv = (MSISTORAGESVIEW *)view; + struct storages_view *sv = (struct storages_view *)view; TRACE("(%p, %p, %p)\n", view, rows, cols); @@ -330,7 +330,7 @@ static UINT STORAGES_get_column_info( struct tagMSIVIEW *view, UINT n, LPCWSTR * return ERROR_SUCCESS; } -static UINT storages_find_row(MSISTORAGESVIEW *sv, MSIRECORD *rec, UINT *row) +static UINT storages_find_row(struct storages_view *sv, MSIRECORD *rec, UINT *row) { LPCWSTR str; UINT r, i, id, data; @@ -356,7 +356,7 @@ static UINT storages_find_row(MSISTORAGESVIEW *sv, MSIRECORD *rec, UINT *row) static UINT storages_modify_update(struct tagMSIVIEW *view, MSIRECORD *rec) { - MSISTORAGESVIEW *sv = (MSISTORAGESVIEW *)view; + struct storages_view *sv = (struct storages_view *)view; UINT r, row; r = storages_find_row(sv, rec, &row); @@ -368,7 +368,7 @@ static UINT storages_modify_update(struct tagMSIVIEW *view, MSIRECORD *rec) static UINT storages_modify_assign(struct tagMSIVIEW *view, MSIRECORD *rec) { - MSISTORAGESVIEW *sv = (MSISTORAGESVIEW *)view; + struct storages_view *sv = (struct storages_view *)view; UINT r, row; r = storages_find_row(sv, rec, &row); @@ -420,7 +420,7 @@ static UINT STORAGES_modify(struct tagMSIVIEW *view, MSIMODIFY eModifyMode, MSIR static UINT STORAGES_delete(struct tagMSIVIEW *view) { - MSISTORAGESVIEW *sv = (MSISTORAGESVIEW *)view; + struct storages_view *sv = (struct storages_view *)view; UINT i; TRACE("(%p)\n", view); @@ -431,9 +431,9 @@ static UINT STORAGES_delete(struct tagMSIVIEW *view) IStorage_Release(sv->storages[i].storage); } - msi_free(sv->storages); + free(sv->storages); sv->storages = NULL; - msi_free(sv); + free(sv); return ERROR_SUCCESS; } @@ -461,7 +461,7 @@ static const MSIVIEWOPS storages_ops = NULL, }; -static INT add_storages_to_table(MSISTORAGESVIEW *sv) +static INT add_storages_to_table(struct storages_view *sv) { IEnumSTATSTG *stgenum = NULL; STATSTG stat; @@ -474,7 +474,7 @@ static INT add_storages_to_table(MSISTORAGESVIEW *sv) return -1; sv->max_storages = 1; - sv->storages = msi_alloc(sizeof(*sv->storages)); + sv->storages = malloc(sizeof(*sv->storages)); if (!sv->storages) return -1; @@ -514,12 +514,12 @@ static INT add_storages_to_table(MSISTORAGESVIEW *sv) UINT STORAGES_CreateView(MSIDATABASE *db, MSIVIEW **view) { - MSISTORAGESVIEW *sv; + struct storages_view *sv; INT rows; TRACE("(%p, %p)\n", db, view); - sv = msi_alloc_zero( sizeof(MSISTORAGESVIEW) ); + sv = calloc(1, sizeof(*sv)); if (!sv) return ERROR_FUNCTION_FAILED; @@ -529,7 +529,7 @@ UINT STORAGES_CreateView(MSIDATABASE *db, MSIVIEW **view) rows = add_storages_to_table(sv); if (rows < 0) { - msi_free( sv ); + free(sv); return ERROR_FUNCTION_FAILED; } sv->num_rows = rows; diff --git a/dll/win32/msi/streams.c b/dll/win32/msi/streams.c index faa9fe4333a5b..4c23a97d10f74 100644 --- a/dll/win32/msi/streams.c +++ b/dll/win32/msi/streams.c @@ -38,18 +38,18 @@ WINE_DEFAULT_DEBUG_CHANNEL(msidb); #define NUM_STREAMS_COLS 2 -typedef struct tagMSISTREAMSVIEW +struct streams_view { MSIVIEW view; MSIDATABASE *db; UINT num_cols; -} MSISTREAMSVIEW; +}; static BOOL streams_resize_table( MSIDATABASE *db, UINT size ) { if (!db->num_streams_allocated) { - if (!(db->streams = msi_alloc_zero( size * sizeof(MSISTREAM) ))) return FALSE; + if (!(db->streams = calloc( size, sizeof(MSISTREAM) ))) return FALSE; db->num_streams_allocated = size; return TRUE; } @@ -57,7 +57,7 @@ static BOOL streams_resize_table( MSIDATABASE *db, UINT size ) { MSISTREAM *tmp; UINT new_size = db->num_streams_allocated * 2; - if (!(tmp = msi_realloc( db->streams, new_size * sizeof(*tmp) ))) return FALSE; + if (!(tmp = realloc( db->streams, new_size * sizeof(*tmp) ))) return FALSE; memset( tmp + db->num_streams_allocated, 0, (new_size - db->num_streams_allocated) * sizeof(*tmp) ); db->streams = tmp; db->num_streams_allocated = new_size; @@ -67,7 +67,7 @@ static BOOL streams_resize_table( MSIDATABASE *db, UINT size ) static UINT STREAMS_fetch_int(struct tagMSIVIEW *view, UINT row, UINT col, UINT *val) { - MSISTREAMSVIEW *sv = (MSISTREAMSVIEW *)view; + struct streams_view *sv = (struct streams_view *)view; TRACE("(%p, %d, %d, %p)\n", view, row, col, val); @@ -84,7 +84,7 @@ static UINT STREAMS_fetch_int(struct tagMSIVIEW *view, UINT row, UINT col, UINT static UINT STREAMS_fetch_stream(struct tagMSIVIEW *view, UINT row, UINT col, IStream **stm) { - MSISTREAMSVIEW *sv = (MSISTREAMSVIEW *)view; + struct streams_view *sv = (struct streams_view *)view; LARGE_INTEGER pos; HRESULT hr; @@ -112,7 +112,7 @@ static UINT STREAMS_set_string( struct tagMSIVIEW *view, UINT row, UINT col, con static UINT STREAMS_set_stream( MSIVIEW *view, UINT row, UINT col, IStream *stream ) { - MSISTREAMSVIEW *sv = (MSISTREAMSVIEW *)view; + struct streams_view *sv = (struct streams_view *)view; IStream *prev; TRACE("view %p, row %u, col %u, stream %p.\n", view, row, col, stream); @@ -125,7 +125,7 @@ static UINT STREAMS_set_stream( MSIVIEW *view, UINT row, UINT col, IStream *stre static UINT STREAMS_set_row(struct tagMSIVIEW *view, UINT row, MSIRECORD *rec, UINT mask) { - MSISTREAMSVIEW *sv = (MSISTREAMSVIEW *)view; + struct streams_view *sv = (struct streams_view *)view; TRACE("(%p, %d, %p, %08x)\n", view, row, rec, mask); @@ -162,7 +162,7 @@ static UINT STREAMS_set_row(struct tagMSIVIEW *view, UINT row, MSIRECORD *rec, U return ERROR_SUCCESS; } -static UINT streams_find_row( MSISTREAMSVIEW *sv, MSIRECORD *rec, UINT *row ) +static UINT streams_find_row( struct streams_view *sv, MSIRECORD *rec, UINT *row ) { const WCHAR *str; UINT r, i, id, val; @@ -188,7 +188,7 @@ static UINT streams_find_row( MSISTREAMSVIEW *sv, MSIRECORD *rec, UINT *row ) static UINT STREAMS_insert_row(struct tagMSIVIEW *view, MSIRECORD *rec, UINT row, BOOL temporary) { - MSISTREAMSVIEW *sv = (MSISTREAMSVIEW *)view; + struct streams_view *sv = (struct streams_view *)view; UINT i, r, num_rows = sv->db->num_streams + 1; TRACE("(%p, %p, %d, %d)\n", view, rec, row, temporary); @@ -218,7 +218,7 @@ static UINT STREAMS_insert_row(struct tagMSIVIEW *view, MSIRECORD *rec, UINT row static UINT STREAMS_delete_row(struct tagMSIVIEW *view, UINT row) { - MSIDATABASE *db = ((MSISTREAMSVIEW *)view)->db; + MSIDATABASE *db = ((struct streams_view *)view)->db; UINT i, num_rows = db->num_streams - 1; const WCHAR *name; WCHAR *encname; @@ -238,7 +238,7 @@ static UINT STREAMS_delete_row(struct tagMSIVIEW *view, UINT row) db->num_streams = num_rows; hr = IStorage_DestroyElement( db->storage, encname ); - msi_free( encname ); + free( encname ); return FAILED( hr ) ? ERROR_FUNCTION_FAILED : ERROR_SUCCESS; } @@ -256,7 +256,7 @@ static UINT STREAMS_close(struct tagMSIVIEW *view) static UINT STREAMS_get_dimensions(struct tagMSIVIEW *view, UINT *rows, UINT *cols) { - MSISTREAMSVIEW *sv = (MSISTREAMSVIEW *)view; + struct streams_view *sv = (struct streams_view *)view; TRACE("(%p, %p, %p)\n", view, rows, cols); @@ -269,7 +269,7 @@ static UINT STREAMS_get_dimensions(struct tagMSIVIEW *view, UINT *rows, UINT *co static UINT STREAMS_get_column_info( struct tagMSIVIEW *view, UINT n, LPCWSTR *name, UINT *type, BOOL *temporary, LPCWSTR *table_name ) { - MSISTREAMSVIEW *sv = (MSISTREAMSVIEW *)view; + struct streams_view *sv = (struct streams_view *)view; TRACE("(%p, %d, %p, %p, %p, %p)\n", view, n, name, type, temporary, table_name); @@ -295,7 +295,7 @@ static UINT STREAMS_get_column_info( struct tagMSIVIEW *view, UINT n, LPCWSTR *n static UINT streams_modify_update(struct tagMSIVIEW *view, MSIRECORD *rec) { - MSISTREAMSVIEW *sv = (MSISTREAMSVIEW *)view; + struct streams_view *sv = (struct streams_view *)view; UINT r, row; r = streams_find_row(sv, rec, &row); @@ -307,7 +307,7 @@ static UINT streams_modify_update(struct tagMSIVIEW *view, MSIRECORD *rec) static UINT streams_modify_assign(struct tagMSIVIEW *view, MSIRECORD *rec) { - MSISTREAMSVIEW *sv = (MSISTREAMSVIEW *)view; + struct streams_view *sv = (struct streams_view *)view; UINT r; r = streams_find_row( sv, rec, NULL ); @@ -362,11 +362,11 @@ static UINT STREAMS_modify(struct tagMSIVIEW *view, MSIMODIFY eModifyMode, MSIRE static UINT STREAMS_delete(struct tagMSIVIEW *view) { - MSISTREAMSVIEW *sv = (MSISTREAMSVIEW *)view; + struct streams_view *sv = (struct streams_view *)view; TRACE("(%p)\n", view); - msi_free(sv); + free(sv); return ERROR_SUCCESS; } @@ -521,7 +521,7 @@ UINT msi_get_stream( MSIDATABASE *db, const WCHAR *name, IStream **ret ) return ERROR_OUTOFMEMORY; hr = open_stream( db, encname, ret ); - msi_free( encname ); + free( encname ); if (FAILED( hr )) return ERROR_FUNCTION_FAILED; @@ -538,7 +538,7 @@ UINT msi_get_stream( MSIDATABASE *db, const WCHAR *name, IStream **ret ) UINT STREAMS_CreateView(MSIDATABASE *db, MSIVIEW **view) { - MSISTREAMSVIEW *sv; + struct streams_view *sv; UINT r; TRACE("(%p, %p)\n", db, view); @@ -547,7 +547,7 @@ UINT STREAMS_CreateView(MSIDATABASE *db, MSIVIEW **view) if (r != ERROR_SUCCESS) return r; - if (!(sv = msi_alloc_zero( sizeof(MSISTREAMSVIEW) ))) + if (!(sv = calloc( 1, sizeof(*sv) ))) return ERROR_OUTOFMEMORY; sv->view.ops = &streams_ops; @@ -629,7 +629,7 @@ UINT msi_commit_streams( MSIDATABASE *db ) if (FAILED( hr )) { ERR( "failed to write stream %s (hr = %#lx)\n", debugstr_w(encname), hr ); - msi_free( encname ); + free( encname ); IStream_Release( stream ); return ERROR_FUNCTION_FAILED; } @@ -638,17 +638,17 @@ UINT msi_commit_streams( MSIDATABASE *db ) if (FAILED( hr )) { ERR( "failed to commit stream %s (hr = %#lx)\n", debugstr_w(encname), hr ); - msi_free( encname ); + free( encname ); return ERROR_FUNCTION_FAILED; } } else if (hr != STG_E_FILEALREADYEXISTS) { ERR( "failed to create stream %s (hr = %#lx)\n", debugstr_w(encname), hr ); - msi_free( encname ); + free( encname ); return ERROR_FUNCTION_FAILED; } - msi_free( encname ); + free( encname ); } return ERROR_SUCCESS; diff --git a/dll/win32/msi/string.c b/dll/win32/msi/string.c index 70c6873a331c1..38381b8b52162 100644 --- a/dll/win32/msi/string.c +++ b/dll/win32/msi/string.c @@ -75,24 +75,24 @@ static string_table *init_stringtable( int entries, UINT codepage ) if (!validate_codepage( codepage )) return NULL; - st = msi_alloc( sizeof (string_table) ); + st = malloc( sizeof(string_table) ); if( !st ) return NULL; if( entries < 1 ) entries = 1; - st->strings = msi_alloc_zero( sizeof(struct msistring) * entries ); + st->strings = calloc( entries, sizeof(struct msistring) ); if( !st->strings ) { - msi_free( st ); + free( st ); return NULL; } - st->sorted = msi_alloc( sizeof (UINT) * entries ); + st->sorted = malloc( sizeof(UINT) * entries ); if( !st->sorted ) { - msi_free( st->strings ); - msi_free( st ); + free( st->strings ); + free( st ); return NULL; } @@ -112,11 +112,11 @@ VOID msi_destroy_stringtable( string_table *st ) { if( st->strings[i].persistent_refcount || st->strings[i].nonpersistent_refcount ) - msi_free( st->strings[i].data ); + free( st->strings[i].data ); } - msi_free( st->strings ); - msi_free( st->sorted ); - msi_free( st ); + free( st->strings ); + free( st->sorted ); + free( st ); } static int st_find_free_entry( string_table *st ) @@ -140,12 +140,12 @@ static int st_find_free_entry( string_table *st ) /* dynamically resize */ sz = st->maxcount + 1 + st->maxcount / 2; - if (!(p = msi_realloc( st->strings, sz * sizeof(*p) ))) return -1; + if (!(p = realloc( st->strings, sz * sizeof(*p) ))) return -1; memset( p + st->maxcount, 0, (sz - st->maxcount) * sizeof(*p) ); - if (!(s = msi_realloc( st->sorted, sz * sizeof(*s) ))) + if (!(s = realloc( st->sorted, sz * sizeof(*s) ))) { - msi_free( p ); + free( p ); return -1; } @@ -244,13 +244,13 @@ static UINT string2id( const string_table *st, const char *buffer, UINT *id ) if (!(sz = MultiByteToWideChar( st->codepage, 0, buffer, -1, NULL, 0 ))) return r; - str = msi_alloc( sz*sizeof(WCHAR) ); + str = malloc( sz * sizeof(WCHAR) ); if( !str ) return ERROR_NOT_ENOUGH_MEMORY; MultiByteToWideChar( st->codepage, 0, buffer, -1, str, sz ); r = msi_string2id( st, str, sz - 1, id ); - msi_free( str ); + free( str ); return r; } @@ -290,7 +290,7 @@ static int add_string( string_table *st, UINT n, const char *data, UINT len, USH /* allocate a new string */ sz = MultiByteToWideChar( st->codepage, 0, data, len, NULL, 0 ); - str = msi_alloc( (sz+1)*sizeof(WCHAR) ); + str = malloc( (sz + 1) * sizeof(WCHAR) ); if( !str ) return -1; MultiByteToWideChar( st->codepage, 0, data, len, str, sz ); @@ -329,7 +329,7 @@ int msi_add_string( string_table *st, const WCHAR *data, int len, BOOL persisten /* allocate a new string */ TRACE( "%s, n = %d len = %d\n", debugstr_wn(data, len), n, len ); - str = msi_alloc( (len+1)*sizeof(WCHAR) ); + str = malloc( (len + 1) * sizeof(WCHAR) ); if( !str ) return -1; memcpy( str, data, len*sizeof(WCHAR) ); @@ -555,8 +555,8 @@ string_table *msi_load_string_table( IStorage *stg, UINT *bytes_per_strref ) TRACE( "loaded %lu strings\n", count ); end: - msi_free( pool ); - msi_free( data ); + free( pool ); + free( data ); return st; } @@ -575,13 +575,13 @@ UINT msi_save_string_table( const string_table *st, IStorage *storage, UINT *byt TRACE("%u %u %u\n", st->maxcount, datasize, poolsize ); - pool = msi_alloc( poolsize ); + pool = malloc( poolsize ); if( ! pool ) { WARN("Failed to alloc pool %d bytes\n", poolsize ); goto err; } - data = msi_alloc( datasize ); + data = malloc( datasize ); if( ! data ) { WARN("Failed to alloc data %d bytes\n", datasize ); @@ -662,8 +662,8 @@ UINT msi_save_string_table( const string_table *st, IStorage *storage, UINT *byt ret = ERROR_SUCCESS; err: - msi_free( data ); - msi_free( pool ); + free( data ); + free( pool ); return ret; } diff --git a/dll/win32/msi/suminfo.c b/dll/win32/msi/suminfo.c index 0280b036bdae7..fc9077d213231 100644 --- a/dll/win32/msi/suminfo.c +++ b/dll/win32/msi/suminfo.c @@ -43,30 +43,35 @@ WINE_DEFAULT_DEBUG_CHANNEL(msi); #include "pshpack1.h" -typedef struct { +struct property_set_header +{ WORD wByteOrder; WORD wFormat; DWORD dwOSVer; CLSID clsID; DWORD reserved; -} PROPERTYSETHEADER; +}; -typedef struct { +struct format_id_offset +{ FMTID fmtid; DWORD dwOffset; -} FORMATIDOFFSET; +}; -typedef struct { +struct property_section_header +{ DWORD cbSection; DWORD cProperties; -} PROPERTYSECTIONHEADER; +}; -typedef struct { +struct property_id_offset +{ DWORD propid; DWORD dwOffset; -} PROPERTYIDOFFSET; +}; -typedef struct { +struct property_data +{ DWORD type; union { INT i4; @@ -77,7 +82,7 @@ typedef struct { BYTE str[1]; } str; } u; -} PROPERTY_DATA; +}; #include "poppack.h" @@ -85,12 +90,12 @@ static HRESULT (WINAPI *pPropVariantChangeType) (PROPVARIANT *ppropvarDest, REFPROPVARIANT propvarSrc, PROPVAR_CHANGE_FLAGS flags, VARTYPE vt); -#define SECT_HDR_SIZE (sizeof(PROPERTYSECTIONHEADER)) +#define SECT_HDR_SIZE (sizeof(struct property_section_header)) static void free_prop( PROPVARIANT *prop ) { if (prop->vt == VT_LPSTR ) - msi_free( prop->pszVal ); + free( prop->pszVal ); prop->vt = VT_EMPTY; } @@ -183,14 +188,14 @@ static void read_properties_from_data( PROPVARIANT *prop, LPBYTE data, DWORD sz { UINT type; DWORD i, size; - PROPERTY_DATA *propdata; + struct property_data *propdata; PROPVARIANT property, *ptr; PROPVARIANT changed; - PROPERTYIDOFFSET *idofs; - PROPERTYSECTIONHEADER *section_hdr; + struct property_id_offset *idofs; + struct property_section_header *section_hdr; - section_hdr = (PROPERTYSECTIONHEADER*) &data[0]; - idofs = (PROPERTYIDOFFSET*) &data[SECT_HDR_SIZE]; + section_hdr = (struct property_section_header *) &data[0]; + idofs = (struct property_id_offset *)&data[SECT_HDR_SIZE]; /* now set all the properties */ for( i = 0; i < section_hdr->cProperties; i++ ) @@ -208,7 +213,7 @@ static void read_properties_from_data( PROPVARIANT *prop, LPBYTE data, DWORD sz break; } - propdata = (PROPERTY_DATA*) &data[ idofs[i].dwOffset ]; + propdata = (struct property_data *)&data[ idofs[i].dwOffset ]; /* check we don't run off the end of the data */ size = sz - idofs[i].dwOffset - sizeof(DWORD); @@ -223,7 +228,7 @@ static void read_properties_from_data( PROPVARIANT *prop, LPBYTE data, DWORD sz property.vt = propdata->type; if( propdata->type == VT_LPSTR ) { - LPSTR str = msi_alloc( propdata->u.str.len ); + char *str = malloc( propdata->u.str.len ); memcpy( str, propdata->u.str.str, propdata->u.str.len ); str[ propdata->u.str.len - 1 ] = 0; property.pszVal = str; @@ -250,9 +255,9 @@ static void read_properties_from_data( PROPVARIANT *prop, LPBYTE data, DWORD sz static UINT load_summary_info( MSISUMMARYINFO *si, IStream *stm ) { - PROPERTYSETHEADER set_hdr; - FORMATIDOFFSET format_hdr; - PROPERTYSECTIONHEADER section_hdr; + struct property_set_header set_hdr; + struct format_id_offset format_hdr; + struct property_section_header section_hdr; LPBYTE data = NULL; LARGE_INTEGER ofs; ULONG count, sz; @@ -299,7 +304,7 @@ static UINT load_summary_info( MSISUMMARYINFO *si, IStream *stm ) return ERROR_FUNCTION_FAILED; } - data = msi_alloc( section_hdr.cbSection); + data = malloc( section_hdr.cbSection ); if( !data ) return ERROR_FUNCTION_FAILED; @@ -313,7 +318,7 @@ static UINT load_summary_info( MSISUMMARYINFO *si, IStream *stm ) else ERR( "failed to read properties %lu %lu\n", count, sz ); - msi_free( data ); + free( data ); return ERROR_SUCCESS; } @@ -375,10 +380,10 @@ static UINT write_property_to_data( const PROPVARIANT *prop, LPBYTE data ) static UINT save_summary_info( const MSISUMMARYINFO * si, IStream *stm ) { UINT ret = ERROR_FUNCTION_FAILED; - PROPERTYSETHEADER set_hdr; - FORMATIDOFFSET format_hdr; - PROPERTYSECTIONHEADER section_hdr; - PROPERTYIDOFFSET idofs[MSI_MAX_PROPS]; + struct property_set_header set_hdr; + struct format_id_offset format_hdr; + struct property_section_header section_hdr; + struct property_id_offset idofs[MSI_MAX_PROPS]; LPBYTE data = NULL; ULONG count, sz; HRESULT r; @@ -419,7 +424,7 @@ static UINT save_summary_info( const MSISUMMARYINFO * si, IStream *stm ) section_hdr.cbSection += sz; } - data = msi_alloc_zero( section_hdr.cbSection ); + data = calloc( 1, section_hdr.cbSection ); sz = 0; memcpy( &data[sz], §ion_hdr, sizeof section_hdr ); @@ -433,7 +438,7 @@ static UINT save_summary_info( const MSISUMMARYINFO * si, IStream *stm ) sz += write_property_to_data( &si->property[i], &data[sz] ); r = IStream_Write( stm, data, sz, &count ); - msi_free( data ); + free( data ); if( FAILED(r) || count != sz ) return ret; @@ -598,7 +603,7 @@ UINT WINAPI MsiGetSummaryInformationA( MSIHANDLE hDatabase, const char *szDataba ret = MsiGetSummaryInformationW(hDatabase, szwDatabase, uiUpdateCount, pHandle); - msi_free( szwDatabase ); + free( szwDatabase ); return ret; } @@ -872,14 +877,14 @@ static UINT set_prop( MSISUMMARYINFO *si, UINT uiProperty, UINT type, { len = WideCharToMultiByte( CP_ACP, 0, str->str.w, -1, NULL, 0, NULL, NULL ); - prop->pszVal = msi_alloc( len ); + prop->pszVal = malloc( len ); WideCharToMultiByte( CP_ACP, 0, str->str.w, -1, prop->pszVal, len, NULL, NULL ); } else { len = lstrlenA( str->str.a ) + 1; - prop->pszVal = msi_alloc( len ); + prop->pszVal = malloc( len ); lstrcpyA( prop->pszVal, str->str.a ); } break; @@ -888,8 +893,8 @@ static UINT set_prop( MSISUMMARYINFO *si, UINT uiProperty, UINT type, return ERROR_SUCCESS; } -static UINT msi_set_prop( MSISUMMARYINFO *si, UINT uiProperty, UINT uiDataType, - INT iValue, FILETIME *pftValue, awcstring *str ) +static UINT suminfo_set_prop( MSISUMMARYINFO *si, UINT uiProperty, UINT uiDataType, INT iValue, FILETIME *pftValue, + awcstring *str ) { UINT type = get_type( uiProperty ); if( type == VT_EMPTY || type != uiDataType ) @@ -929,7 +934,7 @@ UINT WINAPI MsiSummaryInfoSetPropertyW( MSIHANDLE handle, UINT uiProperty, UINT str.unicode = TRUE; str.str.w = szValue; - ret = msi_set_prop( si, uiProperty, uiDataType, iValue, pftValue, &str ); + ret = suminfo_set_prop( si, uiProperty, uiDataType, iValue, pftValue, &str ); msiobj_release( &si->hdr ); return ret; } @@ -959,7 +964,7 @@ UINT WINAPI MsiSummaryInfoSetPropertyA( MSIHANDLE handle, UINT uiProperty, UINT str.unicode = FALSE; str.str.a = szValue; - ret = msi_set_prop( si, uiProperty, uiDataType, iValue, pftValue, &str ); + ret = suminfo_set_prop( si, uiProperty, uiDataType, iValue, pftValue, &str ); msiobj_release( &si->hdr ); return ret; } @@ -1147,21 +1152,21 @@ static UINT save_prop( MSISUMMARYINFO *si, HANDLE handle, UINT row ) break; case VT_LPSTR: len++; - if (!(str.str.a = msi_alloc( len ))) + if (!(str.str.a = malloc( len ))) return ERROR_OUTOFMEMORY; r = get_prop( si, row, NULL, NULL, NULL, &str, &len ); if (r != ERROR_SUCCESS) { - msi_free( str.str.a ); + free( str.str.a ); return r; } sz = len; if (!WriteFile( handle, str.str.a, sz, &sz, NULL )) { - msi_free( str.str.a ); + free( str.str.a ); return ERROR_WRITE_FAULT; } - msi_free( str.str.a ); + free( str.str.a ); break; case VT_FILETIME: if (!FileTimeToSystemTime( &file_time, &system_time )) @@ -1248,7 +1253,7 @@ UINT WINAPI MsiCreateTransformSummaryInfoA( MSIHANDLE db, MSIHANDLE db_ref, cons return ERROR_OUTOFMEMORY; r = MsiCreateTransformSummaryInfoW( db, db_ref, transformW, error, validation ); - msi_free( transformW ); + free( transformW ); return r; } @@ -1291,19 +1296,19 @@ UINT msi_load_suminfo_properties( MSIPACKAGE *package ) } len++; - if (!(package_code = msi_alloc( len * sizeof(WCHAR) ))) return ERROR_OUTOFMEMORY; + if (!(package_code = malloc( len * sizeof(WCHAR) ))) return ERROR_OUTOFMEMORY; str.str.w = package_code; r = get_prop( si, PID_REVNUMBER, NULL, NULL, NULL, &str, &len ); if (r != ERROR_SUCCESS) { - msi_free( package_code ); + free( package_code ); msiobj_release( &si->hdr ); return r; } r = msi_set_property( package->db, L"PackageCode", package_code, len ); - msi_free( package_code ); + free( package_code ); count = 0; get_prop( si, PID_WORDCOUNT, NULL, &count, NULL, NULL, NULL ); diff --git a/dll/win32/msi/table.c b/dll/win32/msi/table.c index 8168e2f837db3..ea4ef3b0d0ea4 100644 --- a/dll/win32/msi/table.c +++ b/dll/win32/msi/table.c @@ -40,22 +40,22 @@ WINE_DEFAULT_DEBUG_CHANNEL(msidb); #define MSITABLE_HASH_TABLE_SIZE 37 -typedef struct tagMSICOLUMNHASHENTRY +struct column_hash_entry { - struct tagMSICOLUMNHASHENTRY *next; + struct column_hash_entry *next; UINT value; UINT row; -} MSICOLUMNHASHENTRY; +}; -typedef struct tagMSICOLUMNINFO +struct column_info { LPCWSTR tablename; UINT number; LPCWSTR colname; UINT type; UINT offset; - MSICOLUMNHASHENTRY **hash_table; -} MSICOLUMNINFO; + struct column_hash_entry **hash_table; +}; struct tagMSITABLE { @@ -63,7 +63,7 @@ struct tagMSITABLE BOOL *data_persistent; UINT row_count; struct list entry; - MSICOLUMNINFO *colinfo; + struct column_info *colinfo; UINT col_count; MSICONDITION persistent; LONG ref_count; @@ -71,20 +71,22 @@ struct tagMSITABLE }; /* information for default tables */ -static const MSICOLUMNINFO _Columns_cols[4] = { +static const struct column_info _Columns_cols[4] = +{ { L"_Columns", 1, L"Table", MSITYPE_VALID | MSITYPE_STRING | MSITYPE_KEY | 64, 0, NULL }, { L"_Columns", 2, L"Number", MSITYPE_VALID | MSITYPE_KEY | 2, 2, NULL }, { L"_Columns", 3, L"Name", MSITYPE_VALID | MSITYPE_STRING | 64, 4, NULL }, { L"_Columns", 4, L"Type", MSITYPE_VALID | 2, 6, NULL }, }; -static const MSICOLUMNINFO _Tables_cols[1] = { +static const struct column_info _Tables_cols[1] = +{ { L"_Tables", 1, L"Name", MSITYPE_VALID | MSITYPE_STRING | MSITYPE_KEY | 64, 0, NULL }, }; #define MAX_STREAM_NAME 0x1f -static inline UINT bytes_per_column( MSIDATABASE *db, const MSICOLUMNINFO *col, UINT bytes_per_strref ) +static inline UINT bytes_per_column( MSIDATABASE *db, const struct column_info *col, UINT bytes_per_strref ) { if( MSITYPE_IS_BINARY(col->type) ) return 2; @@ -124,7 +126,7 @@ LPWSTR encode_streamname(BOOL bTable, LPCWSTR in) if( !bTable ) count = lstrlenW( in )+2; - if (!(out = msi_alloc( count*sizeof(WCHAR) ))) return NULL; + if (!(out = malloc( count * sizeof(WCHAR) ))) return NULL; p = out; if( bTable ) @@ -158,7 +160,7 @@ LPWSTR encode_streamname(BOOL bTable, LPCWSTR in) *p++ = ch; } ERR("Failed to encode stream name (%s)\n",debugstr_w(in)); - msi_free( out ); + free( out ); return NULL; } @@ -246,7 +248,7 @@ UINT read_stream_data( IStorage *stg, LPCWSTR stname, BOOL table, r = IStorage_OpenStream(stg, encname, NULL, STGM_READ | STGM_SHARE_EXCLUSIVE, 0, &stm); - msi_free( encname ); + free(encname); if( FAILED( r ) ) { WARN( "open stream failed r = %#lx - empty table?\n", r ); @@ -267,7 +269,7 @@ UINT read_stream_data( IStorage *stg, LPCWSTR stname, BOOL table, } sz = stat.cbSize.QuadPart; - data = msi_alloc( sz ); + data = malloc(sz); if( !data ) { WARN( "couldn't allocate memory r = %#lx!\n", r ); @@ -278,7 +280,7 @@ UINT read_stream_data( IStorage *stg, LPCWSTR stname, BOOL table, r = IStream_Read(stm, data, sz, &count ); if( FAILED( r ) || ( count != sz ) ) { - msi_free( data ); + free(data); WARN("read stream failed r = %#lx!\n", r); goto end; } @@ -312,7 +314,7 @@ UINT write_stream_data( IStorage *stg, LPCWSTR stname, r = IStorage_CreateStream( stg, encname, STGM_WRITE | STGM_SHARE_EXCLUSIVE, 0, 0, &stm); } - msi_free( encname ); + free( encname ); if( FAILED( r ) ) { WARN( "open stream failed r = %#lx\n", r ); @@ -353,27 +355,27 @@ UINT write_stream_data( IStorage *stg, LPCWSTR stname, return ret; } -static void msi_free_colinfo( MSICOLUMNINFO *colinfo, UINT count ) +static void free_colinfo( struct column_info *colinfo, UINT count ) { UINT i; - for (i = 0; i < count; i++) msi_free( colinfo[i].hash_table ); + for (i = 0; i < count; i++) free( colinfo[i].hash_table ); } static void free_table( MSITABLE *table ) { UINT i; for( i=0; irow_count; i++ ) - msi_free( table->data[i] ); - msi_free( table->data ); - msi_free( table->data_persistent ); - msi_free_colinfo( table->colinfo, table->col_count ); - msi_free( table->colinfo ); - msi_free( table ); + free( table->data[i] ); + free( table->data ); + free( table->data_persistent ); + free_colinfo( table->colinfo, table->col_count ); + free( table->colinfo ); + free( table ); } -static UINT msi_table_get_row_size( MSIDATABASE *db, const MSICOLUMNINFO *cols, UINT count, UINT bytes_per_strref ) +static UINT table_get_row_size( MSIDATABASE *db, const struct column_info *cols, UINT count, UINT bytes_per_strref ) { - const MSICOLUMNINFO *last_col; + const struct column_info *last_col; if (!count) return 0; @@ -396,8 +398,8 @@ static UINT read_table_from_storage( MSIDATABASE *db, MSITABLE *t, IStorage *stg TRACE("%s\n",debugstr_w(t->name)); - row_size = msi_table_get_row_size( db, t->colinfo, t->col_count, db->bytes_per_strref ); - row_size_mem = msi_table_get_row_size( db, t->colinfo, t->col_count, LONG_STR_BYTES ); + row_size = table_get_row_size( db, t->colinfo, t->col_count, db->bytes_per_strref ); + row_size_mem = table_get_row_size( db, t->colinfo, t->col_count, LONG_STR_BYTES ); /* if we can't read the table, just assume that it's empty */ read_stream_data( stg, t->name, TRUE, &rawdata, &rawsize ); @@ -414,8 +416,8 @@ static UINT read_table_from_storage( MSIDATABASE *db, MSITABLE *t, IStorage *stg if ((t->row_count = rawsize / row_size)) { - if (!(t->data = msi_alloc_zero( t->row_count * sizeof(USHORT *) ))) goto err; - if (!(t->data_persistent = msi_alloc_zero( t->row_count * sizeof(BOOL) ))) goto err; + if (!(t->data = calloc( t->row_count, sizeof(USHORT *) ))) goto err; + if (!(t->data_persistent = calloc( t->row_count, sizeof(BOOL) ))) goto err; } /* transpose all the data */ @@ -424,7 +426,7 @@ static UINT read_table_from_storage( MSIDATABASE *db, MSITABLE *t, IStorage *stg { UINT ofs = 0, ofs_mem = 0; - t->data[i] = msi_alloc( row_size_mem ); + t->data[i] = malloc( row_size_mem ); if( !t->data[i] ) goto err; t->data_persistent[i] = TRUE; @@ -460,10 +462,10 @@ static UINT read_table_from_storage( MSIDATABASE *db, MSITABLE *t, IStorage *stg } } - msi_free( rawdata ); + free( rawdata ); return ERROR_SUCCESS; err: - msi_free( rawdata ); + free( rawdata ); return ERROR_FUNCTION_FAILED; } @@ -489,7 +491,7 @@ static MSITABLE *find_cached_table( MSIDATABASE *db, LPCWSTR name ) return NULL; } -static void table_calc_column_offsets( MSIDATABASE *db, MSICOLUMNINFO *colinfo, DWORD count ) +static void table_calc_column_offsets( MSIDATABASE *db, struct column_info *colinfo, DWORD count ) { DWORD i; @@ -506,9 +508,9 @@ static void table_calc_column_offsets( MSIDATABASE *db, MSICOLUMNINFO *colinfo, } } -static UINT get_defaulttablecolumns( MSIDATABASE *db, LPCWSTR name, MSICOLUMNINFO *colinfo, UINT *sz ) +static UINT get_defaulttablecolumns( MSIDATABASE *db, const WCHAR *name, struct column_info *colinfo, UINT *sz ) { - const MSICOLUMNINFO *p; + const struct column_info *p; DWORD i, n; TRACE("%s\n", debugstr_w(name)); @@ -535,12 +537,12 @@ static UINT get_defaulttablecolumns( MSIDATABASE *db, LPCWSTR name, MSICOLUMNINF return ERROR_SUCCESS; } -static UINT get_tablecolumns( MSIDATABASE *db, LPCWSTR szTableName, MSICOLUMNINFO *colinfo, UINT *sz ); +static UINT get_tablecolumns( MSIDATABASE *, const WCHAR *, struct column_info *, UINT * ); -static UINT table_get_column_info( MSIDATABASE *db, LPCWSTR name, MSICOLUMNINFO **pcols, UINT *pcount ) +static UINT table_get_column_info( MSIDATABASE *db, const WCHAR *name, struct column_info **pcols, UINT *pcount ) { UINT r, column_count = 0; - MSICOLUMNINFO *columns; + struct column_info *columns; /* get the number of columns in this table */ column_count = 0; @@ -556,14 +558,14 @@ static UINT table_get_column_info( MSIDATABASE *db, LPCWSTR name, MSICOLUMNINFO TRACE("table %s found\n", debugstr_w(name)); - columns = msi_alloc( column_count * sizeof(MSICOLUMNINFO) ); + columns = malloc( column_count * sizeof(*columns) ); if (!columns) return ERROR_FUNCTION_FAILED; r = get_tablecolumns( db, name, columns, &column_count ); if (r != ERROR_SUCCESS) { - msi_free( columns ); + free( columns ); return ERROR_FUNCTION_FAILED; } *pcols = columns; @@ -584,7 +586,7 @@ static UINT get_table( MSIDATABASE *db, LPCWSTR name, MSITABLE **table_ret ) } /* nonexistent tables should be interpreted as empty tables */ - table = msi_alloc( sizeof(MSITABLE) + lstrlenW( name ) * sizeof(WCHAR) ); + table = malloc( sizeof(MSITABLE) + wcslen( name ) * sizeof(WCHAR) ); if (!table) return ERROR_FUNCTION_FAILED; @@ -626,7 +628,7 @@ static UINT read_table_int( BYTE *const *data, UINT row, UINT col, UINT bytes ) return ret; } -static UINT get_tablecolumns( MSIDATABASE *db, LPCWSTR szTableName, MSICOLUMNINFO *colinfo, UINT *sz ) +static UINT get_tablecolumns( MSIDATABASE *db, const WCHAR *szTableName, struct column_info *colinfo, UINT *sz ) { UINT r, i, n = 0, table_id, count, maxcount = *sz; MSITABLE *table = NULL; @@ -694,7 +696,7 @@ static UINT get_tablecolumns( MSIDATABASE *db, LPCWSTR szTableName, MSICOLUMNINF if (colinfo && n != maxcount) { ERR("missing column in table %s\n", debugstr_w(szTableName)); - msi_free_colinfo( colinfo, maxcount ); + free_colinfo( colinfo, maxcount ); return ERROR_FUNCTION_FAILED; } table_calc_column_offsets( db, colinfo, n ); @@ -719,7 +721,7 @@ UINT msi_create_table( MSIDATABASE *db, LPCWSTR name, column_info *col_info, return ERROR_BAD_QUERY_SYNTAX; } - table = msi_alloc( sizeof (MSITABLE) + lstrlenW(name)*sizeof (WCHAR) ); + table = malloc( sizeof(MSITABLE) + wcslen(name) * sizeof(WCHAR) ); if( !table ) return ERROR_FUNCTION_FAILED; @@ -738,7 +740,7 @@ UINT msi_create_table( MSIDATABASE *db, LPCWSTR name, column_info *col_info, for( col = col_info; col; col = col->next ) table->col_count++; - table->colinfo = msi_alloc( table->col_count * sizeof(MSICOLUMNINFO) ); + table->colinfo = malloc( table->col_count * sizeof(*table->colinfo) ); if (!table->colinfo) { free_table( table ); @@ -867,7 +869,7 @@ static UINT save_table( MSIDATABASE *db, const MSITABLE *t, UINT bytes_per_strre TRACE("Saving %s\n", debugstr_w( t->name ) ); - row_size = msi_table_get_row_size( db, t->colinfo, t->col_count, bytes_per_strref ); + row_size = table_get_row_size( db, t->colinfo, t->col_count, bytes_per_strref ); row_count = t->row_count; for (i = 0; i < t->row_count; i++) { @@ -878,7 +880,7 @@ static UINT save_table( MSIDATABASE *db, const MSITABLE *t, UINT bytes_per_strre } } rawsize = row_count * row_size; - rawdata = msi_alloc_zero( rawsize ); + rawdata = calloc( 1, rawsize ); if( !rawdata ) { r = ERROR_NOT_ENOUGH_MEMORY; @@ -926,11 +928,11 @@ static UINT save_table( MSIDATABASE *db, const MSITABLE *t, UINT bytes_per_strre r = write_stream_data( db->storage, t->name, rawdata, rawsize, TRUE ); err: - msi_free( rawdata ); + free( rawdata ); return r; } -static void msi_update_table_columns( MSIDATABASE *db, LPCWSTR name ) +static void update_table_columns( MSIDATABASE *db, const WCHAR *name ) { MSITABLE *table; UINT size, offset, old_count; @@ -938,19 +940,19 @@ static void msi_update_table_columns( MSIDATABASE *db, LPCWSTR name ) if (!(table = find_cached_table( db, name ))) return; old_count = table->col_count; - msi_free_colinfo( table->colinfo, table->col_count ); - msi_free( table->colinfo ); + free_colinfo( table->colinfo, table->col_count ); + free( table->colinfo ); table->colinfo = NULL; table_get_column_info( db, name, &table->colinfo, &table->col_count ); if (!table->col_count) return; - size = msi_table_get_row_size( db, table->colinfo, table->col_count, LONG_STR_BYTES ); + size = table_get_row_size( db, table->colinfo, table->col_count, LONG_STR_BYTES ); offset = table->colinfo[table->col_count - 1].offset; for ( n = 0; n < table->row_count; n++ ) { - table->data[n] = msi_realloc( table->data[n], size ); + table->data[n] = realloc( table->data[n], size ); if (old_count < table->col_count) memset( &table->data[n][offset], 0, size - offset ); } @@ -991,20 +993,20 @@ BOOL TABLE_Exists( MSIDATABASE *db, LPCWSTR name ) /* below is the query interface to a table */ -typedef struct tagMSITABLEVIEW +struct table_view { MSIVIEW view; MSIDATABASE *db; MSITABLE *table; - MSICOLUMNINFO *columns; + struct column_info *columns; UINT num_cols; UINT row_size; WCHAR name[1]; -} MSITABLEVIEW; +}; static UINT TABLE_fetch_int( struct tagMSIVIEW *view, UINT row, UINT col, UINT *val ) { - MSITABLEVIEW *tv = (MSITABLEVIEW*)view; + struct table_view *tv = (struct table_view *)view; UINT offset, n; if( !tv->table ) @@ -1039,7 +1041,7 @@ static UINT TABLE_fetch_int( struct tagMSIVIEW *view, UINT row, UINT col, UINT * return ERROR_SUCCESS; } -static UINT get_stream_name( const MSITABLEVIEW *tv, UINT row, WCHAR **pstname ) +static UINT get_stream_name( const struct table_view *tv, UINT row, WCHAR **pstname ) { LPWSTR p, stname = NULL; UINT i, r, type, ival; @@ -1050,7 +1052,7 @@ static UINT get_stream_name( const MSITABLEVIEW *tv, UINT row, WCHAR **pstname ) TRACE("%p %d\n", tv, row); len = lstrlenW( tv->name ) + 1; - stname = msi_alloc( len*sizeof(WCHAR) ); + stname = malloc( len * sizeof(WCHAR) ); if ( !stname ) { r = ERROR_OUTOFMEMORY; @@ -1100,7 +1102,7 @@ static UINT get_stream_name( const MSITABLEVIEW *tv, UINT row, WCHAR **pstname ) } len += lstrlenW( L"." ) + lstrlenW( sval ); - p = msi_realloc ( stname, len*sizeof(WCHAR) ); + p = realloc( stname, len * sizeof(WCHAR) ); if ( !p ) { r = ERROR_OUTOFMEMORY; @@ -1119,7 +1121,7 @@ static UINT get_stream_name( const MSITABLEVIEW *tv, UINT row, WCHAR **pstname ) return ERROR_SUCCESS; err: - msi_free( stname ); + free( stname ); *pstname = NULL; return r; } @@ -1131,7 +1133,7 @@ static UINT get_stream_name( const MSITABLEVIEW *tv, UINT row, WCHAR **pstname ) */ static UINT TABLE_fetch_stream( struct tagMSIVIEW *view, UINT row, UINT col, IStream **stm ) { - MSITABLEVIEW *tv = (MSITABLEVIEW*)view; + struct table_view *tv = (struct table_view *)view; UINT r; WCHAR *name; @@ -1149,12 +1151,12 @@ static UINT TABLE_fetch_stream( struct tagMSIVIEW *view, UINT row, UINT col, ISt if (r != ERROR_SUCCESS) ERR("fetching stream %s, error = %u\n", debugstr_w(name), r); - msi_free( name ); + free( name ); return r; } /* Set a table value, i.e. preadjusted integer or string ID. */ -static UINT table_set_bytes( MSITABLEVIEW *tv, UINT row, UINT col, UINT val ) +static UINT table_set_bytes( struct table_view *tv, UINT row, UINT col, UINT val ) { UINT offset, n, i; @@ -1174,7 +1176,7 @@ static UINT table_set_bytes( MSITABLEVIEW *tv, UINT row, UINT col, UINT val ) return ERROR_FUNCTION_FAILED; } - msi_free( tv->columns[col-1].hash_table ); + free( tv->columns[col-1].hash_table ); tv->columns[col-1].hash_table = NULL; n = bytes_per_column( tv->db, &tv->columns[col - 1], LONG_STR_BYTES ); @@ -1191,7 +1193,7 @@ static UINT table_set_bytes( MSITABLEVIEW *tv, UINT row, UINT col, UINT val ) return ERROR_SUCCESS; } -static UINT int_to_table_storage( const MSITABLEVIEW *tv, UINT col, int val, UINT *ret ) +static UINT int_to_table_storage( const struct table_view *tv, UINT col, int val, UINT *ret ) { if ((tv->columns[col-1].type & MSI_DATASIZEMASK) == 2) { @@ -1213,7 +1215,7 @@ static UINT int_to_table_storage( const MSITABLEVIEW *tv, UINT col, int val, UIN static UINT TABLE_set_int( MSIVIEW *view, UINT row, UINT col, int val ) { - MSITABLEVIEW *tv = (MSITABLEVIEW *)view; + struct table_view *tv = (struct table_view *)view; UINT r, table_int; TRACE("row %u, col %u, val %d.\n", row, col, val); @@ -1240,7 +1242,7 @@ static UINT TABLE_set_int( MSIVIEW *view, UINT row, UINT col, int val ) static UINT TABLE_set_string( MSIVIEW *view, UINT row, UINT col, const WCHAR *val, int len ) { - MSITABLEVIEW *tv = (MSITABLEVIEW *)view; + struct table_view *tv = (struct table_view *)view; BOOL persistent; UINT id, r; @@ -1277,7 +1279,7 @@ static UINT TABLE_set_string( MSIVIEW *view, UINT row, UINT col, const WCHAR *va static UINT TABLE_get_row( struct tagMSIVIEW *view, UINT row, MSIRECORD **rec ) { - MSITABLEVIEW *tv = (MSITABLEVIEW *)view; + struct table_view *tv = (struct table_view *)view; if (!tv->table) return ERROR_INVALID_PARAMETER; @@ -1339,7 +1341,7 @@ static UINT add_stream( MSIDATABASE *db, const WCHAR *name, IStream *data ) static UINT TABLE_set_stream( MSIVIEW *view, UINT row, UINT col, IStream *stream ) { - MSITABLEVIEW *tv = (MSITABLEVIEW *)view; + struct table_view *tv = (struct table_view *)view; WCHAR *name; UINT r; @@ -1349,13 +1351,13 @@ static UINT TABLE_set_stream( MSIVIEW *view, UINT row, UINT col, IStream *stream return r; r = add_stream( tv->db, name, stream ); - msi_free( name ); + free( name ); return r; } -static UINT get_table_value_from_record( MSITABLEVIEW *tv, MSIRECORD *rec, UINT iField, UINT *pvalue ) +static UINT get_table_value_from_record( struct table_view *tv, MSIRECORD *rec, UINT iField, UINT *pvalue ) { - MSICOLUMNINFO columninfo; + struct column_info columninfo; UINT r; if (!iField || iField > tv->num_cols || MSI_RecordIsNull( rec, iField )) @@ -1387,7 +1389,7 @@ static UINT get_table_value_from_record( MSITABLEVIEW *tv, MSIRECORD *rec, UINT static UINT TABLE_set_row( struct tagMSIVIEW *view, UINT row, MSIRECORD *rec, UINT mask ) { - MSITABLEVIEW *tv = (MSITABLEVIEW*)view; + struct table_view *tv = (struct table_view *)view; UINT i, val, r = ERROR_SUCCESS; if ( !tv->table ) @@ -1434,7 +1436,7 @@ static UINT TABLE_set_row( struct tagMSIVIEW *view, UINT row, MSIRECORD *rec, UI r = add_stream( tv->db, stname, stm ); IStream_Release( stm ); - msi_free ( stname ); + free( stname ); if ( r != ERROR_SUCCESS ) return r; @@ -1472,7 +1474,7 @@ static UINT TABLE_set_row( struct tagMSIVIEW *view, UINT row, MSIRECORD *rec, UI static UINT table_create_new_row( struct tagMSIVIEW *view, UINT *num, BOOL temporary ) { - MSITABLEVIEW *tv = (MSITABLEVIEW*)view; + struct table_view *tv = (struct table_view *)view; BYTE **p, *row; BOOL *b; UINT sz; @@ -1485,7 +1487,7 @@ static UINT table_create_new_row( struct tagMSIVIEW *view, UINT *num, BOOL tempo if( !tv->table ) return ERROR_INVALID_PARAMETER; - row = msi_alloc_zero( tv->row_size ); + row = calloc( 1, tv->row_size ); if( !row ) return ERROR_NOT_ENOUGH_MEMORY; @@ -1497,24 +1499,24 @@ static UINT table_create_new_row( struct tagMSIVIEW *view, UINT *num, BOOL tempo sz = (*row_count + 1) * sizeof (BYTE*); if( *data_ptr ) - p = msi_realloc( *data_ptr, sz ); + p = realloc( *data_ptr, sz ); else - p = msi_alloc( sz ); + p = malloc( sz ); if( !p ) { - msi_free( row ); + free( row ); return ERROR_NOT_ENOUGH_MEMORY; } sz = (*row_count + 1) * sizeof (BOOL); if( *data_persist_ptr ) - b = msi_realloc( *data_persist_ptr, sz ); + b = realloc( *data_persist_ptr, sz ); else - b = msi_alloc( sz ); + b = malloc( sz ); if( !b ) { - msi_free( row ); - msi_free( p ); + free( row ); + free( p ); return ERROR_NOT_ENOUGH_MEMORY; } @@ -1531,7 +1533,7 @@ static UINT table_create_new_row( struct tagMSIVIEW *view, UINT *num, BOOL tempo static UINT TABLE_execute( struct tagMSIVIEW *view, MSIRECORD *record ) { - MSITABLEVIEW *tv = (MSITABLEVIEW*)view; + struct table_view *tv = (struct table_view *)view; TRACE("%p %p\n", tv, record); @@ -1549,7 +1551,7 @@ static UINT TABLE_close( struct tagMSIVIEW *view ) static UINT TABLE_get_dimensions( struct tagMSIVIEW *view, UINT *rows, UINT *cols) { - MSITABLEVIEW *tv = (MSITABLEVIEW*)view; + struct table_view *tv = (struct table_view *)view; TRACE("%p %p %p\n", view, rows, cols ); @@ -1569,7 +1571,7 @@ static UINT TABLE_get_column_info( struct tagMSIVIEW *view, UINT n, LPCWSTR *name, UINT *type, BOOL *temporary, LPCWSTR *table_name ) { - MSITABLEVIEW *tv = (MSITABLEVIEW*)view; + struct table_view *tv = (struct table_view *)view; TRACE("%p %d %p %p\n", tv, n, name, type ); @@ -1599,9 +1601,9 @@ static UINT TABLE_get_column_info( struct tagMSIVIEW *view, return ERROR_SUCCESS; } -static UINT msi_table_find_row( MSITABLEVIEW *tv, MSIRECORD *rec, UINT *row, UINT *column ); +static UINT table_find_row( struct table_view *, MSIRECORD *, UINT *, UINT * ); -static UINT table_validate_new( MSITABLEVIEW *tv, MSIRECORD *rec, UINT *column ) +static UINT table_validate_new( struct table_view *tv, MSIRECORD *rec, UINT *column ) { UINT r, row, i; @@ -1638,14 +1640,14 @@ static UINT table_validate_new( MSITABLEVIEW *tv, MSIRECORD *rec, UINT *column ) } /* check there are no duplicate keys */ - r = msi_table_find_row( tv, rec, &row, column ); + r = table_find_row( tv, rec, &row, column ); if (r == ERROR_SUCCESS) return ERROR_FUNCTION_FAILED; return ERROR_SUCCESS; } -static int compare_record( MSITABLEVIEW *tv, UINT row, MSIRECORD *rec ) +static int compare_record( struct table_view *tv, UINT row, MSIRECORD *rec ) { UINT r, i, ivalue, x; @@ -1678,7 +1680,7 @@ static int compare_record( MSITABLEVIEW *tv, UINT row, MSIRECORD *rec ) return 1; } -static int find_insert_index( MSITABLEVIEW *tv, MSIRECORD *rec ) +static int find_insert_index( struct table_view *tv, MSIRECORD *rec ) { int idx, c, low = 0, high = tv->table->row_count - 1; @@ -1705,7 +1707,7 @@ static int find_insert_index( MSITABLEVIEW *tv, MSIRECORD *rec ) static UINT TABLE_insert_row( struct tagMSIVIEW *view, MSIRECORD *rec, UINT row, BOOL temporary ) { - MSITABLEVIEW *tv = (MSITABLEVIEW*)view; + struct table_view *tv = (struct table_view *)view; UINT i, r; TRACE("%p %p %s\n", tv, rec, temporary ? "TRUE" : "FALSE" ); @@ -1738,7 +1740,7 @@ static UINT TABLE_insert_row( struct tagMSIVIEW *view, MSIRECORD *rec, UINT row, static UINT TABLE_delete_row( struct tagMSIVIEW *view, UINT row ) { - MSITABLEVIEW *tv = (MSITABLEVIEW*)view; + struct table_view *tv = (struct table_view *)view; UINT r, num_rows, num_cols, i; TRACE("%p %d\n", tv, row); @@ -1759,7 +1761,7 @@ static UINT TABLE_delete_row( struct tagMSIVIEW *view, UINT row ) /* reset the hash tables */ for (i = 0; i < tv->num_cols; i++) { - msi_free( tv->columns[i].hash_table ); + free(tv->columns[i].hash_table); tv->columns[i].hash_table = NULL; } @@ -1769,14 +1771,14 @@ static UINT TABLE_delete_row( struct tagMSIVIEW *view, UINT row ) tv->table->data_persistent[i - 1] = tv->table->data_persistent[i]; } - msi_free(tv->table->data[num_rows - 1]); + free(tv->table->data[num_rows - 1]); return ERROR_SUCCESS; } -static UINT msi_table_update(struct tagMSIVIEW *view, MSIRECORD *rec, UINT row) +static UINT table_update(struct tagMSIVIEW *view, MSIRECORD *rec, UINT row) { - MSITABLEVIEW *tv = (MSITABLEVIEW *)view; + struct table_view *tv = (struct table_view *)view; UINT r, new_row; /* FIXME: MsiViewFetch should set rec index 0 to some ID that @@ -1786,7 +1788,7 @@ static UINT msi_table_update(struct tagMSIVIEW *view, MSIRECORD *rec, UINT row) if (!tv->table) return ERROR_INVALID_PARAMETER; - r = msi_table_find_row(tv, rec, &new_row, NULL); + r = table_find_row(tv, rec, &new_row, NULL); if (r != ERROR_SUCCESS) { ERR("can't find row to modify\n"); @@ -1800,22 +1802,22 @@ static UINT msi_table_update(struct tagMSIVIEW *view, MSIRECORD *rec, UINT row) return TABLE_set_row(view, new_row, rec, (1 << tv->num_cols) - 1); } -static UINT msi_table_assign(struct tagMSIVIEW *view, MSIRECORD *rec) +static UINT table_assign(struct tagMSIVIEW *view, MSIRECORD *rec) { - MSITABLEVIEW *tv = (MSITABLEVIEW *)view; + struct table_view *tv = (struct table_view *)view; UINT r, row; if (!tv->table) return ERROR_INVALID_PARAMETER; - r = msi_table_find_row(tv, rec, &row, NULL); + r = table_find_row(tv, rec, &row, NULL); if (r == ERROR_SUCCESS) return TABLE_set_row(view, row, rec, (1 << tv->num_cols) - 1); else return TABLE_insert_row( view, rec, -1, FALSE ); } -static UINT msi_refresh_record( struct tagMSIVIEW *view, MSIRECORD *rec, UINT row ) +static UINT refresh_record( struct tagMSIVIEW *view, MSIRECORD *rec, UINT row ) { MSIRECORD *curr; UINT r, i, count; @@ -1838,7 +1840,7 @@ static UINT msi_refresh_record( struct tagMSIVIEW *view, MSIRECORD *rec, UINT ro static UINT TABLE_modify( struct tagMSIVIEW *view, MSIMODIFY eModifyMode, MSIRECORD *rec, UINT row) { - MSITABLEVIEW *tv = (MSITABLEVIEW*)view; + struct table_view *tv = (struct table_view *)view; UINT r, frow, column; TRACE("%p %d %p\n", view, eModifyMode, rec ); @@ -1873,20 +1875,20 @@ static UINT TABLE_modify( struct tagMSIVIEW *view, MSIMODIFY eModifyMode, break; case MSIMODIFY_REFRESH: - r = msi_refresh_record( view, rec, row ); + r = refresh_record( view, rec, row ); break; case MSIMODIFY_UPDATE: - r = msi_table_update( view, rec, row ); + r = table_update( view, rec, row ); break; case MSIMODIFY_ASSIGN: - r = msi_table_assign( view, rec ); + r = table_assign( view, rec ); break; case MSIMODIFY_MERGE: /* check row that matches this record */ - r = msi_table_find_row( tv, rec, &frow, &column ); + r = table_find_row( tv, rec, &frow, &column ); if (r != ERROR_SUCCESS) { r = table_validate_new( tv, rec, NULL ); @@ -1912,21 +1914,21 @@ static UINT TABLE_modify( struct tagMSIVIEW *view, MSIMODIFY eModifyMode, static UINT TABLE_delete( struct tagMSIVIEW *view ) { - MSITABLEVIEW *tv = (MSITABLEVIEW*)view; + struct table_view *tv = (struct table_view *)view; TRACE("%p\n", view ); tv->table = NULL; tv->columns = NULL; - msi_free( tv ); + free( tv ); return ERROR_SUCCESS; } static UINT TABLE_add_ref(struct tagMSIVIEW *view) { - MSITABLEVIEW *tv = (MSITABLEVIEW*)view; + struct table_view *tv = (struct table_view *)view; TRACE( "%p, %ld\n", view, tv->table->ref_count ); return InterlockedIncrement(&tv->table->ref_count); @@ -1934,7 +1936,7 @@ static UINT TABLE_add_ref(struct tagMSIVIEW *view) static UINT TABLE_remove_column(struct tagMSIVIEW *view, UINT number) { - MSITABLEVIEW *tv = (MSITABLEVIEW*)view; + struct table_view *tv = (struct table_view *)view; MSIRECORD *rec = NULL; MSIVIEW *columns = NULL; UINT row, r; @@ -1946,10 +1948,10 @@ static UINT TABLE_remove_column(struct tagMSIVIEW *view, UINT number) { UINT size = tv->table->colinfo[number-1].offset; tv->table->col_count--; - tv->table->colinfo = msi_realloc( tv->table->colinfo, sizeof(*tv->table->colinfo) * tv->table->col_count ); + tv->table->colinfo = realloc(tv->table->colinfo, sizeof(*tv->table->colinfo) * tv->table->col_count); for (row = 0; row < tv->table->row_count; row++) - tv->table->data[row] = msi_realloc( tv->table->data[row], size ); + tv->table->data[row] = realloc(tv->table->data[row], size); return ERROR_SUCCESS; } @@ -1967,7 +1969,7 @@ static UINT TABLE_remove_column(struct tagMSIVIEW *view, UINT number) return r; } - r = msi_table_find_row((MSITABLEVIEW *)columns, rec, &row, NULL); + r = table_find_row((struct table_view *)columns, rec, &row, NULL); if (r != ERROR_SUCCESS) goto done; @@ -1975,7 +1977,7 @@ static UINT TABLE_remove_column(struct tagMSIVIEW *view, UINT number) if (r != ERROR_SUCCESS) goto done; - msi_update_table_columns(tv->db, tv->name); + update_table_columns(tv->db, tv->name); done: msiobj_release(&rec->hdr); @@ -1985,7 +1987,7 @@ static UINT TABLE_remove_column(struct tagMSIVIEW *view, UINT number) static UINT TABLE_release(struct tagMSIVIEW *view) { - MSITABLEVIEW *tv = (MSITABLEVIEW*)view; + struct table_view *tv = (struct table_view *)view; INT ref = tv->table->ref_count; UINT r; INT i; @@ -2025,8 +2027,8 @@ static UINT TABLE_add_column(struct tagMSIVIEW *view, LPCWSTR column, { UINT i, r, table_id, col_id, size, offset; BOOL temporary = type & MSITYPE_TEMPORARY; - MSITABLEVIEW *tv = (MSITABLEVIEW*)view; - MSICOLUMNINFO *colinfo; + struct table_view *tv = (struct table_view *)view; + struct column_info *colinfo; if (temporary && !hold && !tv->table->ref_count) return ERROR_SUCCESS; @@ -2041,7 +2043,7 @@ static UINT TABLE_add_column(struct tagMSIVIEW *view, LPCWSTR column, return ERROR_BAD_QUERY_SYNTAX; } - colinfo = msi_realloc(tv->table->colinfo, sizeof(*tv->table->colinfo) * (tv->table->col_count + 1)); + colinfo = realloc(tv->table->colinfo, sizeof(*tv->table->colinfo) * (tv->table->col_count + 1)); if (!colinfo) return ERROR_OUTOFMEMORY; tv->table->colinfo = colinfo; @@ -2061,11 +2063,11 @@ static UINT TABLE_add_column(struct tagMSIVIEW *view, LPCWSTR column, table_calc_column_offsets( tv->db, tv->table->colinfo, tv->table->col_count); - size = msi_table_get_row_size( tv->db, tv->table->colinfo, tv->table->col_count, LONG_STR_BYTES ); + size = table_get_row_size( tv->db, tv->table->colinfo, tv->table->col_count, LONG_STR_BYTES ); offset = tv->table->colinfo[tv->table->col_count - 1].offset; for (i = 0; i < tv->table->row_count; i++) { - BYTE *data = msi_realloc( tv->table->data[i], size ); + BYTE *data = realloc(tv->table->data[i], size); if (!data) { tv->table->col_count--; @@ -2117,7 +2119,7 @@ static UINT TABLE_add_column(struct tagMSIVIEW *view, LPCWSTR column, static UINT TABLE_drop(struct tagMSIVIEW *view) { - MSITABLEVIEW *tv = (MSITABLEVIEW*)view; + struct table_view *tv = (struct table_view *)view; MSIVIEW *tables = NULL; MSIRECORD *rec = NULL; UINT r, row; @@ -2145,7 +2147,7 @@ static UINT TABLE_drop(struct tagMSIVIEW *view) return r; } - r = msi_table_find_row((MSITABLEVIEW *)tables, rec, &row, NULL); + r = table_find_row((struct table_view *)tables, rec, &row, NULL); if (r != ERROR_SUCCESS) goto done; @@ -2188,7 +2190,7 @@ static const MSIVIEWOPS table_ops = UINT TABLE_CreateView( MSIDATABASE *db, LPCWSTR name, MSIVIEW **view ) { - MSITABLEVIEW *tv ; + struct table_view *tv ; UINT r, sz; TRACE("%p %s %p\n", db, debugstr_w(name), view ); @@ -2198,15 +2200,15 @@ UINT TABLE_CreateView( MSIDATABASE *db, LPCWSTR name, MSIVIEW **view ) else if ( !wcscmp( name, L"_Storages" ) ) return STORAGES_CreateView( db, view ); - sz = FIELD_OFFSET( MSITABLEVIEW, name[lstrlenW( name ) + 1] ); - tv = msi_alloc_zero( sz ); + sz = FIELD_OFFSET( struct table_view, name[lstrlenW( name ) + 1] ); + tv = calloc( 1, sz ); if( !tv ) return ERROR_FUNCTION_FAILED; r = get_table( db, name, &tv->table ); if( r != ERROR_SUCCESS ) { - msi_free( tv ); + free( tv ); WARN("table not found\n"); return r; } @@ -2218,7 +2220,7 @@ UINT TABLE_CreateView( MSIDATABASE *db, LPCWSTR name, MSIVIEW **view ) tv->db = db; tv->columns = tv->table->colinfo; tv->num_cols = tv->table->col_count; - tv->row_size = msi_table_get_row_size( db, tv->table->colinfo, tv->table->col_count, LONG_STR_BYTES ); + tv->row_size = table_get_row_size( db, tv->table->colinfo, tv->table->col_count, LONG_STR_BYTES ); TRACE("%s one row is %d bytes\n", debugstr_w(name), tv->row_size ); @@ -2228,7 +2230,7 @@ UINT TABLE_CreateView( MSIDATABASE *db, LPCWSTR name, MSIVIEW **view ) return ERROR_SUCCESS; } -static WCHAR* create_key_string(MSITABLEVIEW *tv, MSIRECORD *rec) +static WCHAR *create_key_string(struct table_view *tv, MSIRECORD *rec) { DWORD i, p, len, key_len = 0; WCHAR *key; @@ -2242,7 +2244,7 @@ static WCHAR* create_key_string(MSITABLEVIEW *tv, MSIRECORD *rec) key_len++; } - key = msi_alloc( key_len * sizeof(WCHAR) ); + key = malloc( key_len * sizeof(WCHAR) ); if(!key) return NULL; @@ -2260,7 +2262,7 @@ static WCHAR* create_key_string(MSITABLEVIEW *tv, MSIRECORD *rec) return key; } -static UINT msi_record_stream_name( const MSITABLEVIEW *tv, MSIRECORD *rec, LPWSTR name, DWORD *len ) +static UINT record_stream_name( const struct table_view *tv, MSIRECORD *rec, WCHAR *name, DWORD *len ) { UINT p = 0, i, r; DWORD l; @@ -2295,7 +2297,7 @@ static UINT msi_record_stream_name( const MSITABLEVIEW *tv, MSIRECORD *rec, LPWS static UINT TransformView_fetch_int( MSIVIEW *view, UINT row, UINT col, UINT *val ) { - MSITABLEVIEW *tv = (MSITABLEVIEW*)view; + struct table_view *tv = (struct table_view *)view; if (!tv->table || col > tv->table->col_count) { @@ -2307,7 +2309,7 @@ static UINT TransformView_fetch_int( MSIVIEW *view, UINT row, UINT col, UINT *va static UINT TransformView_fetch_stream( MSIVIEW *view, UINT row, UINT col, IStream **stm ) { - MSITABLEVIEW *tv = (MSITABLEVIEW*)view; + struct table_view *tv = (struct table_view *)view; if (!tv->table || col > tv->table->col_count) { @@ -2322,7 +2324,7 @@ static UINT TransformView_set_row( MSIVIEW *view, UINT row, MSIRECORD *rec, UINT static const WCHAR query_pfx[] = L"INSERT INTO `_TransformView` (`new`, `Table`, `Column`, `Row`, `Data`, `Current`) VALUES (1, '"; - MSITABLEVIEW *tv = (MSITABLEVIEW*)view; + struct table_view *tv = (struct table_view *)view; WCHAR buf[256], *query; MSIRECORD *old_rec; MSIQUERY *q; @@ -2362,33 +2364,33 @@ static UINT TransformView_set_row( MSIVIEW *view, UINT row, MSIRECORD *rec, UINT qlen += wcslen( tv->columns[i].colname ) + 3; qlen += wcslen( key ) + 3; if (MSITYPE_IS_BINARY( tv->columns[i].type )) - r = msi_record_stream_name( tv, rec, NULL, &len ); + r = record_stream_name( tv, rec, NULL, &len ); else r = MSI_RecordGetStringW( rec, i + 1, NULL, &len ); if (r != ERROR_SUCCESS) { if (old_rec) msiobj_release( &old_rec->hdr ); - msi_free( key ); + free( key ); return r; } qlen += len + 3; if (old_rec && (r = MSI_RecordGetStringW( old_rec, i+1, NULL, &len ))) { msiobj_release( &old_rec->hdr ); - msi_free( key ); + free( key ); return r; } qlen += len + 3; /* strlen("')") + 1 */ if (qlen > ARRAY_SIZE(buf)) { - query = msi_alloc( qlen * sizeof(WCHAR) ); + query = malloc( qlen * sizeof(WCHAR) ); if (!query) { if (old_rec) msiobj_release( &old_rec->hdr ); - msi_free( key ); + free( key ); return ERROR_OUTOFMEMORY; } } @@ -2418,7 +2420,7 @@ static UINT TransformView_set_row( MSIVIEW *view, UINT row, MSIRECORD *rec, UINT query[p++] = '\''; len = qlen - p; if (MSITYPE_IS_BINARY( tv->columns[i].type )) - msi_record_stream_name( tv, rec, query + p, &len ); + record_stream_name( tv, rec, query + p, &len ); else MSI_RecordGetStringW( rec, i + 1, query + p, &len ); p += len; @@ -2437,12 +2439,12 @@ static UINT TransformView_set_row( MSIVIEW *view, UINT row, MSIRECORD *rec, UINT r = MSI_DatabaseOpenViewW( tv->db, query, &q ); if (query != buf) - msi_free( query ); + free( query ); if (r != ERROR_SUCCESS) { if (old_rec) msiobj_release( &old_rec->hdr ); - msi_free( key ); + free( key ); return r; } @@ -2452,18 +2454,18 @@ static UINT TransformView_set_row( MSIVIEW *view, UINT row, MSIRECORD *rec, UINT { if (old_rec) msiobj_release( &old_rec->hdr ); - msi_free( key ); + free( key ); return r; } } if (old_rec) msiobj_release( &old_rec->hdr ); - msi_free( key ); + free( key ); return ERROR_SUCCESS; } -static UINT TransformView_create_table( MSITABLEVIEW *tv, MSIRECORD *rec ) +static UINT TransformView_create_table( struct table_view *tv, MSIRECORD *rec ) { static const WCHAR query_fmt[] = L"INSERT INTO `_TransformView` (`Table`, `Column`, `new`) VALUES ('%s', 'CREATE', 1)"; @@ -2481,7 +2483,7 @@ static UINT TransformView_create_table( MSITABLEVIEW *tv, MSIRECORD *rec ) len = _snwprintf( NULL, 0, query_fmt, name ) + 1; if (len > ARRAY_SIZE(buf)) { - query = msi_alloc( len * sizeof(WCHAR) ); + query = malloc( len * sizeof(WCHAR) ); if (!query) return ERROR_OUTOFMEMORY; } @@ -2489,7 +2491,7 @@ static UINT TransformView_create_table( MSITABLEVIEW *tv, MSIRECORD *rec ) r = MSI_DatabaseOpenViewW( tv->db, query, &q ); if (query != buf) - msi_free( query ); + free( query ); if (r != ERROR_SUCCESS) return r; @@ -2498,7 +2500,7 @@ static UINT TransformView_create_table( MSITABLEVIEW *tv, MSIRECORD *rec ) return r; } -static UINT TransformView_add_column( MSITABLEVIEW *tv, MSIRECORD *rec ) +static UINT TransformView_add_column( struct table_view *tv, MSIRECORD *rec ) { static const WCHAR query_pfx[] = L"INSERT INTO `_TransformView` (`new`, `Table`, `Current`, `Column`, `Data`) VALUES (1, '"; @@ -2519,7 +2521,7 @@ static UINT TransformView_add_column( MSITABLEVIEW *tv, MSIRECORD *rec ) if (qlen > ARRAY_SIZE(buf)) { - query = msi_alloc( len * sizeof(WCHAR) ); + query = malloc( len * sizeof(WCHAR) ); qlen = len; if (!query) return ERROR_OUTOFMEMORY; @@ -2543,7 +2545,7 @@ static UINT TransformView_add_column( MSITABLEVIEW *tv, MSIRECORD *rec ) r = MSI_DatabaseOpenViewW( tv->db, query, &q ); if (query != buf) - msi_free( query ); + free( query ); if (r != ERROR_SUCCESS) return r; @@ -2557,7 +2559,7 @@ static UINT TransformView_insert_row( MSIVIEW *view, MSIRECORD *rec, UINT row, B static const WCHAR query_fmt[] = L"INSERT INTO `_TransformView` (`new`, `Table`, `Column`, `Row`) VALUES (1, '%s', 'INSERT', '%s')"; - MSITABLEVIEW *tv = (MSITABLEVIEW*)view; + struct table_view *tv = (struct table_view *)view; WCHAR buf[256], *query = buf; MSIQUERY *q; WCHAR *key; @@ -2577,19 +2579,19 @@ static UINT TransformView_insert_row( MSIVIEW *view, MSIRECORD *rec, UINT row, B len = _snwprintf( NULL, 0, query_fmt, tv->name, key ) + 1; if (len > ARRAY_SIZE(buf)) { - query = msi_alloc( len * sizeof(WCHAR) ); + query = malloc( len * sizeof(WCHAR) ); if (!query) { - msi_free( key ); + free( key ); return ERROR_OUTOFMEMORY; } } swprintf( query, len, query_fmt, tv->name, key ); - msi_free( key ); + free( key ); r = MSI_DatabaseOpenViewW( tv->db, query, &q ); if (query != buf) - msi_free( query ); + free( query ); if (r != ERROR_SUCCESS) return r; @@ -2601,7 +2603,7 @@ static UINT TransformView_insert_row( MSIVIEW *view, MSIRECORD *rec, UINT row, B return TransformView_set_row( view, row, rec, ~0 ); } -static UINT TransformView_drop_table( MSITABLEVIEW *tv, UINT row ) +static UINT TransformView_drop_table( struct table_view *tv, UINT row ) { static const WCHAR query_pfx[] = L"INSERT INTO `_TransformView` ( `new`, `Table`, `Column` ) VALUES ( 1, '"; static const WCHAR query_sfx[] = L"', 'DROP' )"; @@ -2623,7 +2625,7 @@ static UINT TransformView_drop_table( MSITABLEVIEW *tv, UINT row ) len = ARRAY_SIZE(query_pfx) - 1 + table_len + ARRAY_SIZE(query_sfx); if (len > ARRAY_SIZE(buf)) { - query = msi_alloc( len * sizeof(WCHAR) ); + query = malloc( len * sizeof(WCHAR) ); if (!query) return ERROR_OUTOFMEMORY; } @@ -2636,7 +2638,7 @@ static UINT TransformView_drop_table( MSITABLEVIEW *tv, UINT row ) r = MSI_DatabaseOpenViewW( tv->db, query, &q ); if (query != buf) - msi_free( query ); + free( query ); if (r != ERROR_SUCCESS) return r; @@ -2651,7 +2653,7 @@ static UINT TransformView_delete_row( MSIVIEW *view, UINT row ) static const WCHAR query_column[] = L"', 'DELETE', '"; static const WCHAR query_sfx[] = L"')"; - MSITABLEVIEW *tv = (MSITABLEVIEW*)view; + struct table_view *tv = (struct table_view *)view; WCHAR *key, buf[256], *query = buf; UINT r, len, name_len, key_len; MSIRECORD *rec; @@ -2680,11 +2682,11 @@ static UINT TransformView_delete_row( MSIVIEW *view, UINT row ) len = ARRAY_SIZE(query_pfx) + name_len + ARRAY_SIZE(query_column) + key_len + ARRAY_SIZE(query_sfx) - 2; if (len > ARRAY_SIZE(buf)) { - query = msi_alloc( len * sizeof(WCHAR) ); + query = malloc( len * sizeof(WCHAR) ); if (!query) { - msi_free( tv ); - msi_free( key ); + free( tv ); + free( key ); return ERROR_OUTOFMEMORY; } } @@ -2698,11 +2700,11 @@ static UINT TransformView_delete_row( MSIVIEW *view, UINT row ) memcpy( query + len, key, key_len * sizeof(WCHAR) ); len += key_len; memcpy( query + len, query_sfx, ARRAY_SIZE(query_sfx) * sizeof(WCHAR) ); - msi_free( key ); + free( key ); r = MSI_DatabaseOpenViewW( tv->db, query, &q ); if (query != buf) - msi_free( query ); + free( query ); if (r != ERROR_SUCCESS) return r; @@ -2734,9 +2736,9 @@ static UINT TransformView_get_column_info( MSIVIEW *view, UINT n, LPCWSTR *name, static UINT TransformView_delete( MSIVIEW *view ) { - MSITABLEVIEW *tv = (MSITABLEVIEW*)view; + struct table_view *tv = (struct table_view *)view; if (!tv->table || tv->columns != tv->table->colinfo) - msi_free( tv->columns ); + free( tv->columns ); return TABLE_delete( view ); } @@ -2763,51 +2765,46 @@ static const MSIVIEWOPS transform_view_ops = NULL }; -UINT TransformView_Create( MSIDATABASE *db, string_table *st, LPCWSTR name, MSIVIEW **view ) +static UINT TransformView_Create( MSIDATABASE *db, string_table *st, LPCWSTR name, MSIVIEW **view ) { static const WCHAR query_pfx[] = L"SELECT `Column`, `Data`, `Current` FROM `_TransformView` WHERE `Table`='"; static const WCHAR query_sfx[] = L"' AND `Row` IS NULL AND `Current` IS NOT NULL AND `new` = 1"; WCHAR buf[256], *query = buf; UINT r, len, name_len, size, add_col; - MSICOLUMNINFO *colinfo; - MSITABLEVIEW *tv; + struct column_info *colinfo; + struct table_view *tv; MSIRECORD *rec; MSIQUERY *q; name_len = wcslen( name ); - r = TABLE_CreateView( db, name, view ); + r = TABLE_CreateView( db, name, (MSIVIEW **)&tv ); if (r == ERROR_INVALID_PARAMETER) { /* table does not exist */ - size = FIELD_OFFSET( MSITABLEVIEW, name[name_len + 1] ); - tv = msi_alloc_zero( size ); + size = FIELD_OFFSET( struct table_view, name[name_len + 1] ); + tv = calloc( 1, size ); if (!tv) return ERROR_OUTOFMEMORY; tv->db = db; memcpy( tv->name, name, name_len * sizeof(WCHAR) ); - *view = (MSIVIEW*)tv; } else if (r != ERROR_SUCCESS) { return r; } - else - { - tv = (MSITABLEVIEW*)*view; - } tv->view.ops = &transform_view_ops; len = ARRAY_SIZE(query_pfx) + name_len + ARRAY_SIZE(query_sfx) - 1; if (len > ARRAY_SIZE(buf)) { - query = msi_alloc( len * sizeof(WCHAR) ); + query = malloc( len * sizeof(WCHAR) ); if (!query) { - msi_free( tv ); + free( tv ); return ERROR_OUTOFMEMORY; } } @@ -2819,17 +2816,17 @@ UINT TransformView_Create( MSIDATABASE *db, string_table *st, LPCWSTR name, MSIV r = MSI_DatabaseOpenViewW( tv->db, query, &q ); if (query != buf) - msi_free( query ); + free( query ); if (r != ERROR_SUCCESS) { - msi_free( tv ); + free( tv ); return r; } r = MSI_ViewExecute( q, NULL ); if (r != ERROR_SUCCESS) { - msi_free( tv ); + free( tv ); return r; } @@ -2838,23 +2835,24 @@ UINT TransformView_Create( MSIDATABASE *db, string_table *st, LPCWSTR name, MSIV { MSI_ViewClose( q ); msiobj_release( &q->hdr ); - msi_free( tv ); + free( tv ); return r; } if (!add_col) { MSI_ViewClose( q ); msiobj_release( &q->hdr ); + *view = (MSIVIEW *)tv; return ERROR_SUCCESS; } - colinfo = msi_alloc_zero( (add_col + tv->num_cols) * sizeof(*colinfo) ); + colinfo = calloc( add_col + tv->num_cols, sizeof(*colinfo) ); if (!colinfo) { MSI_ViewClose( q ); msiobj_release( &q->hdr ); - msi_free( tv ); - return r; + free( tv ); + return ERROR_OUTOFMEMORY; } while (MSI_ViewFetch( q, &rec ) == ERROR_SUCCESS) @@ -2881,6 +2879,7 @@ UINT TransformView_Create( MSIDATABASE *db, string_table *st, LPCWSTR name, MSIV memcpy( colinfo, tv->columns, tv->num_cols * sizeof(*colinfo) ); tv->columns = colinfo; tv->num_cols += add_col; + *view = (MSIVIEW *)tv; return ERROR_SUCCESS; } @@ -2946,7 +2945,7 @@ static UINT read_raw_int(const BYTE *data, UINT col, UINT bytes) return ret; } -static UINT msi_record_encoded_stream_name( const MSITABLEVIEW *tv, MSIRECORD *rec, LPWSTR *pstname ) +static UINT record_encoded_stream_name( const struct table_view *tv, MSIRECORD *rec, WCHAR **pstname ) { UINT r; DWORD len; @@ -2954,33 +2953,33 @@ static UINT msi_record_encoded_stream_name( const MSITABLEVIEW *tv, MSIRECORD *r TRACE("%p %p\n", tv, rec); - r = msi_record_stream_name( tv, rec, NULL, &len ); + r = record_stream_name( tv, rec, NULL, &len ); if (r != ERROR_SUCCESS) return r; len++; - name = msi_alloc( len * sizeof(WCHAR) ); + name = malloc( len * sizeof(WCHAR) ); if (!name) return ERROR_OUTOFMEMORY; - r = msi_record_stream_name( tv, rec, name, &len ); + r = record_stream_name( tv, rec, name, &len ); if (r != ERROR_SUCCESS) { - msi_free( name ); + free( name ); return r; } *pstname = encode_streamname( FALSE, name ); - msi_free( name ); + free( name ); return ERROR_SUCCESS; } -static MSIRECORD *msi_get_transform_record( const MSITABLEVIEW *tv, const string_table *st, - IStorage *stg, const BYTE *rawdata, UINT bytes_per_strref ) +static MSIRECORD *get_transform_record( const struct table_view *tv, const string_table *st, IStorage *stg, + const BYTE *rawdata, UINT bytes_per_strref ) { UINT i, val, ofs = 0; USHORT mask; - MSICOLUMNINFO *columns = tv->columns; + struct column_info *columns = tv->columns; MSIRECORD *rec; mask = rawdata[0] | (rawdata[1] << 8); @@ -3007,7 +3006,7 @@ static MSIRECORD *msi_get_transform_record( const MSITABLEVIEW *tv, const string ofs += bytes_per_column( tv->db, &columns[i], bytes_per_strref ); - r = msi_record_encoded_stream_name( tv, rec, &encname ); + r = record_encoded_stream_name( tv, rec, &encname ); if ( r != ERROR_SUCCESS ) { msiobj_release( &rec->hdr ); @@ -3017,13 +3016,13 @@ static MSIRECORD *msi_get_transform_record( const MSITABLEVIEW *tv, const string if ( r != ERROR_SUCCESS ) { msiobj_release( &rec->hdr ); - msi_free( encname ); + free( encname ); return NULL; } MSI_RecordSetStream( rec, i+1, stm ); TRACE(" field %d [%s]\n", i+1, debugstr_w(encname)); - msi_free( encname ); + free( encname ); } else if( columns[i].type & MSITYPE_STRING ) { @@ -3074,11 +3073,11 @@ static void dump_table( const string_table *st, const USHORT *rawdata, UINT raws } } -static UINT* msi_record_to_row( const MSITABLEVIEW *tv, MSIRECORD *rec ) +static UINT *record_to_row( const struct table_view *tv, MSIRECORD *rec ) { UINT i, r, *data; - data = msi_alloc( tv->num_cols *sizeof (UINT) ); + data = malloc( tv->num_cols * sizeof (UINT) ); for( i=0; inum_cols; i++ ) { data[i] = 0; @@ -3100,7 +3099,7 @@ static UINT* msi_record_to_row( const MSITABLEVIEW *tv, MSIRECORD *rec ) these keys can't match any record, so fail now. */ if (r != ERROR_SUCCESS) { - msi_free( data ); + free( data ); return NULL; } } @@ -3110,7 +3109,7 @@ static UINT* msi_record_to_row( const MSITABLEVIEW *tv, MSIRECORD *rec ) { if (int_to_table_storage( tv, i + 1, MSI_RecordGetInteger( rec, i + 1 ), &data[i] )) { - msi_free( data ); + free( data ); return NULL; } } @@ -3118,7 +3117,7 @@ static UINT* msi_record_to_row( const MSITABLEVIEW *tv, MSIRECORD *rec ) return data; } -static UINT msi_row_matches( MSITABLEVIEW *tv, UINT row, const UINT *data, UINT *column ) +static UINT row_matches( struct table_view *tv, UINT row, const UINT *data, UINT *column ) { UINT i, r, x, ret = ERROR_FUNCTION_FAILED; @@ -3147,38 +3146,37 @@ static UINT msi_row_matches( MSITABLEVIEW *tv, UINT row, const UINT *data, UINT return ret; } -static UINT msi_table_find_row( MSITABLEVIEW *tv, MSIRECORD *rec, UINT *row, UINT *column ) +static UINT table_find_row( struct table_view *tv, MSIRECORD *rec, UINT *row, UINT *column ) { UINT i, r = ERROR_FUNCTION_FAILED, *data; - data = msi_record_to_row( tv, rec ); + data = record_to_row( tv, rec ); if( !data ) return r; for( i = 0; i < tv->table->row_count; i++ ) { - r = msi_row_matches( tv, i, data, column ); + r = row_matches( tv, i, data, column ); if( r == ERROR_SUCCESS ) { *row = i; break; } } - msi_free( data ); + free( data ); return r; } -typedef struct +struct transform_data { struct list entry; LPWSTR name; -} TRANSFORMDATA; +}; -static UINT msi_table_load_transform( MSIDATABASE *db, IStorage *stg, - string_table *st, TRANSFORMDATA *transform, - UINT bytes_per_strref, int err_cond ) +static UINT table_load_transform( MSIDATABASE *db, IStorage *stg, string_table *st, struct transform_data *transform, + UINT bytes_per_strref, int err_cond ) { BYTE *rawdata = NULL; - MSITABLEVIEW *tv = NULL; + struct table_view *tv = NULL; UINT r, n, sz, i, mask, num_cols, colcol = 0, rawsize = 0; MSIRECORD *rec = NULL; WCHAR coltable[32]; @@ -3275,7 +3273,7 @@ static UINT msi_table_load_transform( MSIDATABASE *db, IStorage *stg, break; } - rec = msi_get_transform_record( tv, st, stg, &rawdata[n], bytes_per_strref ); + rec = get_transform_record( tv, st, stg, &rawdata[n], bytes_per_strref ); if (rec) { WCHAR table[32]; @@ -3309,7 +3307,7 @@ static UINT msi_table_load_transform( MSIDATABASE *db, IStorage *stg, if (TRACE_ON(msidb)) dump_record( rec ); if (tv->table) - r = msi_table_find_row( tv, rec, &row, NULL ); + r = table_find_row( tv, rec, &row, NULL ); else r = ERROR_FUNCTION_FAILED; if (r == ERROR_SUCCESS) @@ -3344,9 +3342,8 @@ static UINT msi_table_load_transform( MSIDATABASE *db, IStorage *stg, WARN("failed to insert row %u\n", r); } - if (!(err_cond & MSITRANSFORM_ERROR_VIEWTRANSFORM) && - !wcscmp( name, L"_Columns" )) - msi_update_table_columns( db, table ); + if (!(err_cond & MSITRANSFORM_ERROR_VIEWTRANSFORM) && !wcscmp( name, L"_Columns" )) + update_table_columns( db, table ); msiobj_release( &rec->hdr ); } @@ -3356,7 +3353,7 @@ static UINT msi_table_load_transform( MSIDATABASE *db, IStorage *stg, err: /* no need to free the table, it's associated with the database */ - msi_free( rawdata ); + free( rawdata ); if( tv ) tv->view.ops->delete( &tv->view ); @@ -3372,8 +3369,8 @@ UINT msi_table_apply_transform( MSIDATABASE *db, IStorage *stg, int err_cond ) { struct list transforms; IEnumSTATSTG *stgenum = NULL; - TRANSFORMDATA *transform; - TRANSFORMDATA *tables = NULL, *columns = NULL; + struct transform_data *transform; + struct transform_data *tables = NULL, *columns = NULL; HRESULT hr; STATSTG stat; string_table *strings; @@ -3396,7 +3393,7 @@ UINT msi_table_apply_transform( MSIDATABASE *db, IStorage *stg, int err_cond ) while ( TRUE ) { - MSITABLEVIEW *tv = NULL; + struct table_view *tv = NULL; WCHAR name[0x40]; ULONG count = 0; @@ -3413,13 +3410,13 @@ UINT msi_table_apply_transform( MSIDATABASE *db, IStorage *stg, int err_cond ) !wcscmp( name+1, L"_StringData" ) ) continue; - transform = msi_alloc_zero( sizeof(TRANSFORMDATA) ); + transform = calloc( 1, sizeof(*transform) ); if ( !transform ) break; list_add_tail( &transforms, &transform->entry ); - transform->name = strdupW( name + 1 ); + transform->name = wcsdup( name + 1 ); if ( !wcscmp( transform->name, L"_Tables" ) ) tables = transform; @@ -3480,11 +3477,11 @@ UINT msi_table_apply_transform( MSIDATABASE *db, IStorage *stg, int err_cond ) * Apply _Tables and _Columns transforms first so that * the table metadata is correct, and empty tables exist. */ - ret = msi_table_load_transform( db, stg, strings, tables, bytes_per_strref, err_cond ); + ret = table_load_transform( db, stg, strings, tables, bytes_per_strref, err_cond ); if (ret != ERROR_SUCCESS && ret != ERROR_INVALID_TABLE) goto end; - ret = msi_table_load_transform( db, stg, strings, columns, bytes_per_strref, err_cond ); + ret = table_load_transform( db, stg, strings, columns, bytes_per_strref, err_cond ); if (ret != ERROR_SUCCESS && ret != ERROR_INVALID_TABLE) goto end; @@ -3492,18 +3489,18 @@ UINT msi_table_apply_transform( MSIDATABASE *db, IStorage *stg, int err_cond ) while ( !list_empty( &transforms ) ) { - transform = LIST_ENTRY( list_head( &transforms ), TRANSFORMDATA, entry ); + transform = LIST_ENTRY( list_head( &transforms ), struct transform_data, entry ); if ( wcscmp( transform->name, L"_Columns" ) && wcscmp( transform->name, L"_Tables" ) && ret == ERROR_SUCCESS ) { - ret = msi_table_load_transform( db, stg, strings, transform, bytes_per_strref, err_cond ); + ret = table_load_transform( db, stg, strings, transform, bytes_per_strref, err_cond ); } list_remove( &transform->entry ); - msi_free( transform->name ); - msi_free( transform ); + free( transform->name ); + free( transform ); } if ( ret == ERROR_SUCCESS ) @@ -3519,7 +3516,7 @@ UINT msi_table_apply_transform( MSIDATABASE *db, IStorage *stg, int err_cond ) msi_destroy_stringtable( strings ); if (transform_view) { - struct tagMSITABLE *table = ((MSITABLEVIEW*)transform_view)->table; + struct tagMSITABLE *table = ((struct table_view *)transform_view)->table; if (ret != ERROR_SUCCESS) transform_view->ops->release( transform_view ); diff --git a/dll/win32/msi/tokenize.c b/dll/win32/msi/tokenize.c index 3b9f98c6f1741..22a905d0544b3 100644 --- a/dll/win32/msi/tokenize.c +++ b/dll/win32/msi/tokenize.c @@ -29,8 +29,8 @@ ** All the keywords of the SQL language are stored as in a hash ** table composed of instances of the following structure. */ -typedef struct Keyword Keyword; -struct Keyword { +struct keyword +{ const WCHAR *name; /* The keyword name */ unsigned int len; int tokenType; /* The token value for this keyword */ @@ -43,7 +43,7 @@ struct Keyword { ** They MUST be in alphabetical order */ #define X(str) str, ARRAY_SIZE(str) - 1 -static const Keyword aKeywordTable[] = { +static const struct keyword aKeywordTable[] = { { X(L"ADD"), TK_ADD }, { X(L"ALTER"), TK_ALTER }, { X(L"AND"), TK_AND }, @@ -88,7 +88,7 @@ static const Keyword aKeywordTable[] = { ** Comparison function for binary search. */ static int __cdecl compKeyword(const void *m1, const void *m2){ - const Keyword *k1 = m1, *k2 = m2; + const struct keyword *k1 = m1, *k2 = m2; int ret, len = min( k1->len, k2->len ); if ((ret = wcsnicmp( k1->name, k2->name, len ))) return ret; @@ -103,7 +103,7 @@ static int __cdecl compKeyword(const void *m1, const void *m2){ ** returned. If the input is not a keyword, TK_ID is returned. */ static int sqliteKeywordCode(const WCHAR *z, int n){ - Keyword key, *r; + struct keyword key, *r; if( n>MAX_TOKEN_LEN ) return TK_ID; @@ -111,7 +111,7 @@ static int sqliteKeywordCode(const WCHAR *z, int n){ key.tokenType = 0; key.name = z; key.len = n; - r = bsearch( &key, aKeywordTable, ARRAY_SIZE(aKeywordTable), sizeof(Keyword), compKeyword ); + r = bsearch( &key, aKeywordTable, ARRAY_SIZE(aKeywordTable), sizeof(struct keyword), compKeyword ); if( r ) return r->tokenType; return TK_ID; diff --git a/dll/win32/msi/update.c b/dll/win32/msi/update.c index 4aa03443f0ca5..865455b154635 100644 --- a/dll/win32/msi/update.c +++ b/dll/win32/msi/update.c @@ -38,17 +38,17 @@ WINE_DEFAULT_DEBUG_CHANNEL(msidb); /* below is the query interface to a table */ -typedef struct tagMSIUPDATEVIEW +struct update_view { MSIVIEW view; MSIDATABASE *db; MSIVIEW *wv; column_info *vals; -} MSIUPDATEVIEW; +}; static UINT UPDATE_fetch_int( struct tagMSIVIEW *view, UINT row, UINT col, UINT *val ) { - MSIUPDATEVIEW *uv = (MSIUPDATEVIEW*)view; + struct update_view *uv = (struct update_view *)view; TRACE("%p %d %d %p\n", uv, row, col, val ); @@ -57,7 +57,7 @@ static UINT UPDATE_fetch_int( struct tagMSIVIEW *view, UINT row, UINT col, UINT static UINT UPDATE_execute( struct tagMSIVIEW *view, MSIRECORD *record ) { - MSIUPDATEVIEW *uv = (MSIUPDATEVIEW*)view; + struct update_view *uv = (struct update_view *)view; UINT i, r, col_count = 0, row_count = 0; MSIRECORD *values = NULL; MSIRECORD *where = NULL; @@ -128,7 +128,7 @@ static UINT UPDATE_execute( struct tagMSIVIEW *view, MSIRECORD *record ) static UINT UPDATE_close( struct tagMSIVIEW *view ) { - MSIUPDATEVIEW *uv = (MSIUPDATEVIEW*)view; + struct update_view *uv = (struct update_view *)view; MSIVIEW *wv; TRACE("%p\n", uv); @@ -142,7 +142,7 @@ static UINT UPDATE_close( struct tagMSIVIEW *view ) static UINT UPDATE_get_dimensions( struct tagMSIVIEW *view, UINT *rows, UINT *cols ) { - MSIUPDATEVIEW *uv = (MSIUPDATEVIEW*)view; + struct update_view *uv = (struct update_view *)view; MSIVIEW *wv; TRACE("%p %p %p\n", uv, rows, cols ); @@ -157,7 +157,7 @@ static UINT UPDATE_get_dimensions( struct tagMSIVIEW *view, UINT *rows, UINT *co static UINT UPDATE_get_column_info( struct tagMSIVIEW *view, UINT n, LPCWSTR *name, UINT *type, BOOL *temporary, LPCWSTR *table_name ) { - MSIUPDATEVIEW *uv = (MSIUPDATEVIEW*)view; + struct update_view *uv = (struct update_view *)view; MSIVIEW *wv; TRACE("%p %d %p %p %p %p\n", uv, n, name, type, temporary, table_name ); @@ -172,7 +172,7 @@ static UINT UPDATE_get_column_info( struct tagMSIVIEW *view, UINT n, LPCWSTR *na static UINT UPDATE_modify( struct tagMSIVIEW *view, MSIMODIFY eModifyMode, MSIRECORD *rec, UINT row ) { - MSIUPDATEVIEW *uv = (MSIUPDATEVIEW*)view; + struct update_view *uv = (struct update_view *)view; TRACE("%p %d %p\n", uv, eModifyMode, rec ); @@ -181,7 +181,7 @@ static UINT UPDATE_modify( struct tagMSIVIEW *view, MSIMODIFY eModifyMode, static UINT UPDATE_delete( struct tagMSIVIEW *view ) { - MSIUPDATEVIEW *uv = (MSIUPDATEVIEW*)view; + struct update_view *uv = (struct update_view *)view; MSIVIEW *wv; TRACE("%p\n", uv ); @@ -190,7 +190,7 @@ static UINT UPDATE_delete( struct tagMSIVIEW *view ) if( wv ) wv->ops->delete( wv ); msiobj_release( &uv->db->hdr ); - msi_free( uv ); + free( uv ); return ERROR_SUCCESS; } @@ -220,7 +220,7 @@ static const MSIVIEWOPS update_ops = UINT UPDATE_CreateView( MSIDATABASE *db, MSIVIEW **view, LPWSTR table, column_info *columns, struct expr *expr ) { - MSIUPDATEVIEW *uv = NULL; + struct update_view *uv = NULL; UINT r; MSIVIEW *sv = NULL, *wv = NULL; @@ -242,7 +242,7 @@ UINT UPDATE_CreateView( MSIDATABASE *db, MSIVIEW **view, LPWSTR table, return r; } - uv = msi_alloc_zero( sizeof *uv ); + uv = calloc( 1, sizeof *uv ); if( !uv ) { wv->ops->delete( wv ); diff --git a/dll/win32/msi/upgrade.c b/dll/win32/msi/upgrade.c index c9744e518598e..a3b90a21b7634 100644 --- a/dll/win32/msi/upgrade.c +++ b/dll/win32/msi/upgrade.c @@ -87,13 +87,13 @@ static void append_productcode( MSIPACKAGE *package, const WCHAR *action_prop, c if (find_product( prop, product )) { TRACE( "related product property %s already contains %s\n", debugstr_w(action_prop), debugstr_w(product) ); - msi_free( prop ); + free( prop ); return; } if (prop) len += lstrlenW( prop ); len += lstrlenW( product ) + 2; - if (!(newprop = msi_alloc( len * sizeof(WCHAR) ))) return; + if (!(newprop = malloc( len * sizeof(WCHAR) ))) return; if (prop) { lstrcpyW( newprop, prop ); @@ -108,8 +108,8 @@ static void append_productcode( MSIPACKAGE *package, const WCHAR *action_prop, c TRACE( "related product property %s now %s\n", debugstr_w(action_prop), debugstr_w(newprop) ); - msi_free( prop ); - msi_free( newprop ); + free( prop ); + free( newprop ); } static UINT ITERATE_FindRelatedProducts(MSIRECORD *rec, LPVOID param) diff --git a/dll/win32/msi/where.c b/dll/win32/msi/where.c index 684d9d5fb983b..d2183d348d4ab 100644 --- a/dll/win32/msi/where.c +++ b/dll/win32/msi/where.c @@ -38,20 +38,20 @@ WINE_DEFAULT_DEBUG_CHANNEL(msidb); /* below is the query interface to a table */ -typedef struct tagMSIROWENTRY +struct row_entry { struct tagMSIWHEREVIEW *wv; /* used during sorting */ UINT values[1]; -} MSIROWENTRY; +}; -typedef struct tagJOINTABLE +struct join_table { - struct tagJOINTABLE *next; + struct join_table *next; MSIVIEW *view; UINT col_count; UINT row_count; UINT table_index; -} JOINTABLE; +}; typedef struct tagMSIORDERINFO { @@ -64,11 +64,11 @@ typedef struct tagMSIWHEREVIEW { MSIVIEW view; MSIDATABASE *db; - JOINTABLE *tables; + struct join_table *tables; UINT row_count; UINT col_count; UINT table_count; - MSIROWENTRY **reorder; + struct row_entry **reorder; UINT reorder_size; /* number of entries available in reorder */ struct expr *cond; UINT rec_index; @@ -90,9 +90,9 @@ static void free_reorder(MSIWHEREVIEW *wv) return; for (i = 0; i < wv->row_count; i++) - msi_free(wv->reorder[i]); + free(wv->reorder[i]); - msi_free( wv->reorder ); + free(wv->reorder); wv->reorder = NULL; wv->reorder_size = 0; wv->row_count = 0; @@ -100,7 +100,7 @@ static void free_reorder(MSIWHEREVIEW *wv) static UINT init_reorder(MSIWHEREVIEW *wv) { - MSIROWENTRY **new = msi_alloc_zero(sizeof(MSIROWENTRY *) * INITIAL_REORDER_SIZE); + struct row_entry **new = calloc(INITIAL_REORDER_SIZE, sizeof(*new)); if (!new) return ERROR_OUTOFMEMORY; @@ -124,14 +124,14 @@ static inline UINT find_row(MSIWHEREVIEW *wv, UINT row, UINT *(values[])) static UINT add_row(MSIWHEREVIEW *wv, UINT vals[]) { - MSIROWENTRY *new; + struct row_entry *new; if (wv->reorder_size <= wv->row_count) { - MSIROWENTRY **new_reorder; + struct row_entry **new_reorder; UINT newsize = wv->reorder_size * 2; - new_reorder = msi_realloc(wv->reorder, newsize * sizeof(*new_reorder)); + new_reorder = realloc(wv->reorder, newsize * sizeof(*new_reorder)); if (!new_reorder) return ERROR_OUTOFMEMORY; memset(new_reorder + wv->reorder_size, 0, (newsize - wv->reorder_size) * sizeof(*new_reorder)); @@ -140,7 +140,7 @@ static UINT add_row(MSIWHEREVIEW *wv, UINT vals[]) wv->reorder_size = newsize; } - new = msi_alloc(FIELD_OFFSET( MSIROWENTRY, values[wv->table_count] )); + new = malloc(offsetof(struct row_entry, values[wv->table_count])); if (!new) return ERROR_OUTOFMEMORY; @@ -153,9 +153,9 @@ static UINT add_row(MSIWHEREVIEW *wv, UINT vals[]) return ERROR_SUCCESS; } -static JOINTABLE *find_table(MSIWHEREVIEW *wv, UINT col, UINT *table_col) +static struct join_table *find_table(MSIWHEREVIEW *wv, UINT col, UINT *table_col) { - JOINTABLE *table = wv->tables; + struct join_table *table = wv->tables; if(col == 0 || col > wv->col_count) return NULL; @@ -174,7 +174,7 @@ static JOINTABLE *find_table(MSIWHEREVIEW *wv, UINT col, UINT *table_col) static UINT parse_column(MSIWHEREVIEW *wv, union ext_column *column, UINT *column_type) { - JOINTABLE *table = wv->tables; + struct join_table *table = wv->tables; UINT i, r; do @@ -216,7 +216,7 @@ static UINT parse_column(MSIWHEREVIEW *wv, union ext_column *column, static UINT WHERE_fetch_int( struct tagMSIVIEW *view, UINT row, UINT col, UINT *val ) { MSIWHEREVIEW *wv = (MSIWHEREVIEW*)view; - JOINTABLE *table; + struct join_table *table; UINT *rows; UINT r; @@ -239,7 +239,7 @@ static UINT WHERE_fetch_int( struct tagMSIVIEW *view, UINT row, UINT col, UINT * static UINT WHERE_fetch_stream( struct tagMSIVIEW *view, UINT row, UINT col, IStream **stm ) { MSIWHEREVIEW *wv = (MSIWHEREVIEW*)view; - JOINTABLE *table; + struct join_table *table; UINT *rows; UINT r; @@ -262,7 +262,7 @@ static UINT WHERE_fetch_stream( struct tagMSIVIEW *view, UINT row, UINT col, ISt static UINT WHERE_set_int(struct tagMSIVIEW *view, UINT row, UINT col, int val) { MSIWHEREVIEW *wv = (MSIWHEREVIEW*)view; - JOINTABLE *table; + struct join_table *table; UINT *rows; UINT r; @@ -282,7 +282,7 @@ static UINT WHERE_set_int(struct tagMSIVIEW *view, UINT row, UINT col, int val) static UINT WHERE_set_string(struct tagMSIVIEW *view, UINT row, UINT col, const WCHAR *val, int len) { MSIWHEREVIEW *wv = (MSIWHEREVIEW*)view; - JOINTABLE *table; + struct join_table *table; UINT *rows; UINT r; @@ -302,7 +302,7 @@ static UINT WHERE_set_string(struct tagMSIVIEW *view, UINT row, UINT col, const static UINT WHERE_set_stream(MSIVIEW *view, UINT row, UINT col, IStream *stream) { MSIWHEREVIEW *wv = (MSIWHEREVIEW*)view; - JOINTABLE *table; + struct join_table *table; UINT *rows; UINT r; @@ -323,7 +323,7 @@ static UINT WHERE_set_row( struct tagMSIVIEW *view, UINT row, MSIRECORD *rec, UI { MSIWHEREVIEW *wv = (MSIWHEREVIEW*)view; UINT i, r, offset = 0; - JOINTABLE *table = wv->tables; + struct join_table *table = wv->tables; UINT *rows; UINT mask_copy = mask; @@ -493,7 +493,7 @@ static INT INT_evaluate_binary( MSIWHEREVIEW *wv, const UINT rows[], static inline UINT expr_fetch_value(const union ext_column *expr, const UINT rows[], UINT *val) { - JOINTABLE *table = expr->parsed.table; + struct join_table *table = expr->parsed.table; if( rows[table->table_index] == INVALID_ROW_INDEX ) { @@ -647,7 +647,7 @@ static UINT WHERE_evaluate( MSIWHEREVIEW *wv, const UINT rows[], return ERROR_SUCCESS; } -static UINT check_condition( MSIWHEREVIEW *wv, MSIRECORD *record, JOINTABLE **tables, +static UINT check_condition( MSIWHEREVIEW *wv, MSIRECORD *record, struct join_table **tables, UINT table_rows[] ) { UINT r = ERROR_FUNCTION_FAILED; @@ -684,8 +684,8 @@ static UINT check_condition( MSIWHEREVIEW *wv, MSIRECORD *record, JOINTABLE **ta static int __cdecl compare_entry( const void *left, const void *right ) { - const MSIROWENTRY *le = *(const MSIROWENTRY**)left; - const MSIROWENTRY *re = *(const MSIROWENTRY**)right; + const struct row_entry *le = *(const struct row_entry **)left; + const struct row_entry *re = *(const struct row_entry **)right; const MSIWHEREVIEW *wv = le->wv; MSIORDERINFO *order = wv->order_info; UINT i, j, r, l_val, r_val; @@ -729,7 +729,7 @@ static int __cdecl compare_entry( const void *left, const void *right ) return 0; } -static void add_to_array( JOINTABLE **array, JOINTABLE *elem ) +static void add_to_array( struct join_table **array, struct join_table *elem ) { while (*array && *array != elem) array++; @@ -737,7 +737,7 @@ static void add_to_array( JOINTABLE **array, JOINTABLE *elem ) *array = elem; } -static BOOL in_array( JOINTABLE **array, JOINTABLE *elem ) +static BOOL in_array( struct join_table **array, struct join_table *elem ) { while (*array && *array != elem) array++; @@ -748,8 +748,8 @@ static BOOL in_array( JOINTABLE **array, JOINTABLE *elem ) #define JOIN_TO_CONST_EXPR 0x10000 /* comparison to a table involved with a CONST_EXPR comaprison */ -static UINT reorder_check( const struct expr *expr, JOINTABLE **ordered_tables, - BOOL process_joins, JOINTABLE **lastused ) +static UINT reorder_check( const struct expr *expr, struct join_table **ordered_tables, + BOOL process_joins, struct join_table **lastused ) { UINT res = 0; @@ -787,12 +787,11 @@ static UINT reorder_check( const struct expr *expr, JOINTABLE **ordered_tables, } /* reorders the tablelist in a way to evaluate the condition as fast as possible */ -static JOINTABLE **ordertables( MSIWHEREVIEW *wv ) +static struct join_table **ordertables( MSIWHEREVIEW *wv ) { - JOINTABLE *table; - JOINTABLE **tables; + struct join_table *table, **tables; - tables = msi_alloc_zero( (wv->table_count + 1) * sizeof(*tables) ); + tables = calloc(wv->table_count + 1, sizeof(*tables)); if (wv->cond) { @@ -815,9 +814,9 @@ static UINT WHERE_execute( struct tagMSIVIEW *view, MSIRECORD *record ) { MSIWHEREVIEW *wv = (MSIWHEREVIEW*)view; UINT r; - JOINTABLE *table = wv->tables; + struct join_table *table = wv->tables; UINT *rows; - JOINTABLE **ordered_tables; + struct join_table **ordered_tables; UINT i = 0; TRACE("%p %p\n", wv, record); @@ -848,7 +847,7 @@ static UINT WHERE_execute( struct tagMSIVIEW *view, MSIRECORD *record ) ordered_tables = ordertables( wv ); - rows = msi_alloc( wv->table_count * sizeof(*rows) ); + rows = malloc(wv->table_count * sizeof(*rows)); for (i = 0; i < wv->table_count; i++) rows[i] = INVALID_ROW_INDEX; @@ -857,20 +856,20 @@ static UINT WHERE_execute( struct tagMSIVIEW *view, MSIRECORD *record ) if (wv->order_info) wv->order_info->error = ERROR_SUCCESS; - qsort(wv->reorder, wv->row_count, sizeof(MSIROWENTRY *), compare_entry); + qsort(wv->reorder, wv->row_count, sizeof(struct row_entry *), compare_entry); if (wv->order_info) r = wv->order_info->error; - msi_free( rows ); - msi_free( ordered_tables ); + free(rows); + free(ordered_tables); return r; } static UINT WHERE_close( struct tagMSIVIEW *view ) { MSIWHEREVIEW *wv = (MSIWHEREVIEW*)view; - JOINTABLE *table = wv->tables; + struct join_table *table = wv->tables; TRACE("%p\n", wv ); @@ -910,7 +909,7 @@ static UINT WHERE_get_column_info( struct tagMSIVIEW *view, UINT n, LPCWSTR *nam UINT *type, BOOL *temporary, LPCWSTR *table_name ) { MSIWHEREVIEW *wv = (MSIWHEREVIEW*)view; - JOINTABLE *table; + struct join_table *table; TRACE("%p %d %p %p %p %p\n", wv, n, name, type, temporary, table_name ); @@ -980,7 +979,7 @@ static UINT WHERE_modify( struct tagMSIVIEW *view, MSIMODIFY eModifyMode, MSIRECORD *rec, UINT row ) { MSIWHEREVIEW *wv = (MSIWHEREVIEW*)view; - JOINTABLE *table = wv->tables; + struct join_table *table = wv->tables; UINT r; TRACE("%p %d %p\n", wv, eModifyMode, rec); @@ -1035,18 +1034,18 @@ static UINT WHERE_modify( struct tagMSIVIEW *view, MSIMODIFY eModifyMode, static UINT WHERE_delete( struct tagMSIVIEW *view ) { MSIWHEREVIEW *wv = (MSIWHEREVIEW*)view; - JOINTABLE *table = wv->tables; + struct join_table *table = wv->tables; TRACE("%p\n", wv ); while(table) { - JOINTABLE *next; + struct join_table *next; table->view->ops->delete(table->view); table->view = NULL; next = table->next; - msi_free(table); + free(table); table = next; } wv->tables = NULL; @@ -1054,11 +1053,11 @@ static UINT WHERE_delete( struct tagMSIVIEW *view ) free_reorder(wv); - msi_free(wv->order_info); + free(wv->order_info); wv->order_info = NULL; msiobj_release( &wv->db->hdr ); - msi_free( wv ); + free(wv); return ERROR_SUCCESS; } @@ -1066,7 +1065,7 @@ static UINT WHERE_delete( struct tagMSIVIEW *view ) static UINT WHERE_sort(struct tagMSIVIEW *view, column_info *columns) { MSIWHEREVIEW *wv = (MSIWHEREVIEW *)view; - JOINTABLE *table = wv->tables; + struct join_table *table = wv->tables; column_info *column = columns; MSIORDERINFO *orderinfo; UINT r, count = 0; @@ -1086,7 +1085,7 @@ static UINT WHERE_sort(struct tagMSIVIEW *view, column_info *columns) if (count == 0) return ERROR_SUCCESS; - orderinfo = msi_alloc(FIELD_OFFSET(MSIORDERINFO, columns[count])); + orderinfo = malloc(offsetof(MSIORDERINFO, columns[count])); if (!orderinfo) return ERROR_OUTOFMEMORY; @@ -1108,7 +1107,7 @@ static UINT WHERE_sort(struct tagMSIVIEW *view, column_info *columns) return ERROR_SUCCESS; error: - msi_free(orderinfo); + free(orderinfo); return r; } @@ -1233,7 +1232,7 @@ UINT WHERE_CreateView( MSIDATABASE *db, MSIVIEW **view, LPWSTR tables, TRACE("(%s)\n", debugstr_w(tables) ); - wv = msi_alloc_zero( sizeof *wv ); + wv = calloc(1, sizeof *wv); if( !wv ) return ERROR_FUNCTION_FAILED; @@ -1245,12 +1244,12 @@ UINT WHERE_CreateView( MSIDATABASE *db, MSIVIEW **view, LPWSTR tables, while (*tables) { - JOINTABLE *table; + struct join_table *table; if ((ptr = wcschr(tables, ' '))) *ptr = '\0'; - table = msi_alloc(sizeof(JOINTABLE)); + table = malloc(sizeof(*table)); if (!table) { r = ERROR_OUTOFMEMORY; @@ -1261,7 +1260,7 @@ UINT WHERE_CreateView( MSIDATABASE *db, MSIVIEW **view, LPWSTR tables, if (r != ERROR_SUCCESS) { WARN("can't create table: %s\n", debugstr_w(tables)); - msi_free(table); + free(table); r = ERROR_BAD_QUERY_SYNTAX; goto end; } @@ -1272,7 +1271,7 @@ UINT WHERE_CreateView( MSIDATABASE *db, MSIVIEW **view, LPWSTR tables, { ERR("can't get table dimensions\n"); table->view->ops->delete(table->view); - msi_free(table); + free(table); goto end; } diff --git a/media/doc/WINESYNC.txt b/media/doc/WINESYNC.txt index e6797f0cc6727..dec52405662b0 100644 --- a/media/doc/WINESYNC.txt +++ b/media/doc/WINESYNC.txt @@ -115,7 +115,7 @@ dll/win32/msg711.acm # Synced to WineStaging-4.18 dll/win32/msgsm32.acm # Synced to WineStaging-4.0 dll/win32/mshtml # Synced to WineStaging-1.7.55 dll/win32/mshtml.tlb # Synced to WineStaging-1.7.55 -dll/win32/msi # Synced to WineStaging-7.3 (+ dialog.c synced to bbce5d014db7f023b133d6d09e6846e027586f7d) +dll/win32/msi # Synced to Wine-9.8 dll/win32/msimg32 # Synced to WineStaging-3.3 dll/win32/msimtf # Synced to WineStaging-4.18 dll/win32/msisip # Synced to WineStaging-4.18 @@ -258,7 +258,7 @@ base/applications/wordpad # Synced to WineStaging-1.9.16 base/applications/write # Synced to WineStaging-3.3 base/services/rpcss # Synced to WineStaging-3.3 base/system/expand # Synced to WineStaging-3.3 -base/system/msiexec # Synced to WineStaging-3.3 +base/system/msiexec # Synced to Wine-9.8 modules/rosapps/applications/winfile # Autosync In addition the following libs, dlls and source files are mostly based on code ported diff --git a/modules/rostests/winetests/msi/action.c b/modules/rostests/winetests/msi/action.c index 0844ec56d9725..9ce9aac715259 100644 --- a/modules/rostests/winetests/msi/action.c +++ b/modules/rostests/winetests/msi/action.c @@ -29,7 +29,6 @@ #include #include #include -#include #include #include #include @@ -43,23 +42,6 @@ #include "utils.h" #include "typelib.h" -static UINT (WINAPI *pMsiQueryComponentStateA) - (LPCSTR, LPCSTR, MSIINSTALLCONTEXT, LPCSTR, INSTALLSTATE *); -static UINT (WINAPI *pMsiSourceListEnumSourcesA) - (LPCSTR, LPCSTR, MSIINSTALLCONTEXT, DWORD, DWORD, LPSTR, LPDWORD); -static UINT (WINAPI *pMsiSourceListGetInfoA) - (LPCSTR, LPCSTR, MSIINSTALLCONTEXT, DWORD, LPCSTR, LPSTR, LPDWORD); -static INSTALLSTATE (WINAPI *pMsiGetComponentPathExA) - (LPCSTR, LPCSTR, LPCSTR, MSIINSTALLCONTEXT, LPSTR, LPDWORD); -static UINT (WINAPI *pMsiQueryFeatureStateExA) - (LPCSTR, LPCSTR, MSIINSTALLCONTEXT, LPCSTR, INSTALLSTATE *); - -static LONG (WINAPI *pRegDeleteKeyExA)(HKEY, LPCSTR, REGSAM, DWORD); -static BOOL (WINAPI *pIsWow64Process)(HANDLE, PBOOL); - -static BOOL (WINAPI *pSRRemoveRestorePoint)(DWORD); -static BOOL (WINAPI *pSRSetRestorePointA)(RESTOREPOINTINFOA *, STATEMGRSTATUS *); - static BOOL is_wow64; static const BOOL is_64bit = sizeof(void *) > sizeof(int); @@ -2375,33 +2357,6 @@ static const msi_table rep_tables[] = /* make the max size large so there is only one cab file */ #define MEDIA_SIZE 0x7FFFFFFF -static void init_functionpointers(void) -{ - HMODULE hmsi = GetModuleHandleA("msi.dll"); - HMODULE hadvapi32 = GetModuleHandleA("advapi32.dll"); - HMODULE hkernel32 = GetModuleHandleA("kernel32.dll"); - HMODULE hsrclient = LoadLibraryA("srclient.dll"); - -#define GET_PROC(mod, func) \ - p ## func = (void*)GetProcAddress(mod, #func); \ - if(!p ## func) \ - trace("GetProcAddress(%s) failed\n", #func); - - GET_PROC(hmsi, MsiQueryComponentStateA); - GET_PROC(hmsi, MsiSourceListEnumSourcesA); - GET_PROC(hmsi, MsiSourceListGetInfoA); - GET_PROC(hmsi, MsiGetComponentPathExA); - GET_PROC(hmsi, MsiQueryFeatureStateExA); - - GET_PROC(hadvapi32, RegDeleteKeyExA) - GET_PROC(hkernel32, IsWow64Process) - - GET_PROC(hsrclient, SRRemoveRestorePoint); - GET_PROC(hsrclient, SRSetRestorePointA); - -#undef GET_PROC -} - static char *get_user_sid(void) { HANDLE token; @@ -2457,34 +2412,6 @@ static void delete_test_files(void) RemoveDirectoryA("msitest"); } -static BOOL notify_system_change(DWORD event_type, STATEMGRSTATUS *status) -{ - RESTOREPOINTINFOA spec; - - spec.dwEventType = event_type; - spec.dwRestorePtType = APPLICATION_INSTALL; - spec.llSequenceNumber = status->llSequenceNumber; - lstrcpyA(spec.szDescription, "msitest restore point"); - - return pSRSetRestorePointA(&spec, status); -} - -static void remove_restore_point(DWORD seq_number) -{ - DWORD res; - - res = pSRRemoveRestorePoint(seq_number); - if (res != ERROR_SUCCESS) - trace("Failed to remove the restore point : %#lx\n", res); -} - -static LONG delete_key( HKEY key, LPCSTR subkey, REGSAM access ) -{ - if (pRegDeleteKeyExA) - return pRegDeleteKeyExA( key, subkey, access, 0 ); - return RegDeleteKeyA( key, subkey ); -} - static void delete_pfmsitest_files(void) { SHFILEOPSTRUCTA shfl; @@ -2672,7 +2599,7 @@ static void test_register_product(void) static const CHAR userugkey[] = "Software\\Microsoft\\Installer\\UpgradeCodes" "\\51AAE0C44620A5E4788506E91F249BD2"; - if (is_process_limited()) + if (!is_process_elevated()) { skip("process is limited\n"); return; @@ -3055,7 +2982,7 @@ static void test_publish_product(void) BOOL old_installer = FALSE; REGSAM access = KEY_ALL_ACCESS; - if (is_process_limited()) + if (!is_process_elevated()) { skip("process is limited\n"); return; @@ -3118,9 +3045,9 @@ static void test_publish_product(void) if (!res) CHECK_DEL_REG_STR(patches, "AllPatches", ""); - delete_key(patches, "", access); + RegDeleteKeyExA(patches, "", access, 0); RegCloseKey(patches); - delete_key(hkey, "", access); + RegDeleteKeyExA(hkey, "", access, 0); RegCloseKey(hkey); currentuser: @@ -3197,9 +3124,9 @@ static void test_publish_product(void) if (!res) CHECK_DEL_REG_STR(patches, "AllPatches", ""); - delete_key(patches, "", access); + RegDeleteKeyExA(patches, "", access, 0); RegCloseKey(patches); - delete_key(hkey, "", access); + RegDeleteKeyExA(hkey, "", access, 0); RegCloseKey(hkey); machprod: @@ -3230,7 +3157,7 @@ static void test_publish_product(void) CHECK_DEL_REG_STR(net, "1", temp); - res = delete_key(net, "", access); + res = RegDeleteKeyExA(net, "", access, 0); ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %ld\n", res); RegCloseKey(net); @@ -3239,13 +3166,13 @@ static void test_publish_product(void) CHECK_DEL_REG_STR(media, "1", "DISK1;"); - res = delete_key(media, "", access); + res = RegDeleteKeyExA(media, "", access, 0); ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %ld\n", res); RegCloseKey(media); - res = delete_key(sourcelist, "", access); + res = RegDeleteKeyExA(sourcelist, "", access, 0); ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %ld\n", res); RegCloseKey(sourcelist); - res = delete_key(hkey, "", access); + res = RegDeleteKeyExA(hkey, "", access, 0); ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %ld\n", res); RegCloseKey(hkey); @@ -3254,7 +3181,7 @@ static void test_publish_product(void) CHECK_DEL_REG_STR(hkey, "84A88FD7F6998CE40A22FB59F6B9C2BB", ""); - res = delete_key(hkey, "", access); + res = RegDeleteKeyExA(hkey, "", access, 0); ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %ld\n", res); RegCloseKey(hkey); @@ -3286,7 +3213,7 @@ static void test_publish_features(void) CHAR keypath[MAX_PATH]; REGSAM access = KEY_ALL_ACCESS; - if (is_process_limited()) + if (!is_process_elevated()) { skip("process is limited\n"); return; @@ -3330,7 +3257,7 @@ static void test_publish_features(void) RegDeleteValueA(hkey, "feature"); RegDeleteValueA(hkey, "montecristo"); - delete_key(hkey, "", access); + RegDeleteKeyExA(hkey, "", access, 0); RegCloseKey(hkey); sprintf(keypath, udfeatpath, usersid); @@ -3342,10 +3269,10 @@ static void test_publish_features(void) RegDeleteValueA(hkey, "feature"); RegDeleteValueA(hkey, "montecristo"); - delete_key(hkey, "", access); + RegDeleteKeyExA(hkey, "", access, 0); RegCloseKey(hkey); sprintf(keypath, udpridpath, usersid); - delete_key(HKEY_LOCAL_MACHINE, keypath, access); + RegDeleteKeyExA(HKEY_LOCAL_MACHINE, keypath, access, 0); /* PublishFeatures, machine */ r = MsiInstallProductA(msifile, "PUBLISH_FEATURES=1 ALLUSERS=1"); @@ -3366,7 +3293,7 @@ static void test_publish_features(void) RegDeleteValueA(hkey, "feature"); RegDeleteValueA(hkey, "montecristo"); - delete_key(hkey, "", access); + RegDeleteKeyExA(hkey, "", access, 0); RegCloseKey(hkey); sprintf(keypath, udfeatpath, "S-1-5-18"); @@ -3378,10 +3305,10 @@ static void test_publish_features(void) RegDeleteValueA(hkey, "feature"); RegDeleteValueA(hkey, "montecristo"); - delete_key(hkey, "", access); + RegDeleteKeyExA(hkey, "", access, 0); RegCloseKey(hkey); sprintf(keypath, udpridpath, "S-1-5-18"); - delete_key(HKEY_LOCAL_MACHINE, keypath, access); + RegDeleteKeyExA(HKEY_LOCAL_MACHINE, keypath, access, 0); error: DeleteFileA(msifile); @@ -3470,7 +3397,7 @@ static void test_register_user(void) "Software\\Microsoft\\Windows\\CurrentVersion\\Installer\\" "UserData\\%s\\Products\\84A88FD7F6998CE40A22FB59F6B9C2BB"; - if (is_process_limited()) + if (!is_process_elevated()) { skip("process is limited\n"); return; @@ -3513,10 +3440,10 @@ static void test_register_user(void) RegDeleteValueA(props, "ProductID"); RegDeleteValueA(props, "RegCompany"); RegDeleteValueA(props, "RegOwner"); - delete_key(props, "", access); + RegDeleteKeyExA(props, "", access, 0); RegCloseKey(props); sprintf(keypath, keypridfmt, usersid); - delete_key(HKEY_LOCAL_MACHINE, keypath, access); + RegDeleteKeyExA(HKEY_LOCAL_MACHINE, keypath, access, 0); /* RegisterUser, machine */ r = MsiInstallProductA(msifile, "REGISTER_USER=1 ALLUSERS=1"); @@ -3535,10 +3462,10 @@ static void test_register_user(void) RegDeleteValueA(props, "ProductID"); RegDeleteValueA(props, "RegCompany"); RegDeleteValueA(props, "RegOwner"); - delete_key(props, "", access); + RegDeleteKeyExA(props, "", access, 0); RegCloseKey(props); sprintf(keypath, keypridfmt, "S-1-5-18"); - delete_key(HKEY_LOCAL_MACHINE, keypath, access); + RegDeleteKeyExA(HKEY_LOCAL_MACHINE, keypath, access, 0); error: free(company); @@ -3566,7 +3493,7 @@ static void test_process_components(void) CHAR program_files_maximus[MAX_PATH]; REGSAM access = KEY_ALL_ACCESS; - if (is_process_limited()) + if (!is_process_elevated()) { skip("process is limited\n"); return; @@ -3615,7 +3542,7 @@ static void test_process_components(void) ok(res == ERROR_FILE_NOT_FOUND, "Expected ERROR_FILE_NOT_FOUND, got %ld\n", res); RegDeleteValueA(comp, "84A88FD7F6998CE40A22FB59F6B9C2BB"); - delete_key(comp, "", access); + RegDeleteKeyExA(comp, "", access, 0); RegCloseKey(comp); sprintf(keypath, keyfmt, usersid, "241C3DA58FECD0945B9687D408766058"); @@ -3633,7 +3560,7 @@ static void test_process_components(void) ok(res == ERROR_FILE_NOT_FOUND, "Expected ERROR_FILE_NOT_FOUND, got %ld\n", res); RegDeleteValueA(comp, "84A88FD7F6998CE40A22FB59F6B9C2BB"); - delete_key(comp, "", access); + RegDeleteKeyExA(comp, "", access, 0); RegCloseKey(comp); /* ProcessComponents, machine */ @@ -3657,7 +3584,7 @@ static void test_process_components(void) ok(res == ERROR_FILE_NOT_FOUND, "Expected ERROR_FILE_NOT_FOUND, got %ld\n", res); RegDeleteValueA(comp, "84A88FD7F6998CE40A22FB59F6B9C2BB"); - delete_key(comp, "", access); + RegDeleteKeyExA(comp, "", access, 0); RegCloseKey(comp); sprintf(keypath, keyfmt, "S-1-5-18", "241C3DA58FECD0945B9687D408766058"); @@ -3675,7 +3602,7 @@ static void test_process_components(void) ok(res == ERROR_FILE_NOT_FOUND, "Expected ERROR_FILE_NOT_FOUND, got %ld\n", res); RegDeleteValueA(comp, "84A88FD7F6998CE40A22FB59F6B9C2BB"); - delete_key(comp, "", access); + RegDeleteKeyExA(comp, "", access, 0); RegCloseKey(comp); error: @@ -3693,16 +3620,12 @@ static void test_publish(void) LONG res; HKEY uninstall, prodkey, uninstall_32node = NULL; INSTALLSTATE state; - char date[MAX_PATH], temp[MAX_PATH], prodcode[] = "{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}"; + char date[MAX_PATH], date2[MAX_PATH], temp[MAX_PATH], buf[MAX_PATH]; + const char prodcode[] = "{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}"; REGSAM access = KEY_ALL_ACCESS; - DWORD error; + DWORD error, type, size; - if (!pMsiQueryFeatureStateExA) - { - win_skip("MsiQueryFeatureStateExA is not available\n"); - return; - } - if (is_process_limited()) + if (!is_process_elevated()) { skip("process is limited\n"); return; @@ -3738,7 +3661,7 @@ static void test_publish(void) state = 0xdead; SetLastError(0xdeadbeef); - r = pMsiQueryFeatureStateExA(prodcode, NULL, MSIINSTALLCONTEXT_MACHINE, "feature", &state); + r = MsiQueryFeatureStateExA(prodcode, NULL, MSIINSTALLCONTEXT_MACHINE, "feature", &state); error = GetLastError(); ok(r == ERROR_UNKNOWN_PRODUCT, "got %u\n", r); ok(state == 0xdead, "got %d\n", state); @@ -3746,7 +3669,7 @@ static void test_publish(void) state = 0xdead; SetLastError(0xdeadbeef); - r = pMsiQueryFeatureStateExA(prodcode, NULL, MSIINSTALLCONTEXT_USERMANAGED, "feature", &state); + r = MsiQueryFeatureStateExA(prodcode, NULL, MSIINSTALLCONTEXT_USERMANAGED, "feature", &state); error = GetLastError(); ok(r == ERROR_UNKNOWN_PRODUCT, "got %u\n", r); ok(state == 0xdead, "got %d\n", state); @@ -3754,7 +3677,7 @@ static void test_publish(void) state = 0xdead; SetLastError(0xdeadbeef); - r = pMsiQueryFeatureStateExA(prodcode, NULL, MSIINSTALLCONTEXT_USERUNMANAGED, "feature", &state); + r = MsiQueryFeatureStateExA(prodcode, NULL, MSIINSTALLCONTEXT_USERUNMANAGED, "feature", &state); error = GetLastError(); ok(r == ERROR_UNKNOWN_PRODUCT, "got %u\n", r); ok(state == 0xdead, "got %d\n", state); @@ -3766,7 +3689,7 @@ static void test_publish(void) state = MsiQueryFeatureStateA(prodcode, "montecristo"); ok(state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state); - r = pMsiQueryComponentStateA(prodcode, NULL, MSIINSTALLCONTEXT_USERUNMANAGED, + r = MsiQueryComponentStateA(prodcode, NULL, MSIINSTALLCONTEXT_USERUNMANAGED, "{DF2CBABC-3BCC-47E5-A998-448D1C0C895B}", &state); ok(r == ERROR_UNKNOWN_PRODUCT, "Expected ERROR_UNKNOWN_PRODUCT, got %d\n", r); ok(state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state); @@ -3794,7 +3717,7 @@ static void test_publish(void) state = MsiQueryFeatureStateA(prodcode, "montecristo"); ok(state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state); - r = pMsiQueryComponentStateA(prodcode, NULL, MSIINSTALLCONTEXT_USERUNMANAGED, + r = MsiQueryComponentStateA(prodcode, NULL, MSIINSTALLCONTEXT_USERUNMANAGED, "{DF2CBABC-3BCC-47E5-A998-448D1C0C895B}", &state); ok(r == ERROR_UNKNOWN_PRODUCT, "Expected ERROR_UNKNOWN_PRODUCT, got %d\n", r); ok(state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state); @@ -3817,7 +3740,7 @@ static void test_publish(void) state = MsiQueryFeatureStateA(prodcode, "montecristo"); ok(state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state); - r = pMsiQueryComponentStateA(prodcode, NULL, MSIINSTALLCONTEXT_USERUNMANAGED, + r = MsiQueryComponentStateA(prodcode, NULL, MSIINSTALLCONTEXT_USERUNMANAGED, "{DF2CBABC-3BCC-47E5-A998-448D1C0C895B}", &state); ok(r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r); ok(state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state); @@ -3876,7 +3799,7 @@ static void test_publish(void) state = MsiQueryFeatureStateA(prodcode, "montecristo"); ok(state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state); - r = pMsiQueryComponentStateA(prodcode, NULL, MSIINSTALLCONTEXT_USERUNMANAGED, + r = MsiQueryComponentStateA(prodcode, NULL, MSIINSTALLCONTEXT_USERUNMANAGED, "{DF2CBABC-3BCC-47E5-A998-448D1C0C895B}", &state); ok(r == ERROR_UNKNOWN_PRODUCT, "Expected ERROR_UNKNOWN_PRODUCT, got %d\n", r); ok(state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state); @@ -3898,7 +3821,7 @@ static void test_publish(void) state = 0xdead; SetLastError(0xdeadbeef); - r = pMsiQueryFeatureStateExA(prodcode, NULL, MSIINSTALLCONTEXT_MACHINE, "feature", &state); + r = MsiQueryFeatureStateExA(prodcode, NULL, MSIINSTALLCONTEXT_MACHINE, "feature", &state); error = GetLastError(); ok(r == ERROR_UNKNOWN_PRODUCT, "got %u\n", r); ok(state == 0xdead, "got %d\n", state); @@ -3906,7 +3829,7 @@ static void test_publish(void) state = 0xdead; SetLastError(0xdeadbeef); - r = pMsiQueryFeatureStateExA(prodcode, NULL, MSIINSTALLCONTEXT_USERMANAGED, "feature", &state); + r = MsiQueryFeatureStateExA(prodcode, NULL, MSIINSTALLCONTEXT_USERMANAGED, "feature", &state); error = GetLastError(); ok(r == ERROR_UNKNOWN_PRODUCT, "got %u\n", r); ok(state == 0xdead, "got %d\n", state); @@ -3914,7 +3837,7 @@ static void test_publish(void) state = 0xdead; SetLastError(0xdeadbeef); - r = pMsiQueryFeatureStateExA(prodcode, NULL, MSIINSTALLCONTEXT_USERUNMANAGED, "feature", &state); + r = MsiQueryFeatureStateExA(prodcode, NULL, MSIINSTALLCONTEXT_USERUNMANAGED, "feature", &state); error = GetLastError(); ok(r == ERROR_SUCCESS, "got %u\n", r); ok(state == INSTALLSTATE_LOCAL, "got %d\n", state); @@ -3923,7 +3846,7 @@ static void test_publish(void) state = MsiQueryFeatureStateA(prodcode, "montecristo"); ok(state == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", state); - r = pMsiQueryComponentStateA(prodcode, NULL, MSIINSTALLCONTEXT_USERUNMANAGED, + r = MsiQueryComponentStateA(prodcode, NULL, MSIINSTALLCONTEXT_USERUNMANAGED, "{DF2CBABC-3BCC-47E5-A998-448D1C0C895B}", &state); ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r); ok(state == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", state); @@ -3981,7 +3904,7 @@ static void test_publish(void) state = MsiQueryFeatureStateA(prodcode, "montecristo"); ok(state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state); - r = pMsiQueryComponentStateA(prodcode, NULL, MSIINSTALLCONTEXT_USERUNMANAGED, + r = MsiQueryComponentStateA(prodcode, NULL, MSIINSTALLCONTEXT_USERUNMANAGED, "{DF2CBABC-3BCC-47E5-A998-448D1C0C895B}", &state); ok(r == ERROR_UNKNOWN_PRODUCT, "Expected ERROR_UNKNOWN_PRODUCT, got %d\n", r); ok(state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state); @@ -4004,7 +3927,7 @@ static void test_publish(void) state = MsiQueryFeatureStateA(prodcode, "montecristo"); ok(state == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", state); - r = pMsiQueryComponentStateA(prodcode, NULL, MSIINSTALLCONTEXT_USERUNMANAGED, + r = MsiQueryComponentStateA(prodcode, NULL, MSIINSTALLCONTEXT_USERUNMANAGED, "{DF2CBABC-3BCC-47E5-A998-448D1C0C895B}", &state); ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r); ok(state == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", state); @@ -4062,7 +3985,7 @@ static void test_publish(void) state = MsiQueryFeatureStateA(prodcode, "montecristo"); ok(state == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", state); - r = pMsiQueryComponentStateA(prodcode, NULL, MSIINSTALLCONTEXT_USERUNMANAGED, + r = MsiQueryComponentStateA(prodcode, NULL, MSIINSTALLCONTEXT_USERUNMANAGED, "{DF2CBABC-3BCC-47E5-A998-448D1C0C895B}", &state); ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r); ok(state == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", state); @@ -4120,7 +4043,7 @@ static void test_publish(void) state = MsiQueryFeatureStateA(prodcode, "montecristo"); ok(state == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", state); - r = pMsiQueryComponentStateA(prodcode, NULL, MSIINSTALLCONTEXT_USERUNMANAGED, + r = MsiQueryComponentStateA(prodcode, NULL, MSIINSTALLCONTEXT_USERUNMANAGED, "{DF2CBABC-3BCC-47E5-A998-448D1C0C895B}", &state); ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r); ok(state == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", state); @@ -4178,7 +4101,7 @@ static void test_publish(void) state = MsiQueryFeatureStateA(prodcode, "montecristo"); ok(state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state); - r = pMsiQueryComponentStateA(prodcode, NULL, MSIINSTALLCONTEXT_USERUNMANAGED, + r = MsiQueryComponentStateA(prodcode, NULL, MSIINSTALLCONTEXT_USERUNMANAGED, "{DF2CBABC-3BCC-47E5-A998-448D1C0C895B}", &state); ok(r == ERROR_UNKNOWN_PRODUCT, "Expected ERROR_UNKNOWN_PRODUCT, got %d\n", r); ok(state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state); @@ -4201,7 +4124,7 @@ static void test_publish(void) state = MsiQueryFeatureStateA(prodcode, "montecristo"); ok(state == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", state); - r = pMsiQueryComponentStateA(prodcode, NULL, MSIINSTALLCONTEXT_USERUNMANAGED, + r = MsiQueryComponentStateA(prodcode, NULL, MSIINSTALLCONTEXT_USERUNMANAGED, "{DF2CBABC-3BCC-47E5-A998-448D1C0C895B}", &state); ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r); ok(state == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", state); @@ -4219,7 +4142,15 @@ static void test_publish(void) CHECK_REG_STR(prodkey, "DisplayName", "MSITEST"); CHECK_REG_STR(prodkey, "DisplayVersion", "1.1.1"); - CHECK_REG_STR(prodkey, "InstallDate", date); + + get_date_str(date2); + size = ARRAY_SIZE(buf); + buf[0] = '\0'; + res = RegQueryValueExA(prodkey, "InstallDate", NULL, &type, (BYTE *)buf, &size); + ok(!res, "Failed to query value, error %ld\n", res); + ok(type == REG_SZ, "Got wrong type %lu\n", type); + ok(!strcmp(buf, date) || !strcmp(buf, date2), "got %s\n", debugstr_a(buf)); + CHECK_REG_STR(prodkey, "InstallSource", temp); CHECK_REG_ISTR(prodkey, "ModifyPath", "MsiExec.exe /X{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}"); CHECK_REG_STR(prodkey, "Publisher", "Wine"); @@ -4259,7 +4190,7 @@ static void test_publish(void) state = MsiQueryFeatureStateA(prodcode, "montecristo"); ok(state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state); - r = pMsiQueryComponentStateA(prodcode, NULL, MSIINSTALLCONTEXT_USERUNMANAGED, + r = MsiQueryComponentStateA(prodcode, NULL, MSIINSTALLCONTEXT_USERUNMANAGED, "{DF2CBABC-3BCC-47E5-A998-448D1C0C895B}", &state); ok(r == ERROR_UNKNOWN_PRODUCT, "Expected ERROR_UNKNOWN_PRODUCT, got %d\n", r); ok(state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state); @@ -4286,12 +4217,7 @@ static void test_publish_sourcelist(void) CHAR path[MAX_PATH]; CHAR prodcode[] = "{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}"; - if (!pMsiSourceListEnumSourcesA || !pMsiSourceListGetInfoA) - { - win_skip("MsiSourceListEnumSourcesA and/or MsiSourceListGetInfoA are not available\n"); - return; - } - if (is_process_limited()) + if (!is_process_elevated()) { skip("process is limited\n"); return; @@ -4317,16 +4243,16 @@ static void test_publish_sourcelist(void) /* nothing published */ size = MAX_PATH; lstrcpyA(value, "aaa"); - r = pMsiSourceListGetInfoA(prodcode, NULL, MSIINSTALLCONTEXT_USERUNMANAGED, - MSICODE_PRODUCT, INSTALLPROPERTY_PACKAGENAMEA, value, &size); + r = MsiSourceListGetInfoA(prodcode, NULL, MSIINSTALLCONTEXT_USERUNMANAGED, + MSICODE_PRODUCT, INSTALLPROPERTY_PACKAGENAMEA, value, &size); ok(r == ERROR_UNKNOWN_PRODUCT, "Expected ERROR_UNKNOWN_PRODUCT, got %d\n", r); ok(size == MAX_PATH, "got %lu\n", size); ok(!lstrcmpA(value, "aaa"), "Expected \"aaa\", got \"%s\"\n", value); size = MAX_PATH; lstrcpyA(value, "aaa"); - r = pMsiSourceListEnumSourcesA(prodcode, NULL, MSIINSTALLCONTEXT_USERUNMANAGED, - MSICODE_PRODUCT | MSISOURCETYPE_URL, 0, value, &size); + r = MsiSourceListEnumSourcesA(prodcode, NULL, MSIINSTALLCONTEXT_USERUNMANAGED, + MSICODE_PRODUCT | MSISOURCETYPE_URL, 0, value, &size); ok(r == ERROR_UNKNOWN_PRODUCT, "Expected ERROR_UNKNOWN_PRODUCT, got %d\n", r); ok(size == MAX_PATH, "got %lu\n", size); ok(!lstrcmpA(value, "aaa"), "Expected \"aaa\", got \"%s\"\n", value); @@ -4339,16 +4265,16 @@ static void test_publish_sourcelist(void) /* after RegisterProduct */ size = MAX_PATH; lstrcpyA(value, "aaa"); - r = pMsiSourceListGetInfoA(prodcode, NULL, MSIINSTALLCONTEXT_USERUNMANAGED, - MSICODE_PRODUCT, INSTALLPROPERTY_PACKAGENAMEA, value, &size); + r = MsiSourceListGetInfoA(prodcode, NULL, MSIINSTALLCONTEXT_USERUNMANAGED, + MSICODE_PRODUCT, INSTALLPROPERTY_PACKAGENAMEA, value, &size); ok(r == ERROR_UNKNOWN_PRODUCT, "Expected ERROR_UNKNOWN_PRODUCT, got %d\n", r); ok(size == MAX_PATH, "got %lu\n", size); ok(!lstrcmpA(value, "aaa"), "Expected \"aaa\", got \"%s\"\n", value); size = MAX_PATH; lstrcpyA(value, "aaa"); - r = pMsiSourceListEnumSourcesA(prodcode, NULL, MSIINSTALLCONTEXT_USERUNMANAGED, - MSICODE_PRODUCT | MSISOURCETYPE_URL, 0, value, &size); + r = MsiSourceListEnumSourcesA(prodcode, NULL, MSIINSTALLCONTEXT_USERUNMANAGED, + MSICODE_PRODUCT | MSISOURCETYPE_URL, 0, value, &size); ok(r == ERROR_UNKNOWN_PRODUCT, "Expected ERROR_UNKNOWN_PRODUCT, got %d\n", r); ok(size == MAX_PATH, "got %lu\n", size); ok(!lstrcmpA(value, "aaa"), "Expected \"aaa\", got \"%s\"\n", value); @@ -4361,16 +4287,16 @@ static void test_publish_sourcelist(void) /* after ProcessComponents */ size = MAX_PATH; lstrcpyA(value, "aaa"); - r = pMsiSourceListGetInfoA(prodcode, NULL, MSIINSTALLCONTEXT_USERUNMANAGED, - MSICODE_PRODUCT, INSTALLPROPERTY_PACKAGENAMEA, value, &size); + r = MsiSourceListGetInfoA(prodcode, NULL, MSIINSTALLCONTEXT_USERUNMANAGED, + MSICODE_PRODUCT, INSTALLPROPERTY_PACKAGENAMEA, value, &size); ok(r == ERROR_UNKNOWN_PRODUCT, "Expected ERROR_UNKNOWN_PRODUCT, got %d\n", r); ok(size == MAX_PATH, "got %lu\n", size); ok(!lstrcmpA(value, "aaa"), "Expected \"aaa\", got \"%s\"\n", value); size = MAX_PATH; lstrcpyA(value, "aaa"); - r = pMsiSourceListEnumSourcesA(prodcode, NULL, MSIINSTALLCONTEXT_USERUNMANAGED, - MSICODE_PRODUCT | MSISOURCETYPE_URL, 0, value, &size); + r = MsiSourceListEnumSourcesA(prodcode, NULL, MSIINSTALLCONTEXT_USERUNMANAGED, + MSICODE_PRODUCT | MSISOURCETYPE_URL, 0, value, &size); ok(r == ERROR_UNKNOWN_PRODUCT, "Expected ERROR_UNKNOWN_PRODUCT, got %d\n", r); ok(size == MAX_PATH, "got %lu\n", size); ok(!lstrcmpA(value, "aaa"), "Expected \"aaa\", got \"%s\"\n", value); @@ -4383,16 +4309,16 @@ static void test_publish_sourcelist(void) /* after PublishFeatures */ size = MAX_PATH; lstrcpyA(value, "aaa"); - r = pMsiSourceListGetInfoA(prodcode, NULL, MSIINSTALLCONTEXT_USERUNMANAGED, - MSICODE_PRODUCT, INSTALLPROPERTY_PACKAGENAMEA, value, &size); + r = MsiSourceListGetInfoA(prodcode, NULL, MSIINSTALLCONTEXT_USERUNMANAGED, + MSICODE_PRODUCT, INSTALLPROPERTY_PACKAGENAMEA, value, &size); ok(r == ERROR_UNKNOWN_PRODUCT, "Expected ERROR_UNKNOWN_PRODUCT, got %d\n", r); ok(size == MAX_PATH, "got %lu\n", size); ok(!lstrcmpA(value, "aaa"), "Expected \"aaa\", got \"%s\"\n", value); size = MAX_PATH; lstrcpyA(value, "aaa"); - r = pMsiSourceListEnumSourcesA(prodcode, NULL, MSIINSTALLCONTEXT_USERUNMANAGED, - MSICODE_PRODUCT | MSISOURCETYPE_URL, 0, value, &size); + r = MsiSourceListEnumSourcesA(prodcode, NULL, MSIINSTALLCONTEXT_USERUNMANAGED, + MSICODE_PRODUCT | MSISOURCETYPE_URL, 0, value, &size); ok(r == ERROR_UNKNOWN_PRODUCT, "Expected ERROR_UNKNOWN_PRODUCT, got %d\n", r); ok(size == MAX_PATH, "got %lu\n", size); ok(!lstrcmpA(value, "aaa"), "Expected \"aaa\", got \"%s\"\n", value); @@ -4405,24 +4331,24 @@ static void test_publish_sourcelist(void) /* after PublishProduct */ size = MAX_PATH; lstrcpyA(value, "aaa"); - r = pMsiSourceListGetInfoA(prodcode, NULL, MSIINSTALLCONTEXT_USERUNMANAGED, - MSICODE_PRODUCT, INSTALLPROPERTY_PACKAGENAMEA, value, &size); + r = MsiSourceListGetInfoA(prodcode, NULL, MSIINSTALLCONTEXT_USERUNMANAGED, + MSICODE_PRODUCT, INSTALLPROPERTY_PACKAGENAMEA, value, &size); ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r); ok(!lstrcmpA(value, "msitest.msi"), "Expected 'msitest.msi', got %s\n", value); ok(size == 11, "Expected 11, got %lu\n", size); size = MAX_PATH; lstrcpyA(value, "aaa"); - r = pMsiSourceListGetInfoA(prodcode, NULL, MSIINSTALLCONTEXT_USERUNMANAGED, - MSICODE_PRODUCT, INSTALLPROPERTY_MEDIAPACKAGEPATHA, value, &size); + r = MsiSourceListGetInfoA(prodcode, NULL, MSIINSTALLCONTEXT_USERUNMANAGED, + MSICODE_PRODUCT, INSTALLPROPERTY_MEDIAPACKAGEPATHA, value, &size); ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r); ok(!lstrcmpA(value, ""), "Expected \"\", got \"%s\"\n", value); ok(size == 0, "Expected 0, got %lu\n", size); size = MAX_PATH; lstrcpyA(value, "aaa"); - r = pMsiSourceListGetInfoA(prodcode, NULL, MSIINSTALLCONTEXT_USERUNMANAGED, - MSICODE_PRODUCT, INSTALLPROPERTY_DISKPROMPTA, value, &size); + r = MsiSourceListGetInfoA(prodcode, NULL, MSIINSTALLCONTEXT_USERUNMANAGED, + MSICODE_PRODUCT, INSTALLPROPERTY_DISKPROMPTA, value, &size); ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r); ok(!lstrcmpA(value, ""), "Expected \"\", got \"%s\"\n", value); ok(size == 0, "Expected 0, got %lu\n", size); @@ -4432,40 +4358,40 @@ static void test_publish_sourcelist(void) size = MAX_PATH; lstrcpyA(value, "aaa"); - r = pMsiSourceListGetInfoA(prodcode, NULL, MSIINSTALLCONTEXT_USERUNMANAGED, - MSICODE_PRODUCT, INSTALLPROPERTY_LASTUSEDSOURCEA, value, &size); + r = MsiSourceListGetInfoA(prodcode, NULL, MSIINSTALLCONTEXT_USERUNMANAGED, + MSICODE_PRODUCT, INSTALLPROPERTY_LASTUSEDSOURCEA, value, &size); ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r); ok(!lstrcmpA(value, path), "Expected \"%s\", got \"%s\"\n", path, value); ok(size == lstrlenA(path), "Expected %d, got %lu\n", lstrlenA(path), size); size = MAX_PATH; lstrcpyA(value, "aaa"); - r = pMsiSourceListGetInfoA(prodcode, NULL, MSIINSTALLCONTEXT_USERUNMANAGED, - MSICODE_PRODUCT, INSTALLPROPERTY_LASTUSEDTYPEA, value, &size); + r = MsiSourceListGetInfoA(prodcode, NULL, MSIINSTALLCONTEXT_USERUNMANAGED, + MSICODE_PRODUCT, INSTALLPROPERTY_LASTUSEDTYPEA, value, &size); ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r); ok(!lstrcmpA(value, "n"), "Expected \"n\", got \"%s\"\n", value); ok(size == 1, "Expected 1, got %lu\n", size); size = MAX_PATH; lstrcpyA(value, "aaa"); - r = pMsiSourceListEnumSourcesA(prodcode, NULL, MSIINSTALLCONTEXT_USERUNMANAGED, - MSICODE_PRODUCT | MSISOURCETYPE_URL, 0, value, &size); + r = MsiSourceListEnumSourcesA(prodcode, NULL, MSIINSTALLCONTEXT_USERUNMANAGED, + MSICODE_PRODUCT | MSISOURCETYPE_URL, 0, value, &size); ok(r == ERROR_NO_MORE_ITEMS, "Expected ERROR_NO_MORE_ITEMS, got %d\n", r); ok(!lstrcmpA(value, "aaa"), "Expected value to be unchanged, got %s\n", value); ok(size == MAX_PATH, "Expected MAX_PATH, got %lu\n", size); size = MAX_PATH; lstrcpyA(value, "aaa"); - r = pMsiSourceListEnumSourcesA(prodcode, NULL, MSIINSTALLCONTEXT_USERUNMANAGED, - MSICODE_PRODUCT | MSISOURCETYPE_NETWORK, 0, value, &size); + r = MsiSourceListEnumSourcesA(prodcode, NULL, MSIINSTALLCONTEXT_USERUNMANAGED, + MSICODE_PRODUCT | MSISOURCETYPE_NETWORK, 0, value, &size); ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r); ok(!lstrcmpA(value, path), "Expected \"%s\", got \"%s\"\n", path, value); ok(size == lstrlenA(path), "Expected %d, got %lu\n", lstrlenA(path), size); size = MAX_PATH; lstrcpyA(value, "aaa"); - r = pMsiSourceListEnumSourcesA(prodcode, NULL, MSIINSTALLCONTEXT_USERUNMANAGED, - MSICODE_PRODUCT | MSISOURCETYPE_NETWORK, 1, value, &size); + r = MsiSourceListEnumSourcesA(prodcode, NULL, MSIINSTALLCONTEXT_USERUNMANAGED, + MSICODE_PRODUCT | MSISOURCETYPE_NETWORK, 1, value, &size); ok(r == ERROR_NO_MORE_ITEMS, "Expected ERROR_NO_MORE_ITEMS, got %d\n", r); ok(!lstrcmpA(value, "aaa"), "Expected value to be unchanged, got %s\n", value); ok(size == MAX_PATH, "Expected MAX_PATH, got %lu\n", size); @@ -4489,7 +4415,7 @@ static void test_remove_files(void) { UINT r; - if (is_process_limited()) + if (!is_process_elevated()) { skip("process is limited\n"); return; @@ -4624,7 +4550,7 @@ static void test_move_files(void) UINT r; char props[4 * MAX_PATH + 74]; - if (is_process_limited()) + if (!is_process_elevated()) { skip("process is limited\n"); return; @@ -4770,7 +4696,7 @@ static void test_duplicate_files(void) { UINT r; - if (is_process_limited()) + if (!is_process_elevated()) { skip("process is limited\n"); return; @@ -4813,7 +4739,7 @@ static void test_write_registry_values(void) LONG res; UINT r; - if (is_process_limited()) + if (!is_process_elevated()) { skip("process is limited\n"); return; @@ -4981,7 +4907,7 @@ static void test_envvar(void) HKEY env, env2; LONG res; - if (is_process_limited()) + if (!is_process_elevated()) { skip("process is limited\n"); return; @@ -5096,7 +5022,7 @@ static void test_create_remove_folder(void) { UINT r; - if (is_process_limited()) + if (!is_process_elevated()) { skip("process is limited\n"); return; @@ -5268,7 +5194,7 @@ static void test_delete_services(void) SC_HANDLE manager, service; DWORD error; - if (is_process_limited()) + if (!is_process_elevated()) { skip("process is limited\n"); return; @@ -5342,7 +5268,7 @@ static void test_install_services(void) HKEY hKey; DWORD err_control, err_controlsize, err_controltype; - if (is_process_limited()) + if (!is_process_elevated()) { skip("process is limited\n"); return; @@ -5418,7 +5344,7 @@ static void test_self_registration(void) HKEY key; UINT r; - if (is_process_limited()) + if (!is_process_elevated()) { skip("process is limited\n"); return; @@ -5466,7 +5392,7 @@ static void test_register_font(void) UINT r; REGSAM access = KEY_ALL_ACCESS; - if (is_process_limited()) + if (!is_process_elevated()) { skip("process is limited\n"); return; @@ -5517,7 +5443,7 @@ static void test_validate_product_id(void) { UINT r; - if (is_process_limited()) + if (!is_process_elevated()) { skip("process is limited\n"); return; @@ -5571,7 +5497,7 @@ static void test_install_remove_odbc(void) WORD len; UINT r; - if (is_process_limited()) + if (!is_process_elevated()) { skip("process is limited\n"); return; @@ -5654,7 +5580,7 @@ static void test_register_typelib(void) HRESULT hr; UINT r; - if (is_process_limited()) + if (!is_process_elevated()) { skip("process is limited\n"); return; @@ -5704,7 +5630,7 @@ static void test_create_remove_shortcut(void) { UINT r; - if (is_process_limited()) + if (!is_process_elevated()) { skip("process is limited\n"); return; @@ -5753,7 +5679,7 @@ static void test_publish_components(void) BYTE *data; DWORD size; - if (is_process_limited()) + if (!is_process_elevated()) { skip("process is limited\n"); return; @@ -5804,10 +5730,7 @@ static void test_publish_components(void) "english.txt", INSTALLMODE_DEFAULT, NULL, &size); ok(r == ERROR_SUCCESS, "MsiProvideQualifiedComponent returned %d\n", r); - if (pRegDeleteKeyExA) - res = pRegDeleteKeyExA(HKEY_LOCAL_MACHINE, keypath2, KEY_WOW64_64KEY, 0); - else - res = RegDeleteKeyA(HKEY_LOCAL_MACHINE, keypath2); + res = RegDeleteKeyExA(HKEY_LOCAL_MACHINE, keypath2, KEY_WOW64_64KEY, 0); ok(res == ERROR_SUCCESS, "RegDeleteKey failed %ld\n", res); res = RegCreateKeyA(HKEY_CURRENT_USER, keypath, &key); @@ -5837,7 +5760,7 @@ static void test_remove_duplicate_files(void) { UINT r; - if (is_process_limited()) + if (!is_process_elevated()) { skip("process is limited\n"); return; @@ -5887,7 +5810,7 @@ static void test_find_related_products(void) { UINT r; - if (is_process_limited()) + if (!is_process_elevated()) { skip("process is limited\n"); return; @@ -5931,7 +5854,7 @@ static void test_ini_values(void) HANDLE file; BOOL ret; - if (is_process_limited()) + if (!is_process_elevated()) { skip("process is limited\n"); return; @@ -5992,7 +5915,7 @@ static void test_register_class_info(void) LONG res; HKEY hkey; - if (is_process_limited()) + if (!is_process_elevated()) { skip("process is limited\n"); return; @@ -6057,7 +5980,7 @@ static void test_register_extension_info(void) LONG res; HKEY hkey; - if (is_process_limited()) + if (!is_process_elevated()) { skip("process is limited\n"); return; @@ -6109,7 +6032,7 @@ static void test_register_progid_info(void) LONG res; HKEY hkey; - if (is_process_limited()) + if (!is_process_elevated()) { skip("process is limited\n"); return; @@ -6235,7 +6158,7 @@ static void test_register_mime_info(void) LONG res; HKEY hkey; - if (is_process_limited()) + if (!is_process_elevated()) { skip("process is limited\n"); return; @@ -6334,7 +6257,7 @@ static void test_publish_assemblies(void) const char *path; int access; - if (is_process_limited()) + if (!is_process_elevated()) { skip("process is limited\n"); return; @@ -6498,7 +6421,7 @@ static void test_remove_existing_products(void) { UINT r; - if (is_process_limited()) + if (!is_process_elevated()) { skip("process is limited\n"); return; @@ -6530,18 +6453,64 @@ static void test_remove_existing_products(void) DeleteFileA(msifile); } +static HANDLE get_admin_token(void) +{ + TOKEN_ELEVATION_TYPE type; + TOKEN_LINKED_TOKEN linked; + DWORD size; + +#ifdef __REACTOS__ +#ifndef GetCurrentThreadEffectiveToken +#define GetCurrentProcessToken() ((HANDLE)~(ULONG_PTR)3) +#define GetCurrentThreadEffectiveToken() GetCurrentProcessToken() +#endif +#endif + + if (!GetTokenInformation(GetCurrentThreadEffectiveToken(), TokenElevationType, &type, sizeof(type), &size) + || type == TokenElevationTypeFull) + return NULL; + + if (!GetTokenInformation(GetCurrentThreadEffectiveToken(), TokenLinkedToken, &linked, sizeof(linked), &size)) + return NULL; + return linked.LinkedToken; +} + +void restart_as_admin_elevated(void) +{ + HANDLE token; + PROCESS_INFORMATION pi; + STARTUPINFOW si; + + if (!(token = get_admin_token())) return; + + memset(&si, 0, sizeof(si)); + si.cb = sizeof(si); + if (CreateProcessAsUserW(token, NULL, GetCommandLineW(), NULL, NULL, FALSE, 0, NULL, NULL, &si, &pi)) + { + DWORD exit_code; + + trace("restarting\n"); + WaitForSingleObject(pi.hProcess, INFINITE); + GetExitCodeProcess(pi.hProcess, &exit_code); + CloseHandle(pi.hProcess); + CloseHandle(pi.hThread); + ExitProcess(exit_code); + } + else trace("failed to restart as admin %lu\n", GetLastError()); + + CloseHandle(token); +} + START_TEST(action) { DWORD len; char temp_path[MAX_PATH], prev_path[MAX_PATH], log_file[MAX_PATH]; - STATEMGRSTATUS status; - BOOL ret = FALSE; - init_functionpointers(); + if (!is_process_elevated()) restart_as_admin_elevated(); + subtest("custom"); - if (pIsWow64Process) - pIsWow64Process(GetCurrentProcess(), &is_wow64); + IsWow64Process(GetCurrentProcess(), &is_wow64); GetCurrentDirectoryA(MAX_PATH, prev_path); GetTempPathA(MAX_PATH, temp_path); @@ -6556,18 +6525,6 @@ START_TEST(action) ok(get_system_dirs(), "failed to retrieve system dirs\n"); ok(get_user_dirs(), "failed to retrieve user dirs\n"); - /* Create a restore point ourselves so we circumvent the multitude of restore points - * that would have been created by all the installation and removal tests. - * - * This is not needed on version 5.0 where setting MSIFASTINSTALL prevents the - * creation of restore points. - */ - if (pSRSetRestorePointA && !pMsiGetComponentPathExA) - { - memset(&status, 0, sizeof(status)); - ret = notify_system_change(BEGIN_NESTED_SYSTEM_CHANGE, &status); - } - /* Create only one log file and don't append. We have to pass something * for the log mode for this to work. The logfile needs to have an absolute * path otherwise we still end up with some extra logfiles as some tests @@ -6611,13 +6568,5 @@ START_TEST(action) test_remove_existing_products(); DeleteFileA(log_file); - - if (pSRSetRestorePointA && !pMsiGetComponentPathExA && ret) - { - ret = notify_system_change(END_NESTED_SYSTEM_CHANGE, &status); - if (ret) - remove_restore_point(status.llSequenceNumber); - } - SetCurrentDirectoryA(prev_path); } diff --git a/modules/rostests/winetests/msi/automation.c b/modules/rostests/winetests/msi/automation.c index bc79701c707a4..8a48ebf6e1bfc 100644 --- a/modules/rostests/winetests/msi/automation.c +++ b/modules/rostests/winetests/msi/automation.c @@ -32,6 +32,7 @@ #include #include "wine/test.h" +#include "utils.h" #ifdef __REACTOS__ #include "ole2.h" @@ -39,14 +40,10 @@ static BOOL is_wow64; -static LONG (WINAPI *pRegDeleteKeyExA)(HKEY, LPCSTR, REGSAM, DWORD); -static BOOL (WINAPI *pIsWow64Process)(HANDLE, PBOOL); - DEFINE_GUID(GUID_NULL,0,0,0,0,0,0,0,0,0,0,0); static const char *msifile = "winetest-automation.msi"; static FILETIME systemtime; -static CHAR CURR_DIR[MAX_PATH]; static EXCEPINFO excepinfo; /* @@ -156,13 +153,6 @@ static const CHAR registry_dat[] = "Registry\tRoot\tKey\tName\tValue\tComponent_ "regdata\t1\tSOFTWARE\\Wine\\msitest\tblah\tbad\tdangler\n" "OrderTest\t1\tSOFTWARE\\Wine\\msitest\tOrderTestName\tOrderTestValue\tcomponent\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[] = @@ -202,65 +192,6 @@ static const msi_summary_info summary_info[] = ADD_INFO_FILETIME(PID_LASTPRINTED, &systemtime) }; -static void init_functionpointers(void) -{ - HMODULE hadvapi32 = GetModuleHandleA("advapi32.dll"); - HMODULE hkernel32 = GetModuleHandleA("kernel32.dll"); - -#define GET_PROC(dll, func) \ - p ## func = (void *)GetProcAddress(dll, #func); \ - if(!p ## func) \ - trace("GetProcAddress(%s) failed\n", #func); - - GET_PROC(hadvapi32, RegDeleteKeyExA) - GET_PROC(hkernel32, IsWow64Process) - -#undef GET_PROC -} - -static BOOL is_process_limited(void) -{ - SID_IDENTIFIER_AUTHORITY NtAuthority = {SECURITY_NT_AUTHORITY}; - PSID Group = NULL; - BOOL IsInGroup; - HANDLE token; - - if (!AllocateAndInitializeSid(&NtAuthority, 2, SECURITY_BUILTIN_DOMAIN_RID, - DOMAIN_ALIAS_RID_ADMINS, 0, 0, 0, 0, 0, 0, &Group) || - !CheckTokenMembership(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 (OpenProcessToken(GetCurrentProcess(), TOKEN_QUERY, &token)) - { - BOOL ret; - TOKEN_ELEVATION_TYPE type = TokenElevationTypeDefault; - DWORD size; - - ret = GetTokenInformation(token, TokenElevationType, &type, sizeof(type), &size); - CloseHandle(token); - return (ret && type == TokenElevationTypeLimited); - } - return FALSE; -} - -static LONG delete_key_portable( HKEY key, LPCSTR subkey, REGSAM access ) -{ - if (pRegDeleteKeyExA) - return pRegDeleteKeyExA( key, subkey, access, 0 ); - return RegDeleteKeyA( key, subkey ); -} - /* * Database Helpers */ @@ -301,8 +232,8 @@ static void write_msi_summary_info(MSIHANDLE db, const msi_summary_info *info, i MsiCloseHandle(summary); } -static void create_database(const CHAR *name, const msi_table *tables, int num_tables, - const msi_summary_info *info, int num_info) +static void create_database_suminfo(const CHAR *name, const msi_table *tables, int num_tables, + const msi_summary_info *info, int num_info) { MSIHANDLE db; UINT r; @@ -343,7 +274,7 @@ static BOOL create_package(LPWSTR path) DWORD len; /* Prepare package */ - create_database(msifile, tables, ARRAY_SIZE(tables), summary_info, ARRAY_SIZE(summary_info)); + create_database_suminfo(msifile, tables, ARRAY_SIZE(tables), summary_info, ARRAY_SIZE(summary_info)); len = MultiByteToWideChar(CP_ACP, MB_PRECOMPOSED, CURR_DIR, -1, path, MAX_PATH); @@ -359,8 +290,6 @@ static BOOL create_package(LPWSTR path) * Installation helpers */ -static char PROG_FILES_DIR[MAX_PATH]; - static BOOL get_program_files_dir(LPSTR buf) { HKEY hkey; @@ -378,24 +307,6 @@ static BOOL get_program_files_dir(LPSTR buf) return TRUE; } -static void create_file(const CHAR *name, DWORD size) -{ - HANDLE file; - DWORD written, left; - - 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, name, strlen(name), &written, NULL); - WriteFile(file, "\n", strlen("\n"), &written, NULL); - - left = size - lstrlenA(name) - 1; - - SetFilePointer(file, left, NULL, FILE_CURRENT); - SetEndOfFile(file); - - CloseHandle(file); -} - static void create_test_files(void) { CreateDirectoryA("msitest", NULL); @@ -411,23 +322,8 @@ static void create_test_files(void) create_file("msitest\\filename", 100); } -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(msifile); DeleteFileA("msitest\\cabout\\new\\five.txt"); DeleteFileA("msitest\\cabout\\four.txt"); DeleteFileA("msitest\\second\\three.txt"); @@ -2341,7 +2237,7 @@ static UINT delete_registry_key(HKEY hkeyParent, LPCSTR subkey, REGSAM access) RegCloseKey(hkey); free(string); - delete_key_portable(hkeyParent, subkey, access); + RegDeleteKeyExA(hkeyParent, subkey, access, 0); return ERROR_SUCCESS; } @@ -2391,7 +2287,7 @@ static void test_Installer_InstallProduct(void) IDispatch *pStringList = NULL; REGSAM access = KEY_ALL_ACCESS; - if (is_process_limited()) + if (!is_process_elevated()) { /* In fact InstallProduct would succeed but then Windows XP * would not allow us to clean up the registry! @@ -2521,13 +2417,13 @@ static void test_Installer_InstallProduct(void) ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %ld\n", res); /* Remove registry keys written by RegisterProduct standard action */ - res = delete_key_portable(HKEY_LOCAL_MACHINE, + res = RegDeleteKeyExA(HKEY_LOCAL_MACHINE, "SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Uninstall\\{837450fa-a39b-4bc8-b321-08b393f784b3}", - KEY_WOW64_32KEY); + KEY_WOW64_32KEY, 0); ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %ld\n", res); - res = delete_key_portable(HKEY_LOCAL_MACHINE, - "SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Installer\\UpgradeCodes\\D8E760ECA1E276347B43E42BDBDA5656", access); + res = RegDeleteKeyExA(HKEY_LOCAL_MACHINE, + "SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Installer\\UpgradeCodes\\D8E760ECA1E276347B43E42BDBDA5656", access, 0); ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %ld\n", res); res = find_registry_key(HKEY_LOCAL_MACHINE, @@ -2538,8 +2434,8 @@ static void test_Installer_InstallProduct(void) ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %ld\n", res); RegCloseKey(hkey); - res = delete_key_portable(HKEY_LOCAL_MACHINE, - "SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Installer\\Products\\af054738b93a8cb43b12803b397f483b", access); + res = RegDeleteKeyExA(HKEY_LOCAL_MACHINE, + "SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Installer\\Products\\af054738b93a8cb43b12803b397f483b", access, 0); ok(res == ERROR_FILE_NOT_FOUND, "Expected ERROR_FILE_NOT_FOUND, got %ld\n", res); /* Remove registry keys written by PublishProduct standard action */ @@ -2695,6 +2591,7 @@ static void test_Installer(void) /* Installer::InstallProduct and other tests that depend on our product being installed */ test_Installer_InstallProduct(); + DeleteFileA(msifile); } START_TEST(automation) @@ -2705,10 +2602,9 @@ START_TEST(automation) CLSID clsid; IUnknown *pUnk; - init_functionpointers(); + if (!is_process_elevated()) restart_as_admin_elevated(); - if (pIsWow64Process) - pIsWow64Process(GetCurrentProcess(), &is_wow64); + IsWow64Process(GetCurrentProcess(), &is_wow64); GetSystemTimeAsFileTime(&systemtime); @@ -2745,6 +2641,5 @@ START_TEST(automation) } OleUninitialize(); - SetCurrentDirectoryA(prev_path); } diff --git a/modules/rostests/winetests/msi/custom.c b/modules/rostests/winetests/msi/custom.c index c1b011c887136..8c5e7e4bbd072 100644 --- a/modules/rostests/winetests/msi/custom.c +++ b/modules/rostests/winetests/msi/custom.c @@ -18,6 +18,10 @@ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA */ +#if 0 +#pragma makedep testdll +#endif + #include #include @@ -32,9 +36,15 @@ #include #include +#ifdef __MINGW32__ +#define __WINE_PRINTF_ATTR(fmt,args) __attribute__((format (printf,fmt,args))) +#else +#define __WINE_PRINTF_ATTR(fmt,args) +#endif + static int todo_level, todo_do_loop; -static void WINAPIV ok_(MSIHANDLE hinst, int todo, const char *file, int line, int condition, const char *msg, ...) +static void WINAPIV __WINE_PRINTF_ATTR(6,7) ok_(MSIHANDLE hinst, int todo, const char *file, int line, int condition, const char *msg, ...) { static char buffer[2000]; MSIHANDLE record; @@ -100,7 +110,7 @@ static void check_prop(MSIHANDLE hinst, const char *prop, const char *expect) DWORD sz = sizeof(buffer); UINT r = MsiGetPropertyA(hinst, prop, buffer, &sz); ok(hinst, !r, "'%s': got %u\n", prop, r); - ok(hinst, sz == strlen(buffer), "'%s': expected %u, got %u\n", prop, strlen(buffer), sz); + ok(hinst, sz == strlen(buffer), "'%s': expected %Iu, got %lu\n", prop, strlen(buffer), sz); ok(hinst, !strcmp(buffer, expect), "expected '%s', got '%s'\n", expect, buffer); } @@ -124,21 +134,21 @@ static void test_props(MSIHANDLE hinst) sz = 0; r = MsiGetPropertyA(hinst, "boo", NULL, &sz); ok(hinst, !r, "got %u\n", r); - ok(hinst, sz == 0, "got size %u\n", sz); + ok(hinst, sz == 0, "got size %lu\n", sz); sz = 0; strcpy(buffer,"x"); r = MsiGetPropertyA(hinst, "boo", buffer, &sz); ok(hinst, r == ERROR_MORE_DATA, "got %u\n", r); ok(hinst, !strcmp(buffer, "x"), "got \"%s\"\n", buffer); - ok(hinst, sz == 0, "got size %u\n", sz); + ok(hinst, sz == 0, "got size %lu\n", sz); sz = 1; strcpy(buffer,"x"); r = MsiGetPropertyA(hinst, "boo", buffer, &sz); ok(hinst, !r, "got %u\n", r); ok(hinst, !buffer[0], "got \"%s\"\n", buffer); - ok(hinst, sz == 0, "got size %u\n", sz); + ok(hinst, sz == 0, "got size %lu\n", sz); /* set the property to something */ r = MsiSetPropertyA(hinst, NULL, NULL); @@ -186,35 +196,35 @@ static void test_props(MSIHANDLE hinst) sz = 0; r = MsiGetPropertyA(hinst, "boo", NULL, &sz); ok(hinst, !r, "got %u\n", r); - ok(hinst, sz == 6, "got size %u\n", sz); + ok(hinst, sz == 6, "got size %lu\n", sz); sz = 0; strcpy(buffer,"q"); r = MsiGetPropertyA(hinst, "boo", buffer, &sz); ok(hinst, r == ERROR_MORE_DATA, "got %u\n", r); ok(hinst, !strcmp(buffer, "q"), "got \"%s\"\n", buffer); - ok(hinst, sz == 6, "got size %u\n", sz); + ok(hinst, sz == 6, "got size %lu\n", sz); sz = 1; strcpy(buffer,"x"); r = MsiGetPropertyA(hinst, "boo", buffer, &sz); ok(hinst, r == ERROR_MORE_DATA, "got %u\n", r); ok(hinst, !buffer[0], "got \"%s\"\n", buffer); - ok(hinst, sz == 6, "got size %u\n", sz); + ok(hinst, sz == 6, "got size %lu\n", sz); sz = 3; strcpy(buffer,"x"); r = MsiGetPropertyA(hinst, "boo", buffer, &sz); ok(hinst, r == ERROR_MORE_DATA, "got %u\n", r); ok(hinst, !strcmp(buffer, "xy"), "got \"%s\"\n", buffer); - ok(hinst, sz == 6, "got size %u\n", sz); + ok(hinst, sz == 6, "got size %lu\n", sz); sz = 4; strcpy(buffer,"x"); r = MsiGetPropertyA(hinst, "boo", buffer, &sz); ok(hinst, !r, "got %u\n", r); ok(hinst, !strcmp(buffer, "xyz"), "got \"%s\"\n", buffer); - ok(hinst, sz == 3, "got size %u\n", sz); + ok(hinst, sz == 3, "got size %lu\n", sz); r = MsiGetPropertyW(hinst, L"boo", NULL, NULL); ok(hinst, !r, "got %u\n", r); @@ -225,35 +235,35 @@ static void test_props(MSIHANDLE hinst) sz = 0; r = MsiGetPropertyW(hinst, L"boo", NULL, &sz); ok(hinst, !r, "got %u\n", r); - ok(hinst, sz == 3, "got size %u\n", sz); + ok(hinst, sz == 3, "got size %lu\n", sz); sz = 0; lstrcpyW(bufferW, L"boo"); r = MsiGetPropertyW(hinst, L"boo", bufferW, &sz); ok(hinst, r == ERROR_MORE_DATA, "got %u\n", r); ok(hinst, !lstrcmpW(bufferW, L"boo"), "got %s\n", dbgstr_w(bufferW)); - ok(hinst, sz == 3, "got size %u\n", sz); + ok(hinst, sz == 3, "got size %lu\n", sz); sz = 1; lstrcpyW(bufferW, L"boo"); r = MsiGetPropertyW(hinst, L"boo", bufferW, &sz); ok(hinst, r == ERROR_MORE_DATA, "got %u\n", r); ok(hinst, !bufferW[0], "got %s\n", dbgstr_w(bufferW)); - ok(hinst, sz == 3, "got size %u\n", sz); + ok(hinst, sz == 3, "got size %lu\n", sz); sz = 3; lstrcpyW(bufferW, L"boo"); r = MsiGetPropertyW(hinst, L"boo", bufferW, &sz); ok(hinst, r == ERROR_MORE_DATA, "got %u\n", r); ok(hinst, !lstrcmpW(bufferW, L"xy"), "got %s\n", dbgstr_w(bufferW)); - ok(hinst, sz == 3, "got size %u\n", sz); + ok(hinst, sz == 3, "got size %lu\n", sz); sz = 4; lstrcpyW(bufferW, L"boo"); r = MsiGetPropertyW(hinst, L"boo", bufferW, &sz); ok(hinst, !r, "got %u\n", r); ok(hinst, !lstrcmpW(bufferW, L"xyz"), "got %s\n", dbgstr_w(bufferW)); - ok(hinst, sz == 3, "got size %u\n", sz); + ok(hinst, sz == 3, "got size %lu\n", sz); r = MsiSetPropertyA(hinst, "boo", NULL); ok(hinst, !r, "got %u\n", r); @@ -262,13 +272,13 @@ static void test_props(MSIHANDLE hinst) sz = 0; r = MsiGetPropertyA(hinst, "embednullprop", NULL, &sz); ok(hinst, !r, "got %u\n", r); - ok(hinst, sz == 6, "got size %u\n", sz); + ok(hinst, sz == 6, "got size %lu\n", sz); sz = 4; memset(buffer, 0xcc, sizeof(buffer)); r = MsiGetPropertyA(hinst, "embednullprop", buffer, &sz); ok(hinst, !r, "got %u\n", r); - ok(hinst, sz == 3, "got size %u\n", sz); + ok(hinst, sz == 3, "got size %lu\n", sz); ok(hinst, !memcmp(buffer, "a\0\0\0\xcc", 5), "wrong data\n"); } @@ -306,7 +316,7 @@ static void test_db(MSIHANDLE hinst) sz = sizeof(buffer); r = MsiRecordGetStringA(rec2, 1, buffer, &sz); ok(hinst, !r, "got %u\n", r); - ok(hinst, sz == strlen(buffer), "got size %u\n", sz); + ok(hinst, sz == strlen(buffer), "got size %lu\n", sz); ok(hinst, !strcmp(buffer, "Name"), "got '%s'\n", buffer); /* Test MsiGetActiveDatabase + MsiDatabaseIsTablePersistent once again */ @@ -335,11 +345,11 @@ static void test_db(MSIHANDLE hinst) sz = sizeof(buffer); r = MsiRecordGetStringA(rec2, 1, buffer, &sz); ok(hinst, !r, "got %u\n", r); - ok(hinst, sz == strlen(buffer), "got size %u\n", sz); + ok(hinst, sz == strlen(buffer), "got size %lu\n", sz); ok(hinst, !strcmp(buffer, "one"), "got '%s'\n", buffer); r = MsiRecordGetInteger(rec2, 2); - ok(hinst, r == 1, "got %d\n", r); + ok(hinst, r == 1, "got %u\n", r); sz = sizeof(buffer); r = MsiRecordReadStream(rec2, 3, buffer, &sz); @@ -358,11 +368,11 @@ static void test_db(MSIHANDLE hinst) sz = sizeof(buffer); r = MsiRecordGetStringA(rec2, 1, buffer, &sz); ok(hinst, !r, "got %u\n", r); - ok(hinst, sz == strlen(buffer), "got size %u\n", sz); + ok(hinst, sz == strlen(buffer), "got size %lu\n", sz); ok(hinst, !strcmp(buffer, "two"), "got '%s'\n", buffer); r = MsiRecordGetInteger(rec2, 2); - ok(hinst, r == 2, "got %d\n", r); + ok(hinst, r == 2, "got %u\n", r); sz = sizeof(buffer); r = MsiRecordReadStream(rec2, 3, buffer, &sz); @@ -382,16 +392,16 @@ static void test_db(MSIHANDLE hinst) ok(hinst, !r, "got %u\n", r); r = MsiViewModify(view, MSIMODIFY_REFRESH, rec2); - ok(hinst, !r, "got %d\n", r); + ok(hinst, !r, "got %u\n", r); sz = sizeof(buffer); r = MsiRecordGetStringA(rec2, 1, buffer, &sz); ok(hinst, !r, "got %u\n", r); - ok(hinst, sz == strlen(buffer), "got size %u\n", sz); + ok(hinst, sz == strlen(buffer), "got size %lu\n", sz); ok(hinst, !strcmp(buffer, "two"), "got '%s'\n", buffer); r = MsiRecordGetInteger(rec2, 2); - ok(hinst, r == 2, "got %d\n", r); + ok(hinst, r == 2, "got %u\n", r); sz = sizeof(buffer); r = MsiRecordReadStream(rec2, 3, buffer, &sz); @@ -403,7 +413,7 @@ static void test_db(MSIHANDLE hinst) r = MsiViewFetch(view, &rec2); ok(hinst, r == ERROR_NO_MORE_ITEMS, "got %u\n", r); - ok(hinst, !rec2, "got %u\n", rec2); + ok(hinst, !rec2, "got %lu\n", rec2); r = MsiViewClose(view); ok(hinst, !r, "got %u\n", r); @@ -424,14 +434,14 @@ static void test_db(MSIHANDLE hinst) ok(hinst, !r, "got %u\n", r); r = MsiRecordGetInteger(rec2, 2); - ok(hinst, r == 1, "got %d\n", r); + ok(hinst, r == 1, "got %u\n", r); r = MsiCloseHandle(rec2); ok(hinst, !r, "got %u\n", r); r = MsiViewFetch(view, &rec2); ok(hinst, r == ERROR_NO_MORE_ITEMS, "got %u\n", r); - ok(hinst, !rec2, "got %u\n", rec2); + ok(hinst, !rec2, "got %lu\n", rec2); r = MsiCloseHandle(rec); ok(hinst, !r, "got %u\n", r); @@ -444,18 +454,18 @@ static void test_db(MSIHANDLE hinst) ok(hinst, !r, "got %u\n", r); r = MsiRecordGetFieldCount(rec); - ok(hinst, r == 1, "got %d\n", r); + ok(hinst, r == 1, "got %u\n", r); sz = sizeof(buffer); r = MsiRecordGetStringA(rec, 0, buffer, &sz); ok(hinst, !r, "got %u\n", r); - ok(hinst, sz == strlen(buffer), "got size %u\n", sz); + ok(hinst, sz == strlen(buffer), "got size %lu\n", sz); ok(hinst, !strcmp(buffer, "Test"), "got '%s'\n", buffer); sz = sizeof(buffer); r = MsiRecordGetStringA(rec, 1, buffer, &sz); ok(hinst, !r, "got %u\n", r); - ok(hinst, sz == strlen(buffer), "got size %u\n", sz); + ok(hinst, sz == strlen(buffer), "got size %lu\n", sz); ok(hinst, !strcmp(buffer, "Name"), "got '%s'\n", buffer); r = MsiCloseHandle(rec); @@ -499,17 +509,17 @@ static void test_db(MSIHANDLE hinst) ok(hinst, int_value == 0, "%u: got %u\n", i, int_value); if (i == PID_TEMPLATE) { - ok(hinst, sz == 5, "%u: got %u\n", i, sz); + ok(hinst, sz == 5, "%u: got %lu\n", i, sz); ok(hinst, !lstrcmpA(buffer, ";1033"), "%u: got %s\n", i, buffer); } else if (i == PID_REVNUMBER) { - ok(hinst, sz == 76, "%u: got %u\n", i, sz); + ok(hinst, sz == 76, "%u: got %lu\n", i, sz); ok(hinst, !lstrcmpA(buffer, "{004757CA"), "%u: got %s\n", i, buffer); } else { - ok(hinst, sz == sizeof(buffer), "%u: got %u\n", i, sz); + ok(hinst, sz == sizeof(buffer), "%u: got %lu\n", i, sz); ok(hinst, !*buffer, "%u: got %s\n", i, buffer); } } @@ -582,68 +592,68 @@ static void test_targetpath(MSIHANDLE hinst) sz = 0; r = MsiGetTargetPathA(hinst, "TARGETDIR", NULL, &sz); ok(hinst, !r, "got %u\n", r); - ok(hinst, sz == 6, "got size %u\n", sz); + ok(hinst, sz == 6, "got size %lu\n", sz); sz = 0; strcpy(buffer,"q"); r = MsiGetTargetPathA(hinst, "TARGETDIR", buffer, &sz); ok(hinst, r == ERROR_MORE_DATA, "got %u\n", r); ok(hinst, !strcmp(buffer, "q"), "got \"%s\"\n", buffer); - ok(hinst, sz == 6, "got size %u\n", sz); + ok(hinst, sz == 6, "got size %lu\n", sz); sz = 1; strcpy(buffer,"x"); r = MsiGetTargetPathA(hinst, "TARGETDIR", buffer, &sz); ok(hinst, r == ERROR_MORE_DATA, "got %u\n", r); ok(hinst, !buffer[0], "got \"%s\"\n", buffer); - ok(hinst, sz == 6, "got size %u\n", sz); + ok(hinst, sz == 6, "got size %lu\n", sz); sz = 3; strcpy(buffer,"x"); r = MsiGetTargetPathA(hinst, "TARGETDIR", buffer, &sz); ok(hinst, r == ERROR_MORE_DATA, "got %u\n", r); ok(hinst, !strcmp(buffer, "C:"), "got \"%s\"\n", buffer); - ok(hinst, sz == 6, "got size %u\n", sz); + ok(hinst, sz == 6, "got size %lu\n", sz); sz = 4; strcpy(buffer,"x"); r = MsiGetTargetPathA(hinst, "TARGETDIR", buffer, &sz); ok(hinst, !r, "got %u\n", r); ok(hinst, !strcmp(buffer, "C:\\"), "got \"%s\"\n", buffer); - ok(hinst, sz == 3, "got size %u\n", sz); + ok(hinst, sz == 3, "got size %lu\n", sz); sz = 0; r = MsiGetTargetPathW(hinst, L"TARGETDIR", NULL, &sz); ok(hinst, !r, "got %u\n", r); - ok(hinst, sz == 3, "got size %u\n", sz); + ok(hinst, sz == 3, "got size %lu\n", sz); sz = 0; bufferW[0] = 'q'; r = MsiGetTargetPathW(hinst, L"TARGETDIR", bufferW, &sz); ok(hinst, r == ERROR_MORE_DATA, "got %u\n", r); ok(hinst, bufferW[0] == 'q', "got %s\n", dbgstr_w(bufferW)); - ok(hinst, sz == 3, "got size %u\n", sz); + ok(hinst, sz == 3, "got size %lu\n", sz); sz = 1; bufferW[0] = 'q'; r = MsiGetTargetPathW(hinst, L"TARGETDIR", bufferW, &sz); ok(hinst, r == ERROR_MORE_DATA, "got %u\n", r); ok(hinst, !bufferW[0], "got %s\n", dbgstr_w(bufferW)); - ok(hinst, sz == 3, "got size %u\n", sz); + ok(hinst, sz == 3, "got size %lu\n", sz); sz = 3; bufferW[0] = 'q'; r = MsiGetTargetPathW(hinst, L"TARGETDIR", bufferW, &sz); ok(hinst, r == ERROR_MORE_DATA, "got %u\n", r); ok(hinst, !lstrcmpW(bufferW, L"C:"), "got %s\n", dbgstr_w(bufferW)); - ok(hinst, sz == 3, "got size %u\n", sz); + ok(hinst, sz == 3, "got size %lu\n", sz); sz = 4; bufferW[0] = 'q'; r = MsiGetTargetPathW(hinst, L"TARGETDIR", bufferW, &sz); ok(hinst, !r, "got %u\n", r); ok(hinst, !lstrcmpW(bufferW, L"C:\\"), "got %s\n", dbgstr_w(bufferW)); - ok(hinst, sz == 3, "got size %u\n", sz); + ok(hinst, sz == 3, "got size %lu\n", sz); r = MsiSetTargetPathA(hinst, NULL, "C:\\subdir"); ok(hinst, r == ERROR_INVALID_PARAMETER, "got %u\n", r); @@ -681,68 +691,68 @@ static void test_targetpath(MSIHANDLE hinst) sz = 0; r = MsiGetSourcePathA(hinst, "TARGETDIR", NULL, &sz); ok(hinst, !r, "got %u\n", r); - ok(hinst, sz == srcsz * 2, "got size %u\n", sz); + ok(hinst, sz == srcsz * 2, "got size %lu\n", sz); sz = 0; strcpy(buffer,"q"); r = MsiGetSourcePathA(hinst, "TARGETDIR", buffer, &sz); ok(hinst, r == ERROR_MORE_DATA, "got %u\n", r); ok(hinst, !strcmp(buffer, "q"), "got \"%s\"\n", buffer); - ok(hinst, sz == srcsz * 2, "got size %u\n", sz); + ok(hinst, sz == srcsz * 2, "got size %lu\n", sz); sz = 1; strcpy(buffer,"x"); r = MsiGetSourcePathA(hinst, "TARGETDIR", buffer, &sz); ok(hinst, r == ERROR_MORE_DATA, "got %u\n", r); ok(hinst, !buffer[0], "got \"%s\"\n", buffer); - ok(hinst, sz == srcsz * 2, "got size %u\n", sz); + ok(hinst, sz == srcsz * 2, "got size %lu\n", sz); sz = srcsz; strcpy(buffer,"x"); r = MsiGetSourcePathA(hinst, "TARGETDIR", buffer, &sz); ok(hinst, r == ERROR_MORE_DATA, "got %u\n", r); - ok(hinst, strlen(buffer) == srcsz - 1, "wrong buffer length %d\n", strlen(buffer)); - ok(hinst, sz == srcsz * 2, "got size %u\n", sz); + ok(hinst, strlen(buffer) == srcsz - 1, "wrong buffer length %Iu\n", strlen(buffer)); + ok(hinst, sz == srcsz * 2, "got size %lu\n", sz); sz = srcsz + 1; strcpy(buffer,"x"); r = MsiGetSourcePathA(hinst, "TARGETDIR", buffer, &sz); ok(hinst, !r, "got %u\n", r); - ok(hinst, strlen(buffer) == srcsz, "wrong buffer length %d\n", strlen(buffer)); - ok(hinst, sz == srcsz, "got size %u\n", sz); + ok(hinst, strlen(buffer) == srcsz, "wrong buffer length %Iu\n", strlen(buffer)); + ok(hinst, sz == srcsz, "got size %lu\n", sz); sz = 0; r = MsiGetSourcePathW(hinst, L"TARGETDIR", NULL, &sz); ok(hinst, !r, "got %u\n", r); - ok(hinst, sz == srcsz, "got size %u\n", sz); + ok(hinst, sz == srcsz, "got size %lu\n", sz); sz = 0; bufferW[0] = 'q'; r = MsiGetSourcePathW(hinst, L"TARGETDIR", bufferW, &sz); ok(hinst, r == ERROR_MORE_DATA, "got %u\n", r); ok(hinst, bufferW[0] == 'q', "got %s\n", dbgstr_w(bufferW)); - ok(hinst, sz == srcsz, "got size %u\n", sz); + ok(hinst, sz == srcsz, "got size %lu\n", sz); sz = 1; bufferW[0] = 'q'; r = MsiGetSourcePathW(hinst, L"TARGETDIR", bufferW, &sz); ok(hinst, r == ERROR_MORE_DATA, "got %u\n", r); ok(hinst, !bufferW[0], "got %s\n", dbgstr_w(bufferW)); - ok(hinst, sz == srcsz, "got size %u\n", sz); + ok(hinst, sz == srcsz, "got size %lu\n", sz); sz = srcsz; bufferW[0] = 'q'; r = MsiGetSourcePathW(hinst, L"TARGETDIR", bufferW, &sz); ok(hinst, r == ERROR_MORE_DATA, "got %u\n", r); ok(hinst, lstrlenW(bufferW) == srcsz - 1, "wrong buffer length %d\n", lstrlenW(bufferW)); - ok(hinst, sz == srcsz, "got size %u\n", sz); + ok(hinst, sz == srcsz, "got size %lu\n", sz); sz = srcsz + 1; bufferW[0] = 'q'; r = MsiGetSourcePathW(hinst, L"TARGETDIR", bufferW, &sz); ok(hinst, !r, "got %u\n", r); ok(hinst, lstrlenW(bufferW) == srcsz, "wrong buffer length %d\n", lstrlenW(bufferW)); - ok(hinst, sz == srcsz, "got size %u\n", sz); + ok(hinst, sz == srcsz, "got size %lu\n", sz); } static void test_misc(MSIHANDLE hinst) @@ -886,35 +896,35 @@ static void test_format_record(MSIHANDLE hinst) sz = 0; r = MsiFormatRecordA(hinst, rec, NULL, &sz); ok(hinst, !r, "got %u\n", r); - ok(hinst, sz == 14, "got size %u\n", sz); + ok(hinst, sz == 14, "got size %lu\n", sz); sz = 0; strcpy(buffer,"q"); r = MsiFormatRecordA(hinst, rec, buffer, &sz); ok(hinst, r == ERROR_MORE_DATA, "got %u\n", r); ok(hinst, !strcmp(buffer, "q"), "got \"%s\"\n", buffer); - ok(hinst, sz == 14, "got size %u\n", sz); + ok(hinst, sz == 14, "got size %lu\n", sz); sz = 1; strcpy(buffer,"x"); r = MsiFormatRecordA(hinst, rec, buffer, &sz); ok(hinst, r == ERROR_MORE_DATA, "got %u\n", r); ok(hinst, !buffer[0], "got \"%s\"\n", buffer); - ok(hinst, sz == 14, "got size %u\n", sz); + ok(hinst, sz == 14, "got size %lu\n", sz); sz = 7; strcpy(buffer,"x"); r = MsiFormatRecordA(hinst, rec, buffer, &sz); ok(hinst, r == ERROR_MORE_DATA, "got %u\n", r); ok(hinst, !strcmp(buffer, "foo 12"), "got \"%s\"\n", buffer); - ok(hinst, sz == 14, "got size %u\n", sz); + ok(hinst, sz == 14, "got size %lu\n", sz); sz = 8; strcpy(buffer,"x"); r = MsiFormatRecordA(hinst, rec, buffer, &sz); ok(hinst, !r, "got %u\n", r); ok(hinst, !strcmp(buffer, "foo 123"), "got \"%s\"\n", buffer); - ok(hinst, sz == 7, "got size %u\n", sz); + ok(hinst, sz == 7, "got size %lu\n", sz); r = MsiFormatRecordW(hinst, rec, NULL, NULL); ok(hinst, !r, "got %u\n", r); @@ -925,35 +935,35 @@ static void test_format_record(MSIHANDLE hinst) sz = 0; r = MsiFormatRecordW(hinst, rec, NULL, &sz); ok(hinst, !r, "got %u\n", r); - ok(hinst, sz == 7, "got size %u\n", sz); + ok(hinst, sz == 7, "got size %lu\n", sz); sz = 0; bufferW[0] = 'q'; r = MsiFormatRecordW(hinst, rec, bufferW, &sz); ok(hinst, r == ERROR_MORE_DATA, "got %u\n", r); ok(hinst, bufferW[0] == 'q', "got %s\n", dbgstr_w(bufferW)); - ok(hinst, sz == 7, "got size %u\n", sz); + ok(hinst, sz == 7, "got size %lu\n", sz); sz = 1; bufferW[0] = 'q'; r = MsiFormatRecordW(hinst, rec, bufferW, &sz); ok(hinst, r == ERROR_MORE_DATA, "got %u\n", r); ok(hinst, !bufferW[0], "got %s\n", dbgstr_w(bufferW)); - ok(hinst, sz == 7, "got size %u\n", sz); + ok(hinst, sz == 7, "got size %lu\n", sz); sz = 7; bufferW[0] = 'q'; r = MsiFormatRecordW(hinst, rec, bufferW, &sz); ok(hinst, r == ERROR_MORE_DATA, "got %u\n", r); ok(hinst, !lstrcmpW(bufferW, L"foo 12"), "got %s\n", dbgstr_w(bufferW)); - ok(hinst, sz == 7, "got size %u\n", sz); + ok(hinst, sz == 7, "got size %lu\n", sz); sz = 8; bufferW[0] = 'q'; r = MsiFormatRecordW(hinst, rec, bufferW, &sz); ok(hinst, !r, "got %u\n", r); ok(hinst, !lstrcmpW(bufferW, L"foo 123"), "got %s\n", dbgstr_w(bufferW)); - ok(hinst, sz == 7, "got size %u\n", sz); + ok(hinst, sz == 7, "got size %lu\n", sz); /* check that properties work */ MsiSetPropertyA(hinst, "fmtprop", "foobar"); @@ -962,7 +972,7 @@ static void test_format_record(MSIHANDLE hinst) r = MsiFormatRecordA(hinst, rec, buffer, &sz); ok(hinst, !r, "got %u\n", r); ok(hinst, !strcmp(buffer, "foobar"), "got \"%s\"\n", buffer); - ok(hinst, sz == 6, "got size %u\n", sz); + ok(hinst, sz == 6, "got size %lu\n", sz); MsiCloseHandle(rec); } @@ -993,7 +1003,7 @@ static void test_costs(MSIHANDLE hinst) sz = cost = temp = 0xdead; r = MsiEnumComponentCostsA(hinst, "One", 0, INSTALLSTATE_LOCAL, NULL, &sz, &cost, &temp); ok(hinst, r == ERROR_INVALID_PARAMETER, "got %u\n", r); - ok(hinst, sz == 0xdead, "got size %d\n", sz); + ok(hinst, sz == 0xdead, "got size %lu\n", sz); ok(hinst, cost == 0xdead, "got cost %d\n", cost); ok(hinst, temp == 0xdead, "got temp %d\n", temp); @@ -1006,20 +1016,20 @@ static void test_costs(MSIHANDLE hinst) sz = temp = 0xdead; r = MsiEnumComponentCostsA(hinst, "One", 0, INSTALLSTATE_LOCAL, buffer, &sz, NULL, &temp); ok(hinst, r == ERROR_INVALID_PARAMETER, "got %u\n", r); - ok(hinst, sz == 0xdead, "got size %d\n", sz); + ok(hinst, sz == 0xdead, "got size %lu\n", sz); ok(hinst, temp == 0xdead, "got temp %d\n", temp); sz = cost = 0xdead; r = MsiEnumComponentCostsA(hinst, "One", 0, INSTALLSTATE_LOCAL, buffer, &sz, &cost, NULL); ok(hinst, r == ERROR_INVALID_PARAMETER, "got %u\n", r); - ok(hinst, sz == 0xdead, "got size %d\n", sz); + ok(hinst, sz == 0xdead, "got size %lu\n", sz); ok(hinst, cost == 0xdead, "got cost %d\n", cost); cost = temp = 0xdead; sz = sizeof(buffer); r = MsiEnumComponentCostsA(hinst, NULL, 0, INSTALLSTATE_LOCAL, buffer, &sz, &cost, &temp); ok(hinst, !r, "got %u\n", r); - ok(hinst, sz == 2, "got size %u\n", sz); + ok(hinst, sz == 2, "got size %lu\n", sz); ok(hinst, !strcmp(buffer, "C:"), "got '%s'\n", buffer); ok(hinst, !cost, "got cost %d\n", cost); ok(hinst, temp && temp != 0xdead, "got temp %d\n", temp); @@ -1028,7 +1038,7 @@ static void test_costs(MSIHANDLE hinst) sz = sizeof(buffer); r = MsiEnumComponentCostsA(hinst, "One", 0, INSTALLSTATE_LOCAL, buffer, &sz, &cost, &temp); ok(hinst, !r, "got %u\n", r); - ok(hinst, sz == 2, "got size %u\n", sz); + ok(hinst, sz == 2, "got size %lu\n", sz); ok(hinst, !strcmp(buffer, "C:"), "got '%s'\n", buffer); ok(hinst, cost == 8, "got cost %d\n", cost); ok(hinst, !temp, "got temp %d\n", temp); @@ -1041,7 +1051,7 @@ static void test_costs(MSIHANDLE hinst) 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); + ok(hinst, sz == 4, "got size %lu\n", sz); ok(hinst, cost == 8, "got cost %d\n", cost); ok(hinst, !temp, "got temp %d\n", temp); @@ -1051,7 +1061,7 @@ static void test_costs(MSIHANDLE hinst) ok(hinst, r == ERROR_MORE_DATA, "got %u\n", r); todo_wine { ok(hinst, !buffer[0], "got \"%s\"\n", buffer); - ok(hinst, sz == 4, "got size %u\n", sz); + ok(hinst, sz == 4, "got size %lu\n", sz); } sz = 2; @@ -1060,7 +1070,7 @@ static void test_costs(MSIHANDLE hinst) ok(hinst, r == ERROR_MORE_DATA, "got %u\n", r); todo_wine { ok(hinst, !strcmp(buffer, "C"), "got \"%s\"\n", buffer); - ok(hinst, sz == 4, "got size %u\n", sz); + ok(hinst, sz == 4, "got size %lu\n", sz); } sz = 3; @@ -1068,35 +1078,35 @@ static void test_costs(MSIHANDLE hinst) r = MsiEnumComponentCostsA(hinst, "One", 0, INSTALLSTATE_LOCAL, buffer, &sz, &cost, &temp); ok(hinst, !r, "got %u\n", r); ok(hinst, !strcmp(buffer, "C:"), "got \"%s\"\n", buffer); - ok(hinst, sz == 2, "got size %u\n", sz); + ok(hinst, sz == 2, "got size %lu\n", sz); sz = 0; bufferW[0] = 'q'; r = MsiEnumComponentCostsW(hinst, L"One", 0, INSTALLSTATE_LOCAL, bufferW, &sz, &cost, &temp); ok(hinst, r == ERROR_MORE_DATA, "got %u\n", r); ok(hinst, bufferW[0] == 'q', "got %s\n", dbgstr_w(bufferW)); - ok(hinst, sz == 2, "got size %u\n", sz); + ok(hinst, sz == 2, "got size %lu\n", sz); sz = 1; bufferW[0] = 'q'; r = MsiEnumComponentCostsW(hinst, L"One", 0, INSTALLSTATE_LOCAL, bufferW, &sz, &cost, &temp); ok(hinst, r == ERROR_MORE_DATA, "got %u\n", r); ok(hinst, !bufferW[0], "got %s\n", dbgstr_w(bufferW)); - ok(hinst, sz == 2, "got size %u\n", sz); + ok(hinst, sz == 2, "got size %lu\n", sz); sz = 2; bufferW[0] = 'q'; r = MsiEnumComponentCostsW(hinst, L"One", 0, INSTALLSTATE_LOCAL, bufferW, &sz, &cost, &temp); ok(hinst, r == ERROR_MORE_DATA, "got %u\n", r); ok(hinst, !lstrcmpW(bufferW, L"C"), "got %s\n", dbgstr_w(bufferW)); - ok(hinst, sz == 2, "got size %u\n", sz); + ok(hinst, sz == 2, "got size %lu\n", sz); sz = 3; bufferW[0] = 'q'; r = MsiEnumComponentCostsW(hinst, L"One", 0, INSTALLSTATE_LOCAL, bufferW, &sz, &cost, &temp); ok(hinst, !r, "got %u\n", r); ok(hinst, !lstrcmpW(bufferW, L"C:"), "got %s\n", dbgstr_w(bufferW)); - ok(hinst, sz == 2, "got size %u\n", sz); + ok(hinst, sz == 2, "got size %lu\n", sz); } static void test_invalid_functions(MSIHANDLE hinst) @@ -1118,9 +1128,7 @@ static void test_invalid_functions(MSIHANDLE hinst) ok(hinst, r == ERROR_INVALID_HANDLE, "got %u\n", r); r = MsiCreateTransformSummaryInfoA(db, db, "bogus.mst", 0, 0); - todo_wine ok(hinst, r == ERROR_INSTALL_PACKAGE_OPEN_FAILED || - r == ERROR_INSTALL_PACKAGE_INVALID /* winxp */, - "got %u\n", r); + todo_wine ok(hinst, r == ERROR_INSTALL_PACKAGE_OPEN_FAILED, "got %u\n", r); GetCurrentDirectoryA(sizeof(path), path); r = MsiDatabaseExportA(db, "Test", path, "bogus.idt"); @@ -1168,7 +1176,7 @@ static void test_view_get_error(MSIHANDLE hinst) sz = 0; err = MsiViewGetErrorA(0, NULL, &sz); todo_wine ok(hinst, err == MSIDBERROR_FUNCTIONERROR, "got %d\n", err); - ok(hinst, sz == 0, "got size %u\n", sz); + ok(hinst, sz == 0, "got size %lu\n", sz); err = MsiViewGetErrorA(view, NULL, NULL); ok(hinst, err == MSIDBERROR_INVALIDARG, "got %d\n", err); @@ -1176,21 +1184,21 @@ static void test_view_get_error(MSIHANDLE hinst) sz = 0; err = MsiViewGetErrorA(view, NULL, &sz); ok(hinst, err == MSIDBERROR_FUNCTIONERROR, "got %d\n", err); - ok(hinst, sz == 0, "got size %u\n", sz); + ok(hinst, sz == 0, "got size %lu\n", sz); sz = 0; strcpy(buffer, "x"); err = MsiViewGetErrorA(view, buffer, &sz); ok(hinst, err == MSIDBERROR_FUNCTIONERROR, "got %d\n", err); ok(hinst, !strcmp(buffer, "x"), "got \"%s\"\n", buffer); - ok(hinst, sz == 0, "got size %u\n", sz); + ok(hinst, sz == 0, "got size %lu\n", sz); sz = 1; strcpy(buffer, "x"); err = MsiViewGetErrorA(view, buffer, &sz); ok(hinst, err == MSIDBERROR_NOERROR, "got %d\n", err); ok(hinst, !buffer[0], "got \"%s\"\n", buffer); - ok(hinst, sz == 0, "got size %u\n", sz); + ok(hinst, sz == 0, "got size %lu\n", sz); rec = MsiCreateRecord(2); MsiRecordSetInteger(rec, 1, 1); @@ -1203,14 +1211,14 @@ static void test_view_get_error(MSIHANDLE hinst) err = MsiViewGetErrorA(view, buffer, &sz); ok(hinst, err == MSIDBERROR_DUPLICATEKEY, "got %d\n", err); ok(hinst, !strcmp(buffer, "A"), "got \"%s\"\n", buffer); - ok(hinst, sz == 1, "got size %u\n", sz); + ok(hinst, sz == 1, "got size %lu\n", sz); sz = 2; strcpy(buffer, "x"); err = MsiViewGetErrorA(view, buffer, &sz); todo_wine ok(hinst, err == MSIDBERROR_NOERROR, "got %d\n", err); todo_wine ok(hinst, !buffer[0], "got \"%s\"\n", buffer); - todo_wine ok(hinst, sz == 0, "got size %u\n", sz); + todo_wine ok(hinst, sz == 0, "got size %lu\n", sz); r = MsiViewModify(view, MSIMODIFY_VALIDATE_NEW, rec); ok(hinst, r == ERROR_INVALID_DATA, "got %u\n", r); @@ -1220,14 +1228,14 @@ static void test_view_get_error(MSIHANDLE hinst) err = MsiViewGetErrorA(view, buffer, &sz); ok(hinst, err == MSIDBERROR_MOREDATA, "got %d\n", err); ok(hinst, !buffer[0], "got \"%s\"\n", buffer); - ok(hinst, sz == 1, "got size %u\n", sz); + ok(hinst, sz == 1, "got size %lu\n", sz); sz = 1; strcpy(buffer, "x"); err = MsiViewGetErrorA(view, buffer, &sz); todo_wine ok(hinst, err == MSIDBERROR_NOERROR, "got %d\n", err); ok(hinst, !buffer[0], "got \"%s\"\n", buffer); - todo_wine ok(hinst, sz == 0, "got size %u\n", sz); + todo_wine ok(hinst, sz == 0, "got size %lu\n", sz); r = MsiViewModify(view, MSIMODIFY_VALIDATE_NEW, rec); ok(hinst, r == ERROR_INVALID_DATA, "got %u\n", r); @@ -1237,14 +1245,14 @@ static void test_view_get_error(MSIHANDLE hinst) err = MsiViewGetErrorA(view, buffer, &sz); ok(hinst, err == MSIDBERROR_FUNCTIONERROR, "got %d\n", err); ok(hinst, !strcmp(buffer, "x"), "got \"%s\"\n", buffer); - ok(hinst, sz == 0, "got size %u\n", sz); + ok(hinst, sz == 0, "got size %lu\n", sz); sz = 0; strcpy(buffer, "x"); err = MsiViewGetErrorA(view, buffer, &sz); ok(hinst, err == MSIDBERROR_FUNCTIONERROR, "got %d\n", err); ok(hinst, !strcmp(buffer, "x"), "got \"%s\"\n", buffer); - ok(hinst, sz == 0, "got size %u\n", sz); + ok(hinst, sz == 0, "got size %lu\n", sz); MsiCloseHandle(rec); MsiCloseHandle(view); @@ -1260,13 +1268,13 @@ UINT WINAPI main_test(MSIHANDLE hinst) /* Test for an MTA apartment */ hr = CoCreateInstance(&CLSID_XMLDocument, NULL, CLSCTX_INPROC_SERVER, &IID_IUnknown, (void **)&unk); - ok(hinst, hr == S_OK, "CoCreateInstance failed with %08x\n", hr); + ok(hinst, hr == S_OK, "CoCreateInstance failed with %08lx\n", hr); if (unk) IUnknown_Release(unk); /* but ours is uninitialized */ hr = CoInitializeEx(NULL, COINIT_APARTMENTTHREADED); - ok(hinst, hr == S_OK, "got %#x\n", hr); + ok(hinst, hr == S_OK, "got %#lx\n", hr); CoUninitialize(); test_props(hinst); @@ -1298,7 +1306,7 @@ static void append_file(MSIHANDLE hinst, const char *filename, const char *text) { DWORD size; HANDLE file = CreateFileA(filename, GENERIC_WRITE, 0, NULL, OPEN_EXISTING, 0, NULL); - ok(hinst, file != INVALID_HANDLE_VALUE, "CreateFile failed, error %u\n", GetLastError()); + ok(hinst, file != INVALID_HANDLE_VALUE, "CreateFile failed, error %lu\n", GetLastError()); SetFilePointer(file, 0, NULL, FILE_END); WriteFile(file, text, strlen(text), &size, NULL); @@ -1376,7 +1384,7 @@ UINT WINAPI process2(MSIHANDLE hinst) { char env[2] = {0}; DWORD r = GetEnvironmentVariableA("MSI_PROCESS_TEST", env, sizeof(env)); - ok(hinst, r == 1, "got %d, error %u\n", r, GetLastError()); + ok(hinst, r == 1, "got %lu, error %lu\n", r, GetLastError()); ok(hinst, !strcmp(env, "1"), "got %s\n", env); ok(hinst, !global_state, "got global_state %d\n", global_state); return ERROR_SUCCESS; @@ -1461,7 +1469,7 @@ UINT WINAPI sds_present(MSIHANDLE hinst) SC_HANDLE manager, service; manager = OpenSCManagerA(NULL, NULL, SC_MANAGER_ALL_ACCESS); service = OpenServiceA(manager, "TestService3", GENERIC_ALL); - ok(hinst, !!service, "service absent: %u\n", GetLastError()); + ok(hinst, !!service, "service absent: %lu\n", GetLastError()); CloseServiceHandle(service); CloseServiceHandle(manager); return ERROR_SUCCESS; @@ -1483,7 +1491,7 @@ UINT WINAPI sis_present(MSIHANDLE hinst) SC_HANDLE manager, service; manager = OpenSCManagerA(NULL, NULL, SC_MANAGER_ALL_ACCESS); service = OpenServiceA(manager, "TestService", GENERIC_ALL); - ok(hinst, !!service, "service absent: %u\n", GetLastError()); + ok(hinst, !!service, "service absent: %lu\n", GetLastError()); CloseServiceHandle(service); CloseServiceHandle(manager); return ERROR_SUCCESS; @@ -1509,8 +1517,8 @@ UINT WINAPI sss_started(MSIHANDLE hinst) manager = OpenSCManagerA(NULL, NULL, SC_MANAGER_ALL_ACCESS); service = OpenServiceA(manager, "Spooler", SC_MANAGER_ALL_ACCESS); ret = QueryServiceStatus(service, &status); - ok(hinst, ret, "QueryServiceStatus failed: %u\n", GetLastError()); - ok(hinst, status.dwCurrentState == SERVICE_RUNNING, "got %u\n", status.dwCurrentState); + ok(hinst, ret, "QueryServiceStatus failed: %lu\n", GetLastError()); + ok(hinst, status.dwCurrentState == SERVICE_RUNNING, "got %lu\n", status.dwCurrentState); CloseServiceHandle(service); CloseServiceHandle(manager); @@ -1526,8 +1534,8 @@ UINT WINAPI sss_stopped(MSIHANDLE hinst) manager = OpenSCManagerA(NULL, NULL, SC_MANAGER_ALL_ACCESS); service = OpenServiceA(manager, "Spooler", SC_MANAGER_ALL_ACCESS); ret = QueryServiceStatus(service, &status); - ok(hinst, ret, "QueryServiceStatus failed: %u\n", GetLastError()); - ok(hinst, status.dwCurrentState == SERVICE_STOPPED, "got %u\n", status.dwCurrentState); + ok(hinst, ret, "QueryServiceStatus failed: %lu\n", GetLastError()); + ok(hinst, status.dwCurrentState == SERVICE_STOPPED, "got %lu\n", status.dwCurrentState); CloseServiceHandle(service); CloseServiceHandle(manager); @@ -1622,12 +1630,12 @@ static void check_reg_str(MSIHANDLE hinst, HKEY key, const char *name, const cha res = RegQueryValueExA(key, name, NULL, NULL, (BYTE *)value, &sz); if (expect) { - ok(hinst, !res, "failed to get value \"%s\": %d\n", name, res); + ok(hinst, !res, "failed to get value \"%s\": %ld\n", name, res); ok(hinst, !strcmp(value, expect), "\"%s\": expected \"%s\", got \"%s\"\n", name, expect, value); } else - ok(hinst, res == ERROR_FILE_NOT_FOUND, "\"%s\": expected missing, got %u\n", + ok(hinst, res == ERROR_FILE_NOT_FOUND, "\"%s\": expected missing, got %ld\n", name, res); } @@ -1641,7 +1649,7 @@ UINT WINAPI pa_present(MSIHANDLE hinst) LONG res; res = RegOpenKeyA(HKEY_CURRENT_USER, path_dotnet, &key); - ok(hinst, !res, "got %d\n", res); + ok(hinst, !res, "got %ld\n", res); check_reg_str(hinst, key, name_dotnet, "rcHQPHq?CA@Uv-XqMI1e>Z'q,T*76M@=YEg6My?~]"); RegCloseKey(key); @@ -1654,7 +1662,7 @@ UINT WINAPI pa_absent(MSIHANDLE hinst) LONG res; res = RegOpenKeyA(HKEY_CURRENT_USER, path_dotnet, &key); - ok(hinst, !res || res == ERROR_FILE_NOT_FOUND, "got %d\n", res); + ok(hinst, !res || res == ERROR_FILE_NOT_FOUND, "got %ld\n", res); if (!res) { check_reg_str(hinst, key, name_dotnet, NULL); @@ -1702,9 +1710,9 @@ UINT WINAPI pub_present(MSIHANDLE hinst) LONG res; res = RegOpenKeyA(HKEY_CURRENT_USER, pub_key, &key); - ok(hinst, !res, "got %u\n", res); + ok(hinst, !res, "got %ld\n", res); res = RegQueryValueExA(key, "english.txt", NULL, NULL, NULL, NULL); - ok(hinst, !res, "got %u\n", res); + ok(hinst, !res, "got %ld\n", res); RegCloseKey(key); return ERROR_SUCCESS; } @@ -1715,7 +1723,7 @@ UINT WINAPI pub_absent(MSIHANDLE hinst) LONG res; res = RegOpenKeyA(HKEY_CURRENT_USER, pub_key, &key); - ok(hinst, res == ERROR_FILE_NOT_FOUND, "got %u\n", res); + ok(hinst, res == ERROR_FILE_NOT_FOUND, "got %ld\n", res); return ERROR_SUCCESS; } @@ -1729,13 +1737,13 @@ UINT WINAPI pf_present(MSIHANDLE hinst) LONG res; res = RegOpenKeyExA(HKEY_CLASSES_ROOT, pf_classkey, 0, KEY_READ | KEY_WOW64_64KEY, &key); - ok(hinst, !res, "got %u\n", res); + ok(hinst, !res, "got %ld\n", res); check_reg_str(hinst, key, "feature", ""); check_reg_str(hinst, key, "montecristo", ""); RegCloseKey(key); res = RegOpenKeyExA(HKEY_LOCAL_MACHINE, pf_userkey, 0, KEY_READ | KEY_WOW64_64KEY, &key); - ok(hinst, !res, "got %u\n", res); + ok(hinst, !res, "got %ld\n", res); check_reg_str(hinst, key, "feature", "VGtfp^p+,?82@JU1j_KE"); check_reg_str(hinst, key, "montecristo", "VGtfp^p+,?82@JU1j_KE"); RegCloseKey(key); @@ -1749,10 +1757,10 @@ UINT WINAPI pf_absent(MSIHANDLE hinst) LONG res; res = RegOpenKeyExA(HKEY_CLASSES_ROOT, pf_classkey, 0, KEY_READ | KEY_WOW64_64KEY, &key); - ok(hinst, res == ERROR_FILE_NOT_FOUND, "got %u\n", res); + ok(hinst, res == ERROR_FILE_NOT_FOUND, "got %ld\n", res); res = RegOpenKeyExA(HKEY_LOCAL_MACHINE, pf_userkey, 0, KEY_READ | KEY_WOW64_64KEY, &key); - ok(hinst, res == ERROR_FILE_NOT_FOUND, "got %u\n", res); + ok(hinst, res == ERROR_FILE_NOT_FOUND, "got %ld\n", res); return ERROR_SUCCESS; } @@ -1765,7 +1773,7 @@ UINT WINAPI pp_present(MSIHANDLE hinst) LONG res; res = RegOpenKeyExA(HKEY_CLASSES_ROOT, pp_prodkey, 0, KEY_READ | KEY_WOW64_64KEY, &key); - ok(hinst, !res, "got %u\n", res); + ok(hinst, !res, "got %ld\n", res); check_reg_str(hinst, key, "ProductName", "MSITEST"); check_reg_str(hinst, key, "PackageCode", "AC75740029052C94DA02821EECD05F2F"); check_reg_str(hinst, key, "Clients", ":"); @@ -1780,7 +1788,7 @@ UINT WINAPI pp_absent(MSIHANDLE hinst) LONG res; res = RegOpenKeyExA(HKEY_CLASSES_ROOT, pp_prodkey, 0, KEY_READ | KEY_WOW64_64KEY, &key); - ok(hinst, res == ERROR_FILE_NOT_FOUND, "got %u\n", res); + ok(hinst, res == ERROR_FILE_NOT_FOUND, "got %ld\n", res); return ERROR_SUCCESS; } @@ -1792,15 +1800,15 @@ UINT WINAPI rci_present(MSIHANDLE hinst) res = RegOpenKeyExA(HKEY_CLASSES_ROOT, "CLSID\\{110913E7-86D1-4BF3-9922-BA103FCDDDFA}", 0, KEY_READ | KEY_WOW64_32KEY, &key); - ok(hinst, !res, "got %u\n", res); + ok(hinst, !res, "got %ld\n", res); RegCloseKey(key); res = RegOpenKeyA(HKEY_CLASSES_ROOT, "FileType\\{110913E7-86D1-4BF3-9922-BA103FCDDDFA}", &key); - ok(hinst, !res, "got %u\n", res); + ok(hinst, !res, "got %ld\n", res); RegCloseKey(key); res = RegOpenKeyA(HKEY_CLASSES_ROOT, "AppID\\{CFCC3B38-E683-497D-9AB4-CB40AAFE307F}", &key); - ok(hinst, !res, "got %u\n", res); + ok(hinst, !res, "got %ld\n", res); RegCloseKey(key); return ERROR_SUCCESS; @@ -1813,13 +1821,13 @@ UINT WINAPI rci_absent(MSIHANDLE hinst) res = RegOpenKeyExA(HKEY_CLASSES_ROOT, "CLSID\\{110913E7-86D1-4BF3-9922-BA103FCDDDFA}", 0, KEY_READ | KEY_WOW64_32KEY, &key); - ok(hinst, res == ERROR_FILE_NOT_FOUND, "got %u\n", res); + ok(hinst, res == ERROR_FILE_NOT_FOUND, "got %ld\n", res); res = RegOpenKeyA(HKEY_CLASSES_ROOT, "FileType\\{110913E7-86D1-4BF3-9922-BA103FCDDDFA}", &key); - ok(hinst, res == ERROR_FILE_NOT_FOUND, "got %u\n", res); + ok(hinst, res == ERROR_FILE_NOT_FOUND, "got %ld\n", res); res = RegOpenKeyA(HKEY_CLASSES_ROOT, "AppID\\{CFCC3B38-E683-497D-9AB4-CB40AAFE307F}", &key); - ok(hinst, res == ERROR_FILE_NOT_FOUND, "got %u\n", res); + ok(hinst, res == ERROR_FILE_NOT_FOUND, "got %ld\n", res); return ERROR_SUCCESS; } @@ -1830,11 +1838,11 @@ UINT WINAPI rei_present(MSIHANDLE hinst) LONG res; res = RegOpenKeyA(HKEY_CLASSES_ROOT, ".extension", &key); - ok(hinst, !res, "got %u\n", res); + ok(hinst, !res, "got %ld\n", res); RegCloseKey(key); res = RegOpenKeyA(HKEY_CLASSES_ROOT, "Prog.Id.1\\shell\\Open\\command", &key); - ok(hinst, !res, "got %u\n", res); + ok(hinst, !res, "got %ld\n", res); RegCloseKey(key); return ERROR_SUCCESS; @@ -1846,10 +1854,10 @@ UINT WINAPI rei_absent(MSIHANDLE hinst) LONG res; res = RegOpenKeyA(HKEY_CLASSES_ROOT, ".extension", &key); - ok(hinst, res == ERROR_FILE_NOT_FOUND, "got %u\n", res); + ok(hinst, res == ERROR_FILE_NOT_FOUND, "got %ld\n", res); res = RegOpenKeyA(HKEY_CLASSES_ROOT, "Prog.Id.1\\shell\\Open\\command", &key); - ok(hinst, res == ERROR_FILE_NOT_FOUND, "got %u\n", res); + ok(hinst, res == ERROR_FILE_NOT_FOUND, "got %ld\n", res); return ERROR_SUCCESS; } @@ -1862,9 +1870,9 @@ UINT WINAPI font_present(MSIHANDLE hinst) LONG res; res = RegOpenKeyExA(HKEY_LOCAL_MACHINE, font_key, 0, KEY_QUERY_VALUE | KEY_WOW64_64KEY, &key); - ok(hinst, !res, "got %u\n", res); + ok(hinst, !res, "got %ld\n", res); res = RegQueryValueExA(key, "msi test font", NULL, NULL, NULL, NULL); - ok(hinst, !res, "got %u\n", res); + ok(hinst, !res, "got %ld\n", res); RegCloseKey(key); return ERROR_SUCCESS; @@ -1876,7 +1884,7 @@ UINT WINAPI font_absent(MSIHANDLE hinst) LONG res; res = RegOpenKeyExA(HKEY_LOCAL_MACHINE, font_key, 0, KEY_QUERY_VALUE | KEY_WOW64_64KEY, &key); - ok(hinst, !res, "got %u\n", res); + ok(hinst, !res, "got %ld\n", res); check_reg_str(hinst, key, "msi test font", NULL); RegCloseKey(key); @@ -1889,7 +1897,7 @@ UINT WINAPI rmi_present(MSIHANDLE hinst) LONG res; res = RegOpenKeyA(HKEY_CLASSES_ROOT, "MIME\\Database\\Content Type\\mime/type", &key); - ok(hinst, !res, "got %u\n", res); + ok(hinst, !res, "got %ld\n", res); return ERROR_SUCCESS; } @@ -1900,7 +1908,7 @@ UINT WINAPI rmi_absent(MSIHANDLE hinst) LONG res; res = RegOpenKeyA(HKEY_CLASSES_ROOT, "MIME\\Database\\Content Type\\mime/type", &key); - ok(hinst, res == ERROR_FILE_NOT_FOUND, "got %u\n", res); + ok(hinst, res == ERROR_FILE_NOT_FOUND, "got %ld\n", res); return ERROR_SUCCESS; } @@ -1914,7 +1922,7 @@ UINT WINAPI rp_present(MSIHANDLE hinst) LONG res; res = RegOpenKeyExA(HKEY_LOCAL_MACHINE, rp_key, 0, KEY_READ | KEY_WOW64_32KEY, &key); - ok(hinst, !res, "got %u\n", res); + ok(hinst, !res, "got %ld\n", res); check_reg_str(hinst, key, "DisplayName", "MSITEST"); RegCloseKey(key); @@ -1927,7 +1935,7 @@ UINT WINAPI rp_absent(MSIHANDLE hinst) LONG res; res = RegOpenKeyExA(HKEY_LOCAL_MACHINE, rp_key, 0, KEY_READ | KEY_WOW64_32KEY, &key); - ok(hinst, res == ERROR_FILE_NOT_FOUND, "got %u\n", res); + ok(hinst, res == ERROR_FILE_NOT_FOUND, "got %ld\n", res); return ERROR_SUCCESS; } @@ -1939,19 +1947,19 @@ UINT WINAPI rpi_present(MSIHANDLE hinst) res = RegOpenKeyExA(HKEY_CLASSES_ROOT, "CLSID\\{110913E7-86D1-4BF3-9922-BA103FCDDDFA}", 0, KEY_READ | KEY_WOW64_32KEY, &key); - ok(hinst, !res, "got %u\n", res); + ok(hinst, !res, "got %ld\n", res); RegCloseKey(key); res = RegOpenKeyA(HKEY_CLASSES_ROOT, "Winetest.Class.1", &key); - ok(hinst, !res, "got %u\n", res); + ok(hinst, !res, "got %ld\n", res); RegCloseKey(key); res = RegOpenKeyA(HKEY_CLASSES_ROOT, "Winetest.Class", &key); - ok(hinst, !res, "got %u\n", res); + ok(hinst, !res, "got %ld\n", res); RegCloseKey(key); res = RegOpenKeyA(HKEY_CLASSES_ROOT, "Winetest.Class.2", &key); - ok(hinst, !res, "got %u\n", res); + ok(hinst, !res, "got %ld\n", res); RegCloseKey(key); return ERROR_SUCCESS; @@ -1964,16 +1972,16 @@ UINT WINAPI rpi_absent(MSIHANDLE hinst) res = RegOpenKeyExA(HKEY_CLASSES_ROOT, "CLSID\\{110913E7-86D1-4BF3-9922-BA103FCDDDFA}", 0, KEY_READ | KEY_WOW64_32KEY, &key); - ok(hinst, res == ERROR_FILE_NOT_FOUND, "got %u\n", res); + ok(hinst, res == ERROR_FILE_NOT_FOUND, "got %ld\n", res); res = RegOpenKeyA(HKEY_CLASSES_ROOT, "Winetest.Class.1", &key); - ok(hinst, res == ERROR_FILE_NOT_FOUND, "got %u\n", res); + ok(hinst, res == ERROR_FILE_NOT_FOUND, "got %ld\n", res); res = RegOpenKeyA(HKEY_CLASSES_ROOT, "Winetest.Class", &key); - ok(hinst, res == ERROR_FILE_NOT_FOUND, "got %u\n", res); + ok(hinst, res == ERROR_FILE_NOT_FOUND, "got %ld\n", res); res = RegOpenKeyA(HKEY_CLASSES_ROOT, "Winetest.Class.2", &key); - ok(hinst, res == ERROR_FILE_NOT_FOUND, "got %u\n", res); + ok(hinst, res == ERROR_FILE_NOT_FOUND, "got %ld\n", res); return ERROR_SUCCESS; } @@ -1987,7 +1995,7 @@ UINT WINAPI ru_present(MSIHANDLE hinst) LONG res; res = RegOpenKeyExA(HKEY_LOCAL_MACHINE, ru_key, 0, KEY_READ | KEY_WOW64_64KEY, &key); - ok(hinst, !res, "got %u\n", res); + ok(hinst, !res, "got %ld\n", res); check_reg_str(hinst, key, "ProductID", "none"); RegCloseKey(key); @@ -2000,7 +2008,7 @@ UINT WINAPI ru_absent(MSIHANDLE hinst) LONG res; res = RegOpenKeyExA(HKEY_LOCAL_MACHINE, ru_key, 0, KEY_READ | KEY_WOW64_64KEY, &key); - ok(hinst, res == ERROR_FILE_NOT_FOUND, "got %u\n", res); + ok(hinst, res == ERROR_FILE_NOT_FOUND, "got %ld\n", res); return ERROR_SUCCESS; } @@ -2014,7 +2022,7 @@ UINT WINAPI tl_present(MSIHANDLE hinst) HRESULT hr; hr = LoadRegTypeLib(&LIBID_register_test, 7, 1, 0, &tlb); - ok(hinst, hr == S_OK, "got %#x\n", hr); + ok(hinst, hr == S_OK, "got %#lx\n", hr); ITypeLib_Release(tlb); return ERROR_SUCCESS; @@ -2026,7 +2034,7 @@ UINT WINAPI tl_absent(MSIHANDLE hinst) HRESULT hr; hr = LoadRegTypeLib(&LIBID_register_test, 7, 1, 0, &tlb); - ok(hinst, hr == TYPE_E_LIBNOTREGISTERED, "got %#x\n", hr); + ok(hinst, hr == TYPE_E_LIBNOTREGISTERED, "got %#lx\n", hr); return ERROR_SUCCESS; } @@ -2037,7 +2045,7 @@ UINT WINAPI sr_present(MSIHANDLE hinst) LONG res; res = RegOpenKeyA(HKEY_CLASSES_ROOT, "selfreg_test", &key); - ok(hinst, !res, "got %u\n", res); + ok(hinst, !res, "got %ld\n", res); RegCloseKey(key); return ERROR_SUCCESS; @@ -2049,7 +2057,7 @@ UINT WINAPI sr_absent(MSIHANDLE hinst) LONG res; res = RegOpenKeyA(HKEY_CLASSES_ROOT, "selfreg_test", &key); - ok(hinst, res == ERROR_FILE_NOT_FOUND, "got %u\n", res); + ok(hinst, res == ERROR_FILE_NOT_FOUND, "got %ld\n", res); return ERROR_SUCCESS; } @@ -2060,7 +2068,7 @@ UINT WINAPI env_present(MSIHANDLE hinst) LONG res; res = RegOpenKeyA(HKEY_CURRENT_USER, "Environment", &key); - ok(hinst, !res, "got %u\n", res); + ok(hinst, !res, "got %ld\n", res); check_reg_str(hinst, key, "MSITESTVAR3", "1"); check_reg_str(hinst, key, "MSITESTVAR4", "1"); RegCloseKey(key); @@ -2074,7 +2082,7 @@ UINT WINAPI env_absent(MSIHANDLE hinst) LONG res; res = RegOpenKeyA(HKEY_CURRENT_USER, "Environment", &key); - ok(hinst, !res, "got %u\n", res); + ok(hinst, !res, "got %ld\n", res); check_reg_str(hinst, key, "MSITESTVAR3", NULL); check_reg_str(hinst, key, "MSITESTVAR4", NULL); RegCloseKey(key); @@ -2092,7 +2100,7 @@ UINT WINAPI ini_present(MSIHANDLE hinst) strcat(path, "\\msitest\\test.ini"); len = GetPrivateProfileStringA("section1", "key1", NULL, buf, sizeof(buf), path); - ok(hinst, len == 6, "got %u\n", len); + ok(hinst, len == 6, "got %lu\n", len); return ERROR_SUCCESS; } @@ -2107,7 +2115,7 @@ UINT WINAPI ini_absent(MSIHANDLE hinst) strcat(path, "\\msitest\\test.ini"); len = GetPrivateProfileStringA("section1", "key1", NULL, buf, sizeof(buf), path); - ok(hinst, !len, "got %u\n", len); + ok(hinst, !len, "got %lu\n", len); return ERROR_SUCCESS; } @@ -2118,7 +2126,7 @@ UINT WINAPI wrv_present(MSIHANDLE hinst) LONG res; res = RegOpenKeyA(HKEY_CURRENT_USER, "msitest", &key); - ok(hinst, !res, "got %u\n", res); + ok(hinst, !res, "got %ld\n", res); check_reg_str(hinst, key, "sz", "string"); RegCloseKey(key); @@ -2131,7 +2139,7 @@ UINT WINAPI wrv_absent(MSIHANDLE hinst) LONG res; res = RegOpenKeyA(HKEY_CURRENT_USER, "msitest", &key); - ok(hinst, !res, "got %u\n", res); + ok(hinst, !res, "got %ld\n", res); check_reg_str(hinst, key, "sz", NULL); RegCloseKey(key); diff --git a/modules/rostests/winetests/msi/db.c b/modules/rostests/winetests/msi/db.c index 59dcf87a47cad..56fff94c5dfac 100644 --- a/modules/rostests/winetests/msi/db.c +++ b/modules/rostests/winetests/msi/db.c @@ -29,6 +29,7 @@ #include #include "wine/test.h" +#include "utils.h" static const char *msifile = "winetest-db.msi"; static const char *msifile2 = "winetst2-db.msi"; @@ -212,22 +213,6 @@ static UINT do_query(MSIHANDLE hdb, const char *query, MSIHANDLE *phrec) return ret; } -static UINT run_query( MSIHANDLE hdb, MSIHANDLE hrec, const char *query ) -{ - MSIHANDLE hview = 0; - UINT r; - - r = MsiDatabaseOpenViewA(hdb, query, &hview); - if( r != ERROR_SUCCESS ) - return r; - - r = MsiViewExecute(hview, hrec); - if( r == ERROR_SUCCESS ) - r = MsiViewClose(hview); - MsiCloseHandle(hview); - return r; -} - static UINT run_queryW( MSIHANDLE hdb, MSIHANDLE hrec, const WCHAR *query ) { MSIHANDLE hview = 0; @@ -1502,29 +1487,6 @@ static void test_longstrings(void) DeleteFileA(msifile); } -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); - WriteFile(file, "\n", strlen("\n"), &written, NULL); - - if (size) - { - SetFilePointer(file, size, NULL, FILE_BEGIN); - SetEndOfFile(file); - } - - CloseHandle(file); -} - -#define create_file(name) create_file_data(name, name, 0) - static void test_streamtable(void) { MSIHANDLE hdb = 0, rec, view, hsi; @@ -1607,7 +1569,7 @@ static void test_streamtable(void) MsiCloseHandle( view ); /* insert a file into the _Streams table */ - create_file( "test.txt" ); + create_file( "test.txt", 0 ); rec = MsiCreateRecord( 2 ); MsiRecordSetStringA( rec, 1, "data" ); @@ -1629,7 +1591,7 @@ static void test_streamtable(void) MsiCloseHandle( view ); /* insert another one */ - create_file( "test1.txt" ); + create_file( "test1.txt", 0 ); rec = MsiCreateRecord( 2 ); MsiRecordSetStringA( rec, 1, "data1" ); @@ -1651,7 +1613,7 @@ static void test_streamtable(void) MsiCloseHandle( view ); /* try again */ - create_file( "test1.txt" ); + create_file( "test1.txt", 0 ); rec = MsiCreateRecord( 2 ); MsiRecordSetStringA( rec, 1, "data1" ); @@ -1691,7 +1653,7 @@ static void test_streamtable(void) memset(buf, 0, MAX_PATH); r = MsiRecordReadStream( rec, 2, buf, &size ); ok( r == ERROR_SUCCESS, "Failed to get stream: %d\n", r); - ok( !lstrcmpA(buf, "test.txt\n"), "Expected 'test.txt\\n', got %s\n", buf); + ok( !lstrcmpA(buf, "test.txt"), "Expected 'test.txt', got %s\n", buf); MsiCloseHandle( rec ); MsiViewClose( view ); @@ -1716,14 +1678,14 @@ static void test_streamtable(void) memset(buf, 0, MAX_PATH); r = MsiRecordReadStream( rec, 2, buf, &size ); ok( r == ERROR_SUCCESS, "Failed to get stream: %d\n", r); - ok( !lstrcmpA(buf, "test1.txt\n"), "Expected 'test1.txt\\n', got %s\n", buf); + ok( !lstrcmpA(buf, "test1.txt"), "Expected 'test1.txt', got %s\n", buf); MsiCloseHandle( rec ); MsiViewClose( view ); MsiCloseHandle( view ); /* perform an update */ - create_file( "test2.txt" ); + create_file( "test2.txt", 0 ); rec = MsiCreateRecord( 1 ); r = MsiRecordSetStreamA( rec, 1, "test2.txt" ); @@ -1761,7 +1723,7 @@ static void test_streamtable(void) memset(buf, 0, MAX_PATH); r = MsiRecordReadStream( rec, 2, buf, &size ); ok( r == ERROR_SUCCESS, "Failed to get stream: %d\n", r); - ok( !lstrcmpA(buf, "test2.txt\n"), "Expected 'test2.txt\\n', got %s\n", buf); + ok( !lstrcmpA(buf, "test2.txt"), "Expected 'test2.txt', got %s\n", buf); MsiCloseHandle( rec ); MsiViewClose( view ); @@ -1773,7 +1735,7 @@ static void test_streamtable(void) r = MsiOpenDatabaseW(msifileW, MSIDBOPEN_CREATEDIRECT, &hdb); ok(r == ERROR_SUCCESS, "Failed to create database\n"); ok( hdb, "failed to create db\n"); - create_file( "test.txt" ); + create_file( "test.txt", 0 ); rec = MsiCreateRecord( 2 ); MsiRecordSetStringA( rec, 1, "data" ); r = MsiRecordSetStreamA( rec, 2, "test.txt" ); @@ -1809,7 +1771,7 @@ static void test_streamtable(void) memset(buf, 0, MAX_PATH); r = MsiRecordReadStream( rec, 2, buf, &size ); ok( r == ERROR_SUCCESS, "Failed to get stream: %d\n", r); - ok( !lstrcmpA(buf, "test.txt\n"), "Expected 'test.txt\\n', got '%s' (%lu)\n", buf, size); + ok( !lstrcmpA(buf, "test.txt"), "Expected 'test.txt', got '%s' (%lu)\n", buf, size); MsiCloseHandle( rec ); /* open a handle to the "data" stream (and keep it open during removal) */ @@ -1865,7 +1827,7 @@ static void test_binary(void) r = run_query( hdb, 0, query ); ok( r == ERROR_SUCCESS, "Cannot create Binary table: %d\n", r ); - create_file( "test.txt" ); + create_file( "test.txt", 0 ); rec = MsiCreateRecord( 1 ); r = MsiRecordSetStreamA( rec, 1, "test.txt" ); ok( r == ERROR_SUCCESS, "Failed to add stream data to the record: %d\n", r); @@ -1892,7 +1854,7 @@ static void test_binary(void) r = run_query( hdb, 0, query ); ok( r == ERROR_SUCCESS, "Cannot create Binary table: %d\n", r ); - create_file( "test.txt" ); + create_file( "test.txt", 0 ); rec = MsiCreateRecord( 1 ); r = MsiRecordSetStreamA( rec, 1, "test.txt" ); ok( r == ERROR_SUCCESS, "Failed to add stream data to the record: %d\n", r ); @@ -1932,7 +1894,7 @@ static void test_binary(void) memset( buf, 0, MAX_PATH ); r = MsiRecordReadStream( rec, 2, buf, &size ); ok( r == ERROR_SUCCESS, "Failed to get stream: %d\n", r ); - ok( !lstrcmpA(buf, "test.txt\n"), "Expected 'test.txt\\n', got %s\n", buf ); + ok( !lstrcmpA(buf, "test.txt"), "Expected 'test.txt', got %s\n", buf ); r = MsiCloseHandle( rec ); ok( r == ERROR_SUCCESS , "Failed to close record handle\n" ); @@ -1951,7 +1913,7 @@ static void test_binary(void) memset( buf, 0, MAX_PATH ); r = MsiRecordReadStream( rec, 3, buf, &size ); ok( r == ERROR_SUCCESS, "Failed to get stream: %d\n", r ); - ok( !lstrcmpA(buf, "test.txt\n"), "Expected 'test.txt\\n', got %s\n", buf ); + ok( !lstrcmpA(buf, "test.txt"), "Expected 'test.txt', got %s\n", buf ); r = MsiCloseHandle( rec ); ok( r == ERROR_SUCCESS , "Failed to close record handle\n" ); @@ -2178,8 +2140,6 @@ static void test_where(void) DeleteFileA(msifile); } -static CHAR CURR_DIR[MAX_PATH]; - static const CHAR test_data[] = "FirstPrimaryColumn\tSecondPrimaryColumn\tShortInt\tShortIntNullable\tLongInt\tLongIntNullable\tString\tLocalizableString\tLocalizableStringNullable\n" "s255\ti2\ti2\tI2\ti4\tI4\tS255\tS0\ts0\n" "TestTable\tFirstPrimaryColumn\n" @@ -7992,7 +7952,7 @@ static void test_dbmerge(void) r = run_query(href, 0, query); ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r); - create_file("binary.dat"); + create_file("binary.dat", 0); hrec = MsiCreateRecord(1); MsiRecordSetStreamA(hrec, 1, "binary.dat"); @@ -8017,8 +7977,7 @@ static void test_dbmerge(void) ZeroMemory(buf, MAX_PATH); r = MsiRecordReadStream(hrec, 2, buf, &size); ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r); - ok(!lstrcmpA(buf, "binary.dat\n"), - "Expected \"binary.dat\\n\", got \"%s\"\n", buf); + ok(!lstrcmpA(buf, "binary.dat"), "Expected \"binary.dat\", got \"%s\"\n", buf); MsiCloseHandle(hrec); @@ -8584,6 +8543,18 @@ static void test_embedded_nulls(void) "s72\tL0\n" "Control\tDialog\n" "LicenseAgreementDlg\ttext\x11\x19text\0text"; + static const char export_expected[] = + "Dialog\tText\r\n" + "s72\tL0\r\n" + "Control\tDialog\r\n" + "LicenseAgreementDlg\ttext\x11\x19text\x19text"; + /* newlines have alternate representation in idt files */ + static const char control_table2[] = + "Dialog\tText\n" + "s72\tL0\n" + "Control\tDialog\n" + "LicenseAgreementDlg\ttext\x11\x19te\nxt\0text"; + char data[1024]; UINT r; DWORD sz; MSIHANDLE hdb, hrec; @@ -8607,9 +8578,27 @@ static void test_embedded_nulls(void) ok( r == ERROR_SUCCESS, "failed to get string %u\n", r ); ok( !memcmp( "text\r\ntext\ntext", buffer, sizeof("text\r\ntext\ntext") - 1 ), "wrong buffer contents \"%s\"\n", buffer ); + r = MsiDatabaseExportA( hdb, "Control", CURR_DIR, "temp_file1"); + ok( r == ERROR_SUCCESS, "failed to export table %u\n", r ); + read_file_data( "temp_file1", data ); + ok( !memcmp( data, export_expected, sizeof(export_expected) - 1), "expected: \"%s\" got: \"%s\"\n", export_expected, data ); + DeleteFileA( "temp_file1" ); + MsiCloseHandle( hrec ); MsiCloseHandle( hdb ); DeleteFileA( msifile ); + + r = MsiOpenDatabaseW( msifileW, MSIDBOPEN_CREATE, &hdb ); + ok( r == ERROR_SUCCESS, "failed to open database %u\n", r ); + + GetCurrentDirectoryA( MAX_PATH, CURR_DIR ); + write_file( "temp_file", control_table2, sizeof(control_table2) ); + r = MsiDatabaseImportA( hdb, CURR_DIR, "temp_file" ); + ok( r == ERROR_FUNCTION_FAILED, "failed to import table %u\n", r ); + DeleteFileA( "temp_file" ); + + MsiCloseHandle( hdb ); + DeleteFileA( msifile ); } static void test_select_column_names(void) diff --git a/modules/rostests/winetests/msi/install.c b/modules/rostests/winetests/msi/install.c index a7388a917d88d..89a27a2746a38 100644 --- a/modules/rostests/winetests/msi/install.c +++ b/modules/rostests/winetests/msi/install.c @@ -29,7 +29,6 @@ #include #include #include -#include #include #include #include @@ -37,21 +36,6 @@ #include "wine/test.h" #include "utils.h" -static UINT (WINAPI *pMsiQueryComponentStateA) - (LPCSTR, LPCSTR, MSIINSTALLCONTEXT, LPCSTR, INSTALLSTATE*); -static UINT (WINAPI *pMsiSourceListEnumSourcesA) - (LPCSTR, LPCSTR, MSIINSTALLCONTEXT, DWORD, DWORD, LPSTR, LPDWORD); -static INSTALLSTATE (WINAPI *pMsiGetComponentPathExA) - (LPCSTR, LPCSTR, LPCSTR, MSIINSTALLCONTEXT, LPSTR, LPDWORD); - -static LONG (WINAPI *pRegDeleteKeyExA)(HKEY, LPCSTR, REGSAM, DWORD); -static BOOL (WINAPI *pIsWow64Process)(HANDLE, PBOOL); -static BOOL (WINAPI *pWow64DisableWow64FsRedirection)(void **); -static BOOL (WINAPI *pWow64RevertWow64FsRedirection)(void *); - -static BOOL (WINAPI *pSRRemoveRestorePoint)(DWORD); -static BOOL (WINAPI *pSRSetRestorePointA)(RESTOREPOINTINFOA*, STATEMGRSTATUS*); - static BOOL is_wow64; static const BOOL is_64bit = sizeof(void *) > sizeof(int); @@ -2224,67 +2208,17 @@ static int CDECL fci_delete(char *pszFile, int *err, void *pv) return 0; } -static void init_functionpointers(void) -{ - HMODULE hmsi = GetModuleHandleA("msi.dll"); - HMODULE hadvapi32 = GetModuleHandleA("advapi32.dll"); - HMODULE hkernel32 = GetModuleHandleA("kernel32.dll"); - HMODULE hsrclient = LoadLibraryA("srclient.dll"); - -#define GET_PROC(mod, func) \ - p ## func = (void*)GetProcAddress(mod, #func); \ - if(!p ## func) \ - trace("GetProcAddress(%s) failed\n", #func); - - GET_PROC(hmsi, MsiQueryComponentStateA); - GET_PROC(hmsi, MsiSourceListEnumSourcesA); - GET_PROC(hmsi, MsiGetComponentPathExA); - - GET_PROC(hadvapi32, RegDeleteKeyExA) - GET_PROC(hkernel32, IsWow64Process) - GET_PROC(hkernel32, Wow64DisableWow64FsRedirection); - GET_PROC(hkernel32, Wow64RevertWow64FsRedirection); - - GET_PROC(hsrclient, SRRemoveRestorePoint); - GET_PROC(hsrclient, SRSetRestorePointA); - -#undef GET_PROC -} - -BOOL is_process_limited(void) +BOOL is_process_elevated(void) { - SID_IDENTIFIER_AUTHORITY NtAuthority = {SECURITY_NT_AUTHORITY}; - PSID Group = NULL; - BOOL IsInGroup; HANDLE token; + TOKEN_ELEVATION_TYPE type = TokenElevationTypeDefault; + DWORD size; + BOOL ret; - if (!AllocateAndInitializeSid(&NtAuthority, 2, SECURITY_BUILTIN_DOMAIN_RID, - DOMAIN_ALIAS_RID_ADMINS, 0, 0, 0, 0, 0, 0, &Group) || - !CheckTokenMembership(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 (OpenProcessToken(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; + if (!OpenProcessToken(GetCurrentProcess(), TOKEN_QUERY, &token)) return FALSE; + ret = GetTokenInformation(token, TokenElevationType, &type, sizeof(type), &size); + CloseHandle(token); + return (ret && type == TokenElevationTypeFull); } static BOOL check_record(MSIHANDLE rec, UINT field, LPCSTR val) @@ -2734,34 +2668,6 @@ void create_database_wordcount(const CHAR *name, const msi_table *tables, int nu free( nameW ); } -static BOOL notify_system_change(DWORD event_type, STATEMGRSTATUS *status) -{ - RESTOREPOINTINFOA spec; - - spec.dwEventType = event_type; - spec.dwRestorePtType = APPLICATION_INSTALL; - spec.llSequenceNumber = status->llSequenceNumber; - lstrcpyA(spec.szDescription, "msitest restore point"); - - return pSRSetRestorePointA(&spec, status); -} - -static void remove_restore_point(DWORD seq_number) -{ - DWORD res; - - res = pSRRemoveRestorePoint(seq_number); - if (res != ERROR_SUCCESS) - trace("Failed to remove the restore point: %#lx\n", res); -} - -static LONG delete_key( HKEY key, LPCSTR subkey, REGSAM access ) -{ - if (pRegDeleteKeyExA) - return pRegDeleteKeyExA( key, subkey, access, 0 ); - return RegDeleteKeyA( key, subkey ); -} - static void test_MsiInstallProduct(void) { UINT r; @@ -2771,7 +2677,7 @@ static void test_MsiInstallProduct(void) DWORD num, size, type; REGSAM access = KEY_ALL_ACCESS; - if (is_process_limited()) + if (!is_process_elevated()) { skip("process is limited\n"); return; @@ -2836,7 +2742,7 @@ static void test_MsiInstallProduct(void) ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %ld\n", res); ok(!lstrcmpA(path, "OrderTestValue"), "Expected OrderTestValue, got %s\n", path); - delete_key(HKEY_CURRENT_USER, "SOFTWARE\\Wine\\msitest", access); + RegDeleteKeyExA(HKEY_CURRENT_USER, "SOFTWARE\\Wine\\msitest", access, 0); /* not published, reinstall */ r = MsiInstallProductA(msifile, NULL); @@ -3116,7 +3022,7 @@ static void test_continuouscabs(void) { UINT r; - if (is_process_limited()) + if (!is_process_elevated()) { skip("process is limited\n"); return; @@ -3309,7 +3215,7 @@ static void test_mixedmedia(void) { UINT r; - if (is_process_limited()) + if (!is_process_elevated()) { skip("process is limited\n"); return; @@ -3429,7 +3335,7 @@ static void test_readonlyfile(void) HANDLE file; CHAR path[MAX_PATH]; - if (is_process_limited()) + if (!is_process_elevated()) { skip("process is limited\n"); return; @@ -3478,7 +3384,7 @@ static void test_readonlyfile_cab(void) CHAR path[MAX_PATH]; CHAR buf[16]; - if (is_process_limited()) + if (!is_process_elevated()) { skip("process is limited\n"); return; @@ -3535,7 +3441,7 @@ static void test_setdirproperty(void) { UINT r; - if (is_process_limited()) + if (!is_process_elevated()) { skip("process is limited\n"); return; @@ -3568,7 +3474,7 @@ static void test_cabisextracted(void) { UINT r; - if (is_process_limited()) + if (!is_process_elevated()) { skip("process is limited\n"); return; @@ -3809,7 +3715,7 @@ static void test_transformprop(void) { UINT r; - if (is_process_limited()) + if (!is_process_elevated()) { skip("process is limited\n"); return; @@ -3857,7 +3763,7 @@ static void test_currentworkingdir(void) CHAR drive[MAX_PATH], path[MAX_PATH + 12]; LPSTR ptr; - if (is_process_limited()) + if (!is_process_elevated()) { skip("process is limited\n"); return; @@ -4015,7 +3921,7 @@ static void test_adminprops(void) { UINT r; - if (is_process_limited()) + if (!is_process_elevated()) { skip("process is limited\n"); return; @@ -4066,7 +3972,7 @@ static void test_missingcab(void) { UINT r; - if (is_process_limited()) + if (!is_process_elevated()) { skip("process is limited\n"); return; @@ -4136,7 +4042,7 @@ static void test_sourcefolder(void) { UINT r; - if (is_process_limited()) + if (!is_process_elevated()) { skip("process is limited\n"); return; @@ -4239,7 +4145,7 @@ static void test_customaction51(void) { UINT r; - if (is_process_limited()) + if (!is_process_elevated()) { skip("process is limited\n"); return; @@ -4272,7 +4178,7 @@ static void test_installstate(void) { UINT r; - if (is_process_limited()) + if (!is_process_elevated()) { skip("process is limited\n"); return; @@ -4758,7 +4664,7 @@ static void test_missingcomponent(void) { UINT r; - if (is_process_limited()) + if (!is_process_elevated()) { skip("process is limited\n"); return; @@ -4814,7 +4720,7 @@ static void test_sourcedirprop(void) UINT r; CHAR props[MAX_PATH + 18]; - if (is_process_limited()) + if (!is_process_elevated()) { skip("process is limited\n"); return; @@ -4865,7 +4771,7 @@ static void test_adminimage(void) { UINT r; - if (is_process_limited()) + if (!is_process_elevated()) { skip("process is limited\n"); return; @@ -4936,7 +4842,7 @@ static void test_propcase(void) { UINT r; - if (is_process_limited()) + if (!is_process_elevated()) { skip("process is limited\n"); return; @@ -5042,7 +4948,7 @@ static void test_shortcut(void) UINT r; HRESULT hr; - if (is_process_limited()) + if (!is_process_elevated()) { skip("process is limited\n"); return; @@ -5089,7 +4995,7 @@ static void test_preselected(void) { UINT r; - if (is_process_limited()) + if (!is_process_elevated()) { skip("process is limited\n"); return; @@ -5145,7 +5051,7 @@ static void test_installed_prop(void) static const char prodcode[] = "{7df88a48-996f-4ec8-a022-bf956f9b2cbb}"; UINT r; - if (is_process_limited()) + if (!is_process_elevated()) { skip("process is limited\n"); return; @@ -5184,7 +5090,7 @@ static void test_allusers_prop(void) { UINT r; - if (is_process_limited()) + if (!is_process_elevated()) { skip("process is limited\n"); return; @@ -5305,7 +5211,7 @@ static void process_pending_renames(HKEY hkey) else { fileret = DeleteFileA(src); - ok(fileret || broken(!fileret) /* win2k3 */, "Failed to delete file %s (%lu)\n", src, GetLastError()); + ok(fileret, "Failed to delete file %s (%lu)\n", src, GetLastError()); } } @@ -5345,7 +5251,7 @@ static void test_file_in_use(void) HKEY hkey; char path[MAX_PATH]; - if (is_process_limited()) + if (!is_process_elevated()) { skip("process is limited\n"); return; @@ -5404,7 +5310,7 @@ static void test_file_in_use_cab(void) HKEY hkey; char path[MAX_PATH]; - if (is_process_limited()) + if (!is_process_elevated()) { skip("process is limited\n"); return; @@ -5465,7 +5371,7 @@ static void test_feature_override(void) UINT r; REGSAM access = KEY_ALL_ACCESS; - if (is_process_limited()) + if (!is_process_elevated()) { skip("process is limited\n"); return; @@ -5527,7 +5433,7 @@ static void test_feature_override(void) ok(!delete_pf("msitest\\preselected.txt", TRUE), "file not removed\n"); ok(!delete_pf("msitest", FALSE), "directory not removed\n"); - delete_key(HKEY_LOCAL_MACHINE, "Software\\Wine\\msitest", access); + RegDeleteKeyExA(HKEY_LOCAL_MACHINE, "Software\\Wine\\msitest", access, 0); error: DeleteFileA("msitest\\override.txt"); @@ -5545,7 +5451,7 @@ static void test_icon_table(void) CHAR path[MAX_PATH]; static const char prodcode[] = "{7DF88A49-996F-4EC8-A022-BF956F9B2CBB}"; - if (is_process_limited()) + if (!is_process_elevated()) { skip("process is limited\n"); return; @@ -5623,7 +5529,7 @@ static void test_package_validation(void) { UINT r; - if (is_process_limited()) + if (!is_process_elevated()) { skip("process is limited\n"); return; @@ -5814,7 +5720,7 @@ static void test_upgrade_code(void) { UINT r; - if (is_process_limited()) + if (!is_process_elevated()) { skip("process is limited\n"); return; @@ -5850,7 +5756,7 @@ static void test_mixed_package(void) char value[MAX_PATH]; DWORD size; - if (is_process_limited()) + if (!is_process_elevated()) { skip("process is limited\n"); return; @@ -5913,7 +5819,7 @@ static void test_mixed_package(void) ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r); res = RegOpenKeyExA(HKEY_LOCAL_MACHINE, "Software\\Wine\\msitest", 0, KEY_ALL_ACCESS|KEY_WOW64_32KEY, &hkey); - ok(res == ERROR_FILE_NOT_FOUND || broken(!res), "32-bit component key not removed\n"); + ok(res == ERROR_FILE_NOT_FOUND, "32-bit component key not removed\n"); res = RegOpenKeyExA(HKEY_LOCAL_MACHINE, "Software\\Wine\\msitest", 0, KEY_ALL_ACCESS|KEY_WOW64_64KEY, &hkey); ok(res == ERROR_FILE_NOT_FOUND, "64-bit component key not removed\n"); @@ -5976,7 +5882,7 @@ static void test_mixed_package(void) ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r); res = RegOpenKeyExA(HKEY_LOCAL_MACHINE, "Software\\Wine\\msitest", 0, KEY_ALL_ACCESS|KEY_WOW64_32KEY, &hkey); - ok(res == ERROR_FILE_NOT_FOUND || broken(!res), "32-bit component key not removed\n"); + ok(res == ERROR_FILE_NOT_FOUND, "32-bit component key not removed\n"); res = RegOpenKeyExA(HKEY_LOCAL_MACHINE, "Software\\Wine\\msitest", 0, KEY_ALL_ACCESS|KEY_WOW64_64KEY, &hkey); ok(res == ERROR_FILE_NOT_FOUND, "64-bit component key not removed\n"); @@ -5999,7 +5905,7 @@ static void test_volume_props(void) { UINT r; - if (is_process_limited()) + if (!is_process_elevated()) { skip("process is limited\n"); return; @@ -6025,7 +5931,7 @@ static void test_shared_component(void) { UINT r; - if (is_process_limited()) + if (!is_process_elevated()) { skip("process is limited\n"); return; @@ -6074,7 +5980,7 @@ static void test_remove_upgrade_code(void) DWORD type, size; char buf[1]; - if (is_process_limited()) + if (!is_process_elevated()) { skip( "process is limited\n" ); return; @@ -6120,7 +6026,7 @@ static void test_feature_tree(void) { UINT r; - if (is_process_limited()) + if (!is_process_elevated()) { skip( "process is limited\n" ); return; @@ -6197,7 +6103,7 @@ static void test_wow64(void) return; } - if (is_process_limited()) + if (!is_process_elevated()) { skip("process is limited\n"); return; @@ -6212,7 +6118,7 @@ static void test_wow64(void) goto error; } - pWow64DisableWow64FsRedirection(&cookie); + Wow64DisableWow64FsRedirection(&cookie); ok(!delete_pf("msitest\\cabout\\new\\five.txt", TRUE), "File installed\n"); ok(!delete_pf("msitest\\cabout\\new", FALSE), "Directory created\n"); @@ -6238,7 +6144,7 @@ static void test_wow64(void) ok(delete_pf_native("msitest\\filename", TRUE), "File not installed\n"); ok(delete_pf_native("msitest", FALSE), "Directory not created\n"); - pWow64RevertWow64FsRedirection(cookie); + Wow64RevertWow64FsRedirection(cookie); error: delete_test_files(); @@ -6250,7 +6156,7 @@ static void test_source_resolution(void) { UINT r; - if (is_process_limited()) + if (!is_process_elevated()) { skip( "process is limited\n" ); return; @@ -6279,14 +6185,12 @@ START_TEST(install) { DWORD len; char temp_path[MAX_PATH], prev_path[MAX_PATH], log_file[MAX_PATH]; - STATEMGRSTATUS status; - BOOL ret = FALSE; - init_functionpointers(); + if (!is_process_elevated()) restart_as_admin_elevated(); + subtest("custom"); - if (pIsWow64Process) - pIsWow64Process(GetCurrentProcess(), &is_wow64); + IsWow64Process(GetCurrentProcess(), &is_wow64); GetCurrentDirectoryA(MAX_PATH, prev_path); GetTempPathA(MAX_PATH, temp_path); @@ -6301,18 +6205,6 @@ START_TEST(install) ok(get_system_dirs(), "failed to retrieve system dirs\n"); ok(get_user_dirs(), "failed to retrieve user dirs\n"); - /* Create a restore point ourselves so we circumvent the multitude of restore points - * that would have been created by all the installation and removal tests. - * - * This is not needed on version 5.0 where setting MSIFASTINSTALL prevents the - * creation of restore points. - */ - if (pSRSetRestorePointA && !pMsiGetComponentPathExA) - { - memset(&status, 0, sizeof(status)); - ret = notify_system_change(BEGIN_NESTED_SYSTEM_CHANGE, &status); - } - /* Create only one log file and don't append. We have to pass something * for the log mode for this to work. The logfile needs to have an absolute * path otherwise we still end up with some extra logfiles as some tests @@ -6322,8 +6214,7 @@ START_TEST(install) lstrcatA(log_file, "\\msitest.log"); MsiEnableLogA(INSTALLLOGMODE_FATALEXIT, log_file, 0); - if (pSRSetRestorePointA) /* test has side-effects on win2k3 that cause failures in following tests */ - test_MsiInstallProduct(); + test_MsiInstallProduct(); test_MsiSetComponentState(); test_packagecoltypes(); test_continuouscabs(); @@ -6370,15 +6261,6 @@ START_TEST(install) test_source_resolution(); DeleteFileA(customdll); - DeleteFileA(log_file); - - if (pSRSetRestorePointA && !pMsiGetComponentPathExA && ret) - { - ret = notify_system_change(END_NESTED_SYSTEM_CHANGE, &status); - if (ret) - remove_restore_point(status.llSequenceNumber); - } - SetCurrentDirectoryA(prev_path); } diff --git a/modules/rostests/winetests/msi/msi.c b/modules/rostests/winetests/msi/msi.c index 70b8f0e3e1d4b..e835db010cde2 100644 --- a/modules/rostests/winetests/msi/msi.c +++ b/modules/rostests/winetests/msi/msi.c @@ -41,77 +41,6 @@ static BOOL is_wow64; static const char msifile[] = "winetest.msi"; static const WCHAR msifileW[] = L"winetest.msi"; -static LONG (WINAPI *pRegDeleteKeyExA)(HKEY, LPCSTR, REGSAM, DWORD); -static BOOL (WINAPI *pIsWow64Process)(HANDLE, PBOOL); - -static INSTALLSTATE (WINAPI *pMsiGetComponentPathA) - (LPCSTR, LPCSTR, LPSTR, DWORD*); -static INSTALLSTATE (WINAPI *pMsiGetComponentPathExA) - (LPCSTR, LPCSTR, LPCSTR, MSIINSTALLCONTEXT, LPSTR, LPDWORD); -static INSTALLSTATE (WINAPI *pMsiProvideComponentA) - (LPCSTR, LPCSTR, LPCSTR, DWORD, LPSTR, LPDWORD); -static INSTALLSTATE (WINAPI *pMsiProvideComponentW) - (LPCWSTR, LPCWSTR, LPCWSTR, DWORD, LPWSTR, LPDWORD); -static UINT (WINAPI *pMsiGetFileHashA) - (LPCSTR, DWORD, PMSIFILEHASHINFO); -static UINT (WINAPI *pMsiGetProductInfoExA) - (LPCSTR, LPCSTR, MSIINSTALLCONTEXT, LPCSTR, LPSTR, LPDWORD); -static UINT (WINAPI *pMsiOpenPackageExA) - (LPCSTR, DWORD, MSIHANDLE*); -static UINT (WINAPI *pMsiOpenPackageExW) - (LPCWSTR, DWORD, MSIHANDLE*); -static UINT (WINAPI *pMsiEnumPatchesExA) - (LPCSTR, LPCSTR, DWORD, DWORD, DWORD, LPSTR, LPSTR, - MSIINSTALLCONTEXT*, LPSTR, LPDWORD); -static UINT (WINAPI *pMsiQueryComponentStateA) - (LPCSTR, LPCSTR, MSIINSTALLCONTEXT, LPCSTR, INSTALLSTATE*); -static INSTALLSTATE (WINAPI *pMsiUseFeatureExA) - (LPCSTR, LPCSTR ,DWORD, DWORD); -static UINT (WINAPI *pMsiGetPatchInfoExA) - (LPCSTR, LPCSTR, LPCSTR, MSIINSTALLCONTEXT, LPCSTR, LPSTR, DWORD *); -static UINT (WINAPI *pMsiEnumProductsExA) - (LPCSTR, LPCSTR, DWORD, DWORD, CHAR[39], MSIINSTALLCONTEXT *, LPSTR, LPDWORD); -static UINT (WINAPI *pMsiEnumComponentsExA) - (LPCSTR, DWORD, DWORD, CHAR[39], MSIINSTALLCONTEXT *, LPSTR, LPDWORD); -static UINT (WINAPI *pMsiSetExternalUIRecord) - (INSTALLUI_HANDLER_RECORD, DWORD, LPVOID, PINSTALLUI_HANDLER_RECORD); -static UINT (WINAPI *pMsiSourceListGetInfoA) - (LPCSTR, LPCSTR, MSIINSTALLCONTEXT, DWORD, LPCSTR, LPSTR, LPDWORD); - -static void init_functionpointers(void) -{ - HMODULE hmsi = GetModuleHandleA("msi.dll"); - HMODULE hadvapi32 = GetModuleHandleA("advapi32.dll"); - HMODULE hkernel32 = GetModuleHandleA("kernel32.dll"); - -#define GET_PROC(dll, func) \ - p ## func = (void *)GetProcAddress(dll, #func); \ - if(!p ## func) \ - trace("GetProcAddress(%s) failed\n", #func); - - GET_PROC(hmsi, MsiGetComponentPathA) - GET_PROC(hmsi, MsiGetComponentPathExA); - GET_PROC(hmsi, MsiProvideComponentA) - GET_PROC(hmsi, MsiProvideComponentW) - GET_PROC(hmsi, MsiGetFileHashA) - GET_PROC(hmsi, MsiGetProductInfoExA) - GET_PROC(hmsi, MsiOpenPackageExA) - GET_PROC(hmsi, MsiOpenPackageExW) - GET_PROC(hmsi, MsiEnumPatchesExA) - GET_PROC(hmsi, MsiQueryComponentStateA) - GET_PROC(hmsi, MsiSetExternalUIRecord) - GET_PROC(hmsi, MsiUseFeatureExA) - GET_PROC(hmsi, MsiGetPatchInfoExA) - GET_PROC(hmsi, MsiEnumProductsExA) - GET_PROC(hmsi, MsiEnumComponentsExA) - GET_PROC(hmsi, MsiSourceListGetInfoA) - - GET_PROC(hadvapi32, RegDeleteKeyExA) - GET_PROC(hkernel32, IsWow64Process) - -#undef GET_PROC -} - /* cabinet definitions */ /* make the max size large so there is only one cab file */ @@ -874,48 +803,35 @@ static void test_usefeature(void) { INSTALLSTATE r; - if (!pMsiUseFeatureExA) - { - win_skip("MsiUseFeatureExA not implemented\n"); - return; - } - r = MsiQueryFeatureStateA(NULL, NULL); ok( r == INSTALLSTATE_INVALIDARG, "wrong return val\n"); r = MsiQueryFeatureStateA("{9085040-6000-11d3-8cfe-0150048383c9}" ,NULL); ok( r == INSTALLSTATE_INVALIDARG, "wrong return val\n"); - r = pMsiUseFeatureExA(NULL,NULL,0,0); + r = MsiUseFeatureExA(NULL,NULL,0,0); ok( r == INSTALLSTATE_INVALIDARG, "wrong return val\n"); - r = pMsiUseFeatureExA(NULL, "WORDVIEWFiles", -2, 1 ); + r = MsiUseFeatureExA(NULL, "WORDVIEWFiles", -2, 1 ); ok( r == INSTALLSTATE_INVALIDARG, "wrong return val\n"); - r = pMsiUseFeatureExA("{90850409-6000-11d3-8cfe-0150048383c9}", + r = MsiUseFeatureExA("{90850409-6000-11d3-8cfe-0150048383c9}", NULL, -2, 0 ); ok( r == INSTALLSTATE_INVALIDARG, "wrong return val\n"); - r = pMsiUseFeatureExA("{9085040-6000-11d3-8cfe-0150048383c9}", + r = MsiUseFeatureExA("{9085040-6000-11d3-8cfe-0150048383c9}", "WORDVIEWFiles", -2, 0 ); ok( r == INSTALLSTATE_INVALIDARG, "wrong return val\n"); - r = pMsiUseFeatureExA("{0085040-6000-11d3-8cfe-0150048383c9}", + r = MsiUseFeatureExA("{0085040-6000-11d3-8cfe-0150048383c9}", "WORDVIEWFiles", -2, 0 ); ok( r == INSTALLSTATE_INVALIDARG, "wrong return val\n"); - r = pMsiUseFeatureExA("{90850409-6000-11d3-8cfe-0150048383c9}", + r = MsiUseFeatureExA("{90850409-6000-11d3-8cfe-0150048383c9}", "WORDVIEWFiles", -2, 1 ); ok( r == INSTALLSTATE_INVALIDARG, "wrong return val\n"); } -static LONG delete_key( HKEY key, LPCSTR subkey, REGSAM access ) -{ - if (pRegDeleteKeyExA) - return pRegDeleteKeyExA( key, subkey, access, 0 ); - return RegDeleteKeyA( key, subkey ); -} - static void test_null(void) { MSIHANDLE hpkg; @@ -929,7 +845,7 @@ static void test_null(void) if (is_wow64) access |= KEY_WOW64_64KEY; - r = pMsiOpenPackageExW(NULL, 0, &hpkg); + r = MsiOpenPackageExW(NULL, 0, &hpkg); ok( r == ERROR_INVALID_PARAMETER,"wrong error\n"); state = MsiQueryProductStateW(NULL); @@ -1016,8 +932,8 @@ static void test_null(void) r = RegCloseKey(hkey); ok( r == ERROR_SUCCESS, "wrong error %d\n", r); - r = delete_key(HKEY_LOCAL_MACHINE, "SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Uninstall\\{F1C3AF50-8B56-4A69-A00C-00773FE42F30}", - access & KEY_WOW64_64KEY); + r = RegDeleteKeyExA(HKEY_LOCAL_MACHINE, "SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Uninstall\\{F1C3AF50-8B56-4A69-A00C-00773FE42F30}", + access & KEY_WOW64_64KEY, 0); ok( r == ERROR_SUCCESS, "wrong error %d\n", r); } @@ -1027,36 +943,33 @@ static void test_getcomponentpath(void) char buffer[0x100]; DWORD sz; - if(!pMsiGetComponentPathA) - return; - - r = pMsiGetComponentPathA( NULL, NULL, NULL, NULL ); + r = MsiGetComponentPathA( NULL, NULL, NULL, NULL ); ok( r == INSTALLSTATE_INVALIDARG, "wrong return value\n"); - r = pMsiGetComponentPathA( "bogus", "bogus", NULL, NULL ); + r = MsiGetComponentPathA( "bogus", "bogus", NULL, NULL ); ok( r == INSTALLSTATE_INVALIDARG, "wrong return value\n"); - r = pMsiGetComponentPathA( "bogus", "{00000000-0000-0000-000000000000}", NULL, NULL ); + r = MsiGetComponentPathA( "bogus", "{00000000-0000-0000-000000000000}", NULL, NULL ); ok( r == INSTALLSTATE_INVALIDARG, "wrong return value\n"); sz = sizeof buffer; buffer[0]=0; - r = pMsiGetComponentPathA( "bogus", "{00000000-0000-0000-000000000000}", buffer, &sz ); + r = MsiGetComponentPathA( "bogus", "{00000000-0000-0000-000000000000}", buffer, &sz ); ok( r == INSTALLSTATE_INVALIDARG, "wrong return value\n"); - r = pMsiGetComponentPathA( "{00000000-78E1-11D2-B60F-006097C998E7}", + r = MsiGetComponentPathA( "{00000000-78E1-11D2-B60F-006097C998E7}", "{00000000-0000-0000-0000-000000000000}", buffer, &sz ); ok( r == INSTALLSTATE_UNKNOWN, "wrong return value\n"); - r = pMsiGetComponentPathA( "{00000409-78E1-11D2-B60F-006097C998E7}", + r = MsiGetComponentPathA( "{00000409-78E1-11D2-B60F-006097C998E7}", "{00000000-0000-0000-0000-00000000}", buffer, &sz ); ok( r == INSTALLSTATE_INVALIDARG, "wrong return value\n"); - r = pMsiGetComponentPathA( "{00000409-78E1-11D2-B60F-006097C998E7}", + r = MsiGetComponentPathA( "{00000409-78E1-11D2-B60F-006097C998E7}", "{029E403D-A86A-1D11-5B5B0006799C897E}", buffer, &sz ); ok( r == INSTALLSTATE_INVALIDARG, "wrong return value\n"); - r = pMsiGetComponentPathA( "{00000000-78E1-11D2-B60F-006097C9987e}", + r = MsiGetComponentPathA( "{00000000-78E1-11D2-B60F-006097C9987e}", "{00000000-A68A-11d1-5B5B-0006799C897E}", buffer, &sz ); ok( r == INSTALLSTATE_UNKNOWN, "wrong return value\n"); } @@ -1136,38 +1049,32 @@ static void test_MsiGetFileHash(void) MSIFILEHASHINFO hash; DWORD i; - if (!pMsiGetFileHashA) - { - win_skip("MsiGetFileHash not implemented\n"); - return; - } - hash.dwFileHashInfoSize = sizeof(MSIFILEHASHINFO); /* szFilePath is NULL */ - r = pMsiGetFileHashA(NULL, 0, &hash); + r = MsiGetFileHashA(NULL, 0, &hash); ok(r == ERROR_INVALID_PARAMETER, "Expected ERROR_INVALID_PARAMETER, got %d\n", r); /* szFilePath is empty */ - r = pMsiGetFileHashA("", 0, &hash); + r = MsiGetFileHashA("", 0, &hash); ok(r == ERROR_PATH_NOT_FOUND || r == ERROR_BAD_PATHNAME, "Expected ERROR_PATH_NOT_FOUND or ERROR_BAD_PATHNAME, got %d\n", r); /* szFilePath is nonexistent */ - r = pMsiGetFileHashA(name, 0, &hash); + r = MsiGetFileHashA(name, 0, &hash); ok(r == ERROR_FILE_NOT_FOUND, "Expected ERROR_FILE_NOT_FOUND, got %d\n", r); /* dwOptions is non-zero */ - r = pMsiGetFileHashA(name, 1, &hash); + r = MsiGetFileHashA(name, 1, &hash); ok(r == ERROR_INVALID_PARAMETER, "Expected ERROR_INVALID_PARAMETER, got %d\n", r); /* pHash.dwFileHashInfoSize is not correct */ hash.dwFileHashInfoSize = 0; - r = pMsiGetFileHashA(name, 0, &hash); + r = MsiGetFileHashA(name, 0, &hash); ok(r == ERROR_INVALID_PARAMETER, "Expected ERROR_INVALID_PARAMETER, got %d\n", r); /* pHash is NULL */ - r = pMsiGetFileHashA(name, 0, NULL); + r = MsiGetFileHashA(name, 0, NULL); ok(r == ERROR_INVALID_PARAMETER, "Expected ERROR_INVALID_PARAMETER, got %d\n", r); for (i = 0; i < ARRAY_SIZE(hash_data); i++) @@ -1179,7 +1086,7 @@ static void test_MsiGetFileHash(void) memset(&hash, 0, sizeof(MSIFILEHASHINFO)); hash.dwFileHashInfoSize = sizeof(MSIFILEHASHINFO); - r = pMsiGetFileHashA(name, 0, &hash); + r = MsiGetFileHashA(name, 0, &hash); ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r); ret = memcmp(&hash, &hash_data[i].hash, HASHSIZE); @@ -1378,7 +1285,7 @@ static void test_MsiQueryProductState(void) ok(error == ERROR_SUCCESS, "expected ERROR_SUCCESS, got %lu\n", error); RegDeleteValueA(localkey, "WindowsInstaller"); - delete_key(localkey, "", access & KEY_WOW64_64KEY); + RegDeleteKeyExA(localkey, "", access & KEY_WOW64_64KEY, 0); lstrcpyA(keypath, "Software\\Microsoft\\Windows\\CurrentVersion\\Installer\\UserData\\"); lstrcatA(keypath, usersid); @@ -1421,19 +1328,6 @@ static void test_MsiQueryProductState(void) SetLastError(0xdeadbeef); state = MsiQueryProductStateA(prodcode); error = GetLastError(); - if (state == INSTALLSTATE_ADVERTISED) - { - win_skip("broken result\n"); - RegDeleteValueA(props, "WindowsInstaller"); - delete_key(props, "", access & KEY_WOW64_64KEY); - RegCloseKey(props); - delete_key(localkey, "", access & KEY_WOW64_64KEY); - RegCloseKey(localkey); - RegDeleteKeyA(userkey, ""); - RegCloseKey(userkey); - LocalFree(usersid); - return; - } ok(state == INSTALLSTATE_DEFAULT, "Expected INSTALLSTATE_DEFAULT, got %d\n", state); ok(error == ERROR_SUCCESS, "expected ERROR_SUCCESS, got %lu\n", error); @@ -1458,9 +1352,9 @@ static void test_MsiQueryProductState(void) ok(error == ERROR_SUCCESS, "expected ERROR_SUCCESS, got %lu\n", error); RegDeleteValueA(props, "WindowsInstaller"); - delete_key(props, "", access & KEY_WOW64_64KEY); + RegDeleteKeyExA(props, "", access & KEY_WOW64_64KEY, 0); RegCloseKey(props); - delete_key(localkey, "", access & KEY_WOW64_64KEY); + RegDeleteKeyExA(localkey, "", access & KEY_WOW64_64KEY, 0); RegCloseKey(localkey); RegDeleteKeyA(userkey, ""); RegCloseKey(userkey); @@ -1507,11 +1401,11 @@ static void test_MsiQueryProductState(void) ok(state == INSTALLSTATE_DEFAULT, "Expected INSTALLSTATE_DEFAULT, got %d\n", state); RegDeleteValueA(props, "WindowsInstaller"); - delete_key(props, "", access & KEY_WOW64_64KEY); + RegDeleteKeyExA(props, "", access & KEY_WOW64_64KEY, 0); RegCloseKey(props); - delete_key(localkey, "", access & KEY_WOW64_64KEY); + RegDeleteKeyExA(localkey, "", access & KEY_WOW64_64KEY, 0); RegCloseKey(localkey); - delete_key(prodkey, "", access & KEY_WOW64_64KEY); + RegDeleteKeyExA(prodkey, "", access & KEY_WOW64_64KEY, 0); RegCloseKey(prodkey); /* MSIINSTALLCONTEXT_MACHINE */ @@ -1558,11 +1452,11 @@ static void test_MsiQueryProductState(void) ok(state == INSTALLSTATE_DEFAULT, "Expected INSTALLSTATE_DEFAULT, got %d\n", state); RegDeleteValueA(props, "WindowsInstaller"); - delete_key(props, "", access & KEY_WOW64_64KEY); + RegDeleteKeyExA(props, "", access & KEY_WOW64_64KEY, 0); RegCloseKey(props); - delete_key(localkey, "", access & KEY_WOW64_64KEY); + RegDeleteKeyExA(localkey, "", access & KEY_WOW64_64KEY, 0); RegCloseKey(localkey); - delete_key(prodkey, "", access & KEY_WOW64_64KEY); + RegDeleteKeyExA(prodkey, "", access & KEY_WOW64_64KEY, 0); RegCloseKey(prodkey); LocalFree(usersid); @@ -1883,8 +1777,8 @@ static void test_MsiQueryFeatureState(void) RegDeleteValueA(compkey, prod_squashed); RegDeleteValueA(compkey2, prod_squashed); - delete_key(compkey, "", access & KEY_WOW64_64KEY); - delete_key(compkey2, "", access & KEY_WOW64_64KEY); + RegDeleteKeyExA(compkey, "", access & KEY_WOW64_64KEY, 0); + RegDeleteKeyExA(compkey2, "", access & KEY_WOW64_64KEY, 0); RegDeleteValueA(localkey, "feature"); RegDeleteValueA(userkey, "feature"); RegDeleteKeyA(userkey, ""); @@ -1990,11 +1884,11 @@ static void test_MsiQueryFeatureState(void) RegDeleteValueA(compkey, prod_squashed); RegDeleteValueA(compkey2, prod_squashed); - delete_key(compkey, "", access & KEY_WOW64_64KEY); - delete_key(compkey2, "", access & KEY_WOW64_64KEY); + RegDeleteKeyExA(compkey, "", access & KEY_WOW64_64KEY, 0); + RegDeleteKeyExA(compkey2, "", access & KEY_WOW64_64KEY, 0); RegDeleteValueA(localkey, "feature"); RegDeleteValueA(userkey, "feature"); - delete_key(userkey, "", access & KEY_WOW64_64KEY); + RegDeleteKeyExA(userkey, "", access & KEY_WOW64_64KEY, 0); RegCloseKey(compkey); RegCloseKey(compkey2); RegCloseKey(localkey); @@ -2098,11 +1992,11 @@ static void test_MsiQueryFeatureState(void) RegDeleteValueA(compkey, prod_squashed); RegDeleteValueA(compkey2, prod_squashed); - delete_key(compkey, "", access & KEY_WOW64_64KEY); - delete_key(compkey2, "", access & KEY_WOW64_64KEY); + RegDeleteKeyExA(compkey, "", access & KEY_WOW64_64KEY, 0); + RegDeleteKeyExA(compkey2, "", access & KEY_WOW64_64KEY, 0); RegDeleteValueA(localkey, "feature"); RegDeleteValueA(userkey, "feature"); - delete_key(userkey, "", access & KEY_WOW64_64KEY); + RegDeleteKeyExA(userkey, "", access & KEY_WOW64_64KEY, 0); RegCloseKey(compkey); RegCloseKey(compkey2); RegCloseKey(localkey); @@ -2128,12 +2022,6 @@ static void test_MsiQueryComponentState(void) static const INSTALLSTATE MAGIC_ERROR = 0xdeadbeef; - if (!pMsiQueryComponentStateA) - { - win_skip("MsiQueryComponentStateA not implemented\n"); - return; - } - create_test_guid(prodcode, prod_squashed); compose_base85_guid(component, comp_base85, comp_squashed); usersid = get_user_sid(); @@ -2144,7 +2032,7 @@ static void test_MsiQueryComponentState(void) /* NULL szProductCode */ state = MAGIC_ERROR; SetLastError(0xdeadbeef); - r = pMsiQueryComponentStateA(NULL, NULL, MSIINSTALLCONTEXT_MACHINE, component, &state); + r = MsiQueryComponentStateA(NULL, NULL, MSIINSTALLCONTEXT_MACHINE, component, &state); error = GetLastError(); ok(r == ERROR_INVALID_PARAMETER, "Expected ERROR_INVALID_PARAMETER, got %d\n", r); ok(state == MAGIC_ERROR, "Expected 0xdeadbeef, got %d\n", state); @@ -2153,7 +2041,7 @@ static void test_MsiQueryComponentState(void) /* empty szProductCode */ state = MAGIC_ERROR; SetLastError(0xdeadbeef); - r = pMsiQueryComponentStateA("", NULL, MSIINSTALLCONTEXT_MACHINE, component, &state); + r = MsiQueryComponentStateA("", NULL, MSIINSTALLCONTEXT_MACHINE, component, &state); error = GetLastError(); ok(r == ERROR_INVALID_PARAMETER, "Expected ERROR_INVALID_PARAMETER, got %d\n", r); ok(state == MAGIC_ERROR, "Expected 0xdeadbeef, got %d\n", state); @@ -2162,7 +2050,7 @@ static void test_MsiQueryComponentState(void) /* random szProductCode */ state = MAGIC_ERROR; SetLastError(0xdeadbeef); - r = pMsiQueryComponentStateA("random", NULL, MSIINSTALLCONTEXT_MACHINE, component, &state); + r = MsiQueryComponentStateA("random", NULL, MSIINSTALLCONTEXT_MACHINE, component, &state); error = GetLastError(); ok(r == ERROR_INVALID_PARAMETER, "Expected ERROR_INVALID_PARAMETER, got %d\n", r); ok(state == MAGIC_ERROR, "Expected 0xdeadbeef, got %d\n", state); @@ -2171,7 +2059,7 @@ static void test_MsiQueryComponentState(void) /* GUID-length szProductCode */ state = MAGIC_ERROR; SetLastError(0xdeadbeef); - r = pMsiQueryComponentStateA("DJANE93KNDNAS-2KN2NR93KMN3LN13=L1N3KDE", NULL, MSIINSTALLCONTEXT_MACHINE, component, &state); + r = MsiQueryComponentStateA("DJANE93KNDNAS-2KN2NR93KMN3LN13=L1N3KDE", NULL, MSIINSTALLCONTEXT_MACHINE, component, &state); error = GetLastError(); ok(r == ERROR_INVALID_PARAMETER, "Expected ERROR_INVALID_PARAMETER, got %d\n", r); ok(state == MAGIC_ERROR, "Expected 0xdeadbeef, got %d\n", state); @@ -2180,7 +2068,7 @@ static void test_MsiQueryComponentState(void) /* GUID-length with brackets */ state = MAGIC_ERROR; SetLastError(0xdeadbeef); - r = pMsiQueryComponentStateA("{JANE93KNDNAS-2KN2NR93KMN3LN13=L1N3KD}", NULL, MSIINSTALLCONTEXT_MACHINE, component, &state); + r = MsiQueryComponentStateA("{JANE93KNDNAS-2KN2NR93KMN3LN13=L1N3KD}", NULL, MSIINSTALLCONTEXT_MACHINE, component, &state); error = GetLastError(); ok(r == ERROR_INVALID_PARAMETER, "Expected ERROR_INVALID_PARAMETER, got %d\n", r); ok(state == MAGIC_ERROR, "Expected 0xdeadbeef, got %d\n", state); @@ -2189,7 +2077,7 @@ static void test_MsiQueryComponentState(void) /* actual GUID */ state = MAGIC_ERROR; SetLastError(0xdeadbeef); - r = pMsiQueryComponentStateA(prodcode, NULL, MSIINSTALLCONTEXT_MACHINE, component, &state); + r = MsiQueryComponentStateA(prodcode, NULL, MSIINSTALLCONTEXT_MACHINE, component, &state); error = GetLastError(); ok(r == ERROR_UNKNOWN_PRODUCT, "Expected ERROR_UNKNOWN_PRODUCT, got %d\n", r); ok(state == MAGIC_ERROR, "Expected 0xdeadbeef, got %d\n", state); @@ -2197,7 +2085,7 @@ static void test_MsiQueryComponentState(void) state = MAGIC_ERROR; SetLastError(0xdeadbeef); - r = pMsiQueryComponentStateA(prodcode, NULL, MSIINSTALLCONTEXT_MACHINE, component, &state); + r = MsiQueryComponentStateA(prodcode, NULL, MSIINSTALLCONTEXT_MACHINE, component, &state); error = GetLastError(); ok(r == ERROR_UNKNOWN_PRODUCT, "Expected ERROR_UNKNOWN_PRODUCT, got %d\n", r); ok(state == MAGIC_ERROR, "Expected 0xdeadbeef, got %d\n", state); @@ -2217,13 +2105,13 @@ static void test_MsiQueryComponentState(void) state = MAGIC_ERROR; SetLastError(0xdeadbeef); - r = pMsiQueryComponentStateA(prodcode, NULL, MSIINSTALLCONTEXT_MACHINE, component, &state); + r = MsiQueryComponentStateA(prodcode, NULL, MSIINSTALLCONTEXT_MACHINE, component, &state); error = GetLastError(); ok(r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r); ok(state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state); ok(error == 0xdeadbeef, "expected 0xdeadbeef, got %lu\n", error); - delete_key(prodkey, "", access & KEY_WOW64_64KEY); + RegDeleteKeyExA(prodkey, "", access & KEY_WOW64_64KEY, 0); RegCloseKey(prodkey); /* create local system product key */ @@ -2242,7 +2130,7 @@ static void test_MsiQueryComponentState(void) /* local system product key exists */ state = MAGIC_ERROR; - r = pMsiQueryComponentStateA(prodcode, NULL, MSIINSTALLCONTEXT_MACHINE, component, &state); + r = MsiQueryComponentStateA(prodcode, NULL, MSIINSTALLCONTEXT_MACHINE, component, &state); error = GetLastError(); ok(r == ERROR_UNKNOWN_PRODUCT, "Expected ERROR_UNKNOWN_PRODUCT, got %d\n", r); ok(state == MAGIC_ERROR, "Expected 0xdeadbeef, got %d\n", state); @@ -2254,7 +2142,7 @@ static void test_MsiQueryComponentState(void) /* LocalPackage value exists */ state = MAGIC_ERROR; SetLastError(0xdeadbeef); - r = pMsiQueryComponentStateA(prodcode, NULL, MSIINSTALLCONTEXT_MACHINE, component, &state); + r = MsiQueryComponentStateA(prodcode, NULL, MSIINSTALLCONTEXT_MACHINE, component, &state); error = GetLastError(); ok(r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r); ok(state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state); @@ -2269,7 +2157,7 @@ static void test_MsiQueryComponentState(void) /* component key exists */ state = MAGIC_ERROR; SetLastError(0xdeadbeef); - r = pMsiQueryComponentStateA(prodcode, NULL, MSIINSTALLCONTEXT_MACHINE, component, &state); + r = MsiQueryComponentStateA(prodcode, NULL, MSIINSTALLCONTEXT_MACHINE, component, &state); error = GetLastError(); ok(r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r); ok(state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state); @@ -2281,7 +2169,7 @@ static void test_MsiQueryComponentState(void) /* component\product exists */ state = MAGIC_ERROR; SetLastError(0xdeadbeef); - r = pMsiQueryComponentStateA(prodcode, NULL, MSIINSTALLCONTEXT_MACHINE, component, &state); + r = MsiQueryComponentStateA(prodcode, NULL, MSIINSTALLCONTEXT_MACHINE, component, &state); ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r); error = GetLastError(); ok(state == INSTALLSTATE_NOTUSED || state == INSTALLSTATE_LOCAL, @@ -2291,7 +2179,7 @@ static void test_MsiQueryComponentState(void) /* NULL component, product exists */ state = MAGIC_ERROR; SetLastError(0xdeadbeef); - r = pMsiQueryComponentStateA(prodcode, NULL, MSIINSTALLCONTEXT_MACHINE, NULL, &state); + r = MsiQueryComponentStateA(prodcode, NULL, MSIINSTALLCONTEXT_MACHINE, NULL, &state); error = GetLastError(); ok(r == ERROR_INVALID_PARAMETER, "Expected ERROR_INVALID_PARAMETER, got %d\n", r); ok(state == MAGIC_ERROR, "Expected state not changed, got %d\n", state); @@ -2303,7 +2191,7 @@ static void test_MsiQueryComponentState(void) /* INSTALLSTATE_LOCAL */ state = MAGIC_ERROR; SetLastError(0xdeadbeef); - r = pMsiQueryComponentStateA(prodcode, NULL, MSIINSTALLCONTEXT_MACHINE, component, &state); + r = MsiQueryComponentStateA(prodcode, NULL, MSIINSTALLCONTEXT_MACHINE, component, &state); error = GetLastError(); ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r); ok(state == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", state); @@ -2315,7 +2203,7 @@ static void test_MsiQueryComponentState(void) /* INSTALLSTATE_SOURCE */ state = MAGIC_ERROR; SetLastError(0xdeadbeef); - r = pMsiQueryComponentStateA(prodcode, NULL, MSIINSTALLCONTEXT_MACHINE, component, &state); + r = MsiQueryComponentStateA(prodcode, NULL, MSIINSTALLCONTEXT_MACHINE, component, &state); error = GetLastError(); ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r); ok(state == INSTALLSTATE_SOURCE, "Expected INSTALLSTATE_SOURCE, got %d\n", state); @@ -2327,7 +2215,7 @@ static void test_MsiQueryComponentState(void) /* bad INSTALLSTATE_SOURCE */ state = MAGIC_ERROR; SetLastError(0xdeadbeef); - r = pMsiQueryComponentStateA(prodcode, NULL, MSIINSTALLCONTEXT_MACHINE, component, &state); + r = MsiQueryComponentStateA(prodcode, NULL, MSIINSTALLCONTEXT_MACHINE, component, &state); error = GetLastError(); ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r); ok(state == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", state); @@ -2339,7 +2227,7 @@ static void test_MsiQueryComponentState(void) /* INSTALLSTATE_SOURCE */ state = MAGIC_ERROR; SetLastError(0xdeadbeef); - r = pMsiQueryComponentStateA(prodcode, NULL, MSIINSTALLCONTEXT_MACHINE, component, &state); + r = MsiQueryComponentStateA(prodcode, NULL, MSIINSTALLCONTEXT_MACHINE, component, &state); error = GetLastError(); ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r); ok(state == INSTALLSTATE_SOURCE, "Expected INSTALLSTATE_SOURCE, got %d\n", state); @@ -2351,23 +2239,23 @@ static void test_MsiQueryComponentState(void) /* registry component */ state = MAGIC_ERROR; SetLastError(0xdeadbeef); - r = pMsiQueryComponentStateA(prodcode, NULL, MSIINSTALLCONTEXT_MACHINE, component, &state); + r = MsiQueryComponentStateA(prodcode, NULL, MSIINSTALLCONTEXT_MACHINE, component, &state); error = GetLastError(); ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r); ok(state == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", state); ok(error == 0xdeadbeef, "expected 0xdeadbeef, got %lu\n", error); RegDeleteValueA(prodkey, "LocalPackage"); - delete_key(prodkey, "", access & KEY_WOW64_64KEY); + RegDeleteKeyExA(prodkey, "", access & KEY_WOW64_64KEY, 0); RegDeleteValueA(compkey, prod_squashed); - delete_key(prodkey, "", access & KEY_WOW64_64KEY); + RegDeleteKeyExA(prodkey, "", access & KEY_WOW64_64KEY, 0); RegCloseKey(prodkey); RegCloseKey(compkey); /* MSIINSTALLCONTEXT_USERUNMANAGED */ state = MAGIC_ERROR; - r = pMsiQueryComponentStateA(prodcode, NULL, MSIINSTALLCONTEXT_USERUNMANAGED, component, &state); + r = MsiQueryComponentStateA(prodcode, NULL, MSIINSTALLCONTEXT_USERUNMANAGED, component, &state); ok(r == ERROR_UNKNOWN_PRODUCT, "Expected ERROR_UNKNOWN_PRODUCT, got %d\n", r); ok(state == MAGIC_ERROR, "Expected 0xdeadbeef, got %d\n", state); @@ -2378,7 +2266,7 @@ static void test_MsiQueryComponentState(void) ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %ld\n", res); state = MAGIC_ERROR; - r = pMsiQueryComponentStateA(prodcode, NULL, MSIINSTALLCONTEXT_USERUNMANAGED, component, &state); + r = MsiQueryComponentStateA(prodcode, NULL, MSIINSTALLCONTEXT_USERUNMANAGED, component, &state); ok(r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r); ok(state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state); @@ -2400,7 +2288,7 @@ static void test_MsiQueryComponentState(void) RegCloseKey(prodkey); state = MAGIC_ERROR; - r = pMsiQueryComponentStateA(prodcode, NULL, MSIINSTALLCONTEXT_USERUNMANAGED, component, &state); + r = MsiQueryComponentStateA(prodcode, NULL, MSIINSTALLCONTEXT_USERUNMANAGED, component, &state); ok(r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r); ok(state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state); @@ -2414,7 +2302,7 @@ static void test_MsiQueryComponentState(void) /* component key exists */ state = MAGIC_ERROR; - r = pMsiQueryComponentStateA(prodcode, NULL, MSIINSTALLCONTEXT_USERUNMANAGED, component, &state); + r = MsiQueryComponentStateA(prodcode, NULL, MSIINSTALLCONTEXT_USERUNMANAGED, component, &state); ok(r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r); ok(state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state); @@ -2423,7 +2311,7 @@ static void test_MsiQueryComponentState(void) /* component\product exists */ state = MAGIC_ERROR; - r = pMsiQueryComponentStateA(prodcode, NULL, MSIINSTALLCONTEXT_USERUNMANAGED, component, &state); + r = MsiQueryComponentStateA(prodcode, NULL, MSIINSTALLCONTEXT_USERUNMANAGED, component, &state); ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r); ok(state == INSTALLSTATE_NOTUSED || state == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_NOTUSED or INSTALLSTATE_LOCAL, got %d\n", state); @@ -2432,14 +2320,14 @@ static void test_MsiQueryComponentState(void) ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %ld\n", res); state = MAGIC_ERROR; - r = pMsiQueryComponentStateA(prodcode, NULL, MSIINSTALLCONTEXT_USERUNMANAGED, component, &state); + r = MsiQueryComponentStateA(prodcode, NULL, MSIINSTALLCONTEXT_USERUNMANAGED, component, &state); ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r); ok(state == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", state); /* MSIINSTALLCONTEXT_USERMANAGED */ state = MAGIC_ERROR; - r = pMsiQueryComponentStateA(prodcode, NULL, MSIINSTALLCONTEXT_USERMANAGED, component, &state); + r = MsiQueryComponentStateA(prodcode, NULL, MSIINSTALLCONTEXT_USERMANAGED, component, &state); ok(r == ERROR_UNKNOWN_PRODUCT, "Expected ERROR_UNKNOWN_PRODUCT, got %d\n", r); ok(state == MAGIC_ERROR, "Expected 0xdeadbeef, got %d\n", state); @@ -2450,7 +2338,7 @@ static void test_MsiQueryComponentState(void) ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %ld\n", res); state = MAGIC_ERROR; - r = pMsiQueryComponentStateA(prodcode, NULL, MSIINSTALLCONTEXT_USERMANAGED, component, &state); + r = MsiQueryComponentStateA(prodcode, NULL, MSIINSTALLCONTEXT_USERMANAGED, component, &state); ok(r == ERROR_UNKNOWN_PRODUCT, "Expected ERROR_UNKNOWN_PRODUCT, got %d\n", r); ok(state == MAGIC_ERROR, "Expected 0xdeadbeef, got %d\n", state); @@ -2466,11 +2354,11 @@ static void test_MsiQueryComponentState(void) ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %ld\n", res); state = MAGIC_ERROR; - r = pMsiQueryComponentStateA(prodcode, NULL, MSIINSTALLCONTEXT_USERMANAGED, component, &state); + r = MsiQueryComponentStateA(prodcode, NULL, MSIINSTALLCONTEXT_USERMANAGED, component, &state); ok(r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r); ok(state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state); - delete_key(prodkey, "", access & KEY_WOW64_64KEY); + RegDeleteKeyExA(prodkey, "", access & KEY_WOW64_64KEY, 0); RegCloseKey(prodkey); lstrcpyA(keypath, "Software\\Microsoft\\Windows\\CurrentVersion\\Installer\\UserData\\"); @@ -2486,15 +2374,15 @@ static void test_MsiQueryComponentState(void) ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %ld\n", res); state = MAGIC_ERROR; - r = pMsiQueryComponentStateA(prodcode, NULL, MSIINSTALLCONTEXT_USERMANAGED, component, &state); + r = MsiQueryComponentStateA(prodcode, NULL, MSIINSTALLCONTEXT_USERMANAGED, component, &state); ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r); ok(state == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", state); RegDeleteValueA(prodkey, "LocalPackage"); RegDeleteValueA(prodkey, "ManagedLocalPackage"); - delete_key(prodkey, "", access & KEY_WOW64_64KEY); + RegDeleteKeyExA(prodkey, "", access & KEY_WOW64_64KEY, 0); RegDeleteValueA(compkey, prod_squashed); - delete_key(compkey, "", access & KEY_WOW64_64KEY); + RegDeleteKeyExA(compkey, "", access & KEY_WOW64_64KEY, 0); RegCloseKey(prodkey); RegCloseKey(compkey); LocalFree(usersid); @@ -2674,9 +2562,9 @@ static void test_MsiGetComponentPath(void) ok(size == 10, "Expected 10, got %lu\n", size); RegDeleteValueA(compkey, prod_squashed); - delete_key(compkey, "", access & KEY_WOW64_64KEY); + RegDeleteKeyExA(compkey, "", access & KEY_WOW64_64KEY, 0); RegDeleteValueA(installprop, "WindowsInstaller"); - delete_key(installprop, "", access & KEY_WOW64_64KEY); + RegDeleteKeyExA(installprop, "", access & KEY_WOW64_64KEY, 0); RegCloseKey(compkey); RegCloseKey(installprop); DeleteFileA("C:\\imapath"); @@ -2764,9 +2652,9 @@ static void test_MsiGetComponentPath(void) ok(size == 10, "Expected 10, got %lu\n", size); RegDeleteValueA(compkey, prod_squashed); - delete_key(compkey, "", access & KEY_WOW64_64KEY); + RegDeleteKeyExA(compkey, "", access & KEY_WOW64_64KEY, 0); RegDeleteValueA(installprop, "WindowsInstaller"); - delete_key(installprop, "", access & KEY_WOW64_64KEY); + RegDeleteKeyExA(installprop, "", access & KEY_WOW64_64KEY, 0); RegCloseKey(compkey); RegCloseKey(installprop); DeleteFileA("C:\\imapath"); @@ -2874,10 +2762,10 @@ static void test_MsiGetComponentPath(void) ok(size == 10, "Expected 10, got %lu\n", size); RegDeleteValueA(compkey, prod_squashed); - delete_key(prodkey, "", access & KEY_WOW64_64KEY); - delete_key(compkey, "", access & KEY_WOW64_64KEY); + RegDeleteKeyExA(prodkey, "", access & KEY_WOW64_64KEY, 0); + RegDeleteKeyExA(compkey, "", access & KEY_WOW64_64KEY, 0); RegDeleteValueA(installprop, "WindowsInstaller"); - delete_key(installprop, "", access & KEY_WOW64_64KEY); + RegDeleteKeyExA(installprop, "", access & KEY_WOW64_64KEY, 0); RegCloseKey(prodkey); RegCloseKey(compkey); RegCloseKey(installprop); @@ -2957,7 +2845,7 @@ static void test_MsiGetComponentPath(void) RegDeleteValueA(compkey, prod_squashed); RegDeleteKeyA(prodkey, ""); - delete_key(compkey, "", access & KEY_WOW64_64KEY); + RegDeleteKeyExA(compkey, "", access & KEY_WOW64_64KEY, 0); RegCloseKey(prodkey); RegCloseKey(compkey); DeleteFileA("C:\\imapath"); @@ -3039,8 +2927,8 @@ static void test_MsiGetComponentPath(void) ok(size == 10, "Expected 10, got %lu\n", size); RegDeleteValueA(compkey, prod_squashed); - delete_key(prodkey, "", access & KEY_WOW64_64KEY); - delete_key(compkey, "", access & KEY_WOW64_64KEY); + RegDeleteKeyExA(prodkey, "", access & KEY_WOW64_64KEY, 0); + RegDeleteKeyExA(compkey, "", access & KEY_WOW64_64KEY, 0); RegCloseKey(prodkey); RegCloseKey(compkey); DeleteFileA("C:\\imapath"); @@ -3058,12 +2946,6 @@ static void test_MsiGetComponentPathEx(void) REGSAM access = KEY_ALL_ACCESS; LONG res; - if (!pMsiGetComponentPathExA) - { - win_skip( "MsiGetComponentPathExA not present\n" ); - return; - } - if (is_wow64) access |= KEY_WOW64_64KEY; create_test_guid( prod, prod_squashed ); @@ -3072,37 +2954,37 @@ static void test_MsiGetComponentPathEx(void) /* NULL product */ size = MAX_PATH; - state = pMsiGetComponentPathExA( NULL, comp, NULL, MSIINSTALLCONTEXT_USERMANAGED, path, &size ); + state = MsiGetComponentPathExA( NULL, comp, NULL, MSIINSTALLCONTEXT_USERMANAGED, path, &size ); ok( state == INSTALLSTATE_INVALIDARG, "got %d\n", state ); todo_wine ok( !size, "got %lu\n", size ); /* NULL component */ size = MAX_PATH; - state = pMsiGetComponentPathExA( prod, NULL, NULL, MSIINSTALLCONTEXT_USERMANAGED, path, &size ); + state = MsiGetComponentPathExA( prod, NULL, NULL, MSIINSTALLCONTEXT_USERMANAGED, path, &size ); ok( state == INSTALLSTATE_INVALIDARG, "got %d\n", state ); todo_wine ok( !size, "got %lu\n", size ); /* non-NULL usersid, MSIINSTALLCONTEXT_MACHINE */ size = MAX_PATH; - state = pMsiGetComponentPathExA( prod, comp, usersid, MSIINSTALLCONTEXT_MACHINE, path, &size); + state = MsiGetComponentPathExA( prod, comp, usersid, MSIINSTALLCONTEXT_MACHINE, path, &size); ok( state == INSTALLSTATE_INVALIDARG, "got %d\n", state ); todo_wine ok( !size, "got %lu\n", size ); /* NULL buf */ size = MAX_PATH; - state = pMsiGetComponentPathExA( prod, comp, NULL, MSIINSTALLCONTEXT_MACHINE, NULL, &size ); + state = MsiGetComponentPathExA( prod, comp, NULL, MSIINSTALLCONTEXT_MACHINE, NULL, &size ); ok( state == INSTALLSTATE_UNKNOWN, "got %d\n", state ); todo_wine ok( size == MAX_PATH * 2, "got %lu\n", size ); /* NULL buflen */ size = MAX_PATH; - state = pMsiGetComponentPathExA( prod, comp, NULL, MSIINSTALLCONTEXT_MACHINE, path, NULL ); + state = MsiGetComponentPathExA( prod, comp, NULL, MSIINSTALLCONTEXT_MACHINE, path, NULL ); ok( state == INSTALLSTATE_INVALIDARG, "got %d\n", state ); ok( size == MAX_PATH, "got %lu\n", size ); /* all params valid */ size = MAX_PATH; - state = pMsiGetComponentPathExA( prod, comp, NULL, MSIINSTALLCONTEXT_MACHINE, path, &size ); + state = MsiGetComponentPathExA( prod, comp, NULL, MSIINSTALLCONTEXT_MACHINE, path, &size ); ok( state == INSTALLSTATE_UNKNOWN, "got %d\n", state ); todo_wine ok( !size, "got %lu\n", size ); @@ -3121,7 +3003,7 @@ static void test_MsiGetComponentPathEx(void) /* local system component key exists */ size = MAX_PATH; - state = pMsiGetComponentPathExA( prod, comp, NULL, MSIINSTALLCONTEXT_MACHINE, path, &size ); + state = MsiGetComponentPathExA( prod, comp, NULL, MSIINSTALLCONTEXT_MACHINE, path, &size ); ok( state == INSTALLSTATE_UNKNOWN, "got %d\n", state ); res = RegSetValueExA( key_comp, prod_squashed, 0, REG_SZ, (const BYTE *)"c:\\testcomponentpath", 20 ); @@ -3130,7 +3012,7 @@ static void test_MsiGetComponentPathEx(void) /* product value exists */ path[0] = 0; size = MAX_PATH; - state = pMsiGetComponentPathExA( prod, comp, NULL, MSIINSTALLCONTEXT_MACHINE, path, &size ); + state = MsiGetComponentPathExA( prod, comp, NULL, MSIINSTALLCONTEXT_MACHINE, path, &size ); ok( state == INSTALLSTATE_ABSENT, "got %d\n", state ); ok( !lstrcmpA( path, "c:\\testcomponentpath" ), "got %s\n", path ); ok( size == 20, "got %lu\n", size ); @@ -3150,7 +3032,7 @@ static void test_MsiGetComponentPathEx(void) /* install properties key exists */ path[0] = 0; size = MAX_PATH; - state = pMsiGetComponentPathExA( prod, comp, NULL, MSIINSTALLCONTEXT_MACHINE, path, &size ); + state = MsiGetComponentPathExA( prod, comp, NULL, MSIINSTALLCONTEXT_MACHINE, path, &size ); ok( state == INSTALLSTATE_ABSENT, "got %d\n", state ); ok( !lstrcmpA( path, "c:\\testcomponentpath"), "got %s\n", path ); ok( size == 20, "got %lu\n", size ); @@ -3160,22 +3042,22 @@ static void test_MsiGetComponentPathEx(void) /* file exists */ path[0] = 0; size = 0; - state = pMsiGetComponentPathExA( prod, comp, NULL, MSIINSTALLCONTEXT_MACHINE, path, &size ); + state = MsiGetComponentPathExA( prod, comp, NULL, MSIINSTALLCONTEXT_MACHINE, path, &size ); ok( state == INSTALLSTATE_MOREDATA, "got %d\n", state ); ok( !path[0], "got %s\n", path ); todo_wine ok( size == 40, "got %lu\n", size ); path[0] = 0; size = MAX_PATH; - state = pMsiGetComponentPathExA( prod, comp, NULL, MSIINSTALLCONTEXT_MACHINE, path, &size ); + state = MsiGetComponentPathExA( prod, comp, NULL, MSIINSTALLCONTEXT_MACHINE, path, &size ); ok( state == INSTALLSTATE_LOCAL, "got %d\n", state ); ok( !lstrcmpA( path, "c:\\testcomponentpath" ), "got %s\n", path ); ok( size == 20, "got %lu\n", size ); RegDeleteValueA( key_comp, prod_squashed ); - delete_key( key_comp, "", access & KEY_WOW64_64KEY ); + RegDeleteKeyExA( key_comp, "", access & KEY_WOW64_64KEY, 0 ); RegDeleteValueA( key_installprop, "WindowsInstaller" ); - delete_key( key_installprop, "", access & KEY_WOW64_64KEY ); + RegDeleteKeyExA( key_installprop, "", access & KEY_WOW64_64KEY, 0 ); RegCloseKey( key_comp ); RegCloseKey( key_installprop ); DeleteFileA( "c:\\testcomponentpath" ); @@ -3188,7 +3070,7 @@ static void test_MsiGetComponentPathEx(void) /* user unmanaged product key exists */ size = MAX_PATH; - state = pMsiGetComponentPathExA( prod, comp, NULL, MSIINSTALLCONTEXT_USERUNMANAGED, path, &size ); + state = MsiGetComponentPathExA( prod, comp, NULL, MSIINSTALLCONTEXT_USERUNMANAGED, path, &size ); ok( state == INSTALLSTATE_UNKNOWN, "got %d\n", state ); todo_wine ok(!size, "got %lu\n", size); @@ -3203,7 +3085,7 @@ static void test_MsiGetComponentPathEx(void) /* user unmanaged component key exists */ size = MAX_PATH; - state = pMsiGetComponentPathExA( prod, comp, NULL, MSIINSTALLCONTEXT_USERUNMANAGED, path, &size ); + state = MsiGetComponentPathExA( prod, comp, NULL, MSIINSTALLCONTEXT_USERUNMANAGED, path, &size ); ok( state == INSTALLSTATE_UNKNOWN, "got %d\n", state ); todo_wine ok(!size, "got %lu\n", size); @@ -3213,7 +3095,7 @@ static void test_MsiGetComponentPathEx(void) /* product value exists */ path[0] = 0; size = MAX_PATH; - state = pMsiGetComponentPathExA( prod, comp, NULL, MSIINSTALLCONTEXT_USERUNMANAGED, path, &size ); + state = MsiGetComponentPathExA( prod, comp, NULL, MSIINSTALLCONTEXT_USERUNMANAGED, path, &size ); ok( state == INSTALLSTATE_ABSENT, "got %d\n", state ); ok( !lstrcmpA( path, "c:\\testcomponentpath"), "got %s\n", path ); ok( size == 20, "got %lu\n", size ); @@ -3223,14 +3105,14 @@ static void test_MsiGetComponentPathEx(void) /* file exists */ path[0] = 0; size = MAX_PATH; - state = pMsiGetComponentPathExA( prod, comp, NULL, MSIINSTALLCONTEXT_USERUNMANAGED, path, &size ); + state = MsiGetComponentPathExA( prod, comp, NULL, MSIINSTALLCONTEXT_USERUNMANAGED, path, &size ); ok( state == INSTALLSTATE_LOCAL, "got %d\n", state ); ok( !lstrcmpA( path, "c:\\testcomponentpath"), "got %s\n", path ); ok( size == 20, "got %lu\n", size ); RegDeleteValueA( key_comp, prod_squashed ); RegDeleteKeyA( key_prod, "" ); - delete_key( key_comp, "", access & KEY_WOW64_64KEY ); + RegDeleteKeyExA( key_comp, "", access & KEY_WOW64_64KEY, 0 ); RegCloseKey( key_prod ); RegCloseKey( key_comp ); DeleteFileA( "c:\\testcomponentpath" ); @@ -3246,7 +3128,7 @@ static void test_MsiGetComponentPathEx(void) /* user managed product key exists */ size = MAX_PATH; - state = pMsiGetComponentPathExA( prod, comp, NULL, MSIINSTALLCONTEXT_USERMANAGED, path, &size ); + state = MsiGetComponentPathExA( prod, comp, NULL, MSIINSTALLCONTEXT_USERMANAGED, path, &size ); ok( state == INSTALLSTATE_UNKNOWN, "got %d\n", state ); lstrcpyA( path_key, "Software\\Microsoft\\Windows\\CurrentVersion\\" ); @@ -3260,7 +3142,7 @@ static void test_MsiGetComponentPathEx(void) /* user managed component key exists */ size = MAX_PATH; - state = pMsiGetComponentPathExA( prod, comp, NULL, MSIINSTALLCONTEXT_USERMANAGED, path, &size ); + state = MsiGetComponentPathExA( prod, comp, NULL, MSIINSTALLCONTEXT_USERMANAGED, path, &size ); ok( state == INSTALLSTATE_UNKNOWN, "got %d\n", state ); res = RegSetValueExA( key_comp, prod_squashed, 0, REG_SZ, (const BYTE *)"c:\\testcomponentpath", 20 ); @@ -3269,7 +3151,7 @@ static void test_MsiGetComponentPathEx(void) /* product value exists */ path[0] = 0; size = MAX_PATH; - state = pMsiGetComponentPathExA( prod, comp, NULL, MSIINSTALLCONTEXT_USERMANAGED, path, &size ); + state = MsiGetComponentPathExA( prod, comp, NULL, MSIINSTALLCONTEXT_USERMANAGED, path, &size ); ok( state == INSTALLSTATE_ABSENT, "got %d\n", state ); ok( !lstrcmpA( path, "c:\\testcomponentpath" ), "got %s\n", path ); ok( size == 20, "got %lu\n", size ); @@ -3289,7 +3171,7 @@ static void test_MsiGetComponentPathEx(void) /* install properties key exists */ path[0] = 0; size = MAX_PATH; - state = pMsiGetComponentPathExA( prod, comp, NULL, MSIINSTALLCONTEXT_USERMANAGED, path, &size ); + state = MsiGetComponentPathExA( prod, comp, NULL, MSIINSTALLCONTEXT_USERMANAGED, path, &size ); ok( state == INSTALLSTATE_ABSENT, "got %d\n", state ); ok( !lstrcmpA( path, "c:\\testcomponentpath" ), "got %s\n", path ); ok( size == 20, "got %lu\n", size ); @@ -3299,16 +3181,16 @@ static void test_MsiGetComponentPathEx(void) /* file exists */ path[0] = 0; size = MAX_PATH; - state = pMsiGetComponentPathExA( prod, comp, NULL, MSIINSTALLCONTEXT_USERMANAGED, path, &size ); + state = MsiGetComponentPathExA( prod, comp, NULL, MSIINSTALLCONTEXT_USERMANAGED, path, &size ); ok( state == INSTALLSTATE_LOCAL, "got %d\n", state ); ok( !lstrcmpA( path, "c:\\testcomponentpath" ), "got %s\n", path ); ok( size == 20, "got %lu\n", size ); RegDeleteValueA( key_comp, prod_squashed ); - delete_key( key_prod, "", access & KEY_WOW64_64KEY ); - delete_key( key_comp, "", access & KEY_WOW64_64KEY ); + RegDeleteKeyExA( key_prod, "", access & KEY_WOW64_64KEY, 0 ); + RegDeleteKeyExA( key_comp, "", access & KEY_WOW64_64KEY, 0 ); RegDeleteValueA( key_installprop, "WindowsInstaller" ); - delete_key( key_installprop, "", access & KEY_WOW64_64KEY ); + RegDeleteKeyExA( key_installprop, "", access & KEY_WOW64_64KEY, 0 ); RegCloseKey( key_prod ); RegCloseKey( key_comp ); RegCloseKey( key_installprop ); @@ -3327,7 +3209,7 @@ static void test_MsiGetComponentPathEx(void) /* local classes product key exists */ size = MAX_PATH; - state = pMsiGetComponentPathExA( prod, comp, NULL, MSIINSTALLCONTEXT_MACHINE, path, &size ); + state = MsiGetComponentPathExA( prod, comp, NULL, MSIINSTALLCONTEXT_MACHINE, path, &size ); ok( state == INSTALLSTATE_UNKNOWN, "got %d\n", state ); todo_wine ok(!size, "got %lu\n", size); @@ -3340,7 +3222,7 @@ static void test_MsiGetComponentPathEx(void) /* local user component key exists */ size = MAX_PATH; - state = pMsiGetComponentPathExA( prod, comp, NULL, MSIINSTALLCONTEXT_MACHINE, path, &size ); + state = MsiGetComponentPathExA( prod, comp, NULL, MSIINSTALLCONTEXT_MACHINE, path, &size ); ok( state == INSTALLSTATE_UNKNOWN, "got %d\n", state ); todo_wine ok(!size, "got %lu\n", size); @@ -3350,7 +3232,7 @@ static void test_MsiGetComponentPathEx(void) /* product value exists */ path[0] = 0; size = MAX_PATH; - state = pMsiGetComponentPathExA( prod, comp, NULL, MSIINSTALLCONTEXT_MACHINE, path, &size ); + state = MsiGetComponentPathExA( prod, comp, NULL, MSIINSTALLCONTEXT_MACHINE, path, &size ); ok( state == INSTALLSTATE_ABSENT, "got %d\n", state ); ok( !lstrcmpA( path, "c:\\testcomponentpath" ), "got %s\n", path ); ok( size == 20, "got %lu\n", size ); @@ -3360,14 +3242,14 @@ static void test_MsiGetComponentPathEx(void) /* file exists */ path[0] = 0; size = MAX_PATH; - state = pMsiGetComponentPathExA( prod, comp, NULL, MSIINSTALLCONTEXT_MACHINE, path, &size ); + state = MsiGetComponentPathExA( prod, comp, NULL, MSIINSTALLCONTEXT_MACHINE, path, &size ); ok( state == INSTALLSTATE_LOCAL, "got %d\n", state ); ok( !lstrcmpA( path, "c:\\testcomponentpath" ), "got %s\n", path ); ok( size == 20, "got %lu\n", size ); RegDeleteValueA( key_comp, prod_squashed ); - delete_key( key_prod, "", access & KEY_WOW64_64KEY ); - delete_key( key_comp, "", access & KEY_WOW64_64KEY ); + RegDeleteKeyExA( key_prod, "", access & KEY_WOW64_64KEY, 0 ); + RegDeleteKeyExA( key_comp, "", access & KEY_WOW64_64KEY, 0 ); RegCloseKey( key_prod ); RegCloseKey( key_comp ); DeleteFileA( "c:\\testcomponentpath" ); @@ -3382,7 +3264,7 @@ static void test_MsiProvideComponent(void) DWORD len, len2; UINT r; - if (is_process_limited()) + if (!is_process_elevated()) { skip("process is limited\n"); return; @@ -3396,9 +3278,9 @@ static void test_MsiProvideComponent(void) buf[0] = 0; len = sizeof(buf); - r = pMsiProvideComponentA("{90120000-0070-0000-0000-4000000FF1CE}", - "{17961602-C4E2-482E-800A-DF6E627549CF}", - "ProductFiles", INSTALLMODE_NODETECTION, buf, &len); + r = MsiProvideComponentA("{90120000-0070-0000-0000-4000000FF1CE}", + "{17961602-C4E2-482E-800A-DF6E627549CF}", + "ProductFiles", INSTALLMODE_NODETECTION, buf, &len); ok(r == ERROR_INVALID_PARAMETER, "got %u\n", r); r = MsiInstallProductA(msifile, NULL); @@ -3409,24 +3291,24 @@ static void test_MsiProvideComponent(void) buf[0] = 0; len = sizeof(buf); - r = pMsiProvideComponentA("{38847338-1BBC-4104-81AC-2FAAC7ECDDCD}", "sourcedir", - "{DD422F92-3ED8-49B5-A0B7-F266F98357DF}", - INSTALLMODE_NODETECTION, buf, &len); + r = MsiProvideComponentA("{38847338-1BBC-4104-81AC-2FAAC7ECDDCD}", "sourcedir", + "{DD422F92-3ED8-49B5-A0B7-F266F98357DF}", + INSTALLMODE_NODETECTION, buf, &len); ok(r == ERROR_SUCCESS, "got %u\n", r); ok(buf[0], "empty path\n"); ok(len == lstrlenA(buf), "got %lu\n", len); len2 = 0; - r = pMsiProvideComponentA("{38847338-1BBC-4104-81AC-2FAAC7ECDDCD}", "sourcedir", - "{DD422F92-3ED8-49B5-A0B7-F266F98357DF}", - INSTALLMODE_NODETECTION, NULL, &len2); + r = MsiProvideComponentA("{38847338-1BBC-4104-81AC-2FAAC7ECDDCD}", "sourcedir", + "{DD422F92-3ED8-49B5-A0B7-F266F98357DF}", + INSTALLMODE_NODETECTION, NULL, &len2); ok(r == ERROR_SUCCESS, "got %u\n", r); ok(len2 == len, "got %lu\n", len2); len2 = 0; - r = pMsiProvideComponentA("{38847338-1BBC-4104-81AC-2FAAC7ECDDCD}", "sourcedir", - "{DD422F92-3ED8-49B5-A0B7-F266F98357DF}", - INSTALLMODE_NODETECTION, buf, &len2); + r = MsiProvideComponentA("{38847338-1BBC-4104-81AC-2FAAC7ECDDCD}", "sourcedir", + "{DD422F92-3ED8-49B5-A0B7-F266F98357DF}", + INSTALLMODE_NODETECTION, buf, &len2); ok(r == ERROR_MORE_DATA, "got %u\n", r); ok(len2 == len, "got %lu\n", len2); @@ -3434,21 +3316,21 @@ static void test_MsiProvideComponent(void) bufW[0] = 0; len = sizeof(buf); - r = pMsiProvideComponentW(L"{38847338-1BBC-4104-81AC-2FAAC7ECDDCD}", L"sourcedir", - L"{DD422F92-3ED8-49B5-A0B7-F266F98357DF}", INSTALLMODE_NODETECTION, bufW, &len); + r = MsiProvideComponentW(L"{38847338-1BBC-4104-81AC-2FAAC7ECDDCD}", L"sourcedir", + L"{DD422F92-3ED8-49B5-A0B7-F266F98357DF}", INSTALLMODE_NODETECTION, bufW, &len); ok(r == ERROR_SUCCESS, "got %u\n", r); ok(bufW[0], "empty path\n"); ok(len == lstrlenW(bufW), "got %lu\n", len); len2 = 0; - r = pMsiProvideComponentW(L"{38847338-1BBC-4104-81AC-2FAAC7ECDDCD}", L"sourcedir", - L"{DD422F92-3ED8-49B5-A0B7-F266F98357DF}", INSTALLMODE_NODETECTION, NULL, &len2); + r = MsiProvideComponentW(L"{38847338-1BBC-4104-81AC-2FAAC7ECDDCD}", L"sourcedir", + L"{DD422F92-3ED8-49B5-A0B7-F266F98357DF}", INSTALLMODE_NODETECTION, NULL, &len2); ok(r == ERROR_SUCCESS, "got %u\n", r); ok(len2 == len, "got %lu\n", len2); len2 = 0; - r = pMsiProvideComponentW(L"{38847338-1BBC-4104-81AC-2FAAC7ECDDCD}", L"sourcedir", - L"{DD422F92-3ED8-49B5-A0B7-F266F98357DF}", INSTALLMODE_NODETECTION, bufW, &len2); + r = MsiProvideComponentW(L"{38847338-1BBC-4104-81AC-2FAAC7ECDDCD}", L"sourcedir", + L"{DD422F92-3ED8-49B5-A0B7-F266F98357DF}", INSTALLMODE_NODETECTION, bufW, &len2); ok(r == ERROR_MORE_DATA, "got %u\n", r); ok(len2 == len, "got %lu\n", len2); @@ -3472,7 +3354,7 @@ static void test_MsiProvideQualifiedComponentEx(void) HKEY hkey, hkey2, hkey3, hkey4, hkey5; LONG res; - if (is_process_limited()) + if (!is_process_elevated()) { skip( "process is limited\n" ); return; @@ -3588,15 +3470,15 @@ static void test_MsiProvideQualifiedComponentEx(void) DeleteFileA( "msitest\\text.txt" ); RemoveDirectoryA( "msitest" ); - delete_key( hkey5, "", access & KEY_WOW64_64KEY ); + RegDeleteKeyExA( hkey5, "", access & KEY_WOW64_64KEY, 0 ); RegCloseKey( hkey5 ); - delete_key( hkey4, "", access & KEY_WOW64_64KEY ); + RegDeleteKeyExA( hkey4, "", access & KEY_WOW64_64KEY, 0 ); RegCloseKey( hkey4 ); - delete_key( hkey3, "", access & KEY_WOW64_64KEY ); + RegDeleteKeyExA( hkey3, "", access & KEY_WOW64_64KEY, 0 ); RegCloseKey( hkey3 ); - delete_key( hkey2, "", access & KEY_WOW64_64KEY ); + RegDeleteKeyExA( hkey2, "", access & KEY_WOW64_64KEY, 0 ); RegCloseKey( hkey2 ); - delete_key( hkey, "", access & KEY_WOW64_64KEY ); + RegDeleteKeyExA( hkey, "", access & KEY_WOW64_64KEY, 0 ); RegCloseKey( hkey ); } @@ -3715,7 +3597,7 @@ static void test_MsiGetProductCode(void) ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r); ok(!lstrcmpA(product, prodcode), "Expected %s, got %s\n", prodcode, product); - delete_key(prodkey, "", access & KEY_WOW64_64KEY); + RegDeleteKeyExA(prodkey, "", access & KEY_WOW64_64KEY, 0); RegCloseKey(prodkey); lstrcpyA(keypath, "Software\\Microsoft\\Installer\\Products\\"); @@ -3751,7 +3633,7 @@ static void test_MsiGetProductCode(void) ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r); ok(!lstrcmpA(product, prodcode), "Expected %s, got %s\n", prodcode, product); - delete_key(prodkey, "", access & KEY_WOW64_64KEY); + RegDeleteKeyExA(prodkey, "", access & KEY_WOW64_64KEY, 0); RegCloseKey(prodkey); lstrcpyA(keypath, "Software\\Microsoft\\Windows\\CurrentVersion\\"); @@ -3769,11 +3651,11 @@ static void test_MsiGetProductCode(void) ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r); ok(!lstrcmpA(product, prodcode2), "Expected %s, got %s\n", prodcode2, product); - delete_key(prodkey, "", access & KEY_WOW64_64KEY); + RegDeleteKeyExA(prodkey, "", access & KEY_WOW64_64KEY, 0); RegCloseKey(prodkey); RegDeleteValueA(compkey, prod_squashed); RegDeleteValueA(compkey, prod2_squashed); - delete_key(compkey, "", access & KEY_WOW64_64KEY); + RegDeleteKeyExA(compkey, "", access & KEY_WOW64_64KEY, 0); RegCloseKey(compkey); lstrcpyA(keypath, "Software\\Microsoft\\Windows\\CurrentVersion\\"); @@ -3816,7 +3698,7 @@ static void test_MsiGetProductCode(void) ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r); ok(!lstrcmpA(product, prodcode), "Expected %s, got %s\n", prodcode, product); - delete_key(prodkey, "", access & KEY_WOW64_64KEY); + RegDeleteKeyExA(prodkey, "", access & KEY_WOW64_64KEY, 0); RegCloseKey(prodkey); lstrcpyA(keypath, "Software\\Microsoft\\Installer\\Products\\"); @@ -3852,7 +3734,7 @@ static void test_MsiGetProductCode(void) ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r); ok(!lstrcmpA(product, prodcode), "Expected %s, got %s\n", prodcode, product); - delete_key(prodkey, "", access & KEY_WOW64_64KEY); + RegDeleteKeyExA(prodkey, "", access & KEY_WOW64_64KEY, 0); RegCloseKey(prodkey); lstrcpyA(keypath, "Software\\Microsoft\\Windows\\CurrentVersion\\"); @@ -3870,11 +3752,11 @@ static void test_MsiGetProductCode(void) ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r); ok(!lstrcmpA(product, prodcode2), "Expected %s, got %s\n", prodcode2, product); - delete_key(prodkey, "", access & KEY_WOW64_64KEY); + RegDeleteKeyExA(prodkey, "", access & KEY_WOW64_64KEY, 0); RegCloseKey(prodkey); RegDeleteValueA(compkey, prod_squashed); RegDeleteValueA(compkey, prod2_squashed); - delete_key(compkey, "", access & KEY_WOW64_64KEY); + RegDeleteKeyExA(compkey, "", access & KEY_WOW64_64KEY, 0); RegCloseKey(compkey); LocalFree(usersid); } @@ -4001,7 +3883,7 @@ static void test_MsiEnumClients(void) RegDeleteValueA(compkey, prod_squashed); RegDeleteValueA(compkey, prod2_squashed); - delete_key(compkey, "", access & KEY_WOW64_64KEY); + RegDeleteKeyExA(compkey, "", access & KEY_WOW64_64KEY, 0); RegCloseKey(compkey); lstrcpyA(keypath, "Software\\Microsoft\\Windows\\CurrentVersion\\"); @@ -4009,6 +3891,12 @@ static void test_MsiEnumClients(void) lstrcatA(keypath, comp_squashed); res = RegCreateKeyExA(HKEY_LOCAL_MACHINE, keypath, 0, NULL, 0, access, NULL, &compkey, NULL); + if (res == ERROR_ACCESS_DENIED) + { + skip("Not enough rights to perform tests\n"); + LocalFree(usersid); + return; + } ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %ld\n", res); /* user local component key exists */ @@ -4071,7 +3959,7 @@ static void test_MsiEnumClients(void) RegDeleteValueA(compkey, prod_squashed); RegDeleteValueA(compkey, prod2_squashed); - delete_key(compkey, "", access & KEY_WOW64_64KEY); + RegDeleteKeyExA(compkey, "", access & KEY_WOW64_64KEY, 0); RegCloseKey(compkey); LocalFree(usersid); } @@ -4281,13 +4169,6 @@ static void test_MsiGetFileVersion(void) lstrcpyA(lang, "lang"); r = MsiGetFileVersionA(path, version, &versz, lang, &langsz); ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r); - if (langchecksz && !langsz) - { - win_skip("broken MsiGetFileVersionA detected\n"); - free(vercheck); - free(langcheck); - return; - } ok(versz == verchecksz, "Expected %lu, got %lu\n", verchecksz, versz); ok(strstr(lang, langcheck) != NULL, "Expected \"%s\" in \"%s\"\n", langcheck, lang); ok(!lstrcmpA(version, vercheck), @@ -4512,7 +4393,7 @@ static void test_MsiGetProductInfo(void) ok(!lstrcmpA(buf, "apple"), "Expected buf to be unchanged, got %s\n", buf); ok(sz == MAX_PATH, "got %lu\n", sz); - delete_key(prodkey, "", access & KEY_WOW64_64KEY); + RegDeleteKeyExA(prodkey, "", access & KEY_WOW64_64KEY, 0); RegCloseKey(prodkey); lstrcpyA(keypath, "Software\\Microsoft\\Windows\\CurrentVersion\\Installer\\UserData\\"); @@ -4624,9 +4505,9 @@ static void test_MsiGetProductInfo(void) RegDeleteValueA(propkey, "IMadeThis"); RegDeleteValueA(propkey, "HelpLink"); - delete_key(propkey, "", access & KEY_WOW64_64KEY); - delete_key(localkey, "", access & KEY_WOW64_64KEY); - delete_key(prodkey, "", access & KEY_WOW64_64KEY); + RegDeleteKeyExA(propkey, "", access & KEY_WOW64_64KEY, 0); + RegDeleteKeyExA(localkey, "", access & KEY_WOW64_64KEY, 0); + RegDeleteKeyExA(prodkey, "", access & KEY_WOW64_64KEY, 0); RegCloseKey(propkey); RegCloseKey(localkey); RegCloseKey(prodkey); @@ -4686,8 +4567,8 @@ static void test_MsiGetProductInfo(void) ok(sz == 4, "Expected 4, got %lu\n", sz); RegDeleteValueA(propkey, "HelpLink"); - delete_key(propkey, "", access & KEY_WOW64_64KEY); - delete_key(localkey, "", access & KEY_WOW64_64KEY); + RegDeleteKeyExA(propkey, "", access & KEY_WOW64_64KEY, 0); + RegDeleteKeyExA(localkey, "", access & KEY_WOW64_64KEY, 0); RegDeleteKeyA(prodkey, ""); RegCloseKey(propkey); RegCloseKey(localkey); @@ -4743,8 +4624,8 @@ static void test_MsiGetProductInfo(void) ok(!lstrcmpA(buf, "apple"), "Expected \"apple\", got \"%s\"\n", buf); ok(sz == MAX_PATH, "Expected MAX_PATH, got %lu\n", sz); - delete_key(propkey, "", access & KEY_WOW64_64KEY); - delete_key(localkey, "", access & KEY_WOW64_64KEY); + RegDeleteKeyExA(propkey, "", access & KEY_WOW64_64KEY, 0); + RegDeleteKeyExA(localkey, "", access & KEY_WOW64_64KEY, 0); RegCloseKey(propkey); RegCloseKey(localkey); @@ -5649,8 +5530,8 @@ static void test_MsiGetProductInfo(void) RegDeleteValueA(propkey, "Version"); RegDeleteValueA(propkey, "ProductIcon"); RegDeleteValueA(propkey, "AuthorizedLUAApp"); - delete_key(propkey, "", access & KEY_WOW64_64KEY); - delete_key(localkey, "", access & KEY_WOW64_64KEY); + RegDeleteKeyExA(propkey, "", access & KEY_WOW64_64KEY, 0); + RegDeleteKeyExA(localkey, "", access & KEY_WOW64_64KEY, 0); RegDeleteValueA(prodkey, "InstanceType"); RegDeleteValueA(prodkey, "Transforms"); RegDeleteValueA(prodkey, "Language"); @@ -5661,8 +5542,8 @@ static void test_MsiGetProductInfo(void) RegDeleteValueA(prodkey, "ProductIcon"); RegDeleteValueA(prodkey, "AuthorizedLUAApp"); RegDeleteValueA(source, "PackageName"); - delete_key(source, "", access & KEY_WOW64_64KEY); - delete_key(prodkey, "", access & KEY_WOW64_64KEY); + RegDeleteKeyExA(source, "", access & KEY_WOW64_64KEY, 0); + RegDeleteKeyExA(prodkey, "", access & KEY_WOW64_64KEY, 0); RegCloseKey(propkey); RegCloseKey(localkey); RegCloseKey(source); @@ -5686,12 +5567,6 @@ static void test_MsiGetProductInfoEx(void) DWORD sz; REGSAM access = KEY_ALL_ACCESS; - if (!pMsiGetProductInfoExA) - { - win_skip("MsiGetProductInfoExA is not available\n"); - return; - } - create_test_guid(prodcode, prod_squashed); create_test_guid(packcode, pack_squashed); usersid = get_user_sid(); @@ -5702,115 +5577,95 @@ static void test_MsiGetProductInfoEx(void) /* NULL szProductCode */ sz = MAX_PATH; lstrcpyA(buf, "apple"); - r = pMsiGetProductInfoExA(NULL, usersid, MSIINSTALLCONTEXT_USERUNMANAGED, - INSTALLPROPERTY_PRODUCTSTATEA, buf, &sz); - ok(r == ERROR_INVALID_PARAMETER, - "Expected ERROR_INVALID_PARAMETER, got %d\n", r); + r = MsiGetProductInfoExA(NULL, usersid, MSIINSTALLCONTEXT_USERUNMANAGED, + INSTALLPROPERTY_PRODUCTSTATEA, buf, &sz); + ok(r == ERROR_INVALID_PARAMETER, "Expected ERROR_INVALID_PARAMETER, got %d\n", r); ok(!lstrcmpA(buf, "apple"), "Expected buf to be unchanged, got %s\n", buf); ok(sz == MAX_PATH, "Expected MAX_PATH, got %lu\n", sz); /* empty szProductCode */ sz = MAX_PATH; lstrcpyA(buf, "apple"); - r = pMsiGetProductInfoExA("", usersid, MSIINSTALLCONTEXT_USERUNMANAGED, - INSTALLPROPERTY_PRODUCTSTATEA, buf, &sz); - ok(r == ERROR_INVALID_PARAMETER, - "Expected ERROR_INVALID_PARAMETER, got %d\n", r); + r = MsiGetProductInfoExA("", usersid, MSIINSTALLCONTEXT_USERUNMANAGED, + INSTALLPROPERTY_PRODUCTSTATEA, buf, &sz); + ok(r == ERROR_INVALID_PARAMETER, "Expected ERROR_INVALID_PARAMETER, got %d\n", r); ok(!lstrcmpA(buf, "apple"), "Expected buf to be unchanged, got %s\n", buf); ok(sz == MAX_PATH, "Expected MAX_PATH, got %lu\n", sz); /* garbage szProductCode */ sz = MAX_PATH; lstrcpyA(buf, "apple"); - r = pMsiGetProductInfoExA("garbage", usersid, MSIINSTALLCONTEXT_USERUNMANAGED, - INSTALLPROPERTY_PRODUCTSTATEA, buf, &sz); - ok(r == ERROR_INVALID_PARAMETER, - "Expected ERROR_INVALID_PARAMETER, got %d\n", r); + r = MsiGetProductInfoExA("garbage", usersid, MSIINSTALLCONTEXT_USERUNMANAGED, + INSTALLPROPERTY_PRODUCTSTATEA, buf, &sz); + ok(r == ERROR_INVALID_PARAMETER, "Expected ERROR_INVALID_PARAMETER, got %d\n", r); ok(!lstrcmpA(buf, "apple"), "Expected buf to be unchanged, got %s\n", buf); ok(sz == MAX_PATH, "Expected MAX_PATH, got %lu\n", sz); /* guid without brackets */ sz = MAX_PATH; lstrcpyA(buf, "apple"); - r = pMsiGetProductInfoExA("6700E8CF-95AB-4D9C-BC2C-15840DEA7A5D", usersid, - MSIINSTALLCONTEXT_USERUNMANAGED, - INSTALLPROPERTY_PRODUCTSTATEA, buf, &sz); - ok(r == ERROR_INVALID_PARAMETER, - "Expected ERROR_INVALID_PARAMETER, got %d\n", r); + r = MsiGetProductInfoExA("6700E8CF-95AB-4D9C-BC2C-15840DEA7A5D", usersid, + MSIINSTALLCONTEXT_USERUNMANAGED, + INSTALLPROPERTY_PRODUCTSTATEA, buf, &sz); + ok(r == ERROR_INVALID_PARAMETER, "Expected ERROR_INVALID_PARAMETER, got %d\n", r); ok(!lstrcmpA(buf, "apple"), "Expected buf to be unchanged, got %s\n", buf); ok(sz == MAX_PATH, "Expected MAX_PATH, got %lu\n", sz); /* guid with brackets */ sz = MAX_PATH; lstrcpyA(buf, "apple"); - r = pMsiGetProductInfoExA("{6700E8CF-95AB-4D9C-BC2C-15840DEA7A5D}", usersid, - MSIINSTALLCONTEXT_USERUNMANAGED, - INSTALLPROPERTY_PRODUCTSTATEA, buf, &sz); - ok(r == ERROR_UNKNOWN_PRODUCT, - "Expected ERROR_UNKNOWN_PRODUCT, got %d\n", r); + r = MsiGetProductInfoExA("{6700E8CF-95AB-4D9C-BC2C-15840DEA7A5D}", usersid, + MSIINSTALLCONTEXT_USERUNMANAGED, + INSTALLPROPERTY_PRODUCTSTATEA, buf, &sz); + ok(r == ERROR_UNKNOWN_PRODUCT, "Expected ERROR_UNKNOWN_PRODUCT, got %d\n", r); ok(!lstrcmpA(buf, "apple"), "Expected buf to be unchanged, got %s\n", buf); ok(sz == MAX_PATH, "Expected MAX_PATH, got %lu\n", sz); /* szValue is non-NULL while pcchValue is NULL */ lstrcpyA(buf, "apple"); - r = pMsiGetProductInfoExA(prodcode, usersid, - MSIINSTALLCONTEXT_USERUNMANAGED, - INSTALLPROPERTY_PRODUCTSTATEA, buf, NULL); - ok(r == ERROR_INVALID_PARAMETER, - "Expected ERROR_INVALID_PARAMETER, got %d\n", r); + r = MsiGetProductInfoExA(prodcode, usersid, MSIINSTALLCONTEXT_USERUNMANAGED, + INSTALLPROPERTY_PRODUCTSTATEA, buf, NULL); + ok(r == ERROR_INVALID_PARAMETER, "Expected ERROR_INVALID_PARAMETER, got %d\n", r); ok(!lstrcmpA(buf, "apple"), "Expected buf to be unchanged, got %s\n", buf); /* dwContext is out of range */ sz = MAX_PATH; lstrcpyA(buf, "apple"); - r = pMsiGetProductInfoExA(prodcode, usersid, 42, - INSTALLPROPERTY_PRODUCTSTATEA, buf, &sz); - ok(r == ERROR_INVALID_PARAMETER, - "Expected ERROR_INVALID_PARAMETER, got %d\n", r); + r = MsiGetProductInfoExA(prodcode, usersid, 42, INSTALLPROPERTY_PRODUCTSTATEA, buf, &sz); + ok(r == ERROR_INVALID_PARAMETER, "Expected ERROR_INVALID_PARAMETER, got %d\n", r); ok(!lstrcmpA(buf, "apple"), "Expected buf to be unchanged, got %s\n", buf); ok(sz == MAX_PATH, "Expected MAX_PATH, got %lu\n", sz); /* szProperty is NULL */ sz = MAX_PATH; lstrcpyA(buf, "apple"); - r = pMsiGetProductInfoExA(prodcode, usersid, - MSIINSTALLCONTEXT_USERUNMANAGED, - NULL, buf, &sz); - ok(r == ERROR_INVALID_PARAMETER, - "Expected ERROR_INVALID_PARAMETER, got %d\n", r); + r = MsiGetProductInfoExA(prodcode, usersid, MSIINSTALLCONTEXT_USERUNMANAGED, NULL, buf, &sz); + ok(r == ERROR_INVALID_PARAMETER, "Expected ERROR_INVALID_PARAMETER, got %d\n", r); ok(!lstrcmpA(buf, "apple"), "Expected buf to be unchanged, got %s\n", buf); ok(sz == MAX_PATH, "Expected MAX_PATH, got %lu\n", sz); /* szProperty is empty */ sz = MAX_PATH; lstrcpyA(buf, "apple"); - r = pMsiGetProductInfoExA(prodcode, usersid, - MSIINSTALLCONTEXT_USERUNMANAGED, - "", buf, &sz); - ok(r == ERROR_INVALID_PARAMETER, - "Expected ERROR_INVALID_PARAMETER, got %d\n", r); + r = MsiGetProductInfoExA(prodcode, usersid, MSIINSTALLCONTEXT_USERUNMANAGED, "", buf, &sz); + ok(r == ERROR_INVALID_PARAMETER, "Expected ERROR_INVALID_PARAMETER, got %d\n", r); ok(!lstrcmpA(buf, "apple"), "Expected buf to be unchanged, got %s\n", buf); ok(sz == MAX_PATH, "Expected MAX_PATH, got %lu\n", sz); /* szProperty is not a valid property */ sz = MAX_PATH; lstrcpyA(buf, "apple"); - r = pMsiGetProductInfoExA(prodcode, usersid, - MSIINSTALLCONTEXT_USERUNMANAGED, - "notvalid", buf, &sz); - ok(r == ERROR_UNKNOWN_PRODUCT, - "Expected ERROR_UNKNOWN_PRODUCT, got %d\n", r); + r = MsiGetProductInfoExA(prodcode, usersid, MSIINSTALLCONTEXT_USERUNMANAGED, "notvalid", buf, &sz); + ok(r == ERROR_UNKNOWN_PRODUCT, "Expected ERROR_UNKNOWN_PRODUCT, got %d\n", r); ok(!lstrcmpA(buf, "apple"), "Expected buf to be unchanged, got %s\n", buf); ok(sz == MAX_PATH, "Expected MAX_PATH, got %lu\n", sz); /* same length as guid, but random */ sz = MAX_PATH; lstrcpyA(buf, "apple"); - r = pMsiGetProductInfoExA("A938G02JF-2NF3N93-VN3-2NNF-3KGKALDNF93", usersid, - MSIINSTALLCONTEXT_USERUNMANAGED, - INSTALLPROPERTY_PRODUCTSTATEA, buf, &sz); - ok(r == ERROR_INVALID_PARAMETER, - "Expected ERROR_INVALID_PARAMETER, got %d\n", r); + r = MsiGetProductInfoExA("A938G02JF-2NF3N93-VN3-2NNF-3KGKALDNF93", usersid, MSIINSTALLCONTEXT_USERUNMANAGED, + INSTALLPROPERTY_PRODUCTSTATEA, buf, &sz); + ok(r == ERROR_INVALID_PARAMETER, "Expected ERROR_INVALID_PARAMETER, got %d\n", r); ok(!lstrcmpA(buf, "apple"), "Expected buf to be unchanged, got %s\n", buf); ok(sz == MAX_PATH, "Expected MAX_PATH, got %lu\n", sz); @@ -5833,11 +5688,9 @@ static void test_MsiGetProductInfoEx(void) /* local user product key exists */ sz = MAX_PATH; lstrcpyA(buf, "apple"); - r = pMsiGetProductInfoExA(prodcode, usersid, - MSIINSTALLCONTEXT_USERUNMANAGED, - INSTALLPROPERTY_PRODUCTSTATEA, buf, &sz); - ok(r == ERROR_UNKNOWN_PRODUCT, - "Expected ERROR_UNKNOWN_PRODUCT, got %d\n", r); + r = MsiGetProductInfoExA(prodcode, usersid, MSIINSTALLCONTEXT_USERUNMANAGED, INSTALLPROPERTY_PRODUCTSTATEA, + buf, &sz); + ok(r == ERROR_UNKNOWN_PRODUCT, "Expected ERROR_UNKNOWN_PRODUCT, got %d\n", r); ok(!lstrcmpA(buf, "apple"), "Expected buf to be unchanged, got %s\n", buf); ok(sz == MAX_PATH, "Expected MAX_PATH, got %lu\n", sz); @@ -5847,11 +5700,9 @@ static void test_MsiGetProductInfoEx(void) /* InstallProperties key exists */ sz = MAX_PATH; lstrcpyA(buf, "apple"); - r = pMsiGetProductInfoExA(prodcode, usersid, - MSIINSTALLCONTEXT_USERUNMANAGED, - INSTALLPROPERTY_PRODUCTSTATEA, buf, &sz); - ok(r == ERROR_UNKNOWN_PRODUCT, - "Expected ERROR_UNKNOWN_PRODUCT, got %d\n", r); + r = MsiGetProductInfoExA(prodcode, usersid, MSIINSTALLCONTEXT_USERUNMANAGED, INSTALLPROPERTY_PRODUCTSTATEA, + buf, &sz); + ok(r == ERROR_UNKNOWN_PRODUCT, "Expected ERROR_UNKNOWN_PRODUCT, got %d\n", r); ok(!lstrcmpA(buf, "apple"), "Expected buf to be unchanged, got %s\n", buf); ok(sz == MAX_PATH, "Expected MAX_PATH, got %lu\n", sz); @@ -5861,9 +5712,8 @@ static void test_MsiGetProductInfoEx(void) /* LocalPackage value exists */ sz = MAX_PATH; lstrcpyA(buf, "apple"); - r = pMsiGetProductInfoExA(prodcode, usersid, - MSIINSTALLCONTEXT_USERUNMANAGED, - INSTALLPROPERTY_PRODUCTSTATEA, buf, &sz); + r = MsiGetProductInfoExA(prodcode, usersid, MSIINSTALLCONTEXT_USERUNMANAGED, INSTALLPROPERTY_PRODUCTSTATEA, + buf, &sz); ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r); ok(!lstrcmpA(buf, "5"), "Expected \"5\", got \"%s\"\n", buf); ok(sz == 1, "Expected 1, got %lu\n", sz); @@ -5873,11 +5723,8 @@ static void test_MsiGetProductInfoEx(void) /* LocalPackage value must exist */ sz = MAX_PATH; lstrcpyA(buf, "apple"); - r = pMsiGetProductInfoExA(prodcode, usersid, - MSIINSTALLCONTEXT_USERUNMANAGED, - INSTALLPROPERTY_HELPLINKA, buf, &sz); - ok(r == ERROR_UNKNOWN_PRODUCT, - "Expected ERROR_UNKNOWN_PRODUCT, got %d\n", r); + r = MsiGetProductInfoExA(prodcode, usersid, MSIINSTALLCONTEXT_USERUNMANAGED, INSTALLPROPERTY_HELPLINKA, buf, &sz); + ok(r == ERROR_UNKNOWN_PRODUCT, "Expected ERROR_UNKNOWN_PRODUCT, got %d\n", r); ok(!lstrcmpA(buf, "apple"), "Expected buf to be unchanged, got %s\n", buf); ok(sz == MAX_PATH, "Expected MAX_PATH, got %lu\n", sz); @@ -5887,9 +5734,7 @@ static void test_MsiGetProductInfoEx(void) /* LocalPackage exists, but HelpLink does not exist */ sz = MAX_PATH; lstrcpyA(buf, "apple"); - r = pMsiGetProductInfoExA(prodcode, usersid, - MSIINSTALLCONTEXT_USERUNMANAGED, - INSTALLPROPERTY_HELPLINKA, buf, &sz); + r = MsiGetProductInfoExA(prodcode, usersid, MSIINSTALLCONTEXT_USERUNMANAGED, INSTALLPROPERTY_HELPLINKA, buf, &sz); ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r); ok(!lstrcmpA(buf, ""), "Expected \"\", got \"%s\"\n", buf); ok(sz == 0, "Expected 0, got %lu\n", sz); @@ -5900,9 +5745,7 @@ static void test_MsiGetProductInfoEx(void) /* HelpLink value exists */ sz = MAX_PATH; lstrcpyA(buf, "apple"); - r = pMsiGetProductInfoExA(prodcode, usersid, - MSIINSTALLCONTEXT_USERUNMANAGED, - INSTALLPROPERTY_HELPLINKA, buf, &sz); + r = MsiGetProductInfoExA(prodcode, usersid, MSIINSTALLCONTEXT_USERUNMANAGED, INSTALLPROPERTY_HELPLINKA, buf, &sz); ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r); ok(!lstrcmpA(buf, "link"), "Expected \"link\", got \"%s\"\n", buf); ok(sz == 4, "Expected 4, got %lu\n", sz); @@ -5913,53 +5756,45 @@ static void test_MsiGetProductInfoEx(void) /* HelpTelephone value exists */ sz = MAX_PATH; lstrcpyA(buf, "apple"); - r = pMsiGetProductInfoExA(prodcode, usersid, - MSIINSTALLCONTEXT_USERUNMANAGED, - INSTALLPROPERTY_HELPTELEPHONEA, buf, &sz); + r = MsiGetProductInfoExA(prodcode, usersid, MSIINSTALLCONTEXT_USERUNMANAGED, INSTALLPROPERTY_HELPTELEPHONEA, + buf, &sz); ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r); ok(!lstrcmpA(buf, "phone"), "Expected \"phone\", got \"%s\"\n", buf); ok(sz == 5, "Expected 5, got %lu\n", sz); /* szValue and pcchValue are NULL */ - r = pMsiGetProductInfoExA(prodcode, usersid, - MSIINSTALLCONTEXT_USERUNMANAGED, - INSTALLPROPERTY_HELPTELEPHONEA, NULL, NULL); + r = MsiGetProductInfoExA(prodcode, usersid, MSIINSTALLCONTEXT_USERUNMANAGED, INSTALLPROPERTY_HELPTELEPHONEA, + NULL, NULL); ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r); /* pcchValue is exactly 5 */ sz = 5; lstrcpyA(buf, "apple"); - r = pMsiGetProductInfoExA(prodcode, usersid, - MSIINSTALLCONTEXT_USERUNMANAGED, - INSTALLPROPERTY_HELPTELEPHONEA, buf, &sz); - ok(r == ERROR_MORE_DATA, - "Expected ERROR_MORE_DATA, got %d\n", r); + r = MsiGetProductInfoExA(prodcode, usersid, MSIINSTALLCONTEXT_USERUNMANAGED, INSTALLPROPERTY_HELPTELEPHONEA, + buf, &sz); + ok(r == ERROR_MORE_DATA, "Expected ERROR_MORE_DATA, got %d\n", r); ok(sz == 10, "Expected 10, got %lu\n", sz); /* szValue is NULL, pcchValue is exactly 5 */ sz = 5; - r = pMsiGetProductInfoExA(prodcode, usersid, - MSIINSTALLCONTEXT_USERUNMANAGED, - INSTALLPROPERTY_HELPTELEPHONEA, NULL, &sz); + r = MsiGetProductInfoExA(prodcode, usersid, MSIINSTALLCONTEXT_USERUNMANAGED, INSTALLPROPERTY_HELPTELEPHONEA, + NULL, &sz); ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r); ok(sz == 10, "Expected 10, got %lu\n", sz); /* szValue is NULL, pcchValue is MAX_PATH */ sz = MAX_PATH; - r = pMsiGetProductInfoExA(prodcode, usersid, - MSIINSTALLCONTEXT_USERUNMANAGED, - INSTALLPROPERTY_HELPTELEPHONEA, NULL, &sz); + r = MsiGetProductInfoExA(prodcode, usersid, MSIINSTALLCONTEXT_USERUNMANAGED, INSTALLPROPERTY_HELPTELEPHONEA, + NULL, &sz); ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r); ok(sz == 10, "Expected 10, got %lu\n", sz); /* pcchValue is exactly 0 */ sz = 0; lstrcpyA(buf, "apple"); - r = pMsiGetProductInfoExA(prodcode, usersid, - MSIINSTALLCONTEXT_USERUNMANAGED, - INSTALLPROPERTY_HELPTELEPHONEA, buf, &sz); - ok(r == ERROR_MORE_DATA, - "Expected ERROR_MORE_DATA, got %d\n", r); + r = MsiGetProductInfoExA(prodcode, usersid, MSIINSTALLCONTEXT_USERUNMANAGED, INSTALLPROPERTY_HELPTELEPHONEA, + buf, &sz); + ok(r == ERROR_MORE_DATA, "Expected ERROR_MORE_DATA, got %d\n", r); ok(!lstrcmpA(buf, "apple"), "Expected \"apple\", got \"%s\"\n", buf); ok(sz == 10, "Expected 10, got %lu\n", sz); @@ -5969,11 +5804,8 @@ static void test_MsiGetProductInfoEx(void) /* szProperty is not a valid property */ sz = MAX_PATH; lstrcpyA(buf, "apple"); - r = pMsiGetProductInfoExA(prodcode, usersid, - MSIINSTALLCONTEXT_USERUNMANAGED, - "notvalid", buf, &sz); - ok(r == ERROR_UNKNOWN_PROPERTY, - "Expected ERROR_UNKNOWN_PROPERTY, got %d\n", r); + r = MsiGetProductInfoExA(prodcode, usersid, MSIINSTALLCONTEXT_USERUNMANAGED, "notvalid", buf, &sz); + ok(r == ERROR_UNKNOWN_PROPERTY, "Expected ERROR_UNKNOWN_PROPERTY, got %d\n", r); ok(!lstrcmpA(buf, "apple"), "Expected buf to be unchanged, got %s\n", buf); ok(sz == MAX_PATH, "Expected MAX_PATH, got %lu\n", sz); @@ -5983,9 +5815,8 @@ static void test_MsiGetProductInfoEx(void) /* InstallDate value exists */ sz = MAX_PATH; lstrcpyA(buf, "apple"); - r = pMsiGetProductInfoExA(prodcode, usersid, - MSIINSTALLCONTEXT_USERUNMANAGED, - INSTALLPROPERTY_INSTALLDATEA, buf, &sz); + r = MsiGetProductInfoExA(prodcode, usersid, MSIINSTALLCONTEXT_USERUNMANAGED, INSTALLPROPERTY_INSTALLDATEA, + buf, &sz); ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r); ok(!lstrcmpA(buf, "date"), "Expected \"date\", got \"%s\"\n", buf); ok(sz == 4, "Expected 4, got %lu\n", sz); @@ -5996,9 +5827,8 @@ static void test_MsiGetProductInfoEx(void) /* DisplayName value exists */ sz = MAX_PATH; lstrcpyA(buf, "apple"); - r = pMsiGetProductInfoExA(prodcode, usersid, - MSIINSTALLCONTEXT_USERUNMANAGED, - INSTALLPROPERTY_INSTALLEDPRODUCTNAMEA, buf, &sz); + r = MsiGetProductInfoExA(prodcode, usersid, MSIINSTALLCONTEXT_USERUNMANAGED, INSTALLPROPERTY_INSTALLEDPRODUCTNAMEA, + buf, &sz); ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r); ok(!lstrcmpA(buf, "name"), "Expected \"name\", got \"%s\"\n", buf); ok(sz == 4, "Expected 4, got %lu\n", sz); @@ -6009,9 +5839,8 @@ static void test_MsiGetProductInfoEx(void) /* InstallLocation value exists */ sz = MAX_PATH; lstrcpyA(buf, "apple"); - r = pMsiGetProductInfoExA(prodcode, usersid, - MSIINSTALLCONTEXT_USERUNMANAGED, - INSTALLPROPERTY_INSTALLLOCATIONA, buf, &sz); + r = MsiGetProductInfoExA(prodcode, usersid, MSIINSTALLCONTEXT_USERUNMANAGED, INSTALLPROPERTY_INSTALLLOCATIONA, + buf, &sz); ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r); ok(!lstrcmpA(buf, "loc"), "Expected \"loc\", got \"%s\"\n", buf); ok(sz == 3, "Expected 3, got %lu\n", sz); @@ -6022,9 +5851,8 @@ static void test_MsiGetProductInfoEx(void) /* InstallSource value exists */ sz = MAX_PATH; lstrcpyA(buf, "apple"); - r = pMsiGetProductInfoExA(prodcode, usersid, - MSIINSTALLCONTEXT_USERUNMANAGED, - INSTALLPROPERTY_INSTALLSOURCEA, buf, &sz); + r = MsiGetProductInfoExA(prodcode, usersid, MSIINSTALLCONTEXT_USERUNMANAGED, INSTALLPROPERTY_INSTALLSOURCEA, + buf, &sz); ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r); ok(!lstrcmpA(buf, "source"), "Expected \"source\", got \"%s\"\n", buf); ok(sz == 6, "Expected 6, got %lu\n", sz); @@ -6035,9 +5863,8 @@ static void test_MsiGetProductInfoEx(void) /* LocalPackage value exists */ sz = MAX_PATH; lstrcpyA(buf, "apple"); - r = pMsiGetProductInfoExA(prodcode, usersid, - MSIINSTALLCONTEXT_USERUNMANAGED, - INSTALLPROPERTY_LOCALPACKAGEA, buf, &sz); + r = MsiGetProductInfoExA(prodcode, usersid, MSIINSTALLCONTEXT_USERUNMANAGED, INSTALLPROPERTY_LOCALPACKAGEA, + buf, &sz); ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r); ok(!lstrcmpA(buf, "local"), "Expected \"local\", got \"%s\"\n", buf); ok(sz == 5, "Expected 5, got %lu\n", sz); @@ -6048,9 +5875,8 @@ static void test_MsiGetProductInfoEx(void) /* Publisher value exists */ sz = MAX_PATH; lstrcpyA(buf, "apple"); - r = pMsiGetProductInfoExA(prodcode, usersid, - MSIINSTALLCONTEXT_USERUNMANAGED, - INSTALLPROPERTY_PUBLISHERA, buf, &sz); + r = MsiGetProductInfoExA(prodcode, usersid, MSIINSTALLCONTEXT_USERUNMANAGED, INSTALLPROPERTY_PUBLISHERA, + buf, &sz); ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r); ok(!lstrcmpA(buf, "pub"), "Expected \"pub\", got \"%s\"\n", buf); ok(sz == 3, "Expected 3, got %lu\n", sz); @@ -6061,9 +5887,8 @@ static void test_MsiGetProductInfoEx(void) /* URLInfoAbout value exists */ sz = MAX_PATH; lstrcpyA(buf, "apple"); - r = pMsiGetProductInfoExA(prodcode, usersid, - MSIINSTALLCONTEXT_USERUNMANAGED, - INSTALLPROPERTY_URLINFOABOUTA, buf, &sz); + r = MsiGetProductInfoExA(prodcode, usersid, MSIINSTALLCONTEXT_USERUNMANAGED, INSTALLPROPERTY_URLINFOABOUTA, + buf, &sz); ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r); ok(!lstrcmpA(buf, "about"), "Expected \"about\", got \"%s\"\n", buf); ok(sz == 5, "Expected 5, got %lu\n", sz); @@ -6074,9 +5899,8 @@ static void test_MsiGetProductInfoEx(void) /* URLUpdateInfo value exists */ sz = MAX_PATH; lstrcpyA(buf, "apple"); - r = pMsiGetProductInfoExA(prodcode, usersid, - MSIINSTALLCONTEXT_USERUNMANAGED, - INSTALLPROPERTY_URLUPDATEINFOA, buf, &sz); + r = MsiGetProductInfoExA(prodcode, usersid, MSIINSTALLCONTEXT_USERUNMANAGED, INSTALLPROPERTY_URLUPDATEINFOA, + buf, &sz); ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r); ok(!lstrcmpA(buf, "update"), "Expected \"update\", got \"%s\"\n", buf); ok(sz == 6, "Expected 6, got %lu\n", sz); @@ -6087,9 +5911,8 @@ static void test_MsiGetProductInfoEx(void) /* VersionMinor value exists */ sz = MAX_PATH; lstrcpyA(buf, "apple"); - r = pMsiGetProductInfoExA(prodcode, usersid, - MSIINSTALLCONTEXT_USERUNMANAGED, - INSTALLPROPERTY_VERSIONMINORA, buf, &sz); + r = MsiGetProductInfoExA(prodcode, usersid, MSIINSTALLCONTEXT_USERUNMANAGED, INSTALLPROPERTY_VERSIONMINORA, + buf, &sz); ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r); ok(!lstrcmpA(buf, "2"), "Expected \"2\", got \"%s\"\n", buf); ok(sz == 1, "Expected 1, got %lu\n", sz); @@ -6100,9 +5923,8 @@ static void test_MsiGetProductInfoEx(void) /* VersionMajor value exists */ sz = MAX_PATH; lstrcpyA(buf, "apple"); - r = pMsiGetProductInfoExA(prodcode, usersid, - MSIINSTALLCONTEXT_USERUNMANAGED, - INSTALLPROPERTY_VERSIONMAJORA, buf, &sz); + r = MsiGetProductInfoExA(prodcode, usersid, MSIINSTALLCONTEXT_USERUNMANAGED, INSTALLPROPERTY_VERSIONMAJORA, + buf, &sz); ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r); ok(!lstrcmpA(buf, "3"), "Expected \"3\", got \"%s\"\n", buf); ok(sz == 1, "Expected 1, got %lu\n", sz); @@ -6113,9 +5935,8 @@ static void test_MsiGetProductInfoEx(void) /* DisplayVersion value exists */ sz = MAX_PATH; lstrcpyA(buf, "apple"); - r = pMsiGetProductInfoExA(prodcode, usersid, - MSIINSTALLCONTEXT_USERUNMANAGED, - INSTALLPROPERTY_VERSIONSTRINGA, buf, &sz); + r = MsiGetProductInfoExA(prodcode, usersid, MSIINSTALLCONTEXT_USERUNMANAGED, INSTALLPROPERTY_VERSIONSTRINGA, + buf, &sz); ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r); ok(!lstrcmpA(buf, "3.2.1"), "Expected \"3.2.1\", got \"%s\"\n", buf); ok(sz == 5, "Expected 5, got %lu\n", sz); @@ -6126,9 +5947,8 @@ static void test_MsiGetProductInfoEx(void) /* ProductID value exists */ sz = MAX_PATH; lstrcpyA(buf, "apple"); - r = pMsiGetProductInfoExA(prodcode, usersid, - MSIINSTALLCONTEXT_USERUNMANAGED, - INSTALLPROPERTY_PRODUCTIDA, buf, &sz); + r = MsiGetProductInfoExA(prodcode, usersid, MSIINSTALLCONTEXT_USERUNMANAGED, INSTALLPROPERTY_PRODUCTIDA, + buf, &sz); ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r); ok(!lstrcmpA(buf, "id"), "Expected \"id\", got \"%s\"\n", buf); ok(sz == 2, "Expected 2, got %lu\n", sz); @@ -6139,9 +5959,8 @@ static void test_MsiGetProductInfoEx(void) /* RegCompany value exists */ sz = MAX_PATH; lstrcpyA(buf, "apple"); - r = pMsiGetProductInfoExA(prodcode, usersid, - MSIINSTALLCONTEXT_USERUNMANAGED, - INSTALLPROPERTY_REGCOMPANYA, buf, &sz); + r = MsiGetProductInfoExA(prodcode, usersid, MSIINSTALLCONTEXT_USERUNMANAGED, INSTALLPROPERTY_REGCOMPANYA, + buf, &sz); ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r); ok(!lstrcmpA(buf, "comp"), "Expected \"comp\", got \"%s\"\n", buf); ok(sz == 4, "Expected 4, got %lu\n", sz); @@ -6152,9 +5971,8 @@ static void test_MsiGetProductInfoEx(void) /* RegOwner value exists */ sz = MAX_PATH; lstrcpyA(buf, "apple"); - r = pMsiGetProductInfoExA(prodcode, usersid, - MSIINSTALLCONTEXT_USERUNMANAGED, - INSTALLPROPERTY_REGOWNERA, buf, &sz); + r = MsiGetProductInfoExA(prodcode, usersid, MSIINSTALLCONTEXT_USERUNMANAGED, INSTALLPROPERTY_REGOWNERA, + buf, &sz); ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r); ok(!lstrcmpA(buf, "owner"), "Expected \"owner\", got \"%s\"\n", buf); ok(sz == 5, "Expected 5, got %lu\n", sz); @@ -6165,11 +5983,9 @@ static void test_MsiGetProductInfoEx(void) /* Transforms value exists */ sz = MAX_PATH; lstrcpyA(buf, "apple"); - r = pMsiGetProductInfoExA(prodcode, usersid, - MSIINSTALLCONTEXT_USERUNMANAGED, - INSTALLPROPERTY_TRANSFORMSA, buf, &sz); - ok(r == ERROR_UNKNOWN_PRODUCT, - "Expected ERROR_UNKNOWN_PRODUCT, got %d\n", r); + r = MsiGetProductInfoExA(prodcode, usersid, MSIINSTALLCONTEXT_USERUNMANAGED, INSTALLPROPERTY_TRANSFORMSA, + buf, &sz); + ok(r == ERROR_UNKNOWN_PRODUCT, "Expected ERROR_UNKNOWN_PRODUCT, got %d\n", r); ok(!lstrcmpA(buf, "apple"), "Expected buf to be unchanged, got %s\n", buf); ok(sz == MAX_PATH, "Expected MAX_PATH, got %lu\n", sz); @@ -6179,11 +5995,9 @@ static void test_MsiGetProductInfoEx(void) /* Language value exists */ sz = MAX_PATH; lstrcpyA(buf, "apple"); - r = pMsiGetProductInfoExA(prodcode, usersid, - MSIINSTALLCONTEXT_USERUNMANAGED, - INSTALLPROPERTY_LANGUAGEA, buf, &sz); - ok(r == ERROR_UNKNOWN_PRODUCT, - "Expected ERROR_UNKNOWN_PRODUCT, got %d\n", r); + r = MsiGetProductInfoExA(prodcode, usersid, MSIINSTALLCONTEXT_USERUNMANAGED, INSTALLPROPERTY_LANGUAGEA, + buf, &sz); + ok(r == ERROR_UNKNOWN_PRODUCT, "Expected ERROR_UNKNOWN_PRODUCT, got %d\n", r); ok(!lstrcmpA(buf, "apple"), "Expected buf to be unchanged, got %s\n", buf); ok(sz == MAX_PATH, "Expected MAX_PATH, got %lu\n", sz); @@ -6193,11 +6007,9 @@ static void test_MsiGetProductInfoEx(void) /* ProductName value exists */ sz = MAX_PATH; lstrcpyA(buf, "apple"); - r = pMsiGetProductInfoExA(prodcode, usersid, - MSIINSTALLCONTEXT_USERUNMANAGED, - INSTALLPROPERTY_PRODUCTNAMEA, buf, &sz); - ok(r == ERROR_UNKNOWN_PRODUCT, - "Expected ERROR_UNKNOWN_PRODUCT, got %d\n", r); + r = MsiGetProductInfoExA(prodcode, usersid, MSIINSTALLCONTEXT_USERUNMANAGED, INSTALLPROPERTY_PRODUCTNAMEA, + buf, &sz); + ok(r == ERROR_UNKNOWN_PRODUCT, "Expected ERROR_UNKNOWN_PRODUCT, got %d\n", r); ok(!lstrcmpA(buf, "apple"), "Expected buf to be unchanged, got %s\n", buf); ok(sz == MAX_PATH, "Expected MAX_PATH, got %lu\n", sz); @@ -6209,11 +6021,9 @@ static void test_MsiGetProductInfoEx(void) /* AssignmentType value exists */ sz = MAX_PATH; lstrcpyA(buf, "apple"); - r = pMsiGetProductInfoExA(prodcode, usersid, - MSIINSTALLCONTEXT_USERUNMANAGED, - INSTALLPROPERTY_ASSIGNMENTTYPEA, buf, &sz); - ok(r == ERROR_UNKNOWN_PRODUCT, - "Expected ERROR_UNKNOWN_PRODUCT, got %d\n", r); + r = MsiGetProductInfoExA(prodcode, usersid, MSIINSTALLCONTEXT_USERUNMANAGED, INSTALLPROPERTY_ASSIGNMENTTYPEA, + buf, &sz); + ok(r == ERROR_UNKNOWN_PRODUCT, "Expected ERROR_UNKNOWN_PRODUCT, got %d\n", r); ok(!lstrcmpA(buf, "apple"), "Expected buf to be unchanged, got %s\n", buf); ok(sz == MAX_PATH, "Expected MAX_PATH, got %lu\n", sz); @@ -6223,11 +6033,9 @@ static void test_MsiGetProductInfoEx(void) /* PackageCode value exists */ sz = MAX_PATH; lstrcpyA(buf, "apple"); - r = pMsiGetProductInfoExA(prodcode, usersid, - MSIINSTALLCONTEXT_USERUNMANAGED, - INSTALLPROPERTY_PACKAGECODEA, buf, &sz); - ok(r == ERROR_UNKNOWN_PRODUCT, - "Expected ERROR_UNKNOWN_PRODUCT, got %d\n", r); + r = MsiGetProductInfoExA(prodcode, usersid, MSIINSTALLCONTEXT_USERUNMANAGED, INSTALLPROPERTY_PACKAGECODEA, + buf, &sz); + ok(r == ERROR_UNKNOWN_PRODUCT, "Expected ERROR_UNKNOWN_PRODUCT, got %d\n", r); ok(!lstrcmpA(buf, "apple"), "Expected buf to be unchanged, got %s\n", buf); ok(sz == MAX_PATH, "Expected MAX_PATH, got %lu\n", sz); @@ -6237,11 +6045,9 @@ static void test_MsiGetProductInfoEx(void) /* Version value exists */ sz = MAX_PATH; lstrcpyA(buf, "apple"); - r = pMsiGetProductInfoExA(prodcode, usersid, - MSIINSTALLCONTEXT_USERUNMANAGED, - INSTALLPROPERTY_VERSIONA, buf, &sz); - ok(r == ERROR_UNKNOWN_PRODUCT, - "Expected ERROR_UNKNOWN_PRODUCT, got %d\n", r); + r = MsiGetProductInfoExA(prodcode, usersid, MSIINSTALLCONTEXT_USERUNMANAGED, INSTALLPROPERTY_VERSIONA, + buf, &sz); + ok(r == ERROR_UNKNOWN_PRODUCT, "Expected ERROR_UNKNOWN_PRODUCT, got %d\n", r); ok(!lstrcmpA(buf, "apple"), "Expected buf to be unchanged, got %s\n", buf); ok(sz == MAX_PATH, "Expected MAX_PATH, got %lu\n", sz); @@ -6251,11 +6057,9 @@ static void test_MsiGetProductInfoEx(void) /* ProductIcon value exists */ sz = MAX_PATH; lstrcpyA(buf, "apple"); - r = pMsiGetProductInfoExA(prodcode, usersid, - MSIINSTALLCONTEXT_USERUNMANAGED, - INSTALLPROPERTY_PRODUCTICONA, buf, &sz); - ok(r == ERROR_UNKNOWN_PRODUCT, - "Expected ERROR_UNKNOWN_PRODUCT, got %d\n", r); + r = MsiGetProductInfoExA(prodcode, usersid, MSIINSTALLCONTEXT_USERUNMANAGED, INSTALLPROPERTY_PRODUCTICONA, + buf, &sz); + ok(r == ERROR_UNKNOWN_PRODUCT, "Expected ERROR_UNKNOWN_PRODUCT, got %d\n", r); ok(!lstrcmpA(buf, "apple"), "Expected buf to be unchanged, got %s\n", buf); ok(sz == MAX_PATH, "Expected MAX_PATH, got %lu\n", sz); @@ -6265,11 +6069,9 @@ static void test_MsiGetProductInfoEx(void) /* PackageName value exists */ sz = MAX_PATH; lstrcpyA(buf, "apple"); - r = pMsiGetProductInfoExA(prodcode, usersid, - MSIINSTALLCONTEXT_USERUNMANAGED, - INSTALLPROPERTY_PACKAGENAMEA, buf, &sz); - ok(r == ERROR_UNKNOWN_PRODUCT, - "Expected ERROR_UNKNOWN_PRODUCT, got %d\n", r); + r = MsiGetProductInfoExA(prodcode, usersid, MSIINSTALLCONTEXT_USERUNMANAGED, INSTALLPROPERTY_PACKAGENAMEA, + buf, &sz); + ok(r == ERROR_UNKNOWN_PRODUCT, "Expected ERROR_UNKNOWN_PRODUCT, got %d\n", r); ok(!lstrcmpA(buf, "apple"), "Expected buf to be unchanged, got %s\n", buf); ok(sz == MAX_PATH, "Expected MAX_PATH, got %lu\n", sz); @@ -6279,11 +6081,9 @@ static void test_MsiGetProductInfoEx(void) /* AuthorizedLUAApp value exists */ sz = MAX_PATH; lstrcpyA(buf, "apple"); - r = pMsiGetProductInfoExA(prodcode, usersid, - MSIINSTALLCONTEXT_USERUNMANAGED, - INSTALLPROPERTY_AUTHORIZED_LUA_APPA, buf, &sz); - ok(r == ERROR_UNKNOWN_PRODUCT, - "Expected ERROR_UNKNOWN_PRODUCT, got %d\n", r); + r = MsiGetProductInfoExA(prodcode, usersid, MSIINSTALLCONTEXT_USERUNMANAGED, INSTALLPROPERTY_AUTHORIZED_LUA_APPA, + buf, &sz); + ok(r == ERROR_UNKNOWN_PRODUCT, "Expected ERROR_UNKNOWN_PRODUCT, got %d\n", r); ok(!lstrcmpA(buf, "apple"), "Expected buf to be unchanged, got %s\n", buf); ok(sz == MAX_PATH, "Expected MAX_PATH, got %lu\n", sz); @@ -6329,11 +6129,9 @@ static void test_MsiGetProductInfoEx(void) /* user product key exists */ sz = MAX_PATH; lstrcpyA(buf, "apple"); - r = pMsiGetProductInfoExA(prodcode, usersid, - MSIINSTALLCONTEXT_USERUNMANAGED, - INSTALLPROPERTY_PRODUCTSTATEA, buf, &sz); - ok(r == ERROR_UNKNOWN_PRODUCT, - "Expected ERROR_UNKNOWN_PRODUCT, got %d\n", r); + r = MsiGetProductInfoExA(prodcode, usersid, MSIINSTALLCONTEXT_USERUNMANAGED, INSTALLPROPERTY_PRODUCTSTATEA, + buf, &sz); + ok(r == ERROR_UNKNOWN_PRODUCT, "Expected ERROR_UNKNOWN_PRODUCT, got %d\n", r); ok(!lstrcmpA(buf, "apple"), "Expected buf to be unchanged, got %s\n", buf); ok(sz == MAX_PATH, "Expected MAX_PATH, got %lu\n", sz); @@ -6348,17 +6146,9 @@ static void test_MsiGetProductInfoEx(void) sz = MAX_PATH; lstrcpyA(buf, "apple"); - r = pMsiGetProductInfoExA(prodcode, usersid, - MSIINSTALLCONTEXT_USERUNMANAGED, - INSTALLPROPERTY_PRODUCTSTATEA, buf, &sz); - ok(r == ERROR_SUCCESS || broken(r == ERROR_UNKNOWN_PRODUCT), "Expected ERROR_SUCCESS, got %d\n", r); - if (r == ERROR_UNKNOWN_PRODUCT) - { - win_skip("skipping remaining tests for MsiGetProductInfoEx\n"); - delete_key(prodkey, "", access); - RegCloseKey(prodkey); - return; - } + r = MsiGetProductInfoExA(prodcode, usersid, MSIINSTALLCONTEXT_USERUNMANAGED, INSTALLPROPERTY_PRODUCTSTATEA, + buf, &sz); + ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r); ok(!lstrcmpA(buf, "1"), "Expected \"1\", got \"%s\"\n", buf); ok(sz == 1, "Expected 1, got %lu\n", sz); @@ -6368,11 +6158,9 @@ static void test_MsiGetProductInfoEx(void) /* HelpLink value exists */ sz = MAX_PATH; lstrcpyA(buf, "apple"); - r = pMsiGetProductInfoExA(prodcode, usersid, - MSIINSTALLCONTEXT_USERUNMANAGED, - INSTALLPROPERTY_HELPLINKA, buf, &sz); - ok(r == ERROR_UNKNOWN_PROPERTY, - "Expected ERROR_UNKNOWN_PROPERTY, got %d\n", r); + r = MsiGetProductInfoExA(prodcode, usersid, MSIINSTALLCONTEXT_USERUNMANAGED, INSTALLPROPERTY_HELPLINKA, + buf, &sz); + ok(r == ERROR_UNKNOWN_PROPERTY, "Expected ERROR_UNKNOWN_PROPERTY, got %d\n", r); ok(!lstrcmpA(buf, "apple"), "Expected buf to be unchanged, got %s\n", buf); ok(sz == MAX_PATH, "Expected MAX_PATH, got %lu\n", sz); @@ -6382,11 +6170,9 @@ static void test_MsiGetProductInfoEx(void) /* HelpTelephone value exists */ sz = MAX_PATH; lstrcpyA(buf, "apple"); - r = pMsiGetProductInfoExA(prodcode, usersid, - MSIINSTALLCONTEXT_USERUNMANAGED, - INSTALLPROPERTY_HELPTELEPHONEA, buf, &sz); - ok(r == ERROR_UNKNOWN_PROPERTY, - "Expected ERROR_UNKNOWN_PROPERTY, got %d\n", r); + r = MsiGetProductInfoExA(prodcode, usersid, MSIINSTALLCONTEXT_USERUNMANAGED, INSTALLPROPERTY_HELPTELEPHONEA, + buf, &sz); + ok(r == ERROR_UNKNOWN_PROPERTY, "Expected ERROR_UNKNOWN_PROPERTY, got %d\n", r); ok(!lstrcmpA(buf, "apple"), "Expected buf to be unchanged, got %s\n", buf); ok(sz == MAX_PATH, "Expected MAX_PATH, got %lu\n", sz); @@ -6396,11 +6182,9 @@ static void test_MsiGetProductInfoEx(void) /* InstallDate value exists */ sz = MAX_PATH; lstrcpyA(buf, "apple"); - r = pMsiGetProductInfoExA(prodcode, usersid, - MSIINSTALLCONTEXT_USERUNMANAGED, - INSTALLPROPERTY_INSTALLDATEA, buf, &sz); - ok(r == ERROR_UNKNOWN_PROPERTY, - "Expected ERROR_UNKNOWN_PROPERTY, got %d\n", r); + r = MsiGetProductInfoExA(prodcode, usersid, MSIINSTALLCONTEXT_USERUNMANAGED, INSTALLPROPERTY_INSTALLDATEA, + buf, &sz); + ok(r == ERROR_UNKNOWN_PROPERTY, "Expected ERROR_UNKNOWN_PROPERTY, got %d\n", r); ok(!lstrcmpA(buf, "apple"), "Expected buf to be unchanged, got %s\n", buf); ok(sz == MAX_PATH, "Expected MAX_PATH, got %lu\n", sz); @@ -6410,11 +6194,9 @@ static void test_MsiGetProductInfoEx(void) /* DisplayName value exists */ sz = MAX_PATH; lstrcpyA(buf, "apple"); - r = pMsiGetProductInfoExA(prodcode, usersid, - MSIINSTALLCONTEXT_USERUNMANAGED, - INSTALLPROPERTY_INSTALLEDPRODUCTNAMEA, buf, &sz); - ok(r == ERROR_UNKNOWN_PROPERTY, - "Expected ERROR_UNKNOWN_PROPERTY, got %d\n", r); + r = MsiGetProductInfoExA(prodcode, usersid, MSIINSTALLCONTEXT_USERUNMANAGED, INSTALLPROPERTY_INSTALLEDPRODUCTNAMEA, + buf, &sz); + ok(r == ERROR_UNKNOWN_PROPERTY, "Expected ERROR_UNKNOWN_PROPERTY, got %d\n", r); ok(!lstrcmpA(buf, "apple"), "Expected buf to be unchanged, got %s\n", buf); ok(sz == MAX_PATH, "Expected MAX_PATH, got %lu\n", sz); @@ -6424,11 +6206,9 @@ static void test_MsiGetProductInfoEx(void) /* InstallLocation value exists */ sz = MAX_PATH; lstrcpyA(buf, "apple"); - r = pMsiGetProductInfoExA(prodcode, usersid, - MSIINSTALLCONTEXT_USERUNMANAGED, - INSTALLPROPERTY_INSTALLLOCATIONA, buf, &sz); - ok(r == ERROR_UNKNOWN_PROPERTY, - "Expected ERROR_UNKNOWN_PROPERTY, got %d\n", r); + r = MsiGetProductInfoExA(prodcode, usersid, MSIINSTALLCONTEXT_USERUNMANAGED, INSTALLPROPERTY_INSTALLLOCATIONA, + buf, &sz); + ok(r == ERROR_UNKNOWN_PROPERTY, "Expected ERROR_UNKNOWN_PROPERTY, got %d\n", r); ok(!lstrcmpA(buf, "apple"), "Expected buf to be unchanged, got %s\n", buf); ok(sz == MAX_PATH, "Expected MAX_PATH, got %lu\n", sz); @@ -6438,11 +6218,9 @@ static void test_MsiGetProductInfoEx(void) /* InstallSource value exists */ sz = MAX_PATH; lstrcpyA(buf, "apple"); - r = pMsiGetProductInfoExA(prodcode, usersid, - MSIINSTALLCONTEXT_USERUNMANAGED, - INSTALLPROPERTY_INSTALLSOURCEA, buf, &sz); - ok(r == ERROR_UNKNOWN_PROPERTY, - "Expected ERROR_UNKNOWN_PROPERTY, got %d\n", r); + r = MsiGetProductInfoExA(prodcode, usersid, MSIINSTALLCONTEXT_USERUNMANAGED, INSTALLPROPERTY_INSTALLSOURCEA, + buf, &sz); + ok(r == ERROR_UNKNOWN_PROPERTY, "Expected ERROR_UNKNOWN_PROPERTY, got %d\n", r); ok(!lstrcmpA(buf, "apple"), "Expected buf to be unchanged, got %s\n", buf); ok(sz == MAX_PATH, "Expected MAX_PATH, got %lu\n", sz); @@ -6452,11 +6230,9 @@ static void test_MsiGetProductInfoEx(void) /* LocalPackage value exists */ sz = MAX_PATH; lstrcpyA(buf, "apple"); - r = pMsiGetProductInfoExA(prodcode, usersid, - MSIINSTALLCONTEXT_USERUNMANAGED, - INSTALLPROPERTY_LOCALPACKAGEA, buf, &sz); - ok(r == ERROR_UNKNOWN_PROPERTY, - "Expected ERROR_UNKNOWN_PROPERTY, got %d\n", r); + r = MsiGetProductInfoExA(prodcode, usersid, MSIINSTALLCONTEXT_USERUNMANAGED, INSTALLPROPERTY_LOCALPACKAGEA, + buf, &sz); + ok(r == ERROR_UNKNOWN_PROPERTY, "Expected ERROR_UNKNOWN_PROPERTY, got %d\n", r); ok(!lstrcmpA(buf, "apple"), "Expected buf to be unchanged, got %s\n", buf); ok(sz == MAX_PATH, "Expected MAX_PATH, got %lu\n", sz); @@ -6466,11 +6242,9 @@ static void test_MsiGetProductInfoEx(void) /* Publisher value exists */ sz = MAX_PATH; lstrcpyA(buf, "apple"); - r = pMsiGetProductInfoExA(prodcode, usersid, - MSIINSTALLCONTEXT_USERUNMANAGED, - INSTALLPROPERTY_PUBLISHERA, buf, &sz); - ok(r == ERROR_UNKNOWN_PROPERTY, - "Expected ERROR_UNKNOWN_PROPERTY, got %d\n", r); + r = MsiGetProductInfoExA(prodcode, usersid, MSIINSTALLCONTEXT_USERUNMANAGED, INSTALLPROPERTY_PUBLISHERA, + buf, &sz); + ok(r == ERROR_UNKNOWN_PROPERTY, "Expected ERROR_UNKNOWN_PROPERTY, got %d\n", r); ok(!lstrcmpA(buf, "apple"), "Expected buf to be unchanged, got %s\n", buf); ok(sz == MAX_PATH, "Expected MAX_PATH, got %lu\n", sz); @@ -6480,11 +6254,9 @@ static void test_MsiGetProductInfoEx(void) /* URLInfoAbout value exists */ sz = MAX_PATH; lstrcpyA(buf, "apple"); - r = pMsiGetProductInfoExA(prodcode, usersid, - MSIINSTALLCONTEXT_USERUNMANAGED, - INSTALLPROPERTY_URLINFOABOUTA, buf, &sz); - ok(r == ERROR_UNKNOWN_PROPERTY, - "Expected ERROR_UNKNOWN_PROPERTY, got %d\n", r); + r = MsiGetProductInfoExA(prodcode, usersid, MSIINSTALLCONTEXT_USERUNMANAGED, INSTALLPROPERTY_URLINFOABOUTA, + buf, &sz); + ok(r == ERROR_UNKNOWN_PROPERTY, "Expected ERROR_UNKNOWN_PROPERTY, got %d\n", r); ok(!lstrcmpA(buf, "apple"), "Expected buf to be unchanged, got %s\n", buf); ok(sz == MAX_PATH, "Expected MAX_PATH, got %lu\n", sz); @@ -6494,11 +6266,9 @@ static void test_MsiGetProductInfoEx(void) /* URLUpdateInfo value exists */ sz = MAX_PATH; lstrcpyA(buf, "apple"); - r = pMsiGetProductInfoExA(prodcode, usersid, - MSIINSTALLCONTEXT_USERUNMANAGED, - INSTALLPROPERTY_URLUPDATEINFOA, buf, &sz); - ok(r == ERROR_UNKNOWN_PROPERTY, - "Expected ERROR_UNKNOWN_PROPERTY, got %d\n", r); + r = MsiGetProductInfoExA(prodcode, usersid, MSIINSTALLCONTEXT_USERUNMANAGED, INSTALLPROPERTY_URLUPDATEINFOA, + buf, &sz); + ok(r == ERROR_UNKNOWN_PROPERTY, "Expected ERROR_UNKNOWN_PROPERTY, got %d\n", r); ok(!lstrcmpA(buf, "apple"), "Expected buf to be unchanged, got %s\n", buf); ok(sz == MAX_PATH, "Expected MAX_PATH, got %lu\n", sz); @@ -6508,11 +6278,9 @@ static void test_MsiGetProductInfoEx(void) /* VersionMinor value exists */ sz = MAX_PATH; lstrcpyA(buf, "apple"); - r = pMsiGetProductInfoExA(prodcode, usersid, - MSIINSTALLCONTEXT_USERUNMANAGED, - INSTALLPROPERTY_VERSIONMINORA, buf, &sz); - ok(r == ERROR_UNKNOWN_PROPERTY, - "Expected ERROR_UNKNOWN_PROPERTY, got %d\n", r); + r = MsiGetProductInfoExA(prodcode, usersid, MSIINSTALLCONTEXT_USERUNMANAGED, INSTALLPROPERTY_VERSIONMINORA, + buf, &sz); + ok(r == ERROR_UNKNOWN_PROPERTY, "Expected ERROR_UNKNOWN_PROPERTY, got %d\n", r); ok(!lstrcmpA(buf, "apple"), "Expected buf to be unchanged, got %s\n", buf); ok(sz == MAX_PATH, "Expected MAX_PATH, got %lu\n", sz); @@ -6522,11 +6290,9 @@ static void test_MsiGetProductInfoEx(void) /* VersionMajor value exists */ sz = MAX_PATH; lstrcpyA(buf, "apple"); - r = pMsiGetProductInfoExA(prodcode, usersid, - MSIINSTALLCONTEXT_USERUNMANAGED, - INSTALLPROPERTY_VERSIONMAJORA, buf, &sz); - ok(r == ERROR_UNKNOWN_PROPERTY, - "Expected ERROR_UNKNOWN_PROPERTY, got %d\n", r); + r = MsiGetProductInfoExA(prodcode, usersid, MSIINSTALLCONTEXT_USERUNMANAGED, INSTALLPROPERTY_VERSIONMAJORA, + buf, &sz); + ok(r == ERROR_UNKNOWN_PROPERTY, "Expected ERROR_UNKNOWN_PROPERTY, got %d\n", r); ok(!lstrcmpA(buf, "apple"), "Expected buf to be unchanged, got %s\n", buf); ok(sz == MAX_PATH, "Expected MAX_PATH, got %lu\n", sz); @@ -6536,11 +6302,9 @@ static void test_MsiGetProductInfoEx(void) /* DisplayVersion value exists */ sz = MAX_PATH; lstrcpyA(buf, "apple"); - r = pMsiGetProductInfoExA(prodcode, usersid, - MSIINSTALLCONTEXT_USERUNMANAGED, - INSTALLPROPERTY_VERSIONSTRINGA, buf, &sz); - ok(r == ERROR_UNKNOWN_PROPERTY, - "Expected ERROR_UNKNOWN_PROPERTY, got %d\n", r); + r = MsiGetProductInfoExA(prodcode, usersid, MSIINSTALLCONTEXT_USERUNMANAGED, INSTALLPROPERTY_VERSIONSTRINGA, + buf, &sz); + ok(r == ERROR_UNKNOWN_PROPERTY, "Expected ERROR_UNKNOWN_PROPERTY, got %d\n", r); ok(!lstrcmpA(buf, "apple"), "Expected buf to be unchanged, got %s\n", buf); ok(sz == MAX_PATH, "Expected MAX_PATH, got %lu\n", sz); @@ -6550,11 +6314,9 @@ static void test_MsiGetProductInfoEx(void) /* ProductID value exists */ sz = MAX_PATH; lstrcpyA(buf, "apple"); - r = pMsiGetProductInfoExA(prodcode, usersid, - MSIINSTALLCONTEXT_USERUNMANAGED, - INSTALLPROPERTY_PRODUCTIDA, buf, &sz); - ok(r == ERROR_UNKNOWN_PROPERTY, - "Expected ERROR_UNKNOWN_PROPERTY, got %d\n", r); + r = MsiGetProductInfoExA(prodcode, usersid, MSIINSTALLCONTEXT_USERUNMANAGED, INSTALLPROPERTY_PRODUCTIDA, + buf, &sz); + ok(r == ERROR_UNKNOWN_PROPERTY, "Expected ERROR_UNKNOWN_PROPERTY, got %d\n", r); ok(!lstrcmpA(buf, "apple"), "Expected buf to be unchanged, got %s\n", buf); ok(sz == MAX_PATH, "Expected MAX_PATH, got %lu\n", sz); @@ -6564,11 +6326,9 @@ static void test_MsiGetProductInfoEx(void) /* RegCompany value exists */ sz = MAX_PATH; lstrcpyA(buf, "apple"); - r = pMsiGetProductInfoExA(prodcode, usersid, - MSIINSTALLCONTEXT_USERUNMANAGED, - INSTALLPROPERTY_REGCOMPANYA, buf, &sz); - ok(r == ERROR_UNKNOWN_PROPERTY, - "Expected ERROR_UNKNOWN_PROPERTY, got %d\n", r); + r = MsiGetProductInfoExA(prodcode, usersid, MSIINSTALLCONTEXT_USERUNMANAGED, INSTALLPROPERTY_REGCOMPANYA, + buf, &sz); + ok(r == ERROR_UNKNOWN_PROPERTY, "Expected ERROR_UNKNOWN_PROPERTY, got %d\n", r); ok(!lstrcmpA(buf, "apple"), "Expected buf to be unchanged, got %s\n", buf); ok(sz == MAX_PATH, "Expected MAX_PATH, got %lu\n", sz); @@ -6578,11 +6338,9 @@ static void test_MsiGetProductInfoEx(void) /* RegOwner value exists */ sz = MAX_PATH; lstrcpyA(buf, "apple"); - r = pMsiGetProductInfoExA(prodcode, usersid, - MSIINSTALLCONTEXT_USERUNMANAGED, - INSTALLPROPERTY_REGOWNERA, buf, &sz); - ok(r == ERROR_UNKNOWN_PROPERTY, - "Expected ERROR_UNKNOWN_PROPERTY, got %d\n", r); + r = MsiGetProductInfoExA(prodcode, usersid, MSIINSTALLCONTEXT_USERUNMANAGED, INSTALLPROPERTY_REGOWNERA, + buf, &sz); + ok(r == ERROR_UNKNOWN_PROPERTY, "Expected ERROR_UNKNOWN_PROPERTY, got %d\n", r); ok(!lstrcmpA(buf, "apple"), "Expected buf to be unchanged, got %s\n", buf); ok(sz == MAX_PATH, "Expected MAX_PATH, got %lu\n", sz); @@ -6592,9 +6350,8 @@ static void test_MsiGetProductInfoEx(void) /* Transforms value exists */ sz = MAX_PATH; lstrcpyA(buf, "apple"); - r = pMsiGetProductInfoExA(prodcode, usersid, - MSIINSTALLCONTEXT_USERUNMANAGED, - INSTALLPROPERTY_TRANSFORMSA, buf, &sz); + r = MsiGetProductInfoExA(prodcode, usersid, MSIINSTALLCONTEXT_USERUNMANAGED, INSTALLPROPERTY_TRANSFORMSA, + buf, &sz); ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r); ok(!lstrcmpA(buf, "trans"), "Expected \"trans\", got \"%s\"\n", buf); ok(sz == 5, "Expected 5, got %lu\n", sz); @@ -6605,9 +6362,8 @@ static void test_MsiGetProductInfoEx(void) /* Language value exists */ sz = MAX_PATH; lstrcpyA(buf, "apple"); - r = pMsiGetProductInfoExA(prodcode, usersid, - MSIINSTALLCONTEXT_USERUNMANAGED, - INSTALLPROPERTY_LANGUAGEA, buf, &sz); + r = MsiGetProductInfoExA(prodcode, usersid, MSIINSTALLCONTEXT_USERUNMANAGED, INSTALLPROPERTY_LANGUAGEA, + buf, &sz); ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r); ok(!lstrcmpA(buf, "lang"), "Expected \"lang\", got \"%s\"\n", buf); ok(sz == 4, "Expected 4, got %lu\n", sz); @@ -6618,9 +6374,8 @@ static void test_MsiGetProductInfoEx(void) /* ProductName value exists */ sz = MAX_PATH; lstrcpyA(buf, "apple"); - r = pMsiGetProductInfoExA(prodcode, usersid, - MSIINSTALLCONTEXT_USERUNMANAGED, - INSTALLPROPERTY_PRODUCTNAMEA, buf, &sz); + r = MsiGetProductInfoExA(prodcode, usersid, MSIINSTALLCONTEXT_USERUNMANAGED, INSTALLPROPERTY_PRODUCTNAMEA, + buf, &sz); ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r); ok(!lstrcmpA(buf, "name"), "Expected \"name\", got \"%s\"\n", buf); ok(sz == 4, "Expected 4, got %lu\n", sz); @@ -6633,9 +6388,8 @@ static void test_MsiGetProductInfoEx(void) /* AssignmentType value exists */ sz = MAX_PATH; lstrcpyA(buf, "apple"); - r = pMsiGetProductInfoExA(prodcode, usersid, - MSIINSTALLCONTEXT_USERUNMANAGED, - INSTALLPROPERTY_ASSIGNMENTTYPEA, buf, &sz); + r = MsiGetProductInfoExA(prodcode, usersid, MSIINSTALLCONTEXT_USERUNMANAGED, INSTALLPROPERTY_ASSIGNMENTTYPEA, + buf, &sz); ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r); ok(!lstrcmpA(buf, ""), "Expected \"\", got \"%s\"\n", buf); ok(sz == 0, "Expected 0, got %lu\n", sz); @@ -6648,13 +6402,11 @@ static void test_MsiGetProductInfoEx(void) /* PackageCode value exists */ sz = MAX_PATH; lstrcpyA(buf, "apple"); - r = pMsiGetProductInfoExA(prodcode, usersid, - MSIINSTALLCONTEXT_USERUNMANAGED, - INSTALLPROPERTY_PACKAGECODEA, buf, &sz); + r = MsiGetProductInfoExA(prodcode, usersid, MSIINSTALLCONTEXT_USERUNMANAGED, INSTALLPROPERTY_PACKAGECODEA, + buf, &sz); todo_wine { - ok(r == ERROR_BAD_CONFIGURATION, - "Expected ERROR_BAD_CONFIGURATION, got %d\n", r); + ok(r == ERROR_BAD_CONFIGURATION, "Expected ERROR_BAD_CONFIGURATION, got %d\n", r); ok(!lstrcmpA(buf, "apple"), "Expected buf to be unchanged, got %s\n", buf); ok(sz == MAX_PATH, "Expected MAX_PATH, got %lu\n", sz); } @@ -6665,9 +6417,8 @@ static void test_MsiGetProductInfoEx(void) /* Version value exists */ sz = MAX_PATH; lstrcpyA(buf, "apple"); - r = pMsiGetProductInfoExA(prodcode, usersid, - MSIINSTALLCONTEXT_USERUNMANAGED, - INSTALLPROPERTY_VERSIONA, buf, &sz); + r = MsiGetProductInfoExA(prodcode, usersid, MSIINSTALLCONTEXT_USERUNMANAGED, INSTALLPROPERTY_VERSIONA, + buf, &sz); ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r); ok(!lstrcmpA(buf, "ver"), "Expected \"ver\", got \"%s\"\n", buf); ok(sz == 3, "Expected 3, got %lu\n", sz); @@ -6678,9 +6429,8 @@ static void test_MsiGetProductInfoEx(void) /* ProductIcon value exists */ sz = MAX_PATH; lstrcpyA(buf, "apple"); - r = pMsiGetProductInfoExA(prodcode, usersid, - MSIINSTALLCONTEXT_USERUNMANAGED, - INSTALLPROPERTY_PRODUCTICONA, buf, &sz); + r = MsiGetProductInfoExA(prodcode, usersid, MSIINSTALLCONTEXT_USERUNMANAGED, INSTALLPROPERTY_PRODUCTICONA, + buf, &sz); ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r); ok(!lstrcmpA(buf, "icon"), "Expected \"icon\", got \"%s\"\n", buf); ok(sz == 4, "Expected 4, got %lu\n", sz); @@ -6691,13 +6441,11 @@ static void test_MsiGetProductInfoEx(void) /* PackageName value exists */ sz = MAX_PATH; lstrcpyA(buf, "apple"); - r = pMsiGetProductInfoExA(prodcode, usersid, - MSIINSTALLCONTEXT_USERUNMANAGED, - INSTALLPROPERTY_PACKAGENAMEA, buf, &sz); + r = MsiGetProductInfoExA(prodcode, usersid, MSIINSTALLCONTEXT_USERUNMANAGED, INSTALLPROPERTY_PACKAGENAMEA, + buf, &sz); todo_wine { - ok(r == ERROR_UNKNOWN_PRODUCT, - "Expected ERROR_UNKNOWN_PRODUCT, got %d\n", r); + ok(r == ERROR_UNKNOWN_PRODUCT, "Expected ERROR_UNKNOWN_PRODUCT, got %d\n", r); ok(!lstrcmpA(buf, "apple"), "Expected buf to be unchanged, got %s\n", buf); ok(sz == MAX_PATH, "Expected MAX_PATH, got %lu\n", sz); } @@ -6708,9 +6456,8 @@ static void test_MsiGetProductInfoEx(void) /* AuthorizedLUAApp value exists */ sz = MAX_PATH; lstrcpyA(buf, "apple"); - r = pMsiGetProductInfoExA(prodcode, usersid, - MSIINSTALLCONTEXT_USERUNMANAGED, - INSTALLPROPERTY_AUTHORIZED_LUA_APPA, buf, &sz); + r = MsiGetProductInfoExA(prodcode, usersid, MSIINSTALLCONTEXT_USERUNMANAGED, INSTALLPROPERTY_AUTHORIZED_LUA_APPA, + buf, &sz); ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r); ok(!lstrcmpA(buf, "auth"), "Expected \"auth\", got \"%s\"\n", buf); ok(sz == 4, "Expected 4, got %lu\n", sz); @@ -6741,7 +6488,7 @@ static void test_MsiGetProductInfoEx(void) RegDeleteValueA(prodkey, "HelpTelephone"); RegDeleteValueA(prodkey, "HelpLink"); RegDeleteValueA(prodkey, "LocalPackage"); - delete_key(prodkey, "", access & KEY_WOW64_64KEY); + RegDeleteKeyExA(prodkey, "", access & KEY_WOW64_64KEY, 0); RegCloseKey(prodkey); /* MSIINSTALLCONTEXT_USERMANAGED */ @@ -6757,11 +6504,9 @@ static void test_MsiGetProductInfoEx(void) /* local user product key exists */ sz = MAX_PATH; lstrcpyA(buf, "apple"); - r = pMsiGetProductInfoExA(prodcode, usersid, - MSIINSTALLCONTEXT_USERMANAGED, - INSTALLPROPERTY_PRODUCTSTATEA, buf, &sz); - ok(r == ERROR_UNKNOWN_PRODUCT, - "Expected ERROR_UNKNOWN_PRODUCT, got %d\n", r); + r = MsiGetProductInfoExA(prodcode, usersid, MSIINSTALLCONTEXT_USERMANAGED, INSTALLPROPERTY_PRODUCTSTATEA, + buf, &sz); + ok(r == ERROR_UNKNOWN_PRODUCT, "Expected ERROR_UNKNOWN_PRODUCT, got %d\n", r); ok(!lstrcmpA(buf, "apple"), "Expected buf to be unchanged, got %s\n", buf); ok(sz == MAX_PATH, "Expected MAX_PATH, got %lu\n", sz); @@ -6771,11 +6516,9 @@ static void test_MsiGetProductInfoEx(void) /* InstallProperties key exists */ sz = MAX_PATH; lstrcpyA(buf, "apple"); - r = pMsiGetProductInfoExA(prodcode, usersid, - MSIINSTALLCONTEXT_USERMANAGED, - INSTALLPROPERTY_PRODUCTSTATEA, buf, &sz); - ok(r == ERROR_UNKNOWN_PRODUCT, - "Expected ERROR_UNKNOWN_PRODUCT, got %d\n", r); + r = MsiGetProductInfoExA(prodcode, usersid, MSIINSTALLCONTEXT_USERMANAGED, INSTALLPROPERTY_PRODUCTSTATEA, + buf, &sz); + ok(r == ERROR_UNKNOWN_PRODUCT, "Expected ERROR_UNKNOWN_PRODUCT, got %d\n", r); ok(!lstrcmpA(buf, "apple"), "Expected buf to be unchanged, got %s\n", buf); ok(sz == MAX_PATH, "Expected MAX_PATH, got %lu\n", sz); @@ -6785,9 +6528,8 @@ static void test_MsiGetProductInfoEx(void) /* ManagedLocalPackage value exists */ sz = MAX_PATH; lstrcpyA(buf, "apple"); - r = pMsiGetProductInfoExA(prodcode, usersid, - MSIINSTALLCONTEXT_USERMANAGED, - INSTALLPROPERTY_PRODUCTSTATEA, buf, &sz); + r = MsiGetProductInfoExA(prodcode, usersid, MSIINSTALLCONTEXT_USERMANAGED, INSTALLPROPERTY_PRODUCTSTATEA, + buf, &sz); ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r); ok(!lstrcmpA(buf, "5"), "Expected \"5\", got \"%s\"\n", buf); ok(sz == 1, "Expected 1, got %lu\n", sz); @@ -6798,9 +6540,8 @@ static void test_MsiGetProductInfoEx(void) /* HelpLink value exists */ sz = MAX_PATH; lstrcpyA(buf, "apple"); - r = pMsiGetProductInfoExA(prodcode, usersid, - MSIINSTALLCONTEXT_USERMANAGED, - INSTALLPROPERTY_HELPLINKA, buf, &sz); + r = MsiGetProductInfoExA(prodcode, usersid, MSIINSTALLCONTEXT_USERMANAGED, INSTALLPROPERTY_HELPLINKA, + buf, &sz); ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r); ok(!lstrcmpA(buf, "link"), "Expected \"link\", got \"%s\"\n", buf); ok(sz == 4, "Expected 4, got %lu\n", sz); @@ -6811,9 +6552,8 @@ static void test_MsiGetProductInfoEx(void) /* HelpTelephone value exists */ sz = MAX_PATH; lstrcpyA(buf, "apple"); - r = pMsiGetProductInfoExA(prodcode, usersid, - MSIINSTALLCONTEXT_USERMANAGED, - INSTALLPROPERTY_HELPTELEPHONEA, buf, &sz); + r = MsiGetProductInfoExA(prodcode, usersid, MSIINSTALLCONTEXT_USERMANAGED, INSTALLPROPERTY_HELPTELEPHONEA, + buf, &sz); ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r); ok(!lstrcmpA(buf, "phone"), "Expected \"phone\", got \"%s\"\n", buf); ok(sz == 5, "Expected 5, got %lu\n", sz); @@ -6824,9 +6564,8 @@ static void test_MsiGetProductInfoEx(void) /* InstallDate value exists */ sz = MAX_PATH; lstrcpyA(buf, "apple"); - r = pMsiGetProductInfoExA(prodcode, usersid, - MSIINSTALLCONTEXT_USERMANAGED, - INSTALLPROPERTY_INSTALLDATEA, buf, &sz); + r = MsiGetProductInfoExA(prodcode, usersid, MSIINSTALLCONTEXT_USERMANAGED, INSTALLPROPERTY_INSTALLDATEA, + buf, &sz); ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r); ok(!lstrcmpA(buf, "date"), "Expected \"date\", got \"%s\"\n", buf); ok(sz == 4, "Expected 4, got %lu\n", sz); @@ -6837,9 +6576,8 @@ static void test_MsiGetProductInfoEx(void) /* DisplayName value exists */ sz = MAX_PATH; lstrcpyA(buf, "apple"); - r = pMsiGetProductInfoExA(prodcode, usersid, - MSIINSTALLCONTEXT_USERMANAGED, - INSTALLPROPERTY_INSTALLEDPRODUCTNAMEA, buf, &sz); + r = MsiGetProductInfoExA(prodcode, usersid, MSIINSTALLCONTEXT_USERMANAGED, INSTALLPROPERTY_INSTALLEDPRODUCTNAMEA, + buf, &sz); ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r); ok(!lstrcmpA(buf, "name"), "Expected \"name\", got \"%s\"\n", buf); ok(sz == 4, "Expected 4, got %lu\n", sz); @@ -6850,9 +6588,8 @@ static void test_MsiGetProductInfoEx(void) /* InstallLocation value exists */ sz = MAX_PATH; lstrcpyA(buf, "apple"); - r = pMsiGetProductInfoExA(prodcode, usersid, - MSIINSTALLCONTEXT_USERMANAGED, - INSTALLPROPERTY_INSTALLLOCATIONA, buf, &sz); + r = MsiGetProductInfoExA(prodcode, usersid, MSIINSTALLCONTEXT_USERMANAGED, INSTALLPROPERTY_INSTALLLOCATIONA, + buf, &sz); ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r); ok(!lstrcmpA(buf, "loc"), "Expected \"loc\", got \"%s\"\n", buf); ok(sz == 3, "Expected 3, got %lu\n", sz); @@ -6863,9 +6600,8 @@ static void test_MsiGetProductInfoEx(void) /* InstallSource value exists */ sz = MAX_PATH; lstrcpyA(buf, "apple"); - r = pMsiGetProductInfoExA(prodcode, usersid, - MSIINSTALLCONTEXT_USERMANAGED, - INSTALLPROPERTY_INSTALLSOURCEA, buf, &sz); + r = MsiGetProductInfoExA(prodcode, usersid, MSIINSTALLCONTEXT_USERMANAGED, INSTALLPROPERTY_INSTALLSOURCEA, + buf, &sz); ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r); ok(!lstrcmpA(buf, "source"), "Expected \"source\", got \"%s\"\n", buf); ok(sz == 6, "Expected 6, got %lu\n", sz); @@ -6876,9 +6612,8 @@ static void test_MsiGetProductInfoEx(void) /* LocalPackage value exists */ sz = MAX_PATH; lstrcpyA(buf, "apple"); - r = pMsiGetProductInfoExA(prodcode, usersid, - MSIINSTALLCONTEXT_USERMANAGED, - INSTALLPROPERTY_LOCALPACKAGEA, buf, &sz); + r = MsiGetProductInfoExA(prodcode, usersid, MSIINSTALLCONTEXT_USERMANAGED, INSTALLPROPERTY_LOCALPACKAGEA, + buf, &sz); ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r); ok(!lstrcmpA(buf, "local"), "Expected \"local\", got \"%s\"\n", buf); ok(sz == 5, "Expected 5, got %lu\n", sz); @@ -6889,9 +6624,8 @@ static void test_MsiGetProductInfoEx(void) /* Publisher value exists */ sz = MAX_PATH; lstrcpyA(buf, "apple"); - r = pMsiGetProductInfoExA(prodcode, usersid, - MSIINSTALLCONTEXT_USERMANAGED, - INSTALLPROPERTY_PUBLISHERA, buf, &sz); + r = MsiGetProductInfoExA(prodcode, usersid, MSIINSTALLCONTEXT_USERMANAGED, INSTALLPROPERTY_PUBLISHERA, + buf, &sz); ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r); ok(!lstrcmpA(buf, "pub"), "Expected \"pub\", got \"%s\"\n", buf); ok(sz == 3, "Expected 3, got %lu\n", sz); @@ -6902,9 +6636,8 @@ static void test_MsiGetProductInfoEx(void) /* URLInfoAbout value exists */ sz = MAX_PATH; lstrcpyA(buf, "apple"); - r = pMsiGetProductInfoExA(prodcode, usersid, - MSIINSTALLCONTEXT_USERMANAGED, - INSTALLPROPERTY_URLINFOABOUTA, buf, &sz); + r = MsiGetProductInfoExA(prodcode, usersid, MSIINSTALLCONTEXT_USERMANAGED, INSTALLPROPERTY_URLINFOABOUTA, + buf, &sz); ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r); ok(!lstrcmpA(buf, "about"), "Expected \"about\", got \"%s\"\n", buf); ok(sz == 5, "Expected 5, got %lu\n", sz); @@ -6915,9 +6648,8 @@ static void test_MsiGetProductInfoEx(void) /* URLUpdateInfo value exists */ sz = MAX_PATH; lstrcpyA(buf, "apple"); - r = pMsiGetProductInfoExA(prodcode, usersid, - MSIINSTALLCONTEXT_USERMANAGED, - INSTALLPROPERTY_URLUPDATEINFOA, buf, &sz); + r = MsiGetProductInfoExA(prodcode, usersid, MSIINSTALLCONTEXT_USERMANAGED, INSTALLPROPERTY_URLUPDATEINFOA, + buf, &sz); ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r); ok(!lstrcmpA(buf, "update"), "Expected \"update\", got \"%s\"\n", buf); ok(sz == 6, "Expected 6, got %lu\n", sz); @@ -6928,9 +6660,8 @@ static void test_MsiGetProductInfoEx(void) /* VersionMinor value exists */ sz = MAX_PATH; lstrcpyA(buf, "apple"); - r = pMsiGetProductInfoExA(prodcode, usersid, - MSIINSTALLCONTEXT_USERMANAGED, - INSTALLPROPERTY_VERSIONMINORA, buf, &sz); + r = MsiGetProductInfoExA(prodcode, usersid, MSIINSTALLCONTEXT_USERMANAGED, INSTALLPROPERTY_VERSIONMINORA, + buf, &sz); ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r); ok(!lstrcmpA(buf, "2"), "Expected \"2\", got \"%s\"\n", buf); ok(sz == 1, "Expected 1, got %lu\n", sz); @@ -6941,9 +6672,8 @@ static void test_MsiGetProductInfoEx(void) /* VersionMajor value exists */ sz = MAX_PATH; lstrcpyA(buf, "apple"); - r = pMsiGetProductInfoExA(prodcode, usersid, - MSIINSTALLCONTEXT_USERMANAGED, - INSTALLPROPERTY_VERSIONMAJORA, buf, &sz); + r = MsiGetProductInfoExA(prodcode, usersid, MSIINSTALLCONTEXT_USERMANAGED, INSTALLPROPERTY_VERSIONMAJORA, + buf, &sz); ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r); ok(!lstrcmpA(buf, "3"), "Expected \"3\", got \"%s\"\n", buf); ok(sz == 1, "Expected 1, got %lu\n", sz); @@ -6954,9 +6684,8 @@ static void test_MsiGetProductInfoEx(void) /* DisplayVersion value exists */ sz = MAX_PATH; lstrcpyA(buf, "apple"); - r = pMsiGetProductInfoExA(prodcode, usersid, - MSIINSTALLCONTEXT_USERMANAGED, - INSTALLPROPERTY_VERSIONSTRINGA, buf, &sz); + r = MsiGetProductInfoExA(prodcode, usersid, MSIINSTALLCONTEXT_USERMANAGED, INSTALLPROPERTY_VERSIONSTRINGA, + buf, &sz); ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r); ok(!lstrcmpA(buf, "3.2.1"), "Expected \"3.2.1\", got \"%s\"\n", buf); ok(sz == 5, "Expected 5, got %lu\n", sz); @@ -6967,9 +6696,8 @@ static void test_MsiGetProductInfoEx(void) /* ProductID value exists */ sz = MAX_PATH; lstrcpyA(buf, "apple"); - r = pMsiGetProductInfoExA(prodcode, usersid, - MSIINSTALLCONTEXT_USERMANAGED, - INSTALLPROPERTY_PRODUCTIDA, buf, &sz); + r = MsiGetProductInfoExA(prodcode, usersid, MSIINSTALLCONTEXT_USERMANAGED, INSTALLPROPERTY_PRODUCTIDA, + buf, &sz); ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r); ok(!lstrcmpA(buf, "id"), "Expected \"id\", got \"%s\"\n", buf); ok(sz == 2, "Expected 2, got %lu\n", sz); @@ -6980,9 +6708,8 @@ static void test_MsiGetProductInfoEx(void) /* RegCompany value exists */ sz = MAX_PATH; lstrcpyA(buf, "apple"); - r = pMsiGetProductInfoExA(prodcode, usersid, - MSIINSTALLCONTEXT_USERMANAGED, - INSTALLPROPERTY_REGCOMPANYA, buf, &sz); + r = MsiGetProductInfoExA(prodcode, usersid, MSIINSTALLCONTEXT_USERMANAGED, INSTALLPROPERTY_REGCOMPANYA, + buf, &sz); ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r); ok(!lstrcmpA(buf, "comp"), "Expected \"comp\", got \"%s\"\n", buf); ok(sz == 4, "Expected 4, got %lu\n", sz); @@ -6993,9 +6720,8 @@ static void test_MsiGetProductInfoEx(void) /* RegOwner value exists */ sz = MAX_PATH; lstrcpyA(buf, "apple"); - r = pMsiGetProductInfoExA(prodcode, usersid, - MSIINSTALLCONTEXT_USERMANAGED, - INSTALLPROPERTY_REGOWNERA, buf, &sz); + r = MsiGetProductInfoExA(prodcode, usersid, MSIINSTALLCONTEXT_USERMANAGED, INSTALLPROPERTY_REGOWNERA, + buf, &sz); ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r); ok(!lstrcmpA(buf, "owner"), "Expected \"owner\", got \"%s\"\n", buf); ok(sz == 5, "Expected 5, got %lu\n", sz); @@ -7006,11 +6732,9 @@ static void test_MsiGetProductInfoEx(void) /* Transforms value exists */ sz = MAX_PATH; lstrcpyA(buf, "apple"); - r = pMsiGetProductInfoExA(prodcode, usersid, - MSIINSTALLCONTEXT_USERMANAGED, - INSTALLPROPERTY_TRANSFORMSA, buf, &sz); - ok(r == ERROR_UNKNOWN_PRODUCT, - "Expected ERROR_UNKNOWN_PRODUCT, got %d\n", r); + r = MsiGetProductInfoExA(prodcode, usersid, MSIINSTALLCONTEXT_USERMANAGED, INSTALLPROPERTY_TRANSFORMSA, + buf, &sz); + ok(r == ERROR_UNKNOWN_PRODUCT, "Expected ERROR_UNKNOWN_PRODUCT, got %d\n", r); ok(!lstrcmpA(buf, "apple"), "Expected buf to be unchanged, got %s\n", buf); ok(sz == MAX_PATH, "Expected MAX_PATH, got %lu\n", sz); @@ -7020,11 +6744,9 @@ static void test_MsiGetProductInfoEx(void) /* Language value exists */ sz = MAX_PATH; lstrcpyA(buf, "apple"); - r = pMsiGetProductInfoExA(prodcode, usersid, - MSIINSTALLCONTEXT_USERMANAGED, - INSTALLPROPERTY_LANGUAGEA, buf, &sz); - ok(r == ERROR_UNKNOWN_PRODUCT, - "Expected ERROR_UNKNOWN_PRODUCT, got %d\n", r); + r = MsiGetProductInfoExA(prodcode, usersid, MSIINSTALLCONTEXT_USERMANAGED, INSTALLPROPERTY_LANGUAGEA, + buf, &sz); + ok(r == ERROR_UNKNOWN_PRODUCT, "Expected ERROR_UNKNOWN_PRODUCT, got %d\n", r); ok(!lstrcmpA(buf, "apple"), "Expected buf to be unchanged, got %s\n", buf); ok(sz == MAX_PATH, "Expected MAX_PATH, got %lu\n", sz); @@ -7034,11 +6756,9 @@ static void test_MsiGetProductInfoEx(void) /* ProductName value exists */ sz = MAX_PATH; lstrcpyA(buf, "apple"); - r = pMsiGetProductInfoExA(prodcode, usersid, - MSIINSTALLCONTEXT_USERMANAGED, - INSTALLPROPERTY_PRODUCTNAMEA, buf, &sz); - ok(r == ERROR_UNKNOWN_PRODUCT, - "Expected ERROR_UNKNOWN_PRODUCT, got %d\n", r); + r = MsiGetProductInfoExA(prodcode, usersid, MSIINSTALLCONTEXT_USERMANAGED, INSTALLPROPERTY_PRODUCTNAMEA, + buf, &sz); + ok(r == ERROR_UNKNOWN_PRODUCT, "Expected ERROR_UNKNOWN_PRODUCT, got %d\n", r); ok(!lstrcmpA(buf, "apple"), "Expected buf to be unchanged, got %s\n", buf); ok(sz == MAX_PATH, "Expected MAX_PATH, got %lu\n", sz); @@ -7050,11 +6770,9 @@ static void test_MsiGetProductInfoEx(void) /* AssignmentType value exists */ sz = MAX_PATH; lstrcpyA(buf, "apple"); - r = pMsiGetProductInfoExA(prodcode, usersid, - MSIINSTALLCONTEXT_USERMANAGED, - INSTALLPROPERTY_ASSIGNMENTTYPEA, buf, &sz); - ok(r == ERROR_UNKNOWN_PRODUCT, - "Expected ERROR_UNKNOWN_PRODUCT, got %d\n", r); + r = MsiGetProductInfoExA(prodcode, usersid, MSIINSTALLCONTEXT_USERMANAGED, INSTALLPROPERTY_ASSIGNMENTTYPEA, + buf, &sz); + ok(r == ERROR_UNKNOWN_PRODUCT, "Expected ERROR_UNKNOWN_PRODUCT, got %d\n", r); ok(!lstrcmpA(buf, "apple"), "Expected buf to be unchanged, got %s\n", buf); ok(sz == MAX_PATH, "Expected MAX_PATH, got %lu\n", sz); @@ -7064,11 +6782,9 @@ static void test_MsiGetProductInfoEx(void) /* PackageCode value exists */ sz = MAX_PATH; lstrcpyA(buf, "apple"); - r = pMsiGetProductInfoExA(prodcode, usersid, - MSIINSTALLCONTEXT_USERMANAGED, - INSTALLPROPERTY_PACKAGECODEA, buf, &sz); - ok(r == ERROR_UNKNOWN_PRODUCT, - "Expected ERROR_UNKNOWN_PRODUCT, got %d\n", r); + r = MsiGetProductInfoExA(prodcode, usersid, MSIINSTALLCONTEXT_USERMANAGED, INSTALLPROPERTY_PACKAGECODEA, + buf, &sz); + ok(r == ERROR_UNKNOWN_PRODUCT, "Expected ERROR_UNKNOWN_PRODUCT, got %d\n", r); ok(!lstrcmpA(buf, "apple"), "Expected buf to be unchanged, got %s\n", buf); ok(sz == MAX_PATH, "Expected MAX_PATH, got %lu\n", sz); @@ -7078,11 +6794,9 @@ static void test_MsiGetProductInfoEx(void) /* Version value exists */ sz = MAX_PATH; lstrcpyA(buf, "apple"); - r = pMsiGetProductInfoExA(prodcode, usersid, - MSIINSTALLCONTEXT_USERMANAGED, - INSTALLPROPERTY_VERSIONA, buf, &sz); - ok(r == ERROR_UNKNOWN_PRODUCT, - "Expected ERROR_UNKNOWN_PRODUCT, got %d\n", r); + r = MsiGetProductInfoExA(prodcode, usersid, MSIINSTALLCONTEXT_USERMANAGED, INSTALLPROPERTY_VERSIONA, + buf, &sz); + ok(r == ERROR_UNKNOWN_PRODUCT, "Expected ERROR_UNKNOWN_PRODUCT, got %d\n", r); ok(!lstrcmpA(buf, "apple"), "Expected buf to be unchanged, got %s\n", buf); ok(sz == MAX_PATH, "Expected MAX_PATH, got %lu\n", sz); @@ -7092,11 +6806,9 @@ static void test_MsiGetProductInfoEx(void) /* ProductIcon value exists */ sz = MAX_PATH; lstrcpyA(buf, "apple"); - r = pMsiGetProductInfoExA(prodcode, usersid, - MSIINSTALLCONTEXT_USERMANAGED, - INSTALLPROPERTY_PRODUCTICONA, buf, &sz); - ok(r == ERROR_UNKNOWN_PRODUCT, - "Expected ERROR_UNKNOWN_PRODUCT, got %d\n", r); + r = MsiGetProductInfoExA(prodcode, usersid, MSIINSTALLCONTEXT_USERMANAGED, INSTALLPROPERTY_PRODUCTICONA, + buf, &sz); + ok(r == ERROR_UNKNOWN_PRODUCT, "Expected ERROR_UNKNOWN_PRODUCT, got %d\n", r); ok(!lstrcmpA(buf, "apple"), "Expected buf to be unchanged, got %s\n", buf); ok(sz == MAX_PATH, "Expected MAX_PATH, got %lu\n", sz); @@ -7106,11 +6818,9 @@ static void test_MsiGetProductInfoEx(void) /* PackageName value exists */ sz = MAX_PATH; lstrcpyA(buf, "apple"); - r = pMsiGetProductInfoExA(prodcode, usersid, - MSIINSTALLCONTEXT_USERMANAGED, - INSTALLPROPERTY_PACKAGENAMEA, buf, &sz); - ok(r == ERROR_UNKNOWN_PRODUCT, - "Expected ERROR_UNKNOWN_PRODUCT, got %d\n", r); + r = MsiGetProductInfoExA(prodcode, usersid, MSIINSTALLCONTEXT_USERMANAGED, INSTALLPROPERTY_PACKAGENAMEA, + buf, &sz); + ok(r == ERROR_UNKNOWN_PRODUCT, "Expected ERROR_UNKNOWN_PRODUCT, got %d\n", r); ok(!lstrcmpA(buf, "apple"), "Expected buf to be unchanged, got %s\n", buf); ok(sz == MAX_PATH, "Expected MAX_PATH, got %lu\n", sz); @@ -7120,11 +6830,9 @@ static void test_MsiGetProductInfoEx(void) /* AuthorizedLUAApp value exists */ sz = MAX_PATH; lstrcpyA(buf, "apple"); - r = pMsiGetProductInfoExA(prodcode, usersid, - MSIINSTALLCONTEXT_USERMANAGED, - INSTALLPROPERTY_AUTHORIZED_LUA_APPA, buf, &sz); - ok(r == ERROR_UNKNOWN_PRODUCT, - "Expected ERROR_UNKNOWN_PRODUCT, got %d\n", r); + r = MsiGetProductInfoExA(prodcode, usersid, MSIINSTALLCONTEXT_USERMANAGED, INSTALLPROPERTY_AUTHORIZED_LUA_APPA, + buf, &sz); + ok(r == ERROR_UNKNOWN_PRODUCT, "Expected ERROR_UNKNOWN_PRODUCT, got %d\n", r); ok(!lstrcmpA(buf, "apple"), "Expected buf to be unchanged, got %s\n", buf); ok(sz == MAX_PATH, "Expected MAX_PATH, got %lu\n", sz); @@ -7154,9 +6862,9 @@ static void test_MsiGetProductInfoEx(void) RegDeleteValueA(propkey, "HelpTelephone"); RegDeleteValueA(propkey, "HelpLink"); RegDeleteValueA(propkey, "ManagedLocalPackage"); - delete_key(propkey, "", access & KEY_WOW64_64KEY); + RegDeleteKeyExA(propkey, "", access & KEY_WOW64_64KEY, 0); RegCloseKey(propkey); - delete_key(localkey, "", access & KEY_WOW64_64KEY); + RegDeleteKeyExA(localkey, "", access & KEY_WOW64_64KEY, 0); RegCloseKey(localkey); lstrcpyA(keypath, "Software\\Microsoft\\Windows\\CurrentVersion\\Installer\\Managed\\"); @@ -7170,14 +6878,13 @@ static void test_MsiGetProductInfoEx(void) /* user product key exists */ sz = MAX_PATH; lstrcpyA(buf, "apple"); - r = pMsiGetProductInfoExA(prodcode, usersid, - MSIINSTALLCONTEXT_USERMANAGED, - INSTALLPROPERTY_PRODUCTSTATEA, buf, &sz); + r = MsiGetProductInfoExA(prodcode, usersid, MSIINSTALLCONTEXT_USERMANAGED, INSTALLPROPERTY_PRODUCTSTATEA, + buf, &sz); ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r); ok(!lstrcmpA(buf, "1"), "Expected \"1\", got \"%s\"\n", buf); ok(sz == 1, "Expected 1, got %lu\n", sz); - delete_key(userkey, "", access & KEY_WOW64_64KEY); + RegDeleteKeyExA(userkey, "", access & KEY_WOW64_64KEY, 0); RegCloseKey(userkey); lstrcpyA(keypath, "Software\\Microsoft\\Installer\\Products\\"); @@ -7189,11 +6896,9 @@ static void test_MsiGetProductInfoEx(void) /* current user product key exists */ sz = MAX_PATH; lstrcpyA(buf, "apple"); - r = pMsiGetProductInfoExA(prodcode, usersid, - MSIINSTALLCONTEXT_USERMANAGED, - INSTALLPROPERTY_PRODUCTSTATEA, buf, &sz); - ok(r == ERROR_UNKNOWN_PRODUCT, - "Expected ERROR_UNKNOWN_PRODUCT, got %d\n", r); + r = MsiGetProductInfoExA(prodcode, usersid, MSIINSTALLCONTEXT_USERMANAGED, INSTALLPROPERTY_PRODUCTSTATEA, + buf, &sz); + ok(r == ERROR_UNKNOWN_PRODUCT, "Expected ERROR_UNKNOWN_PRODUCT, got %d\n", r); ok(!lstrcmpA(buf, "apple"), "Expected buf to be unchanged, got %s\n", buf); ok(sz == MAX_PATH, "Expected MAX_PATH, got %lu\n", sz); @@ -7203,11 +6908,9 @@ static void test_MsiGetProductInfoEx(void) /* HelpLink value exists, user product key does not exist */ sz = MAX_PATH; lstrcpyA(buf, "apple"); - r = pMsiGetProductInfoExA(prodcode, usersid, - MSIINSTALLCONTEXT_USERMANAGED, - INSTALLPROPERTY_HELPLINKA, buf, &sz); - ok(r == ERROR_UNKNOWN_PRODUCT, - "Expected ERROR_UNKNOWN_PRODUCT, got %d\n", r); + r = MsiGetProductInfoExA(prodcode, usersid, MSIINSTALLCONTEXT_USERMANAGED, INSTALLPROPERTY_HELPLINKA, + buf, &sz); + ok(r == ERROR_UNKNOWN_PRODUCT, "Expected ERROR_UNKNOWN_PRODUCT, got %d\n", r); ok(!lstrcmpA(buf, "apple"), "Expected buf to be unchanged, got %s\n", buf); ok(sz == MAX_PATH, "Expected MAX_PATH, got %lu\n", sz); @@ -7225,11 +6928,9 @@ static void test_MsiGetProductInfoEx(void) /* HelpLink value exists, user product key does exist */ sz = MAX_PATH; lstrcpyA(buf, "apple"); - r = pMsiGetProductInfoExA(prodcode, usersid, - MSIINSTALLCONTEXT_USERMANAGED, - INSTALLPROPERTY_HELPLINKA, buf, &sz); - ok(r == ERROR_UNKNOWN_PROPERTY, - "Expected ERROR_UNKNOWN_PROPERTY, got %d\n", r); + r = MsiGetProductInfoExA(prodcode, usersid, MSIINSTALLCONTEXT_USERMANAGED, INSTALLPROPERTY_HELPLINKA, + buf, &sz); + ok(r == ERROR_UNKNOWN_PROPERTY, "Expected ERROR_UNKNOWN_PROPERTY, got %d\n", r); ok(!lstrcmpA(buf, "apple"), "Expected buf to be unchanged, got %s\n", buf); ok(sz == MAX_PATH, "Expected MAX_PATH, got %lu\n", sz); @@ -7239,11 +6940,9 @@ static void test_MsiGetProductInfoEx(void) /* HelpTelephone value exists */ sz = MAX_PATH; lstrcpyA(buf, "apple"); - r = pMsiGetProductInfoExA(prodcode, usersid, - MSIINSTALLCONTEXT_USERMANAGED, - INSTALLPROPERTY_HELPTELEPHONEA, buf, &sz); - ok(r == ERROR_UNKNOWN_PROPERTY, - "Expected ERROR_UNKNOWN_PROPERTY, got %d\n", r); + r = MsiGetProductInfoExA(prodcode, usersid, MSIINSTALLCONTEXT_USERMANAGED, INSTALLPROPERTY_HELPTELEPHONEA, + buf, &sz); + ok(r == ERROR_UNKNOWN_PROPERTY, "Expected ERROR_UNKNOWN_PROPERTY, got %d\n", r); ok(!lstrcmpA(buf, "apple"), "Expected buf to be unchanged, got %s\n", buf); ok(sz == MAX_PATH, "Expected MAX_PATH, got %lu\n", sz); @@ -7253,11 +6952,9 @@ static void test_MsiGetProductInfoEx(void) /* InstallDate value exists */ sz = MAX_PATH; lstrcpyA(buf, "apple"); - r = pMsiGetProductInfoExA(prodcode, usersid, - MSIINSTALLCONTEXT_USERMANAGED, - INSTALLPROPERTY_INSTALLDATEA, buf, &sz); - ok(r == ERROR_UNKNOWN_PROPERTY, - "Expected ERROR_UNKNOWN_PROPERTY, got %d\n", r); + r = MsiGetProductInfoExA(prodcode, usersid, MSIINSTALLCONTEXT_USERMANAGED, INSTALLPROPERTY_INSTALLDATEA, + buf, &sz); + ok(r == ERROR_UNKNOWN_PROPERTY, "Expected ERROR_UNKNOWN_PROPERTY, got %d\n", r); ok(!lstrcmpA(buf, "apple"), "Expected buf to be unchanged, got %s\n", buf); ok(sz == MAX_PATH, "Expected MAX_PATH, got %lu\n", sz); @@ -7267,11 +6964,9 @@ static void test_MsiGetProductInfoEx(void) /* DisplayName value exists */ sz = MAX_PATH; lstrcpyA(buf, "apple"); - r = pMsiGetProductInfoExA(prodcode, usersid, - MSIINSTALLCONTEXT_USERMANAGED, - INSTALLPROPERTY_INSTALLEDPRODUCTNAMEA, buf, &sz); - ok(r == ERROR_UNKNOWN_PROPERTY, - "Expected ERROR_UNKNOWN_PROPERTY, got %d\n", r); + r = MsiGetProductInfoExA(prodcode, usersid, MSIINSTALLCONTEXT_USERMANAGED, INSTALLPROPERTY_INSTALLEDPRODUCTNAMEA, + buf, &sz); + ok(r == ERROR_UNKNOWN_PROPERTY, "Expected ERROR_UNKNOWN_PROPERTY, got %d\n", r); ok(!lstrcmpA(buf, "apple"), "Expected buf to be unchanged, got %s\n", buf); ok(sz == MAX_PATH, "Expected MAX_PATH, got %lu\n", sz); @@ -7281,11 +6976,9 @@ static void test_MsiGetProductInfoEx(void) /* InstallLocation value exists */ sz = MAX_PATH; lstrcpyA(buf, "apple"); - r = pMsiGetProductInfoExA(prodcode, usersid, - MSIINSTALLCONTEXT_USERMANAGED, - INSTALLPROPERTY_INSTALLLOCATIONA, buf, &sz); - ok(r == ERROR_UNKNOWN_PROPERTY, - "Expected ERROR_UNKNOWN_PROPERTY, got %d\n", r); + r = MsiGetProductInfoExA(prodcode, usersid, MSIINSTALLCONTEXT_USERMANAGED, INSTALLPROPERTY_INSTALLLOCATIONA, + buf, &sz); + ok(r == ERROR_UNKNOWN_PROPERTY, "Expected ERROR_UNKNOWN_PROPERTY, got %d\n", r); ok(!lstrcmpA(buf, "apple"), "Expected buf to be unchanged, got %s\n", buf); ok(sz == MAX_PATH, "Expected MAX_PATH, got %lu\n", sz); @@ -7295,11 +6988,9 @@ static void test_MsiGetProductInfoEx(void) /* InstallSource value exists */ sz = MAX_PATH; lstrcpyA(buf, "apple"); - r = pMsiGetProductInfoExA(prodcode, usersid, - MSIINSTALLCONTEXT_USERMANAGED, - INSTALLPROPERTY_INSTALLSOURCEA, buf, &sz); - ok(r == ERROR_UNKNOWN_PROPERTY, - "Expected ERROR_UNKNOWN_PROPERTY, got %d\n", r); + r = MsiGetProductInfoExA(prodcode, usersid, MSIINSTALLCONTEXT_USERMANAGED, INSTALLPROPERTY_INSTALLSOURCEA, + buf, &sz); + ok(r == ERROR_UNKNOWN_PROPERTY, "Expected ERROR_UNKNOWN_PROPERTY, got %d\n", r); ok(!lstrcmpA(buf, "apple"), "Expected buf to be unchanged, got %s\n", buf); ok(sz == MAX_PATH, "Expected MAX_PATH, got %lu\n", sz); @@ -7309,11 +7000,9 @@ static void test_MsiGetProductInfoEx(void) /* LocalPackage value exists */ sz = MAX_PATH; lstrcpyA(buf, "apple"); - r = pMsiGetProductInfoExA(prodcode, usersid, - MSIINSTALLCONTEXT_USERMANAGED, - INSTALLPROPERTY_LOCALPACKAGEA, buf, &sz); - ok(r == ERROR_UNKNOWN_PROPERTY, - "Expected ERROR_UNKNOWN_PROPERTY, got %d\n", r); + r = MsiGetProductInfoExA(prodcode, usersid, MSIINSTALLCONTEXT_USERMANAGED, INSTALLPROPERTY_LOCALPACKAGEA, + buf, &sz); + ok(r == ERROR_UNKNOWN_PROPERTY, "Expected ERROR_UNKNOWN_PROPERTY, got %d\n", r); ok(!lstrcmpA(buf, "apple"), "Expected buf to be unchanged, got %s\n", buf); ok(sz == MAX_PATH, "Expected MAX_PATH, got %lu\n", sz); @@ -7323,11 +7012,9 @@ static void test_MsiGetProductInfoEx(void) /* Publisher value exists */ sz = MAX_PATH; lstrcpyA(buf, "apple"); - r = pMsiGetProductInfoExA(prodcode, usersid, - MSIINSTALLCONTEXT_USERMANAGED, - INSTALLPROPERTY_PUBLISHERA, buf, &sz); - ok(r == ERROR_UNKNOWN_PROPERTY, - "Expected ERROR_UNKNOWN_PROPERTY, got %d\n", r); + r = MsiGetProductInfoExA(prodcode, usersid, MSIINSTALLCONTEXT_USERMANAGED, INSTALLPROPERTY_PUBLISHERA, + buf, &sz); + ok(r == ERROR_UNKNOWN_PROPERTY, "Expected ERROR_UNKNOWN_PROPERTY, got %d\n", r); ok(!lstrcmpA(buf, "apple"), "Expected buf to be unchanged, got %s\n", buf); ok(sz == MAX_PATH, "Expected MAX_PATH, got %lu\n", sz); @@ -7337,11 +7024,9 @@ static void test_MsiGetProductInfoEx(void) /* URLInfoAbout value exists */ sz = MAX_PATH; lstrcpyA(buf, "apple"); - r = pMsiGetProductInfoExA(prodcode, usersid, - MSIINSTALLCONTEXT_USERMANAGED, - INSTALLPROPERTY_URLINFOABOUTA, buf, &sz); - ok(r == ERROR_UNKNOWN_PROPERTY, - "Expected ERROR_UNKNOWN_PROPERTY, got %d\n", r); + r = MsiGetProductInfoExA(prodcode, usersid, MSIINSTALLCONTEXT_USERMANAGED, INSTALLPROPERTY_URLINFOABOUTA, + buf, &sz); + ok(r == ERROR_UNKNOWN_PROPERTY, "Expected ERROR_UNKNOWN_PROPERTY, got %d\n", r); ok(!lstrcmpA(buf, "apple"), "Expected buf to be unchanged, got %s\n", buf); ok(sz == MAX_PATH, "Expected MAX_PATH, got %lu\n", sz); @@ -7351,11 +7036,9 @@ static void test_MsiGetProductInfoEx(void) /* URLUpdateInfo value exists */ sz = MAX_PATH; lstrcpyA(buf, "apple"); - r = pMsiGetProductInfoExA(prodcode, usersid, - MSIINSTALLCONTEXT_USERMANAGED, - INSTALLPROPERTY_URLUPDATEINFOA, buf, &sz); - ok(r == ERROR_UNKNOWN_PROPERTY, - "Expected ERROR_UNKNOWN_PROPERTY, got %d\n", r); + r = MsiGetProductInfoExA(prodcode, usersid, MSIINSTALLCONTEXT_USERMANAGED, INSTALLPROPERTY_URLUPDATEINFOA, + buf, &sz); + ok(r == ERROR_UNKNOWN_PROPERTY, "Expected ERROR_UNKNOWN_PROPERTY, got %d\n", r); ok(!lstrcmpA(buf, "apple"), "Expected buf to be unchanged, got %s\n", buf); ok(sz == MAX_PATH, "Expected MAX_PATH, got %lu\n", sz); @@ -7365,11 +7048,9 @@ static void test_MsiGetProductInfoEx(void) /* VersionMinor value exists */ sz = MAX_PATH; lstrcpyA(buf, "apple"); - r = pMsiGetProductInfoExA(prodcode, usersid, - MSIINSTALLCONTEXT_USERMANAGED, - INSTALLPROPERTY_VERSIONMINORA, buf, &sz); - ok(r == ERROR_UNKNOWN_PROPERTY, - "Expected ERROR_UNKNOWN_PROPERTY, got %d\n", r); + r = MsiGetProductInfoExA(prodcode, usersid, MSIINSTALLCONTEXT_USERMANAGED, INSTALLPROPERTY_VERSIONMINORA, + buf, &sz); + ok(r == ERROR_UNKNOWN_PROPERTY, "Expected ERROR_UNKNOWN_PROPERTY, got %d\n", r); ok(!lstrcmpA(buf, "apple"), "Expected buf to be unchanged, got %s\n", buf); ok(sz == MAX_PATH, "Expected MAX_PATH, got %lu\n", sz); @@ -7379,11 +7060,9 @@ static void test_MsiGetProductInfoEx(void) /* VersionMajor value exists */ sz = MAX_PATH; lstrcpyA(buf, "apple"); - r = pMsiGetProductInfoExA(prodcode, usersid, - MSIINSTALLCONTEXT_USERMANAGED, - INSTALLPROPERTY_VERSIONMAJORA, buf, &sz); - ok(r == ERROR_UNKNOWN_PROPERTY, - "Expected ERROR_UNKNOWN_PROPERTY, got %d\n", r); + r = MsiGetProductInfoExA(prodcode, usersid, MSIINSTALLCONTEXT_USERMANAGED, INSTALLPROPERTY_VERSIONMAJORA, + buf, &sz); + ok(r == ERROR_UNKNOWN_PROPERTY, "Expected ERROR_UNKNOWN_PROPERTY, got %d\n", r); ok(!lstrcmpA(buf, "apple"), "Expected buf to be unchanged, got %s\n", buf); ok(sz == MAX_PATH, "Expected MAX_PATH, got %lu\n", sz); @@ -7393,11 +7072,9 @@ static void test_MsiGetProductInfoEx(void) /* DisplayVersion value exists */ sz = MAX_PATH; lstrcpyA(buf, "apple"); - r = pMsiGetProductInfoExA(prodcode, usersid, - MSIINSTALLCONTEXT_USERMANAGED, - INSTALLPROPERTY_VERSIONSTRINGA, buf, &sz); - ok(r == ERROR_UNKNOWN_PROPERTY, - "Expected ERROR_UNKNOWN_PROPERTY, got %d\n", r); + r = MsiGetProductInfoExA(prodcode, usersid, MSIINSTALLCONTEXT_USERMANAGED, INSTALLPROPERTY_VERSIONSTRINGA, + buf, &sz); + ok(r == ERROR_UNKNOWN_PROPERTY, "Expected ERROR_UNKNOWN_PROPERTY, got %d\n", r); ok(!lstrcmpA(buf, "apple"), "Expected buf to be unchanged, got %s\n", buf); ok(sz == MAX_PATH, "Expected MAX_PATH, got %lu\n", sz); @@ -7407,11 +7084,9 @@ static void test_MsiGetProductInfoEx(void) /* ProductID value exists */ sz = MAX_PATH; lstrcpyA(buf, "apple"); - r = pMsiGetProductInfoExA(prodcode, usersid, - MSIINSTALLCONTEXT_USERMANAGED, - INSTALLPROPERTY_PRODUCTIDA, buf, &sz); - ok(r == ERROR_UNKNOWN_PROPERTY, - "Expected ERROR_UNKNOWN_PROPERTY, got %d\n", r); + r = MsiGetProductInfoExA(prodcode, usersid, MSIINSTALLCONTEXT_USERMANAGED, INSTALLPROPERTY_PRODUCTIDA, + buf, &sz); + ok(r == ERROR_UNKNOWN_PROPERTY, "Expected ERROR_UNKNOWN_PROPERTY, got %d\n", r); ok(!lstrcmpA(buf, "apple"), "Expected buf to be unchanged, got %s\n", buf); ok(sz == MAX_PATH, "Expected MAX_PATH, got %lu\n", sz); @@ -7421,11 +7096,9 @@ static void test_MsiGetProductInfoEx(void) /* RegCompany value exists */ sz = MAX_PATH; lstrcpyA(buf, "apple"); - r = pMsiGetProductInfoExA(prodcode, usersid, - MSIINSTALLCONTEXT_USERMANAGED, - INSTALLPROPERTY_REGCOMPANYA, buf, &sz); - ok(r == ERROR_UNKNOWN_PROPERTY, - "Expected ERROR_UNKNOWN_PROPERTY, got %d\n", r); + r = MsiGetProductInfoExA(prodcode, usersid, MSIINSTALLCONTEXT_USERMANAGED, INSTALLPROPERTY_REGCOMPANYA, + buf, &sz); + ok(r == ERROR_UNKNOWN_PROPERTY, "Expected ERROR_UNKNOWN_PROPERTY, got %d\n", r); ok(!lstrcmpA(buf, "apple"), "Expected buf to be unchanged, got %s\n", buf); ok(sz == MAX_PATH, "Expected MAX_PATH, got %lu\n", sz); @@ -7435,11 +7108,9 @@ static void test_MsiGetProductInfoEx(void) /* RegOwner value exists */ sz = MAX_PATH; lstrcpyA(buf, "apple"); - r = pMsiGetProductInfoExA(prodcode, usersid, - MSIINSTALLCONTEXT_USERMANAGED, - INSTALLPROPERTY_REGOWNERA, buf, &sz); - ok(r == ERROR_UNKNOWN_PROPERTY, - "Expected ERROR_UNKNOWN_PROPERTY, got %d\n", r); + r = MsiGetProductInfoExA(prodcode, usersid, MSIINSTALLCONTEXT_USERMANAGED, INSTALLPROPERTY_REGOWNERA, + buf, &sz); + ok(r == ERROR_UNKNOWN_PROPERTY, "Expected ERROR_UNKNOWN_PROPERTY, got %d\n", r); ok(!lstrcmpA(buf, "apple"), "Expected buf to be unchanged, got %s\n", buf); ok(sz == MAX_PATH, "Expected MAX_PATH, got %lu\n", sz); @@ -7449,9 +7120,8 @@ static void test_MsiGetProductInfoEx(void) /* Transforms value exists */ sz = MAX_PATH; lstrcpyA(buf, "apple"); - r = pMsiGetProductInfoExA(prodcode, usersid, - MSIINSTALLCONTEXT_USERMANAGED, - INSTALLPROPERTY_TRANSFORMSA, buf, &sz); + r = MsiGetProductInfoExA(prodcode, usersid, MSIINSTALLCONTEXT_USERMANAGED, INSTALLPROPERTY_TRANSFORMSA, + buf, &sz); ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r); ok(!lstrcmpA(buf, "trans"), "Expected \"trans\", got \"%s\"\n", buf); ok(sz == 5, "Expected 5, got %lu\n", sz); @@ -7462,9 +7132,8 @@ static void test_MsiGetProductInfoEx(void) /* Language value exists */ sz = MAX_PATH; lstrcpyA(buf, "apple"); - r = pMsiGetProductInfoExA(prodcode, usersid, - MSIINSTALLCONTEXT_USERMANAGED, - INSTALLPROPERTY_LANGUAGEA, buf, &sz); + r = MsiGetProductInfoExA(prodcode, usersid, MSIINSTALLCONTEXT_USERMANAGED, INSTALLPROPERTY_LANGUAGEA, + buf, &sz); ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r); ok(!lstrcmpA(buf, "lang"), "Expected \"lang\", got \"%s\"\n", buf); ok(sz == 4, "Expected 4, got %lu\n", sz); @@ -7475,9 +7144,8 @@ static void test_MsiGetProductInfoEx(void) /* ProductName value exists */ sz = MAX_PATH; lstrcpyA(buf, "apple"); - r = pMsiGetProductInfoExA(prodcode, usersid, - MSIINSTALLCONTEXT_USERMANAGED, - INSTALLPROPERTY_PRODUCTNAMEA, buf, &sz); + r = MsiGetProductInfoExA(prodcode, usersid, MSIINSTALLCONTEXT_USERMANAGED, INSTALLPROPERTY_PRODUCTNAMEA, + buf, &sz); ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r); ok(!lstrcmpA(buf, "name"), "Expected \"name\", got \"%s\"\n", buf); ok(sz == 4, "Expected 4, got %lu\n", sz); @@ -7490,9 +7158,8 @@ static void test_MsiGetProductInfoEx(void) /* AssignmentType value exists */ sz = MAX_PATH; lstrcpyA(buf, "apple"); - r = pMsiGetProductInfoExA(prodcode, usersid, - MSIINSTALLCONTEXT_USERMANAGED, - INSTALLPROPERTY_ASSIGNMENTTYPEA, buf, &sz); + r = MsiGetProductInfoExA(prodcode, usersid, MSIINSTALLCONTEXT_USERMANAGED, INSTALLPROPERTY_ASSIGNMENTTYPEA, + buf, &sz); ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r); ok(!lstrcmpA(buf, ""), "Expected \"\", got \"%s\"\n", buf); ok(sz == 0, "Expected 0, got %lu\n", sz); @@ -7505,13 +7172,11 @@ static void test_MsiGetProductInfoEx(void) /* PackageCode value exists */ sz = MAX_PATH; lstrcpyA(buf, "apple"); - r = pMsiGetProductInfoExA(prodcode, usersid, - MSIINSTALLCONTEXT_USERMANAGED, - INSTALLPROPERTY_PACKAGECODEA, buf, &sz); + r = MsiGetProductInfoExA(prodcode, usersid, MSIINSTALLCONTEXT_USERMANAGED, INSTALLPROPERTY_PACKAGECODEA, + buf, &sz); todo_wine { - ok(r == ERROR_BAD_CONFIGURATION, - "Expected ERROR_BAD_CONFIGURATION, got %d\n", r); + ok(r == ERROR_BAD_CONFIGURATION, "Expected ERROR_BAD_CONFIGURATION, got %d\n", r); ok(!lstrcmpA(buf, "apple"), "Expected buf to be unchanged, got %s\n", buf); ok(sz == MAX_PATH, "Expected MAX_PATH, got %lu\n", sz); } @@ -7522,9 +7187,8 @@ static void test_MsiGetProductInfoEx(void) /* Version value exists */ sz = MAX_PATH; lstrcpyA(buf, "apple"); - r = pMsiGetProductInfoExA(prodcode, usersid, - MSIINSTALLCONTEXT_USERMANAGED, - INSTALLPROPERTY_VERSIONA, buf, &sz); + r = MsiGetProductInfoExA(prodcode, usersid, MSIINSTALLCONTEXT_USERMANAGED, INSTALLPROPERTY_VERSIONA, + buf, &sz); ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r); ok(!lstrcmpA(buf, "ver"), "Expected \"ver\", got \"%s\"\n", buf); ok(sz == 3, "Expected 3, got %lu\n", sz); @@ -7535,9 +7199,8 @@ static void test_MsiGetProductInfoEx(void) /* ProductIcon value exists */ sz = MAX_PATH; lstrcpyA(buf, "apple"); - r = pMsiGetProductInfoExA(prodcode, usersid, - MSIINSTALLCONTEXT_USERMANAGED, - INSTALLPROPERTY_PRODUCTICONA, buf, &sz); + r = MsiGetProductInfoExA(prodcode, usersid, MSIINSTALLCONTEXT_USERMANAGED, INSTALLPROPERTY_PRODUCTICONA, + buf, &sz); ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r); ok(!lstrcmpA(buf, "icon"), "Expected \"icon\", got \"%s\"\n", buf); ok(sz == 4, "Expected 4, got %lu\n", sz); @@ -7548,13 +7211,11 @@ static void test_MsiGetProductInfoEx(void) /* PackageName value exists */ sz = MAX_PATH; lstrcpyA(buf, "apple"); - r = pMsiGetProductInfoExA(prodcode, usersid, - MSIINSTALLCONTEXT_USERMANAGED, - INSTALLPROPERTY_PACKAGENAMEA, buf, &sz); + r = MsiGetProductInfoExA(prodcode, usersid, MSIINSTALLCONTEXT_USERMANAGED, INSTALLPROPERTY_PACKAGENAMEA, + buf, &sz); todo_wine { - ok(r == ERROR_UNKNOWN_PRODUCT, - "Expected ERROR_UNKNOWN_PRODUCT, got %d\n", r); + ok(r == ERROR_UNKNOWN_PRODUCT, "Expected ERROR_UNKNOWN_PRODUCT, got %d\n", r); ok(!lstrcmpA(buf, "apple"), "Expected buf to be unchanged, got %s\n", buf); ok(sz == MAX_PATH, "Expected MAX_PATH, got %lu\n", sz); } @@ -7565,9 +7226,8 @@ static void test_MsiGetProductInfoEx(void) /* AuthorizedLUAApp value exists */ sz = MAX_PATH; lstrcpyA(buf, "apple"); - r = pMsiGetProductInfoExA(prodcode, usersid, - MSIINSTALLCONTEXT_USERMANAGED, - INSTALLPROPERTY_AUTHORIZED_LUA_APPA, buf, &sz); + r = MsiGetProductInfoExA(prodcode, usersid, MSIINSTALLCONTEXT_USERMANAGED, INSTALLPROPERTY_AUTHORIZED_LUA_APPA, + buf, &sz); ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r); ok(!lstrcmpA(buf, "auth"), "Expected \"auth\", got \"%s\"\n", buf); ok(sz == 4, "Expected 4, got %lu\n", sz); @@ -7597,9 +7257,9 @@ static void test_MsiGetProductInfoEx(void) RegDeleteValueA(userkey, "InstallDate"); RegDeleteValueA(userkey, "HelpTelephone"); RegDeleteValueA(userkey, "HelpLink"); - delete_key(userkey, "", access & KEY_WOW64_64KEY); + RegDeleteKeyExA(userkey, "", access & KEY_WOW64_64KEY, 0); RegCloseKey(userkey); - delete_key(prodkey, "", access & KEY_WOW64_64KEY); + RegDeleteKeyExA(prodkey, "", access & KEY_WOW64_64KEY, 0); RegCloseKey(prodkey); /* MSIINSTALLCONTEXT_MACHINE */ @@ -7607,11 +7267,8 @@ static void test_MsiGetProductInfoEx(void) /* szUserSid is non-NULL */ sz = MAX_PATH; lstrcpyA(buf, "apple"); - r = pMsiGetProductInfoExA(prodcode, usersid, - MSIINSTALLCONTEXT_MACHINE, - INSTALLPROPERTY_PRODUCTSTATEA, buf, &sz); - ok(r == ERROR_INVALID_PARAMETER, - "Expected ERROR_INVALID_PARAMETER, got %d\n", r); + r = MsiGetProductInfoExA(prodcode, usersid, MSIINSTALLCONTEXT_MACHINE, INSTALLPROPERTY_PRODUCTSTATEA, buf, &sz); + ok(r == ERROR_INVALID_PARAMETER, "Expected ERROR_INVALID_PARAMETER, got %d\n", r); ok(!lstrcmpA(buf, "apple"), "Expected buf to be unchanged, got %s\n", buf); ok(sz == MAX_PATH, "Expected MAX_PATH, got %lu\n", sz); @@ -7624,11 +7281,8 @@ static void test_MsiGetProductInfoEx(void) /* local system product key exists */ sz = MAX_PATH; lstrcpyA(buf, "apple"); - r = pMsiGetProductInfoExA(prodcode, NULL, - MSIINSTALLCONTEXT_MACHINE, - INSTALLPROPERTY_PRODUCTSTATEA, buf, &sz); - ok(r == ERROR_UNKNOWN_PRODUCT, - "Expected ERROR_UNKNOWN_PRODUCT, got %d\n", r); + r = MsiGetProductInfoExA(prodcode, NULL, MSIINSTALLCONTEXT_MACHINE, INSTALLPROPERTY_PRODUCTSTATEA, buf, &sz); + ok(r == ERROR_UNKNOWN_PRODUCT, "Expected ERROR_UNKNOWN_PRODUCT, got %d\n", r); ok(!lstrcmpA(buf, "apple"), "Expected buf to be unchanged, got %s\n", buf); ok(sz == MAX_PATH, "Expected MAX_PATH, got %lu\n", sz); @@ -7638,11 +7292,8 @@ static void test_MsiGetProductInfoEx(void) /* InstallProperties key exists */ sz = MAX_PATH; lstrcpyA(buf, "apple"); - r = pMsiGetProductInfoExA(prodcode, NULL, - MSIINSTALLCONTEXT_MACHINE, - INSTALLPROPERTY_PRODUCTSTATEA, buf, &sz); - ok(r == ERROR_UNKNOWN_PRODUCT, - "Expected ERROR_UNKNOWN_PRODUCT, got %d\n", r); + r = MsiGetProductInfoExA(prodcode, NULL, MSIINSTALLCONTEXT_MACHINE, INSTALLPROPERTY_PRODUCTSTATEA, buf, &sz); + ok(r == ERROR_UNKNOWN_PRODUCT, "Expected ERROR_UNKNOWN_PRODUCT, got %d\n", r); ok(!lstrcmpA(buf, "apple"), "Expected buf to be unchanged, got %s\n", buf); ok(sz == MAX_PATH, "Expected MAX_PATH, got %lu\n", sz); @@ -7652,9 +7303,7 @@ static void test_MsiGetProductInfoEx(void) /* LocalPackage value exists */ sz = MAX_PATH; lstrcpyA(buf, "apple"); - r = pMsiGetProductInfoExA(prodcode, NULL, - MSIINSTALLCONTEXT_MACHINE, - INSTALLPROPERTY_PRODUCTSTATEA, buf, &sz); + r = MsiGetProductInfoExA(prodcode, NULL, MSIINSTALLCONTEXT_MACHINE, INSTALLPROPERTY_PRODUCTSTATEA, buf, &sz); ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r); ok(!lstrcmpA(buf, "5"), "Expected \"5\", got \"%s\"\n", buf); ok(sz == 1, "Expected 1, got %lu\n", sz); @@ -7665,9 +7314,7 @@ static void test_MsiGetProductInfoEx(void) /* HelpLink value exists */ sz = MAX_PATH; lstrcpyA(buf, "apple"); - r = pMsiGetProductInfoExA(prodcode, NULL, - MSIINSTALLCONTEXT_MACHINE, - INSTALLPROPERTY_HELPLINKA, buf, &sz); + r = MsiGetProductInfoExA(prodcode, NULL, MSIINSTALLCONTEXT_MACHINE, INSTALLPROPERTY_HELPLINKA, buf, &sz); ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r); ok(!lstrcmpA(buf, "link"), "Expected \"link\", got \"%s\"\n", buf); ok(sz == 4, "Expected 4, got %lu\n", sz); @@ -7678,9 +7325,7 @@ static void test_MsiGetProductInfoEx(void) /* HelpTelephone value exists */ sz = MAX_PATH; lstrcpyA(buf, "apple"); - r = pMsiGetProductInfoExA(prodcode, NULL, - MSIINSTALLCONTEXT_MACHINE, - INSTALLPROPERTY_HELPTELEPHONEA, buf, &sz); + r = MsiGetProductInfoExA(prodcode, NULL, MSIINSTALLCONTEXT_MACHINE, INSTALLPROPERTY_HELPTELEPHONEA, buf, &sz); ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r); ok(!lstrcmpA(buf, "phone"), "Expected \"phone\", got \"%s\"\n", buf); ok(sz == 5, "Expected 5, got %lu\n", sz); @@ -7691,9 +7336,7 @@ static void test_MsiGetProductInfoEx(void) /* InstallDate value exists */ sz = MAX_PATH; lstrcpyA(buf, "apple"); - r = pMsiGetProductInfoExA(prodcode, NULL, - MSIINSTALLCONTEXT_MACHINE, - INSTALLPROPERTY_INSTALLDATEA, buf, &sz); + r = MsiGetProductInfoExA(prodcode, NULL, MSIINSTALLCONTEXT_MACHINE, INSTALLPROPERTY_INSTALLDATEA, buf, &sz); ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r); ok(!lstrcmpA(buf, "date"), "Expected \"date\", got \"%s\"\n", buf); ok(sz == 4, "Expected 4, got %lu\n", sz); @@ -7704,9 +7347,8 @@ static void test_MsiGetProductInfoEx(void) /* DisplayName value exists */ sz = MAX_PATH; lstrcpyA(buf, "apple"); - r = pMsiGetProductInfoExA(prodcode, NULL, - MSIINSTALLCONTEXT_MACHINE, - INSTALLPROPERTY_INSTALLEDPRODUCTNAMEA, buf, &sz); + r = MsiGetProductInfoExA(prodcode, NULL, MSIINSTALLCONTEXT_MACHINE, INSTALLPROPERTY_INSTALLEDPRODUCTNAMEA, + buf, &sz); ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r); ok(!lstrcmpA(buf, "name"), "Expected \"name\", got \"%s\"\n", buf); ok(sz == 4, "Expected 4, got %lu\n", sz); @@ -7717,9 +7359,7 @@ static void test_MsiGetProductInfoEx(void) /* InstallLocation value exists */ sz = MAX_PATH; lstrcpyA(buf, "apple"); - r = pMsiGetProductInfoExA(prodcode, NULL, - MSIINSTALLCONTEXT_MACHINE, - INSTALLPROPERTY_INSTALLLOCATIONA, buf, &sz); + r = MsiGetProductInfoExA(prodcode, NULL, MSIINSTALLCONTEXT_MACHINE, INSTALLPROPERTY_INSTALLLOCATIONA, buf, &sz); ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r); ok(!lstrcmpA(buf, "loc"), "Expected \"loc\", got \"%s\"\n", buf); ok(sz == 3, "Expected 3, got %lu\n", sz); @@ -7730,9 +7370,7 @@ static void test_MsiGetProductInfoEx(void) /* InstallSource value exists */ sz = MAX_PATH; lstrcpyA(buf, "apple"); - r = pMsiGetProductInfoExA(prodcode, NULL, - MSIINSTALLCONTEXT_MACHINE, - INSTALLPROPERTY_INSTALLSOURCEA, buf, &sz); + r = MsiGetProductInfoExA(prodcode, NULL, MSIINSTALLCONTEXT_MACHINE, INSTALLPROPERTY_INSTALLSOURCEA, buf, &sz); ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r); ok(!lstrcmpA(buf, "source"), "Expected \"source\", got \"%s\"\n", buf); ok(sz == 6, "Expected 6, got %lu\n", sz); @@ -7743,9 +7381,7 @@ static void test_MsiGetProductInfoEx(void) /* LocalPackage value exists */ sz = MAX_PATH; lstrcpyA(buf, "apple"); - r = pMsiGetProductInfoExA(prodcode, NULL, - MSIINSTALLCONTEXT_MACHINE, - INSTALLPROPERTY_LOCALPACKAGEA, buf, &sz); + r = MsiGetProductInfoExA(prodcode, NULL, MSIINSTALLCONTEXT_MACHINE, INSTALLPROPERTY_LOCALPACKAGEA, buf, &sz); ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r); ok(!lstrcmpA(buf, "local"), "Expected \"local\", got \"%s\"\n", buf); ok(sz == 5, "Expected 5, got %lu\n", sz); @@ -7756,9 +7392,7 @@ static void test_MsiGetProductInfoEx(void) /* Publisher value exists */ sz = MAX_PATH; lstrcpyA(buf, "apple"); - r = pMsiGetProductInfoExA(prodcode, NULL, - MSIINSTALLCONTEXT_MACHINE, - INSTALLPROPERTY_PUBLISHERA, buf, &sz); + r = MsiGetProductInfoExA(prodcode, NULL, MSIINSTALLCONTEXT_MACHINE, INSTALLPROPERTY_PUBLISHERA, buf, &sz); ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r); ok(!lstrcmpA(buf, "pub"), "Expected \"pub\", got \"%s\"\n", buf); ok(sz == 3, "Expected 3, got %lu\n", sz); @@ -7769,9 +7403,7 @@ static void test_MsiGetProductInfoEx(void) /* URLInfoAbout value exists */ sz = MAX_PATH; lstrcpyA(buf, "apple"); - r = pMsiGetProductInfoExA(prodcode, NULL, - MSIINSTALLCONTEXT_MACHINE, - INSTALLPROPERTY_URLINFOABOUTA, buf, &sz); + r = MsiGetProductInfoExA(prodcode, NULL, MSIINSTALLCONTEXT_MACHINE, INSTALLPROPERTY_URLINFOABOUTA, buf, &sz); ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r); ok(!lstrcmpA(buf, "about"), "Expected \"about\", got \"%s\"\n", buf); ok(sz == 5, "Expected 5, got %lu\n", sz); @@ -7782,9 +7414,7 @@ static void test_MsiGetProductInfoEx(void) /* URLUpdateInfo value exists */ sz = MAX_PATH; lstrcpyA(buf, "apple"); - r = pMsiGetProductInfoExA(prodcode, NULL, - MSIINSTALLCONTEXT_MACHINE, - INSTALLPROPERTY_URLUPDATEINFOA, buf, &sz); + r = MsiGetProductInfoExA(prodcode, NULL, MSIINSTALLCONTEXT_MACHINE, INSTALLPROPERTY_URLUPDATEINFOA, buf, &sz); ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r); ok(!lstrcmpA(buf, "update"), "Expected \"update\", got \"%s\"\n", buf); ok(sz == 6, "Expected 6, got %lu\n", sz); @@ -7795,9 +7425,7 @@ static void test_MsiGetProductInfoEx(void) /* VersionMinor value exists */ sz = MAX_PATH; lstrcpyA(buf, "apple"); - r = pMsiGetProductInfoExA(prodcode, NULL, - MSIINSTALLCONTEXT_MACHINE, - INSTALLPROPERTY_VERSIONMINORA, buf, &sz); + r = MsiGetProductInfoExA(prodcode, NULL, MSIINSTALLCONTEXT_MACHINE, INSTALLPROPERTY_VERSIONMINORA, buf, &sz); ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r); ok(!lstrcmpA(buf, "2"), "Expected \"2\", got \"%s\"\n", buf); ok(sz == 1, "Expected 1, got %lu\n", sz); @@ -7808,9 +7436,7 @@ static void test_MsiGetProductInfoEx(void) /* VersionMajor value exists */ sz = MAX_PATH; lstrcpyA(buf, "apple"); - r = pMsiGetProductInfoExA(prodcode, NULL, - MSIINSTALLCONTEXT_MACHINE, - INSTALLPROPERTY_VERSIONMAJORA, buf, &sz); + r = MsiGetProductInfoExA(prodcode, NULL, MSIINSTALLCONTEXT_MACHINE, INSTALLPROPERTY_VERSIONMAJORA, buf, &sz); ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r); ok(!lstrcmpA(buf, "3"), "Expected \"3\", got \"%s\"\n", buf); ok(sz == 1, "Expected 1, got %lu\n", sz); @@ -7821,9 +7447,7 @@ static void test_MsiGetProductInfoEx(void) /* DisplayVersion value exists */ sz = MAX_PATH; lstrcpyA(buf, "apple"); - r = pMsiGetProductInfoExA(prodcode, NULL, - MSIINSTALLCONTEXT_MACHINE, - INSTALLPROPERTY_VERSIONSTRINGA, buf, &sz); + r = MsiGetProductInfoExA(prodcode, NULL, MSIINSTALLCONTEXT_MACHINE, INSTALLPROPERTY_VERSIONSTRINGA, buf, &sz); ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r); ok(!lstrcmpA(buf, "3.2.1"), "Expected \"3.2.1\", got \"%s\"\n", buf); ok(sz == 5, "Expected 5, got %lu\n", sz); @@ -7834,9 +7458,7 @@ static void test_MsiGetProductInfoEx(void) /* ProductID value exists */ sz = MAX_PATH; lstrcpyA(buf, "apple"); - r = pMsiGetProductInfoExA(prodcode, NULL, - MSIINSTALLCONTEXT_MACHINE, - INSTALLPROPERTY_PRODUCTIDA, buf, &sz); + r = MsiGetProductInfoExA(prodcode, NULL, MSIINSTALLCONTEXT_MACHINE, INSTALLPROPERTY_PRODUCTIDA, buf, &sz); ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r); ok(!lstrcmpA(buf, "id"), "Expected \"id\", got \"%s\"\n", buf); ok(sz == 2, "Expected 2, got %lu\n", sz); @@ -7847,9 +7469,7 @@ static void test_MsiGetProductInfoEx(void) /* RegCompany value exists */ sz = MAX_PATH; lstrcpyA(buf, "apple"); - r = pMsiGetProductInfoExA(prodcode, NULL, - MSIINSTALLCONTEXT_MACHINE, - INSTALLPROPERTY_REGCOMPANYA, buf, &sz); + r = MsiGetProductInfoExA(prodcode, NULL, MSIINSTALLCONTEXT_MACHINE, INSTALLPROPERTY_REGCOMPANYA, buf, &sz); ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r); ok(!lstrcmpA(buf, "comp"), "Expected \"comp\", got \"%s\"\n", buf); ok(sz == 4, "Expected 4, got %lu\n", sz); @@ -7860,9 +7480,7 @@ static void test_MsiGetProductInfoEx(void) /* RegOwner value exists */ sz = MAX_PATH; lstrcpyA(buf, "apple"); - r = pMsiGetProductInfoExA(prodcode, NULL, - MSIINSTALLCONTEXT_MACHINE, - INSTALLPROPERTY_REGOWNERA, buf, &sz); + r = MsiGetProductInfoExA(prodcode, NULL, MSIINSTALLCONTEXT_MACHINE, INSTALLPROPERTY_REGOWNERA, buf, &sz); ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r); ok(!lstrcmpA(buf, "owner"), "Expected \"owner\", got \"%s\"\n", buf); ok(sz == 5, "Expected 5, got %lu\n", sz); @@ -7873,11 +7491,8 @@ static void test_MsiGetProductInfoEx(void) /* Transforms value exists */ sz = MAX_PATH; lstrcpyA(buf, "apple"); - r = pMsiGetProductInfoExA(prodcode, NULL, - MSIINSTALLCONTEXT_MACHINE, - INSTALLPROPERTY_TRANSFORMSA, buf, &sz); - ok(r == ERROR_UNKNOWN_PRODUCT, - "Expected ERROR_UNKNOWN_PRODUCT, got %d\n", r); + r = MsiGetProductInfoExA(prodcode, NULL, MSIINSTALLCONTEXT_MACHINE, INSTALLPROPERTY_TRANSFORMSA, buf, &sz); + ok(r == ERROR_UNKNOWN_PRODUCT, "Expected ERROR_UNKNOWN_PRODUCT, got %d\n", r); ok(!lstrcmpA(buf, "apple"), "Expected buf to be unchanged, got %s\n", buf); ok(sz == MAX_PATH, "Expected MAX_PATH, got %lu\n", sz); @@ -7887,11 +7502,8 @@ static void test_MsiGetProductInfoEx(void) /* Language value exists */ sz = MAX_PATH; lstrcpyA(buf, "apple"); - r = pMsiGetProductInfoExA(prodcode, NULL, - MSIINSTALLCONTEXT_MACHINE, - INSTALLPROPERTY_LANGUAGEA, buf, &sz); - ok(r == ERROR_UNKNOWN_PRODUCT, - "Expected ERROR_UNKNOWN_PRODUCT, got %d\n", r); + r = MsiGetProductInfoExA(prodcode, NULL, MSIINSTALLCONTEXT_MACHINE, INSTALLPROPERTY_LANGUAGEA, buf, &sz); + ok(r == ERROR_UNKNOWN_PRODUCT, "Expected ERROR_UNKNOWN_PRODUCT, got %d\n", r); ok(!lstrcmpA(buf, "apple"), "Expected buf to be unchanged, got %s\n", buf); ok(sz == MAX_PATH, "Expected MAX_PATH, got %lu\n", sz); @@ -7901,11 +7513,8 @@ static void test_MsiGetProductInfoEx(void) /* ProductName value exists */ sz = MAX_PATH; lstrcpyA(buf, "apple"); - r = pMsiGetProductInfoExA(prodcode, NULL, - MSIINSTALLCONTEXT_MACHINE, - INSTALLPROPERTY_PRODUCTNAMEA, buf, &sz); - ok(r == ERROR_UNKNOWN_PRODUCT, - "Expected ERROR_UNKNOWN_PRODUCT, got %d\n", r); + r = MsiGetProductInfoExA(prodcode, NULL, MSIINSTALLCONTEXT_MACHINE, INSTALLPROPERTY_PRODUCTNAMEA, buf, &sz); + ok(r == ERROR_UNKNOWN_PRODUCT, "Expected ERROR_UNKNOWN_PRODUCT, got %d\n", r); ok(!lstrcmpA(buf, "apple"), "Expected buf to be unchanged, got %s\n", buf); ok(sz == MAX_PATH, "Expected MAX_PATH, got %lu\n", sz); @@ -7917,11 +7526,8 @@ static void test_MsiGetProductInfoEx(void) /* AssignmentType value exists */ sz = MAX_PATH; lstrcpyA(buf, "apple"); - r = pMsiGetProductInfoExA(prodcode, NULL, - MSIINSTALLCONTEXT_MACHINE, - INSTALLPROPERTY_ASSIGNMENTTYPEA, buf, &sz); - ok(r == ERROR_UNKNOWN_PRODUCT, - "Expected ERROR_UNKNOWN_PRODUCT, got %d\n", r); + r = MsiGetProductInfoExA(prodcode, NULL, MSIINSTALLCONTEXT_MACHINE, INSTALLPROPERTY_ASSIGNMENTTYPEA, buf, &sz); + ok(r == ERROR_UNKNOWN_PRODUCT, "Expected ERROR_UNKNOWN_PRODUCT, got %d\n", r); ok(!lstrcmpA(buf, "apple"), "Expected buf to be unchanged, got %s\n", buf); ok(sz == MAX_PATH, "Expected MAX_PATH, got %lu\n", sz); @@ -7931,11 +7537,8 @@ static void test_MsiGetProductInfoEx(void) /* PackageCode value exists */ sz = MAX_PATH; lstrcpyA(buf, "apple"); - r = pMsiGetProductInfoExA(prodcode, NULL, - MSIINSTALLCONTEXT_MACHINE, - INSTALLPROPERTY_PACKAGECODEA, buf, &sz); - ok(r == ERROR_UNKNOWN_PRODUCT, - "Expected ERROR_UNKNOWN_PRODUCT, got %d\n", r); + r = MsiGetProductInfoExA(prodcode, NULL, MSIINSTALLCONTEXT_MACHINE, INSTALLPROPERTY_PACKAGECODEA, buf, &sz); + ok(r == ERROR_UNKNOWN_PRODUCT, "Expected ERROR_UNKNOWN_PRODUCT, got %d\n", r); ok(!lstrcmpA(buf, "apple"), "Expected buf to be unchanged, got %s\n", buf); ok(sz == MAX_PATH, "Expected MAX_PATH, got %lu\n", sz); @@ -7945,11 +7548,8 @@ static void test_MsiGetProductInfoEx(void) /* Version value exists */ sz = MAX_PATH; lstrcpyA(buf, "apple"); - r = pMsiGetProductInfoExA(prodcode, NULL, - MSIINSTALLCONTEXT_MACHINE, - INSTALLPROPERTY_VERSIONA, buf, &sz); - ok(r == ERROR_UNKNOWN_PRODUCT, - "Expected ERROR_UNKNOWN_PRODUCT, got %d\n", r); + r = MsiGetProductInfoExA(prodcode, NULL, MSIINSTALLCONTEXT_MACHINE, INSTALLPROPERTY_VERSIONA, buf, &sz); + ok(r == ERROR_UNKNOWN_PRODUCT, "Expected ERROR_UNKNOWN_PRODUCT, got %d\n", r); ok(!lstrcmpA(buf, "apple"), "Expected buf to be unchanged, got %s\n", buf); ok(sz == MAX_PATH, "Expected MAX_PATH, got %lu\n", sz); @@ -7959,11 +7559,8 @@ static void test_MsiGetProductInfoEx(void) /* ProductIcon value exists */ sz = MAX_PATH; lstrcpyA(buf, "apple"); - r = pMsiGetProductInfoExA(prodcode, NULL, - MSIINSTALLCONTEXT_MACHINE, - INSTALLPROPERTY_PRODUCTICONA, buf, &sz); - ok(r == ERROR_UNKNOWN_PRODUCT, - "Expected ERROR_UNKNOWN_PRODUCT, got %d\n", r); + r = MsiGetProductInfoExA(prodcode, NULL, MSIINSTALLCONTEXT_MACHINE, INSTALLPROPERTY_PRODUCTICONA, buf, &sz); + ok(r == ERROR_UNKNOWN_PRODUCT, "Expected ERROR_UNKNOWN_PRODUCT, got %d\n", r); ok(!lstrcmpA(buf, "apple"), "Expected buf to be unchanged, got %s\n", buf); ok(sz == MAX_PATH, "Expected MAX_PATH, got %lu\n", sz); @@ -7973,11 +7570,8 @@ static void test_MsiGetProductInfoEx(void) /* PackageName value exists */ sz = MAX_PATH; lstrcpyA(buf, "apple"); - r = pMsiGetProductInfoExA(prodcode, NULL, - MSIINSTALLCONTEXT_MACHINE, - INSTALLPROPERTY_PACKAGENAMEA, buf, &sz); - ok(r == ERROR_UNKNOWN_PRODUCT, - "Expected ERROR_UNKNOWN_PRODUCT, got %d\n", r); + r = MsiGetProductInfoExA(prodcode, NULL, MSIINSTALLCONTEXT_MACHINE, INSTALLPROPERTY_PACKAGENAMEA, buf, &sz); + ok(r == ERROR_UNKNOWN_PRODUCT, "Expected ERROR_UNKNOWN_PRODUCT, got %d\n", r); ok(!lstrcmpA(buf, "apple"), "Expected buf to be unchanged, got %s\n", buf); ok(sz == MAX_PATH, "Expected MAX_PATH, got %lu\n", sz); @@ -7987,11 +7581,8 @@ static void test_MsiGetProductInfoEx(void) /* AuthorizedLUAApp value exists */ sz = MAX_PATH; lstrcpyA(buf, "apple"); - r = pMsiGetProductInfoExA(prodcode, NULL, - MSIINSTALLCONTEXT_MACHINE, - INSTALLPROPERTY_AUTHORIZED_LUA_APPA, buf, &sz); - ok(r == ERROR_UNKNOWN_PRODUCT, - "Expected ERROR_UNKNOWN_PRODUCT, got %d\n", r); + r = MsiGetProductInfoExA(prodcode, NULL, MSIINSTALLCONTEXT_MACHINE, INSTALLPROPERTY_AUTHORIZED_LUA_APPA, buf, &sz); + ok(r == ERROR_UNKNOWN_PRODUCT, "Expected ERROR_UNKNOWN_PRODUCT, got %d\n", r); ok(!lstrcmpA(buf, "apple"), "Expected buf to be unchanged, got %s\n", buf); ok(sz == MAX_PATH, "Expected MAX_PATH, got %lu\n", sz); @@ -8021,9 +7612,9 @@ static void test_MsiGetProductInfoEx(void) RegDeleteValueA(propkey, "HelpTelephone"); RegDeleteValueA(propkey, "HelpLink"); RegDeleteValueA(propkey, "LocalPackage"); - delete_key(propkey, "", access & KEY_WOW64_64KEY); + RegDeleteKeyExA(propkey, "", access & KEY_WOW64_64KEY, 0); RegCloseKey(propkey); - delete_key(localkey, "", access & KEY_WOW64_64KEY); + RegDeleteKeyExA(localkey, "", access & KEY_WOW64_64KEY, 0); RegCloseKey(localkey); lstrcpyA(keypath, "Software\\Classes\\Installer\\Products\\"); @@ -8041,9 +7632,7 @@ static void test_MsiGetProductInfoEx(void) /* local classes product key exists */ sz = MAX_PATH; lstrcpyA(buf, "apple"); - r = pMsiGetProductInfoExA(prodcode, NULL, - MSIINSTALLCONTEXT_MACHINE, - INSTALLPROPERTY_PRODUCTSTATEA, buf, &sz); + r = MsiGetProductInfoExA(prodcode, NULL, MSIINSTALLCONTEXT_MACHINE, INSTALLPROPERTY_PRODUCTSTATEA, buf, &sz); ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r); ok(!lstrcmpA(buf, "1"), "Expected \"1\", got \"%s\"\n", buf); ok(sz == 1, "Expected 1, got %lu\n", sz); @@ -8054,11 +7643,8 @@ static void test_MsiGetProductInfoEx(void) /* HelpLink value exists */ sz = MAX_PATH; lstrcpyA(buf, "apple"); - r = pMsiGetProductInfoExA(prodcode, NULL, - MSIINSTALLCONTEXT_MACHINE, - INSTALLPROPERTY_HELPLINKA, buf, &sz); - ok(r == ERROR_UNKNOWN_PROPERTY, - "Expected ERROR_UNKNOWN_PROPERTY, got %d\n", r); + r = MsiGetProductInfoExA(prodcode, NULL, MSIINSTALLCONTEXT_MACHINE, INSTALLPROPERTY_HELPLINKA, buf, &sz); + ok(r == ERROR_UNKNOWN_PROPERTY, "Expected ERROR_UNKNOWN_PROPERTY, got %d\n", r); ok(!lstrcmpA(buf, "apple"), "Expected buf to be unchanged, got %s\n", buf); ok(sz == MAX_PATH, "Expected MAX_PATH, got %lu\n", sz); @@ -8068,11 +7654,8 @@ static void test_MsiGetProductInfoEx(void) /* HelpTelephone value exists */ sz = MAX_PATH; lstrcpyA(buf, "apple"); - r = pMsiGetProductInfoExA(prodcode, NULL, - MSIINSTALLCONTEXT_MACHINE, - INSTALLPROPERTY_HELPTELEPHONEA, buf, &sz); - ok(r == ERROR_UNKNOWN_PROPERTY, - "Expected ERROR_UNKNOWN_PROPERTY, got %d\n", r); + r = MsiGetProductInfoExA(prodcode, NULL, MSIINSTALLCONTEXT_MACHINE, INSTALLPROPERTY_HELPTELEPHONEA, buf, &sz); + ok(r == ERROR_UNKNOWN_PROPERTY, "Expected ERROR_UNKNOWN_PROPERTY, got %d\n", r); ok(!lstrcmpA(buf, "apple"), "Expected buf to be unchanged, got %s\n", buf); ok(sz == MAX_PATH, "Expected MAX_PATH, got %lu\n", sz); @@ -8082,11 +7665,8 @@ static void test_MsiGetProductInfoEx(void) /* InstallDate value exists */ sz = MAX_PATH; lstrcpyA(buf, "apple"); - r = pMsiGetProductInfoExA(prodcode, NULL, - MSIINSTALLCONTEXT_MACHINE, - INSTALLPROPERTY_INSTALLDATEA, buf, &sz); - ok(r == ERROR_UNKNOWN_PROPERTY, - "Expected ERROR_UNKNOWN_PROPERTY, got %d\n", r); + r = MsiGetProductInfoExA(prodcode, NULL, MSIINSTALLCONTEXT_MACHINE, INSTALLPROPERTY_INSTALLDATEA, buf, &sz); + ok(r == ERROR_UNKNOWN_PROPERTY, "Expected ERROR_UNKNOWN_PROPERTY, got %d\n", r); ok(!lstrcmpA(buf, "apple"), "Expected buf to be unchanged, got %s\n", buf); ok(sz == MAX_PATH, "Expected MAX_PATH, got %lu\n", sz); @@ -8096,11 +7676,9 @@ static void test_MsiGetProductInfoEx(void) /* DisplayName value exists */ sz = MAX_PATH; lstrcpyA(buf, "apple"); - r = pMsiGetProductInfoExA(prodcode, NULL, - MSIINSTALLCONTEXT_MACHINE, - INSTALLPROPERTY_INSTALLEDPRODUCTNAMEA, buf, &sz); - ok(r == ERROR_UNKNOWN_PROPERTY, - "Expected ERROR_UNKNOWN_PROPERTY, got %d\n", r); + r = MsiGetProductInfoExA(prodcode, NULL, MSIINSTALLCONTEXT_MACHINE, INSTALLPROPERTY_INSTALLEDPRODUCTNAMEA, + buf, &sz); + ok(r == ERROR_UNKNOWN_PROPERTY, "Expected ERROR_UNKNOWN_PROPERTY, got %d\n", r); ok(!lstrcmpA(buf, "apple"), "Expected buf to be unchanged, got %s\n", buf); ok(sz == MAX_PATH, "Expected MAX_PATH, got %lu\n", sz); @@ -8110,11 +7688,8 @@ static void test_MsiGetProductInfoEx(void) /* InstallLocation value exists */ sz = MAX_PATH; lstrcpyA(buf, "apple"); - r = pMsiGetProductInfoExA(prodcode, NULL, - MSIINSTALLCONTEXT_MACHINE, - INSTALLPROPERTY_INSTALLLOCATIONA, buf, &sz); - ok(r == ERROR_UNKNOWN_PROPERTY, - "Expected ERROR_UNKNOWN_PROPERTY, got %d\n", r); + r = MsiGetProductInfoExA(prodcode, NULL, MSIINSTALLCONTEXT_MACHINE, INSTALLPROPERTY_INSTALLLOCATIONA, buf, &sz); + ok(r == ERROR_UNKNOWN_PROPERTY, "Expected ERROR_UNKNOWN_PROPERTY, got %d\n", r); ok(!lstrcmpA(buf, "apple"), "Expected buf to be unchanged, got %s\n", buf); ok(sz == MAX_PATH, "Expected MAX_PATH, got %lu\n", sz); @@ -8124,11 +7699,8 @@ static void test_MsiGetProductInfoEx(void) /* InstallSource value exists */ sz = MAX_PATH; lstrcpyA(buf, "apple"); - r = pMsiGetProductInfoExA(prodcode, NULL, - MSIINSTALLCONTEXT_MACHINE, - INSTALLPROPERTY_INSTALLSOURCEA, buf, &sz); - ok(r == ERROR_UNKNOWN_PROPERTY, - "Expected ERROR_UNKNOWN_PROPERTY, got %d\n", r); + r = MsiGetProductInfoExA(prodcode, NULL, MSIINSTALLCONTEXT_MACHINE, INSTALLPROPERTY_INSTALLSOURCEA, buf, &sz); + ok(r == ERROR_UNKNOWN_PROPERTY, "Expected ERROR_UNKNOWN_PROPERTY, got %d\n", r); ok(!lstrcmpA(buf, "apple"), "Expected buf to be unchanged, got %s\n", buf); ok(sz == MAX_PATH, "Expected MAX_PATH, got %lu\n", sz); @@ -8138,11 +7710,8 @@ static void test_MsiGetProductInfoEx(void) /* LocalPackage value exists */ sz = MAX_PATH; lstrcpyA(buf, "apple"); - r = pMsiGetProductInfoExA(prodcode, NULL, - MSIINSTALLCONTEXT_MACHINE, - INSTALLPROPERTY_LOCALPACKAGEA, buf, &sz); - ok(r == ERROR_UNKNOWN_PROPERTY, - "Expected ERROR_UNKNOWN_PROPERTY, got %d\n", r); + r = MsiGetProductInfoExA(prodcode, NULL, MSIINSTALLCONTEXT_MACHINE, INSTALLPROPERTY_LOCALPACKAGEA, buf, &sz); + ok(r == ERROR_UNKNOWN_PROPERTY, "Expected ERROR_UNKNOWN_PROPERTY, got %d\n", r); ok(!lstrcmpA(buf, "apple"), "Expected buf to be unchanged, got %s\n", buf); ok(sz == MAX_PATH, "Expected MAX_PATH, got %lu\n", sz); @@ -8152,11 +7721,8 @@ static void test_MsiGetProductInfoEx(void) /* Publisher value exists */ sz = MAX_PATH; lstrcpyA(buf, "apple"); - r = pMsiGetProductInfoExA(prodcode, NULL, - MSIINSTALLCONTEXT_MACHINE, - INSTALLPROPERTY_PUBLISHERA, buf, &sz); - ok(r == ERROR_UNKNOWN_PROPERTY, - "Expected ERROR_UNKNOWN_PROPERTY, got %d\n", r); + r = MsiGetProductInfoExA(prodcode, NULL, MSIINSTALLCONTEXT_MACHINE, INSTALLPROPERTY_PUBLISHERA, buf, &sz); + ok(r == ERROR_UNKNOWN_PROPERTY, "Expected ERROR_UNKNOWN_PROPERTY, got %d\n", r); ok(!lstrcmpA(buf, "apple"), "Expected buf to be unchanged, got %s\n", buf); ok(sz == MAX_PATH, "Expected MAX_PATH, got %lu\n", sz); @@ -8166,11 +7732,8 @@ static void test_MsiGetProductInfoEx(void) /* URLInfoAbout value exists */ sz = MAX_PATH; lstrcpyA(buf, "apple"); - r = pMsiGetProductInfoExA(prodcode, NULL, - MSIINSTALLCONTEXT_MACHINE, - INSTALLPROPERTY_URLINFOABOUTA, buf, &sz); - ok(r == ERROR_UNKNOWN_PROPERTY, - "Expected ERROR_UNKNOWN_PROPERTY, got %d\n", r); + r = MsiGetProductInfoExA(prodcode, NULL, MSIINSTALLCONTEXT_MACHINE, INSTALLPROPERTY_URLINFOABOUTA, buf, &sz); + ok(r == ERROR_UNKNOWN_PROPERTY, "Expected ERROR_UNKNOWN_PROPERTY, got %d\n", r); ok(!lstrcmpA(buf, "apple"), "Expected buf to be unchanged, got %s\n", buf); ok(sz == MAX_PATH, "Expected MAX_PATH, got %lu\n", sz); @@ -8180,11 +7743,8 @@ static void test_MsiGetProductInfoEx(void) /* URLUpdateInfo value exists */ sz = MAX_PATH; lstrcpyA(buf, "apple"); - r = pMsiGetProductInfoExA(prodcode, NULL, - MSIINSTALLCONTEXT_MACHINE, - INSTALLPROPERTY_URLUPDATEINFOA, buf, &sz); - ok(r == ERROR_UNKNOWN_PROPERTY, - "Expected ERROR_UNKNOWN_PROPERTY, got %d\n", r); + r = MsiGetProductInfoExA(prodcode, NULL, MSIINSTALLCONTEXT_MACHINE, INSTALLPROPERTY_URLUPDATEINFOA, buf, &sz); + ok(r == ERROR_UNKNOWN_PROPERTY, "Expected ERROR_UNKNOWN_PROPERTY, got %d\n", r); ok(!lstrcmpA(buf, "apple"), "Expected buf to be unchanged, got %s\n", buf); ok(sz == MAX_PATH, "Expected MAX_PATH, got %lu\n", sz); @@ -8194,11 +7754,8 @@ static void test_MsiGetProductInfoEx(void) /* VersionMinor value exists */ sz = MAX_PATH; lstrcpyA(buf, "apple"); - r = pMsiGetProductInfoExA(prodcode, NULL, - MSIINSTALLCONTEXT_MACHINE, - INSTALLPROPERTY_VERSIONMINORA, buf, &sz); - ok(r == ERROR_UNKNOWN_PROPERTY, - "Expected ERROR_UNKNOWN_PROPERTY, got %d\n", r); + r = MsiGetProductInfoExA(prodcode, NULL, MSIINSTALLCONTEXT_MACHINE, INSTALLPROPERTY_VERSIONMINORA, buf, &sz); + ok(r == ERROR_UNKNOWN_PROPERTY, "Expected ERROR_UNKNOWN_PROPERTY, got %d\n", r); ok(!lstrcmpA(buf, "apple"), "Expected buf to be unchanged, got %s\n", buf); ok(sz == MAX_PATH, "Expected MAX_PATH, got %lu\n", sz); @@ -8208,11 +7765,8 @@ static void test_MsiGetProductInfoEx(void) /* VersionMajor value exists */ sz = MAX_PATH; lstrcpyA(buf, "apple"); - r = pMsiGetProductInfoExA(prodcode, NULL, - MSIINSTALLCONTEXT_MACHINE, - INSTALLPROPERTY_VERSIONMAJORA, buf, &sz); - ok(r == ERROR_UNKNOWN_PROPERTY, - "Expected ERROR_UNKNOWN_PROPERTY, got %d\n", r); + r = MsiGetProductInfoExA(prodcode, NULL, MSIINSTALLCONTEXT_MACHINE, INSTALLPROPERTY_VERSIONMAJORA, buf, &sz); + ok(r == ERROR_UNKNOWN_PROPERTY, "Expected ERROR_UNKNOWN_PROPERTY, got %d\n", r); ok(!lstrcmpA(buf, "apple"), "Expected buf to be unchanged, got %s\n", buf); ok(sz == MAX_PATH, "Expected MAX_PATH, got %lu\n", sz); @@ -8222,11 +7776,8 @@ static void test_MsiGetProductInfoEx(void) /* DisplayVersion value exists */ sz = MAX_PATH; lstrcpyA(buf, "apple"); - r = pMsiGetProductInfoExA(prodcode, NULL, - MSIINSTALLCONTEXT_MACHINE, - INSTALLPROPERTY_VERSIONSTRINGA, buf, &sz); - ok(r == ERROR_UNKNOWN_PROPERTY, - "Expected ERROR_UNKNOWN_PROPERTY, got %d\n", r); + r = MsiGetProductInfoExA(prodcode, NULL, MSIINSTALLCONTEXT_MACHINE, INSTALLPROPERTY_VERSIONSTRINGA, buf, &sz); + ok(r == ERROR_UNKNOWN_PROPERTY, "Expected ERROR_UNKNOWN_PROPERTY, got %d\n", r); ok(!lstrcmpA(buf, "apple"), "Expected buf to be unchanged, got %s\n", buf); ok(sz == MAX_PATH, "Expected MAX_PATH, got %lu\n", sz); @@ -8236,11 +7787,8 @@ static void test_MsiGetProductInfoEx(void) /* ProductID value exists */ sz = MAX_PATH; lstrcpyA(buf, "apple"); - r = pMsiGetProductInfoExA(prodcode, NULL, - MSIINSTALLCONTEXT_MACHINE, - INSTALLPROPERTY_PRODUCTIDA, buf, &sz); - ok(r == ERROR_UNKNOWN_PROPERTY, - "Expected ERROR_UNKNOWN_PROPERTY, got %d\n", r); + r = MsiGetProductInfoExA(prodcode, NULL, MSIINSTALLCONTEXT_MACHINE, INSTALLPROPERTY_PRODUCTIDA, buf, &sz); + ok(r == ERROR_UNKNOWN_PROPERTY, "Expected ERROR_UNKNOWN_PROPERTY, got %d\n", r); ok(!lstrcmpA(buf, "apple"), "Expected buf to be unchanged, got %s\n", buf); ok(sz == MAX_PATH, "Expected MAX_PATH, got %lu\n", sz); @@ -8250,11 +7798,8 @@ static void test_MsiGetProductInfoEx(void) /* RegCompany value exists */ sz = MAX_PATH; lstrcpyA(buf, "apple"); - r = pMsiGetProductInfoExA(prodcode, NULL, - MSIINSTALLCONTEXT_MACHINE, - INSTALLPROPERTY_REGCOMPANYA, buf, &sz); - ok(r == ERROR_UNKNOWN_PROPERTY, - "Expected ERROR_UNKNOWN_PROPERTY, got %d\n", r); + r = MsiGetProductInfoExA(prodcode, NULL, MSIINSTALLCONTEXT_MACHINE, INSTALLPROPERTY_REGCOMPANYA, buf, &sz); + ok(r == ERROR_UNKNOWN_PROPERTY, "Expected ERROR_UNKNOWN_PROPERTY, got %d\n", r); ok(!lstrcmpA(buf, "apple"), "Expected buf to be unchanged, got %s\n", buf); ok(sz == MAX_PATH, "Expected MAX_PATH, got %lu\n", sz); @@ -8264,11 +7809,8 @@ static void test_MsiGetProductInfoEx(void) /* RegOwner value exists */ sz = MAX_PATH; lstrcpyA(buf, "apple"); - r = pMsiGetProductInfoExA(prodcode, NULL, - MSIINSTALLCONTEXT_MACHINE, - INSTALLPROPERTY_REGOWNERA, buf, &sz); - ok(r == ERROR_UNKNOWN_PROPERTY, - "Expected ERROR_UNKNOWN_PROPERTY, got %d\n", r); + r = MsiGetProductInfoExA(prodcode, NULL, MSIINSTALLCONTEXT_MACHINE, INSTALLPROPERTY_REGOWNERA, buf, &sz); + ok(r == ERROR_UNKNOWN_PROPERTY, "Expected ERROR_UNKNOWN_PROPERTY, got %d\n", r); ok(!lstrcmpA(buf, "apple"), "Expected buf to be unchanged, got %s\n", buf); ok(sz == MAX_PATH, "Expected MAX_PATH, got %lu\n", sz); @@ -8278,9 +7820,7 @@ static void test_MsiGetProductInfoEx(void) /* Transforms value exists */ sz = MAX_PATH; lstrcpyA(buf, "apple"); - r = pMsiGetProductInfoExA(prodcode, NULL, - MSIINSTALLCONTEXT_MACHINE, - INSTALLPROPERTY_TRANSFORMSA, buf, &sz); + r = MsiGetProductInfoExA(prodcode, NULL, MSIINSTALLCONTEXT_MACHINE, INSTALLPROPERTY_TRANSFORMSA, buf, &sz); ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r); ok(!lstrcmpA(buf, "trans"), "Expected \"trans\", got \"%s\"\n", buf); ok(sz == 5, "Expected 5, got %lu\n", sz); @@ -8291,9 +7831,7 @@ static void test_MsiGetProductInfoEx(void) /* Language value exists */ sz = MAX_PATH; lstrcpyA(buf, "apple"); - r = pMsiGetProductInfoExA(prodcode, NULL, - MSIINSTALLCONTEXT_MACHINE, - INSTALLPROPERTY_LANGUAGEA, buf, &sz); + r = MsiGetProductInfoExA(prodcode, NULL, MSIINSTALLCONTEXT_MACHINE, INSTALLPROPERTY_LANGUAGEA, buf, &sz); ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r); ok(!lstrcmpA(buf, "lang"), "Expected \"lang\", got \"%s\"\n", buf); ok(sz == 4, "Expected 4, got %lu\n", sz); @@ -8304,9 +7842,7 @@ static void test_MsiGetProductInfoEx(void) /* ProductName value exists */ sz = MAX_PATH; lstrcpyA(buf, "apple"); - r = pMsiGetProductInfoExA(prodcode, NULL, - MSIINSTALLCONTEXT_MACHINE, - INSTALLPROPERTY_PRODUCTNAMEA, buf, &sz); + r = MsiGetProductInfoExA(prodcode, NULL, MSIINSTALLCONTEXT_MACHINE, INSTALLPROPERTY_PRODUCTNAMEA, buf, &sz); ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r); ok(!lstrcmpA(buf, "name"), "Expected \"name\", got \"%s\"\n", buf); ok(sz == 4, "Expected 4, got %lu\n", sz); @@ -8319,9 +7855,7 @@ static void test_MsiGetProductInfoEx(void) /* AssignmentType value exists */ sz = MAX_PATH; lstrcpyA(buf, "apple"); - r = pMsiGetProductInfoExA(prodcode, NULL, - MSIINSTALLCONTEXT_MACHINE, - INSTALLPROPERTY_ASSIGNMENTTYPEA, buf, &sz); + r = MsiGetProductInfoExA(prodcode, NULL, MSIINSTALLCONTEXT_MACHINE, INSTALLPROPERTY_ASSIGNMENTTYPEA, buf, &sz); ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r); ok(!lstrcmpA(buf, ""), "Expected \"\", got \"%s\"\n", buf); ok(sz == 0, "Expected 0, got %lu\n", sz); @@ -8334,13 +7868,10 @@ static void test_MsiGetProductInfoEx(void) /* PackageCode value exists */ sz = MAX_PATH; lstrcpyA(buf, "apple"); - r = pMsiGetProductInfoExA(prodcode, NULL, - MSIINSTALLCONTEXT_MACHINE, - INSTALLPROPERTY_PACKAGECODEA, buf, &sz); + r = MsiGetProductInfoExA(prodcode, NULL, MSIINSTALLCONTEXT_MACHINE, INSTALLPROPERTY_PACKAGECODEA, buf, &sz); todo_wine { - ok(r == ERROR_BAD_CONFIGURATION, - "Expected ERROR_BAD_CONFIGURATION, got %d\n", r); + ok(r == ERROR_BAD_CONFIGURATION, "Expected ERROR_BAD_CONFIGURATION, got %d\n", r); ok(!lstrcmpA(buf, "apple"), "Expected buf to be unchanged, got %s\n", buf); ok(sz == MAX_PATH, "Expected MAX_PATH, got %lu\n", sz); } @@ -8351,9 +7882,7 @@ static void test_MsiGetProductInfoEx(void) /* Version value exists */ sz = MAX_PATH; lstrcpyA(buf, "apple"); - r = pMsiGetProductInfoExA(prodcode, NULL, - MSIINSTALLCONTEXT_MACHINE, - INSTALLPROPERTY_VERSIONA, buf, &sz); + r = MsiGetProductInfoExA(prodcode, NULL, MSIINSTALLCONTEXT_MACHINE, INSTALLPROPERTY_VERSIONA, buf, &sz); ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r); ok(!lstrcmpA(buf, "ver"), "Expected \"ver\", got \"%s\"\n", buf); ok(sz == 3, "Expected 3, got %lu\n", sz); @@ -8364,9 +7893,7 @@ static void test_MsiGetProductInfoEx(void) /* ProductIcon value exists */ sz = MAX_PATH; lstrcpyA(buf, "apple"); - r = pMsiGetProductInfoExA(prodcode, NULL, - MSIINSTALLCONTEXT_MACHINE, - INSTALLPROPERTY_PRODUCTICONA, buf, &sz); + r = MsiGetProductInfoExA(prodcode, NULL, MSIINSTALLCONTEXT_MACHINE, INSTALLPROPERTY_PRODUCTICONA, buf, &sz); ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r); ok(!lstrcmpA(buf, "icon"), "Expected \"icon\", got \"%s\"\n", buf); ok(sz == 4, "Expected 4, got %lu\n", sz); @@ -8377,13 +7904,10 @@ static void test_MsiGetProductInfoEx(void) /* PackageName value exists */ sz = MAX_PATH; lstrcpyA(buf, "apple"); - r = pMsiGetProductInfoExA(prodcode, NULL, - MSIINSTALLCONTEXT_MACHINE, - INSTALLPROPERTY_PACKAGENAMEA, buf, &sz); + r = MsiGetProductInfoExA(prodcode, NULL, MSIINSTALLCONTEXT_MACHINE, INSTALLPROPERTY_PACKAGENAMEA, buf, &sz); todo_wine { - ok(r == ERROR_UNKNOWN_PRODUCT, - "Expected ERROR_UNKNOWN_PRODUCT, got %d\n", r); + ok(r == ERROR_UNKNOWN_PRODUCT, "Expected ERROR_UNKNOWN_PRODUCT, got %d\n", r); ok(!lstrcmpA(buf, "apple"), "Expected buf to be unchanged, got %s\n", buf); ok(sz == MAX_PATH, "Expected MAX_PATH, got %lu\n", sz); } @@ -8394,9 +7918,8 @@ static void test_MsiGetProductInfoEx(void) /* AuthorizedLUAApp value exists */ sz = MAX_PATH; lstrcpyA(buf, "apple"); - r = pMsiGetProductInfoExA(prodcode, NULL, - MSIINSTALLCONTEXT_MACHINE, - INSTALLPROPERTY_AUTHORIZED_LUA_APPA, buf, &sz); + r = MsiGetProductInfoExA(prodcode, NULL, MSIINSTALLCONTEXT_MACHINE, INSTALLPROPERTY_AUTHORIZED_LUA_APPA, + buf, &sz); ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r); ok(!lstrcmpA(buf, "auth"), "Expected \"auth\", got \"%s\"\n", buf); ok(sz == 4, "Expected 4, got %lu\n", sz); @@ -8426,7 +7949,7 @@ static void test_MsiGetProductInfoEx(void) RegDeleteValueA(prodkey, "InstallDate"); RegDeleteValueA(prodkey, "HelpTelephone"); RegDeleteValueA(prodkey, "HelpLink"); - delete_key(prodkey, "", access & KEY_WOW64_64KEY); + RegDeleteKeyExA(prodkey, "", access & KEY_WOW64_64KEY, 0); RegCloseKey(prodkey); LocalFree(usersid); } @@ -8783,11 +8306,11 @@ static void test_MsiGetUserInfo(void) RegDeleteValueA(props, "ProductID"); RegDeleteValueA(props, "RegCompany"); RegDeleteValueA(props, "RegOwner"); - delete_key(props, "", access & KEY_WOW64_64KEY); + RegDeleteKeyExA(props, "", access & KEY_WOW64_64KEY, 0); RegCloseKey(props); - delete_key(userprod, "", access & KEY_WOW64_64KEY); + RegDeleteKeyExA(userprod, "", access & KEY_WOW64_64KEY, 0); RegCloseKey(userprod); - delete_key(prodkey, "", access & KEY_WOW64_64KEY); + RegDeleteKeyExA(prodkey, "", access & KEY_WOW64_64KEY, 0); RegCloseKey(prodkey); /* MSIINSTALLCONTEXT_USERUNMANAGED */ @@ -8901,9 +8424,9 @@ static void test_MsiGetUserInfo(void) RegDeleteValueA(props, "ProductID"); RegDeleteValueA(props, "RegCompany"); RegDeleteValueA(props, "RegOwner"); - delete_key(props, "", access & KEY_WOW64_64KEY); + RegDeleteKeyExA(props, "", access & KEY_WOW64_64KEY, 0); RegCloseKey(props); - delete_key(userprod, "", access & KEY_WOW64_64KEY); + RegDeleteKeyExA(userprod, "", access & KEY_WOW64_64KEY, 0); RegCloseKey(userprod); RegDeleteKeyA(prodkey, ""); RegCloseKey(prodkey); @@ -9024,11 +8547,11 @@ static void test_MsiGetUserInfo(void) RegDeleteValueA(props, "ProductID"); RegDeleteValueA(props, "RegCompany"); RegDeleteValueA(props, "RegOwner"); - delete_key(props, "", access & KEY_WOW64_64KEY); + RegDeleteKeyExA(props, "", access & KEY_WOW64_64KEY, 0); RegCloseKey(props); - delete_key(userprod, "", access & KEY_WOW64_64KEY); + RegDeleteKeyExA(userprod, "", access & KEY_WOW64_64KEY, 0); RegCloseKey(userprod); - delete_key(prodkey, "", access & KEY_WOW64_64KEY); + RegDeleteKeyExA(prodkey, "", access & KEY_WOW64_64KEY, 0); RegCloseKey(prodkey); LocalFree(usersid); } @@ -9188,11 +8711,11 @@ static void test_MsiOpenProduct(void) MsiCloseHandle(hprod); RegDeleteValueA(props, "ManagedLocalPackage"); - delete_key(props, "", access & KEY_WOW64_64KEY); + RegDeleteKeyExA(props, "", access & KEY_WOW64_64KEY, 0); RegCloseKey(props); - delete_key(userkey, "", access & KEY_WOW64_64KEY); + RegDeleteKeyExA(userkey, "", access & KEY_WOW64_64KEY, 0); RegCloseKey(userkey); - delete_key(prodkey, "", access & KEY_WOW64_64KEY); + RegDeleteKeyExA(prodkey, "", access & KEY_WOW64_64KEY, 0); RegCloseKey(prodkey); /* MSIINSTALLCONTEXT_USERUNMANAGED */ @@ -9257,9 +8780,9 @@ static void test_MsiOpenProduct(void) MsiCloseHandle(hprod); RegDeleteValueA(props, "LocalPackage"); - delete_key(props, "", access & KEY_WOW64_64KEY); + RegDeleteKeyExA(props, "", access & KEY_WOW64_64KEY, 0); RegCloseKey(props); - delete_key(userkey, "", access & KEY_WOW64_64KEY); + RegDeleteKeyExA(userkey, "", access & KEY_WOW64_64KEY, 0); RegCloseKey(userkey); RegDeleteKeyA(prodkey, ""); RegCloseKey(prodkey); @@ -9349,11 +8872,11 @@ static void test_MsiOpenProduct(void) ok(hprod == 0xdeadbeef, "Expected hprod to be unchanged\n"); RegDeleteValueA(props, "LocalPackage"); - delete_key(props, "", access & KEY_WOW64_64KEY); + RegDeleteKeyExA(props, "", access & KEY_WOW64_64KEY, 0); RegCloseKey(props); - delete_key(userkey, "", access & KEY_WOW64_64KEY); + RegDeleteKeyExA(userkey, "", access & KEY_WOW64_64KEY, 0); RegCloseKey(userkey); - delete_key(prodkey, "", access & KEY_WOW64_64KEY); + RegDeleteKeyExA(prodkey, "", access & KEY_WOW64_64KEY, 0); RegCloseKey(prodkey); DeleteFileA(msifile); @@ -9386,23 +8909,19 @@ static void test_MsiEnumPatchesEx_usermanaged(LPCSTR usersid, LPCSTR expectedsid context = 0xdeadbeef; lstrcpyA(targetsid, "kiwi"); size = MAX_PATH; - r = pMsiEnumPatchesExA(prodcode, usersid, MSIINSTALLCONTEXT_USERMANAGED, - MSIPATCHSTATE_APPLIED, 0, patchcode, targetprod, - &context, targetsid, &size); + r = MsiEnumPatchesExA(prodcode, usersid, MSIINSTALLCONTEXT_USERMANAGED, + MSIPATCHSTATE_APPLIED, 0, patchcode, targetprod, + &context, targetsid, &size); if (r == ERROR_ACCESS_DENIED) { skip("Not enough rights to perform tests\n"); return; } ok(r == ERROR_NO_MORE_ITEMS, "Expected ERROR_NO_MORE_ITEMS, got %d\n", r); - ok(!lstrcmpA(patchcode, "apple"), - "Expected patchcode to be unchanged, got %s\n", patchcode); - ok(!lstrcmpA(targetprod, "banana"), - "Expected targetprod to be unchanged, got %s\n", targetprod); - ok(context == 0xdeadbeef, - "Expected context to be unchanged, got %d\n", context); - ok(!lstrcmpA(targetsid, "kiwi"), - "Expected targetsid to be unchanged, got %s\n", targetsid); + ok(!lstrcmpA(patchcode, "apple"), "Expected patchcode to be unchanged, got %s\n", patchcode); + ok(!lstrcmpA(targetprod, "banana"), "Expected targetprod to be unchanged, got %s\n", targetprod); + ok(context == 0xdeadbeef, "Expected context to be unchanged, got %d\n", context); + ok(!lstrcmpA(targetsid, "kiwi"), "Expected targetsid to be unchanged, got %s\n", targetsid); ok(size == MAX_PATH, "Expected size to be unchanged, got %lu\n", size); lstrcpyA(keypath, "Software\\Microsoft\\Windows\\CurrentVersion\\Installer\\Managed\\"); @@ -9424,18 +8943,13 @@ static void test_MsiEnumPatchesEx_usermanaged(LPCSTR usersid, LPCSTR expectedsid context = 0xdeadbeef; lstrcpyA(targetsid, "kiwi"); size = MAX_PATH; - r = pMsiEnumPatchesExA(prodcode, usersid, MSIINSTALLCONTEXT_USERMANAGED, - MSIPATCHSTATE_APPLIED, 0, patchcode, targetprod, - &context, targetsid, &size); + r = MsiEnumPatchesExA(prodcode, usersid, MSIINSTALLCONTEXT_USERMANAGED, MSIPATCHSTATE_APPLIED, + 0, patchcode, targetprod, &context, targetsid, &size); ok(r == ERROR_NO_MORE_ITEMS, "Expected ERROR_NO_MORE_ITEMS, got %d\n", r); - ok(!lstrcmpA(patchcode, "apple"), - "Expected patchcode to be unchanged, got %s\n", patchcode); - ok(!lstrcmpA(targetprod, "banana"), - "Expected targetprod to be unchanged, got %s\n", targetprod); - ok(context == 0xdeadbeef, - "Expected context to be unchanged, got %d\n", context); - ok(!lstrcmpA(targetsid, "kiwi"), - "Expected targetsid to be unchanged, got %s\n", targetsid); + ok(!lstrcmpA(patchcode, "apple"), "Expected patchcode to be unchanged, got %s\n", patchcode); + ok(!lstrcmpA(targetprod, "banana"), "Expected targetprod to be unchanged, got %s\n", targetprod); + ok(context == 0xdeadbeef, "Expected context to be unchanged, got %d\n", context); + ok(!lstrcmpA(targetsid, "kiwi"), "Expected targetsid to be unchanged, got %s\n", targetsid); ok(size == MAX_PATH, "Expected size to be unchanged, got %lu\n", size); res = RegCreateKeyExA(prodkey, "Patches", 0, NULL, 0, access, NULL, &patches, NULL); @@ -9447,18 +8961,13 @@ static void test_MsiEnumPatchesEx_usermanaged(LPCSTR usersid, LPCSTR expectedsid context = 0xdeadbeef; lstrcpyA(targetsid, "kiwi"); size = MAX_PATH; - r = pMsiEnumPatchesExA(prodcode, usersid, MSIINSTALLCONTEXT_USERMANAGED, - MSIPATCHSTATE_APPLIED, 0, patchcode, targetprod, - &context, targetsid, &size); + r = MsiEnumPatchesExA(prodcode, usersid, MSIINSTALLCONTEXT_USERMANAGED, MSIPATCHSTATE_APPLIED, + 0, patchcode, targetprod, &context, targetsid, &size); ok(r == ERROR_NO_MORE_ITEMS, "Expected ERROR_NO_MORE_ITEMS, got %d\n", r); - ok(!lstrcmpA(patchcode, "apple"), - "Expected patchcode to be unchanged, got %s\n", patchcode); - ok(!lstrcmpA(targetprod, "banana"), - "Expected targetprod to be unchanged, got %s\n", targetprod); - ok(context == 0xdeadbeef, - "Expected context to be unchanged, got %d\n", context); - ok(!lstrcmpA(targetsid, "kiwi"), - "Expected targetsid to be unchanged, got %s\n", targetsid); + ok(!lstrcmpA(patchcode, "apple"), "Expected patchcode to be unchanged, got %s\n", patchcode); + ok(!lstrcmpA(targetprod, "banana"), "Expected targetprod to be unchanged, got %s\n", targetprod); + ok(context == 0xdeadbeef, "Expected context to be unchanged, got %d\n", context); + ok(!lstrcmpA(targetsid, "kiwi"), "Expected targetsid to be unchanged, got %s\n", targetsid); ok(size == MAX_PATH, "Expected size to be unchanged, got %lu\n", size); res = RegSetValueExA(patches, "Patches", 0, REG_SZ, @@ -9472,19 +8981,13 @@ static void test_MsiEnumPatchesEx_usermanaged(LPCSTR usersid, LPCSTR expectedsid context = 0xdeadbeef; lstrcpyA(targetsid, "kiwi"); size = MAX_PATH; - r = pMsiEnumPatchesExA(prodcode, usersid, MSIINSTALLCONTEXT_USERMANAGED, - MSIPATCHSTATE_APPLIED, 0, patchcode, targetprod, - &context, targetsid, &size); - ok(r == ERROR_BAD_CONFIGURATION, - "Expected ERROR_BAD_CONFIGURATION, got %d\n", r); - ok(!lstrcmpA(patchcode, "apple"), - "Expected patchcode to be unchanged, got %s\n", patchcode); - ok(!lstrcmpA(targetprod, "banana"), - "Expected targetprod to be unchanged, got %s\n", targetprod); - ok(context == 0xdeadbeef, - "Expected context to be unchanged, got %d\n", context); - ok(!lstrcmpA(targetsid, "kiwi"), - "Expected targetsid to be unchanged, got %s\n", targetsid); + r = MsiEnumPatchesExA(prodcode, usersid, MSIINSTALLCONTEXT_USERMANAGED, MSIPATCHSTATE_APPLIED, + 0, patchcode, targetprod, &context, targetsid, &size); + ok(r == ERROR_BAD_CONFIGURATION, "Expected ERROR_BAD_CONFIGURATION, got %d\n", r); + ok(!lstrcmpA(patchcode, "apple"), "Expected patchcode to be unchanged, got %s\n", patchcode); + ok(!lstrcmpA(targetprod, "banana"), "Expected targetprod to be unchanged, got %s\n", targetprod); + ok(context == 0xdeadbeef, "Expected context to be unchanged, got %d\n", context); + ok(!lstrcmpA(targetsid, "kiwi"), "Expected targetsid to be unchanged, got %s\n", targetsid); ok(size == MAX_PATH, "Expected size to be unchanged, got %lu\n", size); res = RegSetValueExA(patches, "Patches", 0, REG_MULTI_SZ, @@ -9497,19 +9000,13 @@ static void test_MsiEnumPatchesEx_usermanaged(LPCSTR usersid, LPCSTR expectedsid context = 0xdeadbeef; lstrcpyA(targetsid, "kiwi"); size = MAX_PATH; - r = pMsiEnumPatchesExA(prodcode, usersid, MSIINSTALLCONTEXT_USERMANAGED, - MSIPATCHSTATE_APPLIED, 0, patchcode, targetprod, - &context, targetsid, &size); - ok(r == ERROR_BAD_CONFIGURATION, - "Expected ERROR_BAD_CONFIGURATION, got %d\n", r); - ok(!lstrcmpA(patchcode, "apple"), - "Expected patchcode to be unchanged, got %s\n", patchcode); - ok(!lstrcmpA(targetprod, "banana"), - "Expected targetprod to be unchanged, got %s\n", targetprod); - ok(context == 0xdeadbeef, - "Expected context to be unchanged, got %d\n", context); - ok(!lstrcmpA(targetsid, "kiwi"), - "Expected targetsid to be unchanged, got %s\n", targetsid); + r = MsiEnumPatchesExA(prodcode, usersid, MSIINSTALLCONTEXT_USERMANAGED, MSIPATCHSTATE_APPLIED, + 0, patchcode, targetprod, &context, targetsid, &size); + ok(r == ERROR_BAD_CONFIGURATION, "Expected ERROR_BAD_CONFIGURATION, got %d\n", r); + ok(!lstrcmpA(patchcode, "apple"), "Expected patchcode to be unchanged, got %s\n", patchcode); + ok(!lstrcmpA(targetprod, "banana"), "Expected targetprod to be unchanged, got %s\n", targetprod); + ok(context == 0xdeadbeef, "Expected context to be unchanged, got %d\n", context); + ok(!lstrcmpA(targetsid, "kiwi"), "Expected targetsid to be unchanged, got %s\n", targetsid); ok(size == MAX_PATH, "Expected size to be unchanged, got %lu\n", size); patch_squashed[lstrlenA(patch_squashed) + 1] = '\0'; @@ -9524,18 +9021,13 @@ static void test_MsiEnumPatchesEx_usermanaged(LPCSTR usersid, LPCSTR expectedsid context = 0xdeadbeef; lstrcpyA(targetsid, "kiwi"); size = MAX_PATH; - r = pMsiEnumPatchesExA(prodcode, usersid, MSIINSTALLCONTEXT_USERMANAGED, - MSIPATCHSTATE_APPLIED, 0, patchcode, targetprod, - &context, targetsid, &size); + r = MsiEnumPatchesExA(prodcode, usersid, MSIINSTALLCONTEXT_USERMANAGED, MSIPATCHSTATE_APPLIED, + 0, patchcode, targetprod, &context, targetsid, &size); ok(r == ERROR_NO_MORE_ITEMS, "Expected ERROR_NO_MORE_ITEMS, got %d\n", r); - ok(!lstrcmpA(patchcode, "apple"), - "Expected patchcode to be unchanged, got %s\n", patchcode); - ok(!lstrcmpA(targetprod, "banana"), - "Expected targetprod to be unchanged, got %s\n", targetprod); - ok(context == 0xdeadbeef, - "Expected context to be unchanged, got %d\n", context); - ok(!lstrcmpA(targetsid, "kiwi"), - "Expected targetsid to be unchanged, got %s\n", targetsid); + ok(!lstrcmpA(patchcode, "apple"), "Expected patchcode to be unchanged, got %s\n", patchcode); + ok(!lstrcmpA(targetprod, "banana"), "Expected targetprod to be unchanged, got %s\n", targetprod); + ok(context == 0xdeadbeef, "Expected context to be unchanged, got %d\n", context); + ok(!lstrcmpA(targetsid, "kiwi"), "Expected targetsid to be unchanged, got %s\n", targetsid); ok(size == MAX_PATH, "Expected size to be unchanged, got %lu\n", size); res = RegSetValueExA(patches, patch_squashed, 0, REG_SZ, @@ -9548,20 +9040,14 @@ static void test_MsiEnumPatchesEx_usermanaged(LPCSTR usersid, LPCSTR expectedsid context = 0xdeadbeef; lstrcpyA(targetsid, "kiwi"); size = MAX_PATH; - r = pMsiEnumPatchesExA(prodcode, usersid, MSIINSTALLCONTEXT_USERMANAGED, - MSIPATCHSTATE_APPLIED, 0, patchcode, targetprod, - &context, targetsid, &size); - ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r); - ok(!lstrcmpA(patchcode, patch), - "Expected \"%s\", got \"%s\"\n", patch, patchcode); - ok(!lstrcmpA(targetprod, prodcode), - "Expected \"%s\", got \"%s\"\n", prodcode, targetprod); - ok(context == MSIINSTALLCONTEXT_USERMANAGED, - "Expected MSIINSTALLCONTEXT_USERMANAGED, got %d\n", context); - ok(!lstrcmpA(targetsid, expectedsid), - "Expected \"%s\", got \"%s\"\n", expectedsid, targetsid); - ok(size == lstrlenA(expectedsid), - "Expected %d, got %lu\n", lstrlenA(expectedsid), size); + r = MsiEnumPatchesExA(prodcode, usersid, MSIINSTALLCONTEXT_USERMANAGED, MSIPATCHSTATE_APPLIED, + 0, patchcode, targetprod, &context, targetsid, &size); + ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r); + ok(!lstrcmpA(patchcode, patch), "Expected \"%s\", got \"%s\"\n", patch, patchcode); + ok(!lstrcmpA(targetprod, prodcode), "Expected \"%s\", got \"%s\"\n", prodcode, targetprod); + ok(context == MSIINSTALLCONTEXT_USERMANAGED, "Expected MSIINSTALLCONTEXT_USERMANAGED, got %d\n", context); + ok(!lstrcmpA(targetsid, expectedsid), "Expected \"%s\", got \"%s\"\n", expectedsid, targetsid); + ok(size == lstrlenA(expectedsid), "Expected %d, got %lu\n", lstrlenA(expectedsid), size); /* increase the index */ lstrcpyA(patchcode, "apple"); @@ -9569,18 +9055,13 @@ static void test_MsiEnumPatchesEx_usermanaged(LPCSTR usersid, LPCSTR expectedsid context = 0xdeadbeef; lstrcpyA(targetsid, "kiwi"); size = MAX_PATH; - r = pMsiEnumPatchesExA(prodcode, usersid, MSIINSTALLCONTEXT_USERMANAGED, - MSIPATCHSTATE_APPLIED, 1, patchcode, targetprod, - &context, targetsid, &size); + r = MsiEnumPatchesExA(prodcode, usersid, MSIINSTALLCONTEXT_USERMANAGED, MSIPATCHSTATE_APPLIED, + 1, patchcode, targetprod, &context, targetsid, &size); ok(r == ERROR_NO_MORE_ITEMS, "Expected ERROR_NO_MORE_ITEMS, got %d\n", r); - ok(!lstrcmpA(patchcode, "apple"), - "Expected patchcode to be unchanged, got %s\n", patchcode); - ok(!lstrcmpA(targetprod, "banana"), - "Expected targetprod to be unchanged, got %s\n", targetprod); - ok(context == 0xdeadbeef, - "Expected context to be unchanged, got %d\n", context); - ok(!lstrcmpA(targetsid, "kiwi"), - "Expected targetsid to be unchanged, got %s\n", targetsid); + ok(!lstrcmpA(patchcode, "apple"), "Expected patchcode to be unchanged, got %s\n", patchcode); + ok(!lstrcmpA(targetprod, "banana"), "Expected targetprod to be unchanged, got %s\n", targetprod); + ok(context == 0xdeadbeef, "Expected context to be unchanged, got %d\n", context); + ok(!lstrcmpA(targetsid, "kiwi"), "Expected targetsid to be unchanged, got %s\n", targetsid); ok(size == MAX_PATH, "Expected size to be unchanged, got %lu\n", size); /* increase again */ @@ -9589,19 +9070,13 @@ static void test_MsiEnumPatchesEx_usermanaged(LPCSTR usersid, LPCSTR expectedsid context = 0xdeadbeef; lstrcpyA(targetsid, "kiwi"); size = MAX_PATH; - r = pMsiEnumPatchesExA(prodcode, usersid, MSIINSTALLCONTEXT_USERMANAGED, - MSIPATCHSTATE_APPLIED, 2, patchcode, targetprod, - &context, targetsid, &size); - ok(r == ERROR_INVALID_PARAMETER, - "Expected ERROR_INVALID_PARAMETER, got %d\n", r); - ok(!lstrcmpA(patchcode, "apple"), - "Expected patchcode to be unchanged, got %s\n", patchcode); - ok(!lstrcmpA(targetprod, "banana"), - "Expected targetprod to be unchanged, got %s\n", targetprod); - ok(context == 0xdeadbeef, - "Expected context to be unchanged, got %d\n", context); - ok(!lstrcmpA(targetsid, "kiwi"), - "Expected targetsid to be unchanged, got %s\n", targetsid); + r = MsiEnumPatchesExA(prodcode, usersid, MSIINSTALLCONTEXT_USERMANAGED, MSIPATCHSTATE_APPLIED, + 2, patchcode, targetprod, &context, targetsid, &size); + ok(r == ERROR_INVALID_PARAMETER, "Expected ERROR_INVALID_PARAMETER, got %d\n", r); + ok(!lstrcmpA(patchcode, "apple"), "Expected patchcode to be unchanged, got %s\n", patchcode); + ok(!lstrcmpA(targetprod, "banana"), "Expected targetprod to be unchanged, got %s\n", targetprod); + ok(context == 0xdeadbeef, "Expected context to be unchanged, got %d\n", context); + ok(!lstrcmpA(targetsid, "kiwi"), "Expected targetsid to be unchanged, got %s\n", targetsid); ok(size == MAX_PATH, "Expected size to be unchanged, got %lu\n", size); /* szPatchCode is NULL */ @@ -9609,72 +9084,52 @@ static void test_MsiEnumPatchesEx_usermanaged(LPCSTR usersid, LPCSTR expectedsid context = 0xdeadbeef; lstrcpyA(targetsid, "kiwi"); size = MAX_PATH; - r = pMsiEnumPatchesExA(prodcode, usersid, MSIINSTALLCONTEXT_USERMANAGED, - MSIPATCHSTATE_APPLIED, 0, NULL, targetprod, - &context, targetsid, &size); + r = MsiEnumPatchesExA(prodcode, usersid, MSIINSTALLCONTEXT_USERMANAGED, MSIPATCHSTATE_APPLIED, + 0, NULL, targetprod, &context, targetsid, &size); ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r); - ok(!lstrcmpA(targetprod, prodcode), - "Expected \"%s\", got \"%s\"\n", prodcode, targetprod); - ok(context == MSIINSTALLCONTEXT_USERMANAGED, - "Expected MSIINSTALLCONTEXT_USERMANAGED, got %d\n", context); - ok(!lstrcmpA(targetsid, expectedsid), - "Expected \"%s\", got \"%s\"\n", expectedsid, targetsid); - ok(size == lstrlenA(expectedsid), - "Expected %d, got %lu\n", lstrlenA(expectedsid), size); + ok(!lstrcmpA(targetprod, prodcode), "Expected \"%s\", got \"%s\"\n", prodcode, targetprod); + ok(context == MSIINSTALLCONTEXT_USERMANAGED, "Expected MSIINSTALLCONTEXT_USERMANAGED, got %d\n", context); + ok(!lstrcmpA(targetsid, expectedsid), "Expected \"%s\", got \"%s\"\n", expectedsid, targetsid); + ok(size == lstrlenA(expectedsid), "Expected %d, got %lu\n", lstrlenA(expectedsid), size); /* szTargetProductCode is NULL */ lstrcpyA(patchcode, "apple"); context = 0xdeadbeef; lstrcpyA(targetsid, "kiwi"); size = MAX_PATH; - r = pMsiEnumPatchesExA(prodcode, usersid, MSIINSTALLCONTEXT_USERMANAGED, - MSIPATCHSTATE_APPLIED, 0, patchcode, NULL, - &context, targetsid, &size); + r = MsiEnumPatchesExA(prodcode, usersid, MSIINSTALLCONTEXT_USERMANAGED, MSIPATCHSTATE_APPLIED, + 0, patchcode, NULL, &context, targetsid, &size); ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r); - ok(!lstrcmpA(patchcode, patch), - "Expected \"%s\", got \"%s\"\n", patch, patchcode); - ok(context == MSIINSTALLCONTEXT_USERMANAGED, - "Expected MSIINSTALLCONTEXT_USERMANAGED, got %d\n", context); - ok(!lstrcmpA(targetsid, expectedsid), - "Expected \"%s\", got \"%s\"\n", expectedsid, targetsid); - ok(size == lstrlenA(expectedsid), - "Expected %d, got %lu\n", lstrlenA(expectedsid), size); + ok(!lstrcmpA(patchcode, patch), "Expected \"%s\", got \"%s\"\n", patch, patchcode); + ok(context == MSIINSTALLCONTEXT_USERMANAGED, "Expected MSIINSTALLCONTEXT_USERMANAGED, got %d\n", context); + ok(!lstrcmpA(targetsid, expectedsid), "Expected \"%s\", got \"%s\"\n", expectedsid, targetsid); + ok(size == lstrlenA(expectedsid), "Expected %d, got %lu\n", lstrlenA(expectedsid), size); /* pdwTargetProductContext is NULL */ lstrcpyA(patchcode, "apple"); lstrcpyA(targetprod, "banana"); lstrcpyA(targetsid, "kiwi"); size = MAX_PATH; - r = pMsiEnumPatchesExA(prodcode, usersid, MSIINSTALLCONTEXT_USERMANAGED, - MSIPATCHSTATE_APPLIED, 0, patchcode, targetprod, - NULL, targetsid, &size); + r = MsiEnumPatchesExA(prodcode, usersid, MSIINSTALLCONTEXT_USERMANAGED, MSIPATCHSTATE_APPLIED, + 0, patchcode, targetprod, NULL, targetsid, &size); ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r); - ok(!lstrcmpA(patchcode, patch), - "Expected \"%s\", got \"%s\"\n", patch, patchcode); - ok(!lstrcmpA(targetprod, prodcode), - "Expected \"%s\", got \"%s\"\n", prodcode, targetprod); - ok(!lstrcmpA(targetsid, expectedsid), - "Expected \"%s\", got \"%s\"\n", expectedsid, targetsid); - ok(size == lstrlenA(expectedsid), - "Expected %d, got %lu\n", lstrlenA(expectedsid), size); + ok(!lstrcmpA(patchcode, patch), "Expected \"%s\", got \"%s\"\n", patch, patchcode); + ok(!lstrcmpA(targetprod, prodcode), "Expected \"%s\", got \"%s\"\n", prodcode, targetprod); + ok(!lstrcmpA(targetsid, expectedsid), "Expected \"%s\", got \"%s\"\n", expectedsid, targetsid); + ok(size == lstrlenA(expectedsid), "Expected %d, got %lu\n", lstrlenA(expectedsid), size); /* szTargetUserSid is NULL */ lstrcpyA(patchcode, "apple"); lstrcpyA(targetprod, "banana"); context = 0xdeadbeef; size = MAX_PATH; - r = pMsiEnumPatchesExA(prodcode, usersid, MSIINSTALLCONTEXT_USERMANAGED, - MSIPATCHSTATE_APPLIED, 0, patchcode, targetprod, - &context, NULL, &size); + r = MsiEnumPatchesExA(prodcode, usersid, MSIINSTALLCONTEXT_USERMANAGED, MSIPATCHSTATE_APPLIED, + 0, patchcode, targetprod, &context, NULL, &size); ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r); - ok(!lstrcmpA(patchcode, patch), - "Expected \"%s\", got \"%s\"\n", patch, patchcode); - ok(!lstrcmpA(targetprod, prodcode), - "Expected \"%s\", got \"%s\"\n", prodcode, targetprod); - ok(context == MSIINSTALLCONTEXT_USERMANAGED, - "Expected MSIINSTALLCONTEXT_USERMANAGED, got %d\n", context); - ok(size == lstrlenA(expectedsid) * sizeof(WCHAR), - "Expected %d*sizeof(WCHAR), got %lu\n", lstrlenA(expectedsid), size); + ok(!lstrcmpA(patchcode, patch), "Expected \"%s\", got \"%s\"\n", patch, patchcode); + ok(!lstrcmpA(targetprod, prodcode), "Expected \"%s\", got \"%s\"\n", prodcode, targetprod); + ok(context == MSIINSTALLCONTEXT_USERMANAGED, "Expected MSIINSTALLCONTEXT_USERMANAGED, got %d\n", context); + ok(size == lstrlenA(expectedsid) * sizeof(WCHAR), "Expected %d*sizeof(WCHAR), got %lu\n", lstrlenA(expectedsid), size); /* pcchTargetUserSid is exactly the length of szTargetUserSid */ lstrcpyA(patchcode, "apple"); @@ -9682,20 +9137,14 @@ static void test_MsiEnumPatchesEx_usermanaged(LPCSTR usersid, LPCSTR expectedsid context = 0xdeadbeef; lstrcpyA(targetsid, "kiwi"); size = lstrlenA(expectedsid); - r = pMsiEnumPatchesExA(prodcode, usersid, MSIINSTALLCONTEXT_USERMANAGED, - MSIPATCHSTATE_APPLIED, 0, patchcode, targetprod, - &context, targetsid, &size); + r = MsiEnumPatchesExA(prodcode, usersid, MSIINSTALLCONTEXT_USERMANAGED, MSIPATCHSTATE_APPLIED, + 0, patchcode, targetprod, &context, targetsid, &size); ok(r == ERROR_MORE_DATA, "Expected ERROR_MORE_DATA, got %d\n", r); - ok(!lstrcmpA(patchcode, patch), - "Expected \"%s\", got \"%s\"\n", patch, patchcode); - ok(!lstrcmpA(targetprod, prodcode), - "Expected \"%s\", got \"%s\"\n", prodcode, targetprod); - ok(context == MSIINSTALLCONTEXT_USERMANAGED, - "Expected MSIINSTALLCONTEXT_USERMANAGED, got %d\n", context); - ok(!strncmp(targetsid, expectedsid, lstrlenA(expectedsid) - 1), - "Expected \"%s\", got \"%s\"\n", expectedsid, targetsid); - ok(size == lstrlenA(expectedsid) * sizeof(WCHAR), - "Expected %d*sizeof(WCHAR), got %lu\n", lstrlenA(expectedsid), size); + ok(!lstrcmpA(patchcode, patch), "Expected \"%s\", got \"%s\"\n", patch, patchcode); + ok(!lstrcmpA(targetprod, prodcode), "Expected \"%s\", got \"%s\"\n", prodcode, targetprod); + ok(context == MSIINSTALLCONTEXT_USERMANAGED, "Expected MSIINSTALLCONTEXT_USERMANAGED, got %d\n", context); + ok(!strncmp(targetsid, expectedsid, lstrlenA(expectedsid) - 1), "Expected \"%s\", got \"%s\"\n", expectedsid, targetsid); + ok(size == lstrlenA(expectedsid) * sizeof(WCHAR), "Expected %d*sizeof(WCHAR), got %lu\n", lstrlenA(expectedsid), size); /* pcchTargetUserSid has enough room for NULL terminator */ lstrcpyA(patchcode, "apple"); @@ -9703,35 +9152,25 @@ static void test_MsiEnumPatchesEx_usermanaged(LPCSTR usersid, LPCSTR expectedsid context = 0xdeadbeef; lstrcpyA(targetsid, "kiwi"); size = lstrlenA(expectedsid) + 1; - r = pMsiEnumPatchesExA(prodcode, usersid, MSIINSTALLCONTEXT_USERMANAGED, - MSIPATCHSTATE_APPLIED, 0, patchcode, targetprod, - &context, targetsid, &size); - ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r); - ok(!lstrcmpA(patchcode, patch), - "Expected \"%s\", got \"%s\"\n", patch, patchcode); - ok(!lstrcmpA(targetprod, prodcode), - "Expected \"%s\", got \"%s\"\n", prodcode, targetprod); - ok(context == MSIINSTALLCONTEXT_USERMANAGED, - "Expected MSIINSTALLCONTEXT_USERMANAGED, got %d\n", context); - ok(!lstrcmpA(targetsid, expectedsid), - "Expected \"%s\", got \"%s\"\n", expectedsid, targetsid); - ok(size == lstrlenA(expectedsid), - "Expected %d, got %lu\n", lstrlenA(expectedsid), size); + r = MsiEnumPatchesExA(prodcode, usersid, MSIINSTALLCONTEXT_USERMANAGED, MSIPATCHSTATE_APPLIED, + 0, patchcode, targetprod, &context, targetsid, &size); + ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r); + ok(!lstrcmpA(patchcode, patch), "Expected \"%s\", got \"%s\"\n", patch, patchcode); + ok(!lstrcmpA(targetprod, prodcode), "Expected \"%s\", got \"%s\"\n", prodcode, targetprod); + ok(context == MSIINSTALLCONTEXT_USERMANAGED, "Expected MSIINSTALLCONTEXT_USERMANAGED, got %d\n", context); + ok(!lstrcmpA(targetsid, expectedsid), "Expected \"%s\", got \"%s\"\n", expectedsid, targetsid); + ok(size == lstrlenA(expectedsid), "Expected %d, got %lu\n", lstrlenA(expectedsid), size); /* both szTargetuserSid and pcchTargetUserSid are NULL */ lstrcpyA(patchcode, "apple"); lstrcpyA(targetprod, "banana"); context = 0xdeadbeef; - r = pMsiEnumPatchesExA(prodcode, usersid, MSIINSTALLCONTEXT_USERMANAGED, - MSIPATCHSTATE_APPLIED, 0, patchcode, targetprod, - &context, NULL, NULL); + r = MsiEnumPatchesExA(prodcode, usersid, MSIINSTALLCONTEXT_USERMANAGED, MSIPATCHSTATE_APPLIED, + 0, patchcode, targetprod, &context, NULL, NULL); ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r); - ok(!lstrcmpA(patchcode, patch), - "Expected \"%s\", got \"%s\"\n", patch, patchcode); - ok(!lstrcmpA(targetprod, prodcode), - "Expected \"%s\", got \"%s\"\n", prodcode, targetprod); - ok(context == MSIINSTALLCONTEXT_USERMANAGED, - "Expected MSIINSTALLCONTEXT_USERMANAGED, got %d\n", context); + ok(!lstrcmpA(patchcode, patch), "Expected \"%s\", got \"%s\"\n", patch, patchcode); + ok(!lstrcmpA(targetprod, prodcode), "Expected \"%s\", got \"%s\"\n", prodcode, targetprod); + ok(context == MSIINSTALLCONTEXT_USERMANAGED, "Expected MSIINSTALLCONTEXT_USERMANAGED, got %d\n", context); /* MSIPATCHSTATE_SUPERSEDED */ @@ -9740,18 +9179,13 @@ static void test_MsiEnumPatchesEx_usermanaged(LPCSTR usersid, LPCSTR expectedsid context = 0xdeadbeef; lstrcpyA(targetsid, "kiwi"); size = MAX_PATH; - r = pMsiEnumPatchesExA(prodcode, usersid, MSIINSTALLCONTEXT_USERMANAGED, - MSIPATCHSTATE_SUPERSEDED, 0, patchcode, targetprod, - &context, targetsid, &size); + r = MsiEnumPatchesExA(prodcode, usersid, MSIINSTALLCONTEXT_USERMANAGED, MSIPATCHSTATE_SUPERSEDED, + 0, patchcode, targetprod, &context, targetsid, &size); ok(r == ERROR_NO_MORE_ITEMS, "Expected ERROR_NO_MORE_ITEMS, got %d\n", r); - ok(!lstrcmpA(patchcode, "apple"), - "Expected patchcode to be unchanged, got %s\n", patchcode); - ok(!lstrcmpA(targetprod, "banana"), - "Expected targetprod to be unchanged, got %s\n", targetprod); - ok(context == 0xdeadbeef, - "Expected context to be unchanged, got %d\n", context); - ok(!lstrcmpA(targetsid, "kiwi"), - "Expected targetsid to be unchanged, got %s\n", targetsid); + ok(!lstrcmpA(patchcode, "apple"), "Expected patchcode to be unchanged, got %s\n", patchcode); + ok(!lstrcmpA(targetprod, "banana"), "Expected targetprod to be unchanged, got %s\n", targetprod); + ok(context == 0xdeadbeef, "Expected context to be unchanged, got %d\n", context); + ok(!lstrcmpA(targetsid, "kiwi"), "Expected targetsid to be unchanged, got %s\n", targetsid); ok(size == MAX_PATH, "Expected size to be unchanged, got %lu\n", size); lstrcpyA(keypath, "Software\\Microsoft\\Windows\\CurrentVersion\\Installer\\UserData\\"); @@ -9773,18 +9207,13 @@ static void test_MsiEnumPatchesEx_usermanaged(LPCSTR usersid, LPCSTR expectedsid context = 0xdeadbeef; lstrcpyA(targetsid, "kiwi"); size = MAX_PATH; - r = pMsiEnumPatchesExA(prodcode, usersid, MSIINSTALLCONTEXT_USERMANAGED, - MSIPATCHSTATE_SUPERSEDED, 0, patchcode, targetprod, - &context, targetsid, &size); + r = MsiEnumPatchesExA(prodcode, usersid, MSIINSTALLCONTEXT_USERMANAGED, MSIPATCHSTATE_SUPERSEDED, + 0, patchcode, targetprod, &context, targetsid, &size); ok(r == ERROR_NO_MORE_ITEMS, "Expected ERROR_NO_MORE_ITEMS, got %d\n", r); - ok(!lstrcmpA(patchcode, "apple"), - "Expected patchcode to be unchanged, got %s\n", patchcode); - ok(!lstrcmpA(targetprod, "banana"), - "Expected targetprod to be unchanged, got %s\n", targetprod); - ok(context == 0xdeadbeef, - "Expected context to be unchanged, got %d\n", context); - ok(!lstrcmpA(targetsid, "kiwi"), - "Expected targetsid to be unchanged, got %s\n", targetsid); + ok(!lstrcmpA(patchcode, "apple"), "Expected patchcode to be unchanged, got %s\n", patchcode); + ok(!lstrcmpA(targetprod, "banana"), "Expected targetprod to be unchanged, got %s\n", targetprod); + ok(context == 0xdeadbeef, "Expected context to be unchanged, got %d\n", context); + ok(!lstrcmpA(targetsid, "kiwi"), "Expected targetsid to be unchanged, got %s\n", targetsid); ok(size == MAX_PATH, "Expected size to be unchanged, got %lu\n", size); res = RegCreateKeyExA(udprod, "Patches", 0, NULL, 0, access, NULL, &udpatch, NULL); @@ -9796,18 +9225,13 @@ static void test_MsiEnumPatchesEx_usermanaged(LPCSTR usersid, LPCSTR expectedsid context = 0xdeadbeef; lstrcpyA(targetsid, "kiwi"); size = MAX_PATH; - r = pMsiEnumPatchesExA(prodcode, usersid, MSIINSTALLCONTEXT_USERMANAGED, - MSIPATCHSTATE_SUPERSEDED, 0, patchcode, targetprod, - &context, targetsid, &size); + r = MsiEnumPatchesExA(prodcode, usersid, MSIINSTALLCONTEXT_USERMANAGED, MSIPATCHSTATE_SUPERSEDED, + 0, patchcode, targetprod, &context, targetsid, &size); ok(r == ERROR_NO_MORE_ITEMS, "Expected ERROR_NO_MORE_ITEMS, got %d\n", r); - ok(!lstrcmpA(patchcode, "apple"), - "Expected patchcode to be unchanged, got %s\n", patchcode); - ok(!lstrcmpA(targetprod, "banana"), - "Expected targetprod to be unchanged, got %s\n", targetprod); - ok(context == 0xdeadbeef, - "Expected context to be unchanged, got %d\n", context); - ok(!lstrcmpA(targetsid, "kiwi"), - "Expected targetsid to be unchanged, got %s\n", targetsid); + ok(!lstrcmpA(patchcode, "apple"), "Expected patchcode to be unchanged, got %s\n", patchcode); + ok(!lstrcmpA(targetprod, "banana"), "Expected targetprod to be unchanged, got %s\n", targetprod); + ok(context == 0xdeadbeef, "Expected context to be unchanged, got %d\n", context); + ok(!lstrcmpA(targetsid, "kiwi"), "Expected targetsid to be unchanged, got %s\n", targetsid); ok(size == MAX_PATH, "Expected size to be unchanged, got %lu\n", size); res = RegCreateKeyExA(udpatch, patch_squashed, 0, NULL, 0, access, NULL, &hpatch, NULL); @@ -9819,19 +9243,13 @@ static void test_MsiEnumPatchesEx_usermanaged(LPCSTR usersid, LPCSTR expectedsid context = 0xdeadbeef; lstrcpyA(targetsid, "kiwi"); size = MAX_PATH; - r = pMsiEnumPatchesExA(prodcode, usersid, MSIINSTALLCONTEXT_USERMANAGED, - MSIPATCHSTATE_SUPERSEDED, 0, patchcode, targetprod, - &context, targetsid, &size); - ok(r == ERROR_BAD_CONFIGURATION, - "Expected ERROR_BAD_CONFIGURATION, got %d\n", r); - ok(!lstrcmpA(patchcode, "apple"), - "Expected patchcode to be unchanged, got %s\n", patchcode); - ok(!lstrcmpA(targetprod, "banana"), - "Expected targetprod to be unchanged, got %s\n", targetprod); - ok(context == 0xdeadbeef, - "Expected context to be unchanged, got %d\n", context); - ok(!lstrcmpA(targetsid, "kiwi"), - "Expected targetsid to be unchanged, got %s\n", targetsid); + r = MsiEnumPatchesExA(prodcode, usersid, MSIINSTALLCONTEXT_USERMANAGED, MSIPATCHSTATE_SUPERSEDED, + 0, patchcode, targetprod, &context, targetsid, &size); + ok(r == ERROR_BAD_CONFIGURATION, "Expected ERROR_BAD_CONFIGURATION, got %d\n", r); + ok(!lstrcmpA(patchcode, "apple"), "Expected patchcode to be unchanged, got %s\n", patchcode); + ok(!lstrcmpA(targetprod, "banana"), "Expected targetprod to be unchanged, got %s\n", targetprod); + ok(context == 0xdeadbeef, "Expected context to be unchanged, got %d\n", context); + ok(!lstrcmpA(targetsid, "kiwi"), "Expected targetsid to be unchanged, got %s\n", targetsid); ok(size == MAX_PATH, "Expected size to be unchanged, got %lu\n", size); data = MSIPATCHSTATE_SUPERSEDED; @@ -9845,20 +9263,14 @@ static void test_MsiEnumPatchesEx_usermanaged(LPCSTR usersid, LPCSTR expectedsid context = 0xdeadbeef; lstrcpyA(targetsid, "kiwi"); size = MAX_PATH; - r = pMsiEnumPatchesExA(prodcode, usersid, MSIINSTALLCONTEXT_USERMANAGED, - MSIPATCHSTATE_SUPERSEDED, 0, patchcode, targetprod, - &context, targetsid, &size); - ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r); - ok(!lstrcmpA(patchcode, patch), - "Expected \"%s\", got \"%s\"\n", patch, patchcode); - ok(!lstrcmpA(targetprod, prodcode), - "Expected \"%s\", got \"%s\"\n", prodcode, targetprod); - ok(context == MSIINSTALLCONTEXT_USERMANAGED, - "Expected MSIINSTALLCONTEXT_USERMANAGED, got %d\n", context); - ok(!lstrcmpA(targetsid, expectedsid), - "Expected \"%s\", got \"%s\"\n", expectedsid, targetsid); - ok(size == lstrlenA(expectedsid), - "Expected %d, got %lu\n", lstrlenA(expectedsid), size); + r = MsiEnumPatchesExA(prodcode, usersid, MSIINSTALLCONTEXT_USERMANAGED, MSIPATCHSTATE_SUPERSEDED, + 0, patchcode, targetprod, &context, targetsid, &size); + ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r); + ok(!lstrcmpA(patchcode, patch), "Expected \"%s\", got \"%s\"\n", patch, patchcode); + ok(!lstrcmpA(targetprod, prodcode), "Expected \"%s\", got \"%s\"\n", prodcode, targetprod); + ok(context == MSIINSTALLCONTEXT_USERMANAGED, "Expected MSIINSTALLCONTEXT_USERMANAGED, got %d\n", context); + ok(!lstrcmpA(targetsid, expectedsid), "Expected \"%s\", got \"%s\"\n", expectedsid, targetsid); + ok(size == lstrlenA(expectedsid), "Expected %d, got %lu\n", lstrlenA(expectedsid), size); /* MSIPATCHSTATE_OBSOLETED */ @@ -9867,18 +9279,13 @@ static void test_MsiEnumPatchesEx_usermanaged(LPCSTR usersid, LPCSTR expectedsid context = 0xdeadbeef; lstrcpyA(targetsid, "kiwi"); size = MAX_PATH; - r = pMsiEnumPatchesExA(prodcode, usersid, MSIINSTALLCONTEXT_USERMANAGED, - MSIPATCHSTATE_OBSOLETED, 0, patchcode, targetprod, - &context, targetsid, &size); + r = MsiEnumPatchesExA(prodcode, usersid, MSIINSTALLCONTEXT_USERMANAGED, MSIPATCHSTATE_OBSOLETED, + 0, patchcode, targetprod, &context, targetsid, &size); ok(r == ERROR_NO_MORE_ITEMS, "Expected ERROR_NO_MORE_ITEMS, got %d\n", r); - ok(!lstrcmpA(patchcode, "apple"), - "Expected patchcode to be unchanged, got %s\n", patchcode); - ok(!lstrcmpA(targetprod, "banana"), - "Expected targetprod to be unchanged, got %s\n", targetprod); - ok(context == 0xdeadbeef, - "Expected context to be unchanged, got %d\n", context); - ok(!lstrcmpA(targetsid, "kiwi"), - "Expected targetsid to be unchanged, got %s\n", targetsid); + ok(!lstrcmpA(patchcode, "apple"), "Expected patchcode to be unchanged, got %s\n", patchcode); + ok(!lstrcmpA(targetprod, "banana"), "Expected targetprod to be unchanged, got %s\n", targetprod); + ok(context == 0xdeadbeef, "Expected context to be unchanged, got %d\n", context); + ok(!lstrcmpA(targetsid, "kiwi"), "Expected targetsid to be unchanged, got %s\n", targetsid); ok(size == MAX_PATH, "Expected size to be unchanged, got %lu\n", size); data = MSIPATCHSTATE_OBSOLETED; @@ -9892,20 +9299,14 @@ static void test_MsiEnumPatchesEx_usermanaged(LPCSTR usersid, LPCSTR expectedsid context = 0xdeadbeef; lstrcpyA(targetsid, "kiwi"); size = MAX_PATH; - r = pMsiEnumPatchesExA(prodcode, usersid, MSIINSTALLCONTEXT_USERMANAGED, - MSIPATCHSTATE_OBSOLETED, 0, patchcode, targetprod, - &context, targetsid, &size); - ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r); - ok(!lstrcmpA(patchcode, patch), - "Expected \"%s\", got \"%s\"\n", patch, patchcode); - ok(!lstrcmpA(targetprod, prodcode), - "Expected \"%s\", got \"%s\"\n", prodcode, targetprod); - ok(context == MSIINSTALLCONTEXT_USERMANAGED, - "Expected MSIINSTALLCONTEXT_USERMANAGED, got %d\n", context); - ok(!lstrcmpA(targetsid, expectedsid), - "Expected \"%s\", got \"%s\"\n", expectedsid, targetsid); - ok(size == lstrlenA(expectedsid), - "Expected %d, got %lu\n", lstrlenA(expectedsid), size); + r = MsiEnumPatchesExA(prodcode, usersid, MSIINSTALLCONTEXT_USERMANAGED, MSIPATCHSTATE_OBSOLETED, + 0, patchcode, targetprod, &context, targetsid, &size); + ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r); + ok(!lstrcmpA(patchcode, patch), "Expected \"%s\", got \"%s\"\n", patch, patchcode); + ok(!lstrcmpA(targetprod, prodcode), "Expected \"%s\", got \"%s\"\n", prodcode, targetprod); + ok(context == MSIINSTALLCONTEXT_USERMANAGED, "Expected MSIINSTALLCONTEXT_USERMANAGED, got %d\n", context); + ok(!lstrcmpA(targetsid, expectedsid), "Expected \"%s\", got \"%s\"\n", expectedsid, targetsid); + ok(size == lstrlenA(expectedsid), "Expected %d, got %lu\n", lstrlenA(expectedsid), size); /* MSIPATCHSTATE_REGISTERED */ /* FIXME */ @@ -9918,20 +9319,14 @@ static void test_MsiEnumPatchesEx_usermanaged(LPCSTR usersid, LPCSTR expectedsid context = 0xdeadbeef; lstrcpyA(targetsid, "kiwi"); size = MAX_PATH; - r = pMsiEnumPatchesExA(prodcode, usersid, MSIINSTALLCONTEXT_USERMANAGED, - MSIPATCHSTATE_ALL, 0, patchcode, targetprod, - &context, targetsid, &size); - ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r); - ok(!lstrcmpA(patchcode, patch), - "Expected \"%s\", got \"%s\"\n", patch, patchcode); - ok(!lstrcmpA(targetprod, prodcode), - "Expected \"%s\", got \"%s\"\n", prodcode, targetprod); - ok(context == MSIINSTALLCONTEXT_USERMANAGED, - "Expected MSIINSTALLCONTEXT_USERMANAGED, got %d\n", context); - ok(!lstrcmpA(targetsid, expectedsid), - "Expected \"%s\", got \"%s\"\n", expectedsid, targetsid); - ok(size == lstrlenA(expectedsid), - "Expected %d, got %lu\n", lstrlenA(expectedsid), size); + r = MsiEnumPatchesExA(prodcode, usersid, MSIINSTALLCONTEXT_USERMANAGED, MSIPATCHSTATE_ALL, + 0, patchcode, targetprod, &context, targetsid, &size); + ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r); + ok(!lstrcmpA(patchcode, patch), "Expected \"%s\", got \"%s\"\n", patch, patchcode); + ok(!lstrcmpA(targetprod, prodcode), "Expected \"%s\", got \"%s\"\n", prodcode, targetprod); + ok(context == MSIINSTALLCONTEXT_USERMANAGED, "Expected MSIINSTALLCONTEXT_USERMANAGED, got %d\n", context); + ok(!lstrcmpA(targetsid, expectedsid), "Expected \"%s\", got \"%s\"\n", expectedsid, targetsid); + ok(size == lstrlenA(expectedsid), "Expected %d, got %lu\n", lstrlenA(expectedsid), size); /* same patch in multiple places, only one is enumerated */ lstrcpyA(patchcode, "apple"); @@ -9939,31 +9334,26 @@ static void test_MsiEnumPatchesEx_usermanaged(LPCSTR usersid, LPCSTR expectedsid context = 0xdeadbeef; lstrcpyA(targetsid, "kiwi"); size = MAX_PATH; - r = pMsiEnumPatchesExA(prodcode, usersid, MSIINSTALLCONTEXT_USERMANAGED, - MSIPATCHSTATE_ALL, 1, patchcode, targetprod, - &context, targetsid, &size); + r = MsiEnumPatchesExA(prodcode, usersid, MSIINSTALLCONTEXT_USERMANAGED, MSIPATCHSTATE_ALL, + 1, patchcode, targetprod, &context, targetsid, &size); ok(r == ERROR_NO_MORE_ITEMS, "Expected ERROR_NO_MORE_ITEMS, got %d\n", r); - ok(!lstrcmpA(patchcode, "apple"), - "Expected patchcode to be unchanged, got %s\n", patchcode); - ok(!lstrcmpA(targetprod, "banana"), - "Expected targetprod to be unchanged, got %s\n", targetprod); - ok(context == 0xdeadbeef, - "Expected context to be unchanged, got %d\n", context); - ok(!lstrcmpA(targetsid, "kiwi"), - "Expected targetsid to be unchanged, got %s\n", targetsid); + ok(!lstrcmpA(patchcode, "apple"), "Expected patchcode to be unchanged, got %s\n", patchcode); + ok(!lstrcmpA(targetprod, "banana"), "Expected targetprod to be unchanged, got %s\n", targetprod); + ok(context == 0xdeadbeef, "Expected context to be unchanged, got %d\n", context); + ok(!lstrcmpA(targetsid, "kiwi"), "Expected targetsid to be unchanged, got %s\n", targetsid); ok(size == MAX_PATH, "Expected size to be unchanged, got %lu\n", size); RegDeleteValueA(hpatch, "State"); - delete_key(hpatch, "", access & KEY_WOW64_64KEY); + RegDeleteKeyExA(hpatch, "", access & KEY_WOW64_64KEY, 0); RegCloseKey(hpatch); - delete_key(udpatch, "", access & KEY_WOW64_64KEY); + RegDeleteKeyExA(udpatch, "", access & KEY_WOW64_64KEY, 0); RegCloseKey(udpatch); - delete_key(udprod, "", access & KEY_WOW64_64KEY); + RegDeleteKeyExA(udprod, "", access & KEY_WOW64_64KEY, 0); RegCloseKey(udprod); RegDeleteValueA(patches, "Patches"); - delete_key(patches, "", access & KEY_WOW64_64KEY); + RegDeleteKeyExA(patches, "", access & KEY_WOW64_64KEY, 0); RegCloseKey(patches); - delete_key(prodkey, "", access & KEY_WOW64_64KEY); + RegDeleteKeyExA(prodkey, "", access & KEY_WOW64_64KEY, 0); RegCloseKey(prodkey); } @@ -9994,18 +9384,13 @@ static void test_MsiEnumPatchesEx_userunmanaged(LPCSTR usersid, LPCSTR expecteds context = 0xdeadbeef; lstrcpyA(targetsid, "kiwi"); size = MAX_PATH; - r = pMsiEnumPatchesExA(prodcode, usersid, MSIINSTALLCONTEXT_USERUNMANAGED, - MSIPATCHSTATE_APPLIED, 0, patchcode, targetprod, - &context, targetsid, &size); + r = MsiEnumPatchesExA(prodcode, usersid, MSIINSTALLCONTEXT_USERUNMANAGED, MSIPATCHSTATE_APPLIED, + 0, patchcode, targetprod, &context, targetsid, &size); ok(r == ERROR_NO_MORE_ITEMS, "Expected ERROR_NO_MORE_ITEMS, got %d\n", r); - ok(!lstrcmpA(patchcode, "apple"), - "Expected patchcode to be unchanged, got %s\n", patchcode); - ok(!lstrcmpA(targetprod, "banana"), - "Expected targetprod to be unchanged, got %s\n", targetprod); - ok(context == 0xdeadbeef, - "Expected context to be unchanged, got %d\n", context); - ok(!lstrcmpA(targetsid, "kiwi"), - "Expected targetsid to be unchanged, got %s\n", targetsid); + ok(!lstrcmpA(patchcode, "apple"), "Expected patchcode to be unchanged, got %s\n", patchcode); + ok(!lstrcmpA(targetprod, "banana"), "Expected targetprod to be unchanged, got %s\n", targetprod); + ok(context == 0xdeadbeef, "Expected context to be unchanged, got %d\n", context); + ok(!lstrcmpA(targetsid, "kiwi"), "Expected targetsid to be unchanged, got %s\n", targetsid); ok(size == MAX_PATH, "Expected size to be unchanged, got %lu\n", size); lstrcpyA(keypath, "Software\\Microsoft\\Installer\\Products\\"); @@ -10020,18 +9405,13 @@ static void test_MsiEnumPatchesEx_userunmanaged(LPCSTR usersid, LPCSTR expecteds context = 0xdeadbeef; lstrcpyA(targetsid, "kiwi"); size = MAX_PATH; - r = pMsiEnumPatchesExA(prodcode, usersid, MSIINSTALLCONTEXT_USERUNMANAGED, - MSIPATCHSTATE_APPLIED, 0, patchcode, targetprod, - &context, targetsid, &size); + r = MsiEnumPatchesExA(prodcode, usersid, MSIINSTALLCONTEXT_USERUNMANAGED, MSIPATCHSTATE_APPLIED, + 0, patchcode, targetprod, &context, targetsid, &size); ok(r == ERROR_NO_MORE_ITEMS, "Expected ERROR_NO_MORE_ITEMS, got %d\n", r); - ok(!lstrcmpA(patchcode, "apple"), - "Expected patchcode to be unchanged, got %s\n", patchcode); - ok(!lstrcmpA(targetprod, "banana"), - "Expected targetprod to be unchanged, got %s\n", targetprod); - ok(context == 0xdeadbeef, - "Expected context to be unchanged, got %d\n", context); - ok(!lstrcmpA(targetsid, "kiwi"), - "Expected targetsid to be unchanged, got %s\n", targetsid); + ok(!lstrcmpA(patchcode, "apple"), "Expected patchcode to be unchanged, got %s\n", patchcode); + ok(!lstrcmpA(targetprod, "banana"), "Expected targetprod to be unchanged, got %s\n", targetprod); + ok(context == 0xdeadbeef, "Expected context to be unchanged, got %d\n", context); + ok(!lstrcmpA(targetsid, "kiwi"), "Expected targetsid to be unchanged, got %s\n", targetsid); ok(size == MAX_PATH, "Expected size to be unchanged, got %lu\n", size); res = RegCreateKeyA(prodkey, "Patches", &patches); @@ -10043,18 +9423,13 @@ static void test_MsiEnumPatchesEx_userunmanaged(LPCSTR usersid, LPCSTR expecteds context = 0xdeadbeef; lstrcpyA(targetsid, "kiwi"); size = MAX_PATH; - r = pMsiEnumPatchesExA(prodcode, usersid, MSIINSTALLCONTEXT_USERUNMANAGED, - MSIPATCHSTATE_APPLIED, 0, patchcode, targetprod, - &context, targetsid, &size); + r = MsiEnumPatchesExA(prodcode, usersid, MSIINSTALLCONTEXT_USERUNMANAGED, MSIPATCHSTATE_APPLIED, + 0, patchcode, targetprod, &context, targetsid, &size); ok(r == ERROR_NO_MORE_ITEMS, "Expected ERROR_NO_MORE_ITEMS, got %d\n", r); - ok(!lstrcmpA(patchcode, "apple"), - "Expected patchcode to be unchanged, got %s\n", patchcode); - ok(!lstrcmpA(targetprod, "banana"), - "Expected targetprod to be unchanged, got %s\n", targetprod); - ok(context == 0xdeadbeef, - "Expected context to be unchanged, got %d\n", context); - ok(!lstrcmpA(targetsid, "kiwi"), - "Expected targetsid to be unchanged, got %s\n", targetsid); + ok(!lstrcmpA(patchcode, "apple"), "Expected patchcode to be unchanged, got %s\n", patchcode); + ok(!lstrcmpA(targetprod, "banana"), "Expected targetprod to be unchanged, got %s\n", targetprod); + ok(context == 0xdeadbeef, "Expected context to be unchanged, got %d\n", context); + ok(!lstrcmpA(targetsid, "kiwi"), "Expected targetsid to be unchanged, got %s\n", targetsid); ok(size == MAX_PATH, "Expected size to be unchanged, got %lu\n", size); res = RegSetValueExA(patches, "Patches", 0, REG_SZ, @@ -10068,19 +9443,13 @@ static void test_MsiEnumPatchesEx_userunmanaged(LPCSTR usersid, LPCSTR expecteds context = 0xdeadbeef; lstrcpyA(targetsid, "kiwi"); size = MAX_PATH; - r = pMsiEnumPatchesExA(prodcode, usersid, MSIINSTALLCONTEXT_USERUNMANAGED, - MSIPATCHSTATE_APPLIED, 0, patchcode, targetprod, - &context, targetsid, &size); - ok(r == ERROR_BAD_CONFIGURATION, - "Expected ERROR_BAD_CONFIGURATION, got %d\n", r); - ok(!lstrcmpA(patchcode, "apple"), - "Expected patchcode to be unchanged, got %s\n", patchcode); - ok(!lstrcmpA(targetprod, "banana"), - "Expected targetprod to be unchanged, got %s\n", targetprod); - ok(context == 0xdeadbeef, - "Expected context to be unchanged, got %d\n", context); - ok(!lstrcmpA(targetsid, "kiwi"), - "Expected targetsid to be unchanged, got %s\n", targetsid); + r = MsiEnumPatchesExA(prodcode, usersid, MSIINSTALLCONTEXT_USERUNMANAGED, MSIPATCHSTATE_APPLIED, + 0, patchcode, targetprod, &context, targetsid, &size); + ok(r == ERROR_BAD_CONFIGURATION, "Expected ERROR_BAD_CONFIGURATION, got %d\n", r); + ok(!lstrcmpA(patchcode, "apple"), "Expected patchcode to be unchanged, got %s\n", patchcode); + ok(!lstrcmpA(targetprod, "banana"), "Expected targetprod to be unchanged, got %s\n", targetprod); + ok(context == 0xdeadbeef, "Expected context to be unchanged, got %d\n", context); + ok(!lstrcmpA(targetsid, "kiwi"), "Expected targetsid to be unchanged, got %s\n", targetsid); ok(size == MAX_PATH, "Expected size to be unchanged, got %lu\n", size); res = RegSetValueExA(patches, "Patches", 0, REG_MULTI_SZ, @@ -10093,19 +9462,13 @@ static void test_MsiEnumPatchesEx_userunmanaged(LPCSTR usersid, LPCSTR expecteds context = 0xdeadbeef; lstrcpyA(targetsid, "kiwi"); size = MAX_PATH; - r = pMsiEnumPatchesExA(prodcode, usersid, MSIINSTALLCONTEXT_USERUNMANAGED, - MSIPATCHSTATE_APPLIED, 0, patchcode, targetprod, - &context, targetsid, &size); - ok(r == ERROR_BAD_CONFIGURATION, - "Expected ERROR_BAD_CONFIGURATION, got %d\n", r); - ok(!lstrcmpA(patchcode, "apple"), - "Expected patchcode to be unchanged, got %s\n", patchcode); - ok(!lstrcmpA(targetprod, "banana"), - "Expected targetprod to be unchanged, got %s\n", targetprod); - ok(context == 0xdeadbeef, - "Expected context to be unchanged, got %d\n", context); - ok(!lstrcmpA(targetsid, "kiwi"), - "Expected targetsid to be unchanged, got %s\n", targetsid); + r = MsiEnumPatchesExA(prodcode, usersid, MSIINSTALLCONTEXT_USERUNMANAGED, MSIPATCHSTATE_APPLIED, + 0, patchcode, targetprod, &context, targetsid, &size); + ok(r == ERROR_BAD_CONFIGURATION, "Expected ERROR_BAD_CONFIGURATION, got %d\n", r); + ok(!lstrcmpA(patchcode, "apple"), "Expected patchcode to be unchanged, got %s\n", patchcode); + ok(!lstrcmpA(targetprod, "banana"), "Expected targetprod to be unchanged, got %s\n", targetprod); + ok(context == 0xdeadbeef, "Expected context to be unchanged, got %d\n", context); + ok(!lstrcmpA(targetsid, "kiwi"), "Expected targetsid to be unchanged, got %s\n", targetsid); ok(size == MAX_PATH, "Expected size to be unchanged, got %lu\n", size); patch_squashed[lstrlenA(patch_squashed) + 1] = 0; @@ -10120,20 +9483,13 @@ static void test_MsiEnumPatchesEx_userunmanaged(LPCSTR usersid, LPCSTR expecteds context = 0xdeadbeef; lstrcpyA(targetsid, "kiwi"); size = MAX_PATH; - r = pMsiEnumPatchesExA(prodcode, usersid, MSIINSTALLCONTEXT_USERUNMANAGED, - MSIPATCHSTATE_APPLIED, 0, patchcode, targetprod, - &context, targetsid, &size); - ok(r == ERROR_NO_MORE_ITEMS || - broken(r == ERROR_BAD_CONFIGURATION), /* Windows Installer 3.0 */ - "Expected ERROR_NO_MORE_ITEMS, got %d\n", r); - ok(!lstrcmpA(patchcode, "apple"), - "Expected patchcode to be unchanged, got %s\n", patchcode); - ok(!lstrcmpA(targetprod, "banana"), - "Expected targetprod to be unchanged, got %s\n", targetprod); - ok(context == 0xdeadbeef, - "Expected context to be unchanged, got %d\n", context); - ok(!lstrcmpA(targetsid, "kiwi"), - "Expected targetsid to be unchanged, got %s\n", targetsid); + r = MsiEnumPatchesExA(prodcode, usersid, MSIINSTALLCONTEXT_USERUNMANAGED, MSIPATCHSTATE_APPLIED, + 0, patchcode, targetprod, &context, targetsid, &size); + ok(r == ERROR_NO_MORE_ITEMS, "Expected ERROR_NO_MORE_ITEMS, got %d\n", r); + ok(!lstrcmpA(patchcode, "apple"), "Expected patchcode to be unchanged, got %s\n", patchcode); + ok(!lstrcmpA(targetprod, "banana"), "Expected targetprod to be unchanged, got %s\n", targetprod); + ok(context == 0xdeadbeef, "Expected context to be unchanged, got %d\n", context); + ok(!lstrcmpA(targetsid, "kiwi"), "Expected targetsid to be unchanged, got %s\n", targetsid); ok(size == MAX_PATH, "Expected size to be unchanged, got %lu\n", size); res = RegSetValueExA(patches, patch_squashed, 0, REG_SZ, @@ -10146,20 +9502,13 @@ static void test_MsiEnumPatchesEx_userunmanaged(LPCSTR usersid, LPCSTR expecteds context = 0xdeadbeef; lstrcpyA(targetsid, "kiwi"); size = MAX_PATH; - r = pMsiEnumPatchesExA(prodcode, usersid, MSIINSTALLCONTEXT_USERUNMANAGED, - MSIPATCHSTATE_APPLIED, 0, patchcode, targetprod, - &context, targetsid, &size); - ok(r == ERROR_NO_MORE_ITEMS || - broken(r == ERROR_BAD_CONFIGURATION), /* Windows Installer 3.0 */ - "Expected ERROR_NO_MORE_ITEMS, got %d\n", r); - ok(!lstrcmpA(patchcode, "apple"), - "Expected patchcode to be unchanged, got %s\n", patchcode); - ok(!lstrcmpA(targetprod, "banana"), - "Expected targetprod to be unchanged, got %s\n", targetprod); - ok(context == 0xdeadbeef, - "Expected context to be unchanged, got %d\n", context); - ok(!lstrcmpA(targetsid, "kiwi"), - "Expected targetsid to be unchanged, got %s\n", targetsid); + r = MsiEnumPatchesExA(prodcode, usersid, MSIINSTALLCONTEXT_USERUNMANAGED, MSIPATCHSTATE_APPLIED, + 0, patchcode, targetprod, &context, targetsid, &size); + ok(r == ERROR_NO_MORE_ITEMS, "Expected ERROR_NO_MORE_ITEMS, got %d\n", r); + ok(!lstrcmpA(patchcode, "apple"), "Expected patchcode to be unchanged, got %s\n", patchcode); + ok(!lstrcmpA(targetprod, "banana"), "Expected targetprod to be unchanged, got %s\n", targetprod); + ok(context == 0xdeadbeef, "Expected context to be unchanged, got %d\n", context); + ok(!lstrcmpA(targetsid, "kiwi"), "Expected targetsid to be unchanged, got %s\n", targetsid); ok(size == MAX_PATH, "Expected size to be unchanged, got %lu\n", size); lstrcpyA(keypath, "Software\\Microsoft\\Windows\\CurrentVersion\\Installer\\UserData\\"); @@ -10181,20 +9530,14 @@ static void test_MsiEnumPatchesEx_userunmanaged(LPCSTR usersid, LPCSTR expecteds context = 0xdeadbeef; lstrcpyA(targetsid, "kiwi"); size = MAX_PATH; - r = pMsiEnumPatchesExA(prodcode, usersid, MSIINSTALLCONTEXT_USERUNMANAGED, - MSIPATCHSTATE_APPLIED, 0, patchcode, targetprod, - &context, targetsid, &size); - ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r); - ok(!lstrcmpA(patchcode, patch), - "Expected \"%s\", got \"%s\"\n", patch, patchcode); - ok(!lstrcmpA(targetprod, prodcode), - "Expected \"%s\", got \"%s\"\n", prodcode, targetprod); - ok(context == MSIINSTALLCONTEXT_USERUNMANAGED, - "Expected MSIINSTALLCONTEXT_USERUNMANAGED, got %d\n", context); - ok(!lstrcmpA(targetsid, expectedsid), - "Expected \"%s\", got \"%s\"\n", expectedsid, targetsid); - ok(size == lstrlenA(expectedsid), - "Expected %d, got %lu\n", lstrlenA(expectedsid), size); + r = MsiEnumPatchesExA(prodcode, usersid, MSIINSTALLCONTEXT_USERUNMANAGED, MSIPATCHSTATE_APPLIED, + 0, patchcode, targetprod, &context, targetsid, &size); + ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r); + ok(!lstrcmpA(patchcode, patch), "Expected \"%s\", got \"%s\"\n", patch, patchcode); + ok(!lstrcmpA(targetprod, prodcode), "Expected \"%s\", got \"%s\"\n", prodcode, targetprod); + ok(context == MSIINSTALLCONTEXT_USERUNMANAGED, "Expected MSIINSTALLCONTEXT_USERUNMANAGED, got %d\n", context); + ok(!lstrcmpA(targetsid, expectedsid), "Expected \"%s\", got \"%s\"\n", expectedsid, targetsid); + ok(size == lstrlenA(expectedsid), "Expected %d, got %lu\n", lstrlenA(expectedsid), size); /* MSIPATCHSTATE_SUPERSEDED */ @@ -10203,18 +9546,13 @@ static void test_MsiEnumPatchesEx_userunmanaged(LPCSTR usersid, LPCSTR expecteds context = 0xdeadbeef; lstrcpyA(targetsid, "kiwi"); size = MAX_PATH; - r = pMsiEnumPatchesExA(prodcode, usersid, MSIINSTALLCONTEXT_USERUNMANAGED, - MSIPATCHSTATE_SUPERSEDED, 0, patchcode, targetprod, - &context, targetsid, &size); + r = MsiEnumPatchesExA(prodcode, usersid, MSIINSTALLCONTEXT_USERUNMANAGED, MSIPATCHSTATE_SUPERSEDED, + 0, patchcode, targetprod, &context, targetsid, &size); ok(r == ERROR_NO_MORE_ITEMS, "Expected ERROR_NO_MORE_ITEMS, got %d\n", r); - ok(!lstrcmpA(patchcode, "apple"), - "Expected patchcode to be unchanged, got %s\n", patchcode); - ok(!lstrcmpA(targetprod, "banana"), - "Expected targetprod to be unchanged, got %s\n", targetprod); - ok(context == 0xdeadbeef, - "Expected context to be unchanged, got %d\n", context); - ok(!lstrcmpA(targetsid, "kiwi"), - "Expected targetsid to be unchanged, got %s\n", targetsid); + ok(!lstrcmpA(patchcode, "apple"), "Expected patchcode to be unchanged, got %s\n", patchcode); + ok(!lstrcmpA(targetprod, "banana"), "Expected targetprod to be unchanged, got %s\n", targetprod); + ok(context == 0xdeadbeef, "Expected context to be unchanged, got %d\n", context); + ok(!lstrcmpA(targetsid, "kiwi"), "Expected targetsid to be unchanged, got %s\n", targetsid); ok(size == MAX_PATH, "Expected size to be unchanged, got %lu\n", size); lstrcpyA(keypath, "Software\\Microsoft\\Windows\\CurrentVersion\\Installer\\UserData\\"); @@ -10236,18 +9574,13 @@ static void test_MsiEnumPatchesEx_userunmanaged(LPCSTR usersid, LPCSTR expecteds context = 0xdeadbeef; lstrcpyA(targetsid, "kiwi"); size = MAX_PATH; - r = pMsiEnumPatchesExA(prodcode, usersid, MSIINSTALLCONTEXT_USERUNMANAGED, - MSIPATCHSTATE_SUPERSEDED, 0, patchcode, targetprod, - &context, targetsid, &size); + r = MsiEnumPatchesExA(prodcode, usersid, MSIINSTALLCONTEXT_USERUNMANAGED, MSIPATCHSTATE_SUPERSEDED, + 0, patchcode, targetprod, &context, targetsid, &size); ok(r == ERROR_NO_MORE_ITEMS, "Expected ERROR_NO_MORE_ITEMS, got %d\n", r); - ok(!lstrcmpA(patchcode, "apple"), - "Expected patchcode to be unchanged, got %s\n", patchcode); - ok(!lstrcmpA(targetprod, "banana"), - "Expected targetprod to be unchanged, got %s\n", targetprod); - ok(context == 0xdeadbeef, - "Expected context to be unchanged, got %d\n", context); - ok(!lstrcmpA(targetsid, "kiwi"), - "Expected targetsid to be unchanged, got %s\n", targetsid); + ok(!lstrcmpA(patchcode, "apple"), "Expected patchcode to be unchanged, got %s\n", patchcode); + ok(!lstrcmpA(targetprod, "banana"), "Expected targetprod to be unchanged, got %s\n", targetprod); + ok(context == 0xdeadbeef, "Expected context to be unchanged, got %d\n", context); + ok(!lstrcmpA(targetsid, "kiwi"), "Expected targetsid to be unchanged, got %s\n", targetsid); ok(size == MAX_PATH, "Expected size to be unchanged, got %lu\n", size); res = RegCreateKeyExA(udprod, "Patches", 0, NULL, 0, access, NULL, &udpatch, NULL); @@ -10259,18 +9592,13 @@ static void test_MsiEnumPatchesEx_userunmanaged(LPCSTR usersid, LPCSTR expecteds context = 0xdeadbeef; lstrcpyA(targetsid, "kiwi"); size = MAX_PATH; - r = pMsiEnumPatchesExA(prodcode, usersid, MSIINSTALLCONTEXT_USERUNMANAGED, - MSIPATCHSTATE_SUPERSEDED, 0, patchcode, targetprod, - &context, targetsid, &size); + r = MsiEnumPatchesExA(prodcode, usersid, MSIINSTALLCONTEXT_USERUNMANAGED, MSIPATCHSTATE_SUPERSEDED, + 0, patchcode, targetprod, &context, targetsid, &size); ok(r == ERROR_NO_MORE_ITEMS, "Expected ERROR_NO_MORE_ITEMS, got %d\n", r); - ok(!lstrcmpA(patchcode, "apple"), - "Expected patchcode to be unchanged, got %s\n", patchcode); - ok(!lstrcmpA(targetprod, "banana"), - "Expected targetprod to be unchanged, got %s\n", targetprod); - ok(context == 0xdeadbeef, - "Expected context to be unchanged, got %d\n", context); - ok(!lstrcmpA(targetsid, "kiwi"), - "Expected targetsid to be unchanged, got %s\n", targetsid); + ok(!lstrcmpA(patchcode, "apple"), "Expected patchcode to be unchanged, got %s\n", patchcode); + ok(!lstrcmpA(targetprod, "banana"), "Expected targetprod to be unchanged, got %s\n", targetprod); + ok(context == 0xdeadbeef, "Expected context to be unchanged, got %d\n", context); + ok(!lstrcmpA(targetsid, "kiwi"), "Expected targetsid to be unchanged, got %s\n", targetsid); ok(size == MAX_PATH, "Expected size to be unchanged, got %lu\n", size); res = RegCreateKeyExA(udpatch, patch_squashed, 0, NULL, 0, access, NULL, &hpatch, NULL); @@ -10282,19 +9610,13 @@ static void test_MsiEnumPatchesEx_userunmanaged(LPCSTR usersid, LPCSTR expecteds context = 0xdeadbeef; lstrcpyA(targetsid, "kiwi"); size = MAX_PATH; - r = pMsiEnumPatchesExA(prodcode, usersid, MSIINSTALLCONTEXT_USERUNMANAGED, - MSIPATCHSTATE_SUPERSEDED, 0, patchcode, targetprod, - &context, targetsid, &size); - ok(r == ERROR_BAD_CONFIGURATION, - "Expected ERROR_BAD_CONFIGURATION, got %d\n", r); - ok(!lstrcmpA(patchcode, "apple"), - "Expected patchcode to be unchanged, got %s\n", patchcode); - ok(!lstrcmpA(targetprod, "banana"), - "Expected targetprod to be unchanged, got %s\n", targetprod); - ok(context == 0xdeadbeef, - "Expected context to be unchanged, got %d\n", context); - ok(!lstrcmpA(targetsid, "kiwi"), - "Expected targetsid to be unchanged, got %s\n", targetsid); + r = MsiEnumPatchesExA(prodcode, usersid, MSIINSTALLCONTEXT_USERUNMANAGED, MSIPATCHSTATE_SUPERSEDED, + 0, patchcode, targetprod, &context, targetsid, &size); + ok(r == ERROR_BAD_CONFIGURATION, "Expected ERROR_BAD_CONFIGURATION, got %d\n", r); + ok(!lstrcmpA(patchcode, "apple"), "Expected patchcode to be unchanged, got %s\n", patchcode); + ok(!lstrcmpA(targetprod, "banana"), "Expected targetprod to be unchanged, got %s\n", targetprod); + ok(context == 0xdeadbeef, "Expected context to be unchanged, got %d\n", context); + ok(!lstrcmpA(targetsid, "kiwi"), "Expected targetsid to be unchanged, got %s\n", targetsid); ok(size == MAX_PATH, "Expected size to be unchanged, got %lu\n", size); data = MSIPATCHSTATE_SUPERSEDED; @@ -10308,20 +9630,14 @@ static void test_MsiEnumPatchesEx_userunmanaged(LPCSTR usersid, LPCSTR expecteds context = 0xdeadbeef; lstrcpyA(targetsid, "kiwi"); size = MAX_PATH; - r = pMsiEnumPatchesExA(prodcode, usersid, MSIINSTALLCONTEXT_USERUNMANAGED, - MSIPATCHSTATE_SUPERSEDED, 0, patchcode, targetprod, - &context, targetsid, &size); - ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r); - ok(!lstrcmpA(patchcode, patch), - "Expected \"%s\", got \"%s\"\n", patch, patchcode); - ok(!lstrcmpA(targetprod, prodcode), - "Expected \"%s\", got \"%s\"\n", prodcode, targetprod); - ok(context == MSIINSTALLCONTEXT_USERUNMANAGED, - "Expected MSIINSTALLCONTEXT_USERUNMANAGED, got %d\n", context); - ok(!lstrcmpA(targetsid, expectedsid), - "Expected \"%s\", got \"%s\"\n", expectedsid, targetsid); - ok(size == lstrlenA(expectedsid), - "Expected %d, got %lu\n", lstrlenA(expectedsid), size); + r = MsiEnumPatchesExA(prodcode, usersid, MSIINSTALLCONTEXT_USERUNMANAGED, MSIPATCHSTATE_SUPERSEDED, + 0, patchcode, targetprod, &context, targetsid, &size); + ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r); + ok(!lstrcmpA(patchcode, patch), "Expected \"%s\", got \"%s\"\n", patch, patchcode); + ok(!lstrcmpA(targetprod, prodcode), "Expected \"%s\", got \"%s\"\n", prodcode, targetprod); + ok(context == MSIINSTALLCONTEXT_USERUNMANAGED, "Expected MSIINSTALLCONTEXT_USERUNMANAGED, got %d\n", context); + ok(!lstrcmpA(targetsid, expectedsid), "Expected \"%s\", got \"%s\"\n", expectedsid, targetsid); + ok(size == lstrlenA(expectedsid), "Expected %d, got %lu\n", lstrlenA(expectedsid), size); /* MSIPATCHSTATE_OBSOLETED */ @@ -10330,18 +9646,13 @@ static void test_MsiEnumPatchesEx_userunmanaged(LPCSTR usersid, LPCSTR expecteds context = 0xdeadbeef; lstrcpyA(targetsid, "kiwi"); size = MAX_PATH; - r = pMsiEnumPatchesExA(prodcode, usersid, MSIINSTALLCONTEXT_USERUNMANAGED, - MSIPATCHSTATE_OBSOLETED, 0, patchcode, targetprod, - &context, targetsid, &size); + r = MsiEnumPatchesExA(prodcode, usersid, MSIINSTALLCONTEXT_USERUNMANAGED, MSIPATCHSTATE_OBSOLETED, + 0, patchcode, targetprod, &context, targetsid, &size); ok(r == ERROR_NO_MORE_ITEMS, "Expected ERROR_NO_MORE_ITEMS, got %d\n", r); - ok(!lstrcmpA(patchcode, "apple"), - "Expected patchcode to be unchanged, got %s\n", patchcode); - ok(!lstrcmpA(targetprod, "banana"), - "Expected targetprod to be unchanged, got %s\n", targetprod); - ok(context == 0xdeadbeef, - "Expected context to be unchanged, got %d\n", context); - ok(!lstrcmpA(targetsid, "kiwi"), - "Expected targetsid to be unchanged, got %s\n", targetsid); + ok(!lstrcmpA(patchcode, "apple"), "Expected patchcode to be unchanged, got %s\n", patchcode); + ok(!lstrcmpA(targetprod, "banana"), "Expected targetprod to be unchanged, got %s\n", targetprod); + ok(context == 0xdeadbeef, "Expected context to be unchanged, got %d\n", context); + ok(!lstrcmpA(targetsid, "kiwi"), "Expected targetsid to be unchanged, got %s\n", targetsid); ok(size == MAX_PATH, "Expected size to be unchanged, got %lu\n", size); data = MSIPATCHSTATE_OBSOLETED; @@ -10355,20 +9666,14 @@ static void test_MsiEnumPatchesEx_userunmanaged(LPCSTR usersid, LPCSTR expecteds context = 0xdeadbeef; lstrcpyA(targetsid, "kiwi"); size = MAX_PATH; - r = pMsiEnumPatchesExA(prodcode, usersid, MSIINSTALLCONTEXT_USERUNMANAGED, - MSIPATCHSTATE_OBSOLETED, 0, patchcode, targetprod, - &context, targetsid, &size); - ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r); - ok(!lstrcmpA(patchcode, patch), - "Expected \"%s\", got \"%s\"\n", patch, patchcode); - ok(!lstrcmpA(targetprod, prodcode), - "Expected \"%s\", got \"%s\"\n", prodcode, targetprod); - ok(context == MSIINSTALLCONTEXT_USERUNMANAGED, - "Expected MSIINSTALLCONTEXT_USERUNMANAGED, got %d\n", context); - ok(!lstrcmpA(targetsid, expectedsid), - "Expected \"%s\", got \"%s\"\n", expectedsid, targetsid); - ok(size == lstrlenA(expectedsid), - "Expected %d, got %lu\n", lstrlenA(expectedsid), size); + r = MsiEnumPatchesExA(prodcode, usersid, MSIINSTALLCONTEXT_USERUNMANAGED, MSIPATCHSTATE_OBSOLETED, + 0, patchcode, targetprod, &context, targetsid, &size); + ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r); + ok(!lstrcmpA(patchcode, patch), "Expected \"%s\", got \"%s\"\n", patch, patchcode); + ok(!lstrcmpA(targetprod, prodcode), "Expected \"%s\", got \"%s\"\n", prodcode, targetprod); + ok(context == MSIINSTALLCONTEXT_USERUNMANAGED, "Expected MSIINSTALLCONTEXT_USERUNMANAGED, got %d\n", context); + ok(!lstrcmpA(targetsid, expectedsid), "Expected \"%s\", got \"%s\"\n", expectedsid, targetsid); + ok(size == lstrlenA(expectedsid), "Expected %d, got %lu\n", lstrlenA(expectedsid), size); /* MSIPATCHSTATE_REGISTERED */ /* FIXME */ @@ -10381,20 +9686,14 @@ static void test_MsiEnumPatchesEx_userunmanaged(LPCSTR usersid, LPCSTR expecteds context = 0xdeadbeef; lstrcpyA(targetsid, "kiwi"); size = MAX_PATH; - r = pMsiEnumPatchesExA(prodcode, usersid, MSIINSTALLCONTEXT_USERUNMANAGED, - MSIPATCHSTATE_ALL, 0, patchcode, targetprod, - &context, targetsid, &size); - ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r); - ok(!lstrcmpA(patchcode, patch), - "Expected \"%s\", got \"%s\"\n", patch, patchcode); - ok(!lstrcmpA(targetprod, prodcode), - "Expected \"%s\", got \"%s\"\n", prodcode, targetprod); - ok(context == MSIINSTALLCONTEXT_USERUNMANAGED, - "Expected MSIINSTALLCONTEXT_USERUNMANAGED, got %d\n", context); - ok(!lstrcmpA(targetsid, expectedsid), - "Expected \"%s\", got \"%s\"\n", expectedsid, targetsid); - ok(size == lstrlenA(expectedsid), - "Expected %d, got %lu\n", lstrlenA(expectedsid), size); + r = MsiEnumPatchesExA(prodcode, usersid, MSIINSTALLCONTEXT_USERUNMANAGED, MSIPATCHSTATE_ALL, + 0, patchcode, targetprod, &context, targetsid, &size); + ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r); + ok(!lstrcmpA(patchcode, patch), "Expected \"%s\", got \"%s\"\n", patch, patchcode); + ok(!lstrcmpA(targetprod, prodcode), "Expected \"%s\", got \"%s\"\n", prodcode, targetprod); + ok(context == MSIINSTALLCONTEXT_USERUNMANAGED, "Expected MSIINSTALLCONTEXT_USERUNMANAGED, got %d\n", context); + ok(!lstrcmpA(targetsid, expectedsid), "Expected \"%s\", got \"%s\"\n", expectedsid, targetsid); + ok(size == lstrlenA(expectedsid), "Expected %d, got %lu\n", lstrlenA(expectedsid), size); /* same patch in multiple places, only one is enumerated */ lstrcpyA(patchcode, "apple"); @@ -10402,28 +9701,23 @@ static void test_MsiEnumPatchesEx_userunmanaged(LPCSTR usersid, LPCSTR expecteds context = 0xdeadbeef; lstrcpyA(targetsid, "kiwi"); size = MAX_PATH; - r = pMsiEnumPatchesExA(prodcode, usersid, MSIINSTALLCONTEXT_USERUNMANAGED, - MSIPATCHSTATE_ALL, 1, patchcode, targetprod, - &context, targetsid, &size); + r = MsiEnumPatchesExA(prodcode, usersid, MSIINSTALLCONTEXT_USERUNMANAGED, MSIPATCHSTATE_ALL, + 1, patchcode, targetprod, &context, targetsid, &size); ok(r == ERROR_NO_MORE_ITEMS, "Expected ERROR_NO_MORE_ITEMS, got %d\n", r); - ok(!lstrcmpA(patchcode, "apple"), - "Expected patchcode to be unchanged, got %s\n", patchcode); - ok(!lstrcmpA(targetprod, "banana"), - "Expected targetprod to be unchanged, got %s\n", targetprod); - ok(context == 0xdeadbeef, - "Expected context to be unchanged, got %d\n", context); - ok(!lstrcmpA(targetsid, "kiwi"), - "Expected targetsid to be unchanged, got %s\n", targetsid); + ok(!lstrcmpA(patchcode, "apple"), "Expected patchcode to be unchanged, got %s\n", patchcode); + ok(!lstrcmpA(targetprod, "banana"), "Expected targetprod to be unchanged, got %s\n", targetprod); + ok(context == 0xdeadbeef, "Expected context to be unchanged, got %d\n", context); + ok(!lstrcmpA(targetsid, "kiwi"), "Expected targetsid to be unchanged, got %s\n", targetsid); ok(size == MAX_PATH, "Expected size to be unchanged, got %lu\n", size); RegDeleteValueA(hpatch, "State"); - delete_key(hpatch, "", access & KEY_WOW64_64KEY); + RegDeleteKeyExA(hpatch, "", access & KEY_WOW64_64KEY, 0); RegCloseKey(hpatch); - delete_key(udpatch, "", access & KEY_WOW64_64KEY); + RegDeleteKeyExA(udpatch, "", access & KEY_WOW64_64KEY, 0); RegCloseKey(udpatch); - delete_key(udprod, "", access & KEY_WOW64_64KEY); + RegDeleteKeyExA(udprod, "", access & KEY_WOW64_64KEY, 0); RegCloseKey(udprod); - delete_key(userkey, "", access & KEY_WOW64_64KEY); + RegDeleteKeyExA(userkey, "", access & KEY_WOW64_64KEY, 0); RegCloseKey(userkey); RegDeleteValueA(patches, patch_squashed); RegDeleteValueA(patches, "Patches"); @@ -10462,18 +9756,13 @@ static void test_MsiEnumPatchesEx_machine(void) context = 0xdeadbeef; lstrcpyA(targetsid, "kiwi"); size = MAX_PATH; - r = pMsiEnumPatchesExA(prodcode, NULL, MSIINSTALLCONTEXT_MACHINE, - MSIPATCHSTATE_APPLIED, 0, patchcode, targetprod, - &context, targetsid, &size); + r = MsiEnumPatchesExA(prodcode, NULL, MSIINSTALLCONTEXT_MACHINE, MSIPATCHSTATE_APPLIED, + 0, patchcode, targetprod, &context, targetsid, &size); ok(r == ERROR_NO_MORE_ITEMS, "Expected ERROR_NO_MORE_ITEMS, got %d\n", r); - ok(!lstrcmpA(patchcode, "apple"), - "Expected patchcode to be unchanged, got %s\n", patchcode); - ok(!lstrcmpA(targetprod, "banana"), - "Expected targetprod to be unchanged, got %s\n", targetprod); - ok(context == 0xdeadbeef, - "Expected context to be unchanged, got %d\n", context); - ok(!lstrcmpA(targetsid, "kiwi"), - "Expected targetsid to be unchanged, got %s\n", targetsid); + ok(!lstrcmpA(patchcode, "apple"), "Expected patchcode to be unchanged, got %s\n", patchcode); + ok(!lstrcmpA(targetprod, "banana"), "Expected targetprod to be unchanged, got %s\n", targetprod); + ok(context == 0xdeadbeef, "Expected context to be unchanged, got %d\n", context); + ok(!lstrcmpA(targetsid, "kiwi"), "Expected targetsid to be unchanged, got %s\n", targetsid); ok(size == MAX_PATH, "Expected size to be unchanged, got %lu\n", size); lstrcpyA(keypath, "Software\\Classes\\Installer\\Products\\"); @@ -10493,18 +9782,13 @@ static void test_MsiEnumPatchesEx_machine(void) context = 0xdeadbeef; lstrcpyA(targetsid, "kiwi"); size = MAX_PATH; - r = pMsiEnumPatchesExA(prodcode, NULL, MSIINSTALLCONTEXT_MACHINE, - MSIPATCHSTATE_APPLIED, 0, patchcode, targetprod, - &context, targetsid, &size); + r = MsiEnumPatchesExA(prodcode, NULL, MSIINSTALLCONTEXT_MACHINE, MSIPATCHSTATE_APPLIED, + 0, patchcode, targetprod, &context, targetsid, &size); ok(r == ERROR_NO_MORE_ITEMS, "Expected ERROR_NO_MORE_ITEMS, got %d\n", r); - ok(!lstrcmpA(patchcode, "apple"), - "Expected patchcode to be unchanged, got %s\n", patchcode); - ok(!lstrcmpA(targetprod, "banana"), - "Expected targetprod to be unchanged, got %s\n", targetprod); - ok(context == 0xdeadbeef, - "Expected context to be unchanged, got %d\n", context); - ok(!lstrcmpA(targetsid, "kiwi"), - "Expected targetsid to be unchanged, got %s\n", targetsid); + ok(!lstrcmpA(patchcode, "apple"), "Expected patchcode to be unchanged, got %s\n", patchcode); + ok(!lstrcmpA(targetprod, "banana"), "Expected targetprod to be unchanged, got %s\n", targetprod); + ok(context == 0xdeadbeef, "Expected context to be unchanged, got %d\n", context); + ok(!lstrcmpA(targetsid, "kiwi"), "Expected targetsid to be unchanged, got %s\n", targetsid); ok(size == MAX_PATH, "Expected size to be unchanged, got %lu\n", size); res = RegCreateKeyExA(prodkey, "Patches", 0, NULL, 0, access, NULL, &patches, NULL); @@ -10516,18 +9800,13 @@ static void test_MsiEnumPatchesEx_machine(void) context = 0xdeadbeef; lstrcpyA(targetsid, "kiwi"); size = MAX_PATH; - r = pMsiEnumPatchesExA(prodcode, NULL, MSIINSTALLCONTEXT_MACHINE, - MSIPATCHSTATE_APPLIED, 0, patchcode, targetprod, - &context, targetsid, &size); + r = MsiEnumPatchesExA(prodcode, NULL, MSIINSTALLCONTEXT_MACHINE, MSIPATCHSTATE_APPLIED, + 0, patchcode, targetprod, &context, targetsid, &size); ok(r == ERROR_NO_MORE_ITEMS, "Expected ERROR_NO_MORE_ITEMS, got %d\n", r); - ok(!lstrcmpA(patchcode, "apple"), - "Expected patchcode to be unchanged, got %s\n", patchcode); - ok(!lstrcmpA(targetprod, "banana"), - "Expected targetprod to be unchanged, got %s\n", targetprod); - ok(context == 0xdeadbeef, - "Expected context to be unchanged, got %d\n", context); - ok(!lstrcmpA(targetsid, "kiwi"), - "Expected targetsid to be unchanged, got %s\n", targetsid); + ok(!lstrcmpA(patchcode, "apple"), "Expected patchcode to be unchanged, got %s\n", patchcode); + ok(!lstrcmpA(targetprod, "banana"), "Expected targetprod to be unchanged, got %s\n", targetprod); + ok(context == 0xdeadbeef, "Expected context to be unchanged, got %d\n", context); + ok(!lstrcmpA(targetsid, "kiwi"), "Expected targetsid to be unchanged, got %s\n", targetsid); ok(size == MAX_PATH, "Expected size to be unchanged, got %lu\n", size); res = RegSetValueExA(patches, "Patches", 0, REG_SZ, @@ -10541,19 +9820,13 @@ static void test_MsiEnumPatchesEx_machine(void) context = 0xdeadbeef; lstrcpyA(targetsid, "kiwi"); size = MAX_PATH; - r = pMsiEnumPatchesExA(prodcode, NULL, MSIINSTALLCONTEXT_MACHINE, - MSIPATCHSTATE_APPLIED, 0, patchcode, targetprod, - &context, targetsid, &size); - ok(r == ERROR_BAD_CONFIGURATION, - "Expected ERROR_BAD_CONFIGURATION, got %d\n", r); - ok(!lstrcmpA(patchcode, "apple"), - "Expected patchcode to be unchanged, got %s\n", patchcode); - ok(!lstrcmpA(targetprod, "banana"), - "Expected targetprod to be unchanged, got %s\n", targetprod); - ok(context == 0xdeadbeef, - "Expected context to be unchanged, got %d\n", context); - ok(!lstrcmpA(targetsid, "kiwi"), - "Expected targetsid to be unchanged, got %s\n", targetsid); + r = MsiEnumPatchesExA(prodcode, NULL, MSIINSTALLCONTEXT_MACHINE, MSIPATCHSTATE_APPLIED, + 0, patchcode, targetprod, &context, targetsid, &size); + ok(r == ERROR_BAD_CONFIGURATION, "Expected ERROR_BAD_CONFIGURATION, got %d\n", r); + ok(!lstrcmpA(patchcode, "apple"), "Expected patchcode to be unchanged, got %s\n", patchcode); + ok(!lstrcmpA(targetprod, "banana"), "Expected targetprod to be unchanged, got %s\n", targetprod); + ok(context == 0xdeadbeef, "Expected context to be unchanged, got %d\n", context); + ok(!lstrcmpA(targetsid, "kiwi"), "Expected targetsid to be unchanged, got %s\n", targetsid); ok(size == MAX_PATH, "Expected size to be unchanged, got %lu\n", size); res = RegSetValueExA(patches, "Patches", 0, REG_MULTI_SZ, @@ -10566,19 +9839,13 @@ static void test_MsiEnumPatchesEx_machine(void) context = 0xdeadbeef; lstrcpyA(targetsid, "kiwi"); size = MAX_PATH; - r = pMsiEnumPatchesExA(prodcode, NULL, MSIINSTALLCONTEXT_MACHINE, - MSIPATCHSTATE_APPLIED, 0, patchcode, targetprod, - &context, targetsid, &size); - ok(r == ERROR_BAD_CONFIGURATION, - "Expected ERROR_BAD_CONFIGURATION, got %d\n", r); - ok(!lstrcmpA(patchcode, "apple"), - "Expected patchcode to be unchanged, got %s\n", patchcode); - ok(!lstrcmpA(targetprod, "banana"), - "Expected targetprod to be unchanged, got %s\n", targetprod); - ok(context == 0xdeadbeef, - "Expected context to be unchanged, got %d\n", context); - ok(!lstrcmpA(targetsid, "kiwi"), - "Expected targetsid to be unchanged, got %s\n", targetsid); + r = MsiEnumPatchesExA(prodcode, NULL, MSIINSTALLCONTEXT_MACHINE, MSIPATCHSTATE_APPLIED, + 0, patchcode, targetprod, &context, targetsid, &size); + ok(r == ERROR_BAD_CONFIGURATION, "Expected ERROR_BAD_CONFIGURATION, got %d\n", r); + ok(!lstrcmpA(patchcode, "apple"), "Expected patchcode to be unchanged, got %s\n", patchcode); + ok(!lstrcmpA(targetprod, "banana"), "Expected targetprod to be unchanged, got %s\n", targetprod); + ok(context == 0xdeadbeef, "Expected context to be unchanged, got %d\n", context); + ok(!lstrcmpA(targetsid, "kiwi"), "Expected targetsid to be unchanged, got %s\n", targetsid); ok(size == MAX_PATH, "Expected size to be unchanged, got %lu\n", size); patch_squashed[lstrlenA(patch_squashed) + 1] = '\0'; @@ -10593,18 +9860,13 @@ static void test_MsiEnumPatchesEx_machine(void) context = 0xdeadbeef; lstrcpyA(targetsid, "kiwi"); size = MAX_PATH; - r = pMsiEnumPatchesExA(prodcode, NULL, MSIINSTALLCONTEXT_MACHINE, - MSIPATCHSTATE_APPLIED, 0, patchcode, targetprod, - &context, targetsid, &size); + r = MsiEnumPatchesExA(prodcode, NULL, MSIINSTALLCONTEXT_MACHINE, MSIPATCHSTATE_APPLIED, + 0, patchcode, targetprod, &context, targetsid, &size); ok(r == ERROR_NO_MORE_ITEMS, "Expected ERROR_NO_MORE_ITEMS, got %d\n", r); - ok(!lstrcmpA(patchcode, "apple"), - "Expected patchcode to be unchanged, got %s\n", patchcode); - ok(!lstrcmpA(targetprod, "banana"), - "Expected targetprod to be unchanged, got %s\n", targetprod); - ok(context == 0xdeadbeef, - "Expected context to be unchanged, got %d\n", context); - ok(!lstrcmpA(targetsid, "kiwi"), - "Expected targetsid to be unchanged, got %s\n", targetsid); + ok(!lstrcmpA(patchcode, "apple"), "Expected patchcode to be unchanged, got %s\n", patchcode); + ok(!lstrcmpA(targetprod, "banana"), "Expected targetprod to be unchanged, got %s\n", targetprod); + ok(context == 0xdeadbeef, "Expected context to be unchanged, got %d\n", context); + ok(!lstrcmpA(targetsid, "kiwi"), "Expected targetsid to be unchanged, got %s\n", targetsid); ok(size == MAX_PATH, "Expected size to be unchanged, got %lu\n", size); res = RegSetValueExA(patches, patch_squashed, 0, REG_SZ, @@ -10617,16 +9879,12 @@ static void test_MsiEnumPatchesEx_machine(void) context = 0xdeadbeef; lstrcpyA(targetsid, "kiwi"); size = MAX_PATH; - r = pMsiEnumPatchesExA(prodcode, NULL, MSIINSTALLCONTEXT_MACHINE, - MSIPATCHSTATE_APPLIED, 0, patchcode, targetprod, - &context, targetsid, &size); + r = MsiEnumPatchesExA(prodcode, NULL, MSIINSTALLCONTEXT_MACHINE, MSIPATCHSTATE_APPLIED, + 0, patchcode, targetprod, &context, targetsid, &size); ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r); - ok(!lstrcmpA(patchcode, patch), - "Expected \"%s\", got \"%s\"\n", patch, patchcode); - ok(!lstrcmpA(targetprod, prodcode), - "Expected \"%s\", got \"%s\"\n", prodcode, targetprod); - ok(context == MSIINSTALLCONTEXT_MACHINE, - "Expected MSIINSTALLCONTEXT_MACHINE, got %d\n", context); + ok(!lstrcmpA(patchcode, patch), "Expected \"%s\", got \"%s\"\n", patch, patchcode); + ok(!lstrcmpA(targetprod, prodcode), "Expected \"%s\", got \"%s\"\n", prodcode, targetprod); + ok(context == MSIINSTALLCONTEXT_MACHINE, "Expected MSIINSTALLCONTEXT_MACHINE, got %d\n", context); ok(!lstrcmpA(targetsid, ""), "Expected \"\", got \"%s\"\n", targetsid); ok(size == 0, "Expected 0, got %lu\n", size); @@ -10648,18 +9906,13 @@ static void test_MsiEnumPatchesEx_machine(void) context = 0xdeadbeef; lstrcpyA(targetsid, "kiwi"); size = MAX_PATH; - r = pMsiEnumPatchesExA(prodcode, NULL, MSIINSTALLCONTEXT_MACHINE, - MSIPATCHSTATE_APPLIED, 0, patchcode, targetprod, - &context, targetsid, &size); - ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r); - ok(!lstrcmpA(patchcode, patch), - "Expected \"%s\", got \"%s\"\n", patch, patchcode); - ok(!lstrcmpA(targetprod, prodcode), - "Expected \"%s\", got \"%s\"\n", prodcode, targetprod); - ok(context == MSIINSTALLCONTEXT_MACHINE, - "Expected MSIINSTALLCONTEXT_MACHINE, got %d\n", context); - ok(!lstrcmpA(targetsid, ""), - "Expected \"\", got \"%s\"\n", targetsid); + r = MsiEnumPatchesExA(prodcode, NULL, MSIINSTALLCONTEXT_MACHINE, MSIPATCHSTATE_APPLIED, + 0, patchcode, targetprod, &context, targetsid, &size); + ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r); + ok(!lstrcmpA(patchcode, patch), "Expected \"%s\", got \"%s\"\n", patch, patchcode); + ok(!lstrcmpA(targetprod, prodcode), "Expected \"%s\", got \"%s\"\n", prodcode, targetprod); + ok(context == MSIINSTALLCONTEXT_MACHINE, "Expected MSIINSTALLCONTEXT_MACHINE, got %d\n", context); + ok(!lstrcmpA(targetsid, ""), "Expected \"\", got \"%s\"\n", targetsid); ok(size == 0, "Expected 0, got %lu\n", size); res = RegCreateKeyExA(udprod, "Patches", 0, NULL, 0, access, NULL, &udpatch, NULL); @@ -10671,18 +9924,13 @@ static void test_MsiEnumPatchesEx_machine(void) context = 0xdeadbeef; lstrcpyA(targetsid, "kiwi"); size = MAX_PATH; - r = pMsiEnumPatchesExA(prodcode, NULL, MSIINSTALLCONTEXT_MACHINE, - MSIPATCHSTATE_APPLIED, 0, patchcode, targetprod, - &context, targetsid, &size); - ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r); - ok(!lstrcmpA(patchcode, patch), - "Expected \"%s\", got \"%s\"\n", patch, patchcode); - ok(!lstrcmpA(targetprod, prodcode), - "Expected \"%s\", got \"%s\"\n", prodcode, targetprod); - ok(context == MSIINSTALLCONTEXT_MACHINE, - "Expected MSIINSTALLCONTEXT_MACHINE, got %d\n", context); - ok(!lstrcmpA(targetsid, ""), - "Expected \"\", got \"%s\"\n", targetsid); + r = MsiEnumPatchesExA(prodcode, NULL, MSIINSTALLCONTEXT_MACHINE, MSIPATCHSTATE_APPLIED, + 0, patchcode, targetprod, &context, targetsid, &size); + ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r); + ok(!lstrcmpA(patchcode, patch), "Expected \"%s\", got \"%s\"\n", patch, patchcode); + ok(!lstrcmpA(targetprod, prodcode), "Expected \"%s\", got \"%s\"\n", prodcode, targetprod); + ok(context == MSIINSTALLCONTEXT_MACHINE, "Expected MSIINSTALLCONTEXT_MACHINE, got %d\n", context); + ok(!lstrcmpA(targetsid, ""), "Expected \"\", got \"%s\"\n", targetsid); ok(size == 0, "Expected 0, got %lu\n", size); res = RegCreateKeyExA(udpatch, patch_squashed, 0, NULL, 0, access, NULL, &hpatch, NULL); @@ -10694,18 +9942,13 @@ static void test_MsiEnumPatchesEx_machine(void) context = 0xdeadbeef; lstrcpyA(targetsid, "kiwi"); size = MAX_PATH; - r = pMsiEnumPatchesExA(prodcode, NULL, MSIINSTALLCONTEXT_MACHINE, - MSIPATCHSTATE_APPLIED, 0, patchcode, targetprod, - &context, targetsid, &size); + r = MsiEnumPatchesExA(prodcode, NULL, MSIINSTALLCONTEXT_MACHINE, MSIPATCHSTATE_APPLIED, + 0, patchcode, targetprod, &context, targetsid, &size); ok(r == ERROR_NO_MORE_ITEMS, "Expected ERROR_NO_MORE_ITEMS, got %d\n", r); - ok(!lstrcmpA(patchcode, "apple"), - "Expected patchcode to be unchanged, got %s\n", patchcode); - ok(!lstrcmpA(targetprod, "banana"), - "Expected targetprod to be unchanged, got %s\n", targetprod); - ok(context == 0xdeadbeef, - "Expected context to be unchanged, got %d\n", context); - ok(!lstrcmpA(targetsid, "kiwi"), - "Expected targetsid to be unchanged, got %s\n", targetsid); + ok(!lstrcmpA(patchcode, "apple"), "Expected patchcode to be unchanged, got %s\n", patchcode); + ok(!lstrcmpA(targetprod, "banana"), "Expected targetprod to be unchanged, got %s\n", targetprod); + ok(context == 0xdeadbeef, "Expected context to be unchanged, got %d\n", context); + ok(!lstrcmpA(targetsid, "kiwi"), "Expected targetsid to be unchanged, got %s\n", targetsid); ok(size == MAX_PATH, "Expected size to be unchanged, got %lu\n", size); data = MSIPATCHSTATE_APPLIED; @@ -10719,18 +9962,13 @@ static void test_MsiEnumPatchesEx_machine(void) context = 0xdeadbeef; lstrcpyA(targetsid, "kiwi"); size = MAX_PATH; - r = pMsiEnumPatchesExA(prodcode, NULL, MSIINSTALLCONTEXT_MACHINE, - MSIPATCHSTATE_APPLIED, 0, patchcode, targetprod, - &context, targetsid, &size); - ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r); - ok(!lstrcmpA(patchcode, patch), - "Expected \"%s\", got \"%s\"\n", patch, patchcode); - ok(!lstrcmpA(targetprod, prodcode), - "Expected \"%s\", got \"%s\"\n", prodcode, targetprod); - ok(context == MSIINSTALLCONTEXT_MACHINE, - "Expected MSIINSTALLCONTEXT_MACHINE, got %d\n", context); - ok(!lstrcmpA(targetsid, ""), - "Expected \"\", got \"%s\"\n", targetsid); + r = MsiEnumPatchesExA(prodcode, NULL, MSIINSTALLCONTEXT_MACHINE, MSIPATCHSTATE_APPLIED, + 0, patchcode, targetprod, &context, targetsid, &size); + ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r); + ok(!lstrcmpA(patchcode, patch), "Expected \"%s\", got \"%s\"\n", patch, patchcode); + ok(!lstrcmpA(targetprod, prodcode), "Expected \"%s\", got \"%s\"\n", prodcode, targetprod); + ok(context == MSIINSTALLCONTEXT_MACHINE, "Expected MSIINSTALLCONTEXT_MACHINE, got %d\n", context); + ok(!lstrcmpA(targetsid, ""), "Expected \"\", got \"%s\"\n", targetsid); ok(size == 0, "Expected 0, got %lu\n", size); /* MSIPATCHSTATE_SUPERSEDED */ @@ -10740,18 +9978,13 @@ static void test_MsiEnumPatchesEx_machine(void) context = 0xdeadbeef; lstrcpyA(targetsid, "kiwi"); size = MAX_PATH; - r = pMsiEnumPatchesExA(prodcode, NULL, MSIINSTALLCONTEXT_MACHINE, - MSIPATCHSTATE_SUPERSEDED, 0, patchcode, targetprod, - &context, targetsid, &size); + r = MsiEnumPatchesExA(prodcode, NULL, MSIINSTALLCONTEXT_MACHINE, MSIPATCHSTATE_SUPERSEDED, + 0, patchcode, targetprod, &context, targetsid, &size); ok(r == ERROR_NO_MORE_ITEMS, "Expected ERROR_NO_MORE_ITEMS, got %d\n", r); - ok(!lstrcmpA(patchcode, "apple"), - "Expected patchcode to be unchanged, got %s\n", patchcode); - ok(!lstrcmpA(targetprod, "banana"), - "Expected targetprod to be unchanged, got %s\n", targetprod); - ok(context == 0xdeadbeef, - "Expected context to be unchanged, got %d\n", context); - ok(!lstrcmpA(targetsid, "kiwi"), - "Expected targetsid to be unchanged, got %s\n", targetsid); + ok(!lstrcmpA(patchcode, "apple"), "Expected patchcode to be unchanged, got %s\n", patchcode); + ok(!lstrcmpA(targetprod, "banana"), "Expected targetprod to be unchanged, got %s\n", targetprod); + ok(context == 0xdeadbeef, "Expected context to be unchanged, got %d\n", context); + ok(!lstrcmpA(targetsid, "kiwi"), "Expected targetsid to be unchanged, got %s\n", targetsid); ok(size == MAX_PATH, "Expected size to be unchanged, got %lu\n", size); data = MSIPATCHSTATE_SUPERSEDED; @@ -10765,16 +9998,12 @@ static void test_MsiEnumPatchesEx_machine(void) context = 0xdeadbeef; lstrcpyA(targetsid, "kiwi"); size = MAX_PATH; - r = pMsiEnumPatchesExA(prodcode, NULL, MSIINSTALLCONTEXT_MACHINE, - MSIPATCHSTATE_SUPERSEDED, 0, patchcode, targetprod, - &context, targetsid, &size); + r = MsiEnumPatchesExA(prodcode, NULL, MSIINSTALLCONTEXT_MACHINE, MSIPATCHSTATE_SUPERSEDED, + 0, patchcode, targetprod, &context, targetsid, &size); ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r); - ok(!lstrcmpA(patchcode, patch), - "Expected \"%s\", got \"%s\"\n", patch, patchcode); - ok(!lstrcmpA(targetprod, prodcode), - "Expected \"%s\", got \"%s\"\n", prodcode, targetprod); - ok(context == MSIINSTALLCONTEXT_MACHINE, - "Expected MSIINSTALLCONTEXT_MACHINE, got %d\n", context); + ok(!lstrcmpA(patchcode, patch), "Expected \"%s\", got \"%s\"\n", patch, patchcode); + ok(!lstrcmpA(targetprod, prodcode), "Expected \"%s\", got \"%s\"\n", prodcode, targetprod); + ok(context == MSIINSTALLCONTEXT_MACHINE, "Expected MSIINSTALLCONTEXT_MACHINE, got %d\n", context); ok(!lstrcmpA(targetsid, ""), "Expected \"\", got \"%s\"\n", targetsid); ok(size == 0, "Expected 0, got %lu\n", size); @@ -10785,18 +10014,13 @@ static void test_MsiEnumPatchesEx_machine(void) context = 0xdeadbeef; lstrcpyA(targetsid, "kiwi"); size = MAX_PATH; - r = pMsiEnumPatchesExA(prodcode, NULL, MSIINSTALLCONTEXT_MACHINE, - MSIPATCHSTATE_OBSOLETED, 0, patchcode, targetprod, - &context, targetsid, &size); + r = MsiEnumPatchesExA(prodcode, NULL, MSIINSTALLCONTEXT_MACHINE, MSIPATCHSTATE_OBSOLETED, + 0, patchcode, targetprod, &context, targetsid, &size); ok(r == ERROR_NO_MORE_ITEMS, "Expected ERROR_NO_MORE_ITEMS, got %d\n", r); - ok(!lstrcmpA(patchcode, "apple"), - "Expected patchcode to be unchanged, got %s\n", patchcode); - ok(!lstrcmpA(targetprod, "banana"), - "Expected targetprod to be unchanged, got %s\n", targetprod); - ok(context == 0xdeadbeef, - "Expected context to be unchanged, got %d\n", context); - ok(!lstrcmpA(targetsid, "kiwi"), - "Expected targetsid to be unchanged, got %s\n", targetsid); + ok(!lstrcmpA(patchcode, "apple"), "Expected patchcode to be unchanged, got %s\n", patchcode); + ok(!lstrcmpA(targetprod, "banana"), "Expected targetprod to be unchanged, got %s\n", targetprod); + ok(context == 0xdeadbeef, "Expected context to be unchanged, got %d\n", context); + ok(!lstrcmpA(targetsid, "kiwi"), "Expected targetsid to be unchanged, got %s\n", targetsid); ok(size == MAX_PATH, "Expected size to be unchanged, got %lu\n", size); data = MSIPATCHSTATE_OBSOLETED; @@ -10810,16 +10034,12 @@ static void test_MsiEnumPatchesEx_machine(void) context = 0xdeadbeef; lstrcpyA(targetsid, "kiwi"); size = MAX_PATH; - r = pMsiEnumPatchesExA(prodcode, NULL, MSIINSTALLCONTEXT_MACHINE, - MSIPATCHSTATE_OBSOLETED, 0, patchcode, targetprod, - &context, targetsid, &size); + r = MsiEnumPatchesExA(prodcode, NULL, MSIINSTALLCONTEXT_MACHINE, MSIPATCHSTATE_OBSOLETED, + 0, patchcode, targetprod, &context, targetsid, &size); ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r); - ok(!lstrcmpA(patchcode, patch), - "Expected \"%s\", got \"%s\"\n", patch, patchcode); - ok(!lstrcmpA(targetprod, prodcode), - "Expected \"%s\", got \"%s\"\n", prodcode, targetprod); - ok(context == MSIINSTALLCONTEXT_MACHINE, - "Expected MSIINSTALLCONTEXT_MACHINE, got %d\n", context); + ok(!lstrcmpA(patchcode, patch), "Expected \"%s\", got \"%s\"\n", patch, patchcode); + ok(!lstrcmpA(targetprod, prodcode), "Expected \"%s\", got \"%s\"\n", prodcode, targetprod); + ok(context == MSIINSTALLCONTEXT_MACHINE, "Expected MSIINSTALLCONTEXT_MACHINE, got %d\n", context); ok(!lstrcmpA(targetsid, ""), "Expected \"\", got \"%s\"\n", targetsid); ok(size == 0, "Expected 0, got %lu\n", size); @@ -10834,16 +10054,12 @@ static void test_MsiEnumPatchesEx_machine(void) context = 0xdeadbeef; lstrcpyA(targetsid, "kiwi"); size = MAX_PATH; - r = pMsiEnumPatchesExA(prodcode, NULL, MSIINSTALLCONTEXT_MACHINE, - MSIPATCHSTATE_ALL, 0, patchcode, targetprod, - &context, targetsid, &size); + r = MsiEnumPatchesExA(prodcode, NULL, MSIINSTALLCONTEXT_MACHINE, MSIPATCHSTATE_ALL, + 0, patchcode, targetprod, &context, targetsid, &size); ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r); - ok(!lstrcmpA(patchcode, patch), - "Expected \"%s\", got \"%s\"\n", patch, patchcode); - ok(!lstrcmpA(targetprod, prodcode), - "Expected \"%s\", got \"%s\"\n", prodcode, targetprod); - ok(context == MSIINSTALLCONTEXT_MACHINE, - "Expected MSIINSTALLCONTEXT_MACHINE, got %d\n", context); + ok(!lstrcmpA(patchcode, patch), "Expected \"%s\", got \"%s\"\n", patch, patchcode); + ok(!lstrcmpA(targetprod, prodcode), "Expected \"%s\", got \"%s\"\n", prodcode, targetprod); + ok(context == MSIINSTALLCONTEXT_MACHINE, "Expected MSIINSTALLCONTEXT_MACHINE, got %d\n", context); ok(!lstrcmpA(targetsid, ""), "Expected \"\", got \"%s\"\n", targetsid); ok(size == 0, "Expected 0, got %lu\n", size); @@ -10853,34 +10069,29 @@ static void test_MsiEnumPatchesEx_machine(void) context = 0xdeadbeef; lstrcpyA(targetsid, "kiwi"); size = MAX_PATH; - r = pMsiEnumPatchesExA(prodcode, NULL, MSIINSTALLCONTEXT_MACHINE, - MSIPATCHSTATE_ALL, 1, patchcode, targetprod, - &context, targetsid, &size); + r = MsiEnumPatchesExA(prodcode, NULL, MSIINSTALLCONTEXT_MACHINE, MSIPATCHSTATE_ALL, + 1, patchcode, targetprod, &context, targetsid, &size); ok(r == ERROR_NO_MORE_ITEMS, "Expected ERROR_NO_MORE_ITEMS, got %d\n", r); - ok(!lstrcmpA(patchcode, "apple"), - "Expected patchcode to be unchanged, got %s\n", patchcode); - ok(!lstrcmpA(targetprod, "banana"), - "Expected targetprod to be unchanged, got %s\n", targetprod); - ok(context == 0xdeadbeef, - "Expected context to be unchanged, got %d\n", context); - ok(!lstrcmpA(targetsid, "kiwi"), - "Expected targetsid to be unchanged, got %s\n", targetsid); + ok(!lstrcmpA(patchcode, "apple"), "Expected patchcode to be unchanged, got %s\n", patchcode); + ok(!lstrcmpA(targetprod, "banana"), "Expected targetprod to be unchanged, got %s\n", targetprod); + ok(context == 0xdeadbeef, "Expected context to be unchanged, got %d\n", context); + ok(!lstrcmpA(targetsid, "kiwi"), "Expected targetsid to be unchanged, got %s\n", targetsid); ok(size == MAX_PATH, "Expected size to be unchanged, got %lu\n", size); - delete_key(hpatch, "", access & KEY_WOW64_64KEY); + RegDeleteKeyExA(hpatch, "", access & KEY_WOW64_64KEY, 0); RegDeleteValueA(hpatch, "State"); RegCloseKey(hpatch); - delete_key(udpatch, "", access & KEY_WOW64_64KEY); + RegDeleteKeyExA(udpatch, "", access & KEY_WOW64_64KEY, 0); RegCloseKey(udpatch); - delete_key(udprod, "", access & KEY_WOW64_64KEY); + RegDeleteKeyExA(udprod, "", access & KEY_WOW64_64KEY, 0); RegCloseKey(udprod); done: RegDeleteValueA(patches, patch_squashed); RegDeleteValueA(patches, "Patches"); - delete_key(patches, "", access & KEY_WOW64_64KEY); + RegDeleteKeyExA(patches, "", access & KEY_WOW64_64KEY, 0); RegCloseKey(patches); - delete_key(prodkey, "", access & KEY_WOW64_64KEY); + RegDeleteKeyExA(prodkey, "", access & KEY_WOW64_64KEY, 0); RegCloseKey(prodkey); } @@ -10894,12 +10105,6 @@ static void test_MsiEnumPatchesEx(void) DWORD size; UINT r; - if (!pMsiEnumPatchesExA) - { - win_skip("MsiEnumPatchesExA not implemented\n"); - return; - } - create_test_guid(prodcode, prod_squashed); usersid = get_user_sid(); @@ -10909,19 +10114,13 @@ static void test_MsiEnumPatchesEx(void) context = 0xdeadbeef; lstrcpyA(targetsid, "kiwi"); size = MAX_PATH; - r = pMsiEnumPatchesExA("", usersid, MSIINSTALLCONTEXT_USERUNMANAGED, - MSIPATCHSTATE_ALL, 0, patchcode, targetprod, &context, - targetsid, &size); - ok(r == ERROR_INVALID_PARAMETER, - "Expected ERROR_INVALID_PARAMETER, got %d\n", r); - ok(!lstrcmpA(patchcode, "apple"), - "Expected patchcode to be unchanged, got %s\n", patchcode); - ok(!lstrcmpA(targetprod, "banana"), - "Expected targetprod to be unchanged, got %s\n", targetprod); - ok(context == 0xdeadbeef, - "Expected context to be unchanged, got %d\n", context); - ok(!lstrcmpA(targetsid, "kiwi"), - "Expected targetsid to be unchanged, got %s\n", targetsid); + r = MsiEnumPatchesExA("", usersid, MSIINSTALLCONTEXT_USERUNMANAGED, MSIPATCHSTATE_ALL, + 0, patchcode, targetprod, &context, targetsid, &size); + ok(r == ERROR_INVALID_PARAMETER, "Expected ERROR_INVALID_PARAMETER, got %d\n", r); + ok(!lstrcmpA(patchcode, "apple"), "Expected patchcode to be unchanged, got %s\n", patchcode); + ok(!lstrcmpA(targetprod, "banana"), "Expected targetprod to be unchanged, got %s\n", targetprod); + ok(context == 0xdeadbeef, "Expected context to be unchanged, got %d\n", context); + ok(!lstrcmpA(targetsid, "kiwi"), "Expected targetsid to be unchanged, got %s\n", targetsid); ok(size == MAX_PATH, "Expected size to be unchanged, got %lu\n", size); /* garbage szProductCode */ @@ -10930,19 +10129,13 @@ static void test_MsiEnumPatchesEx(void) context = 0xdeadbeef; lstrcpyA(targetsid, "kiwi"); size = MAX_PATH; - r = pMsiEnumPatchesExA("garbage", usersid, MSIINSTALLCONTEXT_USERUNMANAGED, - MSIPATCHSTATE_ALL, 0, patchcode, targetprod, &context, - targetsid, &size); - ok(r == ERROR_INVALID_PARAMETER, - "Expected ERROR_INVALID_PARAMETER, got %d\n", r); - ok(!lstrcmpA(patchcode, "apple"), - "Expected patchcode to be unchanged, got %s\n", patchcode); - ok(!lstrcmpA(targetprod, "banana"), - "Expected targetprod to be unchanged, got %s\n", targetprod); - ok(context == 0xdeadbeef, - "Expected context to be unchanged, got %d\n", context); - ok(!lstrcmpA(targetsid, "kiwi"), - "Expected targetsid to be unchanged, got %s\n", targetsid); + r = MsiEnumPatchesExA("garbage", usersid, MSIINSTALLCONTEXT_USERUNMANAGED, MSIPATCHSTATE_ALL, + 0, patchcode, targetprod, &context, targetsid, &size); + ok(r == ERROR_INVALID_PARAMETER, "Expected ERROR_INVALID_PARAMETER, got %d\n", r); + ok(!lstrcmpA(patchcode, "apple"), "Expected patchcode to be unchanged, got %s\n", patchcode); + ok(!lstrcmpA(targetprod, "banana"), "Expected targetprod to be unchanged, got %s\n", targetprod); + ok(context == 0xdeadbeef, "Expected context to be unchanged, got %d\n", context); + ok(!lstrcmpA(targetsid, "kiwi"), "Expected targetsid to be unchanged, got %s\n", targetsid); ok(size == MAX_PATH, "Expected size to be unchanged, got %lu\n", size); /* guid without brackets */ @@ -10951,20 +10144,13 @@ static void test_MsiEnumPatchesEx(void) context = 0xdeadbeef; lstrcpyA(targetsid, "kiwi"); size = MAX_PATH; - r = pMsiEnumPatchesExA("6700E8CF-95AB-4D9C-BC2C-15840DEA7A5D", usersid, - MSIINSTALLCONTEXT_USERUNMANAGED, MSIPATCHSTATE_ALL, - 0, patchcode, targetprod, &context, - targetsid, &size); - ok(r == ERROR_INVALID_PARAMETER, - "Expected ERROR_INVALID_PARAMETER, got %d\n", r); - ok(!lstrcmpA(patchcode, "apple"), - "Expected patchcode to be unchanged, got %s\n", patchcode); - ok(!lstrcmpA(targetprod, "banana"), - "Expected targetprod to be unchanged, got %s\n", targetprod); - ok(context == 0xdeadbeef, - "Expected context to be unchanged, got %d\n", context); - ok(!lstrcmpA(targetsid, "kiwi"), - "Expected targetsid to be unchanged, got %s\n", targetsid); + r = MsiEnumPatchesExA("6700E8CF-95AB-4D9C-BC2C-15840DEA7A5D", usersid, MSIINSTALLCONTEXT_USERUNMANAGED, + MSIPATCHSTATE_ALL, 0, patchcode, targetprod, &context, targetsid, &size); + ok(r == ERROR_INVALID_PARAMETER, "Expected ERROR_INVALID_PARAMETER, got %d\n", r); + ok(!lstrcmpA(patchcode, "apple"), "Expected patchcode to be unchanged, got %s\n", patchcode); + ok(!lstrcmpA(targetprod, "banana"), "Expected targetprod to be unchanged, got %s\n", targetprod); + ok(context == 0xdeadbeef, "Expected context to be unchanged, got %d\n", context); + ok(!lstrcmpA(targetsid, "kiwi"), "Expected targetsid to be unchanged, got %s\n", targetsid); ok(size == MAX_PATH, "Expected size to be unchanged, got %lu\n", size); /* guid with brackets */ @@ -10973,20 +10159,13 @@ static void test_MsiEnumPatchesEx(void) context = 0xdeadbeef; lstrcpyA(targetsid, "kiwi"); size = MAX_PATH; - r = pMsiEnumPatchesExA("{6700E8CF-95AB-4D9C-BC2C-15840DDA7A5D}", usersid, - MSIINSTALLCONTEXT_USERUNMANAGED, MSIPATCHSTATE_ALL, - 0, patchcode, targetprod, &context, - targetsid, &size); - ok(r == ERROR_NO_MORE_ITEMS, - "Expected ERROR_NO_MORE_ITEMS, got %d\n", r); - ok(!lstrcmpA(patchcode, "apple"), - "Expected patchcode to be unchanged, got %s\n", patchcode); - ok(!lstrcmpA(targetprod, "banana"), - "Expected targetprod to be unchanged, got %s\n", targetprod); - ok(context == 0xdeadbeef, - "Expected context to be unchanged, got %d\n", context); - ok(!lstrcmpA(targetsid, "kiwi"), - "Expected targetsid to be unchanged, got %s\n", targetsid); + r = MsiEnumPatchesExA("{6700E8CF-95AB-4D9C-BC2C-15840DDA7A5D}", usersid, MSIINSTALLCONTEXT_USERUNMANAGED, + MSIPATCHSTATE_ALL, 0, patchcode, targetprod, &context, targetsid, &size); + ok(r == ERROR_NO_MORE_ITEMS, "Expected ERROR_NO_MORE_ITEMS, got %d\n", r); + ok(!lstrcmpA(patchcode, "apple"), "Expected patchcode to be unchanged, got %s\n", patchcode); + ok(!lstrcmpA(targetprod, "banana"), "Expected targetprod to be unchanged, got %s\n", targetprod); + ok(context == 0xdeadbeef, "Expected context to be unchanged, got %d\n", context); + ok(!lstrcmpA(targetsid, "kiwi"), "Expected targetsid to be unchanged, got %s\n", targetsid); ok(size == MAX_PATH, "Expected size to be unchanged, got %lu\n", size); /* szUserSid is S-1-5-18 */ @@ -10995,20 +10174,13 @@ static void test_MsiEnumPatchesEx(void) context = 0xdeadbeef; lstrcpyA(targetsid, "kiwi"); size = MAX_PATH; - r = pMsiEnumPatchesExA(prodcode, "S-1-5-18", - MSIINSTALLCONTEXT_USERUNMANAGED, MSIPATCHSTATE_ALL, - 0, patchcode, targetprod, &context, - targetsid, &size); - ok(r == ERROR_INVALID_PARAMETER, - "Expected ERROR_INVALID_PARAMETER, got %d\n", r); - ok(!lstrcmpA(patchcode, "apple"), - "Expected patchcode to be unchanged, got %s\n", patchcode); - ok(!lstrcmpA(targetprod, "banana"), - "Expected targetprod to be unchanged, got %s\n", targetprod); - ok(context == 0xdeadbeef, - "Expected context to be unchanged, got %d\n", context); - ok(!lstrcmpA(targetsid, "kiwi"), - "Expected targetsid to be unchanged, got %s\n", targetsid); + r = MsiEnumPatchesExA(prodcode, "S-1-5-18", MSIINSTALLCONTEXT_USERUNMANAGED, MSIPATCHSTATE_ALL, + 0, patchcode, targetprod, &context, targetsid, &size); + ok(r == ERROR_INVALID_PARAMETER, "Expected ERROR_INVALID_PARAMETER, got %d\n", r); + ok(!lstrcmpA(patchcode, "apple"), "Expected patchcode to be unchanged, got %s\n", patchcode); + ok(!lstrcmpA(targetprod, "banana"), "Expected targetprod to be unchanged, got %s\n", targetprod); + ok(context == 0xdeadbeef, "Expected context to be unchanged, got %d\n", context); + ok(!lstrcmpA(targetsid, "kiwi"), "Expected targetsid to be unchanged, got %s\n", targetsid); ok(size == MAX_PATH, "Expected size to be unchanged, got %lu\n", size); /* dwContext is MSIINSTALLCONTEXT_MACHINE, but szUserSid is non-NULL */ @@ -11017,19 +10189,13 @@ static void test_MsiEnumPatchesEx(void) context = 0xdeadbeef; lstrcpyA(targetsid, "kiwi"); size = MAX_PATH; - r = pMsiEnumPatchesExA(prodcode, usersid, MSIINSTALLCONTEXT_MACHINE, - MSIPATCHSTATE_ALL, 0, patchcode, targetprod, - &context, targetsid, &size); - ok(r == ERROR_INVALID_PARAMETER, - "Expected ERROR_INVALID_PARAMETER, got %d\n", r); - ok(!lstrcmpA(patchcode, "apple"), - "Expected patchcode to be unchanged, got %s\n", patchcode); - ok(!lstrcmpA(targetprod, "banana"), - "Expected targetprod to be unchanged, got %s\n", targetprod); - ok(context == 0xdeadbeef, - "Expected context to be unchanged, got %d\n", context); - ok(!lstrcmpA(targetsid, "kiwi"), - "Expected targetsid to be unchanged, got %s\n", targetsid); + r = MsiEnumPatchesExA(prodcode, usersid, MSIINSTALLCONTEXT_MACHINE, MSIPATCHSTATE_ALL, + 0, patchcode, targetprod, &context, targetsid, &size); + ok(r == ERROR_INVALID_PARAMETER, "Expected ERROR_INVALID_PARAMETER, got %d\n", r); + ok(!lstrcmpA(patchcode, "apple"), "Expected patchcode to be unchanged, got %s\n", patchcode); + ok(!lstrcmpA(targetprod, "banana"), "Expected targetprod to be unchanged, got %s\n", targetprod); + ok(context == 0xdeadbeef, "Expected context to be unchanged, got %d\n", context); + ok(!lstrcmpA(targetsid, "kiwi"), "Expected targetsid to be unchanged, got %s\n", targetsid); ok(size == MAX_PATH, "Expected size to be unchanged, got %lu\n", size); /* dwContext is out of bounds */ @@ -11038,19 +10204,13 @@ static void test_MsiEnumPatchesEx(void) context = 0xdeadbeef; lstrcpyA(targetsid, "kiwi"); size = MAX_PATH; - r = pMsiEnumPatchesExA(prodcode, usersid, 0, - MSIPATCHSTATE_ALL, 0, patchcode, targetprod, - &context, targetsid, &size); - ok(r == ERROR_INVALID_PARAMETER, - "Expected ERROR_INVALID_PARAMETER, got %d\n", r); - ok(!lstrcmpA(patchcode, "apple"), - "Expected patchcode to be unchanged, got %s\n", patchcode); - ok(!lstrcmpA(targetprod, "banana"), - "Expected targetprod to be unchanged, got %s\n", targetprod); - ok(context == 0xdeadbeef, - "Expected context to be unchanged, got %d\n", context); - ok(!lstrcmpA(targetsid, "kiwi"), - "Expected targetsid to be unchanged, got %s\n", targetsid); + r = MsiEnumPatchesExA(prodcode, usersid, 0, MSIPATCHSTATE_ALL, 0, patchcode, targetprod, + &context, targetsid, &size); + ok(r == ERROR_INVALID_PARAMETER, "Expected ERROR_INVALID_PARAMETER, got %d\n", r); + ok(!lstrcmpA(patchcode, "apple"), "Expected patchcode to be unchanged, got %s\n", patchcode); + ok(!lstrcmpA(targetprod, "banana"), "Expected targetprod to be unchanged, got %s\n", targetprod); + ok(context == 0xdeadbeef, "Expected context to be unchanged, got %d\n", context); + ok(!lstrcmpA(targetsid, "kiwi"), "Expected targetsid to be unchanged, got %s\n", targetsid); ok(size == MAX_PATH, "Expected size to be unchanged, got %lu\n", size); /* dwContext is out of bounds */ @@ -11059,19 +10219,13 @@ static void test_MsiEnumPatchesEx(void) context = 0xdeadbeef; lstrcpyA(targetsid, "kiwi"); size = MAX_PATH; - r = pMsiEnumPatchesExA(prodcode, usersid, MSIINSTALLCONTEXT_ALL + 1, - MSIPATCHSTATE_ALL, 0, patchcode, targetprod, - &context, targetsid, &size); - ok(r == ERROR_INVALID_PARAMETER, - "Expected ERROR_INVALID_PARAMETER, got %d\n", r); - ok(!lstrcmpA(patchcode, "apple"), - "Expected patchcode to be unchanged, got %s\n", patchcode); - ok(!lstrcmpA(targetprod, "banana"), - "Expected targetprod to be unchanged, got %s\n", targetprod); - ok(context == 0xdeadbeef, - "Expected context to be unchanged, got %d\n", context); - ok(!lstrcmpA(targetsid, "kiwi"), - "Expected targetsid to be unchanged, got %s\n", targetsid); + r = MsiEnumPatchesExA(prodcode, usersid, MSIINSTALLCONTEXT_ALL + 1, MSIPATCHSTATE_ALL, 0, patchcode, + targetprod, &context, targetsid, &size); + ok(r == ERROR_INVALID_PARAMETER, "Expected ERROR_INVALID_PARAMETER, got %d\n", r); + ok(!lstrcmpA(patchcode, "apple"), "Expected patchcode to be unchanged, got %s\n", patchcode); + ok(!lstrcmpA(targetprod, "banana"), "Expected targetprod to be unchanged, got %s\n", targetprod); + ok(context == 0xdeadbeef, "Expected context to be unchanged, got %d\n", context); + ok(!lstrcmpA(targetsid, "kiwi"), "Expected targetsid to be unchanged, got %s\n", targetsid); ok(size == MAX_PATH, "Expected size to be unchanged, got %lu\n", size); /* dwFilter is out of bounds */ @@ -11080,19 +10234,13 @@ static void test_MsiEnumPatchesEx(void) context = 0xdeadbeef; lstrcpyA(targetsid, "kiwi"); size = MAX_PATH; - r = pMsiEnumPatchesExA(prodcode, usersid, MSIINSTALLCONTEXT_USERUNMANAGED, - MSIPATCHSTATE_INVALID, 0, patchcode, targetprod, - &context, targetsid, &size); - ok(r == ERROR_INVALID_PARAMETER, - "Expected ERROR_INVALID_PARAMETER, got %d\n", r); - ok(!lstrcmpA(patchcode, "apple"), - "Expected patchcode to be unchanged, got %s\n", patchcode); - ok(!lstrcmpA(targetprod, "banana"), - "Expected targetprod to be unchanged, got %s\n", targetprod); - ok(context == 0xdeadbeef, - "Expected context to be unchanged, got %d\n", context); - ok(!lstrcmpA(targetsid, "kiwi"), - "Expected targetsid to be unchanged, got %s\n", targetsid); + r = MsiEnumPatchesExA(prodcode, usersid, MSIINSTALLCONTEXT_USERUNMANAGED, MSIPATCHSTATE_INVALID, + 0, patchcode, targetprod, &context, targetsid, &size); + ok(r == ERROR_INVALID_PARAMETER, "Expected ERROR_INVALID_PARAMETER, got %d\n", r); + ok(!lstrcmpA(patchcode, "apple"), "Expected patchcode to be unchanged, got %s\n", patchcode); + ok(!lstrcmpA(targetprod, "banana"), "Expected targetprod to be unchanged, got %s\n", targetprod); + ok(context == 0xdeadbeef, "Expected context to be unchanged, got %d\n", context); + ok(!lstrcmpA(targetsid, "kiwi"), "Expected targetsid to be unchanged, got %s\n", targetsid); ok(size == MAX_PATH, "Expected size to be unchanged, got %lu\n", size); /* dwFilter is out of bounds */ @@ -11101,19 +10249,13 @@ static void test_MsiEnumPatchesEx(void) context = 0xdeadbeef; lstrcpyA(targetsid, "kiwi"); size = MAX_PATH; - r = pMsiEnumPatchesExA(prodcode, usersid, MSIINSTALLCONTEXT_USERUNMANAGED, - MSIPATCHSTATE_ALL + 1, 0, patchcode, targetprod, - &context, targetsid, &size); - ok(r == ERROR_INVALID_PARAMETER, - "Expected ERROR_INVALID_PARAMETER, got %d\n", r); - ok(!lstrcmpA(patchcode, "apple"), - "Expected patchcode to be unchanged, got %s\n", patchcode); - ok(!lstrcmpA(targetprod, "banana"), - "Expected targetprod to be unchanged, got %s\n", targetprod); - ok(context == 0xdeadbeef, - "Expected context to be unchanged, got %d\n", context); - ok(!lstrcmpA(targetsid, "kiwi"), - "Expected targetsid to be unchanged, got %s\n", targetsid); + r = MsiEnumPatchesExA(prodcode, usersid, MSIINSTALLCONTEXT_USERUNMANAGED, MSIPATCHSTATE_ALL + 1, + 0, patchcode, targetprod, &context, targetsid, &size); + ok(r == ERROR_INVALID_PARAMETER, "Expected ERROR_INVALID_PARAMETER, got %d\n", r); + ok(!lstrcmpA(patchcode, "apple"), "Expected patchcode to be unchanged, got %s\n", patchcode); + ok(!lstrcmpA(targetprod, "banana"), "Expected targetprod to be unchanged, got %s\n", targetprod); + ok(context == 0xdeadbeef, "Expected context to be unchanged, got %d\n", context); + ok(!lstrcmpA(targetsid, "kiwi"), "Expected targetsid to be unchanged, got %s\n", targetsid); ok(size == MAX_PATH, "Expected size to be unchanged, got %lu\n", size); /* pcchTargetUserSid is NULL while szTargetUserSid is non-NULL */ @@ -11121,19 +10263,13 @@ static void test_MsiEnumPatchesEx(void) lstrcpyA(targetprod, "banana"); context = 0xdeadbeef; lstrcpyA(targetsid, "kiwi"); - r = pMsiEnumPatchesExA(prodcode, usersid, MSIINSTALLCONTEXT_USERUNMANAGED, - MSIPATCHSTATE_ALL, 0, patchcode, targetprod, - &context, targetsid, NULL); - ok(r == ERROR_INVALID_PARAMETER, - "Expected ERROR_INVALID_PARAMETER, got %d\n", r); - ok(!lstrcmpA(patchcode, "apple"), - "Expected patchcode to be unchanged, got %s\n", patchcode); - ok(!lstrcmpA(targetprod, "banana"), - "Expected targetprod to be unchanged, got %s\n", targetprod); - ok(context == 0xdeadbeef, - "Expected context to be unchanged, got %d\n", context); - ok(!lstrcmpA(targetsid, "kiwi"), - "Expected targetsid to be unchanged, got %s\n", targetsid); + r = MsiEnumPatchesExA(prodcode, usersid, MSIINSTALLCONTEXT_USERUNMANAGED, MSIPATCHSTATE_ALL, + 0, patchcode, targetprod, &context, targetsid, NULL); + ok(r == ERROR_INVALID_PARAMETER, "Expected ERROR_INVALID_PARAMETER, got %d\n", r); + ok(!lstrcmpA(patchcode, "apple"), "Expected patchcode to be unchanged, got %s\n", patchcode); + ok(!lstrcmpA(targetprod, "banana"), "Expected targetprod to be unchanged, got %s\n", targetprod); + ok(context == 0xdeadbeef, "Expected context to be unchanged, got %d\n", context); + ok(!lstrcmpA(targetsid, "kiwi"), "Expected targetsid to be unchanged, got %s\n", targetsid); test_MsiEnumPatchesEx_usermanaged(usersid, usersid); test_MsiEnumPatchesEx_usermanaged(NULL, usersid); @@ -11296,18 +10432,12 @@ static void test_MsiEnumPatches(void) lstrcpyA(patch, "apple"); lstrcpyA(transforms, "banana"); r = MsiEnumPatchesA(prodcode, 0, patch, transforms, &size); - ok(r == ERROR_NO_MORE_ITEMS || - broken(r == ERROR_FILE_NOT_FOUND), /* Windows Installer < 3.0 */ - "Expected ERROR_NO_MORE_ITEMS, got %d\n", r); - ok(!lstrcmpA(patch, "apple"), - "Expected lpPatchBuf to be unchanged, got \"%s\"\n", patch); - ok(!lstrcmpA(transforms, "banana"), - "Expected lpTransformsBuf to be unchanged, got \"%s\"\n", transforms); + ok(r == ERROR_NO_MORE_ITEMS, "Expected ERROR_NO_MORE_ITEMS, got %d\n", r); + ok(!lstrcmpA(patch, "apple"), "Expected lpPatchBuf to be unchanged, got \"%s\"\n", patch); + ok(!lstrcmpA(transforms, "banana"), "Expected lpTransformsBuf to be unchanged, got \"%s\"\n", transforms); ok(size == MAX_PATH, "Expected size to be unchanged, got %lu\n", size); - res = RegSetValueExA(patches, "Patches", 0, REG_SZ, - (const BYTE *)patch_squashed, - lstrlenA(patch_squashed) + 1); + res = RegSetValueExA(patches, "Patches", 0, REG_SZ, (const BYTE *)patch_squashed, lstrlenA(patch_squashed) + 1); ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %ld\n", res); /* Patches value exists, is not REG_MULTI_SZ */ @@ -11315,17 +10445,12 @@ static void test_MsiEnumPatches(void) lstrcpyA(patch, "apple"); lstrcpyA(transforms, "banana"); r = MsiEnumPatchesA(prodcode, 0, patch, transforms, &size); - ok(r == ERROR_BAD_CONFIGURATION || - broken(r == ERROR_SUCCESS), /* Windows Installer < 3.0 */ - "Expected ERROR_BAD_CONFIGURATION, got %d\n", r); - ok(!lstrcmpA(patch, "apple"), - "Expected lpPatchBuf to be unchanged, got \"%s\"\n", patch); - ok(!lstrcmpA(transforms, "banana"), - "Expected lpTransformsBuf to be unchanged, got \"%s\"\n", transforms); + ok(r == ERROR_BAD_CONFIGURATION, "Expected ERROR_BAD_CONFIGURATION, got %d\n", r); + ok(!lstrcmpA(patch, "apple"), "Expected lpPatchBuf to be unchanged, got \"%s\"\n", patch); + ok(!lstrcmpA(transforms, "banana"), "Expected lpTransformsBuf to be unchanged, got \"%s\"\n", transforms); ok(size == MAX_PATH, "Expected size to be unchanged, got %lu\n", size); - res = RegSetValueExA(patches, "Patches", 0, REG_MULTI_SZ, - (const BYTE *)"a\0b\0c\0\0", 7); + res = RegSetValueExA(patches, "Patches", 0, REG_MULTI_SZ, (const BYTE *)"a\0b\0c\0\0", 7); ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %ld\n", res); /* Patches value exists, is not a squashed guid */ @@ -11333,18 +10458,13 @@ static void test_MsiEnumPatches(void) lstrcpyA(patch, "apple"); lstrcpyA(transforms, "banana"); r = MsiEnumPatchesA(prodcode, 0, patch, transforms, &size); - ok(r == ERROR_BAD_CONFIGURATION, - "Expected ERROR_BAD_CONFIGURATION, got %d\n", r); - ok(!lstrcmpA(patch, "apple"), - "Expected lpPatchBuf to be unchanged, got \"%s\"\n", patch); - ok(!lstrcmpA(transforms, "banana"), - "Expected lpTransformsBuf to be unchanged, got \"%s\"\n", transforms); + ok(r == ERROR_BAD_CONFIGURATION, "Expected ERROR_BAD_CONFIGURATION, got %d\n", r); + ok(!lstrcmpA(patch, "apple"), "Expected lpPatchBuf to be unchanged, got \"%s\"\n", patch); + ok(!lstrcmpA(transforms, "banana"), "Expected lpTransformsBuf to be unchanged, got \"%s\"\n", transforms); ok(size == MAX_PATH, "Expected size to be unchanged, got %lu\n", size); patch_squashed[lstrlenA(patch_squashed) + 1] = '\0'; - res = RegSetValueExA(patches, "Patches", 0, REG_MULTI_SZ, - (const BYTE *)patch_squashed, - lstrlenA(patch_squashed) + 2); + res = RegSetValueExA(patches, "Patches", 0, REG_MULTI_SZ, (const BYTE *)patch_squashed, lstrlenA(patch_squashed) + 2); ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %ld\n", res); /* Patches value exists */ @@ -11352,18 +10472,12 @@ static void test_MsiEnumPatches(void) lstrcpyA(patch, "apple"); lstrcpyA(transforms, "banana"); r = MsiEnumPatchesA(prodcode, 0, patch, transforms, &size); - ok(r == ERROR_NO_MORE_ITEMS || - broken(r == ERROR_FILE_NOT_FOUND), /* Windows Installer < 3.0 */ - "Expected ERROR_NO_MORE_ITEMS, got %d\n", r); - ok(!lstrcmpA(patch, "apple") || - broken(!lstrcmpA(patch, patchcode)), /* Windows Installer < 3.0 */ - "Expected lpPatchBuf to be unchanged, got \"%s\"\n", patch); - ok(!lstrcmpA(transforms, "banana"), - "Expected lpTransformsBuf to be unchanged, got \"%s\"\n", transforms); + ok(r == ERROR_NO_MORE_ITEMS, "Expected ERROR_NO_MORE_ITEMS, got %d\n", r); + ok(!lstrcmpA(patch, "apple"), "Expected lpPatchBuf to be unchanged, got \"%s\"\n", patch); + ok(!lstrcmpA(transforms, "banana"), "Expected lpTransformsBuf to be unchanged, got \"%s\"\n", transforms); ok(size == MAX_PATH, "Expected size to be unchanged, got %lu\n", size); - res = RegSetValueExA(patches, patch_squashed, 0, REG_SZ, - (const BYTE *)"whatever", 9); + res = RegSetValueExA(patches, patch_squashed, 0, REG_SZ, (const BYTE *)"whatever", 9); ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %ld\n", res); /* patch squashed value exists */ @@ -11372,42 +10486,33 @@ static void test_MsiEnumPatches(void) lstrcpyA(transforms, "banana"); r = MsiEnumPatchesA(prodcode, 0, patch, transforms, &size); ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r); - ok(!lstrcmpA(patch, patchcode), - "Expected \"%s\", got \"%s\"\n", patchcode, patch); - ok(!lstrcmpA(transforms, "whatever"), - "Expected \"whatever\", got \"%s\"\n", transforms); + ok(!lstrcmpA(patch, patchcode), "Expected \"%s\", got \"%s\"\n", patchcode, patch); + ok(!lstrcmpA(transforms, "whatever"), "Expected \"whatever\", got \"%s\"\n", transforms); ok(size == 8 || size == MAX_PATH, "Expected 8 or MAX_PATH, got %lu\n", size); /* lpPatchBuf is NULL */ size = MAX_PATH; lstrcpyA(transforms, "banana"); r = MsiEnumPatchesA(prodcode, 0, NULL, transforms, &size); - ok(r == ERROR_INVALID_PARAMETER, - "Expected ERROR_INVALID_PARAMETER, got %d\n", r); - ok(!lstrcmpA(transforms, "banana"), - "Expected lpTransformsBuf to be unchanged, got \"%s\"\n", transforms); + ok(r == ERROR_INVALID_PARAMETER, "Expected ERROR_INVALID_PARAMETER, got %d\n", r); + ok(!lstrcmpA(transforms, "banana"), "Expected lpTransformsBuf to be unchanged, got \"%s\"\n", transforms); ok(size == MAX_PATH, "Expected size to be unchanged, got %lu\n", size); /* lpTransformsBuf is NULL, pcchTransformsBuf is not */ size = MAX_PATH; lstrcpyA(patch, "apple"); r = MsiEnumPatchesA(prodcode, 0, patch, NULL, &size); - ok(r == ERROR_INVALID_PARAMETER, - "Expected ERROR_INVALID_PARAMETER, got %d\n", r); - ok(!lstrcmpA(patch, "apple"), - "Expected lpPatchBuf to be unchanged, got \"%s\"\n", patch); + ok(r == ERROR_INVALID_PARAMETER, "Expected ERROR_INVALID_PARAMETER, got %d\n", r); + ok(!lstrcmpA(patch, "apple"), "Expected lpPatchBuf to be unchanged, got \"%s\"\n", patch); ok(size == MAX_PATH, "Expected size to be unchanged, got %lu\n", size); /* pcchTransformsBuf is NULL, lpTransformsBuf is not */ lstrcpyA(patch, "apple"); lstrcpyA(transforms, "banana"); r = MsiEnumPatchesA(prodcode, 0, patch, transforms, NULL); - ok(r == ERROR_INVALID_PARAMETER, - "Expected ERROR_INVALID_PARAMETER, got %d\n", r); - ok(!lstrcmpA(patch, "apple"), - "Expected lpPatchBuf to be unchanged, got \"%s\"\n", patch); - ok(!lstrcmpA(transforms, "banana"), - "Expected lpTransformsBuf to be unchanged, got \"%s\"\n", transforms); + ok(r == ERROR_INVALID_PARAMETER, "Expected ERROR_INVALID_PARAMETER, got %d\n", r); + ok(!lstrcmpA(patch, "apple"), "Expected lpPatchBuf to be unchanged, got \"%s\"\n", patch); + ok(!lstrcmpA(transforms, "banana"), "Expected lpTransformsBuf to be unchanged, got \"%s\"\n", transforms); /* pcchTransformsBuf is too small */ size = 6; @@ -11415,11 +10520,8 @@ static void test_MsiEnumPatches(void) lstrcpyA(transforms, "banana"); r = MsiEnumPatchesA(prodcode, 0, patch, transforms, &size); ok(r == ERROR_MORE_DATA, "Expected ERROR_MORE_DATA, got %d\n", r); - ok(!lstrcmpA(patch, patchcode), - "Expected \"%s\", got \"%s\"\n", patchcode, patch); - ok(!lstrcmpA(transforms, "whate") || - broken(!lstrcmpA(transforms, "banana")), /* Windows Installer < 3.0 */ - "Expected \"whate\", got \"%s\"\n", transforms); + ok(!lstrcmpA(patch, patchcode), "Expected \"%s\", got \"%s\"\n", patchcode, patch); + ok(!lstrcmpA(transforms, "whate"), "Expected \"whate\", got \"%s\"\n", transforms); ok(size == 8 || size == 16, "Expected 8 or 16, got %lu\n", size); /* increase the index */ @@ -11428,10 +10530,8 @@ static void test_MsiEnumPatches(void) lstrcpyA(transforms, "banana"); r = MsiEnumPatchesA(prodcode, 1, patch, transforms, &size); ok(r == ERROR_NO_MORE_ITEMS, "Expected ERROR_NO_MORE_ITEMS, got %d\n", r); - ok(!lstrcmpA(patch, "apple"), - "Expected lpPatchBuf to be unchanged, got \"%s\"\n", patch); - ok(!lstrcmpA(transforms, "banana"), - "Expected lpTransformsBuf to be unchanged, got \"%s\"\n", transforms); + ok(!lstrcmpA(patch, "apple"), "Expected lpPatchBuf to be unchanged, got \"%s\"\n", patch); + ok(!lstrcmpA(transforms, "banana"), "Expected lpTransformsBuf to be unchanged, got \"%s\"\n", transforms); ok(size == MAX_PATH, "Expected size to be unchanged, got %lu\n", size); /* increase again */ @@ -11440,16 +10540,14 @@ static void test_MsiEnumPatches(void) lstrcpyA(transforms, "banana"); r = MsiEnumPatchesA(prodcode, 2, patch, transforms, &size); ok(r == ERROR_NO_MORE_ITEMS, "Expected ERROR_NO_MORE_ITEMS, got %d\n", r); - ok(!lstrcmpA(patch, "apple"), - "Expected lpPatchBuf to be unchanged, got \"%s\"\n", patch); - ok(!lstrcmpA(transforms, "banana"), - "Expected lpTransformsBuf to be unchanged, got \"%s\"\n", transforms); + ok(!lstrcmpA(patch, "apple"), "Expected lpPatchBuf to be unchanged, got \"%s\"\n", patch); + ok(!lstrcmpA(transforms, "banana"), "Expected lpTransformsBuf to be unchanged, got \"%s\"\n", transforms); ok(size == MAX_PATH, "Expected size to be unchanged, got %lu\n", size); RegDeleteValueA(patches, "Patches"); - delete_key(patches, "", access & KEY_WOW64_64KEY); + RegDeleteKeyExA(patches, "", access & KEY_WOW64_64KEY, 0); RegCloseKey(patches); - delete_key(prodkey, "", access & KEY_WOW64_64KEY); + RegDeleteKeyExA(prodkey, "", access & KEY_WOW64_64KEY, 0); RegCloseKey(prodkey); /* MSIINSTALLCONTEXT_USERUNMANAGED */ @@ -11458,12 +10556,9 @@ static void test_MsiEnumPatches(void) lstrcpyA(patch, "apple"); lstrcpyA(transforms, "banana"); r = MsiEnumPatchesA(prodcode, 0, patch, transforms, &size); - ok(r == ERROR_UNKNOWN_PRODUCT, - "Expected ERROR_UNKNOWN_PRODUCT, got %d\n", r); - ok(!lstrcmpA(patch, "apple"), - "Expected lpPatchBuf to be unchanged, got \"%s\"\n", patch); - ok(!lstrcmpA(transforms, "banana"), - "Expected lpTransformsBuf to be unchanged, got \"%s\"\n", transforms); + ok(r == ERROR_UNKNOWN_PRODUCT, "Expected ERROR_UNKNOWN_PRODUCT, got %d\n", r); + ok(!lstrcmpA(patch, "apple"), "Expected lpPatchBuf to be unchanged, got \"%s\"\n", patch); + ok(!lstrcmpA(transforms, "banana"), "Expected lpTransformsBuf to be unchanged, got \"%s\"\n", transforms); ok(size == MAX_PATH, "Expected size to be unchanged, got %lu\n", size); lstrcpyA(keypath, "Software\\Microsoft\\Installer\\Products\\"); @@ -11478,10 +10573,8 @@ static void test_MsiEnumPatches(void) lstrcpyA(transforms, "banana"); r = MsiEnumPatchesA(prodcode, 0, patch, transforms, &size); ok(r == ERROR_NO_MORE_ITEMS, "Expected ERROR_NO_MORE_ITEMS, got %d\n", r); - ok(!lstrcmpA(patch, "apple"), - "Expected lpPatchBuf to be unchanged, got \"%s\"\n", patch); - ok(!lstrcmpA(transforms, "banana"), - "Expected lpTransformsBuf to be unchanged, got \"%s\"\n", transforms); + ok(!lstrcmpA(patch, "apple"), "Expected lpPatchBuf to be unchanged, got \"%s\"\n", patch); + ok(!lstrcmpA(transforms, "banana"), "Expected lpTransformsBuf to be unchanged, got \"%s\"\n", transforms); ok(size == MAX_PATH, "Expected size to be unchanged, got %lu\n", size); res = RegCreateKeyA(prodkey, "Patches", &patches); @@ -11492,18 +10585,12 @@ static void test_MsiEnumPatches(void) lstrcpyA(patch, "apple"); lstrcpyA(transforms, "banana"); r = MsiEnumPatchesA(prodcode, 0, patch, transforms, &size); - ok(r == ERROR_NO_MORE_ITEMS || - broken(r == ERROR_FILE_NOT_FOUND), /* Windows Installer < 3.0 */ - "Expected ERROR_NO_MORE_ITEMS, got %d\n", r); - ok(!lstrcmpA(patch, "apple"), - "Expected lpPatchBuf to be unchanged, got \"%s\"\n", patch); - ok(!lstrcmpA(transforms, "banana"), - "Expected lpTransformsBuf to be unchanged, got \"%s\"\n", transforms); + ok(r == ERROR_NO_MORE_ITEMS, "Expected ERROR_NO_MORE_ITEMS, got %d\n", r); + ok(!lstrcmpA(patch, "apple"), "Expected lpPatchBuf to be unchanged, got \"%s\"\n", patch); + ok(!lstrcmpA(transforms, "banana"), "Expected lpTransformsBuf to be unchanged, got \"%s\"\n", transforms); ok(size == MAX_PATH, "Expected size to be unchanged, got %lu\n", size); - res = RegSetValueExA(patches, "Patches", 0, REG_SZ, - (const BYTE *)patch_squashed, - lstrlenA(patch_squashed) + 1); + res = RegSetValueExA(patches, "Patches", 0, REG_SZ, (const BYTE *)patch_squashed, lstrlenA(patch_squashed) + 1); ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %ld\n", res); /* Patches value exists, is not REG_MULTI_SZ */ @@ -11511,17 +10598,12 @@ static void test_MsiEnumPatches(void) lstrcpyA(patch, "apple"); lstrcpyA(transforms, "banana"); r = MsiEnumPatchesA(prodcode, 0, patch, transforms, &size); - ok(r == ERROR_BAD_CONFIGURATION || - broken(r == ERROR_SUCCESS), /* Windows Installer < 3.0 */ - "Expected ERROR_BAD_CONFIGURATION, got %d\n", r); - ok(!lstrcmpA(patch, "apple"), - "Expected lpPatchBuf to be unchanged, got \"%s\"\n", patch); - ok(!lstrcmpA(transforms, "banana"), - "Expected lpTransformsBuf to be unchanged, got \"%s\"\n", transforms); + ok(r == ERROR_BAD_CONFIGURATION, "Expected ERROR_BAD_CONFIGURATION, got %d\n", r); + ok(!lstrcmpA(patch, "apple"), "Expected lpPatchBuf to be unchanged, got \"%s\"\n", patch); + ok(!lstrcmpA(transforms, "banana"), "Expected lpTransformsBuf to be unchanged, got \"%s\"\n", transforms); ok(size == MAX_PATH, "Expected size to be unchanged, got %lu\n", size); - res = RegSetValueExA(patches, "Patches", 0, REG_MULTI_SZ, - (const BYTE *)"a\0b\0c\0\0", 7); + res = RegSetValueExA(patches, "Patches", 0, REG_MULTI_SZ, (const BYTE *)"a\0b\0c\0\0", 7); ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %ld\n", res); /* Patches value exists, is not a squashed guid */ @@ -11529,18 +10611,13 @@ static void test_MsiEnumPatches(void) lstrcpyA(patch, "apple"); lstrcpyA(transforms, "banana"); r = MsiEnumPatchesA(prodcode, 0, patch, transforms, &size); - ok(r == ERROR_BAD_CONFIGURATION, - "Expected ERROR_BAD_CONFIGURATION, got %d\n", r); - ok(!lstrcmpA(patch, "apple"), - "Expected lpPatchBuf to be unchanged, got \"%s\"\n", patch); - ok(!lstrcmpA(transforms, "banana"), - "Expected lpTransformsBuf to be unchanged, got \"%s\"\n", transforms); + ok(r == ERROR_BAD_CONFIGURATION, "Expected ERROR_BAD_CONFIGURATION, got %d\n", r); + ok(!lstrcmpA(patch, "apple"), "Expected lpPatchBuf to be unchanged, got \"%s\"\n", patch); + ok(!lstrcmpA(transforms, "banana"), "Expected lpTransformsBuf to be unchanged, got \"%s\"\n", transforms); ok(size == MAX_PATH, "Expected size to be unchanged, got %lu\n", size); patch_squashed[lstrlenA(patch_squashed) + 1] = '\0'; - res = RegSetValueExA(patches, "Patches", 0, REG_MULTI_SZ, - (const BYTE *)patch_squashed, - lstrlenA(patch_squashed) + 2); + res = RegSetValueExA(patches, "Patches", 0, REG_MULTI_SZ, (const BYTE *)patch_squashed, lstrlenA(patch_squashed) + 2); ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %ld\n", res); /* Patches value exists */ @@ -11548,18 +10625,12 @@ static void test_MsiEnumPatches(void) lstrcpyA(patch, "apple"); lstrcpyA(transforms, "banana"); r = MsiEnumPatchesA(prodcode, 0, patch, transforms, &size); - ok(r == ERROR_NO_MORE_ITEMS || - broken(r == ERROR_FILE_NOT_FOUND), /* Windows Installer < 3.0 */ - "Expected ERROR_NO_MORE_ITEMS, got %d\n", r); - ok(!lstrcmpA(patch, "apple") || - broken(!lstrcmpA(patch, patchcode)), /* Windows Installer < 3.0 */ - "Expected lpPatchBuf to be unchanged, got \"%s\"\n", patch); - ok(!lstrcmpA(transforms, "banana"), - "Expected lpTransformsBuf to be unchanged, got \"%s\"\n", transforms); + ok(r == ERROR_NO_MORE_ITEMS, "Expected ERROR_NO_MORE_ITEMS, got %d\n", r); + ok(!lstrcmpA(patch, "apple"), "Expected lpPatchBuf to be unchanged, got \"%s\"\n", patch); + ok(!lstrcmpA(transforms, "banana"), "Expected lpTransformsBuf to be unchanged, got \"%s\"\n", transforms); ok(size == MAX_PATH, "Expected size to be unchanged, got %lu\n", size); - res = RegSetValueExA(patches, patch_squashed, 0, REG_SZ, - (const BYTE *)"whatever", 9); + res = RegSetValueExA(patches, patch_squashed, 0, REG_SZ, (const BYTE *)"whatever", 9); ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %ld\n", res); /* patch code value exists */ @@ -11567,15 +10638,9 @@ static void test_MsiEnumPatches(void) lstrcpyA(patch, "apple"); lstrcpyA(transforms, "banana"); r = MsiEnumPatchesA(prodcode, 0, patch, transforms, &size); - ok(r == ERROR_NO_MORE_ITEMS || - broken(r == ERROR_SUCCESS), /* Windows Installer < 3.0 */ - "Expected ERROR_NO_MORE_ITEMS, got %d\n", r); - ok(!lstrcmpA(patch, "apple") || - broken(!lstrcmpA(patch, patchcode)), /* Windows Installer < 3.0 */ - "Expected lpPatchBuf to be unchanged, got \"%s\"\n", patch); - ok(!lstrcmpA(transforms, "banana") || - broken(!lstrcmpA(transforms, "whatever")), /* Windows Installer < 3.0 */ - "Expected lpTransformsBuf to be unchanged, got \"%s\"\n", transforms); + ok(r == ERROR_NO_MORE_ITEMS, "Expected ERROR_NO_MORE_ITEMS, got %d\n", r); + ok(!lstrcmpA(patch, "apple"), "Expected lpPatchBuf to be unchanged, got \"%s\"\n", patch); + ok(!lstrcmpA(transforms, "banana"), "Expected lpTransformsBuf to be unchanged, got \"%s\"\n", transforms); ok(size == MAX_PATH, "Expected size to be unchanged, got %lu\n", size); lstrcpyA(keypath, "Software\\Microsoft\\Windows\\CurrentVersion\\Installer\\UserData\\"); @@ -11584,6 +10649,12 @@ static void test_MsiEnumPatches(void) lstrcatA(keypath, patch_squashed); res = RegCreateKeyExA(HKEY_LOCAL_MACHINE, keypath, 0, NULL, 0, access, NULL, &userkey, NULL); + if (res == ERROR_ACCESS_DENIED) + { + skip("Not enough rights to perform tests\n"); + LocalFree(usersid); + return; + } ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %ld\n", res); /* userdata patch key exists */ @@ -11592,13 +10663,11 @@ static void test_MsiEnumPatches(void) lstrcpyA(transforms, "banana"); r = MsiEnumPatchesA(prodcode, 0, patch, transforms, &size); ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r); - ok(!lstrcmpA(patch, patchcode), - "Expected \"%s\", got \"%s\"\n", patchcode, patch); - ok(!lstrcmpA(transforms, "whatever"), - "Expected \"whatever\", got \"%s\"\n", transforms); + ok(!lstrcmpA(patch, patchcode), "Expected \"%s\", got \"%s\"\n", patchcode, patch); + ok(!lstrcmpA(transforms, "whatever"), "Expected \"whatever\", got \"%s\"\n", transforms); ok(size == 8 || size == MAX_PATH, "Expected 8 or MAX_PATH, got %lu\n", size); - delete_key(userkey, "", access & KEY_WOW64_64KEY); + RegDeleteKeyExA(userkey, "", access & KEY_WOW64_64KEY, 0); RegCloseKey(userkey); RegDeleteValueA(patches, patch_squashed); RegDeleteValueA(patches, "Patches"); @@ -11613,12 +10682,9 @@ static void test_MsiEnumPatches(void) lstrcpyA(patch, "apple"); lstrcpyA(transforms, "banana"); r = MsiEnumPatchesA(prodcode, 0, patch, transforms, &size); - ok(r == ERROR_UNKNOWN_PRODUCT, - "Expected ERROR_UNKNOWN_PRODUCT, got %d\n", r); - ok(!lstrcmpA(patch, "apple"), - "Expected lpPatchBuf to be unchanged, got \"%s\"\n", patch); - ok(!lstrcmpA(transforms, "banana"), - "Expected lpTransformsBuf to be unchanged, got \"%s\"\n", transforms); + ok(r == ERROR_UNKNOWN_PRODUCT, "Expected ERROR_UNKNOWN_PRODUCT, got %d\n", r); + ok(!lstrcmpA(patch, "apple"), "Expected lpPatchBuf to be unchanged, got \"%s\"\n", patch); + ok(!lstrcmpA(transforms, "banana"), "Expected lpTransformsBuf to be unchanged, got \"%s\"\n", transforms); ok(size == MAX_PATH, "Expected size to be unchanged, got %lu\n", size); lstrcpyA(keypath, "Software\\Classes\\Installer\\Products\\"); @@ -11639,10 +10705,8 @@ static void test_MsiEnumPatches(void) lstrcpyA(transforms, "banana"); r = MsiEnumPatchesA(prodcode, 0, patch, transforms, &size); ok(r == ERROR_NO_MORE_ITEMS, "Expected ERROR_NO_MORE_ITEMS, got %d\n", r); - ok(!lstrcmpA(patch, "apple"), - "Expected lpPatchBuf to be unchanged, got \"%s\"\n", patch); - ok(!lstrcmpA(transforms, "banana"), - "Expected lpTransformsBuf to be unchanged, got \"%s\"\n", transforms); + ok(!lstrcmpA(patch, "apple"), "Expected lpPatchBuf to be unchanged, got \"%s\"\n", patch); + ok(!lstrcmpA(transforms, "banana"), "Expected lpTransformsBuf to be unchanged, got \"%s\"\n", transforms); ok(size == MAX_PATH, "Expected size to be unchanged, got %lu\n", size); res = RegCreateKeyExA(prodkey, "Patches", 0, NULL, 0, access, NULL, &patches, NULL); @@ -11653,18 +10717,12 @@ static void test_MsiEnumPatches(void) lstrcpyA(patch, "apple"); lstrcpyA(transforms, "banana"); r = MsiEnumPatchesA(prodcode, 0, patch, transforms, &size); - ok(r == ERROR_NO_MORE_ITEMS || - broken(r == ERROR_FILE_NOT_FOUND), /* Windows Installer < 3.0 */ - "Expected ERROR_NO_MORE_ITEMS, got %d\n", r); - ok(!lstrcmpA(patch, "apple"), - "Expected lpPatchBuf to be unchanged, got \"%s\"\n", patch); - ok(!lstrcmpA(transforms, "banana"), - "Expected lpTransformsBuf to be unchanged, got \"%s\"\n", transforms); + ok(r == ERROR_NO_MORE_ITEMS, "Expected ERROR_NO_MORE_ITEMS, got %d\n", r); + ok(!lstrcmpA(patch, "apple"), "Expected lpPatchBuf to be unchanged, got \"%s\"\n", patch); + ok(!lstrcmpA(transforms, "banana"), "Expected lpTransformsBuf to be unchanged, got \"%s\"\n", transforms); ok(size == MAX_PATH, "Expected size to be unchanged, got %lu\n", size); - res = RegSetValueExA(patches, "Patches", 0, REG_SZ, - (const BYTE *)patch_squashed, - lstrlenA(patch_squashed) + 1); + res = RegSetValueExA(patches, "Patches", 0, REG_SZ, (const BYTE *)patch_squashed, lstrlenA(patch_squashed) + 1); ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %ld\n", res); /* Patches value exists, is not REG_MULTI_SZ */ @@ -11672,17 +10730,12 @@ static void test_MsiEnumPatches(void) lstrcpyA(patch, "apple"); lstrcpyA(transforms, "banana"); r = MsiEnumPatchesA(prodcode, 0, patch, transforms, &size); - ok(r == ERROR_BAD_CONFIGURATION || - broken(r == ERROR_SUCCESS), /* Windows Installer < 3.0 */ - "Expected ERROR_BAD_CONFIGURATION, got %d\n", r); - ok(!lstrcmpA(patch, "apple"), - "Expected lpPatchBuf to be unchanged, got \"%s\"\n", patch); - ok(!lstrcmpA(transforms, "banana"), - "Expected lpTransformsBuf to be unchanged, got \"%s\"\n", transforms); + ok(r == ERROR_BAD_CONFIGURATION, "Expected ERROR_BAD_CONFIGURATION, got %d\n", r); + ok(!lstrcmpA(patch, "apple"), "Expected lpPatchBuf to be unchanged, got \"%s\"\n", patch); + ok(!lstrcmpA(transforms, "banana"), "Expected lpTransformsBuf to be unchanged, got \"%s\"\n", transforms); ok(size == MAX_PATH, "Expected size to be unchanged, got %lu\n", size); - res = RegSetValueExA(patches, "Patches", 0, REG_MULTI_SZ, - (const BYTE *)"a\0b\0c\0\0", 7); + res = RegSetValueExA(patches, "Patches", 0, REG_MULTI_SZ, (const BYTE *)"a\0b\0c\0\0", 7); ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %ld\n", res); /* Patches value exists, is not a squashed guid */ @@ -11690,18 +10743,13 @@ static void test_MsiEnumPatches(void) lstrcpyA(patch, "apple"); lstrcpyA(transforms, "banana"); r = MsiEnumPatchesA(prodcode, 0, patch, transforms, &size); - ok(r == ERROR_BAD_CONFIGURATION, - "Expected ERROR_BAD_CONFIGURATION, got %d\n", r); - ok(!lstrcmpA(patch, "apple"), - "Expected lpPatchBuf to be unchanged, got \"%s\"\n", patch); - ok(!lstrcmpA(transforms, "banana"), - "Expected lpTransformsBuf to be unchanged, got \"%s\"\n", transforms); + ok(r == ERROR_BAD_CONFIGURATION, "Expected ERROR_BAD_CONFIGURATION, got %d\n", r); + ok(!lstrcmpA(patch, "apple"), "Expected lpPatchBuf to be unchanged, got \"%s\"\n", patch); + ok(!lstrcmpA(transforms, "banana"), "Expected lpTransformsBuf to be unchanged, got \"%s\"\n", transforms); ok(size == MAX_PATH, "Expected size to be unchanged, got %lu\n", size); patch_squashed[lstrlenA(patch_squashed) + 1] = '\0'; - res = RegSetValueExA(patches, "Patches", 0, REG_MULTI_SZ, - (const BYTE *)patch_squashed, - lstrlenA(patch_squashed) + 2); + res = RegSetValueExA(patches, "Patches", 0, REG_MULTI_SZ, (const BYTE *)patch_squashed, lstrlenA(patch_squashed) + 2); ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %ld\n", res); /* Patches value exists */ @@ -11709,18 +10757,12 @@ static void test_MsiEnumPatches(void) lstrcpyA(patch, "apple"); lstrcpyA(transforms, "banana"); r = MsiEnumPatchesA(prodcode, 0, patch, transforms, &size); - ok(r == ERROR_NO_MORE_ITEMS || - broken(r == ERROR_FILE_NOT_FOUND), /* Windows Installer < 3.0 */ - "Expected ERROR_NO_MORE_ITEMS, got %d\n", r); - ok(!lstrcmpA(patch, "apple") || - broken(!lstrcmpA(patch, patchcode)), /* Windows Installer < 3.0 */ - "Expected lpPatchBuf to be unchanged, got \"%s\"\n", patch); - ok(!lstrcmpA(transforms, "banana"), - "Expected lpTransformsBuf to be unchanged, got \"%s\"\n", transforms); + ok(r == ERROR_NO_MORE_ITEMS, "Expected ERROR_NO_MORE_ITEMS, got %d\n", r); + ok(!lstrcmpA(patch, "apple"), "Expected lpPatchBuf to be unchanged, got \"%s\"\n", patch); + ok(!lstrcmpA(transforms, "banana"), "Expected lpTransformsBuf to be unchanged, got \"%s\"\n", transforms); ok(size == MAX_PATH, "Expected size to be unchanged, got %lu\n", size); - res = RegSetValueExA(patches, patch_squashed, 0, REG_SZ, - (const BYTE *)"whatever", 9); + res = RegSetValueExA(patches, patch_squashed, 0, REG_SZ, (const BYTE *)"whatever", 9); ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %ld\n", res); /* patch code value exists */ @@ -11729,10 +10771,8 @@ static void test_MsiEnumPatches(void) lstrcpyA(transforms, "banana"); r = MsiEnumPatchesA(prodcode, 0, patch, transforms, &size); ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r); - ok(!lstrcmpA(patch, patchcode), - "Expected \"%s\", got \"%s\"\n", patchcode, patch); - ok(!lstrcmpA(transforms, "whatever"), - "Expected \"whatever\", got \"%s\"\n", transforms); + ok(!lstrcmpA(patch, patchcode), "Expected \"%s\", got \"%s\"\n", patchcode, patch); + ok(!lstrcmpA(transforms, "whatever"), "Expected \"whatever\", got \"%s\"\n", transforms); ok(size == 8 || size == MAX_PATH, "Expected 8 or MAX_PATH, got %lu\n", size); lstrcpyA(keypath, "Software\\Microsoft\\Windows\\CurrentVersion\\"); @@ -11748,10 +10788,8 @@ static void test_MsiEnumPatches(void) lstrcpyA(transforms, "banana"); r = MsiEnumPatchesA(prodcode, 0, patch, transforms, &size); ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r); - ok(!lstrcmpA(patch, patchcode), - "Expected \"%s\", got \"%s\"\n", patchcode, patch); - ok(!lstrcmpA(transforms, "whatever"), - "Expected \"whatever\", got \"%s\"\n", transforms); + ok(!lstrcmpA(patch, patchcode), "Expected \"%s\", got \"%s\"\n", patchcode, patch); + ok(!lstrcmpA(transforms, "whatever"), "Expected \"whatever\", got \"%s\"\n", transforms); ok(size == 8 || size == MAX_PATH, "Expected 8 or MAX_PATH, got %lu\n", size); res = RegCreateKeyExA(udprod, "Patches", 0, NULL, 0, access, NULL, &udpatch, NULL); @@ -11763,10 +10801,8 @@ static void test_MsiEnumPatches(void) lstrcpyA(transforms, "banana"); r = MsiEnumPatchesA(prodcode, 0, patch, transforms, &size); ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r); - ok(!lstrcmpA(patch, patchcode), - "Expected \"%s\", got \"%s\"\n", patchcode, patch); - ok(!lstrcmpA(transforms, "whatever"), - "Expected \"whatever\", got \"%s\"\n", transforms); + ok(!lstrcmpA(patch, patchcode), "Expected \"%s\", got \"%s\"\n", patchcode, patch); + ok(!lstrcmpA(transforms, "whatever"), "Expected \"whatever\", got \"%s\"\n", transforms); ok(size == 8 || size == MAX_PATH, "Expected 8 or MAX_PATH, got %lu\n", size); res = RegCreateKeyExA(udpatch, patch_squashed, 0, NULL, 0, access, NULL, &hpatch, NULL); @@ -11777,20 +10813,13 @@ static void test_MsiEnumPatches(void) lstrcpyA(patch, "apple"); lstrcpyA(transforms, "banana"); r = MsiEnumPatchesA(prodcode, 0, patch, transforms, &size); - ok(r == ERROR_NO_MORE_ITEMS || - broken(r == ERROR_SUCCESS), /* Windows Installer < 3.0 */ - "Expected ERROR_NO_MORE_ITEMS, got %d\n", r); - ok(!lstrcmpA(patch, "apple") || - broken(!lstrcmpA(patch, patchcode)), /* Windows Installer < 3.0 */ - "Expected lpPatchBuf to be unchanged, got \"%s\"\n", patch); - ok(!lstrcmpA(transforms, "banana") || - broken(!lstrcmpA(transforms, "whatever")), /* Windows Installer < 3.0 */ - "Expected lpTransformsBuf to be unchanged, got \"%s\"\n", transforms); + ok(r == ERROR_NO_MORE_ITEMS, "Expected ERROR_NO_MORE_ITEMS, got %d\n", r); + ok(!lstrcmpA(patch, "apple"), "Expected lpPatchBuf to be unchanged, got \"%s\"\n", patch); + ok(!lstrcmpA(transforms, "banana"), "Expected lpTransformsBuf to be unchanged, got \"%s\"\n", transforms); ok(size == MAX_PATH, "Expected size to be unchanged, got %lu\n", size); data = MSIPATCHSTATE_APPLIED; - res = RegSetValueExA(hpatch, "State", 0, REG_DWORD, - (const BYTE *)&data, sizeof(DWORD)); + res = RegSetValueExA(hpatch, "State", 0, REG_DWORD, (const BYTE *)&data, sizeof(DWORD)); ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %ld\n", res); /* State value exists */ @@ -11799,10 +10828,8 @@ static void test_MsiEnumPatches(void) lstrcpyA(transforms, "banana"); r = MsiEnumPatchesA(prodcode, 0, patch, transforms, &size); ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r); - ok(!lstrcmpA(patch, patchcode), - "Expected \"%s\", got \"%s\"\n", patchcode, patch); - ok(!lstrcmpA(transforms, "whatever"), - "Expected \"whatever\", got \"%s\"\n", transforms); + ok(!lstrcmpA(patch, patchcode), "Expected \"%s\", got \"%s\"\n", patchcode, patch); + ok(!lstrcmpA(transforms, "whatever"), "Expected \"whatever\", got \"%s\"\n", transforms); ok(size == 8 || size == MAX_PATH, "Expected 8 or MAX_PATH, got %lu\n", size); /* now duplicate some of the tests for the W version */ @@ -11816,11 +10843,8 @@ static void test_MsiEnumPatches(void) ok(r == ERROR_MORE_DATA, "Expected ERROR_MORE_DATA, got %d\n", r); WideCharToMultiByte( CP_ACP, 0, patchW, -1, patch, MAX_PATH, NULL, NULL ); WideCharToMultiByte( CP_ACP, 0, transformsW, -1, transforms, MAX_PATH, NULL, NULL ); - ok(!lstrcmpA(patch, patchcode), - "Expected \"%s\", got \"%s\"\n", patchcode, patch); - ok(!lstrcmpA(transforms, "whate") || - broken(!lstrcmpA(transforms, "banana")), /* Windows Installer < 3.0 */ - "Expected \"whate\", got \"%s\"\n", transforms); + ok(!lstrcmpA(patch, patchcode), "Expected \"%s\", got \"%s\"\n", patchcode, patch); + ok(!lstrcmpA(transforms, "whate"), "Expected \"whate\", got \"%s\"\n", transforms); ok(size == 8, "Expected 8, got %lu\n", size); /* patch code value exists */ @@ -11831,24 +10855,22 @@ static void test_MsiEnumPatches(void) ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r); WideCharToMultiByte( CP_ACP, 0, patchW, -1, patch, MAX_PATH, NULL, NULL ); WideCharToMultiByte( CP_ACP, 0, transformsW, -1, transforms, MAX_PATH, NULL, NULL ); - ok(!lstrcmpA(patch, patchcode), - "Expected \"%s\", got \"%s\"\n", patchcode, patch); - ok(!lstrcmpA(transforms, "whatever"), - "Expected \"whatever\", got \"%s\"\n", transforms); + ok(!lstrcmpA(patch, patchcode), "Expected \"%s\", got \"%s\"\n", patchcode, patch); + ok(!lstrcmpA(transforms, "whatever"), "Expected \"whatever\", got \"%s\"\n", transforms); ok(size == 8 || size == MAX_PATH, "Expected 8 or MAX_PATH, got %lu\n", size); RegDeleteValueA(patches, patch_squashed); RegDeleteValueA(patches, "Patches"); - delete_key(patches, "", access & KEY_WOW64_64KEY); + RegDeleteKeyExA(patches, "", access & KEY_WOW64_64KEY, 0); RegCloseKey(patches); RegDeleteValueA(hpatch, "State"); - delete_key(hpatch, "", access & KEY_WOW64_64KEY); + RegDeleteKeyExA(hpatch, "", access & KEY_WOW64_64KEY, 0); RegCloseKey(hpatch); - delete_key(udpatch, "", access & KEY_WOW64_64KEY); + RegDeleteKeyExA(udpatch, "", access & KEY_WOW64_64KEY, 0); RegCloseKey(udpatch); - delete_key(udprod, "", access & KEY_WOW64_64KEY); + RegDeleteKeyExA(udprod, "", access & KEY_WOW64_64KEY, 0); RegCloseKey(udprod); - delete_key(prodkey, "", access & KEY_WOW64_64KEY); + RegDeleteKeyExA(prodkey, "", access & KEY_WOW64_64KEY, 0); RegCloseKey(prodkey); LocalFree(usersid); } @@ -11866,12 +10888,6 @@ static void test_MsiGetPatchInfoEx(void) UINT r; REGSAM access = KEY_ALL_ACCESS; - if (!pMsiGetPatchInfoExA) - { - win_skip("MsiGetPatchInfoEx not implemented\n"); - return; - } - create_test_guid(prodcode, prod_squashed); create_test_guid(patchcode, patch_squashed); usersid = get_user_sid(); @@ -11882,237 +10898,181 @@ static void test_MsiGetPatchInfoEx(void) /* NULL szPatchCode */ lstrcpyA(val, "apple"); size = MAX_PATH; - r = pMsiGetPatchInfoExA(NULL, prodcode, NULL, MSIINSTALLCONTEXT_USERMANAGED, - INSTALLPROPERTY_LOCALPACKAGEA, val, &size); - ok(r == ERROR_INVALID_PARAMETER, - "Expected ERROR_INVALID_PARAMETER, got %d\n", r); - ok(!lstrcmpA(val, "apple"), - "Expected val to be unchanged, got \"%s\"\n", val); + r = MsiGetPatchInfoExA(NULL, prodcode, NULL, MSIINSTALLCONTEXT_USERMANAGED, INSTALLPROPERTY_LOCALPACKAGEA, + val, &size); + ok(r == ERROR_INVALID_PARAMETER, "Expected ERROR_INVALID_PARAMETER, got %d\n", r); + ok(!lstrcmpA(val, "apple"), "Expected val to be unchanged, got \"%s\"\n", val); ok(size == MAX_PATH, "Expected size to be unchanged, got %lu\n", size); /* empty szPatchCode */ size = MAX_PATH; lstrcpyA(val, "apple"); - r = pMsiGetPatchInfoExA("", prodcode, NULL, MSIINSTALLCONTEXT_USERMANAGED, - INSTALLPROPERTY_LOCALPACKAGEA, val, &size); - ok(r == ERROR_INVALID_PARAMETER, - "Expected ERROR_INVALID_PARAMETER, got %d\n", r); - ok(!lstrcmpA(val, "apple"), - "Expected val to be unchanged, got \"%s\"\n", val); + r = MsiGetPatchInfoExA("", prodcode, NULL, MSIINSTALLCONTEXT_USERMANAGED, INSTALLPROPERTY_LOCALPACKAGEA, + val, &size); + ok(r == ERROR_INVALID_PARAMETER, "Expected ERROR_INVALID_PARAMETER, got %d\n", r); + ok(!lstrcmpA(val, "apple"), "Expected val to be unchanged, got \"%s\"\n", val); ok(size == MAX_PATH, "Expected size to be unchanged, got %lu\n", size); /* garbage szPatchCode */ size = MAX_PATH; lstrcpyA(val, "apple"); - r = pMsiGetPatchInfoExA("garbage", prodcode, NULL, - MSIINSTALLCONTEXT_USERMANAGED, - INSTALLPROPERTY_LOCALPACKAGEA, val, &size); - ok(r == ERROR_INVALID_PARAMETER, - "Expected ERROR_INVALID_PARAMETER, got %d\n", r); - ok(!lstrcmpA(val, "apple"), - "Expected val to be unchanged, got \"%s\"\n", val); + r = MsiGetPatchInfoExA("garbage", prodcode, NULL, MSIINSTALLCONTEXT_USERMANAGED, INSTALLPROPERTY_LOCALPACKAGEA, + val, &size); + ok(r == ERROR_INVALID_PARAMETER, "Expected ERROR_INVALID_PARAMETER, got %d\n", r); + ok(!lstrcmpA(val, "apple"), "Expected val to be unchanged, got \"%s\"\n", val); ok(size == MAX_PATH, "Expected size to be unchanged, got %lu\n", size); /* guid without brackets */ size = MAX_PATH; lstrcpyA(val, "apple"); - r = pMsiGetPatchInfoExA("6700E8CF-95AB-4D9C-BC2C-15840DEA7A5D", prodcode, - NULL, MSIINSTALLCONTEXT_USERMANAGED, - INSTALLPROPERTY_LOCALPACKAGEA, val, &size); - ok(r == ERROR_INVALID_PARAMETER, - "Expected ERROR_INVALID_PARAMETER, got %d\n", r); - ok(!lstrcmpA(val, "apple"), - "Expected val to be unchanged, got \"%s\"\n", val); + r = MsiGetPatchInfoExA("6700E8CF-95AB-4D9C-BC2C-15840DEA7A5D", prodcode, NULL, MSIINSTALLCONTEXT_USERMANAGED, + INSTALLPROPERTY_LOCALPACKAGEA, val, &size); + ok(r == ERROR_INVALID_PARAMETER, "Expected ERROR_INVALID_PARAMETER, got %d\n", r); + ok(!lstrcmpA(val, "apple"), "Expected val to be unchanged, got \"%s\"\n", val); ok(size == MAX_PATH, "Expected size to be unchanged, got %lu\n", size); /* guid with brackets */ size = MAX_PATH; lstrcpyA(val, "apple"); - r = pMsiGetPatchInfoExA("{6700E8CF-95AB-4D9C-BC2C-15840DEA7A5D}", prodcode, - NULL, MSIINSTALLCONTEXT_USERMANAGED, - INSTALLPROPERTY_LOCALPACKAGEA, val, &size); - ok(r == ERROR_UNKNOWN_PRODUCT, - "Expected ERROR_UNKNOWN_PRODUCT, got %d\n", r); - ok(!lstrcmpA(val, "apple"), - "Expected val to be unchanged, got \"%s\"\n", val); + r = MsiGetPatchInfoExA("{6700E8CF-95AB-4D9C-BC2C-15840DEA7A5D}", prodcode, NULL, MSIINSTALLCONTEXT_USERMANAGED, + INSTALLPROPERTY_LOCALPACKAGEA, val, &size); + ok(r == ERROR_UNKNOWN_PRODUCT, "Expected ERROR_UNKNOWN_PRODUCT, got %d\n", r); + ok(!lstrcmpA(val, "apple"), "Expected val to be unchanged, got \"%s\"\n", val); ok(size == MAX_PATH, "Expected size to be unchanged, got %lu\n", size); /* same length as guid, but random */ size = MAX_PATH; lstrcpyA(val, "apple"); - r = pMsiGetPatchInfoExA("A938G02JF-2NF3N93-VN3-2NNF-3KGKALDNF93", prodcode, - NULL, MSIINSTALLCONTEXT_USERMANAGED, - INSTALLPROPERTY_LOCALPACKAGEA, val, &size); - ok(r == ERROR_INVALID_PARAMETER, - "Expected ERROR_INVALID_PARAMETER, got %d\n", r); - ok(!lstrcmpA(val, "apple"), - "Expected val to be unchanged, got \"%s\"\n", val); + r = MsiGetPatchInfoExA("A938G02JF-2NF3N93-VN3-2NNF-3KGKALDNF93", prodcode, NULL, MSIINSTALLCONTEXT_USERMANAGED, + INSTALLPROPERTY_LOCALPACKAGEA, val, &size); + ok(r == ERROR_INVALID_PARAMETER, "Expected ERROR_INVALID_PARAMETER, got %d\n", r); + ok(!lstrcmpA(val, "apple"), "Expected val to be unchanged, got \"%s\"\n", val); ok(size == MAX_PATH, "Expected size to be unchanged, got %lu\n", size); /* NULL szProductCode */ lstrcpyA(val, "apple"); size = MAX_PATH; - r = pMsiGetPatchInfoExA(patchcode, NULL, NULL, MSIINSTALLCONTEXT_USERMANAGED, - INSTALLPROPERTY_LOCALPACKAGEA, val, &size); - ok(r == ERROR_INVALID_PARAMETER, - "Expected ERROR_INVALID_PARAMETER, got %d\n", r); - ok(!lstrcmpA(val, "apple"), - "Expected val to be unchanged, got \"%s\"\n", val); + r = MsiGetPatchInfoExA(patchcode, NULL, NULL, MSIINSTALLCONTEXT_USERMANAGED, INSTALLPROPERTY_LOCALPACKAGEA, + val, &size); + ok(r == ERROR_INVALID_PARAMETER, "Expected ERROR_INVALID_PARAMETER, got %d\n", r); + ok(!lstrcmpA(val, "apple"), "Expected val to be unchanged, got \"%s\"\n", val); ok(size == MAX_PATH, "Expected size to be unchanged, got %lu\n", size); /* empty szProductCode */ size = MAX_PATH; lstrcpyA(val, "apple"); - r = pMsiGetPatchInfoExA(patchcode, "", NULL, MSIINSTALLCONTEXT_USERMANAGED, - INSTALLPROPERTY_LOCALPACKAGEA, val, &size); - ok(r == ERROR_INVALID_PARAMETER, - "Expected ERROR_INVALID_PARAMETER, got %d\n", r); - ok(!lstrcmpA(val, "apple"), - "Expected val to be unchanged, got \"%s\"\n", val); + r = MsiGetPatchInfoExA(patchcode, "", NULL, MSIINSTALLCONTEXT_USERMANAGED, INSTALLPROPERTY_LOCALPACKAGEA, + val, &size); + ok(r == ERROR_INVALID_PARAMETER, "Expected ERROR_INVALID_PARAMETER, got %d\n", r); + ok(!lstrcmpA(val, "apple"), "Expected val to be unchanged, got \"%s\"\n", val); ok(size == MAX_PATH, "Expected size to be unchanged, got %lu\n", size); /* garbage szProductCode */ size = MAX_PATH; lstrcpyA(val, "apple"); - r = pMsiGetPatchInfoExA(patchcode, "garbage", NULL, - MSIINSTALLCONTEXT_USERMANAGED, - INSTALLPROPERTY_LOCALPACKAGEA, val, &size); - ok(r == ERROR_INVALID_PARAMETER, - "Expected ERROR_INVALID_PARAMETER, got %d\n", r); - ok(!lstrcmpA(val, "apple"), - "Expected val to be unchanged, got \"%s\"\n", val); + r = MsiGetPatchInfoExA(patchcode, "garbage", NULL, MSIINSTALLCONTEXT_USERMANAGED, INSTALLPROPERTY_LOCALPACKAGEA, + val, &size); + ok(r == ERROR_INVALID_PARAMETER, "Expected ERROR_INVALID_PARAMETER, got %d\n", r); + ok(!lstrcmpA(val, "apple"), "Expected val to be unchanged, got \"%s\"\n", val); ok(size == MAX_PATH, "Expected size to be unchanged, got %lu\n", size); /* guid without brackets */ size = MAX_PATH; lstrcpyA(val, "apple"); - r = pMsiGetPatchInfoExA(patchcode, "6700E8CF-95AB-4D9C-BC2C-15840DEA7A5D", - NULL, MSIINSTALLCONTEXT_USERMANAGED, - INSTALLPROPERTY_LOCALPACKAGEA, val, &size); - ok(r == ERROR_INVALID_PARAMETER, - "Expected ERROR_INVALID_PARAMETER, got %d\n", r); - ok(!lstrcmpA(val, "apple"), - "Expected val to be unchanged, got \"%s\"\n", val); + r = MsiGetPatchInfoExA(patchcode, "6700E8CF-95AB-4D9C-BC2C-15840DEA7A5D", NULL, MSIINSTALLCONTEXT_USERMANAGED, + INSTALLPROPERTY_LOCALPACKAGEA, val, &size); + ok(r == ERROR_INVALID_PARAMETER, "Expected ERROR_INVALID_PARAMETER, got %d\n", r); + ok(!lstrcmpA(val, "apple"), "Expected val to be unchanged, got \"%s\"\n", val); ok(size == MAX_PATH, "Expected size to be unchanged, got %lu\n", size); /* guid with brackets */ size = MAX_PATH; lstrcpyA(val, "apple"); - r = pMsiGetPatchInfoExA(patchcode, "{6700E8CF-95AB-4D9C-BC2C-15840DEA7A5D}", - NULL, MSIINSTALLCONTEXT_USERMANAGED, - INSTALLPROPERTY_LOCALPACKAGEA, val, &size); - ok(r == ERROR_UNKNOWN_PRODUCT, - "Expected ERROR_UNKNOWN_PRODUCT, got %d\n", r); - ok(!lstrcmpA(val, "apple"), - "Expected val to be unchanged, got \"%s\"\n", val); + r = MsiGetPatchInfoExA(patchcode, "{6700E8CF-95AB-4D9C-BC2C-15840DEA7A5D}", NULL, MSIINSTALLCONTEXT_USERMANAGED, + INSTALLPROPERTY_LOCALPACKAGEA, val, &size); + ok(r == ERROR_UNKNOWN_PRODUCT, "Expected ERROR_UNKNOWN_PRODUCT, got %d\n", r); + ok(!lstrcmpA(val, "apple"), "Expected val to be unchanged, got \"%s\"\n", val); ok(size == MAX_PATH, "Expected size to be unchanged, got %lu\n", size); /* same length as guid, but random */ size = MAX_PATH; lstrcpyA(val, "apple"); - r = pMsiGetPatchInfoExA(patchcode, "A938G02JF-2NF3N93-VN3-2NNF-3KGKALDNF93", - NULL, MSIINSTALLCONTEXT_USERMANAGED, - INSTALLPROPERTY_LOCALPACKAGEA, val, &size); - ok(r == ERROR_INVALID_PARAMETER, - "Expected ERROR_INVALID_PARAMETER, got %d\n", r); - ok(!lstrcmpA(val, "apple"), - "Expected val to be unchanged, got \"%s\"\n", val); + r = MsiGetPatchInfoExA(patchcode, "A938G02JF-2NF3N93-VN3-2NNF-3KGKALDNF93", NULL, MSIINSTALLCONTEXT_USERMANAGED, + INSTALLPROPERTY_LOCALPACKAGEA, val, &size); + ok(r == ERROR_INVALID_PARAMETER, "Expected ERROR_INVALID_PARAMETER, got %d\n", r); + ok(!lstrcmpA(val, "apple"), "Expected val to be unchanged, got \"%s\"\n", val); ok(size == MAX_PATH, "Expected size to be unchanged, got %lu\n", size); /* szUserSid cannot be S-1-5-18 for MSIINSTALLCONTEXT_USERMANAGED */ size = MAX_PATH; lstrcpyA(val, "apple"); - r = pMsiGetPatchInfoExA(patchcode, prodcode, "S-1-5-18", - MSIINSTALLCONTEXT_USERMANAGED, - INSTALLPROPERTY_LOCALPACKAGEA, val, &size); - ok(r == ERROR_INVALID_PARAMETER, - "Expected ERROR_INVALID_PARAMETER, got %d\n", r); - ok(!lstrcmpA(val, "apple"), - "Expected val to be unchanged, got \"%s\"\n", val); + r = MsiGetPatchInfoExA(patchcode, prodcode, "S-1-5-18", MSIINSTALLCONTEXT_USERMANAGED, INSTALLPROPERTY_LOCALPACKAGEA, + val, &size); + ok(r == ERROR_INVALID_PARAMETER, "Expected ERROR_INVALID_PARAMETER, got %d\n", r); + ok(!lstrcmpA(val, "apple"), "Expected val to be unchanged, got \"%s\"\n", val); ok(size == MAX_PATH, "Expected size to be unchanged, got %lu\n", size); /* szUserSid cannot be S-1-5-18 for MSIINSTALLCONTEXT_USERUNMANAGED */ size = MAX_PATH; lstrcpyA(val, "apple"); - r = pMsiGetPatchInfoExA(patchcode, prodcode, "S-1-5-18", - MSIINSTALLCONTEXT_USERUNMANAGED, - INSTALLPROPERTY_LOCALPACKAGEA, val, &size); - ok(r == ERROR_INVALID_PARAMETER, - "Expected ERROR_INVALID_PARAMETER, got %d\n", r); - ok(!lstrcmpA(val, "apple"), - "Expected val to be unchanged, got \"%s\"\n", val); + r = MsiGetPatchInfoExA(patchcode, prodcode, "S-1-5-18", MSIINSTALLCONTEXT_USERUNMANAGED, INSTALLPROPERTY_LOCALPACKAGEA, + val, &size); + ok(r == ERROR_INVALID_PARAMETER, "Expected ERROR_INVALID_PARAMETER, got %d\n", r); + ok(!lstrcmpA(val, "apple"), "Expected val to be unchanged, got \"%s\"\n", val); ok(size == MAX_PATH, "Expected size to be unchanged, got %lu\n", size); /* szUserSid cannot be S-1-5-18 for MSIINSTALLCONTEXT_MACHINE */ size = MAX_PATH; lstrcpyA(val, "apple"); - r = pMsiGetPatchInfoExA(patchcode, prodcode, "S-1-5-18", - MSIINSTALLCONTEXT_MACHINE, - INSTALLPROPERTY_LOCALPACKAGEA, val, &size); - ok(r == ERROR_INVALID_PARAMETER, - "Expected ERROR_INVALID_PARAMETER, got %d\n", r); - ok(!lstrcmpA(val, "apple"), - "Expected val to be unchanged, got \"%s\"\n", val); + r = MsiGetPatchInfoExA(patchcode, prodcode, "S-1-5-18", MSIINSTALLCONTEXT_MACHINE, INSTALLPROPERTY_LOCALPACKAGEA, + val, &size); + ok(r == ERROR_INVALID_PARAMETER, "Expected ERROR_INVALID_PARAMETER, got %d\n", r); + ok(!lstrcmpA(val, "apple"), "Expected val to be unchanged, got \"%s\"\n", val); ok(size == MAX_PATH, "Expected size to be unchanged, got %lu\n", size); /* szUserSid must be NULL for MSIINSTALLCONTEXT_MACHINE */ size = MAX_PATH; lstrcpyA(val, "apple"); - r = pMsiGetPatchInfoExA(patchcode, prodcode, usersid, - MSIINSTALLCONTEXT_MACHINE, - INSTALLPROPERTY_LOCALPACKAGEA, val, &size); - ok(r == ERROR_INVALID_PARAMETER, - "Expected ERROR_INVALID_PARAMETER, got %d\n", r); - ok(!lstrcmpA(val, "apple"), - "Expected val to be unchanged, got \"%s\"\n", val); + r = MsiGetPatchInfoExA(patchcode, prodcode, usersid, MSIINSTALLCONTEXT_MACHINE, INSTALLPROPERTY_LOCALPACKAGEA, + val, &size); + ok(r == ERROR_INVALID_PARAMETER, "Expected ERROR_INVALID_PARAMETER, got %d\n", r); + ok(!lstrcmpA(val, "apple"), "Expected val to be unchanged, got \"%s\"\n", val); ok(size == MAX_PATH, "Expected size to be unchanged, got %lu\n", size); /* dwContext is out of range */ size = MAX_PATH; lstrcpyA(val, "apple"); - r = pMsiGetPatchInfoExA(patchcode, prodcode, usersid, - MSIINSTALLCONTEXT_NONE, - INSTALLPROPERTY_LOCALPACKAGEA, val, &size); - ok(r == ERROR_INVALID_PARAMETER, - "Expected ERROR_INVALID_PARAMETER, got %d\n", r); - ok(!lstrcmpA(val, "apple"), - "Expected val to be unchanged, got \"%s\"\n", val); + r = MsiGetPatchInfoExA(patchcode, prodcode, usersid, MSIINSTALLCONTEXT_NONE, INSTALLPROPERTY_LOCALPACKAGEA, + val, &size); + ok(r == ERROR_INVALID_PARAMETER, "Expected ERROR_INVALID_PARAMETER, got %d\n", r); + ok(!lstrcmpA(val, "apple"), "Expected val to be unchanged, got \"%s\"\n", val); ok(size == MAX_PATH, "Expected size to be unchanged, got %lu\n", size); /* dwContext is out of range */ size = MAX_PATH; lstrcpyA(val, "apple"); - r = pMsiGetPatchInfoExA(patchcode, prodcode, usersid, - MSIINSTALLCONTEXT_ALL, - INSTALLPROPERTY_LOCALPACKAGEA, val, &size); - ok(r == ERROR_INVALID_PARAMETER, - "Expected ERROR_INVALID_PARAMETER, got %d\n", r); - ok(!lstrcmpA(val, "apple"), - "Expected val to be unchanged, got \"%s\"\n", val); + r = MsiGetPatchInfoExA(patchcode, prodcode, usersid, MSIINSTALLCONTEXT_ALL, INSTALLPROPERTY_LOCALPACKAGEA, + val, &size); + ok(r == ERROR_INVALID_PARAMETER, "Expected ERROR_INVALID_PARAMETER, got %d\n", r); + ok(!lstrcmpA(val, "apple"), "Expected val to be unchanged, got \"%s\"\n", val); ok(size == MAX_PATH, "Expected size to be unchanged, got %lu\n", size); /* dwContext is invalid */ size = MAX_PATH; lstrcpyA(val, "apple"); - r = pMsiGetPatchInfoExA(patchcode, prodcode, usersid, 3, - INSTALLPROPERTY_LOCALPACKAGEA, val, &size); - ok(r == ERROR_INVALID_PARAMETER, - "Expected ERROR_INVALID_PARAMETER, got %d\n", r); - ok(!lstrcmpA(val, "apple"), - "Expected val to be unchanged, got \"%s\"\n", val); + r = MsiGetPatchInfoExA(patchcode, prodcode, usersid, 3, INSTALLPROPERTY_LOCALPACKAGEA, val, &size); + ok(r == ERROR_INVALID_PARAMETER, "Expected ERROR_INVALID_PARAMETER, got %d\n", r); + ok(!lstrcmpA(val, "apple"), "Expected val to be unchanged, got \"%s\"\n", val); ok(size == MAX_PATH, "Expected size to be unchanged, got %lu\n", size); /* MSIINSTALLCONTEXT_USERMANAGED */ size = MAX_PATH; lstrcpyA(val, "apple"); - r = pMsiGetPatchInfoExA(patchcode, prodcode, usersid, - MSIINSTALLCONTEXT_USERMANAGED, - INSTALLPROPERTY_LOCALPACKAGEA, val, &size); - ok(r == ERROR_UNKNOWN_PRODUCT, - "Expected ERROR_UNKNOWN_PRODUCT, got %d\n", r); - ok(!lstrcmpA(val, "apple"), - "Expected val to be unchanged, got \"%s\"\n", val); + r = MsiGetPatchInfoExA(patchcode, prodcode, usersid, MSIINSTALLCONTEXT_USERMANAGED, INSTALLPROPERTY_LOCALPACKAGEA, + val, &size); + ok(r == ERROR_UNKNOWN_PRODUCT, "Expected ERROR_UNKNOWN_PRODUCT, got %d\n", r); + ok(!lstrcmpA(val, "apple"), "Expected val to be unchanged, got \"%s\"\n", val); ok(size == MAX_PATH, "Expected size to be unchanged, got %lu\n", size); lstrcpyA(keypath, "Software\\Microsoft\\Windows\\CurrentVersion\\Installer\\UserData\\"); @@ -12132,13 +11092,10 @@ static void test_MsiGetPatchInfoEx(void) /* local UserData product key exists */ size = MAX_PATH; lstrcpyA(val, "apple"); - r = pMsiGetPatchInfoExA(patchcode, prodcode, usersid, - MSIINSTALLCONTEXT_USERMANAGED, - INSTALLPROPERTY_LOCALPACKAGEA, val, &size); - ok(r == ERROR_UNKNOWN_PRODUCT, - "Expected ERROR_UNKNOWN_PRODUCT, got %d\n", r); - ok(!lstrcmpA(val, "apple"), - "Expected val to be unchanged, got \"%s\"\n", val); + r = MsiGetPatchInfoExA(patchcode, prodcode, usersid, MSIINSTALLCONTEXT_USERMANAGED, INSTALLPROPERTY_LOCALPACKAGEA, + val, &size); + ok(r == ERROR_UNKNOWN_PRODUCT, "Expected ERROR_UNKNOWN_PRODUCT, got %d\n", r); + ok(!lstrcmpA(val, "apple"), "Expected val to be unchanged, got \"%s\"\n", val); ok(size == MAX_PATH, "Expected size to be unchanged, got %lu\n", size); res = RegCreateKeyExA(udprod, "InstallProperties", 0, NULL, 0, access, NULL, &props, NULL); @@ -12147,12 +11104,10 @@ static void test_MsiGetPatchInfoEx(void) /* InstallProperties key exists */ size = MAX_PATH; lstrcpyA(val, "apple"); - r = pMsiGetPatchInfoExA(patchcode, prodcode, usersid, - MSIINSTALLCONTEXT_USERMANAGED, - INSTALLPROPERTY_LOCALPACKAGEA, val, &size); + r = MsiGetPatchInfoExA(patchcode, prodcode, usersid, MSIINSTALLCONTEXT_USERMANAGED, INSTALLPROPERTY_LOCALPACKAGEA, + val, &size); ok(r == ERROR_UNKNOWN_PATCH, "Expected ERROR_UNKNOWN_PATCH, got %d\n", r); - ok(!lstrcmpA(val, "apple"), - "Expected val to be unchanged, got \"%s\"\n", val); + ok(!lstrcmpA(val, "apple"), "Expected val to be unchanged, got \"%s\"\n", val); ok(size == MAX_PATH, "Expected size to be unchanged, got %lu\n", size); res = RegCreateKeyExA(udprod, "Patches", 0, NULL, 0, access, NULL, &patches, NULL); @@ -12161,12 +11116,10 @@ static void test_MsiGetPatchInfoEx(void) /* Patches key exists */ size = MAX_PATH; lstrcpyA(val, "apple"); - r = pMsiGetPatchInfoExA(patchcode, prodcode, usersid, - MSIINSTALLCONTEXT_USERMANAGED, - INSTALLPROPERTY_LOCALPACKAGEA, val, &size); + r = MsiGetPatchInfoExA(patchcode, prodcode, usersid, MSIINSTALLCONTEXT_USERMANAGED, INSTALLPROPERTY_LOCALPACKAGEA, + val, &size); ok(r == ERROR_UNKNOWN_PATCH, "Expected ERROR_UNKNOWN_PATCHA, got %d\n", r); - ok(!lstrcmpA(val, "apple"), - "Expected val to be unchanged, got \"%s\"\n", val); + ok(!lstrcmpA(val, "apple"), "Expected val to be unchanged, got \"%s\"\n", val); ok(size == MAX_PATH, "Expected size to be unchanged, got %lu\n", size); res = RegCreateKeyExA(patches, patch_squashed, 0, NULL, 0, access, NULL, &hpatch, NULL); @@ -12175,12 +11128,10 @@ static void test_MsiGetPatchInfoEx(void) /* Patches key exists */ size = MAX_PATH; lstrcpyA(val, "apple"); - r = pMsiGetPatchInfoExA(patchcode, prodcode, usersid, - MSIINSTALLCONTEXT_USERMANAGED, - INSTALLPROPERTY_LOCALPACKAGEA, val, &size); + r = MsiGetPatchInfoExA(patchcode, prodcode, usersid, MSIINSTALLCONTEXT_USERMANAGED, INSTALLPROPERTY_LOCALPACKAGEA, + val, &size); ok(r == ERROR_UNKNOWN_PATCH, "Expected ERROR_UNKNOWN_PATCH, got %d\n", r); - ok(!lstrcmpA(val, "apple"), - "Expected val to be unchanged, got \"%s\"\n", val); + ok(!lstrcmpA(val, "apple"), "Expected val to be unchanged, got \"%s\"\n", val); ok(size == MAX_PATH, "Expected size to be unchanged, got %lu\n", size); lstrcpyA(keypath, "Software\\Microsoft\\Windows\\CurrentVersion\\Installer\\Managed\\"); @@ -12194,12 +11145,10 @@ static void test_MsiGetPatchInfoEx(void) /* managed product key exists */ size = MAX_PATH; lstrcpyA(val, "apple"); - r = pMsiGetPatchInfoExA(patchcode, prodcode, usersid, - MSIINSTALLCONTEXT_USERMANAGED, - INSTALLPROPERTY_LOCALPACKAGEA, val, &size); + r = MsiGetPatchInfoExA(patchcode, prodcode, usersid, MSIINSTALLCONTEXT_USERMANAGED, INSTALLPROPERTY_LOCALPACKAGEA, + val, &size); ok(r == ERROR_UNKNOWN_PATCH, "Expected ERROR_UNKNOWN_PATCH, got %d\n", r); - ok(!lstrcmpA(val, "apple"), - "Expected val to be unchanged, got \"%s\"\n", val); + ok(!lstrcmpA(val, "apple"), "Expected val to be unchanged, got \"%s\"\n", val); ok(size == MAX_PATH, "Expected size to be unchanged, got %lu\n", size); res = RegCreateKeyExA(prodkey, "Patches", 0, NULL, 0, access, NULL, &prodpatches, NULL); @@ -12208,27 +11157,22 @@ static void test_MsiGetPatchInfoEx(void) /* Patches key exists */ size = MAX_PATH; lstrcpyA(val, "apple"); - r = pMsiGetPatchInfoExA(patchcode, prodcode, usersid, - MSIINSTALLCONTEXT_USERMANAGED, - INSTALLPROPERTY_LOCALPACKAGEA, val, &size); + r = MsiGetPatchInfoExA(patchcode, prodcode, usersid, MSIINSTALLCONTEXT_USERMANAGED, INSTALLPROPERTY_LOCALPACKAGEA, + val, &size); ok(r == ERROR_UNKNOWN_PATCH, "Expected ERROR_UNKNOWN_PATCH, got %d\n", r); - ok(!lstrcmpA(val, "apple"), - "Expected val to be unchanged, got \"%s\"\n", val); + ok(!lstrcmpA(val, "apple"), "Expected val to be unchanged, got \"%s\"\n", val); ok(size == MAX_PATH, "Expected size to be unchanged, got %lu\n", size); - res = RegSetValueExA(prodpatches, patch_squashed, 0, REG_SZ, - (const BYTE *)"transforms", 11); + res = RegSetValueExA(prodpatches, patch_squashed, 0, REG_SZ, (const BYTE *)"transforms", 11); ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %ld\n", res); /* specific patch value exists */ size = MAX_PATH; lstrcpyA(val, "apple"); - r = pMsiGetPatchInfoExA(patchcode, prodcode, usersid, - MSIINSTALLCONTEXT_USERMANAGED, - INSTALLPROPERTY_LOCALPACKAGEA, val, &size); + r = MsiGetPatchInfoExA(patchcode, prodcode, usersid, MSIINSTALLCONTEXT_USERMANAGED, INSTALLPROPERTY_LOCALPACKAGEA, + val, &size); ok(r == ERROR_UNKNOWN_PATCH, "Expected ERROR_UNKNOWN_PATCH, got %d\n", r); - ok(!lstrcmpA(val, "apple"), - "Expected val to be unchanged, got \"%s\"\n", val); + ok(!lstrcmpA(val, "apple"), "Expected val to be unchanged, got \"%s\"\n", val); ok(size == MAX_PATH, "Expected size to be unchanged, got %lu\n", size); lstrcpyA(keypath, "Software\\Microsoft\\Windows\\CurrentVersion\\Installer\\UserData\\"); @@ -12242,132 +11186,114 @@ static void test_MsiGetPatchInfoEx(void) /* UserData Patches key exists */ size = MAX_PATH; lstrcpyA(val, "apple"); - r = pMsiGetPatchInfoExA(patchcode, prodcode, usersid, - MSIINSTALLCONTEXT_USERMANAGED, - INSTALLPROPERTY_LOCALPACKAGEA, val, &size); + r = MsiGetPatchInfoExA(patchcode, prodcode, usersid, MSIINSTALLCONTEXT_USERMANAGED, INSTALLPROPERTY_LOCALPACKAGEA, + val, &size); ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r); ok(!lstrcmpA(val, ""), "Expected \"\", got \"%s\"\n", val); ok(size == 0, "Expected 0, got %lu\n", size); - res = RegSetValueExA(udpatch, "ManagedLocalPackage", 0, REG_SZ, - (const BYTE *)"pack", 5); + res = RegSetValueExA(udpatch, "ManagedLocalPackage", 0, REG_SZ, (const BYTE *)"pack", 5); ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %ld\n", res); /* ManagedLocalPatch value exists */ size = MAX_PATH; lstrcpyA(val, "apple"); - r = pMsiGetPatchInfoExA(patchcode, prodcode, usersid, - MSIINSTALLCONTEXT_USERMANAGED, - INSTALLPROPERTY_LOCALPACKAGEA, val, &size); + r = MsiGetPatchInfoExA(patchcode, prodcode, usersid, MSIINSTALLCONTEXT_USERMANAGED, INSTALLPROPERTY_LOCALPACKAGEA, + val, &size); ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r); ok(!lstrcmpA(val, "pack"), "Expected \"pack\", got \"%s\"\n", val); ok(size == 4, "Expected 4, got %lu\n", size); size = MAX_PATH; lstrcpyA(val, "apple"); - r = pMsiGetPatchInfoExA(patchcode, prodcode, usersid, - MSIINSTALLCONTEXT_USERMANAGED, - INSTALLPROPERTY_TRANSFORMSA, val, &size); + r = MsiGetPatchInfoExA(patchcode, prodcode, usersid, MSIINSTALLCONTEXT_USERMANAGED, INSTALLPROPERTY_TRANSFORMSA, + val, &size); ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r); ok(!lstrcmpA(val, "transforms"), "Expected \"transforms\", got \"%s\"\n", val); ok(size == 10, "Expected 10, got %lu\n", size); - res = RegSetValueExA(hpatch, "Installed", 0, REG_SZ, - (const BYTE *)"mydate", 7); + res = RegSetValueExA(hpatch, "Installed", 0, REG_SZ, (const BYTE *)"mydate", 7); ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %ld\n", res); /* Installed value exists */ size = MAX_PATH; lstrcpyA(val, "apple"); - r = pMsiGetPatchInfoExA(patchcode, prodcode, usersid, - MSIINSTALLCONTEXT_USERMANAGED, - INSTALLPROPERTY_INSTALLDATEA, val, &size); + r = MsiGetPatchInfoExA(patchcode, prodcode, usersid, MSIINSTALLCONTEXT_USERMANAGED, INSTALLPROPERTY_INSTALLDATEA, + val, &size); ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r); ok(!lstrcmpA(val, "mydate"), "Expected \"mydate\", got \"%s\"\n", val); ok(size == 6, "Expected 6, got %lu\n", size); - res = RegSetValueExA(hpatch, "Uninstallable", 0, REG_SZ, - (const BYTE *)"yes", 4); + res = RegSetValueExA(hpatch, "Uninstallable", 0, REG_SZ, (const BYTE *)"yes", 4); ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %ld\n", res); /* Uninstallable value exists */ size = MAX_PATH; lstrcpyA(val, "apple"); - r = pMsiGetPatchInfoExA(patchcode, prodcode, usersid, - MSIINSTALLCONTEXT_USERMANAGED, - INSTALLPROPERTY_UNINSTALLABLEA, val, &size); + r = MsiGetPatchInfoExA(patchcode, prodcode, usersid, MSIINSTALLCONTEXT_USERMANAGED, INSTALLPROPERTY_UNINSTALLABLEA, + val, &size); ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r); ok(!lstrcmpA(val, "yes"), "Expected \"yes\", got \"%s\"\n", val); ok(size == 3, "Expected 3, got %lu\n", size); - res = RegSetValueExA(hpatch, "State", 0, REG_SZ, - (const BYTE *)"good", 5); + res = RegSetValueExA(hpatch, "State", 0, REG_SZ, (const BYTE *)"good", 5); ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %ld\n", res); /* State value exists */ size = MAX_PATH; lstrcpyA(val, "apple"); - r = pMsiGetPatchInfoExA(patchcode, prodcode, usersid, - MSIINSTALLCONTEXT_USERMANAGED, - INSTALLPROPERTY_PATCHSTATEA, val, &size); + r = MsiGetPatchInfoExA(patchcode, prodcode, usersid, MSIINSTALLCONTEXT_USERMANAGED, INSTALLPROPERTY_PATCHSTATEA, + val, &size); ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r); ok(!lstrcmpA(val, "good"), "Expected \"good\", got \"%s\"\n", val); ok(size == 4, "Expected 4, got %lu\n", size); size = 1; - res = RegSetValueExA(hpatch, "State", 0, REG_DWORD, - (const BYTE *)&size, sizeof(DWORD)); + res = RegSetValueExA(hpatch, "State", 0, REG_DWORD, (const BYTE *)&size, sizeof(DWORD)); ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %ld\n", res); /* State value exists */ size = MAX_PATH; lstrcpyA(val, "apple"); - r = pMsiGetPatchInfoExA(patchcode, prodcode, usersid, - MSIINSTALLCONTEXT_USERMANAGED, - INSTALLPROPERTY_PATCHSTATEA, val, &size); + r = MsiGetPatchInfoExA(patchcode, prodcode, usersid, MSIINSTALLCONTEXT_USERMANAGED, INSTALLPROPERTY_PATCHSTATEA, + val, &size); ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r); ok(!lstrcmpA(val, "1"), "Expected \"1\", got \"%s\"\n", val); ok(size == 1, "Expected 1, got %lu\n", size); size = 1; - res = RegSetValueExA(hpatch, "Uninstallable", 0, REG_DWORD, - (const BYTE *)&size, sizeof(DWORD)); + res = RegSetValueExA(hpatch, "Uninstallable", 0, REG_DWORD, (const BYTE *)&size, sizeof(DWORD)); ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %ld\n", res); /* Uninstallable value exists */ size = MAX_PATH; lstrcpyA(val, "apple"); - r = pMsiGetPatchInfoExA(patchcode, prodcode, usersid, - MSIINSTALLCONTEXT_USERMANAGED, - INSTALLPROPERTY_UNINSTALLABLEA, val, &size); + r = MsiGetPatchInfoExA(patchcode, prodcode, usersid, MSIINSTALLCONTEXT_USERMANAGED, INSTALLPROPERTY_UNINSTALLABLEA, + val, &size); ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r); ok(!lstrcmpA(val, "1"), "Expected \"1\", got \"%s\"\n", val); ok(size == 1, "Expected 1, got %lu\n", size); - res = RegSetValueExA(hpatch, "DisplayName", 0, REG_SZ, - (const BYTE *)"display", 8); + res = RegSetValueExA(hpatch, "DisplayName", 0, REG_SZ, (const BYTE *)"display", 8); ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %ld\n", res); /* DisplayName value exists */ size = MAX_PATH; lstrcpyA(val, "apple"); - r = pMsiGetPatchInfoExA(patchcode, prodcode, usersid, - MSIINSTALLCONTEXT_USERMANAGED, - INSTALLPROPERTY_DISPLAYNAMEA, val, &size); + r = MsiGetPatchInfoExA(patchcode, prodcode, usersid, MSIINSTALLCONTEXT_USERMANAGED, INSTALLPROPERTY_DISPLAYNAMEA, + val, &size); ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r); ok(!lstrcmpA(val, "display"), "Expected \"display\", got \"%s\"\n", val); ok(size == 7, "Expected 7, got %lu\n", size); - res = RegSetValueExA(hpatch, "MoreInfoURL", 0, REG_SZ, - (const BYTE *)"moreinfo", 9); + res = RegSetValueExA(hpatch, "MoreInfoURL", 0, REG_SZ, (const BYTE *)"moreinfo", 9); ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %ld\n", res); /* MoreInfoURL value exists */ size = MAX_PATH; lstrcpyA(val, "apple"); - r = pMsiGetPatchInfoExA(patchcode, prodcode, usersid, - MSIINSTALLCONTEXT_USERMANAGED, - INSTALLPROPERTY_MOREINFOURLA, val, &size); + r = MsiGetPatchInfoExA(patchcode, prodcode, usersid, MSIINSTALLCONTEXT_USERMANAGED, INSTALLPROPERTY_MOREINFOURLA, + val, &size); ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r); ok(!lstrcmpA(val, "moreinfo"), "Expected \"moreinfo\", got \"%s\"\n", val); ok(size == 8, "Expected 8, got %lu\n", size); @@ -12375,71 +11301,59 @@ static void test_MsiGetPatchInfoEx(void) /* szProperty is invalid */ size = MAX_PATH; lstrcpyA(val, "apple"); - r = pMsiGetPatchInfoExA(patchcode, prodcode, usersid, - MSIINSTALLCONTEXT_USERMANAGED, - "IDontExist", val, &size); - ok(r == ERROR_UNKNOWN_PROPERTY, - "Expected ERROR_UNKNOWN_PROPERTY, got %d\n", r); + r = MsiGetPatchInfoExA(patchcode, prodcode, usersid, MSIINSTALLCONTEXT_USERMANAGED, "IDontExist", val, &size); + ok(r == ERROR_UNKNOWN_PROPERTY, "Expected ERROR_UNKNOWN_PROPERTY, got %d\n", r); ok(!lstrcmpA(val, "apple"), "Expected \"apple\", got \"%s\"\n", val); ok(size == MAX_PATH, "Expected MAX_PATH, got %lu\n", size); /* lpValue is NULL, while pcchValue is non-NULL */ size = MAX_PATH; - r = pMsiGetPatchInfoExA(patchcode, prodcode, usersid, - MSIINSTALLCONTEXT_USERMANAGED, - INSTALLPROPERTY_MOREINFOURLA, NULL, &size); + r = MsiGetPatchInfoExA(patchcode, prodcode, usersid, MSIINSTALLCONTEXT_USERMANAGED, INSTALLPROPERTY_MOREINFOURLA, + NULL, &size); ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r); ok(size == 16, "Expected 16, got %lu\n", size); /* pcchValue is NULL, while lpValue is non-NULL */ lstrcpyA(val, "apple"); - r = pMsiGetPatchInfoExA(patchcode, prodcode, usersid, - MSIINSTALLCONTEXT_USERMANAGED, - INSTALLPROPERTY_MOREINFOURLA, val, NULL); - ok(r == ERROR_INVALID_PARAMETER, - "Expected ERROR_INVALID_PARAMETER, got %d\n", r); + r = MsiGetPatchInfoExA(patchcode, prodcode, usersid, MSIINSTALLCONTEXT_USERMANAGED, INSTALLPROPERTY_MOREINFOURLA, + val, NULL); + ok(r == ERROR_INVALID_PARAMETER, "Expected ERROR_INVALID_PARAMETER, got %d\n", r); ok(!lstrcmpA(val, "apple"), "Expected \"apple\", got \"%s\"\n", val); /* both lpValue and pcchValue are NULL */ - r = pMsiGetPatchInfoExA(patchcode, prodcode, usersid, - MSIINSTALLCONTEXT_USERMANAGED, - INSTALLPROPERTY_MOREINFOURLA, NULL, NULL); + r = MsiGetPatchInfoExA(patchcode, prodcode, usersid, MSIINSTALLCONTEXT_USERMANAGED, INSTALLPROPERTY_MOREINFOURLA, + NULL, NULL); ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r); /* pcchValue doesn't have enough room for NULL terminator */ size = 8; lstrcpyA(val, "apple"); - r = pMsiGetPatchInfoExA(patchcode, prodcode, usersid, - MSIINSTALLCONTEXT_USERMANAGED, - INSTALLPROPERTY_MOREINFOURLA, val, &size); + r = MsiGetPatchInfoExA(patchcode, prodcode, usersid, MSIINSTALLCONTEXT_USERMANAGED, INSTALLPROPERTY_MOREINFOURLA, + val, &size); ok(r == ERROR_MORE_DATA, "Expected ERROR_MORE_DATA, got %d\n", r); - ok(!lstrcmpA(val, "moreinf"), - "Expected \"moreinf\", got \"%s\"\n", val); + ok(!lstrcmpA(val, "moreinf"), "Expected \"moreinf\", got \"%s\"\n", val); ok(size == 16, "Expected 16, got %lu\n", size); /* pcchValue has exactly enough room for NULL terminator */ size = 9; lstrcpyA(val, "apple"); - r = pMsiGetPatchInfoExA(patchcode, prodcode, usersid, - MSIINSTALLCONTEXT_USERMANAGED, - INSTALLPROPERTY_MOREINFOURLA, val, &size); + r = MsiGetPatchInfoExA(patchcode, prodcode, usersid, MSIINSTALLCONTEXT_USERMANAGED, INSTALLPROPERTY_MOREINFOURLA, + val, &size); ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r); - ok(!lstrcmpA(val, "moreinfo"), - "Expected \"moreinfo\", got \"%s\"\n", val); + ok(!lstrcmpA(val, "moreinfo"), "Expected \"moreinfo\", got \"%s\"\n", val); ok(size == 8, "Expected 8, got %lu\n", size); /* pcchValue is too small, lpValue is NULL */ size = 0; - r = pMsiGetPatchInfoExA(patchcode, prodcode, usersid, - MSIINSTALLCONTEXT_USERMANAGED, - INSTALLPROPERTY_MOREINFOURLA, NULL, &size); + r = MsiGetPatchInfoExA(patchcode, prodcode, usersid, MSIINSTALLCONTEXT_USERMANAGED, INSTALLPROPERTY_MOREINFOURLA, + NULL, &size); ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r); ok(size == 16, "Expected 16, got %lu\n", size); RegDeleteValueA(prodpatches, patch_squashed); - delete_key(prodpatches, "", access & KEY_WOW64_64KEY); + RegDeleteKeyExA(prodpatches, "", access & KEY_WOW64_64KEY, 0); RegCloseKey(prodpatches); - delete_key(prodkey, "", access & KEY_WOW64_64KEY); + RegDeleteKeyExA(prodkey, "", access & KEY_WOW64_64KEY, 0); RegCloseKey(prodkey); /* UserData is sufficient for all properties @@ -12447,9 +11361,8 @@ static void test_MsiGetPatchInfoEx(void) */ size = MAX_PATH; lstrcpyA(val, "apple"); - r = pMsiGetPatchInfoExA(patchcode, prodcode, usersid, - MSIINSTALLCONTEXT_USERMANAGED, - INSTALLPROPERTY_LOCALPACKAGEA, val, &size); + r = MsiGetPatchInfoExA(patchcode, prodcode, usersid, MSIINSTALLCONTEXT_USERMANAGED, INSTALLPROPERTY_LOCALPACKAGEA, + val, &size); ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r); ok(!lstrcmpA(val, "pack"), "Expected \"pack\", got \"%s\"\n", val); ok(size == 4, "Expected 4, got %lu\n", size); @@ -12459,9 +11372,8 @@ static void test_MsiGetPatchInfoEx(void) */ size = MAX_PATH; lstrcpyA(val, "apple"); - r = pMsiGetPatchInfoExA(patchcode, prodcode, usersid, - MSIINSTALLCONTEXT_USERMANAGED, - INSTALLPROPERTY_TRANSFORMSA, val, &size); + r = MsiGetPatchInfoExA(patchcode, prodcode, usersid, MSIINSTALLCONTEXT_USERMANAGED, INSTALLPROPERTY_TRANSFORMSA, + val, &size); ok(r == ERROR_UNKNOWN_PATCH, "Expected ERROR_UNKNOWN_PATCH, got %d\n", r); ok(!lstrcmpA(val, "apple"), "Expected \"apple\", got \"%s\"\n", val); ok(size == MAX_PATH, "Expected MAX_PATH, got %lu\n", size); @@ -12472,28 +11384,25 @@ static void test_MsiGetPatchInfoEx(void) RegDeleteValueA(hpatch, "Uninstallable"); RegDeleteValueA(hpatch, "Installed"); RegDeleteValueA(udpatch, "ManagedLocalPackage"); - delete_key(udpatch, "", access & KEY_WOW64_64KEY); + RegDeleteKeyExA(udpatch, "", access & KEY_WOW64_64KEY, 0); RegCloseKey(udpatch); - delete_key(hpatch, "", access & KEY_WOW64_64KEY); + RegDeleteKeyExA(hpatch, "", access & KEY_WOW64_64KEY, 0); RegCloseKey(hpatch); - delete_key(patches, "", access & KEY_WOW64_64KEY); + RegDeleteKeyExA(patches, "", access & KEY_WOW64_64KEY, 0); RegCloseKey(patches); - delete_key(props, "", access & KEY_WOW64_64KEY); + RegDeleteKeyExA(props, "", access & KEY_WOW64_64KEY, 0); RegCloseKey(props); - delete_key(udprod, "", access & KEY_WOW64_64KEY); + RegDeleteKeyExA(udprod, "", access & KEY_WOW64_64KEY, 0); RegCloseKey(udprod); /* MSIINSTALLCONTEXT_USERUNMANAGED */ size = MAX_PATH; lstrcpyA(val, "apple"); - r = pMsiGetPatchInfoExA(patchcode, prodcode, usersid, - MSIINSTALLCONTEXT_USERUNMANAGED, - INSTALLPROPERTY_LOCALPACKAGEA, val, &size); - ok(r == ERROR_UNKNOWN_PRODUCT, - "Expected ERROR_UNKNOWN_PRODUCT, got %d\n", r); - ok(!lstrcmpA(val, "apple"), - "Expected val to be unchanged, got \"%s\"\n", val); + r = MsiGetPatchInfoExA(patchcode, prodcode, usersid, MSIINSTALLCONTEXT_USERUNMANAGED, INSTALLPROPERTY_LOCALPACKAGEA, + val, &size); + ok(r == ERROR_UNKNOWN_PRODUCT, "Expected ERROR_UNKNOWN_PRODUCT, got %d\n", r); + ok(!lstrcmpA(val, "apple"), "Expected val to be unchanged, got \"%s\"\n", val); ok(size == MAX_PATH, "Expected size to be unchanged, got %lu\n", size); lstrcpyA(keypath, "Software\\Microsoft\\Windows\\CurrentVersion\\Installer\\UserData\\"); @@ -12507,13 +11416,10 @@ static void test_MsiGetPatchInfoEx(void) /* local UserData product key exists */ size = MAX_PATH; lstrcpyA(val, "apple"); - r = pMsiGetPatchInfoExA(patchcode, prodcode, usersid, - MSIINSTALLCONTEXT_USERUNMANAGED, - INSTALLPROPERTY_LOCALPACKAGEA, val, &size); - ok(r == ERROR_UNKNOWN_PRODUCT, - "Expected ERROR_UNKNOWN_PRODUCT, got %d\n", r); - ok(!lstrcmpA(val, "apple"), - "Expected val to be unchanged, got \"%s\"\n", val); + r = MsiGetPatchInfoExA(patchcode, prodcode, usersid, MSIINSTALLCONTEXT_USERUNMANAGED, INSTALLPROPERTY_LOCALPACKAGEA, + val, &size); + ok(r == ERROR_UNKNOWN_PRODUCT, "Expected ERROR_UNKNOWN_PRODUCT, got %d\n", r); + ok(!lstrcmpA(val, "apple"), "Expected val to be unchanged, got \"%s\"\n", val); ok(size == MAX_PATH, "Expected size to be unchanged, got %lu\n", size); res = RegCreateKeyExA(udprod, "InstallProperties", 0, NULL, 0, access, NULL, &props, NULL); @@ -12522,12 +11428,10 @@ static void test_MsiGetPatchInfoEx(void) /* InstallProperties key exists */ size = MAX_PATH; lstrcpyA(val, "apple"); - r = pMsiGetPatchInfoExA(patchcode, prodcode, usersid, - MSIINSTALLCONTEXT_USERUNMANAGED, - INSTALLPROPERTY_LOCALPACKAGEA, val, &size); + r = MsiGetPatchInfoExA(patchcode, prodcode, usersid, MSIINSTALLCONTEXT_USERUNMANAGED, INSTALLPROPERTY_LOCALPACKAGEA, + val, &size); ok(r == ERROR_UNKNOWN_PATCH, "Expected ERROR_UNKNOWN_PATCH, got %d\n", r); - ok(!lstrcmpA(val, "apple"), - "Expected val to be unchanged, got \"%s\"\n", val); + ok(!lstrcmpA(val, "apple"), "Expected val to be unchanged, got \"%s\"\n", val); ok(size == MAX_PATH, "Expected size to be unchanged, got %lu\n", size); res = RegCreateKeyExA(udprod, "Patches", 0, NULL, 0, access, NULL, &patches, NULL); @@ -12536,12 +11440,10 @@ static void test_MsiGetPatchInfoEx(void) /* Patches key exists */ size = MAX_PATH; lstrcpyA(val, "apple"); - r = pMsiGetPatchInfoExA(patchcode, prodcode, usersid, - MSIINSTALLCONTEXT_USERUNMANAGED, - INSTALLPROPERTY_LOCALPACKAGEA, val, &size); + r = MsiGetPatchInfoExA(patchcode, prodcode, usersid, MSIINSTALLCONTEXT_USERUNMANAGED, INSTALLPROPERTY_LOCALPACKAGEA, + val, &size); ok(r == ERROR_UNKNOWN_PATCH, "Expected ERROR_UNKNOWN_PATCH, got %d\n", r); - ok(!lstrcmpA(val, "apple"), - "Expected val to be unchanged, got \"%s\"\n", val); + ok(!lstrcmpA(val, "apple"), "Expected val to be unchanged, got \"%s\"\n", val); ok(size == MAX_PATH, "Expected size to be unchanged, got %lu\n", size); res = RegCreateKeyExA(patches, patch_squashed, 0, NULL, 0, access, NULL, &hpatch, NULL); @@ -12550,12 +11452,10 @@ static void test_MsiGetPatchInfoEx(void) /* Patches key exists */ size = MAX_PATH; lstrcpyA(val, "apple"); - r = pMsiGetPatchInfoExA(patchcode, prodcode, usersid, - MSIINSTALLCONTEXT_USERUNMANAGED, - INSTALLPROPERTY_LOCALPACKAGEA, val, &size); + r = MsiGetPatchInfoExA(patchcode, prodcode, usersid, MSIINSTALLCONTEXT_USERUNMANAGED, INSTALLPROPERTY_LOCALPACKAGEA, + val, &size); ok(r == ERROR_UNKNOWN_PATCH, "Expected ERROR_UNKNOWN_PATCH, got %d\n", r); - ok(!lstrcmpA(val, "apple"), - "Expected val to be unchanged, got \"%s\"\n", val); + ok(!lstrcmpA(val, "apple"), "Expected val to be unchanged, got \"%s\"\n", val); ok(size == MAX_PATH, "Expected size to be unchanged, got %lu\n", size); lstrcpyA(keypath, "Software\\Microsoft\\Installer\\Products\\"); @@ -12567,12 +11467,10 @@ static void test_MsiGetPatchInfoEx(void) /* current user product key exists */ size = MAX_PATH; lstrcpyA(val, "apple"); - r = pMsiGetPatchInfoExA(patchcode, prodcode, usersid, - MSIINSTALLCONTEXT_USERUNMANAGED, - INSTALLPROPERTY_LOCALPACKAGEA, val, &size); + r = MsiGetPatchInfoExA(patchcode, prodcode, usersid, MSIINSTALLCONTEXT_USERUNMANAGED, INSTALLPROPERTY_LOCALPACKAGEA, + val, &size); ok(r == ERROR_UNKNOWN_PATCH, "Expected ERROR_UNKNOWN_PATCH, got %d\n", r); - ok(!lstrcmpA(val, "apple"), - "Expected val to be unchanged, got \"%s\"\n", val); + ok(!lstrcmpA(val, "apple"), "Expected val to be unchanged, got \"%s\"\n", val); ok(size == MAX_PATH, "Expected size to be unchanged, got %lu\n", size); res = RegCreateKeyA(prodkey, "Patches", &prodpatches); @@ -12581,12 +11479,10 @@ static void test_MsiGetPatchInfoEx(void) /* Patches key exists */ size = MAX_PATH; lstrcpyA(val, "apple"); - r = pMsiGetPatchInfoExA(patchcode, prodcode, usersid, - MSIINSTALLCONTEXT_USERUNMANAGED, - INSTALLPROPERTY_LOCALPACKAGEA, val, &size); + r = MsiGetPatchInfoExA(patchcode, prodcode, usersid, MSIINSTALLCONTEXT_USERUNMANAGED, INSTALLPROPERTY_LOCALPACKAGEA, + val, &size); ok(r == ERROR_UNKNOWN_PATCH, "Expected ERROR_UNKNOWN_PATCH, got %d\n", r); - ok(!lstrcmpA(val, "apple"), - "Expected val to be unchanged, got \"%s\"\n", val); + ok(!lstrcmpA(val, "apple"), "Expected val to be unchanged, got \"%s\"\n", val); ok(size == MAX_PATH, "Expected size to be unchanged, got %lu\n", size); res = RegSetValueExA(prodpatches, patch_squashed, 0, REG_SZ, @@ -12596,12 +11492,10 @@ static void test_MsiGetPatchInfoEx(void) /* specific patch value exists */ size = MAX_PATH; lstrcpyA(val, "apple"); - r = pMsiGetPatchInfoExA(patchcode, prodcode, usersid, - MSIINSTALLCONTEXT_USERUNMANAGED, - INSTALLPROPERTY_LOCALPACKAGEA, val, &size); + r = MsiGetPatchInfoExA(patchcode, prodcode, usersid, MSIINSTALLCONTEXT_USERUNMANAGED, INSTALLPROPERTY_LOCALPACKAGEA, + val, &size); ok(r == ERROR_UNKNOWN_PATCH, "Expected ERROR_UNKNOWN_PATCH, got %d\n", r); - ok(!lstrcmpA(val, "apple"), - "Expected val to be unchanged, got \"%s\"\n", val); + ok(!lstrcmpA(val, "apple"), "Expected val to be unchanged, got \"%s\"\n", val); ok(size == MAX_PATH, "Expected size to be unchanged, got %lu\n", size); lstrcpyA(keypath, "Software\\Microsoft\\Windows\\CurrentVersion\\Installer\\UserData\\"); @@ -12615,9 +11509,8 @@ static void test_MsiGetPatchInfoEx(void) /* UserData Patches key exists */ size = MAX_PATH; lstrcpyA(val, "apple"); - r = pMsiGetPatchInfoExA(patchcode, prodcode, usersid, - MSIINSTALLCONTEXT_USERUNMANAGED, - INSTALLPROPERTY_LOCALPACKAGEA, val, &size); + r = MsiGetPatchInfoExA(patchcode, prodcode, usersid, MSIINSTALLCONTEXT_USERUNMANAGED, INSTALLPROPERTY_LOCALPACKAGEA, + val, &size); ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r); ok(!lstrcmpA(val, ""), "Expected \"\", got \"%s\"\n", val); ok(size == 0, "Expected 0, got %lu\n", size); @@ -12629,24 +11522,22 @@ static void test_MsiGetPatchInfoEx(void) /* LocalPatch value exists */ size = MAX_PATH; lstrcpyA(val, "apple"); - r = pMsiGetPatchInfoExA(patchcode, prodcode, usersid, - MSIINSTALLCONTEXT_USERUNMANAGED, - INSTALLPROPERTY_LOCALPACKAGEA, val, &size); + r = MsiGetPatchInfoExA(patchcode, prodcode, usersid, MSIINSTALLCONTEXT_USERUNMANAGED, INSTALLPROPERTY_LOCALPACKAGEA, + val, &size); ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r); ok(!lstrcmpA(val, "pack"), "Expected \"pack\", got \"%s\"\n", val); ok(size == 4, "Expected 4, got %lu\n", size); size = MAX_PATH; lstrcpyA(val, "apple"); - r = pMsiGetPatchInfoExA(patchcode, prodcode, usersid, - MSIINSTALLCONTEXT_USERUNMANAGED, - INSTALLPROPERTY_TRANSFORMSA, val, &size); + r = MsiGetPatchInfoExA(patchcode, prodcode, usersid, MSIINSTALLCONTEXT_USERUNMANAGED, INSTALLPROPERTY_TRANSFORMSA, + val, &size); ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r); ok(!lstrcmpA(val, "transforms"), "Expected \"transforms\", got \"%s\"\n", val); ok(size == 10, "Expected 10, got %lu\n", size); RegDeleteValueA(prodpatches, patch_squashed); - delete_key(prodpatches, "", access & KEY_WOW64_64KEY); + RegDeleteKeyExA(prodpatches, "", access & KEY_WOW64_64KEY, 0); RegCloseKey(prodpatches); RegDeleteKeyA(prodkey, ""); RegCloseKey(prodkey); @@ -12656,9 +11547,8 @@ static void test_MsiGetPatchInfoEx(void) */ size = MAX_PATH; lstrcpyA(val, "apple"); - r = pMsiGetPatchInfoExA(patchcode, prodcode, usersid, - MSIINSTALLCONTEXT_USERUNMANAGED, - INSTALLPROPERTY_LOCALPACKAGEA, val, &size); + r = MsiGetPatchInfoExA(patchcode, prodcode, usersid, MSIINSTALLCONTEXT_USERUNMANAGED, INSTALLPROPERTY_LOCALPACKAGEA, + val, &size); ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r); ok(!lstrcmpA(val, "pack"), "Expected \"pack\", got \"%s\"\n", val); ok(size == 4, "Expected 4, got %lu\n", size); @@ -12668,36 +11558,32 @@ static void test_MsiGetPatchInfoEx(void) */ size = MAX_PATH; lstrcpyA(val, "apple"); - r = pMsiGetPatchInfoExA(patchcode, prodcode, usersid, - MSIINSTALLCONTEXT_USERUNMANAGED, - INSTALLPROPERTY_TRANSFORMSA, val, &size); + r = MsiGetPatchInfoExA(patchcode, prodcode, usersid, MSIINSTALLCONTEXT_USERUNMANAGED, INSTALLPROPERTY_TRANSFORMSA, + val, &size); ok(r == ERROR_UNKNOWN_PATCH, "Expected ERROR_UNKNOWN_PATCH, got %d\n", r); ok(!lstrcmpA(val, "apple"), "Expected \"apple\", got \"%s\"\n", val); ok(size == MAX_PATH, "Expected MAX_PATH, got %lu\n", size); RegDeleteValueA(udpatch, "LocalPackage"); - delete_key(udpatch, "", access & KEY_WOW64_64KEY); + RegDeleteKeyExA(udpatch, "", access & KEY_WOW64_64KEY, 0); RegCloseKey(udpatch); - delete_key(hpatch, "", access & KEY_WOW64_64KEY); + RegDeleteKeyExA(hpatch, "", access & KEY_WOW64_64KEY, 0); RegCloseKey(hpatch); - delete_key(patches, "", access & KEY_WOW64_64KEY); + RegDeleteKeyExA(patches, "", access & KEY_WOW64_64KEY, 0); RegCloseKey(patches); - delete_key(props, "", access & KEY_WOW64_64KEY); + RegDeleteKeyExA(props, "", access & KEY_WOW64_64KEY, 0); RegCloseKey(props); - delete_key(udprod, "", access & KEY_WOW64_64KEY); + RegDeleteKeyExA(udprod, "", access & KEY_WOW64_64KEY, 0); RegCloseKey(udprod); /* MSIINSTALLCONTEXT_MACHINE */ size = MAX_PATH; lstrcpyA(val, "apple"); - r = pMsiGetPatchInfoExA(patchcode, prodcode, NULL, - MSIINSTALLCONTEXT_MACHINE, - INSTALLPROPERTY_LOCALPACKAGEA, val, &size); - ok(r == ERROR_UNKNOWN_PRODUCT, - "Expected ERROR_UNKNOWN_PRODUCT, got %d\n", r); - ok(!lstrcmpA(val, "apple"), - "Expected val to be unchanged, got \"%s\"\n", val); + r = MsiGetPatchInfoExA(patchcode, prodcode, NULL, MSIINSTALLCONTEXT_MACHINE, INSTALLPROPERTY_LOCALPACKAGEA, + val, &size); + ok(r == ERROR_UNKNOWN_PRODUCT, "Expected ERROR_UNKNOWN_PRODUCT, got %d\n", r); + ok(!lstrcmpA(val, "apple"), "Expected val to be unchanged, got \"%s\"\n", val); ok(size == MAX_PATH, "Expected size to be unchanged, got %lu\n", size); lstrcpyA(keypath, "Software\\Microsoft\\Windows\\CurrentVersion\\Installer"); @@ -12710,13 +11596,10 @@ static void test_MsiGetPatchInfoEx(void) /* local UserData product key exists */ size = MAX_PATH; lstrcpyA(val, "apple"); - r = pMsiGetPatchInfoExA(patchcode, prodcode, NULL, - MSIINSTALLCONTEXT_MACHINE, - INSTALLPROPERTY_LOCALPACKAGEA, val, &size); - ok(r == ERROR_UNKNOWN_PRODUCT, - "Expected ERROR_UNKNOWN_PRODUCT, got %d\n", r); - ok(!lstrcmpA(val, "apple"), - "Expected val to be unchanged, got \"%s\"\n", val); + r = MsiGetPatchInfoExA(patchcode, prodcode, NULL, MSIINSTALLCONTEXT_MACHINE, INSTALLPROPERTY_LOCALPACKAGEA, + val, &size); + ok(r == ERROR_UNKNOWN_PRODUCT, "Expected ERROR_UNKNOWN_PRODUCT, got %d\n", r); + ok(!lstrcmpA(val, "apple"), "Expected val to be unchanged, got \"%s\"\n", val); ok(size == MAX_PATH, "Expected size to be unchanged, got %lu\n", size); res = RegCreateKeyExA(udprod, "InstallProperties", 0, NULL, 0, access, NULL, &props, NULL); @@ -12725,12 +11608,10 @@ static void test_MsiGetPatchInfoEx(void) /* InstallProperties key exists */ size = MAX_PATH; lstrcpyA(val, "apple"); - r = pMsiGetPatchInfoExA(patchcode, prodcode, NULL, - MSIINSTALLCONTEXT_MACHINE, - INSTALLPROPERTY_LOCALPACKAGEA, val, &size); + r = MsiGetPatchInfoExA(patchcode, prodcode, NULL, MSIINSTALLCONTEXT_MACHINE, INSTALLPROPERTY_LOCALPACKAGEA, + val, &size); ok(r == ERROR_UNKNOWN_PATCH, "Expected ERROR_UNKNOWN_PATCH, got %d\n", r); - ok(!lstrcmpA(val, "apple"), - "Expected val to be unchanged, got \"%s\"\n", val); + ok(!lstrcmpA(val, "apple"), "Expected val to be unchanged, got \"%s\"\n", val); ok(size == MAX_PATH, "Expected size to be unchanged, got %lu\n", size); res = RegCreateKeyExA(udprod, "Patches", 0, NULL, 0, access, NULL, &patches, NULL); @@ -12739,12 +11620,10 @@ static void test_MsiGetPatchInfoEx(void) /* Patches key exists */ size = MAX_PATH; lstrcpyA(val, "apple"); - r = pMsiGetPatchInfoExA(patchcode, prodcode, NULL, - MSIINSTALLCONTEXT_MACHINE, - INSTALLPROPERTY_LOCALPACKAGEA, val, &size); + r = MsiGetPatchInfoExA(patchcode, prodcode, NULL, MSIINSTALLCONTEXT_MACHINE, INSTALLPROPERTY_LOCALPACKAGEA, + val, &size); ok(r == ERROR_UNKNOWN_PATCH, "Expected ERROR_UNKNOWN_PATCH, got %d\n", r); - ok(!lstrcmpA(val, "apple"), - "Expected val to be unchanged, got \"%s\"\n", val); + ok(!lstrcmpA(val, "apple"), "Expected val to be unchanged, got \"%s\"\n", val); ok(size == MAX_PATH, "Expected size to be unchanged, got %lu\n", size); res = RegCreateKeyExA(patches, patch_squashed, 0, NULL, 0, access, NULL, &hpatch, NULL); @@ -12753,12 +11632,10 @@ static void test_MsiGetPatchInfoEx(void) /* Patches key exists */ size = MAX_PATH; lstrcpyA(val, "apple"); - r = pMsiGetPatchInfoExA(patchcode, prodcode, NULL, - MSIINSTALLCONTEXT_MACHINE, - INSTALLPROPERTY_LOCALPACKAGEA, val, &size); + r = MsiGetPatchInfoExA(patchcode, prodcode, NULL, MSIINSTALLCONTEXT_MACHINE, INSTALLPROPERTY_LOCALPACKAGEA, + val, &size); ok(r == ERROR_UNKNOWN_PATCH, "Expected ERROR_UNKNOWN_PATCH, got %d\n", r); - ok(!lstrcmpA(val, "apple"), - "Expected val to be unchanged, got \"%s\"\n", val); + ok(!lstrcmpA(val, "apple"), "Expected val to be unchanged, got \"%s\"\n", val); ok(size == MAX_PATH, "Expected size to be unchanged, got %lu\n", size); lstrcpyA(keypath, "Software\\Classes\\Installer\\Products\\"); @@ -12776,12 +11653,10 @@ static void test_MsiGetPatchInfoEx(void) /* local product key exists */ size = MAX_PATH; lstrcpyA(val, "apple"); - r = pMsiGetPatchInfoExA(patchcode, prodcode, NULL, - MSIINSTALLCONTEXT_MACHINE, - INSTALLPROPERTY_LOCALPACKAGEA, val, &size); + r = MsiGetPatchInfoExA(patchcode, prodcode, NULL, MSIINSTALLCONTEXT_MACHINE, INSTALLPROPERTY_LOCALPACKAGEA, + val, &size); ok(r == ERROR_UNKNOWN_PATCH, "Expected ERROR_UNKNOWN_PATCH, got %d\n", r); - ok(!lstrcmpA(val, "apple"), - "Expected val to be unchanged, got \"%s\"\n", val); + ok(!lstrcmpA(val, "apple"), "Expected val to be unchanged, got \"%s\"\n", val); ok(size == MAX_PATH, "Expected size to be unchanged, got %lu\n", size); res = RegCreateKeyExA(prodkey, "Patches", 0, NULL, 0, access, NULL, &prodpatches, NULL); @@ -12790,12 +11665,10 @@ static void test_MsiGetPatchInfoEx(void) /* Patches key exists */ size = MAX_PATH; lstrcpyA(val, "apple"); - r = pMsiGetPatchInfoExA(patchcode, prodcode, NULL, - MSIINSTALLCONTEXT_MACHINE, - INSTALLPROPERTY_LOCALPACKAGEA, val, &size); + r = MsiGetPatchInfoExA(patchcode, prodcode, NULL, MSIINSTALLCONTEXT_MACHINE, INSTALLPROPERTY_LOCALPACKAGEA, + val, &size); ok(r == ERROR_UNKNOWN_PATCH, "Expected ERROR_UNKNOWN_PATCH, got %d\n", r); - ok(!lstrcmpA(val, "apple"), - "Expected val to be unchanged, got \"%s\"\n", val); + ok(!lstrcmpA(val, "apple"), "Expected val to be unchanged, got \"%s\"\n", val); ok(size == MAX_PATH, "Expected size to be unchanged, got %lu\n", size); res = RegSetValueExA(prodpatches, patch_squashed, 0, REG_SZ, @@ -12805,12 +11678,10 @@ static void test_MsiGetPatchInfoEx(void) /* specific patch value exists */ size = MAX_PATH; lstrcpyA(val, "apple"); - r = pMsiGetPatchInfoExA(patchcode, prodcode, NULL, - MSIINSTALLCONTEXT_MACHINE, - INSTALLPROPERTY_LOCALPACKAGEA, val, &size); + r = MsiGetPatchInfoExA(patchcode, prodcode, NULL, MSIINSTALLCONTEXT_MACHINE, INSTALLPROPERTY_LOCALPACKAGEA, + val, &size); ok(r == ERROR_UNKNOWN_PATCH, "Expected ERROR_UNKNOWN_PATCH, got %d\n", r); - ok(!lstrcmpA(val, "apple"), - "Expected val to be unchanged, got \"%s\"\n", val); + ok(!lstrcmpA(val, "apple"), "Expected val to be unchanged, got \"%s\"\n", val); ok(size == MAX_PATH, "Expected size to be unchanged, got %lu\n", size); lstrcpyA(keypath, "Software\\Microsoft\\Windows\\CurrentVersion\\Installer"); @@ -12823,40 +11694,36 @@ static void test_MsiGetPatchInfoEx(void) /* UserData Patches key exists */ size = MAX_PATH; lstrcpyA(val, "apple"); - r = pMsiGetPatchInfoExA(patchcode, prodcode, NULL, - MSIINSTALLCONTEXT_MACHINE, - INSTALLPROPERTY_LOCALPACKAGEA, val, &size); + r = MsiGetPatchInfoExA(patchcode, prodcode, NULL, MSIINSTALLCONTEXT_MACHINE, INSTALLPROPERTY_LOCALPACKAGEA, + val, &size); ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r); ok(!lstrcmpA(val, ""), "Expected \"\", got \"%s\"\n", val); ok(size == 0, "Expected 0, got %lu\n", size); - res = RegSetValueExA(udpatch, "LocalPackage", 0, REG_SZ, - (const BYTE *)"pack", 5); + res = RegSetValueExA(udpatch, "LocalPackage", 0, REG_SZ, (const BYTE *)"pack", 5); ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %ld\n", res); /* LocalPatch value exists */ size = MAX_PATH; lstrcpyA(val, "apple"); - r = pMsiGetPatchInfoExA(patchcode, prodcode, NULL, - MSIINSTALLCONTEXT_MACHINE, - INSTALLPROPERTY_LOCALPACKAGEA, val, &size); + r = MsiGetPatchInfoExA(patchcode, prodcode, NULL, MSIINSTALLCONTEXT_MACHINE, INSTALLPROPERTY_LOCALPACKAGEA, + val, &size); ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r); ok(!lstrcmpA(val, "pack"), "Expected \"pack\", got \"%s\"\n", val); ok(size == 4, "Expected 4, got %lu\n", size); size = MAX_PATH; lstrcpyA(val, "apple"); - r = pMsiGetPatchInfoExA(patchcode, prodcode, NULL, - MSIINSTALLCONTEXT_MACHINE, - INSTALLPROPERTY_TRANSFORMSA, val, &size); + r = MsiGetPatchInfoExA(patchcode, prodcode, NULL, MSIINSTALLCONTEXT_MACHINE, INSTALLPROPERTY_TRANSFORMSA, + val, &size); ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r); ok(!lstrcmpA(val, "transforms"), "Expected \"transforms\", got \"%s\"\n", val); ok(size == 10, "Expected 10, got %lu\n", size); RegDeleteValueA(prodpatches, patch_squashed); - delete_key(prodpatches, "", access & KEY_WOW64_64KEY); + RegDeleteKeyExA(prodpatches, "", access & KEY_WOW64_64KEY, 0); RegCloseKey(prodpatches); - delete_key(prodkey, "", access & KEY_WOW64_64KEY); + RegDeleteKeyExA(prodkey, "", access & KEY_WOW64_64KEY, 0); RegCloseKey(prodkey); /* UserData is sufficient for all properties @@ -12864,9 +11731,8 @@ static void test_MsiGetPatchInfoEx(void) */ size = MAX_PATH; lstrcpyA(val, "apple"); - r = pMsiGetPatchInfoExA(patchcode, prodcode, NULL, - MSIINSTALLCONTEXT_MACHINE, - INSTALLPROPERTY_LOCALPACKAGEA, val, &size); + r = MsiGetPatchInfoExA(patchcode, prodcode, NULL, MSIINSTALLCONTEXT_MACHINE, INSTALLPROPERTY_LOCALPACKAGEA, + val, &size); ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r); ok(!lstrcmpA(val, "pack"), "Expected \"pack\", got \"%s\"\n", val); ok(size == 4, "Expected 4, got %lu\n", size); @@ -12876,23 +11742,22 @@ static void test_MsiGetPatchInfoEx(void) */ size = MAX_PATH; lstrcpyA(val, "apple"); - r = pMsiGetPatchInfoExA(patchcode, prodcode, NULL, - MSIINSTALLCONTEXT_MACHINE, - INSTALLPROPERTY_TRANSFORMSA, val, &size); + r = MsiGetPatchInfoExA(patchcode, prodcode, NULL, MSIINSTALLCONTEXT_MACHINE, INSTALLPROPERTY_TRANSFORMSA, + val, &size); ok(r == ERROR_UNKNOWN_PATCH, "Expected ERROR_UNKNOWN_PATCH, got %d\n", r); ok(!lstrcmpA(val, "apple"), "Expected \"apple\", got \"%s\"\n", val); ok(size == MAX_PATH, "Expected MAX_PATH, got %lu\n", size); RegDeleteValueA(udpatch, "LocalPackage"); - delete_key(udpatch, "", access & KEY_WOW64_64KEY); + RegDeleteKeyExA(udpatch, "", access & KEY_WOW64_64KEY, 0); RegCloseKey(udpatch); - delete_key(hpatch, "", access & KEY_WOW64_64KEY); + RegDeleteKeyExA(hpatch, "", access & KEY_WOW64_64KEY, 0); RegCloseKey(hpatch); - delete_key(patches, "", access & KEY_WOW64_64KEY); + RegDeleteKeyExA(patches, "", access & KEY_WOW64_64KEY, 0); RegCloseKey(patches); - delete_key(props, "", access & KEY_WOW64_64KEY); + RegDeleteKeyExA(props, "", access & KEY_WOW64_64KEY, 0); RegCloseKey(props); - delete_key(udprod, "", access & KEY_WOW64_64KEY); + RegDeleteKeyExA(udprod, "", access & KEY_WOW64_64KEY, 0); RegCloseKey(udprod); LocalFree(usersid); } @@ -13068,25 +11933,25 @@ static void test_MsiGetPatchInfo(void) ok(valW[0], "expected > 0 got %u\n", valW[0]); ok(size == 11, "expected 11 got %lu\n", size); - delete_key(hkey_udproductpatch, "", access & KEY_WOW64_64KEY); + RegDeleteKeyExA(hkey_udproductpatch, "", access & KEY_WOW64_64KEY, 0); RegCloseKey(hkey_udproductpatch); - delete_key(hkey_udproductpatches, "", access & KEY_WOW64_64KEY); + RegDeleteKeyExA(hkey_udproductpatches, "", access & KEY_WOW64_64KEY, 0); RegCloseKey(hkey_udproductpatches); - delete_key(hkey_udpatch, "", access & KEY_WOW64_64KEY); + RegDeleteKeyExA(hkey_udpatch, "", access & KEY_WOW64_64KEY, 0); RegCloseKey(hkey_udpatch); - delete_key(hkey_udpatches, "", access & KEY_WOW64_64KEY); + RegDeleteKeyExA(hkey_udpatches, "", access & KEY_WOW64_64KEY, 0); RegCloseKey(hkey_udpatches); - delete_key(hkey_udprops, "", access & KEY_WOW64_64KEY); + RegDeleteKeyExA(hkey_udprops, "", access & KEY_WOW64_64KEY, 0); RegCloseKey(hkey_udprops); - delete_key(hkey_udproduct, "", access & KEY_WOW64_64KEY); + RegDeleteKeyExA(hkey_udproduct, "", access & KEY_WOW64_64KEY, 0); RegCloseKey(hkey_udproduct); done: - delete_key(hkey_patches, "", access & KEY_WOW64_64KEY); + RegDeleteKeyExA(hkey_patches, "", access & KEY_WOW64_64KEY, 0); RegCloseKey(hkey_patches); - delete_key(hkey_product, "", access & KEY_WOW64_64KEY); + RegDeleteKeyExA(hkey_product, "", access & KEY_WOW64_64KEY, 0); RegCloseKey(hkey_product); - delete_key(hkey_patch, "", access & KEY_WOW64_64KEY); + RegDeleteKeyExA(hkey_patch, "", access & KEY_WOW64_64KEY, 0); RegCloseKey(hkey_patch); } @@ -13102,7 +11967,7 @@ static void test_MsiEnumProducts(void) HKEY key1, key2, key3; REGSAM access = KEY_ALL_ACCESS; - if (is_process_limited()) + if (!is_process_elevated()) { skip( "process is limited\n" ); return; @@ -13177,8 +12042,8 @@ static void test_MsiEnumProducts(void) ros_skip_flaky ok(found3, "product3 not found\n"); - delete_key(key1, "", access & KEY_WOW64_64KEY); - delete_key(key2, "", access & KEY_WOW64_64KEY); + RegDeleteKeyExA(key1, "", access & KEY_WOW64_64KEY, 0); + RegDeleteKeyExA(key2, "", access & KEY_WOW64_64KEY, 0); RegDeleteKeyA(key3, ""); RegCloseKey(key1); RegCloseKey(key2); @@ -13242,12 +12107,6 @@ static void test_MsiEnumProductsEx(void) char *usersid = get_user_sid(); BOOL found1, found2, found3; - if (!pMsiEnumProductsExA) - { - win_skip("MsiEnumProductsExA not implemented\n"); - return; - } - create_test_guid( product0, NULL ); create_test_guid( product1, product_squashed1 ); create_test_guid( product2, product_squashed2 ); @@ -13286,34 +12145,34 @@ static void test_MsiEnumProductsEx(void) r = RegCreateKeyExA( HKEY_USERS, keypath3, 0, NULL, 0, access, NULL, &key3, NULL ); ok( r == ERROR_SUCCESS, "got %u\n", r ); - r = pMsiEnumProductsExA( NULL, NULL, 0, 0, NULL, NULL, NULL, NULL ); + r = MsiEnumProductsExA( NULL, NULL, 0, 0, NULL, NULL, NULL, NULL ); ok( r == ERROR_INVALID_PARAMETER, "got %u\n", r ); len = sizeof(sid); - r = pMsiEnumProductsExA( NULL, NULL, 0, 0, NULL, NULL, NULL, &len ); + r = MsiEnumProductsExA( NULL, NULL, 0, 0, NULL, NULL, NULL, &len ); ok( r == ERROR_INVALID_PARAMETER, "got %u\n", r ); ok( len == sizeof(sid), "got %lu\n", len ); - r = pMsiEnumProductsExA( NULL, NULL, MSIINSTALLCONTEXT_ALL, 0, NULL, NULL, NULL, NULL ); + r = MsiEnumProductsExA( NULL, NULL, MSIINSTALLCONTEXT_ALL, 0, NULL, NULL, NULL, NULL ); ok( r == ERROR_SUCCESS, "got %u\n", r ); sid[0] = 0; len = sizeof(sid); - r = pMsiEnumProductsExA( product0, NULL, MSIINSTALLCONTEXT_ALL, 0, NULL, NULL, sid, &len ); + r = MsiEnumProductsExA( product0, NULL, MSIINSTALLCONTEXT_ALL, 0, NULL, NULL, sid, &len ); ok( r == ERROR_NO_MORE_ITEMS, "got %u\n", r ); ok( len == sizeof(sid), "got %lu\n", len ); ok( !sid[0], "got %s\n", sid ); sid[0] = 0; len = sizeof(sid); - r = pMsiEnumProductsExA( product0, usersid, MSIINSTALLCONTEXT_ALL, 0, NULL, NULL, sid, &len ); + r = MsiEnumProductsExA( product0, usersid, MSIINSTALLCONTEXT_ALL, 0, NULL, NULL, sid, &len ); ok( r == ERROR_NO_MORE_ITEMS, "got %u\n", r ); ok( len == sizeof(sid), "got %lu\n", len ); ok( !sid[0], "got %s\n", sid ); sid[0] = 0; len = 0; - r = pMsiEnumProductsExA( NULL, usersid, MSIINSTALLCONTEXT_USERUNMANAGED, 0, NULL, NULL, sid, &len ); + r = MsiEnumProductsExA( NULL, usersid, MSIINSTALLCONTEXT_USERUNMANAGED, 0, NULL, NULL, sid, &len ); ok( r == ERROR_MORE_DATA, "got %u\n", r ); ok( len, "length unchanged\n" ); ok( !sid[0], "got %s\n", sid ); @@ -13322,7 +12181,7 @@ static void test_MsiEnumProductsEx(void) context = 0xdeadbeef; sid[0] = 0; len = sizeof(sid); - r = pMsiEnumProductsExA( NULL, NULL, MSIINSTALLCONTEXT_ALL, 0, guid, &context, sid, &len ); + r = MsiEnumProductsExA( NULL, NULL, MSIINSTALLCONTEXT_ALL, 0, guid, &context, sid, &len ); ok( r == ERROR_SUCCESS, "got %u\n", r ); ok( guid[0], "empty guid\n" ); ok( context != 0xdeadbeef, "context unchanged\n" ); @@ -13333,7 +12192,7 @@ static void test_MsiEnumProductsEx(void) context = 0xdeadbeef; sid[0] = 0; len = sizeof(sid); - r = pMsiEnumProductsExA( NULL, usersid, MSIINSTALLCONTEXT_ALL, 0, guid, &context, sid, &len ); + r = MsiEnumProductsExA( NULL, usersid, MSIINSTALLCONTEXT_ALL, 0, guid, &context, sid, &len ); ok( r == ERROR_SUCCESS, "got %u\n", r ); ok( guid[0], "empty guid\n" ); ok( context != 0xdeadbeef, "context unchanged\n" ); @@ -13344,7 +12203,7 @@ static void test_MsiEnumProductsEx(void) context = 0xdeadbeef; sid[0] = 0; len = sizeof(sid); - r = pMsiEnumProductsExA( NULL, "S-1-1-0", MSIINSTALLCONTEXT_ALL, 0, guid, &context, sid, &len ); + r = MsiEnumProductsExA( NULL, "S-1-1-0", MSIINSTALLCONTEXT_ALL, 0, guid, &context, sid, &len ); if (r == ERROR_ACCESS_DENIED) { skip( "insufficient rights\n" ); @@ -13362,7 +12221,7 @@ static void test_MsiEnumProductsEx(void) sid[0] = 0; len = sizeof(sid); found1 = found2 = found3 = FALSE; - while (!pMsiEnumProductsExA( NULL, "S-1-1-0", MSIINSTALLCONTEXT_ALL, index, guid, &context, sid, &len )) + while (!MsiEnumProductsExA( NULL, "S-1-1-0", MSIINSTALLCONTEXT_ALL, index, guid, &context, sid, &len )) { if (!strcmp( product1, guid )) { @@ -13397,9 +12256,9 @@ static void test_MsiEnumProductsEx(void) ok(found3, "product3 not found\n"); done: - delete_key( key1, "", access ); - delete_key( key2, "", access ); - delete_key( key3, "", access ); + RegDeleteKeyExA( key1, "", access, 0 ); + RegDeleteKeyExA( key2, "", access, 0 ); + RegDeleteKeyExA( key3, "", access, 0 ); RegCloseKey( key1 ); RegCloseKey( key2 ); RegCloseKey( key3 ); @@ -13418,7 +12277,7 @@ static void test_MsiEnumComponents(void) char *usersid = get_user_sid(); HKEY key1 = NULL, key2 = NULL; - if (is_process_limited()) + if (!is_process_elevated()) { skip("process is limited\n"); return; @@ -13472,8 +12331,8 @@ static void test_MsiEnumComponents(void) ok( found2, "comp2 not found\n" ); done: - delete_key( key1, "", access ); - delete_key( key2, "", access ); + RegDeleteKeyExA( key1, "", access, 0 ); + RegDeleteKeyExA( key2, "", access, 0 ); RegCloseKey( key1 ); RegCloseKey( key2 ); LocalFree( usersid ); @@ -13492,12 +12351,7 @@ static void test_MsiEnumComponentsEx(void) REGSAM access = KEY_ALL_ACCESS; char *usersid = get_user_sid(); - if (!pMsiEnumComponentsExA) - { - win_skip( "MsiEnumComponentsExA not implemented\n" ); - return; - } - if (is_process_limited()) + if (!is_process_elevated()) { skip("process is limited\n"); return; @@ -13542,7 +12396,7 @@ static void test_MsiEnumComponentsEx(void) sid[0] = 0; len = sizeof(sid); found1 = found2 = FALSE; - while (!pMsiEnumComponentsExA( "S-1-1-0", MSIINSTALLCONTEXT_ALL, index, guid, &context, sid, &len )) + while (!MsiEnumComponentsExA( "S-1-1-0", MSIINSTALLCONTEXT_ALL, index, guid, &context, sid, &len )) { if (!strcmp( comp1, guid )) { @@ -13569,16 +12423,16 @@ static void test_MsiEnumComponentsEx(void) ok( found1, "comp1 not found\n" ); ok( found2, "comp2 not found\n" ); - r = pMsiEnumComponentsExA( NULL, 0, 0, NULL, NULL, NULL, NULL ); + r = MsiEnumComponentsExA( NULL, 0, 0, NULL, NULL, NULL, NULL ); ok( r == ERROR_INVALID_PARAMETER, "got %u\n", r ); - r = pMsiEnumComponentsExA( NULL, MSIINSTALLCONTEXT_ALL, 0, NULL, NULL, sid, NULL ); + r = MsiEnumComponentsExA( NULL, MSIINSTALLCONTEXT_ALL, 0, NULL, NULL, sid, NULL ); ok( r == ERROR_INVALID_PARAMETER, "got %u\n", r ); done: RegDeleteValueA( key2, comp_squashed2 ); - delete_key( key1, "", access ); - delete_key( key2, "", access ); + RegDeleteKeyExA( key1, "", access, 0 ); + RegDeleteKeyExA( key2, "", access, 0 ); RegCloseKey( key1 ); RegCloseKey( key2 ); LocalFree( usersid ); @@ -13593,7 +12447,7 @@ static void test_MsiConfigureProductEx(void) CHAR keypath[MAX_PATH * 2], localpackage[MAX_PATH], packagename[MAX_PATH]; REGSAM access = KEY_ALL_ACCESS; - if (is_process_limited()) + if (!is_process_elevated()) { skip("process is limited\n"); return; @@ -13876,7 +12730,7 @@ static void test_MsiSetFeatureAttributes(void) char path[MAX_PATH]; MSIHANDLE package; - if (is_process_limited()) + if (!is_process_elevated()) { skip("process is limited\n"); return; @@ -13958,7 +12812,7 @@ static void test_MsiGetFeatureInfo(void) char title[32], help[32], path[MAX_PATH]; DWORD attrs, title_len, help_len; - if (is_process_limited()) + if (!is_process_elevated()) { skip("process is limited\n"); return; @@ -14079,18 +12933,12 @@ static void test_MsiSetExternalUI(void) ret_a = MsiSetExternalUIA(NULL, 0, NULL); ok(ret_a == handler_a, "expected %p, got %p\n", handler_a, ret_a); - /* Not present before Installer 3.1 */ - if (!pMsiSetExternalUIRecord) { - win_skip("MsiSetExternalUIRecord is not available\n"); - return; - } - - error = pMsiSetExternalUIRecord(handler_record, INSTALLLOGMODE_ERROR, NULL, &prev); + error = MsiSetExternalUIRecord(handler_record, INSTALLLOGMODE_ERROR, NULL, &prev); ok(!error, "MsiSetExternalUIRecord failed %u\n", error); ok(prev == NULL, "expected NULL, got %p\n", prev); prev = (INSTALLUI_HANDLER_RECORD)0xdeadbeef; - error = pMsiSetExternalUIRecord(NULL, INSTALLLOGMODE_ERROR, NULL, &prev); + error = MsiSetExternalUIRecord(NULL, INSTALLLOGMODE_ERROR, NULL, &prev); ok(!error, "MsiSetExternalUIRecord failed %u\n", error); ok(prev == handler_record, "expected %p, got %p\n", handler_record, prev); @@ -14107,7 +12955,7 @@ static void test_MsiSetExternalUI(void) ok(ret_w == NULL, "expected NULL, got %p\n", ret_w); prev = (INSTALLUI_HANDLER_RECORD)0xdeadbeef; - error = pMsiSetExternalUIRecord(handler_record, INSTALLLOGMODE_ERROR, NULL, &prev); + error = MsiSetExternalUIRecord(handler_record, INSTALLLOGMODE_ERROR, NULL, &prev); ok(!error, "MsiSetExternalUIRecord failed %u\n", error); ok(prev == NULL, "expected NULL, got %p\n", prev); @@ -14118,14 +12966,14 @@ static void test_MsiSetExternalUI(void) ok(ret_w == NULL, "expected NULL, got %p\n", ret_w); prev = (INSTALLUI_HANDLER_RECORD)0xdeadbeef; - error = pMsiSetExternalUIRecord(NULL, 0, NULL, &prev); + error = MsiSetExternalUIRecord(NULL, 0, NULL, &prev); ok(!error, "MsiSetExternalUIRecord failed %u\n", error); ok(prev == handler_record, "expected %p, got %p\n", handler_record, prev); - error = pMsiSetExternalUIRecord(handler_record, INSTALLLOGMODE_ERROR, NULL, NULL); + error = MsiSetExternalUIRecord(handler_record, INSTALLLOGMODE_ERROR, NULL, NULL); ok(!error, "MsiSetExternalUIRecord failed %u\n", error); - error = pMsiSetExternalUIRecord(NULL, 0, NULL, NULL); + error = MsiSetExternalUIRecord(NULL, 0, NULL, NULL); ok(!error, "MsiSetExternalUIRecord failed %u\n", error); } @@ -14136,12 +12984,6 @@ static void test_lastusedsource(void) DWORD size; UINT r; - if (!pMsiSourceListGetInfoA) - { - win_skip("MsiSourceListGetInfoA is not available\n"); - return; - } - CreateDirectoryA("msitest", NULL); create_file("maximus", 500); create_cab_file("test1.cab", MEDIA_SIZE, "maximus\0"); @@ -14157,8 +12999,8 @@ static void test_lastusedsource(void) size = MAX_PATH; lstrcpyA(value, "aaa"); - r = pMsiSourceListGetInfoA(prodcode, NULL, MSIINSTALLCONTEXT_USERUNMANAGED, - MSICODE_PRODUCT, INSTALLPROPERTY_LASTUSEDSOURCEA, value, &size); + r = MsiSourceListGetInfoA(prodcode, NULL, MSIINSTALLCONTEXT_USERUNMANAGED, + MSICODE_PRODUCT, INSTALLPROPERTY_LASTUSEDSOURCEA, value, &size); ok(r == ERROR_UNKNOWN_PRODUCT, "expected ERROR_UNKNOWN_PRODUCT, got %u\n", r); ok(!lstrcmpA(value, "aaa"), "expected \"aaa\", got \"%s\"\n", value); @@ -14175,8 +13017,8 @@ static void test_lastusedsource(void) size = MAX_PATH; lstrcpyA(value, "aaa"); - r = pMsiSourceListGetInfoA(prodcode, NULL, MSIINSTALLCONTEXT_USERUNMANAGED, - MSICODE_PRODUCT, INSTALLPROPERTY_LASTUSEDSOURCEA, value, &size); + r = MsiSourceListGetInfoA(prodcode, NULL, MSIINSTALLCONTEXT_USERUNMANAGED, + MSICODE_PRODUCT, INSTALLPROPERTY_LASTUSEDSOURCEA, value, &size); ok(r == ERROR_SUCCESS, "expected ERROR_SUCCESS, got %u\n", r); ok(!lstrcmpA(value, path), "expected \"%s\", got \"%s\"\n", path, value); ok(size == lstrlenA(path), "expected %d, got %lu\n", lstrlenA(path), size); @@ -14188,8 +13030,8 @@ static void test_lastusedsource(void) size = MAX_PATH; lstrcpyA(value, "aaa"); - r = pMsiSourceListGetInfoA(prodcode, NULL, MSIINSTALLCONTEXT_USERUNMANAGED, - MSICODE_PRODUCT, INSTALLPROPERTY_LASTUSEDSOURCEA, value, &size); + r = MsiSourceListGetInfoA(prodcode, NULL, MSIINSTALLCONTEXT_USERUNMANAGED, + MSICODE_PRODUCT, INSTALLPROPERTY_LASTUSEDSOURCEA, value, &size); ok(r == ERROR_UNKNOWN_PRODUCT, "expected ERROR_UNKNOWN_PRODUCT, got %u\n", r); ok(!lstrcmpA(value, "aaa"), "expected \"aaa\", got \"%s\"\n", value); @@ -14201,8 +13043,8 @@ static void test_lastusedsource(void) size = MAX_PATH; lstrcpyA(value, "aaa"); - r = pMsiSourceListGetInfoA(prodcode, NULL, MSIINSTALLCONTEXT_USERUNMANAGED, - MSICODE_PRODUCT, INSTALLPROPERTY_LASTUSEDSOURCEA, value, &size); + r = MsiSourceListGetInfoA(prodcode, NULL, MSIINSTALLCONTEXT_USERUNMANAGED, + MSICODE_PRODUCT, INSTALLPROPERTY_LASTUSEDSOURCEA, value, &size); ok(r == ERROR_SUCCESS, "expected ERROR_SUCCESS, got %u\n", r); ok(!lstrcmpA(value, path), "expected \"%s\", got \"%s\"\n", path, value); ok(size == lstrlenA(path), "expected %d, got %lu\n", lstrlenA(path), size); @@ -14212,8 +13054,8 @@ static void test_lastusedsource(void) size = MAX_PATH; lstrcpyA(value, "aaa"); - r = pMsiSourceListGetInfoA(prodcode, NULL, MSIINSTALLCONTEXT_USERUNMANAGED, - MSICODE_PRODUCT, INSTALLPROPERTY_LASTUSEDSOURCEA, value, &size); + r = MsiSourceListGetInfoA(prodcode, NULL, MSIINSTALLCONTEXT_USERUNMANAGED, + MSICODE_PRODUCT, INSTALLPROPERTY_LASTUSEDSOURCEA, value, &size); ok(r == ERROR_UNKNOWN_PRODUCT, "expected ERROR_UNKNOWN_PRODUCT, got %u\n", r); ok(!lstrcmpA(value, "aaa"), "expected \"aaa\", got \"%s\"\n", value); @@ -14226,8 +13068,8 @@ static void test_lastusedsource(void) size = MAX_PATH; lstrcpyA(value, "aaa"); - r = pMsiSourceListGetInfoA(prodcode, NULL, MSIINSTALLCONTEXT_USERUNMANAGED, - MSICODE_PRODUCT, INSTALLPROPERTY_LASTUSEDSOURCEA, value, &size); + r = MsiSourceListGetInfoA(prodcode, NULL, MSIINSTALLCONTEXT_USERUNMANAGED, + MSICODE_PRODUCT, INSTALLPROPERTY_LASTUSEDSOURCEA, value, &size); ok(r == ERROR_SUCCESS, "expected ERROR_SUCCESS, got %u\n", r); ok(!lstrcmpA(value, path), "expected \"%s\", got \"%s\"\n", path, value); ok(size == lstrlenA(path), "expected %d, got %lu\n", lstrlenA(path), size); @@ -14237,8 +13079,8 @@ static void test_lastusedsource(void) size = MAX_PATH; lstrcpyA(value, "aaa"); - r = pMsiSourceListGetInfoA(prodcode, NULL, MSIINSTALLCONTEXT_USERUNMANAGED, - MSICODE_PRODUCT, INSTALLPROPERTY_LASTUSEDSOURCEA, value, &size); + r = MsiSourceListGetInfoA(prodcode, NULL, MSIINSTALLCONTEXT_USERUNMANAGED, + MSICODE_PRODUCT, INSTALLPROPERTY_LASTUSEDSOURCEA, value, &size); ok(r == ERROR_UNKNOWN_PRODUCT, "expected ERROR_UNKNOWN_PRODUCT, got %u\n", r); ok(!lstrcmpA(value, "aaa"), "expected \"aaa\", got \"%s\"\n", value); @@ -14255,7 +13097,7 @@ static void test_setpropertyfolder(void) { UINT r; - if (is_process_limited()) + if (!is_process_elevated()) { skip("process is limited\n"); return; @@ -14310,7 +13152,7 @@ static void test_sourcedir_props(void) { UINT r; - if (is_process_limited()) + if (!is_process_elevated()) { skip("process is limited\n"); return; @@ -14374,7 +13216,7 @@ static void test_concurrentinstall(void) UINT r; CHAR path[MAX_PATH]; - if (is_process_limited()) + if (!is_process_elevated()) { skip("process is limited\n"); return; @@ -14426,7 +13268,7 @@ static void test_command_line_parsing(void) UINT r; const char *cmd; - if (is_process_limited()) + if (!is_process_elevated()) { skip("process is limited\n"); return; @@ -14595,10 +13437,9 @@ START_TEST(msi) } #endif - init_functionpointers(); + if (!is_process_elevated()) restart_as_admin_elevated(); - if (pIsWow64Process) - pIsWow64Process(GetCurrentProcess(), &is_wow64); + IsWow64Process(GetCurrentProcess(), &is_wow64); GetCurrentDirectoryA(MAX_PATH, prev_path); GetTempPathA(MAX_PATH, temp_path); @@ -14646,8 +13487,7 @@ START_TEST(msi) test_lastusedsource(); test_setpropertyfolder(); test_sourcedir_props(); - if (pMsiGetComponentPathExA) - test_concurrentinstall(); + test_concurrentinstall(); test_command_line_parsing(); test_MsiProvideQualifiedComponentEx(); diff --git a/modules/rostests/winetests/msi/package.c b/modules/rostests/winetests/msi/package.c index 05633c4b6df66..5977a525fb6d7 100644 --- a/modules/rostests/winetests/msi/package.c +++ b/modules/rostests/winetests/msi/package.c @@ -32,96 +32,11 @@ #include #include "wine/test.h" +#include "utils.h" static BOOL is_wow64; static const char msifile[] = "winetest-package.msi"; static const WCHAR msifileW[] = L"winetest-package.msi"; -static char CURR_DIR[MAX_PATH]; - -static INSTALLSTATE (WINAPI *pMsiGetComponentPathExA)(LPCSTR, LPCSTR, LPCSTR, MSIINSTALLCONTEXT, LPSTR, LPDWORD); - -static LONG (WINAPI *pRegDeleteKeyExA)(HKEY, LPCSTR, REGSAM, DWORD); -static LONG (WINAPI *pRegDeleteKeyExW)(HKEY, LPCWSTR, REGSAM, DWORD); -static BOOL (WINAPI *pIsWow64Process)(HANDLE, PBOOL); -static BOOL (WINAPI *pSRRemoveRestorePoint)(DWORD); -static BOOL (WINAPI *pSRSetRestorePointA)(RESTOREPOINTINFOA*, STATEMGRSTATUS*); - -static void init_functionpointers(void) -{ - HMODULE hmsi = GetModuleHandleA("msi.dll"); - HMODULE hadvapi32 = GetModuleHandleA("advapi32.dll"); - HMODULE hkernel32 = GetModuleHandleA("kernel32.dll"); - HMODULE hsrclient = LoadLibraryA("srclient.dll"); - -#define GET_PROC(mod, func) \ - p ## func = (void*)GetProcAddress(mod, #func); - - GET_PROC(hmsi, MsiGetComponentPathExA); - - GET_PROC(hadvapi32, RegDeleteKeyExA) - GET_PROC(hadvapi32, RegDeleteKeyExW) - GET_PROC(hkernel32, IsWow64Process) - - GET_PROC(hsrclient, SRRemoveRestorePoint); - GET_PROC(hsrclient, SRSetRestorePointA); - -#undef GET_PROC -} - -static BOOL is_process_limited(void) -{ - SID_IDENTIFIER_AUTHORITY NtAuthority = {SECURITY_NT_AUTHORITY}; - PSID Group = NULL; - BOOL IsInGroup; - HANDLE token; - - if (!AllocateAndInitializeSid(&NtAuthority, 2, SECURITY_BUILTIN_DOMAIN_RID, - DOMAIN_ALIAS_RID_ADMINS, 0, 0, 0, 0, 0, 0, &Group) || - !CheckTokenMembership(NULL, Group, &IsInGroup)) - { - trace("Could not check if the current user is an administrator\n"); - FreeSid(Group); - return FALSE; - } - FreeSid(Group); - - if (!IsInGroup) - { - if (!AllocateAndInitializeSid(&NtAuthority, 2, - SECURITY_BUILTIN_DOMAIN_RID, - DOMAIN_ALIAS_RID_POWER_USERS, - 0, 0, 0, 0, 0, 0, &Group) || - !CheckTokenMembership(NULL, Group, &IsInGroup)) - { - trace("Could not check if the current user is a power user\n"); - return FALSE; - } - if (!IsInGroup) - { - /* Only administrators and power users can be powerful */ - return TRUE; - } - } - - if (OpenProcessToken(GetCurrentProcess(), TOKEN_QUERY, &token)) - { - BOOL ret; - TOKEN_ELEVATION_TYPE type = TokenElevationTypeDefault; - DWORD size; - - ret = GetTokenInformation(token, TokenElevationType, &type, sizeof(type), &size); - CloseHandle(token); - return (ret && type == TokenElevationTypeLimited); - } - return FALSE; -} - -static LONG delete_key( HKEY key, LPCSTR subkey, REGSAM access ) -{ - if (pRegDeleteKeyExA) - return pRegDeleteKeyExA( key, subkey, access, 0 ); - return RegDeleteKeyA( key, subkey ); -} static char *get_user_sid(void) { @@ -186,12 +101,7 @@ static LSTATUS package_RegDeleteTreeW(HKEY hKey, LPCWSTR lpszSubKey, REGSAM acce } if (lpszSubKey) - { - if (pRegDeleteKeyExW) - ret = pRegDeleteKeyExW(hKey, lpszSubKey, access, 0); - else - ret = RegDeleteKeyW(hKey, lpszSubKey); - } + ret = RegDeleteKeyExW(hKey, lpszSubKey, access, 0); else while (TRUE) { @@ -402,25 +312,9 @@ static UINT do_query(MSIHANDLE hdb, const char *query, MSIHANDLE *phrec) return ret; } -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 create_component_table( MSIHANDLE hdb ) { - UINT r = run_query( hdb, + UINT r = run_query( hdb, 0, "CREATE TABLE `Component` ( " "`Component` CHAR(72) NOT NULL, " "`ComponentId` CHAR(38), " @@ -435,7 +329,7 @@ static UINT create_component_table( MSIHANDLE hdb ) static UINT create_feature_table( MSIHANDLE hdb ) { - UINT r = run_query( hdb, + UINT r = run_query( hdb, 0, "CREATE TABLE `Feature` ( " "`Feature` CHAR(38) NOT NULL, " "`Feature_Parent` CHAR(38), " @@ -452,7 +346,7 @@ static UINT create_feature_table( MSIHANDLE hdb ) static UINT create_feature_components_table( MSIHANDLE hdb ) { - UINT r = run_query( hdb, + UINT r = run_query( hdb, 0, "CREATE TABLE `FeatureComponents` ( " "`Feature_` CHAR(38) NOT NULL, " "`Component_` CHAR(72) NOT NULL " @@ -463,7 +357,7 @@ static UINT create_feature_components_table( MSIHANDLE hdb ) static UINT create_file_table( MSIHANDLE hdb ) { - UINT r = run_query( hdb, + UINT r = run_query( hdb, 0, "CREATE TABLE `File` (" "`File` CHAR(72) NOT NULL, " "`Component_` CHAR(72) NOT NULL, " @@ -480,7 +374,7 @@ static UINT create_file_table( MSIHANDLE hdb ) static UINT create_remove_file_table( MSIHANDLE hdb ) { - UINT r = run_query( hdb, + UINT r = run_query( hdb, 0, "CREATE TABLE `RemoveFile` (" "`FileKey` CHAR(72) NOT NULL, " "`Component_` CHAR(72) NOT NULL, " @@ -494,7 +388,7 @@ static UINT create_remove_file_table( MSIHANDLE hdb ) static UINT create_appsearch_table( MSIHANDLE hdb ) { - UINT r = run_query( hdb, + UINT r = run_query( hdb, 0, "CREATE TABLE `AppSearch` (" "`Property` CHAR(72) NOT NULL, " "`Signature_` CHAR(72) NOT NULL " @@ -505,7 +399,7 @@ static UINT create_appsearch_table( MSIHANDLE hdb ) static UINT create_reglocator_table( MSIHANDLE hdb ) { - UINT r = run_query( hdb, + UINT r = run_query( hdb, 0, "CREATE TABLE `RegLocator` (" "`Signature_` CHAR(72) NOT NULL, " "`Root` SHORT NOT NULL, " @@ -519,7 +413,7 @@ static UINT create_reglocator_table( MSIHANDLE hdb ) static UINT create_signature_table( MSIHANDLE hdb ) { - UINT r = run_query( hdb, + UINT r = run_query( hdb, 0, "CREATE TABLE `Signature` (" "`Signature` CHAR(72) NOT NULL, " "`FileName` CHAR(255) NOT NULL, " @@ -537,7 +431,7 @@ static UINT create_signature_table( MSIHANDLE hdb ) static UINT create_launchcondition_table( MSIHANDLE hdb ) { - UINT r = run_query( hdb, + UINT r = run_query( hdb, 0, "CREATE TABLE `LaunchCondition` (" "`Condition` CHAR(255) NOT NULL, " "`Description` CHAR(255) NOT NULL " @@ -548,7 +442,7 @@ static UINT create_launchcondition_table( MSIHANDLE hdb ) static UINT create_property_table( MSIHANDLE hdb ) { - UINT r = run_query( hdb, + UINT r = run_query( hdb, 0, "CREATE TABLE `Property` (" "`Property` CHAR(72) NOT NULL, " "`Value` CHAR(0) " @@ -559,7 +453,7 @@ static UINT create_property_table( MSIHANDLE hdb ) static UINT create_install_execute_sequence_table( MSIHANDLE hdb ) { - UINT r = run_query( hdb, + UINT r = run_query( hdb, 0, "CREATE TABLE `InstallExecuteSequence` (" "`Action` CHAR(72) NOT NULL, " "`Condition` CHAR(255), " @@ -571,7 +465,7 @@ static UINT create_install_execute_sequence_table( MSIHANDLE hdb ) static UINT create_install_ui_sequence_table( MSIHANDLE hdb ) { - UINT r = run_query( hdb, + UINT r = run_query( hdb, 0, "CREATE TABLE `InstallUISequence` (" "`Action` CHAR(72) NOT NULL, " "`Condition` CHAR(255), " @@ -583,7 +477,7 @@ static UINT create_install_ui_sequence_table( MSIHANDLE hdb ) static UINT create_media_table( MSIHANDLE hdb ) { - UINT r = run_query( hdb, + UINT r = run_query( hdb, 0, "CREATE TABLE `Media` (" "`DiskId` SHORT NOT NULL, " "`LastSequence` SHORT NOT NULL, " @@ -598,7 +492,7 @@ static UINT create_media_table( MSIHANDLE hdb ) static UINT create_ccpsearch_table( MSIHANDLE hdb ) { - UINT r = run_query( hdb, + UINT r = run_query( hdb, 0, "CREATE TABLE `CCPSearch` (" "`Signature_` CHAR(72) NOT NULL " "PRIMARY KEY `Signature_`)" ); @@ -608,7 +502,7 @@ static UINT create_ccpsearch_table( MSIHANDLE hdb ) static UINT create_drlocator_table( MSIHANDLE hdb ) { - UINT r = run_query( hdb, + UINT r = run_query( hdb, 0, "CREATE TABLE `DrLocator` (" "`Signature_` CHAR(72) NOT NULL, " "`Parent` CHAR(72), " @@ -621,7 +515,7 @@ static UINT create_drlocator_table( MSIHANDLE hdb ) static UINT create_complocator_table( MSIHANDLE hdb ) { - UINT r = run_query( hdb, + UINT r = run_query( hdb, 0, "CREATE TABLE `CompLocator` (" "`Signature_` CHAR(72) NOT NULL, " "`ComponentId` CHAR(38) NOT NULL, " @@ -633,7 +527,7 @@ static UINT create_complocator_table( MSIHANDLE hdb ) static UINT create_inilocator_table( MSIHANDLE hdb ) { - UINT r = run_query( hdb, + UINT r = run_query( hdb, 0, "CREATE TABLE `IniLocator` (" "`Signature_` CHAR(72) NOT NULL, " "`FileName` CHAR(255) NOT NULL, " @@ -648,7 +542,7 @@ static UINT create_inilocator_table( MSIHANDLE hdb ) static UINT create_custom_action_table( MSIHANDLE hdb ) { - UINT r = run_query( hdb, + UINT r = run_query( hdb, 0, "CREATE TABLE `CustomAction` (" "`Action` CHAR(72) NOT NULL, " "`Type` SHORT NOT NULL, " @@ -661,7 +555,7 @@ static UINT create_custom_action_table( MSIHANDLE hdb ) static UINT create_dialog_table( MSIHANDLE hdb ) { - UINT r = run_query(hdb, + UINT r = run_query(hdb, 0, "CREATE TABLE `Dialog` (" "`Dialog` CHAR(72) NOT NULL, " "`HCentering` SHORT NOT NULL, " @@ -680,7 +574,7 @@ static UINT create_dialog_table( MSIHANDLE hdb ) static UINT create_control_table( MSIHANDLE hdb ) { - UINT r = run_query(hdb, + UINT r = run_query(hdb, 0, "CREATE TABLE `Control` (" "`Dialog_` CHAR(72) NOT NULL, " "`Control` CHAR(50) NOT NULL, " @@ -701,7 +595,7 @@ static UINT create_control_table( MSIHANDLE hdb ) static UINT create_controlevent_table( MSIHANDLE hdb ) { - UINT r = run_query(hdb, + UINT r = run_query(hdb, 0, "CREATE TABLE `ControlEvent` (" "`Dialog_` CHAR(72) NOT NULL, " "`Control_` CHAR(50) NOT NULL, " @@ -716,7 +610,7 @@ static UINT create_controlevent_table( MSIHANDLE hdb ) static UINT create_actiontext_table( MSIHANDLE hdb ) { - UINT r = run_query(hdb, + UINT r = run_query(hdb, 0, "CREATE TABLE `ActionText` (" "`Action` CHAR(72) NOT NULL, " "`Description` CHAR(64) LOCALIZABLE, " @@ -728,7 +622,7 @@ static UINT create_actiontext_table( MSIHANDLE hdb ) static UINT create_upgrade_table( MSIHANDLE hdb ) { - UINT r = run_query( hdb, + UINT r = run_query( hdb, 0, "CREATE TABLE `Upgrade` (" "`UpgradeCode` CHAR(38) NOT NULL, " "`VersionMin` CHAR(20), " @@ -750,7 +644,7 @@ static inline UINT add_entry(const char *file, int line, const char *type, MSIHA sz = strlen(values) + strlen(insert) + 1; query = malloc(sz); sprintf(query, insert, values); - r = run_query(hdb, query); + r = run_query(hdb, 0, query); free(query); ok_(file, line)(r == ERROR_SUCCESS, "failed to insert into %s table: %u\n", type, r); return r; @@ -867,7 +761,7 @@ static UINT add_reglocator_entry( MSIHANDLE hdb, const char *sig, UINT root, con sz = strlen( sig ) + 10 + strlen( path ) + strlen( name ) + 10 + sizeof( insert ); query = malloc( sz ); sprintf( query, insert, sig, root, path, name, type ); - r = run_query( hdb, query ); + r = run_query( hdb, 0, query ); free( query ); ok(r == ERROR_SUCCESS, "failed to insert into reglocator table: %u\n", r); \ return r; @@ -937,7 +831,7 @@ static MSIHANDLE create_package_db(void) res = set_summary_info(hdb); ok( res == ERROR_SUCCESS, "Expected ERROR_SUCCESS got %d\n", res); - res = run_query( hdb, + res = run_query( hdb, 0, "CREATE TABLE `Directory` ( " "`Directory` CHAR(255) NOT NULL, " "`Directory_Parent` CHAR(255), " @@ -973,25 +867,9 @@ static UINT package_from_db(MSIHANDLE hdb, MSIHANDLE *handle) return ERROR_SUCCESS; } -static void create_file_data(LPCSTR name, LPCSTR data) -{ - 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); - if (file == INVALID_HANDLE_VALUE) - return; - - WriteFile(file, data, strlen(data), &written, NULL); - WriteFile(file, "\n", strlen("\n"), &written, NULL); - - CloseHandle(file); -} - static void create_test_file(const CHAR *name) { - create_file_data(name, name); + create_file_data(name, name, strlen(name)); } typedef struct _tagVS_VERSIONINFO @@ -1057,27 +935,6 @@ static BOOL create_file_with_version(const CHAR *name, LONG ms, LONG ls) return ret; } -static BOOL notify_system_change(DWORD event_type, STATEMGRSTATUS *status) -{ - RESTOREPOINTINFOA spec; - - spec.dwEventType = event_type; - spec.dwRestorePtType = APPLICATION_INSTALL; - spec.llSequenceNumber = status->llSequenceNumber; - lstrcpyA(spec.szDescription, "msitest restore point"); - - return pSRSetRestorePointA(&spec, status); -} - -static void remove_restore_point(DWORD seq_number) -{ - DWORD res; - - res = pSRRemoveRestorePoint(seq_number); - if (res != ERROR_SUCCESS) - trace("Failed to remove the restore point: %#lx\n", res); -} - static BOOL is_root(const char *path) { return (isalpha(path[0]) && path[1] == ':' && path[2] == '\\' && !path[3]); @@ -2118,26 +1975,22 @@ static void test_condition(void) ok( r == MSICONDITION_FALSE, "wrong return val (%d)\n", r); r = MsiEvaluateConditionW(hpkg, L"\"a\x30a\"<\"\xe5\""); - ok( r == MSICONDITION_TRUE || broken(r == MSICONDITION_FALSE), - "wrong return val (%d)\n", r); + ok( r == MSICONDITION_TRUE, "wrong return val (%d)\n", r); r = MsiEvaluateConditionW(hpkg, L"\"a\x30a\">\"\xe5\""); - ok( r == MSICONDITION_FALSE || broken(r == MSICONDITION_TRUE), - "wrong return val (%d)\n", r); + ok( r == MSICONDITION_FALSE, "wrong return val (%d)\n", r); r = MsiEvaluateConditionW(hpkg, L"\"a\x30a\"<>\"\xe5\""); - ok( r == MSICONDITION_TRUE || broken(r == MSICONDITION_FALSE), - "wrong return val (%d)\n", r); + ok( r == MSICONDITION_TRUE, "wrong return val (%d)\n", r); r = MsiEvaluateConditionW(hpkg, L"\"a\x30a\"=\"\xe5\""); - ok( r == MSICONDITION_FALSE || broken(r == MSICONDITION_TRUE), - "wrong return val (%d)\n", r); + ok( r == MSICONDITION_FALSE, "wrong return val (%d)\n", r); MsiCloseHandle( hpkg ); DeleteFileA(msifile); } -static void check_prop(MSIHANDLE hpkg, const char *prop, const char *expect, int match_case) +static void check_prop(MSIHANDLE hpkg, const char *prop, const char *expect, int match_case, int todo_value) { char buffer[MAX_PATH] = "x"; DWORD sz = sizeof(buffer); @@ -2145,9 +1998,9 @@ static void check_prop(MSIHANDLE hpkg, const char *prop, const char *expect, int ok(!r, "'%s': got %u\n", prop, r); ok(sz == lstrlenA(buffer), "'%s': expected %u, got %lu\n", prop, lstrlenA(buffer), sz); if (match_case) - ok(!strcmp(buffer, expect), "'%s': expected '%s', got '%s'\n", prop, expect, buffer); + todo_wine_if (todo_value) ok(!strcmp(buffer, expect), "'%s': expected '%s', got '%s'\n", prop, expect, buffer); else - ok(!_stricmp(buffer, expect), "'%s': expected '%s', got '%s'\n", prop, expect, buffer); + todo_wine_if (todo_value) ok(!_stricmp(buffer, expect), "'%s': expected '%s', got '%s'\n", prop, expect, buffer); } static void test_props(void) @@ -2220,29 +2073,29 @@ static void test_props(void) r = MsiSetPropertyA( hpkg, "=", "asdf" ); ok(!r, "got %u\n", r); - check_prop(hpkg, "=", "asdf", 1); + check_prop(hpkg, "=", "asdf", 1, 0); r = MsiSetPropertyA( hpkg, " ", "asdf" ); ok(!r, "got %u\n", r); - check_prop(hpkg, " ", "asdf", 1); + check_prop(hpkg, " ", "asdf", 1, 0); r = MsiSetPropertyA( hpkg, "'", "asdf" ); ok(!r, "got %u\n", r); - check_prop(hpkg, "'", "asdf", 1); + check_prop(hpkg, "'", "asdf", 1, 0); /* set empty values */ r = MsiSetPropertyA( hpkg, "boo", NULL ); ok(!r, "got %u\n", r); - check_prop(hpkg, "boo", "", 1); + check_prop(hpkg, "boo", "", 1, 0); r = MsiSetPropertyA( hpkg, "boo", "" ); ok(!r, "got %u\n", r); - check_prop(hpkg, "boo", "", 1); + check_prop(hpkg, "boo", "", 1, 0); /* set a non-empty value */ r = MsiSetPropertyA( hpkg, "boo", "xyz" ); ok(!r, "got %u\n", r); - check_prop(hpkg, "boo", "xyz", 1); + check_prop(hpkg, "boo", "xyz", 1, 0); r = MsiGetPropertyA(hpkg, "boo", NULL, NULL); ok(!r, "got %u\n", r); @@ -2317,10 +2170,10 @@ static void test_props(void) ok(sz == 3, "got size %lu\n", sz); /* properties are case-sensitive */ - check_prop(hpkg, "BOO", "", 1); + check_prop(hpkg, "BOO", "", 1, 0); /* properties set in Property table should work */ - check_prop(hpkg, "MetadataCompName", "Photoshop.dll", 1); + check_prop(hpkg, "MetadataCompName", "Photoshop.dll", 1, 0); MsiCloseHandle( hpkg ); DeleteFileA(msifile); @@ -2393,7 +2246,7 @@ static void test_property_table(void) query = "CREATE TABLE `_Property` ( " "`foo` INT NOT NULL, `bar` INT LOCALIZABLE PRIMARY KEY `foo`)"; - r = run_query(hdb, query); + r = run_query(hdb, 0, query); ok(r == ERROR_BAD_QUERY_SYNTAX, "Expected ERROR_BAD_QUERY_SYNTAX, got %d\n", r); MsiCloseHandle(hdb); @@ -2405,19 +2258,19 @@ static void test_property_table(void) query = "CREATE TABLE `_Property` ( " "`foo` INT NOT NULL, `bar` INT LOCALIZABLE PRIMARY KEY `foo`)"; - r = run_query(hdb, query); + r = run_query(hdb, 0, query); ok(r == ERROR_SUCCESS, "failed to create table\n"); query = "ALTER `_Property` ADD `foo` INTEGER"; - r = run_query(hdb, query); + r = run_query(hdb, 0, query); ok(r == ERROR_BAD_QUERY_SYNTAX, "failed to add column\n"); query = "ALTER TABLE `_Property` ADD `foo` INTEGER"; - r = run_query(hdb, query); + r = run_query(hdb, 0, query); ok(r == ERROR_BAD_QUERY_SYNTAX, "failed to add column\n"); query = "ALTER TABLE `_Property` ADD `extra` INTEGER"; - r = run_query(hdb, query); + r = run_query(hdb, 0, query); ok(r == ERROR_SUCCESS, "failed to add column\n"); sprintf(package, "#%lu", hdb); @@ -3071,11 +2924,10 @@ static void test_states(void) MSIHANDLE hpkg, hprod; UINT r; MSIHANDLE hdb; - BOOL is_broken; char value[MAX_PATH]; DWORD size; - if (is_process_limited()) + if (!is_process_elevated()) { skip("process is limited\n"); return; @@ -3608,8 +3460,7 @@ static void test_states(void) /* reinstall the product */ r = MsiInstallProductA(msifile3, "REINSTALL=ALL"); - is_broken = (r == ERROR_INSTALL_FAILURE); - ok(r == ERROR_SUCCESS || broken(is_broken) /* win2k3 */, "Expected ERROR_SUCCESS, got %d\n", r); + ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r); state = MsiQueryFeatureStateA("{7262AC98-EEBD-4364-8CE3-D654F6A425B9}", "five"); ok(state == INSTALLSTATE_UNKNOWN, "state = %d\n", state); @@ -3781,8 +3632,7 @@ static void test_states(void) MsiCloseHandle( hpkg ); r = MsiInstallProductA(msifile, ""); - ok(r == ERROR_SUCCESS || (is_broken && r == ERROR_INSTALL_FAILURE) /* win2k3 */, - "Expected ERROR_SUCCESS, got %d\n", r); + ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r); state = MsiQueryFeatureStateA("{7262AC98-EEBD-4364-8CE3-D654F6A425B9}", "one"); ok(state == INSTALLSTATE_SOURCE, "state = %d\n", state); state = MsiQueryFeatureStateA("{7262AC98-EEBD-4364-8CE3-D654F6A425B9}", "two"); @@ -4120,8 +3970,8 @@ static void test_appsearch(void) MsiCloseHandle( hpkg ); DeleteFileA(msifile); RegDeleteKeyA(HKEY_CURRENT_USER, "Software\\Winetest_msi"); - delete_key(HKEY_LOCAL_MACHINE, "Software\\Winetest_msi", KEY_WOW64_32KEY); - delete_key(HKEY_LOCAL_MACHINE, "Software\\Winetest_msi", KEY_WOW64_64KEY); + RegDeleteKeyExA(HKEY_LOCAL_MACHINE, "Software\\Winetest_msi", KEY_WOW64_32KEY, 0); + RegDeleteKeyExA(HKEY_LOCAL_MACHINE, "Software\\Winetest_msi", KEY_WOW64_64KEY, 0); } static void test_appsearch_complocator(void) @@ -4135,7 +3985,7 @@ static void test_appsearch_complocator(void) if (!(usersid = get_user_sid())) return; - if (is_process_limited()) + if (!is_process_elevated()) { skip("process is limited\n"); return; @@ -4412,9 +4262,7 @@ static void test_appsearch_reglocator(void) users = 0; res = RegCreateKeyA(HKEY_USERS, "S-1-5-18\\Software\\Wine", &users); - ok(res == ERROR_SUCCESS || - broken(res == ERROR_INVALID_PARAMETER), - "Expected ERROR_SUCCESS, got %ld\n", res); + ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %ld\n", res); if (res == ERROR_SUCCESS) { @@ -4717,7 +4565,7 @@ static void test_appsearch_reglocator(void) memset(&si, 0, sizeof(si)); GetNativeSystemInfo(&si); - if (S(U(si)).wProcessorArchitecture == PROCESSOR_ARCHITECTURE_INTEL) + if (si.wProcessorArchitecture == PROCESSOR_ARCHITECTURE_INTEL) { size = ExpandEnvironmentStringsA("%PATH%", NULL, 0); pathvar = malloc(size); @@ -5066,6 +4914,7 @@ static void test_appsearch_inilocator(void) } ok(r == ERROR_SUCCESS, "Expected a valid package handle %u\n", r); + MsiCloseHandle( hdb ); MsiSetInternalUI(INSTALLUILEVEL_NONE, NULL); r = MsiDoActionA(hpkg, "AppSearch"); @@ -5074,6 +4923,12 @@ static void test_appsearch_inilocator(void) size = MAX_PATH; r = MsiGetPropertyA(hpkg, "SIGPROP1", prop, &size); ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r); + if (!prop[0]) + { + win_skip("broken result\n"); + MsiCloseHandle(hpkg); + goto error; + } ok(!lstrcmpA(prop, "keydata"), "Expected \"keydata\", got \"%s\"\n", prop); size = MAX_PATH; @@ -5576,7 +5431,7 @@ static void test_installprops(void) CHAR path[MAX_PATH], buf[MAX_PATH]; DWORD size, type; LANGID langid; - HKEY hkey1, hkey2, pathkey; + HKEY hkey1, hkey2, pathkey = NULL; int res; UINT r; REGSAM access = KEY_ALL_ACCESS; @@ -5628,7 +5483,12 @@ static void test_installprops(void) ok( !lstrcmpA(buf, path), "Expected %s, got %s\n", path, buf); RegOpenKeyA(HKEY_CURRENT_USER, "SOFTWARE\\Microsoft\\MS Setup (ACME)\\User Info", &hkey1); - RegOpenKeyExA(HKEY_LOCAL_MACHINE, "SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion", 0, access, &hkey2); + res = RegOpenKeyExA(HKEY_LOCAL_MACHINE, "SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion", 0, access, &hkey2); + if (res == ERROR_ACCESS_DENIED) + { + win_skip("no access\n"); + goto done; + } RegOpenKeyExA(HKEY_LOCAL_MACHINE, "SOFTWARE\\Microsoft\\Windows\\CurrentVersion", 0, KEY_QUERY_VALUE | KEY_WOW64_64KEY, &pathkey); @@ -5734,72 +5594,73 @@ static void test_installprops(void) GetNativeSystemInfo(&si); sprintf(buf, "%d", LOBYTE(LOWORD(GetVersion())) * 100 + HIBYTE(LOWORD(GetVersion()))); - check_prop(hpkg, "VersionNT", buf, 1); + check_prop(hpkg, "VersionNT", buf, 1, 1); - if (S(U(si)).wProcessorArchitecture == PROCESSOR_ARCHITECTURE_AMD64) + if (si.wProcessorArchitecture == PROCESSOR_ARCHITECTURE_AMD64) { sprintf(buf, "%d", si.wProcessorLevel); - check_prop(hpkg, "Intel", buf, 1); - check_prop(hpkg, "MsiAMD64", buf, 1); - check_prop(hpkg, "Msix64", buf, 1); + check_prop(hpkg, "Intel", buf, 1, 0); + check_prop(hpkg, "MsiAMD64", buf, 1, 0); + check_prop(hpkg, "Msix64", buf, 1, 0); sprintf(buf, "%d", LOBYTE(LOWORD(GetVersion())) * 100 + HIBYTE(LOWORD(GetVersion()))); - check_prop(hpkg, "VersionNT64", buf, 1); + check_prop(hpkg, "VersionNT64", buf, 1, 1); GetSystemDirectoryA(path, MAX_PATH); strcat(path, "\\"); - check_prop(hpkg, "System64Folder", path, 0); + check_prop(hpkg, "System64Folder", path, 0, 0); GetSystemWow64DirectoryA(path, MAX_PATH); strcat(path, "\\"); - check_prop(hpkg, "SystemFolder", path, 0); + check_prop(hpkg, "SystemFolder", path, 0, 0); size = MAX_PATH; r = RegQueryValueExA(pathkey, "ProgramFilesDir (x86)", 0, &type, (BYTE *)path, &size); strcat(path, "\\"); - check_prop(hpkg, "ProgramFilesFolder", path, 0); + check_prop(hpkg, "ProgramFilesFolder", path, 0, 0); size = MAX_PATH; RegQueryValueExA(pathkey, "ProgramFilesDir", 0, &type, (BYTE *)path, &size); strcat(path, "\\"); - check_prop(hpkg, "ProgramFiles64Folder", path, 0); + check_prop(hpkg, "ProgramFiles64Folder", path, 0, 0); size = MAX_PATH; RegQueryValueExA(pathkey, "CommonFilesDir (x86)", 0, &type, (BYTE *)path, &size); strcat(path, "\\"); - check_prop(hpkg, "CommonFilesFolder", path, 0); + check_prop(hpkg, "CommonFilesFolder", path, 0, 0); size = MAX_PATH; RegQueryValueExA(pathkey, "CommonFilesDir", 0, &type, (BYTE *)path, &size); strcat(path, "\\"); - check_prop(hpkg, "CommonFiles64Folder", path, 0); + check_prop(hpkg, "CommonFiles64Folder", path, 0, 0); } - else if (S(U(si)).wProcessorArchitecture == PROCESSOR_ARCHITECTURE_INTEL) + else if (si.wProcessorArchitecture == PROCESSOR_ARCHITECTURE_INTEL) { sprintf(buf, "%d", si.wProcessorLevel); - check_prop(hpkg, "Intel", buf, 1); + check_prop(hpkg, "Intel", buf, 1, 0); GetSystemDirectoryA(path, MAX_PATH); strcat(path, "\\"); - check_prop(hpkg, "SystemFolder", path, 0); + check_prop(hpkg, "SystemFolder", path, 0, 0); size = MAX_PATH; RegQueryValueExA(pathkey, "ProgramFilesDir", 0, &type, (BYTE *)path, &size); strcat(path, "\\"); - check_prop(hpkg, "ProgramFilesFolder", path, 0); + check_prop(hpkg, "ProgramFilesFolder", path, 0, 0); size = MAX_PATH; RegQueryValueExA(pathkey, "CommonFilesDir", 0, &type, (BYTE *)path, &size); strcat(path, "\\"); - check_prop(hpkg, "CommonFilesFolder", path, 0); - - check_prop(hpkg, "MsiAMD64", "", 1); - check_prop(hpkg, "Msix64", "", 1); - check_prop(hpkg, "VersionNT64", "", 1); - check_prop(hpkg, "System64Folder", "", 0); - check_prop(hpkg, "ProgramFiles64Dir", "", 0); - check_prop(hpkg, "CommonFiles64Dir", "", 0); + check_prop(hpkg, "CommonFilesFolder", path, 0, 0); + + check_prop(hpkg, "MsiAMD64", "", 1, 0); + check_prop(hpkg, "Msix64", "", 1, 0); + check_prop(hpkg, "VersionNT64", "", 1, 0); + check_prop(hpkg, "System64Folder", "", 0, 0); + check_prop(hpkg, "ProgramFiles64Dir", "", 0, 0); + check_prop(hpkg, "CommonFiles64Dir", "", 0, 0); } +done: CloseHandle(hkey1); CloseHandle(hkey2); RegCloseKey(pathkey); @@ -7982,7 +7843,7 @@ static void test_MsiGetProductProperty(void) r = set_summary_info(hdb); ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r); - r = run_query(hdb, + r = run_query(hdb, 0, "CREATE TABLE `Directory` ( " "`Directory` CHAR(255) NOT NULL, " "`Directory_Parent` CHAR(255), " @@ -8022,6 +7883,7 @@ static void test_MsiGetProductProperty(void) skip("Not enough rights to perform tests\n"); RegDeleteKeyA(prodkey, ""); RegCloseKey(prodkey); + DeleteFileA(msifile); return; } ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %ld\n", res); @@ -8032,12 +7894,16 @@ static void test_MsiGetProductProperty(void) lstrcpyA(val, path); lstrcatA(val, "\\"); lstrcatA(val, msifile); - res = RegSetValueExA(props, "LocalPackage", 0, REG_SZ, - (const BYTE *)val, lstrlenA(val) + 1); + res = RegSetValueExA(props, "LocalPackage", 0, REG_SZ, (const BYTE *)val, lstrlenA(val) + 1); ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %ld\n", res); hprod = 0xdeadbeef; r = MsiOpenProductA(prodcode, &hprod); + if (r == ERROR_UNKNOWN_PRODUCT) + { + win_skip("broken result, skipping tests\n"); + goto done; + } ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r); ok(hprod != 0 && hprod != 0xdeadbeef, "Expected a valid product handle\n"); @@ -8258,13 +8124,13 @@ static void test_MsiGetProductProperty(void) "Expected %d, got %lu\n", lstrlenW(prodcodeW), size); MsiCloseHandle(hprod); - +done: RegDeleteValueA(props, "LocalPackage"); - delete_key(props, "", access); + RegDeleteKeyExA(props, "", access, 0); RegCloseKey(props); - delete_key(userkey, "", access); + RegDeleteKeyExA(userkey, "", access, 0); RegCloseKey(userkey); - delete_key(prodkey, "", access); + RegDeleteKeyExA(prodkey, "", access, 0); RegCloseKey(prodkey); DeleteFileA(msifile); } @@ -8459,10 +8325,14 @@ static void test_costs(void) add_media_entry( hdb, "'1', '2', 'cabinet', '', '', ''"); create_file_table( hdb ); - add_file_entry( hdb, "'one.txt', 'one', 'one.txt', 4096, '', '', 8192, 1" ); + add_file_entry( hdb, "'a.txt', 'one', 'a.txt', 2048000000, '', '', 8192, 1" ); + add_file_entry( hdb, "'b.txt', 'one', 'b.txt', 2048000000, '', '', 8192, 1" ); + add_file_entry( hdb, "'c.txt', 'one', 'c.txt', 2048000000, '', '', 8192, 1" ); + add_file_entry( hdb, "'d.txt', 'one', 'd.txt', 4097, '', '', 8192, 1" ); + add_file_entry( hdb, "'e.txt', 'one', 'e.txt', 1, '', '', 8192, 1" ); create_component_table( hdb ); - add_component_entry( hdb, "'one', '{B2F86B9D-8447-4BC5-8883-750C45AA31CA}', 'TARGETDIR', 0, '', 'one.txt'" ); + add_component_entry( hdb, "'one', '{B2F86B9D-8447-4BC5-8883-750C45AA31CA}', 'TARGETDIR', 0, '', 'a.txt'" ); add_component_entry( hdb, "'two', '{62A09F6E-0B74-4829-BDB7-CAB66F42CCE8}', 'TARGETDIR', 0, '', ''" ); create_feature_table( hdb ); @@ -8590,7 +8460,7 @@ static void test_costs(void) ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r ); ok( len == 2, "expected len == 2, got %lu\n", len ); ok( drive[0], "expected a drive\n" ); - ok( cost && cost != 0xdead, "expected cost > 0, got %d\n", cost ); + ok( cost == 12000024, "got %d\n", cost ); ok( !temp, "expected temp == 0, got %d\n", temp ); len = sizeof(drive); @@ -8611,7 +8481,7 @@ static void test_costs(void) ok( len == 2, "expected len == 2, got %lu\n", len ); ok( drive[0], "expected a drive\n" ); ok( !cost, "expected cost == 0, got %d\n", cost ); - ok( temp && temp != 0xdead, "expected temp > 0, got %d\n", temp ); + todo_wine ok( temp && temp != 0xdead, "expected temp > 0, got %d\n", temp ); /* increased index */ len = sizeof(drive); @@ -8634,7 +8504,7 @@ static void test_costs(void) cost = 0xdead; r = MsiGetFeatureCostA( hpkg, "one", MSICOSTTREE_SELFONLY, INSTALLSTATE_LOCAL, &cost ); ok( !r, "got %u\n", r); - ok( cost == 8, "got %d\n", cost ); + ok( cost == 12000024, "got %d\n", cost ); MsiCloseHandle( hpkg ); error: @@ -9108,13 +8978,13 @@ static void test_externalui_message(void) hdb = create_package_db(); ok(hdb, "failed to create database\n"); - create_file_data("forcecodepage.idt", "\r\n\r\n1252\t_ForceCodepage\r\n"); + create_file_data("forcecodepage.idt", "\r\n\r\n1252\t_ForceCodepage\r\n", sizeof("\r\n\r\n1252\t_ForceCodepage\r\n") - 1); r = MsiDatabaseImportA(hdb, CURR_DIR, "forcecodepage.idt"); ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r); - r = run_query(hdb, "CREATE TABLE `Error` (`Error` SHORT NOT NULL, `Message` CHAR(0) PRIMARY KEY `Error`)"); + r = run_query(hdb, 0, "CREATE TABLE `Error` (`Error` SHORT NOT NULL, `Message` CHAR(0) PRIMARY KEY `Error`)"); ok(r == ERROR_SUCCESS, "Failed to create Error table: %u\n", r); - r = run_query(hdb, "INSERT INTO `Error` (`Error`, `Message`) VALUES (5, 'internal error')"); + r = run_query(hdb, 0, "INSERT INTO `Error` (`Error`, `Message`) VALUES (5, 'internal error')"); ok(r == ERROR_SUCCESS, "Failed to insert into Error table: %u\n", r); create_actiontext_table(hdb); @@ -9325,7 +9195,7 @@ static void test_controlevent(void) hdb = create_package_db(); ok(hdb, "failed to create database\n"); - create_file_data("forcecodepage.idt", "\r\n\r\n1252\t_ForceCodepage\r\n"); + create_file_data("forcecodepage.idt", "\r\n\r\n1252\t_ForceCodepage\r\n", sizeof("\r\n\r\n1252\t_ForceCodepage\r\n") - 1); r = MsiDatabaseImportA(hdb, CURR_DIR, "forcecodepage.idt"); ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r); @@ -9548,7 +9418,7 @@ static void test_top_level_action(void) hdb = create_package_db(); ok(hdb, "failed to create database\n"); - create_file_data("forcecodepage.idt", "\r\n\r\n1252\t_ForceCodepage\r\n"); + create_file_data("forcecodepage.idt", "\r\n\r\n1252\t_ForceCodepage\r\n", sizeof("\r\n\r\n1252\t_ForceCodepage\r\n") -1 ); r = MsiDatabaseImportA(hdb, CURR_DIR, "forcecodepage.idt"); ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r); @@ -9623,14 +9493,11 @@ static void test_top_level_action(void) START_TEST(package) { char temp_path[MAX_PATH], prev_path[MAX_PATH]; - STATEMGRSTATUS status; - BOOL ret = FALSE; DWORD len; - init_functionpointers(); + if (!is_process_elevated()) restart_as_admin_elevated(); - if (pIsWow64Process) - pIsWow64Process(GetCurrentProcess(), &is_wow64); + IsWow64Process(GetCurrentProcess(), &is_wow64); GetCurrentDirectoryA(MAX_PATH, prev_path); GetTempPathA(MAX_PATH, temp_path); @@ -9642,18 +9509,6 @@ START_TEST(package) if (len && (CURR_DIR[len - 1] == '\\')) CURR_DIR[len - 1] = 0; - /* Create a restore point ourselves so we circumvent the multitude of restore points - * that would have been created by all the installation and removal tests. - * - * This is not needed on version 5.0 where setting MSIFASTINSTALL prevents the - * creation of restore points. - */ - if (pSRSetRestorePointA && !pMsiGetComponentPathExA) - { - memset(&status, 0, sizeof(status)); - ret = notify_system_change(BEGIN_NESTED_SYSTEM_CHANGE, &status); - } - test_createpackage(); test_doaction(); test_gettargetpath_bad(); @@ -9692,12 +9547,5 @@ START_TEST(package) test_controlevent(); test_top_level_action(); - if (pSRSetRestorePointA && !pMsiGetComponentPathExA && ret) - { - ret = notify_system_change(END_NESTED_SYSTEM_CHANGE, &status); - if (ret) - remove_restore_point(status.llSequenceNumber); - } - SetCurrentDirectoryA(prev_path); } diff --git a/modules/rostests/winetests/msi/patch.c b/modules/rostests/winetests/msi/patch.c index 9d46f493e0812..1b110ecfc8935 100644 --- a/modules/rostests/winetests/msi/patch.c +++ b/modules/rostests/winetests/msi/patch.c @@ -30,22 +30,13 @@ #include #include "wine/test.h" - -static UINT (WINAPI *pMsiApplyPatchA)( LPCSTR, LPCSTR, INSTALLTYPE, LPCSTR ); -static UINT (WINAPI *pMsiGetPatchInfoExA)( LPCSTR, LPCSTR, LPCSTR, MSIINSTALLCONTEXT, - LPCSTR, LPSTR, DWORD * ); -static UINT (WINAPI *pMsiEnumPatchesExA)( LPCSTR, LPCSTR, DWORD, DWORD, DWORD, LPSTR, - LPSTR, MSIINSTALLCONTEXT *, LPSTR, LPDWORD ); +#include "utils.h" static const char *msifile = "winetest-patch.msi"; static const char *mspfile = "winetest-patch.msp"; static const WCHAR msifileW[] = L"winetest-patch.msi"; static const WCHAR mspfileW[] = L"winetest-patch.msp"; -static char CURR_DIR[MAX_PATH]; -static char PROG_FILES_DIR[MAX_PATH]; -static char COMMON_FILES_DIR[MAX_PATH]; - /* msi database data */ static const char property_dat[] = @@ -136,8 +127,6 @@ struct msi_table int size; }; -#define ADD_TABLE( x ) { #x".idt", x##_dat, sizeof(x##_dat) } - static const struct msi_table tables[] = { ADD_TABLE( directory ), @@ -151,39 +140,6 @@ static const struct msi_table tables[] = ADD_TABLE( condition ) }; -static void init_function_pointers( void ) -{ - HMODULE hmsi = GetModuleHandleA( "msi.dll" ); - -#define GET_PROC( mod, func ) \ - p ## func = (void *)GetProcAddress( mod, #func ); \ - if (!p ## func) \ - trace( "GetProcAddress(%s) failed\n", #func ); - - GET_PROC( hmsi, MsiApplyPatchA ); - GET_PROC( hmsi, MsiGetPatchInfoExA ); - GET_PROC( hmsi, MsiEnumPatchesExA ); - -#undef GET_PROC -} - -static BOOL is_process_limited(void) -{ - HANDLE token; - - if (OpenProcessToken(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 BOOL get_program_files_dir( char *buf, char *buf2 ) { HKEY hkey; @@ -209,40 +165,6 @@ static BOOL get_program_files_dir( char *buf, char *buf2 ) return TRUE; } -static void create_file_data( const char *filename, const char *data, DWORD size ) -{ - HANDLE file; - DWORD written; - - file = CreateFileA( filename, 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 BOOL delete_pf( const char *rel_path, BOOL is_file ) -{ - char path[MAX_PATH]; - - strcpy( path, PROG_FILES_DIR ); - strcat( path, "\\" ); - strcat( path, rel_path ); - - if (is_file) - return DeleteFileA( path ); - else - return RemoveDirectoryA( path ); -} - static DWORD get_pf_file_size( const char *filename ) { char path[MAX_PATH]; @@ -313,7 +235,7 @@ static void set_suminfo( const WCHAR *filename ) ok( r == ERROR_SUCCESS, "failed to close database %u\n", r ); } -static void create_database( const char *filename, const struct msi_table *tables, UINT num_tables ) +static void create_database_suminfo( const char *filename, const struct msi_table *tables, UINT num_tables ) { MSIHANDLE hdb; UINT r, i; @@ -747,12 +669,7 @@ static void test_simple_patch( void ) WCHAR pathW[MAX_PATH]; MSIHANDLE hpackage, hdb, hview, hrec; - if (!pMsiApplyPatchA) - { - win_skip("MsiApplyPatchA is not available\n"); - return; - } - if (is_process_limited()) + if (!is_process_elevated()) { skip("process is limited\n"); return; @@ -761,7 +678,7 @@ static void test_simple_patch( void ) CreateDirectoryA( "msitest", NULL ); create_file( "msitest\\patch.txt", 1000 ); - create_database( msifile, tables, ARRAY_SIZE(tables) ); + create_database_suminfo( msifile, tables, ARRAY_SIZE(tables) ); create_patch( mspfile ); MsiSetInternalUI( INSTALLUILEVEL_NONE, NULL ); @@ -830,14 +747,7 @@ static void test_simple_patch( void ) MsiCloseHandle( hpackage ); r = MsiApplyPatchA( mspfile, NULL, INSTALLTYPE_DEFAULT, NULL ); - ok( r == ERROR_SUCCESS || broken( r == ERROR_PATCH_PACKAGE_INVALID ), /* version 2.0 */ - "expected ERROR_SUCCESS, got %u\n", r ); - - if (r == ERROR_PATCH_PACKAGE_INVALID) - { - win_skip("Windows Installer < 3.0 detected\n"); - goto uninstall; - } + ok( r == ERROR_SUCCESS, "expected ERROR_SUCCESS, got %u\n", r ); size = get_pf_file_size( "msitest\\patch.txt" ); ok( size == 1002, "expected 1002, got %lu\n", size ); @@ -913,7 +823,6 @@ static void test_simple_patch( void ) MsiCloseHandle( hview ); MsiCloseHandle( hdb ); -uninstall: size = sizeof(path); r = MsiGetProductInfoA( "{913B8D18-FBB6-4CAC-A239-C74C11E3FA74}", "InstallSource", path, &size ); @@ -962,7 +871,7 @@ static void test_MsiOpenDatabase( void ) MsiCloseHandle( hdb ); DeleteFileA( mspfile ); - create_database( msifile, tables, ARRAY_SIZE(tables) ); + create_database_suminfo( msifile, tables, ARRAY_SIZE(tables) ); create_patch( mspfile ); r = MsiOpenDatabaseW( msifileW, MSIDBOPEN_READONLY + MSIDBOPEN_PATCHFILE, &hdb ); @@ -1086,12 +995,7 @@ static void test_system_tables( void ) const char *query; MSIHANDLE hproduct, hdb, hview, hrec; - if (!pMsiApplyPatchA) - { - win_skip("MsiApplyPatchA is not available\n"); - return; - } - if (is_process_limited()) + if (!is_process_elevated()) { skip("process is limited\n"); return; @@ -1100,7 +1004,7 @@ static void test_system_tables( void ) CreateDirectoryA( "msitest", NULL ); create_file( "msitest\\patch.txt", 1000 ); - create_database( msifile, tables, ARRAY_SIZE(tables) ); + create_database_suminfo( msifile, tables, ARRAY_SIZE(tables) ); create_patch( mspfile ); MsiSetInternalUI( INSTALLUILEVEL_NONE, NULL ); @@ -1168,14 +1072,7 @@ static void test_system_tables( void ) MsiCloseHandle( hproduct ); r = MsiApplyPatchA( mspfile, NULL, INSTALLTYPE_DEFAULT, NULL ); - ok( r == ERROR_SUCCESS || broken( r == ERROR_PATCH_PACKAGE_INVALID ), /* version 2.0 */ - "expected ERROR_SUCCESS, got %u\n", r ); - - if (r == ERROR_PATCH_PACKAGE_INVALID) - { - win_skip("Windows Installer < 3.0 detected\n"); - goto uninstall; - } + ok( r == ERROR_SUCCESS, "expected ERROR_SUCCESS, got %u\n", r ); r = MsiOpenProductA( "{913B8D18-FBB6-4CAC-A239-C74C11E3FA74}", &hproduct ); ok( r == ERROR_SUCCESS, "expected ERROR_SUCCESS, got %u\n", r ); @@ -1259,7 +1156,6 @@ static void test_system_tables( void ) MsiCloseHandle( hdb ); MsiCloseHandle( hproduct ); -uninstall: r = MsiInstallProductA( msifile, "REMOVE=ALL" ); ok( r == ERROR_SUCCESS, "expected ERROR_SUCCESS, got %u\n", r ); @@ -1276,12 +1172,7 @@ static void test_patch_registration( void ) DWORD size; char buffer[MAX_PATH], patch_code[39]; - if (!pMsiApplyPatchA || !pMsiGetPatchInfoExA || !pMsiEnumPatchesExA) - { - win_skip("required functions not available\n"); - return; - } - if (is_process_limited()) + if (!is_process_elevated()) { skip("process is limited\n"); return; @@ -1290,7 +1181,7 @@ static void test_patch_registration( void ) CreateDirectoryA( "msitest", NULL ); create_file( "msitest\\patch.txt", 1000 ); - create_database( msifile, tables, ARRAY_SIZE(tables) ); + create_database_suminfo( msifile, tables, ARRAY_SIZE(tables) ); create_patch( mspfile ); MsiSetInternalUI( INSTALLUILEVEL_NONE, NULL ); @@ -1303,67 +1194,59 @@ static void test_patch_registration( void ) } r = MsiApplyPatchA( mspfile, NULL, INSTALLTYPE_DEFAULT, NULL ); - ok( r == ERROR_SUCCESS || broken( r == ERROR_PATCH_PACKAGE_INVALID ), /* version 2.0 */ - "expected ERROR_SUCCESS, got %u\n", r ); - - if (r == ERROR_PATCH_PACKAGE_INVALID) - { - win_skip("Windows Installer < 3.0 detected\n"); - goto uninstall; - } + ok( r == ERROR_SUCCESS, "expected ERROR_SUCCESS, got %u\n", r ); buffer[0] = 0; size = sizeof(buffer); - r = pMsiGetPatchInfoExA( "{0F96CDC0-4CDF-4304-B283-7B9264889EF7}", - "{913B8D18-FBB6-4CAC-A239-C74C11E3FA74}", - NULL, MSIINSTALLCONTEXT_USERUNMANAGED, - INSTALLPROPERTY_LOCALPACKAGEA, buffer, &size ); + r = MsiGetPatchInfoExA( "{0F96CDC0-4CDF-4304-B283-7B9264889EF7}", + "{913B8D18-FBB6-4CAC-A239-C74C11E3FA74}", + NULL, MSIINSTALLCONTEXT_USERUNMANAGED, + INSTALLPROPERTY_LOCALPACKAGEA, buffer, &size ); ok( r == ERROR_SUCCESS, "expected ERROR_SUCCESS, got %u\n", r ); ok( buffer[0], "buffer empty\n" ); buffer[0] = 0; size = sizeof(buffer); - r = pMsiGetPatchInfoExA( "{0F96CDC0-4CDF-4304-B283-7B9264889EF7}", - "{913B8D18-FBB6-4CAC-A239-C74C11E3FA74}", - NULL, MSIINSTALLCONTEXT_MACHINE, - INSTALLPROPERTY_LOCALPACKAGEA, buffer, &size ); + r = MsiGetPatchInfoExA( "{0F96CDC0-4CDF-4304-B283-7B9264889EF7}", + "{913B8D18-FBB6-4CAC-A239-C74C11E3FA74}", + NULL, MSIINSTALLCONTEXT_MACHINE, + INSTALLPROPERTY_LOCALPACKAGEA, buffer, &size ); ok( r == ERROR_UNKNOWN_PRODUCT, "expected ERROR_UNKNOWN_PRODUCT, got %u\n", r ); buffer[0] = 0; size = sizeof(buffer); - r = pMsiGetPatchInfoExA( "{0F96CDC0-4CDF-4304-B283-7B9264889EF7}", - "{913B8D18-FBB6-4CAC-A239-C74C11E3FA74}", + r = MsiGetPatchInfoExA( "{0F96CDC0-4CDF-4304-B283-7B9264889EF7}", + "{913B8D18-FBB6-4CAC-A239-C74C11E3FA74}", NULL, MSIINSTALLCONTEXT_USERMANAGED, INSTALLPROPERTY_LOCALPACKAGEA, buffer, &size ); ok( r == ERROR_SUCCESS, "expected ERROR_SUCCESS, got %u\n", r ); ok( !buffer[0], "got %s\n", buffer ); - r = pMsiEnumPatchesExA( "{913B8D18-FBB6-4CAC-A239-C74C11E3FA74}", - NULL, MSIINSTALLCONTEXT_USERUNMANAGED, MSIPATCHSTATE_APPLIED, - 0, patch_code, NULL, NULL, NULL, NULL ); + r = MsiEnumPatchesExA( "{913B8D18-FBB6-4CAC-A239-C74C11E3FA74}", + NULL, MSIINSTALLCONTEXT_USERUNMANAGED, MSIPATCHSTATE_APPLIED, + 0, patch_code, NULL, NULL, NULL, NULL ); ok( r == ERROR_SUCCESS, "expected ERROR_SUCCESS, got %u\n", r ); ok( !strcmp( patch_code, "{0F96CDC0-4CDF-4304-B283-7B9264889EF7}" ), "wrong patch code\n" ); - r = pMsiEnumPatchesExA( "{913B8D18-FBB6-4CAC-A239-C74C11E3FA74}", - NULL, MSIINSTALLCONTEXT_MACHINE, MSIPATCHSTATE_APPLIED, - 0, patch_code, NULL, NULL, NULL, NULL ); + r = MsiEnumPatchesExA( "{913B8D18-FBB6-4CAC-A239-C74C11E3FA74}", + NULL, MSIINSTALLCONTEXT_MACHINE, MSIPATCHSTATE_APPLIED, + 0, patch_code, NULL, NULL, NULL, NULL ); ok( r == ERROR_NO_MORE_ITEMS, "expected ERROR_NO_MORE_ITEMS, got %u\n", r ); - r = pMsiEnumPatchesExA( "{913B8D18-FBB6-4CAC-A239-C74C11E3FA74}", - NULL, MSIINSTALLCONTEXT_USERMANAGED, MSIPATCHSTATE_APPLIED, - 0, patch_code, NULL, NULL, NULL, NULL ); + r = MsiEnumPatchesExA( "{913B8D18-FBB6-4CAC-A239-C74C11E3FA74}", + NULL, MSIINSTALLCONTEXT_USERMANAGED, MSIPATCHSTATE_APPLIED, + 0, patch_code, NULL, NULL, NULL, NULL ); ok( r == ERROR_NO_MORE_ITEMS, "expected ERROR_NO_MORE_ITEMS, got %u\n", r ); -uninstall: r = MsiInstallProductA( msifile, "REMOVE=ALL" ); ok( r == ERROR_SUCCESS, "expected ERROR_SUCCESS, got %u\n", r ); buffer[0] = 0; size = sizeof(buffer); - r = pMsiGetPatchInfoExA( "{0F96CDC0-4CDF-4304-B283-7B9264889EF7}", - "{913B8D18-FBB6-4CAC-A239-C74C11E3FA74}", - NULL, MSIINSTALLCONTEXT_USERUNMANAGED, - INSTALLPROPERTY_LOCALPACKAGEA, buffer, &size ); + r = MsiGetPatchInfoExA( "{0F96CDC0-4CDF-4304-B283-7B9264889EF7}", + "{913B8D18-FBB6-4CAC-A239-C74C11E3FA74}", + NULL, MSIINSTALLCONTEXT_USERUNMANAGED, + INSTALLPROPERTY_LOCALPACKAGEA, buffer, &size ); ok( r == ERROR_UNKNOWN_PRODUCT, "expected ERROR_UNKNOWN_PRODUCT, got %u\n", r ); cleanup: @@ -1378,7 +1261,7 @@ START_TEST(patch) DWORD len; char temp_path[MAX_PATH], prev_path[MAX_PATH]; - init_function_pointers(); + if (!is_process_elevated()) restart_as_admin_elevated(); GetCurrentDirectoryA( MAX_PATH, prev_path ); GetTempPathA( MAX_PATH, temp_path ); diff --git a/modules/rostests/winetests/msi/record.c b/modules/rostests/winetests/msi/record.c index fb778104ee11b..5f3e2754f2b49 100644 --- a/modules/rostests/winetests/msi/record.c +++ b/modules/rostests/winetests/msi/record.c @@ -244,11 +244,11 @@ static void test_msirecord(void) i = MsiRecordSetStringA(h,0,"42"); ok(i == ERROR_SUCCESS, "Failed to set string at 0\n"); i = MsiRecordGetInteger(h, 0); - ok(i == 42, "should get invalid integer\n"); + ok(i == 42, "should get 42\n"); i = MsiRecordSetStringA(h,0,"-42"); ok(i == ERROR_SUCCESS, "Failed to set string at 0\n"); i = MsiRecordGetInteger(h, 0); - ok(i == -42, "should get invalid integer\n"); + ok(i == -42, "should get -42\n"); i = MsiRecordSetStringA(h,0," 42"); ok(i == ERROR_SUCCESS, "Failed to set string at 0\n"); i = MsiRecordGetInteger(h, 0); @@ -349,7 +349,7 @@ static void test_msirecord(void) ok(r == ERROR_SUCCESS, "failed to add stream to record\n"); r = MsiRecordReadStream(h, 1, buf, NULL); ok(r == ERROR_INVALID_PARAMETER, "should return error\n"); - DeleteFileA(filename); /* Windows 98 doesn't like this at all, so don't check return. */ + DeleteFileA(filename); r = MsiRecordReadStream(h, 1, NULL, NULL); ok(r == ERROR_INVALID_PARAMETER, "should return error\n"); sz = sizeof buf; diff --git a/modules/rostests/winetests/msi/selfreg.c b/modules/rostests/winetests/msi/selfreg.c index 668e742e9ba3c..2f5e6f48ef1b4 100644 --- a/modules/rostests/winetests/msi/selfreg.c +++ b/modules/rostests/winetests/msi/selfreg.c @@ -18,6 +18,10 @@ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA */ +#if 0 +#pragma makedep testdll +#endif + #include #include #include diff --git a/modules/rostests/winetests/msi/source.c b/modules/rostests/winetests/msi/source.c index 1e794caaf5a26..0f6967cde22dd 100644 --- a/modules/rostests/winetests/msi/source.c +++ b/modules/rostests/winetests/msi/source.c @@ -35,53 +35,6 @@ static BOOL is_wow64; -static LONG (WINAPI *pRegDeleteKeyExA)(HKEY, LPCSTR, REGSAM, DWORD); -static BOOL (WINAPI *pIsWow64Process)(HANDLE, PBOOL); - -static UINT (WINAPI *pMsiSourceListAddMediaDiskA) - (LPCSTR, LPCSTR, MSIINSTALLCONTEXT, DWORD, DWORD, LPCSTR, LPCSTR); -static UINT (WINAPI *pMsiSourceListAddSourceExA) - (LPCSTR, LPCSTR, MSIINSTALLCONTEXT, DWORD, LPCSTR, DWORD); -static UINT (WINAPI *pMsiSourceListEnumMediaDisksA) - (LPCSTR, LPCSTR, MSIINSTALLCONTEXT, DWORD, DWORD, LPDWORD, LPSTR, - LPDWORD, LPSTR, LPDWORD); -static UINT (WINAPI *pMsiSourceListEnumSourcesA) - (LPCSTR, LPCSTR, MSIINSTALLCONTEXT, DWORD, DWORD, LPSTR, LPDWORD); -static UINT (WINAPI *pMsiSourceListGetInfoA) - (LPCSTR, LPCSTR, MSIINSTALLCONTEXT, DWORD, LPCSTR, LPSTR, LPDWORD); -static UINT (WINAPI *pMsiSourceListGetInfoW) - (LPCWSTR, LPCWSTR, MSIINSTALLCONTEXT, DWORD, LPCWSTR, LPWSTR, LPDWORD); -static UINT (WINAPI *pMsiSourceListSetInfoA) - (LPCSTR, LPCSTR, MSIINSTALLCONTEXT, DWORD,LPCSTR, LPCSTR); -static UINT (WINAPI *pMsiSourceListAddSourceA) - (LPCSTR, LPCSTR, DWORD, LPCSTR); - -static void init_functionpointers(void) -{ - HMODULE hmsi = GetModuleHandleA("msi.dll"); - HMODULE hadvapi32 = GetModuleHandleA("advapi32.dll"); - HMODULE hkernel32 = GetModuleHandleA("kernel32.dll"); - -#define GET_PROC(dll, func) \ - p ## func = (void *)GetProcAddress(dll, #func); \ - if(!p ## func) \ - trace("GetProcAddress(%s) failed\n", #func); - - GET_PROC(hmsi, MsiSourceListAddMediaDiskA) - GET_PROC(hmsi, MsiSourceListAddSourceExA) - GET_PROC(hmsi, MsiSourceListEnumMediaDisksA) - GET_PROC(hmsi, MsiSourceListEnumSourcesA) - GET_PROC(hmsi, MsiSourceListGetInfoA) - GET_PROC(hmsi, MsiSourceListGetInfoW) - GET_PROC(hmsi, MsiSourceListSetInfoA) - GET_PROC(hmsi, MsiSourceListAddSourceA) - - GET_PROC(hadvapi32, RegDeleteKeyExA) - GET_PROC(hkernel32, IsWow64Process) - -#undef GET_PROC -} - /* copied from dlls/msi/registry.c */ static BOOL squash_guid(LPCWSTR in, LPWSTR out) { @@ -203,12 +156,6 @@ static void test_MsiSourceListGetInfo(void) HKEY userkey, hkey, media; DWORD size; - if (!pMsiSourceListGetInfoA) - { - win_skip("Skipping MsiSourceListGetInfoA tests\n"); - return; - } - create_test_guid(prodcode, prod_squashed); if (!(usersid = get_user_sid())) { @@ -217,78 +164,78 @@ static void test_MsiSourceListGetInfo(void) } /* NULL szProductCodeOrPatchCode */ - r = pMsiSourceListGetInfoA(NULL, usersid, MSIINSTALLCONTEXT_USERUNMANAGED, + r = MsiSourceListGetInfoA(NULL, usersid, MSIINSTALLCONTEXT_USERUNMANAGED, MSICODE_PRODUCT, INSTALLPROPERTY_PACKAGENAMEA, NULL, NULL); ok(r == ERROR_INVALID_PARAMETER, "Expected ERROR_INVALID_PARAMETER, got %d\n", r); /* empty szProductCodeOrPatchCode */ - r = pMsiSourceListGetInfoA("", usersid, MSIINSTALLCONTEXT_USERUNMANAGED, + r = MsiSourceListGetInfoA("", usersid, MSIINSTALLCONTEXT_USERUNMANAGED, MSICODE_PRODUCT, INSTALLPROPERTY_PACKAGENAMEA, NULL, NULL); ok(r == ERROR_INVALID_PARAMETER, "Expected ERROR_INVALID_PARAMETER, got %d\n", r); /* garbage szProductCodeOrPatchCode */ - r = pMsiSourceListGetInfoA("garbage", usersid, MSIINSTALLCONTEXT_USERUNMANAGED, + r = MsiSourceListGetInfoA("garbage", usersid, MSIINSTALLCONTEXT_USERUNMANAGED, MSICODE_PRODUCT, INSTALLPROPERTY_PACKAGENAMEA, NULL, NULL); ok(r == ERROR_INVALID_PARAMETER, "Expected ERROR_INVALID_PARAMETER, got %d\n", r); /* guid without brackets */ - r = pMsiSourceListGetInfoA("51CD2AD5-0482-4C46-8DDD-0ED1022AA1AA", usersid, MSIINSTALLCONTEXT_USERUNMANAGED, + r = MsiSourceListGetInfoA("51CD2AD5-0482-4C46-8DDD-0ED1022AA1AA", usersid, MSIINSTALLCONTEXT_USERUNMANAGED, MSICODE_PRODUCT, INSTALLPROPERTY_PACKAGENAMEA, NULL, NULL); ok(r == ERROR_INVALID_PARAMETER, "Expected ERROR_INVALID_PARAMETER, got %d\n", r); /* guid with brackets */ - r = pMsiSourceListGetInfoA("{51CD2AD5-0482-4C46-8DDD-0ED1022AA1AA}", usersid, MSIINSTALLCONTEXT_USERUNMANAGED, + r = MsiSourceListGetInfoA("{51CD2AD5-0482-4C46-8DDD-0ED1022AA1AA}", usersid, MSIINSTALLCONTEXT_USERUNMANAGED, MSICODE_PRODUCT, INSTALLPROPERTY_PACKAGENAMEA, NULL, NULL); ok(r == ERROR_UNKNOWN_PRODUCT, "Expected ERROR_UNKNOWN_PRODUCT, got %d\n", r); /* same length as guid, but random */ - r = pMsiSourceListGetInfoA("ADKD-2KSDFF2-DKK1KNFJASD9GLKWME-1I3KAD", usersid, MSIINSTALLCONTEXT_USERUNMANAGED, + r = MsiSourceListGetInfoA("ADKD-2KSDFF2-DKK1KNFJASD9GLKWME-1I3KAD", usersid, MSIINSTALLCONTEXT_USERUNMANAGED, MSICODE_PRODUCT, INSTALLPROPERTY_PACKAGENAMEA, NULL, NULL); ok(r == ERROR_INVALID_PARAMETER, "Expected ERROR_INVALID_PARAMETER, got %d\n", r); /* invalid context */ - r = pMsiSourceListGetInfoA(prodcode, usersid, MSIINSTALLCONTEXT_NONE, + r = MsiSourceListGetInfoA(prodcode, usersid, MSIINSTALLCONTEXT_NONE, MSICODE_PRODUCT, INSTALLPROPERTY_PACKAGENAMEA, NULL, NULL); ok(r == ERROR_INVALID_PARAMETER, "Expected ERROR_INVALID_PARAMETER, got %d\n", r); /* another invalid context */ - r = pMsiSourceListGetInfoA(prodcode, usersid, MSIINSTALLCONTEXT_ALLUSERMANAGED, + r = MsiSourceListGetInfoA(prodcode, usersid, MSIINSTALLCONTEXT_ALLUSERMANAGED, MSICODE_PRODUCT, INSTALLPROPERTY_PACKAGENAMEA, NULL, NULL); ok(r == ERROR_INVALID_PARAMETER, "Expected ERROR_INVALID_PARAMETER, got %d\n", r); /* yet another invalid context */ - r = pMsiSourceListGetInfoA(prodcode, usersid, MSIINSTALLCONTEXT_ALL, + r = MsiSourceListGetInfoA(prodcode, usersid, MSIINSTALLCONTEXT_ALL, MSICODE_PRODUCT, INSTALLPROPERTY_PACKAGENAMEA, NULL, NULL); ok(r == ERROR_INVALID_PARAMETER, "Expected ERROR_INVALID_PARAMETER, got %d\n", r); /* mix two valid contexts */ - r = pMsiSourceListGetInfoA(prodcode, usersid, MSIINSTALLCONTEXT_USERMANAGED | MSIINSTALLCONTEXT_USERUNMANAGED, + r = MsiSourceListGetInfoA(prodcode, usersid, MSIINSTALLCONTEXT_USERMANAGED | MSIINSTALLCONTEXT_USERUNMANAGED, MSICODE_PRODUCT, INSTALLPROPERTY_PACKAGENAMEA, NULL, NULL); ok(r == ERROR_INVALID_PARAMETER, "Expected ERROR_INVALID_PARAMETER, got %d\n", r); /* invalid option */ - r = pMsiSourceListGetInfoA(prodcode, usersid, MSIINSTALLCONTEXT_USERUNMANAGED, + r = MsiSourceListGetInfoA(prodcode, usersid, MSIINSTALLCONTEXT_USERUNMANAGED, 4, INSTALLPROPERTY_PACKAGENAMEA, NULL, NULL); ok(r == ERROR_UNKNOWN_PRODUCT, "Expected ERROR_UNKNOWN_PRODUCT, got %d\n", r); /* NULL property */ - r = pMsiSourceListGetInfoA(prodcode, usersid, MSIINSTALLCONTEXT_USERUNMANAGED, + r = MsiSourceListGetInfoA(prodcode, usersid, MSIINSTALLCONTEXT_USERUNMANAGED, MSICODE_PRODUCT, NULL, NULL, NULL); ok(r == ERROR_INVALID_PARAMETER, "Expected ERROR_INVALID_PARAMETER, got %d\n", r); /* empty property */ - r = pMsiSourceListGetInfoA(prodcode, usersid, MSIINSTALLCONTEXT_USERUNMANAGED, + r = MsiSourceListGetInfoA(prodcode, usersid, MSIINSTALLCONTEXT_USERUNMANAGED, MSICODE_PRODUCT, "", NULL, NULL); ok(r == ERROR_UNKNOWN_PRODUCT, "Expected ERROR_UNKNOWN_PRODUCT, got %d\n", r); /* value is non-NULL while size is NULL */ - r = pMsiSourceListGetInfoA(prodcode, usersid, MSIINSTALLCONTEXT_USERUNMANAGED, + r = MsiSourceListGetInfoA(prodcode, usersid, MSIINSTALLCONTEXT_USERUNMANAGED, MSICODE_PRODUCT, INSTALLPROPERTY_PACKAGENAMEA, value, NULL); ok(r == ERROR_INVALID_PARAMETER, "Expected ERROR_INVALID_PARAMETER, got %d\n", r); /* size is non-NULL while value is NULL */ size = MAX_PATH; - r = pMsiSourceListGetInfoA(prodcode, usersid, MSIINSTALLCONTEXT_USERUNMANAGED, + r = MsiSourceListGetInfoA(prodcode, usersid, MSIINSTALLCONTEXT_USERUNMANAGED, MSICODE_PRODUCT, INSTALLPROPERTY_PACKAGENAMEA, NULL, &size); ok(r == ERROR_UNKNOWN_PRODUCT || r == ERROR_INVALID_PARAMETER, "Expected ERROR_UNKNOWN_PRODUCT or ERROR_INVALID_PARAMETER, got %d\n", r); @@ -302,7 +249,7 @@ static void test_MsiSourceListGetInfo(void) /* user product key exists */ size = MAX_PATH; lstrcpyA(value, "aaa"); - r = pMsiSourceListGetInfoA(prodcode, usersid, MSIINSTALLCONTEXT_USERUNMANAGED, + r = MsiSourceListGetInfoA(prodcode, usersid, MSIINSTALLCONTEXT_USERUNMANAGED, MSICODE_PRODUCT, INSTALLPROPERTY_PACKAGENAMEA, value, &size); ok(r == ERROR_BAD_CONFIGURATION, "Expected ERROR_BAD_CONFIGURATION, got %d\n", r); ok(!lstrcmpA(value, "aaa"), "Expected \"aaa\", got \"%s\"\n", value); @@ -313,7 +260,7 @@ static void test_MsiSourceListGetInfo(void) /* SourceList key exists */ size = MAX_PATH; lstrcpyA(value, "aaa"); - r = pMsiSourceListGetInfoA(prodcode, usersid, MSIINSTALLCONTEXT_USERUNMANAGED, + r = MsiSourceListGetInfoA(prodcode, usersid, MSIINSTALLCONTEXT_USERUNMANAGED, MSICODE_PRODUCT, INSTALLPROPERTY_PACKAGENAMEA, value, &size); ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r); ok(size == 0, "Expected 0, got %lu\n", size); @@ -325,16 +272,16 @@ static void test_MsiSourceListGetInfo(void) /* PackageName value exists */ size = 0xdeadbeef; - r = pMsiSourceListGetInfoA(prodcode, usersid, MSIINSTALLCONTEXT_USERUNMANAGED, + r = MsiSourceListGetInfoA(prodcode, usersid, MSIINSTALLCONTEXT_USERUNMANAGED, MSICODE_PRODUCT, INSTALLPROPERTY_PACKAGENAMEA, NULL, &size); ok(r == ERROR_SUCCESS || r == ERROR_INVALID_PARAMETER, - "Expected ERROR_SUCCESS or ERROR_INVALID_PARAMETER, got %d\n", r); + "Expected ERROR_SUCCESS or ERROR_INVALID_PARAMETER, got %d\n", r); ok(size == 11 || r != ERROR_SUCCESS, "Expected 11, got %lu\n", size); /* read the value, don't change size */ - size = 11; + size = 11; lstrcpyA(value, "aaa"); - r = pMsiSourceListGetInfoA(prodcode, usersid, MSIINSTALLCONTEXT_USERUNMANAGED, + r = MsiSourceListGetInfoA(prodcode, usersid, MSIINSTALLCONTEXT_USERUNMANAGED, MSICODE_PRODUCT, INSTALLPROPERTY_PACKAGENAMEA, value, &size); ok(r == ERROR_MORE_DATA, "Expected ERROR_MORE_DATA, got %d\n", r); ok(!lstrcmpA(value, "aaa"), "Expected 'aaa', got %s\n", value); @@ -342,7 +289,7 @@ static void test_MsiSourceListGetInfo(void) /* read the value, fix size */ size++; - r = pMsiSourceListGetInfoA(prodcode, usersid, MSIINSTALLCONTEXT_USERUNMANAGED, + r = MsiSourceListGetInfoA(prodcode, usersid, MSIINSTALLCONTEXT_USERUNMANAGED, MSICODE_PRODUCT, INSTALLPROPERTY_PACKAGENAMEA, value, &size); ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r); ok(!lstrcmpA(value, "msitest.msi"), "Expected 'msitest.msi', got %s\n", value); @@ -351,7 +298,7 @@ static void test_MsiSourceListGetInfo(void) /* empty property now that product key exists */ size = MAX_PATH; lstrcpyA(value, "aaa"); - r = pMsiSourceListGetInfoA(prodcode, usersid, MSIINSTALLCONTEXT_USERUNMANAGED, + r = MsiSourceListGetInfoA(prodcode, usersid, MSIINSTALLCONTEXT_USERUNMANAGED, MSICODE_PRODUCT, "", value, &size); ok(r == ERROR_UNKNOWN_PROPERTY, "Expected ERROR_UNKNOWN_PROPERTY, got %d\n", r); ok(size == MAX_PATH, "Expected %d, got %lu\n", MAX_PATH, size); @@ -360,7 +307,7 @@ static void test_MsiSourceListGetInfo(void) /* nonexistent property now that product key exists */ size = MAX_PATH; lstrcpyA(value, "aaa"); - r = pMsiSourceListGetInfoA(prodcode, usersid, MSIINSTALLCONTEXT_USERUNMANAGED, + r = MsiSourceListGetInfoA(prodcode, usersid, MSIINSTALLCONTEXT_USERUNMANAGED, MSICODE_PRODUCT, "nonexistent", value, &size); ok(r == ERROR_UNKNOWN_PROPERTY, "Expected ERROR_UNKNOWN_PROPERTY, got %d\n", r); ok(size == MAX_PATH, "Expected %d, got %lu\n", MAX_PATH, size); @@ -373,7 +320,7 @@ static void test_MsiSourceListGetInfo(void) /* nonexistent property now that nonexistent value exists */ size = MAX_PATH; lstrcpyA(value, "aaa"); - r = pMsiSourceListGetInfoA(prodcode, usersid, MSIINSTALLCONTEXT_USERUNMANAGED, + r = MsiSourceListGetInfoA(prodcode, usersid, MSIINSTALLCONTEXT_USERUNMANAGED, MSICODE_PRODUCT, "nonexistent", value, &size); ok(r == ERROR_UNKNOWN_PROPERTY, "Expected ERROR_UNKNOWN_PROPERTY, got %d\n", r); ok(size == MAX_PATH, "Expected %d, got %lu\n", MAX_PATH, size); @@ -381,7 +328,7 @@ static void test_MsiSourceListGetInfo(void) /* invalid option now that product key exists */ size = MAX_PATH; - r = pMsiSourceListGetInfoA(prodcode, usersid, MSIINSTALLCONTEXT_USERUNMANAGED, + r = MsiSourceListGetInfoA(prodcode, usersid, MSIINSTALLCONTEXT_USERUNMANAGED, 4, INSTALLPROPERTY_PACKAGENAMEA, value, &size); ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r); ok(size == 11, "Expected 11, got %lu\n", size); @@ -389,9 +336,8 @@ static void test_MsiSourceListGetInfo(void) /* INSTALLPROPERTY_MEDIAPACKAGEPATH, media key does not exist */ size = MAX_PATH; lstrcpyA(value, "aaa"); - r = pMsiSourceListGetInfoA(prodcode, usersid, MSIINSTALLCONTEXT_USERUNMANAGED, - MSICODE_PRODUCT, INSTALLPROPERTY_MEDIAPACKAGEPATHA, - value, &size); + r = MsiSourceListGetInfoA(prodcode, usersid, MSIINSTALLCONTEXT_USERUNMANAGED, + MSICODE_PRODUCT, INSTALLPROPERTY_MEDIAPACKAGEPATHA, value, &size); ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r); ok(!lstrcmpA(value, ""), "Expected \"\", got \"%s\"\n", value); ok(size == 0, "Expected 0, got %lu\n", size); @@ -406,9 +352,8 @@ static void test_MsiSourceListGetInfo(void) /* INSTALLPROPERTY_MEDIAPACKAGEPATH */ size = MAX_PATH; - r = pMsiSourceListGetInfoA(prodcode, usersid, MSIINSTALLCONTEXT_USERUNMANAGED, - MSICODE_PRODUCT, INSTALLPROPERTY_MEDIAPACKAGEPATHA, - value, &size); + r = MsiSourceListGetInfoA(prodcode, usersid, MSIINSTALLCONTEXT_USERUNMANAGED, + MSICODE_PRODUCT, INSTALLPROPERTY_MEDIAPACKAGEPATHA, value, &size); ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r); ok(!lstrcmpA(value, "path"), "Expected \"path\", got \"%s\"\n", value); ok(size == 4, "Expected 4, got %lu\n", size); @@ -420,9 +365,8 @@ static void test_MsiSourceListGetInfo(void) ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %ld\n", res); size = MAX_PATH; - r = pMsiSourceListGetInfoA(prodcode, usersid, MSIINSTALLCONTEXT_USERUNMANAGED, - MSICODE_PRODUCT, INSTALLPROPERTY_DISKPROMPTA, - value, &size); + r = MsiSourceListGetInfoA(prodcode, usersid, MSIINSTALLCONTEXT_USERUNMANAGED, + MSICODE_PRODUCT, INSTALLPROPERTY_DISKPROMPTA, value, &size); ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r); ok(!lstrcmpA(value, "prompt"), "Expected \"prompt\", got \"%s\"\n", value); ok(size == 6, "Expected 6, got %lu\n", size); @@ -431,9 +375,8 @@ static void test_MsiSourceListGetInfo(void) RegDeleteValueA(hkey, "LastUsedSource"); size = MAX_PATH; memset(value, 0x55, sizeof(value)); - r = pMsiSourceListGetInfoA(prodcode, usersid, MSIINSTALLCONTEXT_USERUNMANAGED, - MSICODE_PRODUCT, INSTALLPROPERTY_LASTUSEDSOURCEA, - value, &size); + r = MsiSourceListGetInfoA(prodcode, usersid, MSIINSTALLCONTEXT_USERUNMANAGED, + MSICODE_PRODUCT, INSTALLPROPERTY_LASTUSEDSOURCEA, value, &size); ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r); ok(!lstrcmpA(value, ""), "Expected \"\", got \"%s\"\n", value); ok(size == 0, "Expected 0, got %lu\n", size); @@ -442,9 +385,8 @@ static void test_MsiSourceListGetInfo(void) usersidW = strdupAW(usersid); prodcodeW = strdupAW(prodcode); memset(valueW, 0x55, sizeof(valueW)); - r = pMsiSourceListGetInfoW(prodcodeW, usersidW, MSIINSTALLCONTEXT_USERUNMANAGED, - MSICODE_PRODUCT, INSTALLPROPERTY_LASTUSEDSOURCEW, - valueW, &size); + r = MsiSourceListGetInfoW(prodcodeW, usersidW, MSIINSTALLCONTEXT_USERUNMANAGED, + MSICODE_PRODUCT, INSTALLPROPERTY_LASTUSEDSOURCEW, valueW, &size); ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r); ok(!valueW[0], "Expected \"\""); ok(size == 0, "Expected 0, got %lu\n", size); @@ -458,9 +400,8 @@ static void test_MsiSourceListGetInfo(void) /* INSTALLPROPERTY_LASTUSEDSOURCE, source is empty */ size = MAX_PATH; - r = pMsiSourceListGetInfoA(prodcode, usersid, MSIINSTALLCONTEXT_USERUNMANAGED, - MSICODE_PRODUCT, INSTALLPROPERTY_LASTUSEDSOURCEA, - value, &size); + r = MsiSourceListGetInfoA(prodcode, usersid, MSIINSTALLCONTEXT_USERUNMANAGED, + MSICODE_PRODUCT, INSTALLPROPERTY_LASTUSEDSOURCEA, value, &size); ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r); ok(!lstrcmpA(value, ""), "Expected \"\", got \"%s\"\n", value); ok(size == 0, "Expected 0, got %lu\n", size); @@ -472,9 +413,8 @@ static void test_MsiSourceListGetInfo(void) /* INSTALLPROPERTY_LASTUSEDSOURCE */ size = MAX_PATH; - r = pMsiSourceListGetInfoA(prodcode, usersid, MSIINSTALLCONTEXT_USERUNMANAGED, - MSICODE_PRODUCT, INSTALLPROPERTY_LASTUSEDSOURCEA, - value, &size); + r = MsiSourceListGetInfoA(prodcode, usersid, MSIINSTALLCONTEXT_USERUNMANAGED, + MSICODE_PRODUCT, INSTALLPROPERTY_LASTUSEDSOURCEA, value, &size); ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r); ok(!lstrcmpA(value, "source"), "Expected \"source\", got \"%s\"\n", value); ok(size == 6, "Expected 6, got %lu\n", size); @@ -482,9 +422,8 @@ static void test_MsiSourceListGetInfo(void) /* INSTALLPROPERTY_LASTUSEDSOURCE, size is too short */ size = 4; lstrcpyA(value, "aaa"); - r = pMsiSourceListGetInfoA(prodcode, usersid, MSIINSTALLCONTEXT_USERUNMANAGED, - MSICODE_PRODUCT, INSTALLPROPERTY_LASTUSEDSOURCEA, - value, &size); + r = MsiSourceListGetInfoA(prodcode, usersid, MSIINSTALLCONTEXT_USERUNMANAGED, + MSICODE_PRODUCT, INSTALLPROPERTY_LASTUSEDSOURCEA, value, &size); ok(r == ERROR_MORE_DATA, "Expected ERROR_MORE_DATA, got %d\n", r); ok(!lstrcmpA(value, "aaa"), "Expected value to be unchanged, got \"%s\"\n", value); ok(size == 6, "Expected 6, got %lu\n", size); @@ -492,116 +431,100 @@ static void test_MsiSourceListGetInfo(void) /* INSTALLPROPERTY_LASTUSEDSOURCE, size is exactly 6 */ size = 6; lstrcpyA(value, "aaa"); - r = pMsiSourceListGetInfoA(prodcode, usersid, MSIINSTALLCONTEXT_USERUNMANAGED, - MSICODE_PRODUCT, INSTALLPROPERTY_LASTUSEDSOURCEA, - value, &size); + r = MsiSourceListGetInfoA(prodcode, usersid, MSIINSTALLCONTEXT_USERUNMANAGED, + MSICODE_PRODUCT, INSTALLPROPERTY_LASTUSEDSOURCEA, value, &size); ok(r == ERROR_MORE_DATA, "Expected ERROR_MORE_DATA, got %d\n", r); ok(!lstrcmpA(value, "aaa"), "Expected value to be unchanged, got \"%s\"\n", value); ok(size == 6, "Expected 6, got %lu\n", size); data = "a;source"; - res = RegSetValueExA(hkey, "LastUsedSource", 0, REG_SZ, - (const BYTE *)data, lstrlenA(data) + 1); + res = RegSetValueExA(hkey, "LastUsedSource", 0, REG_SZ, (const BYTE *)data, lstrlenA(data) + 1); ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %ld\n", res); /* INSTALLPROPERTY_LASTUSEDSOURCE, one semi-colon */ size = MAX_PATH; - r = pMsiSourceListGetInfoA(prodcode, usersid, MSIINSTALLCONTEXT_USERUNMANAGED, - MSICODE_PRODUCT, INSTALLPROPERTY_LASTUSEDSOURCEA, - value, &size); + r = MsiSourceListGetInfoA(prodcode, usersid, MSIINSTALLCONTEXT_USERUNMANAGED, + MSICODE_PRODUCT, INSTALLPROPERTY_LASTUSEDSOURCEA, value, &size); ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r); ok(!lstrcmpA(value, "source"), "Expected \"source\", got \"%s\"\n", value); ok(size == 6, "Expected 6, got %lu\n", size); data = "a:source"; - res = RegSetValueExA(hkey, "LastUsedSource", 0, REG_SZ, - (const BYTE *)data, lstrlenA(data) + 1); + res = RegSetValueExA(hkey, "LastUsedSource", 0, REG_SZ, (const BYTE *)data, lstrlenA(data) + 1); ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %ld\n", res); /* INSTALLPROPERTY_LASTUSEDSOURCE, one colon */ size = MAX_PATH; - r = pMsiSourceListGetInfoA(prodcode, usersid, MSIINSTALLCONTEXT_USERUNMANAGED, - MSICODE_PRODUCT, INSTALLPROPERTY_LASTUSEDSOURCEA, - value, &size); + r = MsiSourceListGetInfoA(prodcode, usersid, MSIINSTALLCONTEXT_USERUNMANAGED, + MSICODE_PRODUCT, INSTALLPROPERTY_LASTUSEDSOURCEA, value, &size); ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r); ok(!lstrcmpA(value, "a:source"), "Expected \"a:source\", got \"%s\"\n", value); ok(size == 8, "Expected 8, got %lu\n", size); /* INSTALLPROPERTY_LASTUSEDTYPE, invalid source format */ size = MAX_PATH; - r = pMsiSourceListGetInfoA(prodcode, usersid, MSIINSTALLCONTEXT_USERUNMANAGED, - MSICODE_PRODUCT, INSTALLPROPERTY_LASTUSEDTYPEA, - value, &size); + r = MsiSourceListGetInfoA(prodcode, usersid, MSIINSTALLCONTEXT_USERUNMANAGED, + MSICODE_PRODUCT, INSTALLPROPERTY_LASTUSEDTYPEA, value, &size); ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r); ok(!lstrcmpA(value, ""), "Expected \"\", got \"%s\"\n", value); ok(size == 0, "Expected 0, got %lu\n", size); data = "x;y;z"; - res = RegSetValueExA(hkey, "LastUsedSource", 0, REG_SZ, - (const BYTE *)data, lstrlenA(data) + 1); + res = RegSetValueExA(hkey, "LastUsedSource", 0, REG_SZ, (const BYTE *)data, lstrlenA(data) + 1); ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %ld\n", res); /* INSTALLPROPERTY_LASTUSEDTYPE, invalid source format */ size = MAX_PATH; - r = pMsiSourceListGetInfoA(prodcode, usersid, MSIINSTALLCONTEXT_USERUNMANAGED, - MSICODE_PRODUCT, INSTALLPROPERTY_LASTUSEDTYPEA, - value, &size); + r = MsiSourceListGetInfoA(prodcode, usersid, MSIINSTALLCONTEXT_USERUNMANAGED, + MSICODE_PRODUCT, INSTALLPROPERTY_LASTUSEDTYPEA, value, &size); ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r); ok(!lstrcmpA(value, ""), "Expected \"\", got \"%s\"\n", value); ok(size == 0, "Expected 0, got %lu\n", size); data = "n;y;z"; - res = RegSetValueExA(hkey, "LastUsedSource", 0, REG_SZ, - (const BYTE *)data, lstrlenA(data) + 1); + res = RegSetValueExA(hkey, "LastUsedSource", 0, REG_SZ, (const BYTE *)data, lstrlenA(data) + 1); ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %ld\n", res); /* INSTALLPROPERTY_LASTUSEDTYPE */ size = MAX_PATH; - r = pMsiSourceListGetInfoA(prodcode, usersid, MSIINSTALLCONTEXT_USERUNMANAGED, - MSICODE_PRODUCT, INSTALLPROPERTY_LASTUSEDTYPEA, - value, &size); + r = MsiSourceListGetInfoA(prodcode, usersid, MSIINSTALLCONTEXT_USERUNMANAGED, + MSICODE_PRODUCT, INSTALLPROPERTY_LASTUSEDTYPEA, value, &size); ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r); ok(!lstrcmpA(value, "n"), "Expected \"n\", got \"%s\"\n", value); ok(size == 1, "Expected 1, got %lu\n", size); data = "negatory"; - res = RegSetValueExA(hkey, "LastUsedSource", 0, REG_SZ, - (const BYTE *)data, lstrlenA(data) + 1); + res = RegSetValueExA(hkey, "LastUsedSource", 0, REG_SZ, (const BYTE *)data, lstrlenA(data) + 1); ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %ld\n", res); /* INSTALLPROPERTY_LASTUSEDTYPE */ size = MAX_PATH; - r = pMsiSourceListGetInfoA(prodcode, usersid, MSIINSTALLCONTEXT_USERUNMANAGED, - MSICODE_PRODUCT, INSTALLPROPERTY_LASTUSEDTYPEA, - value, &size); + r = MsiSourceListGetInfoA(prodcode, usersid, MSIINSTALLCONTEXT_USERUNMANAGED, + MSICODE_PRODUCT, INSTALLPROPERTY_LASTUSEDTYPEA, value, &size); ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r); ok(!lstrcmpA(value, "n"), "Expected \"n\", got \"%s\"\n", value); ok(size == 1, "Expected 1, got %lu\n", size); data = "megatron"; - res = RegSetValueExA(hkey, "LastUsedSource", 0, REG_SZ, - (const BYTE *)data, lstrlenA(data) + 1); + res = RegSetValueExA(hkey, "LastUsedSource", 0, REG_SZ, (const BYTE *)data, lstrlenA(data) + 1); ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %ld\n", res); /* INSTALLPROPERTY_LASTUSEDTYPE */ size = MAX_PATH; - r = pMsiSourceListGetInfoA(prodcode, usersid, MSIINSTALLCONTEXT_USERUNMANAGED, - MSICODE_PRODUCT, INSTALLPROPERTY_LASTUSEDTYPEA, - value, &size); + r = MsiSourceListGetInfoA(prodcode, usersid, MSIINSTALLCONTEXT_USERUNMANAGED, + MSICODE_PRODUCT, INSTALLPROPERTY_LASTUSEDTYPEA, value, &size); ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r); ok(!lstrcmpA(value, "m"), "Expected \"m\", got \"%s\"\n", value); ok(size == 1, "Expected 1, got %lu\n", size); data = "useless"; - res = RegSetValueExA(hkey, "LastUsedSource", 0, REG_SZ, - (const BYTE *)data, lstrlenA(data) + 1); + res = RegSetValueExA(hkey, "LastUsedSource", 0, REG_SZ, (const BYTE *)data, lstrlenA(data) + 1); ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %ld\n", res); /* INSTALLPROPERTY_LASTUSEDTYPE */ size = MAX_PATH; - r = pMsiSourceListGetInfoA(prodcode, usersid, MSIINSTALLCONTEXT_USERUNMANAGED, - MSICODE_PRODUCT, INSTALLPROPERTY_LASTUSEDTYPEA, - value, &size); + r = MsiSourceListGetInfoA(prodcode, usersid, MSIINSTALLCONTEXT_USERUNMANAGED, + MSICODE_PRODUCT, INSTALLPROPERTY_LASTUSEDTYPEA, value, &size); ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r); ok(!lstrcmpA(value, "u"), "Expected \"u\", got \"%s\"\n", value); ok(size == 1, "Expected 1, got %lu\n", size); @@ -620,7 +543,7 @@ static void test_MsiSourceListGetInfo(void) /* try a patch */ size = MAX_PATH; lstrcpyA(value, "aaa"); - r = pMsiSourceListGetInfoA(prodcode, usersid, MSIINSTALLCONTEXT_USERUNMANAGED, + r = MsiSourceListGetInfoA(prodcode, usersid, MSIINSTALLCONTEXT_USERUNMANAGED, MSICODE_PATCH, INSTALLPROPERTY_PACKAGENAMEA, value, &size); ok(r == ERROR_UNKNOWN_PATCH, "Expected ERROR_UNKNOWN_PATCH, got %d\n", r); ok(size == MAX_PATH, "Expected %d, got %lu\n", MAX_PATH, size); @@ -637,7 +560,7 @@ static void test_MsiSourceListGetInfo(void) */ size = MAX_PATH; lstrcpyA(value, "aaa"); - r = pMsiSourceListGetInfoA(prodcode, usersid, MSIINSTALLCONTEXT_USERUNMANAGED, + r = MsiSourceListGetInfoA(prodcode, usersid, MSIINSTALLCONTEXT_USERUNMANAGED, MSICODE_PATCH, INSTALLPROPERTY_PACKAGENAMEA, value, &size); ok(r == ERROR_BAD_CONFIGURATION, "Expected ERROR_BAD_CONFIGURATION, got %d\n", r); ok(size == MAX_PATH, "Expected %d, got %lu\n", MAX_PATH, size); @@ -649,7 +572,7 @@ static void test_MsiSourceListGetInfo(void) /* SourceList key exists */ size = MAX_PATH; lstrcpyA(value, "aaa"); - r = pMsiSourceListGetInfoA(prodcode, usersid, MSIINSTALLCONTEXT_USERUNMANAGED, + r = MsiSourceListGetInfoA(prodcode, usersid, MSIINSTALLCONTEXT_USERUNMANAGED, MSICODE_PATCH, INSTALLPROPERTY_PACKAGENAMEA, value, &size); ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r); ok(!lstrcmpA(value, ""), "Expected \"\", got \"%s\"\n", value); @@ -662,13 +585,6 @@ static void test_MsiSourceListGetInfo(void) LocalFree(usersid); } -static LONG delete_key( HKEY key, LPCSTR subkey, REGSAM access ) -{ - if (pRegDeleteKeyExA) - return pRegDeleteKeyExA( key, subkey, access, 0 ); - return RegDeleteKeyA( key, subkey ); -} - static void test_MsiSourceListAddSourceEx(void) { CHAR prodcode[MAX_PATH]; @@ -682,12 +598,7 @@ static void test_MsiSourceListAddSourceEx(void) DWORD size; REGSAM access = KEY_ALL_ACCESS; - if (!pMsiSourceListAddSourceExA) - { - win_skip("Skipping MsiSourceListAddSourceExA tests\n"); - return; - } - if (is_process_limited()) + if (!is_process_elevated()) { skip("process is limited\n"); return; @@ -706,36 +617,35 @@ static void test_MsiSourceListAddSourceEx(void) /* GetLastError is not set by the function */ /* NULL szProductCodeOrPatchCode */ - r = pMsiSourceListAddSourceExA(NULL, usersid, MSIINSTALLCONTEXT_USERUNMANAGED, + r = MsiSourceListAddSourceExA(NULL, usersid, MSIINSTALLCONTEXT_USERUNMANAGED, MSICODE_PRODUCT | MSISOURCETYPE_URL, "C:\\source", 0); ok(r == ERROR_INVALID_PARAMETER, "Expected ERROR_INVALID_PARAMETER, got %d\n", r); /* empty szProductCodeOrPatchCode */ - r = pMsiSourceListAddSourceExA("", usersid, MSIINSTALLCONTEXT_USERUNMANAGED, + r = MsiSourceListAddSourceExA("", usersid, MSIINSTALLCONTEXT_USERUNMANAGED, MSICODE_PRODUCT | MSISOURCETYPE_URL, "C:\\source", 0); ok(r == ERROR_INVALID_PARAMETER, "Expected ERROR_INVALID_PARAMETER, got %d\n", r); /* garbage szProductCodeOrPatchCode */ - r = pMsiSourceListAddSourceExA("garbage", usersid, MSIINSTALLCONTEXT_USERUNMANAGED, + r = MsiSourceListAddSourceExA("garbage", usersid, MSIINSTALLCONTEXT_USERUNMANAGED, MSICODE_PRODUCT | MSISOURCETYPE_URL, "C:\\source", 0); ok(r == ERROR_INVALID_PARAMETER, "Expected ERROR_INVALID_PARAMETER, got %d\n", r); /* guid without brackets */ - r = pMsiSourceListAddSourceExA("51CD2AD5-0482-4C46-8DDD-0ED1022AA1AA", usersid, + r = MsiSourceListAddSourceExA("51CD2AD5-0482-4C46-8DDD-0ED1022AA1AA", usersid, MSIINSTALLCONTEXT_USERUNMANAGED, MSICODE_PRODUCT | MSISOURCETYPE_URL, "C:\\source", 0); ok(r == ERROR_INVALID_PARAMETER, "Expected ERROR_INVALID_PARAMETER, got %d\n", r); /* guid with brackets */ - r = pMsiSourceListAddSourceExA("{51CD2AD5-0482-4C46-8DDD-0ED1022AA1AA}", usersid, + r = MsiSourceListAddSourceExA("{51CD2AD5-0482-4C46-8DDD-0ED1022AA1AA}", usersid, MSIINSTALLCONTEXT_USERUNMANAGED, MSICODE_PRODUCT | MSISOURCETYPE_URL, "C:\\source", 0); ok(r == ERROR_UNKNOWN_PRODUCT, "Expected ERROR_UNKNOWN_PRODUCT, got %d\n", r); /* MSIINSTALLCONTEXT_USERUNMANAGED */ - r = pMsiSourceListAddSourceExA(prodcode, usersid, - MSIINSTALLCONTEXT_USERUNMANAGED, + r = MsiSourceListAddSourceExA(prodcode, usersid, MSIINSTALLCONTEXT_USERUNMANAGED, MSICODE_PRODUCT | MSISOURCETYPE_URL, "C:\\source", 0); ok(r == ERROR_UNKNOWN_PRODUCT, "Expected ERROR_UNKNOWN_PRODUCT, got %d\n", r); @@ -746,8 +656,7 @@ static void test_MsiSourceListAddSourceEx(void) ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %ld\n", res); /* user product key exists */ - r = pMsiSourceListAddSourceExA(prodcode, usersid, - MSIINSTALLCONTEXT_USERUNMANAGED, + r = MsiSourceListAddSourceExA(prodcode, usersid, MSIINSTALLCONTEXT_USERUNMANAGED, MSICODE_PRODUCT | MSISOURCETYPE_URL, "C:\\source", 0); ok(r == ERROR_BAD_CONFIGURATION, "Expected ERROR_BAD_CONFIGURATION, got %d\n", r); @@ -756,8 +665,7 @@ static void test_MsiSourceListAddSourceEx(void) RegCloseKey(url); /* SourceList key exists */ - r = pMsiSourceListAddSourceExA(prodcode, usersid, - MSIINSTALLCONTEXT_USERUNMANAGED, + r = MsiSourceListAddSourceExA(prodcode, usersid, MSIINSTALLCONTEXT_USERUNMANAGED, MSICODE_PRODUCT | MSISOURCETYPE_URL, "C:\\source", 0); ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r); @@ -771,8 +679,7 @@ static void test_MsiSourceListAddSourceEx(void) ok(size == 11, "Expected 11, got %lu\n", size); /* add another source, index 0 */ - r = pMsiSourceListAddSourceExA(prodcode, usersid, - MSIINSTALLCONTEXT_USERUNMANAGED, + r = MsiSourceListAddSourceExA(prodcode, usersid, MSIINSTALLCONTEXT_USERUNMANAGED, MSICODE_PRODUCT | MSISOURCETYPE_URL, "another", 0); ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r); @@ -789,8 +696,7 @@ static void test_MsiSourceListAddSourceEx(void) ok(size == 9, "Expected 9, got %lu\n", size); /* add another source, index 1 */ - r = pMsiSourceListAddSourceExA(prodcode, usersid, - MSIINSTALLCONTEXT_USERUNMANAGED, + r = MsiSourceListAddSourceExA(prodcode, usersid, MSIINSTALLCONTEXT_USERUNMANAGED, MSICODE_PRODUCT | MSISOURCETYPE_URL, "third/", 1); ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r); @@ -813,8 +719,7 @@ static void test_MsiSourceListAddSourceEx(void) ok(size == 9, "Expected 9, got %lu\n", size); /* add another source, index > N */ - r = pMsiSourceListAddSourceExA(prodcode, usersid, - MSIINSTALLCONTEXT_USERUNMANAGED, + r = MsiSourceListAddSourceExA(prodcode, usersid, MSIINSTALLCONTEXT_USERUNMANAGED, MSICODE_PRODUCT | MSISOURCETYPE_URL, "last/", 5); ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r); @@ -843,8 +748,7 @@ static void test_MsiSourceListAddSourceEx(void) ok(size == 6, "Expected 6, got %lu\n", size); /* just MSISOURCETYPE_NETWORK */ - r = pMsiSourceListAddSourceExA(prodcode, usersid, - MSIINSTALLCONTEXT_USERUNMANAGED, + r = MsiSourceListAddSourceExA(prodcode, usersid, MSIINSTALLCONTEXT_USERUNMANAGED, MSISOURCETYPE_NETWORK, "source", 0); ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r); @@ -858,8 +762,7 @@ static void test_MsiSourceListAddSourceEx(void) ok(size == 8, "Expected 8, got %lu\n", size); /* just MSISOURCETYPE_URL */ - r = pMsiSourceListAddSourceExA(prodcode, usersid, - MSIINSTALLCONTEXT_USERUNMANAGED, + r = MsiSourceListAddSourceExA(prodcode, usersid, MSIINSTALLCONTEXT_USERUNMANAGED, MSISOURCETYPE_URL, "source", 0); ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r); @@ -894,8 +797,7 @@ static void test_MsiSourceListAddSourceEx(void) ok(size == 8, "Expected 8, got %lu\n", size); /* NULL szUserSid */ - r = pMsiSourceListAddSourceExA(prodcode, NULL, - MSIINSTALLCONTEXT_USERUNMANAGED, + r = MsiSourceListAddSourceExA(prodcode, NULL, MSIINSTALLCONTEXT_USERUNMANAGED, MSISOURCETYPE_NETWORK, "nousersid", 0); ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r); @@ -912,32 +814,27 @@ static void test_MsiSourceListAddSourceEx(void) ok(size == 11, "Expected 11, got %lu\n", size); /* invalid options, must have source type */ - r = pMsiSourceListAddSourceExA(prodcode, usersid, - MSIINSTALLCONTEXT_USERUNMANAGED, + r = MsiSourceListAddSourceExA(prodcode, usersid, MSIINSTALLCONTEXT_USERUNMANAGED, MSICODE_PRODUCT, "source", 0); ok(r == ERROR_INVALID_PARAMETER, "Expected ERROR_INVALID_PARAMETER, got %d\n", r); - r = pMsiSourceListAddSourceExA(prodcode, usersid, - MSIINSTALLCONTEXT_USERUNMANAGED, + r = MsiSourceListAddSourceExA(prodcode, usersid, MSIINSTALLCONTEXT_USERUNMANAGED, MSICODE_PATCH, "source", 0); ok(r == ERROR_INVALID_PARAMETER, "Expected ERROR_INVALID_PARAMETER, got %d\n", r); /* NULL szSource */ - r = pMsiSourceListAddSourceExA(prodcode, usersid, - MSIINSTALLCONTEXT_USERUNMANAGED, + r = MsiSourceListAddSourceExA(prodcode, usersid, MSIINSTALLCONTEXT_USERUNMANAGED, MSISOURCETYPE_URL, NULL, 1); ok(r == ERROR_INVALID_PARAMETER, "Expected ERROR_INVALID_PARAMETER, got %d\n", r); /* empty szSource */ - r = pMsiSourceListAddSourceExA(prodcode, usersid, - MSIINSTALLCONTEXT_USERUNMANAGED, + r = MsiSourceListAddSourceExA(prodcode, usersid, MSIINSTALLCONTEXT_USERUNMANAGED, MSISOURCETYPE_URL, "", 1); ok(r == ERROR_INVALID_PARAMETER, "Expected ERROR_INVALID_PARAMETER, got %d\n", r); /* MSIINSTALLCONTEXT_USERMANAGED, non-NULL szUserSid */ - r = pMsiSourceListAddSourceExA(prodcode, usersid, - MSIINSTALLCONTEXT_USERMANAGED, + r = MsiSourceListAddSourceExA(prodcode, usersid, MSIINSTALLCONTEXT_USERMANAGED, MSICODE_PRODUCT | MSISOURCETYPE_URL, "C:\\source", 0); ok(r == ERROR_UNKNOWN_PRODUCT, "Expected ERROR_UNKNOWN_PRODUCT, got %d\n", r); @@ -954,8 +851,7 @@ static void test_MsiSourceListAddSourceEx(void) } /* product key exists */ - r = pMsiSourceListAddSourceExA(prodcode, usersid, - MSIINSTALLCONTEXT_USERMANAGED, + r = MsiSourceListAddSourceExA(prodcode, usersid, MSIINSTALLCONTEXT_USERMANAGED, MSICODE_PRODUCT | MSISOURCETYPE_URL, "C:\\source", 0); ok(r == ERROR_BAD_CONFIGURATION, "Expected ERROR_BAD_CONFIGURATION, got %d\n", r); @@ -964,8 +860,7 @@ static void test_MsiSourceListAddSourceEx(void) RegCloseKey(hkey); /* SourceList exists */ - r = pMsiSourceListAddSourceExA(prodcode, usersid, - MSIINSTALLCONTEXT_USERMANAGED, + r = MsiSourceListAddSourceExA(prodcode, usersid, MSIINSTALLCONTEXT_USERMANAGED, MSICODE_PRODUCT | MSISOURCETYPE_URL, "C:\\source", 0); ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r); @@ -982,8 +877,7 @@ static void test_MsiSourceListAddSourceEx(void) /* MSIINSTALLCONTEXT_USERMANAGED, NULL szUserSid */ - r = pMsiSourceListAddSourceExA(prodcode, NULL, - MSIINSTALLCONTEXT_USERMANAGED, + r = MsiSourceListAddSourceExA(prodcode, NULL, MSIINSTALLCONTEXT_USERMANAGED, MSICODE_PRODUCT | MSISOURCETYPE_URL, "another", 0); ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r); @@ -1009,13 +903,11 @@ static void test_MsiSourceListAddSourceEx(void) machine_tests: /* szUserSid must be NULL for MSIINSTALLCONTEXT_MACHINE */ - r = pMsiSourceListAddSourceExA(prodcode, usersid, - MSIINSTALLCONTEXT_MACHINE, + r = MsiSourceListAddSourceExA(prodcode, usersid, MSIINSTALLCONTEXT_MACHINE, MSICODE_PRODUCT | MSISOURCETYPE_URL, "C:\\source", 0); ok(r == ERROR_INVALID_PARAMETER, "Expected ERROR_INVALID_PARAMETER, got %d\n", r); - r = pMsiSourceListAddSourceExA(prodcode, NULL, - MSIINSTALLCONTEXT_MACHINE, + r = MsiSourceListAddSourceExA(prodcode, NULL, MSIINSTALLCONTEXT_MACHINE, MSICODE_PRODUCT | MSISOURCETYPE_URL, "C:\\source", 0); ok(r == ERROR_UNKNOWN_PRODUCT, "Expected ERROR_UNKNOWN_PRODUCT, got %d\n", r); @@ -1031,8 +923,7 @@ static void test_MsiSourceListAddSourceEx(void) } /* product key exists */ - r = pMsiSourceListAddSourceExA(prodcode, NULL, - MSIINSTALLCONTEXT_MACHINE, + r = MsiSourceListAddSourceExA(prodcode, NULL, MSIINSTALLCONTEXT_MACHINE, MSICODE_PRODUCT | MSISOURCETYPE_URL, "C:\\source", 0); ok(r == ERROR_BAD_CONFIGURATION, "Expected ERROR_BAD_CONFIGURATION, got %d\n", r); @@ -1041,8 +932,7 @@ static void test_MsiSourceListAddSourceEx(void) RegCloseKey(hkey); /* SourceList exists */ - r = pMsiSourceListAddSourceExA(prodcode, NULL, - MSIINSTALLCONTEXT_MACHINE, + r = MsiSourceListAddSourceExA(prodcode, NULL, MSIINSTALLCONTEXT_MACHINE, MSICODE_PRODUCT | MSISOURCETYPE_URL, "C:\\source", 0); if (r == ERROR_ACCESS_DENIED) skip("MsiSourceListAddSourceEx (insufficient privileges)\n"); @@ -1079,12 +969,6 @@ static void test_MsiSourceListEnumSources(void) DWORD size; REGSAM access = KEY_ALL_ACCESS; - if (!pMsiSourceListEnumSourcesA) - { - win_skip("MsiSourceListEnumSourcesA is not available\n"); - return; - } - create_test_guid(prodcode, prod_squashed); if (!(usersid = get_user_sid())) { @@ -1099,38 +983,38 @@ static void test_MsiSourceListEnumSources(void) /* NULL szProductCodeOrPatchCode */ size = 0xdeadbeef; - r = pMsiSourceListEnumSourcesA(NULL, usersid, MSIINSTALLCONTEXT_USERUNMANAGED, - MSICODE_PRODUCT | MSISOURCETYPE_NETWORK, 0, value, &size); + r = MsiSourceListEnumSourcesA(NULL, usersid, MSIINSTALLCONTEXT_USERUNMANAGED, + MSICODE_PRODUCT | MSISOURCETYPE_NETWORK, 0, value, &size); ok(r == ERROR_INVALID_PARAMETER, "Expected ERROR_INVALID_PARAMETER, got %d\n", r); ok(size == 0xdeadbeef, "Expected 0xdeadbeef, got %lu\n", size); /* empty szProductCodeOrPatchCode */ size = 0xdeadbeef; - r = pMsiSourceListEnumSourcesA("", usersid, MSIINSTALLCONTEXT_USERUNMANAGED, - MSICODE_PRODUCT | MSISOURCETYPE_NETWORK, 0, value, &size); + r = MsiSourceListEnumSourcesA("", usersid, MSIINSTALLCONTEXT_USERUNMANAGED, + MSICODE_PRODUCT | MSISOURCETYPE_NETWORK, 0, value, &size); ok(r == ERROR_INVALID_PARAMETER, "Expected ERROR_INVALID_PARAMETER, got %d\n", r); ok(size == 0xdeadbeef, "Expected 0xdeadbeef, got %lu\n", size); /* garbage szProductCodeOrPatchCode */ size = 0xdeadbeef; - r = pMsiSourceListEnumSourcesA("garbage", usersid, MSIINSTALLCONTEXT_USERUNMANAGED, - MSICODE_PRODUCT | MSISOURCETYPE_NETWORK, 0, value, &size); + r = MsiSourceListEnumSourcesA("garbage", usersid, MSIINSTALLCONTEXT_USERUNMANAGED, + MSICODE_PRODUCT | MSISOURCETYPE_NETWORK, 0, value, &size); ok(r == ERROR_INVALID_PARAMETER, "Expected ERROR_INVALID_PARAMETER, got %d\n", r); ok(size == 0xdeadbeef, "Expected 0xdeadbeef, got %lu\n", size); /* guid without brackets */ size = 0xdeadbeef; - r = pMsiSourceListEnumSourcesA("51CD2AD5-0482-4C46-8DDD-0ED1022AA1AA", - usersid, MSIINSTALLCONTEXT_USERUNMANAGED, - MSICODE_PRODUCT | MSISOURCETYPE_NETWORK, 0, value, &size); + r = MsiSourceListEnumSourcesA("51CD2AD5-0482-4C46-8DDD-0ED1022AA1AA", + usersid, MSIINSTALLCONTEXT_USERUNMANAGED, + MSICODE_PRODUCT | MSISOURCETYPE_NETWORK, 0, value, &size); ok(r == ERROR_INVALID_PARAMETER, "Expected ERROR_INVALID_PARAMETER, got %d\n", r); ok(size == 0xdeadbeef, "Expected 0xdeadbeef, got %lu\n", size); /* guid with brackets */ size = 0xdeadbeef; - r = pMsiSourceListEnumSourcesA("{51CD2AD5-0482-4C46-8DDD-0ED1022AA1AA}", - usersid, MSIINSTALLCONTEXT_USERUNMANAGED, - MSICODE_PRODUCT | MSISOURCETYPE_NETWORK, 0, value, &size); + r = MsiSourceListEnumSourcesA("{51CD2AD5-0482-4C46-8DDD-0ED1022AA1AA}", + usersid, MSIINSTALLCONTEXT_USERUNMANAGED, + MSICODE_PRODUCT | MSISOURCETYPE_NETWORK, 0, value, &size); ok(r == ERROR_UNKNOWN_PRODUCT, "Expected ERROR_UNKNOWN_PRODUCT, got %d\n", r); ok(size == 0xdeadbeef, "Expected 0xdeadbeef, got %lu\n", size); @@ -1138,9 +1022,8 @@ static void test_MsiSourceListEnumSources(void) size = MAX_PATH; lstrcpyA(value, "aaa"); - r = pMsiSourceListEnumSourcesA(prodcode, usersid, - MSIINSTALLCONTEXT_USERUNMANAGED, - MSICODE_PRODUCT | MSISOURCETYPE_URL, 0, value, &size); + r = MsiSourceListEnumSourcesA(prodcode, usersid, MSIINSTALLCONTEXT_USERUNMANAGED, + MSICODE_PRODUCT | MSISOURCETYPE_URL, 0, value, &size); ok(r == ERROR_UNKNOWN_PRODUCT, "Expected ERROR_UNKNOWN_PRODUCT, got %d\n", r); ok(!lstrcmpA(value, "aaa"), "Expected value to be unchanged, got %s\n", value); ok(size == MAX_PATH, "Expected MAX_PATH, got %lu\n", size); @@ -1154,9 +1037,8 @@ static void test_MsiSourceListEnumSources(void) /* user product key exists */ size = MAX_PATH; lstrcpyA(value, "aaa"); - r = pMsiSourceListEnumSourcesA(prodcode, usersid, - MSIINSTALLCONTEXT_USERUNMANAGED, - MSICODE_PRODUCT | MSISOURCETYPE_URL, 0, value, &size); + r = MsiSourceListEnumSourcesA(prodcode, usersid, MSIINSTALLCONTEXT_USERUNMANAGED, + MSICODE_PRODUCT | MSISOURCETYPE_URL, 0, value, &size); ok(r == ERROR_BAD_CONFIGURATION, "Expected ERROR_BAD_CONFIGURATION, got %d\n", r); ok(!lstrcmpA(value, "aaa"), "Expected value to be unchanged, got %s\n", value); ok(size == MAX_PATH, "Expected MAX_PATH, got %lu\n", size); @@ -1167,9 +1049,8 @@ static void test_MsiSourceListEnumSources(void) /* SourceList key exists */ size = MAX_PATH; lstrcpyA(value, "aaa"); - r = pMsiSourceListEnumSourcesA(prodcode, usersid, - MSIINSTALLCONTEXT_USERUNMANAGED, - MSICODE_PRODUCT | MSISOURCETYPE_URL, 0, value, &size); + r = MsiSourceListEnumSourcesA(prodcode, usersid, MSIINSTALLCONTEXT_USERUNMANAGED, + MSICODE_PRODUCT | MSISOURCETYPE_URL, 0, value, &size); ok(r == ERROR_NO_MORE_ITEMS, "Expected ERROR_NO_MORE_ITEMS, got %d\n", r); ok(!lstrcmpA(value, "aaa"), "Expected value to be unchanged, got %s\n", value); ok(size == MAX_PATH, "Expected MAX_PATH, got %lu\n", size); @@ -1180,9 +1061,8 @@ static void test_MsiSourceListEnumSources(void) /* URL key exists */ size = MAX_PATH; lstrcpyA(value, "aaa"); - r = pMsiSourceListEnumSourcesA(prodcode, usersid, - MSIINSTALLCONTEXT_USERUNMANAGED, - MSICODE_PRODUCT | MSISOURCETYPE_URL, 0, value, &size); + r = MsiSourceListEnumSourcesA(prodcode, usersid, MSIINSTALLCONTEXT_USERUNMANAGED, + MSICODE_PRODUCT | MSISOURCETYPE_URL, 0, value, &size); ok(r == ERROR_NO_MORE_ITEMS, "Expected ERROR_NO_MORE_ITEMS, got %d\n", r); ok(!lstrcmpA(value, "aaa"), "Expected value to be unchanged, got %s\n", value); ok(size == MAX_PATH, "Expected MAX_PATH, got %lu\n", size); @@ -1199,9 +1079,8 @@ static void test_MsiSourceListEnumSources(void) /* sources exist */ size = MAX_PATH; lstrcpyA(value, "aaa"); - r = pMsiSourceListEnumSourcesA(prodcode, usersid, - MSIINSTALLCONTEXT_USERUNMANAGED, - MSICODE_PRODUCT | MSISOURCETYPE_URL, 0, value, &size); + r = MsiSourceListEnumSourcesA(prodcode, usersid, MSIINSTALLCONTEXT_USERUNMANAGED, + MSICODE_PRODUCT | MSISOURCETYPE_URL, 0, value, &size); ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r); ok(!lstrcmpA(value, "first"), "Expected \"first\", got %s\n", value); ok(size == 5, "Expected 5, got %lu\n", size); @@ -1209,60 +1088,52 @@ static void test_MsiSourceListEnumSources(void) /* try index 0 again */ size = MAX_PATH; lstrcpyA(value, "aaa"); - r = pMsiSourceListEnumSourcesA(prodcode, usersid, - MSIINSTALLCONTEXT_USERUNMANAGED, - MSICODE_PRODUCT | MSISOURCETYPE_URL, 0, value, &size); + r = MsiSourceListEnumSourcesA(prodcode, usersid, MSIINSTALLCONTEXT_USERUNMANAGED, + MSICODE_PRODUCT | MSISOURCETYPE_URL, 0, value, &size); ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r); ok(!lstrcmpA(value, "first"), "Expected \"first\", got %s\n", value); ok(size == 5, "Expected 5, got %lu\n", size); /* both szSource and pcchSource are NULL, index 0 */ - r = pMsiSourceListEnumSourcesA(prodcode, usersid, - MSIINSTALLCONTEXT_USERUNMANAGED, - MSICODE_PRODUCT | MSISOURCETYPE_URL, 0, NULL, NULL); + r = MsiSourceListEnumSourcesA(prodcode, usersid, MSIINSTALLCONTEXT_USERUNMANAGED, + MSICODE_PRODUCT | MSISOURCETYPE_URL, 0, NULL, NULL); ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r); /* both szSource and pcchSource are NULL, index 1 */ - r = pMsiSourceListEnumSourcesA(prodcode, usersid, - MSIINSTALLCONTEXT_USERUNMANAGED, - MSICODE_PRODUCT | MSISOURCETYPE_URL, 1, NULL, NULL); + r = MsiSourceListEnumSourcesA(prodcode, usersid, MSIINSTALLCONTEXT_USERUNMANAGED, + MSICODE_PRODUCT | MSISOURCETYPE_URL, 1, NULL, NULL); ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r); /* size is exactly 5 */ size = 5; lstrcpyA(value, "aaa"); - r = pMsiSourceListEnumSourcesA(prodcode, usersid, - MSIINSTALLCONTEXT_USERUNMANAGED, - MSICODE_PRODUCT | MSISOURCETYPE_URL, 0, value, &size); + r = MsiSourceListEnumSourcesA(prodcode, usersid, MSIINSTALLCONTEXT_USERUNMANAGED, + MSICODE_PRODUCT | MSISOURCETYPE_URL, 0, value, &size); ok(r == ERROR_MORE_DATA, "Expected ERROR_MORE_DATA, got %d\n", r); ok(!lstrcmpA(value, "aaa"), "Expected \"aaa\", got %s\n", value); ok(size == 5, "Expected 5, got %lu\n", size); /* szSource is non-NULL while pcchSource is NULL */ lstrcpyA(value, "aaa"); - r = pMsiSourceListEnumSourcesA(prodcode, usersid, - MSIINSTALLCONTEXT_USERUNMANAGED, - MSICODE_PRODUCT | MSISOURCETYPE_URL, 0, value, NULL); + r = MsiSourceListEnumSourcesA(prodcode, usersid, MSIINSTALLCONTEXT_USERUNMANAGED, + MSICODE_PRODUCT | MSISOURCETYPE_URL, 0, value, NULL); ok(r == ERROR_INVALID_PARAMETER, "Expected ERROR_INVALID_PARAMETER, got %d\n", r); ok(!lstrcmpA(value, "aaa"), "Expected \"aaa\", got %s\n", value); /* try index 1 after failure */ size = MAX_PATH; lstrcpyA(value, "aaa"); - r = pMsiSourceListEnumSourcesA(prodcode, usersid, - MSIINSTALLCONTEXT_USERUNMANAGED, - MSICODE_PRODUCT | MSISOURCETYPE_URL, 1, value, &size); - ok(r == ERROR_INVALID_PARAMETER, - "Expected ERROR_INVALID_PARAMETER, got %d\n", r); + r = MsiSourceListEnumSourcesA(prodcode, usersid, MSIINSTALLCONTEXT_USERUNMANAGED, + MSICODE_PRODUCT | MSISOURCETYPE_URL, 1, value, &size); + ok(r == ERROR_INVALID_PARAMETER, "Expected ERROR_INVALID_PARAMETER, got %d\n", r); ok(!lstrcmpA(value, "aaa"), "Expected \"aaa\", got %s\n", value); ok(size == MAX_PATH, "Expected MAX_PATH, got %lu\n", size); /* reset the enumeration */ size = MAX_PATH; lstrcpyA(value, "aaa"); - r = pMsiSourceListEnumSourcesA(prodcode, usersid, - MSIINSTALLCONTEXT_USERUNMANAGED, - MSICODE_PRODUCT | MSISOURCETYPE_URL, 0, value, &size); + r = MsiSourceListEnumSourcesA(prodcode, usersid, MSIINSTALLCONTEXT_USERUNMANAGED, + MSICODE_PRODUCT | MSISOURCETYPE_URL, 0, value, &size); ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r); ok(!lstrcmpA(value, "first"), "Expected \"first\", got %s\n", value); ok(size == 5, "Expected 5, got %lu\n", size); @@ -1270,9 +1141,8 @@ static void test_MsiSourceListEnumSources(void) /* try index 1 */ size = MAX_PATH; lstrcpyA(value, "aaa"); - r = pMsiSourceListEnumSourcesA(prodcode, usersid, - MSIINSTALLCONTEXT_USERUNMANAGED, - MSICODE_PRODUCT | MSISOURCETYPE_URL, 1, value, &size); + r = MsiSourceListEnumSourcesA(prodcode, usersid, MSIINSTALLCONTEXT_USERUNMANAGED, + MSICODE_PRODUCT | MSISOURCETYPE_URL, 1, value, &size); ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r); ok(!lstrcmpA(value, "second"), "Expected \"second\", got %s\n", value); ok(size == 6, "Expected 6, got %lu\n", size); @@ -1280,20 +1150,17 @@ static void test_MsiSourceListEnumSources(void) /* try index 1 again */ size = MAX_PATH; lstrcpyA(value, "aaa"); - r = pMsiSourceListEnumSourcesA(prodcode, usersid, - MSIINSTALLCONTEXT_USERUNMANAGED, - MSICODE_PRODUCT | MSISOURCETYPE_URL, 1, value, &size); - ok(r == ERROR_INVALID_PARAMETER, - "Expected ERROR_INVALID_PARAMETER, got %d\n", r); + r = MsiSourceListEnumSourcesA(prodcode, usersid, MSIINSTALLCONTEXT_USERUNMANAGED, + MSICODE_PRODUCT | MSISOURCETYPE_URL, 1, value, &size); + ok(r == ERROR_INVALID_PARAMETER, "Expected ERROR_INVALID_PARAMETER, got %d\n", r); ok(!lstrcmpA(value, "aaa"), "Expected value to be unchanged, got %s\n", value); ok(size == MAX_PATH, "Expected MAX_PATH, got %lu\n", size); /* try index 2 */ size = MAX_PATH; lstrcpyA(value, "aaa"); - r = pMsiSourceListEnumSourcesA(prodcode, usersid, - MSIINSTALLCONTEXT_USERUNMANAGED, - MSICODE_PRODUCT | MSISOURCETYPE_URL, 2, value, &size); + r = MsiSourceListEnumSourcesA(prodcode, usersid, MSIINSTALLCONTEXT_USERUNMANAGED, + MSICODE_PRODUCT | MSISOURCETYPE_URL, 2, value, &size); ok(r == ERROR_NO_MORE_ITEMS, "Expected ERROR_NO_MORE_ITEMS, got %d\n", r); ok(!lstrcmpA(value, "aaa"), "Expected value to be unchanged, got %s\n", value); ok(size == MAX_PATH, "Expected MAX_PATH, got %lu\n", size); @@ -1301,20 +1168,17 @@ static void test_MsiSourceListEnumSources(void) /* try index < 0 */ size = MAX_PATH; lstrcpyA(value, "aaa"); - r = pMsiSourceListEnumSourcesA(prodcode, usersid, - MSIINSTALLCONTEXT_USERUNMANAGED, - MSICODE_PRODUCT | MSISOURCETYPE_URL, -1, value, &size); - ok(r == ERROR_INVALID_PARAMETER, - "Expected ERROR_INVALID_PARAMETER, got %d\n", r); + r = MsiSourceListEnumSourcesA(prodcode, usersid, MSIINSTALLCONTEXT_USERUNMANAGED, + MSICODE_PRODUCT | MSISOURCETYPE_URL, -1, value, &size); + ok(r == ERROR_INVALID_PARAMETER, "Expected ERROR_INVALID_PARAMETER, got %d\n", r); ok(!lstrcmpA(value, "aaa"), "Expected value to be unchanged, got %s\n", value); ok(size == MAX_PATH, "Expected MAX_PATH, got %lu\n", size); /* NULL szUserSid */ size = MAX_PATH; lstrcpyA(value, "aaa"); - r = pMsiSourceListEnumSourcesA(prodcode, NULL, - MSIINSTALLCONTEXT_USERUNMANAGED, - MSICODE_PRODUCT | MSISOURCETYPE_URL, 0, value, &size); + r = MsiSourceListEnumSourcesA(prodcode, NULL, MSIINSTALLCONTEXT_USERUNMANAGED, + MSICODE_PRODUCT | MSISOURCETYPE_URL, 0, value, &size); ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r); ok(!lstrcmpA(value, "first"), "Expected \"first\", got %s\n", value); ok(size == 5, "Expected 5, got %lu\n", size); @@ -1322,9 +1186,8 @@ static void test_MsiSourceListEnumSources(void) /* invalid dwOptions, must be one of MSICODE_ and MSISOURCETYPE_ */ size = MAX_PATH; lstrcpyA(value, "aaa"); - r = pMsiSourceListEnumSourcesA(prodcode, NULL, - MSIINSTALLCONTEXT_USERUNMANAGED, - MSICODE_PRODUCT, 0, value, &size); + r = MsiSourceListEnumSourcesA(prodcode, NULL, MSIINSTALLCONTEXT_USERUNMANAGED, + MSICODE_PRODUCT, 0, value, &size); ok(r == ERROR_INVALID_PARAMETER, "Expected ERROR_INVALID_PARAMETER, got %d\n", r); ok(!lstrcmpA(value, "aaa"), "Expected value to be unchanged, got %s\n", value); ok(size == MAX_PATH, "Expected MAX_PATH, got %lu\n", size); @@ -1332,9 +1195,8 @@ static void test_MsiSourceListEnumSources(void) /* invalid dwOptions, must be one of MSICODE_ and MSISOURCETYPE_ */ size = MAX_PATH; lstrcpyA(value, "aaa"); - r = pMsiSourceListEnumSourcesA(prodcode, NULL, - MSIINSTALLCONTEXT_USERUNMANAGED, - MSICODE_PATCH, 0, value, &size); + r = MsiSourceListEnumSourcesA(prodcode, NULL, MSIINSTALLCONTEXT_USERUNMANAGED, + MSICODE_PATCH, 0, value, &size); ok(r == ERROR_INVALID_PARAMETER, "Expected ERROR_INVALID_PARAMETER, got %d\n", r); ok(!lstrcmpA(value, "aaa"), "Expected value to be unchanged, got %s\n", value); ok(size == MAX_PATH, "Expected MAX_PATH, got %lu\n", size); @@ -1342,10 +1204,8 @@ static void test_MsiSourceListEnumSources(void) /* invalid dwOptions, must be one of MSICODE_ and MSISOURCETYPE_ */ size = MAX_PATH; lstrcpyA(value, "aaa"); - r = pMsiSourceListEnumSourcesA(prodcode, NULL, - MSIINSTALLCONTEXT_USERUNMANAGED, - MSICODE_PRODUCT | MSICODE_PATCH | MSISOURCETYPE_URL, - 0, value, &size); + r = MsiSourceListEnumSourcesA(prodcode, NULL, MSIINSTALLCONTEXT_USERUNMANAGED, + MSICODE_PRODUCT | MSICODE_PATCH | MSISOURCETYPE_URL, 0, value, &size); ok(r == ERROR_UNKNOWN_PATCH, "Expected ERROR_UNKNOWN_PATCH, got %d\n", r); ok(!lstrcmpA(value, "aaa"), "Expected value to be unchanged, got %s\n", value); ok(size == MAX_PATH, "Expected MAX_PATH, got %lu\n", size); @@ -1353,10 +1213,8 @@ static void test_MsiSourceListEnumSources(void) /* invalid dwOptions, must be one of MSICODE_ and MSISOURCETYPE_ */ size = MAX_PATH; lstrcpyA(value, "aaa"); - r = pMsiSourceListEnumSourcesA(prodcode, NULL, - MSIINSTALLCONTEXT_USERUNMANAGED, - MSICODE_PRODUCT | MSISOURCETYPE_NETWORK | MSISOURCETYPE_URL, - 0, value, &size); + r = MsiSourceListEnumSourcesA(prodcode, NULL, MSIINSTALLCONTEXT_USERUNMANAGED, + MSICODE_PRODUCT | MSISOURCETYPE_NETWORK | MSISOURCETYPE_URL, 0, value, &size); ok(r == ERROR_INVALID_PARAMETER, "Expected ERROR_INVALID_PARAMETER, got %d\n", r); ok(!lstrcmpA(value, "aaa"), "Expected value to be unchanged, got %s\n", value); ok(size == MAX_PATH, "Expected MAX_PATH, got %lu\n", size); @@ -1370,9 +1228,8 @@ static void test_MsiSourceListEnumSources(void) /* SourceList key exists */ size = MAX_PATH; lstrcpyA(value, "aaa"); - r = pMsiSourceListEnumSourcesA(prodcode, usersid, - MSIINSTALLCONTEXT_USERUNMANAGED, - MSICODE_PRODUCT | MSISOURCETYPE_NETWORK, 0, value, &size); + r = MsiSourceListEnumSourcesA(prodcode, usersid, MSIINSTALLCONTEXT_USERUNMANAGED, + MSICODE_PRODUCT | MSISOURCETYPE_NETWORK, 0, value, &size); ok(r == ERROR_NO_MORE_ITEMS, "Expected ERROR_NO_MORE_ITEMS, got %d\n", r); ok(!lstrcmpA(value, "aaa"), "Expected value to be unchanged, got %s\n", value); ok(size == MAX_PATH, "Expected MAX_PATH, got %lu\n", size); @@ -1383,9 +1240,8 @@ static void test_MsiSourceListEnumSources(void) /* Net key exists */ size = MAX_PATH; lstrcpyA(value, "aaa"); - r = pMsiSourceListEnumSourcesA(prodcode, usersid, - MSIINSTALLCONTEXT_USERUNMANAGED, - MSICODE_PRODUCT | MSISOURCETYPE_NETWORK, 0, value, &size); + r = MsiSourceListEnumSourcesA(prodcode, usersid, MSIINSTALLCONTEXT_USERUNMANAGED, + MSICODE_PRODUCT | MSISOURCETYPE_NETWORK, 0, value, &size); ok(r == ERROR_NO_MORE_ITEMS, "Expected ERROR_NO_MORE_ITEMS, got %d\n", r); ok(!lstrcmpA(value, "aaa"), "Expected value to be unchanged, got %s\n", value); ok(size == MAX_PATH, "Expected MAX_PATH, got %lu\n", size); @@ -1396,9 +1252,8 @@ static void test_MsiSourceListEnumSources(void) /* sources exist */ size = MAX_PATH; lstrcpyA(value, "aaa"); - r = pMsiSourceListEnumSourcesA(prodcode, usersid, - MSIINSTALLCONTEXT_USERUNMANAGED, - MSICODE_PRODUCT | MSISOURCETYPE_NETWORK, 0, value, &size); + r = MsiSourceListEnumSourcesA(prodcode, usersid, MSIINSTALLCONTEXT_USERUNMANAGED, + MSICODE_PRODUCT | MSISOURCETYPE_NETWORK, 0, value, &size); ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r); ok(!lstrcmpA(value, "first"), "Expected \"first\", got %s\n", value); ok(size == 5, "Expected 5, got %lu\n", size); @@ -1415,9 +1270,8 @@ static void test_MsiSourceListEnumSources(void) size = MAX_PATH; lstrcpyA(value, "aaa"); - r = pMsiSourceListEnumSourcesA(prodcode, usersid, - MSIINSTALLCONTEXT_USERMANAGED, - MSICODE_PRODUCT | MSISOURCETYPE_URL, 0, value, &size); + r = MsiSourceListEnumSourcesA(prodcode, usersid, MSIINSTALLCONTEXT_USERMANAGED, + MSICODE_PRODUCT | MSISOURCETYPE_URL, 0, value, &size); ok(r == ERROR_UNKNOWN_PRODUCT, "Expected ERROR_UNKNOWN_PRODUCT, got %d\n", r); ok(!lstrcmpA(value, "aaa"), "Expected value to be unchanged, got %s\n", value); ok(size == MAX_PATH, "Expected MAX_PATH, got %lu\n", size); @@ -1437,9 +1291,8 @@ static void test_MsiSourceListEnumSources(void) /* user product key exists */ size = MAX_PATH; lstrcpyA(value, "aaa"); - r = pMsiSourceListEnumSourcesA(prodcode, usersid, - MSIINSTALLCONTEXT_USERMANAGED, - MSICODE_PRODUCT | MSISOURCETYPE_URL, 0, value, &size); + r = MsiSourceListEnumSourcesA(prodcode, usersid, MSIINSTALLCONTEXT_USERMANAGED, + MSICODE_PRODUCT | MSISOURCETYPE_URL, 0, value, &size); ok(r == ERROR_BAD_CONFIGURATION, "Expected ERROR_BAD_CONFIGURATION, got %d\n", r); ok(!lstrcmpA(value, "aaa"), "Expected value to be unchanged, got %s\n", value); ok(size == MAX_PATH, "Expected MAX_PATH, got %lu\n", size); @@ -1450,9 +1303,8 @@ static void test_MsiSourceListEnumSources(void) /* SourceList key exists */ size = MAX_PATH; lstrcpyA(value, "aaa"); - r = pMsiSourceListEnumSourcesA(prodcode, usersid, - MSIINSTALLCONTEXT_USERMANAGED, - MSICODE_PRODUCT | MSISOURCETYPE_URL, 0, value, &size); + r = MsiSourceListEnumSourcesA(prodcode, usersid, MSIINSTALLCONTEXT_USERMANAGED, + MSICODE_PRODUCT | MSISOURCETYPE_URL, 0, value, &size); ok(r == ERROR_NO_MORE_ITEMS, "Expected ERROR_NO_MORE_ITEMS, got %d\n", r); ok(!lstrcmpA(value, "aaa"), "Expected value to be unchanged, got %s\n", value); ok(size == MAX_PATH, "Expected MAX_PATH, got %lu\n", size); @@ -1463,9 +1315,8 @@ static void test_MsiSourceListEnumSources(void) /* URL key exists */ size = MAX_PATH; lstrcpyA(value, "aaa"); - r = pMsiSourceListEnumSourcesA(prodcode, usersid, - MSIINSTALLCONTEXT_USERMANAGED, - MSICODE_PRODUCT | MSISOURCETYPE_URL, 0, value, &size); + r = MsiSourceListEnumSourcesA(prodcode, usersid, MSIINSTALLCONTEXT_USERMANAGED, + MSICODE_PRODUCT | MSISOURCETYPE_URL, 0, value, &size); ok(r == ERROR_NO_MORE_ITEMS, "Expected ERROR_NO_MORE_ITEMS, got %d\n", r); ok(!lstrcmpA(value, "aaa"), "Expected value to be unchanged, got %s\n", value); ok(size == MAX_PATH, "Expected MAX_PATH, got %lu\n", size); @@ -1476,9 +1327,8 @@ static void test_MsiSourceListEnumSources(void) /* sources exist */ size = MAX_PATH; lstrcpyA(value, "aaa"); - r = pMsiSourceListEnumSourcesA(prodcode, usersid, - MSIINSTALLCONTEXT_USERMANAGED, - MSICODE_PRODUCT | MSISOURCETYPE_URL, 0, value, &size); + r = MsiSourceListEnumSourcesA(prodcode, usersid, MSIINSTALLCONTEXT_USERMANAGED, + MSICODE_PRODUCT | MSISOURCETYPE_URL, 0, value, &size); ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r); ok(!lstrcmpA(value, "first"), "Expected \"first\", got %s\n", value); ok(size == 5, "Expected 5, got %lu\n", size); @@ -1486,23 +1336,21 @@ static void test_MsiSourceListEnumSources(void) /* NULL szUserSid */ size = MAX_PATH; lstrcpyA(value, "aaa"); - r = pMsiSourceListEnumSourcesA(prodcode, NULL, - MSIINSTALLCONTEXT_USERMANAGED, - MSICODE_PRODUCT | MSISOURCETYPE_URL, 0, value, &size); + r = MsiSourceListEnumSourcesA(prodcode, NULL, MSIINSTALLCONTEXT_USERMANAGED, + MSICODE_PRODUCT | MSISOURCETYPE_URL, 0, value, &size); ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r); ok(!lstrcmpA(value, "first"), "Expected \"first\", got %s\n", value); ok(size == 5, "Expected 5, got %lu\n", size); RegDeleteValueA(url, "1"); - delete_key(url, "", access); + RegDeleteKeyExA(url, "", access, 0); RegCloseKey(url); /* SourceList key exists */ size = MAX_PATH; lstrcpyA(value, "aaa"); - r = pMsiSourceListEnumSourcesA(prodcode, usersid, - MSIINSTALLCONTEXT_USERMANAGED, - MSICODE_PRODUCT | MSISOURCETYPE_NETWORK, 0, value, &size); + r = MsiSourceListEnumSourcesA(prodcode, usersid, MSIINSTALLCONTEXT_USERMANAGED, + MSICODE_PRODUCT | MSISOURCETYPE_NETWORK, 0, value, &size); ok(r == ERROR_NO_MORE_ITEMS, "Expected ERROR_NO_MORE_ITEMS, got %d\n", r); ok(!lstrcmpA(value, "aaa"), "Expected value to be unchanged, got %s\n", value); ok(size == MAX_PATH, "Expected MAX_PATH, got %lu\n", size); @@ -1513,9 +1361,8 @@ static void test_MsiSourceListEnumSources(void) /* Net key exists */ size = MAX_PATH; lstrcpyA(value, "aaa"); - r = pMsiSourceListEnumSourcesA(prodcode, usersid, - MSIINSTALLCONTEXT_USERMANAGED, - MSICODE_PRODUCT | MSISOURCETYPE_NETWORK, 0, value, &size); + r = MsiSourceListEnumSourcesA(prodcode, usersid, MSIINSTALLCONTEXT_USERMANAGED, + MSICODE_PRODUCT | MSISOURCETYPE_NETWORK, 0, value, &size); ok(r == ERROR_NO_MORE_ITEMS, "Expected ERROR_NO_MORE_ITEMS, got %d\n", r); ok(!lstrcmpA(value, "aaa"), "Expected value to be unchanged, got %s\n", value); ok(size == MAX_PATH, "Expected MAX_PATH, got %lu\n", size); @@ -1526,19 +1373,18 @@ static void test_MsiSourceListEnumSources(void) /* sources exist */ size = MAX_PATH; lstrcpyA(value, "aaa"); - r = pMsiSourceListEnumSourcesA(prodcode, usersid, - MSIINSTALLCONTEXT_USERMANAGED, - MSICODE_PRODUCT | MSISOURCETYPE_NETWORK, 0, value, &size); + r = MsiSourceListEnumSourcesA(prodcode, usersid, MSIINSTALLCONTEXT_USERMANAGED, + MSICODE_PRODUCT | MSISOURCETYPE_NETWORK, 0, value, &size); ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r); ok(!lstrcmpA(value, "first"), "Expected \"first\", got %s\n", value); ok(size == 5, "Expected 5, got %lu\n", size); RegDeleteValueA(net, "1"); - delete_key(net, "", access); + RegDeleteKeyExA(net, "", access, 0); RegCloseKey(net); - delete_key(source, "", access); + RegDeleteKeyExA(source, "", access, 0); RegCloseKey(source); - delete_key(userkey, "", access); + RegDeleteKeyExA(userkey, "", access, 0); RegCloseKey(userkey); /* MSIINSTALLCONTEXT_MACHINE */ @@ -1547,9 +1393,8 @@ static void test_MsiSourceListEnumSources(void) /* szUserSid is non-NULL */ size = MAX_PATH; lstrcpyA(value, "aaa"); - r = pMsiSourceListEnumSourcesA(prodcode, usersid, - MSIINSTALLCONTEXT_MACHINE, - MSICODE_PRODUCT | MSISOURCETYPE_URL, 0, value, &size); + r = MsiSourceListEnumSourcesA(prodcode, usersid, MSIINSTALLCONTEXT_MACHINE, + MSICODE_PRODUCT | MSISOURCETYPE_URL, 0, value, &size); ok(r == ERROR_INVALID_PARAMETER, "Expected ERROR_INVALID_PARAMETER, got %d\n", r); ok(!lstrcmpA(value, "aaa"), "Expected value to be unchanged, got %s\n", value); ok(size == MAX_PATH, "Expected MAX_PATH, got %lu\n", size); @@ -1557,9 +1402,8 @@ static void test_MsiSourceListEnumSources(void) /* szUserSid is NULL */ size = MAX_PATH; lstrcpyA(value, "aaa"); - r = pMsiSourceListEnumSourcesA(prodcode, NULL, - MSIINSTALLCONTEXT_MACHINE, - MSICODE_PRODUCT | MSISOURCETYPE_URL, 0, value, &size); + r = MsiSourceListEnumSourcesA(prodcode, NULL, MSIINSTALLCONTEXT_MACHINE, + MSICODE_PRODUCT | MSISOURCETYPE_URL, 0, value, &size); ok(r == ERROR_UNKNOWN_PRODUCT, "Expected ERROR_UNKNOWN_PRODUCT, got %d\n", r); ok(!lstrcmpA(value, "aaa"), "Expected value to be unchanged, got %s\n", value); ok(size == MAX_PATH, "Expected MAX_PATH, got %lu\n", size); @@ -1578,9 +1422,8 @@ static void test_MsiSourceListEnumSources(void) /* user product key exists */ size = MAX_PATH; lstrcpyA(value, "aaa"); - r = pMsiSourceListEnumSourcesA(prodcode, NULL, - MSIINSTALLCONTEXT_MACHINE, - MSICODE_PRODUCT | MSISOURCETYPE_URL, 0, value, &size); + r = MsiSourceListEnumSourcesA(prodcode, NULL, MSIINSTALLCONTEXT_MACHINE, + MSICODE_PRODUCT | MSISOURCETYPE_URL, 0, value, &size); ok(r == ERROR_BAD_CONFIGURATION, "Expected ERROR_BAD_CONFIGURATION, got %d\n", r); ok(!lstrcmpA(value, "aaa"), "Expected value to be unchanged, got %s\n", value); ok(size == MAX_PATH, "Expected MAX_PATH, got %lu\n", size); @@ -1591,9 +1434,8 @@ static void test_MsiSourceListEnumSources(void) /* SourceList key exists */ size = MAX_PATH; lstrcpyA(value, "aaa"); - r = pMsiSourceListEnumSourcesA(prodcode, NULL, - MSIINSTALLCONTEXT_MACHINE, - MSICODE_PRODUCT | MSISOURCETYPE_URL, 0, value, &size); + r = MsiSourceListEnumSourcesA(prodcode, NULL, MSIINSTALLCONTEXT_MACHINE, + MSICODE_PRODUCT | MSISOURCETYPE_URL, 0, value, &size); ok(r == ERROR_NO_MORE_ITEMS, "Expected ERROR_NO_MORE_ITEMS, got %d\n", r); ok(!lstrcmpA(value, "aaa"), "Expected value to be unchanged, got %s\n", value); ok(size == MAX_PATH, "Expected MAX_PATH, got %lu\n", size); @@ -1604,9 +1446,8 @@ static void test_MsiSourceListEnumSources(void) /* URL key exists */ size = MAX_PATH; lstrcpyA(value, "aaa"); - r = pMsiSourceListEnumSourcesA(prodcode, NULL, - MSIINSTALLCONTEXT_MACHINE, - MSICODE_PRODUCT | MSISOURCETYPE_URL, 0, value, &size); + r = MsiSourceListEnumSourcesA(prodcode, NULL, MSIINSTALLCONTEXT_MACHINE, + MSICODE_PRODUCT | MSISOURCETYPE_URL, 0, value, &size); ok(r == ERROR_NO_MORE_ITEMS, "Expected ERROR_NO_MORE_ITEMS, got %d\n", r); ok(!lstrcmpA(value, "aaa"), "Expected value to be unchanged, got %s\n", value); ok(size == MAX_PATH, "Expected MAX_PATH, got %lu\n", size); @@ -1617,9 +1458,8 @@ static void test_MsiSourceListEnumSources(void) /* sources exist */ size = MAX_PATH; lstrcpyA(value, "aaa"); - r = pMsiSourceListEnumSourcesA(prodcode, NULL, - MSIINSTALLCONTEXT_MACHINE, - MSICODE_PRODUCT | MSISOURCETYPE_URL, 0, value, &size); + r = MsiSourceListEnumSourcesA(prodcode, NULL, MSIINSTALLCONTEXT_MACHINE, + MSICODE_PRODUCT | MSISOURCETYPE_URL, 0, value, &size); ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r); ok(!lstrcmpA(value, "first"), "Expected \"first\", got %s\n", value); ok(size == 5, "Expected 5, got %lu\n", size); @@ -1627,23 +1467,21 @@ static void test_MsiSourceListEnumSources(void) /* NULL szUserSid */ size = MAX_PATH; lstrcpyA(value, "aaa"); - r = pMsiSourceListEnumSourcesA(prodcode, NULL, - MSIINSTALLCONTEXT_MACHINE, - MSICODE_PRODUCT | MSISOURCETYPE_URL, 0, value, &size); + r = MsiSourceListEnumSourcesA(prodcode, NULL, MSIINSTALLCONTEXT_MACHINE, + MSICODE_PRODUCT | MSISOURCETYPE_URL, 0, value, &size); ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r); ok(!lstrcmpA(value, "first"), "Expected \"first\", got %s\n", value); ok(size == 5, "Expected 5, got %lu\n", size); RegDeleteValueA(url, "1"); - delete_key(url, "", access); + RegDeleteKeyExA(url, "", access, 0); RegCloseKey(url); /* SourceList key exists */ size = MAX_PATH; lstrcpyA(value, "aaa"); - r = pMsiSourceListEnumSourcesA(prodcode, NULL, - MSIINSTALLCONTEXT_MACHINE, - MSICODE_PRODUCT | MSISOURCETYPE_NETWORK, 0, value, &size); + r = MsiSourceListEnumSourcesA(prodcode, NULL, MSIINSTALLCONTEXT_MACHINE, + MSICODE_PRODUCT | MSISOURCETYPE_NETWORK, 0, value, &size); ok(r == ERROR_NO_MORE_ITEMS, "Expected ERROR_NO_MORE_ITEMS, got %d\n", r); ok(!lstrcmpA(value, "aaa"), "Expected value to be unchanged, got %s\n", value); ok(size == MAX_PATH, "Expected MAX_PATH, got %lu\n", size); @@ -1654,9 +1492,8 @@ static void test_MsiSourceListEnumSources(void) /* Net key exists */ size = MAX_PATH; lstrcpyA(value, "aaa"); - r = pMsiSourceListEnumSourcesA(prodcode, NULL, - MSIINSTALLCONTEXT_MACHINE, - MSICODE_PRODUCT | MSISOURCETYPE_NETWORK, 0, value, &size); + r = MsiSourceListEnumSourcesA(prodcode, NULL, MSIINSTALLCONTEXT_MACHINE, + MSICODE_PRODUCT | MSISOURCETYPE_NETWORK, 0, value, &size); ok(r == ERROR_NO_MORE_ITEMS, "Expected ERROR_NO_MORE_ITEMS, got %d\n", r); ok(!lstrcmpA(value, "aaa"), "Expected value to be unchanged, got %s\n", value); ok(size == MAX_PATH, "Expected MAX_PATH, got %lu\n", size); @@ -1667,19 +1504,18 @@ static void test_MsiSourceListEnumSources(void) /* sources exist */ size = MAX_PATH; lstrcpyA(value, "aaa"); - r = pMsiSourceListEnumSourcesA(prodcode, NULL, - MSIINSTALLCONTEXT_MACHINE, - MSICODE_PRODUCT | MSISOURCETYPE_NETWORK, 0, value, &size); + r = MsiSourceListEnumSourcesA(prodcode, NULL, MSIINSTALLCONTEXT_MACHINE, + MSICODE_PRODUCT | MSISOURCETYPE_NETWORK, 0, value, &size); ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r); ok(!lstrcmpA(value, "first"), "Expected \"first\", got %s\n", value); ok(size == 5, "Expected 5, got %lu\n", size); RegDeleteValueA(net, "1"); - delete_key(net, "", access); + RegDeleteKeyExA(net, "", access, 0); RegCloseKey(net); - delete_key(source, "", access); + RegDeleteKeyExA(source, "", access, 0); RegCloseKey(source); - delete_key(prodkey, "", access); + RegDeleteKeyExA(prodkey, "", access, 0); RegCloseKey(prodkey); LocalFree(usersid); } @@ -1696,12 +1532,7 @@ static void test_MsiSourceListSetInfo(void) UINT r; REGSAM access = KEY_ALL_ACCESS; - if (!pMsiSourceListSetInfoA) - { - win_skip("MsiSourceListSetInfoA is not available\n"); - return; - } - if (is_process_limited()) + if (!is_process_elevated()) { skip("process is limited\n"); return; @@ -1720,87 +1551,71 @@ static void test_MsiSourceListSetInfo(void) /* GetLastError is not set by the function */ /* NULL szProductCodeOrPatchCode */ - r = pMsiSourceListSetInfoA(NULL, usersid, MSIINSTALLCONTEXT_USERUNMANAGED, - MSICODE_PRODUCT | MSISOURCETYPE_NETWORK, - INSTALLPROPERTY_MEDIAPACKAGEPATHA, "path"); - ok(r == ERROR_INVALID_PARAMETER, - "Expected ERROR_INVALID_PARAMETER, got %d\n", r); + r = MsiSourceListSetInfoA(NULL, usersid, MSIINSTALLCONTEXT_USERUNMANAGED, + MSICODE_PRODUCT | MSISOURCETYPE_NETWORK, + INSTALLPROPERTY_MEDIAPACKAGEPATHA, "path"); + ok(r == ERROR_INVALID_PARAMETER, "Expected ERROR_INVALID_PARAMETER, got %d\n", r); /* empty szProductCodeOrPatchCode */ - r = pMsiSourceListSetInfoA("", usersid, MSIINSTALLCONTEXT_USERUNMANAGED, - MSICODE_PRODUCT | MSISOURCETYPE_NETWORK, - INSTALLPROPERTY_MEDIAPACKAGEPATHA, "path"); - ok(r == ERROR_INVALID_PARAMETER, - "Expected ERROR_INVALID_PARAMETER, got %d\n", r); + r = MsiSourceListSetInfoA("", usersid, MSIINSTALLCONTEXT_USERUNMANAGED, + MSICODE_PRODUCT | MSISOURCETYPE_NETWORK, + INSTALLPROPERTY_MEDIAPACKAGEPATHA, "path"); + ok(r == ERROR_INVALID_PARAMETER, "Expected ERROR_INVALID_PARAMETER, got %d\n", r); /* garbage szProductCodeOrPatchCode */ - r = pMsiSourceListSetInfoA("garbage", usersid, - MSIINSTALLCONTEXT_USERUNMANAGED, - MSICODE_PRODUCT | MSISOURCETYPE_NETWORK, - INSTALLPROPERTY_MEDIAPACKAGEPATHA, "path"); - ok(r == ERROR_INVALID_PARAMETER, - "Expected ERROR_INVALID_PARAMETER, got %d\n", r); + r = MsiSourceListSetInfoA("garbage", usersid, MSIINSTALLCONTEXT_USERUNMANAGED, + MSICODE_PRODUCT | MSISOURCETYPE_NETWORK, + INSTALLPROPERTY_MEDIAPACKAGEPATHA, "path"); + ok(r == ERROR_INVALID_PARAMETER, "Expected ERROR_INVALID_PARAMETER, got %d\n", r); /* guid without brackets */ - r = pMsiSourceListSetInfoA("51CD2AD5-0482-4C46-8DDD-0ED1022AA1AA", - usersid, MSIINSTALLCONTEXT_USERUNMANAGED, - MSICODE_PRODUCT | MSISOURCETYPE_NETWORK, - INSTALLPROPERTY_MEDIAPACKAGEPATHA, "path"); - ok(r == ERROR_INVALID_PARAMETER, - "Expected ERROR_INVALID_PARAMETER, got %d\n", r); + r = MsiSourceListSetInfoA("51CD2AD5-0482-4C46-8DDD-0ED1022AA1AA", + usersid, MSIINSTALLCONTEXT_USERUNMANAGED, + MSICODE_PRODUCT | MSISOURCETYPE_NETWORK, + INSTALLPROPERTY_MEDIAPACKAGEPATHA, "path"); + ok(r == ERROR_INVALID_PARAMETER, "Expected ERROR_INVALID_PARAMETER, got %d\n", r); /* guid with brackets */ - r = pMsiSourceListSetInfoA("{51CD2AD5-0482-4C46-8DDD-0ED1022AA1AA}", - usersid, MSIINSTALLCONTEXT_USERUNMANAGED, - MSICODE_PRODUCT | MSISOURCETYPE_NETWORK, - INSTALLPROPERTY_MEDIAPACKAGEPATHA, "path"); - ok(r == ERROR_UNKNOWN_PRODUCT, - "Expected ERROR_UNKNOWN_PRODUCT, got %d\n", r); + r = MsiSourceListSetInfoA("{51CD2AD5-0482-4C46-8DDD-0ED1022AA1AA}", + usersid, MSIINSTALLCONTEXT_USERUNMANAGED, + MSICODE_PRODUCT | MSISOURCETYPE_NETWORK, + INSTALLPROPERTY_MEDIAPACKAGEPATHA, "path"); + ok(r == ERROR_UNKNOWN_PRODUCT, "Expected ERROR_UNKNOWN_PRODUCT, got %d\n", r); /* dwOptions is MSICODE_PRODUCT */ - r = pMsiSourceListSetInfoA(prodcode, usersid, - MSIINSTALLCONTEXT_USERUNMANAGED, MSICODE_PRODUCT, - INSTALLPROPERTY_MEDIAPACKAGEPATHA, "path"); - ok(r == ERROR_UNKNOWN_PRODUCT, - "Expected ERROR_UNKNOWN_PRODUCT, got %d\n", r); + r = MsiSourceListSetInfoA(prodcode, usersid, MSIINSTALLCONTEXT_USERUNMANAGED, MSICODE_PRODUCT, + INSTALLPROPERTY_MEDIAPACKAGEPATHA, "path"); + ok(r == ERROR_UNKNOWN_PRODUCT, "Expected ERROR_UNKNOWN_PRODUCT, got %d\n", r); /* dwOptions is MSICODE_PATCH */ - r = pMsiSourceListSetInfoA(prodcode, usersid, - MSIINSTALLCONTEXT_USERUNMANAGED, MSICODE_PATCH, - INSTALLPROPERTY_MEDIAPACKAGEPATHA, "path"); + r = MsiSourceListSetInfoA(prodcode, usersid, MSIINSTALLCONTEXT_USERUNMANAGED, MSICODE_PATCH, + INSTALLPROPERTY_MEDIAPACKAGEPATHA, "path"); ok(r == ERROR_UNKNOWN_PATCH, "Expected ERROR_UNKNOWN_PATCH, got %d\n", r); /* dwOptions is both MSICODE_PRODUCT and MSICODE_PATCH */ - r = pMsiSourceListSetInfoA(prodcode, usersid, - MSIINSTALLCONTEXT_USERUNMANAGED, - MSICODE_PRODUCT | MSICODE_PATCH | MSISOURCETYPE_URL, - INSTALLPROPERTY_MEDIAPACKAGEPATHA, "path"); + r = MsiSourceListSetInfoA(prodcode, usersid, MSIINSTALLCONTEXT_USERUNMANAGED, + MSICODE_PRODUCT | MSICODE_PATCH | MSISOURCETYPE_URL, + INSTALLPROPERTY_MEDIAPACKAGEPATHA, "path"); ok(r == ERROR_UNKNOWN_PATCH, "Expected ERROR_UNKNOWN_PATCH, got %d\n", r); /* dwOptions has both MSISOURCETYPE_NETWORK and MSISOURCETYPE_URL */ - r = pMsiSourceListSetInfoA(prodcode, NULL, - MSIINSTALLCONTEXT_USERUNMANAGED, - MSICODE_PRODUCT | MSISOURCETYPE_NETWORK | MSISOURCETYPE_URL, - INSTALLPROPERTY_MEDIAPACKAGEPATHA, "path"); - ok(r == ERROR_UNKNOWN_PRODUCT, - "Expected ERROR_UNKNOWN_PRODUCT, got %d\n", r); + r = MsiSourceListSetInfoA(prodcode, NULL, MSIINSTALLCONTEXT_USERUNMANAGED, + MSICODE_PRODUCT | MSISOURCETYPE_NETWORK | MSISOURCETYPE_URL, + INSTALLPROPERTY_MEDIAPACKAGEPATHA, "path"); + ok(r == ERROR_UNKNOWN_PRODUCT, "Expected ERROR_UNKNOWN_PRODUCT, got %d\n", r); /* LastUsedSource and dwOptions has both * MSISOURCETYPE_NETWORK and MSISOURCETYPE_URL */ - r = pMsiSourceListSetInfoA(prodcode, NULL, - MSIINSTALLCONTEXT_USERUNMANAGED, - MSICODE_PRODUCT | MSISOURCETYPE_NETWORK | MSISOURCETYPE_URL, - INSTALLPROPERTY_LASTUSEDSOURCEA, "path"); - ok(r == ERROR_UNKNOWN_PRODUCT, - "Expected ERROR_UNKNOWN_PRODUCT, got %d\n", r); + r = MsiSourceListSetInfoA(prodcode, NULL, MSIINSTALLCONTEXT_USERUNMANAGED, + MSICODE_PRODUCT | MSISOURCETYPE_NETWORK | MSISOURCETYPE_URL, + INSTALLPROPERTY_LASTUSEDSOURCEA, "path"); + ok(r == ERROR_UNKNOWN_PRODUCT, "Expected ERROR_UNKNOWN_PRODUCT, got %d\n", r); /* LastUsedSource and dwOptions has no source type */ - r = pMsiSourceListSetInfoA(prodcode, NULL, - MSIINSTALLCONTEXT_USERUNMANAGED, MSICODE_PRODUCT, - INSTALLPROPERTY_LASTUSEDSOURCEA, "path"); - ok(r == ERROR_UNKNOWN_PRODUCT, - "Expected ERROR_UNKNOWN_PRODUCT, got %d\n", r); + r = MsiSourceListSetInfoA(prodcode, NULL, MSIINSTALLCONTEXT_USERUNMANAGED, MSICODE_PRODUCT, + INSTALLPROPERTY_LASTUSEDSOURCEA, "path"); + ok(r == ERROR_UNKNOWN_PRODUCT, "Expected ERROR_UNKNOWN_PRODUCT, got %d\n", r); /* MSIINSTALLCONTEXT_USERUNMANAGED */ @@ -1811,19 +1626,16 @@ static void test_MsiSourceListSetInfo(void) ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %ld\n", res); /* user product key exists */ - r = pMsiSourceListSetInfoA(prodcode, NULL, - MSIINSTALLCONTEXT_USERUNMANAGED, MSICODE_PRODUCT, - INSTALLPROPERTY_MEDIAPACKAGEPATHA, "path"); - ok(r == ERROR_BAD_CONFIGURATION, - "Expected ERROR_BAD_CONFIGURATION, got %d\n", r); + r = MsiSourceListSetInfoA(prodcode, NULL, MSIINSTALLCONTEXT_USERUNMANAGED, MSICODE_PRODUCT, + INSTALLPROPERTY_MEDIAPACKAGEPATHA, "path"); + ok(r == ERROR_BAD_CONFIGURATION, "Expected ERROR_BAD_CONFIGURATION, got %d\n", r); res = RegCreateKeyA(userkey, "SourceList", &source); ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %ld\n", res); /* SourceList key exists, no source type */ - r = pMsiSourceListSetInfoA(prodcode, NULL, - MSIINSTALLCONTEXT_USERUNMANAGED, MSICODE_PRODUCT, - INSTALLPROPERTY_MEDIAPACKAGEPATHA, "path"); + r = MsiSourceListSetInfoA(prodcode, NULL, MSIINSTALLCONTEXT_USERUNMANAGED, MSICODE_PRODUCT, + INSTALLPROPERTY_MEDIAPACKAGEPATHA, "path"); ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r); /* Media key is created by MsiSourceListSetInfo */ @@ -1832,91 +1644,71 @@ static void test_MsiSourceListSetInfo(void) CHECK_REG_STR(media, "MediaPackage", "path"); /* set the info again */ - r = pMsiSourceListSetInfoA(prodcode, NULL, - MSIINSTALLCONTEXT_USERUNMANAGED, MSICODE_PRODUCT, - INSTALLPROPERTY_MEDIAPACKAGEPATHA, "path2"); + r = MsiSourceListSetInfoA(prodcode, NULL, MSIINSTALLCONTEXT_USERUNMANAGED, MSICODE_PRODUCT, + INSTALLPROPERTY_MEDIAPACKAGEPATHA, "path2"); ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r); CHECK_REG_STR(media, "MediaPackage", "path2"); /* NULL szProperty */ - r = pMsiSourceListSetInfoA(prodcode, NULL, - MSIINSTALLCONTEXT_USERUNMANAGED, MSICODE_PRODUCT, - NULL, "path"); - ok(r == ERROR_INVALID_PARAMETER, - "Expected ERROR_INVALID_PARAMETER, got %d\n", r); + r = MsiSourceListSetInfoA(prodcode, NULL, MSIINSTALLCONTEXT_USERUNMANAGED, MSICODE_PRODUCT, + NULL, "path"); + ok(r == ERROR_INVALID_PARAMETER, "Expected ERROR_INVALID_PARAMETER, got %d\n", r); /* empty szProperty */ - r = pMsiSourceListSetInfoA(prodcode, NULL, - MSIINSTALLCONTEXT_USERUNMANAGED, MSICODE_PRODUCT, - "", "path"); - ok(r == ERROR_UNKNOWN_PROPERTY, - "Expected ERROR_UNKNOWN_PROPERTY, got %d\n", r); + r = MsiSourceListSetInfoA(prodcode, NULL, MSIINSTALLCONTEXT_USERUNMANAGED, MSICODE_PRODUCT, + "", "path"); + ok(r == ERROR_UNKNOWN_PROPERTY, "Expected ERROR_UNKNOWN_PROPERTY, got %d\n", r); /* NULL szValue */ - r = pMsiSourceListSetInfoA(prodcode, NULL, - MSIINSTALLCONTEXT_USERUNMANAGED, MSICODE_PRODUCT, - INSTALLPROPERTY_MEDIAPACKAGEPATHA, NULL); - ok(r == ERROR_UNKNOWN_PROPERTY, - "Expected ERROR_UNKNOWN_PROPERTY, got %d\n", r); + r = MsiSourceListSetInfoA(prodcode, NULL, MSIINSTALLCONTEXT_USERUNMANAGED, MSICODE_PRODUCT, + INSTALLPROPERTY_MEDIAPACKAGEPATHA, NULL); + ok(r == ERROR_UNKNOWN_PROPERTY, "Expected ERROR_UNKNOWN_PROPERTY, got %d\n", r); /* empty szValue */ - r = pMsiSourceListSetInfoA(prodcode, NULL, - MSIINSTALLCONTEXT_USERUNMANAGED, MSICODE_PRODUCT, - INSTALLPROPERTY_MEDIAPACKAGEPATHA, ""); + r = MsiSourceListSetInfoA(prodcode, NULL, MSIINSTALLCONTEXT_USERUNMANAGED, MSICODE_PRODUCT, + INSTALLPROPERTY_MEDIAPACKAGEPATHA, ""); ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r); CHECK_REG_STR(media, "MediaPackage", ""); /* INSTALLPROPERTY_MEDIAPACKAGEPATH, MSISOURCETYPE_NETWORK */ - r = pMsiSourceListSetInfoA(prodcode, NULL, - MSIINSTALLCONTEXT_USERUNMANAGED, - MSICODE_PRODUCT | MSISOURCETYPE_NETWORK, - INSTALLPROPERTY_MEDIAPACKAGEPATHA, "path"); - ok(r == ERROR_INVALID_PARAMETER, - "Expected ERROR_INVALID_PARAMETER, got %d\n", r); + r = MsiSourceListSetInfoA(prodcode, NULL, MSIINSTALLCONTEXT_USERUNMANAGED, + MSICODE_PRODUCT | MSISOURCETYPE_NETWORK, + INSTALLPROPERTY_MEDIAPACKAGEPATHA, "path"); + ok(r == ERROR_INVALID_PARAMETER, "Expected ERROR_INVALID_PARAMETER, got %d\n", r); /* INSTALLPROPERTY_MEDIAPACKAGEPATH, MSISOURCETYPE_URL */ - r = pMsiSourceListSetInfoA(prodcode, NULL, - MSIINSTALLCONTEXT_USERUNMANAGED, - MSICODE_PRODUCT | MSISOURCETYPE_URL, - INSTALLPROPERTY_MEDIAPACKAGEPATHA, "path"); - ok(r == ERROR_INVALID_PARAMETER, - "Expected ERROR_INVALID_PARAMETER, got %d\n", r); + r = MsiSourceListSetInfoA(prodcode, NULL, MSIINSTALLCONTEXT_USERUNMANAGED, + MSICODE_PRODUCT | MSISOURCETYPE_URL, + INSTALLPROPERTY_MEDIAPACKAGEPATHA, "path"); + ok(r == ERROR_INVALID_PARAMETER, "Expected ERROR_INVALID_PARAMETER, got %d\n", r); /* INSTALLPROPERTY_DISKPROMPT */ - r = pMsiSourceListSetInfoA(prodcode, NULL, - MSIINSTALLCONTEXT_USERUNMANAGED, MSICODE_PRODUCT, - INSTALLPROPERTY_DISKPROMPTA, "prompt"); + r = MsiSourceListSetInfoA(prodcode, NULL, MSIINSTALLCONTEXT_USERUNMANAGED, MSICODE_PRODUCT, + INSTALLPROPERTY_DISKPROMPTA, "prompt"); ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r); CHECK_REG_STR(media, "DiskPrompt", "prompt"); /* INSTALLPROPERTY_DISKPROMPT, MSISOURCETYPE_NETWORK */ - r = pMsiSourceListSetInfoA(prodcode, NULL, - MSIINSTALLCONTEXT_USERUNMANAGED, - MSICODE_PRODUCT | MSISOURCETYPE_NETWORK, - INSTALLPROPERTY_DISKPROMPTA, "prompt"); - ok(r == ERROR_INVALID_PARAMETER, - "Expected ERROR_INVALID_PARAMETER, got %d\n", r); + r = MsiSourceListSetInfoA(prodcode, NULL, MSIINSTALLCONTEXT_USERUNMANAGED, + MSICODE_PRODUCT | MSISOURCETYPE_NETWORK, + INSTALLPROPERTY_DISKPROMPTA, "prompt"); + ok(r == ERROR_INVALID_PARAMETER, "Expected ERROR_INVALID_PARAMETER, got %d\n", r); /* INSTALLPROPERTY_DISKPROMPT, MSISOURCETYPE_URL */ - r = pMsiSourceListSetInfoA(prodcode, NULL, - MSIINSTALLCONTEXT_USERUNMANAGED, - MSICODE_PRODUCT | MSISOURCETYPE_URL, - INSTALLPROPERTY_DISKPROMPTA, "prompt"); - ok(r == ERROR_INVALID_PARAMETER, - "Expected ERROR_INVALID_PARAMETER, got %d\n", r); + r = MsiSourceListSetInfoA(prodcode, NULL, MSIINSTALLCONTEXT_USERUNMANAGED, + MSICODE_PRODUCT | MSISOURCETYPE_URL, + INSTALLPROPERTY_DISKPROMPTA, "prompt"); + ok(r == ERROR_INVALID_PARAMETER, "Expected ERROR_INVALID_PARAMETER, got %d\n", r); /* INSTALLPROPERTY_LASTUSEDSOURCE */ - r = pMsiSourceListSetInfoA(prodcode, NULL, - MSIINSTALLCONTEXT_USERUNMANAGED, MSICODE_PRODUCT, - INSTALLPROPERTY_LASTUSEDSOURCEA, "source"); - ok(r == ERROR_INVALID_PARAMETER, - "Expected ERROR_INVALID_PARAMETER, got %d\n", r); + r = MsiSourceListSetInfoA(prodcode, NULL, MSIINSTALLCONTEXT_USERUNMANAGED, MSICODE_PRODUCT, + INSTALLPROPERTY_LASTUSEDSOURCEA, "source"); + ok(r == ERROR_INVALID_PARAMETER, "Expected ERROR_INVALID_PARAMETER, got %d\n", r); /* INSTALLPROPERTY_LASTUSEDSOURCE, MSISOURCETYPE_NETWORK */ - r = pMsiSourceListSetInfoA(prodcode, NULL, - MSIINSTALLCONTEXT_USERUNMANAGED, - MSICODE_PRODUCT | MSISOURCETYPE_NETWORK, - INSTALLPROPERTY_LASTUSEDSOURCEA, "source"); + r = MsiSourceListSetInfoA(prodcode, NULL, MSIINSTALLCONTEXT_USERUNMANAGED, + MSICODE_PRODUCT | MSISOURCETYPE_NETWORK, + INSTALLPROPERTY_LASTUSEDSOURCEA, "source"); ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r); /* Net key is created by MsiSourceListSetInfo */ @@ -1926,20 +1718,18 @@ static void test_MsiSourceListSetInfo(void) CHECK_REG_STR(source, "LastUsedSource", "n;1;source"); /* source has forward slash */ - r = pMsiSourceListSetInfoA(prodcode, NULL, - MSIINSTALLCONTEXT_USERUNMANAGED, - MSICODE_PRODUCT | MSISOURCETYPE_NETWORK, - INSTALLPROPERTY_LASTUSEDSOURCEA, "source/"); + r = MsiSourceListSetInfoA(prodcode, NULL, MSIINSTALLCONTEXT_USERUNMANAGED, + MSICODE_PRODUCT | MSISOURCETYPE_NETWORK, + INSTALLPROPERTY_LASTUSEDSOURCEA, "source/"); ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r); CHECK_REG_STR(net, "1", "source\\"); CHECK_REG_STR(net, "2", "source/\\"); CHECK_REG_STR(source, "LastUsedSource", "n;2;source/"); /* INSTALLPROPERTY_LASTUSEDSOURCE, MSISOURCETYPE_URL */ - r = pMsiSourceListSetInfoA(prodcode, NULL, - MSIINSTALLCONTEXT_USERUNMANAGED, - MSICODE_PRODUCT | MSISOURCETYPE_URL, - INSTALLPROPERTY_LASTUSEDSOURCEA, "source"); + r = MsiSourceListSetInfoA(prodcode, NULL, MSIINSTALLCONTEXT_USERUNMANAGED, + MSICODE_PRODUCT | MSISOURCETYPE_URL, + INSTALLPROPERTY_LASTUSEDSOURCEA, "source"); ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r); /* URL key is created by MsiSourceListSetInfo */ @@ -1949,59 +1739,47 @@ static void test_MsiSourceListSetInfo(void) CHECK_REG_STR(source, "LastUsedSource", "u;1;source"); /* source has backslash */ - r = pMsiSourceListSetInfoA(prodcode, NULL, - MSIINSTALLCONTEXT_USERUNMANAGED, - MSICODE_PRODUCT | MSISOURCETYPE_URL, - INSTALLPROPERTY_LASTUSEDSOURCEA, "source\\"); + r = MsiSourceListSetInfoA(prodcode, NULL, MSIINSTALLCONTEXT_USERUNMANAGED, + MSICODE_PRODUCT | MSISOURCETYPE_URL, + INSTALLPROPERTY_LASTUSEDSOURCEA, "source\\"); ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r); CHECK_REG_STR(url, "1", "source/"); CHECK_REG_STR(url, "2", "source\\/"); CHECK_REG_STR(source, "LastUsedSource", "u;2;source\\"); /* INSTALLPROPERTY_LASTUSEDSOURCE, MSISOURCETYPE_MEDIA */ - r = pMsiSourceListSetInfoA(prodcode, NULL, - MSIINSTALLCONTEXT_USERUNMANAGED, - MSICODE_PRODUCT | MSISOURCETYPE_MEDIA, - INSTALLPROPERTY_LASTUSEDSOURCEA, "source"); - ok(r == ERROR_INVALID_PARAMETER, - "Expected ERROR_INVALID_PARAMETER, got %d\n", r); + r = MsiSourceListSetInfoA(prodcode, NULL, MSIINSTALLCONTEXT_USERUNMANAGED, + MSICODE_PRODUCT | MSISOURCETYPE_MEDIA, + INSTALLPROPERTY_LASTUSEDSOURCEA, "source"); + ok(r == ERROR_INVALID_PARAMETER, "Expected ERROR_INVALID_PARAMETER, got %d\n", r); /* INSTALLPROPERTY_PACKAGENAME */ - r = pMsiSourceListSetInfoA(prodcode, NULL, - MSIINSTALLCONTEXT_USERUNMANAGED, MSICODE_PRODUCT, - INSTALLPROPERTY_PACKAGENAMEA, "name"); + r = MsiSourceListSetInfoA(prodcode, NULL, MSIINSTALLCONTEXT_USERUNMANAGED, MSICODE_PRODUCT, + INSTALLPROPERTY_PACKAGENAMEA, "name"); ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r); CHECK_REG_STR(source, "PackageName", "name"); /* INSTALLPROPERTY_PACKAGENAME, MSISOURCETYPE_NETWORK */ - r = pMsiSourceListSetInfoA(prodcode, NULL, - MSIINSTALLCONTEXT_USERUNMANAGED, - MSICODE_PRODUCT | MSISOURCETYPE_NETWORK, - INSTALLPROPERTY_PACKAGENAMEA, "name"); - ok(r == ERROR_INVALID_PARAMETER, - "Expected ERROR_INVALID_PARAMETER, got %d\n", r); + r = MsiSourceListSetInfoA(prodcode, NULL, MSIINSTALLCONTEXT_USERUNMANAGED, + MSICODE_PRODUCT | MSISOURCETYPE_NETWORK, + INSTALLPROPERTY_PACKAGENAMEA, "name"); + ok(r == ERROR_INVALID_PARAMETER, "Expected ERROR_INVALID_PARAMETER, got %d\n", r); /* INSTALLPROPERTY_PACKAGENAME, MSISOURCETYPE_URL */ - r = pMsiSourceListSetInfoA(prodcode, NULL, - MSIINSTALLCONTEXT_USERUNMANAGED, - MSICODE_PRODUCT | MSISOURCETYPE_URL, - INSTALLPROPERTY_PACKAGENAMEA, "name"); - ok(r == ERROR_INVALID_PARAMETER, - "Expected ERROR_INVALID_PARAMETER, got %d\n", r); + r = MsiSourceListSetInfoA(prodcode, NULL, MSIINSTALLCONTEXT_USERUNMANAGED, + MSICODE_PRODUCT | MSISOURCETYPE_URL, + INSTALLPROPERTY_PACKAGENAMEA, "name"); + ok(r == ERROR_INVALID_PARAMETER, "Expected ERROR_INVALID_PARAMETER, got %d\n", r); /* INSTALLPROPERTY_LASTUSEDTYPE */ - r = pMsiSourceListSetInfoA(prodcode, NULL, - MSIINSTALLCONTEXT_USERUNMANAGED, MSICODE_PRODUCT, - INSTALLPROPERTY_LASTUSEDTYPEA, "type"); - ok(r == ERROR_UNKNOWN_PROPERTY, - "Expected ERROR_UNKNOWN_PROPERTY, got %d\n", r); + r = MsiSourceListSetInfoA(prodcode, NULL, MSIINSTALLCONTEXT_USERUNMANAGED, MSICODE_PRODUCT, + INSTALLPROPERTY_LASTUSEDTYPEA, "type"); + ok(r == ERROR_UNKNOWN_PROPERTY, "Expected ERROR_UNKNOWN_PROPERTY, got %d\n", r); /* definitely unknown property */ - r = pMsiSourceListSetInfoA(prodcode, NULL, - MSIINSTALLCONTEXT_USERUNMANAGED, MSICODE_PRODUCT, - "unknown", "val"); - ok(r == ERROR_UNKNOWN_PROPERTY, - "Expected ERROR_UNKNOWN_PROPERTY, got %d\n", r); + r = MsiSourceListSetInfoA(prodcode, NULL, MSIINSTALLCONTEXT_USERUNMANAGED, MSICODE_PRODUCT, + "unknown", "val"); + ok(r == ERROR_UNKNOWN_PROPERTY, "Expected ERROR_UNKNOWN_PROPERTY, got %d\n", r); RegDeleteValueA(net, "1"); RegDeleteKeyA(net, ""); @@ -2034,19 +1812,16 @@ static void test_MsiSourceListSetInfo(void) } /* user product key exists */ - r = pMsiSourceListSetInfoA(prodcode, NULL, - MSIINSTALLCONTEXT_USERMANAGED, MSICODE_PRODUCT, - INSTALLPROPERTY_MEDIAPACKAGEPATHA, "path"); - ok(r == ERROR_BAD_CONFIGURATION, - "Expected ERROR_BAD_CONFIGURATION, got %d\n", r); + r = MsiSourceListSetInfoA(prodcode, NULL, MSIINSTALLCONTEXT_USERMANAGED, MSICODE_PRODUCT, + INSTALLPROPERTY_MEDIAPACKAGEPATHA, "path"); + ok(r == ERROR_BAD_CONFIGURATION, "Expected ERROR_BAD_CONFIGURATION, got %d\n", r); res = RegCreateKeyExA(userkey, "SourceList", 0, NULL, 0, access, NULL, &source, NULL); ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %ld\n", res); /* SourceList key exists, no source type */ - r = pMsiSourceListSetInfoA(prodcode, NULL, - MSIINSTALLCONTEXT_USERMANAGED, MSICODE_PRODUCT, - INSTALLPROPERTY_MEDIAPACKAGEPATHA, "path"); + r = MsiSourceListSetInfoA(prodcode, NULL, MSIINSTALLCONTEXT_USERMANAGED, MSICODE_PRODUCT, + INSTALLPROPERTY_MEDIAPACKAGEPATHA, "path"); ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r); /* Media key is created by MsiSourceListSetInfo */ @@ -2055,11 +1830,11 @@ static void test_MsiSourceListSetInfo(void) CHECK_REG_STR(media, "MediaPackage", "path"); RegDeleteValueA(media, "MediaPackage"); - delete_key(media, "", access); + RegDeleteKeyExA(media, "", access, 0); RegCloseKey(media); - delete_key(source, "", access); + RegDeleteKeyExA(source, "", access, 0); RegCloseKey(source); - delete_key(userkey, "", access); + RegDeleteKeyExA(userkey, "", access, 0); RegCloseKey(userkey); /* MSIINSTALLCONTEXT_MACHINE */ @@ -2077,19 +1852,16 @@ static void test_MsiSourceListSetInfo(void) } /* user product key exists */ - r = pMsiSourceListSetInfoA(prodcode, NULL, - MSIINSTALLCONTEXT_MACHINE, MSICODE_PRODUCT, - INSTALLPROPERTY_MEDIAPACKAGEPATHA, "path"); - ok(r == ERROR_BAD_CONFIGURATION, - "Expected ERROR_BAD_CONFIGURATION, got %d\n", r); + r = MsiSourceListSetInfoA(prodcode, NULL, MSIINSTALLCONTEXT_MACHINE, MSICODE_PRODUCT, + INSTALLPROPERTY_MEDIAPACKAGEPATHA, "path"); + ok(r == ERROR_BAD_CONFIGURATION, "Expected ERROR_BAD_CONFIGURATION, got %d\n", r); res = RegCreateKeyExA(prodkey, "SourceList", 0, NULL, 0, access, NULL, &source, NULL); ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %ld\n", res); /* SourceList key exists, no source type */ - r = pMsiSourceListSetInfoA(prodcode, NULL, - MSIINSTALLCONTEXT_MACHINE, MSICODE_PRODUCT, - INSTALLPROPERTY_MEDIAPACKAGEPATHA, "path"); + r = MsiSourceListSetInfoA(prodcode, NULL, MSIINSTALLCONTEXT_MACHINE, MSICODE_PRODUCT, + INSTALLPROPERTY_MEDIAPACKAGEPATHA, "path"); if (r == ERROR_ACCESS_DENIED) { skip("MsiSourceListSetInfo (insufficient privileges)\n"); @@ -2103,19 +1875,17 @@ static void test_MsiSourceListSetInfo(void) CHECK_REG_STR(media, "MediaPackage", "path"); /* szUserSid is non-NULL */ - r = pMsiSourceListSetInfoA(prodcode, usersid, - MSIINSTALLCONTEXT_MACHINE, MSICODE_PRODUCT, - INSTALLPROPERTY_MEDIAPACKAGEPATHA, "path"); - ok(r == ERROR_INVALID_PARAMETER, - "Expected ERROR_INVALID_PARAMETER, got %d\n", r); + r = MsiSourceListSetInfoA(prodcode, usersid, MSIINSTALLCONTEXT_MACHINE, MSICODE_PRODUCT, + INSTALLPROPERTY_MEDIAPACKAGEPATHA, "path"); + ok(r == ERROR_INVALID_PARAMETER, "Expected ERROR_INVALID_PARAMETER, got %d\n", r); RegDeleteValueA(media, "MediaPackage"); - delete_key(media, "", access); + RegDeleteKeyExA(media, "", access, 0); RegCloseKey(media); done: - delete_key(source, "", access); + RegDeleteKeyExA(source, "", access, 0); RegCloseKey(source); - delete_key(prodkey, "", access); + RegDeleteKeyExA(prodkey, "", access, 0); RegCloseKey(prodkey); LocalFree(usersid); } @@ -2132,12 +1902,7 @@ static void test_MsiSourceListAddMediaDisk(void) UINT r; REGSAM access = KEY_ALL_ACCESS; - if (!pMsiSourceListAddMediaDiskA) - { - win_skip("MsiSourceListAddMediaDiskA is not available\n"); - return; - } - if (is_process_limited()) + if (!is_process_elevated()) { skip("process is limited\n"); return; @@ -2156,60 +1921,52 @@ static void test_MsiSourceListAddMediaDisk(void) /* GetLastError is not set by the function */ /* NULL szProductCodeOrPatchCode */ - r = pMsiSourceListAddMediaDiskA(NULL, usersid, MSIINSTALLCONTEXT_USERUNMANAGED, - MSICODE_PRODUCT, 1, "label", "prompt"); - ok(r == ERROR_INVALID_PARAMETER, - "Expected ERROR_INVALID_PARAMETER, got %d\n", r); + r = MsiSourceListAddMediaDiskA(NULL, usersid, MSIINSTALLCONTEXT_USERUNMANAGED, + MSICODE_PRODUCT, 1, "label", "prompt"); + ok(r == ERROR_INVALID_PARAMETER, "Expected ERROR_INVALID_PARAMETER, got %d\n", r); /* empty szProductCodeOrPatchCode */ - r = pMsiSourceListAddMediaDiskA("", usersid, MSIINSTALLCONTEXT_USERUNMANAGED, - MSICODE_PRODUCT, 1, "label", "prompt"); - ok(r == ERROR_INVALID_PARAMETER, - "Expected ERROR_INVALID_PARAMETER, got %d\n", r); + r = MsiSourceListAddMediaDiskA("", usersid, MSIINSTALLCONTEXT_USERUNMANAGED, + MSICODE_PRODUCT, 1, "label", "prompt"); + ok(r == ERROR_INVALID_PARAMETER, "Expected ERROR_INVALID_PARAMETER, got %d\n", r); /* garbage szProductCodeOrPatchCode */ - r = pMsiSourceListAddMediaDiskA("garbage", usersid, MSIINSTALLCONTEXT_USERUNMANAGED, - MSICODE_PRODUCT, 1, "label", "prompt"); - ok(r == ERROR_INVALID_PARAMETER, - "Expected ERROR_INVALID_PARAMETER, got %d\n", r); + r = MsiSourceListAddMediaDiskA("garbage", usersid, MSIINSTALLCONTEXT_USERUNMANAGED, + MSICODE_PRODUCT, 1, "label", "prompt"); + ok(r == ERROR_INVALID_PARAMETER, "Expected ERROR_INVALID_PARAMETER, got %d\n", r); /* guid without brackets */ - r = pMsiSourceListAddMediaDiskA("51CD2AD5-0482-4C46-8DDD-0ED1022AA1AA", - usersid, MSIINSTALLCONTEXT_USERUNMANAGED, - MSICODE_PRODUCT, 1, "label", "prompt"); - ok(r == ERROR_INVALID_PARAMETER, - "Expected ERROR_INVALID_PARAMETER, got %d\n", r); + r = MsiSourceListAddMediaDiskA("51CD2AD5-0482-4C46-8DDD-0ED1022AA1AA", + usersid, MSIINSTALLCONTEXT_USERUNMANAGED, + MSICODE_PRODUCT, 1, "label", "prompt"); + ok(r == ERROR_INVALID_PARAMETER, "Expected ERROR_INVALID_PARAMETER, got %d\n", r); /* guid with brackets */ - r = pMsiSourceListAddMediaDiskA("{51CD2AD5-0482-4C46-8DDD-0ED1022AA1AA}", - usersid, MSIINSTALLCONTEXT_USERUNMANAGED, - MSICODE_PRODUCT, 1, "label", "prompt"); - ok(r == ERROR_UNKNOWN_PRODUCT, - "Expected ERROR_UNKNOWN_PRODUCT, got %d\n", r); + r = MsiSourceListAddMediaDiskA("{51CD2AD5-0482-4C46-8DDD-0ED1022AA1AA}", + usersid, MSIINSTALLCONTEXT_USERUNMANAGED, + MSICODE_PRODUCT, 1, "label", "prompt"); + ok(r == ERROR_UNKNOWN_PRODUCT, "Expected ERROR_UNKNOWN_PRODUCT, got %d\n", r); /* dwOptions has MSISOURCETYPE_NETWORK */ - r = pMsiSourceListAddMediaDiskA("{51CD2AD5-0482-4C46-8DDD-0ED1022AA1AA}", - usersid, MSIINSTALLCONTEXT_USERUNMANAGED, - MSICODE_PRODUCT | MSISOURCETYPE_NETWORK, - 1, "label", "prompt"); - ok(r == ERROR_INVALID_PARAMETER, - "Expected ERROR_INVALID_PARAMETER, got %d\n", r); + r = MsiSourceListAddMediaDiskA("{51CD2AD5-0482-4C46-8DDD-0ED1022AA1AA}", + usersid, MSIINSTALLCONTEXT_USERUNMANAGED, + MSICODE_PRODUCT | MSISOURCETYPE_NETWORK, + 1, "label", "prompt"); + ok(r == ERROR_INVALID_PARAMETER, "Expected ERROR_INVALID_PARAMETER, got %d\n", r); /* dwOptions has MSISOURCETYPE_URL */ - r = pMsiSourceListAddMediaDiskA("{51CD2AD5-0482-4C46-8DDD-0ED1022AA1AA}", - usersid, MSIINSTALLCONTEXT_USERUNMANAGED, - MSICODE_PRODUCT | MSISOURCETYPE_URL, - 1, "label", "prompt"); - ok(r == ERROR_INVALID_PARAMETER, - "Expected ERROR_INVALID_PARAMETER, got %d\n", r); + r = MsiSourceListAddMediaDiskA("{51CD2AD5-0482-4C46-8DDD-0ED1022AA1AA}", + usersid, MSIINSTALLCONTEXT_USERUNMANAGED, + MSICODE_PRODUCT | MSISOURCETYPE_URL, + 1, "label", "prompt"); + ok(r == ERROR_INVALID_PARAMETER, "Expected ERROR_INVALID_PARAMETER, got %d\n", r); /* dwOptions has MSISOURCETYPE_MEDIA */ - r = pMsiSourceListAddMediaDiskA("{51CD2AD5-0482-4C46-8DDD-0ED1022AA1AA}", - usersid, MSIINSTALLCONTEXT_USERUNMANAGED, - MSICODE_PRODUCT | MSISOURCETYPE_MEDIA, - 1, "label", "prompt"); - ok(r == ERROR_INVALID_PARAMETER, - "Expected ERROR_INVALID_PARAMETER, got %d\n", r); + r = MsiSourceListAddMediaDiskA("{51CD2AD5-0482-4C46-8DDD-0ED1022AA1AA}", + usersid, MSIINSTALLCONTEXT_USERUNMANAGED, + MSICODE_PRODUCT | MSISOURCETYPE_MEDIA, + 1, "label", "prompt"); + ok(r == ERROR_INVALID_PARAMETER, "Expected ERROR_INVALID_PARAMETER, got %d\n", r); /* MSIINSTALLCONTEXT_USERUNMANAGED */ @@ -2220,19 +1977,16 @@ static void test_MsiSourceListAddMediaDisk(void) ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %ld\n", res); /* user product key exists */ - r = pMsiSourceListAddMediaDiskA(prodcode, usersid, - MSIINSTALLCONTEXT_USERUNMANAGED, - MSICODE_PRODUCT, 1, "label", "prompt"); - ok(r == ERROR_BAD_CONFIGURATION, - "Expected ERROR_BAD_CONFIGURATION, got %d\n", r); + r = MsiSourceListAddMediaDiskA(prodcode, usersid, MSIINSTALLCONTEXT_USERUNMANAGED, + MSICODE_PRODUCT, 1, "label", "prompt"); + ok(r == ERROR_BAD_CONFIGURATION, "Expected ERROR_BAD_CONFIGURATION, got %d\n", r); res = RegCreateKeyA(userkey, "SourceList", &source); ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %ld\n", res); /* SourceList key exists */ - r = pMsiSourceListAddMediaDiskA(prodcode, usersid, - MSIINSTALLCONTEXT_USERUNMANAGED, - MSICODE_PRODUCT, 1, "label", "prompt"); + r = MsiSourceListAddMediaDiskA(prodcode, usersid, MSIINSTALLCONTEXT_USERUNMANAGED, + MSICODE_PRODUCT, 1, "label", "prompt"); ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r); /* Media subkey is created by MsiSourceListAddMediaDisk */ @@ -2242,18 +1996,16 @@ static void test_MsiSourceListAddMediaDisk(void) CHECK_REG_STR(media, "1", "label;prompt"); /* dwDiskId is random */ - r = pMsiSourceListAddMediaDiskA(prodcode, usersid, - MSIINSTALLCONTEXT_USERUNMANAGED, - MSICODE_PRODUCT, 42, "label42", "prompt42"); + r = MsiSourceListAddMediaDiskA(prodcode, usersid, MSIINSTALLCONTEXT_USERUNMANAGED, + MSICODE_PRODUCT, 42, "label42", "prompt42"); ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r); CHECK_REG_STR(media, "1", "label;prompt"); CHECK_REG_STR(media, "42", "label42;prompt42"); /* dwDiskId is 0 */ - r = pMsiSourceListAddMediaDiskA(prodcode, usersid, - MSIINSTALLCONTEXT_USERUNMANAGED, - MSICODE_PRODUCT, 0, "label0", "prompt0"); + r = MsiSourceListAddMediaDiskA(prodcode, usersid, MSIINSTALLCONTEXT_USERUNMANAGED, + MSICODE_PRODUCT, 0, "label0", "prompt0"); ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r); CHECK_REG_STR(media, "0", "label0;prompt0"); @@ -2261,9 +2013,8 @@ static void test_MsiSourceListAddMediaDisk(void) CHECK_REG_STR(media, "42", "label42;prompt42"); /* dwDiskId is < 0 */ - r = pMsiSourceListAddMediaDiskA(prodcode, usersid, - MSIINSTALLCONTEXT_USERUNMANAGED, - MSICODE_PRODUCT, -1, "label-1", "prompt-1"); + r = MsiSourceListAddMediaDiskA(prodcode, usersid, MSIINSTALLCONTEXT_USERUNMANAGED, + MSICODE_PRODUCT, -1, "label-1", "prompt-1"); ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r); CHECK_REG_STR(media, "-1", "label-1;prompt-1"); @@ -2272,9 +2023,8 @@ static void test_MsiSourceListAddMediaDisk(void) CHECK_REG_STR(media, "42", "label42;prompt42"); /* update dwDiskId 1 */ - r = pMsiSourceListAddMediaDiskA(prodcode, usersid, - MSIINSTALLCONTEXT_USERUNMANAGED, - MSICODE_PRODUCT, 1, "newlabel", "newprompt"); + r = MsiSourceListAddMediaDiskA(prodcode, usersid, MSIINSTALLCONTEXT_USERUNMANAGED, + MSICODE_PRODUCT, 1, "newlabel", "newprompt"); ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r); CHECK_REG_STR(media, "-1", "label-1;prompt-1"); @@ -2283,9 +2033,8 @@ static void test_MsiSourceListAddMediaDisk(void) CHECK_REG_STR(media, "42", "label42;prompt42"); /* update dwDiskId 1, szPrompt is NULL */ - r = pMsiSourceListAddMediaDiskA(prodcode, usersid, - MSIINSTALLCONTEXT_USERUNMANAGED, - MSICODE_PRODUCT, 1, "etiqueta", NULL); + r = MsiSourceListAddMediaDiskA(prodcode, usersid, MSIINSTALLCONTEXT_USERUNMANAGED, + MSICODE_PRODUCT, 1, "etiqueta", NULL); ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r); CHECK_REG_STR(media, "-1", "label-1;prompt-1"); @@ -2294,16 +2043,13 @@ static void test_MsiSourceListAddMediaDisk(void) CHECK_REG_STR(media, "42", "label42;prompt42"); /* update dwDiskId 1, szPrompt is empty */ - r = pMsiSourceListAddMediaDiskA(prodcode, usersid, - MSIINSTALLCONTEXT_USERUNMANAGED, - MSICODE_PRODUCT, 1, "etikett", ""); - ok(r == ERROR_INVALID_PARAMETER, - "Expected ERROR_INVALID_PARAMETER, got %d\n", r); + r = MsiSourceListAddMediaDiskA(prodcode, usersid, MSIINSTALLCONTEXT_USERUNMANAGED, + MSICODE_PRODUCT, 1, "etikett", ""); + ok(r == ERROR_INVALID_PARAMETER, "Expected ERROR_INVALID_PARAMETER, got %d\n", r); /* update dwDiskId 1, szVolumeLabel is NULL */ - r = pMsiSourceListAddMediaDiskA(prodcode, usersid, - MSIINSTALLCONTEXT_USERUNMANAGED, - MSICODE_PRODUCT, 1, NULL, "provocar"); + r = MsiSourceListAddMediaDiskA(prodcode, usersid, MSIINSTALLCONTEXT_USERUNMANAGED, + MSICODE_PRODUCT, 1, NULL, "provocar"); ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r); CHECK_REG_STR(media, "-1", "label-1;prompt-1"); @@ -2312,16 +2058,13 @@ static void test_MsiSourceListAddMediaDisk(void) CHECK_REG_STR(media, "42", "label42;prompt42"); /* update dwDiskId 1, szVolumeLabel is empty */ - r = pMsiSourceListAddMediaDiskA(prodcode, usersid, - MSIINSTALLCONTEXT_USERUNMANAGED, - MSICODE_PRODUCT, 1, "", "provoquer"); - ok(r == ERROR_INVALID_PARAMETER, - "Expected ERROR_INVALID_PARAMETER, got %d\n", r); + r = MsiSourceListAddMediaDiskA(prodcode, usersid, MSIINSTALLCONTEXT_USERUNMANAGED, + MSICODE_PRODUCT, 1, "", "provoquer"); + ok(r == ERROR_INVALID_PARAMETER, "Expected ERROR_INVALID_PARAMETER, got %d\n", r); /* szUserSid is NULL */ - r = pMsiSourceListAddMediaDiskA(prodcode, NULL, - MSIINSTALLCONTEXT_USERUNMANAGED, - MSICODE_PRODUCT, 1, NULL, "provoquer"); + r = MsiSourceListAddMediaDiskA(prodcode, NULL, MSIINSTALLCONTEXT_USERUNMANAGED, + MSICODE_PRODUCT, 1, NULL, "provoquer"); ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r); CHECK_REG_STR(media, "-1", "label-1;prompt-1"); @@ -2355,19 +2098,16 @@ static void test_MsiSourceListAddMediaDisk(void) } /* user product key exists */ - r = pMsiSourceListAddMediaDiskA(prodcode, usersid, - MSIINSTALLCONTEXT_USERMANAGED, - MSICODE_PRODUCT, 1, "label", "prompt"); - ok(r == ERROR_BAD_CONFIGURATION, - "Expected ERROR_BAD_CONFIGURATION, got %d\n", r); + r = MsiSourceListAddMediaDiskA(prodcode, usersid, MSIINSTALLCONTEXT_USERMANAGED, + MSICODE_PRODUCT, 1, "label", "prompt"); + ok(r == ERROR_BAD_CONFIGURATION, "Expected ERROR_BAD_CONFIGURATION, got %d\n", r); res = RegCreateKeyExA(userkey, "SourceList", 0, NULL, 0, access, NULL, &source, NULL); ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %ld\n", res); /* SourceList key exists */ - r = pMsiSourceListAddMediaDiskA(prodcode, usersid, - MSIINSTALLCONTEXT_USERMANAGED, - MSICODE_PRODUCT, 1, "label", "prompt"); + r = MsiSourceListAddMediaDiskA(prodcode, usersid, MSIINSTALLCONTEXT_USERMANAGED, + MSICODE_PRODUCT, 1, "label", "prompt"); ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r); /* Media subkey is created by MsiSourceListAddMediaDisk */ @@ -2377,11 +2117,11 @@ static void test_MsiSourceListAddMediaDisk(void) CHECK_REG_STR(media, "1", "label;prompt"); RegDeleteValueA(media, "1"); - delete_key(media, "", access); + RegDeleteKeyExA(media, "", access, 0); RegCloseKey(media); - delete_key(source, "", access); + RegDeleteKeyExA(source, "", access, 0); RegCloseKey(source); - delete_key(userkey, "", access); + RegDeleteKeyExA(userkey, "", access, 0); RegCloseKey(userkey); /* MSIINSTALLCONTEXT_MACHINE */ @@ -2399,19 +2139,16 @@ static void test_MsiSourceListAddMediaDisk(void) } /* machine product key exists */ - r = pMsiSourceListAddMediaDiskA(prodcode, NULL, - MSIINSTALLCONTEXT_MACHINE, - MSICODE_PRODUCT, 1, "label", "prompt"); - ok(r == ERROR_BAD_CONFIGURATION, - "Expected ERROR_BAD_CONFIGURATION, got %d\n", r); + r = MsiSourceListAddMediaDiskA(prodcode, NULL, MSIINSTALLCONTEXT_MACHINE, + MSICODE_PRODUCT, 1, "label", "prompt"); + ok(r == ERROR_BAD_CONFIGURATION, "Expected ERROR_BAD_CONFIGURATION, got %d\n", r); res = RegCreateKeyExA(prodkey, "SourceList", 0, NULL, 0, access, NULL, &source, NULL); ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %ld\n", res); /* SourceList key exists */ - r = pMsiSourceListAddMediaDiskA(prodcode, NULL, - MSIINSTALLCONTEXT_MACHINE, - MSICODE_PRODUCT, 1, "label", "prompt"); + r = MsiSourceListAddMediaDiskA(prodcode, NULL, MSIINSTALLCONTEXT_MACHINE, + MSICODE_PRODUCT, 1, "label", "prompt"); if (r == ERROR_ACCESS_DENIED) { skip("MsiSourceListAddMediaDisk (insufficient privileges)\n"); @@ -2426,19 +2163,17 @@ static void test_MsiSourceListAddMediaDisk(void) CHECK_REG_STR(media, "1", "label;prompt"); /* szUserSid is non-NULL */ - r = pMsiSourceListAddMediaDiskA(prodcode, usersid, - MSIINSTALLCONTEXT_MACHINE, - MSICODE_PRODUCT, 1, "label", "prompt"); - ok(r == ERROR_INVALID_PARAMETER, - "Expected ERROR_INVALID_PARAMETER, got %d\n", r); + r = MsiSourceListAddMediaDiskA(prodcode, usersid, MSIINSTALLCONTEXT_MACHINE, + MSICODE_PRODUCT, 1, "label", "prompt"); + ok(r == ERROR_INVALID_PARAMETER, "Expected ERROR_INVALID_PARAMETER, got %d\n", r); RegDeleteValueA(media, "1"); - delete_key(media, "", access); + RegDeleteKeyExA(media, "", access, 0); RegCloseKey(media); done: - delete_key(source, "", access); + RegDeleteKeyExA(source, "", access, 0); RegCloseKey(source); - delete_key(prodkey, "", access); + RegDeleteKeyExA(prodkey, "", access, 0); RegCloseKey(prodkey); LocalFree(usersid); } @@ -2457,12 +2192,6 @@ static void test_MsiSourceListEnumMediaDisks(void) UINT r; REGSAM access = KEY_ALL_ACCESS; - if (!pMsiSourceListEnumMediaDisksA) - { - win_skip("MsiSourceListEnumMediaDisksA is not available\n"); - return; - } - create_test_guid(prodcode, prod_squashed); if (!(usersid = get_user_sid())) { @@ -2478,78 +2207,62 @@ static void test_MsiSourceListEnumMediaDisks(void) /* NULL szProductCodeOrPatchCode */ labelsz = sizeof(label); promptsz = sizeof(prompt); - r = pMsiSourceListEnumMediaDisksA(NULL, usersid, MSIINSTALLCONTEXT_USERUNMANAGED, - MSICODE_PRODUCT, 0, &id, label, &labelsz, - prompt, &promptsz); - ok(r == ERROR_INVALID_PARAMETER, - "Expected ERROR_INVALID_PARAMETER, got %d\n", r); + r = MsiSourceListEnumMediaDisksA(NULL, usersid, MSIINSTALLCONTEXT_USERUNMANAGED, + MSICODE_PRODUCT, 0, &id, label, &labelsz, prompt, &promptsz); + ok(r == ERROR_INVALID_PARAMETER, "Expected ERROR_INVALID_PARAMETER, got %d\n", r); /* empty szProductCodeOrPatchCode */ labelsz = sizeof(label); promptsz = sizeof(prompt); - r = pMsiSourceListEnumMediaDisksA("", usersid, MSIINSTALLCONTEXT_USERUNMANAGED, - MSICODE_PRODUCT, 0, &id, label, &labelsz, - prompt, &promptsz); - ok(r == ERROR_INVALID_PARAMETER, - "Expected ERROR_INVALID_PARAMETER, got %d\n", r); + r = MsiSourceListEnumMediaDisksA("", usersid, MSIINSTALLCONTEXT_USERUNMANAGED, + MSICODE_PRODUCT, 0, &id, label, &labelsz, prompt, &promptsz); + ok(r == ERROR_INVALID_PARAMETER, "Expected ERROR_INVALID_PARAMETER, got %d\n", r); /* garbage szProductCodeOrPatchCode */ labelsz = sizeof(label); promptsz = sizeof(prompt); - r = pMsiSourceListEnumMediaDisksA("garbage", usersid, MSIINSTALLCONTEXT_USERUNMANAGED, - MSICODE_PRODUCT, 0, &id, label, &labelsz, - prompt, &promptsz); - ok(r == ERROR_INVALID_PARAMETER, - "Expected ERROR_INVALID_PARAMETER, got %d\n", r); + r = MsiSourceListEnumMediaDisksA("garbage", usersid, MSIINSTALLCONTEXT_USERUNMANAGED, + MSICODE_PRODUCT, 0, &id, label, &labelsz, prompt, &promptsz); + ok(r == ERROR_INVALID_PARAMETER, "Expected ERROR_INVALID_PARAMETER, got %d\n", r); /* guid without brackets */ labelsz = sizeof(label); promptsz = sizeof(prompt); - r = pMsiSourceListEnumMediaDisksA("51CD2AD5-0482-4C46-8DDD-0ED1022AA1AA", - usersid, MSIINSTALLCONTEXT_USERUNMANAGED, - MSICODE_PRODUCT, 0, &id, label, &labelsz, - prompt, &promptsz); - ok(r == ERROR_INVALID_PARAMETER, - "Expected ERROR_INVALID_PARAMETER, got %d\n", r); + r = MsiSourceListEnumMediaDisksA("51CD2AD5-0482-4C46-8DDD-0ED1022AA1AA", + usersid, MSIINSTALLCONTEXT_USERUNMANAGED, + MSICODE_PRODUCT, 0, &id, label, &labelsz, prompt, &promptsz); + ok(r == ERROR_INVALID_PARAMETER, "Expected ERROR_INVALID_PARAMETER, got %d\n", r); /* guid with brackets */ labelsz = sizeof(label); promptsz = sizeof(prompt); - r = pMsiSourceListEnumMediaDisksA("{51CD2AD5-0482-4C46-8DDD-0ED1022AA1AA}", - usersid, MSIINSTALLCONTEXT_USERUNMANAGED, - MSICODE_PRODUCT, 0, &id, label, &labelsz, - prompt, &promptsz); - ok(r == ERROR_UNKNOWN_PRODUCT, - "Expected ERROR_UNKNOWN_PRODUCT, got %d\n", r); + r = MsiSourceListEnumMediaDisksA("{51CD2AD5-0482-4C46-8DDD-0ED1022AA1AA}", + usersid, MSIINSTALLCONTEXT_USERUNMANAGED, + MSICODE_PRODUCT, 0, &id, label, &labelsz, prompt, &promptsz); + ok(r == ERROR_UNKNOWN_PRODUCT, "Expected ERROR_UNKNOWN_PRODUCT, got %d\n", r); /* dwOptions has MSISOURCETYPE_NETWORK */ labelsz = sizeof(label); promptsz = sizeof(prompt); - r = pMsiSourceListEnumMediaDisksA(prodcode, usersid, MSIINSTALLCONTEXT_USERUNMANAGED, - MSICODE_PRODUCT | MSISOURCETYPE_NETWORK, - 0, &id, label, &labelsz, - prompt, &promptsz); - ok(r == ERROR_INVALID_PARAMETER, - "Expected ERROR_INVALID_PARAMETER, got %d\n", r); + r = MsiSourceListEnumMediaDisksA(prodcode, usersid, MSIINSTALLCONTEXT_USERUNMANAGED, + MSICODE_PRODUCT | MSISOURCETYPE_NETWORK, + 0, &id, label, &labelsz, prompt, &promptsz); + ok(r == ERROR_INVALID_PARAMETER, "Expected ERROR_INVALID_PARAMETER, got %d\n", r); /* dwOptions has MSISOURCETYPE_URL */ labelsz = sizeof(label); promptsz = sizeof(prompt); - r = pMsiSourceListEnumMediaDisksA(prodcode, usersid, MSIINSTALLCONTEXT_USERUNMANAGED, - MSICODE_PRODUCT | MSISOURCETYPE_URL, - 0, &id, label, &labelsz, - prompt, &promptsz); - ok(r == ERROR_INVALID_PARAMETER, - "Expected ERROR_INVALID_PARAMETER, got %d\n", r); + r = MsiSourceListEnumMediaDisksA(prodcode, usersid, MSIINSTALLCONTEXT_USERUNMANAGED, + MSICODE_PRODUCT | MSISOURCETYPE_URL, + 0, &id, label, &labelsz, prompt, &promptsz); + ok(r == ERROR_INVALID_PARAMETER, "Expected ERROR_INVALID_PARAMETER, got %d\n", r); /* dwIndex is non-zero */ labelsz = sizeof(label); promptsz = sizeof(prompt); - r = pMsiSourceListEnumMediaDisksA(prodcode, usersid, MSIINSTALLCONTEXT_USERUNMANAGED, - MSICODE_PRODUCT, 1, &id, label, &labelsz, - prompt, &promptsz); - ok(r == ERROR_INVALID_PARAMETER, - "Expected ERROR_INVALID_PARAMETER, got %d\n", r); + r = MsiSourceListEnumMediaDisksA(prodcode, usersid, MSIINSTALLCONTEXT_USERUNMANAGED, + MSICODE_PRODUCT, 1, &id, label, &labelsz, prompt, &promptsz); + ok(r == ERROR_INVALID_PARAMETER, "Expected ERROR_INVALID_PARAMETER, got %d\n", r); /* MSIINSTALLCONTEXT_USERUNMANAGED */ @@ -2562,11 +2275,9 @@ static void test_MsiSourceListEnumMediaDisks(void) /* user product key exists */ labelsz = sizeof(label); promptsz = sizeof(prompt); - r = pMsiSourceListEnumMediaDisksA(prodcode, usersid, MSIINSTALLCONTEXT_USERUNMANAGED, - MSICODE_PRODUCT, 0, &id, label, &labelsz, - prompt, &promptsz); - ok(r == ERROR_BAD_CONFIGURATION, - "Expected ERROR_BAD_CONFIGURATION, got %d\n", r); + r = MsiSourceListEnumMediaDisksA(prodcode, usersid, MSIINSTALLCONTEXT_USERUNMANAGED, + MSICODE_PRODUCT, 0, &id, label, &labelsz, prompt, &promptsz); + ok(r == ERROR_BAD_CONFIGURATION, "Expected ERROR_BAD_CONFIGURATION, got %d\n", r); res = RegCreateKeyA(userkey, "SourceList", &source); ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %ld\n", res); @@ -2577,11 +2288,9 @@ static void test_MsiSourceListEnumMediaDisks(void) labelsz = 0xdeadbeef; lstrcpyA(prompt, "bbb"); promptsz = 0xdeadbeef; - r = pMsiSourceListEnumMediaDisksA(prodcode, usersid, MSIINSTALLCONTEXT_USERUNMANAGED, - MSICODE_PRODUCT, 0, &id, label, &labelsz, - prompt, &promptsz); - ok(r == ERROR_NO_MORE_ITEMS, - "Expected ERROR_NO_MORE_ITEMS, got %d\n", r); + r = MsiSourceListEnumMediaDisksA(prodcode, usersid, MSIINSTALLCONTEXT_USERUNMANAGED, + MSICODE_PRODUCT, 0, &id, label, &labelsz, prompt, &promptsz); + ok(r == ERROR_NO_MORE_ITEMS, "Expected ERROR_NO_MORE_ITEMS, got %d\n", r); ok(id == 0xbeef, "Expected 0xbeef, got %lu\n", id); ok(!lstrcmpA(label, "aaa"), "Expected \"aaa\", got \"%s\"\n", label); ok(labelsz == 0xdeadbeef, "Expected 0xdeadbeef, got %lu\n", labelsz); @@ -2597,11 +2306,9 @@ static void test_MsiSourceListEnumMediaDisks(void) labelsz = 0xdeadbeef; lstrcpyA(prompt, "bbb"); promptsz = 0xdeadbeef; - r = pMsiSourceListEnumMediaDisksA(prodcode, usersid, MSIINSTALLCONTEXT_USERUNMANAGED, - MSICODE_PRODUCT, 0, &id, label, &labelsz, - prompt, &promptsz); - ok(r == ERROR_NO_MORE_ITEMS, - "Expected ERROR_NO_MORE_ITEMS, got %d\n", r); + r = MsiSourceListEnumMediaDisksA(prodcode, usersid, MSIINSTALLCONTEXT_USERUNMANAGED, + MSICODE_PRODUCT, 0, &id, label, &labelsz, prompt, &promptsz); + ok(r == ERROR_NO_MORE_ITEMS, "Expected ERROR_NO_MORE_ITEMS, got %d\n", r); ok(id == 0xbeef, "Expected 0xbeef, got %lu\n", id); ok(!lstrcmpA(label, "aaa"), "Expected \"aaa\", got \"%s\"\n", label); ok(labelsz == 0xdeadbeef, "Expected 0xdeadbeef, got %lu\n", labelsz); @@ -2617,9 +2324,8 @@ static void test_MsiSourceListEnumMediaDisks(void) labelsz = MAX_PATH; lstrcpyA(prompt, "bbb"); promptsz = MAX_PATH; - r = pMsiSourceListEnumMediaDisksA(prodcode, usersid, MSIINSTALLCONTEXT_USERUNMANAGED, - MSICODE_PRODUCT, 0, &id, label, &labelsz, - prompt, &promptsz); + r = MsiSourceListEnumMediaDisksA(prodcode, usersid, MSIINSTALLCONTEXT_USERUNMANAGED, + MSICODE_PRODUCT, 0, &id, label, &labelsz, prompt, &promptsz); ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r); ok(id == 1, "Expected 1, got %lu\n", id); ok(!lstrcmpA(label, "label"), "Expected \"label\", got \"%s\"\n", label); @@ -2634,9 +2340,8 @@ static void test_MsiSourceListEnumMediaDisks(void) id = 0; labelsz = MAX_PATH; promptsz = MAX_PATH; - r = pMsiSourceListEnumMediaDisksA(prodcode, usersid, MSIINSTALLCONTEXT_USERUNMANAGED, - MSICODE_PRODUCT, 1, &id, NULL, &labelsz, - NULL, &promptsz); + r = MsiSourceListEnumMediaDisksA(prodcode, usersid, MSIINSTALLCONTEXT_USERUNMANAGED, + MSICODE_PRODUCT, 1, &id, NULL, &labelsz, NULL, &promptsz); ok(r == ERROR_SUCCESS || r == ERROR_INVALID_PARAMETER, "Expected ERROR_SUCCESS or ERROR_INVALID_PARAMETER, got %d\n", r); if (r == ERROR_SUCCESS) @@ -2652,9 +2357,8 @@ static void test_MsiSourceListEnumMediaDisks(void) labelsz = MAX_PATH; lstrcpyA(prompt, "bbb"); promptsz = MAX_PATH; - r = pMsiSourceListEnumMediaDisksA(prodcode, usersid, MSIINSTALLCONTEXT_USERUNMANAGED, - MSICODE_PRODUCT, 1, &id, label, &labelsz, - prompt, &promptsz); + r = MsiSourceListEnumMediaDisksA(prodcode, usersid, MSIINSTALLCONTEXT_USERUNMANAGED, + MSICODE_PRODUCT, 1, &id, label, &labelsz, prompt, &promptsz); ok(r == ERROR_SUCCESS || r == ERROR_INVALID_PARAMETER, "Expected ERROR_SUCCESS or ERROR_INVALID_PARAMETER, got %d\n", r); if (r == ERROR_SUCCESS) @@ -2683,9 +2387,8 @@ static void test_MsiSourceListEnumMediaDisks(void) labelsz = MAX_PATH; lstrcpyA(prompt, "bbb"); promptsz = MAX_PATH; - r = pMsiSourceListEnumMediaDisksA(prodcode, usersid, MSIINSTALLCONTEXT_USERUNMANAGED, - MSICODE_PRODUCT, 0, &id, label, &labelsz, - prompt, &promptsz); + r = MsiSourceListEnumMediaDisksA(prodcode, usersid, MSIINSTALLCONTEXT_USERUNMANAGED, + MSICODE_PRODUCT, 0, &id, label, &labelsz, prompt, &promptsz); ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r); ok(id == 1, "Expected 1, got %lu\n", id); ok(!lstrcmpA(label, "label"), "Expected \"label\", got \"%s\"\n", label); @@ -2699,9 +2402,8 @@ static void test_MsiSourceListEnumMediaDisks(void) labelsz = MAX_PATH; lstrcpyA(prompt, "bbb"); promptsz = MAX_PATH; - r = pMsiSourceListEnumMediaDisksA(prodcode, usersid, MSIINSTALLCONTEXT_USERUNMANAGED, - MSICODE_PRODUCT, 1, &id, label, &labelsz, - prompt, &promptsz); + r = MsiSourceListEnumMediaDisksA(prodcode, usersid, MSIINSTALLCONTEXT_USERUNMANAGED, + MSICODE_PRODUCT, 1, &id, label, &labelsz, prompt, &promptsz); ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r); ok(id == 2, "Expected 2, got %lu\n", id); ok(!lstrcmpA(label, "one"), "Expected \"one\", got \"%s\"\n", label); @@ -2715,9 +2417,8 @@ static void test_MsiSourceListEnumMediaDisks(void) labelsz = MAX_PATH; lstrcpyA(prompt, "bbb"); promptsz = MAX_PATH; - r = pMsiSourceListEnumMediaDisksA(prodcode, usersid, MSIINSTALLCONTEXT_USERUNMANAGED, - MSICODE_PRODUCT, 2, &id, label, &labelsz, - prompt, &promptsz); + r = MsiSourceListEnumMediaDisksA(prodcode, usersid, MSIINSTALLCONTEXT_USERUNMANAGED, + MSICODE_PRODUCT, 2, &id, label, &labelsz, prompt, &promptsz); ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r); ok(id == 4, "Expected 4, got %lu\n", id); ok(!lstrcmpA(label, "three"), "Expected \"three\", got \"%s\"\n", label); @@ -2731,11 +2432,9 @@ static void test_MsiSourceListEnumMediaDisks(void) labelsz = MAX_PATH; lstrcpyA(prompt, "bbb"); promptsz = MAX_PATH; - r = pMsiSourceListEnumMediaDisksA(prodcode, usersid, MSIINSTALLCONTEXT_USERUNMANAGED, - MSICODE_PRODUCT, 3, &id, label, &labelsz, - prompt, &promptsz); - ok(r == ERROR_NO_MORE_ITEMS, - "Expected ERROR_NO_MORE_ITEMS, got %d\n", r); + r = MsiSourceListEnumMediaDisksA(prodcode, usersid, MSIINSTALLCONTEXT_USERUNMANAGED, + MSICODE_PRODUCT, 3, &id, label, &labelsz, prompt, &promptsz); + ok(r == ERROR_NO_MORE_ITEMS, "Expected ERROR_NO_MORE_ITEMS, got %d\n", r); ok(id == 0xbeef, "Expected 0xbeef, got %lu\n", id); ok(!lstrcmpA(label, "aaa"), "Expected \"aaa\", got \"%s\"\n", label); ok(labelsz == MAX_PATH, "Expected MAX_PATH, got %lu\n", labelsz); @@ -2748,9 +2447,8 @@ static void test_MsiSourceListEnumMediaDisks(void) labelsz = MAX_PATH; lstrcpyA(prompt, "bbb"); promptsz = MAX_PATH; - r = pMsiSourceListEnumMediaDisksA(prodcode, usersid, MSIINSTALLCONTEXT_USERUNMANAGED, - MSICODE_PRODUCT, 0, &id, label, &labelsz, - prompt, &promptsz); + r = MsiSourceListEnumMediaDisksA(prodcode, usersid, MSIINSTALLCONTEXT_USERUNMANAGED, + MSICODE_PRODUCT, 0, &id, label, &labelsz, prompt, &promptsz); ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r); ok(id == 1, "Expected 1, got %lu\n", id); ok(!lstrcmpA(label, "label"), "Expected \"label\", got \"%s\"\n", label); @@ -2764,9 +2462,8 @@ static void test_MsiSourceListEnumMediaDisks(void) labelsz = MAX_PATH; lstrcpyA(prompt, "bbb"); promptsz = MAX_PATH; - r = pMsiSourceListEnumMediaDisksA(prodcode, usersid, MSIINSTALLCONTEXT_USERUNMANAGED, - MSICODE_PRODUCT, 0, &id, label, &labelsz, - prompt, &promptsz); + r = MsiSourceListEnumMediaDisksA(prodcode, usersid, MSIINSTALLCONTEXT_USERUNMANAGED, + MSICODE_PRODUCT, 0, &id, label, &labelsz, prompt, &promptsz); ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r); ok(id == 1, "Expected 1, got %lu\n", id); ok(!lstrcmpA(label, "label"), "Expected \"label\", got \"%s\"\n", label); @@ -2780,9 +2477,8 @@ static void test_MsiSourceListEnumMediaDisks(void) labelsz = MAX_PATH; lstrcpyA(prompt, "bbb"); promptsz = MAX_PATH; - r = pMsiSourceListEnumMediaDisksA(prodcode, usersid, MSIINSTALLCONTEXT_USERUNMANAGED, - MSICODE_PRODUCT, 2, &id, label, &labelsz, - prompt, &promptsz); + r = MsiSourceListEnumMediaDisksA(prodcode, usersid, MSIINSTALLCONTEXT_USERUNMANAGED, + MSICODE_PRODUCT, 2, &id, label, &labelsz, prompt, &promptsz); ok(r == ERROR_INVALID_PARAMETER, "Expected ERROR_INVALID_PARAMETER, got %d\n", r); ok(id == 0xbeef, "Expected 0xbeef, got %lu\n", id); ok(!lstrcmpA(label, "aaa"), "Expected \"aaa\", got \"%s\"\n", label); @@ -2796,9 +2492,8 @@ static void test_MsiSourceListEnumMediaDisks(void) labelsz = MAX_PATH; lstrcpyA(prompt, "bbb"); promptsz = MAX_PATH; - r = pMsiSourceListEnumMediaDisksA(prodcode, usersid, MSIINSTALLCONTEXT_USERUNMANAGED, - MSICODE_PRODUCT, 1, &id, label, &labelsz, - prompt, &promptsz); + r = MsiSourceListEnumMediaDisksA(prodcode, usersid, MSIINSTALLCONTEXT_USERUNMANAGED, + MSICODE_PRODUCT, 1, &id, label, &labelsz, prompt, &promptsz); ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r); ok(id == 2, "Expected 2, got %lu\n", id); ok(!lstrcmpA(label, "one"), "Expected \"one\", got \"%s\"\n", label); @@ -2812,9 +2507,8 @@ static void test_MsiSourceListEnumMediaDisks(void) labelsz = MAX_PATH; lstrcpyA(prompt, "bbb"); promptsz = MAX_PATH; - r = pMsiSourceListEnumMediaDisksA(prodcode, usersid, MSIINSTALLCONTEXT_USERUNMANAGED, - MSICODE_PRODUCT, 1, &id, label, &labelsz, - prompt, &promptsz); + r = MsiSourceListEnumMediaDisksA(prodcode, usersid, MSIINSTALLCONTEXT_USERUNMANAGED, + MSICODE_PRODUCT, 1, &id, label, &labelsz, prompt, &promptsz); ok(r == ERROR_INVALID_PARAMETER, "Expected ERROR_INVALID_PARAMETER, got %d\n", r); ok(id == 0xbeef, "Expected 0xbeef, got %lu\n", id); ok(!lstrcmpA(label, "aaa"), "Expected \"aaa\", got \"%s\"\n", label); @@ -2827,9 +2521,8 @@ static void test_MsiSourceListEnumMediaDisks(void) labelsz = MAX_PATH; lstrcpyA(prompt, "bbb"); promptsz = MAX_PATH; - r = pMsiSourceListEnumMediaDisksA(prodcode, usersid, MSIINSTALLCONTEXT_USERUNMANAGED, - MSICODE_PRODUCT, 0, NULL, label, &labelsz, - prompt, &promptsz); + r = MsiSourceListEnumMediaDisksA(prodcode, usersid, MSIINSTALLCONTEXT_USERUNMANAGED, + MSICODE_PRODUCT, 0, NULL, label, &labelsz, prompt, &promptsz); ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r); ok(!lstrcmpA(label, "label"), "Expected \"label\", got \"%s\"\n", label); ok(labelsz == 5, "Expected 5, got %lu\n", labelsz); @@ -2841,9 +2534,8 @@ static void test_MsiSourceListEnumMediaDisks(void) labelsz = MAX_PATH; lstrcpyA(prompt, "bbb"); promptsz = MAX_PATH; - r = pMsiSourceListEnumMediaDisksA(prodcode, usersid, MSIINSTALLCONTEXT_USERUNMANAGED, - MSICODE_PRODUCT, 0, &id, NULL, &labelsz, - prompt, &promptsz); + r = MsiSourceListEnumMediaDisksA(prodcode, usersid, MSIINSTALLCONTEXT_USERUNMANAGED, + MSICODE_PRODUCT, 0, &id, NULL, &labelsz, prompt, &promptsz); ok(r == ERROR_SUCCESS || r == ERROR_INVALID_PARAMETER, "Expected ERROR_SUCCESS or ERROR_INVALID_PARAMETER, got %d\n", r); if (r == ERROR_SUCCESS) @@ -2858,9 +2550,8 @@ static void test_MsiSourceListEnumMediaDisks(void) id = 0; lstrcpyA(prompt, "bbb"); promptsz = MAX_PATH; - r = pMsiSourceListEnumMediaDisksA(prodcode, usersid, MSIINSTALLCONTEXT_USERUNMANAGED, - MSICODE_PRODUCT, 0, &id, NULL, NULL, - prompt, &promptsz); + r = MsiSourceListEnumMediaDisksA(prodcode, usersid, MSIINSTALLCONTEXT_USERUNMANAGED, + MSICODE_PRODUCT, 0, &id, NULL, NULL, prompt, &promptsz); ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r); ok(id == 1, "Expected 1, got %lu\n", id); ok(!lstrcmpA(prompt, "prompt"), "Expected \"prompt\", got \"%s\"\n", prompt); @@ -2871,9 +2562,8 @@ static void test_MsiSourceListEnumMediaDisks(void) lstrcpyA(label, "aaa"); lstrcpyA(prompt, "bbb"); promptsz = MAX_PATH; - r = pMsiSourceListEnumMediaDisksA(prodcode, usersid, MSIINSTALLCONTEXT_USERUNMANAGED, - MSICODE_PRODUCT, 0, &id, label, NULL, - prompt, &promptsz); + r = MsiSourceListEnumMediaDisksA(prodcode, usersid, MSIINSTALLCONTEXT_USERUNMANAGED, + MSICODE_PRODUCT, 0, &id, label, NULL, prompt, &promptsz); ok(r == ERROR_SUCCESS || r == ERROR_INVALID_PARAMETER, "Expected ERROR_SUCCESS or ERROR_INVALID_PARAMETER, got %d\n", r); if (r == ERROR_SUCCESS) @@ -2889,9 +2579,8 @@ static void test_MsiSourceListEnumMediaDisks(void) lstrcpyA(label, "aaa"); labelsz = MAX_PATH; promptsz = MAX_PATH; - r = pMsiSourceListEnumMediaDisksA(prodcode, usersid, MSIINSTALLCONTEXT_USERUNMANAGED, - MSICODE_PRODUCT, 0, &id, label, &labelsz, - NULL, &promptsz); + r = MsiSourceListEnumMediaDisksA(prodcode, usersid, MSIINSTALLCONTEXT_USERUNMANAGED, + MSICODE_PRODUCT, 0, &id, label, &labelsz, NULL, &promptsz); ok(r == ERROR_SUCCESS || r == ERROR_INVALID_PARAMETER, "Expected ERROR_SUCCESS, got %d\n", r); if (r == ERROR_SUCCESS) { @@ -2905,9 +2594,8 @@ static void test_MsiSourceListEnumMediaDisks(void) id = 0; lstrcpyA(label, "aaa"); labelsz = MAX_PATH; - r = pMsiSourceListEnumMediaDisksA(prodcode, usersid, MSIINSTALLCONTEXT_USERUNMANAGED, - MSICODE_PRODUCT, 0, &id, label, &labelsz, - NULL, NULL); + r = MsiSourceListEnumMediaDisksA(prodcode, usersid, MSIINSTALLCONTEXT_USERUNMANAGED, + MSICODE_PRODUCT, 0, &id, label, &labelsz, NULL, NULL); ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r); ok(id == 1, "Expected 1, got %lu\n", id); ok(!lstrcmpA(label, "label"), "Expected \"label\", got \"%s\"\n", label); @@ -2918,11 +2606,9 @@ static void test_MsiSourceListEnumMediaDisks(void) lstrcpyA(label, "aaa"); labelsz = MAX_PATH; lstrcpyA(prompt, "bbb"); - r = pMsiSourceListEnumMediaDisksA(prodcode, usersid, MSIINSTALLCONTEXT_USERUNMANAGED, - MSICODE_PRODUCT, 0, &id, label, &labelsz, - prompt, NULL); - ok(r == ERROR_INVALID_PARAMETER, - "Expected ERROR_INVALID_PARAMETER, got %d\n", r); + r = MsiSourceListEnumMediaDisksA(prodcode, usersid, MSIINSTALLCONTEXT_USERUNMANAGED, + MSICODE_PRODUCT, 0, &id, label, &labelsz, prompt, NULL); + ok(r == ERROR_INVALID_PARAMETER, "Expected ERROR_INVALID_PARAMETER, got %d\n", r); ok(id == 0xbeef, "Expected 0xbeef, got %lu\n", id); ok(!lstrcmpA(label, "aaa"), "Expected \"aaa\", got \"%s\"\n", label); ok(labelsz == MAX_PATH, "Expected MAX_PATH, got %lu\n", labelsz); @@ -2931,18 +2617,16 @@ static void test_MsiSourceListEnumMediaDisks(void) /* pcchVolumeLabel, szDiskPrompt and pcchDiskPrompt are NULL */ id = 0; lstrcpyA(label, "aaa"); - r = pMsiSourceListEnumMediaDisksA(prodcode, usersid, MSIINSTALLCONTEXT_USERUNMANAGED, - MSICODE_PRODUCT, 0, &id, label, NULL, - NULL, NULL); + r = MsiSourceListEnumMediaDisksA(prodcode, usersid, MSIINSTALLCONTEXT_USERUNMANAGED, + MSICODE_PRODUCT, 0, &id, label, NULL, NULL, NULL); ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r); ok(!lstrcmpA(label, "aaa"), "Expected \"aaa\", got \"%s\"\n", label); ok(id == 1, "Expected 1, got %lu\n", id); /* szVolumeLabel, pcchVolumeLabel, szDiskPrompt and pcchDiskPrompt are NULL */ id = 0; - r = pMsiSourceListEnumMediaDisksA(prodcode, usersid, MSIINSTALLCONTEXT_USERUNMANAGED, - MSICODE_PRODUCT, 0, &id, NULL, NULL, - NULL, NULL); + r = MsiSourceListEnumMediaDisksA(prodcode, usersid, MSIINSTALLCONTEXT_USERUNMANAGED, + MSICODE_PRODUCT, 0, &id, NULL, NULL, NULL, NULL); ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r); ok(id == 1, "Expected 1, got %lu\n", id); @@ -2951,9 +2635,8 @@ static void test_MsiSourceListEnumMediaDisks(void) labelsz = 5; lstrcpyA(prompt, "bbb"); promptsz = MAX_PATH; - r = pMsiSourceListEnumMediaDisksA(prodcode, usersid, MSIINSTALLCONTEXT_USERUNMANAGED, - MSICODE_PRODUCT, 0, NULL, label, &labelsz, - prompt, &promptsz); + r = MsiSourceListEnumMediaDisksA(prodcode, usersid, MSIINSTALLCONTEXT_USERUNMANAGED, + MSICODE_PRODUCT, 0, NULL, label, &labelsz, prompt, &promptsz); ok(r == ERROR_MORE_DATA, "Expected ERROR_MORE_DATA, got %d\n", r); ok(!lstrcmpA(label, "aaa"), "Expected \"aaa\", got \"%s\"\n", label); ok(labelsz == 5, "Expected 5, got %lu\n", labelsz); @@ -2965,9 +2648,8 @@ static void test_MsiSourceListEnumMediaDisks(void) labelsz = MAX_PATH; lstrcpyA(prompt, "bbb"); promptsz = 6; - r = pMsiSourceListEnumMediaDisksA(prodcode, usersid, MSIINSTALLCONTEXT_USERUNMANAGED, - MSICODE_PRODUCT, 0, NULL, label, &labelsz, - prompt, &promptsz); + r = MsiSourceListEnumMediaDisksA(prodcode, usersid, MSIINSTALLCONTEXT_USERUNMANAGED, + MSICODE_PRODUCT, 0, NULL, label, &labelsz, prompt, &promptsz); ok(r == ERROR_MORE_DATA, "Expected ERROR_MORE_DATA, got %d\n", r); ok(!lstrcmpA(label, "aaa"), "Expected \"aaa\", got \"%s\"\n", label); ok(labelsz == 5, "Expected 5, got %lu\n", labelsz); @@ -2983,9 +2665,8 @@ static void test_MsiSourceListEnumMediaDisks(void) labelsz = MAX_PATH; lstrcpyA(prompt, "bbb"); promptsz = MAX_PATH; - r = pMsiSourceListEnumMediaDisksA(prodcode, usersid, MSIINSTALLCONTEXT_USERUNMANAGED, - MSICODE_PRODUCT, 0, &id, label, &labelsz, - prompt, &promptsz); + r = MsiSourceListEnumMediaDisksA(prodcode, usersid, MSIINSTALLCONTEXT_USERUNMANAGED, + MSICODE_PRODUCT, 0, &id, label, &labelsz, prompt, &promptsz); ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r); ok(id == 1, "Expected 1, got %lu\n", id); ok(!lstrcmpA(label, "label"), "Expected \"label\", got \"%s\"\n", label); @@ -3002,9 +2683,8 @@ static void test_MsiSourceListEnumMediaDisks(void) labelsz = MAX_PATH; lstrcpyA(prompt, "bbb"); promptsz = MAX_PATH; - r = pMsiSourceListEnumMediaDisksA(prodcode, usersid, MSIINSTALLCONTEXT_USERUNMANAGED, - MSICODE_PRODUCT, 0, &id, label, &labelsz, - prompt, &promptsz); + r = MsiSourceListEnumMediaDisksA(prodcode, usersid, MSIINSTALLCONTEXT_USERUNMANAGED, + MSICODE_PRODUCT, 0, &id, label, &labelsz, prompt, &promptsz); ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r); ok(id == 1, "Expected 1, got %lu\n", id); ok(!lstrcmpA(label, "label"), "Expected \"label\", got \"%s\"\n", label); @@ -3021,9 +2701,8 @@ static void test_MsiSourceListEnumMediaDisks(void) labelsz = MAX_PATH; lstrcpyA(prompt, "bbb"); promptsz = MAX_PATH; - r = pMsiSourceListEnumMediaDisksA(prodcode, usersid, MSIINSTALLCONTEXT_USERUNMANAGED, - MSICODE_PRODUCT, 0, &id, label, &labelsz, - prompt, &promptsz); + r = MsiSourceListEnumMediaDisksA(prodcode, usersid, MSIINSTALLCONTEXT_USERUNMANAGED, + MSICODE_PRODUCT, 0, &id, label, &labelsz, prompt, &promptsz); ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r); ok(id == 1, "Expected 1, got %lu\n", id); ok(!lstrcmpA(label, ""), "Expected \"\", got \"%s\"\n", label); @@ -3040,9 +2719,8 @@ static void test_MsiSourceListEnumMediaDisks(void) labelsz = MAX_PATH; lstrcpyA(prompt, "bbb"); promptsz = MAX_PATH; - r = pMsiSourceListEnumMediaDisksA(prodcode, usersid, MSIINSTALLCONTEXT_USERUNMANAGED, - MSICODE_PRODUCT, 0, &id, label, &labelsz, - prompt, &promptsz); + r = MsiSourceListEnumMediaDisksA(prodcode, usersid, MSIINSTALLCONTEXT_USERUNMANAGED, + MSICODE_PRODUCT, 0, &id, label, &labelsz, prompt, &promptsz); ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r); ok(id == 1, "Expected 1, got %lu\n", id); ok(!lstrcmpA(label, ""), "Expected \"\", got \"%s\"\n", label); @@ -3060,9 +2738,8 @@ static void test_MsiSourceListEnumMediaDisks(void) labelsz = MAX_PATH; lstrcpyA(prompt, "bbb"); promptsz = MAX_PATH; - r = pMsiSourceListEnumMediaDisksA(prodcode, usersid, MSIINSTALLCONTEXT_USERUNMANAGED, - MSICODE_PRODUCT, 0, &id, label, &labelsz, - prompt, &promptsz); + r = MsiSourceListEnumMediaDisksA(prodcode, usersid, MSIINSTALLCONTEXT_USERUNMANAGED, + MSICODE_PRODUCT, 0, &id, label, &labelsz, prompt, &promptsz); ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r); ok(id == 1, "Expected 1, got %lu\n", id); ok(!lstrcmpA(label, "#42"), "Expected \"#42\", got \"%s\"\n", label); @@ -3095,11 +2772,9 @@ static void test_MsiSourceListEnumMediaDisks(void) } /* user product key exists */ - r = pMsiSourceListEnumMediaDisksA(prodcode, usersid, MSIINSTALLCONTEXT_USERMANAGED, - MSICODE_PRODUCT, 0, &id, label, &labelsz, - prompt, &promptsz); - ok(r == ERROR_BAD_CONFIGURATION, - "Expected ERROR_BAD_CONFIGURATION, got %d\n", r); + r = MsiSourceListEnumMediaDisksA(prodcode, usersid, MSIINSTALLCONTEXT_USERMANAGED, + MSICODE_PRODUCT, 0, &id, label, &labelsz, prompt, &promptsz); + ok(r == ERROR_BAD_CONFIGURATION, "Expected ERROR_BAD_CONFIGURATION, got %d\n", r); res = RegCreateKeyExA(userkey, "SourceList", 0, NULL, 0, access, NULL, &source, NULL); ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %ld\n", res); @@ -3110,11 +2785,9 @@ static void test_MsiSourceListEnumMediaDisks(void) labelsz = 0xdeadbeef; lstrcpyA(prompt, "bbb"); promptsz = 0xdeadbeef; - r = pMsiSourceListEnumMediaDisksA(prodcode, usersid, MSIINSTALLCONTEXT_USERMANAGED, - MSICODE_PRODUCT, 0, &id, label, &labelsz, - prompt, &promptsz); - ok(r == ERROR_NO_MORE_ITEMS, - "Expected ERROR_NO_MORE_ITEMS, got %d\n", r); + r = MsiSourceListEnumMediaDisksA(prodcode, usersid, MSIINSTALLCONTEXT_USERMANAGED, + MSICODE_PRODUCT, 0, &id, label, &labelsz, prompt, &promptsz); + ok(r == ERROR_NO_MORE_ITEMS, "Expected ERROR_NO_MORE_ITEMS, got %d\n", r); ok(id == 0xbeef, "Expected 0xbeef, got %lu\n", id); ok(!lstrcmpA(label, "aaa"), "Expected \"aaa\", got \"%s\"\n", label); ok(labelsz == 0xdeadbeef, "Expected 0xdeadbeef, got %lu\n", labelsz); @@ -3130,11 +2803,9 @@ static void test_MsiSourceListEnumMediaDisks(void) labelsz = 0xdeadbeef; lstrcpyA(prompt, "bbb"); promptsz = 0xdeadbeef; - r = pMsiSourceListEnumMediaDisksA(prodcode, usersid, MSIINSTALLCONTEXT_USERMANAGED, - MSICODE_PRODUCT, 0, &id, label, &labelsz, - prompt, &promptsz); - ok(r == ERROR_NO_MORE_ITEMS, - "Expected ERROR_NO_MORE_ITEMS, got %d\n", r); + r = MsiSourceListEnumMediaDisksA(prodcode, usersid, MSIINSTALLCONTEXT_USERMANAGED, + MSICODE_PRODUCT, 0, &id, label, &labelsz, prompt, &promptsz); + ok(r == ERROR_NO_MORE_ITEMS, "Expected ERROR_NO_MORE_ITEMS, got %d\n", r); ok(id == 0xbeef, "Expected 0xbeef, got %lu\n", id); ok(!lstrcmpA(label, "aaa"), "Expected \"aaa\", got \"%s\"\n", label); ok(labelsz == 0xdeadbeef, "Expected 0xdeadbeef, got %lu\n", labelsz); @@ -3150,9 +2821,8 @@ static void test_MsiSourceListEnumMediaDisks(void) labelsz = MAX_PATH; lstrcpyA(prompt, "bbb"); promptsz = MAX_PATH; - r = pMsiSourceListEnumMediaDisksA(prodcode, usersid, MSIINSTALLCONTEXT_USERMANAGED, - MSICODE_PRODUCT, 0, &id, label, &labelsz, - prompt, &promptsz); + r = MsiSourceListEnumMediaDisksA(prodcode, usersid, MSIINSTALLCONTEXT_USERMANAGED, + MSICODE_PRODUCT, 0, &id, label, &labelsz, prompt, &promptsz); ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r); ok(id == 2, "Expected 2, got %lu\n", id); ok(!lstrcmpA(label, "label"), "Expected \"label\", got \"%s\"\n", label); @@ -3161,11 +2831,11 @@ static void test_MsiSourceListEnumMediaDisks(void) ok(promptsz == 6, "Expected 6, got %lu\n", promptsz); RegDeleteValueA(media, "2"); - delete_key(media, "", access); + RegDeleteKeyExA(media, "", access, 0); RegCloseKey(media); - delete_key(source, "", access); + RegDeleteKeyExA(source, "", access, 0); RegCloseKey(source); - delete_key(userkey, "", access); + RegDeleteKeyExA(userkey, "", access, 0); RegCloseKey(userkey); /* MSIINSTALLCONTEXT_MACHINE */ @@ -3183,11 +2853,9 @@ static void test_MsiSourceListEnumMediaDisks(void) } /* machine product key exists */ - r = pMsiSourceListEnumMediaDisksA(prodcode, NULL, MSIINSTALLCONTEXT_MACHINE, - MSICODE_PRODUCT, 0, &id, label, &labelsz, - prompt, &promptsz); - ok(r == ERROR_BAD_CONFIGURATION, - "Expected ERROR_BAD_CONFIGURATION, got %d\n", r); + r = MsiSourceListEnumMediaDisksA(prodcode, NULL, MSIINSTALLCONTEXT_MACHINE, + MSICODE_PRODUCT, 0, &id, label, &labelsz, prompt, &promptsz); + ok(r == ERROR_BAD_CONFIGURATION, "Expected ERROR_BAD_CONFIGURATION, got %d\n", r); res = RegCreateKeyExA(prodkey, "SourceList", 0, NULL, 0, access, NULL, &source, NULL); ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %ld\n", res); @@ -3198,11 +2866,9 @@ static void test_MsiSourceListEnumMediaDisks(void) labelsz = 0xdeadbeef; lstrcpyA(prompt, "bbb"); promptsz = 0xdeadbeef; - r = pMsiSourceListEnumMediaDisksA(prodcode, NULL, MSIINSTALLCONTEXT_MACHINE, - MSICODE_PRODUCT, 0, &id, label, &labelsz, - prompt, &promptsz); - ok(r == ERROR_NO_MORE_ITEMS, - "Expected ERROR_NO_MORE_ITEMS, got %d\n", r); + r = MsiSourceListEnumMediaDisksA(prodcode, NULL, MSIINSTALLCONTEXT_MACHINE, + MSICODE_PRODUCT, 0, &id, label, &labelsz, prompt, &promptsz); + ok(r == ERROR_NO_MORE_ITEMS, "Expected ERROR_NO_MORE_ITEMS, got %d\n", r); ok(id == 0xbeef, "Expected 0xbeef, got %lu\n", id); ok(!lstrcmpA(label, "aaa"), "Expected \"aaa\", got \"%s\"\n", label); ok(labelsz == 0xdeadbeef, "Expected 0xdeadbeef, got %lu\n", labelsz); @@ -3218,11 +2884,9 @@ static void test_MsiSourceListEnumMediaDisks(void) labelsz = 0xdeadbeef; lstrcpyA(prompt, "bbb"); promptsz = 0xdeadbeef; - r = pMsiSourceListEnumMediaDisksA(prodcode, NULL, MSIINSTALLCONTEXT_MACHINE, - MSICODE_PRODUCT, 0, &id, label, &labelsz, - prompt, &promptsz); - ok(r == ERROR_NO_MORE_ITEMS, - "Expected ERROR_NO_MORE_ITEMS, got %d\n", r); + r = MsiSourceListEnumMediaDisksA(prodcode, NULL, MSIINSTALLCONTEXT_MACHINE, + MSICODE_PRODUCT, 0, &id, label, &labelsz, prompt, &promptsz); + ok(r == ERROR_NO_MORE_ITEMS, "Expected ERROR_NO_MORE_ITEMS, got %d\n", r); ok(id == 0xbeef, "Expected 0xbeef, got %lu\n", id); ok(!lstrcmpA(label, "aaa"), "Expected \"aaa\", got \"%s\"\n", label); ok(labelsz == 0xdeadbeef, "Expected 0xdeadbeef, got %lu\n", labelsz); @@ -3238,9 +2902,8 @@ static void test_MsiSourceListEnumMediaDisks(void) labelsz = MAX_PATH; lstrcpyA(prompt, "bbb"); promptsz = MAX_PATH; - r = pMsiSourceListEnumMediaDisksA(prodcode, NULL, MSIINSTALLCONTEXT_MACHINE, - MSICODE_PRODUCT, 0, &id, label, &labelsz, - prompt, &promptsz); + r = MsiSourceListEnumMediaDisksA(prodcode, NULL, MSIINSTALLCONTEXT_MACHINE, + MSICODE_PRODUCT, 0, &id, label, &labelsz, prompt, &promptsz); ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r); ok(id == 2, "Expected 2, got %lu\n", id); ok(!lstrcmpA(label, "label"), "Expected \"label\", got \"%s\"\n", label); @@ -3254,11 +2917,9 @@ static void test_MsiSourceListEnumMediaDisks(void) labelsz = MAX_PATH; lstrcpyA(prompt, "bbb"); promptsz = MAX_PATH; - r = pMsiSourceListEnumMediaDisksA(prodcode, usersid, MSIINSTALLCONTEXT_MACHINE, - MSICODE_PRODUCT, 0, &id, label, &labelsz, - prompt, &promptsz); - ok(r == ERROR_INVALID_PARAMETER, - "Expected ERROR_INVALID_PARAMETER, got %d\n", r); + r = MsiSourceListEnumMediaDisksA(prodcode, usersid, MSIINSTALLCONTEXT_MACHINE, + MSICODE_PRODUCT, 0, &id, label, &labelsz, prompt, &promptsz); + ok(r == ERROR_INVALID_PARAMETER, "Expected ERROR_INVALID_PARAMETER, got %d\n", r); ok(id == 0xbeef, "Expected 0xbeef, got %lu\n", id); ok(!lstrcmpA(label, "aaa"), "Expected \"aaa\", got \"%s\"\n", label); ok(labelsz == MAX_PATH, "Expected MAX_PATH, got %lu\n", labelsz); @@ -3266,11 +2927,11 @@ static void test_MsiSourceListEnumMediaDisks(void) ok(promptsz == MAX_PATH, "Expected MAX_PATH, got %lu\n", promptsz); RegDeleteValueA(media, "2"); - delete_key(media, "", access); + RegDeleteKeyExA(media, "", access, 0); RegCloseKey(media); - delete_key(source, "", access); + RegDeleteKeyExA(source, "", access, 0); RegCloseKey(source); - delete_key(prodkey, "", access); + RegDeleteKeyExA(prodkey, "", access, 0); RegCloseKey(prodkey); LocalFree(usersid); } @@ -3288,12 +2949,7 @@ static void test_MsiSourceListAddSource(void) DWORD size; REGSAM access = KEY_ALL_ACCESS; - if (!pMsiSourceListAddSourceA) - { - win_skip("Skipping MsiSourceListAddSourceA tests\n"); - return; - } - if (is_process_limited()) + if (!is_process_elevated()) { skip("process is limited\n"); return; @@ -3317,40 +2973,40 @@ static void test_MsiSourceListAddSource(void) /* GetLastError is not set by the function */ /* NULL szProduct */ - r = pMsiSourceListAddSourceA(NULL, username, 0, "source"); + r = MsiSourceListAddSourceA(NULL, username, 0, "source"); ok(r == ERROR_INVALID_PARAMETER, "Expected ERROR_INVALID_PARAMETER, got %d\n", r); /* empty szProduct */ - r = pMsiSourceListAddSourceA("", username, 0, "source"); + r = MsiSourceListAddSourceA("", username, 0, "source"); ok(r == ERROR_INVALID_PARAMETER, "Expected ERROR_INVALID_PARAMETER, got %d\n", r); /* garbage szProduct */ - r = pMsiSourceListAddSourceA("garbage", username, 0, "source"); + r = MsiSourceListAddSourceA("garbage", username, 0, "source"); ok(r == ERROR_INVALID_PARAMETER, "Expected ERROR_INVALID_PARAMETER, got %d\n", r); /* guid without brackets */ - r = pMsiSourceListAddSourceA("51CD2AD5-0482-4C46-8DDD-0ED1022AA1AA", username, 0, "source"); + r = MsiSourceListAddSourceA("51CD2AD5-0482-4C46-8DDD-0ED1022AA1AA", username, 0, "source"); ok(r == ERROR_INVALID_PARAMETER, "Expected ERROR_INVALID_PARAMETER, got %d\n", r); /* guid with brackets */ - r = pMsiSourceListAddSourceA("{51CD2AD5-0482-4C46-8DDD-0ED1022AA1AA}", username, 0, "source"); + r = MsiSourceListAddSourceA("{51CD2AD5-0482-4C46-8DDD-0ED1022AA1AA}", username, 0, "source"); ok(r == ERROR_UNKNOWN_PRODUCT, "Expected ERROR_UNKNOWN_PRODUCT, got %d\n", r); /* dwReserved is not 0 */ - r = pMsiSourceListAddSourceA(prodcode, username, 42, "source"); + r = MsiSourceListAddSourceA(prodcode, username, 42, "source"); ok(r == ERROR_INVALID_PARAMETER, "Expected ERROR_INVALID_PARAMETER, got %d\n", r); /* szSource is NULL */ - r = pMsiSourceListAddSourceA(prodcode, username, 0, NULL); + r = MsiSourceListAddSourceA(prodcode, username, 0, NULL); ok(r == ERROR_INVALID_PARAMETER, "Expected ERROR_INVALID_PARAMETER, got %d\n", r); /* szSource is empty */ - r = pMsiSourceListAddSourceA(prodcode, username, 0, ""); + r = MsiSourceListAddSourceA(prodcode, username, 0, ""); ok(r == ERROR_INVALID_PARAMETER, "Expected ERROR_INVALID_PARAMETER, got %d\n", r); /* MSIINSTALLCONTEXT_USERMANAGED */ - r = pMsiSourceListAddSourceA(prodcode, username, 0, "source"); + r = MsiSourceListAddSourceA(prodcode, username, 0, "source"); ok(r == ERROR_UNKNOWN_PRODUCT, "Expected ERROR_UNKNOWN_PRODUCT, got %d\n", r); lstrcpyA(keypath, "Software\\Microsoft\\Windows\\CurrentVersion\\Installer\\Managed\\"); @@ -3366,14 +3022,14 @@ static void test_MsiSourceListAddSource(void) } /* user product key exists */ - r = pMsiSourceListAddSourceA(prodcode, username, 0, "source"); + r = MsiSourceListAddSourceA(prodcode, username, 0, "source"); ok(r == ERROR_BAD_CONFIGURATION, "Expected ERROR_BAD_CONFIGURATION, got %d\n", r); res = RegCreateKeyExA(userkey, "SourceList", 0, NULL, 0, access, NULL, &source, NULL); ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %ld\n", res); /* SourceList key exists */ - r = pMsiSourceListAddSourceA(prodcode, username, 0, "source"); + r = MsiSourceListAddSourceA(prodcode, username, 0, "source"); ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r); /* Net key is created */ @@ -3387,14 +3043,14 @@ static void test_MsiSourceListAddSource(void) CHECK_REG_STR(net, "1", "source\\"); RegDeleteValueA(net, "1"); - delete_key(net, "", access); + RegDeleteKeyExA(net, "", access, 0); RegCloseKey(net); res = RegSetValueExA(source, "LastUsedSource", 0, REG_SZ, (LPBYTE)"blah", 5); ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %ld\n", res); /* LastUsedSource value exists */ - r = pMsiSourceListAddSourceA(prodcode, username, 0, "source"); + r = MsiSourceListAddSourceA(prodcode, username, 0, "source"); ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r); /* Net key is created */ @@ -3405,14 +3061,14 @@ static void test_MsiSourceListAddSource(void) CHECK_REG_STR(net, "1", "source\\"); RegDeleteValueA(net, "1"); - delete_key(net, "", access); + RegDeleteKeyExA(net, "", access, 0); RegCloseKey(net); res = RegSetValueExA(source, "LastUsedSource", 0, REG_SZ, (LPBYTE)"5", 2); ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %ld\n", res); /* LastUsedSource is an integer */ - r = pMsiSourceListAddSourceA(prodcode, username, 0, "source"); + r = MsiSourceListAddSourceA(prodcode, username, 0, "source"); ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r); /* Net key is created */ @@ -3423,7 +3079,7 @@ static void test_MsiSourceListAddSource(void) CHECK_REG_STR(net, "1", "source\\"); /* Add a second source, has trailing backslash */ - r = pMsiSourceListAddSourceA(prodcode, username, 0, "another\\"); + r = MsiSourceListAddSourceA(prodcode, username, 0, "another\\"); ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r); CHECK_REG_STR(source, "LastUsedSource", "5"); @@ -3434,7 +3090,7 @@ static void test_MsiSourceListAddSource(void) ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %ld\n", res); /* LastUsedSource is in the source list */ - r = pMsiSourceListAddSourceA(prodcode, username, 0, "third/"); + r = MsiSourceListAddSourceA(prodcode, username, 0, "third/"); ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r); CHECK_REG_STR(source, "LastUsedSource", "2"); @@ -3445,17 +3101,17 @@ static void test_MsiSourceListAddSource(void) RegDeleteValueA(net, "1"); RegDeleteValueA(net, "2"); RegDeleteValueA(net, "3"); - delete_key(net, "", access); + RegDeleteKeyExA(net, "", access, 0); RegCloseKey(net); - delete_key(source, "", access); + RegDeleteKeyExA(source, "", access, 0); RegCloseKey(source); - delete_key(userkey, "", access); + RegDeleteKeyExA(userkey, "", access, 0); RegCloseKey(userkey); /* MSIINSTALLCONTEXT_USERUNMANAGED */ userunmanaged_tests: - r = pMsiSourceListAddSourceA(prodcode, username, 0, "source"); + r = MsiSourceListAddSourceA(prodcode, username, 0, "source"); ok(r == ERROR_UNKNOWN_PRODUCT, "Expected ERROR_UNKNOWN_PRODUCT, got %d\n", r); lstrcpyA(keypath, "Software\\Microsoft\\Installer\\Products\\"); @@ -3469,14 +3125,14 @@ static void test_MsiSourceListAddSource(void) } /* user product key exists */ - r = pMsiSourceListAddSourceA(prodcode, username, 0, "source"); + r = MsiSourceListAddSourceA(prodcode, username, 0, "source"); ok(r == ERROR_BAD_CONFIGURATION, "Expected ERROR_BAD_CONFIGURATION, got %d\n", r); res = RegCreateKeyA(userkey, "SourceList", &source); ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %ld\n", res); /* SourceList key exists */ - r = pMsiSourceListAddSourceA(prodcode, username, 0, "source"); + r = MsiSourceListAddSourceA(prodcode, username, 0, "source"); ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r); /* Net key is created */ @@ -3496,7 +3152,7 @@ static void test_MsiSourceListAddSource(void) /* MSIINSTALLCONTEXT_MACHINE */ machine_tests: - r = pMsiSourceListAddSourceA(prodcode, NULL, 0, "source"); + r = MsiSourceListAddSourceA(prodcode, NULL, 0, "source"); ok(r == ERROR_UNKNOWN_PRODUCT, "Expected ERROR_UNKNOWN_PRODUCT, got %d\n", r); lstrcpyA(keypath, "Software\\Classes\\Installer\\Products\\"); @@ -3511,14 +3167,14 @@ static void test_MsiSourceListAddSource(void) } /* machine product key exists */ - r = pMsiSourceListAddSourceA(prodcode, NULL, 0, "source"); + r = MsiSourceListAddSourceA(prodcode, NULL, 0, "source"); ok(r == ERROR_BAD_CONFIGURATION, "Expected ERROR_BAD_CONFIGURATION, got %d\n", r); res = RegCreateKeyExA(prodkey, "SourceList", 0, NULL, 0, access, NULL, &source, NULL); ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %ld\n", res); /* SourceList key exists */ - r = pMsiSourceListAddSourceA(prodcode, NULL, 0, "source"); + r = MsiSourceListAddSourceA(prodcode, NULL, 0, "source"); ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r); /* Net key is created */ @@ -3533,7 +3189,7 @@ static void test_MsiSourceListAddSource(void) CHECK_REG_STR(net, "1", "source\\"); /* empty szUserName */ - r = pMsiSourceListAddSourceA(prodcode, "", 0, "another"); + r = MsiSourceListAddSourceA(prodcode, "", 0, "another"); ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r); CHECK_REG_STR(net, "1", "source\\"); @@ -3541,23 +3197,22 @@ static void test_MsiSourceListAddSource(void) RegDeleteValueA(net, "2"); RegDeleteValueA(net, "1"); - delete_key(net, "", access); + RegDeleteKeyExA(net, "", access, 0); RegCloseKey(net); done: - delete_key(source, "", access); + RegDeleteKeyExA(source, "", access, 0); RegCloseKey(source); - delete_key(prodkey, "", access); + RegDeleteKeyExA(prodkey, "", access, 0); RegCloseKey(prodkey); LocalFree(usersid); } START_TEST(source) { - init_functionpointers(); + if (!is_process_elevated()) restart_as_admin_elevated(); - if (pIsWow64Process) - pIsWow64Process(GetCurrentProcess(), &is_wow64); + IsWow64Process(GetCurrentProcess(), &is_wow64); test_MsiSourceListGetInfo(); test_MsiSourceListAddSourceEx(); diff --git a/modules/rostests/winetests/msi/suminfo.c b/modules/rostests/winetests/msi/suminfo.c index 6053248a7c462..59b56a2cbbafc 100644 --- a/modules/rostests/winetests/msi/suminfo.c +++ b/modules/rostests/winetests/msi/suminfo.c @@ -343,45 +343,45 @@ static void test_create_database_binary(void) ok( r == S_OK, "failed to set class\n"); propspec[0].ulKind = PRSPEC_PROPID; - U(propspec[0]).propid = PID_TITLE; + propspec[0].propid = PID_TITLE; propvar[0].vt = VT_LPSTR; - U(propvar[0]).pszVal = LOSE_CONST("test title"); + propvar[0].pszVal = LOSE_CONST("test title"); propspec[1].ulKind = PRSPEC_PROPID; - U(propspec[1]).propid = PID_SUBJECT; + propspec[1].propid = PID_SUBJECT; propvar[1].vt = VT_LPSTR; - U(propvar[1]).pszVal = LOSE_CONST("msi suminfo / property storage test"); + propvar[1].pszVal = LOSE_CONST("msi suminfo / property storage test"); propspec[2].ulKind = PRSPEC_PROPID; - U(propspec[2]).propid = PID_AUTHOR; + propspec[2].propid = PID_AUTHOR; propvar[2].vt = VT_LPSTR; - U(propvar[2]).pszVal = LOSE_CONST("mike_m"); + propvar[2].pszVal = LOSE_CONST("mike_m"); propspec[3].ulKind = PRSPEC_PROPID; - U(propspec[3]).propid = PID_TEMPLATE; + propspec[3].propid = PID_TEMPLATE; propvar[3].vt = VT_LPSTR; - U(propvar[3]).pszVal = LOSE_CONST(";1033"); /* actually the string table's codepage */ + propvar[3].pszVal = LOSE_CONST(";1033"); /* actually the string table's codepage */ propspec[4].ulKind = PRSPEC_PROPID; - U(propspec[4]).propid = PID_REVNUMBER; + propspec[4].propid = PID_REVNUMBER; propvar[4].vt = VT_LPSTR; - U(propvar[4]).pszVal = LOSE_CONST("{913B8D18-FBB6-4CAC-A239-C74C11E3FA74}"); + propvar[4].pszVal = LOSE_CONST("{913B8D18-FBB6-4CAC-A239-C74C11E3FA74}"); propspec[5].ulKind = PRSPEC_PROPID; - U(propspec[5]).propid = PID_PAGECOUNT; + propspec[5].propid = PID_PAGECOUNT; propvar[5].vt = VT_I4; - U(propvar[5]).lVal = 100; + propvar[5].lVal = 100; propspec[6].ulKind = PRSPEC_PROPID; - U(propspec[6]).propid = PID_WORDCOUNT; + propspec[6].propid = PID_WORDCOUNT; propvar[6].vt = VT_I4; - U(propvar[6]).lVal = 0; + propvar[6].lVal = 0; /* MSDN says that PID_LASTPRINTED should be a VT_FILETIME... */ propspec[7].ulKind = PRSPEC_PROPID; - U(propspec[7]).propid = PID_LASTPRINTED; + propspec[7].propid = PID_LASTPRINTED; propvar[7].vt = VT_LPSTR; - U(propvar[7]).pszVal = LOSE_CONST("7/1/1999 5:17"); + propvar[7].pszVal = LOSE_CONST("7/1/1999 5:17"); r = IPropertyStorage_WriteMultiple( ps, 8, propspec, propvar, PID_FIRST_USABLE ); ok( r == S_OK, "failed to write properties\n"); diff --git a/modules/rostests/winetests/msi/utils.h b/modules/rostests/winetests/msi/utils.h index 0880553863e0e..3bcc575f2703c 100644 --- a/modules/rostests/winetests/msi/utils.h +++ b/modules/rostests/winetests/msi/utils.h @@ -56,5 +56,6 @@ 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); +BOOL is_process_elevated(void); UINT run_query(MSIHANDLE hdb, MSIHANDLE hrec, const char *query); +void restart_as_admin_elevated(void); diff --git a/sdk/include/psdk/msi.h b/sdk/include/psdk/msi.h index b79efaea5c655..b4c659460dc59 100644 --- a/sdk/include/psdk/msi.h +++ b/sdk/include/psdk/msi.h @@ -838,6 +838,10 @@ MsiGetComponentPathW( #define MsiGetComponentPath WINELIB_NAME_AW(MsiGetComponentPath) +INSTALLSTATE WINAPI MsiGetComponentPathExA(LPCSTR, LPCSTR, LPCSTR, MSIINSTALLCONTEXT, LPSTR, LPDWORD); +INSTALLSTATE WINAPI MsiGetComponentPathExW(LPCWSTR, LPCWSTR, LPCWSTR, MSIINSTALLCONTEXT, LPWSTR, LPDWORD); +#define MsiGetComponentPathEx WINELIB_NAME_AW(MsiGetComponentPathEx) + INSTALLSTATE WINAPI MsiQueryFeatureStateA(_In_ LPCSTR, _In_ LPCSTR); INSTALLSTATE WINAPI MsiQueryFeatureStateW(_In_ LPCWSTR, _In_ LPCWSTR); #define MsiQueryFeatureState WINELIB_NAME_AW(MsiQueryFeatureState) @@ -1060,7 +1064,7 @@ MsiGetUserInfoW( #define MsiGetUserInfo WINELIB_NAME_AW(MsiGetUserInfo) -UINT WINAPI MsiProvidedComponentA(LPCSTR, LPCSTR, LPCSTR, DWORD, LPSTR, LPDWORD); +UINT WINAPI MsiProvideComponentA(LPCSTR, LPCSTR, LPCSTR, DWORD, LPSTR, LPDWORD); UINT WINAPI MsiProvideComponentW(LPCWSTR, LPCWSTR, LPCWSTR, DWORD, LPWSTR, LPDWORD); #define MsiProvideComponent WINELIB_NAME_AW(MsiProvideComponent) diff --git a/sdk/tools/winesync/msi.cfg b/sdk/tools/winesync/msi.cfg index 31196a18ac0f7..623d422bd8860 100644 --- a/sdk/tools/winesync/msi.cfg +++ b/sdk/tools/winesync/msi.cfg @@ -7,4 +7,4 @@ files: include/msidefs.h: sdk/include/psdk/msidefs.h include/msiquery.h: sdk/include/psdk/msiquery.h tags: - wine: wine-7.3 + wine: wine-9.8 diff --git a/sdk/tools/winesync/msi_staging/0001-msi__Do_not_sign_extend_after_multiplying.diff b/sdk/tools/winesync/msi_staging/0001-msi__Do_not_sign_extend_after_multiplying.diff deleted file mode 100644 index 6f8e3524a5b67..0000000000000 --- a/sdk/tools/winesync/msi_staging/0001-msi__Do_not_sign_extend_after_multiplying.diff +++ /dev/null @@ -1,26 +0,0 @@ -diff --git a/sdk/tools/winesync/msi_staging/0001-msi__Do_not_sign_extend_after_multiplying.diff b/sdk/tools/winesync/msi_staging/0001-msi__Do_not_sign_extend_after_multiplying.diff -new file mode 100644 -index 00000000000..307428366a3 ---- /dev/null -+++ b/sdk/tools/winesync/msi_staging/0001-msi__Do_not_sign_extend_after_multiplying.diff -@@ -0,0 +1,20 @@ -+diff --git a/dll/win32/msi/dialog.c b/dll/win32/msi/dialog.c -+index 9d82be8..8e4c151 100644 -+--- a/dll/win32/msi/dialog.c -++++ b/dll/win32/msi/dialog.c -+@@ -3186,13 +3186,13 @@ static LONGLONG msi_vcl_get_cost( msi_dialog *dialog ) -+ MSICOSTTREE_SELFONLY, INSTALLSTATE_LOCAL, &each_cost))) -+ { -+ /* each_cost is in 512-byte units */ -+- total_cost += each_cost * 512; -++ total_cost += ((LONGLONG)each_cost) * 512; -+ } -+ if (ERROR_SUCCESS == (MSI_GetFeatureCost(dialog->package, feature, -+ MSICOSTTREE_SELFONLY, INSTALLSTATE_ABSENT, &each_cost))) -+ { -+ /* each_cost is in 512-byte units */ -+- total_cost -= each_cost * 512; -++ total_cost -= ((LONGLONG)each_cost) * 512; -+ } -+ } -+ return total_cost; diff --git a/sdk/tools/winesync/msi_staging/0002-msi__Create_the_custom_action_server_as_an_elevated_process.diff b/sdk/tools/winesync/msi_staging/0002-msi__Create_the_custom_action_server_as_an_elevated_process.diff deleted file mode 100644 index b94f8d0652666..0000000000000 --- a/sdk/tools/winesync/msi_staging/0002-msi__Create_the_custom_action_server_as_an_elevated_process.diff +++ /dev/null @@ -1,61 +0,0 @@ -diff --git a/dll/win32/msi/custom.c b/dll/win32/msi/custom.c -index 143de262971..f29699bd54b 100644 ---- a/dll/win32/msi/custom.c -+++ b/dll/win32/msi/custom.c -@@ -593,12 +593,35 @@ UINT CDECL __wine_msi_call_dll_function(DWORD client_pid, const GUID *guid) - return r; - } - -+static HANDLE get_admin_token(void) -+{ -+ TOKEN_ELEVATION_TYPE type; -+ TOKEN_LINKED_TOKEN linked; -+ DWORD size; -+ -+#ifdef __REACTOS__ -+#ifndef GetCurrentThreadEffectiveToken -+#define GetCurrentProcessToken() ((HANDLE)~(ULONG_PTR)3) -+#define GetCurrentThreadEffectiveToken() GetCurrentProcessToken() -+#endif -+#endif -+ -+ if (!GetTokenInformation(GetCurrentThreadEffectiveToken(), TokenElevationType, &type, sizeof(type), &size) -+ || type == TokenElevationTypeFull) -+ return NULL; -+ -+ if (!GetTokenInformation(GetCurrentThreadEffectiveToken(), TokenLinkedToken, &linked, sizeof(linked), &size)) -+ return NULL; -+ return linked.LinkedToken; -+} -+ - static DWORD custom_start_server(MSIPACKAGE *package, DWORD arch) - { - WCHAR path[MAX_PATH], cmdline[MAX_PATH + 23]; - PROCESS_INFORMATION pi = {0}; - STARTUPINFOW si = {0}; - WCHAR buffer[24]; -+ HANDLE token; - void *cookie; - HANDLE pipe; - -@@ -620,14 +643,18 @@ static DWORD custom_start_server(MSIPACKAGE *package, DWORD arch) - lstrcatW(path, L"\\msiexec.exe"); - swprintf(cmdline, ARRAY_SIZE(cmdline), L"%s -Embedding %d", path, GetCurrentProcessId()); - -+ token = get_admin_token(); -+ - if (is_wow64 && arch == SCS_64BIT_BINARY) - { - Wow64DisableWow64FsRedirection(&cookie); -- CreateProcessW(path, cmdline, NULL, NULL, FALSE, 0, NULL, NULL, &si, &pi); -+ CreateProcessAsUserW(token, path, cmdline, NULL, NULL, FALSE, 0, NULL, NULL, &si, &pi); - Wow64RevertWow64FsRedirection(cookie); - } - else -- CreateProcessW(path, cmdline, NULL, NULL, FALSE, 0, NULL, NULL, &si, &pi); -+ CreateProcessAsUserW(token, path, cmdline, NULL, NULL, FALSE, 0, NULL, NULL, &si, &pi); -+ -+ if (token) CloseHandle(token); - - CloseHandle(pi.hThread); -