Commit 4d566bb72f239870e95fde861d123bcee85f3672
1 parent
ea871732
Exists in
master
Reuso de codigos da library generica, pequenas correcoes e faxina de codigo.
git-svn-id: http://svn.softwarepublico.gov.br/svn/cacic/cacic/trunk/agente-windows@774 fecfc0c7-e812-0410-ae72-849f08638ee7
Showing
23 changed files
with
272 additions
and
282 deletions
Show diff stats
cacic2.res
No preview for this file type
cacicservice/CACICsvc.res
No preview for this file type
cacicservice/CACICsvcMain.pas
| @@ -44,7 +44,7 @@ type | @@ -44,7 +44,7 @@ type | ||
| 44 | 44 | ||
| 45 | { Internal Start & Stop methods } | 45 | { Internal Start & Stop methods } |
| 46 | function GetValorChaveRegIni(p_Secao, p_Chave, p_File : String): String; | 46 | function GetValorChaveRegIni(p_Secao, p_Chave, p_File : String): String; |
| 47 | - procedure doSaveLog(Msg : String); | 47 | + procedure logDEBUG(Msg : String); |
| 48 | Procedure WMEndSession(var Msg : TWMEndSession) ; message WM_ENDSESSION; | 48 | Procedure WMEndSession(var Msg : TWMEndSession) ; message WM_ENDSESSION; |
| 49 | procedure ExecutaCACIC; | 49 | procedure ExecutaCACIC; |
| 50 | public | 50 | public |
| @@ -62,7 +62,7 @@ implementation | @@ -62,7 +62,7 @@ implementation | ||
| 62 | procedure TCACICservice.WMEndSession(var Msg : TWMEndSession) ; | 62 | procedure TCACICservice.WMEndSession(var Msg : TWMEndSession) ; |
| 63 | begin | 63 | begin |
| 64 | if Msg.EndSession = TRUE then | 64 | if Msg.EndSession = TRUE then |
| 65 | - doSaveLog('Windows finalizado em ' + FormatDateTime('c', Now)) ; | 65 | + logDEBUG('Windows finalizado em ' + FormatDateTime('c', Now)) ; |
| 66 | inherited; | 66 | inherited; |
| 67 | Application.Free; | 67 | Application.Free; |
| 68 | end; | 68 | end; |
| @@ -77,7 +77,7 @@ var | @@ -77,7 +77,7 @@ var | ||
| 77 | i, j, v_Size_Section, v_Size_Key : integer; | 77 | i, j, v_Size_Section, v_Size_Key : integer; |
| 78 | v_SectionName, v_KeyName : string; | 78 | v_SectionName, v_KeyName : string; |
| 79 | begin | 79 | begin |
| 80 | -//doSaveLog('GetVCRini: Secao: '+p_Secao+' Chave: '+p_Chave+' File: '+p_File); | 80 | + logDEBUG('GetVCRini: Secao: '+p_Secao+' Chave: '+p_Chave+' File: '+p_File); |
| 81 | Result := ''; | 81 | Result := ''; |
| 82 | v_SectionName := '[' + p_Secao + ']'; | 82 | v_SectionName := '[' + p_Secao + ']'; |
| 83 | v_Size_Section := strLen(PChar(v_SectionName)); | 83 | v_Size_Section := strLen(PChar(v_SectionName)); |
| @@ -106,32 +106,34 @@ var | @@ -106,32 +106,34 @@ var | ||
| 106 | end; | 106 | end; |
| 107 | end; | 107 | end; |
| 108 | 108 | ||
| 109 | -procedure TCACICservice.doSaveLog(Msg : String); | 109 | +procedure TCACICservice.logDEBUG(Msg : String); |
| 110 | var fLog: textfile; | 110 | var fLog: textfile; |
| 111 | begin | 111 | begin |
| 112 | - AssignFile(fLog, g_oCacic.Windows.getWinDir + 'CACICsvc.log'); | ||
| 113 | - if FileExists(g_oCacic.Windows.getWinDir + 'CACICsvc.log') then | ||
| 114 | - Append(fLog) | ||
| 115 | - else | ||
| 116 | - Rewrite(fLog); | ||
| 117 | - Writeln(fLog,FormatDateTime('dd/mm hh:nn:ss ', Now) + '[CACICsvc] : ' +msg); | ||
| 118 | - CloseFile(fLog); | 112 | + // Somente gravarei informações para debug se o arquivo "<HomeDrive>:\CACICsvc.log" existir |
| 113 | + if FileExists(g_oCacic.Windows.getHomeDrive + 'CACICsvc.log') then | ||
| 114 | + Begin | ||
| 115 | + AssignFile(fLog, g_oCacic.Windows.getHomeDrive + 'CACICsvc.log'); | ||
| 116 | + if FileExists(g_oCacic.Windows.getHomeDrive + 'CACICsvc.log') then | ||
| 117 | + Append(fLog) | ||
| 118 | + else | ||
| 119 | + Rewrite(fLog); | ||
| 120 | + Writeln(fLog,FormatDateTime('dd/mm hh:nn:ss ', Now) + '[CACICsvc][DEBUG] : ' +msg); | ||
| 121 | + CloseFile(fLog); | ||
| 122 | + End; | ||
| 119 | End; | 123 | End; |
| 120 | 124 | ||
| 121 | procedure ServiceController(CtrlCode: DWord); stdcall; | 125 | procedure ServiceController(CtrlCode: DWord); stdcall; |
| 122 | begin | 126 | begin |
| 123 | - CACICservice.Controller(CtrlCode); | 127 | + CACICservice.Controller(CtrlCode); |
| 124 | end; | 128 | end; |
| 125 | 129 | ||
| 126 | function TCACICservice.GetServiceController: TServiceController; | 130 | function TCACICservice.GetServiceController: TServiceController; |
| 127 | begin | 131 | begin |
| 128 | - Result := ServiceController; | 132 | + Result := ServiceController; |
| 129 | end; | 133 | end; |
| 130 | 134 | ||
| 131 | procedure TCACICservice.ServiceExecute(Sender: TService); | 135 | procedure TCACICservice.ServiceExecute(Sender: TService); |
| 132 | begin | 136 | begin |
| 133 | - doSaveLog('TCACICservice.ServiceExecute'); | ||
| 134 | - | ||
| 135 | { Loop while service is active in SCM } | 137 | { Loop while service is active in SCM } |
| 136 | While NOT Terminated do | 138 | While NOT Terminated do |
| 137 | Begin | 139 | Begin |
| @@ -144,8 +146,9 @@ end; | @@ -144,8 +146,9 @@ end; | ||
| 144 | 146 | ||
| 145 | procedure TCACICservice.ServiceStart(Sender: TService; var Started: Boolean); | 147 | procedure TCACICservice.ServiceStart(Sender: TService; var Started: Boolean); |
| 146 | begin | 148 | begin |
| 147 | - g_oCacic := TCACIC.Create; | ||
| 148 | 149 | ||
| 150 | + g_oCacic := TCACIC.Create; | ||
| 151 | + CACICservice.logDEBUG('TCACICservice.ServiceStart'); | ||
| 149 | Started := true; | 152 | Started := true; |
| 150 | 153 | ||
| 151 | ExecutaCACIC; | 154 | ExecutaCACIC; |
| @@ -159,8 +162,10 @@ end; | @@ -159,8 +162,10 @@ end; | ||
| 159 | 162 | ||
| 160 | procedure TCACICservice.ExecutaCACIC; | 163 | procedure TCACICservice.ExecutaCACIC; |
| 161 | Begin | 164 | Begin |
| 162 | - g_oCacic.setCacicPath(g_oCacic.getHomeDrive + GetValorChaveRegIni('Cacic2', 'cacic_dir', g_oCacic.getWinDir + 'chksis.ini') + '\'); | 165 | + CACICservice.logDEBUG('TCACICservice.ExecutaCACIC : setCacicPath => '+GetValorChaveRegIni('Cacic2', 'cacic_dir', g_oCacic.getWinDir + 'chksis.ini')); |
| 166 | + g_oCacic.setCacicPath(GetValorChaveRegIni('Cacic2', 'cacic_dir', g_oCacic.getWinDir + 'chksis.ini')); | ||
| 163 | 167 | ||
| 168 | + CACICservice.logDEBUG('TCACICservice.ExecutaCACIC : deleteFile => '+g_oCacic.getCacicPath + 'aguarde_CACIC.txt'); | ||
| 164 | DeleteFile(g_oCacic.getCacicPath + 'aguarde_CACIC.txt'); | 169 | DeleteFile(g_oCacic.getCacicPath + 'aguarde_CACIC.txt'); |
| 165 | Sleep(3000); | 170 | Sleep(3000); |
| 166 | 171 | ||
| @@ -169,7 +174,8 @@ Begin | @@ -169,7 +174,8 @@ Begin | ||
| 169 | Begin | 174 | Begin |
| 170 | // Executo o CHKsis, verificando a estrutura do sistema | 175 | // Executo o CHKsis, verificando a estrutura do sistema |
| 171 | Try | 176 | Try |
| 172 | - WinEXEC(PChar(g_oCacic.getWinDir + 'chksis.exe'),sw_HIDE); | 177 | + CACICservice.logDEBUG('TCACICservice.ExecutaCACIC : winExec => '+g_oCacic.getWinDir + 'chksis.exe'); |
| 178 | + g_oCacic.createSampleProcess(g_oCacic.getWinDir + 'chksis.exe',false); | ||
| 173 | Except | 179 | Except |
| 174 | End; | 180 | End; |
| 175 | 181 | ||
| @@ -180,19 +186,21 @@ Begin | @@ -180,19 +186,21 @@ Begin | ||
| 180 | 186 | ||
| 181 | // Executo o Agente Principal do CACIC | 187 | // Executo o Agente Principal do CACIC |
| 182 | Try | 188 | Try |
| 183 | - WinEXEC(PChar(g_oCacic.getCacicPath + 'cacic2.exe'),sw_hide); | 189 | + CACICservice.logDEBUG('TCACICservice.ExecutaCACIC : winExec => '+g_oCacic.getCacicPath + 'cacic2.exe'); |
| 190 | + g_oCacic.createSampleProcess(g_oCacic.getCacicPath + 'cacic2.exe',false); | ||
| 184 | Except | 191 | Except |
| 185 | End; | 192 | End; |
| 186 | End; | 193 | End; |
| 187 | 194 | ||
| 188 | procedure TCACICservice.ServiceAfterInstall(Sender: TService); | 195 | procedure TCACICservice.ServiceAfterInstall(Sender: TService); |
| 189 | - | ||
| 190 | begin | 196 | begin |
| 191 | ServiceStart(nil,boolStarted); | 197 | ServiceStart(nil,boolStarted); |
| 198 | + CACICservice.logDEBUG('TCACICservice.ServiceAfterInstall'); | ||
| 192 | end; | 199 | end; |
| 193 | 200 | ||
| 194 | procedure TCACICservice.Timer_CHKsisTimer(Sender: TObject); | 201 | procedure TCACICservice.Timer_CHKsisTimer(Sender: TObject); |
| 195 | begin | 202 | begin |
| 203 | + CACICservice.logDEBUG('TCACICservice.Timer_CHKsisTimer'); | ||
| 196 | ExecutaCACIC; | 204 | ExecutaCACIC; |
| 197 | 205 | ||
| 198 | // Verificações diversas | 206 | // Verificações diversas |
| @@ -202,6 +210,7 @@ end; | @@ -202,6 +210,7 @@ end; | ||
| 202 | procedure TCACICservice.ServiceStop(Sender: TService; | 210 | procedure TCACICservice.ServiceStop(Sender: TService; |
| 203 | var Stopped: Boolean); | 211 | var Stopped: Boolean); |
| 204 | begin | 212 | begin |
| 213 | + CACICservice.logDEBUG('TCACICservice.ServiceStop'); | ||
| 205 | Stopped := true; | 214 | Stopped := true; |
| 206 | end; | 215 | end; |
| 207 | 216 |
chkcacic/FormConfig.dfm
| @@ -154,11 +154,11 @@ object Configs: TConfigs | @@ -154,11 +154,11 @@ object Configs: TConfigs | ||
| 154 | Text = 'Cacic' | 154 | Text = 'Cacic' |
| 155 | end | 155 | end |
| 156 | object Button_Gravar: TButton | 156 | object Button_Gravar: TButton |
| 157 | - Left = 74 | 157 | + Left = 48 |
| 158 | Top = 325 | 158 | Top = 325 |
| 159 | - Width = 150 | 159 | + Width = 214 |
| 160 | Height = 35 | 160 | Height = 35 |
| 161 | - Caption = 'Gravar Configura'#231#245'es' | 161 | + Caption = 'Concluir Instala'#231#227'o/Atualiza'#231#227'o' |
| 162 | Font.Charset = DEFAULT_CHARSET | 162 | Font.Charset = DEFAULT_CHARSET |
| 163 | Font.Color = clWindowText | 163 | Font.Color = clWindowText |
| 164 | Font.Height = -13 | 164 | Font.Height = -13 |
| @@ -169,7 +169,7 @@ object Configs: TConfigs | @@ -169,7 +169,7 @@ object Configs: TConfigs | ||
| 169 | OnClick = Button_GravarClick | 169 | OnClick = Button_GravarClick |
| 170 | end | 170 | end |
| 171 | object btSair: TButton | 171 | object btSair: TButton |
| 172 | - Left = 265 | 172 | + Left = 291 |
| 173 | Top = 325 | 173 | Top = 325 |
| 174 | Width = 150 | 174 | Width = 150 |
| 175 | Height = 35 | 175 | Height = 35 |
chkcacic/FormConfig.pas
| @@ -20,8 +20,21 @@ unit FormConfig; | @@ -20,8 +20,21 @@ unit FormConfig; | ||
| 20 | interface | 20 | interface |
| 21 | 21 | ||
| 22 | uses | 22 | uses |
| 23 | - Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, | ||
| 24 | - Dialogs, StdCtrls,main, PJVersionInfo, NTFileSecurity, Buttons, ExtCtrls; | 23 | + Windows, |
| 24 | + Messages, | ||
| 25 | + SysUtils, | ||
| 26 | + Variants, | ||
| 27 | + Classes, | ||
| 28 | + Graphics, | ||
| 29 | + Controls, | ||
| 30 | + Forms, | ||
| 31 | + Dialogs, | ||
| 32 | + StdCtrls, | ||
| 33 | + main, | ||
| 34 | + PJVersionInfo, | ||
| 35 | + NTFileSecurity, | ||
| 36 | + Buttons, | ||
| 37 | + ExtCtrls; | ||
| 25 | 38 | ||
| 26 | type | 39 | type |
| 27 | TConfigs = class(TForm) | 40 | TConfigs = class(TForm) |
chkcacic/chkcacic.dpr
| @@ -27,18 +27,18 @@ const | @@ -27,18 +27,18 @@ const | ||
| 27 | CACIC_APP_NAME = 'chkcacic'; | 27 | CACIC_APP_NAME = 'chkcacic'; |
| 28 | 28 | ||
| 29 | var | 29 | var |
| 30 | - g_oCacic : TCACIC; | 30 | + oCacic : TCACIC; |
| 31 | 31 | ||
| 32 | begin | 32 | begin |
| 33 | - g_oCacic := TCACIC.Create(); | 33 | + oCacic := TCACIC.Create(); |
| 34 | 34 | ||
| 35 | - if( not g_oCacic.isAppRunning( CACIC_APP_NAME ) ) | 35 | + if( not oCacic.isAppRunning( CACIC_APP_NAME ) ) |
| 36 | then begin | 36 | then begin |
| 37 | Application.Initialize; | 37 | Application.Initialize; |
| 38 | Application.CreateForm(TForm1, Form1); | 38 | Application.CreateForm(TForm1, Form1); |
| 39 | Application.Run; | 39 | Application.Run; |
| 40 | end; | 40 | end; |
| 41 | 41 | ||
| 42 | - g_oCacic.Free(); | 42 | + oCacic.Free(); |
| 43 | 43 | ||
| 44 | end. | 44 | end. |
chkcacic/chkcacic.res
No preview for this file type
chkcacic/main.pas
| @@ -80,9 +80,9 @@ uses | @@ -80,9 +80,9 @@ uses | ||
| 80 | IdFTP, | 80 | IdFTP, |
| 81 | Tlhelp32, | 81 | Tlhelp32, |
| 82 | ExtCtrls, | 82 | ExtCtrls, |
| 83 | + Dialogs, | ||
| 83 | CACIC_Library, | 84 | CACIC_Library, |
| 84 | - WinSvc, | ||
| 85 | - dialogs; | 85 | + WinSvc; |
| 86 | 86 | ||
| 87 | var | 87 | var |
| 88 | v_ip_serv_cacic, | 88 | v_ip_serv_cacic, |
| @@ -94,9 +94,9 @@ var | @@ -94,9 +94,9 @@ var | ||
| 94 | v_versao_remota, | 94 | v_versao_remota, |
| 95 | v_strCipherClosed, | 95 | v_strCipherClosed, |
| 96 | v_strCipherOpened, | 96 | v_strCipherOpened, |
| 97 | - v_retorno, | ||
| 98 | v_versao_REM, | 97 | v_versao_REM, |
| 99 | - v_versao_LOC : String; | 98 | + v_versao_LOC, |
| 99 | + v_retorno : String; | ||
| 100 | 100 | ||
| 101 | var | 101 | var |
| 102 | v_Debugs : boolean; | 102 | v_Debugs : boolean; |
| @@ -392,6 +392,7 @@ var v_DatFile : TextFile; | @@ -392,6 +392,7 @@ var v_DatFile : TextFile; | ||
| 392 | v_strCipherOpened, | 392 | v_strCipherOpened, |
| 393 | v_strCipherClosed : string; | 393 | v_strCipherClosed : string; |
| 394 | begin | 394 | begin |
| 395 | + LogDebug('Tentando acessar configurações em '+g_oCacic.getCacicPath + g_oCacic.getDatFileName); | ||
| 395 | v_strCipherOpened := ''; | 396 | v_strCipherOpened := ''; |
| 396 | if FileExists(p_DatFileName) then | 397 | if FileExists(p_DatFileName) then |
| 397 | begin | 398 | begin |
| @@ -415,10 +416,8 @@ begin | @@ -415,10 +416,8 @@ begin | ||
| 415 | else | 416 | else |
| 416 | Result := g_oCacic.explode('Configs.ID_SO'+g_oCacic.getSeparatorKey+ g_oCacic.getWindowsStrId() +g_oCacic.getSeparatorKey+'Configs.Endereco_WS'+g_oCacic.getSeparatorKey+'/cacic2/ws/',g_oCacic.getSeparatorKey); | 417 | Result := g_oCacic.explode('Configs.ID_SO'+g_oCacic.getSeparatorKey+ g_oCacic.getWindowsStrId() +g_oCacic.getSeparatorKey+'Configs.Endereco_WS'+g_oCacic.getSeparatorKey+'/cacic2/ws/',g_oCacic.getSeparatorKey); |
| 417 | 418 | ||
| 418 | - | ||
| 419 | if Result.Count mod 2 <> 0 then | 419 | if Result.Count mod 2 <> 0 then |
| 420 | Result.Add(''); | 420 | Result.Add(''); |
| 421 | - | ||
| 422 | end; | 421 | end; |
| 423 | 422 | ||
| 424 | Procedure SetValorDatMemoria(p_Chave : string; p_Valor : String); | 423 | Procedure SetValorDatMemoria(p_Chave : string; p_Valor : String); |
| @@ -573,11 +572,6 @@ end; | @@ -573,11 +572,6 @@ end; | ||
| 573 | function SetValorChaveRegIni(p_Secao, p_Chave, p_Valor, p_File : String): String; | 572 | function SetValorChaveRegIni(p_Secao, p_Chave, p_Valor, p_File : String): String; |
| 574 | var Reg_Ini : TIniFile; | 573 | var Reg_Ini : TIniFile; |
| 575 | begin | 574 | begin |
| 576 | -// FileSetAttr (p_File,0); | ||
| 577 | - { | ||
| 578 | - To remove write protection on a file: | ||
| 579 | - Den Schreibschutz einer Datei aufheben: | ||
| 580 | - } | ||
| 581 | if (FileGetAttr(p_File) and faReadOnly) > 0 then | 575 | if (FileGetAttr(p_File) and faReadOnly) > 0 then |
| 582 | FileSetAttr(p_File, FileGetAttr(p_File) xor faReadOnly); | 576 | FileSetAttr(p_File, FileGetAttr(p_File) xor faReadOnly); |
| 583 | 577 | ||
| @@ -650,12 +644,14 @@ end; | @@ -650,12 +644,14 @@ end; | ||
| 650 | 644 | ||
| 651 | Procedure CriaFormConfigura; | 645 | Procedure CriaFormConfigura; |
| 652 | begin | 646 | begin |
| 647 | + LogDebug('Chamando Criação do Formulário de Configurações - 1'); | ||
| 653 | Application.CreateForm(TConfigs, FormConfig.Configs); | 648 | Application.CreateForm(TConfigs, FormConfig.Configs); |
| 654 | FormConfig.Configs.lbVersao.Caption := 'v: ' + getVersionInfo(ParamStr(0)); | 649 | FormConfig.Configs.lbVersao.Caption := 'v: ' + getVersionInfo(ParamStr(0)); |
| 655 | end; | 650 | end; |
| 656 | 651 | ||
| 657 | Procedure MostraFormConfigura; | 652 | Procedure MostraFormConfigura; |
| 658 | begin | 653 | begin |
| 654 | + LogDebug('Exibindo formulário de configurações'); | ||
| 659 | FormConfig.Configs.ShowModal; | 655 | FormConfig.Configs.ShowModal; |
| 660 | end; | 656 | end; |
| 661 | 657 | ||
| @@ -726,12 +722,12 @@ begin | @@ -726,12 +722,12 @@ begin | ||
| 726 | LogDebug('FTP: Change to "'+p_PathServer+'"'); | 722 | LogDebug('FTP: Change to "'+p_PathServer+'"'); |
| 727 | IdFTP.ChangeDir(p_PathServer); | 723 | IdFTP.ChangeDir(p_PathServer); |
| 728 | Try | 724 | Try |
| 729 | - LogDebug('Iniciando FTP de "'+p_Dest + '\' + p_File+'"'); | ||
| 730 | - LogDebug('HashCode de "'+p_File+'" Antes do FTP => '+g_oCacic.GetFileHash(p_File)); | ||
| 731 | - IdFTP.Get(p_File, p_Dest + '\' + p_File, True, True); | ||
| 732 | - LogDebug('HashCode de "'+p_Dest + '\' + p_File +'" Após o FTP => '+g_oCacic.GetFileHash(p_Dest + '\' + p_File)); | 725 | + LogDebug('Iniciando FTP de "'+p_Dest + p_File+'"'); |
| 726 | + LogDebug('HashCode de "'+p_File+'" Antes do FTP => '+g_oCacic.GetFileHash(p_Dest + p_File)); | ||
| 727 | + IdFTP.Get(p_File, p_Dest + p_File, True, True); | ||
| 728 | + LogDebug('HashCode de "'+p_Dest + p_File +'" Após o FTP => '+g_oCacic.GetFileHash(p_Dest + p_File)); | ||
| 733 | Finally | 729 | Finally |
| 734 | - LogDebug('HashCode de "'+p_Dest + '\' + p_File +'" Após o FTP em Finally => '+g_oCacic.GetFileHash(p_Dest + '\' + p_File)); | 730 | + LogDebug('HashCode de "'+p_Dest + p_File +'" Após o FTP em Finally => '+g_oCacic.GetFileHash(p_Dest + p_File)); |
| 735 | IdFTP.Disconnect; | 731 | IdFTP.Disconnect; |
| 736 | IdFTP.Free; | 732 | IdFTP.Free; |
| 737 | result := true; | 733 | result := true; |
| @@ -751,7 +747,7 @@ procedure GravaConfiguracoes; | @@ -751,7 +747,7 @@ procedure GravaConfiguracoes; | ||
| 751 | var chkcacic_ini : TextFile; | 747 | var chkcacic_ini : TextFile; |
| 752 | begin | 748 | begin |
| 753 | try | 749 | try |
| 754 | - g_oCacic.setCacicPath(Configs.Edit_cacic_dir.text+'); | 750 | + LogDebug('g_ocacic => setCacicpath => '+Configs.Edit_cacic_dir.text+'); |
| 755 | 751 | ||
| 756 | FileSetAttr (ExtractFilePath(Application.Exename) + '\chkcacic.ini',0); // Retira os atributos do arquivo para evitar o erro FILE ACCESS DENIED em máquinas 2000 | 752 | FileSetAttr (ExtractFilePath(Application.Exename) + '\chkcacic.ini',0); // Retira os atributos do arquivo para evitar o erro FILE ACCESS DENIED em máquinas 2000 |
| 757 | AssignFile(chkcacic_ini,ExtractFilePath(Application.Exename) + '\chkcacic.ini'); {Associa o arquivo a uma variável do tipo TextFile} | 753 | AssignFile(chkcacic_ini,ExtractFilePath(Application.Exename) + '\chkcacic.ini'); {Associa o arquivo a uma variável do tipo TextFile} |
| @@ -845,13 +841,15 @@ begin | @@ -845,13 +841,15 @@ begin | ||
| 845 | 841 | ||
| 846 | // Escrita dos parâmetros obrigatórios | 842 | // Escrita dos parâmetros obrigatórios |
| 847 | Writeln(chkcacic_ini,'ip_serv_cacic='+v_ip_serv_cacic); | 843 | Writeln(chkcacic_ini,'ip_serv_cacic='+v_ip_serv_cacic); |
| 848 | - Writeln(chkcacic_ini,'cacic_dir='+Configs.Edit_cacic_dir.text); | 844 | + Writeln(chkcacic_ini,'cacic_dir='+g_oCacic.getHomeDrive + Configs.Edit_cacic_dir.text+'\'); |
| 849 | Writeln(chkcacic_ini,'exibe_informacoes='+v_exibe_informacoes); | 845 | Writeln(chkcacic_ini,'exibe_informacoes='+v_exibe_informacoes); |
| 850 | 846 | ||
| 851 | // Escrita dos valores opcionais quando existirem | 847 | // Escrita dos valores opcionais quando existirem |
| 852 | if (v_te_instala_informacoes_extras <>'') then | 848 | if (v_te_instala_informacoes_extras <>'') then |
| 853 | Writeln(chkcacic_ini,'te_instala_informacoes_extras='+ StringReplace(v_te_instala_informacoes_extras,#13#10,'*13*10',[rfReplaceAll])); | 849 | Writeln(chkcacic_ini,'te_instala_informacoes_extras='+ StringReplace(v_te_instala_informacoes_extras,#13#10,'*13*10',[rfReplaceAll])); |
| 854 | CloseFile(chkcacic_ini); {Fecha o arquivo texto} | 850 | CloseFile(chkcacic_ini); {Fecha o arquivo texto} |
| 851 | + | ||
| 852 | + g_oCacic.setCacicPath(g_oCacic.getHomeDrive + Configs.Edit_cacic_dir.text+'\'); | ||
| 855 | except | 853 | except |
| 856 | end; | 854 | end; |
| 857 | end; | 855 | end; |
| @@ -962,7 +960,9 @@ var SearchRec: TSearchRec; | @@ -962,7 +960,9 @@ var SearchRec: TSearchRec; | ||
| 962 | Result: Integer; | 960 | Result: Integer; |
| 963 | strFileName : String; | 961 | strFileName : String; |
| 964 | begin | 962 | begin |
| 963 | + | ||
| 965 | strFileName := StringReplace(v_dir + '\' + v_files,'\\','\',[rfReplaceAll]); | 964 | strFileName := StringReplace(v_dir + '\' + v_files,'\\','\',[rfReplaceAll]); |
| 965 | + LogDebug('Matando: '+strFileName); | ||
| 966 | Result:=FindFirst(strFileName, faAnyFile, SearchRec); | 966 | Result:=FindFirst(strFileName, faAnyFile, SearchRec); |
| 967 | 967 | ||
| 968 | while result=0 do | 968 | while result=0 do |
| @@ -1022,52 +1022,56 @@ end; | @@ -1022,52 +1022,56 @@ end; | ||
| 1022 | 1022 | ||
| 1023 | procedure verifyAndGet(p_strModuleName, | 1023 | procedure verifyAndGet(p_strModuleName, |
| 1024 | p_strFileHash, | 1024 | p_strFileHash, |
| 1025 | - p_strDestinationFolderName, | ||
| 1026 | - p_strServUpdates, | ||
| 1027 | - p_strPortaServUpdates, | ||
| 1028 | - p_strNomeUsuarioLoginServUpdates, | ||
| 1029 | - p_strSenhaLoginServUpdates, | ||
| 1030 | - p_strPathServUpdates, | ||
| 1031 | - p_strExibeInformacoes : String); | ||
| 1032 | - var v_strFileHash : String; | ||
| 1033 | - Begin | 1025 | + p_strDestinationFolderName : String); |
| 1026 | +var v_strFileHash, | ||
| 1027 | + v_strDestinationFolderName : String; | ||
| 1028 | +Begin | ||
| 1029 | + v_strDestinationFolderName := p_strDestinationFolderName + '\'; | ||
| 1030 | + v_strDestinationFolderName := StringReplace(v_strDestinationFolderName,'\\','\',[rfReplaceAll]); | ||
| 1034 | 1031 | ||
| 1032 | + LogDebug('Verificando módulo: '+v_strDestinationFolderName +p_strModuleName); | ||
| 1035 | // Verifico validade do Módulo e mato-o em caso negativo. | 1033 | // Verifico validade do Módulo e mato-o em caso negativo. |
| 1036 | - v_strFileHash := g_oCacic.GetFileHash(p_strDestinationFolderName + '\'+p_strModuleName); | 1034 | + v_strFileHash := g_oCacic.GetFileHash(v_strDestinationFolderName + p_strModuleName); |
| 1037 | 1035 | ||
| 1038 | - LogDebug('verifyAndGet - strFileHash de "'+p_strDestinationFolderName + '\'+p_strModuleName+'": ' + v_strFileHash); | 1036 | + LogDebug('verifyAndGet - HashCode Remot: "'+p_strFileHash+'"'); |
| 1037 | + LogDebug('verifyAndGet - HashCode Local: "'+v_strFileHash+'"'); | ||
| 1039 | 1038 | ||
| 1040 | If (v_strFileHash <> p_strFileHash) then | 1039 | If (v_strFileHash <> p_strFileHash) then |
| 1041 | - Matar(p_strDestinationFolderName, p_strModuleName); | 1040 | + Matar(v_strDestinationFolderName, p_strModuleName); |
| 1042 | 1041 | ||
| 1043 | - If not FileExists(p_strDestinationFolderName + '\'+p_strModuleName) Then | 1042 | + If not FileExists(v_strDestinationFolderName + p_strModuleName) Then |
| 1044 | Begin | 1043 | Begin |
| 1045 | if (FileExists(ExtractFilePath(Application.Exename) + '\modulos\'+p_strModuleName)) then | 1044 | if (FileExists(ExtractFilePath(Application.Exename) + '\modulos\'+p_strModuleName)) then |
| 1046 | Begin | 1045 | Begin |
| 1047 | - LogDiario('Copiando '+p_strModuleName+' de '+ExtractFilePath(Application.Exename)+'modulos\'); | ||
| 1048 | - CopyFile(PChar(ExtractFilePath(Application.Exename) + 'modulos\'+p_strModuleName), PChar(p_strDestinationFolderName + '\'+p_strModuleName),false); | ||
| 1049 | - FileSetAttr (PChar(p_strDestinationFolderName + '\' + p_strModuleName),0); // Retira os atributos do arquivo para evitar o erro FILE ACCESS DENIED | 1046 | + LogDebug('Copiando '+p_strModuleName+' de '+ExtractFilePath(Application.Exename)+'modulos\'); |
| 1047 | + CopyFile(PChar(ExtractFilePath(Application.Exename) + 'modulos\'+p_strModuleName), PChar(v_strDestinationFolderName + p_strModuleName),false); | ||
| 1048 | + FileSetAttr (PChar(v_strDestinationFolderName + p_strModuleName),0); // Retira os atributos do arquivo para evitar o erro FILE ACCESS DENIED | ||
| 1050 | End | 1049 | End |
| 1051 | else | 1050 | else |
| 1052 | begin | 1051 | begin |
| 1052 | + | ||
| 1053 | Try | 1053 | Try |
| 1054 | - if not FTP(p_strServUpdates, | ||
| 1055 | - p_strPortaServUpdates, | ||
| 1056 | - p_strNomeUsuarioLoginServUpdates, | ||
| 1057 | - p_strSenhaLoginServUpdates, | ||
| 1058 | - p_strPathServUpdates, | 1054 | + if not FTP(XML_RetornaValor('te_serv_updates' , v_retorno), |
| 1055 | + XML_RetornaValor('nu_porta_serv_updates' , v_retorno), | ||
| 1056 | + XML_RetornaValor('nm_usuario_login_serv_updates', v_retorno), | ||
| 1057 | + XML_RetornaValor('te_senha_login_serv_updates' , v_retorno), | ||
| 1058 | + XML_RetornaValor('te_path_serv_updates' , v_retorno), | ||
| 1059 | p_strModuleName, | 1059 | p_strModuleName, |
| 1060 | - p_strDestinationFolderName) then | ||
| 1061 | - Configs.Memo_te_instala_informacoes_extras.Lines.add(#13#10+'ATENÇÃO! Não foi possível efetuar FTP para "'+p_strDestinationFolderName + '\'+p_strModuleName+'".'+#13#10+'Verifique o Servidor de Updates.'); | 1060 | + v_strDestinationFolderName) then |
| 1061 | + Configs.Memo_te_instala_informacoes_extras.Lines.add(#13#10+'ATENÇÃO! Não foi possível efetuar FTP para "'+v_strDestinationFolderName + p_strModuleName+'".'+#13#10+'Verifique o Servidor de Updates.'); | ||
| 1062 | Except | 1062 | Except |
| 1063 | - LogDebug('FTP de "'+ p_strDestinationFolderName + '\' + p_strModuleName+'" Interrompido.'); | 1063 | + LogDebug('FTP de "'+ v_strDestinationFolderName + p_strModuleName+'" Interrompido.'); |
| 1064 | End; | 1064 | End; |
| 1065 | 1065 | ||
| 1066 | - if not FileExists(p_strDestinationFolderName + '\' + p_strModuleName) Then | 1066 | + if not FileExists(v_strDestinationFolderName + p_strModuleName) Then |
| 1067 | Begin | 1067 | Begin |
| 1068 | - LogDebug('Problemas Efetuando Download de '+ p_strDestinationFolderName + '\' + p_strModuleName+' (FTP)'); | 1068 | + LogDebug('Problemas Efetuando Download de '+ v_strDestinationFolderName + p_strModuleName+' (FTP)'); |
| 1069 | LogDebug('Conexão:'); | 1069 | LogDebug('Conexão:'); |
| 1070 | - LogDebug(p_strServUpdates+', '+p_strPortaServUpdates+', '+p_strNomeUsuarioLoginServUpdates+', '+p_strSenhaLoginServUpdates+', '+p_strPathServUpdates); | 1070 | + LogDebug(XML_RetornaValor('te_serv_updates',v_retorno) +', '+ |
| 1071 | + XML_RetornaValor('nu_porta_serv_updates' , v_retorno)+', '+ | ||
| 1072 | + XML_RetornaValor('nm_usuario_login_serv_updates', v_retorno)+', '+ | ||
| 1073 | + XML_RetornaValor('te_senha_login_serv_updates' , v_retorno)+', '+ | ||
| 1074 | + XML_RetornaValor('te_path_serv_updates' , v_retorno)); | ||
| 1071 | End | 1075 | End |
| 1072 | else | 1076 | else |
| 1073 | LogDiario('Download Concluído de "'+p_strModuleName+'" (FTP)'); | 1077 | LogDiario('Download Concluído de "'+p_strModuleName+'" (FTP)'); |
| @@ -1114,6 +1118,8 @@ begin | @@ -1114,6 +1118,8 @@ begin | ||
| 1114 | bool_CommandLine := false; | 1118 | bool_CommandLine := false; |
| 1115 | bool_ArquivoINI := FileExists(ExtractFilePath(Application.Exename) + '\chkcacic.ini'); | 1119 | bool_ArquivoINI := FileExists(ExtractFilePath(Application.Exename) + '\chkcacic.ini'); |
| 1116 | 1120 | ||
| 1121 | + g_oCacic := TCACIC.Create(); | ||
| 1122 | + g_oCacic.setBoolCipher(true); | ||
| 1117 | Try | 1123 | Try |
| 1118 | 1124 | ||
| 1119 | // 2.2.0.17 - Tratamento de opções passadas em linha de comando | 1125 | // 2.2.0.17 - Tratamento de opções passadas em linha de comando |
| @@ -1155,7 +1161,6 @@ begin | @@ -1155,7 +1161,6 @@ begin | ||
| 1155 | Begin | 1161 | Begin |
| 1156 | If not bool_ArquivoINI then | 1162 | If not bool_ArquivoINI then |
| 1157 | Begin | 1163 | Begin |
| 1158 | - LogDiario('Abrindo formulário de configurações'); | ||
| 1159 | CriaFormConfigura; | 1164 | CriaFormConfigura; |
| 1160 | MostraFormConfigura; | 1165 | MostraFormConfigura; |
| 1161 | End; | 1166 | End; |
| @@ -1165,8 +1170,7 @@ begin | @@ -1165,8 +1170,7 @@ begin | ||
| 1165 | v_te_instala_informacoes_extras := StringReplace(GetValorChaveRegIni('Cacic2', 'te_instala_informacoes_extras', ExtractFilePath(Application.Exename) + '\chkcacic.ini'),'*13*10',#13#10,[rfReplaceAll]); | 1170 | v_te_instala_informacoes_extras := StringReplace(GetValorChaveRegIni('Cacic2', 'te_instala_informacoes_extras', ExtractFilePath(Application.Exename) + '\chkcacic.ini'),'*13*10',#13#10,[rfReplaceAll]); |
| 1166 | End; | 1171 | End; |
| 1167 | 1172 | ||
| 1168 | - g_oCacic := TCACIC.Create(); | ||
| 1169 | - g_oCacic.setCacicPath(g_oCacic.getHomeDrive + v_cacic_dir + '\'); | 1173 | + g_oCacic.setCacicPath(v_cacic_dir); |
| 1170 | 1174 | ||
| 1171 | if DirectoryExists(g_oCacic.getCacicPath + 'Temp\Debugs') then | 1175 | if DirectoryExists(g_oCacic.getCacicPath + 'Temp\Debugs') then |
| 1172 | Begin | 1176 | Begin |
| @@ -1202,7 +1206,7 @@ begin | @@ -1202,7 +1206,7 @@ begin | ||
| 1202 | Configs.ckboxExibeInformacoes.Checked := true; | 1206 | Configs.ckboxExibeInformacoes.Checked := true; |
| 1203 | Configs.ckboxExibeInformacoes.Visible := false; | 1207 | Configs.ckboxExibeInformacoes.Visible := false; |
| 1204 | 1208 | ||
| 1205 | - Configs.Height := 357; | 1209 | + Configs.Height := 350; |
| 1206 | Configs.lbMensagemNaoAplicavel.Visible := false; | 1210 | Configs.lbMensagemNaoAplicavel.Visible := false; |
| 1207 | 1211 | ||
| 1208 | Configs.Memo_te_instala_informacoes_extras.Clear; | 1212 | Configs.Memo_te_instala_informacoes_extras.Clear; |
| @@ -1232,7 +1236,7 @@ begin | @@ -1232,7 +1236,7 @@ begin | ||
| 1232 | bool_configura := false; | 1236 | bool_configura := false; |
| 1233 | 1237 | ||
| 1234 | //chave AES. Recomenda-se que cada empresa/órgão altere a sua chave. | 1238 | //chave AES. Recomenda-se que cada empresa/órgão altere a sua chave. |
| 1235 | - v_tstrCipherOpened := CipherOpen(g_oCacic.getCacicPath + '\' + g_oCacic.getDatFileName); | 1239 | + v_tstrCipherOpened := CipherOpen(g_oCacic.getCacicPath + g_oCacic.getDatFileName); |
| 1236 | 1240 | ||
| 1237 | if (g_oCacic.isWindowsGEXP()) then // Se >= Maior ou Igual ao WinXP... | 1241 | if (g_oCacic.isWindowsGEXP()) then // Se >= Maior ou Igual ao WinXP... |
| 1238 | Begin | 1242 | Begin |
| @@ -1282,7 +1286,6 @@ begin | @@ -1282,7 +1286,6 @@ begin | ||
| 1282 | 1286 | ||
| 1283 | while (v_ip_serv_cacic = '') or (v_cacic_dir = '') or bool_configura do | 1287 | while (v_ip_serv_cacic = '') or (v_cacic_dir = '') or bool_configura do |
| 1284 | Begin | 1288 | Begin |
| 1285 | - LogDiario('Abrindo formulário de configurações'); | ||
| 1286 | bool_configura := false; | 1289 | bool_configura := false; |
| 1287 | CriaFormConfigura; | 1290 | CriaFormConfigura; |
| 1288 | 1291 | ||
| @@ -1304,6 +1307,7 @@ begin | @@ -1304,6 +1307,7 @@ begin | ||
| 1304 | Application.Terminate; | 1307 | Application.Terminate; |
| 1305 | end; | 1308 | end; |
| 1306 | 1309 | ||
| 1310 | + LogDebug('Verificando pasta "'+g_oCacic.getCacicPath+'"'); | ||
| 1307 | // Verifico a existência do diretório configurado para o Cacic, normalmente CACIC | 1311 | // Verifico a existência do diretório configurado para o Cacic, normalmente CACIC |
| 1308 | if not DirectoryExists(g_oCacic.getCacicPath) then | 1312 | if not DirectoryExists(g_oCacic.getCacicPath) then |
| 1309 | begin | 1313 | begin |
| @@ -1311,6 +1315,7 @@ begin | @@ -1311,6 +1315,7 @@ begin | ||
| 1311 | ForceDirectories(g_oCacic.getCacicPath); | 1315 | ForceDirectories(g_oCacic.getCacicPath); |
| 1312 | end; | 1316 | end; |
| 1313 | 1317 | ||
| 1318 | + LogDebug('Verificando pasta "'+g_oCacic.getCacicPath+'modulos'+'"'); | ||
| 1314 | // Para eliminar versão 20014 e anteriores que provavelmente não fazem corretamente o AutoUpdate | 1319 | // Para eliminar versão 20014 e anteriores que provavelmente não fazem corretamente o AutoUpdate |
| 1315 | if not DirectoryExists(g_oCacic.getCacicPath+'modulos') then | 1320 | if not DirectoryExists(g_oCacic.getCacicPath+'modulos') then |
| 1316 | begin | 1321 | begin |
| @@ -1319,11 +1324,12 @@ begin | @@ -1319,11 +1324,12 @@ begin | ||
| 1319 | LogDiario('Criando pasta '+g_oCacic.getCacicPath+'modulos'); | 1324 | LogDiario('Criando pasta '+g_oCacic.getCacicPath+'modulos'); |
| 1320 | end; | 1325 | end; |
| 1321 | 1326 | ||
| 1327 | + LogDebug('Verificando pasta "'+g_oCacic.getCacicPath+'Temp'+'"'); | ||
| 1322 | // Crio o SubDiretório TEMP, caso não exista | 1328 | // Crio o SubDiretório TEMP, caso não exista |
| 1323 | - if not DirectoryExists(g_oCacic.getCacicPath+'temp') then | 1329 | + if not DirectoryExists(g_oCacic.getCacicPath+'Temp') then |
| 1324 | begin | 1330 | begin |
| 1325 | - ForceDirectories(g_oCacic.getCacicPath + 'temp'); | ||
| 1326 | - LogDiario('Criando pasta '+g_oCacic.getCacicPath+'temp'); | 1331 | + ForceDirectories(g_oCacic.getCacicPath + 'Temp'); |
| 1332 | + LogDiario('Criando pasta '+g_oCacic.getCacicPath+'Temp'); | ||
| 1327 | end; | 1333 | end; |
| 1328 | 1334 | ||
| 1329 | 1335 | ||
| @@ -1361,19 +1367,15 @@ begin | @@ -1361,19 +1367,15 @@ begin | ||
| 1361 | idHTTP1.Free; | 1367 | idHTTP1.Free; |
| 1362 | 1368 | ||
| 1363 | v_retorno := Response_Config.DataString; | 1369 | v_retorno := Response_Config.DataString; |
| 1364 | - v_te_serv_updates := XML_RetornaValor('te_serv_updates' , v_retorno); | ||
| 1365 | - v_nu_porta_serv_updates := XML_RetornaValor('nu_porta_serv_updates' , v_retorno); | ||
| 1366 | - v_nm_usuario_login_serv_updates := XML_RetornaValor('nm_usuario_login_serv_updates', v_retorno); | ||
| 1367 | - v_te_senha_login_serv_updates := XML_RetornaValor('te_senha_login_serv_updates' , v_retorno); | ||
| 1368 | - v_te_path_serv_updates := XML_RetornaValor('te_path_serv_updates' , v_retorno); | 1370 | + LogDebug('Retorno de comunicação com servidor: '+v_retorno); |
| 1369 | 1371 | ||
| 1370 | LogDebug(':::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::'); | 1372 | LogDebug(':::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::'); |
| 1371 | LogDebug(':::::::::::::::: VALORES OBTIDOS NO Gerente WEB :::::::::::::::'); | 1373 | LogDebug(':::::::::::::::: VALORES OBTIDOS NO Gerente WEB :::::::::::::::'); |
| 1372 | LogDebug(':::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::'); | 1374 | LogDebug(':::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::'); |
| 1373 | - LogDebug('Servidor de updates......................: '+v_te_serv_updates); | ||
| 1374 | - LogDebug('Porta do servidor de updates.............: '+v_nu_porta_serv_updates); | ||
| 1375 | - LogDebug('Usuário para login no servidor de updates: '+v_nm_usuario_login_serv_updates); | ||
| 1376 | - LogDebug('Pasta no servidor de updates.............: '+v_te_path_serv_updates); | 1375 | + LogDebug('Servidor de updates......................: '+XML_RetornaValor('te_serv_updates' , v_retorno)); |
| 1376 | + LogDebug('Porta do servidor de updates.............: '+XML_RetornaValor('nu_porta_serv_updates' , v_retorno)); | ||
| 1377 | + LogDebug('Usuário para login no servidor de updates: '+XML_RetornaValor('nm_usuario_login_serv_updates', v_retorno)); | ||
| 1378 | + LogDebug('Pasta no servidor de updates.............: '+XML_RetornaValor('te_path_serv_updates' , v_retorno)); | ||
| 1377 | LogDebug(' '); | 1379 | LogDebug(' '); |
| 1378 | LogDebug('Versões dos Agentes Principais:'); | 1380 | LogDebug('Versões dos Agentes Principais:'); |
| 1379 | LogDebug('------------------------------'); | 1381 | LogDebug('------------------------------'); |
| @@ -1403,7 +1405,7 @@ begin | @@ -1403,7 +1405,7 @@ begin | ||
| 1403 | // Atribuição de acesso ao módulo principal e pastas | 1405 | // Atribuição de acesso ao módulo principal e pastas |
| 1404 | Form1.FS_SetSecurity(g_oCacic.getCacicPath); | 1406 | Form1.FS_SetSecurity(g_oCacic.getCacicPath); |
| 1405 | Form1.FS_SetSecurity(g_oCacic.getCacicPath + 'cacic2.exe'); | 1407 | Form1.FS_SetSecurity(g_oCacic.getCacicPath + 'cacic2.exe'); |
| 1406 | - Form1.FS_SetSecurity(g_oCacic.getCacicPath + 'cacic2.dat'); | 1408 | + Form1.FS_SetSecurity(g_oCacic.getCacicPath + g_oCacic.getDatFileName); |
| 1407 | Form1.FS_SetSecurity(g_oCacic.getCacicPath + 'cacic2.log'); | 1409 | Form1.FS_SetSecurity(g_oCacic.getCacicPath + 'cacic2.log'); |
| 1408 | Form1.FS_SetSecurity(g_oCacic.getCacicPath + 'modulos'); | 1410 | Form1.FS_SetSecurity(g_oCacic.getCacicPath + 'modulos'); |
| 1409 | Form1.FS_SetSecurity(g_oCacic.getCacicPath + 'temp'); | 1411 | Form1.FS_SetSecurity(g_oCacic.getCacicPath + 'temp'); |
| @@ -1494,14 +1496,8 @@ begin | @@ -1494,14 +1496,8 @@ begin | ||
| 1494 | 1496 | ||
| 1495 | // Tento detectar o ChkSis.EXE e copio ou faço FTP caso não exista | 1497 | // Tento detectar o ChkSis.EXE e copio ou faço FTP caso não exista |
| 1496 | verifyAndGet('chksis.exe', | 1498 | verifyAndGet('chksis.exe', |
| 1497 | - XML_RetornaValor('CHKSIS_HASH', v_retorno), | ||
| 1498 | - g_oCacic.getWinDir, | ||
| 1499 | - v_te_serv_updates, | ||
| 1500 | - v_nu_porta_serv_updates, | ||
| 1501 | - v_nm_usuario_login_serv_updates, | ||
| 1502 | - v_te_senha_login_serv_updates, | ||
| 1503 | - v_te_path_serv_updates, | ||
| 1504 | - v_exibe_informacoes); | 1499 | + XML_RetornaValor('TE_HASH_CHKSIS', v_retorno), |
| 1500 | + g_oCacic.getWinDir); | ||
| 1505 | 1501 | ||
| 1506 | // Tento detectar o ChkSis.INI e crio-o caso necessário | 1502 | // Tento detectar o ChkSis.INI e crio-o caso necessário |
| 1507 | If not FileExists(g_oCacic.getWinDir + 'chksis.ini') Then | 1503 | If not FileExists(g_oCacic.getWinDir + 'chksis.ini') Then |
| @@ -1517,14 +1513,8 @@ begin | @@ -1517,14 +1513,8 @@ begin | ||
| 1517 | Begin | 1513 | Begin |
| 1518 | // Tento detectar o CACICsvc.EXE e copio ou faço FTP caso não exista | 1514 | // Tento detectar o CACICsvc.EXE e copio ou faço FTP caso não exista |
| 1519 | verifyAndGet('cacicsvc.exe', | 1515 | verifyAndGet('cacicsvc.exe', |
| 1520 | - XML_RetornaValor('CACICSVC_HASH', v_retorno), | ||
| 1521 | - g_oCacic.getWinDir, | ||
| 1522 | - v_te_serv_updates, | ||
| 1523 | - v_nu_porta_serv_updates, | ||
| 1524 | - v_nm_usuario_login_serv_updates, | ||
| 1525 | - v_te_senha_login_serv_updates, | ||
| 1526 | - v_te_path_serv_updates, | ||
| 1527 | - v_exibe_informacoes); | 1516 | + XML_RetornaValor('TE_HASH_CACICSVC', v_retorno), |
| 1517 | + g_oCacic.getWinDir); | ||
| 1528 | 1518 | ||
| 1529 | // O CACICsvc usará o arquivo de configurações \Windows\chksis.ini | 1519 | // O CACICsvc usará o arquivo de configurações \Windows\chksis.ini |
| 1530 | End; | 1520 | End; |
| @@ -1542,24 +1532,12 @@ begin | @@ -1542,24 +1532,12 @@ begin | ||
| 1542 | 1532 | ||
| 1543 | // Tento detectar o Agente Principal e copio ou faço FTP caso não exista | 1533 | // Tento detectar o Agente Principal e copio ou faço FTP caso não exista |
| 1544 | verifyAndGet('cacic2.exe', | 1534 | verifyAndGet('cacic2.exe', |
| 1545 | - XML_RetornaValor('CACIC2_HASH', v_retorno), | ||
| 1546 | - g_oCacic.getCacicPath, | ||
| 1547 | - v_te_serv_updates, | ||
| 1548 | - v_nu_porta_serv_updates, | ||
| 1549 | - v_nm_usuario_login_serv_updates, | ||
| 1550 | - v_te_senha_login_serv_updates, | ||
| 1551 | - v_te_path_serv_updates, | ||
| 1552 | - v_exibe_informacoes); | 1535 | + XML_RetornaValor('TE_HASH_CACIC2', v_retorno), |
| 1536 | + g_oCacic.getCacicPath); | ||
| 1553 | 1537 | ||
| 1554 | verifyAndGet('ger_cols.exe', | 1538 | verifyAndGet('ger_cols.exe', |
| 1555 | - XML_RetornaValor('GER_COLS_HASH', v_retorno), | ||
| 1556 | - g_oCacic.getCacicPath + 'modulos', | ||
| 1557 | - v_te_serv_updates, | ||
| 1558 | - v_nu_porta_serv_updates, | ||
| 1559 | - v_nm_usuario_login_serv_updates, | ||
| 1560 | - v_te_senha_login_serv_updates, | ||
| 1561 | - v_te_path_serv_updates, | ||
| 1562 | - v_exibe_informacoes); | 1539 | + XML_RetornaValor('TE_HASH_GER_COLS', v_retorno), |
| 1540 | + g_oCacic.getCacicPath + 'modulos'); | ||
| 1563 | 1541 | ||
| 1564 | // Caso exista a pasta "modulos", copio todos os executáveis para a pasta Cacic\modulos, exceto cacic2.exe, ger_cols.exe e chksis.exe | 1542 | // Caso exista a pasta "modulos", copio todos os executáveis para a pasta Cacic\modulos, exceto cacic2.exe, ger_cols.exe e chksis.exe |
| 1565 | if (v_modulos <> '') then | 1543 | if (v_modulos <> '') then |
| @@ -1584,35 +1562,17 @@ begin | @@ -1584,35 +1562,17 @@ begin | ||
| 1584 | 1562 | ||
| 1585 | // Tento detectar (de novo) o ChkSis.EXE e copio ou faço FTP caso não exista | 1563 | // Tento detectar (de novo) o ChkSis.EXE e copio ou faço FTP caso não exista |
| 1586 | verifyAndGet('chksis.exe', | 1564 | verifyAndGet('chksis.exe', |
| 1587 | - XML_RetornaValor('CHKSIS_HASH', v_retorno), | ||
| 1588 | - g_oCacic.getWinDir, | ||
| 1589 | - v_te_serv_updates, | ||
| 1590 | - v_nu_porta_serv_updates, | ||
| 1591 | - v_nm_usuario_login_serv_updates, | ||
| 1592 | - v_te_senha_login_serv_updates, | ||
| 1593 | - v_te_path_serv_updates, | ||
| 1594 | - v_exibe_informacoes); | 1565 | + XML_RetornaValor('TE_HASH_CHKSIS', v_retorno), |
| 1566 | + g_oCacic.getWinDir); | ||
| 1595 | 1567 | ||
| 1596 | // Tento detectar (de novo) o Agente Principal e copio ou faço FTP caso não exista | 1568 | // Tento detectar (de novo) o Agente Principal e copio ou faço FTP caso não exista |
| 1597 | verifyAndGet('cacic2.exe', | 1569 | verifyAndGet('cacic2.exe', |
| 1598 | - XML_RetornaValor('CACIC2_HASH', v_retorno), | ||
| 1599 | - g_oCacic.getCacicPath, | ||
| 1600 | - v_te_serv_updates, | ||
| 1601 | - v_nu_porta_serv_updates, | ||
| 1602 | - v_nm_usuario_login_serv_updates, | ||
| 1603 | - v_te_senha_login_serv_updates, | ||
| 1604 | - v_te_path_serv_updates, | ||
| 1605 | - v_exibe_informacoes); | 1570 | + XML_RetornaValor('TE_HASH_CACIC2', v_retorno), |
| 1571 | + g_oCacic.getCacicPath); | ||
| 1606 | 1572 | ||
| 1607 | verifyAndGet('ger_cols.exe', | 1573 | verifyAndGet('ger_cols.exe', |
| 1608 | - XML_RetornaValor('GER_COLS_HASH', v_retorno), | ||
| 1609 | - g_oCacic.getCacicPath + 'modulos', | ||
| 1610 | - v_te_serv_updates, | ||
| 1611 | - v_nu_porta_serv_updates, | ||
| 1612 | - v_nm_usuario_login_serv_updates, | ||
| 1613 | - v_te_senha_login_serv_updates, | ||
| 1614 | - v_te_path_serv_updates, | ||
| 1615 | - v_exibe_informacoes); | 1574 | + XML_RetornaValor('TE_HASH_GER_COLS', v_retorno), |
| 1575 | + g_oCacic.getCacicPath + 'modulos'); | ||
| 1616 | 1576 | ||
| 1617 | if (g_oCacic.isWindowsNTPlataform) then | 1577 | if (g_oCacic.isWindowsNTPlataform) then |
| 1618 | Begin | 1578 | Begin |
| @@ -1659,7 +1619,7 @@ begin | @@ -1659,7 +1619,7 @@ begin | ||
| 1659 | // Igualo as chaves ip_serv_cacic dos arquivos chksis.ini e cacic2.ini! | 1619 | // Igualo as chaves ip_serv_cacic dos arquivos chksis.ini e cacic2.ini! |
| 1660 | SetValorDatMemoria('Configs.EnderecoServidor', v_ip_serv_cacic); | 1620 | SetValorDatMemoria('Configs.EnderecoServidor', v_ip_serv_cacic); |
| 1661 | LogDebug('Fechando Arquivo de Configurações do Cacic'); | 1621 | LogDebug('Fechando Arquivo de Configurações do Cacic'); |
| 1662 | - CipherClose(g_oCacic.getDatFileName); | 1622 | + CipherClose(g_oCacic.getCacicPath + g_oCacic.getDatFileName); |
| 1663 | 1623 | ||
| 1664 | LogDebug('Abrindo Arquivo de Configurações do ChkSis'); | 1624 | LogDebug('Abrindo Arquivo de Configurações do ChkSis'); |
| 1665 | CipherOpen(g_oCacic.getWinDir + 'chksis.dat'); | 1625 | CipherOpen(g_oCacic.getWinDir + 'chksis.dat'); |
| @@ -1709,9 +1669,9 @@ begin | @@ -1709,9 +1669,9 @@ begin | ||
| 1709 | Begin | 1669 | Begin |
| 1710 | LogDebug('Executando '+g_oCacic.getCacicPath + 'cacic2.exe /ip_serv_cacic=' + v_ip_serv_cacic); | 1670 | LogDebug('Executando '+g_oCacic.getCacicPath + 'cacic2.exe /ip_serv_cacic=' + v_ip_serv_cacic); |
| 1711 | if (strDataHoraCACIC2_INI <> strDataHoraCACIC2_FIM) then | 1671 | if (strDataHoraCACIC2_INI <> strDataHoraCACIC2_FIM) then |
| 1712 | - WinExec(PChar(g_oCacic.getCacicPath + 'cacic2.exe /ip_serv_cacic=' + v_ip_serv_cacic+ ' /execute'), SW_HIDE) | 1672 | + g_oCacic.createSampleProcess(g_oCacic.getCacicPath + 'cacic2.exe /ip_serv_cacic=' + v_ip_serv_cacic+ ' /execute', false) |
| 1713 | else | 1673 | else |
| 1714 | - WinExec(PChar(g_oCacic.getCacicPath + 'cacic2.exe /ip_serv_cacic=' + v_ip_serv_cacic ), SW_HIDE); | 1674 | + g_oCacic.createSampleProcess(g_oCacic.getCacicPath + 'cacic2.exe /ip_serv_cacic=' + v_ip_serv_cacic , false); |
| 1715 | End | 1675 | End |
| 1716 | else | 1676 | else |
| 1717 | Begin | 1677 | Begin |
| @@ -1729,14 +1689,14 @@ begin | @@ -1729,14 +1689,14 @@ begin | ||
| 1729 | if (wordServiceStatus = 0) then | 1689 | if (wordServiceStatus = 0) then |
| 1730 | Begin | 1690 | Begin |
| 1731 | // Instalo e Habilito o serviço | 1691 | // Instalo e Habilito o serviço |
| 1732 | - LogDiario('Instalando CACICservice...'); | ||
| 1733 | - WinExec(PChar(g_oCacic.getWinDir + 'cacicsvc.exe -install'), SW_NORMAL); | 1692 | + LogDiario('Instalando/Iniciando CACICservice...'); |
| 1693 | + g_oCacic.createSampleProcess(g_oCacic.getWinDir + 'cacicsvc.exe -install',false); | ||
| 1734 | End | 1694 | End |
| 1735 | else if ((wordServiceStatus < 4) or | 1695 | else if ((wordServiceStatus < 4) or |
| 1736 | (wordServiceStatus > 4)) then | 1696 | (wordServiceStatus > 4)) then |
| 1737 | Begin | 1697 | Begin |
| 1738 | LogDiario('Iniciando CACICservice'); | 1698 | LogDiario('Iniciando CACICservice'); |
| 1739 | - WinExec(PChar(g_oCacic.getWinDir + 'cacicsvc.exe -start'), SW_NORMAL); | 1699 | + g_oCacic.createSampleProcess(g_oCacic.getWinDir + 'cacicsvc.exe -start', false); |
| 1740 | End | 1700 | End |
| 1741 | else | 1701 | else |
| 1742 | LogDiario('Não instalei o CACICservice. Já está rodando...'); | 1702 | LogDiario('Não instalei o CACICservice. Já está rodando...'); |
| @@ -1757,9 +1717,10 @@ begin | @@ -1757,9 +1717,10 @@ begin | ||
| 1757 | End; | 1717 | End; |
| 1758 | 1718 | ||
| 1759 | try | 1719 | try |
| 1760 | - g_oCacic.Free(); | 1720 | + g_oCacic.Free; |
| 1761 | except | 1721 | except |
| 1762 | end; | 1722 | end; |
| 1723 | + | ||
| 1763 | Application.Terminate; | 1724 | Application.Terminate; |
| 1764 | end; | 1725 | end; |
| 1765 | 1726 |
chksis/chksis.dpr
| @@ -640,7 +640,7 @@ begin | @@ -640,7 +640,7 @@ begin | ||
| 640 | v_cacic_dir := GetValorChaveRegIni('Cacic2', 'cacic_dir' , ExtractFilePath(ParamStr(0)) + 'chksis.ini'); | 640 | v_cacic_dir := GetValorChaveRegIni('Cacic2', 'cacic_dir' , ExtractFilePath(ParamStr(0)) + 'chksis.ini'); |
| 641 | v_rem_cacic_v0x := GetValorChaveRegIni('Cacic2', 'rem_cacic_v0x', ExtractFilePath(ParamStr(0)) + 'chksis.ini'); | 641 | v_rem_cacic_v0x := GetValorChaveRegIni('Cacic2', 'rem_cacic_v0x', ExtractFilePath(ParamStr(0)) + 'chksis.ini'); |
| 642 | 642 | ||
| 643 | - g_oCacic.setCacicPath(g_oCacic.getHomeDrive + v_cacic_dir +'\'); | 643 | + g_oCacic.setCacicPath(v_cacic_dir); |
| 644 | 644 | ||
| 645 | v_Debugs := false; | 645 | v_Debugs := false; |
| 646 | if DirectoryExists(g_oCacic.getCacicPath + 'Temp\Debugs') then | 646 | if DirectoryExists(g_oCacic.getCacicPath + 'Temp\Debugs') then |
| @@ -804,28 +804,7 @@ begin | @@ -804,28 +804,7 @@ begin | ||
| 804 | 804 | ||
| 805 | // 5 segundos para espera de possível FTP... | 805 | // 5 segundos para espera de possível FTP... |
| 806 | Sleep(5000); | 806 | Sleep(5000); |
| 807 | - { | ||
| 808 | - Try | ||
| 809 | - // Crio a chave/valor chksis para autoexecução do Cacic, caso não exista esta chave/valor | ||
| 810 | - log_diario('Setando chave HLM../Run com ' + HomeDrive + '\chksis.exe'); | ||
| 811 | - SetValorChaveRegEdit('HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion\Run\CheckSystemRoutine', HomeDrive + '\chksis.exe'); | ||
| 812 | - Except | ||
| 813 | - End; | ||
| 814 | 807 | ||
| 815 | - | ||
| 816 | - bool_ExistsAutoRun := false; | ||
| 817 | - if (GetValorChaveRegEdit('HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion\Run\cacic2')=Dir + '\cacic2.exe') then | ||
| 818 | - bool_ExistsAutoRun := true | ||
| 819 | - else | ||
| 820 | - Begin | ||
| 821 | - Try | ||
| 822 | - // Crio a chave/valor cacic2 para autoexecução do Cacic, caso não exista esta chave/valor | ||
| 823 | - log_diario('Setando chave HLM../Run com ' + Dir + '\cacic2.exe'); | ||
| 824 | - SetValorChaveRegEdit('HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion\Run\cacic2', Dir + '\cacic2.exe'); | ||
| 825 | - Except | ||
| 826 | - End; | ||
| 827 | - End; | ||
| 828 | - } | ||
| 829 | // Caso o Cacic tenha sido baixado executo-o com parâmetro de configuração de servidor | 808 | // Caso o Cacic tenha sido baixado executo-o com parâmetro de configuração de servidor |
| 830 | if Posso_Rodar_CACIC or not bool_ExistsAutoRun then | 809 | if Posso_Rodar_CACIC or not bool_ExistsAutoRun then |
| 831 | Begin | 810 | Begin |
| @@ -833,9 +812,9 @@ begin | @@ -833,9 +812,9 @@ begin | ||
| 833 | 812 | ||
| 834 | // Caso tenha havido download de agentes principais, executar coletas imediatamente... | 813 | // Caso tenha havido download de agentes principais, executar coletas imediatamente... |
| 835 | if (bool_download_CACIC2) then | 814 | if (bool_download_CACIC2) then |
| 836 | - WinExec(PChar(g_oCacic.getCacicPath + 'cacic2.exe /ip_serv_cacic=' + v_ip_serv_cacic+ ' /execute'), SW_HIDE) | 815 | + g_oCacic.createSampleProcess(g_oCacic.getCacicPath + 'cacic2.exe /ip_serv_cacic=' + v_ip_serv_cacic+ ' /execute', false) |
| 837 | else | 816 | else |
| 838 | - WinExec(PChar(g_oCacic.getCacicPath + 'cacic2.exe /ip_serv_cacic=' + v_ip_serv_cacic ), SW_HIDE); | 817 | + g_oCacic.createSampleProcess(g_oCacic.getCacicPath + 'cacic2.exe /ip_serv_cacic=' + v_ip_serv_cacic , false); |
| 839 | End; | 818 | End; |
| 840 | end; | 819 | end; |
| 841 | 820 | ||
| @@ -845,6 +824,8 @@ const | @@ -845,6 +824,8 @@ const | ||
| 845 | begin | 824 | begin |
| 846 | g_oCacic := TCACIC.Create(); | 825 | g_oCacic := TCACIC.Create(); |
| 847 | 826 | ||
| 827 | + g_oCacic.setBoolCipher(true); | ||
| 828 | + | ||
| 848 | if( not g_oCacic.isAppRunning( CACIC_APP_NAME ) ) | 829 | if( not g_oCacic.isAppRunning( CACIC_APP_NAME ) ) |
| 849 | then begin | 830 | then begin |
| 850 | if (FindWindowByTitle('chkcacic') = 0) and (FindWindowByTitle('cacic2') = 0) | 831 | if (FindWindowByTitle('chkcacic') = 0) and (FindWindowByTitle('cacic2') = 0) |
chksis/chksis.res
No preview for this file type
col_anvi/col_anvi.dpr
| @@ -28,12 +28,15 @@ uses | @@ -28,12 +28,15 @@ uses | ||
| 28 | PJVersionInfo, | 28 | PJVersionInfo, |
| 29 | CACIC_Library in '..\CACIC_Library.pas'; | 29 | CACIC_Library in '..\CACIC_Library.pas'; |
| 30 | 30 | ||
| 31 | -var v_strCipherClosed : String; | 31 | +var |
| 32 | + v_strCipherClosed : String; | ||
| 32 | 33 | ||
| 33 | -var v_Debugs : boolean; | 34 | +var |
| 35 | + v_Debugs : boolean; | ||
| 34 | 36 | ||
| 35 | -var v_tstrCipherOpened, | ||
| 36 | - v_tstrCipherOpened1 : TStrings; | 37 | +var |
| 38 | + v_tstrCipherOpened, | ||
| 39 | + v_tstrCipherOpened1 : TStrings; | ||
| 37 | 40 | ||
| 38 | var | 41 | var |
| 39 | g_oCacic : TCACIC; | 42 | g_oCacic : TCACIC; |
| @@ -391,48 +394,57 @@ end; | @@ -391,48 +394,57 @@ end; | ||
| 391 | 394 | ||
| 392 | var tstrTripa1 : TStrings; | 395 | var tstrTripa1 : TStrings; |
| 393 | intAux : integer; | 396 | intAux : integer; |
| 394 | - v_path_cacic : String; | 397 | + strAux : String; |
| 395 | const | 398 | const |
| 396 | CACIC_APP_NAME = 'col_anvi'; | 399 | CACIC_APP_NAME = 'col_anvi'; |
| 397 | 400 | ||
| 398 | begin | 401 | begin |
| 399 | g_oCacic := TCACIC.Create(); | 402 | g_oCacic := TCACIC.Create(); |
| 400 | 403 | ||
| 404 | + g_oCacic.setBoolCipher(true); | ||
| 405 | + | ||
| 401 | if( not g_oCacic.isAppRunning( CACIC_APP_NAME ) ) then | 406 | if( not g_oCacic.isAppRunning( CACIC_APP_NAME ) ) then |
| 402 | if (ParamCount>0) then | 407 | if (ParamCount>0) then |
| 403 | - Begin | ||
| 404 | - //Pegarei o nível anterior do diretório, que deve ser, por exemplo \Cacic, para leitura do cacic2.ini | ||
| 405 | - tstrTripa1 := g_oCacic.explode(ExtractFilePath(ParamStr(0)),'\'); | ||
| 406 | - v_path_cacic := ''; | ||
| 407 | - For intAux := 0 to tstrTripa1.Count -2 do | ||
| 408 | - v_path_cacic := v_path_cacic + tstrTripa1[intAux] + '\'; | ||
| 409 | - | ||
| 410 | - g_oCacic.setCacicPath(v_path_cacic); | ||
| 411 | - | ||
| 412 | - v_Debugs := false; | ||
| 413 | - if DirectoryExists(g_oCacic.getCacicPath + 'Temp\Debugs') then | ||
| 414 | - Begin | ||
| 415 | - if (FormatDateTime('ddmmyyyy', GetFolderDate(g_oCacic.getCacicPath + 'Temp\Debugs')) = FormatDateTime('ddmmyyyy', date)) then | 408 | + Begin |
| 409 | + strAux := ''; | ||
| 410 | + For intAux := 1 to ParamCount do | ||
| 411 | + Begin | ||
| 412 | + if LowerCase(Copy(ParamStr(intAux),1,11)) = '/cacicpath=' then | ||
| 413 | + begin | ||
| 414 | + strAux := Trim(Copy(ParamStr(intAux),12,Length((ParamStr(intAux))))); | ||
| 415 | + log_DEBUG('Parâmetro /CacicPath recebido com valor="'+strAux+'"'); | ||
| 416 | + end; | ||
| 417 | + end; | ||
| 418 | + | ||
| 419 | + if (strAux <> '') then | ||
| 416 | Begin | 420 | Begin |
| 417 | - v_Debugs := true; | ||
| 418 | - log_diario('Pasta "' + g_oCacic.getCacicPath + 'Temp\Debugs" com data '+FormatDateTime('dd-mm-yyyy', GetFolderDate(g_oCacic.getCacicPath + 'Temp\Debugs'))+' encontrada. DEBUG ativado.'); | 421 | + g_oCacic.setCacicPath(strAux); |
| 422 | + | ||
| 423 | + v_Debugs := false; | ||
| 424 | + if DirectoryExists(g_oCacic.getCacicPath + 'Temp\Debugs') then | ||
| 425 | + Begin | ||
| 426 | + if (FormatDateTime('ddmmyyyy', GetFolderDate(g_oCacic.getCacicPath + 'Temp\Debugs')) = FormatDateTime('ddmmyyyy', date)) then | ||
| 427 | + Begin | ||
| 428 | + v_Debugs := true; | ||
| 429 | + log_diario('Pasta "' + g_oCacic.getCacicPath + 'Temp\Debugs" com data '+FormatDateTime('dd-mm-yyyy', GetFolderDate(g_oCacic.getCacicPath + 'Temp\Debugs'))+' encontrada. DEBUG ativado.'); | ||
| 430 | + End; | ||
| 419 | End; | 431 | End; |
| 420 | - End; | ||
| 421 | - | ||
| 422 | - v_tstrCipherOpened := TStrings.Create; | ||
| 423 | - v_tstrCipherOpened := CipherOpen(g_oCacic.getDatFileName); | ||
| 424 | 432 | ||
| 425 | - v_tstrCipherOpened1 := TStrings.Create; | ||
| 426 | - v_tstrCipherOpened1 := CipherOpen(g_oCacic.getCacicPath + 'temp\col_anvi.dat'); | 433 | + v_tstrCipherOpened := TStrings.Create; |
| 434 | + v_tstrCipherOpened := CipherOpen(g_oCacic.getCacicPath + g_oCacic.getDatFileName); | ||
| 427 | 435 | ||
| 428 | - Try | ||
| 429 | - Executa_Col_Anvi; | ||
| 430 | - Except | ||
| 431 | - Begin | ||
| 432 | - SetValorDatMemoria('Col_Anvi.nada', 'nada', v_tstrCipherOpened1); | ||
| 433 | - CipherClose(g_oCacic.getCacicPath + 'temp\col_anvi.dat', v_tstrCipherOpened1); | ||
| 434 | - End; | ||
| 435 | - End; | 436 | + v_tstrCipherOpened1 := TStrings.Create; |
| 437 | + v_tstrCipherOpened1 := CipherOpen(g_oCacic.getCacicPath + 'temp\col_anvi.dat'); | ||
| 438 | + | ||
| 439 | + Try | ||
| 440 | + Executa_Col_Anvi; | ||
| 441 | + Except | ||
| 442 | + Begin | ||
| 443 | + SetValorDatMemoria('Col_Anvi.nada', 'nada', v_tstrCipherOpened1); | ||
| 444 | + CipherClose(g_oCacic.getCacicPath + 'temp\col_anvi.dat', v_tstrCipherOpened1); | ||
| 445 | + End; | ||
| 446 | + End; | ||
| 447 | + End; | ||
| 436 | End; | 448 | End; |
| 437 | g_oCacic.Free(); | 449 | g_oCacic.Free(); |
| 438 | end. | 450 | end. |
col_anvi/col_anvi.res
No preview for this file type
col_comp/col_comp.dpr
| @@ -25,12 +25,15 @@ uses | @@ -25,12 +25,15 @@ uses | ||
| 25 | Registry, | 25 | Registry, |
| 26 | CACIC_Library in '..\CACIC_Library.pas'; | 26 | CACIC_Library in '..\CACIC_Library.pas'; |
| 27 | 27 | ||
| 28 | -var v_strCipherClosed : String; | 28 | +var |
| 29 | + v_strCipherClosed : String; | ||
| 29 | 30 | ||
| 30 | -var v_tstrCipherOpened, | ||
| 31 | - v_tstrCipherOpened1 : TStrings; | 31 | +var |
| 32 | + v_tstrCipherOpened, | ||
| 33 | + v_tstrCipherOpened1 : TStrings; | ||
| 32 | 34 | ||
| 33 | -var g_oCacic : TCACIC; | 35 | +var |
| 36 | + g_oCacic : TCACIC; | ||
| 34 | 37 | ||
| 35 | procedure log_diario(strMsg : String); | 38 | procedure log_diario(strMsg : String); |
| 36 | var | 39 | var |
| @@ -140,7 +143,6 @@ begin | @@ -140,7 +143,6 @@ begin | ||
| 140 | Result := ''; | 143 | Result := ''; |
| 141 | end; | 144 | end; |
| 142 | 145 | ||
| 143 | - | ||
| 144 | function GetRootKey(strRootKey: String): HKEY; | 146 | function GetRootKey(strRootKey: String): HKEY; |
| 145 | begin | 147 | begin |
| 146 | /// Encontrar uma maneira mais elegante de fazer esses testes. | 148 | /// Encontrar uma maneira mais elegante de fazer esses testes. |
| @@ -343,37 +345,46 @@ end; | @@ -343,37 +345,46 @@ end; | ||
| 343 | 345 | ||
| 344 | var tstrTripa1 : TStrings; | 346 | var tstrTripa1 : TStrings; |
| 345 | intAux : integer; | 347 | intAux : integer; |
| 346 | - v_path_cacic : String; | 348 | + strAux : String; |
| 347 | 349 | ||
| 348 | const | 350 | const |
| 349 | CACIC_APP_NAME = 'col_comp'; | 351 | CACIC_APP_NAME = 'col_comp'; |
| 350 | 352 | ||
| 351 | begin | 353 | begin |
| 352 | g_oCacic := TCACIC.Create(); | 354 | g_oCacic := TCACIC.Create(); |
| 353 | - if( not g_oCacic.isAppRunning( CACIC_APP_NAME ) ) then | ||
| 354 | - if (ParamCount>0) then | ||
| 355 | - Begin | ||
| 356 | - //Pegarei o nível anterior do diretório, que deve ser, por exemplo \Cacic, para leitura do cacic2.ini | ||
| 357 | - tstrTripa1 := g_oCacic.explode(ExtractFilePath(ParamStr(0)),'\'); | ||
| 358 | - v_path_cacic := ''; | ||
| 359 | - For intAux := 0 to tstrTripa1.Count -2 do | ||
| 360 | - v_path_cacic := v_path_cacic + tstrTripa1[intAux] + '\'; | ||
| 361 | 355 | ||
| 362 | - g_oCacic.setCacicPath(v_path_cacic); | 356 | + g_oCacic.setBoolCipher(true); |
| 363 | 357 | ||
| 364 | - v_tstrCipherOpened := TStrings.Create; | ||
| 365 | - v_tstrCipherOpened := CipherOpen(g_oCacic.getDatFileName); | ||
| 366 | - | ||
| 367 | - v_tstrCipherOpened1 := TStrings.Create; | ||
| 368 | - v_tstrCipherOpened1 := CipherOpen(g_oCacic.getCacicPath + 'temp\col_comp.dat'); | ||
| 369 | - | ||
| 370 | - Try | ||
| 371 | - Executa_Col_comp; | ||
| 372 | - Except | ||
| 373 | - SetValorDatMemoria('Col_Comp.nada', 'nada', v_tstrCipherOpened1); | ||
| 374 | - CipherClose(g_oCacic.getCacicPath + 'temp\col_comp.dat', v_tstrCipherOpened1); | ||
| 375 | - End; | ||
| 376 | - Halt(0); | ||
| 377 | - End; | 358 | + if( not g_oCacic.isAppRunning( CACIC_APP_NAME ) ) then |
| 359 | + if (ParamCount>0) then | ||
| 360 | + Begin | ||
| 361 | + strAux := ''; | ||
| 362 | + For intAux := 1 to ParamCount do | ||
| 363 | + Begin | ||
| 364 | + if LowerCase(Copy(ParamStr(intAux),1,11)) = '/cacicpath=' then | ||
| 365 | + begin | ||
| 366 | + strAux := Trim(Copy(ParamStr(intAux),12,Length((ParamStr(intAux))))); | ||
| 367 | + end; | ||
| 368 | + end; | ||
| 369 | + | ||
| 370 | + if (strAux <> '') then | ||
| 371 | + Begin | ||
| 372 | + g_oCacic.setCacicPath(strAux); | ||
| 373 | + | ||
| 374 | + v_tstrCipherOpened := TStrings.Create; | ||
| 375 | + v_tstrCipherOpened := CipherOpen(g_oCacic.getCacicPath + g_oCacic.getDatFileName); | ||
| 376 | + | ||
| 377 | + v_tstrCipherOpened1 := TStrings.Create; | ||
| 378 | + v_tstrCipherOpened1 := CipherOpen(g_oCacic.getCacicPath + 'temp\col_comp.dat'); | ||
| 379 | + | ||
| 380 | + Try | ||
| 381 | + Executa_Col_comp; | ||
| 382 | + Except | ||
| 383 | + SetValorDatMemoria('Col_Comp.nada', 'nada', v_tstrCipherOpened1); | ||
| 384 | + CipherClose(g_oCacic.getCacicPath + 'temp\col_comp.dat', v_tstrCipherOpened1); | ||
| 385 | + End; | ||
| 386 | + Halt(0); | ||
| 387 | + End; | ||
| 388 | + End; | ||
| 378 | g_oCacic.Free(); | 389 | g_oCacic.Free(); |
| 379 | end. | 390 | end. |
col_comp/col_comp.res
No preview for this file type
col_hard/col_hard.dpr
| @@ -39,7 +39,6 @@ uses | @@ -39,7 +39,6 @@ uses | ||
| 39 | CACIC_Library in '..\CACIC_Library.pas'; | 39 | CACIC_Library in '..\CACIC_Library.pas'; |
| 40 | 40 | ||
| 41 | var | 41 | var |
| 42 | - v_path_cacic, | ||
| 43 | v_mensagem, | 42 | v_mensagem, |
| 44 | v_strCipherClosed : String; | 43 | v_strCipherClosed : String; |
| 45 | v_debugs : boolean; | 44 | v_debugs : boolean; |
| @@ -538,7 +537,7 @@ var v_te_cpu_fabricante, | @@ -538,7 +537,7 @@ var v_te_cpu_fabricante, | ||
| 538 | v_registry : TRegistry; | 537 | v_registry : TRegistry; |
| 539 | 538 | ||
| 540 | begin | 539 | begin |
| 541 | - g_oCacic := TCACIC.Create(); | 540 | + |
| 542 | Try | 541 | Try |
| 543 | SetValorDatMemoria('Col_Hard.Inicio', FormatDateTime('hh:nn:ss', Now), v_tstrCipherOpened1); | 542 | SetValorDatMemoria('Col_Hard.Inicio', FormatDateTime('hh:nn:ss', Now), v_tstrCipherOpened1); |
| 544 | v_Report := TStringList.Create; | 543 | v_Report := TStringList.Create; |
| @@ -955,47 +954,51 @@ begin | @@ -955,47 +954,51 @@ begin | ||
| 955 | g_oCacic.Free(); | 954 | g_oCacic.Free(); |
| 956 | end; | 955 | end; |
| 957 | 956 | ||
| 957 | +var strAux : String; | ||
| 958 | begin | 958 | begin |
| 959 | g_oCacic := TCACIC.Create(); | 959 | g_oCacic := TCACIC.Create(); |
| 960 | 960 | ||
| 961 | + g_oCacic.setBoolCipher(true); | ||
| 962 | + | ||
| 961 | if( not g_oCacic.isAppRunning( CACIC_APP_NAME ) ) then | 963 | if( not g_oCacic.isAppRunning( CACIC_APP_NAME ) ) then |
| 962 | if (ParamCount>0) then | 964 | if (ParamCount>0) then |
| 963 | - Begin | ||
| 964 | - //Pegarei o nível anterior do diretório, que deve ser, por exemplo \Cacic, para leitura do cacic2.ini | ||
| 965 | - tstrTripa1 := g_oCacic.explode(ExtractFilePath(ParamStr(0)),'\'); | ||
| 966 | - v_path_cacic := ''; | ||
| 967 | - intAux :=0; | ||
| 968 | - While intAux < tstrTripa1.Count -1 do | ||
| 969 | - begin | ||
| 970 | - v_path_cacic := v_path_cacic + tstrTripa1[intAux] + '\'; | ||
| 971 | - intAux := intAux + 1 | ||
| 972 | - end; | ||
| 973 | - | ||
| 974 | - g_oCacic.setCacicPath(v_path_cacic); | ||
| 975 | - | ||
| 976 | - v_tstrCipherOpened := TStrings.Create; | ||
| 977 | - v_tstrCipherOpened := CipherOpen(g_oCacic.getDatFileName); | ||
| 978 | - | ||
| 979 | - v_tstrCipherOpened1 := TStrings.Create; | ||
| 980 | - v_tstrCipherOpened1 := CipherOpen(g_oCacic.getCacicPath + 'temp\col_hard.dat'); | ||
| 981 | - | ||
| 982 | - Try | ||
| 983 | - v_Debugs := false; | ||
| 984 | - if DirectoryExists(g_oCacic.getCacicPath + 'Temp\Debugs') then | ||
| 985 | - Begin | ||
| 986 | - if (FormatDateTime('ddmmyyyy', GetFolderDate(g_oCacic.getCacicPath + 'Temp\Debugs')) = FormatDateTime('ddmmyyyy', date)) then | ||
| 987 | - Begin | ||
| 988 | - v_Debugs := true; | ||
| 989 | - log_diario('Pasta "' + g_oCacic.getCacicPath + 'Temp\Debugs" com data '+FormatDateTime('dd-mm-yyyy', GetFolderDate(g_oCacic.getCacicPath + 'Temp\Debugs'))+' encontrada. DEBUG ativado.'); | ||
| 990 | - End; | ||
| 991 | - End; | ||
| 992 | - Executa_Col_Hard; | ||
| 993 | - Except | ||
| 994 | - SetValorDatMemoria('Col_Hard.nada', 'nada', v_tstrCipherOpened1); | ||
| 995 | - CipherClose(g_oCacic.getCacicPath + 'temp\col_hard.dat', v_tstrCipherOpened1); | ||
| 996 | - End; | ||
| 997 | - End; | 965 | + Begin |
| 966 | + strAux := ''; | ||
| 967 | + For intAux := 1 to ParamCount do | ||
| 968 | + Begin | ||
| 969 | + if LowerCase(Copy(ParamStr(intAux),1,11)) = '/cacicpath=' then | ||
| 970 | + begin | ||
| 971 | + strAux := Trim(Copy(ParamStr(intAux),12,Length((ParamStr(intAux))))); | ||
| 972 | + log_DEBUG('Parâmetro /CacicPath recebido com valor="'+strAux+'"'); | ||
| 973 | + end; | ||
| 974 | + end; | ||
| 998 | 975 | ||
| 999 | - g_oCacic.Free(); | 976 | + if (strAux <> '') then |
| 977 | + Begin | ||
| 978 | + g_oCacic.setCacicPath(strAux); | ||
| 979 | + | ||
| 980 | + v_tstrCipherOpened := TStrings.Create; | ||
| 981 | + v_tstrCipherOpened := CipherOpen(g_oCacic.getCacicPath + g_oCacic.getDatFileName); | ||
| 982 | + | ||
| 983 | + v_tstrCipherOpened1 := TStrings.Create; | ||
| 984 | + v_tstrCipherOpened1 := CipherOpen(g_oCacic.getCacicPath + 'temp\col_hard.dat'); | ||
| 985 | + | ||
| 986 | + Try | ||
| 987 | + v_Debugs := false; | ||
| 988 | + if DirectoryExists(g_oCacic.getCacicPath + 'Temp\Debugs') then | ||
| 989 | + Begin | ||
| 990 | + if (FormatDateTime('ddmmyyyy', GetFolderDate(g_oCacic.getCacicPath + 'Temp\Debugs')) = FormatDateTime('ddmmyyyy', date)) then | ||
| 991 | + Begin | ||
| 992 | + v_Debugs := true; | ||
| 993 | + log_diario('Pasta "' + g_oCacic.getCacicPath + 'Temp\Debugs" com data '+FormatDateTime('dd-mm-yyyy', GetFolderDate(g_oCacic.getCacicPath + 'Temp\Debugs'))+' encontrada. DEBUG ativado.'); | ||
| 994 | + End; | ||
| 995 | + End; | ||
| 996 | + Executa_Col_Hard; | ||
| 997 | + Except | ||
| 998 | + SetValorDatMemoria('Col_Hard.nada', 'nada', v_tstrCipherOpened1); | ||
| 999 | + CipherClose(g_oCacic.getCacicPath + 'temp\col_hard.dat', v_tstrCipherOpened1); | ||
| 1000 | + End; | ||
| 1001 | + End; | ||
| 1002 | + End; | ||
| 1000 | 1003 | ||
| 1001 | end. | 1004 | end. |
col_hard/col_hard.res
No preview for this file type
col_moni/col_moni.res
No preview for this file type
col_patr/col_patr.res
No preview for this file type
col_soft/col_soft.res
No preview for this file type
col_undi/col_undi.res
No preview for this file type
ger_cols/ger_cols.res
No preview for this file type
ini_cols/ini_cols.res
No preview for this file type
mapa/mapacacic.res
No preview for this file type