InstallShield Tips and Techniques

August 15, 2007

Installing to PALM Devices using InstallShield MSI

Filed under: Palm Device, Techniques — shieldmaster @ 11:27 pm

I started a project to create a Basic MSI installation to deliver some client files on a workstation. Not a problem, but the kicker was that in addition, I needed to install a PALM .PRC to a PALM user, and then install a Conduit.

I spent dozens of hours researching this topic, using the Google message boards, and the PALM reference documentation. I have finally succeeded in accomplishing all of my objectives. The final objective was to put out on the Blog what needed to be done. Well here it is!

Note: I created a Basic MSI project using InstallShield X.5 with Custom Actions created using InstallScript – but all the steps could have been done in an earlier/later version, or an InstallScript version. In fact you will note that in one aspect using InstallScript may have been the better choice.

Step 1: Before User dialogs are presented

Determine if PALM Desktop is loaded – cancel install if not present

This Custom Action should be run before any Dialogs are presented; run CondMgr.dll with the function:

nError = CmGetHotSyncExecPath (szPath, p_nvSize);

RC = 0 means PALM Desktop was found and valid path returned, (along with HOTSYNC.exe appended…)

Parse the szPath to obtain just the path:

ParsePath ( gPALMHotSyncPath, szPath, PATH );

Note: Carry these DLLs in your SupportArea. For the first C.A., use the CondMgr.dll that you carry to determine the HotSync path. From that point on, always attempt to load the DLL from the HotSync path, if it fails, then use the one in your SupportArea.

The path is where the HotSync binaries will be found, and can be used in APP PATH registry to create a path to the HS Binaries for your application. All further UseDLL commands should attempt to use the DLL within this path first.

Note: Run C.A. as Immediate Action, but ensure C.A. is run at least once in either the UI or Execute sequence because install might be run silently and then dialogs won’t be presented.

Step 2: During or just before Dialogs are presented

If you have a .PRC file that needs to be installed to the PALM Desktop for synchronization to the PDA, you need to create Custom Actions that will:

Retrieve all users defined to PALM Desktop
Reject any Profiles
Create STRINGLIST or write temporary records to MSI database ListBox

This Custom Action will be running InstAide.dll to retrieve the users; unfortunately it doesn’t distinguish between PALM users or profiles.

To get the users defined to the PALM Desktop, first you need to obtain the total users:
nNumUsers = PltGetUserCount ();

The value in nNumUsers will be a total count of Users and Profiles defined. Create a loop to retrieve each user using a counter from 0 to (nNumUsers -1). For example, if nNumUsers = 12, the first counter will be 0, the final counter value will be 11.

nzUserNameSize = PltGetUser (nCounter, szUserName, p_nvSize);

Each call to the function PltGetUser will return the User/Profile name defined. Now you need to call the function PltIsUserProfile with the user name to determine whether it is a User name versus a Profile.
nResult = PltIsUserProfile(szUserName);

if (nResult = 0) then this user is a defined “User”

Once you have the PALM users, you have two options available with a MSI Basic* install.

First, you can create a STRINGLIST of all PALM Users and install the PRC file to all of the Users. This might be an option for when you may be running a Silent installation, where the user running the installation doesn’t have the ability to choose one user.

ListGetFirstString (gListUsers, svSelectedUser);
while (nResult != END_OF_LIST)
nError = PltInstallFile (svSelectedUser, szPLogAppFilePath);
if (nError = 0) then
….
else
szMsg = “ERROR! PALM HotSync would not install %s!\n” +
“Attempt to install this file for the selected User: %s ” +
“failed.\n\nPlease manually install this application onto the PDA”;
MessageBox (szMsg, WARNING);
endif;
ListGetNextString (gListUsers, svSelectedUser);
endwhile;

Second, you write each user to the LISTBOX table, using a temporary entry to the MSI database. These entries will then appear in the Dialog LISTBOX screen for the user to choose one entry. After the Dialogs have completed, you can retrieve the selected user from the property associated with the LISTBOX and install the PRC file to this user.

////////////////////////////////////////////////////////////////////////////////
// This script populates the LISTALLPALMUSERS control in the ISI_ListBox
// dialog with the current values from the STRINGLIST gListUsers
// The end user’s selection for the ListBox is stored in LISTALLPALMUSERS
//
////////////////////////////////////////////////////////////////////////////////

// open view into ListBox table
MsiDatabaseOpenView(ISMSI_HANDLE,
“SELECT * FROM `ListBox` WHERE `Property`=’LISTALLPALMUSERS'”,
hViewlist);
MsiViewExecute(hViewlist, NULL);

r = 0;

// Get the first string in the list.
nResult = ListGetFirstString (gListUsers, szUserName);

// Loop while list items continue to be retrieved.
while (nResult != END_OF_LIST)

nBuffer = 256; // set size buffer
MsiRecordGetString(hRecordprop, 1, szUserName, nBuffer);
nBuffer = 256; // reset size buffer
//MsiGetProperty(ISMSI_HANDLE, svPropname, svPropvalue, nBuffer);
r = r + 1;
hRecordlist = MsiCreateRecord(4);

MsiRecordSetString(hRecordlist, 1, “LISTALLPALMUSERS”);
MsiRecordSetInteger(hRecordlist, 2, r);
MsiRecordSetString(hRecordlist, 3, szUserName);
MsiRecordSetString(hRecordlist, 4, szUserName);

// can only temporarily modify running .msi database
MsiViewModify(hViewlist, MSIMODIFY_INSERT_TEMPORARY, hRecordlist);
// Get the next string in the list.
nResult = ListGetNextString (gListUsers, szUserName);
endwhile;

MsiViewClose(hViewlist);
MsiViewClose(hViewprop);

Note: Run C.A. as Immediate Action, but ensure C.A. is run at least once in either the UI or Execute sequence because install might be run silently and then dialogs won’t be presented.

palm-listbox.jpg

* MSI Basic – the ListBox has a severe Windows Installer limitation in that you can only select one entry from the ListBox. The Standard InstallScript project’s ListBox will allow multiple selections to be made… If this is critical it should be your guidance as to whether to create the project using InstallScript over Basic MSI.

Step 3: Install PRC file

Obtain PALM user selected for PRC Installation
Install PRC to selected PALM user using the InstAide.Dll

nError = PltInstallFile (svSelectedUser, szAppFilePath);

Step 4: Install Conduit file

• Install a Conduit (if required) using CondMgr.dll

nResult = CmInstallCreator( szConduitName, nzConduit_Application);

nResult = CmSetCreatorName( szConduitName, szConduitFileName);

There may be other items to be required to install the Conduit – determine what they are and pass them by the developers just in case…

Issue a restart to HotSync for it to recognize the installed PRC using HSAPI.dll

nError = HsSetAppStatus (HSRESTART, HSFLAG_NONE);

Note: Run C.A. as Deferred Action

Step 5: Uninstall Process

Remove the Conduit (if required) using CondMgr.dll

nResult = CmRemoveConduitByCreatorID( szConduitName);

Advertisements

1 Comment »

  1. Hi, just wanted to say, I loved this blog post. It was helpful.
    Keep on posting!

    Comment by pron web site — March 28, 2013 @ 3:17 pm


RSS feed for comments on this post. TrackBack URI

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

Blog at WordPress.com.

%d bloggers like this: