I have a problem with a few custom actions I am using in my Installshield Basic MSI which should pick some values from existing ini files (whose location will have been discovered and passed to a property by appsearch) and then set them as MSI properties.  However when I look at the msi log, the custom actions are just deleting all of the null values to these properties, which breaks the dialogs.

 

Here is one of the custom actions:

function WriteUserIniProperties (hMSI)

STRING  USERINI;
STRING  szDBLangTemp;
STRING  szSupportFTemp;
STRING  szDescriptionTemp;
STRING  szDefaultQueryTemp;
STRING  szDefaultAltTemp;
STRING  szWorkBookTemp;
STRING  szSupportPathTemp;                                 
STRING  szDBPathTemp;
STRING szResult;
STRING szRegisteredOwner;
STRING szRegisteredOrganization;
STRING szLicenceNoTemp;
STRING szEmailTemp;
STRING szLicencePathTemp;
STRING szCompareTemp;
STRING svDescriptionTemp;
LIST    listGeneric;
NUMBER nSize; begin listGeneric = ListCreate( STRINGLIST ); //This code deals with the User section of the user.ini file
 MsiGetProperty (ISMSI_HANDLE, "JATOUSERDIR", USERINI, nSize);
 GetProfString (USERINI, USER_SECTION, DBLANG_ENTRY, szDBLangTemp);
 MsiSetProperty (ISMSI_HANDLE, "DB_LANGUAGE", szDBLangTemp);
 GetProfString (USERINI, USER_SECTION, SUPPORTFILESPATH_ENTRY, szSupportFTemp);
 MsiSetProperty (ISMSI_HANDLE, "SUPPORTFILESPATH", szSupportFTemp);
 GetProfString (USERINI, USER_SECTION, DESCRIPTION_ENTRY, szDescriptionTemp);
  if (StrLength(svDescriptionTemp)!=0)
   then                    
   listGeneric = ListCreate(STRINGLIST);
         StrGetTokens(listGeneric,szResult,";");
   ListGetFirstString(listGeneric,szRegisteredOwner);
   ListGetNextString(listGeneric,szRegisteredOrganization);
   ListDestroy(listGeneric);
  endif;
 MsiSetProperty (ISMSI_HANDLE, "USERNAME", szRegisteredOwner);
 MsiSetProperty (ISMSI_HANDLE, "COMPANYNAME", szRegisteredOrganization);
 GetProfString (USERINI, USER_SECTION, DEFAULTQUERYCURRENCY, szDefaultQueryTemp);
 MsiSetProperty (ISMSI_HANDLE, "USER_DEFAULTQUERYCURRENCY", szDefaultQueryTemp);
 GetProfString (USERINI, USER_SECTION, DEFAULTALTERNATECURRENCY, szDefaultAltTemp);
 MsiSetProperty (ISMSI_HANDLE, "USER_DEFAULTALTERNATECURRENCY", szDefaultAltTemp);
 GetProfString (USERINI, USER_SECTION, JATOWORKBOOKPATH_ENTRY, szWorkBookTemp);
 MsiSetProperty (ISMSI_HANDLE, "WORKBOOKPATH", szWorkBookTemp);
 GetProfString (USERINI, USER_SECTION, SUPPORTFILESPATH_ENTRY, szSupportPathTemp);
 MsiSetProperty (ISMSI_HANDLE, "SUPPORTFILESPATH", szSupportPathTemp);
 GetProfString (USERINI, USER_SECTION, DATABASEPATH_ENTRY, szDBPathTemp);
 MsiSetProperty (ISMSI_HANDLE, "DBDIR", szDBPathTemp);
//This code deals with the Licence section of the user.ini file
 GetProfString (USERINI, LICENCE_SECTION, LICENCENO_ENTRY, szLicenceNoTemp);
 MsiSetProperty (ISMSI_HANDLE, "LC_LICENCENO", szLicenceNoTemp);
 GetProfString (USERINI, LICENCE_SECTION, EMAIL_ENTRY, szEmailTemp);
 MsiSetProperty (ISMSI_HANDLE, "EMAIL", szEmailTemp);
 GetProfString (USERINI, LICENCE_SECTION, LICENCEPATH_ENTRY, szLicencePathTemp);
 MsiSetProperty (ISMSI_HANDLE, "LICENCEDIR", szLicencePathTemp);
