Files correlati : Ricompilazione Demo : [ ] Commento :setup.ins & friends git-svn-id: svn://10.65.10.50/trunk@14645 c028cbd2-c16b-5b4b-a496-9718f37d4682
		
			
				
	
	
		
			800 lines
		
	
	
		
			23 KiB
		
	
	
	
		
			Plaintext
		
	
	
		
			Executable File
		
	
	
	
	
			
		
		
	
	
			800 lines
		
	
	
		
			23 KiB
		
	
	
	
		
			Plaintext
		
	
	
		
			Executable File
		
	
	
	
	
| //________________________________________________________________________________________________________________________
 | ||
| // **** Selezione del tipo di installazione (1st level)
 | ||
| // **** Aggiornamento,installazione standard,installazione avanzata
 | ||
| 
 | ||
| function _SelectSetupType(nRetv )
 | ||
| 
 | ||
|   STRING szMsg[512];
 | ||
|   BOOL   bJunk,bReinstall;
 | ||
| begin
 | ||
| 
 | ||
| #ifdef __DEMO__
 | ||
|     bSetupStandard=TRUE;
 | ||
| #else
 | ||
|   bJunk = !bSetupStandard;
 | ||
| 
 | ||
| //cerca il file con eventuali precedenti installazioni (campo.stp)
 | ||
|   if (Is( FILE_EXISTS, "C:\\Campo.stp" )) then
 | ||
| 	bSetupStandard = FALSE;
 | ||
| 	bReinstall = TRUE;
 | ||
|   	nRetv = AskOptions(EXCLUSIVE,"Si desidera effettuare:",
 | ||
| 		"Aggiornamento di una precedente installazione",bReinstall,
 | ||
| 		"Installazione &STANDARD",bSetupStandard, 
 | ||
| 		"Installazione &personalizzata e/o di rete",bJunk);
 | ||
| 	if (nRetv != BACK && bReinstall) then
 | ||
| 	  _ChooseReinstall(nRetv);
 | ||
| 	endif;	
 | ||
| 
 | ||
|   else
 | ||
| 	nRetv = AskOptions(EXCLUSIVE,"Si desidera effettuare:",
 | ||
| 		"Installazione &STANDARD (scelta consigliata)",bSetupStandard, 
 | ||
| 		"Installazione &personalizzata e/o di rete",bJunk);
 | ||
|   endif;
 | ||
|   	
 | ||
| #endif
 | ||
| end;
 | ||
| 
 | ||
| //________________________________________________________________________________________________________________________
 | ||
| // **** Selezione del tipo di installazione (2nd level)
 | ||
| // **** (programmi o postazione di rete)
 | ||
| 
 | ||
| function _SelectSetupMode(nRetv )
 | ||
| 
 | ||
|   STRING szMsg[512];
 | ||
|   BOOL zInstallDemo,zInstallNetWrkChk;
 | ||
| begin
 | ||
| 
 | ||
|  zInstallDemo = bInstallDemo;
 | ||
|  zInstallNetWrkChk = bInstallNetWrkChk;
 | ||
| 
 | ||
| #ifdef __DEMO__
 | ||
| 	bInstallDemo=TRUE;
 | ||
| #else
 | ||
| //caso della reinstallazione su precedente versione: tutto quanto segue e' inutile quindi esce
 | ||
|   if (nReinstall > 0) then
 | ||
|     return;
 | ||
|   endif;
 | ||
| //caso di installazione nuova...
 | ||
|   if bInstallNetWrkChk then
 | ||
|     bInstallEnv=FALSE;
 | ||
|   endif;
 | ||
|   if bSetupStandard then
 | ||
|     bInstallEnv=TRUE;
 | ||
|   else
 | ||
|     szMsg       = "Il programma puo' essere installato in ";
 | ||
|     szMsg=szMsg + "modalita' postazione singola, postazione di rete su disco locale, ";
 | ||
|     szMsg=szMsg + "postazione di rete su disco di rete. Si desidera installare:";
 | ||
|     nRetv = AskOptions(EXCLUSIVE,szMsg,
 | ||
|       "&in postazione singola (o server)",
 | ||
|       bInstallEnv, 
 | ||
|       "in rete con &programmi su disco &locale",
 | ||
|       bInstallNetWrkChk
 | ||
|       );
 | ||
|   endif;
 | ||
|   if bInstallNetWrkChk then
 | ||
|     bInstallEnv=TRUE;
 | ||
|   endif;
 | ||
| #endif
 | ||
| 
 | ||
|   if (( zInstallDemo!=bInstallDemo) || (zInstallNetWrkChk!=bInstallNetWrkChk) ) then
 | ||
|     if bInstallDemo then
 | ||
|       bInstallPrg = TRUE;
 | ||
|       bInstallData=TRUE;
 | ||
|       bInstallDemoData=TRUE;
 | ||
|     else
 | ||
|       bInstallPrg = TRUE;
 | ||
|     endif;
 | ||
|   endif;
 | ||
| end;
 | ||
| 
 | ||
| //________________________________________________________________________________________________________________________
 | ||
| // *** Chiede la directory ove installare i programmi;
 | ||
| 
 | ||
| function _SelectProgramDestination(nRetv)
 | ||
| 
 | ||
|   BOOL bReenterPath, bConfirmdatapath, bFoundInst, bRemoteExe, bRemoteData,bOk;
 | ||
|   STRING szPar, szInst;
 | ||
|   NUMBER nPar, nNextFree;
 | ||
| 
 | ||
| begin
 | ||
|   // ricontrolla la presenza di una installazione 
 | ||
|   // e determina la posizione della directory "DATI"
 | ||
| 
 | ||
| //aggiornamento di una precedente installazione  
 | ||
|   if (nReinstall > 0 ) then
 | ||
| 	szConfigPath = szReinstallPath;
 | ||
| 	bNuovaInst = FALSE;
 | ||
| 	bInstallData = FALSE;
 | ||
|   endif;
 | ||
| 
 | ||
| //se non esiste una precedente installazione->nuova installazione;necessiter<65> di un path di default per l'installazione
 | ||
|   if (szConfigPath = "") then
 | ||
| 	bNuovaInst = TRUE;	//se non e' stato scelto un aggiornamento e' comunque una nuova installazione! 
 | ||
|     bInstallData = TRUE;
 | ||
|     szConfigPath = DEFAULT_LOCALPATH;
 | ||
|   endif;
 | ||
| 
 | ||
|   if (nReinstall = 0) then
 | ||
|     nRetv=AskDestPath( "", "", szConfigPath, 0 );
 | ||
|     StrRemoveLastSlash(szConfigPath);
 | ||
|     if (nRetv=BACK) then
 | ||
|       return;
 | ||
|     endif;
 | ||
|   endif;
 | ||
| 
 | ||
|   bNuovaInst = ! _CheckExistingInst(szConfigPath);
 | ||
|   if (bNuovaInst && (! ExistsDir(szConfigPath))) then
 | ||
|     CreateDir(szConfigPath);
 | ||
|   endif;
 | ||
| 
 | ||
| //per una nuova installazione:aggiunge un paragrafo relativo nel campo.stp
 | ||
|   nNextFree = 0;
 | ||
|   nPar = 1;
 | ||
|   szPar = "1";
 | ||
|   bFoundInst = FALSE;
 | ||
|   while (GetProfString("C:\\Campo.stp", szPar, "Program", szInst) = 0 && ! bFoundInst)
 | ||
|     if (_CheckExistingInst(szInst)) then
 | ||
|       bOk = szInst = szConfigPath;
 | ||
| 	  if (! bOk) then
 | ||
| 		GetProfString("C:\\Campo.stp", szPar, "CampoIni", szInst);
 | ||
| 		bOk = szInst = szConfigPath ^ "\\campo.ini";
 | ||
| 	  endif;
 | ||
|       if (bOk) then
 | ||
| 	    bFoundInst = TRUE;
 | ||
| 	    nReinstall = nPar;
 | ||
| 	    bSetupStandard = FALSE;	//non puo' essere una installazione standard, sta sovrascrivendo una precedente installazione
 | ||
| 	  endif;
 | ||
| 
 | ||
| 	else
 | ||
| 
 | ||
|       if (nNextFree = 0) then
 | ||
| 	    nNextFree = nPar;
 | ||
| 	  endif;
 | ||
| 	   
 | ||
| 	endif;
 | ||
| 
 | ||
| 	nPar = nPar + 1;
 | ||
|     NumToStr(szPar, nPar);
 | ||
| 
 | ||
|   endwhile;
 | ||
| 
 | ||
|   if (! bFoundInst) then
 | ||
|     if (nNextFree > 0) then
 | ||
| 	  nPar = nNextFree;
 | ||
| 	endif;
 | ||
|     NumToStr(szPar, nPar);
 | ||
|     WriteProfString("C:\\Campo.stp", szPar, "Program", szConfigPath);
 | ||
| 	nNewInstall = nPar;
 | ||
|   endif;
 | ||
| 
 | ||
|   if (nReinstall > 0) then
 | ||
|     NumToStr(szPar, nReinstall);
 | ||
|     GetProfString("C:\\Campo.stp", szPar, "CampoIni", szCampoIni);
 | ||
| 	GetProfString("C:\\Campo.stp", szPar, "Program", szAppPath);
 | ||
|   endif;
 | ||
| 
 | ||
|   if ( (szCampoIni = "") || (! Is (FILE_EXISTS, szCampoIni))) then
 | ||
|     szCampoIni = szConfigPath ^ "campo.ini";
 | ||
|   endif;
 | ||
| 
 | ||
| //esiste campo.ini -> e' una reinstallazione  
 | ||
|   if ( Is (FILE_EXISTS, szCampoIni ) ) then
 | ||
| 
 | ||
|     GetProfString(szCampoIni, "Main", "Program",szAppRefPath );
 | ||
|     GetProfString(szCampoIni, "Main", "Study",szDataPath );
 | ||
| 	
 | ||
| 	_IsNetworkDrive(szAppPath, bRemoteExe);
 | ||
| 	_IsNetworkDrive(szDataPath, bRemoteData);
 | ||
