Wednesday, June 13, 2012

Re-Packaging Apple Quicktime 7.72.80.56 and later versions

Quicktime comes as an EXE file which can be extracted easily with 7Zip. The three MSI I received were AppleApplicationSupport, AppleSoftwareUpdate and Quicktime. The Apple Update MSI can be discarded if you do not want to AutoUpdate your Quicktime.

Apple Application Support MSI can be directly installed with /qb! switch.

iTunes can be packaged separately and I have created a separate post for its customization:
http://msiworld.blogspot.com.au/2012/06/re-packaging-apple-itunes-10617-and.html

Quicktime should be modified through Transform as follows:

1) Change the following properties in your MST:

 SCHEDULE_ASUW =0
  REGSRCH_DESKTOP_SHORTCUTS =0
 REBOOT=ReallySuppress

2) Install Quicktime on a test machine and do all the customizations you want with preferences. Once all customizations are complete, copy the quicktime.qtp file from "%userprofile%\AppData\LocalLow\Apple Computer\QuickTime\QuickTime.qtp"

Add this file to Transform in C:\ProgramData\Apple Computer\QuickTime\QuickTime.qtp.

Now add these two scripts in your package in Custom Action to run just before Install Finalize and with Condition as NOT REMOVE~="ALL"

a) This script will copy the .qtp file to all the users profile.
----------------------------------------------------------------------
'Created by Piyush Nasa
'Used to copy the config file to the current user\appdata\local directory.
on error resume next
Set oShell = CreateObject( "WScript.Shell" )
userprofile=oShell.ExpandEnvironmentStrings("%USERPROFILE%")
systemdrive=oShell.ExpandEnvironmentStrings("%SYSTEMDRIVE%")
Set fso = CreateObject("Scripting.FileSystemObject")
Set afile = fso.GetFile(systemdrive & "\ProgramData\Apple Computer\QuickTime\QuickTime.qtp")
strDestination1 =userprofile & "\AppData\LocalLow\Apple Computer\QuickTime\QuickTime.qtp"

fso.CreateFolder(userprofile & "\Application Data\LocalLow\Apple Computer")
fso.CreateFolder(userprofile & "\Application Data\LocalLow\Apple Computer\QuickTime")
afile.Copy(strDestination1)
------------------------------------------------------------------------
b) This script will create the registry key for every user.
------------------------------------------------------------------------
'Created by Piyush Nasa
'Used to create HKCU registry to point to qtp file.
Option Explicit
Dim Temp
'HKEY_CURRENT_USER = HKCU
'HKEY_LOCAL_MACHINE = HKLM
'HKEY_CLASSES_ROOT = HKCR
'HKEY_USERS = HKEY_USERS
'HKEY_CURRENT_CONFIG = HKEY_CURRENT_CONFIG
Temp = WriteReg("HKCU\Software\Apple Computer, Inc.\QuickTime\LocalUserPreferences\FolderPath","%userprofile%\AppData\LocalLow\Apple Computer\QuickTime\","REG_SZ")

Function WriteReg(RegPath, Value, RegType)
       'Regtype should be "REG_SZ" for string, "REG_DWORD" for a integer,…
       '"REG_BINARY" for a binary or boolean, and "REG_EXPAND_SZ" for an expandable string
       Dim objRegistry, Key
       Set objRegistry = CreateObject("Wscript.shell")
      Key = objRegistry.RegWrite(RegPath, Value, RegType)
       WriteReg = Key
End Function
---------------------------------------------------------------------------

3) Add any HKCU registry key in a new component placed at the highest parent Feature. Set this as a keypath. This will ensure that the application is self healed when launched by the user.

4) You will have to remove a Launch condition to check if the existing version is installed already, because I faced a problem and it was not uninstalling properly too with that condition being there. Though this step is optional.

Please note that this package works fine when deployed/installed through any deployment tool in System context as it will trigger the self heal. If you have to manually install this application then you need to add the file the LOCALAPPDATAFOLDER manually in your transform.

Hope this will expidite your packaging of Quicktime application.

18 comments:

Anonymous said...

thanks for posting, are the paths mentioned specific to vista+7, what would the relevant XP path look like?

thanks

Piyush Nasa said...

This is for Windows 7 specificaly. You can check the path in XP by trying %appdata% and it should go there.
ProgramData is same as %allusersprofile%

MattM said...

Excellent work!

A couple questions, is there a setting to turn off the dialogue box that pops up asking for file association and a way to remove all the greyed PRO’s in the menus?
Thank you.

Piyush Nasa said...

I would suggest you to take a setup capture of whatever customization you want and include it in your package.

Dan said...

I personally try and avoid scripting when ever possible...

Personally I used the duplicate files table and self heal to place my custom qtp file.

FYI duplicate file table is very handy at times, allows you to install a custom file in a central location (say installdir), then duplicate files table will copy it to another location during install/repair etc. Useful tool, I think I had to use this method because this product creates a custom source location (or is it itunes), so any files you add via mst will not be found during a repair (unless you copy the cab/files to the customer source location).

Now this method does require you to build out your directory table to include the folders you need to place the file, to support both xp/w7 many times you have to duplicate entries due to the slight differences that may be need (sorry this is from memory, could be confusing itunes).

Nothing terribly wrong with using vbs scripting, just know that you can may loose handy win installer features that could be leveraged during future upgrades etc

Piyush Nasa said...

Hi Dan, Somehow I have not had a good experience with Duplicate File table so I try to avoid it. It is totally a packagers choice how he wants to deploy a thing. I have just showcased a way to do it.

Anonymous said...

Hi, What do you mean and how do you this in Orca? "Add this file to Transform in C:\ProgramData\Apple Computer\QuickTime\QuickTime.qtp."

Piyush Nasa said...

It would be little difficult to do this through ORCA. You can do it through any packaging tool like WISE, Installshield

Peter said...

Hi, HOW DID YOU EXACTLY DO IT WHEN YOU SAID, "Add this file to Transform in C:\ProgramData\Apple Computer\QuickTime\QuickTime.qtp". Is this purely in ORCA? Or you useda a 3rd party program to achieve this? a

Piyush Nasa said...

I used WISE Package Studio. You can use Installshield/Admin Studio or any other 3rd party tool which can help you achieve your task.

Unknown said...

Excellent work Piyush, this saved me a lot of time.

I want to raise some things I encountered when packaging version 7.7.3 however, as originally I had followed this to the letter and had issues with it working properly.

Mainly when running the install as a system user it would hang. Running it as an admin user, it seemed that the Quicktime Preferences screen would pop up towards the end of the install, a behaviour I found rather bizarre.

I noticed the preferences .qtp file was not copying from the C:\ProgramData location to it's destination and even if I copied manually the Quicktime.qtp file, and had the HKCU registry key pointing to the right location, Quicktime would not load the preferences. I later discovered by installing the standard .exe that the HKCU\Software\Apple Computer, Inc.\QuickTime\LocalUserPreferences\FolderPath string points to C:\Users\\AppData\LocalLow...etc while the script itself writes %userprofile%\AppData\LocalLow...etc. Via modifying the key and relaunching Quicktime I confirmed that Quicktime does not recognise the environment variable for some reason. A quick fix for this was to add a couple of things to your script which I have copied below:
-----------------------------------
Option Explicit
Dim oShell,Temp,userprofile
Set oShell = CreateObject("WScript.Shell")
userprofile=oShell.ExpandEnvironmentStrings("%USERPROFILE%")
'HKEY_CURRENT_USER = HKCU
'HKEY_LOCAL_MACHINE = HKLM
'HKEY_CLASSES_ROOT = HKCR
'HKEY_USERS = HKEY_USERS
'HKEY_CURRENT_CONFIG = HKEY_CURRENT_CONFIG
Temp = WriteReg("HKCU\Software\Apple Computer, Inc.\QuickTime\LocalUserPreferences\FolderPath", userprofile & "\AppData\LocalLow\Apple Computer\QuickTime\","REG_SZ")

Function WriteReg(RegPath, Value, RegType)
'Regtype should be "REG_SZ" for string, "REG_DWORD" for a integer,…
'"REG_BINARY" for a binary or boolean, and "REG_EXPAND_SZ" for an expandable string
Dim objRegistry, Key
Set objRegistry = CreateObject("Wscript.shell")
Key = objRegistry.RegWrite(RegPath, Value, RegType)
WriteReg = Key
End Function
-----------------------------------

This script will now expand the variable and write that to the key instead.

Another issue I encountered is that the script which copies the .qtp file is pointing to "userprofile & "\Application Data\LocalLow\Apple Computer\QuickTime" this directory is not valid for Windows7 so as such the script should be modified to copy the .qtp file to:
-----------------------------------
On Error Resume Next
Set oShell = CreateObject("WScript.Shell")
userprofile=oShell.ExpandEnvironmentStrings("%USERPROFILE%")
systemdrive=oShell.ExpandEnvironmentStrings("%SYSTEMDRIVE%")
Set fso = CreateObject("Scripting.FileSystemObject")
Set afile = fso.GetFile(systemdrive & "\ProgramData\Apple Computer\QuickTime\QuickTime.qtp")
strDestination1 = userprofile & "\AppData\LocalLow\Apple Computer\QuickTime\QuickTime.qtp"

fso.CreateFolder(userprofile & "\AppData\LocalLow\Apple Computer")
fso.CreateFolder(userprofile & "\AppData\LocalLow\Apple Computer\QuickTime")
afile.Copy(strDestination1)
-----------------------------------

One final thing I would like to add is that the Quicktime.qtp only handles the Quicktime Preferences (Edit>Preferences>Quicktime Preferences). If you would like your package to also have preconfigured player preferences (such as disabling the Content Guide on startup) then you will need to apply a similar approach to a file called QTPlayerSession.xml, this file can be commonly found in %userprofile%\AppData\Local\Apple Computer\QuickTime.

Anyway, that's about it, I felt it was necessary to share this information as this post helped me greatly in packaging Quicktime in a timely manner.


Cristhian

Piyush Nasa said...

Thanks Cristhian for your input. I am glad my post helped you. Hope your input will be helpful to others as well here. :)

