Commit 3611398b authored by Hans Leidekker's avatar Hans Leidekker Committed by Alexandre Julliard

msi: Remove msi_ prefix from static functions.

parent d9d700f3
...@@ -3476,7 +3476,7 @@ static BOOL CALLBACK Typelib_EnumResNameProc( HMODULE hModule, LPCWSTR lpszType, ...@@ -3476,7 +3476,7 @@ static BOOL CALLBACK Typelib_EnumResNameProc( HMODULE hModule, LPCWSTR lpszType,
return TRUE; 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; HMODULE module;
msi_disable_fs_redirection( package ); msi_disable_fs_redirection( package );
...@@ -3485,7 +3485,7 @@ static HMODULE msi_load_library( MSIPACKAGE *package, const WCHAR *filename, DWO ...@@ -3485,7 +3485,7 @@ static HMODULE msi_load_library( MSIPACKAGE *package, const WCHAR *filename, DWO
return module; 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; HRESULT hr;
msi_disable_fs_redirection( package ); msi_disable_fs_redirection( package );
...@@ -3524,7 +3524,7 @@ static UINT ITERATE_RegisterTypeLibraries(MSIRECORD *row, LPVOID param) ...@@ -3524,7 +3524,7 @@ static UINT ITERATE_RegisterTypeLibraries(MSIRECORD *row, LPVOID param)
} }
MSI_ProcessMessage(package, INSTALLMESSAGE_ACTIONDATA, row); 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) if (module)
{ {
LPCWSTR guid; LPCWSTR guid;
...@@ -3561,7 +3561,7 @@ static UINT ITERATE_RegisterTypeLibraries(MSIRECORD *row, LPVOID param) ...@@ -3561,7 +3561,7 @@ static UINT ITERATE_RegisterTypeLibraries(MSIRECORD *row, LPVOID param)
} }
else else
{ {
hr = msi_load_typelib( package, file->TargetPath, REGKIND_REGISTER, &tlib ); hr = load_typelib( package, file->TargetPath, REGKIND_REGISTER, &tlib );
if (FAILED(hr)) if (FAILED(hr))
{ {
ERR( "failed to load type library: %#lx\n", hr ); ERR( "failed to load type library: %#lx\n", hr );
...@@ -3935,7 +3935,7 @@ static UINT ITERATE_PublishIcon(MSIRECORD *row, LPVOID param) ...@@ -3935,7 +3935,7 @@ static UINT ITERATE_PublishIcon(MSIRECORD *row, LPVOID param)
return ERROR_SUCCESS; return ERROR_SUCCESS;
} }
static UINT msi_publish_icons(MSIPACKAGE *package) static UINT publish_icons(MSIPACKAGE *package)
{ {
MSIQUERY *view; MSIQUERY *view;
UINT r; UINT r;
...@@ -3951,7 +3951,7 @@ static UINT msi_publish_icons(MSIPACKAGE *package) ...@@ -3951,7 +3951,7 @@ static UINT msi_publish_icons(MSIPACKAGE *package)
return ERROR_SUCCESS; return ERROR_SUCCESS;
} }
static UINT msi_publish_sourcelist(MSIPACKAGE *package, HKEY hkey) static UINT publish_sourcelist(MSIPACKAGE *package, HKEY hkey)
{ {
UINT r; UINT r;
HKEY source; HKEY source;
...@@ -4005,7 +4005,7 @@ static UINT msi_publish_sourcelist(MSIPACKAGE *package, HKEY hkey) ...@@ -4005,7 +4005,7 @@ static UINT msi_publish_sourcelist(MSIPACKAGE *package, HKEY hkey)
return ERROR_SUCCESS; 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]; WCHAR *buffer, *ptr, *guids, packcode[SQUASHED_GUID_SIZE];
DWORD langid; DWORD langid;
...@@ -4051,7 +4051,7 @@ static UINT msi_publish_product_properties(MSIPACKAGE *package, HKEY hkey) ...@@ -4051,7 +4051,7 @@ static UINT msi_publish_product_properties(MSIPACKAGE *package, HKEY hkey)
return ERROR_SUCCESS; return ERROR_SUCCESS;
} }
static UINT msi_publish_upgrade_code(MSIPACKAGE *package) static UINT publish_upgrade_code(MSIPACKAGE *package)
{ {
UINT r; UINT r;
HKEY hkey; HKEY hkey;
...@@ -4079,7 +4079,7 @@ static UINT msi_publish_upgrade_code(MSIPACKAGE *package) ...@@ -4079,7 +4079,7 @@ static UINT msi_publish_upgrade_code(MSIPACKAGE *package)
return ERROR_SUCCESS; return ERROR_SUCCESS;
} }
static BOOL msi_check_publish(MSIPACKAGE *package) static BOOL check_publish(MSIPACKAGE *package)
{ {
MSIFEATURE *feature; MSIFEATURE *feature;
...@@ -4093,7 +4093,7 @@ static BOOL msi_check_publish(MSIPACKAGE *package) ...@@ -4093,7 +4093,7 @@ static BOOL msi_check_publish(MSIPACKAGE *package)
return FALSE; return FALSE;
} }
static BOOL msi_check_unpublish(MSIPACKAGE *package) static BOOL check_unpublish(MSIPACKAGE *package)
{ {
MSIFEATURE *feature; MSIFEATURE *feature;
...@@ -4107,7 +4107,7 @@ static BOOL msi_check_unpublish(MSIPACKAGE *package) ...@@ -4107,7 +4107,7 @@ static BOOL msi_check_unpublish(MSIPACKAGE *package)
return TRUE; return TRUE;
} }
static UINT msi_publish_patches( MSIPACKAGE *package ) static UINT publish_patches( MSIPACKAGE *package )
{ {
WCHAR patch_squashed[GUID_SIZE]; WCHAR patch_squashed[GUID_SIZE];
HKEY patches_key = NULL, product_patches_key = NULL, product_key; HKEY patches_key = NULL, product_patches_key = NULL, product_key;
...@@ -4221,7 +4221,7 @@ static UINT ACTION_PublishProduct(MSIPACKAGE *package) ...@@ -4221,7 +4221,7 @@ static UINT ACTION_PublishProduct(MSIPACKAGE *package)
if (!list_empty(&package->patches)) if (!list_empty(&package->patches))
{ {
rc = msi_publish_patches(package); rc = publish_patches(package);
if (rc != ERROR_SUCCESS) if (rc != ERROR_SUCCESS)
goto end; goto end;
} }
...@@ -4255,7 +4255,7 @@ static UINT ACTION_PublishProduct(MSIPACKAGE *package) ...@@ -4255,7 +4255,7 @@ static UINT ACTION_PublishProduct(MSIPACKAGE *package)
} }
/* FIXME: also need to publish if the product is in advertise mode */ /* 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) if (hukey)
RegCloseKey(hukey); RegCloseKey(hukey);
...@@ -4275,19 +4275,19 @@ static UINT ACTION_PublishProduct(MSIPACKAGE *package) ...@@ -4275,19 +4275,19 @@ static UINT ACTION_PublishProduct(MSIPACKAGE *package)
if (rc != ERROR_SUCCESS) if (rc != ERROR_SUCCESS)
goto end; goto end;
rc = msi_publish_upgrade_code(package); rc = publish_upgrade_code(package);
if (rc != ERROR_SUCCESS) if (rc != ERROR_SUCCESS)
goto end; goto end;
rc = msi_publish_product_properties(package, hukey); rc = publish_product_properties(package, hukey);
if (rc != ERROR_SUCCESS) if (rc != ERROR_SUCCESS)
goto end; goto end;
rc = msi_publish_sourcelist(package, hukey); rc = publish_sourcelist(package, hukey);
if (rc != ERROR_SUCCESS) if (rc != ERROR_SUCCESS)
goto end; goto end;
rc = msi_publish_icons(package); rc = publish_icons(package);
end: end:
uirow = MSI_CreateRecord( 1 ); uirow = MSI_CreateRecord( 1 );
...@@ -4707,7 +4707,7 @@ static UINT ACTION_PublishFeatures(MSIPACKAGE *package) ...@@ -4707,7 +4707,7 @@ static UINT ACTION_PublishFeatures(MSIPACKAGE *package)
if (package->script == SCRIPT_NONE) if (package->script == SCRIPT_NONE)
return msi_schedule_action(package, SCRIPT_INSTALL, L"PublishFeatures"); return msi_schedule_action(package, SCRIPT_INSTALL, L"PublishFeatures");
if (!msi_check_publish(package)) if (!check_publish(package))
return ERROR_SUCCESS; return ERROR_SUCCESS;
rc = MSIREG_OpenFeaturesKey(package->ProductCode, NULL, package->Context, rc = MSIREG_OpenFeaturesKey(package->ProductCode, NULL, package->Context,
...@@ -4810,7 +4810,7 @@ end: ...@@ -4810,7 +4810,7 @@ end:
return rc; return rc;
} }
static UINT msi_unpublish_feature(MSIPACKAGE *package, MSIFEATURE *feature) static UINT unpublish_feature(MSIPACKAGE *package, MSIFEATURE *feature)
{ {
UINT r; UINT r;
HKEY hkey; HKEY hkey;
...@@ -4849,18 +4849,18 @@ static UINT ACTION_UnpublishFeatures(MSIPACKAGE *package) ...@@ -4849,18 +4849,18 @@ static UINT ACTION_UnpublishFeatures(MSIPACKAGE *package)
if (package->script == SCRIPT_NONE) if (package->script == SCRIPT_NONE)
return msi_schedule_action(package, SCRIPT_INSTALL, L"UnpublishFeatures"); return msi_schedule_action(package, SCRIPT_INSTALL, L"UnpublishFeatures");
if (!msi_check_unpublish(package)) if (!check_unpublish(package))
return ERROR_SUCCESS; return ERROR_SUCCESS;
LIST_FOR_EACH_ENTRY(feature, &package->features, MSIFEATURE, entry) LIST_FOR_EACH_ENTRY(feature, &package->features, MSIFEATURE, entry)
{ {
msi_unpublish_feature(package, feature); unpublish_feature(package, feature);
} }
return ERROR_SUCCESS; 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[] = static const WCHAR *propval[] =
{ {
...@@ -4959,8 +4959,7 @@ static UINT ACTION_RegisterProduct(MSIPACKAGE *package) ...@@ -4959,8 +4959,7 @@ static UINT ACTION_RegisterProduct(MSIPACKAGE *package)
return msi_schedule_action(package, SCRIPT_INSTALL, L"RegisterProduct"); return msi_schedule_action(package, SCRIPT_INSTALL, L"RegisterProduct");
/* FIXME: also need to publish if the product is in advertise mode */ /* FIXME: also need to publish if the product is in advertise mode */
if (!msi_get_property_int( package->db, L"ProductToBeRegistered", 0 ) if (!msi_get_property_int( package->db, L"ProductToBeRegistered", 0 ) && !check_publish(package))
&& !msi_check_publish(package))
return ERROR_SUCCESS; return ERROR_SUCCESS;
rc = MSIREG_OpenUninstallKey(package->ProductCode, package->platform, &hkey, TRUE); rc = MSIREG_OpenUninstallKey(package->ProductCode, package->platform, &hkey, TRUE);
...@@ -4971,11 +4970,11 @@ static UINT ACTION_RegisterProduct(MSIPACKAGE *package) ...@@ -4971,11 +4970,11 @@ static UINT ACTION_RegisterProduct(MSIPACKAGE *package)
if (rc != ERROR_SUCCESS) if (rc != ERROR_SUCCESS)
goto done; goto done;
rc = msi_publish_install_properties(package, hkey); rc = publish_install_properties(package, hkey);
if (rc != ERROR_SUCCESS) if (rc != ERROR_SUCCESS)
goto done; goto done;
rc = msi_publish_install_properties(package, props); rc = publish_install_properties(package, props);
if (rc != ERROR_SUCCESS) if (rc != ERROR_SUCCESS)
goto done; goto done;
...@@ -5030,7 +5029,7 @@ static UINT ITERATE_UnpublishIcon( MSIRECORD *row, LPVOID param ) ...@@ -5030,7 +5029,7 @@ static UINT ITERATE_UnpublishIcon( MSIRECORD *row, LPVOID param )
return ERROR_SUCCESS; return ERROR_SUCCESS;
} }
static UINT msi_unpublish_icons( MSIPACKAGE *package ) static UINT unpublish_icons( MSIPACKAGE *package )
{ {
MSIQUERY *view; MSIQUERY *view;
UINT r; UINT r;
...@@ -5112,7 +5111,7 @@ static UINT ACTION_UnpublishProduct(MSIPACKAGE *package) ...@@ -5112,7 +5111,7 @@ static UINT ACTION_UnpublishProduct(MSIPACKAGE *package)
TRACE("removing local package %s\n", debugstr_w(package->localfile)); TRACE("removing local package %s\n", debugstr_w(package->localfile));
package->delete_on_close = TRUE; package->delete_on_close = TRUE;
msi_unpublish_icons( package ); unpublish_icons( package );
return ERROR_SUCCESS; return ERROR_SUCCESS;
} }
...@@ -5295,7 +5294,7 @@ static UINT ACTION_RegisterUser(MSIPACKAGE *package) ...@@ -5295,7 +5294,7 @@ static UINT ACTION_RegisterUser(MSIPACKAGE *package)
if (package->script == SCRIPT_NONE) if (package->script == SCRIPT_NONE)
return msi_schedule_action(package, SCRIPT_INSTALL, L"RegisterUser"); return msi_schedule_action(package, SCRIPT_INSTALL, L"RegisterUser");
if (msi_check_unpublish(package)) if (check_unpublish(package))
{ {
MSIREG_DeleteUserDataProductKey(package->ProductCode, package->Context); MSIREG_DeleteUserDataProductKey(package->ProductCode, package->Context);
goto end; goto end;
...@@ -5832,7 +5831,7 @@ static UINT ACTION_InstallServices( MSIPACKAGE *package ) ...@@ -5832,7 +5831,7 @@ static UINT ACTION_InstallServices( MSIPACKAGE *package )
} }
/* converts arg1[~]arg2[~]arg3 to a list of ptrs to the strings */ /* 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; LPCWSTR *vector, *temp_vector;
LPWSTR p, q; LPWSTR p, q;
...@@ -5928,7 +5927,7 @@ static UINT ITERATE_StartService(MSIRECORD *rec, LPVOID param) ...@@ -5928,7 +5927,7 @@ static UINT ITERATE_StartService(MSIRECORD *rec, LPVOID param)
goto done; goto done;
} }
vector = msi_service_args_to_vector(args, &numargs); vector = service_args_to_vector(args, &numargs);
if (!StartServiceW(service, numargs, vector) && if (!StartServiceW(service, numargs, vector) &&
GetLastError() != ERROR_SERVICE_ALREADY_RUNNING) GetLastError() != ERROR_SERVICE_ALREADY_RUNNING)
...@@ -7368,21 +7367,11 @@ static UINT ACTION_MigrateFeatureStates( MSIPACKAGE *package ) ...@@ -7368,21 +7367,11 @@ static UINT ACTION_MigrateFeatureStates( MSIPACKAGE *package )
return ERROR_SUCCESS; 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 ); 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 ); 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 ) static UINT ITERATE_BindImage( MSIRECORD *rec, LPVOID param )
...@@ -7437,7 +7426,7 @@ static UINT ACTION_BindImage( MSIPACKAGE *package ) ...@@ -7437,7 +7426,7 @@ static UINT ACTION_BindImage( MSIPACKAGE *package )
return ERROR_SUCCESS; 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; MSIQUERY *view;
DWORD count = 0; DWORD count = 0;
...@@ -7457,27 +7446,27 @@ static UINT msi_unimplemented_action_stub( MSIPACKAGE *package, LPCSTR action, L ...@@ -7457,27 +7446,27 @@ static UINT msi_unimplemented_action_stub( MSIPACKAGE *package, LPCSTR action, L
static UINT ACTION_IsolateComponents( MSIPACKAGE *package ) 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 ) 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 ) 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 ) 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 ) 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 static const struct
......
...@@ -53,17 +53,17 @@ typedef struct tagMSIRUNNINGACTION ...@@ -53,17 +53,17 @@ typedef struct tagMSIRUNNINGACTION
typedef UINT (WINAPI *MsiCustomActionEntryPoint)( MSIHANDLE ); typedef UINT (WINAPI *MsiCustomActionEntryPoint)( MSIHANDLE );
static CRITICAL_SECTION msi_custom_action_cs; static CRITICAL_SECTION custom_action_cs;
static CRITICAL_SECTION_DEBUG msi_custom_action_cs_debug = static CRITICAL_SECTION_DEBUG custom_action_cs_debug =
{ {
0, 0, &msi_custom_action_cs, 0, 0, &custom_action_cs,
{ &msi_custom_action_cs_debug.ProcessLocksList, { &custom_action_cs_debug.ProcessLocksList,
&msi_custom_action_cs_debug.ProcessLocksList }, &custom_action_cs_debug.ProcessLocksList },
0, 0, { (DWORD_PTR)(__FILE__ ": msi_custom_action_cs") } 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) void __RPC_FAR * __RPC_USER MIDL_user_allocate(SIZE_T len)
{ {
...@@ -171,8 +171,8 @@ static BOOL check_execution_scheduling_options(MSIPACKAGE *package, LPCWSTR acti ...@@ -171,8 +171,8 @@ static BOOL check_execution_scheduling_options(MSIPACKAGE *package, LPCWSTR acti
* *
* [CustomActionData<=>UserSID<=>ProductCode]Action * [CustomActionData<=>UserSID<=>ProductCode]Action
*/ */
static LPWSTR msi_get_deferred_action(LPCWSTR action, LPCWSTR actiondata, static WCHAR *get_deferred_action(const WCHAR *action, const WCHAR *actiondata, const WCHAR *usersid,
LPCWSTR usersid, LPCWSTR prodcode) const WCHAR *prodcode)
{ {
LPWSTR deferred; LPWSTR deferred;
DWORD len; DWORD len;
...@@ -373,7 +373,8 @@ static UINT wait_process_handle(MSIPACKAGE* package, UINT type, ...@@ -373,7 +373,8 @@ static UINT wait_process_handle(MSIPACKAGE* package, UINT type,
return rc; return rc;
} }
typedef struct _msi_custom_action_info { typedef struct
{
struct list entry; struct list entry;
MSIPACKAGE *package; MSIPACKAGE *package;
LPWSTR source; LPWSTR source;
...@@ -383,11 +384,11 @@ typedef struct _msi_custom_action_info { ...@@ -383,11 +384,11 @@ typedef struct _msi_custom_action_info {
INT type; INT type;
GUID guid; GUID guid;
DWORD arch; 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 ); list_remove( &info->entry );
if (info->handle) if (info->handle)
...@@ -398,10 +399,10 @@ static void free_custom_action_data( msi_custom_action_info *info ) ...@@ -398,10 +399,10 @@ static void free_custom_action_data( msi_custom_action_info *info )
msiobj_release( &info->package->hdr ); msiobj_release( &info->package->hdr );
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; UINT rc = ERROR_SUCCESS;
...@@ -424,14 +425,14 @@ static UINT wait_thread_handle( msi_custom_action_info *info ) ...@@ -424,14 +425,14 @@ static UINT wait_thread_handle( msi_custom_action_info *info )
return rc; 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; 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 )) if (IsEqualGUID( &info->guid, guid ))
{ {
...@@ -440,7 +441,7 @@ static msi_custom_action_info *find_action_by_guid( const GUID *guid ) ...@@ -440,7 +441,7 @@ static msi_custom_action_info *find_action_by_guid( const GUID *guid )
} }
} }
LeaveCriticalSection( &msi_custom_action_cs ); LeaveCriticalSection( &custom_action_cs );
if (!found) if (!found)
return NULL; return NULL;
...@@ -642,7 +643,7 @@ void custom_stop_server(HANDLE process, HANDLE pipe) ...@@ -642,7 +643,7 @@ void custom_stop_server(HANDLE process, HANDLE pipe)
static DWORD WINAPI custom_client_thread(void *arg) static DWORD WINAPI custom_client_thread(void *arg)
{ {
msi_custom_action_info *info = arg; custom_action_info *info = arg;
DWORD64 thread64; DWORD64 thread64;
HANDLE process; HANDLE process;
HANDLE thread; HANDLE thread;
...@@ -663,23 +664,23 @@ static DWORD WINAPI custom_client_thread(void *arg) ...@@ -663,23 +664,23 @@ static DWORD WINAPI custom_client_thread(void *arg)
pipe = info->package->custom_server_64_pipe; 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) || if (!WriteFile(pipe, &info->guid, sizeof(info->guid), &size, NULL) ||
size != sizeof(info->guid)) size != sizeof(info->guid))
{ {
ERR("failed to write to custom action client pipe: %lu\n", GetLastError()); ERR("failed to write to custom action client pipe: %lu\n", GetLastError());
LeaveCriticalSection(&msi_custom_action_cs); LeaveCriticalSection(&custom_action_cs);
return GetLastError(); return GetLastError();
} }
if (!ReadFile(pipe, &thread64, sizeof(thread64), &size, NULL) || size != sizeof(thread64)) if (!ReadFile(pipe, &thread64, sizeof(thread64), &size, NULL) || size != sizeof(thread64))
{ {
ERR("failed to read from custom action client pipe: %lu\n", GetLastError()); ERR("failed to read from custom action client pipe: %lu\n", GetLastError());
LeaveCriticalSection(&msi_custom_action_cs); LeaveCriticalSection(&custom_action_cs);
return GetLastError(); return GetLastError();
} }
LeaveCriticalSection(&msi_custom_action_cs); LeaveCriticalSection(&custom_action_cs);
if (DuplicateHandle(process, (HANDLE)(DWORD_PTR)thread64, GetCurrentProcess(), if (DuplicateHandle(process, (HANDLE)(DWORD_PTR)thread64, GetCurrentProcess(),
&thread, 0, FALSE, DUPLICATE_SAME_ACCESS | DUPLICATE_CLOSE_SOURCE)) &thread, 0, FALSE, DUPLICATE_SAME_ACCESS | DUPLICATE_CLOSE_SOURCE))
...@@ -740,10 +741,10 @@ static BOOL get_binary_type( const WCHAR *name, DWORD *type ) ...@@ -740,10 +741,10 @@ 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 ) MSIPACKAGE *package, INT type, LPCWSTR source, LPCWSTR target, LPCWSTR action )
{ {
msi_custom_action_info *info; custom_action_info *info;
RPC_STATUS status; RPC_STATUS status;
BOOL ret; BOOL ret;
...@@ -759,9 +760,9 @@ static msi_custom_action_info *do_msidbCustomActionTypeDll( ...@@ -759,9 +760,9 @@ static msi_custom_action_info *do_msidbCustomActionTypeDll(
info->action = wcsdup( action ); info->action = wcsdup( action );
CoCreateGuid( &info->guid ); CoCreateGuid( &info->guid );
EnterCriticalSection( &msi_custom_action_cs ); EnterCriticalSection( &custom_action_cs );
list_add_tail( &msi_pending_custom_actions, &info->entry ); list_add_tail( &pending_custom_actions, &info->entry );
LeaveCriticalSection( &msi_custom_action_cs ); LeaveCriticalSection( &custom_action_cs );
if (!package->rpc_server_started) if (!package->rpc_server_started)
{ {
...@@ -813,7 +814,7 @@ static msi_custom_action_info *do_msidbCustomActionTypeDll( ...@@ -813,7 +814,7 @@ static msi_custom_action_info *do_msidbCustomActionTypeDll(
static UINT HANDLE_CustomType1( MSIPACKAGE *package, const WCHAR *source, const WCHAR *target, static UINT HANDLE_CustomType1( MSIPACKAGE *package, const WCHAR *source, const WCHAR *target,
INT type, const WCHAR *action ) INT type, const WCHAR *action )
{ {
msi_custom_action_info *info; custom_action_info *info;
MSIBINARY *binary; MSIBINARY *binary;
if (!(binary = get_temp_binary(package, source))) if (!(binary = get_temp_binary(package, source)))
...@@ -915,7 +916,7 @@ static UINT HANDLE_CustomType2( MSIPACKAGE *package, const WCHAR *source, const ...@@ -915,7 +916,7 @@ static UINT HANDLE_CustomType2( MSIPACKAGE *package, const WCHAR *source, const
static UINT HANDLE_CustomType17( MSIPACKAGE *package, const WCHAR *source, const WCHAR *target, static UINT HANDLE_CustomType17( MSIPACKAGE *package, const WCHAR *source, const WCHAR *target,
INT type, const WCHAR *action ) INT type, const WCHAR *action )
{ {
msi_custom_action_info *info; custom_action_info *info;
MSIFILE *file; MSIFILE *file;
TRACE("%s %s\n", debugstr_w(source), debugstr_w(target)); TRACE("%s %s\n", debugstr_w(source), debugstr_w(target));
...@@ -1148,7 +1149,7 @@ static UINT HANDLE_CustomType34( MSIPACKAGE *package, const WCHAR *source, const ...@@ -1148,7 +1149,7 @@ static UINT HANDLE_CustomType34( MSIPACKAGE *package, const WCHAR *source, const
static DWORD ACTION_CallScript( const GUID *guid ) static DWORD ACTION_CallScript( const GUID *guid )
{ {
msi_custom_action_info *info; custom_action_info *info;
MSIHANDLE hPackage; MSIHANDLE hPackage;
UINT r = ERROR_FUNCTION_FAILED; UINT r = ERROR_FUNCTION_FAILED;
...@@ -1189,10 +1190,10 @@ static DWORD WINAPI ScriptThread( LPVOID arg ) ...@@ -1189,10 +1190,10 @@ static DWORD WINAPI ScriptThread( LPVOID arg )
return rc; 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 ) MSIPACKAGE *package, INT type, LPCWSTR script, LPCWSTR function, LPCWSTR action )
{ {
msi_custom_action_info *info; custom_action_info *info;
info = malloc( sizeof *info ); info = malloc( sizeof *info );
if (!info) if (!info)
...@@ -1206,9 +1207,9 @@ static msi_custom_action_info *do_msidbCustomActionTypeScript( ...@@ -1206,9 +1207,9 @@ static msi_custom_action_info *do_msidbCustomActionTypeScript(
info->action = wcsdup( action ); info->action = wcsdup( action );
CoCreateGuid( &info->guid ); CoCreateGuid( &info->guid );
EnterCriticalSection( &msi_custom_action_cs ); EnterCriticalSection( &custom_action_cs );
list_add_tail( &msi_pending_custom_actions, &info->entry ); list_add_tail( &pending_custom_actions, &info->entry );
LeaveCriticalSection( &msi_custom_action_cs ); LeaveCriticalSection( &custom_action_cs );
info->handle = CreateThread( NULL, 0, ScriptThread, &info->guid, 0, NULL ); info->handle = CreateThread( NULL, 0, ScriptThread, &info->guid, 0, NULL );
if (!info->handle) if (!info->handle)
...@@ -1223,7 +1224,7 @@ static msi_custom_action_info *do_msidbCustomActionTypeScript( ...@@ -1223,7 +1224,7 @@ static msi_custom_action_info *do_msidbCustomActionTypeScript(
static UINT HANDLE_CustomType37_38( MSIPACKAGE *package, const WCHAR *source, const WCHAR *target, static UINT HANDLE_CustomType37_38( MSIPACKAGE *package, const WCHAR *source, const WCHAR *target,
INT type, const WCHAR *action ) INT type, const WCHAR *action )
{ {
msi_custom_action_info *info; custom_action_info *info;
TRACE("%s %s\n", debugstr_w(source), debugstr_w(target)); TRACE("%s %s\n", debugstr_w(source), debugstr_w(target));
...@@ -1235,7 +1236,7 @@ static UINT HANDLE_CustomType5_6( MSIPACKAGE *package, const WCHAR *source, cons ...@@ -1235,7 +1236,7 @@ static UINT HANDLE_CustomType5_6( MSIPACKAGE *package, const WCHAR *source, cons
INT type, const WCHAR *action ) INT type, const WCHAR *action )
{ {
MSIRECORD *row = NULL; MSIRECORD *row = NULL;
msi_custom_action_info *info; custom_action_info *info;
CHAR *buffer = NULL; CHAR *buffer = NULL;
WCHAR *bufferw = NULL; WCHAR *bufferw = NULL;
DWORD sz = 0; DWORD sz = 0;
...@@ -1282,7 +1283,7 @@ done: ...@@ -1282,7 +1283,7 @@ done:
static UINT HANDLE_CustomType21_22( MSIPACKAGE *package, const WCHAR *source, const WCHAR *target, static UINT HANDLE_CustomType21_22( MSIPACKAGE *package, const WCHAR *source, const WCHAR *target,
INT type, const WCHAR *action ) INT type, const WCHAR *action )
{ {
msi_custom_action_info *info; custom_action_info *info;
MSIFILE *file; MSIFILE *file;
HANDLE hFile; HANDLE hFile;
DWORD sz, szHighWord = 0, read; DWORD sz, szHighWord = 0, read;
...@@ -1341,7 +1342,7 @@ done: ...@@ -1341,7 +1342,7 @@ done:
static UINT HANDLE_CustomType53_54( MSIPACKAGE *package, const WCHAR *source, const WCHAR *target, static UINT HANDLE_CustomType53_54( MSIPACKAGE *package, const WCHAR *source, const WCHAR *target,
INT type, const WCHAR *action ) INT type, const WCHAR *action )
{ {
msi_custom_action_info *info; custom_action_info *info;
WCHAR *prop; WCHAR *prop;
TRACE("%s %s\n", debugstr_w(source), debugstr_w(target)); TRACE("%s %s\n", debugstr_w(source), debugstr_w(target));
...@@ -1377,7 +1378,7 @@ static UINT defer_custom_action( MSIPACKAGE *package, const WCHAR *action, UINT ...@@ -1377,7 +1378,7 @@ static UINT defer_custom_action( MSIPACKAGE *package, const WCHAR *action, UINT
WCHAR *actiondata = msi_dup_property( package->db, action ); WCHAR *actiondata = msi_dup_property( package->db, action );
WCHAR *usersid = msi_dup_property( package->db, L"UserSID" ); WCHAR *usersid = msi_dup_property( package->db, L"UserSID" );
WCHAR *prodcode = msi_dup_property( package->db, L"ProductCode" ); 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) if (!deferred)
{ {
...@@ -1558,7 +1559,7 @@ void ACTION_FinishCustomActions(const MSIPACKAGE* package) ...@@ -1558,7 +1559,7 @@ void ACTION_FinishCustomActions(const MSIPACKAGE* package)
struct list *item; struct list *item;
HANDLE *wait_handles; HANDLE *wait_handles;
unsigned int handle_count, i; unsigned int handle_count, i;
msi_custom_action_info *info, *cursor; custom_action_info *info, *cursor;
while ((item = list_head( &package->RunningActions ))) while ((item = list_head( &package->RunningActions )))
{ {
...@@ -1574,13 +1575,13 @@ void ACTION_FinishCustomActions(const MSIPACKAGE* package) ...@@ -1574,13 +1575,13 @@ void ACTION_FinishCustomActions(const MSIPACKAGE* package)
free( action ); free( action );
} }
EnterCriticalSection( &msi_custom_action_cs ); EnterCriticalSection( &custom_action_cs );
handle_count = list_count( &msi_pending_custom_actions ); handle_count = list_count( &pending_custom_actions );
wait_handles = malloc( handle_count * sizeof(HANDLE) ); wait_handles = malloc( handle_count * sizeof(HANDLE) );
handle_count = 0; 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 ) if (info->package == package )
{ {
...@@ -1589,7 +1590,7 @@ void ACTION_FinishCustomActions(const MSIPACKAGE* package) ...@@ -1589,7 +1590,7 @@ void ACTION_FinishCustomActions(const MSIPACKAGE* package)
} }
} }
LeaveCriticalSection( &msi_custom_action_cs ); LeaveCriticalSection( &custom_action_cs );
for (i = 0; i < handle_count; i++) for (i = 0; i < handle_count; i++)
{ {
...@@ -1598,18 +1599,18 @@ void ACTION_FinishCustomActions(const MSIPACKAGE* package) ...@@ -1598,18 +1599,18 @@ void ACTION_FinishCustomActions(const MSIPACKAGE* package)
} }
free( wait_handles ); free( wait_handles );
EnterCriticalSection( &msi_custom_action_cs ); EnterCriticalSection( &custom_action_cs );
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) if (info->package == package)
free_custom_action_data( info ); 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) 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); info = find_action_by_guid(guid);
if (!info) if (!info)
......
...@@ -347,7 +347,7 @@ end: ...@@ -347,7 +347,7 @@ end:
return r; return r;
} }
static LPWSTR msi_read_text_archive(LPCWSTR path, DWORD *len) static WCHAR *read_text_archive(const WCHAR *path, DWORD *len)
{ {
HANDLE file; HANDLE file;
LPSTR data = NULL; LPSTR data = NULL;
...@@ -377,7 +377,7 @@ done: ...@@ -377,7 +377,7 @@ done:
return wdata; return wdata;
} }
static void msi_parse_line(LPWSTR *line, LPWSTR **entries, DWORD *num_entries, DWORD *len) static void parse_line(WCHAR **line, WCHAR ***entries, DWORD *num_entries, DWORD *len)
{ {
LPWSTR ptr = *line, save; LPWSTR ptr = *line, save;
DWORD i, count = 1, chars_left = *len; DWORD i, count = 1, chars_left = *len;
...@@ -446,7 +446,7 @@ static void msi_parse_line(LPWSTR *line, LPWSTR **entries, DWORD *num_entries, D ...@@ -446,7 +446,7 @@ static void msi_parse_line(LPWSTR *line, LPWSTR **entries, DWORD *num_entries, D
*num_entries = count; *num_entries = count;
} }
static LPWSTR msi_build_createsql_prelude(LPWSTR table) static WCHAR *build_createsql_prelude(const WCHAR *table)
{ {
LPWSTR prelude; LPWSTR prelude;
DWORD size; DWORD size;
...@@ -460,7 +460,7 @@ static LPWSTR msi_build_createsql_prelude(LPWSTR table) ...@@ -460,7 +460,7 @@ static LPWSTR msi_build_createsql_prelude(LPWSTR table)
return prelude; 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; LPWSTR columns, p;
LPCWSTR type; LPCWSTR type;
...@@ -547,7 +547,7 @@ static LPWSTR msi_build_createsql_columns(LPWSTR *columns_data, LPWSTR *types, D ...@@ -547,7 +547,7 @@ static LPWSTR msi_build_createsql_columns(LPWSTR *columns_data, LPWSTR *types, D
return columns; 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; LPWSTR postlude, keys, ptr;
DWORD size, i; DWORD size, i;
...@@ -579,7 +579,8 @@ done: ...@@ -579,7 +579,8 @@ done:
return postlude; 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; UINT r = ERROR_OUTOFMEMORY;
DWORD size; DWORD size;
...@@ -587,9 +588,9 @@ static UINT msi_add_table_to_db(MSIDATABASE *db, LPWSTR *columns, LPWSTR *types, ...@@ -587,9 +588,9 @@ static UINT msi_add_table_to_db(MSIDATABASE *db, LPWSTR *columns, LPWSTR *types,
LPWSTR create_sql = NULL; LPWSTR create_sql = NULL;
LPWSTR prelude, columns_sql, postlude; LPWSTR prelude, columns_sql, postlude;
prelude = msi_build_createsql_prelude(labels[0]); prelude = build_createsql_prelude(labels[0]);
columns_sql = msi_build_createsql_columns(columns, types, num_columns); columns_sql = build_createsql_columns(columns, types, num_columns);
postlude = msi_build_createsql_postlude(labels + 1, num_labels - 1); /* skip over table name */ postlude = build_createsql_postlude(labels + 1, num_labels - 1); /* skip over table name */
if (!prelude || !columns_sql || !postlude) if (!prelude || !columns_sql || !postlude)
goto done; goto done;
...@@ -619,7 +620,7 @@ done: ...@@ -619,7 +620,7 @@ done:
return r; 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; DWORD len;
LPWSTR fullname, ptr; LPWSTR fullname, ptr;
...@@ -667,7 +668,7 @@ static UINT construct_record(DWORD num_columns, LPWSTR *types, ...@@ -667,7 +668,7 @@ static UINT construct_record(DWORD num_columns, LPWSTR *types,
if (*data[i]) if (*data[i])
{ {
UINT r; UINT r;
LPWSTR file = msi_import_stream_filename(path, data[i]); WCHAR *file = import_stream_filename(path, data[i]);
if (!file) if (!file)
return ERROR_FUNCTION_FAILED; return ERROR_FUNCTION_FAILED;
...@@ -687,10 +688,8 @@ static UINT construct_record(DWORD num_columns, LPWSTR *types, ...@@ -687,10 +688,8 @@ static UINT construct_record(DWORD num_columns, LPWSTR *types,
return ERROR_SUCCESS; return ERROR_SUCCESS;
} }
static UINT msi_add_records_to_table(MSIDATABASE *db, LPWSTR *columns, LPWSTR *types, static UINT add_records_to_table(MSIDATABASE *db, WCHAR **columns, WCHAR **types, WCHAR **labels, WCHAR ***records,
LPWSTR *labels, LPWSTR **records, int num_columns, int num_records, WCHAR *path)
int num_columns, int num_records,
LPWSTR path)
{ {
UINT r; UINT r;
int i; int i;
...@@ -750,7 +749,7 @@ static UINT MSI_DatabaseImport(MSIDATABASE *db, LPCWSTR folder, LPCWSTR file) ...@@ -750,7 +749,7 @@ static UINT MSI_DatabaseImport(MSIDATABASE *db, LPCWSTR folder, LPCWSTR file)
lstrcatW( path, L"\\" ); lstrcatW( path, L"\\" );
lstrcatW( path, file ); lstrcatW( path, file );
data = msi_read_text_archive( path, &len ); data = read_text_archive( path, &len );
if (!data) if (!data)
{ {
free(path); free(path);
...@@ -758,9 +757,9 @@ static UINT MSI_DatabaseImport(MSIDATABASE *db, LPCWSTR folder, LPCWSTR file) ...@@ -758,9 +757,9 @@ static UINT MSI_DatabaseImport(MSIDATABASE *db, LPCWSTR folder, LPCWSTR file)
} }
ptr = data; ptr = data;
msi_parse_line( &ptr, &columns, &num_columns, &len ); parse_line( &ptr, &columns, &num_columns, &len );
msi_parse_line( &ptr, &types, &num_types, &len ); parse_line( &ptr, &types, &num_types, &len );
msi_parse_line( &ptr, &labels, &num_labels, &len ); parse_line( &ptr, &labels, &num_labels, &len );
if (num_columns == 1 && !columns[0][0] && num_labels == 1 && !labels[0][0] && if (num_columns == 1 && !columns[0][0] && num_labels == 1 && !labels[0][0] &&
num_types == 2 && !wcscmp( types[1], L"_ForceCodepage" )) num_types == 2 && !wcscmp( types[1], L"_ForceCodepage" ))
...@@ -785,7 +784,7 @@ static UINT MSI_DatabaseImport(MSIDATABASE *db, LPCWSTR folder, LPCWSTR file) ...@@ -785,7 +784,7 @@ static UINT MSI_DatabaseImport(MSIDATABASE *db, LPCWSTR folder, LPCWSTR file)
/* read in the table records */ /* read in the table records */
while (len) while (len)
{ {
msi_parse_line( &ptr, &records[num_records], NULL, &len ); parse_line( &ptr, &records[num_records], NULL, &len );
num_records++; num_records++;
temp_records = realloc(records, (num_records + 1) * sizeof(WCHAR **)); temp_records = realloc(records, (num_records + 1) * sizeof(WCHAR **));
...@@ -810,7 +809,7 @@ static UINT MSI_DatabaseImport(MSIDATABASE *db, LPCWSTR folder, LPCWSTR file) ...@@ -810,7 +809,7 @@ static UINT MSI_DatabaseImport(MSIDATABASE *db, LPCWSTR folder, LPCWSTR file)
{ {
if (!TABLE_Exists(db, labels[0])) 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) if (r != ERROR_SUCCESS)
{ {
r = ERROR_FUNCTION_FAILED; r = ERROR_FUNCTION_FAILED;
...@@ -818,7 +817,7 @@ static UINT MSI_DatabaseImport(MSIDATABASE *db, LPCWSTR folder, LPCWSTR file) ...@@ -818,7 +817,7 @@ 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: done:
...@@ -880,7 +879,7 @@ end: ...@@ -880,7 +879,7 @@ end:
return r; 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;
BOOL ret; BOOL ret;
...@@ -923,7 +922,7 @@ static UINT msi_export_field( HANDLE handle, MSIRECORD *row, UINT field ) ...@@ -923,7 +922,7 @@ static UINT msi_export_field( HANDLE handle, MSIRECORD *row, UINT field )
return ret ? ERROR_SUCCESS : ERROR_FUNCTION_FAILED; 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; WCHAR stream[MAX_STREAM_NAME_LEN + 1], *path;
DWORD sz, read_size, write_size; DWORD sz, read_size, write_size;
...@@ -981,7 +980,7 @@ struct row_export_info ...@@ -981,7 +980,7 @@ struct row_export_info
const WCHAR *table; 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; HANDLE handle = row_export_info->handle;
UINT i, count, r = ERROR_SUCCESS; UINT i, count, r = ERROR_SUCCESS;
...@@ -991,15 +990,15 @@ static UINT msi_export_record( struct row_export_info *row_export_info, MSIRECOR ...@@ -991,15 +990,15 @@ static UINT msi_export_record( struct row_export_info *row_export_info, MSIRECOR
count = MSI_RecordGetFieldCount( row ); count = MSI_RecordGetFieldCount( row );
for (i = start; i <= count; i++) for (i = start; i <= count; i++)
{ {
r = msi_export_field( handle, row, i ); r = export_field( handle, row, i );
if (r == ERROR_INVALID_PARAMETER) 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) if (r != ERROR_SUCCESS)
return r; return r;
/* exporting a binary stream, repeat the "Name" field */ /* 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) if (r != ERROR_SUCCESS)
return r; return r;
} }
...@@ -1013,12 +1012,12 @@ static UINT msi_export_record( struct row_export_info *row_export_info, MSIRECOR ...@@ -1013,12 +1012,12 @@ static UINT msi_export_record( struct row_export_info *row_export_info, MSIRECOR
return r; 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"; static const char fmt[] = "\r\n\r\n%u\t_ForceCodepage\r\n";
char data[sizeof(fmt) + 10]; char data[sizeof(fmt) + 10];
...@@ -1030,7 +1029,7 @@ static UINT msi_export_forcecodepage( HANDLE handle, UINT codepage ) ...@@ -1030,7 +1029,7 @@ static UINT msi_export_forcecodepage( HANDLE handle, UINT codepage )
return ERROR_SUCCESS; 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" static const char header[] = "PropertyId\tValue\r\n"
"i2\tl255\r\n" "i2\tl255\r\n"
...@@ -1075,13 +1074,13 @@ static UINT MSI_DatabaseExport( MSIDATABASE *db, LPCWSTR table, LPCWSTR folder, ...@@ -1075,13 +1074,13 @@ static UINT MSI_DatabaseExport( MSIDATABASE *db, LPCWSTR table, LPCWSTR folder,
if (!wcscmp( table, L"_ForceCodepage" )) if (!wcscmp( table, L"_ForceCodepage" ))
{ {
UINT codepage = msi_get_string_table_codepage( db->strings ); UINT codepage = msi_get_string_table_codepage( db->strings );
r = msi_export_forcecodepage( handle, codepage ); r = export_forcecodepage( handle, codepage );
goto done; goto done;
} }
if (!wcscmp( table, L"_SummaryInformation" )) if (!wcscmp( table, L"_SummaryInformation" ))
{ {
r = msi_export_summaryinformation( db, handle ); r = export_summaryinformation( db, handle );
goto done; goto done;
} }
...@@ -1094,7 +1093,7 @@ static UINT MSI_DatabaseExport( MSIDATABASE *db, LPCWSTR table, LPCWSTR folder, ...@@ -1094,7 +1093,7 @@ static UINT MSI_DatabaseExport( MSIDATABASE *db, LPCWSTR table, LPCWSTR folder,
r = MSI_ViewGetColumnInfo(view, MSICOLINFO_NAMES, &rec); r = MSI_ViewGetColumnInfo(view, MSICOLINFO_NAMES, &rec);
if (r == ERROR_SUCCESS) if (r == ERROR_SUCCESS)
{ {
msi_export_record( &row_export_info, rec, 1 ); export_record( &row_export_info, rec, 1 );
msiobj_release( &rec->hdr ); msiobj_release( &rec->hdr );
} }
...@@ -1102,7 +1101,7 @@ static UINT MSI_DatabaseExport( MSIDATABASE *db, LPCWSTR table, LPCWSTR folder, ...@@ -1102,7 +1101,7 @@ static UINT MSI_DatabaseExport( MSIDATABASE *db, LPCWSTR table, LPCWSTR folder,
r = MSI_ViewGetColumnInfo(view, MSICOLINFO_TYPES, &rec); r = MSI_ViewGetColumnInfo(view, MSICOLINFO_TYPES, &rec);
if (r == ERROR_SUCCESS) if (r == ERROR_SUCCESS)
{ {
msi_export_record( &row_export_info, rec, 1 ); export_record( &row_export_info, rec, 1 );
msiobj_release( &rec->hdr ); msiobj_release( &rec->hdr );
} }
...@@ -1111,12 +1110,12 @@ static UINT MSI_DatabaseExport( MSIDATABASE *db, LPCWSTR table, LPCWSTR folder, ...@@ -1111,12 +1110,12 @@ static UINT MSI_DatabaseExport( MSIDATABASE *db, LPCWSTR table, LPCWSTR folder,
if (r == ERROR_SUCCESS) if (r == ERROR_SUCCESS)
{ {
MSI_RecordSetStringW( rec, 0, table ); MSI_RecordSetStringW( rec, 0, table );
msi_export_record( &row_export_info, rec, 0 ); export_record( &row_export_info, rec, 0 );
msiobj_release( &rec->hdr ); msiobj_release( &rec->hdr );
} }
/* write out row 4 onwards, the data */ /* 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 ); msiobj_release( &view->hdr );
} }
...@@ -1521,7 +1520,7 @@ done: ...@@ -1521,7 +1520,7 @@ done:
return r; 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; UINT r, i, count;
MSIRECORD *prec = NULL; MSIRECORD *prec = NULL;
...@@ -1550,7 +1549,7 @@ end: ...@@ -1550,7 +1549,7 @@ end:
return r; 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; UINT r, i, count;
MSIRECORD *prec = NULL; MSIRECORD *prec = NULL;
...@@ -1579,7 +1578,7 @@ end: ...@@ -1579,7 +1578,7 @@ end:
return r; 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; UINT r, i, count;
MSIRECORD *prec = NULL; MSIRECORD *prec = NULL;
...@@ -1655,7 +1654,7 @@ static void free_merge_table(MERGETABLE *table) ...@@ -1655,7 +1654,7 @@ static void free_merge_table(MERGETABLE *table)
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, MERGETABLE **ptable)
{ {
UINT r; UINT r;
MERGETABLE *table; MERGETABLE *table;
...@@ -1668,7 +1667,7 @@ static UINT msi_get_merge_table (MSIDATABASE *db, LPCWSTR name, MERGETABLE **pta ...@@ -1668,7 +1667,7 @@ static UINT msi_get_merge_table (MSIDATABASE *db, LPCWSTR name, MERGETABLE **pta
return ERROR_OUTOFMEMORY; 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) if (r != ERROR_SUCCESS)
goto err; goto err;
...@@ -1676,11 +1675,11 @@ static UINT msi_get_merge_table (MSIDATABASE *db, LPCWSTR name, MERGETABLE **pta ...@@ -1676,11 +1675,11 @@ static UINT msi_get_merge_table (MSIDATABASE *db, LPCWSTR name, MERGETABLE **pta
if (r != ERROR_SUCCESS) if (r != ERROR_SUCCESS)
goto err; 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) if (r != ERROR_SUCCESS)
goto err; 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) if (r != ERROR_SUCCESS)
goto err; goto err;
...@@ -1730,7 +1729,7 @@ static UINT merge_diff_tables(MSIRECORD *rec, LPVOID param) ...@@ -1730,7 +1729,7 @@ static UINT merge_diff_tables(MSIRECORD *rec, LPVOID param)
goto done; goto done;
} }
r = msi_get_merge_table(data->merge, name, &table); r = get_merge_table(data->merge, name, &table);
if (r != ERROR_SUCCESS) if (r != ERROR_SUCCESS)
goto done; goto done;
...@@ -1778,8 +1777,7 @@ static UINT merge_table(MSIDATABASE *db, MERGETABLE *table) ...@@ -1778,8 +1777,7 @@ static UINT merge_table(MSIDATABASE *db, MERGETABLE *table)
if (!TABLE_Exists(db, table->name)) if (!TABLE_Exists(db, table->name))
{ {
r = msi_add_table_to_db(db, table->columns, table->types, r = add_table_to_db(db, table->columns, table->types, table->labels, table->numlabels, table->numcolumns);
table->labels, table->numlabels, table->numcolumns);
if (r != ERROR_SUCCESS) if (r != ERROR_SUCCESS)
return ERROR_FUNCTION_FAILED; return ERROR_FUNCTION_FAILED;
} }
......
...@@ -140,7 +140,7 @@ typedef struct ...@@ -140,7 +140,7 @@ typedef struct
static DWORD uiThreadId; static DWORD uiThreadId;
static HWND hMsiHiddenWindow; static HWND hMsiHiddenWindow;
static LPWSTR msi_get_window_text( HWND hwnd ) static WCHAR *get_window_text( HWND hwnd )
{ {
UINT sz, r; UINT sz, r;
WCHAR *buf, *new_buf; WCHAR *buf, *new_buf;
...@@ -162,12 +162,12 @@ static LPWSTR msi_get_window_text( HWND hwnd ) ...@@ -162,12 +162,12 @@ static LPWSTR msi_get_window_text( HWND hwnd )
return 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 ); return MulDiv( val, dialog->scale, 12 );
} }
static msi_control *msi_dialog_find_control( msi_dialog *dialog, LPCWSTR name ) static msi_control *dialog_find_control( msi_dialog *dialog, LPCWSTR name )
{ {
msi_control *control; msi_control *control;
...@@ -181,7 +181,7 @@ static msi_control *msi_dialog_find_control( msi_dialog *dialog, LPCWSTR name ) ...@@ -181,7 +181,7 @@ static msi_control *msi_dialog_find_control( msi_dialog *dialog, LPCWSTR name )
return NULL; return NULL;
} }
static msi_control *msi_dialog_find_control_by_type( msi_dialog *dialog, LPCWSTR type ) static msi_control *dialog_find_control_by_type( msi_dialog *dialog, LPCWSTR type )
{ {
msi_control *control; msi_control *control;
...@@ -195,7 +195,7 @@ static msi_control *msi_dialog_find_control_by_type( msi_dialog *dialog, LPCWSTR ...@@ -195,7 +195,7 @@ static msi_control *msi_dialog_find_control_by_type( msi_dialog *dialog, LPCWSTR
return NULL; return NULL;
} }
static msi_control *msi_dialog_find_control_by_hwnd( msi_dialog *dialog, HWND hwnd ) static msi_control *dialog_find_control_by_hwnd( msi_dialog *dialog, HWND hwnd )
{ {
msi_control *control; msi_control *control;
...@@ -207,7 +207,7 @@ static msi_control *msi_dialog_find_control_by_hwnd( msi_dialog *dialog, HWND hw ...@@ -207,7 +207,7 @@ static msi_control *msi_dialog_find_control_by_hwnd( msi_dialog *dialog, HWND hw
return NULL; 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 ); LPCWSTR str = MSI_RecordGetString( rec, field );
LPWSTR ret = NULL; LPWSTR ret = NULL;
...@@ -217,7 +217,7 @@ static LPWSTR msi_get_deformatted_field( MSIPACKAGE *package, MSIRECORD *rec, in ...@@ -217,7 +217,7 @@ static LPWSTR msi_get_deformatted_field( MSIPACKAGE *package, MSIRECORD *rec, in
return ret; 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; LPWSTR prop = NULL;
...@@ -234,12 +234,12 @@ static LPWSTR msi_dialog_dup_property( msi_dialog *dialog, LPCWSTR property, BOO ...@@ -234,12 +234,12 @@ static LPWSTR msi_dialog_dup_property( msi_dialog *dialog, LPCWSTR property, BOO
} }
/* /*
* msi_dialog_get_style * dialog_get_style
* *
* Extract the {\style} string from the front of the text to display and * 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. * 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; LPWSTR ret;
LPCWSTR q, i, first; LPCWSTR q, i, first;
...@@ -276,7 +276,7 @@ static LPWSTR msi_dialog_get_style( LPCWSTR p, LPCWSTR *rest ) ...@@ -276,7 +276,7 @@ static LPWSTR msi_dialog_get_style( LPCWSTR p, LPCWSTR *rest )
return ret; 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_dialog *dialog = param;
msi_font *font; msi_font *font;
...@@ -322,7 +322,7 @@ static UINT msi_dialog_add_font( MSIRECORD *rec, LPVOID param ) ...@@ -322,7 +322,7 @@ static UINT msi_dialog_add_font( MSIRECORD *rec, LPVOID param )
return ERROR_SUCCESS; return ERROR_SUCCESS;
} }
static msi_font *msi_dialog_find_font( msi_dialog *dialog, LPCWSTR name ) static msi_font *dialog_find_font( msi_dialog *dialog, const WCHAR *name )
{ {
msi_font *font = NULL; msi_font *font = NULL;
...@@ -333,11 +333,11 @@ static msi_font *msi_dialog_find_font( msi_dialog *dialog, LPCWSTR name ) ...@@ -333,11 +333,11 @@ static msi_font *msi_dialog_find_font( msi_dialog *dialog, LPCWSTR name )
return font; 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; msi_font *font;
font = msi_dialog_find_font( dialog, name ); font = dialog_find_font( dialog, name );
if( font ) if( font )
SendMessageW( hwnd, WM_SETFONT, (WPARAM) font->hfont, TRUE ); SendMessageW( hwnd, WM_SETFONT, (WPARAM) font->hfont, TRUE );
else else
...@@ -345,7 +345,7 @@ static UINT msi_dialog_set_font( msi_dialog *dialog, HWND hwnd, LPCWSTR name ) ...@@ -345,7 +345,7 @@ static UINT msi_dialog_set_font( msi_dialog *dialog, HWND hwnd, LPCWSTR name )
return ERROR_SUCCESS; return ERROR_SUCCESS;
} }
static UINT msi_dialog_build_font_list( msi_dialog *dialog ) static UINT dialog_build_font_list( msi_dialog *dialog )
{ {
MSIQUERY *view; MSIQUERY *view;
UINT r; UINT r;
...@@ -356,12 +356,12 @@ static UINT msi_dialog_build_font_list( msi_dialog *dialog ) ...@@ -356,12 +356,12 @@ static UINT msi_dialog_build_font_list( msi_dialog *dialog )
if( r != ERROR_SUCCESS ) if( r != ERROR_SUCCESS )
return r; 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 ); msiobj_release( &view->hdr );
return r; return r;
} }
static void msi_destroy_control( msi_control *t ) static void destroy_control( msi_control *t )
{ {
list_remove( &t->entry ); list_remove( &t->entry );
/* leave dialog->hwnd - destroying parent destroys child windows */ /* leave dialog->hwnd - destroying parent destroys child windows */
...@@ -416,15 +416,15 @@ static msi_control *dialog_create_window( msi_dialog *dialog, MSIRECORD *rec, DW ...@@ -416,15 +416,15 @@ static msi_control *dialog_create_window( msi_dialog *dialog, MSIRECORD *rec, DW
width = MSI_RecordGetInteger( rec, 6 ); width = MSI_RecordGetInteger( rec, 6 );
height = MSI_RecordGetInteger( rec, 7 ); height = MSI_RecordGetInteger( rec, 7 );
x = msi_dialog_scale_unit( dialog, x ); x = dialog_scale_unit( dialog, x );
y = msi_dialog_scale_unit( dialog, y ); y = dialog_scale_unit( dialog, y );
width = msi_dialog_scale_unit( dialog, width ); width = dialog_scale_unit( dialog, width );
height = msi_dialog_scale_unit( dialog, height ); height = dialog_scale_unit( dialog, height );
if( text ) if( text )
{ {
deformat_string( dialog->package, text, &title_font ); deformat_string( dialog->package, text, &title_font );
font = msi_dialog_get_style( title_font, &title ); font = dialog_get_style( title_font, &title );
} }
control->hwnd = CreateWindowExW( exstyle, szCls, title, style, control->hwnd = CreateWindowExW( exstyle, szCls, title, style,
...@@ -433,8 +433,7 @@ static msi_control *dialog_create_window( msi_dialog *dialog, MSIRECORD *rec, DW ...@@ -433,8 +433,7 @@ static msi_control *dialog_create_window( msi_dialog *dialog, MSIRECORD *rec, DW
TRACE("Dialog %s control %s hwnd %p\n", TRACE("Dialog %s control %s hwnd %p\n",
debugstr_w(dialog->name), debugstr_w(text), control->hwnd ); debugstr_w(dialog->name), debugstr_w(text), control->hwnd );
msi_dialog_set_font( dialog, control->hwnd, dialog_set_font( dialog, control->hwnd, font ? font : dialog->default_font );
font ? font : dialog->default_font );
free( title_font ); free( title_font );
free( font ); free( font );
...@@ -442,7 +441,7 @@ static msi_control *dialog_create_window( msi_dialog *dialog, MSIRECORD *rec, DW ...@@ -442,7 +441,7 @@ static msi_control *dialog_create_window( msi_dialog *dialog, MSIRECORD *rec, DW
return control; 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; MSIRECORD *rec;
LPWSTR text; LPWSTR text;
...@@ -454,8 +453,7 @@ static LPWSTR msi_dialog_get_uitext( msi_dialog *dialog, LPCWSTR key ) ...@@ -454,8 +453,7 @@ static LPWSTR msi_dialog_get_uitext( msi_dialog *dialog, LPCWSTR key )
return text; return text;
} }
static HANDLE msi_load_image( MSIDATABASE *db, LPCWSTR name, UINT type, static HANDLE load_image( MSIDATABASE *db, const WCHAR *name, UINT type, UINT cx, UINT cy, UINT flags )
UINT cx, UINT cy, UINT flags )
{ {
MSIRECORD *rec; MSIRECORD *rec;
HANDLE himage = NULL; HANDLE himage = NULL;
...@@ -482,7 +480,7 @@ static HANDLE msi_load_image( MSIDATABASE *db, LPCWSTR name, UINT type, ...@@ -482,7 +480,7 @@ static HANDLE msi_load_image( MSIDATABASE *db, LPCWSTR name, UINT type,
return himage; 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; DWORD cx = 0, cy = 0, flags;
...@@ -502,10 +500,10 @@ static HICON msi_load_icon( MSIDATABASE *db, LPCWSTR text, UINT attributes ) ...@@ -502,10 +500,10 @@ static HICON msi_load_icon( MSIDATABASE *db, LPCWSTR text, UINT attributes )
} }
/* msidbControlAttributesIconSize48 handled by above logic */ /* 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; msi_control *control;
...@@ -516,7 +514,7 @@ static void msi_dialog_update_controls( msi_dialog *dialog, LPCWSTR property ) ...@@ -516,7 +514,7 @@ static void msi_dialog_update_controls( msi_dialog *dialog, LPCWSTR property )
} }
} }
static void msi_dialog_update_all_controls( msi_dialog *dialog ) static void dialog_update_all_controls( msi_dialog *dialog )
{ {
msi_control *control; msi_control *control;
...@@ -527,14 +525,14 @@ static void msi_dialog_update_all_controls( msi_dialog *dialog ) ...@@ -527,14 +525,14 @@ static void msi_dialog_update_all_controls( msi_dialog *dialog )
} }
} }
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 ); UINT r = msi_set_property( package->db, property, value, -1 );
if (r == ERROR_SUCCESS && !wcscmp( property, L"SourceDir" )) if (r == ERROR_SUCCESS && !wcscmp( property, L"SourceDir" ))
msi_reset_source_folders( package ); 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; TVITEMW tvi;
...@@ -554,18 +552,17 @@ struct msi_selection_tree_info ...@@ -554,18 +552,17 @@ struct msi_selection_tree_info
HTREEITEM selected; HTREEITEM selected;
}; };
static MSIFEATURE *msi_seltree_get_selected_feature( msi_control *control ) static MSIFEATURE *seltree_get_selected_feature( msi_control *control )
{ {
struct msi_selection_tree_info *info = GetPropW( control->hwnd, L"MSIDATA" ); 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, static void dialog_handle_event( msi_dialog *dialog, const WCHAR *control, const WCHAR *attribute, MSIRECORD *rec )
const WCHAR *attribute, MSIRECORD *rec )
{ {
msi_control* ctrl; msi_control* ctrl;
ctrl = msi_dialog_find_control( dialog, control ); ctrl = dialog_find_control( dialog, control );
if (!ctrl) if (!ctrl)
return; return;
if( !wcscmp( attribute, L"Text" ) ) if( !wcscmp( attribute, L"Text" ) )
...@@ -574,7 +571,7 @@ static void dialog_handle_event( msi_dialog *dialog, const WCHAR *control, ...@@ -574,7 +571,7 @@ static void dialog_handle_event( msi_dialog *dialog, const WCHAR *control,
WCHAR *font, *text_fmt = NULL; WCHAR *font, *text_fmt = NULL;
font_text = MSI_RecordGetString( rec , 1 ); 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 ); deformat_string( dialog->package, text, &text_fmt );
if (text_fmt) text = text_fmt; if (text_fmt) text = text_fmt;
else text = L""; else text = L"";
...@@ -642,13 +639,13 @@ static void dialog_handle_event( msi_dialog *dialog, const WCHAR *control, ...@@ -642,13 +639,13 @@ static void dialog_handle_event( msi_dialog *dialog, const WCHAR *control,
} }
else if ( !wcscmp( attribute, L"Property" ) ) else if ( !wcscmp( attribute, L"Property" ) )
{ {
MSIFEATURE *feature = msi_seltree_get_selected_feature( ctrl ); MSIFEATURE *feature = seltree_get_selected_feature( ctrl );
if (feature) msi_dialog_set_property( dialog->package, ctrl->property, feature->Directory ); if (feature) dialog_set_property( dialog->package, ctrl->property, feature->Directory );
} }
else if ( !wcscmp( attribute, L"SelectionPath" ) ) else if ( !wcscmp( attribute, L"SelectionPath" ) )
{ {
BOOL indirect = ctrl->attributes & msidbControlAttributesIndirect; 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; if (!path) return;
SetWindowTextW( ctrl->hwnd, path ); SetWindowTextW( ctrl->hwnd, path );
free( path ); free( path );
...@@ -721,8 +718,7 @@ static void dialog_map_events( msi_dialog *dialog, const WCHAR *control ) ...@@ -721,8 +718,7 @@ static void dialog_map_events( msi_dialog *dialog, const WCHAR *control )
} }
/* everything except radio buttons */ /* everything except radio buttons */
static msi_control *msi_dialog_add_control( msi_dialog *dialog, static msi_control *dialog_add_control( msi_dialog *dialog, MSIRECORD *rec, const WCHAR *szCls, DWORD style )
MSIRECORD *rec, LPCWSTR szCls, DWORD style )
{ {
DWORD attributes; DWORD attributes;
const WCHAR *text = NULL, *name, *control_type; const WCHAR *text = NULL, *name, *control_type;
...@@ -758,7 +754,7 @@ struct msi_text_info ...@@ -758,7 +754,7 @@ struct msi_text_info
* we don't erase our own background, * we don't erase our own background,
* so we have to make sure that the parent window redraws first * 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; HWND hParent;
RECT rc; RECT rc;
...@@ -769,8 +765,7 @@ static void msi_text_on_settext( HWND hWnd ) ...@@ -769,8 +765,7 @@ static void msi_text_on_settext( HWND hWnd )
InvalidateRect( hParent, &rc, TRUE ); InvalidateRect( hParent, &rc, TRUE );
} }
static LRESULT WINAPI static LRESULT WINAPI MSIText_WndProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam)
MSIText_WndProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam)
{ {
struct msi_text_info *info; struct msi_text_info *info;
LRESULT r = 0; LRESULT r = 0;
...@@ -793,7 +788,7 @@ MSIText_WndProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam) ...@@ -793,7 +788,7 @@ MSIText_WndProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam)
switch( msg ) switch( msg )
{ {
case WM_SETTEXT: case WM_SETTEXT:
msi_text_on_settext( hWnd ); text_on_settext( hWnd );
break; break;
case WM_NCDESTROY: case WM_NCDESTROY:
free( info ); free( info );
...@@ -804,7 +799,7 @@ MSIText_WndProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam) ...@@ -804,7 +799,7 @@ MSIText_WndProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam)
return r; 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; msi_control *control;
struct msi_text_info *info; struct msi_text_info *info;
...@@ -813,7 +808,7 @@ static UINT msi_dialog_text_control( msi_dialog *dialog, MSIRECORD *rec ) ...@@ -813,7 +808,7 @@ static UINT msi_dialog_text_control( msi_dialog *dialog, MSIRECORD *rec )
TRACE("%p %p\n", dialog, rec); 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 ) if( !control )
return ERROR_FUNCTION_FAILED; return ERROR_FUNCTION_FAILED;
...@@ -824,11 +819,11 @@ static UINT msi_dialog_text_control( msi_dialog *dialog, MSIRECORD *rec ) ...@@ -824,11 +819,11 @@ static UINT msi_dialog_text_control( msi_dialog *dialog, MSIRECORD *rec )
control_name = MSI_RecordGetString( rec, 2 ); control_name = MSI_RecordGetString( rec, 2 );
control->attributes = MSI_RecordGetInteger( rec, 8 ); control->attributes = MSI_RecordGetInteger( rec, 8 );
prop = MSI_RecordGetString( rec, 9 ); 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 ); text = MSI_RecordGetString( rec, 10 );
font_name = msi_dialog_get_style( text, &ptr ); font_name = dialog_get_style( text, &ptr );
info->font = ( font_name ) ? msi_dialog_find_font( dialog, font_name ) : NULL; info->font = ( font_name ) ? dialog_find_font( dialog, font_name ) : NULL;
free( font_name ); free( font_name );
info->attributes = MSI_RecordGetInteger( rec, 8 ); info->attributes = MSI_RecordGetInteger( rec, 8 );
...@@ -844,11 +839,11 @@ static UINT msi_dialog_text_control( msi_dialog *dialog, MSIRECORD *rec ) ...@@ -844,11 +839,11 @@ static UINT msi_dialog_text_control( msi_dialog *dialog, MSIRECORD *rec )
} }
/* strip any leading text style label from text field */ /* 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; WCHAR *p, *text;
text = msi_get_deformatted_field( package, rec, 10 ); text = get_deformatted_field( package, rec, 10 );
if (!text) if (!text)
return NULL; return NULL;
...@@ -864,7 +859,7 @@ static WCHAR *msi_get_binary_name( MSIPACKAGE *package, MSIRECORD *rec ) ...@@ -864,7 +859,7 @@ static WCHAR *msi_get_binary_name( MSIPACKAGE *package, MSIRECORD *rec )
return p; 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; LPWSTR p, prop, arg_fmt = NULL;
UINT len; UINT len;
...@@ -877,8 +872,8 @@ static UINT msi_dialog_set_property_event( msi_dialog *dialog, LPCWSTR event, LP ...@@ -877,8 +872,8 @@ static UINT msi_dialog_set_property_event( msi_dialog *dialog, LPCWSTR event, LP
{ {
*p = 0; *p = 0;
if (wcscmp( L"{}", arg )) deformat_string( dialog->package, arg, &arg_fmt ); if (wcscmp( L"{}", arg )) deformat_string( dialog->package, arg, &arg_fmt );
msi_dialog_set_property( dialog->package, prop, arg_fmt ); dialog_set_property( dialog->package, prop, arg_fmt );
msi_dialog_update_controls( dialog, prop ); dialog_update_controls( dialog, prop );
free( arg_fmt ); free( arg_fmt );
} }
else ERR("Badly formatted property string - what happens?\n"); else ERR("Badly formatted property string - what happens?\n");
...@@ -886,7 +881,7 @@ static UINT msi_dialog_set_property_event( msi_dialog *dialog, LPCWSTR event, LP ...@@ -886,7 +881,7 @@ static UINT msi_dialog_set_property_event( msi_dialog *dialog, LPCWSTR event, LP
return ERROR_SUCCESS; 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; LPWSTR event_fmt = NULL, arg_fmt = NULL;
...@@ -903,7 +898,7 @@ static UINT msi_dialog_send_event( msi_dialog *dialog, LPCWSTR event, LPCWSTR ar ...@@ -903,7 +898,7 @@ static UINT msi_dialog_send_event( msi_dialog *dialog, LPCWSTR event, LPCWSTR ar
return ERROR_SUCCESS; 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; msi_dialog *dialog = param;
LPCWSTR condition, event, arg; LPCWSTR condition, event, arg;
...@@ -916,14 +911,14 @@ static UINT msi_dialog_control_event( MSIRECORD *rec, LPVOID param ) ...@@ -916,14 +911,14 @@ static UINT msi_dialog_control_event( MSIRECORD *rec, LPVOID param )
event = MSI_RecordGetString( rec, 3 ); event = MSI_RecordGetString( rec, 3 );
arg = MSI_RecordGetString( rec, 4 ); arg = MSI_RecordGetString( rec, 4 );
if (event[0] == '[') if (event[0] == '[')
msi_dialog_set_property_event( dialog, event, arg ); dialog_set_property_event( dialog, event, arg );
else else
msi_dialog_send_event( dialog, event, arg ); dialog_send_event( dialog, event, arg );
} }
return ERROR_SUCCESS; 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, msi_control *control, WPARAM param )
{ {
MSIQUERY *view; MSIQUERY *view;
UINT r; UINT r;
...@@ -939,7 +934,7 @@ static UINT msi_dialog_button_handler( msi_dialog *dialog, msi_control *control, ...@@ -939,7 +934,7 @@ static UINT msi_dialog_button_handler( msi_dialog *dialog, msi_control *control,
ERR("query failed\n"); ERR("query failed\n");
return ERROR_SUCCESS; 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 ); msiobj_release( &view->hdr );
/* dialog control events must be processed last regardless of ordering */ /* dialog control events must be processed last regardless of ordering */
...@@ -954,7 +949,7 @@ static UINT msi_dialog_button_handler( msi_dialog *dialog, msi_control *control, ...@@ -954,7 +949,7 @@ static UINT msi_dialog_button_handler( msi_dialog *dialog, msi_control *control,
return r; 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; HBITMAP hOleBitmap = 0, hBitmap = 0, hOldSrcBitmap, hOldDestBitmap;
MSIRECORD *rec = NULL; MSIRECORD *rec = NULL;
...@@ -1018,7 +1013,7 @@ end: ...@@ -1018,7 +1013,7 @@ end:
return hBitmap; 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; msi_control *control;
UINT attributes, style, cx = 0, cy = 0, flags = 0; UINT attributes, style, cx = 0, cy = 0, flags = 0;
...@@ -1035,21 +1030,21 @@ static UINT msi_dialog_button_control( msi_dialog *dialog, MSIRECORD *rec ) ...@@ -1035,21 +1030,21 @@ static UINT msi_dialog_button_control( msi_dialog *dialog, MSIRECORD *rec )
if (attributes & msidbControlAttributesFixedSize) flags |= LR_DEFAULTSIZE; if (attributes & msidbControlAttributesFixedSize) flags |= LR_DEFAULTSIZE;
else else
{ {
cx = msi_dialog_scale_unit( dialog, MSI_RecordGetInteger(rec, 6) ); cx = dialog_scale_unit( dialog, MSI_RecordGetInteger(rec, 6) );
cy = msi_dialog_scale_unit( dialog, MSI_RecordGetInteger(rec, 7) ); 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) if (!control)
return ERROR_FUNCTION_FAILED; return ERROR_FUNCTION_FAILED;
control->handler = msi_dialog_button_handler; control->handler = dialog_button_handler;
if (attributes & msidbControlAttributesIcon) if (attributes & msidbControlAttributesIcon)
{ {
name = msi_get_binary_name( dialog->package, rec ); name = get_binary_name( dialog->package, rec );
control->hIcon = msi_load_icon( dialog->package->db, name, attributes ); control->hIcon = load_icon( dialog->package->db, name, attributes );
if (control->hIcon) if (control->hIcon)
{ {
SendMessageW( control->hwnd, BM_SETIMAGE, IMAGE_ICON, (LPARAM) control->hIcon ); SendMessageW( control->hwnd, BM_SETIMAGE, IMAGE_ICON, (LPARAM) control->hIcon );
...@@ -1058,8 +1053,8 @@ static UINT msi_dialog_button_control( msi_dialog *dialog, MSIRECORD *rec ) ...@@ -1058,8 +1053,8 @@ static UINT msi_dialog_button_control( msi_dialog *dialog, MSIRECORD *rec )
} }
else if (attributes & msidbControlAttributesBitmap) else if (attributes & msidbControlAttributesBitmap)
{ {
name = msi_get_binary_name( dialog->package, rec ); name = get_binary_name( dialog->package, rec );
control->hBitmap = msi_load_picture( dialog->package->db, name, cx, cy, flags ); control->hBitmap = load_picture( dialog->package->db, name, cx, cy, flags );
if (control->hBitmap) if (control->hBitmap)
{ {
SendMessageW( control->hwnd, BM_SETIMAGE, IMAGE_BITMAP, (LPARAM) control->hBitmap ); SendMessageW( control->hwnd, BM_SETIMAGE, IMAGE_BITMAP, (LPARAM) control->hBitmap );
...@@ -1071,7 +1066,7 @@ static UINT msi_dialog_button_control( msi_dialog *dialog, MSIRECORD *rec ) ...@@ -1071,7 +1066,7 @@ static UINT msi_dialog_button_control( msi_dialog *dialog, MSIRECORD *rec )
return ERROR_SUCCESS; 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; MSIRECORD *rec = NULL;
LPWSTR ret = NULL; LPWSTR ret = NULL;
...@@ -1081,7 +1076,7 @@ static LPWSTR msi_get_checkbox_value( msi_dialog *dialog, LPCWSTR prop ) ...@@ -1081,7 +1076,7 @@ static LPWSTR msi_get_checkbox_value( msi_dialog *dialog, LPCWSTR prop )
if (!rec) if (!rec)
return ret; return ret;
ret = msi_get_deformatted_field( dialog->package, rec, 2 ); ret = get_deformatted_field( dialog->package, rec, 2 );
if( ret && !ret[0] ) if( ret && !ret[0] )
{ {
free( ret ); free( ret );
...@@ -1101,7 +1096,7 @@ static LPWSTR msi_get_checkbox_value( msi_dialog *dialog, LPCWSTR prop ) ...@@ -1101,7 +1096,7 @@ static LPWSTR msi_get_checkbox_value( msi_dialog *dialog, LPCWSTR prop )
return ret; return ret;
} }
static UINT msi_dialog_get_checkbox_state( msi_dialog *dialog, msi_control *control ) static UINT dialog_get_checkbox_state( msi_dialog *dialog, msi_control *control )
{ {
WCHAR state[2] = {0}; WCHAR state[2] = {0};
DWORD sz = 2; DWORD sz = 2;
...@@ -1110,14 +1105,14 @@ static UINT msi_dialog_get_checkbox_state( msi_dialog *dialog, msi_control *cont ...@@ -1110,14 +1105,14 @@ static UINT msi_dialog_get_checkbox_state( msi_dialog *dialog, msi_control *cont
return state[0] ? 1 : 0; 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, msi_control *control, UINT state )
{ {
LPCWSTR val; LPCWSTR val;
/* if uncheck then the property is set to NULL */ /* if uncheck then the property is set to NULL */
if (!state) if (!state)
{ {
msi_dialog_set_property( dialog->package, control->property, NULL ); dialog_set_property( dialog->package, control->property, NULL );
return; return;
} }
...@@ -1127,16 +1122,16 @@ static void msi_dialog_set_checkbox_state( msi_dialog *dialog, msi_control *cont ...@@ -1127,16 +1122,16 @@ static void msi_dialog_set_checkbox_state( msi_dialog *dialog, msi_control *cont
else else
val = L"1"; 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, msi_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 ); 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, msi_control *control, WPARAM param )
{ {
UINT state; UINT state;
...@@ -1145,36 +1140,36 @@ static UINT msi_dialog_checkbox_handler( msi_dialog *dialog, msi_control *contro ...@@ -1145,36 +1140,36 @@ 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)); 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; state = state ? 0 : 1;
msi_dialog_set_checkbox_state( dialog, control, state ); dialog_set_checkbox_state( dialog, control, state );
msi_dialog_checkbox_sync_state( dialog, control ); 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; msi_control *control;
LPCWSTR prop; LPCWSTR prop;
TRACE("%p %p\n", dialog, rec); TRACE("%p %p\n", dialog, rec);
control = msi_dialog_add_control( dialog, rec, L"BUTTON", BS_CHECKBOX | BS_MULTILINE | WS_TABSTOP ); control = dialog_add_control( dialog, rec, L"BUTTON", BS_CHECKBOX | BS_MULTILINE | WS_TABSTOP );
control->handler = msi_dialog_checkbox_handler; control->handler = dialog_checkbox_handler;
control->update = msi_dialog_checkbox_sync_state; control->update = dialog_checkbox_sync_state;
prop = MSI_RecordGetString( rec, 9 ); prop = MSI_RecordGetString( rec, 9 );
if (prop) if (prop)
{ {
control->property = wcsdup( prop ); control->property = wcsdup( prop );
control->value = msi_get_checkbox_value( dialog, prop ); control->value = get_checkbox_value( dialog, prop );
TRACE("control %s value %s\n", debugstr_w(control->property), debugstr_w(control->value)); 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; 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; DWORD attributes;
LPCWSTR name; LPCWSTR name;
...@@ -1220,9 +1215,9 @@ static UINT msi_dialog_line_control( msi_dialog *dialog, MSIRECORD *rec ) ...@@ -1220,9 +1215,9 @@ static UINT msi_dialog_line_control( msi_dialog *dialog, MSIRECORD *rec )
y = MSI_RecordGetInteger( rec, 5 ); y = MSI_RecordGetInteger( rec, 5 );
width = MSI_RecordGetInteger( rec, 6 ); width = MSI_RecordGetInteger( rec, 6 );
x = msi_dialog_scale_unit( dialog, x ); x = dialog_scale_unit( dialog, x );
y = msi_dialog_scale_unit( dialog, y ); y = dialog_scale_unit( dialog, y );
width = msi_dialog_scale_unit( dialog, width ); width = dialog_scale_unit( dialog, width );
height = 2; /* line is exactly 2 units in height */ height = 2; /* line is exactly 2 units in height */
control->hwnd = CreateWindowExW( exstyle, L"Static", NULL, style, control->hwnd = CreateWindowExW( exstyle, L"Static", NULL, style,
...@@ -1243,8 +1238,7 @@ struct msi_scrolltext_info ...@@ -1243,8 +1238,7 @@ struct msi_scrolltext_info
WNDPROC oldproc; WNDPROC oldproc;
}; };
static LRESULT WINAPI static LRESULT WINAPI MSIScrollText_WndProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam)
MSIScrollText_WndProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam)
{ {
struct msi_scrolltext_info *info; struct msi_scrolltext_info *info;
HRESULT r; HRESULT r;
...@@ -1265,7 +1259,7 @@ MSIScrollText_WndProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam) ...@@ -1265,7 +1259,7 @@ MSIScrollText_WndProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam)
break; break;
case WM_PAINT: case WM_PAINT:
/* native MSI sets a wait cursor here */ /* 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; break;
} }
return r; return r;
...@@ -1278,8 +1272,7 @@ struct msi_streamin_info ...@@ -1278,8 +1272,7 @@ struct msi_streamin_info
DWORD length; DWORD length;
}; };
static DWORD CALLBACK static DWORD CALLBACK richedit_stream_in( DWORD_PTR arg, BYTE *buffer, LONG count, LONG *pcb )
msi_richedit_stream_in( DWORD_PTR arg, LPBYTE buffer, LONG count, LONG *pcb )
{ {
struct msi_streamin_info *info = (struct msi_streamin_info*) arg; struct msi_streamin_info *info = (struct msi_streamin_info*) arg;
...@@ -1294,7 +1287,7 @@ msi_richedit_stream_in( DWORD_PTR arg, LPBYTE buffer, LONG count, LONG *pcb ) ...@@ -1294,7 +1287,7 @@ msi_richedit_stream_in( DWORD_PTR arg, LPBYTE buffer, LONG count, LONG *pcb )
return 0; return 0;
} }
static void msi_scrolltext_add_text( msi_control *control, LPCWSTR text ) static void scrolltext_add_text( msi_control *control, const WCHAR *text )
{ {
struct msi_streamin_info info; struct msi_streamin_info info;
EDITSTREAM es; EDITSTREAM es;
...@@ -1305,14 +1298,14 @@ static void msi_scrolltext_add_text( msi_control *control, LPCWSTR text ) ...@@ -1305,14 +1298,14 @@ static void msi_scrolltext_add_text( msi_control *control, LPCWSTR text )
es.dwCookie = (DWORD_PTR) &info; es.dwCookie = (DWORD_PTR) &info;
es.dwError = 0; es.dwError = 0;
es.pfnCallback = msi_richedit_stream_in; es.pfnCallback = richedit_stream_in;
SendMessageW( control->hwnd, EM_STREAMIN, SF_RTF, (LPARAM) &es ); SendMessageW( control->hwnd, EM_STREAMIN, SF_RTF, (LPARAM) &es );
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; struct msi_scrolltext_info *info;
msi_control *control; msi_control *control;
...@@ -1328,7 +1321,7 @@ static UINT msi_dialog_scrolltext_control( msi_dialog *dialog, MSIRECORD *rec ) ...@@ -1328,7 +1321,7 @@ static UINT msi_dialog_scrolltext_control( msi_dialog *dialog, MSIRECORD *rec )
style = WS_BORDER | ES_MULTILINE | WS_VSCROLL | style = WS_BORDER | ES_MULTILINE | WS_VSCROLL |
ES_READONLY | ES_AUTOVSCROLL | WS_TABSTOP; 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) if (!control)
{ {
FreeLibrary( hRichedit ); FreeLibrary( hRichedit );
...@@ -1349,13 +1342,13 @@ static UINT msi_dialog_scrolltext_control( msi_dialog *dialog, MSIRECORD *rec ) ...@@ -1349,13 +1342,13 @@ static UINT msi_dialog_scrolltext_control( msi_dialog *dialog, MSIRECORD *rec )
/* add the text into the richedit */ /* add the text into the richedit */
text = MSI_RecordGetString( rec, 10 ); text = MSI_RecordGetString( rec, 10 );
if (text) if (text)
msi_scrolltext_add_text( control, text ); scrolltext_add_text( control, text );
return ERROR_SUCCESS; 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; UINT cx, cy, flags, style, attributes;
msi_control *control; msi_control *control;
...@@ -1371,14 +1364,14 @@ static UINT msi_dialog_bitmap_control( msi_dialog *dialog, MSIRECORD *rec ) ...@@ -1371,14 +1364,14 @@ static UINT msi_dialog_bitmap_control( msi_dialog *dialog, MSIRECORD *rec )
style |= SS_CENTERIMAGE; 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 ); cx = MSI_RecordGetInteger( rec, 6 );
cy = MSI_RecordGetInteger( rec, 7 ); cy = MSI_RecordGetInteger( rec, 7 );
cx = msi_dialog_scale_unit( dialog, cx ); cx = dialog_scale_unit( dialog, cx );
cy = msi_dialog_scale_unit( dialog, cy ); cy = dialog_scale_unit( dialog, cy );
name = msi_get_binary_name( dialog->package, rec ); name = get_binary_name( dialog->package, rec );
control->hBitmap = msi_load_picture( dialog->package->db, name, cx, cy, flags ); control->hBitmap = load_picture( dialog->package->db, name, cx, cy, flags );
if( control->hBitmap ) if( control->hBitmap )
SendMessageW( control->hwnd, STM_SETIMAGE, SendMessageW( control->hwnd, STM_SETIMAGE,
IMAGE_BITMAP, (LPARAM) control->hBitmap ); IMAGE_BITMAP, (LPARAM) control->hBitmap );
...@@ -1390,7 +1383,7 @@ static UINT msi_dialog_bitmap_control( msi_dialog *dialog, MSIRECORD *rec ) ...@@ -1390,7 +1383,7 @@ static UINT msi_dialog_bitmap_control( msi_dialog *dialog, MSIRECORD *rec )
return ERROR_SUCCESS; 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; msi_control *control;
DWORD attributes; DWORD attributes;
...@@ -1398,12 +1391,11 @@ static UINT msi_dialog_icon_control( msi_dialog *dialog, MSIRECORD *rec ) ...@@ -1398,12 +1391,11 @@ static UINT msi_dialog_icon_control( msi_dialog *dialog, MSIRECORD *rec )
TRACE("\n"); TRACE("\n");
control = msi_dialog_add_control( dialog, rec, L"Static", control = dialog_add_control( dialog, rec, L"Static", SS_ICON | SS_CENTERIMAGE | WS_GROUP );
SS_ICON | SS_CENTERIMAGE | WS_GROUP );
attributes = MSI_RecordGetInteger( rec, 8 ); attributes = MSI_RecordGetInteger( rec, 8 );
name = msi_get_binary_name( dialog->package, rec ); name = get_binary_name( dialog->package, rec );
control->hIcon = msi_load_icon( dialog->package->db, name, attributes ); control->hIcon = load_icon( dialog->package->db, name, attributes );
if( control->hIcon ) if( control->hIcon )
SendMessageW( control->hwnd, STM_SETICON, (WPARAM) control->hIcon, 0 ); SendMessageW( control->hwnd, STM_SETICON, (WPARAM) control->hIcon, 0 );
else else
...@@ -1452,7 +1444,7 @@ static LRESULT WINAPI MSIComboBox_WndProc(HWND hWnd, UINT msg, WPARAM wParam, LP ...@@ -1452,7 +1444,7 @@ static LRESULT WINAPI MSIComboBox_WndProc(HWND hWnd, UINT msg, WPARAM wParam, LP
return r; 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; struct msi_combobox_info *info = param;
LPCWSTR value, text; LPCWSTR value, text;
...@@ -1470,7 +1462,7 @@ static UINT msi_combobox_add_item( MSIRECORD *rec, LPVOID param ) ...@@ -1470,7 +1462,7 @@ static UINT msi_combobox_add_item( MSIRECORD *rec, LPVOID param )
return ERROR_SUCCESS; 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; MSIQUERY *view;
DWORD count; DWORD count;
...@@ -1492,12 +1484,12 @@ static UINT msi_combobox_add_items( struct msi_combobox_info *info, LPCWSTR prop ...@@ -1492,12 +1484,12 @@ static UINT msi_combobox_add_items( struct msi_combobox_info *info, LPCWSTR prop
info->num_items = count; info->num_items = count;
info->items = malloc( 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 ); msiobj_release( &view->hdr );
return r; 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_dialog *dialog = param;
msi_control *control; msi_control *control;
...@@ -1508,7 +1500,7 @@ static UINT msi_dialog_set_control_condition( MSIRECORD *rec, LPVOID param ) ...@@ -1508,7 +1500,7 @@ static UINT msi_dialog_set_control_condition( MSIRECORD *rec, LPVOID param )
action = MSI_RecordGetString( rec, 3 ); action = MSI_RecordGetString( rec, 3 );
condition = MSI_RecordGetString( rec, 4 ); condition = MSI_RecordGetString( rec, 4 );
r = MSI_EvaluateConditionW( dialog->package, condition ); r = MSI_EvaluateConditionW( dialog->package, condition );
control = msi_dialog_find_control( dialog, name ); control = dialog_find_control( dialog, name );
if (r == MSICONDITION_TRUE && control) if (r == MSICONDITION_TRUE && control)
{ {
TRACE("%s control %s\n", debugstr_w(action), debugstr_w(name)); TRACE("%s control %s\n", debugstr_w(action), debugstr_w(name));
...@@ -1530,7 +1522,7 @@ static UINT msi_dialog_set_control_condition( MSIRECORD *rec, LPVOID param ) ...@@ -1530,7 +1522,7 @@ static UINT msi_dialog_set_control_condition( MSIRECORD *rec, LPVOID param )
return ERROR_SUCCESS; return ERROR_SUCCESS;
} }
static UINT msi_dialog_evaluate_control_conditions( msi_dialog *dialog ) static UINT dialog_evaluate_control_conditions( msi_dialog *dialog )
{ {
UINT r; UINT r;
MSIQUERY *view; MSIQUERY *view;
...@@ -1543,12 +1535,12 @@ static UINT msi_dialog_evaluate_control_conditions( msi_dialog *dialog ) ...@@ -1543,12 +1535,12 @@ static UINT msi_dialog_evaluate_control_conditions( msi_dialog *dialog )
if (r != ERROR_SUCCESS) if (r != ERROR_SUCCESS)
return 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 ); msiobj_release( &view->hdr );
return r; return r;
} }
static UINT msi_dialog_combobox_handler( msi_dialog *dialog, msi_control *control, WPARAM param ) static UINT dialog_combobox_handler( msi_dialog *dialog, msi_control *control, WPARAM param )
{ {
struct msi_combobox_info *info; struct msi_combobox_info *info;
int index; int index;
...@@ -1560,12 +1552,12 @@ static UINT msi_dialog_combobox_handler( msi_dialog *dialog, msi_control *contro ...@@ -1560,12 +1552,12 @@ static UINT msi_dialog_combobox_handler( msi_dialog *dialog, msi_control *contro
info = GetPropW( control->hwnd, L"MSIDATA" ); info = GetPropW( control->hwnd, L"MSIDATA" );
index = SendMessageW( control->hwnd, CB_GETCURSEL, 0, 0 ); index = SendMessageW( control->hwnd, CB_GETCURSEL, 0, 0 );
if (index == CB_ERR) if (index == CB_ERR)
value = msi_get_window_text( control->hwnd ); value = get_window_text( control->hwnd );
else else
value = (LPWSTR) SendMessageW( control->hwnd, CB_GETITEMDATA, index, 0 ); value = (LPWSTR) SendMessageW( control->hwnd, CB_GETITEMDATA, index, 0 );
msi_dialog_set_property( info->dialog->package, control->property, value ); dialog_set_property( info->dialog->package, control->property, value );
msi_dialog_evaluate_control_conditions( info->dialog ); dialog_evaluate_control_conditions( info->dialog );
if (index == CB_ERR) if (index == CB_ERR)
free( value ); free( value );
...@@ -1573,7 +1565,7 @@ static UINT msi_dialog_combobox_handler( msi_dialog *dialog, msi_control *contro ...@@ -1573,7 +1565,7 @@ static UINT msi_dialog_combobox_handler( msi_dialog *dialog, msi_control *contro
return ERROR_SUCCESS; return ERROR_SUCCESS;
} }
static void msi_dialog_combobox_update( msi_dialog *dialog, msi_control *control ) static void dialog_combobox_update( msi_dialog *dialog, msi_control *control )
{ {
struct msi_combobox_info *info; struct msi_combobox_info *info;
LPWSTR value, tmp; LPWSTR value, tmp;
...@@ -1608,7 +1600,7 @@ static void msi_dialog_combobox_update( msi_dialog *dialog, msi_control *control ...@@ -1608,7 +1600,7 @@ static void msi_dialog_combobox_update( msi_dialog *dialog, msi_control *control
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; struct msi_combobox_info *info;
msi_control *control; msi_control *control;
...@@ -1628,18 +1620,18 @@ static UINT msi_dialog_combo_control( msi_dialog *dialog, MSIRECORD *rec ) ...@@ -1628,18 +1620,18 @@ static UINT msi_dialog_combo_control( msi_dialog *dialog, MSIRECORD *rec )
else else
style |= CBS_DROPDOWN; style |= CBS_DROPDOWN;
control = msi_dialog_add_control( dialog, rec, WC_COMBOBOXW, style ); control = dialog_add_control( dialog, rec, WC_COMBOBOXW, style );
if (!control) if (!control)
{ {
free( info ); free( info );
return ERROR_FUNCTION_FAILED; return ERROR_FUNCTION_FAILED;
} }
control->handler = msi_dialog_combobox_handler; control->handler = dialog_combobox_handler;
control->update = msi_dialog_combobox_update; control->update = dialog_combobox_update;
prop = MSI_RecordGetString( rec, 9 ); prop = MSI_RecordGetString( rec, 9 );
control->property = msi_dialog_dup_property( dialog, prop, FALSE ); control->property = dialog_dup_property( dialog, prop, FALSE );
/* subclass */ /* subclass */
info->dialog = dialog; info->dialog = dialog;
...@@ -1651,14 +1643,14 @@ static UINT msi_dialog_combo_control( msi_dialog *dialog, MSIRECORD *rec ) ...@@ -1651,14 +1643,14 @@ static UINT msi_dialog_combo_control( msi_dialog *dialog, MSIRECORD *rec )
SetPropW( control->hwnd, L"MSIDATA", info ); SetPropW( control->hwnd, L"MSIDATA", info );
if (control->property) 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; 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, msi_control *control, WPARAM param )
{ {
LPWSTR buf; LPWSTR buf;
...@@ -1667,8 +1659,8 @@ static UINT msi_dialog_edit_handler( msi_dialog *dialog, msi_control *control, W ...@@ -1667,8 +1659,8 @@ 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)); TRACE("edit %s contents changed, set %s\n", debugstr_w(control->name), debugstr_w(control->property));
buf = msi_get_window_text( control->hwnd ); buf = get_window_text( control->hwnd );
msi_dialog_set_property( dialog->package, control->property, buf ); dialog_set_property( dialog->package, control->property, buf );
free( buf ); free( buf );
return ERROR_SUCCESS; return ERROR_SUCCESS;
...@@ -1677,7 +1669,7 @@ static UINT msi_dialog_edit_handler( msi_dialog *dialog, msi_control *control, W ...@@ -1677,7 +1669,7 @@ static UINT msi_dialog_edit_handler( msi_dialog *dialog, msi_control *control, W
/* length of 2^32 + 1 */ /* length of 2^32 + 1 */
#define MAX_NUM_DIGITS 11 #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; msi_control *control;
LPCWSTR prop, text; LPCWSTR prop, text;
...@@ -1685,9 +1677,8 @@ static UINT msi_dialog_edit_control( msi_dialog *dialog, MSIRECORD *rec ) ...@@ -1685,9 +1677,8 @@ static UINT msi_dialog_edit_control( msi_dialog *dialog, MSIRECORD *rec )
WCHAR num[MAX_NUM_DIGITS]; WCHAR num[MAX_NUM_DIGITS];
DWORD limit; DWORD limit;
control = msi_dialog_add_control( dialog, rec, L"Edit", control = dialog_add_control( dialog, rec, L"Edit", WS_BORDER | WS_TABSTOP | ES_AUTOHSCROLL );
WS_BORDER | WS_TABSTOP | ES_AUTOHSCROLL ); control->handler = dialog_edit_handler;
control->handler = msi_dialog_edit_handler;
text = MSI_RecordGetString( rec, 10 ); text = MSI_RecordGetString( rec, 10 );
if ( text ) if ( text )
...@@ -1739,7 +1730,7 @@ struct msi_maskedit_info ...@@ -1739,7 +1730,7 @@ struct msi_maskedit_info
struct msi_mask_group group[MASK_MAX_GROUPS]; struct msi_mask_group group[MASK_MAX_GROUPS];
}; };
static BOOL msi_mask_editable( WCHAR type ) static BOOL mask_editable( WCHAR type )
{ {
switch (type) switch (type)
{ {
...@@ -1754,7 +1745,7 @@ static BOOL msi_mask_editable( WCHAR type ) ...@@ -1754,7 +1745,7 @@ static BOOL msi_mask_editable( WCHAR type )
return FALSE; 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; LPWSTR val;
UINT i, n, r; UINT i, n, r;
...@@ -1775,7 +1766,7 @@ static void msi_mask_control_change( struct msi_maskedit_info *info ) ...@@ -1775,7 +1766,7 @@ static void msi_mask_control_change( struct msi_maskedit_info *info )
ERR("can't fit control %d text into template\n",i); ERR("can't fit control %d text into template\n",i);
break; break;
} }
if (!msi_mask_editable(info->group[i].type)) if (!mask_editable(info->group[i].type))
{ {
for(r=0; r<info->group[i].len; r++) for(r=0; r<info->group[i].len; r++)
val[n+r] = info->group[i].type; val[n+r] = info->group[i].type;
...@@ -1796,14 +1787,14 @@ static void msi_mask_control_change( struct msi_maskedit_info *info ) ...@@ -1796,14 +1787,14 @@ static void msi_mask_control_change( struct msi_maskedit_info *info )
if( i == info->num_groups ) if( i == info->num_groups )
{ {
TRACE("Set property %s to %s\n", debugstr_w(info->prop), debugstr_w(val)); TRACE("Set property %s to %s\n", debugstr_w(info->prop), debugstr_w(val));
msi_dialog_set_property( info->dialog->package, info->prop, val ); dialog_set_property( info->dialog->package, info->prop, val );
msi_dialog_evaluate_control_conditions( info->dialog ); dialog_evaluate_control_conditions( info->dialog );
} }
free( val ); free( val );
} }
/* now move to the next control if necessary */ /* 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; HWND hWndNext;
UINT len, i; UINT len, i;
...@@ -1824,8 +1815,7 @@ static VOID msi_mask_next_control( struct msi_maskedit_info *info, HWND hWnd ) ...@@ -1824,8 +1815,7 @@ static VOID msi_mask_next_control( struct msi_maskedit_info *info, HWND hWnd )
SetFocus( hWndNext ); SetFocus( hWndNext );
} }
static LRESULT WINAPI static LRESULT WINAPI MSIMaskedEdit_WndProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam)
MSIMaskedEdit_WndProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam)
{ {
struct msi_maskedit_info *info; struct msi_maskedit_info *info;
HRESULT r; HRESULT r;
...@@ -1841,8 +1831,8 @@ MSIMaskedEdit_WndProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam) ...@@ -1841,8 +1831,8 @@ MSIMaskedEdit_WndProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam)
case WM_COMMAND: case WM_COMMAND:
if (HIWORD(wParam) == EN_CHANGE) if (HIWORD(wParam) == EN_CHANGE)
{ {
msi_mask_control_change( info ); mask_control_change( info );
msi_mask_next_control( info, (HWND) lParam ); mask_next_control( info, (HWND) lParam );
} }
break; break;
case WM_NCDESTROY: case WM_NCDESTROY:
...@@ -1856,8 +1846,7 @@ MSIMaskedEdit_WndProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam) ...@@ -1856,8 +1846,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 */ /* fish the various bits of the property out and put them in the control */
static void static void maskedit_set_text( struct msi_maskedit_info *info, const WCHAR *text )
msi_maskedit_set_text( struct msi_maskedit_info *info, LPCWSTR text )
{ {
LPCWSTR p; LPCWSTR p;
UINT i; UINT i;
...@@ -1881,7 +1870,7 @@ msi_maskedit_set_text( struct msi_maskedit_info *info, LPCWSTR text ) ...@@ -1881,7 +1870,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; struct msi_maskedit_info *info;
int i = 0, n = 0, total = 0; int i = 0, n = 0, total = 0;
...@@ -1942,8 +1931,7 @@ static struct msi_maskedit_info * msi_dialog_parse_groups( LPCWSTR mask ) ...@@ -1942,8 +1931,7 @@ static struct msi_maskedit_info * msi_dialog_parse_groups( LPCWSTR mask )
return info; return info;
} }
static void static void maskedit_create_children( struct msi_maskedit_info *info, const WCHAR *font )
msi_maskedit_create_children( struct msi_maskedit_info *info, LPCWSTR font )
{ {
DWORD width, height, style, wx, ww; DWORD width, height, style, wx, ww;
RECT rect; RECT rect;
...@@ -1959,7 +1947,7 @@ msi_maskedit_create_children( struct msi_maskedit_info *info, LPCWSTR font ) ...@@ -1959,7 +1947,7 @@ msi_maskedit_create_children( struct msi_maskedit_info *info, LPCWSTR font )
for( i = 0; i < info->num_groups; i++ ) for( i = 0; i < info->num_groups; i++ )
{ {
if (!msi_mask_editable( info->group[i].type )) if (!mask_editable( info->group[i].type ))
continue; continue;
if (info->num_chars) if (info->num_chars)
{ {
...@@ -1981,8 +1969,7 @@ msi_maskedit_create_children( struct msi_maskedit_info *info, LPCWSTR font ) ...@@ -1981,8 +1969,7 @@ msi_maskedit_create_children( struct msi_maskedit_info *info, LPCWSTR font )
SendMessageW( hwnd, EM_LIMITTEXT, info->group[i].len, 0 ); SendMessageW( hwnd, EM_LIMITTEXT, info->group[i].len, 0 );
msi_dialog_set_font( info->dialog, hwnd, dialog_set_font( info->dialog, hwnd, font?font:info->dialog->default_font );
font?font:info->dialog->default_font );
info->group[i].hwnd = hwnd; info->group[i].hwnd = hwnd;
} }
} }
...@@ -1992,7 +1979,7 @@ msi_maskedit_create_children( struct msi_maskedit_info *info, LPCWSTR font ) ...@@ -1992,7 +1979,7 @@ msi_maskedit_create_children( struct msi_maskedit_info *info, LPCWSTR font )
* delphi 7 uses "<????-??????-??????-????>" and "<???-???>" * delphi 7 uses "<????-??????-??????-????>" and "<???-???>"
* filemaker pro 7 uses "<^^^^=^^^^=^^^^=^^^^=^^^^=^^^^=^^^^^>" * 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; LPWSTR font_mask, val = NULL, font;
struct msi_maskedit_info *info = NULL; struct msi_maskedit_info *info = NULL;
...@@ -2002,15 +1989,15 @@ static UINT msi_dialog_maskedit_control( msi_dialog *dialog, MSIRECORD *rec ) ...@@ -2002,15 +1989,15 @@ static UINT msi_dialog_maskedit_control( msi_dialog *dialog, MSIRECORD *rec )
TRACE("\n"); TRACE("\n");
font_mask = msi_get_deformatted_field( dialog->package, rec, 10 ); font_mask = get_deformatted_field( dialog->package, rec, 10 );
font = msi_dialog_get_style( font_mask, &mask ); font = dialog_get_style( font_mask, &mask );
if( !mask ) if( !mask )
{ {
WARN("mask template is empty\n"); WARN("mask template is empty\n");
goto end; goto end;
} }
info = msi_dialog_parse_groups( mask ); info = dialog_parse_groups( mask );
if( !info ) if( !info )
{ {
ERR("template %s is invalid\n", debugstr_w(mask)); ERR("template %s is invalid\n", debugstr_w(mask));
...@@ -2019,8 +2006,7 @@ static UINT msi_dialog_maskedit_control( msi_dialog *dialog, MSIRECORD *rec ) ...@@ -2019,8 +2006,7 @@ static UINT msi_dialog_maskedit_control( msi_dialog *dialog, MSIRECORD *rec )
info->dialog = dialog; info->dialog = dialog;
control = msi_dialog_add_control( dialog, rec, L"Static", control = dialog_add_control( dialog, rec, L"Static", SS_OWNERDRAW | WS_GROUP | WS_VISIBLE );
SS_OWNERDRAW | WS_GROUP | WS_VISIBLE );
if( !control ) if( !control )
{ {
ERR("Failed to create maskedit container\n"); ERR("Failed to create maskedit container\n");
...@@ -2040,14 +2026,14 @@ static UINT msi_dialog_maskedit_control( msi_dialog *dialog, MSIRECORD *rec ) ...@@ -2040,14 +2026,14 @@ static UINT msi_dialog_maskedit_control( msi_dialog *dialog, MSIRECORD *rec )
if( prop ) if( prop )
info->prop = wcsdup( prop ); info->prop = wcsdup( prop );
msi_maskedit_create_children( info, font ); maskedit_create_children( info, font );
if( prop ) if( prop )
{ {
val = msi_dup_property( dialog->package->db, prop ); val = msi_dup_property( dialog->package->db, prop );
if( val ) if( val )
{ {
msi_maskedit_set_text( info, val ); maskedit_set_text( info, val );
free( val ); free( val );
} }
} }
...@@ -2062,7 +2048,7 @@ end: ...@@ -2062,7 +2048,7 @@ end:
/******************** Progress Bar *****************************************/ /******************** 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; msi_control *control;
DWORD attributes, style; DWORD attributes, style;
...@@ -2072,7 +2058,7 @@ static UINT msi_dialog_progress_bar( msi_dialog *dialog, MSIRECORD *rec ) ...@@ -2072,7 +2058,7 @@ static UINT msi_dialog_progress_bar( msi_dialog *dialog, MSIRECORD *rec )
if( !(attributes & msidbControlAttributesProgress95) ) if( !(attributes & msidbControlAttributesProgress95) )
style |= PBS_SMOOTH; style |= PBS_SMOOTH;
control = msi_dialog_add_control( dialog, rec, PROGRESS_CLASSW, style ); control = dialog_add_control( dialog, rec, PROGRESS_CLASSW, style );
if( !control ) if( !control )
return ERROR_FUNCTION_FAILED; return ERROR_FUNCTION_FAILED;
...@@ -2093,17 +2079,17 @@ static WCHAR *get_path_property( msi_dialog *dialog, msi_control *control ) ...@@ -2093,17 +2079,17 @@ static WCHAR *get_path_property( msi_dialog *dialog, msi_control *control )
{ {
WCHAR *prop, *path; WCHAR *prop, *path;
BOOL indirect = control->attributes & msidbControlAttributesIndirect; BOOL indirect = control->attributes & msidbControlAttributesIndirect;
if (!(prop = msi_dialog_dup_property( dialog, control->property, indirect ))) return NULL; if (!(prop = dialog_dup_property( dialog, control->property, indirect ))) return NULL;
path = msi_dialog_dup_property( dialog, prop, TRUE ); path = dialog_dup_property( dialog, prop, TRUE );
free( prop ); free( prop );
return path; return path;
} }
static void msi_dialog_update_pathedit( msi_dialog *dialog, msi_control *control ) static void dialog_update_pathedit( msi_dialog *dialog, msi_control *control )
{ {
WCHAR *path; 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; return;
if (!(path = get_path_property( dialog, control ))) return; if (!(path = get_path_property( dialog, control ))) return;
...@@ -2113,7 +2099,7 @@ static void msi_dialog_update_pathedit( msi_dialog *dialog, msi_control *control ...@@ -2113,7 +2099,7 @@ static void msi_dialog_update_pathedit( msi_dialog *dialog, msi_control *control
} }
/* FIXME: test when this should fail */ /* 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] ) if ( !path[0] )
return FALSE; return FALSE;
...@@ -2125,18 +2111,18 @@ static BOOL msi_dialog_verify_path( LPWSTR path ) ...@@ -2125,18 +2111,18 @@ static BOOL msi_dialog_verify_path( LPWSTR path )
} }
/* returns TRUE if the path is valid, FALSE otherwise */ /* 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, msi_control *control )
{ {
LPWSTR buf, prop; LPWSTR buf, prop;
BOOL indirect; BOOL indirect;
BOOL valid; BOOL valid;
indirect = control->attributes & msidbControlAttributesIndirect; 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 */ /* FIXME: display an error message box */
ERR("Invalid path %s\n", debugstr_w( buf )); ERR("Invalid path %s\n", debugstr_w( buf ));
...@@ -2146,10 +2132,10 @@ static BOOL msi_dialog_onkillfocus( msi_dialog *dialog, msi_control *control ) ...@@ -2146,10 +2132,10 @@ static BOOL msi_dialog_onkillfocus( msi_dialog *dialog, msi_control *control )
else else
{ {
valid = TRUE; 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), TRACE("edit %s contents changed, set %s\n", debugstr_w(control->name),
debugstr_w(prop)); debugstr_w(prop));
...@@ -2170,7 +2156,7 @@ static LRESULT WINAPI MSIPathEdit_WndProc(HWND hWnd, UINT msg, WPARAM wParam, LP ...@@ -2170,7 +2156,7 @@ static LRESULT WINAPI MSIPathEdit_WndProc(HWND hWnd, UINT msg, WPARAM wParam, LP
if ( msg == WM_KILLFOCUS ) if ( msg == WM_KILLFOCUS )
{ {
/* if the path is invalid, don't handle this message */ /* 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; return 0;
} }
...@@ -2185,7 +2171,7 @@ static LRESULT WINAPI MSIPathEdit_WndProc(HWND hWnd, UINT msg, WPARAM wParam, LP ...@@ -2185,7 +2171,7 @@ static LRESULT WINAPI MSIPathEdit_WndProc(HWND hWnd, UINT msg, WPARAM wParam, LP
return r; 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; struct msi_pathedit_info *info;
msi_control *control; msi_control *control;
...@@ -2195,12 +2181,11 @@ static UINT msi_dialog_pathedit_control( msi_dialog *dialog, MSIRECORD *rec ) ...@@ -2195,12 +2181,11 @@ static UINT msi_dialog_pathedit_control( msi_dialog *dialog, MSIRECORD *rec )
if (!info) if (!info)
return ERROR_FUNCTION_FAILED; return ERROR_FUNCTION_FAILED;
control = msi_dialog_add_control( dialog, rec, L"Edit", control = dialog_add_control( dialog, rec, L"Edit", WS_BORDER | WS_TABSTOP );
WS_BORDER | WS_TABSTOP );
control->attributes = MSI_RecordGetInteger( rec, 8 ); control->attributes = MSI_RecordGetInteger( rec, 8 );
prop = MSI_RecordGetString( rec, 9 ); prop = MSI_RecordGetString( rec, 9 );
control->property = msi_dialog_dup_property( dialog, prop, FALSE ); control->property = dialog_dup_property( dialog, prop, FALSE );
control->update = msi_dialog_update_pathedit; control->update = dialog_update_pathedit;
info->dialog = dialog; info->dialog = dialog;
info->control = control; info->control = control;
...@@ -2208,25 +2193,25 @@ static UINT msi_dialog_pathedit_control( msi_dialog *dialog, MSIRECORD *rec ) ...@@ -2208,25 +2193,25 @@ static UINT msi_dialog_pathedit_control( msi_dialog *dialog, MSIRECORD *rec )
(LONG_PTR)MSIPathEdit_WndProc ); (LONG_PTR)MSIPathEdit_WndProc );
SetPropW( control->hwnd, L"MSIDATA", info ); SetPropW( control->hwnd, L"MSIDATA", info );
msi_dialog_update_pathedit( dialog, control ); dialog_update_pathedit( dialog, control );
return ERROR_SUCCESS; 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, msi_control *control, WPARAM param )
{ {
if (HIWORD(param) != BN_CLICKED) if (HIWORD(param) != BN_CLICKED)
return ERROR_SUCCESS; return ERROR_SUCCESS;
TRACE("clicked radio button %s, set %s\n", debugstr_w(control->name), debugstr_w(control->property)); 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 */ /* 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; radio_button_group_descr *group = param;
msi_dialog *dialog = group->dialog; msi_dialog *dialog = group->dialog;
...@@ -2241,7 +2226,7 @@ static UINT msi_dialog_create_radiobutton( MSIRECORD *rec, LPVOID param ) ...@@ -2241,7 +2226,7 @@ static UINT msi_dialog_create_radiobutton( MSIRECORD *rec, LPVOID param )
group->parent->hwnd ); group->parent->hwnd );
if (!control) if (!control)
return ERROR_FUNCTION_FAILED; return ERROR_FUNCTION_FAILED;
control->handler = msi_dialog_radiogroup_handler; control->handler = dialog_radiogroup_handler;
if (group->propval && !wcscmp( control->name, group->propval )) if (group->propval && !wcscmp( control->name, group->propval ))
SendMessageW(control->hwnd, BM_SETCHECK, BST_CHECKED, 0); SendMessageW(control->hwnd, BM_SETCHECK, BST_CHECKED, 0);
...@@ -2253,7 +2238,7 @@ static UINT msi_dialog_create_radiobutton( MSIRECORD *rec, LPVOID param ) ...@@ -2253,7 +2238,7 @@ static UINT msi_dialog_create_radiobutton( MSIRECORD *rec, LPVOID param )
return ERROR_SUCCESS; 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 ); EnableWindow( hWnd, lParam );
return TRUE; return TRUE;
...@@ -2273,12 +2258,12 @@ static LRESULT WINAPI MSIRadioGroup_WndProc( HWND hWnd, UINT msg, WPARAM wParam, ...@@ -2273,12 +2258,12 @@ static LRESULT WINAPI MSIRadioGroup_WndProc( HWND hWnd, UINT msg, WPARAM wParam,
/* make sure the radio buttons show as disabled if the parent is disabled */ /* make sure the radio buttons show as disabled if the parent is disabled */
if (msg == WM_ENABLE) if (msg == WM_ENABLE)
EnumChildWindows( hWnd, msi_radioground_child_enum, wParam ); EnumChildWindows( hWnd, radioground_child_enum, wParam );
return r; 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; UINT r;
LPCWSTR prop; LPCWSTR prop;
...@@ -2304,7 +2289,7 @@ static UINT msi_dialog_radiogroup_control( msi_dialog *dialog, MSIRECORD *rec ) ...@@ -2304,7 +2289,7 @@ static UINT msi_dialog_radiogroup_control( msi_dialog *dialog, MSIRECORD *rec )
style |= BS_OWNERDRAW; style |= BS_OWNERDRAW;
/* Create parent group box to hold radio buttons */ /* 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 ) if( !control )
return ERROR_FUNCTION_FAILED; return ERROR_FUNCTION_FAILED;
...@@ -2329,14 +2314,13 @@ static UINT msi_dialog_radiogroup_control( msi_dialog *dialog, MSIRECORD *rec ) ...@@ -2329,14 +2314,13 @@ static UINT msi_dialog_radiogroup_control( msi_dialog *dialog, MSIRECORD *rec )
group.parent = control; group.parent = control;
group.propval = msi_dup_property( dialog->package->db, control->property ); 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 ); msiobj_release( &view->hdr );
free( group.propval ); free( group.propval );
return r; return r;
} }
static void static void seltree_sync_item_state( HWND hwnd, MSIFEATURE *feature, HTREEITEM hItem )
msi_seltree_sync_item_state( HWND hwnd, MSIFEATURE *feature, HTREEITEM hItem )
{ {
TVITEMW tvi; TVITEMW tvi;
DWORD index = feature->ActionRequest; DWORD index = feature->ActionRequest;
...@@ -2355,8 +2339,7 @@ msi_seltree_sync_item_state( HWND hwnd, MSIFEATURE *feature, HTREEITEM hItem ) ...@@ -2355,8 +2339,7 @@ msi_seltree_sync_item_state( HWND hwnd, MSIFEATURE *feature, HTREEITEM hItem )
SendMessageW( hwnd, TVM_SETITEMW, 0, (LPARAM) &tvi ); SendMessageW( hwnd, TVM_SETITEMW, 0, (LPARAM) &tvi );
} }
static UINT static UINT seltree_popup_menu( HWND hwnd, INT x, INT y )
msi_seltree_popup_menu( HWND hwnd, INT x, INT y )
{ {
HMENU hMenu; HMENU hMenu;
INT r; INT r;
...@@ -2375,18 +2358,16 @@ msi_seltree_popup_menu( HWND hwnd, INT x, INT y ) ...@@ -2375,18 +2358,16 @@ msi_seltree_popup_menu( HWND hwnd, INT x, INT y )
return r; return r;
} }
static void static void seltree_update_feature_installstate( HWND hwnd, HTREEITEM hItem, MSIPACKAGE *package,
msi_seltree_update_feature_installstate( HWND hwnd, HTREEITEM hItem, MSIFEATURE *feature, INSTALLSTATE state )
MSIPACKAGE *package, MSIFEATURE *feature, INSTALLSTATE state )
{ {
feature->ActionRequest = state; feature->ActionRequest = state;
msi_seltree_sync_item_state( hwnd, feature, hItem ); seltree_sync_item_state( hwnd, feature, hItem );
ACTION_UpdateComponentStates( package, feature ); ACTION_UpdateComponentStates( package, feature );
} }
static void static void seltree_update_siblings_and_children_installstate( HWND hwnd, HTREEITEM curr, MSIPACKAGE *package,
msi_seltree_update_siblings_and_children_installstate( HWND hwnd, HTREEITEM curr, INSTALLSTATE state )
MSIPACKAGE *package, INSTALLSTATE state)
{ {
/* update all siblings */ /* update all siblings */
do do
...@@ -2394,20 +2375,18 @@ msi_seltree_update_siblings_and_children_installstate( HWND hwnd, HTREEITEM curr ...@@ -2394,20 +2375,18 @@ msi_seltree_update_siblings_and_children_installstate( HWND hwnd, HTREEITEM curr
MSIFEATURE *feature; MSIFEATURE *feature;
HTREEITEM child; HTREEITEM child;
feature = msi_seltree_feature_from_item( hwnd, curr ); feature = seltree_feature_from_item( hwnd, curr );
msi_seltree_update_feature_installstate( hwnd, curr, package, feature, state ); seltree_update_feature_installstate( hwnd, curr, package, feature, state );
/* update this sibling's children */ /* update this sibling's children */
child = (HTREEITEM)SendMessageW( hwnd, TVM_GETNEXTITEM, (WPARAM)TVGN_CHILD, (LPARAM)curr ); child = (HTREEITEM)SendMessageW( hwnd, TVM_GETNEXTITEM, (WPARAM)TVGN_CHILD, (LPARAM)curr );
if (child) if (child)
msi_seltree_update_siblings_and_children_installstate( hwnd, child, seltree_update_siblings_and_children_installstate( hwnd, child, package, state );
package, state );
} }
while ((curr = (HTREEITEM)SendMessageW( hwnd, TVM_GETNEXTITEM, (WPARAM)TVGN_NEXT, (LPARAM)curr ))); while ((curr = (HTREEITEM)SendMessageW( hwnd, TVM_GETNEXTITEM, (WPARAM)TVGN_NEXT, (LPARAM)curr )));
} }
static LRESULT static LRESULT seltree_menu( HWND hwnd, HTREEITEM hItem )
msi_seltree_menu( HWND hwnd, HTREEITEM hItem )
{ {
struct msi_selection_tree_info *info; struct msi_selection_tree_info *info;
MSIFEATURE *feature; MSIFEATURE *feature;
...@@ -2422,7 +2401,7 @@ msi_seltree_menu( HWND hwnd, HTREEITEM hItem ) ...@@ -2422,7 +2401,7 @@ msi_seltree_menu( HWND hwnd, HTREEITEM hItem )
info = GetPropW(hwnd, L"MSIDATA"); info = GetPropW(hwnd, L"MSIDATA");
package = info->dialog->package; package = info->dialog->package;
feature = msi_seltree_feature_from_item( hwnd, hItem ); feature = seltree_feature_from_item( hwnd, hItem );
if (!feature) if (!feature)
{ {
ERR("item %p feature was NULL\n", hItem); ERR("item %p feature was NULL\n", hItem);
...@@ -2434,7 +2413,7 @@ msi_seltree_menu( HWND hwnd, HTREEITEM hItem ) ...@@ -2434,7 +2413,7 @@ msi_seltree_menu( HWND hwnd, HTREEITEM hItem )
SendMessageW( hwnd, TVM_GETITEMRECT, 0, (LPARAM) &u.rc ); SendMessageW( hwnd, TVM_GETITEMRECT, 0, (LPARAM) &u.rc );
MapWindowPoints( hwnd, NULL, u.pt, 2 ); 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) switch (r)
{ {
...@@ -2447,19 +2426,18 @@ msi_seltree_menu( HWND hwnd, HTREEITEM hItem ) ...@@ -2447,19 +2426,18 @@ msi_seltree_menu( HWND hwnd, HTREEITEM hItem )
HTREEITEM child; HTREEITEM child;
child = (HTREEITEM)SendMessageW( hwnd, TVM_GETNEXTITEM, (WPARAM)TVGN_CHILD, (LPARAM)hItem ); child = (HTREEITEM)SendMessageW( hwnd, TVM_GETNEXTITEM, (WPARAM)TVGN_CHILD, (LPARAM)hItem );
if (child) 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 */ /* fall-through */
case INSTALLSTATE_LOCAL: case INSTALLSTATE_LOCAL:
msi_seltree_update_feature_installstate( hwnd, hItem, package, feature, r ); seltree_update_feature_installstate( hwnd, hItem, package, feature, r );
break; break;
} }
return 0; return 0;
} }
static LRESULT WINAPI static LRESULT WINAPI MSISelectionTree_WndProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam)
MSISelectionTree_WndProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam)
{ {
struct msi_selection_tree_info *info; struct msi_selection_tree_info *info;
TVHITTESTINFO tvhti; TVHITTESTINFO tvhti;
...@@ -2478,7 +2456,7 @@ MSISelectionTree_WndProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam) ...@@ -2478,7 +2456,7 @@ MSISelectionTree_WndProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam)
tvhti.hItem = 0; tvhti.hItem = 0;
CallWindowProcW(info->oldproc, hWnd, TVM_HITTEST, 0, (LPARAM) &tvhti ); CallWindowProcW(info->oldproc, hWnd, TVM_HITTEST, 0, (LPARAM) &tvhti );
if (tvhti.flags & TVHT_ONITEMSTATEICON) if (tvhti.flags & TVHT_ONITEMSTATEICON)
return msi_seltree_menu( hWnd, tvhti.hItem ); return seltree_menu( hWnd, tvhti.hItem );
break; break;
} }
r = CallWindowProcW(info->oldproc, hWnd, msg, wParam, lParam); r = CallWindowProcW(info->oldproc, hWnd, msg, wParam, lParam);
...@@ -2493,9 +2471,7 @@ MSISelectionTree_WndProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam) ...@@ -2493,9 +2471,7 @@ MSISelectionTree_WndProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam)
return r; return r;
} }
static void static void seltree_add_child_features( MSIPACKAGE *package, HWND hwnd, const WCHAR *parent, HTREEITEM hParent )
msi_seltree_add_child_features( MSIPACKAGE *package, HWND hwnd,
LPCWSTR parent, HTREEITEM hParent )
{ {
struct msi_selection_tree_info *info = GetPropW( hwnd, L"MSIDATA" ); struct msi_selection_tree_info *info = GetPropW( hwnd, L"MSIDATA" );
MSIFEATURE *feature; MSIFEATURE *feature;
...@@ -2531,8 +2507,8 @@ msi_seltree_add_child_features( MSIPACKAGE *package, HWND hwnd, ...@@ -2531,8 +2507,8 @@ msi_seltree_add_child_features( MSIPACKAGE *package, HWND hwnd,
if (!hfirst) if (!hfirst)
hfirst = hitem; hfirst = hitem;
msi_seltree_sync_item_state( hwnd, feature, hitem ); seltree_sync_item_state( hwnd, feature, hitem );
msi_seltree_add_child_features( package, hwnd, seltree_add_child_features( package, hwnd,
feature->Feature, hitem ); feature->Feature, hitem );
/* the node is expanded if Display is odd */ /* the node is expanded if Display is odd */
...@@ -2545,7 +2521,7 @@ msi_seltree_add_child_features( MSIPACKAGE *package, HWND hwnd, ...@@ -2545,7 +2521,7 @@ msi_seltree_add_child_features( MSIPACKAGE *package, HWND hwnd,
info->selected = hfirst; 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_width = 32, bm_height = 16, bm_count = 3;
const int bm_resource = 0x1001; const int bm_resource = 0x1001;
...@@ -2582,8 +2558,7 @@ static void msi_seltree_create_imagelist( HWND hwnd ) ...@@ -2582,8 +2558,7 @@ static void msi_seltree_create_imagelist( HWND hwnd )
SendMessageW( hwnd, TVM_SETIMAGELIST, TVSIL_STATE, (LPARAM)himl ); SendMessageW( hwnd, TVM_SETIMAGELIST, TVSIL_STATE, (LPARAM)himl );
} }
static UINT msi_dialog_seltree_handler( msi_dialog *dialog, static UINT dialog_seltree_handler( msi_dialog *dialog, msi_control *control, WPARAM param )
msi_control *control, WPARAM param )
{ {
struct msi_selection_tree_info *info = GetPropW( control->hwnd, L"MSIDATA" ); struct msi_selection_tree_info *info = GetPropW( control->hwnd, L"MSIDATA" );
LPNMTREEVIEWW tv = (LPNMTREEVIEWW)param; LPNMTREEVIEWW tv = (LPNMTREEVIEWW)param;
...@@ -2600,7 +2575,7 @@ static UINT msi_dialog_seltree_handler( msi_dialog *dialog, ...@@ -2600,7 +2575,7 @@ static UINT msi_dialog_seltree_handler( msi_dialog *dialog,
if (!(tv->itemNew.mask & TVIF_TEXT)) 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) if (feature)
title = feature->Title; title = feature->Title;
} }
...@@ -2639,7 +2614,7 @@ done: ...@@ -2639,7 +2614,7 @@ done:
return r; 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; msi_control *control;
LPCWSTR prop, control_name; LPCWSTR prop, control_name;
...@@ -2654,18 +2629,18 @@ static UINT msi_dialog_selection_tree( msi_dialog *dialog, MSIRECORD *rec ) ...@@ -2654,18 +2629,18 @@ static UINT msi_dialog_selection_tree( msi_dialog *dialog, MSIRECORD *rec )
/* create the treeview control */ /* create the treeview control */
style = TVS_HASLINES | TVS_HASBUTTONS | TVS_LINESATROOT; style = TVS_HASLINES | TVS_HASBUTTONS | TVS_LINESATROOT;
style |= WS_GROUP | WS_VSCROLL | WS_TABSTOP; 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) if (!control)
{ {
free(info); free(info);
return ERROR_FUNCTION_FAILED; return ERROR_FUNCTION_FAILED;
} }
control->handler = msi_dialog_seltree_handler; control->handler = dialog_seltree_handler;
control_name = MSI_RecordGetString( rec, 2 ); control_name = MSI_RecordGetString( rec, 2 );
control->attributes = MSI_RecordGetInteger( rec, 8 ); control->attributes = MSI_RecordGetInteger( rec, 8 );
prop = MSI_RecordGetString( rec, 9 ); prop = MSI_RecordGetString( rec, 9 );
control->property = msi_dialog_dup_property( dialog, prop, FALSE ); control->property = dialog_dup_property( dialog, prop, FALSE );
/* subclass */ /* subclass */
info->dialog = dialog; info->dialog = dialog;
...@@ -2677,21 +2652,21 @@ static UINT msi_dialog_selection_tree( msi_dialog *dialog, MSIRECORD *rec ) ...@@ -2677,21 +2652,21 @@ static UINT msi_dialog_selection_tree( msi_dialog *dialog, MSIRECORD *rec )
event_subscribe( dialog, L"SelectionPath", control_name, L"Property" ); event_subscribe( dialog, L"SelectionPath", control_name, L"Property" );
/* initialize it */ /* initialize it */
msi_seltree_create_imagelist( control->hwnd ); seltree_create_imagelist( control->hwnd );
msi_seltree_add_child_features( package, control->hwnd, NULL, NULL ); seltree_add_child_features( package, control->hwnd, NULL, NULL );
return ERROR_SUCCESS; return ERROR_SUCCESS;
} }
/******************** Group Box ***************************************/ /******************** 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; msi_control *control;
DWORD style; DWORD style;
style = BS_GROUPBOX | WS_CHILD | WS_GROUP; 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) if (!control)
return ERROR_FUNCTION_FAILED; return ERROR_FUNCTION_FAILED;
...@@ -2738,7 +2713,7 @@ static LRESULT WINAPI MSIListBox_WndProc(HWND hWnd, UINT msg, WPARAM wParam, LPA ...@@ -2738,7 +2713,7 @@ static LRESULT WINAPI MSIListBox_WndProc(HWND hWnd, UINT msg, WPARAM wParam, LPA
return r; 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; struct msi_listbox_info *info = param;
LPCWSTR value, text; LPCWSTR value, text;
...@@ -2755,7 +2730,7 @@ static UINT msi_listbox_add_item( MSIRECORD *rec, LPVOID param ) ...@@ -2755,7 +2730,7 @@ static UINT msi_listbox_add_item( MSIRECORD *rec, LPVOID param )
return ERROR_SUCCESS; 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; MSIQUERY *view;
DWORD count; DWORD count;
...@@ -2777,13 +2752,12 @@ static UINT msi_listbox_add_items( struct msi_listbox_info *info, LPCWSTR proper ...@@ -2777,13 +2752,12 @@ static UINT msi_listbox_add_items( struct msi_listbox_info *info, LPCWSTR proper
info->num_items = count; info->num_items = count;
info->items = malloc( 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 ); msiobj_release( &view->hdr );
return r; return r;
} }
static UINT msi_dialog_listbox_handler( msi_dialog *dialog, static UINT dialog_listbox_handler( msi_dialog *dialog, msi_control *control, WPARAM param )
msi_control *control, WPARAM param )
{ {
struct msi_listbox_info *info; struct msi_listbox_info *info;
int index; int index;
...@@ -2796,13 +2770,13 @@ static UINT msi_dialog_listbox_handler( msi_dialog *dialog, ...@@ -2796,13 +2770,13 @@ static UINT msi_dialog_listbox_handler( msi_dialog *dialog,
index = SendMessageW( control->hwnd, LB_GETCURSEL, 0, 0 ); index = SendMessageW( control->hwnd, LB_GETCURSEL, 0, 0 );
value = (LPCWSTR) SendMessageW( control->hwnd, LB_GETITEMDATA, index, 0 ); value = (LPCWSTR) SendMessageW( control->hwnd, LB_GETITEMDATA, index, 0 );
msi_dialog_set_property( info->dialog->package, control->property, value ); dialog_set_property( info->dialog->package, control->property, value );
msi_dialog_evaluate_control_conditions( info->dialog ); dialog_evaluate_control_conditions( info->dialog );
return ERROR_SUCCESS; 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; struct msi_listbox_info *info;
msi_control *control; msi_control *control;
...@@ -2818,17 +2792,17 @@ static UINT msi_dialog_list_box( msi_dialog *dialog, MSIRECORD *rec ) ...@@ -2818,17 +2792,17 @@ static UINT msi_dialog_list_box( msi_dialog *dialog, MSIRECORD *rec )
if (~attributes & msidbControlAttributesSorted) if (~attributes & msidbControlAttributesSorted)
style |= LBS_SORT; style |= LBS_SORT;
control = msi_dialog_add_control( dialog, rec, WC_LISTBOXW, style ); control = dialog_add_control( dialog, rec, WC_LISTBOXW, style );
if (!control) if (!control)
{ {
free(info); free(info);
return ERROR_FUNCTION_FAILED; return ERROR_FUNCTION_FAILED;
} }
control->handler = msi_dialog_listbox_handler; control->handler = dialog_listbox_handler;
prop = MSI_RecordGetString( rec, 9 ); prop = MSI_RecordGetString( rec, 9 );
control->property = msi_dialog_dup_property( dialog, prop, FALSE ); control->property = dialog_dup_property( dialog, prop, FALSE );
/* subclass */ /* subclass */
info->dialog = dialog; info->dialog = dialog;
...@@ -2840,18 +2814,18 @@ static UINT msi_dialog_list_box( msi_dialog *dialog, MSIRECORD *rec ) ...@@ -2840,18 +2814,18 @@ static UINT msi_dialog_list_box( msi_dialog *dialog, MSIRECORD *rec )
SetPropW( control->hwnd, L"MSIDATA", info ); SetPropW( control->hwnd, L"MSIDATA", info );
if ( control->property ) if ( control->property )
msi_listbox_add_items( info, control->property ); listbox_add_items( info, control->property );
return ERROR_SUCCESS; return ERROR_SUCCESS;
} }
/******************** Directory Combo ***************************************/ /******************** Directory Combo ***************************************/
static void msi_dialog_update_directory_combo( msi_dialog *dialog, msi_control *control ) static void dialog_update_directory_combo( msi_dialog *dialog, msi_control *control )
{ {
WCHAR *path; 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; return;
if (!(path = get_path_property( dialog, control ))) return; if (!(path = get_path_property( dialog, control ))) return;
...@@ -2864,7 +2838,7 @@ static void msi_dialog_update_directory_combo( msi_dialog *dialog, msi_control * ...@@ -2864,7 +2838,7 @@ static void msi_dialog_update_directory_combo( msi_dialog *dialog, msi_control *
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; msi_control *control;
LPCWSTR prop; LPCWSTR prop;
...@@ -2873,29 +2847,29 @@ static UINT msi_dialog_directory_combo( msi_dialog *dialog, MSIRECORD *rec ) ...@@ -2873,29 +2847,29 @@ static UINT msi_dialog_directory_combo( msi_dialog *dialog, MSIRECORD *rec )
/* FIXME: use CBS_OWNERDRAWFIXED and add owner draw code */ /* FIXME: use CBS_OWNERDRAWFIXED and add owner draw code */
style = CBS_DROPDOWNLIST | CBS_HASSTRINGS | WS_CHILD | style = CBS_DROPDOWNLIST | CBS_HASSTRINGS | WS_CHILD |
WS_GROUP | WS_TABSTOP | WS_VSCROLL; 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) if (!control)
return ERROR_FUNCTION_FAILED; return ERROR_FUNCTION_FAILED;
control->attributes = MSI_RecordGetInteger( rec, 8 ); control->attributes = MSI_RecordGetInteger( rec, 8 );
prop = MSI_RecordGetString( rec, 9 ); 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; return ERROR_SUCCESS;
} }
/******************** Directory List ***************************************/ /******************** Directory List ***************************************/
static void msi_dialog_update_directory_list( msi_dialog *dialog, msi_control *control ) static void dialog_update_directory_list( msi_dialog *dialog, msi_control *control )
{ {
WCHAR dir_spec[MAX_PATH], *path; WCHAR dir_spec[MAX_PATH], *path;
WIN32_FIND_DATAW wfd; WIN32_FIND_DATAW wfd;
LVITEMW item; LVITEMW item;
HANDLE file; 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; return;
/* clear the list-view */ /* clear the list-view */
...@@ -2933,27 +2907,27 @@ static void msi_dialog_update_directory_list( msi_dialog *dialog, msi_control *c ...@@ -2933,27 +2907,27 @@ static void msi_dialog_update_directory_list( msi_dialog *dialog, msi_control *c
FindClose( file ); FindClose( file );
} }
static UINT msi_dialog_directorylist_up( msi_dialog *dialog ) static UINT dialog_directorylist_up( msi_dialog *dialog )
{ {
msi_control *control; msi_control *control;
LPWSTR prop, path, ptr; LPWSTR prop, path, ptr;
BOOL indirect; 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; indirect = control->attributes & msidbControlAttributesIndirect;
prop = msi_dialog_dup_property( dialog, control->property, indirect ); prop = dialog_dup_property( dialog, control->property, indirect );
path = msi_dialog_dup_property( dialog, prop, TRUE ); path = dialog_dup_property( dialog, prop, TRUE );
/* strip off the last directory */ /* strip off the last directory */
ptr = PathFindFileNameW( path ); ptr = PathFindFileNameW( path );
if (ptr != path) *(ptr - 1) = '\0'; if (ptr != path) *(ptr - 1) = '\0';
PathAddBackslashW( path ); PathAddBackslashW( path );
msi_dialog_set_property( dialog->package, prop, path ); dialog_set_property( dialog->package, prop, path );
msi_dialog_update_directory_list( dialog, NULL ); dialog_update_directory_list( dialog, NULL );
msi_dialog_update_directory_combo( dialog, NULL ); dialog_update_directory_combo( dialog, NULL );
msi_dialog_update_pathedit( dialog, NULL ); dialog_update_pathedit( dialog, NULL );
free( path ); free( path );
free( prop ); free( prop );
...@@ -2989,14 +2963,14 @@ static WCHAR *get_unique_folder_name( const WCHAR *root, int *ret_len ) ...@@ -2989,14 +2963,14 @@ static WCHAR *get_unique_folder_name( const WCHAR *root, int *ret_len )
return path; return path;
} }
static UINT msi_dialog_directorylist_new( msi_dialog *dialog ) static UINT dialog_directorylist_new( msi_dialog *dialog )
{ {
msi_control *control; msi_control *control;
WCHAR *path; WCHAR *path;
LVITEMW item; LVITEMW item;
int index; 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; if (!(path = get_path_property( dialog, control ))) return ERROR_OUTOFMEMORY;
...@@ -3014,7 +2988,7 @@ static UINT msi_dialog_directorylist_new( msi_dialog *dialog ) ...@@ -3014,7 +2988,7 @@ static UINT msi_dialog_directorylist_new( msi_dialog *dialog )
return ERROR_SUCCESS; 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, msi_control *control, WPARAM param )
{ {
NMHDR *nmhdr = (NMHDR *)param; NMHDR *nmhdr = (NMHDR *)param;
WCHAR text[MAX_PATH], *new_path, *path, *prop; WCHAR text[MAX_PATH], *new_path, *path, *prop;
...@@ -3052,8 +3026,8 @@ static UINT msi_dialog_dirlist_handler( msi_dialog *dialog, msi_control *control ...@@ -3052,8 +3026,8 @@ static UINT msi_dialog_dirlist_handler( msi_dialog *dialog, msi_control *control
} }
indirect = control->attributes & msidbControlAttributesIndirect; indirect = control->attributes & msidbControlAttributesIndirect;
prop = msi_dialog_dup_property( dialog, control->property, indirect ); prop = dialog_dup_property( dialog, control->property, indirect );
path = msi_dialog_dup_property( dialog, prop, TRUE ); path = dialog_dup_property( dialog, prop, TRUE );
if (!(new_path = malloc( (wcslen(path) + wcslen(text) + 2) * sizeof(WCHAR) ))) if (!(new_path = malloc( (wcslen(path) + wcslen(text) + 2) * sizeof(WCHAR) )))
{ {
...@@ -3066,11 +3040,11 @@ static UINT msi_dialog_dirlist_handler( msi_dialog *dialog, msi_control *control ...@@ -3066,11 +3040,11 @@ static UINT msi_dialog_dirlist_handler( msi_dialog *dialog, msi_control *control
if (nmhdr->code == LVN_ENDLABELEDITW) CreateDirectoryW( new_path, NULL ); if (nmhdr->code == LVN_ENDLABELEDITW) CreateDirectoryW( new_path, NULL );
lstrcatW( new_path, L"\\" ); 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 ); dialog_update_directory_list( dialog, NULL );
msi_dialog_update_directory_combo( dialog, NULL ); dialog_update_directory_combo( dialog, NULL );
msi_dialog_update_pathedit( dialog, NULL ); dialog_update_pathedit( dialog, NULL );
free( prop ); free( prop );
free( path ); free( path );
...@@ -3079,7 +3053,7 @@ static UINT msi_dialog_dirlist_handler( msi_dialog *dialog, msi_control *control ...@@ -3079,7 +3053,7 @@ static UINT msi_dialog_dirlist_handler( msi_dialog *dialog, msi_control *control
return ERROR_SUCCESS; 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; msi_control *control;
LPCWSTR prop; LPCWSTR prop;
...@@ -3088,20 +3062,20 @@ static UINT msi_dialog_directory_list( msi_dialog *dialog, MSIRECORD *rec ) ...@@ -3088,20 +3062,20 @@ static UINT msi_dialog_directory_list( msi_dialog *dialog, MSIRECORD *rec )
style = LVS_LIST | WS_VSCROLL | LVS_SHAREIMAGELISTS | LVS_EDITLABELS | style = LVS_LIST | WS_VSCROLL | LVS_SHAREIMAGELISTS | LVS_EDITLABELS |
LVS_AUTOARRANGE | LVS_SINGLESEL | WS_BORDER | LVS_AUTOARRANGE | LVS_SINGLESEL | WS_BORDER |
LVS_SORTASCENDING | WS_CHILD | WS_GROUP | WS_TABSTOP; 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) if (!control)
return ERROR_FUNCTION_FAILED; return ERROR_FUNCTION_FAILED;
control->attributes = MSI_RecordGetInteger( rec, 8 ); control->attributes = MSI_RecordGetInteger( rec, 8 );
control->handler = msi_dialog_dirlist_handler; control->handler = dialog_dirlist_handler;
prop = MSI_RecordGetString( rec, 9 ); 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 */ /* double click to activate an item in the list */
SendMessageW( control->hwnd, LVM_SETEXTENDEDLISTVIEWSTYLE, SendMessageW( control->hwnd, LVM_SETEXTENDEDLISTVIEWSTYLE,
0, LVS_EX_TWOCLICKACTIVATE ); 0, LVS_EX_TWOCLICKACTIVATE );
msi_dialog_update_directory_list( dialog, control ); dialog_update_directory_list( dialog, control );
return ERROR_SUCCESS; return ERROR_SUCCESS;
} }
...@@ -3128,7 +3102,7 @@ static const WCHAR column_keys[][80] = ...@@ -3128,7 +3102,7 @@ static const WCHAR column_keys[][80] =
L"VolumeCostDifference", 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, msi_control *control, MSIRECORD *rec )
{ {
LPCWSTR text = MSI_RecordGetString( rec, 10 ); LPCWSTR text = MSI_RecordGetString( rec, 10 );
LPCWSTR begin = text, end; LPCWSTR begin = text, end;
...@@ -3169,7 +3143,7 @@ static void msi_dialog_vcl_add_columns( msi_dialog *dialog, msi_control *control ...@@ -3169,7 +3143,7 @@ static void msi_dialog_vcl_add_columns( msi_dialog *dialog, msi_control *control
ZeroMemory( &lvc, sizeof(lvc) ); ZeroMemory( &lvc, sizeof(lvc) );
lvc.mask = LVCF_TEXT | LVCF_WIDTH | LVCF_SUBITEM; lvc.mask = LVCF_TEXT | LVCF_WIDTH | LVCF_SUBITEM;
lvc.cx = wcstol( num, NULL, 10 ); 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 ); SendMessageW( control->hwnd, LVM_INSERTCOLUMNW, count++, (LPARAM)&lvc );
free( lvc.pszText ); free( lvc.pszText );
...@@ -3177,7 +3151,7 @@ static void msi_dialog_vcl_add_columns( msi_dialog *dialog, msi_control *control ...@@ -3177,7 +3151,7 @@ static void msi_dialog_vcl_add_columns( msi_dialog *dialog, msi_control *control
} }
} }
static LONGLONG msi_vcl_get_cost( msi_dialog *dialog ) static LONGLONG vcl_get_cost( msi_dialog *dialog )
{ {
MSIFEATURE *feature; MSIFEATURE *feature;
INT each_cost; INT each_cost;
...@@ -3201,7 +3175,7 @@ static LONGLONG msi_vcl_get_cost( msi_dialog *dialog ) ...@@ -3201,7 +3175,7 @@ static LONGLONG msi_vcl_get_cost( msi_dialog *dialog )
return total_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, msi_control *control )
{ {
ULARGE_INTEGER total, unused; ULARGE_INTEGER total, unused;
LONGLONG difference, cost; LONGLONG difference, cost;
...@@ -3212,7 +3186,7 @@ static void msi_dialog_vcl_add_drives( msi_dialog *dialog, msi_control *control ...@@ -3212,7 +3186,7 @@ static void msi_dialog_vcl_add_drives( msi_dialog *dialog, msi_control *control
DWORD size, flags; DWORD size, flags;
int i = 0; int i = 0;
cost = msi_vcl_get_cost(dialog); cost = vcl_get_cost(dialog);
StrFormatByteSizeW(cost, cost_text, MAX_PATH); StrFormatByteSizeW(cost, cost_text, MAX_PATH);
size = GetLogicalDriveStringsW( 0, NULL ); size = GetLogicalDriveStringsW( 0, NULL );
...@@ -3273,7 +3247,7 @@ static void msi_dialog_vcl_add_drives( msi_dialog *dialog, msi_control *control ...@@ -3273,7 +3247,7 @@ static void msi_dialog_vcl_add_drives( msi_dialog *dialog, msi_control *control
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; msi_control *control;
DWORD style; DWORD style;
...@@ -3281,20 +3255,19 @@ static UINT msi_dialog_volumecost_list( msi_dialog *dialog, MSIRECORD *rec ) ...@@ -3281,20 +3255,19 @@ static UINT msi_dialog_volumecost_list( msi_dialog *dialog, MSIRECORD *rec )
style = LVS_REPORT | WS_VSCROLL | WS_HSCROLL | LVS_SHAREIMAGELISTS | style = LVS_REPORT | WS_VSCROLL | WS_HSCROLL | LVS_SHAREIMAGELISTS |
LVS_AUTOARRANGE | LVS_SINGLESEL | WS_BORDER | LVS_AUTOARRANGE | LVS_SINGLESEL | WS_BORDER |
WS_CHILD | WS_TABSTOP | WS_GROUP; 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) if (!control)
return ERROR_FUNCTION_FAILED; return ERROR_FUNCTION_FAILED;
msi_dialog_vcl_add_columns( dialog, control, rec ); dialog_vcl_add_columns( dialog, control, rec );
msi_dialog_vcl_add_drives( dialog, control ); dialog_vcl_add_drives( dialog, control );
return ERROR_SUCCESS; return ERROR_SUCCESS;
} }
/******************** VolumeSelect Combo ***************************************/ /******************** VolumeSelect Combo ***************************************/
static UINT msi_dialog_volsel_handler( msi_dialog *dialog, static UINT dialog_volsel_handler( msi_dialog *dialog, msi_control *control, WPARAM param )
msi_control *control, WPARAM param )
{ {
WCHAR text[MAX_PATH]; WCHAR text[MAX_PATH];
LPWSTR prop; LPWSTR prop;
...@@ -3314,15 +3287,15 @@ static UINT msi_dialog_volsel_handler( msi_dialog *dialog, ...@@ -3314,15 +3287,15 @@ static UINT msi_dialog_volsel_handler( msi_dialog *dialog,
SendMessageW( control->hwnd, CB_GETLBTEXT, index, (LPARAM)text ); SendMessageW( control->hwnd, CB_GETLBTEXT, index, (LPARAM)text );
indirect = control->attributes & msidbControlAttributesIndirect; 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 );
free( prop ); free( prop );
return ERROR_SUCCESS; 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, msi_control *control )
{ {
LPWSTR drives, ptr; LPWSTR drives, ptr;
DWORD size; DWORD size;
...@@ -3345,7 +3318,7 @@ static void msi_dialog_vsc_add_drives( msi_dialog *dialog, msi_control *control ...@@ -3345,7 +3318,7 @@ static void msi_dialog_vsc_add_drives( msi_dialog *dialog, msi_control *control
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; msi_control *control;
LPCWSTR prop; LPCWSTR prop;
...@@ -3355,21 +3328,21 @@ static UINT msi_dialog_volumeselect_combo( msi_dialog *dialog, MSIRECORD *rec ) ...@@ -3355,21 +3328,21 @@ static UINT msi_dialog_volumeselect_combo( msi_dialog *dialog, MSIRECORD *rec )
style = WS_CHILD | WS_VISIBLE | WS_GROUP | WS_TABSTOP | style = WS_CHILD | WS_VISIBLE | WS_GROUP | WS_TABSTOP |
CBS_DROPDOWNLIST | CBS_SORT | CBS_HASSTRINGS | CBS_DROPDOWNLIST | CBS_SORT | CBS_HASSTRINGS |
WS_EX_LEFT | WS_EX_LTRREADING | WS_EX_RIGHTSCROLLBAR; 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) if (!control)
return ERROR_FUNCTION_FAILED; return ERROR_FUNCTION_FAILED;
control->attributes = MSI_RecordGetInteger( rec, 8 ); control->attributes = MSI_RecordGetInteger( rec, 8 );
control->handler = msi_dialog_volsel_handler; control->handler = dialog_volsel_handler;
prop = MSI_RecordGetString( rec, 9 ); 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; 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, msi_control *control, WPARAM param )
{ {
int len, len_href = ARRAY_SIZE( L"href" ) - 1; int len, len_href = ARRAY_SIZE( L"href" ) - 1;
const WCHAR *p, *q; const WCHAR *p, *q;
...@@ -3414,7 +3387,7 @@ static UINT msi_dialog_hyperlink_handler( msi_dialog *dialog, msi_control *contr ...@@ -3414,7 +3387,7 @@ static UINT msi_dialog_hyperlink_handler( msi_dialog *dialog, msi_control *contr
return ERROR_SUCCESS; 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; msi_control *control;
DWORD style = WS_CHILD | WS_TABSTOP | WS_GROUP; DWORD style = WS_CHILD | WS_TABSTOP | WS_GROUP;
...@@ -3422,12 +3395,12 @@ static UINT msi_dialog_hyperlink( msi_dialog *dialog, MSIRECORD *rec ) ...@@ -3422,12 +3395,12 @@ static UINT msi_dialog_hyperlink( msi_dialog *dialog, MSIRECORD *rec )
int len = lstrlenW( text ); int len = lstrlenW( text );
LITEM item; LITEM item;
control = msi_dialog_add_control( dialog, rec, WC_LINK, style ); control = dialog_add_control( dialog, rec, WC_LINK, style );
if (!control) if (!control)
return ERROR_FUNCTION_FAILED; return ERROR_FUNCTION_FAILED;
control->attributes = MSI_RecordGetInteger( rec, 8 ); 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.mask = LIF_ITEMINDEX | LIF_STATE | LIF_URL;
item.iLink = 0; item.iLink = 0;
...@@ -3449,7 +3422,7 @@ struct listview_param ...@@ -3449,7 +3422,7 @@ struct listview_param
msi_control *control; msi_control *control;
}; };
static UINT msi_dialog_listview_handler( msi_dialog *dialog, msi_control *control, WPARAM param ) static UINT dialog_listview_handler( msi_dialog *dialog, msi_control *control, WPARAM param )
{ {
NMHDR *nmhdr = (NMHDR *)param; NMHDR *nmhdr = (NMHDR *)param;
...@@ -3458,7 +3431,7 @@ static UINT msi_dialog_listview_handler( msi_dialog *dialog, msi_control *contro ...@@ -3458,7 +3431,7 @@ static UINT msi_dialog_listview_handler( msi_dialog *dialog, msi_control *contro
return ERROR_SUCCESS; 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; struct listview_param *lv_param = (struct listview_param *)param;
LPCWSTR text, binary; LPCWSTR text, binary;
...@@ -3467,7 +3440,7 @@ static UINT msi_listview_add_item( MSIRECORD *rec, LPVOID param ) ...@@ -3467,7 +3440,7 @@ static UINT msi_listview_add_item( MSIRECORD *rec, LPVOID param )
text = MSI_RecordGetString( rec, 4 ); text = MSI_RecordGetString( rec, 4 );
binary = MSI_RecordGetString( rec, 5 ); 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); TRACE("Adding: text %s, binary %s, icon %p\n", debugstr_w(text), debugstr_w(binary), hIcon);
...@@ -3483,7 +3456,7 @@ static UINT msi_listview_add_item( MSIRECORD *rec, LPVOID param ) ...@@ -3483,7 +3456,7 @@ static UINT msi_listview_add_item( MSIRECORD *rec, LPVOID param )
return ERROR_SUCCESS; return ERROR_SUCCESS;
} }
static UINT msi_listview_add_items( msi_dialog *dialog, msi_control *control ) static UINT listview_add_items( msi_dialog *dialog, msi_control *control )
{ {
MSIQUERY *view; MSIQUERY *view;
struct listview_param lv_param = { dialog, control }; struct listview_param lv_param = { dialog, control };
...@@ -3491,14 +3464,14 @@ static UINT msi_listview_add_items( msi_dialog *dialog, msi_control *control ) ...@@ -3491,14 +3464,14 @@ 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`", if (MSI_OpenQuery( dialog->package->db, &view, L"SELECT * FROM `ListView` WHERE `Property` = '%s' ORDER BY `Order`",
control->property ) == ERROR_SUCCESS) 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 ); msiobj_release( &view->hdr );
} }
return ERROR_SUCCESS; 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; msi_control *control;
LPCWSTR prop; LPCWSTR prop;
...@@ -3511,12 +3484,12 @@ static UINT msi_dialog_listview( msi_dialog *dialog, MSIRECORD *rec ) ...@@ -3511,12 +3484,12 @@ static UINT msi_dialog_listview( msi_dialog *dialog, MSIRECORD *rec )
attributes = MSI_RecordGetInteger( rec, 8 ); attributes = MSI_RecordGetInteger( rec, 8 );
if ( ~attributes & msidbControlAttributesSorted ) if ( ~attributes & msidbControlAttributesSorted )
style |= LVS_SORTASCENDING; style |= LVS_SORTASCENDING;
control = msi_dialog_add_control( dialog, rec, WC_LISTVIEWW, style ); control = dialog_add_control( dialog, rec, WC_LISTVIEWW, style );
if (!control) if (!control)
return ERROR_FUNCTION_FAILED; return ERROR_FUNCTION_FAILED;
prop = MSI_RecordGetString( rec, 9 ); 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); control->hImageList = ImageList_Create( 16, 16, ILC_COLOR32, 0, 1);
SendMessageW( control->hwnd, LVM_SETIMAGELIST, LVSIL_SMALL, (LPARAM)control->hImageList ); SendMessageW( control->hwnd, LVM_SETIMAGELIST, LVSIL_SMALL, (LPARAM)control->hImageList );
...@@ -3531,40 +3504,40 @@ static UINT msi_dialog_listview( msi_dialog *dialog, MSIRECORD *rec ) ...@@ -3531,40 +3504,40 @@ static UINT msi_dialog_listview( msi_dialog *dialog, MSIRECORD *rec )
SendMessageW( control->hwnd, LVM_INSERTCOLUMNW, 0, (LPARAM)&col ); SendMessageW( control->hwnd, LVM_INSERTCOLUMNW, 0, (LPARAM)&col );
if (control->property) 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; return ERROR_SUCCESS;
} }
static const struct control_handler msi_dialog_handler[] = static const struct control_handler msi_dialog_handler[] =
{ {
{ L"Text", msi_dialog_text_control }, { L"Text", dialog_text_control },
{ L"PushButton", msi_dialog_button_control }, { L"PushButton", dialog_button_control },
{ L"Line", msi_dialog_line_control }, { L"Line", dialog_line_control },
{ L"Bitmap", msi_dialog_bitmap_control }, { L"Bitmap", dialog_bitmap_control },
{ L"CheckBox", msi_dialog_checkbox_control }, { L"CheckBox", dialog_checkbox_control },
{ L"ScrollableText", msi_dialog_scrolltext_control }, { L"ScrollableText", dialog_scrolltext_control },
{ L"ComboBox", msi_dialog_combo_control }, { L"ComboBox", dialog_combo_control },
{ L"Edit", msi_dialog_edit_control }, { L"Edit", dialog_edit_control },
{ L"MaskedEdit", msi_dialog_maskedit_control }, { L"MaskedEdit", dialog_maskedit_control },
{ L"PathEdit", msi_dialog_pathedit_control }, { L"PathEdit", dialog_pathedit_control },
{ L"ProgressBar", msi_dialog_progress_bar }, { L"ProgressBar", dialog_progress_bar },
{ L"RadioButtonGroup", msi_dialog_radiogroup_control }, { L"RadioButtonGroup", dialog_radiogroup_control },
{ L"Icon", msi_dialog_icon_control }, { L"Icon", dialog_icon_control },
{ L"SelectionTree", msi_dialog_selection_tree }, { L"SelectionTree", dialog_selection_tree },
{ L"GroupBox", msi_dialog_group_box }, { L"GroupBox", dialog_group_box },
{ L"ListBox", msi_dialog_list_box }, { L"ListBox", dialog_list_box },
{ L"DirectoryCombo", msi_dialog_directory_combo }, { L"DirectoryCombo", dialog_directory_combo },
{ L"DirectoryList", msi_dialog_directory_list }, { L"DirectoryList", dialog_directory_list },
{ L"VolumeCostList", msi_dialog_volumecost_list }, { L"VolumeCostList", dialog_volumecost_list },
{ L"VolumeSelectCombo", msi_dialog_volumeselect_combo }, { L"VolumeSelectCombo", dialog_volumeselect_combo },
{ L"HyperLink", msi_dialog_hyperlink }, { L"HyperLink", dialog_hyperlink },
{ L"ListView", msi_dialog_listview } { 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; msi_dialog *dialog = param;
LPCWSTR control_type; LPCWSTR control_type;
...@@ -3583,7 +3556,7 @@ static UINT msi_dialog_create_controls( MSIRECORD *rec, LPVOID param ) ...@@ -3583,7 +3556,7 @@ static UINT msi_dialog_create_controls( MSIRECORD *rec, LPVOID param )
return ERROR_SUCCESS; return ERROR_SUCCESS;
} }
static UINT msi_dialog_fill_controls( msi_dialog *dialog ) static UINT dialog_fill_controls( msi_dialog *dialog )
{ {
UINT r; UINT r;
MSIQUERY *view; MSIQUERY *view;
...@@ -3599,19 +3572,19 @@ static UINT msi_dialog_fill_controls( msi_dialog *dialog ) ...@@ -3599,19 +3572,19 @@ static UINT msi_dialog_fill_controls( msi_dialog *dialog )
return ERROR_INVALID_PARAMETER; 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 ); msiobj_release( &view->hdr );
return r; 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 */ /* 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 */ /* 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; LOGFONTW lf;
TEXTMETRICW tm; TEXTMETRICW tm;
...@@ -3642,7 +3615,7 @@ static INT msi_dialog_get_sans_serif_height( HWND hwnd ) ...@@ -3642,7 +3615,7 @@ static INT msi_dialog_get_sans_serif_height( HWND hwnd )
} }
/* fetch the associated record from the Dialog table */ /* 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; MSIPACKAGE *package = dialog->package;
MSIRECORD *rec = NULL; MSIRECORD *rec = NULL;
...@@ -3656,7 +3629,7 @@ static MSIRECORD *msi_get_dialog_record( msi_dialog *dialog ) ...@@ -3656,7 +3629,7 @@ static MSIRECORD *msi_get_dialog_record( msi_dialog *dialog )
return rec; 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; UINT xres, yres;
POINT center; POINT center;
...@@ -3669,8 +3642,8 @@ static void msi_dialog_adjust_dialog_pos( msi_dialog *dialog, MSIRECORD *rec, LP ...@@ -3669,8 +3642,8 @@ static void msi_dialog_adjust_dialog_pos( msi_dialog *dialog, MSIRECORD *rec, LP
sz.cx = MSI_RecordGetInteger( rec, 4 ); sz.cx = MSI_RecordGetInteger( rec, 4 );
sz.cy = MSI_RecordGetInteger( rec, 5 ); sz.cy = MSI_RecordGetInteger( rec, 5 );
sz.cx = msi_dialog_scale_unit( dialog, sz.cx ); sz.cx = dialog_scale_unit( dialog, sz.cx );
sz.cy = msi_dialog_scale_unit( dialog, sz.cy ); sz.cy = dialog_scale_unit( dialog, sz.cy );
xres = msi_get_property_int( dialog->package->db, L"ScreenX", 0 ); xres = msi_get_property_int( dialog->package->db, L"ScreenX", 0 );
yres = msi_get_property_int( dialog->package->db, L"ScreenY", 0 ); yres = msi_get_property_int( dialog->package->db, L"ScreenY", 0 );
...@@ -3707,14 +3680,14 @@ static void msi_dialog_adjust_dialog_pos( msi_dialog *dialog, MSIRECORD *rec, LP ...@@ -3707,14 +3680,14 @@ static void msi_dialog_adjust_dialog_pos( msi_dialog *dialog, MSIRECORD *rec, LP
AdjustWindowRect( pos, style, FALSE ); 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; struct list tab_chain;
msi_control *control; msi_control *control;
HWND prev = HWND_TOP; HWND prev = HWND_TOP;
list_init( &tab_chain ); 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; dialog->hWndFocus = control->hwnd;
while (control) while (control)
...@@ -3722,7 +3695,7 @@ static void msi_dialog_set_tab_order( msi_dialog *dialog, LPCWSTR first ) ...@@ -3722,7 +3695,7 @@ static void msi_dialog_set_tab_order( msi_dialog *dialog, LPCWSTR first )
list_remove( &control->entry ); list_remove( &control->entry );
list_add_tail( &tab_chain, &control->entry ); list_add_tail( &tab_chain, &control->entry );
if (!control->tabnext) break; 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, msi_control, entry )
...@@ -3737,7 +3710,7 @@ static void msi_dialog_set_tab_order( msi_dialog *dialog, LPCWSTR first ) ...@@ -3737,7 +3710,7 @@ static void msi_dialog_set_tab_order( msi_dialog *dialog, LPCWSTR first )
list_move_head( &dialog->controls, &tab_chain ); 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; msi_dialog *dialog = cs->lpCreateParams;
MSIRECORD *rec = NULL; MSIRECORD *rec = NULL;
...@@ -3749,16 +3722,16 @@ static LRESULT msi_dialog_oncreate( HWND hwnd, LPCREATESTRUCTW cs ) ...@@ -3749,16 +3722,16 @@ static LRESULT msi_dialog_oncreate( HWND hwnd, LPCREATESTRUCTW cs )
dialog->hwnd = hwnd; dialog->hwnd = hwnd;
SetWindowLongPtrW( hwnd, GWLP_USERDATA, (LONG_PTR) dialog ); SetWindowLongPtrW( hwnd, GWLP_USERDATA, (LONG_PTR) dialog );
rec = msi_get_dialog_record( dialog ); rec = get_dialog_record( dialog );
if( !rec ) if( !rec )
{ {
TRACE("No record found for dialog %s\n", debugstr_w(dialog->name)); TRACE("No record found for dialog %s\n", debugstr_w(dialog->name));
return -1; 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->attributes = MSI_RecordGetInteger( rec, 6 );
...@@ -3773,7 +3746,7 @@ static LRESULT msi_dialog_oncreate( HWND hwnd, LPCREATESTRUCTW cs ) ...@@ -3773,7 +3746,7 @@ 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 ); SetWindowTextW( hwnd, title );
free( title ); free( title );
...@@ -3781,16 +3754,16 @@ static LRESULT msi_dialog_oncreate( HWND hwnd, LPCREATESTRUCTW cs ) ...@@ -3781,16 +3754,16 @@ static LRESULT msi_dialog_oncreate( HWND hwnd, LPCREATESTRUCTW cs )
pos.right - pos.left, pos.bottom - pos.top, pos.right - pos.left, pos.bottom - pos.top,
SWP_NOACTIVATE | SWP_NOZORDER | SWP_NOREDRAW ); SWP_NOACTIVATE | SWP_NOZORDER | SWP_NOREDRAW );
msi_dialog_build_font_list( dialog ); dialog_build_font_list( dialog );
msi_dialog_fill_controls( dialog ); dialog_fill_controls( dialog );
msi_dialog_evaluate_control_conditions( dialog ); dialog_evaluate_control_conditions( dialog );
msi_dialog_set_tab_order( dialog, MSI_RecordGetString( rec, 8 ) ); dialog_set_tab_order( dialog, MSI_RecordGetString( rec, 8 ) );
msiobj_release( &rec->hdr ); msiobj_release( &rec->hdr );
return 0; 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; msi_control *control = NULL;
...@@ -3799,13 +3772,13 @@ static LRESULT msi_dialog_oncommand( msi_dialog *dialog, WPARAM param, HWND hwnd ...@@ -3799,13 +3772,13 @@ static LRESULT msi_dialog_oncommand( msi_dialog *dialog, WPARAM param, HWND hwnd
switch (param) switch (param)
{ {
case 1: /* enter */ case 1: /* enter */
control = msi_dialog_find_control( dialog, dialog->control_default ); control = dialog_find_control( dialog, dialog->control_default );
break; break;
case 2: /* escape */ case 2: /* escape */
control = msi_dialog_find_control( dialog, dialog->control_cancel ); control = dialog_find_control( dialog, dialog->control_cancel );
break; break;
default: default:
control = msi_dialog_find_control_by_hwnd( dialog, hwnd ); control = dialog_find_control_by_hwnd( dialog, hwnd );
} }
if( control ) if( control )
...@@ -3813,17 +3786,17 @@ static LRESULT msi_dialog_oncommand( msi_dialog *dialog, WPARAM param, HWND hwnd ...@@ -3813,17 +3786,17 @@ static LRESULT msi_dialog_oncommand( msi_dialog *dialog, WPARAM param, HWND hwnd
if( control->handler ) if( control->handler )
{ {
control->handler( dialog, control, param ); control->handler( dialog, control, param );
msi_dialog_evaluate_control_conditions( dialog ); dialog_evaluate_control_conditions( dialog );
} }
} }
return 0; 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; LPNMHDR nmhdr = (LPNMHDR) param;
msi_control *control = msi_dialog_find_control_by_hwnd( dialog, nmhdr->hwndFrom ); msi_control *control = dialog_find_control_by_hwnd( dialog, nmhdr->hwndFrom );
TRACE("%p %p\n", dialog, nmhdr->hwndFrom); TRACE("%p %p\n", dialog, nmhdr->hwndFrom);
...@@ -3858,14 +3831,14 @@ static LRESULT WINAPI MSIDialog_WndProc( HWND hwnd, UINT msg, ...@@ -3858,14 +3831,14 @@ static LRESULT WINAPI MSIDialog_WndProc( HWND hwnd, UINT msg,
break; break;
case WM_CREATE: case WM_CREATE:
return msi_dialog_oncreate( hwnd, (LPCREATESTRUCTW)lParam ); return dialog_oncreate( hwnd, (LPCREATESTRUCTW)lParam );
case WM_COMMAND: case WM_COMMAND:
return msi_dialog_oncommand( dialog, wParam, (HWND)lParam ); return dialog_oncommand( dialog, wParam, (HWND)lParam );
case WM_CLOSE: case WM_CLOSE:
/* Simulate escape press */ /* Simulate escape press */
return msi_dialog_oncommand(dialog, 2, NULL); return dialog_oncommand(dialog, 2, NULL);
case WM_ACTIVATE: case WM_ACTIVATE:
if( LOWORD(wParam) == WA_INACTIVE ) if( LOWORD(wParam) == WA_INACTIVE )
...@@ -3886,7 +3859,7 @@ static LRESULT WINAPI MSIDialog_WndProc( HWND hwnd, UINT msg, ...@@ -3886,7 +3859,7 @@ static LRESULT WINAPI MSIDialog_WndProc( HWND hwnd, UINT msg,
dialog->hwnd = NULL; dialog->hwnd = NULL;
return 0; return 0;
case WM_NOTIFY: case WM_NOTIFY:
return msi_dialog_onnotify( dialog, lParam ); return dialog_onnotify( dialog, lParam );
} }
return DefWindowProcW(hwnd, msg, wParam, lParam); return DefWindowProcW(hwnd, msg, wParam, lParam);
} }
...@@ -3947,8 +3920,7 @@ static UINT dialog_run_message_loop( msi_dialog *dialog ) ...@@ -3947,8 +3920,7 @@ static UINT dialog_run_message_loop( msi_dialog *dialog )
return ERROR_SUCCESS; return ERROR_SUCCESS;
} }
static LRESULT WINAPI MSIHiddenWindowProc( HWND hwnd, UINT msg, static LRESULT WINAPI MSIHiddenWindowProc( HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam )
WPARAM wParam, LPARAM lParam )
{ {
msi_dialog *dialog = (msi_dialog*) lParam; msi_dialog *dialog = (msi_dialog*) lParam;
...@@ -4020,7 +3992,7 @@ static msi_dialog *dialog_create( MSIPACKAGE *package, const WCHAR *name, msi_di ...@@ -4020,7 +3992,7 @@ static msi_dialog *dialog_create( MSIPACKAGE *package, const WCHAR *name, msi_di
list_init( &dialog->fonts ); list_init( &dialog->fonts );
/* verify that the dialog exists */ /* verify that the dialog exists */
rec = msi_get_dialog_record( dialog ); rec = get_dialog_record( dialog );
if( !rec ) if( !rec )
{ {
free( dialog ); free( dialog );
...@@ -4045,7 +4017,7 @@ static msi_dialog *dialog_create( MSIPACKAGE *package, const WCHAR *name, msi_di ...@@ -4045,7 +4017,7 @@ static msi_dialog *dialog_create( MSIPACKAGE *package, const WCHAR *name, msi_di
return dialog; return dialog;
} }
static void msi_dialog_end_dialog( msi_dialog *dialog ) static void dialog_end_dialog( msi_dialog *dialog )
{ {
TRACE("%p\n", dialog); TRACE("%p\n", dialog);
dialog->finished = 1; dialog->finished = 1;
...@@ -4146,7 +4118,7 @@ void msi_dialog_destroy( msi_dialog *dialog ) ...@@ -4146,7 +4118,7 @@ void msi_dialog_destroy( msi_dialog *dialog )
t = LIST_ENTRY( list_head( &dialog->controls ), t = LIST_ENTRY( list_head( &dialog->controls ),
msi_control, entry ); msi_control, entry );
msi_destroy_control( t ); destroy_control( t );
} }
/* destroy the list of fonts */ /* destroy the list of fonts */
...@@ -4367,7 +4339,7 @@ static UINT event_end_dialog( msi_dialog *dialog, const WCHAR *argument ) ...@@ -4367,7 +4339,7 @@ static UINT event_end_dialog( msi_dialog *dialog, const WCHAR *argument )
dialog->retval = IDABORT; dialog->retval = IDABORT;
} }
event_cleanup_subscriptions( dialog->package, dialog->name ); event_cleanup_subscriptions( dialog->package, dialog->name );
msi_dialog_end_dialog( dialog ); dialog_end_dialog( dialog );
return ERROR_SUCCESS; return ERROR_SUCCESS;
} }
...@@ -4385,7 +4357,7 @@ static UINT event_new_dialog( msi_dialog *dialog, const WCHAR *argument ) ...@@ -4385,7 +4357,7 @@ static UINT event_new_dialog( msi_dialog *dialog, const WCHAR *argument )
/* store the name of the next dialog, and signal this one to end */ /* store the name of the next dialog, and signal this one to end */
dialog->package->next_dialog = wcsdup( argument ); dialog->package->next_dialog = wcsdup( argument );
msi_event_cleanup_all_subscriptions( dialog->package ); msi_event_cleanup_all_subscriptions( dialog->package );
msi_dialog_end_dialog( dialog ); dialog_end_dialog( dialog );
return ERROR_SUCCESS; return ERROR_SUCCESS;
} }
...@@ -4406,10 +4378,10 @@ static UINT event_spawn_dialog( msi_dialog *dialog, const WCHAR *argument ) ...@@ -4406,10 +4378,10 @@ static UINT event_spawn_dialog( msi_dialog *dialog, const WCHAR *argument )
if (r != 0) if (r != 0)
{ {
dialog->retval = r; dialog->retval = r;
msi_dialog_end_dialog( dialog ); dialog_end_dialog( dialog );
} }
else else
msi_dialog_update_all_controls(dialog); dialog_update_all_controls(dialog);
return ERROR_SUCCESS; return ERROR_SUCCESS;
} }
...@@ -4516,7 +4488,7 @@ static UINT event_set_target_path( msi_dialog *dialog, const WCHAR *argument ) ...@@ -4516,7 +4488,7 @@ static UINT event_set_target_path( msi_dialog *dialog, const WCHAR *argument )
static UINT event_reset( msi_dialog *dialog, const WCHAR *argument ) static UINT event_reset( msi_dialog *dialog, const WCHAR *argument )
{ {
msi_dialog_reset( dialog ); dialog_reset( dialog );
return ERROR_SUCCESS; return ERROR_SUCCESS;
} }
...@@ -4582,12 +4554,12 @@ static UINT event_set_install_level( msi_dialog *dialog, const WCHAR *argument ) ...@@ -4582,12 +4554,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 ) 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 ) 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 ) static UINT event_reinstall_mode( msi_dialog *dialog, const WCHAR *argument )
......
...@@ -67,7 +67,7 @@ HANDLE msi_create_file( MSIPACKAGE *package, const WCHAR *filename, DWORD access ...@@ -67,7 +67,7 @@ HANDLE msi_create_file( MSIPACKAGE *package, const WCHAR *filename, DWORD access
return handle; 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; BOOL ret;
msi_disable_fs_redirection( package ); msi_disable_fs_redirection( package );
...@@ -85,7 +85,7 @@ BOOL msi_delete_file( MSIPACKAGE *package, const WCHAR *filename ) ...@@ -85,7 +85,7 @@ BOOL msi_delete_file( MSIPACKAGE *package, const WCHAR *filename )
return ret; return ret;
} }
static BOOL msi_create_directory( MSIPACKAGE *package, const WCHAR *path ) static BOOL create_directory( MSIPACKAGE *package, const WCHAR *path )
{ {
BOOL ret; BOOL ret;
msi_disable_fs_redirection( package ); msi_disable_fs_redirection( package );
...@@ -148,7 +148,7 @@ BOOL msi_move_file( MSIPACKAGE *package, const WCHAR *from, const WCHAR *to, DWO ...@@ -148,7 +148,7 @@ BOOL msi_move_file( MSIPACKAGE *package, const WCHAR *from, const WCHAR *to, DWO
return ret; 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; BOOL ret;
msi_disable_fs_redirection( package ); msi_disable_fs_redirection( package );
...@@ -220,7 +220,7 @@ BOOL msi_create_full_path( MSIPACKAGE *package, const WCHAR *path ) ...@@ -220,7 +220,7 @@ BOOL msi_create_full_path( MSIPACKAGE *package, const WCHAR *path )
while ((len = lstrlenW( new_path )) && new_path[len - 1] == '\\') while ((len = lstrlenW( new_path )) && new_path[len - 1] == '\\')
new_path[len - 1] = 0; new_path[len - 1] = 0;
while (!msi_create_directory( package, new_path )) while (!create_directory( package, new_path ))
{ {
WCHAR *slash; WCHAR *slash;
DWORD last_error = GetLastError(); DWORD last_error = GetLastError();
...@@ -248,7 +248,7 @@ BOOL msi_create_full_path( MSIPACKAGE *package, const WCHAR *path ) ...@@ -248,7 +248,7 @@ BOOL msi_create_full_path( MSIPACKAGE *package, const WCHAR *path )
return ret; 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; MSIRECORD *uirow;
...@@ -401,11 +401,11 @@ static void schedule_install_files(MSIPACKAGE *package) ...@@ -401,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; BOOL ret;
ret = msi_copy_file( package, source, file->TargetPath, FALSE ); ret = copy_file( package, source, file->TargetPath, FALSE );
if (!ret) if (!ret)
return GetLastError(); return GetLastError();
...@@ -419,7 +419,7 @@ static UINT copy_install_file(MSIPACKAGE *package, MSIFILE *file, LPWSTR source) ...@@ -419,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)); 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) if (gle == ERROR_SUCCESS)
return gle; return gle;
...@@ -432,7 +432,7 @@ static UINT copy_install_file(MSIPACKAGE *package, MSIFILE *file, LPWSTR source) ...@@ -432,7 +432,7 @@ static UINT copy_install_file(MSIPACKAGE *package, MSIFILE *file, LPWSTR source)
{ {
msi_set_file_attributes( package, file->TargetPath, FILE_ATTRIBUTE_NORMAL ); 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); TRACE("Overwriting existing file: %d\n", gle);
} }
if (gle == ERROR_SHARING_VIOLATION || gle == ERROR_USER_MAPPED_FILE) if (gle == ERROR_SHARING_VIOLATION || gle == ERROR_USER_MAPPED_FILE)
...@@ -453,7 +453,7 @@ static UINT copy_install_file(MSIPACKAGE *package, MSIFILE *file, LPWSTR source) ...@@ -453,7 +453,7 @@ static UINT copy_install_file(MSIPACKAGE *package, MSIFILE *file, LPWSTR source)
if (!GetTempFileNameW( pathW, L"msi", 0, tmpfileW )) tmpfileW[0] = 0; if (!GetTempFileNameW( pathW, L"msi", 0, tmpfileW )) tmpfileW[0] = 0;
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, file->TargetPath, NULL, MOVEFILE_DELAY_UNTIL_REBOOT ) &&
msi_move_file( package, tmpfileW, file->TargetPath, MOVEFILE_DELAY_UNTIL_REBOOT )) msi_move_file( package, tmpfileW, file->TargetPath, MOVEFILE_DELAY_UNTIL_REBOOT ))
{ {
...@@ -472,7 +472,7 @@ static UINT copy_install_file(MSIPACKAGE *package, MSIFILE *file, LPWSTR source) ...@@ -472,7 +472,7 @@ static UINT copy_install_file(MSIPACKAGE *package, MSIFILE *file, LPWSTR source)
return gle; return gle;
} }
static UINT create_directory( MSIPACKAGE *package, const WCHAR *dir ) static UINT create_folder( MSIPACKAGE *package, const WCHAR *dir )
{ {
MSIFOLDER *folder; MSIFOLDER *folder;
const WCHAR *install_path; const WCHAR *install_path;
...@@ -519,7 +519,7 @@ static BOOL installfiles_cb(MSIPACKAGE *package, LPCWSTR filename, DWORD action, ...@@ -519,7 +519,7 @@ static BOOL installfiles_cb(MSIPACKAGE *package, LPCWSTR filename, DWORD action,
if (!msi_is_global_assembly( file->Component )) if (!msi_is_global_assembly( file->Component ))
{ {
create_directory( package, file->Component->Directory ); create_folder( package, file->Component->Directory );
} }
*path = wcsdup( file->TargetPath ); *path = wcsdup( file->TargetPath );
*attrs = file->Attributes; *attrs = file->Attributes;
...@@ -579,7 +579,7 @@ UINT ACTION_InstallFiles(MSIPACKAGE *package) ...@@ -579,7 +579,7 @@ UINT ACTION_InstallFiles(MSIPACKAGE *package)
{ {
BOOL is_global_assembly = msi_is_global_assembly( file->Component ); 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 ); rc = msi_load_media_info( package, file->Sequence, mi );
if (rc != ERROR_SUCCESS) if (rc != ERROR_SUCCESS)
...@@ -628,7 +628,7 @@ UINT ACTION_InstallFiles(MSIPACKAGE *package) ...@@ -628,7 +628,7 @@ UINT ACTION_InstallFiles(MSIPACKAGE *package)
if (!is_global_assembly) if (!is_global_assembly)
{ {
create_directory(package, file->Component->Directory); create_folder(package, file->Component->Directory);
} }
rc = copy_install_file(package, file, source); rc = copy_install_file(package, file, source);
if (rc != ERROR_SUCCESS) if (rc != ERROR_SUCCESS)
...@@ -707,7 +707,7 @@ static UINT patch_file( MSIPACKAGE *package, MSIFILEPATCH *patch ) ...@@ -707,7 +707,7 @@ static UINT patch_file( MSIPACKAGE *package, MSIFILEPATCH *patch )
WCHAR *tmpfile = msi_create_temp_file( package->db ); WCHAR *tmpfile = msi_create_temp_file( package->db );
if (!tmpfile) return ERROR_INSTALL_FAILURE; 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_delete_file( package, patch->File->TargetPath );
msi_move_file( package, tmpfile, patch->File->TargetPath, 0 ); msi_move_file( package, tmpfile, patch->File->TargetPath, 0 );
...@@ -751,7 +751,7 @@ UINT msi_patch_assembly( MSIPACKAGE *package, MSIASSEMBLY *assembly, MSIFILEPATC ...@@ -751,7 +751,7 @@ UINT msi_patch_assembly( MSIPACKAGE *package, MSIASSEMBLY *assembly, MSIFILEPATC
if ((path = msi_get_assembly_path( package, displayname ))) 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), ERR( "failed to copy file %s -> %s (%lu)\n", debugstr_w(path),
debugstr_w(patch->File->TargetPath), GetLastError() ); debugstr_w(patch->File->TargetPath), GetLastError() );
...@@ -884,10 +884,10 @@ static BOOL move_file( MSIPACKAGE *package, const WCHAR *source, const WCHAR *de ...@@ -884,10 +884,10 @@ static BOOL move_file( MSIPACKAGE *package, const WCHAR *source, const WCHAR *de
else else
{ {
TRACE("copying %s -> %s\n", debugstr_w(source), debugstr_w(dest)); 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) if (!ret)
{ {
WARN( "msi_copy_file failed: %lu\n", GetLastError() ); WARN( "copy_file failed: %lu\n", GetLastError() );
return FALSE; return FALSE;
} }
} }
...@@ -1294,7 +1294,7 @@ static UINT ITERATE_DuplicateFiles(MSIRECORD *row, LPVOID param) ...@@ -1294,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)); 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", WARN( "failed to copy file %s -> %s (%lu)\n",
debugstr_w(file->TargetPath), debugstr_w(dest), GetLastError() ); debugstr_w(file->TargetPath), debugstr_w(dest), GetLastError() );
...@@ -1550,7 +1550,7 @@ UINT ACTION_RemoveFiles( MSIPACKAGE *package ) ...@@ -1550,7 +1550,7 @@ UINT ACTION_RemoveFiles( MSIPACKAGE *package )
VS_FIXEDFILEINFO *ver; VS_FIXEDFILEINFO *ver;
comp = file->Component; 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 ); comp->Action = msi_get_component_action( package, comp );
if (comp->Action != INSTALLSTATE_ABSENT || comp->Installed == INSTALLSTATE_SOURCE) if (comp->Action != INSTALLSTATE_ABSENT || comp->Installed == INSTALLSTATE_SOURCE)
......
...@@ -35,27 +35,27 @@ ...@@ -35,27 +35,27 @@
WINE_DEFAULT_DEBUG_CHANNEL(msi); WINE_DEFAULT_DEBUG_CHANNEL(msi);
static CRITICAL_SECTION MSI_handle_cs; static CRITICAL_SECTION handle_cs;
static CRITICAL_SECTION_DEBUG MSI_handle_cs_debug = static CRITICAL_SECTION_DEBUG handle_cs_debug =
{ {
0, 0, &MSI_handle_cs, 0, 0, &handle_cs,
{ &MSI_handle_cs_debug.ProcessLocksList, { &handle_cs_debug.ProcessLocksList,
&MSI_handle_cs_debug.ProcessLocksList }, &handle_cs_debug.ProcessLocksList },
0, 0, { (DWORD_PTR)(__FILE__ ": MSI_handle_cs") } 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 object_cs;
static CRITICAL_SECTION_DEBUG MSI_object_cs_debug = static CRITICAL_SECTION_DEBUG object_cs_debug =
{ {
0, 0, &MSI_object_cs, 0, 0, &object_cs,
{ &MSI_object_cs_debug.ProcessLocksList, { &object_cs_debug.ProcessLocksList,
&MSI_object_cs_debug.ProcessLocksList }, &object_cs_debug.ProcessLocksList },
0, 0, { (DWORD_PTR)(__FILE__ ": MSI_object_cs") } 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; BOOL remote;
union { union {
...@@ -63,18 +63,18 @@ typedef struct msi_handle_info_t ...@@ -63,18 +63,18 @@ typedef struct msi_handle_info_t
MSIHANDLE rem; MSIHANDLE rem;
} u; } u;
DWORD dwThreadId; DWORD dwThreadId;
} msi_handle_info; };
static msi_handle_info *msihandletable = NULL; static struct handle_info *handle_table = NULL;
static unsigned int msihandletable_size = 0; static unsigned int handle_table_size = 0;
void msi_free_handle_table(void) void msi_free_handle_table(void)
{ {
free( msihandletable ); free( handle_table );
msihandletable = NULL; handle_table = NULL;
msihandletable_size = 0; handle_table_size = 0;
DeleteCriticalSection(&MSI_handle_cs); DeleteCriticalSection(&handle_cs);
DeleteCriticalSection(&MSI_object_cs); DeleteCriticalSection(&object_cs);
} }
static MSIHANDLE alloc_handle_table_entry(void) static MSIHANDLE alloc_handle_table_entry(void)
...@@ -82,50 +82,50 @@ static MSIHANDLE alloc_handle_table_entry(void) ...@@ -82,50 +82,50 @@ static MSIHANDLE alloc_handle_table_entry(void)
UINT i; UINT i;
/* find a slot */ /* find a slot */
for(i=0; i<msihandletable_size; i++) for(i = 0; i < handle_table_size; i++)
if( !msihandletable[i].u.obj && !msihandletable[i].u.rem ) if (!handle_table[i].u.obj && !handle_table[i].u.rem)
break; break;
if( i==msihandletable_size ) if (i == handle_table_size)
{ {
msi_handle_info *p; struct handle_info *p;
int newsize; int newsize;
if (msihandletable_size == 0) if (!handle_table_size)
{ {
newsize = 256; newsize = 256;
p = calloc(newsize, sizeof(*p)); p = calloc(newsize, sizeof(*p));
} }
else else
{ {
newsize = msihandletable_size * 2; newsize = handle_table_size * 2;
p = realloc(msihandletable, newsize * sizeof(*p)); p = realloc(handle_table, newsize * sizeof(*p));
if (p) memset(p + msihandletable_size, 0, (newsize - msihandletable_size) * sizeof(*p)); if (p) memset(p + handle_table_size, 0, (newsize - handle_table_size) * sizeof(*p));
} }
if (!p) if (!p)
return 0; return 0;
msihandletable = p; handle_table = p;
msihandletable_size = newsize; handle_table_size = newsize;
} }
return i + 1; return i + 1;
} }
MSIHANDLE alloc_msihandle( MSIOBJECTHDR *obj ) MSIHANDLE alloc_msihandle( MSIOBJECTHDR *obj )
{ {
msi_handle_info *entry; struct handle_info *entry;
MSIHANDLE ret; MSIHANDLE ret;
EnterCriticalSection( &MSI_handle_cs ); EnterCriticalSection( &handle_cs );
ret = alloc_handle_table_entry(); ret = alloc_handle_table_entry();
if (ret) if (ret)
{ {
entry = &msihandletable[ ret - 1 ]; entry = &handle_table[ ret - 1 ];
msiobj_addref( obj ); msiobj_addref( obj );
entry->u.obj = obj; entry->u.obj = obj;
entry->dwThreadId = GetCurrentThreadId(); entry->dwThreadId = GetCurrentThreadId();
entry->remote = FALSE; entry->remote = FALSE;
} }
LeaveCriticalSection( &MSI_handle_cs ); LeaveCriticalSection( &handle_cs );
TRACE( "%p -> %lu\n", obj, ret ); TRACE( "%p -> %lu\n", obj, ret );
...@@ -134,21 +134,21 @@ MSIHANDLE alloc_msihandle( MSIOBJECTHDR *obj ) ...@@ -134,21 +134,21 @@ MSIHANDLE alloc_msihandle( MSIOBJECTHDR *obj )
MSIHANDLE alloc_msi_remote_handle(MSIHANDLE remote) MSIHANDLE alloc_msi_remote_handle(MSIHANDLE remote)
{ {
msi_handle_info *entry; struct handle_info *entry;
MSIHANDLE ret; MSIHANDLE ret;
EnterCriticalSection( &MSI_handle_cs ); EnterCriticalSection( &handle_cs );
ret = alloc_handle_table_entry(); ret = alloc_handle_table_entry();
if (ret) if (ret)
{ {
entry = &msihandletable[ ret - 1 ]; entry = &handle_table[ ret - 1 ];
entry->u.rem = remote; entry->u.rem = remote;
entry->dwThreadId = GetCurrentThreadId(); entry->dwThreadId = GetCurrentThreadId();
entry->remote = TRUE; entry->remote = TRUE;
} }
LeaveCriticalSection( &MSI_handle_cs ); LeaveCriticalSection( &handle_cs );
TRACE( "%lu -> %lu\n", remote, ret ); TRACE( "%lu -> %lu\n", remote, ret );
...@@ -159,23 +159,23 @@ void *msihandle2msiinfo(MSIHANDLE handle, UINT type) ...@@ -159,23 +159,23 @@ void *msihandle2msiinfo(MSIHANDLE handle, UINT type)
{ {
MSIOBJECTHDR *ret = NULL; MSIOBJECTHDR *ret = NULL;
EnterCriticalSection( &MSI_handle_cs ); EnterCriticalSection( &handle_cs );
handle--; handle--;
if( handle >= msihandletable_size ) if (handle >= handle_table_size)
goto out; goto out;
if( msihandletable[handle].remote) if (handle_table[handle].remote)
goto out; goto out;
if( !msihandletable[handle].u.obj ) if (!handle_table[handle].u.obj)
goto out; goto out;
if( msihandletable[handle].u.obj->magic != MSIHANDLE_MAGIC ) if (handle_table[handle].u.obj->magic != MSIHANDLE_MAGIC)
goto out; goto out;
if( type && (msihandletable[handle].u.obj->type != type) ) if (type && (handle_table[handle].u.obj->type != type))
goto out; goto out;
ret = msihandletable[handle].u.obj; ret = handle_table[handle].u.obj;
msiobj_addref( ret ); msiobj_addref( ret );
out: out:
LeaveCriticalSection( &MSI_handle_cs ); LeaveCriticalSection( &handle_cs );
return ret; return ret;
} }
...@@ -184,16 +184,16 @@ MSIHANDLE msi_get_remote( MSIHANDLE handle ) ...@@ -184,16 +184,16 @@ MSIHANDLE msi_get_remote( MSIHANDLE handle )
{ {
MSIHANDLE ret = 0; MSIHANDLE ret = 0;
EnterCriticalSection( &MSI_handle_cs ); EnterCriticalSection( &handle_cs );
handle--; handle--;
if( handle>=msihandletable_size ) if (handle >= handle_table_size)
goto out; goto out;
if( !msihandletable[handle].remote) if (!handle_table[handle].remote)
goto out; goto out;
ret = msihandletable[handle].u.rem; ret = handle_table[handle].u.rem;
out: out:
LeaveCriticalSection( &MSI_handle_cs ); LeaveCriticalSection( &handle_cs );
return ret; return ret;
} }
...@@ -230,12 +230,12 @@ void msiobj_addref( MSIOBJECTHDR *info ) ...@@ -230,12 +230,12 @@ void msiobj_addref( MSIOBJECTHDR *info )
void msiobj_lock( MSIOBJECTHDR *info ) void msiobj_lock( MSIOBJECTHDR *info )
{ {
EnterCriticalSection( &MSI_object_cs ); EnterCriticalSection( &object_cs );
} }
void msiobj_unlock( MSIOBJECTHDR *info ) void msiobj_unlock( MSIOBJECTHDR *info )
{ {
LeaveCriticalSection( &MSI_object_cs ); LeaveCriticalSection( &object_cs );
} }
int msiobj_release( MSIOBJECTHDR *info ) int msiobj_release( MSIOBJECTHDR *info )
...@@ -276,19 +276,19 @@ UINT WINAPI MsiCloseHandle(MSIHANDLE handle) ...@@ -276,19 +276,19 @@ UINT WINAPI MsiCloseHandle(MSIHANDLE handle)
if (!handle) if (!handle)
return ERROR_SUCCESS; return ERROR_SUCCESS;
EnterCriticalSection( &MSI_handle_cs ); EnterCriticalSection( &handle_cs );
handle--; handle--;
if (handle >= msihandletable_size) if (handle >= handle_table_size)
goto out; 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 else
{ {
info = msihandletable[handle].u.obj; info = handle_table[handle].u.obj;
if( !info ) if( !info )
goto out; goto out;
...@@ -299,15 +299,15 @@ UINT WINAPI MsiCloseHandle(MSIHANDLE handle) ...@@ -299,15 +299,15 @@ UINT WINAPI MsiCloseHandle(MSIHANDLE handle)
} }
} }
msihandletable[handle].u.obj = NULL; handle_table[handle].u.obj = NULL;
msihandletable[handle].remote = 0; handle_table[handle].remote = 0;
msihandletable[handle].dwThreadId = 0; handle_table[handle].dwThreadId = 0;
ret = ERROR_SUCCESS; ret = ERROR_SUCCESS;
TRACE( "handle %lu destroyed\n", handle + 1 ); TRACE( "handle %lu destroyed\n", handle + 1 );
out: out:
LeaveCriticalSection( &MSI_handle_cs ); LeaveCriticalSection( &handle_cs );
if( info ) if( info )
msiobj_release( info ); msiobj_release( info );
...@@ -328,18 +328,18 @@ UINT WINAPI MsiCloseAllHandles(void) ...@@ -328,18 +328,18 @@ UINT WINAPI MsiCloseAllHandles(void)
TRACE("\n"); TRACE("\n");
EnterCriticalSection( &MSI_handle_cs ); EnterCriticalSection( &handle_cs );
for(i=0; i<msihandletable_size; i++) for (i = 0; i < handle_table_size; i++)
{ {
if(msihandletable[i].dwThreadId == GetCurrentThreadId()) if (handle_table[i].dwThreadId == GetCurrentThreadId())
{ {
LeaveCriticalSection( &MSI_handle_cs ); LeaveCriticalSection( &handle_cs );
MsiCloseHandle( i+1 ); MsiCloseHandle( i + 1 );
EnterCriticalSection( &MSI_handle_cs ); EnterCriticalSection( &handle_cs );
n++; n++;
} }
} }
LeaveCriticalSection( &MSI_handle_cs ); LeaveCriticalSection( &handle_cs );
return n; return n;
} }
......
...@@ -106,7 +106,7 @@ err: ...@@ -106,7 +106,7 @@ err:
/* checks to see if the column order specified in the INSERT query /* checks to see if the column order specified in the INSERT query
* matches the column order of the table * matches the column order of the table
*/ */
static BOOL msi_columns_in_order(MSIINSERTVIEW *iv, UINT col_count) static BOOL columns_in_order(MSIINSERTVIEW *iv, UINT col_count)
{ {
LPCWSTR a, b; LPCWSTR a, b;
UINT i; UINT i;
...@@ -124,7 +124,7 @@ static BOOL msi_columns_in_order(MSIINSERTVIEW *iv, UINT col_count) ...@@ -124,7 +124,7 @@ static BOOL msi_columns_in_order(MSIINSERTVIEW *iv, UINT col_count)
/* rearranges the data in the record to be inserted based on column order, /* rearranges the data in the record to be inserted based on column order,
* and pads the record for any missing columns in the INSERT query * and pads the record for any missing columns in the INSERT query
*/ */
static UINT msi_arrange_record(MSIINSERTVIEW *iv, MSIRECORD **values) static UINT arrange_record(MSIINSERTVIEW *iv, MSIRECORD **values)
{ {
MSIRECORD *padded; MSIRECORD *padded;
UINT col_count, val_count; UINT col_count, val_count;
...@@ -140,7 +140,7 @@ static UINT msi_arrange_record(MSIINSERTVIEW *iv, MSIRECORD **values) ...@@ -140,7 +140,7 @@ static UINT msi_arrange_record(MSIINSERTVIEW *iv, MSIRECORD **values)
/* check to see if the columns are arranged already /* check to see if the columns are arranged already
* to avoid unnecessary copying * to avoid unnecessary copying
*/ */
if (col_count == val_count && msi_columns_in_order(iv, col_count)) if (col_count == val_count && columns_in_order(iv, col_count))
return ERROR_SUCCESS; return ERROR_SUCCESS;
padded = MSI_CreateRecord(col_count); padded = MSI_CreateRecord(col_count);
...@@ -231,7 +231,7 @@ static UINT INSERT_execute( struct tagMSIVIEW *view, MSIRECORD *record ) ...@@ -231,7 +231,7 @@ static UINT INSERT_execute( struct tagMSIVIEW *view, MSIRECORD *record )
if( !values ) if( !values )
goto err; goto err;
r = msi_arrange_record( iv, &values ); r = arrange_record( iv, &values );
if( r != ERROR_SUCCESS ) if( r != ERROR_SUCCESS )
goto err; goto err;
......
...@@ -60,7 +60,7 @@ static BOOL source_matches_volume(MSIMEDIAINFO *mi, LPCWSTR source_root) ...@@ -60,7 +60,7 @@ static BOOL source_matches_volume(MSIMEDIAINFO *mi, LPCWSTR source_root)
return !wcsicmp( mi->volume_label, p ); 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; MSIRECORD *record;
LPWSTR source_dir; LPWSTR source_dir;
...@@ -83,7 +83,7 @@ static UINT msi_change_media(MSIPACKAGE *package, MSIMEDIAINFO *mi) ...@@ -83,7 +83,7 @@ static UINT msi_change_media(MSIPACKAGE *package, MSIMEDIAINFO *mi)
return r == IDRETRY ? ERROR_SUCCESS : ERROR_INSTALL_SOURCE_ABSENT; 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; MSICABINETSTREAM *cab;
...@@ -183,7 +183,7 @@ static INT_PTR CDECL cabinet_open_stream( char *pszFile, int oflag, int pmode ) ...@@ -183,7 +183,7 @@ static INT_PTR CDECL cabinet_open_stream( char *pszFile, int oflag, int pmode )
MSICABINETSTREAM *cab; MSICABINETSTREAM *cab;
IStream *stream; 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"); WARN("failed to get cabinet stream\n");
return -1; return -1;
...@@ -255,7 +255,7 @@ static LONG CDECL cabinet_seek_stream( INT_PTR hf, LONG dist, int seektype ) ...@@ -255,7 +255,7 @@ static LONG CDECL cabinet_seek_stream( INT_PTR hf, LONG dist, int seektype )
return -1; 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; MSIRECORD *row;
...@@ -313,7 +313,7 @@ static INT_PTR cabinet_next_cabinet(FDINOTIFICATIONTYPE fdint, ...@@ -313,7 +313,7 @@ static INT_PTR cabinet_next_cabinet(FDINOTIFICATIONTYPE fdint,
mi->disk_id++; mi->disk_id++;
mi->is_continuous = TRUE; 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) if (rc != ERROR_SUCCESS)
{ {
ERR("Failed to get next cabinet information: %d\n", rc); ERR("Failed to get next cabinet information: %d\n", rc);
...@@ -355,7 +355,7 @@ static INT_PTR cabinet_next_cabinet(FDINOTIFICATIONTYPE fdint, ...@@ -355,7 +355,7 @@ static INT_PTR cabinet_next_cabinet(FDINOTIFICATIONTYPE fdint,
res = 0; res = 0;
if (GetFileAttributesW(cabinet_file) == INVALID_FILE_ATTRIBUTES) 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; res = -1;
} }
...@@ -382,7 +382,7 @@ static INT_PTR cabinet_next_cabinet_stream( FDINOTIFICATIONTYPE fdint, ...@@ -382,7 +382,7 @@ static INT_PTR cabinet_next_cabinet_stream( FDINOTIFICATIONTYPE fdint,
mi->disk_id++; mi->disk_id++;
mi->is_continuous = TRUE; 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) if (rc != ERROR_SUCCESS)
{ {
ERR("Failed to get next cabinet information: %u\n", rc); ERR("Failed to get next cabinet information: %u\n", rc);
...@@ -889,7 +889,7 @@ UINT ready_media( MSIPACKAGE *package, BOOL compressed, MSIMEDIAINFO *mi ) ...@@ -889,7 +889,7 @@ UINT ready_media( MSIPACKAGE *package, BOOL compressed, MSIMEDIAINFO *mi )
if (!match && (mi->type == DRIVE_CDROM || mi->type == DRIVE_REMOVABLE)) 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)
{ {
free( cabinet_file ); free( cabinet_file );
return rc; return rc;
......
...@@ -1365,7 +1365,7 @@ done: ...@@ -1365,7 +1365,7 @@ done:
return r; 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; UINT r = ERROR_SUCCESS;
...@@ -1490,7 +1490,7 @@ UINT WINAPI MsiGetProductInfoExW(LPCWSTR szProductCode, LPCWSTR szUserSid, ...@@ -1490,7 +1490,7 @@ UINT WINAPI MsiGetProductInfoExW(LPCWSTR szProductCode, LPCWSTR szUserSid,
if (!val) if (!val)
val = wcsdup(L""); val = wcsdup(L"");
r = msi_copy_outval(val, szValue, pcchValue); r = copy_outval(val, szValue, pcchValue);
} }
else if (!wcscmp( szProperty, INSTALLPROPERTY_TRANSFORMSW ) || else if (!wcscmp( szProperty, INSTALLPROPERTY_TRANSFORMSW ) ||
!wcscmp( szProperty, INSTALLPROPERTY_LANGUAGEW ) || !wcscmp( szProperty, INSTALLPROPERTY_LANGUAGEW ) ||
...@@ -1515,7 +1515,7 @@ UINT WINAPI MsiGetProductInfoExW(LPCWSTR szProductCode, LPCWSTR szUserSid, ...@@ -1515,7 +1515,7 @@ UINT WINAPI MsiGetProductInfoExW(LPCWSTR szProductCode, LPCWSTR szUserSid,
if (!val) if (!val)
val = wcsdup(L""); val = wcsdup(L"");
r = msi_copy_outval(val, szValue, pcchValue); r = copy_outval(val, szValue, pcchValue);
} }
else if (!wcscmp( szProperty, INSTALLPROPERTY_PRODUCTSTATEW )) else if (!wcscmp( szProperty, INSTALLPROPERTY_PRODUCTSTATEW ))
{ {
...@@ -1533,14 +1533,14 @@ UINT WINAPI MsiGetProductInfoExW(LPCWSTR szProductCode, LPCWSTR szUserSid, ...@@ -1533,14 +1533,14 @@ UINT WINAPI MsiGetProductInfoExW(LPCWSTR szProductCode, LPCWSTR szUserSid,
else else
val = wcsdup(L"1"); val = wcsdup(L"1");
r = msi_copy_outval(val, szValue, pcchValue); r = copy_outval(val, szValue, pcchValue);
goto done; goto done;
} }
else if (props && (val = reg_get_value(props, package, &type))) else if (props && (val = reg_get_value(props, package, &type)))
{ {
free(val); free(val);
val = wcsdup(L"5"); val = wcsdup(L"5");
r = msi_copy_outval(val, szValue, pcchValue); r = copy_outval(val, szValue, pcchValue);
goto done; goto done;
} }
...@@ -1549,7 +1549,7 @@ UINT WINAPI MsiGetProductInfoExW(LPCWSTR szProductCode, LPCWSTR szUserSid, ...@@ -1549,7 +1549,7 @@ UINT WINAPI MsiGetProductInfoExW(LPCWSTR szProductCode, LPCWSTR szUserSid,
else else
goto done; goto done;
r = msi_copy_outval(val, szValue, pcchValue); r = copy_outval(val, szValue, pcchValue);
} }
else if (!wcscmp( szProperty, INSTALLPROPERTY_ASSIGNMENTTYPEW )) else if (!wcscmp( szProperty, INSTALLPROPERTY_ASSIGNMENTTYPEW ))
{ {
...@@ -1558,7 +1558,7 @@ UINT WINAPI MsiGetProductInfoExW(LPCWSTR szProductCode, LPCWSTR szUserSid, ...@@ -1558,7 +1558,7 @@ UINT WINAPI MsiGetProductInfoExW(LPCWSTR szProductCode, LPCWSTR szUserSid,
/* FIXME */ /* FIXME */
val = wcsdup(L""); val = wcsdup(L"");
r = msi_copy_outval(val, szValue, pcchValue); r = copy_outval(val, szValue, pcchValue);
} }
else else
r = ERROR_UNKNOWN_PROPERTY; r = ERROR_UNKNOWN_PROPERTY;
...@@ -2082,7 +2082,7 @@ UINT WINAPI MsiQueryComponentStateA(LPCSTR szProductCode, ...@@ -2082,7 +2082,7 @@ UINT WINAPI MsiQueryComponentStateA(LPCSTR szProductCode,
return r; 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; UINT r;
HKEY hkey = NULL; HKEY hkey = NULL;
...@@ -2092,7 +2092,7 @@ static BOOL msi_comp_find_prod_key(LPCWSTR prodcode, MSIINSTALLCONTEXT context) ...@@ -2092,7 +2092,7 @@ static BOOL msi_comp_find_prod_key(LPCWSTR prodcode, MSIINSTALLCONTEXT context)
return (r == ERROR_SUCCESS); 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; LPCWSTR package;
HKEY hkey; HKEY hkey;
...@@ -2116,9 +2116,8 @@ static BOOL msi_comp_find_package(LPCWSTR prodcode, MSIINSTALLCONTEXT context) ...@@ -2116,9 +2116,8 @@ static BOOL msi_comp_find_package(LPCWSTR prodcode, MSIINSTALLCONTEXT context)
return (res == ERROR_SUCCESS); return (res == ERROR_SUCCESS);
} }
static UINT msi_comp_find_prodcode(WCHAR *squashed_pc, static UINT comp_find_prodcode(const WCHAR *squashed_pc, MSIINSTALLCONTEXT context, const WCHAR *comp, WCHAR *val,
MSIINSTALLCONTEXT context, DWORD *sz)
LPCWSTR comp, LPWSTR val, DWORD *sz)
{ {
HKEY hkey; HKEY hkey;
LONG res; LONG res;
...@@ -2160,9 +2159,9 @@ UINT WINAPI MsiQueryComponentStateW(LPCWSTR szProductCode, ...@@ -2160,9 +2159,9 @@ UINT WINAPI MsiQueryComponentStateW(LPCWSTR szProductCode,
if (!squash_guid( szProductCode, squashed_pc )) if (!squash_guid( szProductCode, squashed_pc ))
return ERROR_INVALID_PARAMETER; 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) if (found)
{ {
...@@ -2176,7 +2175,7 @@ UINT WINAPI MsiQueryComponentStateW(LPCWSTR szProductCode, ...@@ -2176,7 +2175,7 @@ UINT WINAPI MsiQueryComponentStateW(LPCWSTR szProductCode,
*pdwState = INSTALLSTATE_UNKNOWN; *pdwState = INSTALLSTATE_UNKNOWN;
sz = 0; 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; return ERROR_UNKNOWN_COMPONENT;
if (sz == 0) if (sz == 0)
...@@ -2187,7 +2186,7 @@ UINT WINAPI MsiQueryComponentStateW(LPCWSTR szProductCode, ...@@ -2187,7 +2186,7 @@ UINT WINAPI MsiQueryComponentStateW(LPCWSTR szProductCode,
UINT r; UINT r;
if (!(val = malloc( sz ))) return ERROR_OUTOFMEMORY; if (!(val = malloc( sz ))) return ERROR_OUTOFMEMORY;
if ((r = msi_comp_find_prodcode( squashed_pc, dwContext, szComponent, val, &sz ))) if ((r = comp_find_prodcode( squashed_pc, dwContext, szComponent, val, &sz )))
{ {
free(val); free(val);
return r; return r;
......
...@@ -564,8 +564,7 @@ UINT WINAPI MsiViewExecute( MSIHANDLE hView, MSIHANDLE hRec ) ...@@ -564,8 +564,7 @@ UINT WINAPI MsiViewExecute( MSIHANDLE hView, MSIHANDLE hRec )
return ret; return ret;
} }
static UINT msi_set_record_type_string( MSIRECORD *rec, UINT field, static UINT set_record_type_string( MSIRECORD *rec, UINT field, UINT type, BOOL temporary )
UINT type, BOOL temporary )
{ {
WCHAR szType[0x10]; WCHAR szType[0x10];
...@@ -633,7 +632,7 @@ UINT MSI_ViewGetColumnInfo( MSIQUERY *query, MSICOLINFO info, MSIRECORD **prec ) ...@@ -633,7 +632,7 @@ UINT MSI_ViewGetColumnInfo( MSIQUERY *query, MSICOLINFO info, MSIRECORD **prec )
if (info == MSICOLINFO_NAMES) if (info == MSICOLINFO_NAMES)
MSI_RecordSetStringW( rec, i+1, name ); MSI_RecordSetStringW( rec, i+1, name );
else else
msi_set_record_type_string( rec, i+1, type, temporary ); set_record_type_string( rec, i+1, type, temporary );
} }
*prec = rec; *prec = rec;
return ERROR_SUCCESS; return ERROR_SUCCESS;
...@@ -1009,15 +1008,15 @@ UINT WINAPI MsiDatabaseCommit( MSIHANDLE hdb ) ...@@ -1009,15 +1008,15 @@ UINT WINAPI MsiDatabaseCommit( MSIHANDLE hdb )
return r; return r;
} }
struct msi_primary_key_record_info struct primary_key_record_info
{ {
DWORD n; DWORD n;
MSIRECORD *rec; 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; LPCWSTR name, table;
DWORD type; DWORD type;
...@@ -1041,10 +1040,9 @@ static UINT msi_primary_key_iterator( MSIRECORD *rec, LPVOID param ) ...@@ -1041,10 +1040,9 @@ static UINT msi_primary_key_iterator( MSIRECORD *rec, LPVOID param )
return ERROR_SUCCESS; return ERROR_SUCCESS;
} }
UINT MSI_DatabaseGetPrimaryKeys( MSIDATABASE *db, UINT MSI_DatabaseGetPrimaryKeys( MSIDATABASE *db, const WCHAR *table, MSIRECORD **prec )
LPCWSTR table, MSIRECORD **prec )
{ {
struct msi_primary_key_record_info info; struct primary_key_record_info info;
MSIQUERY *query = NULL; MSIQUERY *query = NULL;
UINT r; UINT r;
...@@ -1058,7 +1056,7 @@ UINT MSI_DatabaseGetPrimaryKeys( MSIDATABASE *db, ...@@ -1058,7 +1056,7 @@ UINT MSI_DatabaseGetPrimaryKeys( MSIDATABASE *db,
/* count the number of primary key records */ /* count the number of primary key records */
info.n = 0; info.n = 0;
info.rec = 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 ) if( r == ERROR_SUCCESS )
{ {
TRACE( "found %lu primary keys\n", info.n ); TRACE( "found %lu primary keys\n", info.n );
...@@ -1066,7 +1064,7 @@ UINT MSI_DatabaseGetPrimaryKeys( MSIDATABASE *db, ...@@ -1066,7 +1064,7 @@ UINT MSI_DatabaseGetPrimaryKeys( MSIDATABASE *db,
/* allocate a record and fill in the names of the tables */ /* allocate a record and fill in the names of the tables */
info.rec = MSI_CreateRecord( info.n ); info.rec = MSI_CreateRecord( info.n );
info.n = 0; 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 ) if( r == ERROR_SUCCESS )
*prec = info.rec; *prec = info.rec;
else else
......
...@@ -940,7 +940,7 @@ static MSIPACKAGE *alloc_package( void ) ...@@ -940,7 +940,7 @@ static MSIPACKAGE *alloc_package( void )
return package; return package;
} }
static UINT msi_load_admin_properties(MSIPACKAGE *package) static UINT load_admin_properties(MSIPACKAGE *package)
{ {
BYTE *data; BYTE *data;
UINT r, sz; UINT r, sz;
...@@ -1009,7 +1009,7 @@ MSIPACKAGE *MSI_CreatePackage( MSIDATABASE *db ) ...@@ -1009,7 +1009,7 @@ MSIPACKAGE *MSI_CreatePackage( MSIDATABASE *db )
} }
if (package->WordCount & msidbSumInfoSourceTypeAdminImage) if (package->WordCount & msidbSumInfoSourceTypeAdminImage)
msi_load_admin_properties( package ); load_admin_properties( package );
package->log_file = INVALID_HANDLE_VALUE; package->log_file = INVALID_HANDLE_VALUE;
package->script = SCRIPT_NONE; package->script = SCRIPT_NONE;
...@@ -2110,7 +2110,7 @@ UINT WINAPI MsiSetPropertyW( MSIHANDLE hInstall, LPCWSTR szName, LPCWSTR szValue ...@@ -2110,7 +2110,7 @@ UINT WINAPI MsiSetPropertyW( MSIHANDLE hInstall, LPCWSTR szName, LPCWSTR szValue
return ret; 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; MSIRECORD *rec, *row = NULL;
MSIQUERY *view; MSIQUERY *view;
...@@ -2185,7 +2185,7 @@ UINT msi_get_property( MSIDATABASE *db, LPCWSTR szName, ...@@ -2185,7 +2185,7 @@ UINT msi_get_property( MSIDATABASE *db, LPCWSTR szName,
TRACE("%p %s %p %p\n", db, debugstr_w(szName), szValueBuf, pchValueBuf); 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) if (*pchValueBuf > 0)
szValueBuf[0] = 0; szValueBuf[0] = 0;
...@@ -2300,7 +2300,7 @@ UINT WINAPI MsiGetPropertyA(MSIHANDLE hinst, const char *name, char *buf, DWORD ...@@ -2300,7 +2300,7 @@ UINT WINAPI MsiGetPropertyA(MSIHANDLE hinst, const char *name, char *buf, DWORD
return r; return r;
} }
row = msi_get_property_row(package->db, nameW); row = get_property_row(package->db, nameW);
if (row) if (row)
value = msi_record_get_string(row, 1, &len); value = msi_record_get_string(row, 1, &len);
...@@ -2363,7 +2363,7 @@ UINT WINAPI MsiGetPropertyW(MSIHANDLE hinst, const WCHAR *name, WCHAR *buf, DWOR ...@@ -2363,7 +2363,7 @@ UINT WINAPI MsiGetPropertyW(MSIHANDLE hinst, const WCHAR *name, WCHAR *buf, DWOR
return r; return r;
} }
row = msi_get_property_row(package->db, name); row = get_property_row(package->db, name);
if (row) if (row)
value = msi_record_get_string(row, 1, &len); value = msi_record_get_string(row, 1, &len);
......
...@@ -315,7 +315,7 @@ UINT msi_check_patch_applicable( MSIPACKAGE *package, MSISUMMARYINFO *si ) ...@@ -315,7 +315,7 @@ UINT msi_check_patch_applicable( MSIPACKAGE *package, MSISUMMARYINFO *si )
return ret; return ret;
} }
static UINT msi_parse_patch_summary( MSISUMMARYINFO *si, MSIPATCHINFO **patch ) static UINT parse_patch_summary( MSISUMMARYINFO *si, MSIPATCHINFO **patch )
{ {
MSIPATCHINFO *pi; MSIPATCHINFO *pi;
UINT r = ERROR_SUCCESS; UINT r = ERROR_SUCCESS;
...@@ -831,7 +831,7 @@ static DWORD is_uninstallable( MSIDATABASE *db ) ...@@ -831,7 +831,7 @@ static DWORD is_uninstallable( MSIDATABASE *db )
return ret; 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; UINT i, r = ERROR_SUCCESS;
WCHAR **substorage; WCHAR **substorage;
...@@ -872,7 +872,7 @@ void msi_free_patchinfo( MSIPATCHINFO *patch ) ...@@ -872,7 +872,7 @@ void msi_free_patchinfo( MSIPATCHINFO *patch )
free( patch ); 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; MSIDATABASE *patch_db = NULL;
WCHAR localfile[MAX_PATH]; WCHAR localfile[MAX_PATH];
...@@ -901,7 +901,7 @@ static UINT msi_apply_patch_package( MSIPACKAGE *package, const WCHAR *file ) ...@@ -901,7 +901,7 @@ static UINT msi_apply_patch_package( MSIPACKAGE *package, const WCHAR *file )
r = ERROR_SUCCESS; r = ERROR_SUCCESS;
goto done; goto done;
} }
r = msi_parse_patch_summary( si, &patch ); r = parse_patch_summary( si, &patch );
if ( r != ERROR_SUCCESS ) if ( r != ERROR_SUCCESS )
goto done; goto done;
...@@ -914,7 +914,7 @@ static UINT msi_apply_patch_package( MSIPACKAGE *package, const WCHAR *file ) ...@@ -914,7 +914,7 @@ static UINT msi_apply_patch_package( MSIPACKAGE *package, const WCHAR *file )
if (!(patch->filename = wcsdup( file ))) goto done; if (!(patch->filename = wcsdup( file ))) goto done;
if (!(patch->localfile = wcsdup( localfile ))) 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); if (r != ERROR_SUCCESS) WARN("patch failed to apply %u\n", r);
done: done:
...@@ -940,7 +940,7 @@ UINT msi_apply_patches( MSIPACKAGE *package ) ...@@ -940,7 +940,7 @@ UINT msi_apply_patches( MSIPACKAGE *package )
patches = msi_split_string( patch_list, ';' ); patches = msi_split_string( patch_list, ';' );
for (i = 0; patches && patches[i] && r == ERROR_SUCCESS; i++) 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] );
free( patches ); free( patches );
free( patch_list ); free( patch_list );
...@@ -1018,7 +1018,7 @@ UINT msi_apply_registered_patch( MSIPACKAGE *package, LPCWSTR patch_code ) ...@@ -1018,7 +1018,7 @@ UINT msi_apply_registered_patch( MSIPACKAGE *package, LPCWSTR patch_code )
msiobj_release( &patch_db->hdr ); msiobj_release( &patch_db->hdr );
return r; return r;
} }
r = msi_parse_patch_summary( si, &patch_info ); r = parse_patch_summary( si, &patch_info );
msiobj_release( &si->hdr ); msiobj_release( &si->hdr );
if (r != ERROR_SUCCESS) if (r != ERROR_SUCCESS)
{ {
...@@ -1034,7 +1034,7 @@ UINT msi_apply_registered_patch( MSIPACKAGE *package, LPCWSTR patch_code ) ...@@ -1034,7 +1034,7 @@ UINT msi_apply_registered_patch( MSIPACKAGE *package, LPCWSTR patch_code )
msi_free_patchinfo( patch_info ); msi_free_patchinfo( patch_info );
return ERROR_OUTOFMEMORY; 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 ); msiobj_release( &patch_db->hdr );
if (r != ERROR_SUCCESS) if (r != ERROR_SUCCESS)
{ {
......
...@@ -497,7 +497,7 @@ UINT WINAPI MsiRecordGetStringW( MSIHANDLE handle, UINT iField, WCHAR *szValue, ...@@ -497,7 +497,7 @@ UINT WINAPI MsiRecordGetStringW( MSIHANDLE handle, UINT iField, WCHAR *szValue,
return ret; return ret;
} }
static UINT msi_get_stream_size( IStream *stm ) static UINT get_stream_size( IStream *stm )
{ {
STATSTG stat; STATSTG stat;
HRESULT r; HRESULT r;
...@@ -524,7 +524,7 @@ static UINT MSI_RecordDataSize(MSIRECORD *rec, UINT iField) ...@@ -524,7 +524,7 @@ static UINT MSI_RecordDataSize(MSIRECORD *rec, UINT iField)
case MSIFIELD_NULL: case MSIFIELD_NULL:
break; break;
case MSIFIELD_STREAM: case MSIFIELD_STREAM:
return msi_get_stream_size( rec->fields[iField].u.stream ); return get_stream_size( rec->fields[iField].u.stream );
} }
return 0; return 0;
} }
...@@ -865,7 +865,7 @@ UINT MSI_RecordGetIStream( MSIRECORD *rec, UINT iField, IStream **pstm) ...@@ -865,7 +865,7 @@ UINT MSI_RecordGetIStream( MSIRECORD *rec, UINT iField, IStream **pstm)
return ERROR_SUCCESS; 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; ULARGE_INTEGER size;
LARGE_INTEGER pos; LARGE_INTEGER pos;
...@@ -909,7 +909,7 @@ UINT MSI_RecordStreamToFile( MSIRECORD *rec, UINT iField, LPCWSTR name ) ...@@ -909,7 +909,7 @@ UINT MSI_RecordStreamToFile( MSIRECORD *rec, UINT iField, LPCWSTR name )
r = MSI_RecordGetIStream( rec, iField, &stm ); r = MSI_RecordGetIStream( rec, iField, &stm );
if( r == ERROR_SUCCESS ) if( r == ERROR_SUCCESS )
{ {
r = msi_dump_stream_to_file( stm, name ); r = dump_stream_to_file( stm, name );
IStream_Release( stm ); IStream_Release( stm );
} }
......
...@@ -1687,9 +1687,8 @@ done: ...@@ -1687,9 +1687,8 @@ done:
return r; return r;
} }
static UINT msi_get_patch_state(LPCWSTR prodcode, LPCWSTR usersid, static UINT get_patch_state(const WCHAR *prodcode, const WCHAR *usersid, MSIINSTALLCONTEXT context,
MSIINSTALLCONTEXT context, WCHAR *patch, MSIPATCHSTATE *state)
LPWSTR patch, MSIPATCHSTATE *state)
{ {
DWORD type, val, size; DWORD type, val, size;
HKEY prod, hkey = 0; HKEY prod, hkey = 0;
...@@ -1732,10 +1731,9 @@ done: ...@@ -1732,10 +1731,9 @@ done:
return r; return r;
} }
static UINT msi_check_product_patches(LPCWSTR prodcode, LPCWSTR usersid, static UINT check_product_patches(const WCHAR *prodcode, const WCHAR *usersid, MSIINSTALLCONTEXT context,
MSIINSTALLCONTEXT context, DWORD filter, DWORD index, DWORD *idx, DWORD filter, DWORD index, DWORD *idx, WCHAR *patch, WCHAR *targetprod,
LPWSTR patch, LPWSTR targetprod, MSIINSTALLCONTEXT *targetctx, MSIINSTALLCONTEXT *targetctx, WCHAR *targetsid, DWORD *sidsize, WCHAR **transforms)
LPWSTR targetsid, DWORD *sidsize, LPWSTR *transforms)
{ {
MSIPATCHSTATE state = MSIPATCHSTATE_INVALID; MSIPATCHSTATE state = MSIPATCHSTATE_INVALID;
LPWSTR ptr, patches = NULL; LPWSTR ptr, patches = NULL;
...@@ -1806,8 +1804,7 @@ static UINT msi_check_product_patches(LPCWSTR prodcode, LPCWSTR usersid, ...@@ -1806,8 +1804,7 @@ static UINT msi_check_product_patches(LPCWSTR prodcode, LPCWSTR usersid,
{ {
if (!(filter & MSIPATCHSTATE_APPLIED)) if (!(filter & MSIPATCHSTATE_APPLIED))
{ {
temp = msi_get_patch_state(prodcode, usersid, context, temp = get_patch_state(prodcode, usersid, context, ptr, &state);
ptr, &state);
if (temp == ERROR_BAD_CONFIGURATION) if (temp == ERROR_BAD_CONFIGURATION)
{ {
r = ERROR_BAD_CONFIGURATION; r = ERROR_BAD_CONFIGURATION;
...@@ -1822,8 +1819,7 @@ static UINT msi_check_product_patches(LPCWSTR prodcode, LPCWSTR usersid, ...@@ -1822,8 +1819,7 @@ static UINT msi_check_product_patches(LPCWSTR prodcode, LPCWSTR usersid,
{ {
if (!(filter & MSIPATCHSTATE_APPLIED)) if (!(filter & MSIPATCHSTATE_APPLIED))
{ {
temp = msi_get_patch_state(prodcode, usersid, context, temp = get_patch_state(prodcode, usersid, context, ptr, &state);
ptr, &state);
if (temp == ERROR_BAD_CONFIGURATION) if (temp == ERROR_BAD_CONFIGURATION)
{ {
r = ERROR_BAD_CONFIGURATION; r = ERROR_BAD_CONFIGURATION;
...@@ -1901,11 +1897,10 @@ done: ...@@ -1901,11 +1897,10 @@ done:
return r; return r;
} }
static UINT msi_enum_patches(LPCWSTR szProductCode, LPCWSTR szUserSid, static UINT enum_patches(const WCHAR *szProductCode, const WCHAR *szUserSid, DWORD dwContext, DWORD dwFilter,
DWORD dwContext, DWORD dwFilter, DWORD dwIndex, DWORD *idx, DWORD dwIndex, DWORD *idx, WCHAR *szPatchCode, WCHAR *szTargetProductCode,
LPWSTR szPatchCode, LPWSTR szTargetProductCode, MSIINSTALLCONTEXT *pdwTargetProductContext, WCHAR *szTargetUserSid, DWORD *pcchTargetUserSid,
MSIINSTALLCONTEXT *pdwTargetProductContext, LPWSTR szTargetUserSid, WCHAR **szTransforms)
LPDWORD pcchTargetUserSid, LPWSTR *szTransforms)
{ {
LPWSTR usersid = NULL; LPWSTR usersid = NULL;
UINT r = ERROR_INVALID_PARAMETER; UINT r = ERROR_INVALID_PARAMETER;
...@@ -1918,11 +1913,8 @@ static UINT msi_enum_patches(LPCWSTR szProductCode, LPCWSTR szUserSid, ...@@ -1918,11 +1913,8 @@ static UINT msi_enum_patches(LPCWSTR szProductCode, LPCWSTR szUserSid,
if (dwContext & MSIINSTALLCONTEXT_USERMANAGED) if (dwContext & MSIINSTALLCONTEXT_USERMANAGED)
{ {
r = msi_check_product_patches(szProductCode, szUserSid, r = check_product_patches(szProductCode, szUserSid, MSIINSTALLCONTEXT_USERMANAGED, dwFilter, dwIndex, idx,
MSIINSTALLCONTEXT_USERMANAGED, dwFilter, szPatchCode, szTargetProductCode, pdwTargetProductContext, szTargetUserSid,
dwIndex, idx, szPatchCode,
szTargetProductCode,
pdwTargetProductContext, szTargetUserSid,
pcchTargetUserSid, szTransforms); pcchTargetUserSid, szTransforms);
if (r != ERROR_NO_MORE_ITEMS) if (r != ERROR_NO_MORE_ITEMS)
goto done; goto done;
...@@ -1930,11 +1922,8 @@ static UINT msi_enum_patches(LPCWSTR szProductCode, LPCWSTR szUserSid, ...@@ -1930,11 +1922,8 @@ static UINT msi_enum_patches(LPCWSTR szProductCode, LPCWSTR szUserSid,
if (dwContext & MSIINSTALLCONTEXT_USERUNMANAGED) if (dwContext & MSIINSTALLCONTEXT_USERUNMANAGED)
{ {
r = msi_check_product_patches(szProductCode, szUserSid, r = check_product_patches(szProductCode, szUserSid, MSIINSTALLCONTEXT_USERUNMANAGED, dwFilter, dwIndex, idx,
MSIINSTALLCONTEXT_USERUNMANAGED, dwFilter, szPatchCode, szTargetProductCode, pdwTargetProductContext, szTargetUserSid,
dwIndex, idx, szPatchCode,
szTargetProductCode,
pdwTargetProductContext, szTargetUserSid,
pcchTargetUserSid, szTransforms); pcchTargetUserSid, szTransforms);
if (r != ERROR_NO_MORE_ITEMS) if (r != ERROR_NO_MORE_ITEMS)
goto done; goto done;
...@@ -1942,11 +1931,8 @@ static UINT msi_enum_patches(LPCWSTR szProductCode, LPCWSTR szUserSid, ...@@ -1942,11 +1931,8 @@ static UINT msi_enum_patches(LPCWSTR szProductCode, LPCWSTR szUserSid,
if (dwContext & MSIINSTALLCONTEXT_MACHINE) if (dwContext & MSIINSTALLCONTEXT_MACHINE)
{ {
r = msi_check_product_patches(szProductCode, szUserSid, r = check_product_patches(szProductCode, szUserSid, MSIINSTALLCONTEXT_MACHINE, dwFilter, dwIndex, idx,
MSIINSTALLCONTEXT_MACHINE, dwFilter, szPatchCode, szTargetProductCode, pdwTargetProductContext, szTargetUserSid,
dwIndex, idx, szPatchCode,
szTargetProductCode,
pdwTargetProductContext, szTargetUserSid,
pcchTargetUserSid, szTransforms); pcchTargetUserSid, szTransforms);
if (r != ERROR_NO_MORE_ITEMS) if (r != ERROR_NO_MORE_ITEMS)
goto done; goto done;
...@@ -1997,10 +1983,8 @@ UINT WINAPI MsiEnumPatchesExW( const WCHAR *szProductCode, const WCHAR *szUserSi ...@@ -1997,10 +1983,8 @@ UINT WINAPI MsiEnumPatchesExW( const WCHAR *szProductCode, const WCHAR *szUserSi
if (dwIndex == 0) if (dwIndex == 0)
last_index = 0; last_index = 0;
r = msi_enum_patches(szProductCode, szUserSid, dwContext, dwFilter, r = enum_patches(szProductCode, szUserSid, dwContext, dwFilter, dwIndex, &idx, szPatchCode, szTargetProductCode,
dwIndex, &idx, szPatchCode, szTargetProductCode, pdwTargetProductContext, szTargetUserSid, pcchTargetUserSid, NULL);
pdwTargetProductContext, szTargetUserSid,
pcchTargetUserSid, NULL);
if (r == ERROR_SUCCESS) if (r == ERROR_SUCCESS)
last_index = dwIndex; last_index = dwIndex;
...@@ -2094,9 +2078,8 @@ UINT WINAPI MsiEnumPatchesW( const WCHAR *szProduct, DWORD iPatchIndex, WCHAR *l ...@@ -2094,9 +2078,8 @@ UINT WINAPI MsiEnumPatchesW( const WCHAR *szProduct, DWORD iPatchIndex, WCHAR *l
RegCloseKey(prod); RegCloseKey(prod);
r = msi_enum_patches(szProduct, NULL, MSIINSTALLCONTEXT_ALL, r = enum_patches(szProduct, NULL, MSIINSTALLCONTEXT_ALL, MSIPATCHSTATE_ALL, iPatchIndex, &idx, lpPatchBuf, NULL,
MSIPATCHSTATE_ALL, iPatchIndex, &idx, lpPatchBuf, NULL, NULL, NULL, &transforms);
NULL, NULL, NULL, NULL, &transforms);
if (r != ERROR_SUCCESS) if (r != ERROR_SUCCESS)
goto done; goto done;
......
...@@ -875,8 +875,8 @@ static UINT set_prop( MSISUMMARYINFO *si, UINT uiProperty, UINT type, ...@@ -875,8 +875,8 @@ static UINT set_prop( MSISUMMARYINFO *si, UINT uiProperty, UINT type,
return ERROR_SUCCESS; return ERROR_SUCCESS;
} }
static UINT msi_set_prop( MSISUMMARYINFO *si, UINT uiProperty, UINT uiDataType, static UINT suminfo_set_prop( MSISUMMARYINFO *si, UINT uiProperty, UINT uiDataType, INT iValue, FILETIME *pftValue,
INT iValue, FILETIME *pftValue, awcstring *str ) awcstring *str )
{ {
UINT type = get_type( uiProperty ); UINT type = get_type( uiProperty );
if( type == VT_EMPTY || type != uiDataType ) if( type == VT_EMPTY || type != uiDataType )
...@@ -916,7 +916,7 @@ UINT WINAPI MsiSummaryInfoSetPropertyW( MSIHANDLE handle, UINT uiProperty, UINT ...@@ -916,7 +916,7 @@ UINT WINAPI MsiSummaryInfoSetPropertyW( MSIHANDLE handle, UINT uiProperty, UINT
str.unicode = TRUE; str.unicode = TRUE;
str.str.w = szValue; 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 ); msiobj_release( &si->hdr );
return ret; return ret;
} }
...@@ -946,7 +946,7 @@ UINT WINAPI MsiSummaryInfoSetPropertyA( MSIHANDLE handle, UINT uiProperty, UINT ...@@ -946,7 +946,7 @@ UINT WINAPI MsiSummaryInfoSetPropertyA( MSIHANDLE handle, UINT uiProperty, UINT
str.unicode = FALSE; str.unicode = FALSE;
str.str.a = szValue; 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 ); msiobj_release( &si->hdr );
return ret; return ret;
} }
......
...@@ -371,7 +371,7 @@ static void free_table( MSITABLE *table ) ...@@ -371,7 +371,7 @@ static void free_table( MSITABLE *table )
free( table ); 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 MSICOLUMNINFO *cols, UINT count, UINT bytes_per_strref )
{ {
const MSICOLUMNINFO *last_col; const MSICOLUMNINFO *last_col;
...@@ -396,8 +396,8 @@ static UINT read_table_from_storage( MSIDATABASE *db, MSITABLE *t, IStorage *stg ...@@ -396,8 +396,8 @@ static UINT read_table_from_storage( MSIDATABASE *db, MSITABLE *t, IStorage *stg
TRACE("%s\n",debugstr_w(t->name)); 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 = 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_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 */ /* if we can't read the table, just assume that it's empty */
read_stream_data( stg, t->name, TRUE, &rawdata, &rawsize ); read_stream_data( stg, t->name, TRUE, &rawdata, &rawsize );
...@@ -867,7 +867,7 @@ static UINT save_table( MSIDATABASE *db, const MSITABLE *t, UINT bytes_per_strre ...@@ -867,7 +867,7 @@ static UINT save_table( MSIDATABASE *db, const MSITABLE *t, UINT bytes_per_strre
TRACE("Saving %s\n", debugstr_w( t->name ) ); 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; row_count = t->row_count;
for (i = 0; i < t->row_count; i++) for (i = 0; i < t->row_count; i++)
{ {
...@@ -930,7 +930,7 @@ err: ...@@ -930,7 +930,7 @@ err:
return r; return r;
} }
static void msi_update_table_columns( MSIDATABASE *db, LPCWSTR name ) static void update_table_columns( MSIDATABASE *db, const WCHAR *name )
{ {
MSITABLE *table; MSITABLE *table;
UINT size, offset, old_count; UINT size, offset, old_count;
...@@ -945,7 +945,7 @@ static void msi_update_table_columns( MSIDATABASE *db, LPCWSTR name ) ...@@ -945,7 +945,7 @@ static void msi_update_table_columns( MSIDATABASE *db, LPCWSTR name )
table_get_column_info( db, name, &table->colinfo, &table->col_count ); table_get_column_info( db, name, &table->colinfo, &table->col_count );
if (!table->col_count) return; 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; offset = table->colinfo[table->col_count - 1].offset;
for ( n = 0; n < table->row_count; n++ ) for ( n = 0; n < table->row_count; n++ )
...@@ -1599,7 +1599,7 @@ static UINT TABLE_get_column_info( struct tagMSIVIEW *view, ...@@ -1599,7 +1599,7 @@ static UINT TABLE_get_column_info( struct tagMSIVIEW *view,
return ERROR_SUCCESS; return ERROR_SUCCESS;
} }
static UINT msi_table_find_row( MSITABLEVIEW *tv, MSIRECORD *rec, UINT *row, UINT *column ); static UINT table_find_row( MSITABLEVIEW *, MSIRECORD *, UINT *, UINT * );
static UINT table_validate_new( MSITABLEVIEW *tv, MSIRECORD *rec, UINT *column ) static UINT table_validate_new( MSITABLEVIEW *tv, MSIRECORD *rec, UINT *column )
{ {
...@@ -1638,7 +1638,7 @@ static UINT table_validate_new( MSITABLEVIEW *tv, MSIRECORD *rec, UINT *column ) ...@@ -1638,7 +1638,7 @@ static UINT table_validate_new( MSITABLEVIEW *tv, MSIRECORD *rec, UINT *column )
} }
/* check there are no duplicate keys */ /* 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) if (r == ERROR_SUCCESS)
return ERROR_FUNCTION_FAILED; return ERROR_FUNCTION_FAILED;
...@@ -1774,7 +1774,7 @@ static UINT TABLE_delete_row( struct tagMSIVIEW *view, UINT row ) ...@@ -1774,7 +1774,7 @@ static UINT TABLE_delete_row( struct tagMSIVIEW *view, UINT row )
return ERROR_SUCCESS; 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; MSITABLEVIEW *tv = (MSITABLEVIEW *)view;
UINT r, new_row; UINT r, new_row;
...@@ -1786,7 +1786,7 @@ static UINT msi_table_update(struct tagMSIVIEW *view, MSIRECORD *rec, UINT row) ...@@ -1786,7 +1786,7 @@ static UINT msi_table_update(struct tagMSIVIEW *view, MSIRECORD *rec, UINT row)
if (!tv->table) if (!tv->table)
return ERROR_INVALID_PARAMETER; 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) if (r != ERROR_SUCCESS)
{ {
ERR("can't find row to modify\n"); ERR("can't find row to modify\n");
...@@ -1800,7 +1800,7 @@ static UINT msi_table_update(struct tagMSIVIEW *view, MSIRECORD *rec, UINT row) ...@@ -1800,7 +1800,7 @@ 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); 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; MSITABLEVIEW *tv = (MSITABLEVIEW *)view;
UINT r, row; UINT r, row;
...@@ -1808,14 +1808,14 @@ static UINT msi_table_assign(struct tagMSIVIEW *view, MSIRECORD *rec) ...@@ -1808,14 +1808,14 @@ static UINT msi_table_assign(struct tagMSIVIEW *view, MSIRECORD *rec)
if (!tv->table) if (!tv->table)
return ERROR_INVALID_PARAMETER; 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) if (r == ERROR_SUCCESS)
return TABLE_set_row(view, row, rec, (1 << tv->num_cols) - 1); return TABLE_set_row(view, row, rec, (1 << tv->num_cols) - 1);
else else
return TABLE_insert_row( view, rec, -1, FALSE ); 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; MSIRECORD *curr;
UINT r, i, count; UINT r, i, count;
...@@ -1873,20 +1873,20 @@ static UINT TABLE_modify( struct tagMSIVIEW *view, MSIMODIFY eModifyMode, ...@@ -1873,20 +1873,20 @@ static UINT TABLE_modify( struct tagMSIVIEW *view, MSIMODIFY eModifyMode,
break; break;
case MSIMODIFY_REFRESH: case MSIMODIFY_REFRESH:
r = msi_refresh_record( view, rec, row ); r = refresh_record( view, rec, row );
break; break;
case MSIMODIFY_UPDATE: case MSIMODIFY_UPDATE:
r = msi_table_update( view, rec, row ); r = table_update( view, rec, row );
break; break;
case MSIMODIFY_ASSIGN: case MSIMODIFY_ASSIGN:
r = msi_table_assign( view, rec ); r = table_assign( view, rec );
break; break;
case MSIMODIFY_MERGE: case MSIMODIFY_MERGE:
/* check row that matches this record */ /* 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) if (r != ERROR_SUCCESS)
{ {
r = table_validate_new( tv, rec, NULL ); r = table_validate_new( tv, rec, NULL );
...@@ -1967,7 +1967,7 @@ static UINT TABLE_remove_column(struct tagMSIVIEW *view, UINT number) ...@@ -1967,7 +1967,7 @@ static UINT TABLE_remove_column(struct tagMSIVIEW *view, UINT number)
return r; return r;
} }
r = msi_table_find_row((MSITABLEVIEW *)columns, rec, &row, NULL); r = table_find_row((MSITABLEVIEW *)columns, rec, &row, NULL);
if (r != ERROR_SUCCESS) if (r != ERROR_SUCCESS)
goto done; goto done;
...@@ -1975,7 +1975,7 @@ static UINT TABLE_remove_column(struct tagMSIVIEW *view, UINT number) ...@@ -1975,7 +1975,7 @@ static UINT TABLE_remove_column(struct tagMSIVIEW *view, UINT number)
if (r != ERROR_SUCCESS) if (r != ERROR_SUCCESS)
goto done; goto done;
msi_update_table_columns(tv->db, tv->name); update_table_columns(tv->db, tv->name);
done: done:
msiobj_release(&rec->hdr); msiobj_release(&rec->hdr);
...@@ -2061,7 +2061,7 @@ static UINT TABLE_add_column(struct tagMSIVIEW *view, LPCWSTR column, ...@@ -2061,7 +2061,7 @@ static UINT TABLE_add_column(struct tagMSIVIEW *view, LPCWSTR column,
table_calc_column_offsets( tv->db, tv->table->colinfo, tv->table->col_count); 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; offset = tv->table->colinfo[tv->table->col_count - 1].offset;
for (i = 0; i < tv->table->row_count; i++) for (i = 0; i < tv->table->row_count; i++)
{ {
...@@ -2145,7 +2145,7 @@ static UINT TABLE_drop(struct tagMSIVIEW *view) ...@@ -2145,7 +2145,7 @@ static UINT TABLE_drop(struct tagMSIVIEW *view)
return r; return r;
} }
r = msi_table_find_row((MSITABLEVIEW *)tables, rec, &row, NULL); r = table_find_row((MSITABLEVIEW *)tables, rec, &row, NULL);
if (r != ERROR_SUCCESS) if (r != ERROR_SUCCESS)
goto done; goto done;
...@@ -2218,7 +2218,7 @@ UINT TABLE_CreateView( MSIDATABASE *db, LPCWSTR name, MSIVIEW **view ) ...@@ -2218,7 +2218,7 @@ UINT TABLE_CreateView( MSIDATABASE *db, LPCWSTR name, MSIVIEW **view )
tv->db = db; tv->db = db;
tv->columns = tv->table->colinfo; tv->columns = tv->table->colinfo;
tv->num_cols = tv->table->col_count; 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 ); TRACE("%s one row is %d bytes\n", debugstr_w(name), tv->row_size );
...@@ -2260,7 +2260,7 @@ static WCHAR* create_key_string(MSITABLEVIEW *tv, MSIRECORD *rec) ...@@ -2260,7 +2260,7 @@ static WCHAR* create_key_string(MSITABLEVIEW *tv, MSIRECORD *rec)
return key; return key;
} }
static UINT msi_record_stream_name( const MSITABLEVIEW *tv, MSIRECORD *rec, LPWSTR name, DWORD *len ) static UINT record_stream_name( const MSITABLEVIEW *tv, MSIRECORD *rec, WCHAR *name, DWORD *len )
{ {
UINT p = 0, i, r; UINT p = 0, i, r;
DWORD l; DWORD l;
...@@ -2362,7 +2362,7 @@ static UINT TransformView_set_row( MSIVIEW *view, UINT row, MSIRECORD *rec, UINT ...@@ -2362,7 +2362,7 @@ static UINT TransformView_set_row( MSIVIEW *view, UINT row, MSIRECORD *rec, UINT
qlen += wcslen( tv->columns[i].colname ) + 3; qlen += wcslen( tv->columns[i].colname ) + 3;
qlen += wcslen( key ) + 3; qlen += wcslen( key ) + 3;
if (MSITYPE_IS_BINARY( tv->columns[i].type )) 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 else
r = MSI_RecordGetStringW( rec, i + 1, NULL, &len ); r = MSI_RecordGetStringW( rec, i + 1, NULL, &len );
if (r != ERROR_SUCCESS) if (r != ERROR_SUCCESS)
...@@ -2418,7 +2418,7 @@ static UINT TransformView_set_row( MSIVIEW *view, UINT row, MSIRECORD *rec, UINT ...@@ -2418,7 +2418,7 @@ static UINT TransformView_set_row( MSIVIEW *view, UINT row, MSIRECORD *rec, UINT
query[p++] = '\''; query[p++] = '\'';
len = qlen - p; len = qlen - p;
if (MSITYPE_IS_BINARY( tv->columns[i].type )) 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 else
MSI_RecordGetStringW( rec, i + 1, query + p, &len ); MSI_RecordGetStringW( rec, i + 1, query + p, &len );
p += len; p += len;
...@@ -2946,7 +2946,7 @@ static UINT read_raw_int(const BYTE *data, UINT col, UINT bytes) ...@@ -2946,7 +2946,7 @@ static UINT read_raw_int(const BYTE *data, UINT col, UINT bytes)
return ret; return ret;
} }
static UINT msi_record_encoded_stream_name( const MSITABLEVIEW *tv, MSIRECORD *rec, LPWSTR *pstname ) static UINT record_encoded_stream_name( const MSITABLEVIEW *tv, MSIRECORD *rec, WCHAR **pstname )
{ {
UINT r; UINT r;
DWORD len; DWORD len;
...@@ -2954,7 +2954,7 @@ static UINT msi_record_encoded_stream_name( const MSITABLEVIEW *tv, MSIRECORD *r ...@@ -2954,7 +2954,7 @@ static UINT msi_record_encoded_stream_name( const MSITABLEVIEW *tv, MSIRECORD *r
TRACE("%p %p\n", tv, rec); 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) if (r != ERROR_SUCCESS)
return r; return r;
len++; len++;
...@@ -2963,7 +2963,7 @@ static UINT msi_record_encoded_stream_name( const MSITABLEVIEW *tv, MSIRECORD *r ...@@ -2963,7 +2963,7 @@ static UINT msi_record_encoded_stream_name( const MSITABLEVIEW *tv, MSIRECORD *r
if (!name) if (!name)
return ERROR_OUTOFMEMORY; return ERROR_OUTOFMEMORY;
r = msi_record_stream_name( tv, rec, name, &len ); r = record_stream_name( tv, rec, name, &len );
if (r != ERROR_SUCCESS) if (r != ERROR_SUCCESS)
{ {
free( name ); free( name );
...@@ -2975,8 +2975,8 @@ static UINT msi_record_encoded_stream_name( const MSITABLEVIEW *tv, MSIRECORD *r ...@@ -2975,8 +2975,8 @@ static UINT msi_record_encoded_stream_name( const MSITABLEVIEW *tv, MSIRECORD *r
return ERROR_SUCCESS; return ERROR_SUCCESS;
} }
static MSIRECORD *msi_get_transform_record( const MSITABLEVIEW *tv, const string_table *st, static MSIRECORD *get_transform_record( const MSITABLEVIEW *tv, const string_table *st, IStorage *stg,
IStorage *stg, const BYTE *rawdata, UINT bytes_per_strref ) const BYTE *rawdata, UINT bytes_per_strref )
{ {
UINT i, val, ofs = 0; UINT i, val, ofs = 0;
USHORT mask; USHORT mask;
...@@ -3007,7 +3007,7 @@ static MSIRECORD *msi_get_transform_record( const MSITABLEVIEW *tv, const string ...@@ -3007,7 +3007,7 @@ static MSIRECORD *msi_get_transform_record( const MSITABLEVIEW *tv, const string
ofs += bytes_per_column( tv->db, &columns[i], bytes_per_strref ); 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 ) if ( r != ERROR_SUCCESS )
{ {
msiobj_release( &rec->hdr ); msiobj_release( &rec->hdr );
...@@ -3074,7 +3074,7 @@ static void dump_table( const string_table *st, const USHORT *rawdata, UINT raws ...@@ -3074,7 +3074,7 @@ 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 MSITABLEVIEW *tv, MSIRECORD *rec )
{ {
UINT i, r, *data; UINT i, r, *data;
...@@ -3118,7 +3118,7 @@ static UINT* msi_record_to_row( const MSITABLEVIEW *tv, MSIRECORD *rec ) ...@@ -3118,7 +3118,7 @@ static UINT* msi_record_to_row( const MSITABLEVIEW *tv, MSIRECORD *rec )
return data; return data;
} }
static UINT msi_row_matches( MSITABLEVIEW *tv, UINT row, const UINT *data, UINT *column ) static UINT row_matches( MSITABLEVIEW *tv, UINT row, const UINT *data, UINT *column )
{ {
UINT i, r, x, ret = ERROR_FUNCTION_FAILED; UINT i, r, x, ret = ERROR_FUNCTION_FAILED;
...@@ -3147,16 +3147,16 @@ static UINT msi_row_matches( MSITABLEVIEW *tv, UINT row, const UINT *data, UINT ...@@ -3147,16 +3147,16 @@ static UINT msi_row_matches( MSITABLEVIEW *tv, UINT row, const UINT *data, UINT
return ret; return ret;
} }
static UINT msi_table_find_row( MSITABLEVIEW *tv, MSIRECORD *rec, UINT *row, UINT *column ) static UINT table_find_row( MSITABLEVIEW *tv, MSIRECORD *rec, UINT *row, UINT *column )
{ {
UINT i, r = ERROR_FUNCTION_FAILED, *data; UINT i, r = ERROR_FUNCTION_FAILED, *data;
data = msi_record_to_row( tv, rec ); data = record_to_row( tv, rec );
if( !data ) if( !data )
return r; return r;
for( i = 0; i < tv->table->row_count; i++ ) 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 ) if( r == ERROR_SUCCESS )
{ {
*row = i; *row = i;
...@@ -3173,8 +3173,7 @@ typedef struct ...@@ -3173,8 +3173,7 @@ typedef struct
LPWSTR name; LPWSTR name;
} TRANSFORMDATA; } TRANSFORMDATA;
static UINT msi_table_load_transform( MSIDATABASE *db, IStorage *stg, static UINT table_load_transform( MSIDATABASE *db, IStorage *stg, string_table *st, TRANSFORMDATA *transform,
string_table *st, TRANSFORMDATA *transform,
UINT bytes_per_strref, int err_cond ) UINT bytes_per_strref, int err_cond )
{ {
BYTE *rawdata = NULL; BYTE *rawdata = NULL;
...@@ -3275,7 +3274,7 @@ static UINT msi_table_load_transform( MSIDATABASE *db, IStorage *stg, ...@@ -3275,7 +3274,7 @@ static UINT msi_table_load_transform( MSIDATABASE *db, IStorage *stg,
break; 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) if (rec)
{ {
WCHAR table[32]; WCHAR table[32];
...@@ -3309,7 +3308,7 @@ static UINT msi_table_load_transform( MSIDATABASE *db, IStorage *stg, ...@@ -3309,7 +3308,7 @@ static UINT msi_table_load_transform( MSIDATABASE *db, IStorage *stg,
if (TRACE_ON(msidb)) dump_record( rec ); if (TRACE_ON(msidb)) dump_record( rec );
if (tv->table) if (tv->table)
r = msi_table_find_row( tv, rec, &row, NULL ); r = table_find_row( tv, rec, &row, NULL );
else else
r = ERROR_FUNCTION_FAILED; r = ERROR_FUNCTION_FAILED;
if (r == ERROR_SUCCESS) if (r == ERROR_SUCCESS)
...@@ -3344,9 +3343,8 @@ static UINT msi_table_load_transform( MSIDATABASE *db, IStorage *stg, ...@@ -3344,9 +3343,8 @@ static UINT msi_table_load_transform( MSIDATABASE *db, IStorage *stg,
WARN("failed to insert row %u\n", r); WARN("failed to insert row %u\n", r);
} }
if (!(err_cond & MSITRANSFORM_ERROR_VIEWTRANSFORM) && if (!(err_cond & MSITRANSFORM_ERROR_VIEWTRANSFORM) && !wcscmp( name, L"_Columns" ))
!wcscmp( name, L"_Columns" )) update_table_columns( db, table );
msi_update_table_columns( db, table );
msiobj_release( &rec->hdr ); msiobj_release( &rec->hdr );
} }
...@@ -3480,11 +3478,11 @@ UINT msi_table_apply_transform( MSIDATABASE *db, IStorage *stg, int err_cond ) ...@@ -3480,11 +3478,11 @@ UINT msi_table_apply_transform( MSIDATABASE *db, IStorage *stg, int err_cond )
* Apply _Tables and _Columns transforms first so that * Apply _Tables and _Columns transforms first so that
* the table metadata is correct, and empty tables exist. * 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) if (ret != ERROR_SUCCESS && ret != ERROR_INVALID_TABLE)
goto end; 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) if (ret != ERROR_SUCCESS && ret != ERROR_INVALID_TABLE)
goto end; goto end;
...@@ -3498,7 +3496,7 @@ UINT msi_table_apply_transform( MSIDATABASE *db, IStorage *stg, int err_cond ) ...@@ -3498,7 +3496,7 @@ UINT msi_table_apply_transform( MSIDATABASE *db, IStorage *stg, int err_cond )
wcscmp( transform->name, L"_Tables" ) && wcscmp( transform->name, L"_Tables" ) &&
ret == ERROR_SUCCESS ) 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 ); list_remove( &transform->entry );
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment