cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

HOTFIX: CopyFile on Locked File Results in Installation Hanging

HOTFIX: CopyFile on Locked File Results in Installation Hanging

Summary

CopyFile does not return the correct error value when attempting to overwrite an existing locked file. This will provide the wrong value in a condition statement and prevent the custom action from closing resulting in a hanging installation.

Symptoms

When attempting to overwrite a locked file with the CopyFile function, no error code is returned which results in the installation hanging. In some cases, it will immediately go straight to the SetupCompleteError dialog

Cause

This behavior is caused by an issue with InstallShield 2013 and InstallShield 2014.

Steps To Reproduce

  1. Create a new Basic MSI project
  2. Use the function example below as an InstallScript custom action (this is pulled from the CopyFile help example)
  3. In the Custom Actions view, add the ExFn_CopyFile to run after CostFinalize in the UI sequence
  4. Set the Return Processing property to Synchronous (Check exit code)
  5. Build the project using the default releases values
  6. Copy the newly created executable to both "C:\Target" and "C:\Source" or new values if you modified the sample listed above
  7. Launch the executable file copied to "C:\Target" and leave the process running
  8. Launch the executable from the original build location
  9. Message box with ?An unspecified error occurred? displays as the results are not returned properly and the installation is unable to proceed
#define  SOURCE_DIR "C:\\Source"
#define  TARGET_DIR "C:\\Target"
 
// Include Ifx.h for built-in InstallScript function prototypes.
#include "Ifx.h"
 
export prototype ExFn_CopyFile(HWND);
 
function ExFn_CopyFile(hMSI)
    NUMBER nResult;
begin
    
    // Copy all files in the source directory, including files
    // in subdirectories, to the target directory.
    nResult = CopyFile(SOURCE_DIR ^ "*.*", TARGET_DIR ^ "*.*");
    
    // Report the results of the copy operation.
    switch (nResult)
        case 0:
            MessageBox ("Files successfully copied.", INFORMATION);
        case COPY_ERR_CREATEDIR:
            MessageBox ("A target directory could not be created.", SEVERE);
        case COPY_ERR_MEMORY:
            MessageBox ("Insufficient memory.", SEVERE);
        case COPY_ERR_NODISKSPACE:
            MessageBox ("Insufficint disk space.", SEVERE);
        case COPY_ERR_OPENINPUT:
            MessageBox ("Unable to open the input files in "+ SOURCE_DIR +".",
                       SEVERE);
        case COPY_ERR_OPENOUTPUT:
            MessageBox ("Unable to copy the source files.", SEVERE);
        case COPY_ERR_TARGETREADONLY:
            MessageBox ("A target file already exists and cannot be overwritten.",
                       SEVERE);
        default:
            MessageBox ("An unspecified error occurred.", SEVERE);
    endswitch;
 
end;


Resolution

This issue has been submitted as a bug to our Engineering team. The issue is being tracked under issue #IOJ-1667248.

To apply the HotFix attached below, please do the following steps:
  1. Close IS 2014 SP 1.
  2. Rename the following files by prepending ORIG_ to the file name:
C:\Program Files (x86)\InstallShield\2014\Redist\Language Independent\i386\ISSetup.dll
C:\Program Files (x86)\InstallShield\2014\Redist\Language Independent\i386\ISP\ISSetup.dll

3. Copy the HotFixed versions of ISSetup.dll to their respective locations on the target machine.
4. Launch IS 2014 SP 1 and rebuild the project.

Related KB Articles

InstallShield 2014 Known Issues
Was this article helpful? Yes No
No ratings
Version history
Last update:
‎Jul 19, 2018 05:00 PM
Updated by: