//! Write Eclipse plugin paths to files
//!
static UINT RemoveCodewarriorLinkFiles(MSIHANDLE hInstall) {
   ::hInstall = hInstall;
   printLog("RemoveCodewarriorLinkFiles()");

   unsigned rc;

   for (unsigned sub=0; sub<(sizeof(cwPluginInformation)/sizeof(cwPluginInformation[0])); sub++) {
      // Check if feature is being installed - otherwise no action needed
      INSTALLSTATE installedState;
      INSTALLSTATE actionState;
      rc = MsiGetFeatureState(hInstall, cwPluginInformation[sub].feature, &installedState, &actionState);
      printLog("RemoveCodewarriorLinkFiles() Feature = \'%s\' actionState = %d", cwPluginInformation[sub].feature, actionState);
      if (actionState != INSTALLSTATE_ABSENT) {
         printLog("RemoveCodewarriorLinkFiles() Feature = \'%s\' not being removed - no action", cwPluginInformation[sub].feature);
         continue;
      }
      // Get Eclipse install plugin path
      unsigned long pathLength = MAX_PATH;
      char path[MAX_PATH];
      rc = MsiGetTargetPath(hInstall, cwPluginInformation[sub].dropinPath, path, &pathLength);
      if (rc != ERROR_SUCCESS) {
         printLog("RemoveCodewarriorLinkFiles() MsiGetProperty(%s) => FAILED", cwPluginInformation[sub].dropinPath);
         return rc;
      }
      printLog("RemoveCodewarriorLinkFiles() MsiGetProperty(%s) => \'%s\'", cwPluginInformation[sub].dropinPath, path);
      strcat(path, "/usbdm.link");
      remove(path);
   }
   return 0;
}
//! Write Eclipse plugin paths to files
//!
static UINT WriteCodewarriorLinkFiles(MSIHANDLE hInstall) {
   ::hInstall = hInstall;
   printLog("WriteCodewarriorLinkFiles()");

//   tests();

   unsigned rc;

   static const char *PLUGIN_ID = "D.CWEclipsePlugins";

   // Get path to shared USBDM Eclipse plugins
   unsigned long pathLength = MAX_PATH;
   char usbdmPluginsPath[MAX_PATH];
   rc = MsiGetTargetPath(hInstall, PLUGIN_ID, usbdmPluginsPath, &pathLength);
   if (rc != ERROR_SUCCESS) {
      printLog("WriteCodewarriorLinkFiles() MsiGetTargetPath(%s) => FAILED", PLUGIN_ID);
      return rc;
   }
   printLog("WriteCodewarriorLinkFiles() MsiGetTargetPath(%s) => \'%s\'", PLUGIN_ID, usbdmPluginsPath);
   // Create entry for link file
   char linkFileContents[MAX_PATH+20];
   sprintf(linkFileContents, "path=%susbdm", usbdmPluginsPath);
   for( char *s=linkFileContents; *s!= '\0'; s++) {
      if (*s == '\\') {
         *s = '/';
      }
   }
   for (unsigned sub=0; sub<(sizeof(cwPluginInformation)/sizeof(cwPluginInformation[0])); sub++) {
      // Check if feature is being installed - otherwise no action needed
      INSTALLSTATE installedState;
      INSTALLSTATE actionState;
      rc = MsiGetFeatureState(hInstall, cwPluginInformation[sub].feature, &installedState, &actionState);
      if (actionState != INSTALLSTATE_LOCAL) {
         printLog("WriteCodewarriorLinkFiles() Feature = \'%s\' not being installed - no action", cwPluginInformation[sub].feature);
         continue;
      }
      // Get Eclipse install plugin path
      unsigned long pathLength = MAX_PATH;
      char path[MAX_PATH];
      rc = MsiGetTargetPath(hInstall, cwPluginInformation[sub].dropinPath, path, &pathLength);
      if (rc != ERROR_SUCCESS) {
         printLog("WriteCodewarriorLinkFiles() MsiGetProperty(%s) => FAILED", cwPluginInformation[sub].dropinPath);
         return rc;
      }
      printLog("WriteCodewarriorLinkFiles() MsiGetProperty(%s) => \'%s\'", cwPluginInformation[sub].dropinPath, path);
      strcat(path, "/usbdm.link");
      FILE *fp = fopen(path, "w");
      fputs(linkFileContents, fp);
      fclose(fp);
   }
   return 0;
}
Ejemplo n.º 3
0
UINT __stdcall 
ingres_install_dotnetfx(MSIHANDLE hInstall) 
{
    INSTALLSTATE iInstalled, iAction;
    char buf[MAX_PATH+1], cmd[MAX_PATH+1], 
			version[MAX_PATH], message[MAX_PATH];
    DWORD nret;
    BOOL bAnswer;
    nret=sizeof(buf); *buf=0;
    *version = '\0';

    sprintf(cmd, "http://www.microsoft.com/downloads");

    MsiSetProperty(hInstall, "INGRES_CONTINUE", "YES");

    if (!MsiGetFeatureState(hInstall, "IngresDotNETDataProvider", &iInstalled, &iAction))
    {
		if ((iAction==INSTALLSTATE_LOCAL || iAction == INSTALLSTATE_SOURCE 
			|| iAction == INSTALLSTATE_DEFAULT) && !IsDotNETFX20Installed())
		{
			MsiSetProperty(hInstall, "INGRES_CONTINUE", "NO");
			if (*version == '\0')
				sprintf(version, "%s", "2.0");
			else
			{
				sprintf(buf, " and %s", "2.0");
				strcat(version, buf);
			}
		}
		if (IsDotNETFX20Installed())
		{
			MsiSetProperty(hInstall, "INGRES_CONTINUE", "YES");
			goto complete;
		}

		sprintf(message, "The Ingres .NET Data Provider component requires the Microsoft .NET Framework %s, which could not be found on your system.\r\nTo obtain the Microsoft .NET Framework %s Package(s) from the Microsoft website, click OK and exit the Ingres installation\r\nwizard, or click Cancel and uncheck the .NET Data Provider component to continue.\r\n", version, version);
		bAnswer = AskUserOkCancel(hInstall, message);
		if (bAnswer)
		{
			ExecuteShellEx(cmd);
		}
		
	}
    else
	    MsiSetProperty(hInstall, "INGRES_CONTINUE", "YES");

complete:
    return ERROR_SUCCESS;
}
Ejemplo n.º 4
0
UINT __stdcall 
ingres_cluster_unregister_service(MSIHANDLE hInstall) 
{
	HCLUSTER hCluster;
	HRESOURCE hResource;
	WCHAR wszResourceName[256];
	char szResourceName[256];
	char szInstallCode[3];
	DWORD dwSize;
	INSTALLSTATE iInstalled, iAction;
	char szBuf[256];

	MsiGetFeatureState(hInstall, "IngresDBMS", &iInstalled, &iAction);
	if(iAction != INSTALLSTATE_ABSENT)
		return ERROR_SUCCESS;

	dwSize=sizeof(szBuf); *szBuf=0;
	if (!MsiGetProperty(hInstall, "INGRES_CLUSTER_RESOURCE_INUSE", szBuf, &dwSize) 
		&& !strcmp(szBuf, "1"))
		return ERROR_SUCCESS;

	dwSize=sizeof(szResourceName); *szResourceName=0;
	MsiGetProperty(hInstall, "INGRES_CLUSTER_RESOURCE", szResourceName, &dwSize);
	mbstowcs(wszResourceName, szResourceName, sizeof(szResourceName));
	dwSize=sizeof(szInstallCode); *szInstallCode=0;
	MsiGetProperty(hInstall, "II_INSTALLATION", szInstallCode, &dwSize);

	hCluster = OpenCluster(NULL);
	if(hCluster)
	{
		hResource = OpenClusterResource(hCluster, wszResourceName);
		if(hResource)
		{
			if (!DeleteClusterResource(hResource))
				SetupRegistryKeys(hResource, szInstallCode, FALSE);
			CloseClusterResource(hResource);
		}
		CloseCluster(hCluster);
	}

	return ERROR_SUCCESS;
}
Ejemplo n.º 5
0
UINT __stdcall
ingres_set_rep_reg_entries (MSIHANDLE ihnd)
{
    HKEY		hKey;
    char		KeyName[256];
    int			status = 0;
    DWORD		dwSize, dwDisposition, dwType;
    TCHAR		tchValue[2048];
    INSTALLSTATE	iInstalled, iAction;
    BOOL    	bInstalled, bVer25, bVersion9X;
    char szID[3], szComponentGUID[39], szProductGUID[39];
	
    bInstalled=bVer25=bVersion9X=FALSE;

    if (!MsiGetFeatureState(ihnd, "IngresReplicator", &iInstalled, &iAction))
    {
	if (iInstalled==INSTALLSTATE_ABSENT && iAction==INSTALLSTATE_UNKNOWN) 
	    return ERROR_SUCCESS;
    }
    else 
	return ERROR_SUCCESS;

    dwSize = sizeof(tchValue);
    if (MsiGetProperty( ihnd, "II_INSTALLATION", tchValue,
			&dwSize ) != ERROR_SUCCESS)
    {
	return (ERROR_INSTALL_FAILURE);
    }
    else
    {
	sprintf(KeyName,
		"Software\\IngresCorporation\\Ingres\\%s_Installation",
		tchValue);
	status = RegCreateKeyEx(HKEY_LOCAL_MACHINE, KeyName, 0, NULL,
				REG_OPTION_NON_VOLATILE, KEY_ALL_ACCESS, NULL,
				&hKey, &dwDisposition);
    }

    if (iInstalled == INSTALLSTATE_LOCAL)
    {
	/*
	** Set up the InstalledFeatures registry key for possible use.
	*/
	dwType = REG_SZ;
	dwSize = sizeof(tchValue);
	if (RegQueryValueEx(hKey, "InstalledFeatures", NULL, &dwType,
			    tchValue, &dwSize) != ERROR_SUCCESS)
	{
	    strcpy(tchValue, "REP");
	}
	else if (!strstr(tchValue, "REP"))
	    strcat(tchValue, ",REP");

	status = RegSetValueEx( hKey, "InstalledFeatures", 0, REG_SZ,
				tchValue, strlen(tchValue) + 1 );
    }

    dwSize=sizeof(szID);
    MsiGetProperty(ihnd, "II_INSTALLATION", szID, &dwSize);
    if (!_stricmp(szID, "II"))
	strcpy(szComponentGUID, "{531C8AD8-2F05-11D5-BDFC-00B0D0AD4485}");
    else
    {
	int idx;

	idx = (toupper(szID[0]) - 'A') * 26 + toupper(szID[1]) - 'A';
	if (idx <= 0) 
	    idx = (toupper(szID[0]) - 'A') * 26 + toupper(szID[1]) - '0';
	sprintf(szComponentGUID, "{531C8AD8-2F05-11D5-%04X-%012X}", idx, idx*idx);
    }

    dwSize=sizeof(szProductGUID);
    MsiGetProperty(ihnd, "ProductCode", szProductGUID, &dwSize);

    if (iAction==INSTALLSTATE_ABSENT && GetRefCount(szComponentGUID, szProductGUID)==0)
    {
	/*
	** Set up the RemovedFeatures registry key for use later on.
	*/
	dwType = REG_SZ;
	dwSize = sizeof(tchValue);
	if (RegQueryValueEx(hKey, "RemovedFeatures", NULL, &dwType,
			    tchValue, &dwSize) != ERROR_SUCCESS)
	{
	    strcpy(tchValue, "REP");
	}
	else if (!strstr(tchValue, "REP"))
	    strcat(tchValue, ",REP");

	status = RegSetValueEx( hKey, "RemovedFeatures", 0, REG_SZ,
				tchValue, strlen(tchValue) + 1 );

	RegCloseKey(hKey);
	return (status==ERROR_SUCCESS ? ERROR_SUCCESS : ERROR_INSTALL_FAILURE);
    }
    else if (iInstalled == INSTALLSTATE_LOCAL || iAction != INSTALLSTATE_LOCAL)
    {
	dwSize = sizeof(tchValue);
	if (!MsiGetProperty(ihnd, "INGRES_UPGRADE", tchValue, &dwSize) && strcmp(tchValue, "2"))
	{
	    RegCloseKey(hKey);
	    return (ERROR_SUCCESS);
	}
    }

    strcpy(tchValue, "TRUE");
    status = RegSetValueEx( hKey, "Ingres/Replicator", 0, REG_SZ, 
			    (CONST BYTE *)&tchValue, strlen(tchValue) + 1 );

    dwType = REG_SZ;
    dwSize = sizeof(tchValue);
    if (RegQueryValueEx(hKey, "PostInstallationNeeded", NULL, &dwType,
			tchValue, &dwSize) != ERROR_SUCCESS)
    {
	dwSize = sizeof(tchValue);
	if (status ||
	    MsiGetProperty( ihnd, "INGRES_SERVICEAUTO", tchValue,
			    &dwSize ) != ERROR_SUCCESS)
	{
	    return (ERROR_INSTALL_FAILURE);
	}
	else
	{
	    char szBuf[MAX_PATH+1];
	    sprintf(szBuf, "Ingres_Database_%s", szID);
	    if (CheckServiceExists(szBuf))
	    {
	         if (IsServiceStartupTypeAuto(szBuf))
		    sprintf(tchValue, "1");
		 else
		    sprintf(tchValue, "0");
  	         
		 status = RegSetValueEx( hKey, "serviceauto", 0, REG_SZ, 
				    tchValue, strlen(tchValue) + 1 );
		
	    }
	    else
	    	 status = RegSetValueEx( hKey, "serviceauto", 0, REG_SZ, 
				    tchValue, strlen(tchValue) + 1 );
	}

	dwSize = sizeof(tchValue);
	if (status ||
	    MsiGetProperty( ihnd, "INGRES_SERVICELOGINID", tchValue,
			    &dwSize ) != ERROR_SUCCESS)
	{
	    return (ERROR_INSTALL_FAILURE);
	}
	else
	{
	    status = RegSetValueEx( hKey, "serviceloginid", 0, REG_SZ, 
				    tchValue, strlen(tchValue) + 1 );
	}

	dwSize = sizeof(tchValue);
	if (status ||
	    MsiGetProperty( ihnd, "INGRES_SERVICEPASSWORD", tchValue,
			    &dwSize ) != ERROR_SUCCESS)
	{
	    return (ERROR_INSTALL_FAILURE);
	}
	else
	{
	    /* Clear the password from the property table. */
	    MsiSetProperty(ihnd, "INGRES_SERVICEPASSWORD", "");
	    MsiSetProperty(ihnd, "INGRES_SERVICEPASSWORD2", "");

	    status = RegSetValueEx( hKey, "servicepassword", 0, REG_SZ, 
				    tchValue, strlen(tchValue) + 1 );
	}

	strcpy(tchValue, "YES");
	status = RegSetValueEx( hKey, "PostInstallationNeeded", 0, REG_SZ, 
				tchValue, strlen(tchValue) + 1 );
	MsiSetProperty(ihnd, "INGRES_POSTINSTALLATIONNEEDED", "1");

	dwSize = sizeof(tchValue);
	MsiGetProperty(ihnd, "INGRES_RSP_LOC", tchValue, &dwSize);
	if (tchValue[0] && strcmp(tchValue, "0"))
	{
	    strcpy(tchValue, "YES");
	    RegSetValueEx( hKey, "SilentInstall", 0, REG_SZ, (CONST BYTE *)&tchValue, strlen(tchValue) + 1 );
	}

	dwSize = sizeof(tchValue);
	MsiGetProperty(ihnd, "Installed", tchValue, &dwSize);
	if (tchValue[0])
	    bInstalled=TRUE;
	dwSize = sizeof(tchValue);
	MsiGetProperty(ihnd, "INGRES_VER25", tchValue, &dwSize);
	if (tchValue[0] && !strcmp(tchValue, "1"))
	    bVer25=0;
	dwSize=sizeof(tchValue);
	MsiGetProperty(ihnd, "Version9X", tchValue, &dwSize);
	if (tchValue[0])
	    bVersion9X=TRUE;
	if (!bInstalled && !bVer25 && bVersion9X)
	{
	    strcpy(tchValue, "YES");
	    RegSetValueEx( hKey, "RebootNeeded", 0, REG_SZ, (CONST BYTE *)&tchValue, strlen(tchValue) + 1 );
	}
    }

    return (status == ERROR_SUCCESS ? ERROR_SUCCESS : ERROR_INSTALL_FAILURE);
}
//! Check if feature paths are valid
//!
extern "C" UINT __stdcall CheckInstallPaths(MSIHANDLE hInstall) {
   bool found = true;
   DWORD filePathLength;
   DirectoryQuad pathsToCheck[] = {
         // directory                         feature                            subdir                   description
         {"D.CW_FOR_MCU_V10.5",              "F.CW_FOR_MCU_V10.5",              "MCU",                    "Codewarrior - MCU V10.5"             },
         {"D.CW_FOR_MCU_V10.6",              "F.CW_FOR_MCU_V10.6",              "MCU",                    "Codewarrior - MCU V10.6"             },
         {"D.CW_FOR_MCU_V10.6.4",            "F.CW_FOR_MCU_V10.6.4",            "MCU",                    "Codewarrior - MCU V10.6.4"           },
         {"D.CW_FOR_MCU_V10.7",              "F.CW_FOR_MCU_V10.7",              "MCU",                    "Codewarrior - MCU V10.7"             },

         {"D.CW_FOR_MICROCONTROLLERS_V6_3",  "F.CW_FOR_MICROCONTROLLERS_V6_3",  "bin",                    "Codewarrior - Microcontrollers V6.3" },

         {"D.CWS12_X_V5_1",                  "F.CWS12_X_V5_1",                  "bin",                    "Codewarrior - S12(X) V5.1"           },

         {"D.CODEWARRIOR_COLDFIRE_V7_2",     "F.CODEWARRIOR_COLDFIRE_V7_2",     "bin",                    "Codewarrior - Coldfire V7.2"         },

         {"D.CODEWARRIOR_DSC_V8_3",          "F.CODEWARRIOR_DSC_V8_3",          "bin",                    "Codewarrior - DSC56800E B8.3"        },

         {"D.FREEMASTER_V1_3",               "F.FREEMASTER_V1_3",               "plugins",                "FreeMASTER V1.3"			            },

         {"D.CFFLASHER_V3_1",                "F.CFFLASHER_V3_1",                "BDM Protocol",           "CF Flasher V3.1"			            },

         {"D.KDS_3_0_0_INSTALL",             "F.KDS_3_0_0",                     "eclipse\\configuration", "Kinetis Design Studio Plugins"       },
         {"D.KDS_3_2_0_INSTALL",             "F.KDS_3_2_0",                     "eclipse\\configuration", "Kinetis Design Studio Plugins"       },

         {"D.S32DS_1_0_0_INSTALL",           "F.S32DS_1_0_0",                   "eclipse\\configuration", "S32 Design Studio Plugins"		      },

         {"D.CDT_1_ECLIPSE",                 "F.CDT_1",                         "configuration",          "Eclipse CDT Plugins #1"		         },
         {"D.CDT_2_ECLIPSE",                 "F.CDT_2",                         "configuration",          "Eclipse CDT Plugins #2"		         },

         {"D.MCU_EXPRESS_INSTALL",           "F.MCU_EXPRESS",                   "ide\\configuration",     "MCUExpresso CDT Plugins"             },

         {NULL,                              NULL,                              NULL,                     NULL                                  }
   };
   ::hInstall = hInstall;
   printLog("CheckInstallPaths()\n");

   int pathNum;
   for (pathNum=0; pathsToCheck[pathNum].directory != NULL; pathNum++) {
      UINT rc;
      filePathLength = MAX_PATH;
      INSTALLSTATE installedState;
      INSTALLSTATE actionState;

      // Check if feature is being installed - otherwise no path check needed
      rc = MsiGetFeatureState(hInstall,pathsToCheck[pathNum].feature, &installedState, &actionState);
      if (actionState != INSTALLSTATE_LOCAL) {
         printLog("CheckInstallPaths() Feature = \'%s\' not being installed - no action\n", pathsToCheck[pathNum].feature);
         continue;
      }
      // Check if path exists
      found = false;
      // Get path & validate
      char directory[MAX_PATH];
      char path[MAX_PATH+1];
      rc = MsiGetTargetPath(hInstall, pathsToCheck[pathNum].directory, directory, &filePathLength);
      if (rc == ERROR_SUCCESS) {
         strncpy(path, directory, MAX_PATH);
         strncat(path, pathsToCheck[pathNum].subdir, MAX_PATH);
         found = directoryExists(path);
      }
      printLog("CheckInstallPaths(%s) => %s\n", path, found?"Found":"Not Found");
      if (!found) {
         MsiSetProperty (hInstall, "CODEWARRIOR_MISSING_PATH", directory);
         MsiSetProperty (hInstall, "CODEWARRIOR_MISSING_APP",  pathsToCheck[pathNum].description);
         break;
      }
   }
   UINT rc = MsiSetProperty(hInstall, "CODEWARRIOR_PATHS_EXIST", found?"1":"0");
   return rc;
}
Ejemplo n.º 7
0
/*
**  Name:ingres_prepare_remove_dbms_files
**
**  Description:
**	Set up the RemoveFile table in DBMS Merge Module for the 
**	directories and files that were not installed as part of 
**	the initial installation so that they can be removed from  
**	the system during an uninstall.
**
**  Inputs:
**	hInstall	Handle to the installation.
**
**  Outputs:
**	None.
**	Returns:
**	    ERROR_SUCCESS			The function succeeds.
**	    ERROR_INSTALL_FAILURE	The function fails.
**	Exceptions:
**	    None.
**
**  Side Effects:
**	None.
**
**  History:
**	16-Aug-2001 (penga03)
**	    Created.
**	17-Aug-2001 (penga03)
**	    Do not put the INSTALLDIR in the RemoveFile table.
**	14-may-2004 (somsa01)
**	    Make sure we use the 64-bit GUID,
**	    8CCBF50C_6C17_4366_B8FE_FBB31A4092E0, when needed.
**	17-may-2004 (somsa01)
**	    Backed out prior change, as it does NOT properly fix the problem.
*/
UINT __stdcall
ingres_prepare_remove_dbms_files(MSIHANDLE hInstall)
{
	TCHAR tchValue[MAX_PATH+1], ii_system[MAX_PATH+1], szBuf[MAX_PATH+1];
	DWORD dwSize;
	MSIHANDLE hDatabase, hView, hRecord;
	TCHAR ConfigKey[256], Host[64];
	INSTALLSTATE iInstalled, iAction;
	TCHAR inst_id[64] = "INSTALLDIR.870341B5_2D6D_11D5_BDFC_00B0D0AD4485";
	TCHAR bin_id[64] = "Bin.870341B5_2D6D_11D5_BDFC_00B0D0AD4485";
	char sharedDisk[3];

	MsiGetFeatureState(hInstall, "IngresDBMS", &iInstalled, &iAction);
	if(iAction!=INSTALLSTATE_ABSENT)
		return ERROR_SUCCESS;

	dwSize=sizeof(ii_system);
	if(MsiGetTargetPath(hInstall, inst_id, ii_system, &dwSize)!=ERROR_SUCCESS)
		return ERROR_INSTALL_FAILURE;
	if(ii_system[lstrlen(ii_system)-1] == '\\')
		ii_system[lstrlen(ii_system)-1] = '\0';
	SetEnvironmentVariable("II_SYSTEM", ii_system);
	
	MsiSetProperty(hInstall, "INGRES_CLUSTER_RESOURCE_INUSE", "0");
	if(Local_NMgtIngAt("II_DATABASE", tchValue)==ERROR_SUCCESS)
	{
		strncpy(sharedDisk, tchValue, 2);
		sharedDisk[2]='\0';
		if (GetFileAttributes(sharedDisk) == -1)
		{
			MsiSetProperty(hInstall, "INGRES_CLUSTER_RESOURCE_INUSE", "1");
			return ERROR_SUCCESS;
		}
	}

	hDatabase=MsiGetActiveDatabase(hInstall);
	if(!hDatabase)
		return ERROR_INSTALL_FAILURE;
	if(MsiDatabaseOpenView(hDatabase, "INSERT INTO `RemoveFile` (`FileKey`, `Component_`, `FileName`, `DirProperty`, `InstallMode`) VALUES (?, ?, ?, ?, ?) TEMPORARY", &hView)!=ERROR_SUCCESS)
		return ERROR_INSTALL_FAILURE;
	hRecord=MsiCreateRecord(5);
	if(!hRecord)
		return ERROR_INSTALL_FAILURE;

	if(Local_NMgtIngAt("II_DATABASE", tchValue)==ERROR_SUCCESS)
	{
		int KeyCount;
		char szKey[MAX_PATH+1], szKey2[MAX_PATH+1];

		wsprintf(szBuf, "%s\\ingres\\data", tchValue);
		Count=-1;
		CreateDirList(szBuf);
		for(KeyCount=0; KeyCount<=Count; KeyCount++)
		{
			wsprintf(szKey, "RemoveDatabaseDir_%d", KeyCount);
			wsprintf(szKey2, "RemoveDatabaseDir_%d_Dir", KeyCount);

			MsiSetProperty(hInstall, szKey, DirList[KeyCount].DirName);
			
			MsiRecordSetString(hRecord, 1, szKey);
			MsiRecordSetString(hRecord, 2, bin_id);
			MsiRecordSetString(hRecord, 3, "*.*");
			MsiRecordSetString(hRecord, 4, szKey);
			MsiRecordSetInteger(hRecord, 5, 2);
			if(MsiViewExecute(hView, hRecord)!=ERROR_SUCCESS)
				return ERROR_INSTALL_FAILURE;

			MsiRecordSetString(hRecord, 1, szKey2);
			MsiRecordSetString(hRecord, 2, bin_id);
			MsiRecordSetString(hRecord, 3, "");
			MsiRecordSetString(hRecord, 4, szKey);
			MsiRecordSetInteger(hRecord, 5, 2);
			if(MsiViewExecute(hView, hRecord)!=ERROR_SUCCESS)
				return ERROR_INSTALL_FAILURE;
		}

		Count++;
		wsprintf(szKey, "RemoveDatabaseDir_%d", Count);
		wsprintf(szKey2, "RemoveDatabaseDir_%d_Dir", Count);

		wsprintf(szBuf, "%s\\ingres", tchValue);
		MsiSetProperty(hInstall, szKey, szBuf);
			
		MsiRecordSetString(hRecord, 1, szKey2);
		MsiRecordSetString(hRecord, 2, bin_id);
		MsiRecordSetString(hRecord, 3, "");
		MsiRecordSetString(hRecord, 4, szKey);
		MsiRecordSetInteger(hRecord, 5, 2);
		if(MsiViewExecute(hView, hRecord)!=ERROR_SUCCESS)
			return ERROR_INSTALL_FAILURE;

		Count++;
		wsprintf(szKey, "RemoveDatabaseDir_%d", Count);
		wsprintf(szKey2, "RemoveDatabaseDir_%d_Dir", Count);
		
		wsprintf(szBuf, "%s", tchValue);
		MsiSetProperty(hInstall, szKey, szBuf);
			
		MsiRecordSetString(hRecord, 1, szKey2);
		MsiRecordSetString(hRecord, 2, bin_id);
		MsiRecordSetString(hRecord, 3, "");
		MsiRecordSetString(hRecord, 4, szKey);
		MsiRecordSetInteger(hRecord, 5, 2);
		if(MsiViewExecute(hView, hRecord)!=ERROR_SUCCESS)
			return ERROR_INSTALL_FAILURE;
	}

	if(Local_NMgtIngAt("II_CHECKPOINT", tchValue)==ERROR_SUCCESS)
	{
		int KeyCount;
		char szKey[MAX_PATH+1], szKey2[MAX_PATH+1];

		wsprintf(szBuf, "%s\\ingres\\ckp", tchValue);
		Count=-1;
		CreateDirList(szBuf);
		for(KeyCount=0; KeyCount<=Count; KeyCount++)
		{
			wsprintf(szKey, "RemovecCheckpointDir_%d", KeyCount);
			wsprintf(szKey2, "RemoveCheckpointDir_%d_Dir", KeyCount);

			MsiSetProperty(hInstall, szKey, DirList[KeyCount].DirName);
			
			MsiRecordSetString(hRecord, 1, szKey);
			MsiRecordSetString(hRecord, 2, bin_id);
			MsiRecordSetString(hRecord, 3, "*.*");
			MsiRecordSetString(hRecord, 4, szKey);
			MsiRecordSetInteger(hRecord, 5, 2);
			if(MsiViewExecute(hView, hRecord)!=ERROR_SUCCESS)
				return ERROR_INSTALL_FAILURE;

			MsiRecordSetString(hRecord, 1, szKey2);
			MsiRecordSetString(hRecord, 2, bin_id);
			MsiRecordSetString(hRecord, 3, "");
			MsiRecordSetString(hRecord, 4, szKey);
			MsiRecordSetInteger(hRecord, 5, 2);
			if(MsiViewExecute(hView, hRecord)!=ERROR_SUCCESS)
				return ERROR_INSTALL_FAILURE;
		}

		Count++;
		wsprintf(szKey, "RemovecCheckpointDir_%d", Count);
		wsprintf(szKey2, "RemovecCheckpointDir_%d_Dir", Count);

		wsprintf(szBuf, "%s\\ingres", tchValue);
		MsiSetProperty(hInstall, szKey, szBuf);
			
		MsiRecordSetString(hRecord, 1, szKey2);
		MsiRecordSetString(hRecord, 2, bin_id);
		MsiRecordSetString(hRecord, 3, "");
		MsiRecordSetString(hRecord, 4, szKey);
		MsiRecordSetInteger(hRecord, 5, 2);
		if(MsiViewExecute(hView, hRecord)!=ERROR_SUCCESS)
			return ERROR_INSTALL_FAILURE;

		Count++;
		wsprintf(szKey, "RemovecCheckpointDir_%d", Count);
		wsprintf(szKey2, "RemovecCheckpointDir_%d_Dir", Count);
		
		wsprintf(szBuf, "%s", tchValue);
		MsiSetProperty(hInstall, szKey, szBuf);
			
		MsiRecordSetString(hRecord, 1, szKey2);
		MsiRecordSetString(hRecord, 2, bin_id);
		MsiRecordSetString(hRecord, 3, "");
		MsiRecordSetString(hRecord, 4, szKey);
		MsiRecordSetInteger(hRecord, 5, 2);
		if(MsiViewExecute(hView, hRecord)!=ERROR_SUCCESS)
			return ERROR_INSTALL_FAILURE;
	}

	if(Local_NMgtIngAt("II_JOURNAL", tchValue)==ERROR_SUCCESS)
	{
		int KeyCount;
		char szKey[MAX_PATH+1], szKey2[MAX_PATH+1];

		wsprintf(szBuf, "%s\\ingres\\jnl", tchValue);
		Count=-1;
		CreateDirList(szBuf);
		for(KeyCount=0; KeyCount<=Count; KeyCount++)
		{
			wsprintf(szKey, "RemoveJournalDir_%d", KeyCount);
			wsprintf(szKey2, "RemoveJournalDir_%d_Dir", KeyCount);

			MsiSetProperty(hInstall, szKey, DirList[KeyCount].DirName);
			
			MsiRecordSetString(hRecord, 1, szKey);
			MsiRecordSetString(hRecord, 2, bin_id);
			MsiRecordSetString(hRecord, 3, "*.*");
			MsiRecordSetString(hRecord, 4, szKey);
			MsiRecordSetInteger(hRecord, 5, 2);
			if(MsiViewExecute(hView, hRecord)!=ERROR_SUCCESS)
				return ERROR_INSTALL_FAILURE;

			MsiRecordSetString(hRecord, 1, szKey2);
			MsiRecordSetString(hRecord, 2, bin_id);
			MsiRecordSetString(hRecord, 3, "");
			MsiRecordSetString(hRecord, 4, szKey);
			MsiRecordSetInteger(hRecord, 5, 2);
			if(MsiViewExecute(hView, hRecord)!=ERROR_SUCCESS)
				return ERROR_INSTALL_FAILURE;
		}

		Count++;
		wsprintf(szKey, "RemoveJournalDir_%d", Count);
		wsprintf(szKey2, "RemoveJournalDir_%d_Dir", Count);

		wsprintf(szBuf, "%s\\ingres", tchValue);
		MsiSetProperty(hInstall, szKey, szBuf);
			
		MsiRecordSetString(hRecord, 1, szKey2);
		MsiRecordSetString(hRecord, 2, bin_id);
		MsiRecordSetString(hRecord, 3, "");
		MsiRecordSetString(hRecord, 4, szKey);
		MsiRecordSetInteger(hRecord, 5, 2);
		if(MsiViewExecute(hView, hRecord)!=ERROR_SUCCESS)
			return ERROR_INSTALL_FAILURE;

		Count++;
		wsprintf(szKey, "RemoveJournalDir_%d", Count);
		wsprintf(szKey2, "RemoveJournalDir_%d_Dir", Count);
		
		wsprintf(szBuf, "%s", tchValue);
		MsiSetProperty(hInstall, szKey, szBuf);
			
		MsiRecordSetString(hRecord, 1, szKey2);
		MsiRecordSetString(hRecord, 2, bin_id);
		MsiRecordSetString(hRecord, 3, "");
		MsiRecordSetString(hRecord, 4, szKey);
		MsiRecordSetInteger(hRecord, 5, 2);
		if(MsiViewExecute(hView, hRecord)!=ERROR_SUCCESS)
			return ERROR_INSTALL_FAILURE;
	}

	if(Local_NMgtIngAt("II_DUMP", tchValue)==ERROR_SUCCESS)
	{
		int KeyCount;
		char szKey[MAX_PATH+1], szKey2[MAX_PATH+1];

		wsprintf(szBuf, "%s\\ingres\\dmp", tchValue);
		Count=-1;
		CreateDirList(szBuf);
		for(KeyCount=0; KeyCount<=Count; KeyCount++)
		{
			wsprintf(szKey, "RemoveDumpDir_%d", KeyCount);
			wsprintf(szKey2, "RemoveDumpDir_%d_Dir", KeyCount);

			MsiSetProperty(hInstall, szKey, DirList[KeyCount].DirName);
			
			MsiRecordSetString(hRecord, 1, szKey);
			MsiRecordSetString(hRecord, 2, bin_id);
			MsiRecordSetString(hRecord, 3, "*.*");
			MsiRecordSetString(hRecord, 4, szKey);
			MsiRecordSetInteger(hRecord, 5, 2);
			if(MsiViewExecute(hView, hRecord)!=ERROR_SUCCESS)
				return ERROR_INSTALL_FAILURE;

			MsiRecordSetString(hRecord, 1, szKey2);
			MsiRecordSetString(hRecord, 2, bin_id);
			MsiRecordSetString(hRecord, 3, "");
			MsiRecordSetString(hRecord, 4, szKey);
			MsiRecordSetInteger(hRecord, 5, 2);
			if(MsiViewExecute(hView, hRecord)!=ERROR_SUCCESS)
				return ERROR_INSTALL_FAILURE;
		}

		Count++;
		wsprintf(szKey, "RemoveDumpDir_%d", Count);
		wsprintf(szKey2, "RemoveDumpDir_%d_Dir", Count);

		wsprintf(szBuf, "%s\\ingres", tchValue);
		MsiSetProperty(hInstall, szKey, szBuf);
			
		MsiRecordSetString(hRecord, 1, szKey2);
		MsiRecordSetString(hRecord, 2, bin_id);
		MsiRecordSetString(hRecord, 3, "");
		MsiRecordSetString(hRecord, 4, szKey);
		MsiRecordSetInteger(hRecord, 5, 2);
		if(MsiViewExecute(hView, hRecord)!=ERROR_SUCCESS)
			return ERROR_INSTALL_FAILURE;

		Count++;
		wsprintf(szKey, "RemoveDumpDir_%d", Count);
		wsprintf(szKey2, "RemoveDumpDir_%d_Dir", Count);
		
		wsprintf(szBuf, "%s", tchValue);
		MsiSetProperty(hInstall, szKey, szBuf);
			
		MsiRecordSetString(hRecord, 1, szKey2);
		MsiRecordSetString(hRecord, 2, bin_id);
		MsiRecordSetString(hRecord, 3, "");
		MsiRecordSetString(hRecord, 4, szKey);
		MsiRecordSetInteger(hRecord, 5, 2);
		if(MsiViewExecute(hView, hRecord)!=ERROR_SUCCESS)
			return ERROR_INSTALL_FAILURE;
	}

	if(Local_NMgtIngAt("II_WORK", tchValue)==ERROR_SUCCESS)
	{
		int KeyCount;
		char szKey[MAX_PATH+1], szKey2[MAX_PATH+1];

		wsprintf(szBuf, "%s\\ingres\\work", tchValue);
		Count=-1;
		CreateDirList(szBuf);
		for(KeyCount=0; KeyCount<=Count; KeyCount++)
		{
			wsprintf(szKey, "RemoveWorkDir_%d", KeyCount);
			wsprintf(szKey2, "RemoveWorkDir_%d_Dir", KeyCount);

			MsiSetProperty(hInstall, szKey, DirList[KeyCount].DirName);
			
			MsiRecordSetString(hRecord, 1, szKey);
			MsiRecordSetString(hRecord, 2, bin_id);
			MsiRecordSetString(hRecord, 3, "*.*");
			MsiRecordSetString(hRecord, 4, szKey);
			MsiRecordSetInteger(hRecord, 5, 2);
			if(MsiViewExecute(hView, hRecord)!=ERROR_SUCCESS)
				return ERROR_INSTALL_FAILURE;

			MsiRecordSetString(hRecord, 1, szKey2);
			MsiRecordSetString(hRecord, 2, bin_id);
			MsiRecordSetString(hRecord, 3, "");
			MsiRecordSetString(hRecord, 4, szKey);
			MsiRecordSetInteger(hRecord, 5, 2);
			if(MsiViewExecute(hView, hRecord)!=ERROR_SUCCESS)
				return ERROR_INSTALL_FAILURE;
		}

		Count++;
		wsprintf(szKey, "RemoveWorkDir_%d", Count);
		wsprintf(szKey2, "RemoveWorkDir_%d_Dir", Count);

		wsprintf(szBuf, "%s\\ingres", tchValue);
		MsiSetProperty(hInstall, szKey, szBuf);
			
		MsiRecordSetString(hRecord, 1, szKey2);
		MsiRecordSetString(hRecord, 2, bin_id);
		MsiRecordSetString(hRecord, 3, "");
		MsiRecordSetString(hRecord, 4, szKey);
		MsiRecordSetInteger(hRecord, 5, 2);
		if(MsiViewExecute(hView, hRecord)!=ERROR_SUCCESS)
			return ERROR_INSTALL_FAILURE;

		Count++;
		wsprintf(szKey, "RemoveWorkDir_%d", Count);
		wsprintf(szKey2, "RemoveWorkDir_%d_Dir", Count);
		
		wsprintf(szBuf, "%s", tchValue);
		MsiSetProperty(hInstall, szKey, szBuf);
			
		MsiRecordSetString(hRecord, 1, szKey2);
		MsiRecordSetString(hRecord, 2, bin_id);
		MsiRecordSetString(hRecord, 3, "");
		MsiRecordSetString(hRecord, 4, szKey);
		MsiRecordSetInteger(hRecord, 5, 2);
		if(MsiViewExecute(hView, hRecord)!=ERROR_SUCCESS)
			return ERROR_INSTALL_FAILURE;
	}

	Local_PMhost(Host);
	wsprintf(ConfigKey, "ii.%s.rcp.log.log_file_parts", Host);
	if(Local_PMget(ConfigKey, tchValue) == ERROR_SUCCESS)
	{
		int num_logs, i;
		
		num_logs=atoi(tchValue);
		for(i=1; i<=num_logs; i++)
		{
			wsprintf(ConfigKey, "ii.%s.rcp.log.log_file_%d", Host, i);
			if(Local_PMget(ConfigKey, tchValue) == ERROR_SUCCESS)
			{
				int KeyCount;
				char szKey[MAX_PATH+1], szKey2[MAX_PATH+1];
				
				StringReplace(tchValue);
				wsprintf(szBuf, "%s\\ingres\\log", tchValue);
				Count=-1;
				CreateDirList(szBuf);
				for(KeyCount=0; KeyCount<=Count; KeyCount++)
				{
					wsprintf(szKey, "RemoveLogDir_%d", KeyCount);
					wsprintf(szKey2, "RemoveLogDir_%d_Dir", KeyCount);
					
					MsiSetProperty(hInstall, szKey, DirList[KeyCount].DirName);
					
					MsiRecordSetString(hRecord, 1, szKey);
					MsiRecordSetString(hRecord, 2, bin_id);
					MsiRecordSetString(hRecord, 3, "*.*");
					MsiRecordSetString(hRecord, 4, szKey);
					MsiRecordSetInteger(hRecord, 5, 2);
					if(MsiViewExecute(hView, hRecord)!=ERROR_SUCCESS)
						return ERROR_INSTALL_FAILURE;
					
					MsiRecordSetString(hRecord, 1, szKey2);
					MsiRecordSetString(hRecord, 2, bin_id);
					MsiRecordSetString(hRecord, 3, "");
					MsiRecordSetString(hRecord, 4, szKey);
					MsiRecordSetInteger(hRecord, 5, 2);
					if(MsiViewExecute(hView, hRecord)!=ERROR_SUCCESS)
						return ERROR_INSTALL_FAILURE;
				}
				
				Count++;
				wsprintf(szKey, "RemoveLogDir_%d", Count);
				wsprintf(szKey2, "RemoveLogDir_%d_Dir", Count);
				
				wsprintf(szBuf, "%s\\ingres", tchValue);
				MsiSetProperty(hInstall, szKey, szBuf);
				
				MsiRecordSetString(hRecord, 1, szKey2);
				MsiRecordSetString(hRecord, 2, bin_id);
				MsiRecordSetString(hRecord, 3, "");
				MsiRecordSetString(hRecord, 4, szKey);
				MsiRecordSetInteger(hRecord, 5, 2);
				if(MsiViewExecute(hView, hRecord)!=ERROR_SUCCESS)
					return ERROR_INSTALL_FAILURE;
				
				Count++;
				wsprintf(szKey, "RemoveLogDir_%d", Count);
				wsprintf(szKey2, "RemoveLogDir_%d_Dir", Count);
				
				wsprintf(szBuf, "%s", tchValue);
				MsiSetProperty(hInstall, szKey, szBuf);
				
				MsiRecordSetString(hRecord, 1, szKey2);
				MsiRecordSetString(hRecord, 2, bin_id);
				MsiRecordSetString(hRecord, 3, "");
				MsiRecordSetString(hRecord, 4, szKey);
				MsiRecordSetInteger(hRecord, 5, 2);
				if(MsiViewExecute(hView, hRecord)!=ERROR_SUCCESS)
					return ERROR_INSTALL_FAILURE;
			}
		}
	}
	
	wsprintf(ConfigKey, "ii.%s.rcp.log.dual_log_1", Host);
	if(Local_PMget(ConfigKey, tchValue) == ERROR_SUCCESS)
	{
		int KeyCount;
		char szKey[MAX_PATH+1], szKey2[MAX_PATH+1];
		
		StringReplace(tchValue);
		wsprintf(szBuf, "%s\\ingres\\log", tchValue);
		Count=-1;
		CreateDirList(szBuf);
		for(KeyCount=0; KeyCount<=Count; KeyCount++)
		{
			wsprintf(szKey, "RemoveDuallogDir_%d", KeyCount);
			wsprintf(szKey2, "RemoveDuallogDir_%d_Dir", KeyCount);

			MsiSetProperty(hInstall, szKey, DirList[KeyCount].DirName);
			
			MsiRecordSetString(hRecord, 1, szKey);
			MsiRecordSetString(hRecord, 2, bin_id);
			MsiRecordSetString(hRecord, 3, "*.*");
			MsiRecordSetString(hRecord, 4, szKey);
			MsiRecordSetInteger(hRecord, 5, 2);
			if(MsiViewExecute(hView, hRecord)!=ERROR_SUCCESS)
				return ERROR_INSTALL_FAILURE;

			MsiRecordSetString(hRecord, 1, szKey2);
			MsiRecordSetString(hRecord, 2, bin_id);
			MsiRecordSetString(hRecord, 3, "");
			MsiRecordSetString(hRecord, 4, szKey);
			MsiRecordSetInteger(hRecord, 5, 2);
			if(MsiViewExecute(hView, hRecord)!=ERROR_SUCCESS)
				return ERROR_INSTALL_FAILURE;
		}

		Count++;
		wsprintf(szKey, "RemoveDuallogDir_%d", Count);
		wsprintf(szKey2, "RemoveDuallogDir_%d_Dir", Count);
				
		wsprintf(szBuf, "%s\\ingres", tchValue);
		MsiSetProperty(hInstall, szKey, szBuf);
				
		MsiRecordSetString(hRecord, 1, szKey2);
		MsiRecordSetString(hRecord, 2, bin_id);
		MsiRecordSetString(hRecord, 3, "");
		MsiRecordSetString(hRecord, 4, szKey);
		MsiRecordSetInteger(hRecord, 5, 2);
		if(MsiViewExecute(hView, hRecord)!=ERROR_SUCCESS)
			return ERROR_INSTALL_FAILURE;
		
		Count++;
		wsprintf(szKey, "RemoveDuallogDir_%d", Count);
		wsprintf(szKey2, "RemoveDuallogDir_%d_Dir", Count);
		
		wsprintf(szBuf, "%s", tchValue);
		MsiSetProperty(hInstall, szKey, szBuf);
		
		MsiRecordSetString(hRecord, 1, szKey2);
		MsiRecordSetString(hRecord, 2, bin_id);
		MsiRecordSetString(hRecord, 3, "");
		MsiRecordSetString(hRecord, 4, szKey);
		MsiRecordSetInteger(hRecord, 5, 2);
		if(MsiViewExecute(hView, hRecord)!=ERROR_SUCCESS)
			return ERROR_INSTALL_FAILURE;
	}

	MsiCloseHandle(hRecord);
	MsiCloseHandle(hView);
	MsiCloseHandle(hDatabase);

	return ERROR_SUCCESS;
}
Ejemplo n.º 8
0
UINT __stdcall
ingres_set_dbms_reg_entries (MSIHANDLE ihnd)
{
    HKEY		hKey;
    char		KeyName[256];
    int			status = 0;
    DWORD		dwSize, dwDisposition, dwType;
    TCHAR		tchValue[2048];
    INSTALLSTATE	iInstalled, iAction;
    char szID[3], szComponentGUID[39], szProductGUID[39];

    if (!MsiGetFeatureState(ihnd, "IngresDBMS", &iInstalled, &iAction))
    {
	if (iInstalled==INSTALLSTATE_ABSENT && iAction==INSTALLSTATE_UNKNOWN) 
	    return ERROR_SUCCESS;
    }
    else
	return ERROR_SUCCESS;

    dwSize = sizeof(tchValue);
    if (MsiGetProperty( ihnd, "II_INSTALLATION", tchValue,
			&dwSize ) != ERROR_SUCCESS)
    {
	return (ERROR_INSTALL_FAILURE);
    }
    else
    {
	sprintf(KeyName,
		"Software\\IngresCorporation\\Ingres\\%s_Installation",
		tchValue);
	status = RegCreateKeyEx(HKEY_LOCAL_MACHINE, KeyName, 0, NULL,
				REG_OPTION_NON_VOLATILE, KEY_ALL_ACCESS, NULL,
				&hKey, &dwDisposition);
    }

    if (iInstalled == INSTALLSTATE_LOCAL)
    {
	/*
	** Set up the InstalledFeatures registry key for possible use.
	*/
	dwType = REG_SZ;
	dwSize = sizeof(tchValue);
	if (RegQueryValueEx(hKey, "InstalledFeatures", NULL, &dwType,
			    tchValue, &dwSize) != ERROR_SUCCESS)
	{
	    strcpy(tchValue, "DBMS");
	}
	else if (!strstr(tchValue, "DBMS"))
	    strcat(tchValue, ",DBMS");

	status = RegSetValueEx( hKey, "InstalledFeatures", 0, REG_SZ,
				tchValue, strlen(tchValue) + 1 );
    }

    dwSize=sizeof(szID);
    MsiGetProperty(ihnd, "II_INSTALLATION", szID, &dwSize);
    if (!_stricmp(szID, "II"))
	strcpy(szComponentGUID, "{6C233EE5-2D74-11D5-BDFC-00B0D0AD4485}");
    else
    {
	int idx;

	idx = (toupper(szID[0]) - 'A') * 26 + toupper(szID[1]) - 'A';
	if (idx <= 0) 
	    idx = (toupper(szID[0]) - 'A') * 26 + toupper(szID[1]) - '0';
	sprintf(szComponentGUID, "{6C233EE5-2D74-11D5-%04X-%012X}", idx, idx*idx);
    }

    dwSize=sizeof(szProductGUID);
    MsiGetProperty(ihnd, "ProductCode", szProductGUID, &dwSize);

    if (iAction==INSTALLSTATE_ABSENT && GetRefCount(szComponentGUID, szProductGUID)==0)
    {
	/*
	** Set up the RemovedFeatures registry key for use later on.
	*/
	dwType = REG_SZ;
	dwSize = sizeof(tchValue);
	if (RegQueryValueEx(hKey, "RemovedFeatures", NULL, &dwType,
			    tchValue, &dwSize) != ERROR_SUCCESS)
	{
	    strcpy(tchValue, "DBMS");
	}
	else if (!strstr(tchValue, "DBMS"))
	    strcat(tchValue, ",DBMS");

	status = RegSetValueEx( hKey, "RemovedFeatures", 0, REG_SZ,
				tchValue, strlen(tchValue) + 1 );

	RegCloseKey(hKey);
	return (status==ERROR_SUCCESS ? ERROR_SUCCESS : ERROR_INSTALL_FAILURE);
    }
    else if (iInstalled == INSTALLSTATE_LOCAL || iAction != INSTALLSTATE_LOCAL)
    {
	dwSize = sizeof(tchValue);
	if (!MsiGetProperty(ihnd, "INGRES_UPGRADE", tchValue, &dwSize) && strcmp(tchValue, "2"))
	{
	    RegCloseKey(hKey);
	    return (ERROR_SUCCESS);
	}
    }

    /*
    ** If this is an upgrade install, then checkpoint the databases
    ** if INGRES_CKPDBS is set.
    */

    dwSize = sizeof(tchValue);
    if (status ||
	MsiGetProperty( ihnd, "INGRES_LOGFILESIZE", tchValue,
			&dwSize ) != ERROR_SUCCESS)
    {
	return (ERROR_INSTALL_FAILURE);
    }
    else
    {
	status = RegSetValueEx( hKey, "logfilesize", 0, REG_SZ, tchValue,
				strlen(tchValue) + 1 );
    }

    dwSize = sizeof(tchValue);
    if (status ||
	MsiGetProperty( ihnd, "INGRES_ENABLEDUALLOG", tchValue,
			&dwSize ) != ERROR_SUCCESS)
    {
	return (ERROR_INSTALL_FAILURE);
    }
    else
    {
	status = RegSetValueEx( hKey, "enableduallogging", 0, REG_SZ, tchValue,
				strlen(tchValue) + 1 );
    }

    dwSize = sizeof(tchValue);
    if (status ||
	MsiGetProperty( ihnd, "INGRES_ENABLESQL92", tchValue,
			&dwSize ) != ERROR_SUCCESS)
    {
	return (ERROR_INSTALL_FAILURE);
    }
    else
    {
	status = RegSetValueEx( hKey, "enablesql92", 0, REG_SZ, tchValue,
				strlen(tchValue) + 1 );
    }

    dwSize = sizeof(tchValue);
    if (status ||
	MsiGetProperty( ihnd, "INGRES_DATADIR", tchValue,
			&dwSize ) != ERROR_SUCCESS)
    {
	return (ERROR_INSTALL_FAILURE);
    }
    else
    {
	if (tchValue[strlen(tchValue)-1] == '\\')
	    tchValue[strlen(tchValue)-1] = '\0';
	status = RegSetValueEx( hKey, "iidatabasedir", 0, REG_SZ, tchValue,
				strlen(tchValue) + 1 );
    }

    dwSize = sizeof(tchValue);
    if (status ||
	MsiGetProperty( ihnd, "INGRES_CKPDIR", tchValue,
			&dwSize ) != ERROR_SUCCESS)
    {
	return (ERROR_INSTALL_FAILURE);
    }
    else
    {
	if (tchValue[strlen(tchValue)-1] == '\\')
	    tchValue[strlen(tchValue)-1] = '\0';
	status = RegSetValueEx( hKey, "iicheckpointdir", 0, REG_SZ, tchValue,
				strlen(tchValue) + 1 );
    }

    dwSize = sizeof(tchValue);
    if (status ||
	MsiGetProperty( ihnd, "INGRES_JNLDIR", tchValue,
			&dwSize ) != ERROR_SUCCESS)
    {
	return (ERROR_INSTALL_FAILURE);
    }
    else
    {
	if (tchValue[strlen(tchValue)-1] == '\\')
	    tchValue[strlen(tchValue)-1] = '\0';
	status = RegSetValueEx( hKey, "iijournaldir", 0, REG_SZ, tchValue,
				strlen(tchValue) + 1 );
    }

    dwSize = sizeof(tchValue);
    if (status ||
	MsiGetProperty( ihnd, "INGRES_DMPDIR", tchValue,
			&dwSize ) != ERROR_SUCCESS)
    {
	return (ERROR_INSTALL_FAILURE);
    }
    else
    {
	if (tchValue[strlen(tchValue)-1] == '\\')
	    tchValue[strlen(tchValue)-1] = '\0';
	status = RegSetValueEx( hKey, "iidumpdir", 0, REG_SZ, tchValue,						strlen(tchValue) + 1 );
    }

    dwSize = sizeof(tchValue);
    if (status ||
	MsiGetProperty( ihnd, "INGRES_WORKDIR", tchValue,
			&dwSize ) != ERROR_SUCCESS)
    {
	return (ERROR_INSTALL_FAILURE);
    }
    else
    {
	if (tchValue[strlen(tchValue)-1] == '\\')
	    tchValue[strlen(tchValue)-1] = '\0';
	status = RegSetValueEx( hKey, "iiworkdir", 0, REG_SZ, tchValue,
				strlen(tchValue) + 1 );
    }

    dwSize = sizeof(tchValue);
    if (status ||
	MsiGetProperty( ihnd, "INGRES_PRIMLOGDIR", tchValue,
			&dwSize ) != ERROR_SUCCESS)
    {
	return (ERROR_INSTALL_FAILURE);
    }
    else
    {
	if (tchValue[strlen(tchValue)-1] == '\\')
	    tchValue[strlen(tchValue)-1] = '\0';
	status = RegSetValueEx( hKey, "primarylogdir", 0, REG_SZ, tchValue,
				strlen(tchValue) + 1 );
    }

    dwSize = sizeof(tchValue);
    if (status ||
	MsiGetProperty( ihnd, "INGRES_DUALLOGDIR", tchValue,
			&dwSize ) != ERROR_SUCCESS)
    {
	return (ERROR_INSTALL_FAILURE);
    }
    else
    {
	if (tchValue[strlen(tchValue)-1] == '\\')
	    tchValue[strlen(tchValue)-1] = '\0';
	status = RegSetValueEx( hKey, "duallogdir", 0, REG_SZ, tchValue,
				strlen(tchValue) + 1 );
    }

    dwSize = sizeof(tchValue);
    if (status ||
	MsiGetProperty( ihnd, "INGRES_DESTROYTXLOGFILE", tchValue,
			&dwSize ) != ERROR_SUCCESS)
    {
	return (ERROR_INSTALL_FAILURE);
    }
    else
    {
	status = RegSetValueEx( hKey, "destroytxlogfile", 0, REG_SZ, tchValue,
				strlen(tchValue) + 1 );
    }

    dwSize = sizeof(tchValue);
    if (status ||
	MsiGetProperty( ihnd, "INGRES_UPGRADEUSERDBS", tchValue,
			&dwSize ) != ERROR_SUCCESS)
    {
	return (ERROR_INSTALL_FAILURE);
    }
    else
    {
	status = RegSetValueEx( hKey, "upgradeuserdatabases", 0, REG_SZ, 
				tchValue, strlen(tchValue) + 1 );
    }

    dwSize = sizeof(tchValue);
    if (status ||
	MsiGetProperty( ihnd, "INGRES_CLUSTER_INSTALL", tchValue,
			&dwSize ) != ERROR_SUCCESS || !tchValue[0])
    {
    }
    else
    {
	status = RegSetValueEx( hKey, 
				"clusterinstall", 
				0, REG_SZ, (CONST BYTE *)&tchValue, 
				strlen(tchValue) + 1 );

    }

    dwSize = sizeof(tchValue);
    if (status ||
	MsiGetProperty( ihnd, "INGRES_CLUSTER_RESOURCE", tchValue,
			&dwSize ) != ERROR_SUCCESS || !tchValue[0])
    {
    }
    else
    {
	status = RegSetValueEx( hKey, 
				"clusterresource", 
				0, REG_SZ, (CONST BYTE *)&tchValue, 
				strlen(tchValue) + 1 );

    }

    dwSize = sizeof(tchValue);
    if (status ||
	MsiGetProperty( ihnd, "INGRES_MDB_INSTALL", tchValue,
			&dwSize ) != ERROR_SUCCESS || !tchValue[0])
    {
    }
    else
    {
	status = RegSetValueEx( hKey, 
				"mdbinstall", 
				0, REG_SZ, (CONST BYTE *)&tchValue, 
				strlen(tchValue) + 1 );

    }

    dwSize = sizeof(tchValue);
    if (status ||
	MsiGetProperty( ihnd, "INGRES_MDB_NAME", tchValue,
			&dwSize ) != ERROR_SUCCESS || !tchValue[0])
    {
    }
    else
    {
	status = RegSetValueEx( hKey, 
				"mdbname", 
				0, REG_SZ, (CONST BYTE *)&tchValue, 
				strlen(tchValue) + 1 );

    }

    dwSize = sizeof(tchValue);
    if (status ||
	MsiGetProperty( ihnd, "INGRES_MDB_SIZE", tchValue,
			&dwSize ) != ERROR_SUCCESS || !tchValue[0])
    {
    }
    else
    {
	status = RegSetValueEx( hKey, 
				"mdbsize", 
				0, REG_SZ, (CONST BYTE *)&tchValue, 
				strlen(tchValue) + 1 );

    }

    dwSize = sizeof(tchValue);
    if (status ||
	MsiGetProperty( ihnd, "INGRES_MDB_DEBUG", tchValue,
			&dwSize ) != ERROR_SUCCESS || !tchValue[0])
    {
    }
    else
    {
	status = RegSetValueEx( hKey, 
				"mdbdebug", 
				0, REG_SZ, (CONST BYTE *)&tchValue, 
				strlen(tchValue) + 1 );

    }

    strcpy(tchValue, "TRUE");
    status = RegSetValueEx( hKey, "Ingres DBMS Server", 0, REG_SZ, 
			    (CONST BYTE *)&tchValue, strlen(tchValue) + 1 );

    return (status == ERROR_SUCCESS ? ERROR_SUCCESS : ERROR_INSTALL_FAILURE);
}