//This code deals with the Output section of the user.ini file
 GetProfString (USERINI, OUTPUT_SECTION, COMPARE_SYMBOL, szCompareTemp);
 MsiSetProperty (ISMSI_HANDLE, "USER_COMPARE_SYMBOL", szCompareTemp);
end;

.....and here is the section where it miswrites the properties in the log file:

MSI (c) (64:84) [16:57:23:348]: Doing action: WriteUserIniProperties
Action 16:57:23: WriteUserIniProperties.
Action start 16:57:23: WriteUserIniProperties.
MSI (c) (64:14) [16:57:23:398]: Invoking remote custom action. DLL: C:\Users\TIM~1.SHI\AppData\Local\Temp\MSI3E9F.tmp, Entrypoint: f8
MSI (c) (64!74) [16:57:25:278]: PROPERTY CHANGE: Deleting DB_LANGUAGE property. Its current value is '1'.
MSI (c) (64!74) [16:57:25:278]: PROPERTY CHANGE: Deleting SUPPORTFILESPATH property. Its current value is 'C:\ProgramData\JATO\Support\'.
MSI (c) (64!74) [16:57:25:278]: PROPERTY CHANGE: Deleting USERNAME property. Its current value is '{ID_STRING4685}'.
MSI (c) (64!74) [16:57:25:278]: PROPERTY CHANGE: Deleting COMPANYNAME property. Its current value is 'NULL'.
MSI (c) (64!74) [16:57:25:278]: PROPERTY CHANGE: Deleting USER_DEFAULTQUERYCURRENCY property. Its current value is 'NTV'.
MSI (c) (64!74) [16:57:25:278]: PROPERTY CHANGE: Deleting USER_DEFAULTALTERNATECURRENCY property. Its current value is 'EUR'.
MSI (c) (64!74) [16:57:25:278]: PROPERTY CHANGE: Deleting WORKBOOKPATH property. Its current value is '[JATOUSERDIR]Workbook'.
MSI (c) (64!74) [16:57:25:278]: PROPERTY CHANGE: Deleting DBDIR property. Its current value is 'C:\Users\Public\JATO\DATABASE\'.
MSI (c) (64!74) [16:57:25:278]: PROPERTY CHANGE: Deleting LC_LICENCENO property. Its current value is '0'.
MSI (c) (64!74) [16:57:25:278]: PROPERTY CHANGE: Deleting EMAIL property. Its current value is '{ID_STRING4681}'.
MSI (c) (64!74) [16:57:25:278]: PROPERTY CHANGE: Deleting LICENCEDIR property. Its current value is '[JATOUSERDIR]'.
MSI (c) (64!74) [16:57:25:278]: PROPERTY CHANGE: Deleting USER_COMPARE_SYMBOL property. Its current value is '=='.
Action ended 16:57:25: WriteUserIniProperties. Return value 1.

Now I can appreciate that the ini file path may not be completely correct on one of the custom actions but I would find it strange if it wasn't right on all of them - one thing I was a little wary of is whether or not the double backslashes are added into paths but I have seen on another internet forum that apparently installscript is smart enough to convert over paths, which leaves me a bit stuck for ideas.

 

Answer Summary:
Cancel
0 Comments   [ + ] Show Comments

Comments

Please log in to comment

Answers

0

I cracked it, for some reason GetMsiProperty doesn't like the handle ISMSI_HANDLE but SetMsiProperty does so I changed the GetMsiProperty lines to hMSI and they seem to all work fine now.

 

Weird.

Answered 06/08/2012 by: shields_t
Senior Purple Belt

Please log in to comment
Answer this question or Comment on this question for clarity
Admin Script Editor
Admin Script Editor is an integrated scripting environment available free here at ITNinja

Share