| 
 | ||
| 	bInstallNetWrkChk = FALSE;
 | ||
| 	bInstallEnv = ! bRemoteExe;
 | ||
| 
 | ||
| //distingue tra dati in remoto e campo wst
 | ||
| 	if (bRemoteData) then
 | ||
|       bInstallNetWrkChk = !bRemoteExe;
 | ||
|     endif;	  
 | ||
|     
 | ||
| //non esiste campo.ini -> e' una installazione
 | ||
|   else
 | ||
|     szDataPath = szConfigPath ^ "DATI\\";
 | ||
| 
 | ||
|   endif;
 | ||
| 
 | ||
|   if ( nReinstall > 0 ) then
 | ||
|     NumToStr(szPar, nReinstall);
 | ||
|   else
 | ||
|     NumToStr(szPar, nNewInstall);
 | ||
|   endif;
 | ||
| 
 | ||
| //scrive su campo.stp..
 | ||
|     WriteProfString("C:\\Campo.stp", szPar, "CampoIni", "");	
 | ||
| //..e l'application path e' lo stesso del campo.ini (ovvio,ba0.exe e' assieme a campo.ini)    
 | ||
| 	szAppPath = szConfigPath;
 | ||
| 
 | ||
|   return;
 | ||
| end;
 | ||
| 
 | ||
| 
 | ||
| //________________________________________________________________________________________________________________________
 | ||
| // *** Selezione dei componenti da installare (area dati, server chiave e master server)
 | ||
|  
 | ||
| function _SelectWhatToInstall(nRetv)
 | ||
| 
 | ||
|   BOOL bJunk;
 | ||
|   STRING szMsg[512], szPar;
 | ||
|   NUMBER nServers;
 | ||
| begin
 | ||
| 
 | ||
|   bInstallPrg=TRUE;
 | ||
|   bInstallData = (szDataPath != '')&&(! _CheckExistingData(szDataPath));
 | ||
|   bInstallServer = FALSE;
 | ||
| 
 | ||
|   if (nReinstall > 0) then
 | ||
|     bInstallData = FALSE;
 | ||
|     NumToStr(szPar, nReinstall);
 | ||
|     GetProfInt("C:\\Campo.stp", szPar, "Servers", nServers);
 | ||
| 	bInstallServer = nServers != 0;
 | ||
|   endif;
 | ||
| 
 | ||
| //installazione standard per utente basico; finisce qui
 | ||
|   if bSetupStandard then
 | ||
|     return;
 | ||
|   endif;
 | ||
| 
 | ||
| //installazione avanzata
 | ||
|   repeat
 | ||
| 
 | ||
| // Windows 95/98/ME or NT/2000/XP platforms
 | ||
|     if (bInstallNetWrkChk) then
 | ||
|       szMsg= "Setup installera' la postazione di lavoro.\nE' possibile installare anche l'area dati, il server di rete per le chiavi di protezione.";
 | ||
|       nRetv = AskOptions(NONEXCLUSIVE,szMsg,
 | ||
|         "Installa l'area dati", bInstallData ,
 | ||
| 	    "Installa i servizi avanzati di rete (Lerch)", bInstallServer
 | ||
|       ); 
 | ||
|     else
 | ||
|       szMsg= "E' possibile installare i programmi (ambiente e moduli), l'area dati, il server di rete per le chiavi di protezione. ";
 | ||
|       szMsg=szMsg + "\nSelezionare almeno una delle componenti"; 
 | ||
|       nRetv = AskOptions(NONEXCLUSIVE,szMsg,
 | ||
|         "Installa i programmi", bInstallPrg,
 | ||
|         "Installa l'area dati", bInstallData ,
 | ||
| 	    "Installa i servizi avanzati di rete (Lerch)", bInstallServer 
 | ||
|       ); 
 | ||
|     endif;
 | ||
| 
 | ||
|   until  nRetv!=NEXT || bInstallData || bInstallPrg || bInstallServer;
 | ||
| 
 | ||
| //viene aggiornato il file campo.stp con i valori relativi all'installazione del master server e del server di chiavi  
 | ||
|   if (nReinstall > 0) then
 | ||
| 	NumToStr(szPar, nReinstall);
 | ||
|   else
 | ||
| 	NumToStr(szPar, nNewInstall);
 | ||
|   endif;
 | ||
| 
 | ||
|   nServers = 0;
 | ||
|   if (bInstallServer) then
 | ||
|     nServers = 1;
 | ||
|   endif;
 | ||
|   
 | ||
|   NumToStr(szTmp, nServers);
 | ||
|   WriteProfString("C:\\Campo.stp", szPar, "Servers", szTmp);
 | ||
| 
 | ||
|   return ;
 | ||
| end;
 | ||
| 
 | ||
| 
 | ||
| //________________________________________________________________________________________________________________________
 | ||
| // *** In caso venga selezionata una installazione di rete, richiede i parametri necessari
 | ||
| 
 | ||
| function _SelectNetConfig(nDirection )
 | ||
| 
 | ||
|   STRING szText[ _MAX_LENGTH ], szModifiedPath[ _MAX_LENGTH ], szTemp[ _MAX_LENGTH ];
 | ||
|   STRING szNetAppPath[ _MAX_LENGTH ], szPar[ _MAX_LENGTH ];
 | ||
|   NUMBER nHandle;
 | ||
|   BOOL ok;
 | ||
| begin
 | ||
|   if (!(bInstallNetWrkChk && bInstallPrg)) then
 | ||
|     return;
 | ||
|   endif;
 | ||
| 
 | ||
|   if (szAppRefPath = "") then
 | ||
| 	GetProfString(szCampoIni, "Main", "Program", szAppRefPath);
 | ||
|   endif;
 | ||
|   szNetAppPath=szAppRefPath;
 | ||
| 
 | ||
|   szText = szText + "Inserire il percorso completo del direttorio di rete che contiene i files del programma. ";
 | ||
|   szText = szText + "Se tali files mancano, installarli secondo la modalita' 'postazione singola'. ";
 | ||
|   szText = szText + "Ogni postazione di rete verifichera' eventuali aggiornamenti di questa installazione ";
 | ||
|   szText = szText + "aggiornandosi automaticamente.";
 | ||
| 
 | ||
|   if (szNetAppPath = "") then
 | ||
|     szNetAppPath = DEFAULT_NETPATH;
 | ||
|   endif;
 | ||
|   ok=FALSE;
 | ||
|     while (!ok)
 | ||
|       nDirection = AskPath( szText , szNetAppPath, szModifiedPath );
 | ||
|       if ( nDirection = NEXT ) then
 | ||
|         if ( _CheckExistingInst(szModifiedPath) ) then
 | ||
|           szNetAppPath = szModifiedPath;
 | ||
|           StrToUpper( szNetAppPath, szNetAppPath );
 | ||
|           if szDataPath = "" then
 | ||
|              StrToUpper(szDataPath ,szModifiedPath);
 | ||
|           endif; 
 | ||
|           bProgrammiServer = TRUE;
 | ||
|           ok = TRUE;
 | ||
|         else
 | ||
|           _Attenzione( "Impossibile trovare i files del programma in " +  szModifiedPath );
 | ||
|         endif;
 | ||
|       else
 | ||
|         ok = TRUE;
 | ||
|       endif;
 | ||
|     endwhile;
 | ||
| 
 | ||
|     szAppRefPath =szNetAppPath;
 | ||
|     StrRemoveLastSlash(szAppRefPath);
 | ||
| 
 | ||
| end;
 | ||
| 
 | ||
| //________________________________________________________________________________________________________________________
 | ||
| // *** Chiede dove sono i dati da utilizzare; se esistono gia' o vanno creati
 | ||
| 
 | ||
| function _SelectDataDestination(nRetv)
 | ||
| 
 | ||
|   BOOL bConfirmdatapath;
 | ||
|   STRING szChangedPath[256]
 | ||
|   STRING sMsg[256]
 | ||
| begin
 | ||
| // ricontrolla la presenza di una installazione 
 | ||
| // e determina la posizione della directory "DATI"
 | ||
|   if bInstallData || bInstallPrg then
 | ||
|     if bInstallData then
 | ||
|       sMsg = "Setup installer<65> l'area dati nel seguente direttorio.";
 | ||
|     else  
 | ||
|       sMsg = "Verr<72> utilizzata l'area dati che si trova nel seguente direttorio.";
 | ||
|     endif;
 | ||
|     sMsg = sMsg + "\nE' possibile cambiare il direttorio digitando il nuovo nome o scegliendo il pulsante <Sfoglia>";
 | ||
|     repeat  
 | ||
|       bConfirmdatapath=TRUE;
 | ||
|       nRetv=AskPath(sMsg ,szDataPath, szChangedPath);
 | ||
|       if (nRetv=BACK) then
 | ||
|         return ;
 | ||
|       endif;
 | ||
|       szDataPath=szChangedPath;
 | ||
|       bDatiPresenti = _CheckExistingData(szDataPath);
 | ||
|       if (bDatiPresenti && bInstallData) then
 | ||
|         bConfirmdatapath=_CanOverwrite();
 | ||
|       endif;
 | ||
|       if ((! bDatiPresenti) && (! bInstallData)) then
 | ||
|         if (bSetupStandard) then
 | ||
|           bInstallData=TRUE;
 | ||
|         else
 | ||
|           MessageBox( "La cartella indicata non contiene dati. \nSe si desidera davvero utilizzare questa cartella, \nabilitare l'installazione dell'area dati" ,SEVERE);
 | ||
|           bConfirmdatapath=FALSE;
 | ||
|         endif;
 | ||
|       endif;
 | ||
|     until (bConfirmdatapath);
 | ||
|   endif;
 | ||
|   return ;
 | ||
| end;
 | ||
| 
 | ||
| //________________________________________________________________________________________________________________________
 | ||
| // **** Selezione del tipo di installazione dati
 | ||
| 
 | ||
| function _SelectDataType( nRetv)
 | ||
| 
 | ||
|   BOOL bJunk;
 | ||
|   STRING szMsg[512];
 | ||
| begin
 | ||
|   if ( (!bInstallData) || (nReinstall > 0) ) then
 | ||
|     return;
 | ||
|   endif;
 | ||
| #ifdef __DEMO__
 | ||
|       bInstallDemoData=TRUE;
 | ||
| #else
 | ||
|   szMsg= "Verranno installati nuovi archivi nell'area dati. \n";
 | ||
|   szMsg=  szMsg + "Si desidera precaricarli con dati dimostrativi ?";
 | ||
|   repeat
 | ||
|       nRetv = AskOptions(NONEXCLUSIVE,szMsg, "carica i dati dimostrativi", bInstallDemoData); 
 | ||
|       if nRetv=BACK then
 | ||
|         return ;
 | ||
|       endif;
 | ||
| 
 | ||
|       if bInstallDemoData then
 | ||
|         szInstType = INST_DEMO;
 | ||
|       else
 | ||
|         szInstType = INST_ENVIRONMENT;
 | ||
|         bInstallFirm = TRUE;
 | ||
|       endif;
 | ||
|   until nRetv=NEXT;
 | ||
| #endif
 | ||
|   return ;
 | ||
| end;
 | ||
| 
 | ||
| 
 | ||
| //________________________________________________________________________________________________________________________
 | ||
| // *** sceglie la locazione della chiave (locale o server)
 | ||
| 
 | ||
| function _SelectDongleServer(nRetv)
 | ||
| 
 | ||
|   STRING msg;
 | ||
|   BOOL bJunk;
 | ||
| begin
 | ||
| 
 | ||
|     if (bInstallDemo || bSetupStandard) then
 | ||
|       bUseDongleServer=FALSE;
 | ||
| 
 | ||
|     else
 | ||
| 	      
 | ||
|       msg = "I programmi sono protetti da una chiave hardware.\n";
 | ||
| 
 | ||
| //se installi il server (quindi chiave in locale) lo usi
 | ||
|       if (bInstallServer) then
 | ||
|         bUseDongleServer=TRUE;
 | ||
|         msg = msg + "Su questa macchina sta per essere installato un server di autorizzazioni:";
 | ||
|         nRetv = AskOptions(EXCLUSIVE,msg,
 | ||
|           "utilizza il server per il controllo delle autorizzazioni",bJunk);
 | ||
|       else
 | ||
|         if (_TCPIPPresent()) then 
 | ||
|           // e' installato il TCP/IP o verra' installato; posso fare uso delle chiavi di rete
 | ||
|           msg = msg +  "Il controllo delle autorizzazioni va effettuato:";
 | ||
| 		  if (nReinstall > 0 ) then
 | ||
| 		    GetProfString(szCampoIni, "Server", "Dongle", szTmp);
 | ||
| 			bJunk = (szTmp = "");
 | ||
| 			bUseDongleServer = ! bJunk;
 | ||
| 		  endif;
 | ||
|           nRetv = AskOptions(EXCLUSIVE,msg,
 | ||
|             "tramite chiave locale",       bJunk, 
 | ||
|             "tramite un server di chiavi", bUseDongleServer
 | ||
| 			);
 | ||
|         else
 | ||
|           bUseDongleServer=FALSE;
 | ||
|           nRetv = AskOptions(EXCLUSIVE, msg, "effettuare il controllo tramite chiave locale", bJunk);
 | ||
|         endif;
 | ||
|       endif;
 | ||
|     endif;
 | ||
| 	 
 | ||
|   return nRetv;
 | ||
| end;
 | ||
| 
 | ||
| 
 | ||
| //________________________________________________________________________________________________________________________
 | ||
| // *** Mette in Avvio Automatico il collegamento al server della chiave
 | ||
| 
 | ||
| function _FindAutoStartFolder(nDirection)
 | ||
| 
 | ||
|   NUMBER nItems;
 | ||
|   NUMBER lResult;
 | ||
|   NUMBER listID;
 | ||
|   NUMBER nRetv;
 | ||
|   STRING szTempore,szStartFolder;
 | ||
|   BOOL bJunk;
 | ||
| 
 | ||
| begin
 | ||
|   if (!bInstallServer) then
 | ||
|     return;
 | ||
|   endif;
 | ||
|   RegDBSetDefaultRoot(HKEY_CURRENT_USER);
 | ||
| 
 | ||
|   if RegDBGetKeyValueEx("\\.Default\\Software\\Microsoft\\Windows\\CurrentVersion\\Explorer\\Shell Folders","Startup",lResult,szAutoRunFolder,nItems) < 0 then
 | ||
|     // Registry access failed (16 bit DLL?)
 | ||
|     szAutoRunFolder="";
 | ||
|     // try to determine the folder by names...
 | ||
|     listID = ListCreate(STRINGLIST);
 | ||
|     if (GetGroupNameList(listID)<0) then
 | ||
|         MessageBox("Impossibile leggere la lista delle cartelle dei programmi",SEVERE);
 | ||
|     endif;
 | ||
|     lResult=  ListGetFirstString(listID,szTempore);
 | ||
|     while (lResult != END_OF_LIST)
 | ||
