mirror of
https://github.com/reactos/reactos.git
synced 2025-05-08 11:24:14 +00:00
[MSI]
* Sync with Wine 1.7.1. CORE-7469 svn path=/trunk/; revision=60307
This commit is contained in:
parent
b44def699b
commit
d221b534b9
21 changed files with 1735 additions and 1597 deletions
|
@ -24,7 +24,6 @@ list(APPEND SOURCE
|
|||
dialog.c
|
||||
distinct.c
|
||||
drop.c
|
||||
events.c
|
||||
files.c
|
||||
font.c
|
||||
format.c
|
||||
|
@ -62,12 +61,9 @@ if(MSVC)
|
|||
endif()
|
||||
|
||||
add_library(msi SHARED ${SOURCE})
|
||||
|
||||
add_idl_headers(msi_idlheader msiserver.idl)
|
||||
add_typelib(msiserver.idl)
|
||||
|
||||
set_source_files_properties(msi.rc PROPERTIES OBJECT_DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/msiserver.tlb)
|
||||
|
||||
set_module_type(msi win32dll)
|
||||
target_link_libraries(msi uuid ${PSEH_LIB} wine)
|
||||
add_dependencies(msi msi_idlheader)
|
||||
|
|
|
@ -336,6 +336,8 @@ UINT msi_parse_command_line( MSIPACKAGE *package, LPCWSTR szCommandLine,
|
|||
len = ptr2 - ptr;
|
||||
if (!len) return ERROR_INVALID_COMMAND_LINE;
|
||||
|
||||
while (ptr[len - 1] == ' ') len--;
|
||||
|
||||
prop = msi_alloc( (len + 1) * sizeof(WCHAR) );
|
||||
memcpy( prop, ptr, len * sizeof(WCHAR) );
|
||||
prop[len] = 0;
|
||||
|
@ -411,18 +413,16 @@ static BOOL ui_sequence_exists( MSIPACKAGE *package )
|
|||
static const WCHAR query [] = {
|
||||
'S','E','L','E','C','T',' ','*',' ','F','R','O','M',' ',
|
||||
'`','I','n','s','t','a','l','l','U','I','S','e','q','u','e','n','c','e','`',' ',
|
||||
'W','H','E','R','E',' ','`','S','e','q','u','e','n','c','e','`',' ','>',' ','0',' ',
|
||||
'O','R','D','E','R',' ','B','Y',' ','`','S','e','q','u','e','n','c','e','`',0};
|
||||
'W','H','E','R','E',' ','`','S','e','q','u','e','n','c','e','`',' ','>',' ','0',0};
|
||||
MSIQUERY *view;
|
||||
UINT rc;
|
||||
DWORD count = 0;
|
||||
|
||||
rc = MSI_DatabaseOpenViewW(package->db, query, &view);
|
||||
if (rc == ERROR_SUCCESS)
|
||||
if (!(MSI_DatabaseOpenViewW( package->db, query, &view )))
|
||||
{
|
||||
msiobj_release(&view->hdr);
|
||||
return TRUE;
|
||||
MSI_IterateRecords( view, &count, NULL, package );
|
||||
msiobj_release( &view->hdr );
|
||||
}
|
||||
return FALSE;
|
||||
return count != 0;
|
||||
}
|
||||
|
||||
UINT msi_set_sourcedir_props(MSIPACKAGE *package, BOOL replace)
|
||||
|
@ -639,14 +639,12 @@ static UINT ACTION_ProcessUISequence(MSIPACKAGE *package)
|
|||
/********************************************************
|
||||
* ACTION helper functions and functions that perform the actions
|
||||
*******************************************************/
|
||||
static BOOL ACTION_HandleCustomAction( MSIPACKAGE* package, LPCWSTR action,
|
||||
UINT* rc, UINT script, BOOL force )
|
||||
static BOOL ACTION_HandleCustomAction( MSIPACKAGE *package, LPCWSTR action, UINT *rc, UINT script )
|
||||
{
|
||||
BOOL ret=FALSE;
|
||||
UINT arc;
|
||||
|
||||
arc = ACTION_CustomAction(package, action, script, force);
|
||||
|
||||
arc = ACTION_CustomAction( package, action, script );
|
||||
if (arc != ERROR_CALL_NOT_IMPLEMENTED)
|
||||
{
|
||||
*rc = arc;
|
||||
|
@ -2309,9 +2307,12 @@ static WCHAR *get_install_location( MSIPACKAGE *package )
|
|||
WCHAR *path;
|
||||
|
||||
if (!package->ProductCode) return NULL;
|
||||
if (MSIREG_OpenInstallProps( package->ProductCode, package->Context, NULL, &hkey, FALSE ))
|
||||
return NULL;
|
||||
path = msi_reg_get_val_str( hkey, szInstallLocation );
|
||||
if (MSIREG_OpenInstallProps( package->ProductCode, package->Context, NULL, &hkey, FALSE )) return NULL;
|
||||
if ((path = msi_reg_get_val_str( hkey, szInstallLocation )) && !path[0])
|
||||
{
|
||||
msi_free( path );
|
||||
path = NULL;
|
||||
}
|
||||
RegCloseKey( hkey );
|
||||
return path;
|
||||
}
|
||||
|
@ -2366,14 +2367,21 @@ void msi_resolve_target_folder( MSIPACKAGE *package, const WCHAR *name, BOOL loa
|
|||
|
||||
static UINT ACTION_CostFinalize(MSIPACKAGE *package)
|
||||
{
|
||||
static const WCHAR query[] = {
|
||||
'S','E','L','E','C','T',' ','*',' ','F','R','O','M',' ',
|
||||
'`','C','o','n','d','i','t','i','o','n','`',0};
|
||||
static const WCHAR szOutOfDiskSpace[] = {
|
||||
'O','u','t','O','f','D','i','s','k','S','p','a','c','e',0};
|
||||
static const WCHAR query[] =
|
||||
{'S','E','L','E','C','T',' ','*',' ','F','R','O','M',' ',
|
||||
'`','C','o','n','d','i','t','i','o','n','`',0};
|
||||
static const WCHAR szOutOfDiskSpace[] =
|
||||
{'O','u','t','O','f','D','i','s','k','S','p','a','c','e',0};
|
||||
static const WCHAR szPrimaryFolder[] =
|
||||
{'P','R','I','M','A','R','Y','F','O','L','D','E','R',0};
|
||||
static const WCHAR szPrimaryVolumePath[] =
|
||||
{'P','r','i','m','a','r','y','V','o','l','u','m','e','P','a','t','h',0};
|
||||
static const WCHAR szPrimaryVolumeSpaceAvailable[] =
|
||||
{'P','r','i','m','a','r','y','V','o','l','u','m','e','S','p','a','c','e',
|
||||
'A','v','a','i','l','a','b','l','e',0};
|
||||
MSICOMPONENT *comp;
|
||||
MSIQUERY *view;
|
||||
LPWSTR level;
|
||||
WCHAR *level, *primary_key, *primary_folder;
|
||||
UINT rc;
|
||||
|
||||
TRACE("Building directory properties\n");
|
||||
|
@ -2416,10 +2424,35 @@ static UINT ACTION_CostFinalize(MSIPACKAGE *package)
|
|||
msi_set_property( package->db, szCostingComplete, szOne, -1 );
|
||||
/* set default run level if not set */
|
||||
level = msi_dup_property( package->db, szInstallLevel );
|
||||
if (!level)
|
||||
msi_set_property( package->db, szInstallLevel, szOne, -1 );
|
||||
if (!level) msi_set_property( package->db, szInstallLevel, szOne, -1 );
|
||||
msi_free(level);
|
||||
|
||||
if ((primary_key = msi_dup_property( package->db, szPrimaryFolder )))
|
||||
{
|
||||
if ((primary_folder = msi_dup_property( package->db, primary_key )))
|
||||
{
|
||||
if (((primary_folder[0] >= 'A' && primary_folder[0] <= 'Z') ||
|
||||
(primary_folder[0] >= 'a' && primary_folder[0] <= 'z')) && primary_folder[1] == ':')
|
||||
{
|
||||
ULARGE_INTEGER free;
|
||||
|
||||
primary_folder[2] = 0;
|
||||
if (GetDiskFreeSpaceExW( primary_folder, &free, NULL, NULL ))
|
||||
{
|
||||
static const WCHAR fmtW[] = {'%','l','u',0};
|
||||
WCHAR buf[21];
|
||||
|
||||
sprintfW( buf, fmtW, free.QuadPart / 512 );
|
||||
msi_set_property( package->db, szPrimaryVolumeSpaceAvailable, buf, -1 );
|
||||
}
|
||||
toupperW( primary_folder[0] );
|
||||
msi_set_property( package->db, szPrimaryVolumePath, primary_folder, 2 );
|
||||
}
|
||||
msi_free( primary_folder );
|
||||
}
|
||||
msi_free( primary_key );
|
||||
}
|
||||
|
||||
/* FIXME: check volume disk space */
|
||||
msi_set_property( package->db, szOutOfDiskSpace, szZero, -1 );
|
||||
|
||||
|
@ -7619,7 +7652,7 @@ UINT ACTION_PerformAction(MSIPACKAGE *package, const WCHAR *action, UINT script)
|
|||
handled = ACTION_HandleStandardAction(package, action, &rc);
|
||||
|
||||
if (!handled)
|
||||
handled = ACTION_HandleCustomAction(package, action, &rc, script, TRUE);
|
||||
handled = ACTION_HandleCustomAction(package, action, &rc, script);
|
||||
|
||||
if (!handled)
|
||||
{
|
||||
|
@ -7641,7 +7674,7 @@ UINT ACTION_PerformUIAction(MSIPACKAGE *package, const WCHAR *action, UINT scrip
|
|||
handled = ACTION_HandleStandardAction(package, action, &rc);
|
||||
|
||||
if (!handled)
|
||||
handled = ACTION_HandleCustomAction(package, action, &rc, script, FALSE);
|
||||
handled = ACTION_HandleCustomAction(package, action, &rc, script);
|
||||
|
||||
if( !handled && ACTION_DialogBox(package, action) == ERROR_SUCCESS )
|
||||
handled = TRUE;
|
||||
|
|
File diff suppressed because it is too large
Load diff
|
@ -42,11 +42,6 @@
|
|||
#include "wine/unicode.h"
|
||||
#include "wine/list.h"
|
||||
|
||||
#define YYLEX_PARAM info
|
||||
#define YYPARSE_PARAM info
|
||||
|
||||
static int cond_error(const char *str);
|
||||
|
||||
WINE_DEFAULT_DEBUG_CHANNEL(msi);
|
||||
|
||||
typedef struct tag_yyinput
|
||||
|
@ -66,6 +61,7 @@ struct cond_str {
|
|||
static LPWSTR COND_GetString( COND_input *info, const struct cond_str *str );
|
||||
static LPWSTR COND_GetLiteral( COND_input *info, const struct cond_str *str );
|
||||
static int cond_lex( void *COND_lval, COND_input *info);
|
||||
static int cond_error( COND_input *info, const char *str);
|
||||
|
||||
static void *cond_alloc( COND_input *cond, unsigned int sz );
|
||||
static void *cond_track_mem( COND_input *cond, void *ptr, unsigned int sz );
|
||||
|
@ -110,6 +106,8 @@ static BOOL num_from_prop( LPCWSTR p, INT *val )
|
|||
|
||||
%}
|
||||
|
||||
%lex-param { COND_input *info }
|
||||
%parse-param { COND_input *info }
|
||||
%pure-parser
|
||||
|
||||
%union
|
||||
|
@ -798,7 +796,7 @@ static void cond_free( void *ptr )
|
|||
}
|
||||
}
|
||||
|
||||
static int cond_error(const char *str)
|
||||
static int cond_error( COND_input *info, const char *str )
|
||||
{
|
||||
TRACE("%s\n", str );
|
||||
return 0;
|
||||
|
|
|
@ -881,6 +881,7 @@ static UINT HANDLE_CustomType50( MSIPACKAGE *package, const WCHAR *source, const
|
|||
TRACE("exe %s arg %s\n", debugstr_w(exe), debugstr_w(arg));
|
||||
|
||||
handle = execute_command( exe, arg, szCRoot );
|
||||
msi_free( exe );
|
||||
msi_free( arg );
|
||||
if (handle == INVALID_HANDLE_VALUE) return ERROR_SUCCESS;
|
||||
return wait_process_handle( package, type, handle, action );
|
||||
|
@ -1120,7 +1121,7 @@ static UINT HANDLE_CustomType53_54( MSIPACKAGE *package, const WCHAR *source, co
|
|||
return wait_thread_handle( info );
|
||||
}
|
||||
|
||||
static BOOL action_type_matches_script( MSIPACKAGE *package, UINT type, UINT script )
|
||||
static BOOL action_type_matches_script( UINT type, UINT script )
|
||||
{
|
||||
switch (script)
|
||||
{
|
||||
|
@ -1174,7 +1175,7 @@ static UINT defer_custom_action( MSIPACKAGE *package, const WCHAR *action, UINT
|
|||
return ERROR_SUCCESS;
|
||||
}
|
||||
|
||||
UINT ACTION_CustomAction(MSIPACKAGE *package, LPCWSTR action, UINT script, BOOL execute)
|
||||
UINT ACTION_CustomAction( MSIPACKAGE *package, LPCWSTR action, UINT script )
|
||||
{
|
||||
static const WCHAR query[] = {
|
||||
'S','E','L','E','C','T',' ','*',' ','F','R','O','M',' ',
|
||||
|
@ -1214,7 +1215,7 @@ UINT ACTION_CustomAction(MSIPACKAGE *package, LPCWSTR action, UINT script, BOOL
|
|||
if (type & msidbCustomActionTypeNoImpersonate)
|
||||
WARN("msidbCustomActionTypeNoImpersonate not handled\n");
|
||||
|
||||
if (!execute || !action_type_matches_script( package, type, script ))
|
||||
if (!action_type_matches_script( type, script ))
|
||||
{
|
||||
rc = defer_custom_action( package, action, type );
|
||||
goto end;
|
||||
|
|
|
@ -1380,7 +1380,10 @@ static UINT merge_verify_colnames(MSIQUERY *dbview, MSIQUERY *mergeview)
|
|||
|
||||
r = MSI_ViewGetColumnInfo(mergeview, MSICOLINFO_NAMES, &mergerec);
|
||||
if (r != ERROR_SUCCESS)
|
||||
{
|
||||
msiobj_release(&dbrec->hdr);
|
||||
return r;
|
||||
}
|
||||
|
||||
count = MSI_RecordGetFieldCount(dbrec);
|
||||
for (i = 1; i <= count; i++)
|
||||
|
@ -1405,7 +1408,10 @@ static UINT merge_verify_colnames(MSIQUERY *dbview, MSIQUERY *mergeview)
|
|||
|
||||
r = MSI_ViewGetColumnInfo(mergeview, MSICOLINFO_TYPES, &mergerec);
|
||||
if (r != ERROR_SUCCESS)
|
||||
{
|
||||
msiobj_release(&dbrec->hdr);
|
||||
return r;
|
||||
}
|
||||
|
||||
count = MSI_RecordGetFieldCount(dbrec);
|
||||
for (i = 1; i <= count; i++)
|
||||
|
|
|
@ -2,6 +2,7 @@
|
|||
* Implementation of the Microsoft Installer (msi.dll)
|
||||
*
|
||||
* Copyright 2005 Mike McCormack for CodeWeavers
|
||||
* Copyright 2005 Aric Stewart for CodeWeavers
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
|
@ -43,6 +44,7 @@
|
|||
#include <winreg.h>
|
||||
#include <shlwapi.h>
|
||||
#include <msiserver.h>
|
||||
#include <shellapi.h>
|
||||
|
||||
#include <wine/debug.h>
|
||||
#include <wine/unicode.h>
|
||||
|
@ -55,6 +57,7 @@ struct msi_control_tag;
|
|||
typedef struct msi_control_tag msi_control;
|
||||
typedef UINT (*msi_handler)( msi_dialog *, msi_control *, WPARAM );
|
||||
typedef void (*msi_update)( msi_dialog *, msi_control * );
|
||||
typedef UINT (*control_event_handler)( msi_dialog *, const WCHAR *, const WCHAR * );
|
||||
|
||||
struct msi_control_tag
|
||||
{
|
||||
|
@ -88,7 +91,7 @@ struct msi_dialog_tag
|
|||
{
|
||||
MSIPACKAGE *package;
|
||||
msi_dialog *parent;
|
||||
msi_dialog_event_handler event_handler;
|
||||
control_event_handler event_handler;
|
||||
BOOL finished;
|
||||
INT scale;
|
||||
DWORD attributes;
|
||||
|
@ -103,6 +106,15 @@ struct msi_dialog_tag
|
|||
WCHAR name[1];
|
||||
};
|
||||
|
||||
struct subscriber
|
||||
{
|
||||
struct list entry;
|
||||
msi_dialog *dialog;
|
||||
WCHAR *event;
|
||||
WCHAR *control;
|
||||
WCHAR *attribute;
|
||||
};
|
||||
|
||||
typedef UINT (*msi_dialog_control_func)( msi_dialog *dialog, MSIRECORD *rec );
|
||||
struct control_handler
|
||||
{
|
||||
|
@ -148,6 +160,7 @@ static const WCHAR szVolumeSelectCombo[] = { 'V','o','l','u','m','e','S','e','l'
|
|||
static const WCHAR szSelectionDescription[] = {'S','e','l','e','c','t','i','o','n','D','e','s','c','r','i','p','t','i','o','n',0};
|
||||
static const WCHAR szSelectionPath[] = {'S','e','l','e','c','t','i','o','n','P','a','t','h',0};
|
||||
static const WCHAR szProperty[] = {'P','r','o','p','e','r','t','y',0};
|
||||
static const WCHAR szHyperLink[] = {'H','y','p','e','r','L','i','n','k',0};
|
||||
|
||||
/* dialog sequencing */
|
||||
|
||||
|
@ -249,16 +262,6 @@ static LPWSTR msi_dialog_dup_property( msi_dialog *dialog, LPCWSTR property, BOO
|
|||
return prop;
|
||||
}
|
||||
|
||||
msi_dialog *msi_dialog_get_parent( msi_dialog *dialog )
|
||||
{
|
||||
return dialog->parent;
|
||||
}
|
||||
|
||||
LPWSTR msi_dialog_get_name( msi_dialog *dialog )
|
||||
{
|
||||
return dialog->name;
|
||||
}
|
||||
|
||||
/*
|
||||
* msi_dialog_get_style
|
||||
*
|
||||
|
@ -407,9 +410,9 @@ static void msi_destroy_control( msi_control *t )
|
|||
msi_free( t );
|
||||
}
|
||||
|
||||
static msi_control *msi_dialog_create_window( msi_dialog *dialog,
|
||||
MSIRECORD *rec, DWORD exstyle, LPCWSTR szCls, LPCWSTR name, LPCWSTR text,
|
||||
DWORD style, HWND parent )
|
||||
static msi_control *dialog_create_window( msi_dialog *dialog, MSIRECORD *rec, DWORD exstyle,
|
||||
const WCHAR *szCls, const WCHAR *name, const WCHAR *text,
|
||||
DWORD style, HWND parent )
|
||||
{
|
||||
DWORD x, y, width, height;
|
||||
LPWSTR font = NULL, title_font = NULL;
|
||||
|
@ -618,24 +621,29 @@ static MSIFEATURE *msi_seltree_get_selected_feature( msi_control *control )
|
|||
return msi_seltree_feature_from_item( control->hwnd, info->selected );
|
||||
}
|
||||
|
||||
/* called from the Control Event subscription code */
|
||||
void msi_dialog_handle_event( msi_dialog* dialog, LPCWSTR control,
|
||||
LPCWSTR attribute, MSIRECORD *rec )
|
||||
static void dialog_handle_event( msi_dialog *dialog, const WCHAR *control,
|
||||
const WCHAR *attribute, MSIRECORD *rec )
|
||||
{
|
||||
msi_control* ctrl;
|
||||
LPCWSTR font_text, text = NULL;
|
||||
LPWSTR font;
|
||||
|
||||
ctrl = msi_dialog_find_control( dialog, control );
|
||||
if (!ctrl)
|
||||
return;
|
||||
if( !strcmpW( attribute, szText ) )
|
||||
{
|
||||
const WCHAR *font_text, *text = NULL;
|
||||
WCHAR *font, *text_fmt = NULL;
|
||||
|
||||
font_text = MSI_RecordGetString( rec , 1 );
|
||||
font = msi_dialog_get_style( font_text, &text );
|
||||
if (!text) text = szEmpty;
|
||||
deformat_string( dialog->package, text, &text_fmt );
|
||||
if (text_fmt) text = text_fmt;
|
||||
else text = szEmpty;
|
||||
|
||||
SetWindowTextW( ctrl->hwnd, text );
|
||||
|
||||
msi_free( font );
|
||||
msi_free( text_fmt );
|
||||
msi_dialog_check_messages( NULL );
|
||||
}
|
||||
else if( !strcmpW( attribute, szProgress ) )
|
||||
|
@ -713,27 +721,65 @@ void msi_dialog_handle_event( msi_dialog* dialog, LPCWSTR control,
|
|||
}
|
||||
}
|
||||
|
||||
static void msi_dialog_map_events(msi_dialog* dialog, LPCWSTR control)
|
||||
static void event_subscribe( msi_dialog *dialog, const WCHAR *event, const WCHAR *control, const WCHAR *attribute )
|
||||
{
|
||||
static const WCHAR Query[] = {
|
||||
'S','E','L','E','C','T',' ','*',' ','F','R','O','M',' ',
|
||||
struct subscriber *sub;
|
||||
|
||||
TRACE("event %s control %s attribute %s\n", debugstr_w(event), debugstr_w(control), debugstr_w(attribute));
|
||||
|
||||
LIST_FOR_EACH_ENTRY( sub, &dialog->package->subscriptions, struct subscriber, entry )
|
||||
{
|
||||
if (!strcmpiW( sub->event, event ) &&
|
||||
!strcmpiW( sub->control, control ) &&
|
||||
!strcmpiW( sub->attribute, attribute ))
|
||||
{
|
||||
TRACE("already subscribed\n");
|
||||
return;
|
||||
};
|
||||
}
|
||||
if (!(sub = msi_alloc( sizeof(*sub) ))) return;
|
||||
sub->dialog = dialog;
|
||||
sub->event = strdupW( event );
|
||||
sub->control = strdupW( control );
|
||||
sub->attribute = strdupW( attribute );
|
||||
list_add_tail( &dialog->package->subscriptions, &sub->entry );
|
||||
}
|
||||
|
||||
struct dialog_control
|
||||
{
|
||||
msi_dialog *dialog;
|
||||
const WCHAR *control;
|
||||
};
|
||||
|
||||
static UINT map_event( MSIRECORD *row, void *param )
|
||||
{
|
||||
struct dialog_control *dc = param;
|
||||
const WCHAR *event = MSI_RecordGetString( row, 3 );
|
||||
const WCHAR *attribute = MSI_RecordGetString( row, 4 );
|
||||
|
||||
event_subscribe( dc->dialog, event, dc->control, attribute );
|
||||
return ERROR_SUCCESS;
|
||||
}
|
||||
|
||||
static void dialog_map_events( msi_dialog *dialog, const WCHAR *control )
|
||||
{
|
||||
static const WCHAR queryW[] =
|
||||
{'S','E','L','E','C','T',' ','*',' ','F','R','O','M',' ',
|
||||
'`','E','v','e','n','t','M','a','p','p','i','n','g','`',' ',
|
||||
'W','H','E','R','E',' ',
|
||||
'`','D','i','a','l','o','g','_','`',' ','=',' ','\'','%','s','\'',' ',
|
||||
'A','N','D',' ',
|
||||
'`','C','o','n','t','r','o','l','_','`',' ','=',' ','\'','%','s','\'',0
|
||||
'W','H','E','R','E',' ','`','D','i','a','l','o','g','_','`',' ','=',' ','\'','%','s','\'',' ',
|
||||
'A','N','D',' ','`','C','o','n','t','r','o','l','_','`',' ','=',' ','\'','%','s','\'',0};
|
||||
MSIQUERY *view;
|
||||
struct dialog_control dialog_control =
|
||||
{
|
||||
dialog,
|
||||
control
|
||||
};
|
||||
MSIRECORD *row;
|
||||
LPCWSTR event, attribute;
|
||||
|
||||
row = MSI_QueryGetRecord( dialog->package->db, Query, dialog->name, control );
|
||||
if (!row)
|
||||
return;
|
||||
|
||||
event = MSI_RecordGetString( row, 3 );
|
||||
attribute = MSI_RecordGetString( row, 4 );
|
||||
ControlEvent_SubscribeToEvent( dialog->package, dialog, event, control, attribute );
|
||||
msiobj_release( &row->hdr );
|
||||
if (!MSI_OpenQuery( dialog->package->db, &view, queryW, dialog->name, control ))
|
||||
{
|
||||
MSI_IterateRecords( view, NULL, map_event, &dialog_control );
|
||||
msiobj_release( &view->hdr );
|
||||
}
|
||||
}
|
||||
|
||||
/* everything except radio buttons */
|
||||
|
@ -758,10 +804,9 @@ static msi_control *msi_dialog_add_control( msi_dialog *dialog,
|
|||
if( attributes & msidbControlAttributesSunken )
|
||||
exstyle |= WS_EX_CLIENTEDGE;
|
||||
|
||||
msi_dialog_map_events(dialog, name);
|
||||
dialog_map_events( dialog, name );
|
||||
|
||||
return msi_dialog_create_window( dialog, rec, exstyle, szCls, name,
|
||||
text, style, dialog->hwnd );
|
||||
return dialog_create_window( dialog, rec, exstyle, szCls, name, text, style, dialog->hwnd );
|
||||
}
|
||||
|
||||
struct msi_text_info
|
||||
|
@ -856,9 +901,7 @@ static UINT msi_dialog_text_control( msi_dialog *dialog, MSIRECORD *rec )
|
|||
(LONG_PTR)MSIText_WndProc );
|
||||
SetPropW( control->hwnd, szButtonData, info );
|
||||
|
||||
ControlEvent_SubscribeToEvent( dialog->package, dialog,
|
||||
szSelectionPath, control_name, szSelectionPath );
|
||||
|
||||
event_subscribe( dialog, szSelectionPath, control_name, szSelectionPath );
|
||||
return ERROR_SUCCESS;
|
||||
}
|
||||
|
||||
|
@ -916,7 +959,7 @@ static UINT msi_dialog_send_event( msi_dialog *dialog, LPCWSTR event, LPCWSTR ar
|
|||
deformat_string( dialog->package, event, &event_fmt );
|
||||
deformat_string( dialog->package, arg, &arg_fmt );
|
||||
|
||||
dialog->event_handler( dialog->package, event_fmt, arg_fmt, dialog );
|
||||
dialog->event_handler( dialog, event_fmt, arg_fmt );
|
||||
|
||||
msi_free( event_fmt );
|
||||
msi_free( arg_fmt );
|
||||
|
@ -1137,7 +1180,7 @@ static UINT msi_dialog_line_control( msi_dialog *dialog, MSIRECORD *rec )
|
|||
if( attributes & msidbControlAttributesSunken )
|
||||
exstyle |= WS_EX_CLIENTEDGE;
|
||||
|
||||
msi_dialog_map_events(dialog, name);
|
||||
dialog_map_events( dialog, name );
|
||||
|
||||
control = msi_alloc( FIELD_OFFSET(msi_control, name[strlenW( name ) + 1] ));
|
||||
if (!control)
|
||||
|
@ -2072,8 +2115,7 @@ static UINT msi_dialog_progress_bar( msi_dialog *dialog, MSIRECORD *rec )
|
|||
if( !control )
|
||||
return ERROR_FUNCTION_FAILED;
|
||||
|
||||
ControlEvent_SubscribeToEvent( dialog->package, dialog,
|
||||
szSetProgress, control->name, szProgress );
|
||||
event_subscribe( dialog, szSetProgress, control->name, szProgress );
|
||||
return ERROR_SUCCESS;
|
||||
}
|
||||
|
||||
|
@ -2234,8 +2276,8 @@ static UINT msi_dialog_create_radiobutton( MSIRECORD *rec, LPVOID param )
|
|||
if( ~attributes & msidbControlAttributesEnabled )
|
||||
style |= WS_DISABLED;
|
||||
|
||||
control = msi_dialog_create_window( dialog, rec, 0, szButton, name, text,
|
||||
style, group->parent->hwnd );
|
||||
control = dialog_create_window( dialog, rec, 0, szButton, name, text, style,
|
||||
group->parent->hwnd );
|
||||
if (!control)
|
||||
return ERROR_FUNCTION_FAILED;
|
||||
control->handler = msi_dialog_radiogroup_handler;
|
||||
|
@ -2618,7 +2660,7 @@ static UINT msi_dialog_seltree_handler( msi_dialog *dialog,
|
|||
rec = MSI_CreateRecord( 1 );
|
||||
|
||||
MSI_RecordSetStringW( rec, 1, MSI_RecordGetString( row, 4 ) );
|
||||
ControlEvent_FireSubscribedEvent( dialog->package, szSelectionDescription, rec );
|
||||
msi_event_fire( dialog->package, szSelectionDescription, rec );
|
||||
|
||||
dir = MSI_RecordGetString( row, 7 );
|
||||
if (dir)
|
||||
|
@ -2634,7 +2676,7 @@ static UINT msi_dialog_seltree_handler( msi_dialog *dialog,
|
|||
else
|
||||
MSI_RecordSetStringW( rec, 1, NULL );
|
||||
|
||||
ControlEvent_FireSubscribedEvent( dialog->package, szSelectionPath, rec );
|
||||
msi_event_fire( dialog->package, szSelectionPath, rec );
|
||||
|
||||
done:
|
||||
msiobj_release(&row->hdr);
|
||||
|
@ -2678,8 +2720,7 @@ static UINT msi_dialog_selection_tree( msi_dialog *dialog, MSIRECORD *rec )
|
|||
(LONG_PTR)MSISelectionTree_WndProc );
|
||||
SetPropW( control->hwnd, szButtonData, info );
|
||||
|
||||
ControlEvent_SubscribeToEvent( dialog->package, dialog,
|
||||
szSelectionPath, control_name, szProperty );
|
||||
event_subscribe( dialog, szSelectionPath, control_name, szProperty );
|
||||
|
||||
/* initialize it */
|
||||
msi_seltree_create_imagelist( control->hwnd );
|
||||
|
@ -3310,6 +3351,80 @@ static UINT msi_dialog_volumeselect_combo( msi_dialog *dialog, MSIRECORD *rec )
|
|||
return ERROR_SUCCESS;
|
||||
}
|
||||
|
||||
static UINT msi_dialog_hyperlink_handler( msi_dialog *dialog, msi_control *control, WPARAM param )
|
||||
{
|
||||
static const WCHAR hrefW[] = {'h','r','e','f'};
|
||||
static const WCHAR openW[] = {'o','p','e','n',0};
|
||||
int len, len_href = sizeof(hrefW) / sizeof(hrefW[0]);
|
||||
const WCHAR *p, *q;
|
||||
WCHAR quote = 0;
|
||||
LITEM item;
|
||||
|
||||
item.mask = LIF_ITEMINDEX | LIF_URL;
|
||||
item.iLink = 0;
|
||||
item.szUrl[0] = 0;
|
||||
|
||||
SendMessageW( control->hwnd, LM_GETITEM, 0, (LPARAM)&item );
|
||||
|
||||
p = item.szUrl;
|
||||
while (*p && *p != '<') p++;
|
||||
if (!*p++) return ERROR_SUCCESS;
|
||||
if (toupperW( *p++ ) != 'A' || !isspaceW( *p++ )) return ERROR_SUCCESS;
|
||||
while (*p && isspaceW( *p )) p++;
|
||||
|
||||
len = strlenW( p );
|
||||
if (len > len_href && !memicmpW( p, hrefW, len_href ))
|
||||
{
|
||||
p += len_href;
|
||||
while (*p && isspaceW( *p )) p++;
|
||||
if (!*p || *p++ != '=') return ERROR_SUCCESS;
|
||||
while (*p && isspaceW( *p )) p++;
|
||||
|
||||
if (*p == '\"' || *p == '\'') quote = *p++;
|
||||
q = p;
|
||||
if (quote)
|
||||
{
|
||||
while (*q && *q != quote) q++;
|
||||
if (*q != quote) return ERROR_SUCCESS;
|
||||
}
|
||||
else
|
||||
{
|
||||
while (*q && *q != '>' && !isspaceW( *q )) q++;
|
||||
if (!*q) return ERROR_SUCCESS;
|
||||
}
|
||||
item.szUrl[q - item.szUrl] = 0;
|
||||
ShellExecuteW( NULL, openW, p, NULL, NULL, SW_SHOWNORMAL );
|
||||
}
|
||||
return ERROR_SUCCESS;
|
||||
}
|
||||
|
||||
static UINT msi_dialog_hyperlink( msi_dialog *dialog, MSIRECORD *rec )
|
||||
{
|
||||
msi_control *control;
|
||||
DWORD style = WS_CHILD | WS_TABSTOP | WS_GROUP;
|
||||
const WCHAR *text = MSI_RecordGetString( rec, 10 );
|
||||
int len = strlenW( text );
|
||||
LITEM item;
|
||||
|
||||
control = msi_dialog_add_control( dialog, rec, WC_LINK, style );
|
||||
if (!control)
|
||||
return ERROR_FUNCTION_FAILED;
|
||||
|
||||
control->attributes = MSI_RecordGetInteger( rec, 8 );
|
||||
control->handler = msi_dialog_hyperlink_handler;
|
||||
|
||||
item.mask = LIF_ITEMINDEX | LIF_STATE | LIF_URL;
|
||||
item.iLink = 0;
|
||||
item.state = LIS_ENABLED;
|
||||
item.stateMask = LIS_ENABLED;
|
||||
if (len < L_MAX_URL_LENGTH) strcpyW( item.szUrl, text );
|
||||
else item.szUrl[0] = 0;
|
||||
|
||||
SendMessageW( control->hwnd, LM_SETITEM, 0, (LPARAM)&item );
|
||||
|
||||
return ERROR_SUCCESS;
|
||||
}
|
||||
|
||||
static const struct control_handler msi_dialog_handler[] =
|
||||
{
|
||||
{ szText, msi_dialog_text_control },
|
||||
|
@ -3332,6 +3447,7 @@ static const struct control_handler msi_dialog_handler[] =
|
|||
{ szDirectoryList, msi_dialog_directory_list },
|
||||
{ szVolumeCostList, msi_dialog_volumecost_list },
|
||||
{ szVolumeSelectCombo, msi_dialog_volumeselect_combo },
|
||||
{ szHyperLink, msi_dialog_hyperlink }
|
||||
};
|
||||
|
||||
#define NUM_CONTROL_TYPES (sizeof msi_dialog_handler/sizeof msi_dialog_handler[0])
|
||||
|
@ -3556,6 +3672,7 @@ static LRESULT msi_dialog_oncreate( HWND hwnd, LPCREATESTRUCTW cs )
|
|||
if (!dialog->default_font)
|
||||
{
|
||||
dialog->default_font = strdupW(dfv);
|
||||
msiobj_release( &rec->hdr );
|
||||
if (!dialog->default_font) return -1;
|
||||
}
|
||||
|
||||
|
@ -3619,7 +3736,7 @@ static LRESULT msi_dialog_onnotify( msi_dialog *dialog, LPARAM param )
|
|||
return 0;
|
||||
}
|
||||
|
||||
static void msi_dialog_setfocus( msi_dialog *dialog )
|
||||
static void dialog_setfocus( msi_dialog *dialog )
|
||||
{
|
||||
HWND hwnd = dialog->hWndFocus;
|
||||
|
||||
|
@ -3653,11 +3770,11 @@ static LRESULT WINAPI MSIDialog_WndProc( HWND hwnd, UINT msg,
|
|||
if( LOWORD(wParam) == WA_INACTIVE )
|
||||
dialog->hWndFocus = GetFocus();
|
||||
else
|
||||
msi_dialog_setfocus( dialog );
|
||||
dialog_setfocus( dialog );
|
||||
return 0;
|
||||
|
||||
case WM_SETFOCUS:
|
||||
msi_dialog_setfocus( dialog );
|
||||
dialog_setfocus( dialog );
|
||||
return 0;
|
||||
|
||||
/* bounce back to our subclassed static control */
|
||||
|
@ -3673,6 +3790,57 @@ static LRESULT WINAPI MSIDialog_WndProc( HWND hwnd, UINT msg,
|
|||
return DefWindowProcW(hwnd, msg, wParam, lParam);
|
||||
}
|
||||
|
||||
static void process_pending_messages( HWND hdlg )
|
||||
{
|
||||
MSG msg;
|
||||
|
||||
while (PeekMessageW( &msg, 0, 0, 0, PM_REMOVE ))
|
||||
{
|
||||
if (hdlg && IsDialogMessageW( hdlg, &msg )) continue;
|
||||
TranslateMessage( &msg );
|
||||
DispatchMessageW( &msg );
|
||||
}
|
||||
}
|
||||
|
||||
static UINT dialog_run_message_loop( msi_dialog *dialog )
|
||||
{
|
||||
DWORD style;
|
||||
HWND hwnd;
|
||||
|
||||
if( uiThreadId != GetCurrentThreadId() )
|
||||
return SendMessageW( hMsiHiddenWindow, WM_MSI_DIALOG_CREATE, 0, (LPARAM) dialog );
|
||||
|
||||
/* create the dialog window, don't show it yet */
|
||||
style = WS_OVERLAPPED;
|
||||
if( dialog->attributes & msidbDialogAttributesVisible )
|
||||
style |= WS_VISIBLE;
|
||||
|
||||
hwnd = CreateWindowW( szMsiDialogClass, dialog->name, style,
|
||||
CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT,
|
||||
NULL, NULL, NULL, dialog );
|
||||
if( !hwnd )
|
||||
{
|
||||
ERR("Failed to create dialog %s\n", debugstr_w( dialog->name ));
|
||||
return ERROR_FUNCTION_FAILED;
|
||||
}
|
||||
|
||||
ShowWindow( hwnd, SW_SHOW );
|
||||
/* UpdateWindow( hwnd ); - and causes the transparent static controls not to paint */
|
||||
|
||||
if( dialog->attributes & msidbDialogAttributesModal )
|
||||
{
|
||||
while( !dialog->finished )
|
||||
{
|
||||
MsgWaitForMultipleObjects( 0, NULL, 0, INFINITE, QS_ALLINPUT );
|
||||
process_pending_messages( dialog->hwnd );
|
||||
}
|
||||
}
|
||||
else
|
||||
return ERROR_IO_PENDING;
|
||||
|
||||
return ERROR_SUCCESS;
|
||||
}
|
||||
|
||||
static LRESULT WINAPI MSIHiddenWindowProc( HWND hwnd, UINT msg,
|
||||
WPARAM wParam, LPARAM lParam )
|
||||
{
|
||||
|
@ -3683,7 +3851,7 @@ static LRESULT WINAPI MSIHiddenWindowProc( HWND hwnd, UINT msg,
|
|||
switch (msg)
|
||||
{
|
||||
case WM_MSI_DIALOG_CREATE:
|
||||
return msi_dialog_run_message_loop( dialog );
|
||||
return dialog_run_message_loop( dialog );
|
||||
case WM_MSI_DIALOG_DESTROY:
|
||||
msi_dialog_destroy( dialog );
|
||||
return 0;
|
||||
|
@ -3691,7 +3859,7 @@ static LRESULT WINAPI MSIHiddenWindowProc( HWND hwnd, UINT msg,
|
|||
return DefWindowProcW( hwnd, msg, wParam, lParam );
|
||||
}
|
||||
|
||||
static BOOL msi_dialog_register_class( void )
|
||||
static BOOL dialog_register_class( void )
|
||||
{
|
||||
WNDCLASSW cls;
|
||||
|
||||
|
@ -3723,25 +3891,21 @@ static BOOL msi_dialog_register_class( void )
|
|||
return TRUE;
|
||||
}
|
||||
|
||||
/* functions that interface to other modules within MSI */
|
||||
|
||||
msi_dialog *msi_dialog_create( MSIPACKAGE* package,
|
||||
LPCWSTR szDialogName, msi_dialog *parent,
|
||||
msi_dialog_event_handler event_handler )
|
||||
static msi_dialog *dialog_create( MSIPACKAGE *package, const WCHAR *name, msi_dialog *parent,
|
||||
control_event_handler event_handler )
|
||||
{
|
||||
MSIRECORD *rec = NULL;
|
||||
msi_dialog *dialog;
|
||||
|
||||
TRACE("%p %s\n", package, debugstr_w(szDialogName));
|
||||
TRACE("%s\n", debugstr_w(name));
|
||||
|
||||
if (!hMsiHiddenWindow)
|
||||
msi_dialog_register_class();
|
||||
if (!hMsiHiddenWindow) dialog_register_class();
|
||||
|
||||
/* allocate the structure for the dialog to use */
|
||||
dialog = msi_alloc_zero( FIELD_OFFSET( msi_dialog, name[strlenW( szDialogName ) + 1] ));
|
||||
dialog = msi_alloc_zero( FIELD_OFFSET( msi_dialog, name[strlenW( name ) + 1] ));
|
||||
if( !dialog )
|
||||
return NULL;
|
||||
strcpyW( dialog->name, szDialogName );
|
||||
strcpyW( dialog->name, name );
|
||||
dialog->parent = parent;
|
||||
msiobj_addref( &package->hdr );
|
||||
dialog->package = package;
|
||||
|
@ -3766,19 +3930,6 @@ msi_dialog *msi_dialog_create( MSIPACKAGE* package,
|
|||
return dialog;
|
||||
}
|
||||
|
||||
static void msi_process_pending_messages( HWND hdlg )
|
||||
{
|
||||
MSG msg;
|
||||
|
||||
while( PeekMessageW( &msg, 0, 0, 0, PM_REMOVE ) )
|
||||
{
|
||||
if( hdlg && IsDialogMessageW( hdlg, &msg ))
|
||||
continue;
|
||||
TranslateMessage( &msg );
|
||||
DispatchMessageW( &msg );
|
||||
}
|
||||
}
|
||||
|
||||
void msi_dialog_end_dialog( msi_dialog *dialog )
|
||||
{
|
||||
TRACE("%p\n", dialog);
|
||||
|
@ -3809,7 +3960,7 @@ void msi_dialog_check_messages( HANDLE handle )
|
|||
/* there's two choices for the UI thread */
|
||||
while (1)
|
||||
{
|
||||
msi_process_pending_messages( NULL );
|
||||
process_pending_messages( NULL );
|
||||
|
||||
if( !handle )
|
||||
break;
|
||||
|
@ -3824,51 +3975,34 @@ void msi_dialog_check_messages( HANDLE handle )
|
|||
}
|
||||
}
|
||||
|
||||
UINT msi_dialog_run_message_loop( msi_dialog *dialog )
|
||||
{
|
||||
DWORD style;
|
||||
HWND hwnd;
|
||||
|
||||
if( uiThreadId != GetCurrentThreadId() )
|
||||
return SendMessageW( hMsiHiddenWindow, WM_MSI_DIALOG_CREATE, 0, (LPARAM) dialog );
|
||||
|
||||
/* create the dialog window, don't show it yet */
|
||||
style = WS_OVERLAPPED;
|
||||
if( dialog->attributes & msidbDialogAttributesVisible )
|
||||
style |= WS_VISIBLE;
|
||||
|
||||
hwnd = CreateWindowW( szMsiDialogClass, dialog->name, style,
|
||||
CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT,
|
||||
NULL, NULL, NULL, dialog );
|
||||
if( !hwnd )
|
||||
{
|
||||
ERR("Failed to create dialog %s\n", debugstr_w( dialog->name ));
|
||||
return ERROR_FUNCTION_FAILED;
|
||||
}
|
||||
|
||||
ShowWindow( hwnd, SW_SHOW );
|
||||
/* UpdateWindow( hwnd ); - and causes the transparent static controls not to paint */
|
||||
|
||||
if( dialog->attributes & msidbDialogAttributesModal )
|
||||
{
|
||||
while( !dialog->finished )
|
||||
{
|
||||
MsgWaitForMultipleObjects( 0, NULL, 0, INFINITE, QS_ALLINPUT );
|
||||
msi_process_pending_messages( dialog->hwnd );
|
||||
}
|
||||
}
|
||||
else
|
||||
return ERROR_IO_PENDING;
|
||||
|
||||
return ERROR_SUCCESS;
|
||||
}
|
||||
|
||||
static void msi_dialog_do_preview( msi_dialog *dialog )
|
||||
static void dialog_do_preview( msi_dialog *dialog )
|
||||
{
|
||||
TRACE("\n");
|
||||
dialog->attributes |= msidbDialogAttributesVisible;
|
||||
dialog->attributes &= ~msidbDialogAttributesModal;
|
||||
msi_dialog_run_message_loop( dialog );
|
||||
dialog_run_message_loop( dialog );
|
||||
}
|
||||
|
||||
static void free_subscriber( struct subscriber *sub )
|
||||
{
|
||||
msi_free( sub->event );
|
||||
msi_free( sub->control );
|
||||
msi_free( sub->attribute );
|
||||
msi_free( sub );
|
||||
}
|
||||
|
||||
static void event_cleanup_subscriptions( MSIPACKAGE *package, const WCHAR *dialog )
|
||||
{
|
||||
struct list *item, *next;
|
||||
|
||||
LIST_FOR_EACH_SAFE( item, next, &package->subscriptions )
|
||||
{
|
||||
struct subscriber *sub = LIST_ENTRY( item, struct subscriber, entry );
|
||||
|
||||
if (strcmpW( sub->dialog->name, dialog )) continue;
|
||||
list_remove( &sub->entry );
|
||||
free_subscriber( sub );
|
||||
}
|
||||
}
|
||||
|
||||
void msi_dialog_destroy( msi_dialog *dialog )
|
||||
|
@ -3888,7 +4022,7 @@ void msi_dialog_destroy( msi_dialog *dialog )
|
|||
DestroyWindow( dialog->hwnd );
|
||||
|
||||
/* unsubscribe events */
|
||||
ControlEvent_CleanupDialogSubscriptions(dialog->package, dialog->name);
|
||||
event_cleanup_subscriptions( dialog->package, dialog->name );
|
||||
|
||||
/* destroy the list of controls */
|
||||
while( !list_empty( &dialog->controls ) )
|
||||
|
@ -3925,8 +4059,19 @@ void msi_dialog_unregister_class( void )
|
|||
uiThreadId = 0;
|
||||
}
|
||||
|
||||
static UINT error_dialog_handler(MSIPACKAGE *package, LPCWSTR event,
|
||||
LPCWSTR argument, msi_dialog* dialog)
|
||||
void msi_event_cleanup_all_subscriptions( MSIPACKAGE *package )
|
||||
{
|
||||
struct list *item, *next;
|
||||
|
||||
LIST_FOR_EACH_SAFE( item, next, &package->subscriptions )
|
||||
{
|
||||
struct subscriber *sub = LIST_ENTRY( item, struct subscriber, entry );
|
||||
list_remove( &sub->entry );
|
||||
free_subscriber( sub );
|
||||
}
|
||||
}
|
||||
|
||||
static UINT error_dialog_handler( msi_dialog *dialog, const WCHAR *event, const WCHAR *argument )
|
||||
{
|
||||
static const WCHAR end_dialog[] = {'E','n','d','D','i','a','l','o','g',0};
|
||||
static const WCHAR error_abort[] = {'E','r','r','o','r','A','b','o','r','t',0};
|
||||
|
@ -3942,10 +4087,10 @@ static UINT error_dialog_handler(MSIPACKAGE *package, LPCWSTR event,
|
|||
if ( !strcmpW( argument, error_abort ) || !strcmpW( argument, error_cancel ) ||
|
||||
!strcmpW( argument, error_no ) )
|
||||
{
|
||||
msi_set_property( package->db, result_prop, error_abort, -1 );
|
||||
msi_set_property( dialog->package->db, result_prop, error_abort, -1 );
|
||||
}
|
||||
|
||||
ControlEvent_CleanupSubscriptions(package);
|
||||
msi_event_cleanup_all_subscriptions( dialog->package );
|
||||
msi_dialog_end_dialog( dialog );
|
||||
|
||||
return ERROR_SUCCESS;
|
||||
|
@ -4007,13 +4152,12 @@ UINT msi_spawn_error_dialog( MSIPACKAGE *package, LPWSTR error_dialog, LPWSTR er
|
|||
if ( r != ERROR_SUCCESS )
|
||||
return r;
|
||||
|
||||
dialog = msi_dialog_create( package, error_dialog, package->dialog,
|
||||
error_dialog_handler );
|
||||
dialog = dialog_create( package, error_dialog, package->dialog, error_dialog_handler );
|
||||
if ( !dialog )
|
||||
return ERROR_FUNCTION_FAILED;
|
||||
|
||||
dialog->finished = FALSE;
|
||||
r = msi_dialog_run_message_loop( dialog );
|
||||
r = dialog_run_message_loop( dialog );
|
||||
if ( r != ERROR_SUCCESS )
|
||||
goto done;
|
||||
|
||||
|
@ -4092,8 +4236,7 @@ UINT WINAPI MsiEnableUIPreview( MSIHANDLE hdb, MSIHANDLE *phPreview )
|
|||
return r;
|
||||
}
|
||||
|
||||
static UINT preview_event_handler( MSIPACKAGE *package, LPCWSTR event,
|
||||
LPCWSTR argument, msi_dialog *dialog )
|
||||
static UINT preview_event_handler( msi_dialog *dialog, const WCHAR *event, const WCHAR *argument )
|
||||
{
|
||||
MESSAGE("Preview dialog event '%s' (arg='%s')\n", debugstr_w(event), debugstr_w(argument));
|
||||
return ERROR_SUCCESS;
|
||||
|
@ -4110,9 +4253,9 @@ static UINT MSI_PreviewDialogW( MSIPREVIEW *preview, LPCWSTR szDialogName )
|
|||
/* an empty name means we should just destroy the current preview dialog */
|
||||
if (szDialogName)
|
||||
{
|
||||
dialog = msi_dialog_create( preview->package, szDialogName, NULL, preview_event_handler );
|
||||
dialog = dialog_create( preview->package, szDialogName, NULL, preview_event_handler );
|
||||
if (dialog)
|
||||
msi_dialog_do_preview( dialog );
|
||||
dialog_do_preview( dialog );
|
||||
else
|
||||
r = ERROR_FUNCTION_FAILED;
|
||||
}
|
||||
|
@ -4165,3 +4308,303 @@ UINT WINAPI MsiPreviewBillboardA( MSIHANDLE hPreview, LPCSTR szControlName, LPCS
|
|||
FIXME("%d %s %s\n", hPreview, debugstr_a(szControlName), debugstr_a(szBillboard));
|
||||
return ERROR_CALL_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
typedef UINT (*event_handler)( msi_dialog *, const WCHAR * );
|
||||
|
||||
struct control_event
|
||||
{
|
||||
const WCHAR *event;
|
||||
event_handler handler;
|
||||
};
|
||||
|
||||
static UINT dialog_event_handler( msi_dialog *, const WCHAR *, const WCHAR * );
|
||||
|
||||
/* create a dialog box and run it if it's modal */
|
||||
static UINT event_do_dialog( MSIPACKAGE *package, const WCHAR *name, msi_dialog *parent, BOOL destroy_modeless )
|
||||
{
|
||||
msi_dialog *dialog;
|
||||
UINT r;
|
||||
|
||||
/* create a new dialog */
|
||||
dialog = dialog_create( package, name, parent, dialog_event_handler );
|
||||
if (dialog)
|
||||
{
|
||||
/* kill the current modeless dialog */
|
||||
if (destroy_modeless && package->dialog)
|
||||
{
|
||||
msi_dialog_destroy( package->dialog );
|
||||
package->dialog = NULL;
|
||||
}
|
||||
|
||||
/* modeless dialogs return an error message */
|
||||
r = dialog_run_message_loop( dialog );
|
||||
if (r == ERROR_SUCCESS)
|
||||
msi_dialog_destroy( dialog );
|
||||
else
|
||||
package->dialog = dialog;
|
||||
}
|
||||
else r = ERROR_FUNCTION_FAILED;
|
||||
return r;
|
||||
}
|
||||
|
||||
/* end a modal dialog box */
|
||||
static UINT event_end_dialog( msi_dialog *dialog, const WCHAR *argument )
|
||||
{
|
||||
static const WCHAR exitW[] = {'E','x','i','t',0};
|
||||
static const WCHAR retryW[] = {'R','e','t','r','y',0};
|
||||
static const WCHAR ignoreW[] = {'I','g','n','o','r','e',0};
|
||||
static const WCHAR returnW[] = {'R','e','t','u','r','n',0};
|
||||
|
||||
if (!strcmpW( argument, exitW ))
|
||||
dialog->package->CurrentInstallState = ERROR_INSTALL_USEREXIT;
|
||||
else if (!strcmpW( argument, retryW ))
|
||||
dialog->package->CurrentInstallState = ERROR_INSTALL_SUSPEND;
|
||||
else if (!strcmpW( argument, ignoreW ))
|
||||
dialog->package->CurrentInstallState = ERROR_SUCCESS;
|
||||
else if (!strcmpW( argument, returnW ))
|
||||
{
|
||||
msi_dialog *parent = dialog->parent;
|
||||
msi_free( dialog->package->next_dialog );
|
||||
dialog->package->next_dialog = (parent) ? strdupW( parent->name ) : NULL;
|
||||
dialog->package->CurrentInstallState = ERROR_SUCCESS;
|
||||
}
|
||||
else
|
||||
{
|
||||
ERR("Unknown argument string %s\n", debugstr_w(argument));
|
||||
dialog->package->CurrentInstallState = ERROR_FUNCTION_FAILED;
|
||||
}
|
||||
event_cleanup_subscriptions( dialog->package, dialog->name );
|
||||
msi_dialog_end_dialog( dialog );
|
||||
return ERROR_SUCCESS;
|
||||
}
|
||||
|
||||
/* transition from one modal dialog to another modal dialog */
|
||||
static UINT event_new_dialog( msi_dialog *dialog, const WCHAR *argument )
|
||||
{
|
||||
/* store the name of the next dialog, and signal this one to end */
|
||||
dialog->package->next_dialog = strdupW( argument );
|
||||
msi_event_cleanup_all_subscriptions( dialog->package );
|
||||
msi_dialog_end_dialog( dialog );
|
||||
return ERROR_SUCCESS;
|
||||
}
|
||||
|
||||
/* create a new child dialog of an existing modal dialog */
|
||||
static UINT event_spawn_dialog( msi_dialog *dialog, const WCHAR *argument )
|
||||
{
|
||||
/* don't destroy a modeless dialogs that might be our parent */
|
||||
event_do_dialog( dialog->package, argument, dialog, FALSE );
|
||||
if (dialog->package->CurrentInstallState != ERROR_SUCCESS) msi_dialog_end_dialog( dialog );
|
||||
return ERROR_SUCCESS;
|
||||
}
|
||||
|
||||
/* creates a dialog that remains up for a period of time based on a condition */
|
||||
static UINT event_spawn_wait_dialog( msi_dialog *dialog, const WCHAR *argument )
|
||||
{
|
||||
FIXME("doing nothing\n");
|
||||
return ERROR_SUCCESS;
|
||||
}
|
||||
|
||||
static UINT event_do_action( msi_dialog *dialog, const WCHAR *argument )
|
||||
{
|
||||
ACTION_PerformAction( dialog->package, argument, SCRIPT_NONE );
|
||||
return ERROR_SUCCESS;
|
||||
}
|
||||
|
||||
static UINT event_add_local( msi_dialog *dialog, const WCHAR *argument )
|
||||
{
|
||||
MSIFEATURE *feature;
|
||||
|
||||
LIST_FOR_EACH_ENTRY( feature, &dialog->package->features, MSIFEATURE, entry )
|
||||
{
|
||||
if (!strcmpW( argument, feature->Feature ) || !strcmpW( argument, szAll ))
|
||||
{
|
||||
if (feature->ActionRequest != INSTALLSTATE_LOCAL)
|
||||
msi_set_property( dialog->package->db, szPreselected, szOne, -1 );
|
||||
MSI_SetFeatureStateW( dialog->package, feature->Feature, INSTALLSTATE_LOCAL );
|
||||
}
|
||||
}
|
||||
return ERROR_SUCCESS;
|
||||
}
|
||||
|
||||
static UINT event_remove( msi_dialog *dialog, const WCHAR *argument )
|
||||
{
|
||||
MSIFEATURE *feature;
|
||||
|
||||
LIST_FOR_EACH_ENTRY( feature, &dialog->package->features, MSIFEATURE, entry )
|
||||
{
|
||||
if (!strcmpW( argument, feature->Feature ) || !strcmpW( argument, szAll ))
|
||||
{
|
||||
if (feature->ActionRequest != INSTALLSTATE_ABSENT)
|
||||
msi_set_property( dialog->package->db, szPreselected, szOne, -1 );
|
||||
MSI_SetFeatureStateW( dialog->package, feature->Feature, INSTALLSTATE_ABSENT );
|
||||
}
|
||||
}
|
||||
return ERROR_SUCCESS;
|
||||
}
|
||||
|
||||
static UINT event_add_source( msi_dialog *dialog, const WCHAR *argument )
|
||||
{
|
||||
MSIFEATURE *feature;
|
||||
|
||||
LIST_FOR_EACH_ENTRY( feature, &dialog->package->features, MSIFEATURE, entry )
|
||||
{
|
||||
if (!strcmpW( argument, feature->Feature ) || !strcmpW( argument, szAll ))
|
||||
{
|
||||
if (feature->ActionRequest != INSTALLSTATE_SOURCE)
|
||||
msi_set_property( dialog->package->db, szPreselected, szOne, -1 );
|
||||
MSI_SetFeatureStateW( dialog->package, feature->Feature, INSTALLSTATE_SOURCE );
|
||||
}
|
||||
}
|
||||
return ERROR_SUCCESS;
|
||||
}
|
||||
|
||||
void msi_event_fire( MSIPACKAGE *package, const WCHAR *event, MSIRECORD *rec )
|
||||
{
|
||||
struct subscriber *sub;
|
||||
|
||||
TRACE("firing event %s\n", debugstr_w(event));
|
||||
|
||||
LIST_FOR_EACH_ENTRY( sub, &package->subscriptions, struct subscriber, entry )
|
||||
{
|
||||
if (strcmpiW( sub->event, event )) continue;
|
||||
dialog_handle_event( sub->dialog, sub->control, sub->attribute, rec );
|
||||
}
|
||||
}
|
||||
|
||||
static UINT event_set_target_path( msi_dialog *dialog, const WCHAR *argument )
|
||||
{
|
||||
WCHAR *path = msi_dup_property( dialog->package->db, argument );
|
||||
MSIRECORD *rec = MSI_CreateRecord( 1 );
|
||||
UINT r = ERROR_SUCCESS;
|
||||
|
||||
MSI_RecordSetStringW( rec, 1, path );
|
||||
msi_event_fire( dialog->package, szSelectionPath, rec );
|
||||
if (path)
|
||||
{
|
||||
/* failure to set the path halts the executing of control events */
|
||||
r = MSI_SetTargetPathW( dialog->package, argument, path );
|
||||
msi_free( path );
|
||||
}
|
||||
msi_free( &rec->hdr );
|
||||
return r;
|
||||
}
|
||||
|
||||
static UINT event_reset( msi_dialog *dialog, const WCHAR *argument )
|
||||
{
|
||||
msi_dialog_reset( dialog );
|
||||
return ERROR_SUCCESS;
|
||||
}
|
||||
|
||||
/* Return ERROR_SUCCESS if dialog is process and ERROR_FUNCTION_FAILED
|
||||
* if the given parameter is not a dialog box
|
||||
*/
|
||||
UINT ACTION_DialogBox( MSIPACKAGE *package, const WCHAR *dialog )
|
||||
{
|
||||
UINT r;
|
||||
|
||||
if (package->next_dialog) ERR("Already got next dialog... ignoring it\n");
|
||||
package->next_dialog = NULL;
|
||||
|
||||
/* Dialogs are chained by filling in the next_dialog member
|
||||
* of the package structure, then terminating the current dialog.
|
||||
* The code below sees the next_dialog member set, and runs the
|
||||
* next dialog.
|
||||
* We fall out of the loop below if we come across a modeless
|
||||
* dialog, as it returns ERROR_IO_PENDING when we try to run
|
||||
* its message loop.
|
||||
*/
|
||||
r = event_do_dialog( package, dialog, NULL, TRUE );
|
||||
while (r == ERROR_SUCCESS && package->next_dialog)
|
||||
{
|
||||
WCHAR *name = package->next_dialog;
|
||||
|
||||
package->next_dialog = NULL;
|
||||
r = event_do_dialog( package, name, NULL, TRUE );
|
||||
msi_free( name );
|
||||
}
|
||||
if (r == ERROR_IO_PENDING) r = ERROR_SUCCESS;
|
||||
return r;
|
||||
}
|
||||
|
||||
static UINT event_set_install_level( msi_dialog *dialog, const WCHAR *argument )
|
||||
{
|
||||
int level = atolW( argument );
|
||||
|
||||
TRACE("setting install level to %d\n", level);
|
||||
return MSI_SetInstallLevel( dialog->package, level );
|
||||
}
|
||||
|
||||
static UINT event_directory_list_up( msi_dialog *dialog, const WCHAR *argument )
|
||||
{
|
||||
return msi_dialog_directorylist_up( dialog );
|
||||
}
|
||||
|
||||
static UINT event_reinstall_mode( msi_dialog *dialog, const WCHAR *argument )
|
||||
{
|
||||
return msi_set_property( dialog->package->db, szReinstallMode, argument, -1 );
|
||||
}
|
||||
|
||||
static UINT event_reinstall( msi_dialog *dialog, const WCHAR *argument )
|
||||
{
|
||||
return msi_set_property( dialog->package->db, szReinstall, argument, -1 );
|
||||
}
|
||||
|
||||
static UINT event_validate_product_id( msi_dialog *dialog, const WCHAR *argument )
|
||||
{
|
||||
return msi_validate_product_id( dialog->package );
|
||||
}
|
||||
|
||||
static const WCHAR end_dialogW[] = {'E','n','d','D','i','a','l','o','g',0};
|
||||
static const WCHAR new_dialogW[] = {'N','e','w','D','i','a','l','o','g',0};
|
||||
static const WCHAR spawn_dialogW[] = {'S','p','a','w','n','D','i','a','l','o','g',0};
|
||||
static const WCHAR spawn_wait_dialogW[] = {'S','p','a','w','n','W','a','i','t','D','i','a','l','o','g',0};
|
||||
static const WCHAR do_actionW[] = {'D','o','A','c','t','i','o','n',0};
|
||||
static const WCHAR add_localW[] = {'A','d','d','L','o','c','a','l',0};
|
||||
static const WCHAR removeW[] = {'R','e','m','o','v','e',0};
|
||||
static const WCHAR add_sourceW[] = {'A','d','d','S','o','u','r','c','e',0};
|
||||
static const WCHAR set_target_pathW[] = {'S','e','t','T','a','r','g','e','t','P','a','t','h',0};
|
||||
static const WCHAR resetW[] = {'R','e','s','e','t',0};
|
||||
static const WCHAR set_install_levelW[] = {'S','e','t','I','n','s','t','a','l','l','L','e','v','e','l',0};
|
||||
static const WCHAR directory_list_upW[] = {'D','i','r','e','c','t','o','r','y','L','i','s','t','U','p',0};
|
||||
static const WCHAR selection_browseW[] = {'S','e','l','e','c','t','i','o','n','B','r','o','w','s','e',0};
|
||||
static const WCHAR reinstall_modeW[] = {'R','e','i','n','s','t','a','l','l','M','o','d','e',0};
|
||||
static const WCHAR reinstallW[] = {'R','e','i','n','s','t','a','l','l',0};
|
||||
static const WCHAR validate_product_idW[] = {'V','a','l','i','d','a','t','e','P','r','o','d','u','c','t','I','D',0};
|
||||
|
||||
static const struct control_event control_events[] =
|
||||
{
|
||||
{ end_dialogW, event_end_dialog },
|
||||
{ new_dialogW, event_new_dialog },
|
||||
{ spawn_dialogW, event_spawn_dialog },
|
||||
{ spawn_wait_dialogW, event_spawn_wait_dialog },
|
||||
{ do_actionW, event_do_action },
|
||||
{ add_localW, event_add_local },
|
||||
{ removeW, event_remove },
|
||||
{ add_sourceW, event_add_source },
|
||||
{ set_target_pathW, event_set_target_path },
|
||||
{ resetW, event_reset },
|
||||
{ set_install_levelW, event_set_install_level },
|
||||
{ directory_list_upW, event_directory_list_up },
|
||||
{ selection_browseW, event_spawn_dialog },
|
||||
{ reinstall_modeW, event_reinstall_mode },
|
||||
{ reinstallW, event_reinstall },
|
||||
{ validate_product_idW, event_validate_product_id },
|
||||
{ NULL, NULL }
|
||||
};
|
||||
|
||||
static UINT dialog_event_handler( msi_dialog *dialog, const WCHAR *event, const WCHAR *argument )
|
||||
{
|
||||
unsigned int i;
|
||||
|
||||
TRACE("handling event %s\n", debugstr_w(event));
|
||||
|
||||
if (!event) return ERROR_SUCCESS;
|
||||
|
||||
for (i = 0; control_events[i].event; i++)
|
||||
{
|
||||
if (!strcmpW( control_events[i].event, event ))
|
||||
return control_events[i].handler( dialog, argument );
|
||||
}
|
||||
FIXME("unhandled event %s arg(%s)\n", debugstr_w(event), debugstr_w(argument));
|
||||
return ERROR_SUCCESS;
|
||||
}
|
||||
|
|
|
@ -1,453 +0,0 @@
|
|||
/*
|
||||
* Implementation of the Microsoft Installer (msi.dll)
|
||||
*
|
||||
* Copyright 2005 Aric Stewart for CodeWeavers
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2.1 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
|
||||
*/
|
||||
|
||||
#define WIN32_NO_STATUS
|
||||
#define _INC_WINDOWS
|
||||
#define COM_NO_WINDOWS_H
|
||||
|
||||
//#include <stdarg.h>
|
||||
//#include <stdio.h>
|
||||
|
||||
//#include <windef.h>
|
||||
//#include "winbase.h"
|
||||
//#include "winerror.h"
|
||||
//#include "winreg.h"
|
||||
//#include "msi.h"
|
||||
#include "msipriv.h"
|
||||
|
||||
#include <wine/debug.h>
|
||||
#include <wine/unicode.h>
|
||||
|
||||
WINE_DEFAULT_DEBUG_CHANNEL(msi);
|
||||
|
||||
typedef UINT (*EVENTHANDLER)(MSIPACKAGE*,LPCWSTR,msi_dialog *);
|
||||
|
||||
struct control_events
|
||||
{
|
||||
const WCHAR *event;
|
||||
EVENTHANDLER handler;
|
||||
};
|
||||
|
||||
struct subscriber {
|
||||
struct list entry;
|
||||
msi_dialog *dialog;
|
||||
LPWSTR event;
|
||||
LPWSTR control;
|
||||
LPWSTR attribute;
|
||||
};
|
||||
|
||||
static UINT ControlEvent_HandleControlEvent(MSIPACKAGE *, LPCWSTR, LPCWSTR, msi_dialog*);
|
||||
|
||||
/*
|
||||
* Create a dialog box and run it if it's modal
|
||||
*/
|
||||
static UINT event_do_dialog( MSIPACKAGE *package, LPCWSTR name, msi_dialog *parent, BOOL destroy_modeless )
|
||||
{
|
||||
msi_dialog *dialog;
|
||||
UINT r;
|
||||
|
||||
/* create a new dialog */
|
||||
dialog = msi_dialog_create( package, name, parent,
|
||||
ControlEvent_HandleControlEvent );
|
||||
if( dialog )
|
||||
{
|
||||
/* kill the current modeless dialog */
|
||||
if( destroy_modeless && package->dialog )
|
||||
{
|
||||
msi_dialog_destroy( package->dialog );
|
||||
package->dialog = NULL;
|
||||
}
|
||||
|
||||
/* modeless dialogs return an error message */
|
||||
r = msi_dialog_run_message_loop( dialog );
|
||||
if( r == ERROR_SUCCESS )
|
||||
msi_dialog_destroy( dialog );
|
||||
else
|
||||
package->dialog = dialog;
|
||||
}
|
||||
else
|
||||
r = ERROR_FUNCTION_FAILED;
|
||||
|
||||
return r;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* End a modal dialog box
|
||||
*/
|
||||
static UINT ControlEvent_EndDialog(MSIPACKAGE* package, LPCWSTR argument,
|
||||
msi_dialog* dialog)
|
||||
{
|
||||
static const WCHAR szExit[] = {'E','x','i','t',0};
|
||||
static const WCHAR szRetry[] = {'R','e','t','r','y',0};
|
||||
static const WCHAR szIgnore[] = {'I','g','n','o','r','e',0};
|
||||
static const WCHAR szReturn[] = {'R','e','t','u','r','n',0};
|
||||
|
||||
if (!strcmpW( argument, szExit ))
|
||||
package->CurrentInstallState = ERROR_INSTALL_USEREXIT;
|
||||
else if (!strcmpW( argument, szRetry ))
|
||||
package->CurrentInstallState = ERROR_INSTALL_SUSPEND;
|
||||
else if (!strcmpW( argument, szIgnore ))
|
||||
package->CurrentInstallState = ERROR_SUCCESS;
|
||||
else if (!strcmpW( argument, szReturn ))
|
||||
{
|
||||
msi_dialog *parent = msi_dialog_get_parent(dialog);
|
||||
msi_free(package->next_dialog);
|
||||
package->next_dialog = (parent) ? strdupW(msi_dialog_get_name(parent)) : NULL;
|
||||
package->CurrentInstallState = ERROR_SUCCESS;
|
||||
}
|
||||
else
|
||||
{
|
||||
ERR("Unknown argument string %s\n",debugstr_w(argument));
|
||||
package->CurrentInstallState = ERROR_FUNCTION_FAILED;
|
||||
}
|
||||
|
||||
ControlEvent_CleanupDialogSubscriptions(package, msi_dialog_get_name( dialog ));
|
||||
msi_dialog_end_dialog( dialog );
|
||||
return ERROR_SUCCESS;
|
||||
}
|
||||
|
||||
/*
|
||||
* transition from one modal dialog to another modal dialog
|
||||
*/
|
||||
static UINT ControlEvent_NewDialog(MSIPACKAGE* package, LPCWSTR argument,
|
||||
msi_dialog *dialog)
|
||||
{
|
||||
/* store the name of the next dialog, and signal this one to end */
|
||||
package->next_dialog = strdupW(argument);
|
||||
ControlEvent_CleanupSubscriptions(package);
|
||||
msi_dialog_end_dialog( dialog );
|
||||
return ERROR_SUCCESS;
|
||||
}
|
||||
|
||||
/*
|
||||
* Create a new child dialog of an existing modal dialog
|
||||
*/
|
||||
static UINT ControlEvent_SpawnDialog(MSIPACKAGE* package, LPCWSTR argument,
|
||||
msi_dialog *dialog)
|
||||
{
|
||||
/* don't destroy a modeless dialogs that might be our parent */
|
||||
event_do_dialog( package, argument, dialog, FALSE );
|
||||
if( package->CurrentInstallState != ERROR_SUCCESS )
|
||||
msi_dialog_end_dialog( dialog );
|
||||
return ERROR_SUCCESS;
|
||||
}
|
||||
|
||||
/*
|
||||
* Creates a dialog that remains up for a period of time
|
||||
* based on a condition
|
||||
*/
|
||||
static UINT ControlEvent_SpawnWaitDialog(MSIPACKAGE* package, LPCWSTR argument,
|
||||
msi_dialog* dialog)
|
||||
{
|
||||
FIXME("Doing Nothing\n");
|
||||
return ERROR_SUCCESS;
|
||||
}
|
||||
|
||||
static UINT ControlEvent_DoAction(MSIPACKAGE* package, LPCWSTR argument,
|
||||
msi_dialog* dialog)
|
||||
{
|
||||
ACTION_PerformAction(package, argument, SCRIPT_NONE);
|
||||
return ERROR_SUCCESS;
|
||||
}
|
||||
|
||||
static UINT ControlEvent_AddLocal( MSIPACKAGE *package, LPCWSTR argument, msi_dialog *dialog )
|
||||
{
|
||||
MSIFEATURE *feature;
|
||||
|
||||
LIST_FOR_EACH_ENTRY( feature, &package->features, MSIFEATURE, entry )
|
||||
{
|
||||
if (!strcmpW( argument, feature->Feature ) || !strcmpW( argument, szAll ))
|
||||
{
|
||||
if (feature->ActionRequest != INSTALLSTATE_LOCAL)
|
||||
msi_set_property( package->db, szPreselected, szOne, -1 );
|
||||
MSI_SetFeatureStateW( package, feature->Feature, INSTALLSTATE_LOCAL );
|
||||
}
|
||||
}
|
||||
return ERROR_SUCCESS;
|
||||
}
|
||||
|
||||
static UINT ControlEvent_Remove( MSIPACKAGE *package, LPCWSTR argument, msi_dialog *dialog )
|
||||
{
|
||||
MSIFEATURE *feature;
|
||||
|
||||
LIST_FOR_EACH_ENTRY( feature, &package->features, MSIFEATURE, entry )
|
||||
{
|
||||
if (!strcmpW( argument, feature->Feature ) || !strcmpW( argument, szAll ))
|
||||
{
|
||||
if (feature->ActionRequest != INSTALLSTATE_ABSENT)
|
||||
msi_set_property( package->db, szPreselected, szOne, -1 );
|
||||
MSI_SetFeatureStateW( package, feature->Feature, INSTALLSTATE_ABSENT );
|
||||
}
|
||||
}
|
||||
return ERROR_SUCCESS;
|
||||
}
|
||||
|
||||
static UINT ControlEvent_AddSource( MSIPACKAGE *package, LPCWSTR argument, msi_dialog *dialog )
|
||||
{
|
||||
MSIFEATURE *feature;
|
||||
|
||||
LIST_FOR_EACH_ENTRY( feature, &package->features, MSIFEATURE, entry )
|
||||
{
|
||||
if (!strcmpW( argument, feature->Feature ) || !strcmpW( argument, szAll ))
|
||||
{
|
||||
if (feature->ActionRequest != INSTALLSTATE_SOURCE)
|
||||
msi_set_property( package->db, szPreselected, szOne, -1 );
|
||||
MSI_SetFeatureStateW( package, feature->Feature, INSTALLSTATE_SOURCE );
|
||||
}
|
||||
}
|
||||
return ERROR_SUCCESS;
|
||||
}
|
||||
|
||||
static UINT ControlEvent_SetTargetPath(MSIPACKAGE* package, LPCWSTR argument,
|
||||
msi_dialog* dialog)
|
||||
{
|
||||
static const WCHAR szSelectionPath[] = {'S','e','l','e','c','t','i','o','n','P','a','t','h',0};
|
||||
LPWSTR path = msi_dup_property( package->db, argument );
|
||||
MSIRECORD *rec = MSI_CreateRecord( 1 );
|
||||
UINT r = ERROR_SUCCESS;
|
||||
|
||||
MSI_RecordSetStringW( rec, 1, path );
|
||||
ControlEvent_FireSubscribedEvent( package, szSelectionPath, rec );
|
||||
if (path)
|
||||
{
|
||||
/* failure to set the path halts the executing of control events */
|
||||
r = MSI_SetTargetPathW(package, argument, path);
|
||||
msi_free(path);
|
||||
}
|
||||
msi_free(&rec->hdr);
|
||||
return r;
|
||||
}
|
||||
|
||||
static UINT ControlEvent_Reset(MSIPACKAGE* package, LPCWSTR argument,
|
||||
msi_dialog* dialog)
|
||||
{
|
||||
msi_dialog_reset(dialog);
|
||||
return ERROR_SUCCESS;
|
||||
}
|
||||
|
||||
/*
|
||||
* Subscribed events
|
||||
*/
|
||||
static void free_subscriber( struct subscriber *sub )
|
||||
{
|
||||
msi_free(sub->event);
|
||||
msi_free(sub->control);
|
||||
msi_free(sub->attribute);
|
||||
msi_free(sub);
|
||||
}
|
||||
|
||||
VOID ControlEvent_SubscribeToEvent( MSIPACKAGE *package, msi_dialog *dialog,
|
||||
LPCWSTR event, LPCWSTR control, LPCWSTR attribute )
|
||||
{
|
||||
struct subscriber *sub;
|
||||
|
||||
TRACE("event %s control %s attribute %s\n", debugstr_w(event), debugstr_w(control), debugstr_w(attribute));
|
||||
|
||||
LIST_FOR_EACH_ENTRY( sub, &package->subscriptions, struct subscriber, entry )
|
||||
{
|
||||
if (!strcmpiW( sub->event, event ) &&
|
||||
!strcmpiW( sub->control, control ) &&
|
||||
!strcmpiW( sub->attribute, attribute ))
|
||||
{
|
||||
TRACE("already subscribed\n");
|
||||
return;
|
||||
};
|
||||
}
|
||||
if (!(sub = msi_alloc( sizeof(*sub) ))) return;
|
||||
sub->dialog = dialog;
|
||||
sub->event = strdupW(event);
|
||||
sub->control = strdupW(control);
|
||||
sub->attribute = strdupW(attribute);
|
||||
list_add_tail( &package->subscriptions, &sub->entry );
|
||||
}
|
||||
|
||||
VOID ControlEvent_FireSubscribedEvent( MSIPACKAGE *package, LPCWSTR event, MSIRECORD *rec )
|
||||
{
|
||||
struct subscriber *sub;
|
||||
|
||||
TRACE("Firing event %s\n", debugstr_w(event));
|
||||
|
||||
LIST_FOR_EACH_ENTRY( sub, &package->subscriptions, struct subscriber, entry )
|
||||
{
|
||||
if (strcmpiW( sub->event, event )) continue;
|
||||
msi_dialog_handle_event( sub->dialog, sub->control, sub->attribute, rec );
|
||||
}
|
||||
}
|
||||
|
||||
VOID ControlEvent_CleanupDialogSubscriptions(MSIPACKAGE *package, LPWSTR dialog)
|
||||
{
|
||||
struct list *i, *t;
|
||||
struct subscriber *sub;
|
||||
|
||||
LIST_FOR_EACH_SAFE( i, t, &package->subscriptions )
|
||||
{
|
||||
sub = LIST_ENTRY( i, struct subscriber, entry );
|
||||
|
||||
if (strcmpW( msi_dialog_get_name( sub->dialog ), dialog ))
|
||||
continue;
|
||||
|
||||
list_remove( &sub->entry );
|
||||
free_subscriber( sub );
|
||||
}
|
||||
}
|
||||
|
||||
VOID ControlEvent_CleanupSubscriptions(MSIPACKAGE *package)
|
||||
{
|
||||
struct list *i, *t;
|
||||
struct subscriber *sub;
|
||||
|
||||
LIST_FOR_EACH_SAFE( i, t, &package->subscriptions )
|
||||
{
|
||||
sub = LIST_ENTRY( i, struct subscriber, entry );
|
||||
|
||||
list_remove( &sub->entry );
|
||||
free_subscriber( sub );
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* ACTION_DialogBox()
|
||||
*
|
||||
* Return ERROR_SUCCESS if dialog is process and ERROR_FUNCTION_FAILED
|
||||
* if the given parameter is not a dialog box
|
||||
*/
|
||||
UINT ACTION_DialogBox( MSIPACKAGE* package, LPCWSTR szDialogName )
|
||||
{
|
||||
UINT r = ERROR_SUCCESS;
|
||||
|
||||
if( package->next_dialog )
|
||||
ERR("Already a next dialog... ignoring it\n");
|
||||
package->next_dialog = NULL;
|
||||
|
||||
/*
|
||||
* Dialogs are chained by filling in the next_dialog member
|
||||
* of the package structure, then terminating the current dialog.
|
||||
* The code below sees the next_dialog member set, and runs the
|
||||
* next dialog.
|
||||
* We fall out of the loop below if we come across a modeless
|
||||
* dialog, as it returns ERROR_IO_PENDING when we try to run
|
||||
* its message loop.
|
||||
*/
|
||||
r = event_do_dialog( package, szDialogName, NULL, TRUE );
|
||||
while( r == ERROR_SUCCESS && package->next_dialog )
|
||||
{
|
||||
LPWSTR name = package->next_dialog;
|
||||
|
||||
package->next_dialog = NULL;
|
||||
r = event_do_dialog( package, name, NULL, TRUE );
|
||||
msi_free( name );
|
||||
}
|
||||
|
||||
if( r == ERROR_IO_PENDING )
|
||||
r = ERROR_SUCCESS;
|
||||
|
||||
return r;
|
||||
}
|
||||
|
||||
static UINT ControlEvent_SetInstallLevel(MSIPACKAGE* package, LPCWSTR argument,
|
||||
msi_dialog* dialog)
|
||||
{
|
||||
int iInstallLevel = atolW(argument);
|
||||
|
||||
TRACE("Setting install level: %i\n", iInstallLevel);
|
||||
|
||||
return MSI_SetInstallLevel( package, iInstallLevel );
|
||||
}
|
||||
|
||||
static UINT ControlEvent_DirectoryListUp(MSIPACKAGE *package, LPCWSTR argument,
|
||||
msi_dialog *dialog)
|
||||
{
|
||||
return msi_dialog_directorylist_up( dialog );
|
||||
}
|
||||
|
||||
static UINT ControlEvent_ReinstallMode(MSIPACKAGE *package, LPCWSTR argument,
|
||||
msi_dialog *dialog)
|
||||
{
|
||||
return msi_set_property( package->db, szReinstallMode, argument, -1 );
|
||||
}
|
||||
|
||||
static UINT ControlEvent_Reinstall( MSIPACKAGE *package, LPCWSTR argument,
|
||||
msi_dialog *dialog )
|
||||
{
|
||||
return msi_set_property( package->db, szReinstall, argument, -1 );
|
||||
}
|
||||
|
||||
static UINT ControlEvent_ValidateProductID(MSIPACKAGE *package, LPCWSTR argument,
|
||||
msi_dialog *dialog)
|
||||
{
|
||||
return msi_validate_product_id( package );
|
||||
}
|
||||
|
||||
static const WCHAR end_dialogW[] = {'E','n','d','D','i','a','l','o','g',0};
|
||||
static const WCHAR new_dialogW[] = {'N','e','w','D','i','a','l','o','g',0};
|
||||
static const WCHAR spawn_dialogW[] = {'S','p','a','w','n','D','i','a','l','o','g',0};
|
||||
static const WCHAR spawn_wait_dialogW[] = {'S','p','a','w','n','W','a','i','t','D','i','a','l','o','g',0};
|
||||
static const WCHAR do_actionW[] = {'D','o','A','c','t','i','o','n',0};
|
||||
static const WCHAR add_localW[] = {'A','d','d','L','o','c','a','l',0};
|
||||
static const WCHAR removeW[] = {'R','e','m','o','v','e',0};
|
||||
static const WCHAR add_sourceW[] = {'A','d','d','S','o','u','r','c','e',0};
|
||||
static const WCHAR set_target_pathW[] = {'S','e','t','T','a','r','g','e','t','P','a','t','h',0};
|
||||
static const WCHAR resetW[] = {'R','e','s','e','t',0};
|
||||
static const WCHAR set_install_levelW[] = {'S','e','t','I','n','s','t','a','l','l','L','e','v','e','l',0};
|
||||
static const WCHAR directory_list_upW[] = {'D','i','r','e','c','t','o','r','y','L','i','s','t','U','p',0};
|
||||
static const WCHAR selection_browseW[] = {'S','e','l','e','c','t','i','o','n','B','r','o','w','s','e',0};
|
||||
static const WCHAR reinstall_modeW[] = {'R','e','i','n','s','t','a','l','l','M','o','d','e',0};
|
||||
static const WCHAR reinstallW[] = {'R','e','i','n','s','t','a','l','l',0};
|
||||
static const WCHAR validate_product_idW[] = {'V','a','l','i','d','a','t','e','P','r','o','d','u','c','t','I','D',0};
|
||||
|
||||
static const struct control_events control_events[] =
|
||||
{
|
||||
{ end_dialogW, ControlEvent_EndDialog },
|
||||
{ new_dialogW, ControlEvent_NewDialog },
|
||||
{ spawn_dialogW, ControlEvent_SpawnDialog },
|
||||
{ spawn_wait_dialogW, ControlEvent_SpawnWaitDialog },
|
||||
{ do_actionW, ControlEvent_DoAction },
|
||||
{ add_localW, ControlEvent_AddLocal },
|
||||
{ removeW, ControlEvent_Remove },
|
||||
{ add_sourceW, ControlEvent_AddSource },
|
||||
{ set_target_pathW, ControlEvent_SetTargetPath },
|
||||
{ resetW, ControlEvent_Reset },
|
||||
{ set_install_levelW, ControlEvent_SetInstallLevel },
|
||||
{ directory_list_upW, ControlEvent_DirectoryListUp },
|
||||
{ selection_browseW, ControlEvent_SpawnDialog },
|
||||
{ reinstall_modeW, ControlEvent_ReinstallMode },
|
||||
{ reinstallW, ControlEvent_Reinstall },
|
||||
{ validate_product_idW, ControlEvent_ValidateProductID },
|
||||
{ NULL, NULL }
|
||||
};
|
||||
|
||||
UINT ControlEvent_HandleControlEvent( MSIPACKAGE *package, LPCWSTR event,
|
||||
LPCWSTR argument, msi_dialog *dialog )
|
||||
{
|
||||
unsigned int i;
|
||||
|
||||
TRACE("handling control event %s\n", debugstr_w(event));
|
||||
|
||||
if (!event) return ERROR_SUCCESS;
|
||||
|
||||
for (i = 0; control_events[i].event; i++)
|
||||
{
|
||||
if (!strcmpW( control_events[i].event, event ))
|
||||
return control_events[i].handler( package, argument, dialog );
|
||||
}
|
||||
FIXME("unhandled control event %s arg(%s)\n", debugstr_w(event), debugstr_w(argument));
|
||||
return ERROR_SUCCESS;
|
||||
}
|
|
@ -250,13 +250,15 @@ static UINT msi_create_directory( MSIPACKAGE *package, const WCHAR *dir )
|
|||
return ERROR_SUCCESS;
|
||||
}
|
||||
|
||||
static MSIFILE *find_file( MSIPACKAGE *package, const WCHAR *filename )
|
||||
static MSIFILE *find_file( MSIPACKAGE *package, UINT disk_id, const WCHAR *filename )
|
||||
{
|
||||
MSIFILE *file;
|
||||
|
||||
LIST_FOR_EACH_ENTRY( file, &package->files, MSIFILE, entry )
|
||||
{
|
||||
if (file->state != msifs_installed && !strcmpiW( filename, file->File )) return file;
|
||||
if (file->disk_id == disk_id &&
|
||||
file->state != msifs_installed &&
|
||||
!strcmpiW( filename, file->File )) return file;
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
@ -269,7 +271,7 @@ static BOOL installfiles_cb(MSIPACKAGE *package, LPCWSTR file, DWORD action,
|
|||
|
||||
if (action == MSICABEXTRACT_BEGINEXTRACT)
|
||||
{
|
||||
if (!(f = find_file( package, file )))
|
||||
if (!(f = find_file( package, disk_id, file )))
|
||||
{
|
||||
TRACE("unknown file in cabinet (%s)\n", debugstr_w(file));
|
||||
return FALSE;
|
||||
|
@ -398,7 +400,7 @@ UINT ACTION_InstallFiles(MSIPACKAGE *package)
|
|||
}
|
||||
else if (file->state != msifs_installed && !(file->Attributes & msidbFileAttributesPatchAdded))
|
||||
{
|
||||
ERR("compressed file wasn't installed (%s)\n", debugstr_w(file->TargetPath));
|
||||
ERR("compressed file wasn't installed (%s)\n", debugstr_w(file->File));
|
||||
rc = ERROR_INSTALL_FAILURE;
|
||||
goto done;
|
||||
}
|
||||
|
|
|
@ -362,8 +362,29 @@ static INT_PTR cabinet_next_cabinet(FDINOTIFICATIONTYPE fdint,
|
|||
|
||||
if (strcmpiW( mi->cabinet, cab ))
|
||||
{
|
||||
ERR("Continuous cabinet does not match the next cabinet in the Media table\n");
|
||||
goto done;
|
||||
char *next_cab;
|
||||
ULONG length;
|
||||
|
||||
WARN("Continuous cabinet %s does not match the next cabinet %s in the media table => use latter one\n", debugstr_w(cab), debugstr_w(mi->cabinet));
|
||||
|
||||
/* Use cabinet name from the media table */
|
||||
next_cab = strdupWtoA(mi->cabinet);
|
||||
/* Modify path to cabinet file with full filename (psz3 points to a 256 bytes buffer that can be modified contrary to psz1 and psz2) */
|
||||
length = strlen(pfdin->psz3) + 1 + strlen(next_cab) + 1;
|
||||
if (length > 256)
|
||||
{
|
||||
WARN("Cannot update next cabinet filename with a string size %u > 256\n", length);
|
||||
msi_free(next_cab);
|
||||
goto done;
|
||||
}
|
||||
else
|
||||
{
|
||||
strcat(pfdin->psz3, "\\");
|
||||
strcat(pfdin->psz3, next_cab);
|
||||
}
|
||||
/* Path psz3 and cabinet psz1 are concatenated by FDI so just reset psz1 */
|
||||
*pfdin->psz1 = 0;
|
||||
msi_free(next_cab);
|
||||
}
|
||||
|
||||
if (!(cabinet_file = get_cabinet_filename(mi)))
|
||||
|
|
|
@ -80,6 +80,7 @@ BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved)
|
|||
IsWow64Process( GetCurrentProcess(), &is_wow64 );
|
||||
break;
|
||||
case DLL_PROCESS_DETACH:
|
||||
if (lpvReserved) break;
|
||||
msi_dialog_unregister_class();
|
||||
msi_free_handle_table();
|
||||
msi_free( gszLogFile );
|
||||
|
|
|
@ -934,18 +934,9 @@ extern LONG msi_reg_set_val_dword( HKEY hkey, LPCWSTR name, DWORD val ) DECLSPEC
|
|||
extern LONG msi_reg_set_subkey_val( HKEY hkey, LPCWSTR path, LPCWSTR name, LPCWSTR val ) DECLSPEC_HIDDEN;
|
||||
|
||||
/* msi dialog interface */
|
||||
typedef UINT (*msi_dialog_event_handler)( MSIPACKAGE*, LPCWSTR, LPCWSTR, msi_dialog* );
|
||||
extern msi_dialog *msi_dialog_create( MSIPACKAGE*, LPCWSTR, msi_dialog*, msi_dialog_event_handler ) DECLSPEC_HIDDEN;
|
||||
extern UINT msi_dialog_run_message_loop( msi_dialog* ) DECLSPEC_HIDDEN;
|
||||
extern void msi_dialog_end_dialog( msi_dialog* ) DECLSPEC_HIDDEN;
|
||||
extern void msi_dialog_check_messages( HANDLE ) DECLSPEC_HIDDEN;
|
||||
extern void msi_dialog_destroy( msi_dialog* ) DECLSPEC_HIDDEN;
|
||||
extern void msi_dialog_unregister_class( void ) DECLSPEC_HIDDEN;
|
||||
extern void msi_dialog_handle_event( msi_dialog*, LPCWSTR, LPCWSTR, MSIRECORD * ) DECLSPEC_HIDDEN;
|
||||
extern UINT msi_dialog_reset( msi_dialog *dialog ) DECLSPEC_HIDDEN;
|
||||
extern UINT msi_dialog_directorylist_up( msi_dialog *dialog ) DECLSPEC_HIDDEN;
|
||||
extern msi_dialog *msi_dialog_get_parent( msi_dialog *dialog ) DECLSPEC_HIDDEN;
|
||||
extern LPWSTR msi_dialog_get_name( msi_dialog *dialog ) DECLSPEC_HIDDEN;
|
||||
extern UINT msi_spawn_error_dialog( MSIPACKAGE*, LPWSTR, LPWSTR ) DECLSPEC_HIDDEN;
|
||||
|
||||
/* summary information */
|
||||
|
@ -977,7 +968,7 @@ extern HINSTANCE msi_hInstance DECLSPEC_HIDDEN;
|
|||
extern UINT ACTION_PerformAction(MSIPACKAGE *package, const WCHAR *action, UINT script) DECLSPEC_HIDDEN;
|
||||
extern UINT ACTION_PerformUIAction(MSIPACKAGE *package, const WCHAR *action, UINT script) DECLSPEC_HIDDEN;
|
||||
extern void ACTION_FinishCustomActions( const MSIPACKAGE* package) DECLSPEC_HIDDEN;
|
||||
extern UINT ACTION_CustomAction(MSIPACKAGE *package,const WCHAR *action, UINT script, BOOL execute) DECLSPEC_HIDDEN;
|
||||
extern UINT ACTION_CustomAction(MSIPACKAGE *, const WCHAR *, UINT) DECLSPEC_HIDDEN;
|
||||
|
||||
/* actions in other modules */
|
||||
extern UINT ACTION_AppSearch(MSIPACKAGE *package) DECLSPEC_HIDDEN;
|
||||
|
@ -1066,12 +1057,8 @@ extern BOOL msi_cabextract(MSIPACKAGE* package, MSIMEDIAINFO *mi, LPVOID data) D
|
|||
extern UINT msi_add_cabinet_stream(MSIPACKAGE *, UINT, IStorage *, const WCHAR *) DECLSPEC_HIDDEN;
|
||||
|
||||
/* control event stuff */
|
||||
extern VOID ControlEvent_FireSubscribedEvent(MSIPACKAGE *package, LPCWSTR event,
|
||||
MSIRECORD *data) DECLSPEC_HIDDEN;
|
||||
extern VOID ControlEvent_CleanupDialogSubscriptions(MSIPACKAGE *package, LPWSTR dialog) DECLSPEC_HIDDEN;
|
||||
extern VOID ControlEvent_CleanupSubscriptions(MSIPACKAGE *package) DECLSPEC_HIDDEN;
|
||||
extern VOID ControlEvent_SubscribeToEvent(MSIPACKAGE *package, msi_dialog *dialog,
|
||||
LPCWSTR event, LPCWSTR control, LPCWSTR attribute) DECLSPEC_HIDDEN;
|
||||
extern void msi_event_fire(MSIPACKAGE *, const WCHAR *, MSIRECORD *) DECLSPEC_HIDDEN;
|
||||
extern void msi_event_cleanup_all_subscriptions( MSIPACKAGE * ) DECLSPEC_HIDDEN;
|
||||
|
||||
/* OLE automation */
|
||||
typedef enum tid_t {
|
||||
|
|
|
@ -346,7 +346,7 @@ static void free_package_structures( MSIPACKAGE *package )
|
|||
remove_tracked_tempfiles(package);
|
||||
|
||||
/* cleanup control event subscriptions */
|
||||
ControlEvent_CleanupSubscriptions( package );
|
||||
msi_event_cleanup_all_subscriptions( package );
|
||||
}
|
||||
|
||||
static void MSI_FreePackage( MSIOBJECTHDR *arg)
|
||||
|
@ -874,14 +874,14 @@ static VOID set_installer_properties(MSIPACKAGE *package)
|
|||
break;
|
||||
case VER_PLATFORM_WIN32_NT:
|
||||
msi_set_property( package->db, szVersionNT, verstr, len );
|
||||
len = sprintfW( verstr, szFormat,OSVersion.wProductType );
|
||||
msi_set_property( package->db, szMsiNTProductType, verstr, len );
|
||||
len = sprintfW( bufstr, szFormat,OSVersion.wProductType );
|
||||
msi_set_property( package->db, szMsiNTProductType, bufstr, len );
|
||||
break;
|
||||
}
|
||||
len = sprintfW( verstr, szFormat, OSVersion.dwBuildNumber );
|
||||
msi_set_property( package->db, szWindowsBuild, verstr, len );
|
||||
len = sprintfW( verstr, szFormat, OSVersion.wServicePackMajor );
|
||||
msi_set_property( package->db, szServicePackLevel, verstr, len );
|
||||
len = sprintfW( bufstr, szFormat, OSVersion.dwBuildNumber );
|
||||
msi_set_property( package->db, szWindowsBuild, bufstr, len );
|
||||
len = sprintfW( bufstr, szFormat, OSVersion.wServicePackMajor );
|
||||
msi_set_property( package->db, szServicePackLevel, bufstr, len );
|
||||
|
||||
len = sprintfW( bufstr, szFormat2, MSI_MAJORVERSION, MSI_MINORVERSION );
|
||||
msi_set_property( package->db, szVersionMsi, bufstr, len );
|
||||
|
@ -1025,7 +1025,7 @@ static VOID set_installer_properties(MSIPACKAGE *package)
|
|||
if ((computername = msi_alloc( len * sizeof(WCHAR) )))
|
||||
{
|
||||
if (GetComputerNameW( computername, &len ))
|
||||
msi_set_property( package->db, szComputerName, computername, len - 1 );
|
||||
msi_set_property( package->db, szComputerName, computername, len );
|
||||
msi_free( computername );
|
||||
}
|
||||
}
|
||||
|
@ -1942,7 +1942,7 @@ INT MSI_ProcessMessage( MSIPACKAGE *package, INSTALLMESSAGE eMessageType, MSIREC
|
|||
MSI_RecordSetStringW(uirow, 1, deformated);
|
||||
msi_free(deformated);
|
||||
|
||||
ControlEvent_FireSubscribedEvent(package, szActionData, uirow);
|
||||
msi_event_fire( package, szActionData, uirow );
|
||||
msiobj_release(&uirow->hdr);
|
||||
|
||||
if (package->action_progress_increment)
|
||||
|
@ -1950,7 +1950,7 @@ INT MSI_ProcessMessage( MSIPACKAGE *package, INSTALLMESSAGE eMessageType, MSIREC
|
|||
uirow = MSI_CreateRecord(2);
|
||||
MSI_RecordSetInteger(uirow, 1, 2);
|
||||
MSI_RecordSetInteger(uirow, 2, package->action_progress_increment);
|
||||
ControlEvent_FireSubscribedEvent(package, szSetProgress, uirow);
|
||||
msi_event_fire( package, szSetProgress, uirow );
|
||||
msiobj_release(&uirow->hdr);
|
||||
}
|
||||
break;
|
||||
|
@ -1961,13 +1961,13 @@ INT MSI_ProcessMessage( MSIPACKAGE *package, INSTALLMESSAGE eMessageType, MSIREC
|
|||
MSI_RecordSetStringW(uirow, 1, deformated);
|
||||
msi_free(deformated);
|
||||
|
||||
ControlEvent_FireSubscribedEvent(package, szActionText, uirow);
|
||||
msi_event_fire( package, szActionText, uirow );
|
||||
|
||||
msiobj_release(&uirow->hdr);
|
||||
break;
|
||||
|
||||
case INSTALLMESSAGE_PROGRESS:
|
||||
ControlEvent_FireSubscribedEvent(package, szSetProgress, record);
|
||||
msi_event_fire( package, szSetProgress, record );
|
||||
break;
|
||||
}
|
||||
|
||||
|
|
|
@ -48,22 +48,22 @@ static BOOL match_language( MSIPACKAGE *package, LANGID langid )
|
|||
return FALSE;
|
||||
}
|
||||
|
||||
static UINT check_transform_applicable( MSIPACKAGE *package, IStorage *patch )
|
||||
static UINT check_transform_applicable( MSIPACKAGE *package, IStorage *transform )
|
||||
{
|
||||
LPWSTR prod_code, patch_product, template = NULL;
|
||||
WCHAR *package_product, *transform_product, *template = NULL;
|
||||
UINT ret = ERROR_FUNCTION_FAILED;
|
||||
|
||||
prod_code = msi_dup_property( package->db, szProductCode );
|
||||
patch_product = msi_get_suminfo_product( patch );
|
||||
package_product = msi_dup_property( package->db, szProductCode );
|
||||
transform_product = msi_get_suminfo_product( transform );
|
||||
|
||||
TRACE("db = %s patch = %s\n", debugstr_w(prod_code), debugstr_w(patch_product));
|
||||
TRACE("package = %s transform = %s\n", debugstr_w(package_product), debugstr_w(transform_product));
|
||||
|
||||
if (strstrW( patch_product, prod_code ))
|
||||
if (!transform_product || strstrW( transform_product, package_product ))
|
||||
{
|
||||
MSISUMMARYINFO *si;
|
||||
const WCHAR *p;
|
||||
|
||||
si = MSI_GetSummaryInformationW( patch, 0 );
|
||||
si = MSI_GetSummaryInformationW( transform, 0 );
|
||||
if (!si)
|
||||
{
|
||||
ERR("no summary information!\n");
|
||||
|
@ -94,8 +94,8 @@ static UINT check_transform_applicable( MSIPACKAGE *package, IStorage *patch )
|
|||
}
|
||||
|
||||
end:
|
||||
msi_free( patch_product );
|
||||
msi_free( prod_code );
|
||||
msi_free( transform_product );
|
||||
msi_free( package_product );
|
||||
msi_free( template );
|
||||
return ret;
|
||||
}
|
||||
|
@ -555,7 +555,6 @@ static UINT set_patch_offsets( MSIDATABASE *db )
|
|||
pos = patch_offset_list_create();
|
||||
patch_offset_get_files( db, last_sequence, pos );
|
||||
patch_offset_get_patches( db, last_sequence, pos );
|
||||
if (pos->count)
|
||||
{
|
||||
UINT offset = db->media_transform_offset - pos->min;
|
||||
last_sequence = offset + pos->max;
|
||||
|
@ -563,7 +562,8 @@ static UINT set_patch_offsets( MSIDATABASE *db )
|
|||
/* FIXME: this is for the patch table, which is not yet properly transformed */
|
||||
last_sequence += pos->min;
|
||||
pos->offset_to_apply = offset;
|
||||
patch_offset_modify_db( db, pos );
|
||||
if (pos->count)
|
||||
patch_offset_modify_db( db, pos );
|
||||
|
||||
MSI_RecordSetInteger( rec, 2, last_sequence );
|
||||
r = MSI_ViewModify( view, MSIMODIFY_UPDATE, rec );
|
||||
|
|
|
@ -96,6 +96,19 @@ struct expr
|
|||
} u;
|
||||
};
|
||||
|
||||
typedef struct
|
||||
{
|
||||
MSIDATABASE *db;
|
||||
LPCWSTR command;
|
||||
DWORD n, len;
|
||||
UINT r;
|
||||
MSIVIEW **view; /* View structure for the resulting query. This value
|
||||
* tracks the view currently being created so we can free
|
||||
* this view on syntax error.
|
||||
*/
|
||||
struct list *mem;
|
||||
} SQL_input;
|
||||
|
||||
UINT MSI_ParseSQL( MSIDATABASE *db, LPCWSTR command, MSIVIEW **phview,
|
||||
struct list *mem ) DECLSPEC_HIDDEN;
|
||||
|
||||
|
|
|
@ -277,6 +277,20 @@ static HRESULT create_activescriptsite(MsiActiveScriptSite **obj)
|
|||
return S_OK;
|
||||
}
|
||||
|
||||
static UINT map_return_value(LONG val)
|
||||
{
|
||||
switch (val)
|
||||
{
|
||||
case 0:
|
||||
case IDOK:
|
||||
case IDIGNORE: return ERROR_SUCCESS;
|
||||
case IDCANCEL: return ERROR_INSTALL_USEREXIT;
|
||||
case IDRETRY: return ERROR_INSTALL_SUSPEND;
|
||||
case IDABORT:
|
||||
default: return ERROR_INSTALL_FAILURE;
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Call a script.
|
||||
*/
|
||||
|
@ -358,13 +372,10 @@ DWORD call_script(MSIHANDLE hPackage, INT type, LPCWSTR script, LPCWSTR function
|
|||
hr = IDispatch_Invoke(pDispatch, dispid, &IID_NULL, LOCALE_USER_DEFAULT, DISPATCH_METHOD, &dispparamsNoArgs, &var, NULL, NULL);
|
||||
if (FAILED(hr)) goto done;
|
||||
|
||||
/* Check return value, if it's not IDOK we failed */
|
||||
hr = VariantChangeType(&var, &var, 0, VT_I4);
|
||||
if (FAILED(hr)) goto done;
|
||||
|
||||
if (V_I4(&var) == IDOK)
|
||||
ret = ERROR_SUCCESS;
|
||||
else ret = ERROR_INSTALL_FAILURE;
|
||||
ret = map_return_value(V_I4(&var));
|
||||
|
||||
VariantClear(&var);
|
||||
} else {
|
||||
|
|
File diff suppressed because it is too large
Load diff
|
@ -1,10 +1,8 @@
|
|||
/* A Bison parser, made by GNU Bison 2.5. */
|
||||
|
||||
/* A Bison parser, made by GNU Bison 2.4.1. */
|
||||
|
||||
/* Skeleton interface for Bison's Yacc-like parsers in C
|
||||
/* Bison interface for Yacc-like parsers in C
|
||||
|
||||
Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002, 2003, 2004, 2005, 2006
|
||||
Free Software Foundation, Inc.
|
||||
Copyright (C) 1984, 1989-1990, 2000-2011 Free Software Foundation, Inc.
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
|
@ -109,8 +107,8 @@
|
|||
typedef union YYSTYPE
|
||||
{
|
||||
|
||||
/* Line 1676 of yacc.c */
|
||||
#line 83 "sql.y"
|
||||
/* Line 2068 of yacc.c */
|
||||
#line 68 "sql.y"
|
||||
|
||||
struct sql_str str;
|
||||
LPWSTR string;
|
||||
|
@ -122,8 +120,8 @@ typedef union YYSTYPE
|
|||
|
||||
|
||||
|
||||
/* Line 1676 of yacc.c */
|
||||
#line 127 "sql.tab.h"
|
||||
/* Line 2068 of yacc.c */
|
||||
#line 125 "sql.tab.h"
|
||||
} YYSTYPE;
|
||||
# define YYSTYPE_IS_TRIVIAL 1
|
||||
# define yystype YYSTYPE /* obsolescent; will be withdrawn */
|
||||
|
|
|
@ -34,29 +34,12 @@
|
|||
#include "wine/debug.h"
|
||||
#include "wine/unicode.h"
|
||||
|
||||
#define YYLEX_PARAM info
|
||||
#define YYPARSE_PARAM info
|
||||
|
||||
static int sql_error(const char *str);
|
||||
|
||||
WINE_DEFAULT_DEBUG_CHANNEL(msi);
|
||||
|
||||
typedef struct tag_SQL_input
|
||||
{
|
||||
MSIDATABASE *db;
|
||||
LPCWSTR command;
|
||||
DWORD n, len;
|
||||
UINT r;
|
||||
MSIVIEW **view; /* View structure for the resulting query. This value
|
||||
* tracks the view currently being created so we can free
|
||||
* this view on syntax error.
|
||||
*/
|
||||
struct list *mem;
|
||||
} SQL_input;
|
||||
|
||||
static UINT SQL_getstring( void *info, const struct sql_str *strdata, LPWSTR *str );
|
||||
static INT SQL_getint( void *info );
|
||||
static int sql_lex( void *SQL_lval, SQL_input *info );
|
||||
static int sql_error( SQL_input *info, const char *str);
|
||||
|
||||
static LPWSTR parser_add_table( void *info, LPCWSTR list, LPCWSTR table );
|
||||
static void *parser_alloc( void *info, unsigned int sz );
|
||||
|
@ -77,6 +60,8 @@ static struct expr * EXPR_wildcard( void *info );
|
|||
|
||||
%}
|
||||
|
||||
%lex-param { SQL_input *info }
|
||||
%parse-param { SQL_input *info }
|
||||
%pure-parser
|
||||
|
||||
%union
|
||||
|
@ -866,7 +851,7 @@ INT SQL_getint( void *info )
|
|||
return r;
|
||||
}
|
||||
|
||||
static int sql_error( const char *str )
|
||||
static int sql_error( SQL_input *info, const char *str )
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
|
|
@ -1263,6 +1263,7 @@ static UINT get_table_value_from_record( MSITABLEVIEW *tv, MSIRECORD *rec, UINT
|
|||
{
|
||||
MSICOLUMNINFO columninfo;
|
||||
UINT r;
|
||||
int ival;
|
||||
|
||||
if ( (iField <= 0) ||
|
||||
(iField > tv->num_cols) ||
|
||||
|
@ -1289,16 +1290,21 @@ static UINT get_table_value_from_record( MSITABLEVIEW *tv, MSIRECORD *rec, UINT
|
|||
}
|
||||
else if ( bytes_per_column( tv->db, &columninfo, LONG_STR_BYTES ) == 2 )
|
||||
{
|
||||
*pvalue = 0x8000 + MSI_RecordGetInteger( rec, iField );
|
||||
if ( *pvalue & 0xffff0000 )
|
||||
ival = MSI_RecordGetInteger( rec, iField );
|
||||
if (ival == 0x80000000) *pvalue = 0x8000;
|
||||
else
|
||||
{
|
||||
ERR("field %u value %d out of range\n", iField, *pvalue - 0x8000);
|
||||
return ERROR_FUNCTION_FAILED;
|
||||
*pvalue = 0x8000 + MSI_RecordGetInteger( rec, iField );
|
||||
if (*pvalue & 0xffff0000)
|
||||
{
|
||||
ERR("field %u value %d out of range\n", iField, *pvalue - 0x8000);
|
||||
return ERROR_FUNCTION_FAILED;
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
INT ival = MSI_RecordGetInteger( rec, iField );
|
||||
ival = MSI_RecordGetInteger( rec, iField );
|
||||
*pvalue = ival ^ 0x80000000;
|
||||
}
|
||||
|
||||
|
|
|
@ -116,7 +116,7 @@ reactos/dll/win32/msg711.acm # Synced to Wine-1.7.1
|
|||
reactos/dll/win32/msgsm32.acm # Synced to Wine-1.7.1
|
||||
reactos/dll/win32/mshtml # Synced to Wine-1.5.26
|
||||
reactos/dll/win32/mshtml.tlb # Synced to Wine-1.5.26
|
||||
reactos/dll/win32/msi # Synced to Wine-1.5.26
|
||||
reactos/dll/win32/msi # Synced to Wine-1.7.1
|
||||
reactos/dll/win32/msimg32 # Synced to Wine-1.5.19
|
||||
reactos/dll/win32/msimtf # Synced to Wine-1.5.19
|
||||
reactos/dll/win32/msisip # Synced to Wine-1.5.19
|
||||
|
|
Loading…
Reference in a new issue