https://git.reactos.org/?p=reactos.git;a=commitdiff;h=f8b992f2d31aaea06dd6a3...
commit f8b992f2d31aaea06dd6a360ad19165d56c331dc Author: Amine Khaldi amine.khaldi@reactos.org AuthorDate: Sat Jan 20 12:29:30 2018 +0100 Commit: Amine Khaldi amine.khaldi@reactos.org CommitDate: Sat Jan 20 12:29:30 2018 +0100
[MSI] Sync with Wine 3.0. CORE-14225 --- dll/win32/msi/action.c | 392 +++++++++++++------------ dll/win32/msi/appsearch.c | 2 +- dll/win32/msi/cond.tab.c | 712 +++++++++++++++++++++------------------------- dll/win32/msi/cond.y | 301 ++++++++++---------- dll/win32/msi/custom.c | 47 ++- dll/win32/msi/database.c | 184 +++--------- dll/win32/msi/dialog.c | 10 +- dll/win32/msi/install.c | 2 +- dll/win32/msi/msi.c | 6 +- dll/win32/msi/msipriv.h | 40 ++- dll/win32/msi/package.c | 70 ++--- dll/win32/msi/streams.c | 28 +- dll/win32/msi/suminfo.c | 111 -------- media/doc/README.WINE | 2 +- 14 files changed, 792 insertions(+), 1115 deletions(-)
diff --git a/dll/win32/msi/action.c b/dll/win32/msi/action.c index 98aaec49f3..c3a36eefac 100644 --- a/dll/win32/msi/action.c +++ b/dll/win32/msi/action.c @@ -139,13 +139,8 @@ static const WCHAR szValidateProductID[] = {'V','a','l','i','d','a','t','e','P','r','o','d','u','c','t','I','D',0}; static const WCHAR szWriteEnvironmentStrings[] = {'W','r','i','t','e','E','n','v','i','r','o','n','m','e','n','t','S','t','r','i','n','g','s',0}; - -struct dummy_thread -{ - HANDLE started; - HANDLE stopped; - HANDLE thread; -}; +static const WCHAR szINSTALL[] = + {'I','N','S','T','A','L','L',0};
static INT ui_actionstart(MSIPACKAGE *package, LPCWSTR action, LPCWSTR description, LPCWSTR template) { @@ -182,7 +177,11 @@ static void ui_actioninfo(MSIPACKAGE *package, LPCWSTR action, BOOL start, template = msi_get_error_message(package->db, start ? MSIERR_INFO_ACTIONSTART : MSIERR_INFO_ACTIONENDED);
row = MSI_CreateRecord(2); - if (!row) return; + if (!row) + { + msi_free(template); + return; + } MSI_RecordSetStringW(row, 0, template); MSI_RecordSetStringW(row, 1, action); MSI_RecordSetInteger(row, 2, start ? package->LastActionResult : rc); @@ -493,10 +492,7 @@ static UINT ITERATE_Actions(MSIRECORD *row, LPVOID param) return ERROR_SUCCESS; }
- if (needs_ui_sequence(package)) - rc = ACTION_PerformUIAction(package, action, SCRIPT_NONE); - else - rc = ACTION_PerformAction(package, action, SCRIPT_NONE); + rc = ACTION_PerformAction(package, action, SCRIPT_NONE);
msi_dialog_check_messages( NULL );
@@ -536,41 +532,26 @@ UINT MSI_Sequence( MSIPACKAGE *package, LPCWSTR table ) return r; }
-static UINT ACTION_ProcessExecSequence(MSIPACKAGE *package, BOOL UIran) +static UINT ACTION_ProcessExecSequence(MSIPACKAGE *package) { static const WCHAR query[] = { 'S','E','L','E','C','T',' ','*',' ', 'F','R','O','M',' ', '`','I','n','s','t','a','l','l','E','x','e','c','u','t','e', 'S','e','q','u','e','n','c','e','`',' ', 'W','H','E','R','E',' ', - '`','S','e','q','u','e','n','c','e','`',' ', '>',' ','%','i',' ', + '`','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}; - static const WCHAR query_validate[] = { - 'S','E','L','E','C','T',' ','`','S','e','q','u','e','n','c','e','`', - ' ', 'F','R','O','M',' ','`','I','n','s','t','a','l','l', - 'E','x','e','c','u','t','e','S','e','q','u','e','n','c','e','`',' ', - 'W','H','E','R','E',' ','`','A','c','t','i','o','n','`',' ','=', - ' ',''', 'I','n','s','t','a','l','l','V','a','l','i','d','a','t','e',''',0}; MSIQUERY *view; - INT seq = 0; UINT rc;
- if (package->script->ExecuteSequenceRun) + if (package->ExecuteSequenceRun) { TRACE("Execute Sequence already Run\n"); return ERROR_SUCCESS; }
- package->script->ExecuteSequenceRun = TRUE; + package->ExecuteSequenceRun = TRUE;
- /* get the sequence number */ - if (UIran) - { - MSIRECORD *row = MSI_QueryGetRecord(package->db, query_validate); - if (!row) return ERROR_FUNCTION_FAILED; - seq = MSI_RecordGetInteger(row,1); - msiobj_release(&row->hdr); - } - rc = MSI_OpenQuery(package->db, &view, query, seq); + rc = MSI_OpenQuery(package->db, &view, query); if (rc == ERROR_SUCCESS) { TRACE("Running the actions\n"); @@ -1541,39 +1522,36 @@ static UINT ACTION_CostInitialize(MSIPACKAGE *package) return ERROR_SUCCESS; }
-static UINT execute_script_action( MSIPACKAGE *package, UINT script, UINT index ) -{ - const WCHAR *action = package->script->Actions[script][index]; - ui_actionstart( package, action, NULL, NULL ); - TRACE("executing %s\n", debugstr_w(action)); - return ACTION_PerformAction( package, action, script ); -} - static UINT execute_script( MSIPACKAGE *package, UINT script ) { UINT i, rc = ERROR_SUCCESS;
TRACE("executing script %u\n", script);
- if (!package->script) - { - ERR("no script!\n"); - return ERROR_FUNCTION_FAILED; - } if (script == SCRIPT_ROLLBACK) { - for (i = package->script->ActionCount[script]; i > 0; i--) + for (i = package->script_actions_count[script]; i > 0; i--) { - rc = execute_script_action( package, script, i - 1 ); - if (rc != ERROR_SUCCESS) break; + rc = ACTION_PerformAction(package, package->script_actions[script][i-1], script); + if (rc != ERROR_SUCCESS) + { + ERR("Execution of script %i halted; action %s returned %u\n", + script, debugstr_w(package->script_actions[script][i-1]), rc); + break; + } } } else { - for (i = 0; i < package->script->ActionCount[script]; i++) + for (i = 0; i < package->script_actions_count[script]; i++) { - rc = execute_script_action( package, script, i ); - if (rc != ERROR_SUCCESS) break; + rc = ACTION_PerformAction(package, package->script_actions[script][i], script); + if (rc != ERROR_SUCCESS) + { + ERR("Execution of script %i halted; action %s returned %u\n", + script, debugstr_w(package->script_actions[script][i]), rc); + break; + } } } msi_free_action_script(package, script); @@ -1743,7 +1721,7 @@ static BOOL process_overrides( MSIPACKAGE *package, int level ) ret |= process_state_property( package, level, szReinstall, INSTALLSTATE_UNKNOWN ); ret |= process_state_property( package, level, szAdvertise, INSTALLSTATE_ADVERTISED );
- if (ret && !package->full_reinstall) + if (ret) msi_set_property( package->db, szPreselected, szOne, -1 );
return ret; @@ -1798,7 +1776,7 @@ UINT MSI_SetFeatureStates(MSIPACKAGE *package)
level = msi_get_property_int(package->db, szInstallLevel, 1);
- if (!msi_get_property_int( package->db, szPreselected, 0 )) + if (msi_get_property_int( package->db, szPreselected, 0 )) { LIST_FOR_EACH_ENTRY( feature, &package->features, MSIFEATURE, entry ) { @@ -1806,24 +1784,18 @@ UINT MSI_SetFeatureStates(MSIPACKAGE *package)
if (feature->ActionRequest == INSTALLSTATE_UNKNOWN) { - if (feature->Attributes & msidbFeatureAttributesFavorSource) - { - feature->Action = INSTALLSTATE_SOURCE; - feature->ActionRequest = INSTALLSTATE_SOURCE; - } - else if (feature->Attributes & msidbFeatureAttributesFavorAdvertise) + if (feature->Installed == INSTALLSTATE_ABSENT) { - feature->Action = INSTALLSTATE_ADVERTISED; - feature->ActionRequest = INSTALLSTATE_ADVERTISED; + feature->Action = INSTALLSTATE_UNKNOWN; + feature->ActionRequest = INSTALLSTATE_UNKNOWN; } else { - feature->Action = INSTALLSTATE_LOCAL; - feature->ActionRequest = INSTALLSTATE_LOCAL; + feature->Action = feature->Installed; + feature->ActionRequest = feature->Installed; } } } - /* disable child features of unselected parent or follow parent */ LIST_FOR_EACH_ENTRY( feature, &package->features, MSIFEATURE, entry ) { if (feature->Feature_Parent) continue; @@ -1831,7 +1803,7 @@ UINT MSI_SetFeatureStates(MSIPACKAGE *package) follow_parent( feature ); } } - else /* preselected */ + else if (!msi_get_property_int( package->db, szInstalled, 0 )) { LIST_FOR_EACH_ENTRY( feature, &package->features, MSIFEATURE, entry ) { @@ -1839,18 +1811,24 @@ UINT MSI_SetFeatureStates(MSIPACKAGE *package)
if (feature->ActionRequest == INSTALLSTATE_UNKNOWN) { - if (feature->Installed == INSTALLSTATE_ABSENT) + if (feature->Attributes & msidbFeatureAttributesFavorSource) { - feature->Action = INSTALLSTATE_UNKNOWN; - feature->ActionRequest = INSTALLSTATE_UNKNOWN; + feature->Action = INSTALLSTATE_SOURCE; + feature->ActionRequest = INSTALLSTATE_SOURCE; + } + else if (feature->Attributes & msidbFeatureAttributesFavorAdvertise) + { + feature->Action = INSTALLSTATE_ADVERTISED; + feature->ActionRequest = INSTALLSTATE_ADVERTISED; } else { - feature->Action = feature->Installed; - feature->ActionRequest = feature->Installed; + feature->Action = INSTALLSTATE_LOCAL; + feature->ActionRequest = INSTALLSTATE_LOCAL; } } } + /* disable child features of unselected parent or follow parent */ LIST_FOR_EACH_ENTRY( feature, &package->features, MSIFEATURE, entry ) { if (feature->Feature_Parent) continue; @@ -1906,6 +1884,14 @@ UINT MSI_SetFeatureStates(MSIPACKAGE *package) else component->hasLocalFeature = 1; break; + case INSTALLSTATE_UNKNOWN: + if (feature->Installed == INSTALLSTATE_ADVERTISED) + component->hasAdvertisedFeature = 1; + if (feature->Installed == INSTALLSTATE_SOURCE) + component->hasSourceFeature = 1; + if (feature->Installed == INSTALLSTATE_LOCAL) + component->hasLocalFeature = 1; + break; default: break; } @@ -4318,7 +4304,7 @@ static BOOL msi_check_publish(MSIPACKAGE *package) LIST_FOR_EACH_ENTRY(feature, &package->features, MSIFEATURE, entry) { feature->Action = msi_get_feature_action( package, feature ); - if (feature->Action == INSTALLSTATE_LOCAL) + if (feature->Action == INSTALLSTATE_LOCAL || feature->Action == INSTALLSTATE_SOURCE) return TRUE; }
@@ -5361,25 +5347,16 @@ static UINT ACTION_UnpublishProduct(MSIPACKAGE *package)
static BOOL is_full_uninstall( MSIPACKAGE *package ) { - WCHAR **features, *remove = msi_dup_property( package->db, szRemove ); MSIFEATURE *feature; - BOOL ret = TRUE; - UINT i;
LIST_FOR_EACH_ENTRY( feature, &package->features, MSIFEATURE, entry ) { - if (feature->Action == INSTALLSTATE_LOCAL) ret = FALSE; - } - - features = msi_split_string( remove, ',' ); - for (i = 0; features && features[i]; i++) - { - if (!strcmpW( features[i], szAll )) ret = TRUE; + if (feature->Action != INSTALLSTATE_ABSENT && + (feature->Installed != INSTALLSTATE_ABSENT || feature->Action != INSTALLSTATE_UNKNOWN)) + return FALSE; }
- msi_free(features); - msi_free(remove); - return ret; + return TRUE; }
static UINT ACTION_InstallFinalize(MSIPACKAGE *package) @@ -5559,16 +5536,154 @@ end: return rc; }
+static UINT iterate_properties(MSIRECORD *record, void *param) +{ + static const WCHAR prop_template[] = + {'P','r','o','p','e','r','t','y','(','S',')',':',' ','[','1',']',' ','=',' ','[','2',']',0}; + MSIRECORD *uirow; + + uirow = MSI_CloneRecord(record); + if (!uirow) return ERROR_OUTOFMEMORY; + MSI_RecordSetStringW(uirow, 0, prop_template); + MSI_ProcessMessage(param, INSTALLMESSAGE_INFO|MB_ICONHAND, uirow); + msiobj_release(&uirow->hdr); + + return ERROR_SUCCESS; +} +
static UINT ACTION_ExecuteAction(MSIPACKAGE *package) { + static const WCHAR prop_query[] = + {'S','E','L','E','C','T',' ','*',' ','F','R','O','M',' ','`','_','P','r','o','p','e','r','t','y','`',0}; + WCHAR *productname; + WCHAR *action; + WCHAR *info_template; + MSIQUERY *view; + MSIRECORD *uirow, *uirow_info; UINT rc;
- package->script->InWhatSequence |= SEQUENCE_EXEC; - rc = ACTION_ProcessExecSequence(package,FALSE); + /* Send COMMONDATA and INFO messages. */ + /* FIXME: when should these messages be sent? [see also MsiOpenPackage()] */ + uirow = MSI_CreateRecord(3); + if (!uirow) return ERROR_OUTOFMEMORY; + MSI_RecordSetStringW(uirow, 0, NULL); + MSI_RecordSetInteger(uirow, 1, 0); + MSI_RecordSetInteger(uirow, 2, package->num_langids ? package->langids[0] : 0); + MSI_RecordSetInteger(uirow, 3, msi_get_string_table_codepage(package->db->strings)); + MSI_ProcessMessageVerbatim(package, INSTALLMESSAGE_COMMONDATA, uirow); + /* FIXME: send INSTALLMESSAGE_PROGRESS */ + MSI_ProcessMessageVerbatim(package, INSTALLMESSAGE_COMMONDATA, uirow); + + if (!(needs_ui_sequence(package) && ui_sequence_exists(package))) + { + uirow_info = MSI_CreateRecord(0); + if (!uirow_info) + { + msiobj_release(&uirow->hdr); + return ERROR_OUTOFMEMORY; + } + info_template = msi_get_error_message(package->db, MSIERR_INFO_LOGGINGSTART); + MSI_RecordSetStringW(uirow_info, 0, info_template); + msi_free(info_template); + MSI_ProcessMessage(package, INSTALLMESSAGE_INFO|MB_ICONHAND, uirow_info); + msiobj_release(&uirow_info->hdr); + } + + MSI_ProcessMessage(package, INSTALLMESSAGE_COMMONDATA, uirow); + + productname = msi_dup_property(package->db, INSTALLPROPERTY_PRODUCTNAMEW); + MSI_RecordSetInteger(uirow, 1, 1); + MSI_RecordSetStringW(uirow, 2, productname); + MSI_RecordSetStringW(uirow, 3, NULL); + MSI_ProcessMessage(package, INSTALLMESSAGE_COMMONDATA, uirow); + msiobj_release(&uirow->hdr); + + package->LastActionResult = MSI_NULL_INTEGER; + + action = msi_dup_property(package->db, szEXECUTEACTION); + if (!action) action = msi_strdupW(szINSTALL, strlenW(szINSTALL)); + + /* Perform the action. Top-level actions trigger a sequence. */ + if (!strcmpW(action, szINSTALL)) + { + /* Send ACTIONSTART/INFO and INSTALLSTART. */ + ui_actionstart(package, szINSTALL, NULL, NULL); + ui_actioninfo(package, szINSTALL, TRUE, 0); + uirow = MSI_CreateRecord(2); + if (!uirow) + { + rc = ERROR_OUTOFMEMORY; + goto end; + } + MSI_RecordSetStringW(uirow, 0, NULL); + MSI_RecordSetStringW(uirow, 1, productname); + MSI_RecordSetStringW(uirow, 2, package->ProductCode); + MSI_ProcessMessage(package, INSTALLMESSAGE_INSTALLSTART, uirow); + msiobj_release(&uirow->hdr); + + /* Perform the installation. Always use the ExecuteSequence. */ + package->InWhatSequence |= SEQUENCE_EXEC; + rc = ACTION_ProcessExecSequence(package); + + /* Send return value and INSTALLEND. */ + ui_actioninfo(package, szINSTALL, FALSE, !rc); + uirow = MSI_CreateRecord(3); + if (!uirow) + { + rc = ERROR_OUTOFMEMORY; + goto end; + } + MSI_RecordSetStringW(uirow, 0, NULL); + MSI_RecordSetStringW(uirow, 1, productname); + MSI_RecordSetStringW(uirow, 2, package->ProductCode); + MSI_RecordSetInteger(uirow, 3, !rc); + MSI_ProcessMessage(package, INSTALLMESSAGE_INSTALLEND, uirow); + msiobj_release(&uirow->hdr); + } + else + rc = ACTION_PerformAction(package, action, SCRIPT_NONE); + + /* Send all set properties. */ + if (!MSI_OpenQuery(package->db, &view, prop_query)) + { + MSI_IterateRecords(view, NULL, iterate_properties, package); + msiobj_release(&view->hdr); + } + + /* And finally, toggle the cancel off and on. */ + uirow = MSI_CreateRecord(2); + if (!uirow) + { + rc = ERROR_OUTOFMEMORY; + goto end; + } + MSI_RecordSetStringW(uirow, 0, NULL); + MSI_RecordSetInteger(uirow, 1, 2); + MSI_RecordSetInteger(uirow, 2, 0); + MSI_ProcessMessageVerbatim(package, INSTALLMESSAGE_COMMONDATA, uirow); + MSI_RecordSetInteger(uirow, 2, 1); + MSI_ProcessMessageVerbatim(package, INSTALLMESSAGE_COMMONDATA, uirow); + msiobj_release(&uirow->hdr); + +end: + msi_free(productname); + msi_free(action); return rc; }
+static UINT ACTION_INSTALL(MSIPACKAGE *package) +{ + msi_set_property(package->db, szEXECUTEACTION, szINSTALL, -1); + if (needs_ui_sequence(package) && ui_sequence_exists(package)) + { + package->InWhatSequence |= SEQUENCE_UI; + return ACTION_ProcessUISequence(package); + } + else + return ACTION_ExecuteAction(package); +} + WCHAR *msi_create_component_advertise_string( MSIPACKAGE *package, MSICOMPONENT *component, const WCHAR *feature ) { static const WCHAR fmt[] = {'%','s','%','s','%','c','%','s',0}; @@ -7720,6 +7835,7 @@ StandardActions[] = { szWriteEnvironmentStrings, IDS_DESC_WRITEENVIRONMENTSTRINGS, IDS_TEMP_WRITEENVIRONMENTSTRINGS, ACTION_WriteEnvironmentStrings, szRemoveEnvironmentStrings }, { szWriteIniValues, IDS_DESC_WRITEINIVALUES, IDS_TEMP_WRITEINIVALUES, ACTION_WriteIniValues, szRemoveIniValues }, { szWriteRegistryValues, IDS_DESC_WRITEREGISTRYVALUES, IDS_TEMP_WRITEREGISTRYVALUES, ACTION_WriteRegistryValues, szRemoveRegistryValues }, + { szINSTALL, 0, 0, ACTION_INSTALL, NULL }, { 0 } };
@@ -7771,23 +7887,6 @@ UINT ACTION_PerformAction(MSIPACKAGE *package, const WCHAR *action, UINT script)
TRACE("Performing action (%s)\n", debugstr_w(action));
- rc = ACTION_HandleStandardAction(package, action); - - if (rc == ERROR_FUNCTION_NOT_CALLED) - rc = ACTION_HandleCustomAction(package, action, script); - - if (rc == ERROR_FUNCTION_NOT_CALLED) - WARN("unhandled msi action %s\n", debugstr_w(action)); - - return rc; -} - -UINT ACTION_PerformUIAction(MSIPACKAGE *package, const WCHAR *action, UINT script) -{ - UINT rc; - - TRACE("Performing action (%s)\n", debugstr_w(action)); - package->action_progress_increment = 0; rc = ACTION_HandleStandardAction(package, action);
@@ -7845,10 +7944,7 @@ static UINT ACTION_PerformActionSequence(MSIPACKAGE *package, UINT seq) return ERROR_FUNCTION_FAILED; }
- if (needs_ui_sequence(package)) - rc = ACTION_PerformUIAction(package, action, SCRIPT_NONE); - else - rc = ACTION_PerformAction(package, action, SCRIPT_NONE); + rc = ACTION_PerformAction(package, action, SCRIPT_NONE);
msiobj_release(&row->hdr); } @@ -7856,42 +7952,6 @@ static UINT ACTION_PerformActionSequence(MSIPACKAGE *package, UINT seq) return rc; }
-DWORD WINAPI dummy_thread_proc(void *arg) -{ - struct dummy_thread *info = arg; - HRESULT hr; - - hr = CoInitializeEx(0, COINIT_MULTITHREADED); - if (FAILED(hr)) ERR("CoInitializeEx failed %08x\n", hr); - - SetEvent(info->started); - WaitForSingleObject(info->stopped, INFINITE); - - CoUninitialize(); - return 0; -} - -static void start_dummy_thread(struct dummy_thread *info) -{ - if (!(info->started = CreateEventA(NULL, TRUE, FALSE, NULL))) return; - if (!(info->stopped = CreateEventA(NULL, TRUE, FALSE, NULL))) return; - if (!(info->thread = CreateThread(NULL, 0, dummy_thread_proc, info, 0, NULL))) return; - - WaitForSingleObject(info->started, INFINITE); -} - -static void stop_dummy_thread(struct dummy_thread *info) -{ - if (info->thread) - { - SetEvent(info->stopped); - WaitForSingleObject(info->thread, INFINITE); - CloseHandle(info->thread); - } - if (info->started) CloseHandle(info->started); - if (info->stopped) CloseHandle(info->stopped); -} - /**************************************************** * TOP level entry points *****************************************************/ @@ -7901,15 +7961,9 @@ UINT MSI_InstallPackage( MSIPACKAGE *package, LPCWSTR szPackagePath, { static const WCHAR szDisableRollback[] = {'D','I','S','A','B','L','E','R','O','L','L','B','A','C','K',0}; static const WCHAR szAction[] = {'A','C','T','I','O','N',0}; - static const WCHAR szInstall[] = {'I','N','S','T','A','L','L',0}; - WCHAR *reinstall, *remove, *patch, *productcode; - struct dummy_thread thread_info = {NULL, NULL, NULL}; - BOOL ui_exists; + WCHAR *reinstall = NULL, *productcode, *action; UINT rc; - - msi_set_property( package->db, szAction, szInstall, -1 ); - - package->script->InWhatSequence = SEQUENCE_INSTALL; + DWORD len = 0;
if (szPackagePath) { @@ -7954,23 +8008,16 @@ UINT MSI_InstallPackage( MSIPACKAGE *package, LPCWSTR szPackagePath, msi_apply_transforms( package ); msi_apply_patches( package );
- patch = msi_dup_property( package->db, szPatch ); - remove = msi_dup_property( package->db, szRemove ); - reinstall = msi_dup_property( package->db, szReinstall ); - if (msi_get_property_int( package->db, szInstalled, 0 ) && !remove && !reinstall && !patch) - { - TRACE("setting REINSTALL property to ALL\n"); - msi_set_property( package->db, szReinstall, szAll, -1 ); - package->full_reinstall = 1; - } + if (msi_get_property( package->db, szAction, NULL, &len )) + msi_set_property( package->db, szAction, szINSTALL, -1 ); + action = msi_dup_property( package->db, szAction ); + CharUpperW(action);
msi_set_original_database_property( package->db, szPackagePath ); msi_parse_command_line( package, szCommandLine, FALSE ); msi_adjust_privilege_properties( package ); msi_set_context( package );
- start_dummy_thread(&thread_info); - productcode = msi_dup_property( package->db, szProductCode ); if (strcmpiW( productcode, package->ProductCode )) { @@ -7986,19 +8033,7 @@ UINT MSI_InstallPackage( MSIPACKAGE *package, LPCWSTR szPackagePath, msi_set_property( package->db, szRollbackDisabled, szOne, -1 ); }
- if (needs_ui_sequence( package)) - { - package->script->InWhatSequence |= SEQUENCE_UI; - rc = ACTION_ProcessUISequence(package); - ui_exists = ui_sequence_exists(package); - if (rc == ERROR_SUCCESS || !ui_exists) - { - package->script->InWhatSequence |= SEQUENCE_EXEC; - rc = ACTION_ProcessExecSequence(package, ui_exists); - } - } - else - rc = ACTION_ProcessExecSequence(package, FALSE); + rc = ACTION_PerformAction(package, action, SCRIPT_NONE);
/* process the ending type action */ if (rc == ERROR_SUCCESS) @@ -8019,16 +8054,13 @@ UINT MSI_InstallPackage( MSIPACKAGE *package, LPCWSTR szPackagePath, /* finish up running custom actions */ ACTION_FinishCustomActions(package);
- stop_dummy_thread(&thread_info); - - if (package->need_rollback && !reinstall) + if (package->need_rollback && !(reinstall = msi_dup_property( package->db, szReinstall ))) { WARN("installation failed, running rollback script\n"); execute_script( package, SCRIPT_ROLLBACK ); } msi_free( reinstall ); - msi_free( remove ); - msi_free( patch ); + msi_free( action );
if (rc == ERROR_SUCCESS && package->need_reboot_at_end) return ERROR_SUCCESS_REBOOT_REQUIRED; diff --git a/dll/win32/msi/appsearch.c b/dll/win32/msi/appsearch.c index e27fa74540..8f2df294b4 100644 --- a/dll/win32/msi/appsearch.c +++ b/dll/win32/msi/appsearch.c @@ -493,7 +493,7 @@ static LPWSTR get_ini_field(LPWSTR buf, int field) while ((end = strchrW(beg, ',')) && i < field) { beg = end + 1; - while (*beg && *beg == ' ') + while (*beg == ' ') beg++;
i++; diff --git a/dll/win32/msi/cond.tab.c b/dll/win32/msi/cond.tab.c index 61ca113369..122f92a153 100644 --- a/dll/win32/msi/cond.tab.c +++ b/dll/win32/msi/cond.tab.c @@ -1,4 +1,4 @@ -/* A Bison parser, made by GNU Bison 3.0.2. */ +/* A Bison parser, made by GNU Bison 3.0. */
/* Bison implementation for Yacc-like parsers in C
@@ -44,7 +44,7 @@ #define YYBISON 1
/* Bison version. */ -#define YYBISON_VERSION "3.0.2" +#define YYBISON_VERSION "3.0"
/* Skeleton name. */ #define YYSKELETON_NAME "yacc.c" @@ -109,6 +109,18 @@ struct cond_str { INT len; };
+struct value { + enum value_type { + VALUE_INTEGER, + VALUE_LITERAL, + VALUE_SYMBOL + } type; + union { + INT integer; + WCHAR *string; + } u; +}; + 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); @@ -121,16 +133,6 @@ static void cond_free( void *ptr ); static INT compare_int( INT a, INT operator, INT b ); static INT compare_string( LPCWSTR a, INT operator, LPCWSTR b, BOOL convert );
-static INT compare_and_free_strings( LPWSTR a, INT op, LPWSTR b, BOOL convert ) -{ - INT r; - - r = compare_string( a, op, b, convert ); - cond_free( a ); - cond_free( b ); - return r; -} - static BOOL num_from_prop( LPCWSTR p, INT *val ) { INT ret = 0, sign = 1; @@ -155,14 +157,20 @@ static BOOL num_from_prop( LPCWSTR p, INT *val ) return TRUE; }
+static void value_free( struct value val ) +{ + if (val.type != VALUE_INTEGER) + cond_free( val.u.string ); +} +
-#line 180 "cond.tab.c" /* yacc.c:339 */ +#line 168 "cond.tab.c" /* yacc.c:339 */
-# ifndef YY_NULLPTR +# ifndef YY_NULL # if defined __cplusplus && 201103L <= __cplusplus -# define YY_NULLPTR nullptr +# define YY_NULL nullptr # else -# define YY_NULLPTR 0 +# define YY_NULL 0 # endif # endif
@@ -174,7 +182,10 @@ static BOOL num_from_prop( LPCWSTR p, INT *val ) # define YYERROR_VERBOSE 0 #endif
- +/* In a future release of Bison, this section will be replaced + by #include "cond.tab.h". */ +#ifndef YY_COND_E_REACTOSSYNC3_0_GCC_DLL_WIN32_MSI_COND_TAB_H_INCLUDED +# define YY_COND_E_REACTOSSYNC3_0_GCC_DLL_WIN32_MSI_COND_TAB_H_INCLUDED /* Debug traces. */ #ifndef YYDEBUG # define YYDEBUG 0 @@ -234,13 +245,15 @@ extern int cond_debug; typedef union YYSTYPE YYSTYPE; union YYSTYPE { -#line 114 "cond.y" /* yacc.c:355 */ +#line 102 "cond.y" /* yacc.c:355 */
struct cond_str str; - LPWSTR string; - INT value; + struct value value; + LPWSTR identifier; + INT operator; + BOOL bool;
-#line 264 "cond.tab.c" /* yacc.c:355 */ +#line 257 "cond.tab.c" /* yacc.c:355 */ }; # define YYSTYPE_IS_TRIVIAL 1 # define YYSTYPE_IS_DECLARED 1 @@ -250,11 +263,11 @@ union YYSTYPE
int cond_parse (COND_input *info);
- +#endif /* !YY_COND_E_REACTOSSYNC3_0_GCC_DLL_WIN32_MSI_COND_TAB_H_INCLUDED */
/* Copy the second part of user declarations. */
-#line 278 "cond.tab.c" /* yacc.c:358 */ +#line 271 "cond.tab.c" /* yacc.c:358 */
#ifdef short # undef short @@ -311,30 +324,11 @@ typedef short int yytype_int16; # endif #endif
-#ifndef YY_ATTRIBUTE -# if (defined __GNUC__ \ - && (2 < __GNUC__ || (__GNUC__ == 2 && 96 <= __GNUC_MINOR__))) \ - || defined __SUNPRO_C && 0x5110 <= __SUNPRO_C -# define YY_ATTRIBUTE(Spec) __attribute__(Spec) -# else -# define YY_ATTRIBUTE(Spec) /* empty */ -# endif -#endif - -#ifndef YY_ATTRIBUTE_PURE -# define YY_ATTRIBUTE_PURE YY_ATTRIBUTE ((__pure__)) -#endif - -#ifndef YY_ATTRIBUTE_UNUSED -# define YY_ATTRIBUTE_UNUSED YY_ATTRIBUTE ((__unused__)) -#endif - -#if !defined _Noreturn \ - && (!defined __STDC_VERSION__ || __STDC_VERSION__ < 201112) -# if defined _MSC_VER && 1200 <= _MSC_VER -# define _Noreturn __declspec (noreturn) -# else -# define _Noreturn YY_ATTRIBUTE ((__noreturn__)) +#ifndef __attribute__ +/* This feature is available in gcc versions 2.5 and later. */ +# if (! defined __GNUC__ || __GNUC__ < 2 \ + || (__GNUC__ == 2 && __GNUC_MINOR__ < 5)) +# define __attribute__(Spec) /* empty */ # endif #endif
@@ -494,18 +488,18 @@ union yyalloc #endif /* !YYCOPY_NEEDED */
/* YYFINAL -- State number of the termination state. */ -#define YYFINAL 28 +#define YYFINAL 24 /* YYLAST -- Last index in YYTABLE. */ -#define YYLAST 71 +#define YYLAST 67
/* YYNTOKENS -- Number of terminals. */ #define YYNTOKENS 41 /* YYNNTS -- Number of nonterminals. */ -#define YYNNTS 12 +#define YYNNTS 8 /* YYNRULES -- Number of rules. */ -#define YYNRULES 53 +#define YYNRULES 41 /* YYNSTATES -- Number of states. */ -#define YYNSTATES 70 +#define YYNSTATES 56
/* YYTRANSLATE[YYX] -- Symbol number corresponding to YYX as returned by yylex, with out-of-bounds checking. */ @@ -555,12 +549,11 @@ static const yytype_uint8 yytranslate[] = /* YYRLINE[YYN] -- Source line where rule number YYN was defined. */ static const yytype_uint16 yyrline[] = { - 0, 138, 138, 144, 151, 155, 159, 163, 167, 174, - 178, 185, 189, 193, 198, 202, 211, 220, 224, 228, - 232, 236, 241, 246, 254, 255, 256, 257, 258, 259, - 260, 261, 262, 263, 264, 265, 266, 267, 268, 269, - 270, 271, 275, 279, 286, 296, 300, 309, 318, 331, - 343, 356, 373, 383 + 0, 129, 129, 135, 142, 146, 150, 154, 158, 165, + 169, 176, 180, 188, 223, 231, 232, 233, 234, 235, + 236, 237, 238, 239, 240, 241, 242, 243, 244, 245, + 246, 247, 248, 252, 266, 281, 289, 299, 316, 333, + 350, 370 }; #endif
@@ -577,8 +570,8 @@ static const char *const yytname[] = "COND_IRHS", "COND_LHS", "COND_RHS", "COND_PERCENT", "COND_DOLLARS", "COND_QUESTION", "COND_AMPER", "COND_EXCLAM", "COND_IDENT", "COND_NUMBER", "COND_LITER", "COND_ERROR", "$accept", "condition", - "expression", "boolean_term", "boolean_factor", "operator", "value_s", - "literal", "value_i", "symbol_s", "identifier", "integer", YY_NULLPTR + "expression", "boolean_term", "boolean_factor", "operator", "value", + "identifier", YY_NULL }; #endif
@@ -595,10 +588,10 @@ static const yytype_uint16 yytoknum[] = }; # endif
-#define YYPACT_NINF -15 +#define YYPACT_NINF -45
#define yypact_value_is_default(Yystate) \ - (!!((Yystate) == (-15))) + (!!((Yystate) == (-45)))
#define YYTABLE_NINF -1
@@ -609,13 +602,12 @@ static const yytype_uint16 yytoknum[] = STATE-NUM. */ static const yytype_int8 yypact[] = { - -7, -7, -7, -14, -14, -14, -14, -14, -15, -15, - -15, 24, 46, 30, -15, -15, -9, -9, -9, -15, - -15, -15, 29, -15, -15, -15, -15, -15, -15, -7, - -7, -7, -7, -7, -15, -15, -15, -15, -15, -15, - -15, -15, -15, -15, -15, -15, -15, -15, -15, -15, - -15, -15, 8, 8, 8, -15, 30, 30, 30, 30, - -15, -15, -15, -15, -15, -15, -15, -15, -15, -15 + -7, -7, -7, -36, -36, -36, -36, -36, -45, -45, + -45, 2, 5, 3, -45, 23, -45, -45, -2, -45, + -45, -45, -45, -45, -45, -7, -7, -7, -7, -7, + -45, -45, -45, -45, -45, -45, -45, -45, -45, -45, + -45, -45, -45, -45, -45, -45, -45, -45, 24, -45, + 3, 3, 3, 3, -45, -45 };
/* YYDEFACT[STATE-NUM] -- Default reduction number in state STATE-NUM. @@ -623,27 +615,24 @@ static const yytype_int8 yypact[] = means the default is an error. */ static const yytype_uint8 yydefact[] = { - 3, 0, 0, 0, 0, 0, 0, 0, 52, 53, - 44, 0, 2, 4, 9, 13, 43, 12, 42, 50, - 45, 11, 0, 51, 46, 47, 48, 49, 1, 0, - 0, 0, 0, 0, 26, 27, 24, 25, 29, 28, - 33, 34, 31, 32, 36, 35, 30, 37, 40, 41, - 38, 39, 0, 0, 0, 23, 5, 7, 6, 8, - 10, 20, 21, 19, 22, 14, 16, 18, 15, 17 + 3, 0, 0, 0, 0, 0, 0, 0, 41, 36, + 35, 0, 2, 4, 9, 12, 33, 11, 0, 34, + 37, 38, 39, 40, 1, 0, 0, 0, 0, 0, + 17, 18, 15, 16, 20, 19, 24, 25, 22, 23, + 27, 26, 21, 28, 31, 32, 29, 30, 0, 14, + 5, 7, 6, 8, 10, 13 };
/* YYPGOTO[NTERM-NUM]. */ static const yytype_int8 yypgoto[] = { - -15, -15, 50, 33, 0, -3, -15, -4, 14, 17, - 54, -15 + -45, -45, 9, 39, 4, -45, -44, 14 };
/* YYDEFGOTO[NTERM-NUM]. */ static const yytype_int8 yydefgoto[] = { - -1, 11, 12, 13, 14, 52, 15, 16, 17, 18, - 19, 20 + -1, 11, 12, 13, 14, 48, 15, 16 };
/* YYTABLE[YYPACT[STATE-NUM]] -- What to do in state STATE-NUM. If @@ -651,26 +640,24 @@ static const yytype_int8 yydefgoto[] = number is the opposite. If YYTABLE_NINF, syntax error. */ static const yytype_uint8 yytable[] = { - 1, 21, 34, 35, 36, 37, 38, 39, 40, 41, - 42, 43, 44, 45, 53, 54, 2, 46, 47, 48, - 49, 50, 51, 8, 28, 3, 4, 5, 6, 7, - 8, 9, 10, 60, 29, 0, 33, 30, 31, 32, - 3, 4, 5, 6, 7, 8, 9, 10, 61, 64, - 67, 29, 22, 55, 30, 31, 32, 23, 24, 25, - 26, 27, 56, 57, 58, 59, 62, 65, 68, 63, - 66, 69 + 1, 8, 24, 25, 55, 17, 26, 27, 28, 29, + 25, 18, 0, 26, 27, 28, 2, 19, 20, 21, + 22, 23, 49, 0, 0, 3, 4, 5, 6, 7, + 8, 9, 10, 54, 30, 31, 32, 33, 34, 35, + 36, 37, 38, 39, 40, 41, 0, 0, 0, 42, + 43, 44, 45, 46, 47, 0, 3, 4, 5, 6, + 7, 8, 9, 10, 50, 51, 52, 53 };
static const yytype_int8 yycheck[] = { - 7, 1, 11, 12, 13, 14, 15, 16, 17, 18, - 19, 20, 21, 22, 17, 18, 23, 26, 27, 28, - 29, 30, 31, 37, 0, 32, 33, 34, 35, 36, - 37, 38, 39, 33, 5, -1, 6, 8, 9, 10, - 32, 33, 34, 35, 36, 37, 38, 39, 52, 53, - 54, 5, 2, 24, 8, 9, 10, 3, 4, 5, - 6, 7, 29, 30, 31, 32, 52, 53, 54, 52, - 53, 54 + 7, 37, 0, 5, 48, 1, 8, 9, 10, 6, + 5, 2, -1, 8, 9, 10, 23, 3, 4, 5, + 6, 7, 24, -1, -1, 32, 33, 34, 35, 36, + 37, 38, 39, 29, 11, 12, 13, 14, 15, 16, + 17, 18, 19, 20, 21, 22, -1, -1, -1, 26, + 27, 28, 29, 30, 31, -1, 32, 33, 34, 35, + 36, 37, 38, 39, 25, 26, 27, 28 };
/* YYSTOS[STATE-NUM] -- The (internal number of the) accessing @@ -678,34 +665,31 @@ static const yytype_int8 yycheck[] = static const yytype_uint8 yystos[] = { 0, 7, 23, 32, 33, 34, 35, 36, 37, 38, - 39, 42, 43, 44, 45, 47, 48, 49, 50, 51, - 52, 45, 43, 51, 51, 51, 51, 51, 0, 5, - 8, 9, 10, 6, 11, 12, 13, 14, 15, 16, - 17, 18, 19, 20, 21, 22, 26, 27, 28, 29, - 30, 31, 46, 46, 46, 24, 44, 44, 44, 44, - 45, 48, 49, 50, 48, 49, 50, 48, 49, 50 + 39, 42, 43, 44, 45, 47, 48, 45, 43, 48, + 48, 48, 48, 48, 0, 5, 8, 9, 10, 6, + 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, + 21, 22, 26, 27, 28, 29, 30, 31, 46, 24, + 44, 44, 44, 44, 45, 47 };
/* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */ static const yytype_uint8 yyr1[] = { 0, 41, 42, 42, 43, 43, 43, 43, 43, 44, - 44, 45, 45, 45, 45, 45, 45, 45, 45, 45, - 45, 45, 45, 45, 46, 46, 46, 46, 46, 46, + 44, 45, 45, 45, 45, 46, 46, 46, 46, 46, 46, 46, 46, 46, 46, 46, 46, 46, 46, 46, - 46, 46, 47, 47, 48, 49, 49, 49, 49, 49, - 50, 50, 51, 52 + 46, 46, 46, 47, 47, 47, 47, 47, 47, 47, + 47, 48 };
/* YYR2[YYN] -- Number of symbols on the right hand side of rule YYN. */ static const yytype_uint8 yyr2[] = { 0, 2, 1, 0, 1, 3, 3, 3, 3, 1, - 3, 2, 1, 1, 3, 3, 3, 3, 3, 3, - 3, 3, 3, 3, 1, 1, 1, 1, 1, 1, + 3, 2, 1, 3, 3, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, - 1, 2, 1, 1 + 1, 1, 1, 1, 2, 1, 1, 2, 2, 2, + 2, 1 };
@@ -990,11 +974,11 @@ static int yysyntax_error (YYSIZE_T *yymsg_alloc, char **yymsg, yytype_int16 *yyssp, int yytoken) { - YYSIZE_T yysize0 = yytnamerr (YY_NULLPTR, yytname[yytoken]); + YYSIZE_T yysize0 = yytnamerr (YY_NULL, yytname[yytoken]); YYSIZE_T yysize = yysize0; enum { YYERROR_VERBOSE_ARGS_MAXIMUM = 5 }; /* Internationalized format string. */ - const char *yyformat = YY_NULLPTR; + const char *yyformat = YY_NULL; /* Arguments of yyformat. */ char const *yyarg[YYERROR_VERBOSE_ARGS_MAXIMUM]; /* Number of reported tokens (one for the "unexpected", one per @@ -1051,7 +1035,7 @@ yysyntax_error (YYSIZE_T *yymsg_alloc, char **yymsg, } yyarg[yycount++] = yytname[yyx]; { - YYSIZE_T yysize1 = yysize + yytnamerr (YY_NULLPTR, yytname[yyx]); + YYSIZE_T yysize1 = yysize + yytnamerr (YY_NULL, yytname[yyx]); if (! (yysize <= yysize1 && yysize1 <= YYSTACK_ALLOC_MAXIMUM)) return 2; @@ -1388,456 +1372,414 @@ yyreduce: switch (yyn) { case 2: -#line 139 "cond.y" /* yacc.c:1646 */ +#line 130 "cond.y" /* yacc.c:1646 */ { COND_input* cond = (COND_input*) info; - cond->result = (yyvsp[0].value); + cond->result = (yyvsp[0].bool); } -#line 1417 "cond.tab.c" /* yacc.c:1646 */ +#line 1381 "E:/reactosSync3.0_gcc/dll/win32/msi/cond.tab.c" /* yacc.c:1646 */ break;
case 3: -#line 144 "cond.y" /* yacc.c:1646 */ +#line 135 "cond.y" /* yacc.c:1646 */ { COND_input* cond = (COND_input*) info; cond->result = MSICONDITION_NONE; } -#line 1426 "cond.tab.c" /* yacc.c:1646 */ +#line 1390 "E:/reactosSync3.0_gcc/dll/win32/msi/cond.tab.c" /* yacc.c:1646 */ break;
case 4: -#line 152 "cond.y" /* yacc.c:1646 */ +#line 143 "cond.y" /* yacc.c:1646 */ { - (yyval.value) = (yyvsp[0].value); + (yyval.bool) = (yyvsp[0].bool); } -#line 1434 "cond.tab.c" /* yacc.c:1646 */ +#line 1398 "E:/reactosSync3.0_gcc/dll/win32/msi/cond.tab.c" /* yacc.c:1646 */ break;
case 5: -#line 156 "cond.y" /* yacc.c:1646 */ +#line 147 "cond.y" /* yacc.c:1646 */ { - (yyval.value) = (yyvsp[-2].value) || (yyvsp[0].value); + (yyval.bool) = (yyvsp[-2].bool) || (yyvsp[0].bool); } -#line 1442 "cond.tab.c" /* yacc.c:1646 */ +#line 1406 "E:/reactosSync3.0_gcc/dll/win32/msi/cond.tab.c" /* yacc.c:1646 */ break;
case 6: -#line 160 "cond.y" /* yacc.c:1646 */ +#line 151 "cond.y" /* yacc.c:1646 */ { - (yyval.value) = !(yyvsp[-2].value) || (yyvsp[0].value); + (yyval.bool) = !(yyvsp[-2].bool) || (yyvsp[0].bool); } -#line 1450 "cond.tab.c" /* yacc.c:1646 */ +#line 1414 "E:/reactosSync3.0_gcc/dll/win32/msi/cond.tab.c" /* yacc.c:1646 */ break;
case 7: -#line 164 "cond.y" /* yacc.c:1646 */ +#line 155 "cond.y" /* yacc.c:1646 */ { - (yyval.value) = ( (yyvsp[-2].value) || (yyvsp[0].value) ) && !( (yyvsp[-2].value) && (yyvsp[0].value) ); + (yyval.bool) = ( (yyvsp[-2].bool) || (yyvsp[0].bool) ) && !( (yyvsp[-2].bool) && (yyvsp[0].bool) ); } -#line 1458 "cond.tab.c" /* yacc.c:1646 */ +#line 1422 "E:/reactosSync3.0_gcc/dll/win32/msi/cond.tab.c" /* yacc.c:1646 */ break;
case 8: -#line 168 "cond.y" /* yacc.c:1646 */ +#line 159 "cond.y" /* yacc.c:1646 */ { - (yyval.value) = ( (yyvsp[-2].value) && (yyvsp[0].value) ) || ( !(yyvsp[-2].value) && !(yyvsp[0].value) ); + (yyval.bool) = ( (yyvsp[-2].bool) && (yyvsp[0].bool) ) || ( !(yyvsp[-2].bool) && !(yyvsp[0].bool) ); } -#line 1466 "cond.tab.c" /* yacc.c:1646 */ +#line 1430 "E:/reactosSync3.0_gcc/dll/win32/msi/cond.tab.c" /* yacc.c:1646 */ break;
case 9: -#line 175 "cond.y" /* yacc.c:1646 */ +#line 166 "cond.y" /* yacc.c:1646 */ { - (yyval.value) = (yyvsp[0].value); + (yyval.bool) = (yyvsp[0].bool); } -#line 1474 "cond.tab.c" /* yacc.c:1646 */ +#line 1438 "E:/reactosSync3.0_gcc/dll/win32/msi/cond.tab.c" /* yacc.c:1646 */ break;
case 10: -#line 179 "cond.y" /* yacc.c:1646 */ +#line 170 "cond.y" /* yacc.c:1646 */ { - (yyval.value) = (yyvsp[-2].value) && (yyvsp[0].value); + (yyval.bool) = (yyvsp[-2].bool) && (yyvsp[0].bool); } -#line 1482 "cond.tab.c" /* yacc.c:1646 */ +#line 1446 "E:/reactosSync3.0_gcc/dll/win32/msi/cond.tab.c" /* yacc.c:1646 */ break;
case 11: -#line 186 "cond.y" /* yacc.c:1646 */ +#line 177 "cond.y" /* yacc.c:1646 */ { - (yyval.value) = (yyvsp[0].value) ? 0 : 1; + (yyval.bool) = !(yyvsp[0].bool); } -#line 1490 "cond.tab.c" /* yacc.c:1646 */ +#line 1454 "E:/reactosSync3.0_gcc/dll/win32/msi/cond.tab.c" /* yacc.c:1646 */ break;
case 12: -#line 190 "cond.y" /* yacc.c:1646 */ +#line 181 "cond.y" /* yacc.c:1646 */ { - (yyval.value) = (yyvsp[0].value) ? 1 : 0; + if ((yyvsp[0].value).type == VALUE_INTEGER) + (yyval.bool) = (yyvsp[0].value).u.integer ? 1 : 0; + else + (yyval.bool) = (yyvsp[0].value).u.string && (yyvsp[0].value).u.string[0]; + value_free( (yyvsp[0].value) ); } -#line 1498 "cond.tab.c" /* yacc.c:1646 */ +#line 1466 "E:/reactosSync3.0_gcc/dll/win32/msi/cond.tab.c" /* yacc.c:1646 */ break;
case 13: -#line 194 "cond.y" /* yacc.c:1646 */ +#line 189 "cond.y" /* yacc.c:1646 */ { - (yyval.value) = ((yyvsp[0].string) && (yyvsp[0].string)[0]) ? 1 : 0; - cond_free( (yyvsp[0].string) ); + if ((yyvsp[-2].value).type == VALUE_INTEGER && (yyvsp[0].value).type == VALUE_INTEGER) + { + (yyval.bool) = compare_int((yyvsp[-2].value).u.integer, (yyvsp[-1].operator), (yyvsp[0].value).u.integer); + } + else if ((yyvsp[-2].value).type != VALUE_INTEGER && (yyvsp[0].value).type != VALUE_INTEGER) + { + (yyval.bool) = compare_string((yyvsp[-2].value).u.string, (yyvsp[-1].operator), (yyvsp[0].value).u.string, + (yyvsp[-2].value).type == VALUE_SYMBOL || (yyvsp[0].value).type == VALUE_SYMBOL); + } + else if ((yyvsp[-2].value).type == VALUE_LITERAL || (yyvsp[0].value).type == VALUE_LITERAL) + { + (yyval.bool) = FALSE; + } + else if ((yyvsp[-2].value).type == VALUE_SYMBOL) /* symbol operator integer */ + { + int num; + if (num_from_prop( (yyvsp[-2].value).u.string, &num )) + (yyval.bool) = compare_int( num, (yyvsp[-1].operator), (yyvsp[0].value).u.integer ); + else + (yyval.bool) = ((yyvsp[-1].operator) == COND_NE || (yyvsp[-1].operator) == COND_INE ); + } + else /* integer operator symbol */ + { + int num; + if (num_from_prop( (yyvsp[0].value).u.string, &num )) + (yyval.bool) = compare_int( (yyvsp[-2].value).u.integer, (yyvsp[-1].operator), num ); + else + (yyval.bool) = ((yyvsp[-1].operator) == COND_NE || (yyvsp[-1].operator) == COND_INE ); + } + + value_free( (yyvsp[-2].value) ); + value_free( (yyvsp[0].value) ); } -#line 1507 "cond.tab.c" /* yacc.c:1646 */ +#line 1505 "E:/reactosSync3.0_gcc/dll/win32/msi/cond.tab.c" /* yacc.c:1646 */ break;
case 14: -#line 199 "cond.y" /* yacc.c:1646 */ +#line 224 "cond.y" /* yacc.c:1646 */ { - (yyval.value) = compare_int( (yyvsp[-2].value), (yyvsp[-1].value), (yyvsp[0].value) ); + (yyval.bool) = (yyvsp[-1].bool); } -#line 1515 "cond.tab.c" /* yacc.c:1646 */ +#line 1513 "E:/reactosSync3.0_gcc/dll/win32/msi/cond.tab.c" /* yacc.c:1646 */ break;
case 15: -#line 203 "cond.y" /* yacc.c:1646 */ - { - int num; - if (num_from_prop( (yyvsp[-2].string), &num )) - (yyval.value) = compare_int( num, (yyvsp[-1].value), (yyvsp[0].value) ); - else - (yyval.value) = ((yyvsp[-1].value) == COND_NE || (yyvsp[-1].value) == COND_INE ); - cond_free( (yyvsp[-2].string) ); - } -#line 1528 "cond.tab.c" /* yacc.c:1646 */ +#line 231 "cond.y" /* yacc.c:1646 */ + { (yyval.operator) = COND_EQ; } +#line 1519 "E:/reactosSync3.0_gcc/dll/win32/msi/cond.tab.c" /* yacc.c:1646 */ break;
case 16: -#line 212 "cond.y" /* yacc.c:1646 */ - { - int num; - if (num_from_prop( (yyvsp[0].string), &num )) - (yyval.value) = compare_int( (yyvsp[-2].value), (yyvsp[-1].value), num ); - else - (yyval.value) = ((yyvsp[-1].value) == COND_NE || (yyvsp[-1].value) == COND_INE ); - cond_free( (yyvsp[0].string) ); - } -#line 1541 "cond.tab.c" /* yacc.c:1646 */ +#line 232 "cond.y" /* yacc.c:1646 */ + { (yyval.operator) = COND_NE; } +#line 1525 "E:/reactosSync3.0_gcc/dll/win32/msi/cond.tab.c" /* yacc.c:1646 */ break;
case 17: -#line 221 "cond.y" /* yacc.c:1646 */ - { - (yyval.value) = compare_and_free_strings( (yyvsp[-2].string), (yyvsp[-1].value), (yyvsp[0].string), TRUE ); - } -#line 1549 "cond.tab.c" /* yacc.c:1646 */ +#line 233 "cond.y" /* yacc.c:1646 */ + { (yyval.operator) = COND_LT; } +#line 1531 "E:/reactosSync3.0_gcc/dll/win32/msi/cond.tab.c" /* yacc.c:1646 */ break;
case 18: -#line 225 "cond.y" /* yacc.c:1646 */ - { - (yyval.value) = compare_and_free_strings( (yyvsp[-2].string), (yyvsp[-1].value), (yyvsp[0].string), TRUE ); - } -#line 1557 "cond.tab.c" /* yacc.c:1646 */ +#line 234 "cond.y" /* yacc.c:1646 */ + { (yyval.operator) = COND_GT; } +#line 1537 "E:/reactosSync3.0_gcc/dll/win32/msi/cond.tab.c" /* yacc.c:1646 */ break;
case 19: -#line 229 "cond.y" /* yacc.c:1646 */ - { - (yyval.value) = compare_and_free_strings( (yyvsp[-2].string), (yyvsp[-1].value), (yyvsp[0].string), TRUE ); - } -#line 1565 "cond.tab.c" /* yacc.c:1646 */ +#line 235 "cond.y" /* yacc.c:1646 */ + { (yyval.operator) = COND_LE; } +#line 1543 "E:/reactosSync3.0_gcc/dll/win32/msi/cond.tab.c" /* yacc.c:1646 */ break;
case 20: -#line 233 "cond.y" /* yacc.c:1646 */ - { - (yyval.value) = compare_and_free_strings( (yyvsp[-2].string), (yyvsp[-1].value), (yyvsp[0].string), FALSE ); - } -#line 1573 "cond.tab.c" /* yacc.c:1646 */ +#line 236 "cond.y" /* yacc.c:1646 */ + { (yyval.operator) = COND_GE; } +#line 1549 "E:/reactosSync3.0_gcc/dll/win32/msi/cond.tab.c" /* yacc.c:1646 */ break;
case 21: #line 237 "cond.y" /* yacc.c:1646 */ - { - (yyval.value) = 0; - cond_free( (yyvsp[-2].string) ); - } -#line 1582 "cond.tab.c" /* yacc.c:1646 */ + { (yyval.operator) = COND_SS; } +#line 1555 "E:/reactosSync3.0_gcc/dll/win32/msi/cond.tab.c" /* yacc.c:1646 */ break;
case 22: -#line 242 "cond.y" /* yacc.c:1646 */ - { - (yyval.value) = 0; - cond_free( (yyvsp[0].string) ); - } -#line 1591 "cond.tab.c" /* yacc.c:1646 */ +#line 238 "cond.y" /* yacc.c:1646 */ + { (yyval.operator) = COND_IEQ; } +#line 1561 "E:/reactosSync3.0_gcc/dll/win32/msi/cond.tab.c" /* yacc.c:1646 */ break;
case 23: -#line 247 "cond.y" /* yacc.c:1646 */ - { - (yyval.value) = (yyvsp[-1].value); - } -#line 1599 "cond.tab.c" /* yacc.c:1646 */ +#line 239 "cond.y" /* yacc.c:1646 */ + { (yyval.operator) = COND_INE; } +#line 1567 "E:/reactosSync3.0_gcc/dll/win32/msi/cond.tab.c" /* yacc.c:1646 */ break;
case 24: -#line 254 "cond.y" /* yacc.c:1646 */ - { (yyval.value) = COND_EQ; } -#line 1605 "cond.tab.c" /* yacc.c:1646 */ +#line 240 "cond.y" /* yacc.c:1646 */ + { (yyval.operator) = COND_ILT; } +#line 1573 "E:/reactosSync3.0_gcc/dll/win32/msi/cond.tab.c" /* yacc.c:1646 */ break;
case 25: -#line 255 "cond.y" /* yacc.c:1646 */ - { (yyval.value) = COND_NE; } -#line 1611 "cond.tab.c" /* yacc.c:1646 */ +#line 241 "cond.y" /* yacc.c:1646 */ + { (yyval.operator) = COND_IGT; } +#line 1579 "E:/reactosSync3.0_gcc/dll/win32/msi/cond.tab.c" /* yacc.c:1646 */ break;
case 26: -#line 256 "cond.y" /* yacc.c:1646 */ - { (yyval.value) = COND_LT; } -#line 1617 "cond.tab.c" /* yacc.c:1646 */ +#line 242 "cond.y" /* yacc.c:1646 */ + { (yyval.operator) = COND_ILE; } +#line 1585 "E:/reactosSync3.0_gcc/dll/win32/msi/cond.tab.c" /* yacc.c:1646 */ break;
case 27: -#line 257 "cond.y" /* yacc.c:1646 */ - { (yyval.value) = COND_GT; } -#line 1623 "cond.tab.c" /* yacc.c:1646 */ +#line 243 "cond.y" /* yacc.c:1646 */ + { (yyval.operator) = COND_IGE; } +#line 1591 "E:/reactosSync3.0_gcc/dll/win32/msi/cond.tab.c" /* yacc.c:1646 */ break;
case 28: -#line 258 "cond.y" /* yacc.c:1646 */ - { (yyval.value) = COND_LE; } -#line 1629 "cond.tab.c" /* yacc.c:1646 */ +#line 244 "cond.y" /* yacc.c:1646 */ + { (yyval.operator) = COND_ISS; } +#line 1597 "E:/reactosSync3.0_gcc/dll/win32/msi/cond.tab.c" /* yacc.c:1646 */ break;
case 29: -#line 259 "cond.y" /* yacc.c:1646 */ - { (yyval.value) = COND_GE; } -#line 1635 "cond.tab.c" /* yacc.c:1646 */ +#line 245 "cond.y" /* yacc.c:1646 */ + { (yyval.operator) = COND_LHS; } +#line 1603 "E:/reactosSync3.0_gcc/dll/win32/msi/cond.tab.c" /* yacc.c:1646 */ break;
case 30: -#line 260 "cond.y" /* yacc.c:1646 */ - { (yyval.value) = COND_SS; } -#line 1641 "cond.tab.c" /* yacc.c:1646 */ +#line 246 "cond.y" /* yacc.c:1646 */ + { (yyval.operator) = COND_RHS; } +#line 1609 "E:/reactosSync3.0_gcc/dll/win32/msi/cond.tab.c" /* yacc.c:1646 */ break;
case 31: -#line 261 "cond.y" /* yacc.c:1646 */ - { (yyval.value) = COND_IEQ; } -#line 1647 "cond.tab.c" /* yacc.c:1646 */ +#line 247 "cond.y" /* yacc.c:1646 */ + { (yyval.operator) = COND_ILHS; } +#line 1615 "E:/reactosSync3.0_gcc/dll/win32/msi/cond.tab.c" /* yacc.c:1646 */ break;
case 32: -#line 262 "cond.y" /* yacc.c:1646 */ - { (yyval.value) = COND_INE; } -#line 1653 "cond.tab.c" /* yacc.c:1646 */ +#line 248 "cond.y" /* yacc.c:1646 */ + { (yyval.operator) = COND_IRHS; } +#line 1621 "E:/reactosSync3.0_gcc/dll/win32/msi/cond.tab.c" /* yacc.c:1646 */ break;
case 33: -#line 263 "cond.y" /* yacc.c:1646 */ - { (yyval.value) = COND_ILT; } -#line 1659 "cond.tab.c" /* yacc.c:1646 */ - break; - - case 34: -#line 264 "cond.y" /* yacc.c:1646 */ - { (yyval.value) = COND_IGT; } -#line 1665 "cond.tab.c" /* yacc.c:1646 */ - break; - - case 35: -#line 265 "cond.y" /* yacc.c:1646 */ - { (yyval.value) = COND_ILE; } -#line 1671 "cond.tab.c" /* yacc.c:1646 */ - break; +#line 253 "cond.y" /* yacc.c:1646 */ + { + COND_input* cond = (COND_input*) info; + UINT len;
- case 36: -#line 266 "cond.y" /* yacc.c:1646 */ - { (yyval.value) = COND_IGE; } -#line 1677 "cond.tab.c" /* yacc.c:1646 */ + (yyval.value).type = VALUE_SYMBOL; + (yyval.value).u.string = msi_dup_property( cond->package->db, (yyvsp[0].identifier) ); + if ((yyval.value).u.string) + { + len = (lstrlenW((yyval.value).u.string) + 1) * sizeof (WCHAR); + (yyval.value).u.string = cond_track_mem( cond, (yyval.value).u.string, len ); + } + cond_free( (yyvsp[0].identifier) ); + } +#line 1639 "E:/reactosSync3.0_gcc/dll/win32/msi/cond.tab.c" /* yacc.c:1646 */ break;
- case 37: + case 34: #line 267 "cond.y" /* yacc.c:1646 */ - { (yyval.value) = COND_ISS; } -#line 1683 "cond.tab.c" /* yacc.c:1646 */ - break; - - case 38: -#line 268 "cond.y" /* yacc.c:1646 */ - { (yyval.value) = COND_LHS; } -#line 1689 "cond.tab.c" /* yacc.c:1646 */ - break; - - case 39: -#line 269 "cond.y" /* yacc.c:1646 */ - { (yyval.value) = COND_RHS; } -#line 1695 "cond.tab.c" /* yacc.c:1646 */ - break; - - case 40: -#line 270 "cond.y" /* yacc.c:1646 */ - { (yyval.value) = COND_ILHS; } -#line 1701 "cond.tab.c" /* yacc.c:1646 */ - break; - - case 41: -#line 271 "cond.y" /* yacc.c:1646 */ - { (yyval.value) = COND_IRHS; } -#line 1707 "cond.tab.c" /* yacc.c:1646 */ - break; - - case 42: -#line 276 "cond.y" /* yacc.c:1646 */ { - (yyval.string) = (yyvsp[0].string); - } -#line 1715 "cond.tab.c" /* yacc.c:1646 */ - break; - - case 43: -#line 280 "cond.y" /* yacc.c:1646 */ - { - (yyval.string) = (yyvsp[0].string); - } -#line 1723 "cond.tab.c" /* yacc.c:1646 */ + COND_input* cond = (COND_input*) info; + UINT len = GetEnvironmentVariableW( (yyvsp[0].identifier), NULL, 0 ); + (yyval.value).type = VALUE_SYMBOL; + (yyval.value).u.string = NULL; + if (len++) + { + (yyval.value).u.string = cond_alloc( cond, len*sizeof (WCHAR) ); + if( !(yyval.value).u.string ) + YYABORT; + GetEnvironmentVariableW( (yyvsp[0].identifier), (yyval.value).u.string, len ); + } + cond_free( (yyvsp[0].identifier) ); + } +#line 1658 "E:/reactosSync3.0_gcc/dll/win32/msi/cond.tab.c" /* yacc.c:1646 */ break;
- case 44: -#line 287 "cond.y" /* yacc.c:1646 */ + case 35: +#line 282 "cond.y" /* yacc.c:1646 */ { COND_input* cond = (COND_input*) info; - (yyval.string) = COND_GetLiteral( cond, &(yyvsp[0].str) ); - if( !(yyval.string) ) + (yyval.value).type = VALUE_LITERAL; + (yyval.value).u.string = COND_GetLiteral( cond, &(yyvsp[0].str) ); + if( !(yyval.value).u.string ) YYABORT; } -#line 1734 "cond.tab.c" /* yacc.c:1646 */ +#line 1670 "E:/reactosSync3.0_gcc/dll/win32/msi/cond.tab.c" /* yacc.c:1646 */ break;
- case 45: -#line 297 "cond.y" /* yacc.c:1646 */ + case 36: +#line 290 "cond.y" /* yacc.c:1646 */ { - (yyval.value) = (yyvsp[0].value); + COND_input* cond = (COND_input*) info; + LPWSTR szNum = COND_GetString( cond, &(yyvsp[0].str) ); + if( !szNum ) + YYABORT; + (yyval.value).type = VALUE_INTEGER; + (yyval.value).u.integer = atoiW( szNum ); + cond_free( szNum ); } -#line 1742 "cond.tab.c" /* yacc.c:1646 */ +#line 1684 "E:/reactosSync3.0_gcc/dll/win32/msi/cond.tab.c" /* yacc.c:1646 */ break;
- case 46: -#line 301 "cond.y" /* yacc.c:1646 */ + case 37: +#line 300 "cond.y" /* yacc.c:1646 */ { COND_input* cond = (COND_input*) info; INSTALLSTATE install = INSTALLSTATE_UNKNOWN, action = INSTALLSTATE_UNKNOWN;
- MSI_GetComponentStateW(cond->package, (yyvsp[0].string), &install, &action ); - (yyval.value) = action; - cond_free( (yyvsp[0].string) ); + if(MSI_GetComponentStateW(cond->package, (yyvsp[0].identifier), &install, &action ) != ERROR_SUCCESS) + { + (yyval.value).type = VALUE_LITERAL; + (yyval.value).u.string = NULL; + } + else + { + (yyval.value).type = VALUE_INTEGER; + (yyval.value).u.integer = action; + } + cond_free( (yyvsp[0].identifier) ); } -#line 1755 "cond.tab.c" /* yacc.c:1646 */ +#line 1705 "E:/reactosSync3.0_gcc/dll/win32/msi/cond.tab.c" /* yacc.c:1646 */ break;
- case 47: -#line 310 "cond.y" /* yacc.c:1646 */ + case 38: +#line 317 "cond.y" /* yacc.c:1646 */ { COND_input* cond = (COND_input*) info; INSTALLSTATE install = INSTALLSTATE_UNKNOWN, action = INSTALLSTATE_UNKNOWN;
- MSI_GetComponentStateW(cond->package, (yyvsp[0].string), &install, &action ); - (yyval.value) = install; - cond_free( (yyvsp[0].string) ); + if(MSI_GetComponentStateW(cond->package, (yyvsp[0].identifier), &install, &action ) != ERROR_SUCCESS) + { + (yyval.value).type = VALUE_LITERAL; + (yyval.value).u.string = NULL; + } + else + { + (yyval.value).type = VALUE_INTEGER; + (yyval.value).u.integer = install; + } + cond_free( (yyvsp[0].identifier) ); } -#line 1768 "cond.tab.c" /* yacc.c:1646 */ +#line 1726 "E:/reactosSync3.0_gcc/dll/win32/msi/cond.tab.c" /* yacc.c:1646 */ break;
- case 48: -#line 319 "cond.y" /* yacc.c:1646 */ + case 39: +#line 334 "cond.y" /* yacc.c:1646 */ { COND_input* cond = (COND_input*) info; - INSTALLSTATE install = INSTALLSTATE_UNKNOWN, action = INSTALLSTATE_UNKNOWN; + INSTALLSTATE install, action;
- MSI_GetFeatureStateW(cond->package, (yyvsp[0].string), &install, &action ); - if (action == INSTALLSTATE_UNKNOWN) - (yyval.value) = MSICONDITION_FALSE; + if (MSI_GetFeatureStateW(cond->package, (yyvsp[0].identifier), &install, &action ) != ERROR_SUCCESS) + { + (yyval.value).type = VALUE_LITERAL; + (yyval.value).u.string = NULL; + } else - (yyval.value) = action; - - cond_free( (yyvsp[0].string) ); + { + (yyval.value).type = VALUE_INTEGER; + (yyval.value).u.integer = action; + } + cond_free( (yyvsp[0].identifier) ); } -#line 1785 "cond.tab.c" /* yacc.c:1646 */ +#line 1747 "E:/reactosSync3.0_gcc/dll/win32/msi/cond.tab.c" /* yacc.c:1646 */ break;
- case 49: -#line 332 "cond.y" /* yacc.c:1646 */ + case 40: +#line 351 "cond.y" /* yacc.c:1646 */ { COND_input* cond = (COND_input*) info; INSTALLSTATE install = INSTALLSTATE_UNKNOWN, action = INSTALLSTATE_UNKNOWN;
- MSI_GetFeatureStateW(cond->package, (yyvsp[0].string), &install, &action ); - (yyval.value) = install; - cond_free( (yyvsp[0].string) ); - } -#line 1798 "cond.tab.c" /* yacc.c:1646 */ - break; - - case 50: -#line 344 "cond.y" /* yacc.c:1646 */ - { - COND_input* cond = (COND_input*) info; - UINT len; - - (yyval.string) = msi_dup_property( cond->package->db, (yyvsp[0].string) ); - if ((yyval.string)) + if(MSI_GetFeatureStateW(cond->package, (yyvsp[0].identifier), &install, &action ) != ERROR_SUCCESS) { - len = (lstrlenW((yyval.string)) + 1) * sizeof (WCHAR); - (yyval.string) = cond_track_mem( cond, (yyval.string), len ); + (yyval.value).type = VALUE_LITERAL; + (yyval.value).u.string = NULL; } - cond_free( (yyvsp[0].string) ); - } -#line 1815 "cond.tab.c" /* yacc.c:1646 */ - break; - - case 51: -#line 357 "cond.y" /* yacc.c:1646 */ - { - COND_input* cond = (COND_input*) info; - UINT len = GetEnvironmentVariableW( (yyvsp[0].string), NULL, 0 ); - (yyval.string) = NULL; - if (len++) + else { - (yyval.string) = cond_alloc( cond, len*sizeof (WCHAR) ); - if( !(yyval.string) ) - YYABORT; - GetEnvironmentVariableW( (yyvsp[0].string), (yyval.string), len ); + (yyval.value).type = VALUE_INTEGER; + (yyval.value).u.integer = install; } - cond_free( (yyvsp[0].string) ); - } -#line 1833 "cond.tab.c" /* yacc.c:1646 */ - break; - - case 52: -#line 374 "cond.y" /* yacc.c:1646 */ - { - COND_input* cond = (COND_input*) info; - (yyval.string) = COND_GetString( cond, &(yyvsp[0].str) ); - if( !(yyval.string) ) - YYABORT; + cond_free( (yyvsp[0].identifier) ); } -#line 1844 "cond.tab.c" /* yacc.c:1646 */ +#line 1768 "E:/reactosSync3.0_gcc/dll/win32/msi/cond.tab.c" /* yacc.c:1646 */ break;
- case 53: -#line 384 "cond.y" /* yacc.c:1646 */ + case 41: +#line 371 "cond.y" /* yacc.c:1646 */ { COND_input* cond = (COND_input*) info; - LPWSTR szNum = COND_GetString( cond, &(yyvsp[0].str) ); - if( !szNum ) + (yyval.identifier) = COND_GetString( cond, &(yyvsp[0].str) ); + if( !(yyval.identifier) ) YYABORT; - (yyval.value) = atoiW( szNum ); - cond_free( szNum ); } -#line 1857 "cond.tab.c" /* yacc.c:1646 */ +#line 1779 "E:/reactosSync3.0_gcc/dll/win32/msi/cond.tab.c" /* yacc.c:1646 */ break;
-#line 1861 "cond.tab.c" /* yacc.c:1646 */ +#line 1783 "E:/reactosSync3.0_gcc/dll/win32/msi/cond.tab.c" /* yacc.c:1646 */ default: break; } /* User semantic actions sometimes alter yychar, and that requires @@ -2065,7 +2007,7 @@ yyreturn: #endif return yyresult; } -#line 394 "cond.y" /* yacc.c:1906 */ +#line 379 "cond.y" /* yacc.c:1906 */
diff --git a/dll/win32/msi/cond.y b/dll/win32/msi/cond.y index fa5582566e..61ace8c57e 100644 --- a/dll/win32/msi/cond.y +++ b/dll/win32/msi/cond.y @@ -20,27 +20,7 @@ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA */
-#define COBJMACROS - -#include "config.h" - -#include <stdarg.h> -#include <stdio.h> -#include <stdlib.h> - -#include "windef.h" -#include "winbase.h" -#include "winuser.h" -#include "msi.h" -#include "msiquery.h" -#include "objbase.h" -#include "oleauto.h" - #include "msipriv.h" -#include "msiserver.h" -#include "wine/debug.h" -#include "wine/unicode.h" -#include "wine/list.h"
WINE_DEFAULT_DEBUG_CHANNEL(msi);
@@ -58,6 +38,18 @@ struct cond_str { INT len; };
+struct value { + enum value_type { + VALUE_INTEGER, + VALUE_LITERAL, + VALUE_SYMBOL + } type; + union { + INT integer; + WCHAR *string; + } u; +}; + 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); @@ -70,16 +62,6 @@ static void cond_free( void *ptr ); static INT compare_int( INT a, INT operator, INT b ); static INT compare_string( LPCWSTR a, INT operator, LPCWSTR b, BOOL convert );
-static INT compare_and_free_strings( LPWSTR a, INT op, LPWSTR b, BOOL convert ) -{ - INT r; - - r = compare_string( a, op, b, convert ); - cond_free( a ); - cond_free( b ); - return r; -} - static BOOL num_from_prop( LPCWSTR p, INT *val ) { INT ret = 0, sign = 1; @@ -104,6 +86,12 @@ static BOOL num_from_prop( LPCWSTR p, INT *val ) return TRUE; }
+static void value_free( struct value val ) +{ + if (val.type != VALUE_INTEGER) + cond_free( val.u.string ); +} + %}
%lex-param { COND_input *info } @@ -113,8 +101,10 @@ static BOOL num_from_prop( LPCWSTR p, INT *val ) %union { struct cond_str str; - LPWSTR string; - INT value; + struct value value; + LPWSTR identifier; + INT operator; + BOOL bool; }
%token COND_SPACE COND_EOF @@ -128,9 +118,10 @@ static BOOL num_from_prop( LPCWSTR p, INT *val )
%nonassoc COND_ERROR COND_EOF
-%type <value> expression boolean_term boolean_factor -%type <value> value_i integer operator -%type <string> identifier symbol_s value_s literal +%type <bool> expression boolean_term boolean_factor +%type <value> value +%type <identifier> identifier +%type <operator> operator
%%
@@ -184,64 +175,50 @@ boolean_term: boolean_factor: COND_NOT boolean_factor { - $$ = $2 ? 0 : 1; - } - | value_i - { - $$ = $1 ? 1 : 0; - } - | value_s - { - $$ = ($1 && $1[0]) ? 1 : 0; - cond_free( $1 ); - } - | value_i operator value_i - { - $$ = compare_int( $1, $2, $3 ); - } - | symbol_s operator value_i - { - int num; - if (num_from_prop( $1, &num )) - $$ = compare_int( num, $2, $3 ); - else - $$ = ($2 == COND_NE || $2 == COND_INE ); - cond_free( $1 ); - } - | value_i operator symbol_s - { - int num; - if (num_from_prop( $3, &num )) - $$ = compare_int( $1, $2, num ); - else - $$ = ($2 == COND_NE || $2 == COND_INE ); - cond_free( $3 ); - } - | symbol_s operator symbol_s - { - $$ = compare_and_free_strings( $1, $2, $3, TRUE ); - } - | symbol_s operator literal - { - $$ = compare_and_free_strings( $1, $2, $3, TRUE ); + $$ = !$2; } - | literal operator symbol_s + | value { - $$ = compare_and_free_strings( $1, $2, $3, TRUE ); - } - | literal operator literal - { - $$ = compare_and_free_strings( $1, $2, $3, FALSE ); - } - | literal operator value_i - { - $$ = 0; - cond_free( $1 ); + if ($1.type == VALUE_INTEGER) + $$ = $1.u.integer ? 1 : 0; + else + $$ = $1.u.string && $1.u.string[0]; + value_free( $1 ); } - | value_i operator literal + | value operator value { - $$ = 0; - cond_free( $3 ); + if ($1.type == VALUE_INTEGER && $3.type == VALUE_INTEGER) + { + $$ = compare_int($1.u.integer, $2, $3.u.integer); + } + else if ($1.type != VALUE_INTEGER && $3.type != VALUE_INTEGER) + { + $$ = compare_string($1.u.string, $2, $3.u.string, + $1.type == VALUE_SYMBOL || $3.type == VALUE_SYMBOL); + } + else if ($1.type == VALUE_LITERAL || $3.type == VALUE_LITERAL) + { + $$ = FALSE; + } + else if ($1.type == VALUE_SYMBOL) /* symbol operator integer */ + { + int num; + if (num_from_prop( $1.u.string, &num )) + $$ = compare_int( num, $2, $3.u.integer ); + else + $$ = ($2 == COND_NE || $2 == COND_INE ); + } + else /* integer operator symbol */ + { + int num; + if (num_from_prop( $3.u.string, &num )) + $$ = compare_int( $1.u.integer, $2, num ); + else + $$ = ($2 == COND_NE || $2 == COND_INE ); + } + + value_free( $1 ); + value_free( $3 ); } | COND_LPAR expression COND_RPAR { @@ -271,39 +248,69 @@ operator: | COND_IRHS { $$ = COND_IRHS; } ;
-value_s: - symbol_s - { - $$ = $1; - } - | literal - { - $$ = $1; - } - ; +value: + identifier + { + COND_input* cond = (COND_input*) info; + UINT len;
-literal: - COND_LITER + $$.type = VALUE_SYMBOL; + $$.u.string = msi_dup_property( cond->package->db, $1 ); + if ($$.u.string) + { + len = (lstrlenW($$.u.string) + 1) * sizeof (WCHAR); + $$.u.string = cond_track_mem( cond, $$.u.string, len ); + } + cond_free( $1 ); + } + | COND_PERCENT identifier { COND_input* cond = (COND_input*) info; - $$ = COND_GetLiteral( cond, &$1 ); - if( !$$ ) + UINT len = GetEnvironmentVariableW( $2, NULL, 0 ); + $$.type = VALUE_SYMBOL; + $$.u.string = NULL; + if (len++) + { + $$.u.string = cond_alloc( cond, len*sizeof (WCHAR) ); + if( !$$.u.string ) + YYABORT; + GetEnvironmentVariableW( $2, $$.u.string, len ); + } + cond_free( $2 ); + } + | COND_LITER + { + COND_input* cond = (COND_input*) info; + $$.type = VALUE_LITERAL; + $$.u.string = COND_GetLiteral( cond, &$1 ); + if( !$$.u.string ) YYABORT; } - ; - -value_i: - integer + | COND_NUMBER { - $$ = $1; + COND_input* cond = (COND_input*) info; + LPWSTR szNum = COND_GetString( cond, &$1 ); + if( !szNum ) + YYABORT; + $$.type = VALUE_INTEGER; + $$.u.integer = atoiW( szNum ); + cond_free( szNum ); } | COND_DOLLARS identifier { COND_input* cond = (COND_input*) info; INSTALLSTATE install = INSTALLSTATE_UNKNOWN, action = INSTALLSTATE_UNKNOWN;
- MSI_GetComponentStateW(cond->package, $2, &install, &action ); - $$ = action; + if(MSI_GetComponentStateW(cond->package, $2, &install, &action ) != ERROR_SUCCESS) + { + $$.type = VALUE_LITERAL; + $$.u.string = NULL; + } + else + { + $$.type = VALUE_INTEGER; + $$.u.integer = action; + } cond_free( $2 ); } | COND_QUESTION identifier @@ -311,21 +318,33 @@ value_i: COND_input* cond = (COND_input*) info; INSTALLSTATE install = INSTALLSTATE_UNKNOWN, action = INSTALLSTATE_UNKNOWN;
- MSI_GetComponentStateW(cond->package, $2, &install, &action ); - $$ = install; + if(MSI_GetComponentStateW(cond->package, $2, &install, &action ) != ERROR_SUCCESS) + { + $$.type = VALUE_LITERAL; + $$.u.string = NULL; + } + else + { + $$.type = VALUE_INTEGER; + $$.u.integer = install; + } cond_free( $2 ); } | COND_AMPER identifier { COND_input* cond = (COND_input*) info; - INSTALLSTATE install = INSTALLSTATE_UNKNOWN, action = INSTALLSTATE_UNKNOWN; + INSTALLSTATE install, action;
- MSI_GetFeatureStateW(cond->package, $2, &install, &action ); - if (action == INSTALLSTATE_UNKNOWN) - $$ = MSICONDITION_FALSE; + if (MSI_GetFeatureStateW(cond->package, $2, &install, &action ) != ERROR_SUCCESS) + { + $$.type = VALUE_LITERAL; + $$.u.string = NULL; + } else - $$ = action; - + { + $$.type = VALUE_INTEGER; + $$.u.integer = action; + } cond_free( $2 ); } | COND_EXCLAM identifier @@ -333,37 +352,15 @@ value_i: COND_input* cond = (COND_input*) info; INSTALLSTATE install = INSTALLSTATE_UNKNOWN, action = INSTALLSTATE_UNKNOWN;
- MSI_GetFeatureStateW(cond->package, $2, &install, &action ); - $$ = install; - cond_free( $2 ); - } - ; - -symbol_s: - identifier - { - COND_input* cond = (COND_input*) info; - UINT len; - - $$ = msi_dup_property( cond->package->db, $1 ); - if ($$) + if(MSI_GetFeatureStateW(cond->package, $2, &install, &action ) != ERROR_SUCCESS) { - len = (lstrlenW($$) + 1) * sizeof (WCHAR); - $$ = cond_track_mem( cond, $$, len ); + $$.type = VALUE_LITERAL; + $$.u.string = NULL; } - cond_free( $1 ); - } - | COND_PERCENT identifier - { - COND_input* cond = (COND_input*) info; - UINT len = GetEnvironmentVariableW( $2, NULL, 0 ); - $$ = NULL; - if (len++) + else { - $$ = cond_alloc( cond, len*sizeof (WCHAR) ); - if( !$$ ) - YYABORT; - GetEnvironmentVariableW( $2, $$, len ); + $$.type = VALUE_INTEGER; + $$.u.integer = install; } cond_free( $2 ); } @@ -379,18 +376,6 @@ identifier: } ;
-integer: - COND_NUMBER - { - COND_input* cond = (COND_input*) info; - LPWSTR szNum = COND_GetString( cond, &$1 ); - if( !szNum ) - YYABORT; - $$ = atoiW( szNum ); - cond_free( szNum ); - } - ; - %%
diff --git a/dll/win32/msi/custom.c b/dll/win32/msi/custom.c index 3dffb8680a..c3fb8d3cd7 100644 --- a/dll/win32/msi/custom.c +++ b/dll/win32/msi/custom.c @@ -64,14 +64,14 @@ UINT msi_schedule_action( MSIPACKAGE *package, UINT script, const WCHAR *action } TRACE("Scheduling action %s in script %u\n", debugstr_w(action), script);
- count = package->script->ActionCount[script]; - package->script->ActionCount[script]++; - if (count != 0) newbuf = msi_realloc( package->script->Actions[script], - package->script->ActionCount[script] * sizeof(WCHAR *) ); + count = package->script_actions_count[script]; + package->script_actions_count[script]++; + if (count != 0) newbuf = msi_realloc( package->script_actions[script], + package->script_actions_count[script] * sizeof(WCHAR *) ); else newbuf = msi_alloc( sizeof(WCHAR *) );
newbuf[count] = strdupW( action ); - package->script->Actions[script] = newbuf; + package->script_actions[script] = newbuf; return ERROR_SUCCESS; }
@@ -80,18 +80,16 @@ UINT msi_register_unique_action( MSIPACKAGE *package, const WCHAR *action ) UINT count; WCHAR **newbuf = NULL;
- if (!package->script) return FALSE; - TRACE("Registering %s as unique action\n", debugstr_w(action));
- count = package->script->UniqueActionsCount; - package->script->UniqueActionsCount++; - if (count != 0) newbuf = msi_realloc( package->script->UniqueActions, - package->script->UniqueActionsCount * sizeof(WCHAR *) ); + count = package->unique_actions_count; + package->unique_actions_count++; + if (count != 0) newbuf = msi_realloc( package->unique_actions, + package->unique_actions_count * sizeof(WCHAR *) ); else newbuf = msi_alloc( sizeof(WCHAR *) );
newbuf[count] = strdupW( action ); - package->script->UniqueActions = newbuf; + package->unique_actions = newbuf; return ERROR_SUCCESS; }
@@ -99,25 +97,20 @@ BOOL msi_action_is_unique( const MSIPACKAGE *package, const WCHAR *action ) { UINT i;
- if (!package->script) return FALSE; - - for (i = 0; i < package->script->UniqueActionsCount; i++) + for (i = 0; i < package->unique_actions_count; i++) { - if (!strcmpW( package->script->UniqueActions[i], action )) return TRUE; + if (!strcmpW( package->unique_actions[i], action )) return TRUE; } return FALSE; }
static BOOL check_execution_scheduling_options(MSIPACKAGE *package, LPCWSTR action, UINT options) { - if (!package->script) - return TRUE; - if ((options & msidbCustomActionTypeClientRepeat) == msidbCustomActionTypeClientRepeat) { - if (!(package->script->InWhatSequence & SEQUENCE_UI && - package->script->InWhatSequence & SEQUENCE_EXEC)) + if (!(package->InWhatSequence & SEQUENCE_UI && + package->InWhatSequence & SEQUENCE_EXEC)) { TRACE("Skipping action due to dbCustomActionTypeClientRepeat option.\n"); return FALSE; @@ -125,8 +118,8 @@ static BOOL check_execution_scheduling_options(MSIPACKAGE *package, LPCWSTR acti } else if (options & msidbCustomActionTypeFirstSequence) { - if (package->script->InWhatSequence & SEQUENCE_UI && - package->script->InWhatSequence & SEQUENCE_EXEC ) + if (package->InWhatSequence & SEQUENCE_UI && + package->InWhatSequence & SEQUENCE_EXEC ) { TRACE("Skipping action due to msidbCustomActionTypeFirstSequence option.\n"); return FALSE; @@ -258,7 +251,7 @@ static MSIBINARY *create_temp_binary( MSIPACKAGE *package, LPCWSTR source, BOOL /* keep a reference to prevent the dll from being unloaded */ if (dll && !(binary->module = LoadLibraryW( tmpfile ))) { - WARN( "failed to load dll %s (%u)\n", debugstr_w( tmpfile ), GetLastError() ); + ERR( "failed to load dll %s (%u)\n", debugstr_w( tmpfile ), GetLastError() ); } binary->source = strdupW( source ); binary->tmpfile = tmpfile; @@ -562,7 +555,7 @@ static DWORD ACTION_CallDllFunction( const GUID *guid ) hModule = LoadLibraryW( dll ); if (!hModule) { - WARN( "failed to load dll %s (%u)\n", debugstr_w( dll ), GetLastError() ); + ERR( "failed to load dll %s (%u)\n", debugstr_w( dll ), GetLastError() ); return ERROR_SUCCESS; }
@@ -695,7 +688,7 @@ static HANDLE execute_command( const WCHAR *app, WCHAR *arg, const WCHAR *dir ) } if (!len_exe) { - WARN("can't find executable %u\n", GetLastError()); + ERR("can't find executable %u\n", GetLastError()); msi_free( exe ); return INVALID_HANDLE_VALUE; } @@ -733,7 +726,7 @@ static HANDLE execute_command( const WCHAR *app, WCHAR *arg, const WCHAR *dir ) msi_free( exe ); if (!ret) { - WARN("unable to execute command %u\n", GetLastError()); + ERR("unable to execute command %u\n", GetLastError()); return INVALID_HANDLE_VALUE; } CloseHandle( info.hThread ); diff --git a/dll/win32/msi/database.c b/dll/win32/msi/database.c index a94cebdbdf..80d366b479 100644 --- a/dll/win32/msi/database.c +++ b/dll/win32/msi/database.c @@ -36,13 +36,6 @@ WINE_DEFAULT_DEBUG_CHANNEL(msi);
#define IS_INTMSIDBOPEN(x) (((ULONG_PTR)(x) >> 16) == 0)
-struct row_export_info -{ - HANDLE handle; - LPCWSTR folder; - LPCWSTR table; -}; - static void free_transforms( MSIDATABASE *db ) { while( !list_empty( &db->transforms ) ) @@ -911,131 +904,50 @@ end: return r; }
-static UINT msi_export_field( HANDLE handle, MSIRECORD *row, UINT field ) +static UINT msi_export_record( HANDLE handle, MSIRECORD *row, UINT start ) { + UINT i, count, len, r = ERROR_SUCCESS; + const char *sep; char *buffer; - BOOL bret; DWORD sz; - UINT r;
- sz = 0x100; - buffer = msi_alloc( sz ); - if (!buffer) + len = 0x100; + buffer = msi_alloc( len ); + if ( !buffer ) return ERROR_OUTOFMEMORY;
- r = MSI_RecordGetStringA( row, field, buffer, &sz ); - if (r == ERROR_MORE_DATA) + count = MSI_RecordGetFieldCount( row ); + for ( i=start; i<=count; i++ ) { - char *p; - - sz++; /* leave room for NULL terminator */ - p = msi_realloc( buffer, sz ); - if (!p) + sz = len; + r = MSI_RecordGetStringA( row, i, buffer, &sz ); + if (r == ERROR_MORE_DATA) { - msi_free( buffer ); - return ERROR_OUTOFMEMORY; - } - buffer = p; - - r = MSI_RecordGetStringA( row, field, buffer, &sz ); - if (r != ERROR_SUCCESS) - { - msi_free( buffer ); - return r; + char *p = msi_realloc( buffer, sz + 1 ); + if (!p) + break; + len = sz + 1; + buffer = p; } - } - else if (r != ERROR_SUCCESS) - return r; - - bret = WriteFile( handle, buffer, sz, &sz, NULL ); - msi_free( buffer ); - if (!bret) - return ERROR_FUNCTION_FAILED; - - return r; -} - -static UINT msi_export_stream( LPCWSTR folder, LPCWSTR table, MSIRECORD *row, UINT field, - UINT start ) -{ - static const WCHAR fmt_file[] = { '%','s','/','%','s','/','%','s',0 }; - static const WCHAR fmt_folder[] = { '%','s','/','%','s',0 }; - WCHAR stream_name[256], stream_filename[MAX_PATH]; - DWORD sz, read_size, write_size; - char buffer[1024]; - HANDLE file; - UINT r; - - /* get the name of the file */ - sz = sizeof(stream_name)/sizeof(WCHAR); - r = MSI_RecordGetStringW( row, start, stream_name, &sz ); - if (r != ERROR_SUCCESS) - return r; - - /* if the destination folder does not exist then create it (folder name = table name) */ - snprintfW( stream_filename, sizeof(stream_filename)/sizeof(WCHAR), fmt_folder, folder, table ); - if (GetFileAttributesW( stream_filename ) == INVALID_FILE_ATTRIBUTES) - { - if (!CreateDirectoryW( stream_filename, NULL )) - return ERROR_PATH_NOT_FOUND; - } - - /* actually create the file */ - snprintfW( stream_filename, sizeof(stream_filename)/sizeof(WCHAR), fmt_file, folder, table, stream_name ); - file = CreateFileW( stream_filename, GENERIC_WRITE, FILE_SHARE_READ | FILE_SHARE_WRITE, - NULL, CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL ); - if (file == INVALID_HANDLE_VALUE) - return ERROR_FILE_NOT_FOUND; - - /* copy the stream to the file */ - read_size = sizeof(buffer); - while (read_size == sizeof(buffer)) - { - r = MSI_RecordReadStream( row, field, buffer, &read_size ); + sz = len; + r = MSI_RecordGetStringA( row, i, buffer, &sz ); if (r != ERROR_SUCCESS) - { - CloseHandle( file ); - return r; - } - if (!WriteFile( file, buffer, read_size, &write_size, NULL ) || read_size != write_size) - { - CloseHandle( file ); - return ERROR_WRITE_FAULT; - } - } - CloseHandle( file ); - return r; -} - -static UINT msi_export_record( struct row_export_info *row_export_info, MSIRECORD *row, UINT start ) -{ - HANDLE handle = row_export_info->handle; - UINT i, count, r = ERROR_SUCCESS; - const char *sep; - DWORD sz; + break;
- count = MSI_RecordGetFieldCount( row ); - for (i = start; i <= count; i++) - { - r = msi_export_field( handle, row, i ); - if (r == ERROR_INVALID_PARAMETER) + if (!WriteFile( handle, buffer, sz, &sz, NULL )) { - r = msi_export_stream( row_export_info->folder, row_export_info->table, row, i, start ); - if (r != ERROR_SUCCESS) - return r; - - /* exporting a binary stream, repeat the "Name" field */ - r = msi_export_field( handle, row, start ); - if (r != ERROR_SUCCESS) - return r; + r = ERROR_FUNCTION_FAILED; + break; } - else if (r != ERROR_SUCCESS) - return r;
sep = (i < count) ? "\t" : "\r\n"; if (!WriteFile( handle, sep, strlen(sep), &sz, NULL )) - return ERROR_FUNCTION_FAILED; + { + r = ERROR_FUNCTION_FAILED; + break; + } } + msi_free( buffer ); return r; }
@@ -1059,25 +971,9 @@ static UINT msi_export_forcecodepage( HANDLE handle, UINT codepage ) return ERROR_SUCCESS; }
-static UINT msi_export_summaryinformation( MSIDATABASE *db, HANDLE handle ) -{ - static const char header[] = "PropertyId\tValue\r\n" - "i2\tl255\r\n" - "_SummaryInformation\tPropertyId\r\n"; - DWORD sz; - - sz = lstrlenA(header); - if (!WriteFile(handle, header, sz, &sz, NULL)) - return ERROR_WRITE_FAULT; - - return msi_export_suminfo( db, handle ); -} - static UINT MSI_DatabaseExport( MSIDATABASE *db, LPCWSTR table, LPCWSTR folder, LPCWSTR file ) { - static const WCHAR summaryinformation[] = { - '_','S','u','m','m','a','r','y','I','n','f','o','r','m','a','t','i','o','n',0 }; static const WCHAR query[] = { 's','e','l','e','c','t',' ','*',' ','f','r','o','m',' ','%','s',0 }; static const WCHAR forcecodepage[] = { @@ -1116,22 +1012,14 @@ static UINT MSI_DatabaseExport( MSIDATABASE *db, LPCWSTR table, goto done; }
- if (!strcmpW( table, summaryinformation )) - { - r = msi_export_summaryinformation( db, handle ); - goto done; - } - r = MSI_OpenQuery( db, &view, query, table ); if (r == ERROR_SUCCESS) { - struct row_export_info row_export_info = { handle, folder, table }; - /* write out row 1, the column names */ r = MSI_ViewGetColumnInfo(view, MSICOLINFO_NAMES, &rec); if (r == ERROR_SUCCESS) { - msi_export_record( &row_export_info, rec, 1 ); + msi_export_record( handle, rec, 1 ); msiobj_release( &rec->hdr ); }
@@ -1139,7 +1027,7 @@ static UINT MSI_DatabaseExport( MSIDATABASE *db, LPCWSTR table, r = MSI_ViewGetColumnInfo(view, MSICOLINFO_TYPES, &rec); if (r == ERROR_SUCCESS) { - msi_export_record( &row_export_info, rec, 1 ); + msi_export_record( handle, rec, 1 ); msiobj_release( &rec->hdr ); }
@@ -1148,12 +1036,12 @@ static UINT MSI_DatabaseExport( MSIDATABASE *db, LPCWSTR table, if (r == ERROR_SUCCESS) { MSI_RecordSetStringW( rec, 0, table ); - msi_export_record( &row_export_info, rec, 0 ); + msi_export_record( handle, rec, 0 ); msiobj_release( &rec->hdr ); }
/* write out row 4 onwards, the data */ - r = MSI_IterateRecords( view, 0, msi_export_row, &row_export_info ); + r = MSI_IterateRecords( view, 0, msi_export_row, handle ); msiobj_release( &view->hdr ); }
@@ -1991,8 +1879,16 @@ MSIDBSTATE WINAPI MsiGetDatabaseState( MSIHANDLE handle ) db = msihandle2msiinfo( handle, MSIHANDLETYPE_DATABASE ); if( !db ) { + IWineMsiRemoteDatabase *remote_database; + + remote_database = (IWineMsiRemoteDatabase *)msi_get_remote( handle ); + if ( !remote_database ) + return MSIDBSTATE_ERROR; + + IWineMsiRemoteDatabase_Release( remote_database ); WARN("MsiGetDatabaseState not allowed during a custom action!\n"); - return MSIDBSTATE_ERROR; + + return MSIDBSTATE_READ; }
if (db->mode != MSIDBOPEN_READONLY ) diff --git a/dll/win32/msi/dialog.c b/dll/win32/msi/dialog.c index 8b62bb0a8f..af986a1da6 100644 --- a/dll/win32/msi/dialog.c +++ b/dll/win32/msi/dialog.c @@ -3179,13 +3179,13 @@ static LONGLONG msi_vcl_get_cost( msi_dialog *dialog ) MSICOSTTREE_SELFONLY, INSTALLSTATE_LOCAL, &each_cost))) { /* each_cost is in 512-byte units */ - total_cost += ((LONGLONG)each_cost) * 512; + total_cost += each_cost * 512; } if (ERROR_SUCCESS == (MSI_GetFeatureCost(dialog->package, feature, MSICOSTTREE_SELFONLY, INSTALLSTATE_ABSENT, &each_cost))) { /* each_cost is in 512-byte units */ - total_cost -= ((LONGLONG)each_cost) * 512; + total_cost -= each_cost * 512; } } return total_cost; @@ -4288,7 +4288,7 @@ static UINT event_end_dialog( msi_dialog *dialog, const WCHAR *argument ) static UINT pending_event_end_dialog( msi_dialog *dialog, const WCHAR *argument ) { dialog->pending_event = event_end_dialog; - if (dialog->pending_argument) msi_free( dialog->pending_argument ); + msi_free( dialog->pending_argument ); dialog->pending_argument = strdupW( argument ); return ERROR_SUCCESS; } @@ -4306,7 +4306,7 @@ static UINT event_new_dialog( msi_dialog *dialog, const WCHAR *argument ) static UINT pending_event_new_dialog( msi_dialog *dialog, const WCHAR *argument ) { dialog->pending_event = event_new_dialog; - if (dialog->pending_argument) msi_free( dialog->pending_argument ); + msi_free( dialog->pending_argument ); dialog->pending_argument = strdupW( argument ); return ERROR_SUCCESS; } @@ -4331,7 +4331,7 @@ static UINT event_spawn_dialog( msi_dialog *dialog, const WCHAR *argument ) static UINT pending_event_spawn_dialog( msi_dialog *dialog, const WCHAR *argument ) { dialog->pending_event = event_spawn_dialog; - if (dialog->pending_argument) msi_free( dialog->pending_argument ); + msi_free( dialog->pending_argument ); dialog->pending_argument = strdupW( argument ); return ERROR_SUCCESS; } diff --git a/dll/win32/msi/install.c b/dll/win32/msi/install.c index 83d6badde8..8882ea1fa6 100644 --- a/dll/win32/msi/install.c +++ b/dll/win32/msi/install.c @@ -90,7 +90,7 @@ UINT WINAPI MsiDoActionW( MSIHANDLE hInstall, LPCWSTR szAction ) return ERROR_SUCCESS; }
- ret = ACTION_PerformUIAction( package, szAction, SCRIPT_NONE ); + ret = ACTION_PerformAction( package, szAction, SCRIPT_NONE ); msiobj_release( &package->hdr );
return ret; diff --git a/dll/win32/msi/msi.c b/dll/win32/msi/msi.c index 092aac82c3..ce1bd4f6de 100644 --- a/dll/win32/msi/msi.c +++ b/dll/win32/msi/msi.c @@ -3723,7 +3723,7 @@ UINT WINAPI MsiCollectUserInfoW(LPCWSTR szProduct) if (!package) return ERROR_CALL_NOT_IMPLEMENTED;
- rc = ACTION_PerformUIAction(package, szFirstRun, SCRIPT_NONE); + rc = ACTION_PerformAction(package, szFirstRun, SCRIPT_NONE); msiobj_release( &package->hdr );
MsiCloseHandle(handle); @@ -3749,7 +3749,7 @@ UINT WINAPI MsiCollectUserInfoA(LPCSTR szProduct) if (!package) return ERROR_CALL_NOT_IMPLEMENTED;
- rc = ACTION_PerformUIAction(package, szFirstRun, SCRIPT_NONE); + rc = ACTION_PerformAction(package, szFirstRun, SCRIPT_NONE); msiobj_release( &package->hdr );
MsiCloseHandle(handle); @@ -3830,7 +3830,7 @@ UINT WINAPI MsiConfigureFeatureW(LPCWSTR szProduct, LPCWSTR szFeature, INSTALLST
MsiSetInternalUI( INSTALLUILEVEL_BASIC, NULL );
- r = ACTION_PerformUIAction( package, szCostInitialize, SCRIPT_NONE ); + r = ACTION_PerformAction( package, szCostInitialize, SCRIPT_NONE ); if (r != ERROR_SUCCESS) goto end;
diff --git a/dll/win32/msi/msipriv.h b/dll/win32/msi/msipriv.h index d680a02435..971750d452 100644 --- a/dll/win32/msi/msipriv.h +++ b/dll/win32/msi/msipriv.h @@ -387,6 +387,15 @@ enum clr_version CLR_VERSION_MAX };
+enum script +{ + SCRIPT_NONE = -1, + SCRIPT_INSTALL = 0, + SCRIPT_COMMIT = 1, + SCRIPT_ROLLBACK = 2, + SCRIPT_MAX = 3 +}; + typedef struct tagMSIPACKAGE { MSIOBJECTHDR hdr; @@ -419,7 +428,12 @@ typedef struct tagMSIPACKAGE struct list mimes; struct list appids;
- struct tagMSISCRIPT *script; + LPWSTR *script_actions[SCRIPT_MAX]; + int script_actions_count[SCRIPT_MAX]; + LPWSTR *unique_actions; + int unique_actions_count; + BOOL ExecuteSequenceRun; + UINT InWhatSequence;
struct list RunningActions;
@@ -449,7 +463,6 @@ typedef struct tagMSIPACKAGE unsigned char need_reboot_at_end : 1; unsigned char need_reboot_now : 1; unsigned char need_rollback : 1; - unsigned char full_reinstall : 1; } MSIPACKAGE;
typedef struct tagMSIPREVIEW @@ -695,28 +708,8 @@ struct tagMSIMIME MSICLASS *Class; };
-enum SCRIPTS -{ - SCRIPT_NONE = -1, - SCRIPT_INSTALL = 0, - SCRIPT_COMMIT = 1, - SCRIPT_ROLLBACK = 2, - SCRIPT_MAX = 3 -}; - #define SEQUENCE_UI 0x1 #define SEQUENCE_EXEC 0x2 -#define SEQUENCE_INSTALL 0x10 - -typedef struct tagMSISCRIPT -{ - LPWSTR *Actions[SCRIPT_MAX]; - UINT ActionCount[SCRIPT_MAX]; - BOOL ExecuteSequenceRun; - UINT InWhatSequence; - LPWSTR *UniqueActions; - UINT UniqueActionsCount; -} MSISCRIPT;
#define MSIHANDLETYPE_ANY 0 #define MSIHANDLETYPE_DATABASE 1 @@ -975,7 +968,6 @@ extern LPWSTR msi_suminfo_dup_string( MSISUMMARYINFO *si, UINT uiProperty ) DECL extern INT msi_suminfo_get_int32( MSISUMMARYINFO *si, UINT uiProperty ) DECLSPEC_HIDDEN; extern LPWSTR msi_get_suminfo_product( IStorage *stg ) DECLSPEC_HIDDEN; extern UINT msi_add_suminfo( MSIDATABASE *db, LPWSTR **records, int num_records, int num_columns ) DECLSPEC_HIDDEN; -extern UINT msi_export_suminfo( MSIDATABASE *db, HANDLE handle ) DECLSPEC_HIDDEN; extern UINT msi_load_suminfo_properties( MSIPACKAGE *package ) DECLSPEC_HIDDEN;
/* undocumented functions */ @@ -1000,7 +992,6 @@ extern HINSTANCE msi_hInstance DECLSPEC_HIDDEN;
/* action related functions */ 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 *, const WCHAR *, UINT) DECLSPEC_HIDDEN;
@@ -1221,6 +1212,7 @@ static const WCHAR szLangResource[] = {'\','V','a','r','F','i','l','e','I','n', static const WCHAR szInstallLocation[] = {'I','n','s','t','a','l','l','L','o','c','a','t','i','o','n',0}; static const WCHAR szProperty[] = {'P','r','o','p','e','r','t','y',0}; static const WCHAR szUninstallable[] = {'U','n','i','n','s','t','a','l','l','a','b','l','e',0}; +static const WCHAR szEXECUTEACTION[] = {'E','X','E','C','U','T','E','A','C','T','I','O','N',0};
/* memory allocation macro functions */ static void *msi_alloc( size_t len ) __WINE_ALLOC_SIZE(1); diff --git a/dll/win32/msi/package.c b/dll/win32/msi/package.c index 3e0ae717f0..5ddc5c8483 100644 --- a/dll/win32/msi/package.c +++ b/dll/win32/msi/package.c @@ -103,17 +103,18 @@ static void free_assembly( MSIASSEMBLY *assembly ) void msi_free_action_script( MSIPACKAGE *package, UINT script ) { UINT i; - for (i = 0; i < package->script->ActionCount[script]; i++) - msi_free( package->script->Actions[script][i] ); + for (i = 0; i < package->script_actions_count[script]; i++) + msi_free( package->script_actions[script][i] );
- msi_free( package->script->Actions[script] ); - package->script->Actions[script] = NULL; - package->script->ActionCount[script] = 0; + msi_free( package->script_actions[script] ); + package->script_actions[script] = NULL; + package->script_actions_count[script] = 0; }
static void free_package_structures( MSIPACKAGE *package ) { struct list *item, *cursor; + int i;
LIST_FOR_EACH_SAFE( item, cursor, &package->features ) { @@ -249,20 +250,12 @@ static void free_package_structures( MSIPACKAGE *package ) msi_free( info ); }
- if (package->script) - { - INT i; - UINT j; - - for (i = 0; i < SCRIPT_MAX; i++) - msi_free_action_script( package, i ); + for (i = 0; i < SCRIPT_MAX; i++) + msi_free_action_script( package, i );
- for (j = 0; j < package->script->UniqueActionsCount; j++) - msi_free( package->script->UniqueActions[j] ); - - msi_free( package->script->UniqueActions ); - msi_free( package->script ); - } + for (i = 0; i < package->unique_actions_count; i++) + msi_free( package->unique_actions[i] ); + msi_free( package->unique_actions);
LIST_FOR_EACH_SAFE( item, cursor, &package->binaries ) { @@ -1061,7 +1054,6 @@ MSIPACKAGE *MSI_CreatePackage( MSIDATABASE *db, LPCWSTR base_url ) msi_adjust_privilege_properties( package );
package->ProductCode = msi_dup_property( package->db, szProductCode ); - package->script = msi_alloc_zero( sizeof(MSISCRIPT) );
set_installer_properties( package );
@@ -1737,6 +1729,8 @@ static INT internal_ui_handler(MSIPACKAGE *package, INSTALLMESSAGE eMessageType, case INSTALLMESSAGE_INFO: case INSTALLMESSAGE_INITIALIZE: case INSTALLMESSAGE_TERMINATE: + case INSTALLMESSAGE_INSTALLSTART: + case INSTALLMESSAGE_INSTALLEND: return 0; case INSTALLMESSAGE_SHOWDIALOG: { @@ -1858,7 +1852,8 @@ LPWSTR msi_get_error_message(MSIDATABASE *db, int error) INT MSI_ProcessMessageVerbatim(MSIPACKAGE *package, INSTALLMESSAGE eMessageType, MSIRECORD *record) { LPWSTR message = {0}; - DWORD len, log_type = 0; + DWORD len; + DWORD log_type = 1 << (eMessageType >> 24); UINT res; INT rc = 0; char *msg; @@ -1866,35 +1861,6 @@ INT MSI_ProcessMessageVerbatim(MSIPACKAGE *package, INSTALLMESSAGE eMessageType, TRACE("%x\n", eMessageType); if (TRACE_ON(msi)) dump_record(record);
- if ((eMessageType & 0xff000000) == INSTALLMESSAGE_FATALEXIT) - log_type |= INSTALLLOGMODE_FATALEXIT; - if ((eMessageType & 0xff000000) == INSTALLMESSAGE_ERROR) - log_type |= INSTALLLOGMODE_ERROR; - if ((eMessageType & 0xff000000) == INSTALLMESSAGE_WARNING) - log_type |= INSTALLLOGMODE_WARNING; - if ((eMessageType & 0xff000000) == INSTALLMESSAGE_USER) - log_type |= INSTALLLOGMODE_USER; - if ((eMessageType & 0xff000000) == INSTALLMESSAGE_INFO) - log_type |= INSTALLLOGMODE_INFO; - if ((eMessageType & 0xff000000) == INSTALLMESSAGE_RESOLVESOURCE) - log_type |= INSTALLLOGMODE_RESOLVESOURCE; - if ((eMessageType & 0xff000000) == INSTALLMESSAGE_OUTOFDISKSPACE) - log_type |= INSTALLLOGMODE_OUTOFDISKSPACE; - if ((eMessageType & 0xff000000) == INSTALLMESSAGE_COMMONDATA) - log_type |= INSTALLLOGMODE_COMMONDATA; - if ((eMessageType & 0xff000000) == INSTALLMESSAGE_ACTIONSTART) - log_type |= INSTALLLOGMODE_ACTIONSTART; - if ((eMessageType & 0xff000000) == INSTALLMESSAGE_ACTIONDATA) - log_type |= INSTALLLOGMODE_ACTIONDATA; - if ((eMessageType & 0xff000000) == INSTALLMESSAGE_PROGRESS) - log_type |= INSTALLLOGMODE_PROGRESS; - if ((eMessageType & 0xff000000) == INSTALLMESSAGE_INITIALIZE) - log_type |= INSTALLLOGMODE_INITIALIZE; - if ((eMessageType & 0xff000000) == INSTALLMESSAGE_TERMINATE) - log_type |= INSTALLLOGMODE_TERMINATE; - if ((eMessageType & 0xff000000) == INSTALLMESSAGE_SHOWDIALOG) - log_type |= INSTALLLOGMODE_SHOWDIALOG; - if (!package || !record) message = NULL; else { @@ -2293,7 +2259,10 @@ static MSIRECORD *msi_get_property_row( MSIDATABASE *db, LPCWSTR name )
row = MSI_CreateRecord(1); if (!row) + { + msi_free(buffer); return NULL; + } MSI_RecordSetStringW(row, 1, buffer); msi_free(buffer); return row; @@ -2308,7 +2277,10 @@ static MSIRECORD *msi_get_property_row( MSIDATABASE *db, LPCWSTR name )
row = MSI_CreateRecord(1); if (!row) + { + msi_free(buffer); return NULL; + } MSI_RecordSetStringW(row, 1, buffer); msi_free(buffer); return row; diff --git a/dll/win32/msi/streams.c b/dll/win32/msi/streams.c index 596fa13cc8..642093e92c 100644 --- a/dll/win32/msi/streams.c +++ b/dll/win32/msi/streams.c @@ -194,28 +194,7 @@ static UINT STREAMS_insert_row(struct tagMSIVIEW *view, MSIRECORD *rec, UINT row
static UINT STREAMS_delete_row(struct tagMSIVIEW *view, UINT row) { - MSIDATABASE *db = ((MSISTREAMSVIEW *)view)->db; - UINT i, num_rows = db->num_streams - 1; - const WCHAR *name; - WCHAR *encname; - HRESULT hr; - - TRACE("(%p %d)!\n", view, row); - - name = msi_string_lookup( db->strings, db->streams[row].str_index, NULL ); - if (!(encname = encode_streamname( FALSE, name ))) return ERROR_OUTOFMEMORY; - hr = IStorage_DestroyElement( db->storage, encname ); - msi_free( encname ); - if (FAILED( hr )) - return ERROR_FUNCTION_FAILED; - hr = IStream_Release( db->streams[row].stream ); - if (FAILED( hr )) - return ERROR_FUNCTION_FAILED; - - for (i = row; i < num_rows; i++) - db->streams[i] = db->streams[i + 1]; - db->num_streams = num_rows; - + FIXME("(%p %d): stub!\n", view, row); return ERROR_SUCCESS; }
@@ -314,15 +293,12 @@ static UINT STREAMS_modify(struct tagMSIVIEW *view, MSIMODIFY eModifyMode, MSIRE r = streams_modify_update(view, rec); break;
- case MSIMODIFY_DELETE: - r = STREAMS_delete_row(view, row - 1); - break; - case MSIMODIFY_VALIDATE_NEW: case MSIMODIFY_INSERT_TEMPORARY: case MSIMODIFY_REFRESH: case MSIMODIFY_REPLACE: case MSIMODIFY_MERGE: + case MSIMODIFY_DELETE: case MSIMODIFY_VALIDATE: case MSIMODIFY_VALIDATE_FIELD: case MSIMODIFY_VALIDATE_DELETE: diff --git a/dll/win32/msi/suminfo.c b/dll/win32/msi/suminfo.c index 99bc431c66..067483d629 100644 --- a/dll/win32/msi/suminfo.c +++ b/dll/win32/msi/suminfo.c @@ -1000,117 +1000,6 @@ end: return r; }
-static UINT save_prop( MSISUMMARYINFO *si, HANDLE handle, UINT row ) -{ - static const char fmt_systemtime[] = "%d/%02d/%02d %02d:%02d:%02d"; - char data[20]; /* largest string: YYYY/MM/DD hh:mm:ss */ - static const char fmt_begin[] = "%u\t"; - static const char data_end[] = "\r\n"; - static const char fmt_int[] = "%u"; - UINT r, data_type, len; - SYSTEMTIME system_time; - FILETIME file_time; - INT int_value; - awstring str; - DWORD sz; - - str.unicode = FALSE; - str.str.a = NULL; - len = 0; - r = get_prop( si, row, &data_type, &int_value, &file_time, &str, &len ); - if (r != ERROR_SUCCESS && r != ERROR_MORE_DATA) - return r; - if (data_type == VT_EMPTY) - return ERROR_SUCCESS; /* property not set */ - snprintf( data, sizeof(data), fmt_begin, row ); - sz = lstrlenA( data ); - if (!WriteFile( handle, data, sz, &sz, NULL )) - return ERROR_WRITE_FAULT; - - switch (data_type) - { - case VT_I2: - case VT_I4: - snprintf( data, sizeof(data), fmt_int, int_value ); - sz = lstrlenA( data ); - if (!WriteFile( handle, data, sz, &sz, NULL )) - return ERROR_WRITE_FAULT; - break; - case VT_LPSTR: - len++; - if (!(str.str.a = msi_alloc( len ))) - return ERROR_OUTOFMEMORY; - r = get_prop( si, row, NULL, NULL, NULL, &str, &len ); - if (r != ERROR_SUCCESS) - { - msi_free( str.str.a ); - return r; - } - sz = lstrlenA( str.str.a ); - if (!WriteFile( handle, str.str.a, sz, &sz, NULL )) - { - msi_free( str.str.a ); - return ERROR_WRITE_FAULT; - } - msi_free( str.str.a ); - break; - case VT_FILETIME: - if (!FileTimeToSystemTime( &file_time, &system_time )) - return ERROR_FUNCTION_FAILED; - snprintf( data, sizeof(data), fmt_systemtime, system_time.wYear, system_time.wMonth, - system_time.wDay, system_time.wHour, system_time.wMinute, - system_time.wSecond ); - sz = lstrlenA( data ); - if (!WriteFile( handle, data, sz, &sz, NULL )) - return ERROR_WRITE_FAULT; - break; - case VT_EMPTY: - /* cannot reach here, property not set */ - break; - default: - FIXME( "Unknown property variant type\n" ); - return ERROR_FUNCTION_FAILED; - } - - sz = lstrlenA( data_end ); - if (!WriteFile( handle, data_end, sz, &sz, NULL )) - return ERROR_WRITE_FAULT; - - return ERROR_SUCCESS; -} - -UINT msi_export_suminfo( MSIDATABASE *db, HANDLE handle ) -{ - UINT i, r, num_rows; - MSISUMMARYINFO *si; - - r = msi_get_suminfo( db->storage, 0, &si ); - if (r != ERROR_SUCCESS) - r = msi_get_db_suminfo( db, 0, &si ); - if (r != ERROR_SUCCESS) - return r; - - num_rows = get_property_count( si->property ); - if (!num_rows) - { - msiobj_release( &si->hdr ); - return ERROR_FUNCTION_FAILED; - } - - for (i = 0; i < num_rows; i++) - { - r = save_prop( si, handle, i ); - if (r != ERROR_SUCCESS) - { - msiobj_release( &si->hdr ); - return r; - } - } - - msiobj_release( &si->hdr ); - return ERROR_SUCCESS; -} - UINT WINAPI MsiSummaryInfoPersist( MSIHANDLE handle ) { MSISUMMARYINFO *si; diff --git a/media/doc/README.WINE b/media/doc/README.WINE index 31f9c5eea2..1ed35c46fd 100644 --- a/media/doc/README.WINE +++ b/media/doc/README.WINE @@ -112,7 +112,7 @@ reactos/dll/win32/msg711.acm # Synced to WineStaging-2.9 reactos/dll/win32/msgsm32.acm # Synced to WineStaging-2.9 reactos/dll/win32/mshtml # Synced to WineStaging-1.7.55 reactos/dll/win32/mshtml.tlb # Synced to WineStaging-1.7.55 -reactos/dll/win32/msi # Synced to WineStaging-2.16 +reactos/dll/win32/msi # Synced to Wine-3.0 reactos/dll/win32/msimg32 # Synced to WineStaging-2.16 reactos/dll/win32/msimtf # Synced to WineStaging-2.9 reactos/dll/win32/msisip # Synced to WineStaging-2.9