//! 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;
}
//! 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;
}
static void tests(void) {
   const char *ids[] = {
      "D.EclipsePlugins",
      "F.ECLIPSE_JUNO_CDT",
      "F.ECLIPSE_KEPLER_CDT",
      "F.ECLIPSE_LUNA_CDT",
      "D.Eclipse_JUNO_Dropins",
      "D.Eclipse_KEPLER_Dropins",
      "D.Eclipse_LUNA_Dropins",
   };
   unsigned rc;

   unsigned long pathLength;
   for(unsigned sub=0; sub<(sizeof(ids)/sizeof(ids[0])); sub++) {
      // Get Eclipse install plugin path
      char path[MAX_PATH];
      pathLength = MAX_PATH;
      rc = MsiGetProperty(hInstall, ids[sub], path, &pathLength);
      if (rc != ERROR_SUCCESS) {
         printLog("WriteLinkFile() MsiGetProperty(%s) => FAILED", ids[sub]);
      }
      else {
         printLog("WriteLinkFile() MsiGetProperty(%s) => \'%s\'", ids[sub], path);
      }
      pathLength = MAX_PATH;
      rc = MsiGetTargetPath(hInstall, ids[sub], path, &pathLength);
      if (rc != ERROR_SUCCESS) {
         printLog("WriteLinkFile() MsiGetTargetPath(%s) => FAILED", ids[sub]);
      }
      else {
         printLog("WriteLinkFile() MsiGetTargetPath(%s) => \'%s\'", ids[sub], path);
      }
   }
}
//! 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;
}
// Determines the path for the sample FW databases, detaches them from SQL server,
// then deletes the files.
// Returns 0 in all cases, but errors are logged to the MSI error output.
extern "C" __declspec(dllexport) UINT RemoveSampleDatabases(MSIHANDLE hInstall)
{
    // Initialize COM client:
    CoInitialize(NULL);
    IOleDbEncap * pOleDbEncap = NULL;

    // Connect to COM Server for FW Databases:
    HRESULT hr = CoCreateInstance(CLSID_OleDbEncap, NULL, CLSCTX_INPROC_SERVER,
                                  IID_IOleDbEncap, reinterpret_cast <void **> (&pOleDbEncap));
    if (FAILED(hr))
    {
        WriteMsiLogEntry(hInstall, "error: CoCreateInstance failed.");
        CoUninitialize();
        return 0;
    }

    // Initialize connection to master database on local machine:
    wchar_t szComputerName[MAX_COMPUTERNAME_LENGTH + 1];
    DWORD cch = sizeof(szComputerName);
    if (0 == GetComputerNameW(szComputerName, &cch))
    {
        WriteMsiLogEntry(hInstall, "error: GetComputerName failed.");
        pOleDbEncap->Release();
        CoUninitialize();
        return 0;
    }

    wchar_t szServerName[MAX_COMPUTERNAME_LENGTH + 7];
    swprintf_s(szServerName, MAX_COMPUTERNAME_LENGTH + 7, L"%s\\SILFW", szComputerName);

    hr = pOleDbEncap->Init(_bstr_t(szServerName), _bstr_t(L"master"), NULL, koltMsgBox, koltvFwDefault);
    if (FAILED(hr))
    {
        WriteMsiLogEntry(hInstall, "error: Initialization of connection to master database failed.");
        pOleDbEncap->Release();
        CoUninitialize();
        return 0;
    }

    // Create a command interface from the FW database connection:
    IOleDbCommand * podc = NULL;
    hr = pOleDbEncap->CreateCommand(&podc);
    if (FAILED(hr))
    {
        WriteMsiLogEntry(hInstall, "error: CreateCommand failed.");
        pOleDbEncap->Release();
        CoUninitialize();
        return 0;
    }

    // Detach each database:
    for (int iDb = 0; iDb < sizeof(pszDbNames) / sizeof(pszDbNames[0]); iDb++)
    {
        // Set the DB name as the parameter:
        hr = podc->SetParameter(1, DBPARAMFLAGS_ISINPUT, NULL, DBTYPE_WSTR,
                                (ULONG *)pszDbNames[iDb], ULONG(wcslen(pszDbNames[iDb]) * sizeof(wchar_t)));

        try
        {
            // Run the "detach" stored procedure:
            hr = podc->ExecCommand(L"EXEC sp_detach_db ?", knSqlStmtNoResults);
            wchar_t szError[200];
            swprintf_s(szError, 200, L"detached %s.", pszDbNames[iDb]);
            WriteMsiLogEntry(hInstall, szError);
        }
        catch (...)
        {
            wchar_t szError[200];
            swprintf_s(szError, 200, L"error: failed to detach %s.", pszDbNames[iDb]);
            WriteMsiLogEntry(hInstall, szError);
        }
    }

    // Get the full path of the folder where the database files are:
    char * pszFolderPath = NULL;
    DWORD cchFolderPath = 0;

    if (!hInstall)
    {
#ifdef TEST_HARNESS
        pszFolderPath = _strdup(DATA_FOLDER);
#else
        podc->Release();
        pOleDbEncap->Release();
        CoUninitialize();
        return 0;
#endif
    }
    else
    {
        // Determine the required buffer size for the full file path:
        UINT uiStat = MsiGetTargetPath(hInstall, "Data", "", &cchFolderPath);
        if (ERROR_MORE_DATA == uiStat)
        {
            ++cchFolderPath; // on output does not include terminating null, so add 1
            pszFolderPath = new char[cchFolderPath];
            if (pszFolderPath)
                uiStat = MsiGetTargetPath(hInstall, "Data", pszFolderPath, &cchFolderPath);
        }
    }

    char szMsg[500];
    if (pszFolderPath)
    {
        sprintf_s(szMsg, 500, "database folder path is %s.", pszFolderPath);
        WriteMsiLogEntry(hInstall, szMsg);
    }
    else
    {
        WriteMsiLogEntry(hInstall, "error: could not determine database folder path.");
        podc->Release();
        pOleDbEncap->Release();
        CoUninitialize();
        return 0;
    }

    // Delete the detached database files:
    for (int iFile = 0; iFile < sizeof(pszFileNames) / sizeof(pszFileNames[0]); iFile++)
    {
        size_t cchFilePath = strlen(pszFolderPath) + strlen(pszFileNames[iFile]) + 1;
        char * pszFilePath = new char [cchFilePath];

        if (pszFilePath)
        {
            sprintf_s(pszFilePath, cchFilePath, "%s%s", pszFolderPath, pszFileNames[iFile]);

            sprintf_s(szMsg, 500, "Deleting file %s.", pszFilePath);
            WriteMsiLogEntry(hInstall, szMsg);

            // Remove the read-only attribute:
            DWORD dwAttrs = GetFileAttributes(pszFilePath);
            if (dwAttrs != INVALID_FILE_ATTRIBUTES)
            {
                if (dwAttrs & FILE_ATTRIBUTE_READONLY) // Only attempt removal if attribute is set
                {
                    if (0 == SetFileAttributes(pszFilePath, dwAttrs & ~FILE_ATTRIBUTE_READONLY))
                    {
                        sprintf_s(szMsg, 500, "Error %d: could not remove read-only attributes.", GetLastError());
                        WriteMsiLogEntry(hInstall, szMsg);
                    }
                }
            }
            else
                WriteMsiLogEntry(hInstall, "Error: could not retrieve file attributes.");

            // Delete the file:
            if (0 == DeleteFile(pszFilePath))
            {
                sprintf_s(szMsg, 500, "Error %d: could not delete file.", GetLastError());
                WriteMsiLogEntry(hInstall, szMsg);
            }
        }
    }

    podc->Release();
    // For some reason, the process would hang here if we tried to release pOleDbEncap.
//	pOleDbEncap->Release();

    return 0;
}
示例#6
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;
}