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

Blanked Out Registry Vaules After Update

Hello,
I need some help with a problem that is plaguing me. I have an InstallScript MSI project that is set to upgrade my product which is a client server based application with an SQL database. I have five dialog options that the upgrade passes through during the UI sequence that are meant to set InstallShield properties based off those input values. They are as follows;

Application Files Location
Database MDF Files Location
Database LDF Files Location
Database Backup Files Location
Server Name/IP Address

All of the above dialogs pull their current (production) values form a list of registry values (they all have a default value but the production location is different for almost every client). Now when I change the product code at every upgrade (our current method) there is no problem with this setup. However my company is looking at setting up an automated deployment using FlexNet Connect, which if I am not mistaken finds the updates available to the client based off the product code. So I was tasked with figuring out how to upgrade our clients without changing the product code. To that end I have been successful to the point that I can get the client to be upgraded silently (via a setup.iss file) after selecting the install option in the common software manager from FlexNet Connect.

My problem is that the stored registry entries get reset to their default values during upgrade instead of pulling the current values out of the registry (the step that the dialogs do during a non-silent upgrade). I have tested this issue extensively and have produced verbose logs and poured through the data to find where my problem arises at. I believe it occurs after the ISSetupFilesCleanup (last step) in the UI execute sequence based on the difference in the logs after this step.

Any ideas or directions for a possible solution would be greatly appreciated.
Labels (1)
0 Kudos
(2) Replies
MalQuiJelKah
Level 3

Below is the InstallScript file used during the upgrade process that was written by a former developer for my company.

Note: I know next to nothing about InstallScript, however I believe I have pinpointed my issue to my InstallScript Function "SetInstallProperties" not running correctly or for that matter not at all.

Again ANY help would be amazing.


[CODE]
//===========================================================================
//
// File Name: Setup.rul
//
// Description: Blank setup main script file
//
// Comments: Blank setup is an empty setup project. If you want to
// create a new project via. step-by step instructions use the
// Project Assistant.
//
//===========================================================================

// Included header files ----------------------------------------------------
#include "ifx.h"

prototype int Msi.MsiGetPropertyA(int, byval string, byref string, byref int);

prototype number ReadPropertyFromRegistry(string, byref string);
prototype EnableASP();
prototype BOOL Kernel32.GetComputerNameA(byref string, byref int);
prototype SetInstallProperties();


//---------------------------------------------------------------------------
// OnFirstUIBefore
//
// The OnFirstUIBefore event is called by the framework when the setup is
// running in first install mode. By default this event displays UI allowing
// the end user to specify installation parameters.
//---------------------------------------------------------------------------
function OnFirstUIBefore()
NUMBER nResult, nSetupType, nPathSize;
STRING szTitle, szMsg, svName;
string databaseDirMdf[MAX_PATH], databaseDirLdf[MAX_PATH], applicationServer[MAX_PATH], databaseBackupDir[MAX_PATH];
begin

nSetupType = CUSTOM;

SHELL_OBJECT_FOLDER = @PRODUCT_NAME;

SetInstallProperties();

Dlg_SdWelcome:
szTitle = "";
szMsg = "";
nResult = SdWelcome(szTitle, szMsg);
if (nResult = BACK) goto Dlg_SdWelcome;

Dlg_SdAskDestPath:
nResult = SdAskDestPath("Choose Application Files Location\n" + @IDS__DialogId_10201_ControlId_51,
@SELECT_APPLICATION_LOCATION,
INSTALLDIR, 0);
if (nResult = BACK) goto Dlg_SdWelcome;

Dlg_SdAskDestPathOfDatabase_MdfFiles:
nPathSize = MAX_PATH;
MsiGetProperty(ISMSI_HANDLE, "MDF_FILES", databaseDirMdf, nPathSize);
nResult = SdAskDestPath("Choose Database Files Location\n" + @IDS__DialogId_10201_ControlId_51,
@SELECT_DATABASE_MDF_LOCATION,
databaseDirMdf, 0);
MsiSetProperty(ISMSI_HANDLE, "MDF_FILES", databaseDirMdf);
MsiSetTargetPath(ISMSI_HANDLE, "MDF_FILES", databaseDirMdf);
if (nResult = BACK) goto Dlg_SdAskDestPath;