|       lResult = ListGetNextString(listID,szTempore);
 | ||
|       if szTempore = "Esecuzione Automatica" then
 | ||
|         szAutoRunFolder=szTempore;
 | ||
|       endif;
 | ||
|       if szTempore = "Startup" then
 | ||
|         szAutoRunFolder=szTempore;
 | ||
|       endif;
 | ||
|     endwhile;
 | ||
| 
 | ||
|     if szAutoRunFolder="" then
 | ||
|       _Attenzione("Non riesco a determinare la cartella di Esecuzione Automatica di Windows");
 | ||
|       repeat 
 | ||
|         szStartFolder="";
 | ||
|         nDirection=SelectFolder("Cartella di Esecuzione Automatica",szAutoRunFolder,szAutoRunFolder);
 | ||
|         if nDirection = BACK then
 | ||
|           return;
 | ||
|         endif;
 | ||
|         if QueryProgGroup(szAutoRunFolder,szStartFolder,nItems) then
 | ||
|           _Attenzione("La cartella indicata non fa parte delle cartelle programmi di Windows");
 | ||
|           nDirection=BACK;
 | ||
|         endif;
 | ||
|       until nDirection=NEXT;
 | ||
|     endif;
 | ||
| 
 | ||
|   endif;
 | ||
|   return ;
 | ||
| end;
 | ||
| 
 | ||
| //________________________________________________________________________________________________________________________
 | ||
| //*** setta il nome del server di autorizzazioni
 | ||
| 
 | ||
| function _SelectDongleServerDestination(nDirection)
 | ||
| 
 | ||
|   NUMBER lResult;
 | ||
|   NUMBER listID;
 | ||
|   NUMBER nRetv;
 | ||
|   STRING szTempore[_MAX_LENGTH];
 | ||
|   BOOL bJunk;
 | ||
| begin
 | ||
|   if !bUseDongleServer then
 | ||
|     return;
 | ||
|   endif;
 | ||
|   if (nReinstall > 0 ) then
 | ||
| 	GetProfString(szCampoIni, "Server", "Dongle", szDongleServerName);
 | ||
|   endif;
 | ||
| 
 | ||
| // propone il nome dell'ultimo server di autorizzazioni (in caso si sia ritornati indietro nel corso
 | ||
| // dell'installazione
 | ||
|   szTempore = szDongleServerName;
 | ||
| // se l'installazione e' del tipo avanzata/installazione locale server e si vuole installare il server
 | ||
| // di autorizzazioni, propone di default localhost, in quanto il server autorizzazioni e' in locale
 | ||
|   if ((!bInstallNetWrkChk) && (nReinstall <= 0) ) then
 | ||
|     szTempore = "localhost";
 | ||
|   endif;
 | ||
| 
 | ||
|   SetDialogTitle(DLG_ASK_TEXT,"Server di autorizzazioni");
 | ||
|   nDirection = AskText("L'installazione attuale far<61> riferimento ad un server di autorizzazioni. Inserire il nome del computer (NON preceduto da '\\\\') su cui <20> stato installato il server delle chiavi di protezione.",szTempore,szDongleServerName);
 | ||
|   if nDirection=BACK then
 | ||
|     szDongleServerName=szTempore;
 | ||
|   endif;
 | ||
|   return ;
 | ||
| end;
 | ||
| 
 | ||
| 
 | ||
| 
 | ||
| //________________________________________________________________________________________________________________________
 | ||
| // *** Mostra le opzioni scelte per l'installazione
 | ||
| 
 | ||
| function _ConfirmInstallation(nDirection)
 | ||
| 
 | ||
|   STRING Msg,szInfo;
 | ||
|   NUMBER listInfo;
 | ||
| 
 | ||
| begin
 | ||
| 
 | ||
| //crea la lista delle informazioni
 | ||
|   listInfo = ListCreate(STRINGLIST);
 | ||
|   
 | ||
|   Msg = "Si e' scelto di installare ";
 | ||
|   if bInstallPrg then
 | ||
|     if bInstallDemo then
 | ||
|       Msg =Msg +"il programma in versione demo";
 | ||
|     else
 | ||
|       Msg =Msg +"il programma in versione commerciale";
 | ||
|     endif;
 | ||
|   else
 | ||
|     Msg =Msg +"l'area dati";
 | ||
|   endif;
 | ||
|   Msg = Msg + " con le opzioni seguenti. \nPremendo <Avanti> Setup procedera' con l'installazione del programma.";
 | ||
| 
 | ||
| 
 | ||
| // directory dei programmi (locale o di rete)
 | ||
|   if (bInstallNetWrkChk) then
 | ||
|     szInfo="Installazione di rete di riferimento:";
 | ||
|     ListAddString(listInfo, szInfo, AFTER);
 | ||
|     szInfo="    " + szAppRefPath;
 | ||
|     ListAddString(listInfo, szInfo, AFTER);
 | ||
|     szInfo="Direttorio dei programmi locali: ";
 | ||
|   else
 | ||
|     szInfo="Direttorio dei programmi: ";
 | ||
|   endif;
 | ||
