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

Installscript Custom Action and Mapped Drive

We have an Installscript custom action in our basic MSI install that does some configuration for our application. We were having UAC problems with it, so we changed it from Immediate Execution to Deferred Execution in System Context. We also had to move the custom action before the InstallFinalize action in the Execute sequence.

This all works fine when we install to a local drive, but when we install to a mapped drive on a remote system, the custom action never executes (we have SprintfMSiLog() calls that are not getting into the log). We ran with full MSI logging, and here is the section from the MSI log:

MSI (s) (78:78) [12:41:24:189]: Executing op: ActionStart(Name=AfterInstallingFiles,,)
Action 12:41:24: AfterInstallingFiles.
MSI (s) (78:78) [12:41:24:189]: Executing op: CustomActionSchedule(Action=AfterInstallingFiles,ActionType=3585,Source=BinaryData,Target=f1,)
MSI (s) (78:78) [12:41:24:205]: Executing op: End(Checksum=0,ProgressTotalHDWord=1,ProgressTotalLDWord=1129473356)
MSI (s) (78:78) [12:41:24:392]: User policy value 'DisableRollback' is 0
MSI (s) (78:78) [12:41:24:392]: Machine policy value 'DisableRollback' is 0
Action 12:41:24: RollbackCleanup. Removing backup files
MSI (s) (78:20) [12:41:24:486]: Invoking remote custom action. DLL: C:\WINDOWS\Installer\MSIADFF.tmp, Entrypoint: f1
MSI (s) (78:EC) [12:41:24:486]: Generating random cookie.
MSI (s) (78:EC) [12:41:24:486]: Created Custom Action Server with PID 760 (0x2F8).
MSI (s) (78:10) [12:41:24:549]: Running as a service.
MSI (s) (78:10) [12:41:24:549]: Hello, I'm your 32bit Elevated custom action server.
InstallShield 12:41:24: Running InstallScript function f1
InstallShield 12:41:24: Opening stream of file C:\WINDOWS\Installer\MSIADFF.tmp
InstallShield 12:41:24: Extracting support file IsConfig.ini to C:\DOCUME~1\baxter\LOCALS~1\Temp\{30BE021D-6A47-447A-B151-381711AF3CFE}\IsConfig.ini
InstallShield 12:41:24: Extracted isconfig.ini to C:\DOCUME~1\baxter\LOCALS~1\Temp\{30BE021D-6A47-447A-B151-381711AF3CFE}\IsConfig.ini
InstallShield 12:41:24: Got '{99BD952E-8FBD-4B14-A397-D4B573934829}' for TempPathGuid from isconfig.ini
InstallShield 12:41:24: Attempting to use temp path 'C:\DOCUME~1\baxter\LOCALS~1\Temp\{99BD952E-8FBD-4B14-A397-D4B573934829}'
InstallShield 12:41:24: Using temp folder C:\DOCUME~1\baxter\LOCALS~1\Temp\{30BE021D-6A47-447A-B151-381711AF3CFE}
InstallShield 12:41:24: Installing engine...
InstallShield 12:41:24: Using product language 0
InstallShield 12:41:24: Extracting support file setup.inx to C:\DOCUME~1\baxter\LOCALS~1\Temp\{30BE021D-6A47-447A-B151-381711AF3CFE}\setup.inx
InstallShield 12:41:24: Extracting support file ISRT.dll to C:\DOCUME~1\baxter\LOCALS~1\Temp\{30BE021D-6A47-447A-B151-381711AF3CFE}\ISRT.dll
InstallShield 12:41:25: Extracting support file _isres_0x0409.dll to C:\DOCUME~1\baxter\LOCALS~1\Temp\{30BE021D-6A47-447A-B151-381711AF3CFE}\_isres_0x0409.dll
InstallShield 12:41:25: Extracting support file String1033.txt to C:\DOCUME~1\baxter\LOCALS~1\Temp\{30BE021D-6A47-447A-B151-381711AF3CFE}\String1033.txt
InstallShield 12:41:25: Skipping optional support file _isuser_0x0409.dll
InstallShield 12:41:25: Setting script cmdline...
InstallShield 12:41:25: ProductCode is {51676C0E-2D18-49F3-A1BE-005DE2654168}
InstallShield 12:41:25: Initializing Engine
InstallShield 12:41:25: Done Initializing...
InstallShield 12:41:25: Registering Msi Server...
InstallShield 12:41:25: Invoking script function AfterInstallingFiles
InstallShield 12:41:25: CallScriptFunctionFromMsiCA() ends
InstallShield 12:41:26: Cleaning up temp file C:\DOCUME~1\baxter\LOCALS~1\Temp\{30BE021D-6A47-447A-B151-381711AF3CFE}\ISRT.dll
InstallShield 12:41:26: Cleaning up temp file C:\DOCUME~1\baxter\LOCALS~1\Temp\{30BE021D-6A47-447A-B151-381711AF3CFE}\IsConfig.ini
InstallShield 12:41:26: Cleaning up temp file C:\DOCUME~1\baxter\LOCALS~1\Temp\{30BE021D-6A47-447A-B151-381711AF3CFE}\String1033.txt
InstallShield 12:41:26: Cleaning up temp file C:\DOCUME~1\baxter\LOCALS~1\Temp\{30BE021D-6A47-447A-B151-381711AF3CFE}\_isres_0x0409.dll
InstallShield 12:41:26: Cleaning up temp file C:\DOCUME~1\baxter\LOCALS~1\Temp\{30BE021D-6A47-447A-B151-381711AF3CFE}\setup.inx
MSI (s) (78:78) [12:41:26:064]: Calling SRSetRestorePoint API. dwRestorePtType: 0, dwEventType: 103, llSequenceNumber: 1468, szDescription: "".
MSI (s) (78:78) [12:41:26:064]: The call to SRSetRestorePoint API succeeded. Returned status: 0.
MSI (s) (78:78) [12:41:26:064]: Unlocking Server
MSI (s) (78:78) [12:41:26:064]: PROPERTY CHANGE: Deleting UpdateStarted property. Its current value is '1'.
Action ended 12:41:26: InstallFinalize. Return value 1.

There is no indication of error, but our custom action code is not getting executed. Anyone have any ideas?
Labels (1)
0 Kudos
(3) Replies
KathyMorey
Level 10

As I understand it, when the install elevates to admin privileges (as it does when items are run in System Context), the drive mappings for the user are not carried over. This due to the way UAC creates the admin security token, not to anything having to do with Windows Installer. I think you may have to use UNC paths in your custom action to get them to work.
0 Kudos
lbhafen
Level 3

Kathy,

Thanks, I think you found it. The first thing my custom action does is read the INSTALLDIR from the registry (since properties are not available) and then validate it. The validation would fail since the drive does not exist. This is done prior to outputting our log message. I will rework the code.
0 Kudos
Cary_R
Level 11

Hi Ibfahen,

Another point to be aware of, since it is relevant:

Q111936: INFO: Custom Action Fails when Copying a File from a UNC Path
http://kb.flexerasoftware.com/selfservice/viewContent.do?externalId=Q111936&sliceId=1

Basically "System Context" tries to access even a UNC path with a NULL user session, and will fail on any modern Windows OS. UNC complicates this since for proper elevation, you need the "System Context".

Kathey's point is also valid in this case, as Microsoft documents here:

http://support.microsoft.com/kb/937624

This also applies to open network share sessions, in case you authenticated with credentials other than what you logged on with.
0 Kudos