Dlg_SdAskDestPathOfDatabase_LdfFiles:
nPathSize = MAX_PATH;
MsiGetProperty(ISMSI_HANDLE, "LDF_FILES", databaseDirLdf, nPathSize);
nResult = SdAskDestPath("Choose Database Log Files Location\n" + @IDS__DialogId_10201_ControlId_51,
@SELECT_DATABASE_LDF_LOCATION,
databaseDirLdf, 0);
MsiSetProperty(ISMSI_HANDLE, "LDF_FILES", databaseDirLdf);
MsiSetTargetPath(ISMSI_HANDLE, "LDF_FILES", databaseDirLdf);
if (nResult = BACK) goto Dlg_SdAskDestPathOfDatabase_MdfFiles;

Dlg_SdAskDestPathOfDatabase_BackupFiles:
nPathSize = MAX_PATH;
MsiGetProperty(ISMSI_HANDLE, "BACKUP_FILES", databaseBackupDir, nPathSize);
nResult = SdAskDestPath("Choose Database Backup File Location\n" + @IDS__DialogId_10201_ControlId_51,
@SELECT_DATABASE_BACKUP_LOCATION,
databaseBackupDir, 0);
MsiSetProperty(ISMSI_HANDLE, "BACKUP_FILES", databaseBackupDir);
MsiSetTargetPath(ISMSI_HANDLE, "BACKUP_FILES", databaseBackupDir);
if (nResult = BACK) goto Dlg_SdAskDestPathOfDatabase_LdfFiles;

Dlg_SdAskApplicationServerIPAddress:
nPathSize = MAX_PATH;
szTitle = "";
szMsg = "";
MsiGetProperty(ISMSI_HANDLE, "RXKEY_APPLICATION_SERVER", applicationServer, nPathSize);
nResult = EnterPassword ( szMsg, applicationServer, applicationServer );
MsiSetProperty(ISMSI_HANDLE, "RXKEY_APPLICATION_SERVER", applicationServer);
if (nResult = BACK) goto Dlg_SdAskDestPathOfDatabase_BackupFiles;

//Dlg_SdFeatureTree:
//szTitle = "";
//szMsg = "";
//if (nSetupType = CUSTOM) then
//nResult = SdFeatureTree(szTitle, szMsg, INSTALLDIR, "", 2);
//if (nResult = BACK) goto Dlg_SdAskApplicationServerIPAddress;
//endif;

Dlg_SQLServerSelectLoginDlg:
if (nSetupType = CUSTOM) then
nResult = OnSQLLogin( nResult );
//if( nResult = BACK ) goto Dlg_SdFeatureTree;
if (nResult = BACK) goto Dlg_SdAskApplicationServerIPAddress;
endif;

Dlg_SdStartCopy:
szTitle = "";
szMsg = "";
nResult = SdStartCopy2(szTitle, szMsg);

if (nResult = BACK) then goto Dlg_SQLServerSelectLoginDlg;
endif;

// setup default status
Enable(STATUSEX);

return 0;
end;



//---------------------------------------------------------------------------
// OnSQLLogin
//---------------------------------------------------------------------------
function number OnSQLLogin( nReturn )
string sDLL, sMessage;
string sHidden[MAX_PATH];
string sServer[MAX_PATH], sUser[MAX_PATH], sPassword[MAX_PATH], sAuth[10], sDB[MAX_PATH];
string sTemp[MAX_PATH], sSecurity[MAX_PATH];
string szConnection, svCatalog;
number nResult, nSize;
BOOL bWinAuth, bDoneLogin;
begin

//First extract runtime dll

//sDLL = SUPPORTDIR ^ "ISSQLSRV.DLL";
//nResult = StreamFileFromBinary( ISMSI_HANDLE, "ISSQLSRV.DLL", sDLL );
//UseDLL( sDLL );

SQLRTInitialize2();

//Get Default Properties
nSize = MAX_PATH;
MsiGetProperty( ISMSI_HANDLE, "IS_SQLSERVER_DIALOG", sTemp, nSize );
if( nSize > 0 ) then

//First add the Password property as a Hidden property
//so no passwords accidentally get logged.
nSize = MAX_PATH;
MsiGetProperty( ISMSI_HANDLE, "MsiHiddenProperties", sHidden, nSize );
if( StrLength( sHidden ) > 0 ) then
sHidden = sHidden + ";" ;
endif;
sHidden = sHidden + "IS_SQLSERVER_PASSWORD";
MsiSetProperty( ISMSI_HANDLE, "MsiHiddenProperties", sHidden );

nSize = MAX_PATH;
MsiGetProperty( ISMSI_HANDLE, "IS_SQLSERVER_SERVER", sServer, nSize );

nSize = 10;
MsiGetProperty( ISMSI_HANDLE, "IS_SQLSERVER_AUTHENTICATION", sAuth, nSize );