| 
 | ||
|   ListAddString(listInfo, szInfo, AFTER);
 | ||
|   szInfo="    " + szAppPath;
 | ||
|   ListAddString(listInfo, szInfo, AFTER);
 | ||
| 
 | ||
| 
 | ||
| 
 | ||
| // directory dei dati (esistente o da creare)
 | ||
|   szInfo="Area dati ";
 | ||
|   if !bInstallData then
 | ||
|     szInfo=szInfo + "pre-esistente";
 | ||
|   else  
 | ||
|     if bInstallDemoData then
 | ||
|       szInfo=szInfo + "da installare (precaricata con archivi dimostrativi)";
 | ||
|     else
 | ||
|       szInfo=szInfo + "da installare";
 | ||
|     endif;
 | ||
|   endif;  
 | ||
|   szInfo=szInfo + " in: ";
 | ||
|   ListAddString(listInfo, szInfo, AFTER);
 | ||
|   szInfo="    " + szDataPath;
 | ||
|   ListAddString(listInfo, szInfo, AFTER);
 | ||
| 
 | ||
| 
 | ||
| // chiave di protezione (locale o con dongle server)
 | ||
| #ifndef __DEMO__
 | ||
|   szInfo="Controllo protezione: ";
 | ||
|   ListAddString(listInfo, szInfo, AFTER);
 | ||
|   if bUseDongleServer then
 | ||
|     szInfo="    attraverso il server '" + szDongleServerName +"'";
 | ||
|   else
 | ||
|     szInfo="    attraverso chiave locale";
 | ||
|   endif;
 | ||
|   ListAddString(listInfo, szInfo, AFTER);
 | ||
| #endif
 | ||
| 
 | ||
| 
 | ||
| // Mostra a video la lista 
 | ||
|   nDirection = SdShowInfoList( "Conferma installazione", Msg, listInfo );
 | ||
| 
 | ||
| end;
 | ||
| 
 | ||
| 
 | ||
| //________________________________________________________________________________________________________________________
 | ||
| // *** Installazione dell'area dati
 | ||
| 
 | ||
| function _InstallData(nDirection)
 | ||
| 
 | ||
|   BOOL bReenterPath, bConfirmdatapath;
 | ||
|   STRING  szTitle[_MAX_LENGTH];
 | ||
|   STRING  szPath[_MAX_LENGTH];
 | ||
|   STRING  szTemp[_MAX_LENGTH];
 | ||
|   NUMBER nTmp;
 | ||
| 
 | ||
| begin
 | ||
| 
 | ||
|   if (!bInstallData) then
 | ||
|     return;
 | ||
|   endif;
 | ||
|   nDirection=BACK;
 | ||
|   TARGETDIR = szDataPath; // i .z hanno gia' il sottodirettorio nel nome di file
 | ||
|   if ( CreateDir( TARGETDIR ) < 0 ) then
 | ||
|     _Attenzione( STR_DATA_DIR_NOTCREATED );
 | ||
|     return;
 | ||
|   endif;
 | ||
|   // ****************
 | ||
|   // copia dati comuni, std, 770 o demo?
 | ||
| 
 | ||
|     SetColor(STATUSBAR,BLUE);
 | ||
|     Enable(FEEDBACK_OPERATION);
 | ||
|     Enable(STATUS);
 | ||
|     // ******** installa dati DEMO ?
 | ||
|     if bInstallDemoData then
 | ||
|       szTitle = "Installazione dati dimostrativi su " + szDataPath;
 | ||
|       FileSetBeginDefine ( "DDEMO");
 | ||
|       if ( CompressGet(  "DATIDEMO.Z", "*.*", INCLUDE_SUBDIR ) < 0) then
 | ||
|         szText = STR_ERR_DECOMPRESS + " il modulo Dati dimostrativi.";
 | ||
|         _Attenzione( szText );
 | ||
|       endif;
 | ||
|       FileSetEndDefine ( "DDEMO");
 | ||
|       StatusUpdate(  ON, 100 );
 | ||
|       SetStatusWindow(  0, szTitle );
 | ||
|       _PerformSet ( "DDEMO");
 | ||
| 
 | ||
|     // ******** installa dati iniziali ditte
 | ||
|     elseif bInstallFirm then
 | ||
|       szTitle = "Installazione dati comuni e standard su " + szDataPath;
 | ||
|       FileSetBeginDefine ( "DATI");
 | ||
|       if ( CompressGet(  "DATISTD.Z", "*.*", INCLUDE_SUBDIR ) < 0) then
 | ||
|         szText = STR_ERR_DECOMPRESS + " il modulo Dati ditta.";
 | ||
|         _Attenzione( szText );
 | ||
|       endif;
 | ||
| 
 | ||
|       FileSetEndDefine ( "DATI");
 | ||
|       SetStatusWindow(  0, szTitle );
 | ||
|       StatusUpdate(  ON, 100 );
 | ||
|       _PerformSet ( "DATI");
 | ||
| 
 | ||
|     endif;
 | ||
| 
 | ||
| 
 | ||
|   Disable(STATUS);
 | ||
| 
 | ||
