[Bug 33500] New: Creo Elements/Direct Modeling Express 4.0 fails to install (msi script custom action return value translation too restrictive)

wine-bugs at winehq.org wine-bugs at winehq.org
Wed May 1 09:17:40 CDT 2013


http://bugs.winehq.org/show_bug.cgi?id=33500

             Bug #: 33500
           Summary: Creo Elements/Direct Modeling Express 4.0 fails to
                    install (msi script custom action return value
                    translation too restrictive)
           Product: Wine
           Version: 1.5.29
          Platform: x86
        OS/Version: Linux
            Status: NEW
          Severity: normal
          Priority: P2
         Component: msi
        AssignedTo: wine-bugs at winehq.org
        ReportedBy: focht at gmx.net
    Classification: Unclassified


Hello folks,

while revisiting bug 27827 it seems the app installer now fails.
The translation of the return value of a vbscript function called in msi custom
action is the culprit.

"OSDM.msi" gets extracted from
"Creo-Elements-Direct-Modeling-Express4-M010-32-setup-EN.exe" and can be run
directly.

--- snip ---
$ wine msiexec -i OSDM.msi
...
0028:trace:msi:ScriptThread custom action (28) started
0028:trace:msi:ACTION_CallScript function L"ExportProperties", script L"option
explicit\r\non error resume next\r\n\r\nfunction ExportProperties( )\r\n\r\n 
Dim svLang\r\n  Dim svInstallLang\r\n  Dim svLanguageID\r\n    \r\n  On Error
Resume Next\r\n\r\n  svLang = Session.Property( \"UserLanguageID\" )\r\n\r\n 
Select Case svLang\r\n\r\n    Case \"1031\", \"2055\", \"307"...
...
0028:trace:msi:MsiActiveScriptSite_OnEnterScript (0x4dfc50) 
...
0028:trace:msi:MsiActiveScriptSite_OnLeaveScript (0x4dfc50)
0028:trace:msi:MsiActiveScriptSite_OnStateChange State: Connected.
0028:trace:msi:call_script Calling function L"ExportProperties" 
...
0028:trace:msi:MsiActiveScriptSite_OnEnterScript (0x4dfc50) 
...
0028:trace:msi:MsiActiveScriptSite_OnLeaveScript (0x4dfc50)
0028:Call oleaut32.VariantChangeType(00a7e848,00a7e848,00000000,00000003)
ret=7ecfc53b
0028:Ret  oleaut32.VariantChangeType() retval=00000000 ret=7ecfc53b
0028:Call oleaut32.VariantClear(00a7e848) ret=7ecfc570
0028:Ret  oleaut32.VariantClear() retval=00000000 ret=7ecfc570
0028:trace:msi:MsiActiveScriptSite_OnStateChange State: Disconnected.
0028:trace:msi:MsiActiveScriptSite_OnStateChange State: Initialized.
0028:trace:msi:MsiActiveScriptSite_OnStateChange State: Closed. 
...
0028:Ret  ole32.CoUninitialize() retval=00000000 ret=7ecfc6db
0028:trace:msi:ACTION_CallScript script returned 1603
0028:trace:msi:MsiCloseHandle 1
0028:trace:msi:ScriptThread custom action (28) returned 1603
0028:trace:msi:MsiCloseAllHandles  
...
0024:err:msi:ITERATE_Actions Execution halted, action L"ExportProperties"
returned 1603 
--- snip ---

The embedded vbscript source code of "ExportProperties" function:

--- snip ---
option explicit
on error resume next

function ExportProperties( )

  Dim svLang
  Dim svInstallLang
  Dim svLanguageID

  On Error Resume Next

  svLang = Session.Property( "UserLanguageID" )

  Select Case svLang

    Case "1031", "2055", "3079", "4103", "5127"
         svInstallLang = "german"
         svLanguageID  = "1031"

    Case "1033", "2057", "3081", "4105", "5129", "6153", _
         "7177", "8201", "9225", "10249", "11273"
         svInstallLang = "english"
         svLanguageID  = "1033"

    Case "1034", "2058", "3082", "4106", "5130", "6154", "7178", "8202",
"9226", _
         "10250", "11274", "12298", "13322", "14346", "15370", "16394",
"17418", _
         "18442", "19466", "20490"
         svInstallLang = "spanish"
         svLanguageID  = "1034"

    Case "1036", "2060", "3084", "4108", "5132"
         svInstallLang = "french"
         svLanguageID  = "1036"

    Case "1040", "2064"
         svInstallLang = "italian"
         svLanguageID  = "1040"

    Case "1041"
         svInstallLang = "japanese"
         svLanguageID  = "1041"

    Case Else
         svInstallLang = svLang
         svLanguageID  = svLang

  End Select

  Session.Property( "InstallLanguage" ) = svInstallLang
  Session.Property( "GroupLanguageID" ) = svLanguageID

  ExportProperties = 0

End Function
--- snip ---

"ExportProperties" explicitly returns "0" (msiDoActionStatusNoAction), no other
code path.

Wine source:
http://source.winehq.org/git/wine.git/blob/3b0179cbde19e650804cb3b5a81857627470b0cb:/dlls/msi/script.c#l279

--- snip ---
 279 DWORD call_script(MSIHANDLE hPackage, INT type, LPCWSTR script, LPCWSTR
function, LPCWSTR action)
 280 {
 281     HRESULT hr;
 282     IActiveScript *pActiveScript = NULL;
 283     IActiveScriptParse *pActiveScriptParse = NULL;
 284     MsiActiveScriptSite *scriptsite;
 285     IDispatch *pDispatch = NULL;
 286     DISPPARAMS dispparamsNoArgs = {NULL, NULL, 0, 0};
 287     DISPID dispid;
 288     CLSID clsid;
 289     VARIANT var;
 290     DWORD ret = ERROR_INSTALL_FAILURE;
 291 
 292     CoInitialize(NULL);
...
 344     /* Call a function if necessary through the IDispatch interface */
 345     if (function != NULL && strlenW(function) > 0) {
 346         TRACE("Calling function %s\n", debugstr_w(function));
 347 
 348         hr = IActiveScript_GetScriptDispatch(pActiveScript, NULL,
&pDispatch);
 349         if (FAILED(hr)) goto done;
 350 
 351         hr = IDispatch_GetIDsOfNames(pDispatch, &IID_NULL, (WCHAR
**)&function, 1,LOCALE_USER_DEFAULT, &dispid);
 352         if (FAILED(hr)) goto done;
 353 
 354         hr = IDispatch_Invoke(pDispatch, dispid, &IID_NULL,
LOCALE_USER_DEFAULT, DISPATCH_METHOD, &dispparamsNoArgs, &var, NULL, NULL);
 355         if (FAILED(hr)) goto done;
 356 
 357         /* Check return value, if it's not IDOK we failed */
 358         hr = VariantChangeType(&var, &var, 0, VT_I4);
 359         if (FAILED(hr)) goto done;
 360 
 361         if (V_I4(&var) == IDOK)
 362             ret = ERROR_SUCCESS;
 363         else ret = ERROR_INSTALL_FAILURE;
 364 
 365         VariantClear(&var);
 366     } else {
 367         /* If no function to be called, MSI behavior is to succeed */
 368         ret = ERROR_SUCCESS;
 369     }
...
--- snip ---

MSDN:
http://msdn.microsoft.com/en-us/library/windows/desktop/aa371254%28v=vs.85%29.aspx

--- quote ---
Custom actions written in JScript or Visual Basic, Scripting Edition (VBScript)
can call an optional function. These functions must return one of the values
shown in the following table.

Return value    Value    Description

msiDoActionStatusNoAction    0    Action not executed.
msiDoActionStatusSuccess    IDOK = 1    Action completed successfully.
msiDoActionStatusUserExit    IDCANCEL = 2    Premature termination by user.
msiDoActionStatusFailure    IDABORT = 3    Unrecoverable error. Returned if
there is an error during parsing or execution of the JScript or VBScript.
msiDoActionStatusSuspend    IDRETRY = 4    Suspended sequence to be resumed
later.
msiDoActionStatusFinished    IDIGNORE = 5    Skip remaining actions. Not an
error.

Note that Windows Installer translates the return values from all actions when
it writes the return value into the log file. For example, if the action return
value appears as 1 (one) in the log file, this means that the action returned
msiDoActionStatusSuccess. For more information about this translation see
Logging of Action Return Values.

To return a value other than success from a script custom action, you must use
a function target for the custom action. The target function is specified in
the Target column of the CustomAction Table. 
--- quote ---

Translating everything not "IDOK" to ERROR_INSTALL_FAILURE seems overly
restrictive.

$ du -sh Creo-Elements-Direct-Modeling-Express4-M010-32-setup-EN.exe 
157M    Creo-Elements-Direct-Modeling-Express4-M010-32-setup-EN.exe

$ sha1sum Creo-Elements-Direct-Modeling-Express4-M010-32-setup-EN.exe 
4b77817ac55bf4cbbd85f02949d8d97e9a0ca19a 
Creo-Elements-Direct-Modeling-Express4-M010-32-setup-EN.exe

$ wine --version
wine-1.5.29-38-g8e4317c

Regards

-- 
Configure bugmail: http://bugs.winehq.org/userprefs.cgi?tab=email
Do not reply to this email, post in Bugzilla using the
above URL to reply.
------- You are receiving this mail because: -------
You are watching all bug changes.



More information about the wine-bugs mailing list