if( sAuth = "1" ) then
nSize = MAX_PATH;
MsiGetProperty( ISMSI_HANDLE, "IS_SQLSERVER_USERNAME", sUser, nSize );
nSize = MAX_PATH;
MsiGetProperty( ISMSI_HANDLE, "IS_SQLSERVER_PASSWORD", sPassword, nSize );
bWinAuth = FALSE;
else
bWinAuth = TRUE;
endif;

nSize = MAX_PATH;
MsiGetProperty( ISMSI_HANDLE, "IS_SQLSERVER_DATABASE", sDB, nSize );

//Now we have defaults
while( !bDoneLogin )

//Show login dialog
szConnection = "MS_CONNECTION";
svCatalog = "RxKey";
nReturn = SQLServerSelectLogin2(szConnection, sServer, sUser, sPassword, bWinAuth, svCatalog, FALSE, FALSE );
//nReturn = SQLServerSelectLogin(sServer, sUser, sPassword,bWinAuth );
if( nReturn = NEXT ) then

//place results from dialog in Property table
MsiSetProperty( ISMSI_HANDLE, "IS_SQLSERVER_SERVER", sServer );

if( bWinAuth = TRUE ) then
sAuth = "0";
sSecurity = "Trusted_Connection=True;";
sUser = "";
sPassword = "";
else
sAuth = "1";
sSecurity = "User Id=" + sUser + ";Password=" + sPassword + ";";
MsiSetProperty( ISMSI_HANDLE, "IS_SQLSERVER_USERNAME", sUser );
MsiSetProperty( ISMSI_HANDLE, "IS_SQLSERVER_PASSWORD", sPassword );
endif;

MsiSetProperty( ISMSI_HANDLE, "IS_SQLSERVER_USERNAME_REGISTRY", sUser );
MsiSetProperty( ISMSI_HANDLE, "IS_SQLSERVER_PASSWORD_REGISTRY", sPassword );
MsiSetProperty( ISMSI_HANDLE, "IS_SQLSERVER_AUTHENTICATION", sAuth );
MsiSetProperty( ISMSI_HANDLE, "IS_SQLSERVER_SECURITY", sSecurity );

//test connection
nResult = SQLRTTestConnection( sServer, sDB, sUser, sPassword, bWinAuth);

if( nResult < 0 ) then

sMessage = SdLoadString( IDS_IFX_SQL_ERROR_LOGIN_FAILED );
MessageBox( sMessage, MB_OK );

else
bDoneLogin = TRUE;
endif;

else
//BACK was clicked, so we don't even try
bDoneLogin = TRUE;
endif;

endwhile;

endif;

return nReturn;
end;

//---------------------------------------------------------------------------
// OnMaintUIBefore
//
// The OnMaintUIBefore event is called by the framework when the setup is
// running in maintenance mode. By default this event displays UI that
// allows the end user to add or remove features, repair currently
// installed features or uninstall the application.
//---------------------------------------------------------------------------
function OnMaintUIBefore()
NUMBER nResult, nType;
STRING szTitle, szMsg, svDir, svResult, szCaption;
begin

SetInstallProperties();

Dlg_Start:

// Added in Version 9.5 - Support for REMOVEONLY option.
if( !REMOVEONLY ) then
// In standard mode show maintenance dialog
Disable(BACKBUTTON);
nType = SdWelcomeMaint(szTitle, szMsg, MODIFY);
Enable(BACKBUTTON);
else
// Hide the initial progress dialog as otherwise the user can
// click on it, and hide the MessageBox.
Disable( DIALOGCACHE );

// In RemoveOnly mode, set to remove.
nType = REMOVEALL;
endif;

// Show Uninstall Confirmation Dialog
if ( nType = REMOVEALL ) then
nResult = MessageBox( SdLoadString( IFX_MAINTUI_MSG ), MB_YESNO );
if (nResult != IDYES ) then

if( REMOVEONLY ) then
// In REMOVEONLY mode, abort the setup.
abort;
else
// In non-REMOVEONLY mode, redisplay the previous dialog.
goto Dlg_Start;
endif;

endif;
endif;

nResult = NEXT;

//Dlg_SdFeatureTree:
//if (nType = MODIFY) then
//szTitle = "";
//szMsg = "";
//nResult = SdFeatureTree(szTitle, szMsg, INSTALLDIR, "", 2);
//if (nResult = BACK) goto Dlg_Start;
//endif;

switch(nType)
case REMOVEALL: FeatureRemoveAll();
case REPAIR: FeatureReinstall();
endswitch;