Anonymous said...

Hi Piyush,

Thanks for the post. But, I am little lost and could not get this thing to work. How do you do this: "Now add these two scripts in your package in Custom Action to run just before Install Finalize and with Condition as NOT REMOVE~="ALL" in ORCA?

Thanks,

Piyush Nasa said...

You cannot do this through ORCA.
I used WISE Package Studio. You can use Installshield/Admin Studio or any other 3rd party tool which can help you achieve this.

Unknown said...

Piyush Nasa you're a start Thanks

looeee said...

THE PURE MSI WAY
run the install and grab the quicktime.qtp and qtplayersession.xml files as described already here

Using InstallShield or Wise, make a new Transform for Quicktime.MSI

Set the following properties
APPLEAPPLICATIONSUPPORTISINSTALLED {0C34B801-6AEC-4667-B053-03A67E2D0415}
ASUWISINSTALLED 0
REBOOT r
QT_TRAY_ICON #0
REGSRCH_DESKTOP_SHORTCUTS 0
SCHEDULE_ASUW 0

go to the Directory Table. We are going to need to add some folders for the components to go to.

these rows are for the folder AppData\Local\Apple Computer\Quicktime

LocalAppDataFolder TARGETDIR LADF|LocalAppData
LADF_Apple LocalAppDataFolder APPLEC~1|Apple Computer
LADF_QuickTime LADF_Apple QUICKT~1|Quicktime

these rows are for the folder AppData\LocalLow\Apple Computer\Quicktime

LOCALLOWAPPDATA TARGETDIR .
LLAD_AppleComp LOCALLOWAPPDATA ac|Apple Computer
LLAD_QuickTime LLAD_AppleComp QuickTime

Unfortunately AppData\LocalLow isn't a standard folder so we need to add a custom action to help locate it
Add this row into the CustomAction Table to have it set
SetLocalLow 35 LOCALLOWAPPDATA [%USERPROFILE]\Appdata\LocalLow

and this row into the InstallExecuteSequence (1410 is before InstallInitialize)
SetLocalLow 1410

Create two components in the QuickTimeEssentials feature.
call one of them qtplayersession.xml and the other quicktime.qtp
set qtplayersession.xml's destination folder to be LADF_QuickTime
set quicktime.qtp to LLAD_QuickTime

add the appropriate files to the appropriate components, telling InstallShield to put the files into a CAB

Go to the registry for component quicktime.qtp
add HKCU\software\Apple Computer, Inc.\QuickTime\LocalUserPreferences
Make a string entry called FolderPath
set [LLAD_QuickTime] as its value
set this value as the keypath for the component

Go to the registry for component qtplayersession.xml
add HKCU\software\Apple Computer, Inc.\QuickTime
Make a string entry called Installed
set 1 as its value
set this value as the keypath for the component

InstallShield saves the files in Data1.cab and we can have that cached by going to the MoveFile Table and adding the following row
Data1.cab QuickTimeInstallerCache Data1.cab SourceDir INSTALLERCACHE 0

Push Save and test the MSI+MST+CAB together

Rob said...

How do you handle the User data when you have an install tool that runs as the System account in a least privileged environment?

QuickTime 7.75
09/23/2014

Piyush Nasa said...

Hi Rob,

you need to write a script to copy data and run it either in active setup or you need to run it by SCCM in user mode. I am not sure what deployment tool you are using, but I use SCCM to run the script after the install as I chain these installs.