|   // ****************
 | ||
|   _CopiaADMININI( );
 | ||
|   _SetCampoIni();
 | ||
|   // ****************
 | ||
| 
 | ||
|   // marca l'installazione dati con il tipo giusto
 | ||
|   szPath=szDataPath ^ "\\CONFIG"; 
 | ||
|   szTemp=szPath ^ DATATYPE_FILE;
 | ||
|   if ( Is( FILE_EXISTS, szTemp ) ) then
 | ||
|       DeleteFile(szTemp);
 | ||
|   endif;
 | ||
|   OpenFileMode( FILE_MODE_APPEND );
 | ||
|   CreateFile( nTmp, szPath, DATATYPE_FILE);
 | ||
|   WriteLine(nTmp,szInstType);
 | ||
|   CloseFile( nTmp );
 | ||
|   nDirection=NEXT;
 | ||
| end;
 | ||
| 
 | ||
| //________________________________________________________________________________________________________________________
 | ||
| // *** Installa le dll, i programmi, aggiorna i registry ed i files di sistema; si sposta poi nella directory di 
 | ||
| // *** destinazione dell'installazione,copia l'install.ini
 | ||
| 
 | ||
| function _InstallInitialFiles(nRetv)
 | ||
| 
 | ||
|   BOOL bReenterPath, bConfirmdatapath;
 | ||
|   STRING sTmp[32],sPath[64];
 | ||
|   NUMBER direction;
 | ||
| 
 | ||
| begin
 | ||
| 
 | ||
|   if (bInstallPrg) then
 | ||
| 
 | ||
|     if (bInstallEnv || bInstallDemo) then
 | ||
|       _ForceAttrib4Dll( );
 | ||
|       // Effettua la vera e propria installazione di: dll,vxd,parte base necessaria installazione c++
 | ||
|       _DeleteFilesMinima( );
 | ||
|       _InstallFilesMinima( );
 | ||
|     
 | ||
|       Disable( FEEDBACK_FULL );
 | ||
|       Disable( STATUS );
 | ||
|       
 | ||
|       VarRestore( SRCTARGETDIR );	// Ripristina il valore di TARGETDIR
 | ||
| 
 | ||
|       _UpdateStartMenu( );			// aggiorna il menu di avvio di windows
 | ||
|   
 | ||
|       ChangeDirectory(szAppPath);
 | ||
|     
 | ||
|       _CopiaINSTALLINI( );
 | ||
|   
 | ||
|       _SetCampoIni();
 | ||
|     
 | ||
|       nRetv=NEXT;
 | ||
|     endif;
 | ||
| 
 | ||
|   endif;
 | ||
| end;
 | ||
| 
 | ||
| 
 | ||
| //________________________________________________________________________________________________________________________
 | ||
| // *** installa il collegamento al master server nel menu autostart di windows
 | ||
| 
 | ||
| function _InstallServerAutoStart(nDirection)
 | ||
| 
 | ||
|   STRING szTempore;
 | ||
| 
 | ||
| begin
 | ||
| 
 | ||
|   if ( ! bInstallServer ) then
 | ||
|     return;
 | ||
|   endif;
 | ||
| 
 | ||
| //server di controllo dei vari servers possibili
 | ||
|     szTempore = szAppPath ^ "\\servers\\lerch.exe";
 | ||
|     AddFolderIcon( szAutoRunFolder, "Lerch", szTempore, "", szTempore, 0, "", REPLACE );    
 | ||
| end;
 | ||
| 
 | ||
| //________________________________________________________________________________________________________________________
 | ||
| // *** memorizza e resetta un eventuale valore di server di chiavi
 | ||
| 
 | ||
| function _ResetDongleServer(szDongle)
 | ||
|   STRING szCampoIni;
 | ||
| begin
 | ||
|   if ((! bUseDongleServer ) || (bInstallServer)) then
 | ||
|     szCampoIni = szConfigPath ^ "campo.ini";
 | ||
|     if ( Is( FILE_EXISTS, szCampoIni ) ) then
 | ||
| 	  GetProfString(szCampoIni, "Server", "Dongle",szDongle );
 | ||
| 	  WriteProfString(szCampoIni, "Server", "Dongle", "");
 | ||
|     endif;
 | ||
|   endif;  
 | ||
| end;
 | ||
| 
 | ||
| //________________________________________________________________________________________________________________________
 | ||
| // *** ripristina un eventuale valore di server di chiavi
 | ||
| 
 | ||
| function _RestoreDongleServer(szDongle)
 | ||
|   STRING szCampoIni;
 | ||
| begin
 | ||
|   if ((! bUseDongleServer) || (bInstallServer)) then
 | ||
|     szCampoIni = szConfigPath ^ "CAMPO.INI";
 | ||
|     if ( Is( FILE_EXISTS, szCampoIni ) ) then
 | ||
| 	  WriteProfString(szCampoIni, "Server", "Dongle", szDongle);
 | ||
|     endif;
 | ||
|   endif;  
 | ||
| end;
 | ||
| 
 | ||
| 
 | ||
| 
 | ||
| 
 | ||
| 
 |