// setup default status
SetStatusWindow(0, "");
Enable(STATUSEX);
StatusUpdate(ON, 100);
end;

function number ReadPropertyFromRegistry( svKey, svValue )
NUMBER nvType, nvSize;
begin

RegDBSetDefaultRoot(HKEY_LOCAL_MACHINE);

return RegDBGetKeyValueEx(
"Software\\KeyCentrix\\RxKey\\Install Properties",
svKey,
nvType,
svValue,
nvSize);
end;

//Enable ASP (Only for Windows Server 2003 Machines)
function EnableASP()
BOOL bFeatVal;
STRING szInstallString;
begin
bFeatVal = FeatureIsItemSelected ( MEDIA , "RxKey\\Server\\WebService" );
if (bFeatVal = TRUE) then
szInstallString = "/i:%windir%\\inf\\sysoc.inf /u:" + INSTALLDIR ^ "WebService\\aspenable.txt /q";
LaunchAppAndWait("sysocmgr", szInstallString, WAIT);
endif;
end;


function SetInstallProperties()
number nPathSize;
string registryValue;
string computerName[MAX_PATH], databaseServer[MAX_PATH];
begin

if (ReadPropertyFromRegistry("INSTALLDIR", registryValue) == 0) then
MsiSetProperty(ISMSI_HANDLE, "INSTALLDIR", registryValue);
endif;

if (ReadPropertyFromRegistry("MDF_FILES", registryValue) == 0) then
MsiSetProperty(ISMSI_HANDLE, "MDF_FILES", registryValue);
endif;

if (ReadPropertyFromRegistry("LDF_FILES", registryValue) == 0) then
MsiSetProperty(ISMSI_HANDLE, "LDF_FILES", registryValue);
endif;

if (ReadPropertyFromRegistry("BACKUP_FILES", registryValue) == 0) then
MsiSetProperty(ISMSI_HANDLE, "BACKUP_FILES", registryValue);
endif;

if (ReadPropertyFromRegistry("IS_SQLSERVER_SERVER", registryValue) == 0) then
MsiSetProperty(ISMSI_HANDLE, "IS_SQLSERVER_SERVER", registryValue);
else
nPathSize = MAX_PATH;
GetComputerNameA (computerName, nPathSize);

nPathSize = MAX_PATH;
MsiGetProperty(ISMSI_HANDLE, "IS_SQLSERVER_SERVER", databaseServer, nPathSize);

databaseServer = computerName + databaseServer;
MsiSetProperty(ISMSI_HANDLE, "IS_SQLSERVER_SERVER", databaseServer);
endif;

if (ReadPropertyFromRegistry("IS_SQLSERVER_USERNAME", registryValue) == 0)
&& (registryValue != "") then
MsiSetProperty(ISMSI_HANDLE, "IS_SQLSERVER_USERNAME", registryValue);
MsiSetProperty(ISMSI_HANDLE, "IS_SQLSERVER_USERNAME_REGISTRY", registryValue);
endif;

if (ReadPropertyFromRegistry("IS_SQLSERVER_PASSWORD", registryValue) == 0)
&& (registryValue != "") then
MsiSetProperty(ISMSI_HANDLE, "IS_SQLSERVER_PASSWORD", registryValue);
MsiSetProperty(ISMSI_HANDLE, "IS_SQLSERVER_PASSWORD_REGISTRY", registryValue);
endif;

if (ReadPropertyFromRegistry("IS_SQLSERVER_SECURITY", registryValue) == 0) then
MsiSetProperty(ISMSI_HANDLE, "IS_SQLSERVER_SECURITY", registryValue);
endif;

if (ReadPropertyFromRegistry("IS_SQLSERVER_AUTHENTICATION", registryValue) == 0) then
MsiSetProperty(ISMSI_HANDLE, "IS_SQLSERVER_AUTHENTICATION", registryValue);
endif;

if (ReadPropertyFromRegistry("RXKEY_APPLICATION_SERVER", registryValue) == 0) then
MsiSetProperty(ISMSI_HANDLE, "RXKEY_APPLICATION_SERVER", registryValue);
else
nPathSize = MAX_PATH;
GetComputerNameA (computerName, nPathSize);
MsiSetProperty(ISMSI_HANDLE, "RXKEY_APPLICATION_SERVER", computerName);
endif;
end;

#include "featureevents.rul" //Empty file
[/CODE]
0 Kudos
MalQuiJelKah
Level 3

I was not calling the OnResumeUIBefore(); method and thus I was skipping the setting of the installation properties that occurred during the OnFirstUIBefore();
0 Kudos