Example #1
0
int main() {
PROCESS_INFORMATION piProcInfo;
STARTUPINFO siStartInfo;
char cmdline[1024];
char programfile[1024];

   /* Only one invocation allowed. */
   /* check if we are already running. */
   if (CheckIfRunning()) {
      MessageBox(NULL, "An Install is already in progress. Aborting Install.", "KeyTrans Installation", MB_OK);
      exit(-1);
   }

   if (GetProgramFilesPath(programfile, 1024) == 0) {
      MessageBox(NULL, "Couldnt obtain Program Files Directory path. - Aborting Install.", "KeyTrans Installation", MB_OK);

      /* Destroy the Semaphore. */
      CloseHandle(OnlyOneSem);

      exit(-1);
   }

   strcat(programfile, "\\KeyTrans");
#ifdef DEBUG
   fprintf(stdout, "Program Files Path: %s\n", programfile);
#endif
   /* We have programfile as: "C:\Program Files" */

   /* Install it and quit. */
   if (InstallFiles(programfile) == 1) {
#ifdef DEBUG
      fprintf(stdout, "Installed KeyTrans.\n");
#endif

      ShowInstallDir(programfile);
      MessageBox(NULL, "KeyTrans Installed successfully. Please install the Vutam Font.", "KeyTrans Installation", MB_OK);
   }
   else {
      MessageBox(NULL, "KeyTrans Installation Failed.", "KeyTrans Installation", MB_OK);

      /* Destroy the Semaphore. */
      CloseHandle(OnlyOneSem);

      exit(-1);
   }

   /* Destroy the Semaphore. */
   CloseHandle(OnlyOneSem);

   /* and we exit. */
   exit(0);
}
Example #2
0
//////////////////////////////////////////////////////////
//
// CInstallManager::_InstallFiles
//
//
//
//////////////////////////////////////////////////////////
SString CInstallManager::_InstallFiles ( void )
{
    WatchDogReset ();

    // Install new files
    if ( !InstallFiles ( m_pSequencer->GetVariable ( SILENT_OPT ) != "no" ) )
    {
        if ( !IsUserAdmin () )
            AddReportLog ( 3048, SString ( "_InstallFiles: Install - trying as admin %s", "" ) );
        else
            AddReportLog ( 5049, SString ( "_InstallFiles: Couldn't install files %s", "" ) );

        m_strAdminReason = _("Install updated MTA:SA files");
        return "fail";
    }
    else
    {
        UpdateMTAVersionApplicationSetting ();
        AddReportLog ( 2050, SString ( "_InstallFiles: ok %s", "" ) );
        return "ok";
    }
}